/* ==========================================================================
   Bro Gateway — dashboard stylesheet
   Tanpa build step: satu file, custom properties, dark/light mode.

   Aturan yang dipegang konsisten di seluruh file:
   - Satu keluarga aksen (emerald) untuk kedua mode. Terang dan gelap berbagi
     hue yang sama; yang berubah hanya luminansi dan warna tinta di atasnya.
   - Skala radius eksplisit lima tingkat: chip 5px, kontrol 8px, ubin 10px,
     permukaan 12px, pil penuh. Tidak ada radius di luar kelima token itu,
     kecuali 50% untuk elemen yang memang berbentuk lingkaran.
   - Setiap pasangan teks/latar sudah diverifikasi >= 4.5:1 (WCAG AA) di
     kedua mode, termasuk teks di atas tombol aksen.
   - Gerak bersifat fungsional saja (hover, active, focus). Seluruhnya
     dimatikan pada prefers-reduced-motion.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Font (self-hosted, tunduk pada CSP font-src 'self')
   -------------------------------------------------------------------------- */

@font-face {
  font-family: 'Geist';
  src: url('/fonts/Geist-Variable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Geist Mono';
  src: url('/fonts/GeistMono-Variable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   2. Token
   -------------------------------------------------------------------------- */

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --surface-3: #e7eaef;
  --line: #e2e6ec;
  --line-strong: #cdd4dd;

  --text: #0f141a;
  --text-muted: #525c68;
  --text-faint: #606b78;

  --accent: #0a7d57;
  --accent-hover: #086b4a;
  --accent-ink: #ffffff;
  --accent-text: #076848;
  --accent-soft: rgba(10, 125, 87, 0.09);
  --accent-line: rgba(10, 125, 87, 0.28);

  --success: #0f7048;
  --success-soft: rgba(15, 112, 72, 0.1);
  --warn: #8a5a0b;
  --warn-soft: rgba(138, 90, 11, 0.1);
  --danger: #b3261e;
  --danger-soft: rgba(179, 38, 30, 0.09);
  --info: #1a5fb4;
  --info-soft: rgba(26, 95, 180, 0.09);

  /* Bayangan diberi rona latar, tidak pernah hitam murni. */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 6px 20px -6px rgba(15, 23, 42, 0.12), 0 2px 6px -2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 24px 48px -20px rgba(15, 23, 42, 0.22);
  --ring: 0 0 0 3px rgba(10, 125, 87, 0.22);

  /* Skala radius: hanya kelima nilai ini yang boleh dipakai. */
  --r-chip: 5px;
  --r-control: 8px;
  --r-surface: 12px;
  --r-tile: 10px;
  --r-pill: 999px;

  --sidebar-w: 246px;
  --topbar-h: 60px;
  /* Kolom konten dipusatkan di dalam .main. Lebar dipersempit dari 1360px
     agar mata tidak menyapu terlalu jauh secara horizontal. */
  --content-max: 1200px;
  --content-narrow: 880px;

  --font: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.2, 0, 0, 1);
  --dur: 140ms;
}

[data-theme='dark'] {
  --bg: #0b0f14;
  --surface: #12181f;
  --surface-2: #182029;
  --surface-3: #1f2833;
  --line: #242e3a;
  --line-strong: #33404f;

  --text: #e9eef5;
  --text-muted: #a4b1bf;
  --text-faint: #8d9aa9;

  --accent: #2fd07d;
  --accent-hover: #46dd8e;
  --accent-ink: #04120b;
  --accent-text: #4fdd97;
  --accent-soft: rgba(47, 208, 125, 0.12);
  --accent-line: rgba(47, 208, 125, 0.32);

  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.13);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.13);
  --danger: #fb8a84;
  --danger-soft: rgba(251, 138, 132, 0.13);
  --info: #7cb2f7;
  --info-soft: rgba(124, 178, 247, 0.13);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.7), 0 2px 6px -2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 28px 56px -24px rgba(0, 0, 0, 0.85);
  --ring: 0 0 0 3px rgba(47, 208, 125, 0.28);
}

/* Cadangan bila JavaScript penyetel tema tidak sempat berjalan. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0b0f14;
    --surface: #12181f;
    --surface-2: #182029;
    --surface-3: #1f2833;
    --line: #242e3a;
    --line-strong: #33404f;
    --text: #e9eef5;
    --text-muted: #a4b1bf;
    --text-faint: #8d9aa9;
    --accent: #2fd07d;
    --accent-hover: #46dd8e;
    --accent-ink: #04120b;
    --accent-text: #4fdd97;
    --accent-soft: rgba(47, 208, 125, 0.12);
    --accent-line: rgba(47, 208, 125, 0.32);
    --success: #4ade80;
    --success-soft: rgba(74, 222, 128, 0.13);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.13);
    --danger: #fb8a84;
    --danger-soft: rgba(251, 138, 132, 0.13);
    --info: #7cb2f7;
    --info-soft: rgba(124, 178, 247, 0.13);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.7), 0 2px 6px -2px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 28px 56px -24px rgba(0, 0, 0, 0.85);
    --ring: 0 0 0 3px rgba(47, 208, 125, 0.28);
  }
}

/* --------------------------------------------------------------------------
   3. Dasar
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.55;
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent-text);
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 4px;
  font-weight: 600;
  letter-spacing: -0.018em;
  line-height: 1.25;
  color: var(--text);
}
h1 { font-size: 22px; letter-spacing: -0.024em; }
h2 { font-size: 15.5px; }
h3 { font-size: 13.5px; }
p { margin: 0 0 12px; }

hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 20px 0;
}

/* Fokus keyboard harus selalu terlihat. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-control);
}

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

code,
pre,
.mono {
  font-family: var(--mono);
  font-size: 12.5px;
  font-variant-ligatures: none;
}
code {
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: var(--r-chip);
  color: var(--text);
}
pre {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-surface);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 14px;
  line-height: 1.65;
}
pre code {
  background: none;
  border: none;
  padding: 0;
}

/* Angka pada tabel dan metrik harus sejajar kolom. */
.table td,
.stat__value,
.kv dd {
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   4. Kerangka halaman
   -------------------------------------------------------------------------- */

.app {
  display: flex;
  min-height: 100dvh;
}

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
  scrollbar-width: thin;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 14px;
  font-weight: 650;
  font-size: 14.5px;
  color: var(--text);
  letter-spacing: -0.02em;
}
.sidebar__brand:hover {
  text-decoration: none;
  color: var(--text);
}

.sidebar__logo {
  width: 30px;
  height: 30px;
  border-radius: var(--r-tile);
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-size: 17px;
  flex: 0 0 30px;
}

.sidebar__section {
  padding: 14px 16px 6px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
}

.sidebar__nav {
  padding: 0 10px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--r-control);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.sidebar__link:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}
.sidebar__link.is-active {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}
/* Penanda aktif berupa batang tipis, bukan sekadar perbedaan warna. */
.sidebar__link.is-active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 0 var(--r-pill) var(--r-pill) 0;
  background: var(--accent);
}
.sidebar__link .ico {
  width: 17px;
  font-size: 17px;
  text-align: center;
  flex: 0 0 17px;
  opacity: 0.9;
}

.sidebar__footer {
  margin-top: auto;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-faint);
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0;
  /* Latar solid dideklarasikan lebih dulu sebagai cadangan bila color-mix
     tidak didukung; tanpa ini topbar bisa menjadi transparan penuh. */
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
@supports not (backdrop-filter: blur(1px)) {
  .topbar { background: var(--surface); }
}
/* Isi topbar disejajarkan dengan kolom konten di bawahnya. */
.topbar__inner {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.main:has(.content--narrow) .topbar__inner { max-width: var(--content-narrow); }

.topbar__title {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.topbar__spacer { flex: 1; }

.content {
  padding: 22px 24px 56px;
  max-width: var(--content-max);
  width: 100%;
  /* Tanpa ini kolom menempel ke kiri dan menyisakan ruang kosong besar di
     kanan pada layar lebar. Dipusatkan terhadap .main, bukan viewport,
     karena sidebar adalah bingkai aplikasi bukan bagian dari kanvas. */
  margin-inline: auto;
}

/* Halaman yang isinya satu kolom teks/form: kolom lebih sempit lagi. */
.content--narrow { max-width: var(--content-narrow); }

.page-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-head__text { flex: 1; min-width: 240px; }
.page-head__sub {
  color: var(--text-muted);
  font-size: 13px;
  margin: 3px 0 0;
  /* Baris teks panjang melelahkan untuk dibaca; batasi ukurannya. */
  max-width: 78ch;
}
.page-head__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   5. Permukaan
   -------------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-surface);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  overflow: hidden;
}

.card__head {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.card__head h2,
.card__head h3 { margin: 0; }
.card__head .spacer { flex: 1; }

.card__body { padding: 16px; }
.card__body--flush { padding: 0; }

.card__foot {
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 12.5px;
  color: var(--text-muted);
}

.grid { display: grid; gap: 16px; }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--sidebar { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

/* --------------------------------------------------------------------------
   6. Metrik
   -------------------------------------------------------------------------- */

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-surface);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.stat__label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  font-weight: 600;
  margin-bottom: 7px;
}
.stat__value {
  font-size: 27px;
  font-weight: 620;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.stat__hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 5px;
}
.stat--accent .stat__value { color: var(--accent-text); }
.stat--danger .stat__value { color: var(--danger); }
.stat--warn .stat__value { color: var(--warn); }

/* --------------------------------------------------------------------------
   7. Tombol
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: var(--r-control);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
    transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.btn:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
  text-decoration: none;
  color: var(--text);
}
/* Umpan balik taktil: tombol terasa ditekan. */
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled,
.btn.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-ink);
}

.btn--danger {
  background: transparent;
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
  color: var(--danger);
}
.btn--danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
.btn--ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn--sm { padding: 4px 9px; font-size: 12.5px; }
.btn--block { width: 100%; }

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* --------------------------------------------------------------------------
   8. Form
   -------------------------------------------------------------------------- */

.field { margin-bottom: 14px; }
.field__label {
  display: block;
  font-size: 12.5px;
  font-weight: 550;
  margin-bottom: 5px;
  color: var(--text);
}
.field__hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 5px;
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 7px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input::placeholder,
.textarea::placeholder { color: var(--text-faint); }
.input:hover,
.select:hover,
.textarea:hover { border-color: var(--text-faint); }
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}
.input:disabled,
.select:disabled,
.textarea:disabled {
  background: var(--surface-2);
  color: var(--text-faint);
  cursor: not-allowed;
}
.textarea { min-height: 112px; resize: vertical; line-height: 1.6; }
.input--mono { font-family: var(--mono); font-size: 12.5px; }

.select {
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13px;
  padding: 5px 0;
  cursor: pointer;
}
.checkbox input {
  margin: 3px 0 0;
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
}
.checkbox__text small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.filters .field { margin-bottom: 0; min-width: 140px; }

/* --------------------------------------------------------------------------
   9. Tabel
   -------------------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  text-align: left;
  padding: 9px 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  font-weight: 600;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--dur) var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }

.td-truncate {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-muted);
}
.empty__icon {
  font-size: 30px;
  line-height: 1;
  margin-bottom: 12px;
  color: var(--text-faint);
  opacity: 0.7;
}
.empty h3 { margin-bottom: 4px; }

/* --------------------------------------------------------------------------
   10. Badge, alert
   -------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface-3);
  color: var(--text-muted);
  border: 1px solid transparent;
}
.badge--success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 22%, transparent); }
.badge--danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 22%, transparent); }
.badge--warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 22%, transparent); }
.badge--info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 22%, transparent); }
.badge--accent { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-line); }

/* Titik status hanya dipakai untuk keadaan semantik nyata (koneksi device). */
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 6px;
}
.dot--pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 14px;
  border-radius: var(--r-surface);
  border: 1px solid var(--line);
  background: var(--surface);
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text);
}
.alert .ph { font-size: 17px; flex: 0 0 auto; margin-top: 1px; }
.alert--success { border-color: color-mix(in srgb, var(--success) 40%, transparent); background: var(--success-soft); }
.alert--success .ph { color: var(--success); }
.alert--error { border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: var(--danger-soft); }
.alert--error .ph { color: var(--danger); }
.alert--warn { border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: var(--warn-soft); }
.alert--warn .ph { color: var(--warn); }
.alert--info { border-color: color-mix(in srgb, var(--info) 40%, transparent); background: var(--info-soft); }
.alert--info .ph { color: var(--info); }
.alert strong { font-weight: 650; }

/* --------------------------------------------------------------------------
   12. QR
   -------------------------------------------------------------------------- */

.qr-panel {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.qr-box {
  width: 264px;
  height: 264px;
  border: 1px solid var(--line);
  border-radius: var(--r-surface);
  /* QR harus selalu gelap di atas putih agar terbaca kamera. */
  background: #ffffff;
  display: grid;
  place-items: center;
  padding: 12px;
  flex: 0 0 auto;
}
.qr-box img { width: 100%; height: 100%; object-fit: contain; display: block; }
.qr-box__placeholder {
  color: #4b5563;
  text-align: center;
  font-size: 13px;
  padding: 20px;
}
.qr-box__placeholder .ph { font-size: 34px; display: block; margin-bottom: 10px; }
.qr-steps { flex: 1; min-width: 260px; }
.qr-steps ol { margin: 0; padding-left: 20px; color: var(--text-muted); }
.qr-steps li { margin-bottom: 7px; }
.qr-steps b { color: var(--text); }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   13. Grafik
   -------------------------------------------------------------------------- */

.chart { width: 100%; height: 220px; display: block; }
.chart-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
}
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 9px; height: 9px; border-radius: var(--r-chip); display: inline-block; }

/* --------------------------------------------------------------------------
   14. Rahasia sekali-tampil
   -------------------------------------------------------------------------- */

/* Daftar fitur pada kartu paket. */
.plan-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13px;
}
.plan-list li {
  position: relative;
  padding: 5px 0 5px 20px;
  border-bottom: 1px solid var(--line);
  color: var(--text-muted);
}
.plan-list li:last-child { border-bottom: none; }
.plan-list li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 12px;
  width: 6px;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--accent);
}
/* Fitur yang tidak termasuk paket: dibedakan warna DAN dicoret, bukan warna saja. */
.plan-list__off {
  text-decoration: line-through;
  color: var(--text-faint);
}
.plan-list__off::before { background: var(--text-faint); }

/* Sel token di tabel: kode bisa memanjang, tombol tetap di tempatnya. */
.token-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.token-cell code {
  min-width: 132px;
  word-break: break-all;
}

.secret-box {
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-surface);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.secret-box code {
  flex: 1;
  min-width: 220px;
  background: transparent;
  border: none;
  word-break: break-all;
  font-size: 13px;
  padding: 0;
}

/* --------------------------------------------------------------------------
   15. Linimasa
   -------------------------------------------------------------------------- */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative;
  padding: 0 0 16px 22px;
  border-left: 2px solid var(--line);
  margin-left: 6px;
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
}
.timeline__time { font-size: 12px; color: var(--text-faint); }

/* --------------------------------------------------------------------------
   16. Halaman auth
   -------------------------------------------------------------------------- */

/* Layar auth dibagi dua: kolom tugas di kiri, panel bukti di kanan.
   Sebelumnya berupa kartu 404px yang melayang di tengah, susunan bawaan yang
   aman tapi tidak menunjukkan sedang masuk ke produk apa. */
.auth {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.auth__form {
  display: grid;
  place-items: center;
  padding: 40px 28px;
  background: var(--surface);
}
.auth__inner { width: 100%; max-width: 384px; }

.auth__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.022em;
  margin-bottom: 34px;
}
.auth__brand:hover { text-decoration: none; color: var(--text); }
.auth__mark {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: var(--r-tile);
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-size: 16px;
}

.auth__title {
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: -0.035em;
  font-weight: 630;
  margin: 0 0 6px;
}
.auth__sub {
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.55;
  margin: 0 0 26px;
  max-width: 46ch;
}

/* Kolom tugas: kontrol dibuat lebih longgar daripada di dashboard karena di
   sini hanya ada dua isian dan targetnya sering disentuh di ponsel. */
.auth__form .field { margin-bottom: 16px; }
.auth__form .input { padding: 10px 13px; font-size: 14.5px; }
.auth__form .btn--block { padding: 11px 18px; font-size: 14.5px; margin-top: 4px; }

.auth__foot {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-muted);
}

/* Panel bukti. Satu warna memikul separuh layar; tidak ada gradien, kaca,
   atau ilustrasi stok. Warnanya diverifikasi 10.31:1 terhadap teks putih. */
.auth__aside {
  background: #064a34;
  color: #ffffff;
  /* Di mode terang batas putih-hijau sudah tegas sendiri. Di mode gelap kedua
     paruh berdekatan nilainya, jadi garis ini yang menjaga batasnya terbaca. */
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  display: grid;
  place-items: center;
  padding: 48px 44px;
}
.auth__aside-inner { max-width: 430px; }

.auth__pitch {
  font-size: 32px;
  line-height: 1.08;
  letter-spacing: -0.04em;
  font-weight: 640;
  margin: 0 0 30px;
}

.auth__points { list-style: none; margin: 0 0 28px; padding: 0; }
.auth__points li {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 11px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 14px;
  line-height: 1.55;
  color: #d8ece2;
}
.auth__points li .ph {
  color: #7fd3a8;
  font-size: 18px;
  flex: 0 0 18px;
  margin-top: 1px;
}

.auth__code {
  background: #043323;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--r-surface);
  padding: 14px 16px;
  margin: 0 0 22px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  color: #cfe4d9;
}
.auth__code code { background: none; border: none; padding: 0; color: inherit; font-size: inherit; }
.auth__code .a-str { color: #8fd3a4; }
.auth__code .a-fn { color: #f0c987; }

.auth__aside-foot {
  font-size: 12.5px;
  color: #9ccbb6;
  margin: 0;
}

/* --------------------------------------------------------------------------
   17. Navigasi sekunder
   -------------------------------------------------------------------------- */

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  padding: 9px 13px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.is-active {
  color: var(--accent-text);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  padding: 14px;
  flex-wrap: wrap;
}
.pagination a,
.pagination span {
  padding: 5px 10px;
  border-radius: var(--r-control);
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--text-muted);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.pagination a:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}
.pagination .is-current {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.kv {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 9px 16px;
  font-size: 13px;
}
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; word-break: break-word; }

/* --------------------------------------------------------------------------
   18. Utilitas
   -------------------------------------------------------------------------- */

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.hidden { display: none !important; }
.inline-form { display: inline; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.flex { display: flex; gap: 10px; align-items: center; }
.flex-between {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: 16px; }

.copy-btn { cursor: pointer; }
.scrollbox { max-height: 340px; overflow-y: auto; }

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: var(--text);
  color: var(--surface);
  padding: 9px 16px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 550;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  opacity: 0;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
  pointer-events: none;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

.menu-toggle { display: none; }

/* --------------------------------------------------------------------------
   19. Responsif
   -------------------------------------------------------------------------- */

/* Panel bukti menyingkir sebelum kolomnya menyempit sampai teksnya patah.
   Halaman tetap utuh: kolom tugas mengambil seluruh lebar. */
@media (max-width: 900px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth__aside { display: none; }
  .auth__form { padding: 36px 22px; }
}

@media (max-width: 1100px) {
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--sidebar,
  .grid--3,
  .grid--2 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
  .grid--4 { grid-template-columns: minmax(0, 1fr); }
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .kv dd { margin-bottom: 10px; }

  .sidebar {
    position: fixed;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 200ms var(--ease);
  }
  .sidebar.is-open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .menu-toggle { display: inline-flex; }

  .content { padding: 16px 14px 44px; }
  .topbar__inner { padding: 0 14px; }
  h1 { font-size: 19px; }
  .stat__value { font-size: 23px; }
  .qr-box { width: 100%; height: auto; aspect-ratio: 1; }
}

/* --------------------------------------------------------------------------
   20. Gerak dikurangi
   Seluruh transisi dan animasi dimatikan; tidak ada informasi yang hilang
   karena gerak di sini hanya bersifat umpan balik.
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .btn:active { transform: none; }
  .dot--pulse { animation: none; }
}

/* --------------------------------------------------------------------------
   21. Cetak
   -------------------------------------------------------------------------- */

@media print {
  .sidebar,
  .topbar,
  .page-head__actions,
  .btn { display: none !important; }
  .content { padding: 0; max-width: none; margin-inline: 0; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
}

/* --------------------------------------------------------------------------
   22. Modal
   Memakai elemen <dialog> native: focus trap, tombol Esc, dan inert pada
   latar belakang sudah ditangani browser, jadi tidak perlu ditulis ulang.
   -------------------------------------------------------------------------- */

.modal {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-surface);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

.modal::backdrop {
  background: rgba(9, 14, 20, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.modal__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.modal__title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
  flex: 1;
}
.modal__close {
  border: none;
  background: transparent;
  color: var(--text-faint);
  font-size: 18px;
  line-height: 1;
  padding: 4px;
  border-radius: var(--r-control);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.modal__close:hover { background: var(--surface-2); color: var(--text); }

.modal__body { padding: 18px; }
.modal__foot {
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.modal__hint {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 12px 0 0;
}

/* Grid pilihan besar, mis. metode penautan device. */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 480px) {
  .choice-grid { grid-template-columns: minmax(0, 1fr); }
  .auth__title { font-size: 24px; }
  .auth__brand { margin-bottom: 26px; }
}

.choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 13px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}
.choice:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
  color: var(--text);
}
.choice:active { transform: translateY(1px); }
.choice:focus-visible { outline: none; box-shadow: var(--ring); }
.choice .ph { font-size: 20px; color: var(--accent-text); }
.choice small {
  font-weight: 450;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

/* --------------------------------------------------------------------------
   23. Toggle
   -------------------------------------------------------------------------- */

.switch {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  padding: 4px 0;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.switch__track {
  position: relative;
  width: 34px;
  height: 20px;
  flex: 0 0 34px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
  margin-top: 1px;
}
.switch__track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease);
}
.switch input:checked + .switch__track {
  background: var(--accent);
  border-color: var(--accent);
}
.switch input:checked + .switch__track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch__track { box-shadow: var(--ring); }
.switch__text { font-size: 13px; }
.switch__text small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 1px;
}

/* --------------------------------------------------------------------------
   24. Menu overflow
   Aksi sekunder disembunyikan di sini supaya kolom aksi tidak berubah
   menjadi deretan tombol yang terulang di setiap baris tabel.
   -------------------------------------------------------------------------- */

.menu { position: relative; display: inline-block; }
/*
 * Panel memakai position: fixed, bukan absolute.
 *
 * Panel ini punya DUA leluhur yang memotong: .table-wrap (overflow-x: auto)
 * dan .card (overflow: hidden). Menurut spesifikasi CSS, begitu satu sumbu
 * bukan `visible`, sumbu lainnya ikut menjadi `auto`, jadi .table-wrap
 * memotong kedua arah. Panel absolute akan terpotong sekaligus memperbesar
 * area scroll, sehingga scrollbar vertikal liar muncul dan isi baris ikut
 * tergeser ke luar pandangan. Elemen fixed tidak terpotong oleh overflow
 * leluhur; koordinatnya dihitung dari posisi tombol pemicu di
 * public/js/app.js, dan menu ditutup saat halaman di-scroll.
 */
.menu__panel {
  position: fixed;
  min-width: 184px;
  max-width: calc(100vw - 24px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  box-shadow: var(--shadow);
  padding: 5px;
  z-index: 70;
  display: none;
}
.menu.is-open .menu__panel { display: block; }
.menu__item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 9px;
  border: none;
  background: transparent;
  border-radius: var(--r-chip);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}
.menu__item:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.menu__item .ph { font-size: 15px; color: var(--text-faint); }
.menu__item--danger { color: var(--danger); }
.menu__item--danger .ph { color: var(--danger); }
.menu__item--danger:hover { background: var(--danger-soft); color: var(--danger); }
.menu__sep { height: 1px; background: var(--line); margin: 5px 0; }

/* --------------------------------------------------------------------------
   25. Sel tabel device
   -------------------------------------------------------------------------- */

.device-id { display: flex; flex-direction: column; gap: 3px; }
.device-id__name { font-weight: 600; font-size: 13.5px; letter-spacing: -0.01em; }
.device-id__phone {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Baris meta bericon: label tetap ditulis, ikon hanya penanda visual. */
.meta-list { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; }
.meta-list__row { display: flex; align-items: center; gap: 7px; color: var(--text-muted); }
.meta-list__row .ph { font-size: 14px; color: var(--text-faint); flex: 0 0 14px; }
.meta-list__row b { color: var(--text); font-weight: 550; }

.actions-cell {
  display: flex;
  gap: 7px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   26. Kode pairing
   -------------------------------------------------------------------------- */

.pair-code {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-align: center;
  padding: 18px 12px;
  border: 1px dashed var(--accent-line);
  border-radius: var(--r-surface);
  background: var(--accent-soft);
  color: var(--accent-text);
  user-select: all;
  word-break: break-all;
}
