/* Atensi design system: shared tokens + components for every page.
   Chart colors come from the validated dataviz reference palette (--s1..--s3, --pos/--neu/--neg, --seq-*). */
@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap");

:root {
  color-scheme: light;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --page: #f4f4f0; --surface: #ffffff; --surface-2: #f3f2ee; --surface-3: #ebeae4;
  --ink: #0f1115; --ink-2: #4f5158; --muted: #8a8b90;
  --grid: #e7e6e0; --axis: #c9c8c0; --border: rgba(15,17,21,0.08); --border-strong: rgba(15,17,21,0.14);
  --shadow: 0 1px 2px rgba(15,17,21,.04), 0 4px 16px -8px rgba(15,17,21,.10);
  --shadow-lg: 0 2px 4px rgba(15,17,21,.04), 0 16px 40px -16px rgba(15,17,21,.22);
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a;
  --pos: #2a78d6; --neu: #c3c2b7; --neg: #e34948;
  --seq-lo: #cde2fb; --seq-hi: #184f95;
  --st1: #eb6834; --st2: #4a3aa7; --st3: #1baf7a;
  --accent: #2a78d6; --accent-ink: #1c5cab; --accent-soft: rgba(42,120,214,.10);
  --good: #0a7a0a; --bad: #d03b3b; --warn: #fab219; --warn-ink: #8a5a00;
  --appbar: rgba(244,244,240,.82);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0b0b0c; --surface: #161618; --surface-2: #1f1f22; --surface-3: #2a2a2e;
    --ink: #f5f5f4; --ink-2: #c3c2b7; --muted: #8a8a86;
    --grid: #29292c; --axis: #3a3a3d; --border: rgba(255,255,255,0.08); --border-strong: rgba(255,255,255,0.14);
    --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px -12px rgba(0,0,0,.6);
    --shadow-lg: 0 1px 0 rgba(255,255,255,.04) inset, 0 20px 48px -16px rgba(0,0,0,.8);
    --s1: #3987e5; --s2: #d95926; --s3: #199e70;
    --pos: #3987e5; --neu: #4a4a47; --neg: #e66767;
    --seq-lo: #1c2a3d; --seq-hi: #86b6ef;
    --st1: #d95926; --st2: #9085e9; --st3: #199e70;
    --accent: #3987e5; --accent-ink: #86b6ef; --accent-soft: rgba(57,135,229,.16);
    --good: #0ca30c; --bad: #e66767; --warn: #fab219; --warn-ink: #fab219;
    --appbar: rgba(11,11,12,.78);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0b0b0c; --surface: #161618; --surface-2: #1f1f22; --surface-3: #2a2a2e;
  --ink: #f5f5f4; --ink-2: #c3c2b7; --muted: #8a8a86;
  --grid: #29292c; --axis: #3a3a3d; --border: rgba(255,255,255,0.08); --border-strong: rgba(255,255,255,0.14);
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px -12px rgba(0,0,0,.6);
  --shadow-lg: 0 1px 0 rgba(255,255,255,.04) inset, 0 20px 48px -16px rgba(0,0,0,.8);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70;
  --pos: #3987e5; --neu: #4a4a47; --neg: #e66767;
  --seq-lo: #1c2a3d; --seq-hi: #86b6ef;
  --st1: #d95926; --st2: #9085e9; --st3: #199e70;
  --accent: #3987e5; --accent-ink: #86b6ef; --accent-soft: rgba(57,135,229,.16);
  --good: #0ca30c; --bad: #e66767; --warn: #fab219; --warn-ink: #fab219;
  --appbar: rgba(11,11,12,.78);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 14px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 28px 20px 72px; }
header { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; }
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 6px; font-weight: 750; letter-spacing: -0.025em; }
h2 { font-size: 15px; margin: 0 0 2px; font-weight: 650; letter-spacing: -0.01em; }
.sub { color: var(--ink-2); font-size: 13.5px; }
.muted { color: var(--muted); font-size: 12px; }
.eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); }
.num, td.num, th.num, .tabular { font-variant-numeric: tabular-nums; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- app bar ---------- */
.appbar { position: sticky; top: 0; z-index: 20; background: var(--appbar); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--border); }
.appbar-inner { max-width: 1280px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 6px; min-height: 58px; }
.logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 16px; letter-spacing: -0.02em; color: var(--ink); margin-right: 14px; }
.logo:hover { text-decoration: none; }
.logo-mark { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #2a78d6, #1c5cab 60%, #104281); box-shadow: 0 2px 8px -2px rgba(42,120,214,.6); }
.logo-mark svg { width: 18px; height: 18px; }
.navlink { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 9px; color: var(--ink-2); font-weight: 600; font-size: 13.5px; }
.navlink:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.navlink.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; min-width: 0; }
.crumb b { color: var(--ink); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32ch; }
.appbar .spacer { flex: 1; }
.iconbtn { appearance: none; border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; cursor: pointer; }
.iconbtn:hover { color: var(--ink); background: var(--surface-2); }
.appbar-inner .iconbtn { margin-left: 4px; }
.userchip { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 0 10px; height: 36px; border-radius: 10px; background: var(--surface-2); }
.userchip svg { width: 15px; height: 15px; }

/* ---------- buttons & form ---------- */
.btn { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 0 14px; height: 36px; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s, box-shadow .15s, transform .05s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 6px 16px -8px var(--accent); }
.btn.primary:hover { background: var(--accent); filter: brightness(1.07); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-group { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; background: var(--surface); }
.btn-group .btn { border: 0; border-radius: 0; height: 34px; }
.btn-group .btn + .btn { border-left: 1px solid var(--border-strong); }
select, input[type=text], input[type=password], textarea { font: inherit; font-size: 13.5px; color: var(--ink); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; }
select { height: 36px; padding: 0 32px 0 12px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8b90' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; }
input[type=text], input[type=password], textarea { padding: 9px 12px; width: 100%; }
input[type=text], input[type=password] { height: 38px; }
textarea { resize: vertical; min-height: 64px; line-height: 1.5; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.filters label { color: var(--ink-2); font-size: 13px; font-weight: 600; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 12px; margin-bottom: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.toolbar .muted { margin-left: auto; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; min-width: 0; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.grid { display: grid; gap: 16px; }
.section-title { margin: 34px 0 14px; }
.section-title h2 { font-size: 17px; }
.empty { padding: 56px 16px; text-align: center; color: var(--ink-2); }

/* hero header used on dashboard / report */
.hero { position: relative; overflow: hidden; padding: 26px 26px 22px; margin-bottom: 18px;
  background: radial-gradient(900px 260px at 100% -40%, var(--accent-soft), transparent 70%), var(--surface); }
.hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: radial-gradient(var(--border-strong) 1px, transparent 1px); background-size: 18px 18px;
  -webkit-mask-image: linear-gradient(90deg, transparent 55%, #000); mask-image: linear-gradient(90deg, transparent 55%, #000); }
.hero > * { position: relative; z-index: 1; }
.hero-row { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-end; justify-content: space-between; }
.hero h1 { font-size: 30px; }
.hero .meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--ink-2); font-size: 13px; margin-top: 4px; }
.hero .meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- KPIs ---------- */
.kpis { grid-template-columns: 1.5fr repeat(5, 1fr); margin-bottom: 16px; }
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi .label { color: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.kpi .value { font-size: 28px; font-weight: 750; letter-spacing: -0.03em; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .note { color: var(--muted); font-size: 12px; margin-top: auto; padding-top: 4px; }
.kpi.hero-kpi { background: linear-gradient(160deg, var(--accent-soft), transparent 60%), var(--surface); }
.kpi.hero-kpi .value { font-size: 48px; }
.kpi .value.pos { color: var(--good); } .kpi .value.neg { color: var(--bad); }

/* ---------- regions ---------- */
.regions { grid-template-columns: repeat(3, 1fr); margin-bottom: 16px; }
.region { position: relative; overflow: hidden; }
.region::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 3px; background: var(--rc, var(--accent)); }
.region .top { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.region .top h2 { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; }
.region .idx { font-size: 46px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; margin: 14px 0 0; font-variant-numeric: tabular-nums; }
.region .idx small { font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.meter { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin: 12px 0 16px; }
.meter > i { display: block; height: 100%; border-radius: 4px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; font-size: 13px; }
.facts .muted { display: block; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.facts b { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.facts .wide { grid-column: 1 / -1; padding-top: 12px; border-top: 1px dashed var(--border-strong); }
.facts .wide b { font-size: 13.5px; }

/* ---------- charts & tables ---------- */
.two { grid-template-columns: 3fr 2fr; margin-bottom: 16px; }
.two-even { grid-template-columns: 1fr 1fr; margin-bottom: 16px; }
.chart { width: 100%; height: 300px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 650; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--grid); }
td { padding: 11px 10px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
tbody tr:hover td, table tr:hover td { background: color-mix(in oklab, var(--surface-2) 55%, transparent); }
tr:last-child td { border-bottom: 0; }
.bar { height: 8px; border-radius: 0 4px 4px 0; background: var(--accent); min-width: 2px; }
.sentbar { display: flex; height: 8px; gap: 2px; width: 120px; }
.sentbar i { display: block; height: 100%; }
.sentbar i:first-child { border-radius: 4px 0 0 4px; } .sentbar i:last-child { border-radius: 0 4px 4px 0; }

/* ---------- posts ---------- */
.posts { grid-template-columns: repeat(3, 1fr); }
.post { display: flex; flex-direction: column; gap: 10px; transition: box-shadow .15s, transform .15s; }
.post:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.post .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.post .summary { font-size: 13.5px; line-height: 1.55; }
.post .orig { font-size: 12px; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; font-style: italic; }
.post .stats { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--grid); display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; align-items: center; }
.author { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--ink-2); background: var(--surface-3); }
.author .who { min-width: 0; line-height: 1.3; }
.author .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 650; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.badge svg { width: 12px; height: 12px; }
.sent { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 650; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); text-transform: capitalize; }
.sent::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: var(--neu); }
.sent.positif::before { background: var(--pos); } .sent.negatif::before { background: var(--neg); }

/* ---------- misc ---------- */
.livelog { font: 12px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); border-radius: 10px; padding: 12px 14px; max-height: 200px; overflow: auto; white-space: pre-wrap; color: var(--ink-2); margin-top: 4px; }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 650; padding: 5px 11px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.status.siap { background: color-mix(in oklab, var(--good) 12%, var(--surface)); color: var(--good); }
.status.siap::before { background: var(--good); }
.status.error { background: color-mix(in oklab, var(--bad) 12%, var(--surface)); color: var(--bad); }
.status.error::before { background: var(--bad); }
.status.crawling, .status.menganalisis, .status.antre { background: var(--accent-soft); color: var(--accent-ink); }
.status.crawling::before, .status.menganalisis::before, .status.antre::before { background: var(--accent); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.chip { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); margin: 0 5px 5px 0; }
.alert { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; font-size: 13px;
  background: linear-gradient(90deg, color-mix(in oklab, var(--warn) 14%, var(--surface)), var(--surface) 60%); }
.alert.tinggi { background: linear-gradient(90deg, color-mix(in oklab, var(--bad) 14%, var(--surface)), var(--surface) 60%); }
.alert b { display: block; font-size: 13.5px; }
.alert .icon { width: 26px; height: 26px; flex: none; border-radius: 8px; display: grid; place-items: center; font-weight: 800; color: var(--warn-ink); background: color-mix(in oklab, var(--warn) 22%, var(--surface)); }
.alert.tinggi .icon { color: var(--bad); background: color-mix(in oklab, var(--bad) 18%, var(--surface)); }
.tabs { display: inline-flex; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: 10px; }
.tabs button { border: 0; background: transparent; color: var(--ink-2); font: inherit; font-size: 12.5px; font-weight: 600; padding: 5px 11px; border-radius: 8px; cursor: pointer; }
.tabs button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
::selection { background: var(--accent-soft); }

@media (max-width: 1080px) {
  .kpis { grid-template-columns: repeat(3, 1fr); } .kpi.hero-kpi { grid-column: span 3; }
  .posts { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
  .two, .two-even, .regions, .posts { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; } .kpi.hero-kpi { grid-column: span 2; }
  .wrap { padding: 20px 16px 56px; }
  .appbar-inner { padding: 8px 12px; gap: 2px; min-height: 54px; }
  .logo { margin-right: 6px; }
  .navlink { padding: 7px 9px; }
  .crumb, .userchip { display: none !important; }
  .hero { padding: 20px 18px; } .hero h1 { font-size: 24px; }
  .kpi.hero-kpi .value { font-size: 38px; }
}
@media (max-width: 400px) { .logo-text { display: none; } }
@media print { .appbar { display: none; } }

/* ---------- stance ---------- */
.stance-split { display: flex; height: 44px; border-radius: 12px; overflow: hidden; gap: 2px; margin: 6px 0 14px; }
.stance-split > div { display: flex; align-items: center; padding: 0 12px; color: #fff; font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; min-width: 0; }
.stance-split > div.neutral { color: var(--ink); }
.stance-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.stance-legend .item { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; position: relative; overflow: hidden; }
.stance-legend .item::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.stance-legend .pct { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stance-legend .sub2 { font-size: 12px; color: var(--ink-2); }
.stance-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 650; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.stance-chip::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--c, var(--neu)); }
.stance-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.stance-col h3 { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 0 0 10px; }
.stance-col h3 i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.voice { border-top: 1px solid var(--grid); padding: 10px 0; font-size: 13px; }
.voice .why { color: var(--ink-2); font-size: 12.5px; margin-top: 3px; }
.voice .why::before { content: "Alasan AI: "; font-weight: 650; color: var(--muted); }
