/* ---------- token warna: gelap (default) & terang ---------- */
:root {
  --bg: #05070d;
  --bg-grid: rgba(120, 160, 255, 0.07);
  --surface: #0c121f;
  --surface-2: #111a2b;
  --surface-glass: rgba(12, 18, 31, 0.86);
  --field: #070b14;
  --line: rgba(120, 160, 255, 0.11);
  --line-2: rgba(120, 160, 255, 0.2);
  --text: #f2f5fd;
  --muted: #8d98b3;
  --dim: #5d6884;
  --accent: #2f7bff;
  --accent-2: #5aa0ff;
  --accent-text: #7fb4ff;
  --accent-soft: rgba(47, 123, 255, 0.14);
  --accent-line: rgba(90, 160, 255, 0.45);
  --glow: rgba(47, 123, 255, 0.35);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.12);
  --danger: #ff5a68;
  --danger-soft: rgba(255, 90, 104, 0.12);
  --shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.8);
  --toggle-off: #1b2439;
  --checker-a: #0a0f1b;
  --checker-b: #070b14;
  --radius: 16px;
  --font: "Inter", system-ui, "Segoe UI", Roboto, sans-serif;
  --display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --header-h: 58px;
  --nav-h: 0px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f2f5fa;
    --bg-grid: rgba(30, 60, 140, 0.05);
    --surface: #ffffff;
    --surface-2: #f5f7fb;
    --surface-glass: rgba(255, 255, 255, 0.9);
    --field: #ffffff;
    --line: rgba(20, 40, 90, 0.09);
    --line-2: rgba(20, 40, 90, 0.16);
    --text: #0d1529;
    --muted: #556180;
    --dim: #8792aa;
    --accent: #2563eb;
    --accent-2: #3b82f6;
    --accent-text: #1d4ed8;
    --accent-soft: rgba(37, 99, 235, 0.09);
    --accent-line: rgba(37, 99, 235, 0.4);
    --glow: rgba(37, 99, 235, 0.25);
    --ok: #059669;
    --ok-soft: rgba(5, 150, 105, 0.1);
    --warn: #b45309;
    --warn-soft: rgba(217, 119, 6, 0.1);
    --danger: #dc2626;
    --danger-soft: rgba(220, 38, 38, 0.08);
    --shadow: 0 14px 34px -18px rgba(20, 40, 90, 0.35);
    --toggle-off: #d5dbe7;
    --checker-a: #e9edf4;
    --checker-b: #f4f6fa;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f2f5fa;
  --bg-grid: rgba(30, 60, 140, 0.05);
  --surface: #ffffff;
  --surface-2: #f5f7fb;
  --surface-glass: rgba(255, 255, 255, 0.9);
  --field: #ffffff;
  --line: rgba(20, 40, 90, 0.09);
  --line-2: rgba(20, 40, 90, 0.16);
  --text: #0d1529;
  --muted: #556180;
  --dim: #8792aa;
  --accent: #2563eb;
  --accent-2: #3b82f6;
  --accent-text: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.09);
  --accent-line: rgba(37, 99, 235, 0.4);
  --glow: rgba(37, 99, 235, 0.25);
  --ok: #059669;
  --ok-soft: rgba(5, 150, 105, 0.1);
  --warn: #b45309;
  --warn-soft: rgba(217, 119, 6, 0.1);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.08);
  --shadow: 0 14px 34px -18px rgba(20, 40, 90, 0.35);
  --toggle-off: #d5dbe7;
  --checker-a: #e9edf4;
  --checker-b: #f4f6fa;
  color-scheme: light;
}
:root[data-theme="dark"] { color-scheme: dark; }

/* ---------- dasar ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background-image: linear-gradient(var(--bg-grid) 1px, transparent 1px), linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 90% 55% at 50% 0%, #000 25%, transparent 75%);
}
body.no-scroll { overflow: hidden; }
input, select, button, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -0.01em; line-height: 1.2; }
p { margin: 0; }
a { color: var(--accent-text); text-decoration: none; }
b { font-weight: 700; }
.min0 { min-width: 0; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.num { font-variant-numeric: tabular-nums; }
.ok-text { color: var(--ok); }
.err-text { color: var(--danger); }
.warn-text { color: var(--warn); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

/* ---------- tombol ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  border: 1px solid transparent; border-radius: 12px; padding: 10px 18px; font-weight: 700; cursor: pointer;
  transition: transform .12s, box-shadow .2s, background .2s, border-color .2s, opacity .2s; white-space: nowrap;
  text-decoration: none; position: relative;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.loading { color: transparent !important; }
.btn.loading::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .7s linear infinite;
}
.btn.ghost.loading::after { border-color: var(--line-2); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }
.btn.primary {
  background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #fff;
  box-shadow: 0 8px 24px -10px var(--glow), inset 0 1px 0 rgba(255,255,255,.22);
}
.btn.danger { background: var(--danger); color: #fff; }
.btn.ok { background: var(--ok); color: #fff; }
.btn.ghost { background: var(--surface); border-color: var(--line-2); color: var(--text); font-weight: 600; }
.btn.ghost:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.btn.soft { background: var(--accent-soft); color: var(--accent-text); }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 13.5px; border-radius: 10px; }
.btn.lg { min-height: 52px; font-size: 16px; border-radius: 14px; }
.btn.full { width: 100%; }
.btn.link { background: none; border: 0; color: var(--accent-text); padding: 4px 0; min-height: 0; font-weight: 600; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--text); cursor: pointer; flex: none;
}
.icon-btn:hover { border-color: var(--accent-line); }

/* ---------- form ---------- */
.input {
  background: var(--field); border: 1px solid var(--line-2); border-radius: 12px; padding: 11px 13px; width: 100%;
  outline: none; transition: border-color .2s, box-shadow .2s; min-height: 44px; font-size: 16px;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.sm { padding: 7px 10px; font-size: 14px; width: auto; min-height: 38px; border-radius: 10px; }
select.input { cursor: pointer; }
textarea.input { resize: vertical; }
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.field .help { font-weight: 500; color: var(--dim); font-size: 12.5px; }
.form-grid { display: grid; gap: 14px; }

.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; color: var(--muted); font-size: 14px; user-select: none; min-height: 36px; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle span {
  width: 38px; height: 22px; border-radius: 22px; background: var(--toggle-off); position: relative; transition: background .2s; flex: none;
}
.toggle span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: left .2s;
}
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::after { left: 19px; }
.toggle input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }

.seg { display: flex; background: var(--field); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button {
  flex: 1; border: 0; background: none; color: var(--muted); padding: 8px 12px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 13.5px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; min-height: 36px;
}
.seg button:disabled { opacity: .45; cursor: not-allowed; }
.seg button.on { background: var(--accent-soft); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent-line); }
.seg button .c { font-size: 11px; color: var(--dim); font-weight: 700; }
.seg button.on .c { color: var(--accent-text); }
.seg.scroll-x { overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.seg.scroll-x::-webkit-scrollbar { display: none; }
.seg.scroll-x button { flex: 0 0 auto; }
.seg.wrap { flex-wrap: wrap; }
.seg.wrap button { flex: 1 0 auto; }

/* ---------- kartu & daftar ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.card-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-title h2 { font-size: 17px; }
.sec-title { font: 600 12.5px var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--dim); margin: 22px 2px 10px; }
.hint { color: var(--muted); font-size: 13px; }
.hint b { color: var(--text); }

/* minmax(0,1fr): teks nowrap di dalam baris tidak boleh melebarkan daftar melewati layar. */
.list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.list > li > a, .list > li.row {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; color: inherit; min-height: 56px;
}
.list > li > a:hover, .list > li > a:active { background: var(--accent-soft); }
.list .av {
  width: 42px; height: 42px; border-radius: 12px; flex: none; display: grid; place-items: center; font: 700 16px var(--display);
  background: var(--accent-soft); border: 1px solid var(--line-2); color: var(--accent-text);
}
.list .t { min-width: 0; flex: 1; }
.list .t .ttl { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .end { text-align: right; font-size: 13px; color: var(--muted); flex: none; }
.list .chev { color: var(--dim); flex: none; }
.list-empty { text-align: center; color: var(--muted); padding: 34px 16px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap;
}
.pill b { color: var(--text); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 800;
}
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.ok { color: var(--ok); background: var(--ok-soft); }
.status.warn { color: var(--warn); background: var(--warn-soft); }
.status.err { color: var(--danger); background: var(--danger-soft); }
.status.info { color: var(--accent-text); background: var(--accent-soft); }
.status.mute { color: var(--muted); background: var(--surface-2); }

.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; font-size: 14px; border: 1px solid; margin-bottom: 14px; }
.banner.info { background: var(--accent-soft); border-color: var(--accent-line); }
.banner.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.banner.err { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.banner.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }

.progress { height: 8px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #38d6ff); border-radius: 8px; transition: width .4s; }
.progress.indet i { width: 35%; animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }

.empty {
  text-align: center; padding: 48px 20px; border: 1px dashed var(--line-2); border-radius: 18px; color: var(--muted); background: var(--surface);
}
.empty h3 { color: var(--text); font-size: 17px; margin-bottom: 6px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- toast & modal ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 20px); transform: translate(-50%, 20px); z-index: 100;
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.3);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }

.modal-wrap {
  position: fixed; inset: 0; z-index: 90; background: rgba(2, 5, 12, .55); display: grid; align-items: end; justify-items: center;
  opacity: 0; transition: opacity .18s; backdrop-filter: blur(3px);
}
.modal-wrap.show { opacity: 1; }
.modal {
  width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 22px 22px 0 0;
  padding: 22px 18px calc(18px + var(--safe-b)); transform: translateY(30px); transition: transform .2s; max-height: 90dvh; overflow: auto;
}
.modal-wrap.show .modal { transform: none; }
.modal h3 { font-size: 19px; margin-bottom: 8px; }
.modal-body { color: var(--muted); font-size: 14.5px; margin-bottom: 18px; }
.modal-body b { color: var(--text); }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
@media (min-width: 600px) {
  .modal-wrap { align-items: center; }
  .modal { border-radius: 20px; padding: 24px; }
}

::-webkit-scrollbar { width: 10px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.grow { flex: 1; min-width: 0; }
