:root {
  --bg: #f6f7f9; --panel: #fff; --text: #16181d; --muted: #6b7280; --line: #e5e7eb;
  --accent: #2563eb; --fb: #6366f1; --wa: #16a34a; --amo: #0ea5e9; --capi: #f59e0b;
  --bad: #dc2626; --bad-bg: #fef2f2; --ok-bg: #f0fdf4; --warn-bg: #fffbeb;
  --radius: 10px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115; --panel: #171a21; --text: #e6e8ec; --muted: #9aa1ad; --line: #272b35;
    --bad-bg: #2a1215; --ok-bg: #0f2418; --warn-bg: #2a2110; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }

header { position: sticky; top: 0; z-index: 5; background: var(--panel); border-bottom: 1px solid var(--line); }
.bar { max-width: 1280px; margin: 0 auto; padding: 10px 16px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.brand { font-weight: 650; margin-right: auto; }
.seg { display: inline-flex; flex-shrink: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { white-space: nowrap; border: 0; background: transparent; padding: 6px 10px; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: #fff; }
select, input[type=date] { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; }
.ghost { background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; }

main { max-width: 1280px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.panel h2 { font-size: 15px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.panel h2 .hint { font-weight: 400; color: var(--muted); font-size: 13px; }

.funnel { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.step { position: relative; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--panel); }
.step::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; border-radius: var(--radius) 0 0 var(--radius); background: var(--c); }
.step .lbl { color: var(--muted); font-size: 13px; padding-right: 44px; }
.step .num { font-size: 30px; font-weight: 650; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.step .sub { color: var(--muted); font-size: 12.5px; min-height: 18px; }
.step .conv { position: absolute; right: 12px; top: 12px; font-size: 12px; color: var(--muted); }
.bad { color: var(--bad); }

.chart { width: 100%; overflow-x: auto; }
.chart svg { display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 8px; color: var(--muted); font-size: 12.5px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

.tbl { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
td.wrap { white-space: normal; max-width: 360px; }
tr:last-child td { border-bottom: 0; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; }
.pill.ok { background: var(--ok-bg); color: var(--wa); }
.pill.err { background: var(--bad-bg); color: var(--bad); }
.pill.wait { background: var(--warn-bg); color: var(--capi); }
.pill.none { color: var(--muted); border: 1px solid var(--line); }
.empty { color: var(--muted); padding: 12px 0; }

.schools { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.school { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.school b { display: block; margin-bottom: 6px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.small { font-size: 12.5px; color: var(--muted); }

.cols { display: grid; grid-template-columns: 1fr; gap: 16px; }

@media (max-width: 860px) {
  .funnel { grid-template-columns: repeat(2, 1fr); }
  .brand { width: 100%; }
}
@media (max-width: 420px) {
  .funnel { grid-template-columns: 1fr; }
}

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: 100%; max-width: 340px; display: grid; gap: 10px; }
.login input { padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.login button { padding: 9px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; }
