:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-2: #f8f7f4;
  --border: #e3e1da;
  --text: #1c1b19;
  --muted: #6b6860;
  --accent: #1f5eff;
  --accent-ink: #ffffff;
  --ok: #18794e;   --ok-bg: #e6f4ec;
  --warn: #9a5b00; --warn-bg: #fdf1dc;
  --bad: #b4321f;  --bad-bg: #fbe8e4;
  --info: #2450c2; --info-bg: #e8eeff;
  --chip: #efede7;
  --shadow: 0 1px 2px rgba(20, 18, 10, .05), 0 4px 16px rgba(20, 18, 10, .04);
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211; --surface: #1b1b19; --surface-2: #222220; --border: #2f2e2b;
    --text: #ecebe6; --muted: #9b998f; --accent: #6b93ff; --accent-ink: #0b0f1d;
    --ok: #4cc38a; --ok-bg: #16301f; --warn: #f0b44c; --warn-bg: #33270f;
    --bad: #ff7a66; --bad-bg: #3a1c17; --info: #8fb0ff; --info-bg: #1b2440;
    --chip: #2a2a27; --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.55 "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5rem; letter-spacing: -.01em; line-height: 1.3; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 15px; font-weight: 650; }
h3 { font-size: 13.5px; font-weight: 650; margin-top: .9rem; }
p { margin: .35rem 0; }
code, pre { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; }
pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px;
  overflow: auto; max-height: 420px; white-space: pre-wrap; word-break: break-word; }
blockquote { margin: 4px 0 6px; padding: 4px 10px; border-left: 3px solid var(--border); color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.ok-text { color: var(--ok); } .warn-text { color: var(--warn); } .bad-text { color: var(--bad); }
.break { overflow-wrap: anywhere; }
.clip { display: block; max-width: 340px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt { margin-top: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
table th.num, table td.num { text-align: right; }

/* top bar */
.topbar { display: flex; align-items: center; gap: 16px; padding: 10px 24px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: var(--text); color: var(--bg); font-size: 12px; font-weight: 700; }
.nav { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 7px 11px; border-radius: 7px; color: var(--muted); font-weight: 550; white-space: nowrap; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--chip); color: var(--text); }
.logout { margin: 0; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 22px 24px 56px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head > div { min-width: 0; flex: 1 1 420px; }
.crumb { margin: 0 0 2px; font-size: 12.5px; }

/* cards & grids */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.card-head h2 { margin: 0; }
.card-warn { border-color: var(--warn); }
.grid-2, .grid-3, .grid-side { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-2 > .card, .grid-3 > .card, .grid-side > .card { margin-bottom: 0; }
.grid-2, .grid-3, .grid-side { margin-bottom: 16px; }
.stat-card .big, .link-card .big { font-size: 26px; font-weight: 650; margin: 2px 0; font-variant-numeric: tabular-nums; }
.link-card { color: var(--text); display: block; }
.link-card:hover { text-decoration: none; border-color: var(--accent); }
.empty { padding: 28px 8px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text); margin-bottom: 4px; }

/* badges & chips */
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; vertical-align: 1px; }
.t-ok { background: var(--ok-bg); color: var(--ok); }
.t-warn { background: var(--warn-bg); color: var(--warn); }
.t-bad { background: var(--bad-bg); color: var(--bad); }
.t-info { background: var(--info-bg); color: var(--info); }
.t-muted { background: var(--chip); color: var(--muted); }
.chip { display: inline-block; padding: 1px 8px; margin: 0 4px 4px 0; border-radius: 999px; background: var(--chip);
  font-size: 12px; color: var(--text); white-space: nowrap; }
a.chip:hover { text-decoration: none; outline: 1px solid var(--border); }
.chip-on { outline: 2px solid var(--accent); }
.chip-aud { background: var(--info-bg); color: var(--info); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 4px; }
.tags .chip { margin: 0; }
.score { display: inline-grid; place-items: center; min-width: 46px; height: 46px; padding: 0 8px; border-radius: 12px;
  background: var(--info-bg); color: var(--info); font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; flex: none; }
.score-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin: 0; }
.score-grid dt { font-size: 12px; color: var(--muted); font-weight: 600; }
.score-grid dd { margin: 0; }
.cov { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cov-k { font-size: 12px; color: var(--muted); }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  font-weight: 600; padding: 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-off td { opacity: .55; }
.src { display: flex; gap: 10px; align-items: flex-start; }
.plat { flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; }
.plat-youtube { background: #d9261c; } .plat-instagram { background: #b5338a; } .plat-tiktok { background: #111; }
@media (prefers-color-scheme: dark) { .plat-tiktok { background: #3a3a36; } }

/* item lists */
.items { list-style: none; margin: 0; padding: 0; }
.item-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.item-row:first-child { padding-top: 0; }
.item-row:last-child { border-bottom: 0; }
.item-main { flex: 1; min-width: 0; }
.item-title { font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.ext { white-space: nowrap; }
.plain { list-style: none; padding: 0; margin: 4px 0; }
.plain li { margin: 4px 0; }
.points li { margin: 4px 0; }
.refs { color: var(--muted); font-size: 11.5px; font-family: ui-monospace, Consolas, monospace; }
.refs a { color: var(--muted); }
.warn-list li { color: var(--warn); }

/* claims & evidence */
.claims { list-style: none; padding: 0; margin: 0; }
.claim { padding: 10px 0; border-bottom: 1px solid var(--border); }
.claim:last-child { border-bottom: 0; }
.claim-head { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.claim-text { margin: 4px 0; }
.ev-details summary { cursor: pointer; font-size: 12.5px; color: var(--muted); }
.ev-mini { list-style: none; padding-left: 0; }
.ev-mini li { margin: 6px 0; font-size: 13px; }
.evidence { list-style: none; padding: 0; margin: 0; }
.evidence li { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.evidence li:target { background: var(--info-bg); }
.ev-loc { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.ev-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 4px 12px; margin: 0; }
.kv dt { color: var(--muted); font-size: 12.5px; }
.kv dd { margin: 0; }
.impact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 8px; }
.impact { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: var(--surface-2); }
.impact h3 { margin-top: 0; }
.exp { border-bottom: 1px solid var(--border); padding: 8px 0; }

/* forms */
.form { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .field { flex: 1 1 160px; }
.row > .grow { flex: 3 1 260px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; margin: 0; }
.field > span { font-weight: 600; font-size: 12.5px; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); color: var(--text); font: inherit; min-width: 0; }
input[type=file] { font: inherit; color: var(--muted); max-width: 100%; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 550; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters .field { flex: 1 1 150px; }
.filter-btns { display: flex; gap: 6px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.inline-form select { width: auto; }
.feedback { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.feedback input { flex: 1 1 220px; }
.fb-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.actions-bar { display: flex; justify-content: flex-end; margin-bottom: 16px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.07); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab { padding: 9px 12px; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.on { color: var(--text); border-bottom-color: var(--text); }
.tab .count { font-size: 12px; padding: 0 7px; border-radius: 999px; background: var(--chip); margin-left: 4px; }

.pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.pager-btns { display: flex; gap: 6px; }

.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 550; overflow-wrap: anywhere; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-err { background: var(--bad-bg); color: var(--bad); }
.flash-warn { background: var(--warn-bg); color: var(--warn); }
.flash-info { background: var(--info-bg); color: var(--info); }

.login { max-width: 380px; margin: 10vh auto 0; }
.login-brand { margin-bottom: 6px; }

.report-body { font-size: 14.5px; line-height: 1.65; overflow-wrap: anywhere; }
.report-body h1 { font-size: 20px; }
.report-body h2 { font-size: 17px; margin-top: 1.4rem; padding-top: .8rem; border-top: 1px solid var(--border); }
.report-body h3 { font-size: 15px; }
.report-body table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; }
.report-body th, .report-body td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; }
.report-body li { margin: 3px 0; }

details > summary { cursor: pointer; }
details.card > summary { font-weight: 600; }

@media (max-width: 900px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2, .grid-side { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; padding: 8px 16px; gap: 8px; }
  .brand-name { display: none; }
  .nav { order: 3; flex-basis: 100%; }
  .logout { margin-left: auto; }
  .wrap { padding: 16px 16px 40px; }
  .hide-sm { display: none; }
  .card { padding: 14px; }
  .evidence li { grid-template-columns: 1fr; gap: 2px; }
  .kv { grid-template-columns: 1fr; }
  .kv dd { margin-bottom: 6px; }
  .clip { max-width: 180px; }
  .page-head .inline-form { width: 100%; }
  .page-head .inline-form select { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Tabel bertumpuk di layar sempit (kelas .stack) */
@media (max-width: 640px) {
  .table.stack thead { display: none; }
  .table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: 100%; }
  .table.stack tr { padding: 10px 0; border-bottom: 1px solid var(--border); }
  .table.stack tr:last-child { border-bottom: 0; }
  .table.stack td { border: 0; padding: 3px 4px; }
  .table.stack td.hide-sm { display: none; }
  .table.stack .clip { max-width: 100%; }
}
