/* DRW IT — token warna di :root, mode gelap dipilih (bukan dibalik otomatis). */
:root {
  color-scheme: light;
  --bg: #f4f4f2;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --border: #e2e1dc;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #7a7974;
  --accent: #256abf;
  --accent-ink: #ffffff;
  --accent-soft: #e6effb;
  --series-1: #2a78d6;  /* terbayar */
  --series-2: #eb6834;  /* belum lunas */
  --bar: #2a78d6;
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --good-soft: #e3f4e3; --warning-soft: #fdf1d6; --serious-soft: #fbe6dd; --critical-soft: #f8e0e0;
  --status-ink: #0b0b0b;
  --grid: #e8e7e3;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  --radius: 10px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --border: #2f2f2c;
    --text: #ffffff; --text-2: #c3c2b7; --muted: #9a998f;
    --accent: #3987e5; --accent-ink: #ffffff; --accent-soft: #1b2a3d;
    --series-1: #3987e5; --series-2: #d95926; --bar: #3987e5;
    --good-soft: #17301a; --warning-soft: #3a2e12; --serious-soft: #3b2418; --critical-soft: #3d1a1a;
    --status-ink: #ffffff; --grid: #2a2a27;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --border: #2f2f2c;
  --text: #ffffff; --text-2: #c3c2b7; --muted: #9a998f;
  --accent: #3987e5; --accent-ink: #ffffff; --accent-soft: #1b2a3d;
  --series-1: #3987e5; --series-2: #d95926; --bar: #3987e5;
  --good-soft: #17301a; --warning-soft: #3a2e12; --serious-soft: #3b2418; --critical-soft: #3d1a1a;
  --status-ink: #ffffff; --grid: #2a2a27;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 620; }
h3 { font-size: 14px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; }
.boot { padding: 40px; color: var(--muted); }
.hidden { display: none !important; }

/* ── Kerangka ── */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-in { max-width: 1280px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 16px; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; white-space: nowrap; color: var(--text); }
.brand:hover { text-decoration: none; }
.logo { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); display: grid; place-items: center; color: #fff; }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav a { padding: 7px 11px; border-radius: 8px; color: var(--text-2); white-space: nowrap; font-weight: 500; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.user { display: flex; align-items: center; gap: 8px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); object-fit: cover; }
.main { max-width: 1280px; margin: 0 auto; padding: 20px 16px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── Komponen ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px 0; }
.card-head .sub { color: var(--muted); font-size: 12px; }
.grid { display: grid; gap: 16px; }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-2 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
@media (max-width: 900px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

.kpi { padding: 14px 16px; }
.kpi .label { color: var(--text-2); font-size: 12px; font-weight: 500; }
.kpi .value { font-size: 22px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi .foot { color: var(--muted); font-size: 12px; margin-top: 2px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--critical); }
.btn.sm { padding: 4px 8px; font-size: 12px; border-radius: 7px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.icon { width: 16px; height: 16px; flex: none; }

input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { min-height: 70px; resize: vertical; }
input[type=checkbox] { width: auto; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); font-weight: 550; }
label.f .help { font-weight: 400; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 600px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters > * { width: auto; }
.filters input[type=search] { min-width: 220px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; color: var(--text-2); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
td .sub { color: var(--muted); font-size: 12px; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 560;
  background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.good { background: var(--good-soft); color: var(--status-ink); } .badge.good .dot { background: var(--good); }
.badge.warning { background: var(--warning-soft); color: var(--status-ink); } .badge.warning .dot { background: var(--warning); }
.badge.serious { background: var(--serious-soft); color: var(--status-ink); } .badge.serious .dot { background: var(--serious); }
.badge.critical { background: var(--critical-soft); color: var(--status-ink); } .badge.critical .dot { background: var(--critical); }
.badge.info { background: var(--accent-soft); color: var(--accent); }
.tag { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); font-size: 11px; font-weight: 550; }

.alerts { display: flex; flex-direction: column; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 16px; border-bottom: 1px solid var(--border); color: var(--text); }
.alert:last-child { border-bottom: 0; }
.alert:hover { background: var(--surface-2); text-decoration: none; }
.alert .sev { flex: none; margin-top: 2px; }
.alert.critical .sev { color: var(--critical); } .alert.serious .sev { color: var(--serious); } .alert.warning .sev { color: var(--warning); }

.note { padding: 12px 14px; border-radius: 8px; background: var(--accent-soft); color: var(--text); font-size: 13px; }
.note.warn { background: var(--warning-soft); }
.note ul { margin: 6px 0 0; padding-left: 18px; }

/* Kartu metode pembayaran */
.pm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.pm { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.pm .pan { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 16px; letter-spacing: .08em; }
.pm.inactive { opacity: .6; }

/* Detail */
.dl { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 6px 12px; margin: 0; }
.dl dt { color: var(--muted); font-size: 12px; padding-top: 1px; }
.dl dd { margin: 0; word-break: break-word; }
@media (max-width: 600px) { .dl { grid-template-columns: minmax(0, 1fr); } .dl dd { margin-bottom: 6px; } }

/* Chart */
.chart { position: relative; padding: 8px 16px 12px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { fill: var(--muted); font-size: 11px; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 8px 16px 0; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow); padding: 8px 10px; font-size: 12px; min-width: 160px; z-index: 5; }
.tip .row { display: flex; justify-content: space-between; gap: 12px; }
.tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.hbars { padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.hbar .top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.hbar .track { height: 8px; background: var(--surface-2); border-radius: 4px; margin-top: 4px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--bar); border-radius: 0 4px 4px 0; }

/* Modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { width: min(720px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: 12px; border: 1px solid var(--border); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-body { padding: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--surface); }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: calc(100vw - 32px); }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 420px; }
.toast.err { background: var(--critical); color: #fff; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 8px 12px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.active { color: var(--accent); border-color: var(--accent); }
.tabs a:hover { text-decoration: none; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(900px 480px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.login-wrap { width: min(420px, 100%); }
.login-card { padding: 32px; border-radius: 14px; }
.login-brand { display: flex; align-items: center; gap: 12px; padding-bottom: 20px; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.login-brand .logo { width: 40px; height: 40px; border-radius: 10px; }
.login-brand .logo .icon { width: 22px; height: 22px; }
.login-name { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.login-tag { font-size: 12px; color: var(--muted); }
.login h1 { font-size: 22px; margin: 0 0 8px; }
.login-lead { margin: 0 0 20px; color: var(--text-2); line-height: 1.55; }
.login-btn { width: 100%; justify-content: center; padding: 11px 16px; font-size: 15px; border-radius: 9px; }
.login-err { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; margin-bottom: 16px; border-radius: 8px;
  background: var(--critical-soft); color: var(--status-ink); font-size: 13px; }
.login-err .icon { color: var(--critical); margin-top: 2px; }
.login-points { list-style: none; margin: 24px 0 0; padding: 20px 0 0; border-top: 1px solid var(--border); display: grid; gap: 12px; }
.login-points li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--text-2); line-height: 1.45; }
.login-points .icon { color: var(--accent); margin-top: 1px; }
.login-points b { color: var(--text); font-weight: 600; }
.login-actions { display: flex; gap: 8px; }
.login-actions .btn { flex: 1; justify-content: center; padding: 10px; }
.login-foot { text-align: center; font-size: 12px; color: var(--muted); margin: 16px 0 0; }
@media (max-width: 480px) { .login-card { padding: 24px 20px; } }
.doc { max-width: 720px; margin: 40px auto; padding: 0 16px; }
.doc h2 { margin: 20px 0 6px; }
