:root {
  color-scheme: light;
  --surface-0: #f3f2ee;
  --surface-1: #fcfcfb;
  --border: #e4e2dc;
  --grid: #ebe9e4;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #77756f;
  --brand: #0f5b46;
  --brand-ink: #ffffff;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--surface-0); color: var(--text-primary); line-height: 1.45; }
a { color: var(--brand); }
button { font: inherit; cursor: pointer; }
.wrap { max-width: 880px; margin: 0 auto; padding: 16px; }
.topbar { background: var(--brand); color: var(--brand-ink); }
.topbar .wrap { display: flex; align-items: center; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
.topbar h1 { font-size: 17px; margin: 0; flex: 1; }
.topbar a { color: var(--brand-ink); font-size: 14px; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: rgba(255,255,255,.18); }
.demo-note { font-size: 13px; color: var(--text-secondary); background: #fff7e0; border: 1px solid #f1dfa6; padding: 8px 12px; border-radius: 10px; margin: 12px 0; }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.card h2 { font-size: 15px; margin: 0 0 10px; }
.card h2 .sub { font-weight: 400; color: var(--text-muted); font-size: 13px; }
.muted { color: var(--text-muted); font-size: 13px; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 720px) { .grid2 { grid-template-columns: 1fr 1fr; } .grid2 > .card { margin: 0; } }

/* Hero number */
.hero-label { font-size: 13px; color: var(--text-secondary); }
.hero-num { font-size: 34px; font-weight: 700; letter-spacing: -0.5px; margin: 2px 0 6px; }
.deltas { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; color: var(--text-secondary); }
.deltas b { color: var(--text-primary); }

/* Alerts: status colour always paired with icon + label */
.alert { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--grid); }
.alert:first-of-type { border-top: 0; }
.alert .dot { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; color: #fff; font-weight: 700; }
.alert.critical .dot { background: var(--critical); }
.alert.serious .dot { background: var(--serious); }
.alert.warning .dot { background: var(--warning); color: #3a2a00; }
.alert.good .dot { background: var(--good); }
.alert .lvl { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); }
.alert .t { font-weight: 600; font-size: 14.5px; }
.alert .d { font-size: 13.5px; color: var(--text-secondary); }

/* AI summary */
.ai { background: linear-gradient(180deg, #eef6f2, var(--surface-1)); }
.ai ul { margin: 0; padding-left: 18px; }
.ai li { margin: 3px 0; }

/* Ranking bars */
.rank-row { display: grid; grid-template-columns: 92px 1fr auto; align-items: center; gap: 10px; padding: 6px 0; font-size: 14px; }
.rank-bar { height: 12px; background: var(--grid); border-radius: 0 4px 4px 0; overflow: hidden; }
.rank-bar span { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.rank-row .v { font-variant-numeric: tabular-nums; font-weight: 600; }

/* Report status */
.status-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.status-item { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; font-size: 13.5px; }
.status-item .s-ok { color: #0a7a0a; font-weight: 600; }
.status-item .s-wait { color: #8a5a00; font-weight: 600; }
.status-item img { width: 100%; border-radius: 6px; margin-top: 6px; }

/* Charts */
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 99px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 5px 12px; font-size: 13px; color: var(--text-secondary); }
.seg button[aria-pressed="true"] { background: var(--brand); color: #fff; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--text-secondary); margin: 4px 0 8px; }
.legend i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-size: 11px; fill: var(--text-muted); font-family: inherit; }
.chart .lbl { fill: var(--text-secondary); font-size: 11.5px; font-weight: 600; }
.tip { position: absolute; pointer-events: none; background: #1f1f1d; color: #fff; font-size: 12.5px; padding: 8px 10px; border-radius: 8px; white-space: nowrap; transform: translate(-50%, -110%); opacity: 0; transition: opacity .1s; z-index: 5; }
.tip.on { opacity: 1; }
.tip i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.linkbtn { background: none; border: 0; color: var(--brand); padding: 0; font-size: 13px; text-decoration: underline; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 5px 6px; border-bottom: 1px solid var(--grid); text-align: right; }
table.data th:first-child, table.data td:first-child { text-align: left; }
.table-scroll { max-height: 260px; overflow: auto; margin-top: 8px; }

/* Payment split */
.split { display: flex; height: 22px; gap: 2px; margin: 8px 0; }
.split span { display: block; height: 100%; }
.split span:first-child { border-radius: 4px 0 0 4px; }
.split span:last-child { border-radius: 0 4px 4px 0; }

/* WhatsApp preview */
.phone { max-width: 320px; margin: 0 auto; background: #efe7dd; border-radius: 22px; border: 8px solid #1f1f1d; overflow: hidden; }
.phone .ph-head { background: #075e54; color: #fff; padding: 10px 12px; font-size: 14px; font-weight: 600; }
.phone .ph-head small { display: block; font-weight: 400; opacity: .8; font-size: 11.5px; }
.phone .ph-body { padding: 12px 10px 16px; min-height: 200px; }
.bubble { background: #fff; border-radius: 0 10px 10px 10px; padding: 8px 10px 16px; font-size: 13.5px; position: relative; max-width: 92%; box-shadow: 0 1px 1px rgba(0,0,0,.08); white-space: pre-line; margin-bottom: 8px; }
.bubble .time { position: absolute; right: 8px; bottom: 3px; font-size: 10.5px; color: #8a8a8a; }

/* Ask */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { border: 1px solid var(--border); background: var(--surface-0); border-radius: 99px; padding: 6px 12px; font-size: 13px; color: var(--text-primary); }
.chip:hover { border-color: var(--brand); }
.ask-form { display: flex; gap: 8px; }
.ask-form input { flex: 1; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); font: inherit; }
.btn { background: var(--brand); color: #fff; border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 600; text-decoration: none; display: inline-block; }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
.answer { margin-top: 10px; padding: 10px 12px; background: #eef6f2; border-radius: 10px; font-size: 14px; display: none; }
.answer.on { display: block; }
.answer .q { font-weight: 600; margin-bottom: 4px; }
footer { text-align: center; font-size: 13px; color: var(--text-muted); padding: 24px 16px 40px; }
