:root {
  /* Brand - biru & magenta */
  --brand-blue-deep: #16215c;
  --brand-blue: #223b9e;
  --brand-magenta: #c81c8f;
  --brand-magenta-deep: #9c1471;
  --brand-gradient: linear-gradient(135deg, var(--brand-blue-deep) 0%, var(--brand-blue) 45%, var(--brand-magenta) 100%);

  --ink: #16215c;
  --ink-soft: #52598f;
  --paper: #ffffff;
  --paper-muted: #f4f5fb;
  --line: #dfe1f2;

  /* Status - SENGAJA dipertahankan hijau/merah universal (sinyal keselamatan
     operasional: boleh/tidak boleh kasih souvenir), bukan bagian dari brand. */
  --go: #2d6a4f;
  --go-soft: #e6f2ec;
  --wait: #b8781e;
  --wait-soft: #fbeed9;
  --stop: #a83c34;
  --stop-soft: #f8e6e4;

  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper-muted);
  color: var(--ink);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  padding-bottom: 32px;
}

.topbar {
  background: var(--brand-gradient);
  color: #fff;
  padding: 16px 20px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 10px rgba(22, 33, 92, 0.25);
}

.topbar h1 {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.01em;
  padding-right: 130px; /* ruang untuk badge kanan atas */
}

.topbar .sub {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.78);
  margin-top: 2px;
  padding-right: 130px;
}

.topbar .sub a { color: #ffd9f0; }

.topbar-actions {
  position: absolute;
  top: 14px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.conn-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.conn-badge.offline { background: rgba(168, 60, 52, 0.9); }

.conn-badge .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
}

.lang-toggle {
  font-size: 12px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--brand-magenta-deep);
  border: none;
  cursor: pointer;
  letter-spacing: 0.03em;
}

.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 0;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}

.field input[type="text"],
.field input[type="tel"],
.field input[type="email"] {
  width: 100%;
  padding: 12px 13px;
  font-size: 16px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
}

.field input:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(34, 59, 158, 0.12);
}

.field .hint {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 4px;
}

.radio-group {
  display: flex;
  gap: 10px;
}

.radio-option {
  flex: 1;
  position: relative;
}

.radio-option input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.radio-option .box {
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  font-weight: 600;
  font-size: 15px;
  color: var(--ink-soft);
}

.radio-option input:checked + .box {
  border-color: var(--brand-blue);
  background: var(--brand-gradient);
  color: #fff;
}

.btn {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 9px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font);
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-magenta) 100%);
  color: #fff;
}

.btn-primary:active { opacity: 0.88; }

.btn-secondary {
  background: transparent;
  border: 1.5px solid var(--line);
  color: var(--ink);
  margin-top: 10px;
}

.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
  margin: 22px 0 10px;
  padding: 0 2px;
}

.entry-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
  background: var(--paper);
}

.entry-row .name {
  flex: 1;
  font-weight: 600;
  font-size: 14.5px;
}

.entry-row .sub {
  font-size: 12px;
  color: var(--ink-soft);
}

.status-pill {
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Warna status TETAP hijau/merah/amber - lihat catatan di :root */
.status-pending { background: var(--wait-soft); color: var(--wait); }
.status-success { background: var(--go-soft); color: var(--go); }
.status-rejected { background: var(--stop-soft); color: var(--stop); }

.empty-state {
  text-align: center;
  color: var(--ink-soft);
  font-size: 13.5px;
  padding: 24px 0;
}

.setup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(22, 33, 92, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.setup-box {
  background: #fff;
  border-radius: var(--radius);
  padding: 22px;
  max-width: 360px;
  width: 100%;
}

.setup-box h2 { font-size: 16px; margin: 0 0 12px; color: var(--ink); }

/* ---- Modal popup hasil (menggantikan banner permanen) ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(22, 33, 92, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal-box {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 24px 20px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  font-weight: 600;
  font-size: 15px;
}

.modal-box.result-pending { background: var(--wait-soft); color: var(--wait); }
.modal-box.result-success { background: var(--go-soft); color: var(--go); }
.modal-box.result-rejected { background: var(--stop-soft); color: var(--stop); }

.modal-box .big { font-size: 21px; margin-bottom: 8px; }

.modal-box .btn-primary {
  background: var(--brand-gradient);
}

/* ---- Dashboard ---- */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.stat-box {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.stat-box .num {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  color: var(--ink);
}

.stat-box .label {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 6px;
  font-weight: 600;
}

.stat-box.hero {
  grid-column: span 2;
  background: var(--brand-gradient);
  color: #fff;
}

.stat-box.hero .num { font-size: 40px; color: #fff; }
.stat-box.hero .label { color: rgba(255, 255, 255, 0.85); }

table.device-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.device-table td, table.device-table th {
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
