:root {
  color-scheme: light;
  --page:        #f9f9f7;
  --surface-1:   #fcfcfb;
  --surface-2:   #f3f2ee;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;
  --gridline:    #e1e0d9;
  --baseline:    #c3c2b7;
  --border:      rgba(11,11,11,0.10);
  --border-strong: rgba(11,11,11,0.16);
  --accent:      #2a78d6;
  --accent-wash: rgba(42,120,214,0.10);
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page:        #0d0d0d;
    --surface-1:   #1a1a19;
    --surface-2:   #232322;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --gridline:    #2c2c2a;
    --baseline:    #383835;
    --border:      rgba(255,255,255,0.10);
    --border-strong: rgba(255,255,255,0.18);
    --accent:      #3987e5;
    --accent-wash: rgba(57,135,229,0.14);
    --good: #0ca30c;
    --warning: #fab219;
    --critical: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page:        #0d0d0d;
  --surface-1:   #1a1a19;
  --surface-2:   #232322;
  --text-primary:   #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted:     #898781;
  --gridline:    #2c2c2a;
  --baseline:    #383835;
  --border:      rgba(255,255,255,0.10);
  --border-strong: rgba(255,255,255,0.18);
  --accent:      #3987e5;
  --accent-wash: rgba(57,135,229,0.14);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
body { padding: 0 0 64px; }
a { color: var(--accent); }
code, .mono { font-family: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, monospace; }

.wrap { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; padding: 0 20px; }

/* ---------- top nav ---------- */
nav.topnav {
  background: var(--surface-1); border-bottom: 1px solid var(--border);
  padding: 12px 20px; margin-bottom: 22px;
}
nav.topnav .topnav-inner { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 18px; }
nav.topnav .brand { font-weight: 700; font-size: 14px; color: var(--text-primary); text-decoration: none; }
nav.topnav a.navlink { font-size: 13.5px; color: var(--text-secondary); text-decoration: none; font-weight: 600; padding: 6px 4px; border-bottom: 2px solid transparent; }
nav.topnav a.navlink:hover { color: var(--text-primary); }
nav.topnav a.navlink.active { color: var(--accent); border-color: var(--accent); }
nav.topnav .spacer { flex: 1; }
nav.topnav .meta { font-size: 12px; color: var(--text-muted); }

/* ---------- header ---------- */
header.page-head { display: flex; flex-direction: column; gap: 6px; padding: 4px 2px 2px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
h1 { font-size: 24px; line-height: 1.25; font-weight: 650; margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
h2 { font-weight: 650; }
.subhead { font-size: 14px; color: var(--text-secondary); max-width: 68ch; line-height: 1.5; margin: 0; }

/* ---------- generic card ---------- */
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.card-title { font-size: 14px; font-weight: 650; margin: 0; }
.card-note { font-size: 12px; color: var(--text-muted); margin: 0; }

/* ---------- KPI row ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
@media (max-width: 780px) { .kpi-row { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.kpi { background: var(--surface-1); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kpi .label { font-size: 12px; color: var(--text-muted); font-weight: 600; letter-spacing: 0.01em; }
.kpi .value { font-size: 26px; font-weight: 650; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12.5px; color: var(--text-secondary); line-height: 1.4; }
.kpi .sub a { font-weight: 600; text-decoration: none; }
.kpi .sub a:hover { text-decoration: underline; }

/* ---------- controls / filter row ---------- */
.controls-card { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.filter-group { display: flex; align-items: center; gap: 10px; }
.filter-group .flabel { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
select.month-select {
  font: inherit; font-size: 13.5px; font-weight: 600; color: var(--text-primary);
  background: var(--surface-1); border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 7px 10px;
}
.k-seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; }
.k-seg a {
  display: inline-block; text-decoration: none; font-size: 14px; font-weight: 600; color: var(--text-secondary);
  padding: 7px 14px; min-width: 42px; text-align: center; border-right: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.k-seg a:last-child { border-right: none; }
.k-seg a:hover { background: var(--surface-2); }
.k-seg a.active { background: var(--accent); color: #fff; }
.sil-readout { font-size: 12.5px; color: var(--text-muted); }
.sil-readout b { color: var(--text-secondary); font-variant-numeric: tabular-nums; }

/* ---------- legend chips ---------- */
.legend-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-secondary); }
.chip .swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.chip b { color: var(--text-primary); font-weight: 650; }

/* ---------- cluster grid ---------- */
.cluster-section { display: grid; grid-template-columns: 1.5fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 880px) { .cluster-section { grid-template-columns: 1fr; } }
.tier-cards { display: flex; flex-direction: column; gap: 10px; }
.tier-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 6px; background: var(--surface-1);
  border-left: 4px solid var(--tier-color, var(--accent));
}
.tier-card .tier-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.tier-card .tier-name { font-size: 13.5px; font-weight: 650; }
.tier-card .tier-count { font-size: 12.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tier-card .tier-stats { display: flex; gap: 14px; font-size: 12px; color: var(--text-secondary); flex-wrap: wrap; }
.tier-card .tier-stats b { color: var(--text-primary); font-variant-numeric: tabular-nums; font-weight: 650; }
.tier-card .tier-example { font-size: 12px; color: var(--text-muted); line-height: 1.45; }
.tier-card .tier-example a { color: var(--text-secondary); text-decoration: none; border-bottom: 1px dotted var(--border-strong); }
.tier-card .tier-example a:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- svg chart chrome ---------- */
svg.chart { display: block; width: 100%; height: auto; overflow: visible; }
svg.chart .grid-line { stroke: var(--gridline); stroke-width: 1; shape-rendering: crispEdges; }
svg.chart .axis-line { stroke: var(--baseline); stroke-width: 1; shape-rendering: crispEdges; }
svg.chart .axis-label { fill: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
svg.chart .axis-title { fill: var(--text-muted); font-size: 11px; font-weight: 600; letter-spacing: 0.02em; }
svg.chart a.mark { cursor: pointer; }
svg.chart a.mark:focus-visible circle.dot,
svg.chart a.mark:focus-visible rect.bar-seg { outline: 2px solid var(--accent); outline-offset: 1px; }
svg.chart circle.dot { stroke: var(--surface-1); stroke-width: 2; transition: r 0.1s ease; }
svg.chart a.mark:hover circle.dot, svg.chart a.mark:focus-visible circle.dot { r: 7; }
svg.chart rect.bar-seg { transition: opacity 0.1s ease; }
svg.chart a.mark:hover rect.bar-seg, svg.chart a.mark:focus-visible rect.bar-seg { opacity: 0.82; }
svg.chart .cat-label { fill: var(--text-secondary); font-size: 12px; font-weight: 600; }
svg.chart .seg-total { fill: var(--text-primary); font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---------- tooltip ---------- */
#tooltip {
  position: fixed; z-index: 50; pointer-events: none; max-width: 280px;
  background: var(--surface-1); border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 10px 12px; font-size: 12.5px; line-height: 1.45; color: var(--text-secondary);
  box-shadow: 0 6px 20px rgba(0,0,0,0.16); opacity: 0; transform: translateY(2px);
  transition: opacity 0.08s ease, transform 0.08s ease;
}
#tooltip.show { opacity: 1; transform: translateY(0); }
#tooltip .tt-value { font-size: 14px; font-weight: 650; color: var(--text-primary); font-variant-numeric: tabular-nums; }
#tooltip .tt-key { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
#tooltip .tt-key .swatch { width: 8px; height: 8px; border-radius: 2px; flex: none; }
#tooltip .tt-cap { margin-top: 6px; color: var(--text-secondary); }
#tooltip .tt-link { margin-top: 6px; font-size: 11.5px; color: var(--text-muted); }

/* ---------- tables ---------- */
.tables-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 780px) { .tables-grid { grid-template-columns: 1fr; } }
.table-scroll { overflow-x: auto; }
table.post-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.post-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--text-muted); font-weight: 650; padding: 6px 8px; border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
table.post-table td { padding: 8px 8px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--text-secondary); }
table.post-table td.num { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-primary); font-weight: 600; white-space: nowrap; }
table.post-table td.cap { max-width: 260px; }
table.post-table td.cap .cap-link { color: var(--text-primary); text-decoration: none; }
table.post-table td.cap .cap-link:hover { color: var(--accent); }
table.post-table td.cap .cap-meta { display: block; color: var(--text-muted); font-size: 11.5px; margin-top: 2px; }
table.post-table tr:last-child td { border-bottom: none; }
.tier-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

/* ---------- methodology ("cara hitung") ---------- */
.method-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 880px) { .method-grid { grid-template-columns: 1fr; } }
.method-step { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--surface-2); }
.method-step h3 { font-size: 13px; margin: 0 0 8px; font-weight: 650; }
.method-step p { font-size: 12.5px; color: var(--text-secondary); line-height: 1.55; margin: 0 0 8px; }
.formula { display: block; background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; margin: 6px 0; overflow-x: auto; }
table.calc-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
table.calc-table th, table.calc-table td { padding: 5px 8px; text-align: right; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
table.calc-table th:first-child, table.calc-table td:first-child { text-align: left; font-variant-numeric: normal; }
table.calc-table th { color: var(--text-muted); font-weight: 650; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.02em; }
.assigned-row { background: var(--accent-wash); }
.step-num { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; margin-right: 6px; }

footer.foot-note { font-size: 12px; color: var(--text-muted); line-height: 1.6; padding: 4px 2px; }
footer.foot-note p { margin: 0 0 6px; }
footer.foot-note p:last-child { margin-bottom: 0; }

.site-footer {
  border-top: 1px solid var(--border); margin-top: 8px; padding: 16px 2px 4px;
  font-size: 12px; color: var(--text-muted); display: flex; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.site-footer .brand { font-weight: 650; color: var(--text-secondary); }

/* ---------- brand gradient style ---------- */
nav.topnav .brand span, .site-footer .brand span {
  background: linear-gradient(45deg, #833ab4, #fd1d1d, #fcb045);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
  display: inline-block;
}

/* ---------- welcome banner ---------- */
.welcome-banner {
  position: relative;
  border-left: 4px solid #e1306c;
  background: linear-gradient(135deg, rgba(131,58,180,0.06) 0%, rgba(253,29,29,0.06) 50%, rgba(252,176,69,0.06) 100%);
  padding: 16px 20px;
  border-radius: 14px;
}
.welcome-banner-content { display: flex; align-items: center; gap: 16px; }
.welcome-logo-box { flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.welcome-logo-img { width: 52px; height: 52px; border-radius: 13px; box-shadow: 0 3px 12px rgba(225,48,108,0.28); display: block; }
.welcome-text { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.welcome-banner .welcome-title { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.35; }
.welcome-banner .welcome-body { margin: 0; font-size: 13px; color: var(--text-secondary); line-height: 1.55; max-width: 76ch; }

/* ---------- mobile responsiveness enhancements ---------- */
@media (max-width: 680px) {
  nav.topnav { padding: 10px 14px; margin-bottom: 16px; }
  nav.topnav .topnav-inner { gap: 12px; }
  nav.topnav .meta { display: none; }
  .wrap { padding: 0 12px; gap: 16px; }
  h1 { font-size: 20px; line-height: 1.3; }
  .subhead { font-size: 13px; }
  .welcome-banner { padding: 12px 14px; }
  .welcome-banner-content { gap: 12px; }
  .welcome-logo-img { width: 44px; height: 44px; border-radius: 11px; }
  .welcome-banner .welcome-title { font-size: 13.5px; }
  .welcome-banner .welcome-body { font-size: 12px; line-height: 1.45; }
  .kpi-row { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
  .kpi { padding: 12px 14px; }
  .kpi .value { font-size: 22px; }
  .controls-card { gap: 12px; padding: 14px; }
  .k-seg a { padding: 6px 10px; min-width: 32px; font-size: 13px; }
}

@media (max-width: 480px) {
  .kpi-row { grid-template-columns: 1fr; }
  .filter-group { width: 100%; justify-content: space-between; }
}

/* ---------- import page ---------- */
.status-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 650; padding: 3px 9px; border-radius: 999px; }
.status-badge.imported { background: rgba(12,163,12,0.14); color: var(--good); }
.status-badge.stale { background: rgba(250,178,25,0.16); color: #9a6b00; }
.status-badge.not_imported { background: var(--surface-2); color: var(--text-muted); }
table.file-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.file-table th { text-align: left; font-size: 11px; text-transform: uppercase; color: var(--text-muted); padding: 8px; border-bottom: 1px solid var(--border-strong); }
table.file-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.file-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13px; font-weight: 650;
  padding: 7px 14px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface-1);
  color: var(--text-primary); cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { opacity: 0.9; }
.upload-card { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.upload-card input[type="file"] { font-size: 13px; }
.flash-msg { border-radius: 10px; padding: 12px 16px; font-size: 13px; margin-bottom: 4px; }
.flash-msg.ok { background: rgba(12,163,12,0.12); color: var(--good); }
.flash-msg.err { background: rgba(208,59,59,0.12); color: var(--critical); }
.warn-list { font-size: 12px; color: var(--text-muted); margin: 6px 0 0; padding-left: 18px; }
