/* Core Demand — gaya dasar. Warna via token, mode gelap mengikuti sistem. */
:root {
  color-scheme: light;
  --page: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #eef3fa;
  --line: #dbe3ef;
  --line-strong: #bccadf;
  --text: #0f1f3a;
  --text-2: #475a76;
  --muted: #7586a0;
  --accent: #2a78d6;
  --accent-strong: #1d5aa6;
  --accent-soft: #e6f0fc;
  --series-1-soft: #9dc0ea;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --good: #0ca30c;
  --good-text: #006300;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --critical-soft: #fbeaea;
  --warning-soft: #fdf3dc;
  --good-soft: #e5f5e5;
  --shadow: 0 1px 2px rgba(15, 31, 58, 0.06);
  /* sidebar biru malam, sama dengan panel kiri halaman login (dipakai di mode terang & gelap) */
  --side-bg: #06122a;
  --side-glow: rgba(42, 120, 214, 0.28);
  --side-line: #13254a;
  --side-text: #c3d2e6;
  --side-muted: #8fa6c6;
  --side-strong: #ffffff;
  --side-hover: rgba(124, 184, 255, 0.10);
  --side-active-bg: #2a78d6;
  --side-active-text: #ffffff;
  --radius: 10px;
  --sidebar: 232px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
}
/* Mode gelap: biru malam seperti halaman login. Ikut sistem, kecuali pengguna memilih lewat tombol (data-theme). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #050d1c;
    --surface: #0b1931;
    --surface-2: #10223f;
    --line: #1a2f55;
    --line-strong: #2a4470;
    --text: #e6edf7;
    --text-2: #a9bad3;
    --muted: #7f93b3;
    --accent: #3d8ee8;
    --accent-strong: #7cb8ff;
    --accent-soft: #11284a;
    --series-1: #3d8ee8;
    --series-1-soft: #2a4f7a;
    --series-2: #f08a4b;
    --series-3: #2bbf8a;
    --good-text: #3ccf6b;
    --critical-soft: #3a1c22;
    --warning-soft: #3a2f14;
    --good-soft: #12301f;
    --shadow: none;
    --side-bg: #06122a;
    --side-line: #13254a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #050d1c;
  --surface: #0b1931;
  --surface-2: #10223f;
  --line: #1a2f55;
  --line-strong: #2a4470;
  --text: #e6edf7;
  --text-2: #a9bad3;
  --muted: #7f93b3;
  --accent: #3d8ee8;
  --accent-strong: #7cb8ff;
  --accent-soft: #11284a;
  --series-1: #3d8ee8;
  --series-1-soft: #2a4f7a;
  --series-2: #f08a4b;
  --series-3: #2bbf8a;
  --good-text: #3ccf6b;
  --critical-soft: #3a1c22;
  --warning-soft: #3a2f14;
  --good-soft: #12301f;
  --shadow: none;
  --side-bg: #06122a;
  --side-line: #13254a;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--page); color: var(--text); line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0; font-weight: 650; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 650; }
h3 { font-size: 13px; margin: 0 0 8px; font-weight: 650; color: var(--text-2); }
small, .muted { color: var(--text-2); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- layout */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  background: radial-gradient(420px 320px at 0% 0%, var(--side-glow, rgba(42,120,214,0.28)), transparent 70%), var(--side-bg);
  color: var(--side-text); border-right: 1px solid var(--side-line); padding: 16px 12px;
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.brand-name { font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 11.5px; color: var(--text-2); }
.sidebar .brand-name { color: var(--side-strong, #fff); }
.sidebar .brand-sub { color: var(--side-muted); }
.sidebar .brand-mark { box-shadow: 0 0 0 5px rgba(42,120,214,0.20); }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--side-text); font-weight: 500;
}
.nav a:hover { background: var(--side-hover, rgba(124,184,255,0.10)); text-decoration: none; color: #ffffff; }
.nav a.active { background: var(--side-active-bg, #2a78d6); color: var(--side-active-text, #fff); box-shadow: 0 6px 16px rgba(42,120,214,0.30); }
.nav svg { width: 17px; height: 17px; flex: none; }
.sidebar-foot { margin-top: auto; padding: 8px; font-size: 12px; color: var(--side-muted); border-top: 1px solid var(--side-line); }
.sidebar-foot b { color: var(--side-strong, #fff); }
.sidebar-foot .bad-text { color: #ff9b8f; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--line);
  background: var(--surface); position: sticky; top: 0; z-index: 5;
}
.topbar .spacer { flex: 1; }
.content { padding: 20px 24px 40px; display: flex; flex-direction: column; gap: 16px; max-width: 1480px; width: 100%; }
.view { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.page-head .spacer { flex: 1; }
.page-sub { color: var(--text-2); margin-top: 2px; }
.btn.menu-btn { display: none; }

/* ---------- komponen */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); min-width: 0;
}
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.card-head .spacer { flex: 1; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.kpi .value { font-size: 24px; font-weight: 650; margin-top: 4px; letter-spacing: -0.01em; }
.kpi .value small { font-size: 13px; font-weight: 500; }
.kpi .sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.good-text { color: var(--good-text); }
.bad-text { color: var(--critical); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); padding: 7px 12px; border-radius: 8px;
  font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.danger { color: var(--critical); }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 0; }
.btn svg { width: 15px; height: 15px; }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 7px 10px; min-width: 0;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters label.field { min-width: 160px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button {
  border: 0; background: none; padding: 8px 12px; font: inherit; font-weight: 550; color: var(--text-2);
  border-bottom: 2px solid transparent; cursor: pointer;
}
.tabs button.active { color: var(--accent-strong); border-bottom-color: var(--accent); }

/* ---------- tabel */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; max-height: 560px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th {
  position: sticky; top: 0; background: var(--surface-2); font-weight: 600; color: var(--text-2);
  font-size: 12px; z-index: 1; white-space: nowrap;
}
th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--text); }
tbody tr:hover { background: var(--surface-2); }
tr.clickable { cursor: pointer; }
td.wrap { white-space: normal; }
.empty { padding: 28px; text-align: center; color: var(--text-2); }

/* ---------- badge status: ikon + label, warna tidak berdiri sendiri */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent;
}
.badge::before { font-size: 10px; }
.b-critical { background: var(--critical-soft); color: var(--critical); }
.b-critical::before { content: "\25B2"; }
.b-warning { background: var(--warning-soft); color: #9a6700; }
.b-warning::before { content: "\25C6"; }
.b-good { background: var(--good-soft); color: var(--good-text); }
.b-good::before { content: "\25CF"; }
.b-neutral { background: var(--surface-2); color: var(--text-2); border-color: var(--line); }
.b-neutral::before { content: "\25CB"; }
.b-info { background: var(--accent-soft); color: var(--accent-strong); }
.b-info::before { content: "\25CF"; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .b-warning { color: var(--warning); } }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font: inherit; color: var(--text);
}
.chip.active { border-color: var(--accent); background: var(--accent-soft); }
.chip b { font-variant-numeric: tabular-nums; }

.mode-pill { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); }
.notice {
  border: 1px solid var(--line); border-left: 3px solid var(--accent); background: var(--surface);
  padding: 10px 14px; border-radius: 8px; font-size: 13px;
}
.notice.warn { border-left-color: var(--warning); }
.notice.bad { border-left-color: var(--critical); }

.chart { width: 100%; height: 320px; }
.chart.tall { height: 380px; }
.chart.short { height: 260px; }

/* ---------- modal & toast */
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal {
  background: var(--surface); border-radius: 12px; border: 1px solid var(--line); width: min(560px, 100%);
  max-height: 90vh; overflow: auto; padding: 20px;
}
.modal.wide { width: min(960px, 100%); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.toasts { position: fixed; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast {
  background: var(--text); color: var(--page); padding: 10px 14px; border-radius: 8px; font-size: 13px;
  max-width: 380px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}
.toast.error { background: var(--critical); color: #fff; }

/* ---------- login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 14px; }
.login-card .brand { padding: 0; }
.error-text { color: var(--critical); font-size: 13px; }

.kv { display: grid; grid-template-columns: 180px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; }
.dropzone {
  border: 1.5px dashed var(--line-strong); border-radius: 10px; padding: 22px; text-align: center;
  color: var(--text-2); cursor: pointer;
}
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.type-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.type-card {
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; cursor: pointer;
  background: var(--surface); text-align: left; font: inherit; color: var(--text);
}
.type-card.active { border-color: var(--accent); background: var(--accent-soft); }
.type-card .t { font-weight: 600; }
.type-card .s { font-size: 12px; color: var(--text-2); }
.step-no { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-2); font-size: 11px; font-weight: 700; margin-right: 6px; }

@media (max-width: 980px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; width: var(--sidebar); left: 0; transform: translateX(-100%); transition: transform 0.15s; }
  .sidebar.open { transform: none; }
  .btn.menu-btn { display: inline-flex; }
  .content { padding: 16px; }
  .topbar { padding: 10px 16px; flex-wrap: wrap; }
  .topbar .muted { display: none; }
  .kv { grid-template-columns: 1fr; }
}

/* ---------- hint & card detail */
.kpi { display: flex; flex-direction: column; }
.kpi-label { display: flex; align-items: center; gap: 6px; }
.kpi-more { margin-top: auto; padding-top: 10px; align-self: flex-start; font-size: 12.5px; font-weight: 600; }
.hint { position: relative; display: inline-flex; }
.hint-btn {
  width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--text-2); font: 600 10.5px/1 Georgia, serif; font-style: italic; cursor: help; padding: 0;
  display: inline-grid; place-items: center;
}
.hint-btn:hover, .hint.open .hint-btn { border-color: var(--accent); color: var(--accent); }
.hint-pop {
  display: none; position: fixed; z-index: 70; top: 0; left: 0; width: min(320px, 80vw); max-height: 70vh; overflow: auto;
  background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 10px 12px; font-size: 12.5px; font-weight: 400; line-height: 1.5; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  white-space: normal; text-align: left;
}
.hint-pop p { margin: 0 0 6px; }
.hint-pop p:last-child { margin: 0; }
.hint:hover .hint-pop, .hint:focus-within .hint-pop, .hint.open .hint-pop { display: block; }
.detail-section { display: flex; flex-direction: column; gap: 8px; }
.detail-section .card-head { margin-bottom: 0; }
.cell-sub { font-size: 12px; color: var(--text-2); }
.nowrap { white-space: nowrap; }

/* ---------- pilihan satuan */
.segmented { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: var(--surface); }
.segmented button {
  border: 0; background: none; padding: 7px 12px; font: inherit; font-weight: 550; color: var(--text-2); cursor: pointer;
  border-right: 1px solid var(--line);
}
.segmented button:last-child { border-right: 0; }
.segmented button.active { background: var(--accent-soft); color: var(--accent-strong); }
.segmented button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.kpi .value .value-2 { display: block; font-size: 15px; font-weight: 600; color: var(--text-2); margin-top: 2px; }
.tier-table td { vertical-align: top; }
.formula { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; font-size: 13px; white-space: pre-wrap; }
.explain { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 980px) { .explain { grid-template-columns: 1fr; } }
.explain h3 { margin-bottom: 6px; }
.explain p { margin: 0 0 8px; font-size: 13px; }
.setting-help { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* ---------- tombol informasi akurasi */
.info-btn { gap: 8px; }
.info-ico {
  width: 16px; height: 16px; border-radius: 50%; border: 1px solid currentColor; display: inline-grid; place-items: center;
  font: italic 600 10.5px/1 Georgia, serif;
}
.info-btn[aria-expanded="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.info-panel { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: var(--surface-2); }
.info-panel[hidden] { display: none; }

/* ---------- segmen pengaturan */
.settings-groups { display: flex; flex-direction: column; gap: 16px; }
.settings-group { border: 1px solid var(--line-strong); border-radius: 10px; padding: 16px; background: var(--surface); }
.settings-group-head { display: flex; align-items: flex-start; gap: 10px; padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.settings-group-head h2 { margin: 0; font-size: 15px; }
.settings-group-no {
  flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong);
  display: inline-grid; place-items: center; font-weight: 700; font-size: 12px; margin-top: 1px;
}
.settings-save {
  position: sticky; bottom: 0; display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 12px 0;
  background: var(--surface); border-top: 1px solid var(--line);
}
.model-hint .hint-pop { width: min(460px, 90vw); }
.modal .grid { grid-template-columns: minmax(0, 1fr); }
.modal .grid > *, .detail-section { min-width: 0; }
.model-hint { display: inline-flex; vertical-align: middle; }

/* ---------- pagination tabel */
.pager { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; font-size: 12.5px; }
.pager:empty { display: none; }
.pager .spacer { flex: 1; }
.pager .btn.small { min-width: 30px; justify-content: center; }
.pager-size { display: inline-flex; align-items: center; gap: 6px; margin-right: 6px; color: var(--muted); }
.pager-size select { padding: 3px 6px; font-size: 12.5px; }

/* ---------- detail data yang dibuka/tutup */
.reveal-btn { margin-top: 4px; }
.reveal-body.hidden { display: none; }

/* ---------- form master data */
.form-grid .req::after { content: " *"; color: var(--bad, #b42318); }
.field-hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.row-actions { white-space: nowrap; display: inline-flex; gap: 4px; }
.usage-list { margin: 6px 0 0 18px; }
.top-list { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.6; }
.kpis.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis.compact .kpi .value { font-size: 20px; }
.type-group { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 12px 0 6px; }

/* ---------- piutang / hutang / efektivitas */
.insights { display: flex; flex-direction: column; gap: 10px; }
.insight { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; }
.insight p { margin: 6px 0 0; font-size: 13.5px; line-height: 1.5; }
.stackbar { display: flex; height: 18px; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.stackbar .seg { height: 100%; }
.stack-legend { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; font-size: 13.5px; }
.stack-legend .row { display: flex; align-items: center; gap: 10px; }
.stack-legend .lab { flex: 1; }
.stack-legend .share { width: 56px; text-align: right; font-size: 12px; }
.dot { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; display: inline-block; }
.c-1 { background: var(--series-1); } .c-2 { background: var(--series-1-soft); }
.c-3 { background: var(--serious); } .c-4 { background: var(--critical); } .c-5 { background: var(--muted); }
.grid-2-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
.grid-1-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 16px; }
@media (max-width: 1000px) { .grid-2-1, .grid-1-2 { grid-template-columns: minmax(0, 1fr); } }
.saldo-strip { display: flex; justify-content: space-between; gap: 4px; padding: 6px 8px 0 40px; font-size: 11.5px; }
.saldo-strip span { flex: 1; text-align: center; color: var(--serious); font-weight: 600; white-space: nowrap; }
.kpi .before { font-size: 14px; color: var(--muted); text-decoration: line-through; margin-left: 8px; font-weight: 500; }
.limit-bar { position: relative; display: flex; height: 26px; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.limit-bar .seg { height: 100%; }
.limit-bar .over { background: repeating-linear-gradient(45deg, var(--serious) 0 6px, var(--warning-soft) 6px 12px); }
.limit-bar .debt { background: var(--muted); }
.limit-bar .ok { background: var(--series-1); }
.limit-mark { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--text); }
.limit-scale { position: relative; height: 18px; font-size: 12px; color: var(--text-2); margin-top: 4px; }
.plan-boxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 14px 0; }
.plan-box { border-radius: 10px; padding: 12px 14px; background: var(--surface-2); }
.plan-box.ok { background: var(--accent-soft); }
.plan-box.held { background: var(--warning-soft); }
.plan-box .v { font-size: 20px; font-weight: 600; margin-top: 4px; }
.plan-box .s { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.seg-toggle { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.seg-toggle button { border: 0; background: var(--surface); padding: 6px 12px; font: inherit; font-size: 13px; color: var(--text-2); cursor: pointer; }
.seg-toggle button.active { background: var(--accent); color: #fff; }
.accent-text { color: var(--accent); }
.w-name { min-width: 150px; }
.card-head { flex-wrap: wrap; row-gap: 8px; }
@media (max-width: 700px) { .saldo-strip { display: none; } }
.cell-sub.bad-text { color: var(--critical); } .cell-sub.good-text { color: var(--good-text); }
.kpis.compact4 { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.kpis.compact4 .kpi .value { font-size: 22px; }
.kpi.warn .value { color: var(--serious); } .kpi.bad .value { color: var(--critical); }
.login-wrap { position: relative; }
.login-lang { position: absolute; top: 16px; right: 16px; }
.lang-toggle button { padding: 4px 10px; font-size: 12px; font-weight: 600; }

/* ---------- halaman login & pasang lisensi (v0.7.1): selalu gelap, tidak ikut tema */
.auth { min-height: 100vh; display: flex; flex-wrap: wrap; background: #050d1c; color: #e6edf7; }
.auth-hero {
  flex: 1 1 560px; box-sizing: border-box; padding: 44px 56px 36px; display: flex; flex-direction: column; gap: 28px;
  position: relative; overflow: hidden; border-right: 1px solid #13254a;
  background: radial-gradient(900px 520px at 0% 0%, rgba(42,120,214,0.30), rgba(42,120,214,0) 70%),
              radial-gradient(700px 420px at 100% 100%, rgba(240,138,75,0.10), rgba(240,138,75,0) 70%), #06122a;
}
.auth-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; background-size: 48px 48px;
  background-image: linear-gradient(rgba(124,184,255,0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(124,184,255,0.05) 1px, transparent 1px);
}
.auth-hero > * { position: relative; }
.auth-brand { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 700; }
.auth-mark { width: 40px; height: 40px; border-radius: 10px; background: #2a78d6; box-shadow: 0 0 0 6px rgba(42,120,214,0.18);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.auth-pitch { max-width: 520px; display: flex; flex-direction: column; gap: 16px; margin-top: 72px; }
.auth-pitch h1 { margin: 0; font-size: 40px; line-height: 1.18; font-weight: 700; letter-spacing: -0.02em; }
.auth-pitch p { margin: 0; font-size: 16px; line-height: 1.65; color: #a9bad3; }
.auth-pitch p span { display: block; }
.auth-chart { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.auth-legend { display: flex; gap: 18px; font-size: 12px; color: #8fa6c6; }
.auth-legend span { display: flex; align-items: center; gap: 6px; }
.auth-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.auth-legend .sales { background: #3d8ee8; }
.auth-legend .fc { border: 1.5px dashed #f08a4b; box-sizing: border-box; }
.auth-bars { height: 150px; display: flex; align-items: flex-end; gap: 6px; border-bottom: 1px solid rgba(124,184,255,0.18);
  -webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,0.35), #000 30%); mask-image: linear-gradient(90deg, rgba(0,0,0,0.35), #000 30%); }
.auth-bars div { flex: 1; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, #3d8ee8, rgba(61,142,232,0.15)); }
.auth-bars div.fc { background: rgba(240,138,75,0.12); border: 1.5px dashed #f08a4b; border-bottom: 0; }
.auth-tags { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11.5px; letter-spacing: 0.16em; color: #5f7392; }
.auth-panel { flex: 1 1 440px; box-sizing: border-box; padding: 32px 56px 36px; display: flex; flex-direction: column; }
.auth-top { display: flex; justify-content: flex-end; }
.auth-body { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px 0; }
.auth-form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 20px; }
.auth-form h2 { margin: 0; font-size: 26px; font-weight: 700; }
.auth-form .lead { margin: 6px 0 0; font-size: 14.5px; color: #8fa6c6; }
.auth-form .help { margin: 0; font-size: 13px; color: #8fa6c6; text-align: center; }
.auth-form .muted, .auth-form p { color: #a9bad3; }
.auth-form code { color: #e6edf7; background: #0b1931; padding: 8px 10px; border-radius: 8px; word-break: break-all; }
.auth-field { display: flex; flex-direction: column; gap: 7px; font-size: 13.5px; font-weight: 600; color: #c9d6e8; }
.auth-input { display: flex; align-items: center; gap: 10px; border: 1px solid #22375c; border-radius: 10px; padding: 0 6px 0 12px; background: #0b1931; color: #6f86a8; }
.auth-input:focus-within { border-color: #3d8ee8; box-shadow: 0 0 0 3px rgba(61,142,232,0.20); }
.auth-input input { flex: 1; min-width: 0; border: 0; font: inherit; font-weight: 400; font-size: 15px; padding: 13px 0; color: #e6edf7; background: transparent; }
.auth-input input:focus { outline: none; }
.auth-input input::placeholder { color: #5f7392; }
.auth-eye { width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; color: #8fa6c6; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.auth-eye:hover { background: rgba(124,184,255,0.10); }
.auth-eye:focus-visible { outline: 2px solid #3d8ee8; }
.auth-submit { font: inherit; font-size: 15px; font-weight: 600; height: 48px; border: 0; border-radius: 10px; background: #2a78d6; color: #fff;
  display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; box-shadow: 0 8px 24px rgba(42,120,214,0.35); }
.auth-submit:hover { background: #2369bf; }
.auth-submit:disabled { opacity: 0.6; cursor: default; }
.auth-submit:focus-visible { outline: 2px solid #b3d5ff; outline-offset: 2px; }
.auth-error { color: #ff9b8f; font-size: 13px; min-height: 0; }
.auth-error:empty { display: none; }
.auth-panel .lang-toggle { border-color: #22375c; }
.auth-panel .lang-toggle button { background: transparent; color: #8fa6c6; }
.auth-panel .lang-toggle button.active { background: #2a78d6; color: #fff; }
.auth-form textarea, .auth-form input[type=file] { background: #0b1931; color: #e6edf7; border: 1px solid #22375c; border-radius: 10px; padding: 10px; font: inherit; }
.auth-form .notice { background: rgba(240,138,75,0.12); border-color: rgba(240,138,75,0.35); color: #f7c9a8; }
@media (max-width: 760px) {
  .auth-hero { padding: 24px 20px; gap: 18px; border-right: 0; border-bottom: 1px solid #13254a; }
  .auth-pitch { margin-top: 8px; }
  .auth-pitch h1 { font-size: 28px; }
  .auth-pitch p { font-size: 14.5px; }
  .auth-chart { display: none; }
  .auth-panel { padding: 16px 20px 28px; }
  .auth-body { padding: 16px 0; }
}

/* ---------- ikon kartu KPI (v0.7.1) */
.kpi-ico { width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, currentColor 14%, transparent); margin-right: 2px; }
.kpi-ico.tone-accent { color: var(--accent); }
.kpi-ico.tone-warn { color: #b7791f; }
.kpi-ico.tone-info { color: #6b5bd2; }
.kpi-ico.tone-good { color: #0f8a6a; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .kpi-ico.tone-warn { color: #e8b04f; }
  :root:not([data-theme="light"]) .kpi-ico.tone-info { color: #a397f0; }
  :root:not([data-theme="light"]) .kpi-ico.tone-good { color: #4cc9a0; }
}
:root[data-theme="dark"] .kpi-ico.tone-warn { color: #e8b04f; }
:root[data-theme="dark"] .kpi-ico.tone-info { color: #a397f0; }
:root[data-theme="dark"] .kpi-ico.tone-good { color: #4cc9a0; }
.nav-sep { border: 0; border-top: 1px solid var(--side-line); margin: 8px 10px; }

/* ---------- animasi halaman login (v0.7.2) */
@keyframes auth-grow { from { transform: scaleY(0); opacity: 0; } to { transform: scaleY(1); opacity: 1; } }
@keyframes auth-rise { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes auth-glow { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
.auth-bars div { transform-origin: bottom; animation: auth-grow 0.75s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.auth-bars div.fc { animation-name: auth-grow, auth-glow; animation-duration: 0.6s, 2.8s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1), ease-in-out; animation-iteration-count: 1, infinite; animation-fill-mode: both, none; }
.auth-pitch, .auth-legend, .auth-tags, .auth-form { animation: auth-rise 0.6s ease-out both; }
.auth-pitch { animation-delay: 0.05s; }
.auth-form { animation-delay: 0.15s; }
.auth-legend, .auth-tags { animation-delay: 0.9s; }
@media (prefers-reduced-motion: reduce) {
  .auth-bars div, .auth-bars div.fc, .auth-pitch, .auth-legend, .auth-tags, .auth-form { animation: none; }
}
.kpi-ico.tone-crit { color: #c4362b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .kpi-ico.tone-crit { color: #ff8a7d; } }
:root[data-theme="dark"] .kpi-ico.tone-crit { color: #ff8a7d; }

/* ---------- transisi antar menu (v0.7.3) */
.main { position: relative; }
.route-progress { position: absolute; top: 0; left: 0; right: 0; height: 3px; z-index: 30; pointer-events: none; overflow: hidden; opacity: 0; }
.route-progress::before { content: ""; position: absolute; inset: 0; background: var(--accent); transform-origin: left; transform: scaleX(0); }
.route-progress.run { opacity: 1; }
.route-progress.run::before { animation: rp-load 2.4s cubic-bezier(0.1, 0.7, 0.2, 1) forwards; }
.route-progress.done { opacity: 0; transition: opacity 0.3s 0.15s; }
.route-progress.done::before { animation: none; transform: scaleX(1); transition: transform 0.15s ease-out; }
@keyframes rp-load { from { transform: scaleX(0); } to { transform: scaleX(0.85); } }

.skeleton { display: flex; flex-direction: column; gap: 16px; animation: sk-in 0.2s 0.12s ease-out both; }
.sk-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 4px; }
.sk-card { gap: 10px; }
.sk-row { display: flex; align-items: center; gap: 8px; }
.sk-block { display: flex; flex-direction: column; gap: 14px; }
.sk { max-width: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 0%, var(--line) 50%, var(--surface-2) 100%);
  background-size: 200% 100%; animation: sk-shimmer 1.3s ease-in-out infinite; }
@keyframes sk-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@keyframes sk-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view.entering > :not(.skeleton) { animation: view-in 0.32s ease-out both; }
.view.entering > :nth-child(2) { animation-delay: 0.04s; }
.view.entering > :nth-child(3) { animation-delay: 0.08s; }
.view.entering > :nth-child(n+4) { animation-delay: 0.12s; }
@media (prefers-reduced-motion: reduce) {
  .route-progress.run::before, .sk, .skeleton, .view.entering > * { animation: none; }
}

/* ---------- saklar mode gelap (v0.7.4) */
.theme-toggle { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px 4px 8px; border: 1px solid var(--line-strong);
  border-radius: 999px; background: var(--surface); color: var(--text-2); cursor: pointer; font: inherit; }
.theme-toggle:hover { border-color: var(--accent); color: var(--accent-strong); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-ico { display: inline-flex; }
.theme-track { position: relative; width: 32px; height: 18px; border-radius: 999px; background: var(--line-strong); transition: background 0.2s; }
.theme-thumb { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25); transition: transform 0.2s; }
.theme-toggle[aria-checked="true"] .theme-track { background: var(--accent); }
.theme-toggle[aria-checked="true"] .theme-thumb { transform: translateX(14px); }
.theme-anim, .theme-anim body, .theme-anim .topbar, .theme-anim .card, .theme-anim .kpi, .theme-anim .content,
.theme-anim table, .theme-anim th, .theme-anim td, .theme-anim .btn, .theme-anim input, .theme-anim select {
  transition: background-color 0.3s, border-color 0.3s, color 0.3s !important; }
@media (prefers-reduced-motion: reduce) { .theme-track, .theme-thumb { transition: none; } }
.rules-list p { margin: 2px 0; font-size: 13px; }

/* ---------- ikon urutan di header tabel (v0.7.6) */
th.sortable { padding: 0; }
.sort-btn { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 4px; width: 100%; padding: 7px 10px; cursor: pointer;
  font: inherit; color: inherit; white-space: nowrap; }
th.num .sort-btn { justify-content: flex-end; }
.sort-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px; }
.sort-ind { display: inline-flex; flex: none; color: var(--muted); opacity: 0.8; transition: opacity 0.15s, color 0.15s; }
th.sortable:hover .sort-ind { opacity: 1; }
th.sorted { color: var(--accent-strong); }
th.sorted .sort-ind { color: var(--accent); opacity: 1; }

/* ---------- logo Core Demand (v0.7.7) */
.logo { display: flex; align-items: center; gap: 12px; }
.logo-mark { flex: none; display: block; }
.logo-name { font-weight: 800; letter-spacing: -0.01em; line-height: 1.1; }
.logo-tagline { font-size: 12.5px; color: #8fa6c6; margin-top: 3px; letter-spacing: 0.01em; }
.auth-brand .logo-name { font-size: 24px; }
.brand-logo { flex: none; display: flex; align-items: center; }
.sidebar .brand-name .bn-core { color: #ffffff; }
.sidebar .brand-name .bn-demand { color: #f5ab3c; }
.sidebar .brand-name { font-weight: 800; font-size: 16px; letter-spacing: -0.01em; }

/* ---------- tombol keluar (v0.7.7) */
.btn.btn-logout { background: #d03b3b; border-color: #d03b3b; color: #fff; display: inline-flex; align-items: center; gap: 6px; }
.btn.btn-logout:hover { background: #b42d2d; border-color: #b42d2d; color: #fff; }
.btn.btn-logout:focus-visible { outline: 2px solid #ff9b8f; outline-offset: 2px; }
.user-menu{display:flex;gap:8px;align-items:center;flex-wrap:wrap;justify-content:flex-end}
@media (max-width: 900px){
  .user-menu{width:100%;justify-content:flex-start}
  .user-menu .btn-logout{margin-left:auto}
}

/* ---------- lisensi (v0.8) */
.trial-pill { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; padding: 3px 8px; border-radius: 999px;
  background: #f5ab3c; color: #3a2400; }
.trial-pill.small { display: inline-block; font-size: 10px; padding: 1px 6px; margin-bottom: 4px; }
.warn-text { color: #9a6700; }
.sidebar-foot .warn-text { color: #f5ab3c; }
[data-theme="dark"] .warn-text { color: var(--warning); }
.notice.banner-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.notice.banner-row .spacer { flex: 1; }
.notice.warn.banner-row { background: var(--warning-soft); }
.notice.bad.banner-row { background: var(--critical-soft, #fdecea); }
.lic-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.lic-head h3 { margin: 0; font-size: 17px; }
.lic-state { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.lic-state.ACTIVE { background: var(--good-soft, #e3f4ea); color: var(--good-text, #1e7a46); }
.lic-state.EXPIRING { background: var(--warning-soft); color: #9a6700; }
.lic-state.GRACE, .lic-state.EXPIRED { background: var(--critical-soft, #fdecea); color: var(--critical); }
[data-theme="dark"] .lic-state.EXPIRING { color: var(--warning); }
.lic-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .lic-grid { grid-template-columns: 1fr; } }
.lic-box { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.lic-box h4 { margin: 0 0 10px; font-size: 14px; }
.usage-row { margin-bottom: 12px; }
.usage-row .lab { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.usage-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.usage-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.usage-bar.full > span { background: var(--warning); }
.usage-bar.over > span { background: var(--critical); }
.lic-input { width: 100%; box-sizing: border-box; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.lic-preview { margin-top: 12px; }
.lic-preview .kv { margin: 8px 0 12px; }

/* ---------- kode instalasi (v0.9) */
.install-code { border: 1px solid #22375c; background: #0b1931; border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.ic-label { font-size: 13.5px; font-weight: 600; color: #c9d6e8; }
.ic-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.auth-form code.ic-code, .ic-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 17px; font-weight: 700; letter-spacing: .04em;
  color: #fff; background: transparent; padding: 0; }
.ic-help { font-size: 12.5px; color: #8fa6c6; line-height: 1.5; }
.install-code .copy-btn { background: #13254a; color: #e6edf7; border-color: #22375c; }
.mc-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px; font-weight: 700; letter-spacing: .03em; }
.mc-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
