/* Admin dashboard: the board's Night Cards look (dark page, white cards), denser for tables. */
:root {
  --bg: #0C0D16;
  --on-bg: #FFFFFF;
  --on-bg-muted: #A9ACC8;
  --rule: rgba(255, 255, 255, .1);
  --surface: #FFFFFF;
  --tint: #F5F6FA;
  --ink: #11132A;
  --muted: #5D6080;
  --faint: #8B8EA6;
  --line: #E6E7F0;
  --accent: #4A63F5;
  --accent-soft: #E9ECFF;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --good: #0B6B4B;
  --good-soft: #E3F6EE;
  --warn: #8A5A00;
  --warn-soft: #FFF3D6;
  --bad: #B42318;
  --bad-soft: #FDECEA;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--on-bg); font: 14px/1.45 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; }
button, input, select { font: inherit; }
[hidden] { display: none !important; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 20px; padding: 12px 24px; background: rgba(12, 13, 22, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.brand { font-weight: 700; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand b { color: var(--on-bg-muted); font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; color: var(--on-bg-muted); padding: 7px 12px; border-radius: 8px; cursor: pointer; font-weight: 500; }
.tabs button:hover { color: var(--on-bg); background: rgba(255, 255, 255, .06); }
.tabs button.on { color: var(--on-bg); background: rgba(255, 255, 255, .1); }
.who { margin-left: auto; color: var(--on-bg-muted); font-size: 13px; display: flex; gap: 12px; align-items: center; }
.who button { background: none; border: 1px solid var(--rule); color: var(--on-bg-muted); border-radius: 8px; padding: 4px 10px; cursor: pointer; }

main { max-width: 1240px; margin: 0 auto; padding: 24px; }
.gate { max-width: 460px; margin: 12vh auto; text-align: center; }
.gate h1 { font-size: 24px; margin: 0 0 8px; }
.gate a.btn { display: inline-block; margin-top: 16px; }
.muted { color: var(--on-bg-muted); }

.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 16px; }
.two { grid-template-columns: 1fr 1fr; margin-bottom: 16px; }
@media (max-width: 860px) { .two { grid-template-columns: 1fr; } }
.section-title { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--on-bg-muted); margin: 8px 0 10px; }

.card { background: var(--surface); color: var(--ink); border-radius: var(--radius); padding: 18px 20px; min-width: 0; }
.card h2 { font-size: 15px; margin: 0; }
.card .sub { color: var(--muted); font-size: 13px; margin: 2px 0 14px; }
.kpi { padding: 16px 18px; }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi .value { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .foot { color: var(--faint); font-size: 12px; margin-top: 2px; }

.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); margin: -4px 0 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis { fill: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover { fill: rgba(17, 19, 42, .04); }
.tip { position: fixed; z-index: 20; pointer-events: none; background: #11132A; color: #fff; padding: 8px 10px; border-radius: 8px; font-size: 12.5px; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); white-space: nowrap; }
.tip b { display: block; margin-bottom: 2px; }
.tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

.rows { display: grid; gap: 8px; }
.row { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.row span:first-child { color: var(--muted); }
.row b { font-variant-numeric: tabular-nums; }
.meter { height: 8px; background: var(--tint); border-radius: 4px; overflow: hidden; margin: 2px 0 6px; }
.meter i { display: block; height: 100%; background: var(--series-1); border-radius: 4px; }

.bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.bar input[type=search] { flex: 1 1 240px; }
.bar .grow { flex: 1; }
input, select { border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; background: #fff; color: var(--ink); min-width: 0; }
input:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.primary, .ghost, .mini { border-radius: 9px; padding: 8px 14px; cursor: pointer; font-weight: 600; border: 1px solid transparent; }
.primary { background: var(--accent); color: #fff; }
.primary:hover { filter: brightness(1.08); }
.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.ghost:hover { background: var(--tint); }
a.btn { text-decoration: none; }
.add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px; background: var(--tint); border-radius: 10px; margin-bottom: 12px; }
.add input { flex: 1 1 200px; }
.note { color: var(--muted); font-size: 12.5px; }
.count { color: var(--muted); font-size: 13px; margin: 0 0 8px; }

.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none; }
.table th[data-sort=""] { cursor: default; }
.table th.sorted::after { content: ' ↓'; }
.table th.sorted.asc::after { content: ' ↑'; }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.table tr:hover td { background: #FAFBFD; }
.table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .name { font-weight: 600; }
.table .email { color: var(--muted); font-size: 12.5px; }
.table tr.off td { color: var(--faint); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--tint); color: var(--muted); }
.pill.qtc { background: #F3E8FF; color: #6B21A8; }
.pill.skool { background: var(--accent-soft); color: #2A3BB0; }
.pill.manual { background: var(--tint); color: var(--muted); }
.pill.admin { background: #11132A; color: #fff; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.mini { padding: 4px 9px; font-size: 12.5px; background: #fff; border-color: var(--line); color: var(--ink); }
.mini:hover { background: var(--tint); }
.mini.danger { color: var(--bad); }
.menu { position: relative; display: inline-block; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; background: #fff; color: var(--ink); padding: 10px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); transition: .2s; font-weight: 500; z-index: 30; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.err { background: var(--bad-soft); color: var(--bad); }

@media (max-width: 640px) {
  .top { padding: 10px 16px; gap: 10px; }
  .who { margin-left: 0; width: 100%; }
  main { padding: 16px; }
  .kpi .value { font-size: 24px; }
}
