:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --line: #e2e0d9;
  --text: #16150f;
  --text-2: #52514e;
  --muted: #7a7872;
  --accent: #8a1c22;          /* merah marun parlemen, hanya untuk aksen UI */
  --accent-ink: #ffffff;
  --focus: #2a78d6;
  /* ramp ordinal (biru) untuk skor & jenjang: rendah -> tinggi */
  --o1: #86b6ef; --o2: #5598e7; --o3: #2a78d6; --o4: #1c5cab; --o5: #104281;
  --unknown: #c9c7c0;
  --bar: #2a78d6;
  --track: #e9e7e1;
  --warn-bg: #fff4dc; --warn-ink: #7a4b00;
  --shadow: 0 1px 2px rgba(20, 18, 10, .06), 0 4px 16px rgba(20, 18, 10, .05);
  --r: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --line: #33332f;
    --text: #f0efec; --text-2: #c3c2b7; --muted: #8f8e86;
    --accent: #e0646a; --accent-ink: #1a1a19; --focus: #6da7ec;
    --o1: #184f95; --o2: #256abf; --o3: #3987e5; --o4: #6da7ec; --o5: #9ec5f4;
    --unknown: #4a4a45; --bar: #3987e5; --track: #2c2c29;
    --warn-bg: #3a2e12; --warn-ink: #f2cf86;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --line: #33332f;
  --text: #f0efec; --text-2: #c3c2b7; --muted: #8f8e86;
  --accent: #e0646a; --accent-ink: #1a1a19; --focus: #6da7ec;
  --o1: #184f95; --o2: #256abf; --o3: #3987e5; --o4: #6da7ec; --o5: #9ec5f4;
  --unknown: #4a4a45; --bar: #3987e5; --track: #2c2c29;
  --warn-bg: #3a2e12; --warn-ink: #f2cf86;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--focus); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 16px; }

/* Header */
header.top { background: var(--surface); border-bottom: 1px solid var(--line); }
header.top .wrap { display: flex; align-items: center; gap: 16px; padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 36px; height: 36px; border-radius: 8px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 800; letter-spacing: -.02em; flex: none; }
.brand h1 { font-size: 17px; margin: 0; letter-spacing: -.01em; }
.brand p { margin: 0; font-size: 12.5px; color: var(--text-2); }
nav.tabs { display: flex; gap: 4px; margin-left: auto; }
nav.tabs button { border: 0; background: none; padding: 8px 14px; border-radius: 8px; cursor: pointer; color: var(--text-2); font-weight: 600; }
nav.tabs button[aria-selected="true"] { background: var(--surface-2); color: var(--text); }
.icon-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; width: 36px; height: 36px; cursor: pointer; }

/* Filter bar */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 16px 0 8px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; cursor: pointer; font-weight: 600; color: var(--text-2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.filters input[type="search"], .filters select {
  border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 10px; min-height: 36px; max-width: 100%;
}
.filters input[type="search"] { flex: 1 1 220px; min-width: 0; }
.filters select { flex: 0 1 auto; }
.filters .spacer { flex: 1; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 12px; cursor: pointer; font-weight: 600; min-height: 36px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* Ringkasan */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 8px 0 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.kpi .v { font-size: 26px; font-weight: 750; letter-spacing: -.02em; }
.kpi .l { font-size: 12.5px; color: var(--text-2); }

/* Kartu anggota */
.result-meta { color: var(--text-2); font-size: 13px; margin: 0 0 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; padding-bottom: 40px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: grid;
  grid-template-columns: 64px 1fr; gap: 12px; cursor: pointer; text-align: left; width: 100%; transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--text-2); transform: translateY(-1px); }
.photo { width: 64px; height: 80px; border-radius: 8px; object-fit: cover; object-position: top; background: var(--surface-2); display: block; }
.card h3 { font-size: 14px; margin: 0 0 2px; line-height: 1.3; overflow-wrap: anywhere; }
.card .sub { font-size: 12.5px; color: var(--text-2); margin: 0 0 8px; }
.score-row { display: flex; align-items: center; gap: 8px; }
.score-num { font-weight: 750; font-size: 18px; min-width: 42px; }
.meter { flex: 1; height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--bar); border-radius: 0 4px 4px 0; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.tag { font-size: 11.5px; padding: 2px 7px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.tag.jen { color: var(--text); font-weight: 700; }
.kat { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.kat i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* Panel detail */
.drawer-bg { position: fixed; inset: 0; background: rgba(10, 10, 8, .45); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 100%); background: var(--surface); z-index: 21;
  overflow-y: auto; box-shadow: -10px 0 40px rgba(0,0,0,.2); }
.drawer-head { display: grid; grid-template-columns: 96px 1fr auto; gap: 16px; padding: 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.drawer-head .photo { width: 96px; height: 120px; }
.drawer-head h2 { font-size: 19px; margin: 0 0 4px; line-height: 1.25; overflow-wrap: anywhere; }
.drawer-head .sub { color: var(--text-2); font-size: 13.5px; margin: 0 0 8px; }
.big-score { display: flex; align-items: baseline; gap: 8px; }
.big-score b { font-size: 34px; letter-spacing: -.03em; }
.drawer section { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer h4 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }
.param { display: grid; grid-template-columns: 200px 1fr 44px; gap: 10px; align-items: center; padding: 6px 0; }
.param .nm { font-size: 13.5px; font-weight: 600; }
.param .nm small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.param .val { text-align: right; font-weight: 700; }
.param .why { grid-column: 1 / -1; font-size: 12.5px; color: var(--text-2); margin-top: -4px; }
.param.na .val, .param.na .nm { color: var(--muted); }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th, table.t td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { font-size: 12px; color: var(--text-2); font-weight: 600; }
.src { font-size: 11px; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line); color: var(--text-2); white-space: nowrap; }
.note { background: var(--warn-bg); color: var(--warn-ink); border-radius: 8px; padding: 8px 10px; font-size: 13px; margin: 6px 0; }
.close { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; width: 36px; height: 36px; cursor: pointer; font-size: 18px; }
.links a { margin-right: 12px; font-size: 13.5px; }
.prose { font-size: 13.5px; color: var(--text-2); }

/* Statistik */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 14px; padding: 16px 0 40px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; min-width: 0; }
.panel h3 { font-size: 15px; margin: 0 0 2px; }
.panel .cap { font-size: 12.5px; color: var(--text-2); margin: 0 0 14px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 52px; gap: 10px; align-items: center; margin: 6px 0; font-size: 13px; }
.hbar .lb { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.hbar .tr { height: 14px; background: transparent; position: relative; }
.hbar .tr i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--bar); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar .vl { text-align: right; color: var(--text-2); font-size: 12.5px; }
.stack { display: flex; height: 22px; gap: 2px; margin: 4px 0 10px; }
.stack i { display: block; height: 100%; min-width: 2px; }
.stack i:first-child { border-radius: 4px 0 0 4px; }
.stack i:last-child { border-radius: 0 4px 4px 0; }
.stack-row { display: grid; grid-template-columns: 60px 1fr; gap: 10px; align-items: center; font-size: 13px; font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12.5px; color: var(--text-2); margin-top: 4px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
details.tbl { margin-top: 10px; font-size: 13px; }
details.tbl summary { cursor: pointer; color: var(--text-2); }

/* Metodologi */
.method { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 380px); gap: 16px; padding: 16px 0 40px; }
.method .panel h3 { margin-bottom: 8px; }
.w-row { display: grid; grid-template-columns: 1fr 56px; gap: 4px 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.w-row label { font-weight: 600; font-size: 13.5px; }
.w-row input[type="range"] { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); }
.w-row output { text-align: right; font-weight: 700; }
.w-row small { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.w-sum { display: flex; justify-content: space-between; padding: 10px 0; font-weight: 700; }

#tip { position: fixed; pointer-events: none; background: var(--text); color: var(--surface); font-size: 12.5px; padding: 6px 9px;
  border-radius: 6px; z-index: 50; max-width: 280px; display: none; }

.empty { text-align: center; color: var(--text-2); padding: 60px 0; }
.disclaimer { font-size: 12.5px; color: var(--text-2); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; margin-top: 14px; }

@media (max-width: 720px) {
  nav.tabs { margin-left: 0; width: 100%; }
  nav.tabs button { flex: 1; padding: 8px 6px; }
  .stats, .method { grid-template-columns: 1fr; }
  .param { grid-template-columns: 1fr 44px; }
  .param .meter { grid-column: 1 / -1; grid-row: 2; }
  .drawer-head { grid-template-columns: 72px 1fr auto; padding: 14px; }
  .drawer-head .photo { width: 72px; height: 90px; }
  .drawer section { padding: 14px; }
  .hbar { grid-template-columns: 90px 1fr 44px; }
  .filters select { flex: 1 1 140px; }
}
