:root {
  --ink: #0b0b0c;
  --ink-2: #3f3f46;
  --muted: #71717a;
  --line: #e4e4e7;
  --bg: #f4f3ef;
  --card: #ffffff;
  --accent: #e8a317;
  --accent-2: #8c8a2b;
  --accent-soft: #fbf1d9;
  --good: #3f7d3a;
  --bad: #b3261e;
  --s1: #0b0b0c;
  --s2: #e8a317;
  --s3: #8c8a2b;
  --s4: #6b7280;
  --s5: #c2410c;
  --s6: #1f6f78;
  --s7: #a16207;
  --s8: #9ca3af;
  --radius: 14px;
  --font: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  --display: 'Archivo', 'Inter', system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #f4f4f5; --ink-2: #d4d4d8; --muted: #a1a1aa; --line: #2e2e33;
    --bg: #0e0e10; --card: #18181b; --accent-soft: #3a2f14;
    --s1: #f4f4f5; --s4: #a1a1aa; --s8: #52525b;
  }
}
:root[data-theme="dark"] {
  --ink: #f4f4f5; --ink-2: #d4d4d8; --muted: #a1a1aa; --line: #2e2e33;
  --bg: #0e0e10; --card: #18181b; --accent-soft: #3a2f14;
  --s1: #f4f4f5; --s4: #a1a1aa; --s8: #52525b;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
.boot { padding: 48px 16px; text-align: center; color: var(--muted); }

/* Header */
.top { position: sticky; top: 0; z-index: 10; background: #0b0b0c; color: #fff; padding: 12px 16px calc(10px) ; padding-top: max(12px, env(safe-area-inset-top)); }
.top-row { display: flex; align-items: center; gap: 12px; max-width: 1200px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.mark { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--accent); display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 13px; letter-spacing: .5px; color: var(--accent); flex: none; }
.brand-name { font-family: var(--display); font-weight: 800; letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 12px; color: #a1a1aa; }
.icon-btn { background: transparent; border: 1px solid #3f3f46; color: #fff; border-radius: 10px; padding: 7px 10px; cursor: pointer; font-size: 13px; white-space: nowrap; }
.icon-btn:hover { border-color: var(--accent); }
.tabs { display: flex; gap: 4px; max-width: 1200px; margin: 10px auto 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { background: transparent; border: 0; color: #a1a1aa; padding: 8px 12px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 14px; white-space: nowrap; }
.tab[aria-selected="true"] { background: var(--accent); color: #0b0b0c; }

/* Period bar */
.period { max-width: 1200px; margin: 0 auto; padding: 14px 16px 4px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.period select { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; min-width: 170px; }
.range { color: var(--muted); font-size: 13px; }
.pill { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--ink-2); }
.pill.live { background: #e5f2e3; color: var(--good); }

main { max-width: 1200px; margin: 0 auto; padding: 8px 16px 64px; }
h2 { font-family: var(--display); font-size: 18px; margin: 26px 0 10px; letter-spacing: .2px; }
h2 small { font-family: var(--font); font-weight: 500; color: var(--muted); font-size: 13px; margin-left: 6px; }

/* KPI cards */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.kpi .l { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.kpi .v { font-family: var(--display); font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .n { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.hi { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.kpi.hi .l, .kpi.hi .n { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.kpi.gold { border-color: var(--accent); background: var(--accent-soft); }
@media (max-width: 860px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi .v { font-size: 20px; } }

/* Cards & grids */
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-width: 0; }
.card h3 { margin: 0 0 10px; font-size: 14px; font-weight: 700; }
.card .sub { color: var(--muted); font-size: 12px; margin: -6px 0 10px; }
.empty { color: var(--muted); font-size: 13px; padding: 18px 0; text-align: center; }

/* Tables */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; position: sticky; left: 0; background: var(--card); }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; }
tfoot td { font-weight: 700; border-bottom: 0; border-top: 2px solid var(--ink); }
td.neg { color: var(--bad); }
td .tag { font-size: 11px; color: var(--muted); margin-left: 4px; }

/* Charts */
.chart { width: 100%; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .val { fill: var(--ink); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.donut-wrap { display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: center; }
@media (max-width: 420px) { .donut-wrap { grid-template-columns: 1fr; justify-items: center; } }
.hbar { display: grid; grid-template-columns: minmax(90px, 140px) 1fr auto; gap: 8px; align-items: center; font-size: 13px; margin: 6px 0; }
.hbar .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { height: 18px; background: color-mix(in srgb, var(--line) 60%, transparent); border-radius: 5px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--ink); border-radius: 5px; }
.hbar.gold .fill { background: var(--accent); }
.hbar .num { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 48px; text-align: right; }

/* Barbers */
.barber { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.barber:last-child { border-bottom: 0; }
.barber .nm { font-weight: 700; }
.barber .rt { font-family: var(--display); font-weight: 800; font-size: 20px; }
.progress { grid-column: 1 / -1; height: 8px; background: color-mix(in srgb, var(--line) 70%, transparent); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); }
.barber .meta { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }

/* Forms */
.btn { background: var(--ink); color: var(--bg); border: 0; border-radius: 10px; padding: 10px 14px; font-weight: 700; cursor: pointer; }
.btn.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn:disabled { opacity: .5; cursor: default; }
.field { display: grid; gap: 6px; margin: 10px 0; }
.field label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.field input, .field textarea, .field select { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.note { font-size: 13px; color: var(--ink-2); background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.err { color: var(--bad); font-size: 13px; margin-top: 8px; }
.ok { color: var(--good); font-size: 13px; margin-top: 8px; }
.log { font-size: 12px; color: var(--muted); max-height: 260px; overflow: auto; }
.log div { padding: 4px 0; border-bottom: 1px dashed var(--line); word-break: break-word; }

/* Sign in */
.signin { max-width: 380px; margin: 10vh auto; padding: 0 16px; }
.signin .card { padding: 22px; }
.signin h1 { font-family: var(--display); font-size: 22px; margin: 12px 0 4px; }
.signin p { color: var(--muted); margin: 0 0 12px; }
.signin .mark { width: 54px; height: 54px; font-size: 18px; color: var(--accent); background: #0b0b0c; }

.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: s 0.8s linear infinite; vertical-align: -2px; }
@keyframes s { to { transform: rotate(360deg); } }
@media print {
  .top, .period .seg, .icon-btn { display: none !important; }
  body { background: #fff; }
}

.top-logo { width: 40px; height: 40px; border-radius: 50%; flex: none; display: block; }
.signin-logo { width: 88px; height: 88px; border-radius: 50%; display: block; }

/* ---------- Drive In theme (charcoal, beige, red; Jost + IBM Plex Sans like driveinbarbershop.com) ---------- */
body.theme-drivein {
  --accent: #c8102e; --accent-2: #7a0a1c; --accent-soft: #f6e3e5; --bg: #f3efe8;
  --s1: #2b2b2b; --s2: #c8102e; --s3: #7a0a1c; --s4: #8a8178; --s5: #d97706; --s6: #1f6f78; --s7: #a3a3a3; --s8: #d6cfc4;
  --font: 'IBM Plex Sans', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  --display: 'Jost', 'IBM Plex Sans', system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  body.theme-drivein:not([data-theme="light"]) { --bg: #141312; --card: #1d1c1b; --accent-soft: #3b1a1f; --accent: #e23b55; --s1: #f4f4f5; --s8: #4a4540; }
}
body.theme-drivein .top { background: #2b2b2b; }
body.theme-drivein .tab[aria-selected="true"] { background: var(--accent); color: #fff; }
body.theme-drivein .top-logo { border-radius: 9px; }
body.theme-drivein .signin-logo { border-radius: 18px; }

/* Quota bar: red under 90%, amber 90–99%, green at or over quota. */
.qbar { height: 12px; background: color-mix(in srgb, var(--line) 70%, transparent); border-radius: 999px; overflow: hidden; }
.qbar > div { height: 100%; border-radius: 999px; }
.qbar.sm { height: 7px; min-width: 70px; }
.q-red { background: #c62828; } .q-amber { background: #e0a100; } .q-green { background: #2e7d32; } .q-none { background: var(--s4); }
.qtxt-red { color: #c62828; } .qtxt-amber { color: #a87700; } .qtxt-green { color: #2e7d32; }
.headline { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 12px; }
@media (max-width: 760px) { .headline { grid-template-columns: 1fr; } }
.big { font-family: var(--display); font-size: 38px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.lbl { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.preview { background: var(--ink); color: var(--bg); border-radius: 10px; padding: 9px 12px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 12px; font-size: 13px; }
.preview button { background: transparent; color: inherit; border: 1px solid currentColor; border-radius: 8px; padding: 4px 10px; cursor: pointer; font-weight: 600; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 960px) { .grid3 { grid-template-columns: 1fr; } }
.rank { list-style: none; margin: 0; padding: 0; counter-reset: r; }
.rank li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.rank li:last-child { border-bottom: 0; }
.rank li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank li b { font-variant-numeric: tabular-nums; }
.cardhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.cardhead h3 { margin: 0; }
.imgbtn { background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 4px 9px; font-size: 12px; cursor: pointer; color: var(--ink-2); white-space: nowrap; }
.imgbtn:hover { border-color: var(--accent); }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--accent-soft); }
th.sort { cursor: pointer; user-select: none; }
th.sort[aria-sort] { color: var(--ink); }
.wn td { padding: 6px 8px; }
.wn td.green { background: #dff1df; color: #1b5e20; } .wn td.orange { background: #fde7c8; color: #8a4b00; } .wn td.red { background: #f8d4d4; color: #8e1b1b; }
@media (prefers-color-scheme: dark) { body:not([data-theme="light"]) .wn td.green { background: #1d3a1f; color: #a5d6a7; } body:not([data-theme="light"]) .wn td.orange { background: #3d2a10; color: #ffcc80; } body:not([data-theme="light"]) .wn td.red { background: #3d1515; color: #ef9a9a; } }
.wn .p { display: block; font-size: 11px; color: var(--muted); }
.person { border-bottom: 1px solid var(--line); padding: 10px 0; }
.person:last-child { border-bottom: 0; }
.person summary { display: flex; justify-content: space-between; gap: 10px; cursor: pointer; list-style: none; align-items: center; }
.person summary::-webkit-details-marker { display: none; }
.person .who { font-weight: 700; }
.person .tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.formgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; margin-top: 6px; }
@media (max-width: 760px) { .formgrid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 460px) { .formgrid { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 8px; margin: 10px 0; font-size: 14px; }
.bar { height: 8px; background: color-mix(in srgb, var(--line) 70%, transparent); border-radius: 999px; overflow: hidden; margin: 10px 0; }
.bar > div { height: 100%; background: var(--accent); transition: width .3s; }
.period .seg { flex-wrap: wrap; }
