:root {
  color-scheme: light;
  --bg: #f4f2ee;
  --surface: #ffffff;
  --surface-2: #f9f8f5;
  --surface-3: #efece6;
  --border: #e2ded6;
  --border-strong: #cbc6bc;
  --ink: #1c1d21;
  --ink-2: #55585f;
  --ink-3: #85888f;
  --accent: #1d3557;
  --accent-hover: #142740;
  --accent-ink: #ffffff;
  --accent-soft: #e5edf7;
  --danger: #b42318;
  --danger-soft: #fcebe9;
  --good: #1e7a46;
  --good-soft: #e5f3ea;
  --warn: #8f5600;
  --warn-soft: #fbf1df;
  --series-1: #2a78d6;
  --grid: #ebe8e2;
  /* Barber palette */
  --brand: #1d3557;
  --brand-2: #274472;
  --brand-ink: #ffffff;
  --brass: #c9a24a;
  --barber-red: #c8372d;
  --c-blue: #2a6fd6;
  --c-blue-soft: #e7f0fc;
  --c-green: #1d8a55;
  --c-green-soft: #e3f4ea;
  --c-amber: #c27c00;
  --c-amber-soft: #fdf1dc;
  --c-red: #c8372d;
  --c-red-soft: #fbe9e7;
  --btn-navy: #1d3557;
  --btn-green: #1d8a55;
  --shadow: 0 1px 2px rgb(20 20 25 / 6%), 0 4px 16px rgb(20 20 25 / 6%);
  --radius: 14px;
  --radius-sm: 10px;
  --tap: 56px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111215;
    --surface: #1b1c20;
    --surface-2: #212227;
    --surface-3: #2a2b31;
    --border: #2f3137;
    --border-strong: #42454d;
    --ink: #eceef2;
    --ink-2: #aeb2bb;
    --ink-3: #80848d;
    --accent: #7eb0ff;
    --accent-hover: #9cc2ff;
    --accent-ink: #0b1a2e;
    --accent-soft: #1b293d;
    --danger: #ff8b80;
    --danger-soft: #3a1d1b;
    --good: #6fd39a;
    --good-soft: #17301f;
    --warn: #f2b65a;
    --warn-soft: #33270f;
    --series-1: #3987e5;
    --grid: #2a2c31;
    --brand: #16253b;
    --brand-2: #1f3352;
    --brass: #d8b45e;
    --c-blue: #7fb0ff;
    --c-blue-soft: #18263a;
    --c-green: #6fd39a;
    --c-green-soft: #142a1d;
    --c-amber: #f2b65a;
    --c-amber-soft: #2e2410;
    --c-red: #ff8b80;
    --c-red-soft: #33191a;
    --btn-navy: #2a4a7a;
    --btn-green: #1f7a4b;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 4px 16px rgb(0 0 0 / 30%);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
#app { min-height: 100vh; min-height: 100dvh; }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--ink-3); }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 21px; font-weight: 650; }
h3 { font-size: 17px; font-weight: 650; }
p { margin: 0; }
a { color: var(--accent); }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.lg { gap: 20px; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }

/* ---------- Buttons ---------- */
button, .btn {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  text-decoration: none;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.12s, transform 0.06s;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn.ghost:hover:not(:disabled) { background: var(--accent-soft); }
.btn.lg { min-height: var(--tap); font-size: 19px; padding: 0 26px; border-radius: var(--radius); }
.btn.xl { min-height: 76px; font-size: 22px; padding: 0 28px; border-radius: 18px; }
.btn.block { width: 100%; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 15px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 13px; color: var(--ink-3); font-weight: 400; }
input, select, textarea {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  min-height: 48px;
  padding: 10px 12px;
  width: 100%;
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input[type="checkbox"] { width: 24px; min-height: 24px; height: 24px; accent-color: var(--accent); }
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.check input { flex: none; margin-top: 1px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.error-text { color: var(--danger); font-size: 15px; font-weight: 500; }
.input-suffix { position: relative; }
.input-suffix input { padding-right: 36px; }
.input-suffix::after { content: attr(data-suffix); position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }

/* Segmented control */
.seg { display: inline-flex; background: var(--surface-3); border-radius: 12px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { min-height: 40px; padding: 0 16px; border-radius: 9px; font-weight: 600; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg.big button { min-height: 64px; padding: 0 30px; font-size: 20px; flex: 1; }
.seg.big { display: flex; }

/* Toggle switch */
.switch { position: relative; width: 56px; height: 32px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 99px; transition: background 0.15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 25%); transition: transform 0.15s; }
.switch input:checked + span { background: var(--good); }
.switch input:checked + span::after { transform: translateX(24px); }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.notice { border-radius: var(--radius-sm); padding: 14px 16px; background: var(--accent-soft); display: flex; gap: 12px; align-items: flex-start; }
.notice.warn { background: var(--warn-soft); }
.notice.danger { background: var(--danger-soft); }
.notice.good { background: var(--good-soft); }
.notice .icon { flex: none; font-weight: 700; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: 12.5px; font-weight: 650; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

/* ---------- Layout: full-screen kiosk pages ---------- */
.screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding: max(20px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left)); }
.screen-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; text-align: center; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; margin-bottom: 20px; }
.topbar .title { font-size: 22px; font-weight: 700; }
.back { min-height: 48px; padding: 0 14px 0 8px; font-size: 18px; color: var(--accent); font-weight: 600; display: inline-flex; align-items: center; gap: 2px; border-radius: 10px; }
.back::before { content: "‹"; font-size: 32px; line-height: 0; margin-top: -3px; }
.content { width: 100%; max-width: 980px; margin: 0 auto; }

/* Login */
.brand { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.brand h1 { font-size: 40px; letter-spacing: -0.02em; }
.brand .clock { color: var(--ink-2); font-size: 18px; }
.people { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 260px)); gap: 20px; justify-content: center; width: 100%; max-width: 900px; }
.person {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  min-height: 190px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  font-size: 24px; font-weight: 650;
  box-shadow: var(--shadow);
  transition: transform 0.08s;
}
.person:active { transform: scale(0.97); }
.avatar { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; font-weight: 700; background: var(--accent-soft); color: var(--accent); }

/* PIN pad */
.pinpad { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.pin-dots { display: flex; gap: 16px; height: 22px; }
.pin-dots i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--ink-3); }
.pin-dots i.on { background: var(--ink); border-color: var(--ink); }
.pin-dots.shake { animation: shake 0.35s; }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
.keys { display: grid; grid-template-columns: repeat(3, 84px); gap: 18px 26px; }
.keys button { width: 84px; height: 84px; border-radius: 50%; font-size: 32px; font-weight: 500; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); font-variant-numeric: tabular-nums; }
.keys button:active:not(:disabled) { background: var(--surface-3); }
.keys button.text { font-size: 17px; font-weight: 600; background: transparent; border: 0; box-shadow: none; color: var(--accent); }
.keys button:disabled { opacity: 0.35; }
.pin-msg { min-height: 26px; font-weight: 500; }

/* Employee home */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 18px 20px; text-align: left; display: flex; flex-direction: column; gap: 4px; min-height: 120px; }
.stat .label { font-size: 15px; color: var(--ink-2); font-weight: 600; }
.stat .value { font-size: 40px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .sub { font-size: 13.5px; color: var(--ink-3); }
button.stat { cursor: pointer; }
button.stat .sub { color: var(--accent); font-weight: 600; }
.actions { display: grid; gap: 16px; }
.action-btn { min-height: 104px; border-radius: 20px; font-size: 24px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 14px; background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow); }
.action-btn.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--border); }
.action-btn .plus { font-size: 34px; font-weight: 400; line-height: 0; }
.action-btn:active { transform: scale(0.99); }

/* Item tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.tile {
  position: relative;
  background: var(--surface); border: 2px solid var(--border); border-radius: 18px;
  min-height: 116px; padding: 16px; text-align: left;
  display: flex; flex-direction: column; justify-content: space-between; gap: 8px;
}
.tile .name { font-size: 19px; font-weight: 650; line-height: 1.25; }
.tile .price { font-size: 17px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tile.on { border-color: var(--accent); background: var(--accent-soft); }
.tile.on::after { content: "✓"; position: absolute; top: 10px; right: 12px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 16px; font-weight: 700; }
.tile .stock { font-size: 13px; color: var(--ink-3); }
.tile .stock.low { color: var(--warn); font-weight: 600; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 44px; height: 44px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border-strong); font-size: 24px; font-weight: 500; display: grid; place-items: center; }
.stepper .q { min-width: 28px; text-align: center; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.section-title { font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); margin: 26px 0 12px; }
.bottom-bar {
  position: sticky; bottom: 0; margin: 24px calc(-1 * max(24px, env(safe-area-inset-left))) calc(-1 * max(24px, env(safe-area-inset-bottom)));
  padding: 14px max(24px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
}
.bottom-bar .summary { flex: 1; font-size: 18px; }
.bottom-bar .summary strong { font-size: 22px; font-variant-numeric: tabular-nums; }

/* Confirm */
.receipt { display: flex; flex-direction: column; }
.receipt .line { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 18px; }
.receipt .line:last-child { border-bottom: 0; }
.receipt .line .amt { font-variant-numeric: tabular-nums; white-space: nowrap; }
.receipt .total { font-size: 26px; font-weight: 750; border-bottom: 0; padding-top: 16px; }
.earn { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--good-soft); border-radius: var(--radius); padding: 16px 20px; }
.earn .v { font-size: 28px; font-weight: 750; color: var(--good); font-variant-numeric: tabular-nums; }
.confirm-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; align-items: start; }

/* Success */
.success-mark { width: 120px; height: 120px; border-radius: 50%; background: var(--good); color: #fff; display: grid; place-items: center; font-size: 64px; font-weight: 700; animation: pop 0.3s ease-out; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.countdown { color: var(--ink-3); font-size: 16px; }

/* Lists */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 14px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); text-align: left; width: 100%; }
.list-item:last-child { border-bottom: 0; }
button.list-item:hover { background: var(--surface-2); }
.list-item .main { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.list-item .meta { font-size: 14px; color: var(--ink-2); }
.list-item .amount { font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.empty { padding: 32px 20px; text-align: center; color: var(--ink-3); }
.strike { text-decoration: line-through; color: var(--ink-3); }

/* ---------- Owner app ---------- */
.owner-shell { min-height: 100vh; display: flex; flex-direction: column; }
.appbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: max(10px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
}
.appbar-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.appbar-top .shop { font-weight: 750; font-size: 19px; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 0 -8px; padding: 0 8px; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 12px 14px; color: var(--ink-2); text-decoration: none; font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; font-size: 16px; }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.nav a .dot { display: inline-block; min-width: 20px; height: 20px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 12px; font-weight: 700; text-align: center; line-height: 20px; padding: 0 6px; margin-left: 6px; }
.page { width: 100%; max-width: 1240px; margin: 0 auto; padding: 22px max(20px, env(safe-area-inset-left)) 60px; display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 10px 12px; flex-wrap: wrap; align-items: center; }
.toolbar input[type="date"], .toolbar select { min-height: 44px; width: auto; }

.live { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.live i { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); }
.live.on i { background: var(--good); box-shadow: 0 0 0 4px var(--good-soft); }
.live.off { color: var(--warn); font-weight: 600; }
.live.off i { background: var(--warn); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.kpi .label { font-size: 14px; color: var(--ink-2); font-weight: 600; }
.kpi .value { font-size: 30px; font-weight: 720; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi .sub { font-size: 13.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.kpi.hero { grid-column: span 2; grid-row: span 2; justify-content: space-between; gap: 12px; }
.kpi.hero .value { font-size: 52px; }
.kpi.hero .kv { font-size: 14.5px; }
.stale .kpi .value, .stale .chart, .stale table { opacity: 0.55; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.dash-grid > * { min-width: 0; }
.activity { display: flex; flex-direction: column; max-height: 420px; }
.activity .list { overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }

table.data { width: 100%; border-collapse: collapse; font-size: 15.5px; }
table.data th, table.data td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data th { font-size: 13px; font-weight: 650; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.04em; background: var(--surface-2); white-space: nowrap; }
table.data td.n, table.data th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data td.num { white-space: nowrap; }
table.data tr.click { cursor: pointer; }
table.data tr.click:hover td { background: var(--surface-2); }
table.data tfoot td { font-weight: 700; background: var(--surface-2); }
table.data tr:last-child td { border-bottom: 0; }
table.data tfoot tr td { border-top: 1px solid var(--border-strong); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.voided td { color: var(--ink-3); }

.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis { fill: var(--ink-3); font-size: 11.5px; font-family: var(--font); }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--border-strong); stroke-width: 1; }
.chart .bar { fill: var(--series-1); }
.chart .bar.neg { fill: var(--ink-3); }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:hover + .bar, .chart .hit:focus + .bar { opacity: 0.8; }
.tooltip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); padding: 8px 10px; border-radius: 8px; font-size: 13.5px; line-height: 1.35; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); z-index: 5; font-variant-numeric: tabular-nums; }

.activity .list-item { padding: 12px 16px; }
.activity .kind { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 15px; font-weight: 700; flex: none; background: var(--surface-3); color: var(--ink-2); }
.activity .kind.sale { background: var(--accent-soft); color: var(--accent); }
.activity .kind.refund, .activity .kind.void { background: var(--danger-soft); color: var(--danger); }
.activity .kind.mistake { background: var(--warn-soft); color: var(--warn); }
.activity .kind.payout { background: var(--good-soft); color: var(--good); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 0; }
.kv dt { color: var(--ink-2); padding-right: 18px; }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.kv .total { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 2px; font-weight: 750; }

.people-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.balance-big { font-size: 34px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

/* ---------- Overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgb(10 10 14 / 45%); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade 0.15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: 20px; width: 100%; max-width: 520px; max-height: calc(100dvh - 40px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgb(0 0 0 / 30%); animation: rise 0.18s ease-out; }
.modal.wide { max-width: 860px; }
@keyframes rise { from { transform: translateY(16px); opacity: 0.6; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 10px; }
.modal-body { padding: 8px 22px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.modal-foot .error-text { flex-basis: 100%; }
.close-x { width: 40px; height: 40px; border-radius: 50%; font-size: 22px; color: var(--ink-2); background: var(--surface-3); flex: none; }
.toast-root { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 600; box-shadow: var(--shadow); animation: rise 0.18s; max-width: 90vw; }
.toast.danger { background: var(--danger); color: #fff; }
.idle-warning { position: fixed; top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 150; background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn); padding: 12px 20px; border-radius: 14px; font-weight: 650; box-shadow: var(--shadow); }
.offline-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 140; background: var(--warn); color: #fff; text-align: center; padding: calc(6px + env(safe-area-inset-top)) 12px 6px; font-weight: 650; font-size: 15px; }

@media (max-width: 900px) {
  .dash-grid, .confirm-grid { grid-template-columns: minmax(0, 1fr); }
  .activity { max-height: none; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .stats { grid-template-columns: 1fr; }
  .stat { min-height: 0; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .value { font-size: 23px; }
  .kpi.hero { grid-column: span 2; grid-row: auto; }
  .kpi.hero .value { font-size: 40px; }
  .keys { grid-template-columns: repeat(3, 76px); gap: 14px 22px; }
  .keys button { width: 76px; height: 76px; }
  .brand h1 { font-size: 32px; }
  .person { min-height: 130px; }
  .action-btn { min-height: 84px; font-size: 21px; }
  .page { padding: 16px 16px 48px; }
  .appbar { padding-left: 16px; padding-right: 16px; }
}
@media print {
  .appbar, .no-print, .toolbar { display: none !important; }
  body { background: #fff; }
  .card { border: 0; padding: 0; }
}

/* Added: owner tile, "10× Haircut" rows */
.person.owner { border-color: var(--accent); }
.count-pill { min-width: 52px; height: 36px; padding: 0 10px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 750; font-size: 17px; flex: none; }
.list-item.total-row { background: var(--surface-2); }
.list-item.total-row .title, .list-item.total-row .amount { font-weight: 750; }

/* ================================================================== */
/* Colour layer                                                        */
/* ================================================================== */

/* Login: logo, coloured person tiles. Each person keeps one colour. */
.brand-logo { width: 72px; height: 72px; border-radius: 18px; box-shadow: var(--shadow); margin-bottom: 6px; }
.pc0 { --pc: #2a6fd6; } .pc1 { --pc: #c8372d; } .pc2 { --pc: #1b9e77; }
.pc3 { --pc: #6a4fc4; } .pc4 { --pc: #d98b00; } .pc5 { --pc: #d1457f; }
.pc-owner { --pc: var(--brass); }
.person { border-top: 6px solid var(--pc, var(--border)); gap: 10px; }
.person .avatar, .screen-center[class*="pc"] .avatar { background: var(--pc, var(--accent-soft)); color: #fff; }
.pc-owner .avatar { color: #1c1d21; }
.avatar.big { width: 92px; height: 92px; font-size: 36px; }
.person .badge.accent { background: color-mix(in srgb, var(--brass) 22%, transparent); color: #8a6a1f; }

/* Selling home: tinted stat tiles, two distinct big buttons */
.stat { border: 0; }
.stat.blue { background: var(--c-blue-soft); } .stat.blue .label { color: var(--c-blue); }
.stat.amber { background: var(--c-amber-soft); } .stat.amber .label { color: var(--c-amber); }
.stat.green { background: var(--c-green-soft); } .stat.green .label { color: var(--c-green); }
button.stat.green .sub { color: var(--c-green); }
.action-btn { background: var(--btn-navy); color: #fff; }
.action-btn.alt { background: var(--btn-green); color: #fff; }
.count-pill.service { background: var(--c-blue-soft); color: var(--c-blue); }
.count-pill.product { background: var(--c-amber-soft); color: var(--c-amber); }
.tile.on { border-color: var(--c-blue); background: var(--c-blue-soft); }
.tile.on::after { background: var(--c-blue); color: #fff; }
.earn .v { color: var(--c-green); }

/* KPI tiles get a coloured edge; the hero is navy */
.kpi { border-left: 5px solid var(--kc, var(--border)); }
.kpi.blue { --kc: var(--c-blue); } .kpi.amber { --kc: var(--c-amber); }
.kpi.green { --kc: var(--c-green); } .kpi.red { --kc: var(--c-red); } .kpi.navy { --kc: var(--brand); }
.kpi.hero { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: var(--brand-ink); border: 0; }
.kpi.hero .label, .kpi.hero .kv dt { color: rgb(255 255 255 / 75%); }
.kpi.hero .kv dd { color: #fff; }

/* Admin header: navy band with a brass underline on the current page */
.appbar { background: var(--brand); border-bottom: 3px solid var(--brass); color: var(--brand-ink); }
.appbar-top .shop { color: #fff; }
.appbar .nav a { color: rgb(255 255 255 / 70%); }
.appbar .nav a[aria-current="page"] { color: #fff; border-bottom-color: var(--brass); }
.appbar .btn { background: transparent; color: #fff; border-color: rgb(255 255 255 / 45%); }
.appbar .btn.primary { background: var(--brass); color: #1c1d21; border-color: transparent; }
.appbar .badge.warn { background: rgb(255 255 255 / 15%); color: #fff; }

/* Recent-activity icons follow the same colours */
.activity .kind.sale { background: var(--c-blue-soft); color: var(--c-blue); }
.activity .kind.payout { background: var(--c-green-soft); color: var(--c-green); }

/* Settings: the activity log is folded away */
details.log > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; }
details.log > summary::-webkit-details-marker { display: none; }
details.log[open] > summary { padding-bottom: 12px; }

/* Main selling screen: today chips, one "add products" button, chosen products */
.today-line { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.chip { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 99px; font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.chip.blue { background: var(--c-blue-soft); color: var(--c-blue); }
.chip.green { background: var(--c-green-soft); color: var(--c-green); }
.topbar { align-items: flex-start; }
.products-box { margin-top: 26px; display: flex; flex-direction: column; gap: 12px; }
.add-products {
  width: 100%; min-height: 76px; border-radius: 18px;
  border: 2px dashed var(--c-amber); background: var(--c-amber-soft); color: var(--c-amber);
  font-size: 21px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 12px;
}
.add-products .plus { font-size: 30px; font-weight: 400; line-height: 0; }
.add-products:active { transform: scale(0.99); }
.chosen { display: flex; flex-direction: column; gap: 8px; }
.chosen:empty { display: none; }
.chosen-row { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--c-amber); border-radius: 14px; padding: 10px 14px; }
.chosen-row .amount { min-width: 90px; text-align: right; font-weight: 700; }
.tile.product.on { border-color: var(--c-amber); background: var(--c-amber-soft); }
.tile.product.on::after { background: var(--c-amber); }
@media (max-width: 640px) { .topbar { flex-wrap: wrap; } }
.tile .name { padding-right: 28px; }
.appbar .btn.primary:hover:not(:disabled) { background: #d8b45e; color: #1c1d21; }
.appbar .btn:not(.primary):hover:not(:disabled) { background: rgb(255 255 255 / 12%); }
@media (max-width: 640px) {
  .topbar .btn.lg { min-height: 44px; font-size: 16px; padding: 0 12px; white-space: nowrap; }
}

/* Product photos */
.thumb { display: block; object-fit: contain; background: #fff; border-radius: 12px; flex: none; }
.thumb.placeholder { display: grid; place-items: center; background: var(--c-amber-soft); color: var(--c-amber); font-weight: 750; }
.thumb.sm { width: 44px; height: 44px; font-size: 18px; border-radius: 10px; }
.thumb.lg { width: 100%; height: 120px; font-size: 40px; margin-bottom: 4px; }
.thumb.xl { width: 220px; height: 220px; font-size: 64px; border-radius: 18px; }
.tile.product .thumb.lg { border: 1px solid var(--border); }
.thumb-cell { width: 60px; }
.photo-preview { display: flex; justify-content: center; }
.photo-preview.checker { padding: 12px; border-radius: 18px; background-color: #fff; background-image: linear-gradient(45deg, #eee 25%, transparent 25%), linear-gradient(-45deg, #eee 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #eee 75%), linear-gradient(-45deg, transparent 75%, #eee 75%); background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0; }
.thumb.clear { background: transparent; }

/* ================================================================== */
/* Responsive pass: iPad (portrait/landscape) and iPhone              */
/* ================================================================== */

/* Top bar, content and the sticky bottom bar share one centred column. */
.screen > .topbar { width: 100%; max-width: 1100px; margin-left: auto; margin-right: auto; }
.content { max-width: 1100px; }
.bottom-bar {
  padding-left: max(24px, calc((100% - 1100px) / 2 + 24px));
  padding-right: max(24px, calc((100% - 1100px) / 2 + 24px));
}
/* iPad landscape and larger: services fill the row, four across. */
@media (min-width: 901px) {
  .content > .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .content > .tiles .tile { min-height: 110px; }
  .content > .tiles .tile .name { font-size: 20px; }
}
.tiles { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }

@media (max-width: 640px) {
  .screen { padding: max(12px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom)); }
  .topbar { margin-bottom: 12px; gap: 10px; }
  .topbar .title { font-size: 19px; }
  .section-title { margin: 18px 0 8px; font-size: 13px; }

  /* Login: compact rows instead of big cards */
  .brand-logo { width: 56px; height: 56px; border-radius: 14px; }
  .brand h1 { font-size: 27px; }
  .brand .clock { font-size: 15px; }
  .screen-center { gap: 20px; }
  .people { grid-template-columns: 1fr; gap: 10px; }
  .person {
    flex-direction: row; justify-content: flex-start; min-height: 72px; padding: 0 16px; gap: 14px;
    border-top: 1px solid var(--border); border-left: 6px solid var(--pc, var(--border)); border-radius: 16px; font-size: 19px;
  }
  .person .avatar { width: 46px; height: 46px; font-size: 19px; }
  .person .badge { margin-left: auto; }

  /* Selling: two columns of compact tiles */
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { min-height: 84px; padding: 12px; border-radius: 14px; }
  .tile .name { font-size: 16px; padding-right: 22px; }
  .tile .price { font-size: 15px; }
  .tile.on::after { width: 22px; height: 22px; font-size: 13px; top: 8px; right: 8px; }
  .add-products { min-height: 60px; font-size: 18px; border-radius: 14px; }
  .products-box { margin-top: 16px; }
  .chosen-row { flex-wrap: wrap; row-gap: 8px; padding: 10px 12px; }
  .chosen-row .grow { flex: 1 1 calc(100% - 60px); }
  .chosen-row .stepper { margin-left: 58px; }
  .chosen-row .amount { margin-left: auto; }
  .stepper button { width: 40px; height: 40px; }
  .bottom-bar { padding: 10px 14px max(12px, env(safe-area-inset-bottom)); margin: 16px -14px calc(-1 * max(14px, env(safe-area-inset-bottom))); }
  .bottom-bar .summary { font-size: 16px; }
  .bottom-bar .summary strong { font-size: 19px; }
  .btn.xl { min-height: 60px; font-size: 19px; padding: 0 22px; }

  /* Pop-ups become bottom sheets */
  .overlay { align-items: flex-end; padding: 0; }
  .modal, .modal.wide { max-width: 100%; border-radius: 20px 20px 0 0; max-height: 92dvh; }
  .modal-head { padding: 16px 16px 8px; }
  .modal-body { padding: 6px 16px 14px; }
  .modal-foot { padding: 12px 16px max(14px, env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }
  .modal .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .thumb.lg { height: 84px; font-size: 30px; }
  .thumb.xl { width: 180px; height: 180px; }

  /* Confirm / saved */
  .receipt .line { font-size: 16px; }
  .receipt .total { font-size: 22px; }
  .earn .v { font-size: 24px; }
  .success-mark { width: 92px; height: 92px; font-size: 48px; }
  .balance-big { font-size: 26px; }
  .card[style*="min-width"] { min-width: 0 !important; width: 100%; }

  /* Admin header */
  .appbar-top { gap: 8px; }
  .appbar-top .shop { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .appbar-top .row { flex: none; gap: 6px; }
  .appbar .badge.warn { display: none; }
  .appbar .btn { white-space: nowrap; }
  .nav a { padding: 10px 11px; font-size: 15px; }
  .page h1 { font-size: 24px; }
  .card { padding: 16px; }
  .card-head { margin-bottom: 10px; }

  /* Tables become cards: one row = one card, each cell labelled */
  table.data thead { display: none; }
  table.data, table.data tbody, table.data tfoot, table.data tr { display: block; width: 100%; }
  table.data tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  table.data tbody tr:last-child { border-bottom: 0; }
  table.data td { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 0; padding: 3px 0; text-align: right; white-space: normal; }
  table.data td::before { content: attr(data-label); color: var(--ink-2); font-size: 13px; font-weight: 600; text-align: left; flex: none; }
  table.data td:first-child, table.data td[data-label=""] { justify-content: flex-start; text-align: left; }
  table.data td:first-child { font-size: 16px; font-weight: 700; padding-bottom: 6px; }
  table.data td:first-child::before, table.data td[data-label=""]::before { content: none; }
  table.data td.right { justify-content: flex-end; }
  table.data td.right > .row { flex-wrap: wrap; justify-content: flex-start !important; }
  table.data td.thumb-cell { display: inline-flex; width: auto; vertical-align: middle; margin-right: 12px; padding: 0 0 8px; }
  table.data td.thumb-cell + td { display: inline-flex; width: calc(100% - 60px); vertical-align: middle; justify-content: flex-start; text-align: left; font-size: 16px; font-weight: 700; padding-bottom: 8px; }
  table.data td.thumb-cell + td::before { content: none; }
  table.data tfoot tr { background: var(--surface-2); }
  table.data tfoot td { background: transparent; border: 0; }
  .table-wrap { overflow: visible; }
}

/* iPad portrait: comfortable three-up tiles */
@media (min-width: 641px) and (max-width: 900px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* Summary tiles: fixed grids so the big "Shitjet" tile never leaves gaps. */
@media (min-width: 901px) {
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 641px) and (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi.hero { grid-column: span 2; grid-row: auto; }
}

/* Demo mode */
body.is-demo::after {
  content: "DEMO"; position: fixed; left: 50%; top: 0; transform: translateX(-50%);
  z-index: 300; pointer-events: none; padding: 1px 10px 2px; border-radius: 0 0 8px 8px;
  background: var(--barber-red); color: #fff; font-size: 10px; font-weight: 800; letter-spacing: 0.12em; opacity: 0.92;
}
.demo-hint { display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 560px; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px dashed var(--border-strong); text-align: center; }
.demo-pins { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.demo-pins .chip { background: var(--surface-3); color: var(--ink); }
