/* Kidcreate Studio HQ Reports. Brand: teal #008E9C, deep teal #00636E, green #7BA229, yellow #FEC825 (sampled from the logo). Single light theme with an explicit white page (Matt keeps devices in dark mode). */
:root {
  color-scheme: light;
  --page: #ffffff;
  --panel: #f5f9f9;
  --line: #e1eaeb;
  --grid: #edf2f3;
  --ink: #1f2a2c;
  --muted: #5d6c6e;
  --faint: #8a9799;
  --teal: #008e9c;
  --deep: #00636e;
  --yellow: #fec825;
  --green: #7ba229;
  --magenta: #c43493;
  --teal-tint: #e6f4f5;
  --good: #2e7d32; --good-bg: #e8f3e8;
  --warn: #8a5a00; --warn-bg: #fff4d6;
  --bad: #b3261e;  --bad-bg: #fdecea;
  --radius: 10px;
  --display: 'Outfit', 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --body: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { background: #ffffff !important; color: var(--ink); }
body { margin: 0; font-family: var(--body); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--display); color: var(--deep); margin: 0; text-wrap: balance; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; color: var(--ink); }
a { color: var(--deep); }
.num, td.num, .kpi b, .tabular { font-variant-numeric: tabular-nums; }
button, input, select { font: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* ---------- gates ---------- */
.gate { position: fixed; inset: 0; display: grid; place-items: center; background: #ffffff; padding: 16px; z-index: 50; }
.gate-card { max-width: 420px; width: 100%; display: grid; gap: 14px; text-align: center; justify-items: center; padding: 32px 24px; border: 1px solid var(--line); border-radius: 14px; }
.gate-card p { margin: 0; color: var(--muted); }
.gate-msg { min-height: 1.5em; color: var(--bad) !important; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--teal); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.brand img { height: 30px; width: auto; display: block; }
.brand-tag { font-family: var(--display); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--deep); background: var(--yellow); padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.gate-logo { width: min(280px, 80%); height: auto; }
.gate-card h1 { font-size: 20px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--deep); }
.gate-card { border-top: 6px solid var(--teal); }

/* ---------- buttons ---------- */
.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--teal); }
.btn.primary { background: var(--deep); border-color: var(--deep); color: #fff; }
.btn.primary:hover { background: #004f58; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.linkbtn { background: none; border: 0; color: var(--deep); cursor: pointer; padding: 0; text-decoration: underline; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; background: #fff; border-bottom: 3px solid var(--yellow); }
.topbar-inner, .controls-inner, .page, .foot { max-width: 1240px; margin: 0 auto; padding-inline: 20px; }
.topbar-inner { display: flex; align-items: center; gap: 20px; padding-block: 10px; flex-wrap: wrap; }
.brand { display: flex; gap: 12px; align-items: center; font-family: var(--display); font-weight: 700; font-size: 17px; color: var(--deep); text-decoration: none; }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.tabs a { padding: 6px 12px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; }
.tabs a:hover { color: var(--deep); background: var(--panel); }
.tabs a[aria-current="page"] { background: var(--deep); color: #fff; }
.who { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 13px; }
.demo-banner { background: var(--warn-bg); color: var(--warn); font-size: 13px; padding: 8px 20px; text-align: center; }

/* ---------- controls ---------- */
.controls { background: var(--panel); border-bottom: 1px solid var(--line); }
.controls-inner { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding-block: 10px; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; }
.seg button { border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 5px 11px; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--teal); border-color: var(--teal); color: #fff; }
.custom-range { display: flex; gap: 8px; flex-wrap: wrap; }
.custom-range label, .select-label { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
input[type="date"], select, input[type="email"], input[type="text"] { border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; background: #fff; color: var(--ink); }
.period-note { font-size: 13px; color: var(--muted); margin-left: auto; }

/* ---------- page ---------- */
.page { padding-block: 22px 40px; display: grid; gap: 22px; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 75ch; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
@media (max-width: 520px) { .grid.two { grid-template-columns: 1fr; } }

.card { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 16px; display: grid; gap: 12px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.card-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.chart-box { position: relative; height: 280px; }
.chart-box.tall { height: 420px; }
.chart-box.short { height: 220px; }
.table-toggle { font-size: 12px; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--teal); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 2px; align-content: start; }
.kpi .l { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--deep); font-weight: 700; }
.kpi b { font-family: var(--display); font-size: 25px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.kpi .sub { font-size: 12px; color: var(--muted); }
.delta { display: inline-flex; gap: 3px; align-items: center; font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 999px; width: fit-content; }
.delta.up { color: var(--good); background: var(--good-bg); }
.delta.down { color: var(--bad); background: var(--bad-bg); }
.delta.flat { color: var(--muted); background: var(--grid); }

/* Highlights */
.highlights { border-left: 4px solid var(--yellow); background: #fff8df; padding: 14px 18px; border-radius: 0 var(--radius) var(--radius) 0; display: grid; gap: 6px; }
.highlights h2 { font-size: 15px; }
.highlights ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; max-width: 95ch; }

/* Tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; vertical-align: middle; }
th { background: var(--panel); font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--deep); font-weight: 700; position: sticky; top: 0; }
th.sortable { cursor: pointer; }
th.sortable::after { content: ' ↕'; color: #a9b8ba; }
th[aria-sort="descending"]::after { content: ' ↓'; color: var(--teal); }
th[aria-sort="ascending"]::after { content: ' ↑'; color: var(--teal); }
td.num, th.num { text-align: right; }
tr:last-child td { border-bottom: 0; }
td .wrap { white-space: normal; display: inline-block; min-width: 160px; }
.muted { color: var(--muted); }
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.ok { background: var(--good-bg); color: var(--good); }
.bar { display: grid; grid-template-columns: 56px auto; gap: 8px; align-items: center; }
.bar .track { height: 8px; background: var(--grid); border-radius: 4px; overflow: hidden; }
.bar .track i { display: block; height: 100%; background: var(--teal); border-radius: 4px; }
.spark { display: block; }

.note { background: var(--warn-bg); color: #5b4300; border-radius: 8px; padding: 10px 14px; font-size: 13px; max-width: 100ch; }
.empty { color: var(--muted); padding: 24px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.form-row label { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); }
.status { font-size: 13px; }
.status.ok { color: var(--good); } .status.err { color: var(--bad); }
.foot { padding-block: 16px 32px; color: var(--faint); font-size: 12px; border-top: 1px solid var(--line); }

@media (max-width: 720px) {
  .brand img { height: 24px; }
  .topbar-inner { gap: 10px; }
  .who { width: 100%; justify-content: space-between; }
  .period-note { margin-left: 0; width: 100%; }
  .chart-box { height: 240px; }
  .chart-box.tall { height: 380px; }
  .topbar-inner, .controls-inner, .page, .foot { padding-inline: 16px; }
}
