: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; }
}
