/* ESB Analytics — token & komponen. Warna seri chart = palet dataviz tervalidasi (CVD-safe),
   dark mode memakai step gelap tersendiri (bukan inversi otomatis). */
:root {
  color-scheme: light;
  --page: #f6f6f3;
  --surface: #ffffff;
  --surface-2: #f3f3ef;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #7a7873;
  --line: #e6e5df;
  --grid: #ecebe5;
  --axis: #c3c2b7;
  --brand: #d9480f;          /* aksen FnB (chrome UI, bukan warna seri) */
  --brand-soft: #fff1e8;
  --brand-ink: #a63a0c;
  --good: #006300; --good-bg: #e7f5e7;
  --bad: #b42323;  --bad-bg: #fdeceb;
  --warn: #8a5a00; --warn-bg: #fff4d6;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;
  --s-muted: #b9b7af;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --surface-2: #222220; --ink: #ffffff; --ink-2: #c3c2b7;
    --muted: #8f8d86; --line: #2c2c2a; --grid: #2a2a28; --axis: #383835;
    --brand: #f76707; --brand-soft: #2b1a10; --brand-ink: #ffa36b;
    --good: #0ca30c; --good-bg: #12260f; --bad: #e66767; --bad-bg: #2d1515; --warn: #fab219; --warn-bg: #2b230e;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; --s-muted: #5a5954;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #222220; --ink: #ffffff; --ink-2: #c3c2b7;
  --muted: #8f8d86; --line: #2c2c2a; --grid: #2a2a28; --axis: #383835;
  --brand: #f76707; --brand-soft: #2b1a10; --brand-ink: #ffa36b;
  --good: #0ca30c; --good-bg: #12260f; --bad: #e66767; --bad-bg: #2d1515; --warn: #fab219; --warn-bg: #2b230e;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; --s-muted: #5a5954;
}

body { background: var(--page); font-feature-settings: "cv11", "ss01"; }

/* ---------- navigasi ---------- */
.nav-link { display: flex; align-items: center; gap: .75rem; padding: .55rem .75rem; border-radius: .6rem;
  font-size: .875rem; font-weight: 500; color: var(--ink-2); transition: background .15s, color .15s; }
.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-active, .nav-active:hover { background: var(--brand-soft); color: var(--brand-ink); }
.icon-btn { display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: .6rem;
  color: var(--ink-2); border: 1px solid var(--line); background: var(--surface); }
.icon-btn:hover { color: var(--ink); background: var(--surface-2); }

/* ---------- kartu ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 1rem;
  box-shadow: 0 1px 2px rgba(16, 16, 12, .04); }
.card-pad { padding: 1.25rem; }
@media (min-width: 640px) { .card-pad { padding: 1.5rem; } }
.card-title { font-size: .95rem; font-weight: 600; color: var(--ink); }
.card-sub { font-size: .8rem; color: var(--muted); margin-top: .15rem; }

/* ---------- KPI ---------- */
.kpi-label { font-size: .8rem; font-weight: 500; color: var(--ink-2); }
.kpi-value { white-space: nowrap; font-size: 1.6rem; line-height: 1.15; font-weight: 650; letter-spacing: -.02em; color: var(--ink); margin-top: .35rem; }
.kpi-hero  { font-size: 2.75rem; line-height: 1.05; font-weight: 700; letter-spacing: -.03em; color: var(--ink); }
@media (max-width: 640px) { .kpi-hero { font-size: 2.1rem; } .kpi-value { font-size: 1.3rem; } }
.kpi-sub { font-size: .78rem; color: var(--muted); margin-top: .35rem; }
.kpi-icon { width: 2.25rem; height: 2.25rem; border-radius: .7rem; display: grid; place-items: center;
  background: var(--surface-2); color: var(--ink-2); }

.delta { display: inline-flex; align-items: center; gap: .2rem; font-size: .75rem; font-weight: 600;
  padding: .1rem .45rem; border-radius: 999px; }
.delta-good { color: var(--good); background: var(--good-bg); }
.delta-bad  { color: var(--bad);  background: var(--bad-bg); }
.delta-flat { color: var(--ink-2); background: var(--surface-2); }

/* ---------- badge ---------- */
.badge { display: inline-flex; align-items: center; font-size: .7rem; font-weight: 600; padding: .12rem .5rem;
  border-radius: 999px; white-space: nowrap; }
.badge-neutral { background: var(--surface-2); color: var(--ink-2); }
.badge-good { background: var(--good-bg); color: var(--good); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad  { background: var(--bad-bg);  color: var(--bad); }

/* ---------- tombol & form ---------- */
.btn { display: inline-flex; align-items: center; gap: .4rem; height: 2.25rem; padding: 0 .9rem; border-radius: .6rem;
  font-size: .85rem; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--ink); white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); }
.input, .select { height: 2.25rem; padding: 0 .7rem; border-radius: .6rem; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: .85rem; }
.input:focus, .select:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
.field-label { display: block; font-size: .72rem; font-weight: 600; color: var(--muted); margin-bottom: .3rem;
  text-transform: uppercase; letter-spacing: .04em; }

/* segmented control (preset rentang) */
.seg { display: inline-flex; padding: .2rem; gap: .15rem; border-radius: .7rem; background: var(--surface-2); border: 1px solid var(--line); }
.seg a, .seg button { padding: .3rem .7rem; border-radius: .5rem; font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.seg a:hover, .seg button:hover { color: var(--ink); }
.seg .on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ---------- tabel ---------- */
.tbl { width: 100%; font-size: .85rem; border-collapse: separate; border-spacing: 0; }
.tbl th { text-align: left; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: .65rem .9rem; border-bottom: 1px solid var(--line); background: var(--surface); white-space: nowrap; position: sticky; top: 0; }
.tbl td { padding: .7rem .9rem; border-bottom: 1px solid var(--line); color: var(--ink); vertical-align: middle; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .num, .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tfoot td { font-weight: 650; border-top: 1px solid var(--line); border-bottom: 0; background: var(--surface-2); }
.tbl-wrap { overflow-x: auto; }

/* ---------- bar list (ranking / komposisi) ---------- */
.meter { height: .5rem; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--s1); }

.swatch { display: inline-block; width: .65rem; height: .65rem; border-radius: 3px; flex: none; }
.line-key { display: inline-block; width: 1rem; height: 2px; border-radius: 2px; flex: none; vertical-align: middle; }

.chart-box { position: relative; width: 100%; }
.empty-state { padding: 2.5rem 1rem; text-align: center; color: var(--muted); font-size: .875rem; }

/* pagination */
.pager { display: flex; gap: .3rem; flex-wrap: wrap; align-items: center; }
.pager a, .pager span { min-width: 2rem; height: 2rem; padding: 0 .55rem; display: inline-grid; place-items: center;
  border-radius: .5rem; font-size: .8rem; font-weight: 600; border: 1px solid var(--line); color: var(--ink-2); background: var(--surface); }
.pager a:hover { background: var(--surface-2); color: var(--ink); }
.pager .on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager .gap { border: 0; background: none; }

details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }

@media print { #sidebar, header, .no-print { display: none !important; } .lg\:pl-64 { padding-left: 0 !important; } }
