/* Insight — report harian per brand. Sistem token sama dengan Mitra Performance (Inter + OKLCH), hue teal 195. */
:root {
  --bg: oklch(0.985 0.004 195);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.972 0.006 195);
  --ink: oklch(0.24 0.02 220);
  --ink-2: oklch(0.44 0.02 220);
  --ink-3: oklch(0.52 0.02 220);
  --line: oklch(0.91 0.008 200);
  --line-2: oklch(0.85 0.01 200);
  --brand: oklch(0.52 0.1 195);
  --brand-ink: oklch(0.42 0.1 195);
  --brand-wash: oklch(0.955 0.025 195);
  --warn: oklch(0.58 0.13 70);
  --warn-wash: oklch(0.96 0.04 80);
  --bad: oklch(0.55 0.19 27);
  --bad-wash: oklch(0.955 0.03 27);
  --shadow: 0 1px 2px oklch(0.24 0.02 220 / 0.06), 0 1px 3px oklch(0.24 0.02 220 / 0.05);
  --r: 10px;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: oklch(0.19 0.012 220); --surface: oklch(0.225 0.014 220); --surface-2: oklch(0.26 0.015 220);
    --ink: oklch(0.95 0.006 220); --ink-2: oklch(0.77 0.012 220); --ink-3: oklch(0.66 0.014 220);
    --line: oklch(0.32 0.014 220); --line-2: oklch(0.4 0.016 220);
    --brand: oklch(0.74 0.1 195); --brand-ink: oklch(0.82 0.09 195); --brand-wash: oklch(0.3 0.04 195);
    --warn: oklch(0.8 0.13 82); --warn-wash: oklch(0.32 0.06 82);
    --bad: oklch(0.7 0.17 27); --bad-wash: oklch(0.32 0.07 27);
    --shadow: 0 1px 2px oklch(0 0 0 / 0.4);
  }
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.01em; }
.wrap { max-width: 1040px; margin: 0 auto; padding-inline: 16px; }
.muted { color: var(--ink-3); font-weight: 400; }
[hidden] { display: none !important; }

/* ---------- topbar ---------- */
.topbar { position: sticky; top: 0; z-index: 10; background: color-mix(in oklch, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding-block: 12px; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand h1 { font-size: 16px; font-weight: 650; }
.brand .sub { font-size: 12px; color: var(--ink-3); }
.mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--brand-wash); color: var(--brand-ink); }
.mark svg { width: 18px; height: 18px; }
.tabs { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.tab { font: inherit; font-weight: 550; font-size: 13px; border: 0; background: transparent; color: var(--ink-2); padding: 6px 14px; border-radius: 7px; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

main { padding-block: 20px 60px; }

/* ---------- controls ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 550; color: var(--ink-2); min-width: 0; }
input, select, textarea {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); width: 100%;
  border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px;
}
input:focus-visible, select:focus-visible, .btn:focus-visible, .tab:focus-visible, .seg-opt input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 1px; }
::placeholder { color: var(--ink-3); opacity: 0.75; }
.btn { font: inherit; font-weight: 600; font-size: 13.5px; border-radius: 8px; padding: 9px 16px; cursor: pointer; border: 1px solid transparent; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }
.btn.primary { background: var(--brand-ink); color: oklch(0.99 0 0); padding-inline: 22px; }
.btn.primary:hover { background: var(--brand); }
.btn.primary:disabled { opacity: 0.6; cursor: wait; }
.btn.ghost { background: var(--surface); border-color: var(--line-2); color: var(--ink-2); }
.btn.ghost:hover { color: var(--ink); background: var(--surface-2); }
.btn.sm { padding: 4px 10px; font-size: 12.5px; }
.btn.icon { font-size: 16px; line-height: 1; padding: 6px 10px; }
.btn.danger:hover, .btn.icon:hover { color: var(--bad); border-color: var(--bad); background: var(--bad-wash); }

/* ---------- form ---------- */
.form { padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.form-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.form-head h2 { font-size: 17px; font-weight: 650; }
.row-top { display: grid; grid-template-columns: 160px 200px 1fr; gap: 12px; align-items: end; }
fieldset.field { border: 0; margin: 0; padding: 0; }
fieldset.field legend { padding: 0; margin-bottom: 5px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-opt { position: relative; }
.seg-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg-opt span { display: inline-block; padding: 8px 14px; border: 1px solid var(--line-2); border-radius: 8px; font-size: 13.5px; font-weight: 550; color: var(--ink-2); background: var(--surface); cursor: pointer; }
.seg-opt span:hover { background: var(--surface-2); color: var(--ink); }
.seg-opt input:checked + span { background: var(--brand-ink); border-color: var(--brand-ink); color: oklch(0.99 0 0); }

.notice { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 8px; font-size: 13px; background: var(--warn-wash); border: 1px solid color-mix(in oklch, var(--warn) 40%, var(--line)); }

.block { display: flex; flex-direction: column; gap: 8px; }
.block h3 { font-size: 14.5px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.block h3 .muted { font-size: 12px; }
.no { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--brand-wash); color: var(--brand-ink); font-size: 12px; font-weight: 700; flex: none; }
.hint-sm { margin: 0; font-size: 12px; color: var(--ink-3); }

.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
.perf th, .perf td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.perf thead th { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.perf tbody th { font-weight: 550; font-size: 13.5px; }
.perf .unit { font-size: 11px; color: var(--ink-3); font-weight: 500; margin-left: 2px; }
.perf-input td { min-width: 150px; }
.perf-input input { text-align: right; font-variant-numeric: tabular-nums; }
.perf output { display: block; text-align: right; padding: 8px 10px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.perf tr.auto th { color: var(--ink-3); }

.pairs { display: grid; grid-template-columns: 22px 1fr 1fr; gap: 8px; align-items: center; margin-bottom: 6px; }
.tickets { display: grid; grid-template-columns: 130px 1fr 1.4fr 38px; gap: 8px; align-items: center; margin-bottom: 6px; }
.pairs.head, .tickets.head { font-size: 12px; font-weight: 600; color: var(--ink-3); margin-bottom: 0; }
.point { display: grid; grid-template-columns: 22px 1fr 38px; gap: 8px; align-items: center; margin-bottom: 6px; }
.add-point { align-self: flex-start; }
.idx { font-size: 12px; font-weight: 600; color: var(--ink-3); text-align: center; }
#add-ticket { align-self: flex-start; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-foot { display: flex; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 16px; }

/* ---------- rekap ---------- */
.filters { padding: 14px; display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters .field { width: 160px; }
.filters .grow { flex: 1 1 180px; width: auto; }
.daynav { display: flex; gap: 6px; align-items: flex-end; }
.daynav .btn { height: 38px; font-size: 16px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-block: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.stat .n { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12px; color: var(--ink-3); }
.stat.warn .n { color: var(--warn); }

.missing { padding: 12px 14px; margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border-color: color-mix(in oklch, var(--warn) 40%, var(--line)); background: color-mix(in oklch, var(--warn-wash) 60%, var(--surface)); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--surface); border: 1px solid var(--line-2); border-radius: 99px; padding: 3px 10px; font-size: 13px; }

.day { margin-bottom: 24px; }
.day-head { font-size: 14px; font-weight: 650; margin: 0 0 8px; display: flex; gap: 8px; align-items: baseline; }
.day-head .muted { font-size: 12.5px; }
.list .report { padding: 16px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 14px; }
.report-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.brand-tag { font-weight: 650; font-size: 15px; }
.report-act { display: flex; gap: 6px; align-items: center; font-size: 12px; }
.r-block h4 { font-size: 13px; font-weight: 650; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.r-block .no { width: 20px; height: 20px; font-size: 11px; }
.r-block .perf td { text-align: right; font-variant-numeric: tabular-nums; }
.r-block .perf thead th:not(:first-child) { text-align: right; }
.r-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.r-list li { overflow-wrap: anywhere; }
.r-list .result { display: block; color: var(--ink-2); font-size: 13px; }
.r-list .result::before { content: "→ "; color: var(--brand-ink); }
.r-tickets th, .r-tickets td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.r-tickets th { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.mono { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.r-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.r-two:empty { display: none; }
.empty { color: var(--ink-3); text-align: center; padding: 40px 0; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 20; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 9px; font-weight: 550; box-shadow: 0 8px 24px oklch(0 0 0 / 0.2); max-width: calc(100% - 32px); }
.toast.bad { background: var(--bad); color: oklch(0.99 0 0); }

/* ---------- viz (dataviz method: palet tervalidasi, light + dark) ---------- */
:root {
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a;   /* Bunga Papan · Rangkaian Bunga · Parselia */
  --neutral: oklch(0.44 0.02 220);               /* Overall (gabungan) */
  --seq-fill: #2a78d6; --seq-track: #cde2fb;      /* meter: satu hue */
  --st-good: #0ca30c; --st-warning: #fab219; --st-critical: #d03b3b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --s1: #3987e5; --s2: #d95926; --s3: #199e70;
    --neutral: oklch(0.76 0.012 220);
    --seq-fill: #3987e5; --seq-track: #1d3654;
  }
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.rekap-body { transition: opacity .15s; }
.rekap-body.loading { opacity: .55; }
.sec-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 22px 0 10px; }
.sec-title h2 { font-size: 15px; font-weight: 650; }
.sec-title .muted { font-size: 12.5px; }

.presets { display: flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; align-self: flex-end; }
.presets button { font: inherit; font-size: 12.5px; font-weight: 550; border: 0; background: transparent; color: var(--ink-2); padding: 6px 10px; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.presets button:hover { color: var(--ink); }
.presets button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; flex: none; }
.key.s1, .lg-key.s1, .tip-key.s1 { background: var(--s1); }
.key.s2, .lg-key.s2, .tip-key.s2 { background: var(--s2); }
.key.s3, .lg-key.s3, .tip-key.s3 { background: var(--s3); }
.key.neutral, .lg-key.neutral, .tip-key.neutral { background: var(--neutral); }

/* status per brand */
.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.bcard { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.bc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.bc-head h3 { font-size: 14px; font-weight: 650; display: flex; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 550; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; padding: 2px 9px 2px 7px; white-space: nowrap; }
.pill svg { width: 13px; height: 13px; fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.st-good svg { stroke: var(--st-good); }
.st-warning svg { stroke: var(--st-warning); }
.st-critical svg { stroke: var(--st-critical); }
.bc-hero { display: flex; flex-direction: column; }
.bc-label { font-size: 12px; color: var(--ink-3); }
.bc-value { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; }
.meter { display: flex; flex-direction: column; gap: 6px; border-radius: 6px; outline-offset: 4px; cursor: default; }
.meter:focus-visible { outline: 2px solid var(--brand); }
.meter-track { position: relative; height: 8px; border-radius: 4px; background: var(--seq-track); }
.meter-fill { height: 100%; border-radius: 4px; background: var(--seq-fill); transition: filter .15s; }
.meter:hover .meter-fill { filter: brightness(1.12); }
.meter-pace { position: absolute; top: -4px; width: 2px; height: 16px; margin-left: -1px; background: var(--ink); border-radius: 1px; box-shadow: 0 0 0 2px var(--surface); }
.meter-cap { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.meter-cap b { color: var(--ink); font-weight: 650; }
.bc-mini { margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.bc-mini dt { font-size: 11.5px; color: var(--ink-3); }
.bc-mini dd { margin: 0; font-size: 13.5px; font-weight: 600; }
.bc-foot { font-size: 11.5px; color: var(--ink-3); }
.bc-note, .bc-empty { margin: 0; font-size: 12.5px; color: var(--ink-3); }
.bcard.is-empty { background: var(--surface-2); box-shadow: none; border-style: dashed; border-color: var(--line-2); }
.bcard.is-empty .btn { align-self: flex-start; }

/* tren */
.viz { margin: 22px 0 0; padding: 16px; }
.viz-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.viz-head h3 { font-size: 15px; font-weight: 650; }
.viz-head p { margin: 2px 0 0; font-size: 12.5px; }
.viz-tools { display: flex; gap: 8px; align-items: center; }
.viz-tools select { width: auto; padding: 5px 8px; font-size: 13px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 12px 0 4px; font-size: 12.5px; color: var(--ink-2); }
.legend:empty { display: none; }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg-key { width: 14px; height: 2px; border-radius: 1px; }
.chart { margin-top: 8px; min-height: 120px; }
.line-chart { display: block; overflow: visible; }
.line-chart:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; border-radius: 4px; }
.line-chart .grid { stroke: var(--line); stroke-width: 1; }
.line-chart .baseline { stroke: var(--line-2); stroke-width: 1; }
.line-chart .tick { fill: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.line-chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.line-chart .dot { stroke: var(--surface); stroke-width: 2; }
.line-chart .end-label { fill: var(--ink-2); font-size: 12px; font-weight: 550; }
.line-chart .xhair { stroke: var(--line-2); stroke-width: 1; }
.line-chart .hit { fill: transparent; cursor: crosshair; }
.line-chart .hover-dots { pointer-events: none; }
.line.s1 { stroke: var(--s1); } .dot.s1 { fill: var(--s1); }
.line.s2 { stroke: var(--s2); } .dot.s2 { fill: var(--s2); }
.line.s3 { stroke: var(--s3); } .dot.s3 { fill: var(--s3); }
.line.neutral { stroke: var(--neutral); } .dot.neutral { fill: var(--neutral); }
.viz-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 140px; border: 1px dashed var(--line-2); border-radius: 8px; color: var(--ink-3); text-align: center; padding: 16px; }
.viz-empty p { margin: 0; }
.viz-table { margin-top: 12px; font-size: 13px; }
.viz-table th, .viz-table td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.viz-table th:first-child { text-align: left; }
.viz-table thead th { font-size: 12px; color: var(--ink-3); font-weight: 600; }

.viz-tip { position: fixed; z-index: 30; pointer-events: none; min-width: 180px; max-width: 280px; background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; box-shadow: 0 8px 24px oklch(0 0 0 / 0.14); font-size: 12.5px; }
.tip-title { font-size: 11.5px; color: var(--ink-3); margin-bottom: 4px; }
.tip-row { display: grid; grid-template-columns: 14px auto 1fr; align-items: center; gap: 8px; padding-block: 1px; }
.tip-row b { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tip-row span { color: var(--ink-2); }
.tip-key { width: 12px; height: 2px; border-radius: 1px; }
.tip-key.none { background: transparent; }
.tip-key.seq { background: var(--seq-fill); height: 6px; border-radius: 2px; }
.tip-key.pace { background: var(--ink); width: 2px; height: 12px; justify-self: center; }

.stats .stat .l { margin-bottom: 2px; }
.report-who { display: flex; align-items: center; flex-wrap: wrap; }

@media (max-width: 760px) {
  .presets { flex-basis: 100%; }
  .presets button { flex: 1; }
  .bc-mini { grid-template-columns: repeat(2, 1fr); }
  .viz-tools { width: 100%; }
  .viz-tools select { flex: 1; }
  .row-top, .row2, .r-two { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .filters .field { width: calc(50% - 5px); }
  .daynav { flex-basis: 100%; }
  .daynav .field { flex: 1; width: auto; }
  .brand { margin-right: 0; flex-basis: 100%; }
  .tabs, .tab { flex: 1; }
  .perf-input td { min-width: 130px; }
  .pairs { grid-template-columns: 22px 1fr; }
  .pairs input[data-k="result"] { grid-column: 2; }
  .pairs.head { display: none; }
  .tickets { grid-template-columns: 1fr 38px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
  .tickets input { grid-column: 1; }
  .tickets [data-remove] { grid-column: 2; grid-row: 1; }
  .tickets.head { display: none; }
}
