/* WASH4U Backend — executive back office for desktop, works down to phone width.
   Layout: white side rail (drawer under 1024px) | top bar with the date range | cards on a calm slate ground.
   Palette from the shop app: slate ground, white cards, ink #0F172A, royal blue #2563EB. Font: Prompt (self-hosted). */
@font-face { font-family: 'Prompt'; font-style: normal; font-weight: 400; font-display: swap; src: url(/vendor/fonts/prompt-400-thai.woff2) format('woff2'); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Prompt'; font-style: normal; font-weight: 400; font-display: swap; src: url(/vendor/fonts/prompt-400-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Prompt'; font-style: normal; font-weight: 500; font-display: swap; src: url(/vendor/fonts/prompt-500-thai.woff2) format('woff2'); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Prompt'; font-style: normal; font-weight: 500; font-display: swap; src: url(/vendor/fonts/prompt-500-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Prompt'; font-style: normal; font-weight: 600; font-display: swap; src: url(/vendor/fonts/prompt-600-thai.woff2) format('woff2'); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Prompt'; font-style: normal; font-weight: 600; font-display: swap; src: url(/vendor/fonts/prompt-600-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #F1F5F9; --surface: #FFFFFF; --surface-2: #F8FAFC; --line: #E2E8F0; --line-soft: #EEF2F6;
  --text: #0F172A; --muted: #64748B; --faint: #94A3B8;
  --accent: #2563EB; --accent-ink: #1D4ED8; --accent-soft: #EEF3FF; --on-accent: #FFFFFF;
  --ok: #16A34A; --ok-soft: #EAF8EF; --warn: #C2410C; --warn-soft: #FFF4EB; --bad: #DC2626; --bad-soft: #FEF1F1;
  --c-counter: #2563EB; --c-line: #06C755; --c-delivery: #F59E0B; --c-cash: #0EA5A4; --c-transfer: #6366F1; --c-avg: #94A3B8;
  --logo: #D7262E;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .04);
  --shadow-pop: 0 12px 40px rgba(15, 23, 42, .16);
  --r: 14px; --r-sm: 10px;
  --font: 'Prompt', 'Sukhumvit Set', 'Thonburi', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --side: 248px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0A0F1C; --surface: #111827; --surface-2: #0E1524; --line: #1F2A3C; --line-soft: #172133;
  --text: #E6EAF2; --muted: #93A0B4; --faint: #64748B;
  --accent: #5B8DEF; --accent-ink: #8AB0FF; --accent-soft: #16233F; --on-accent: #FFFFFF;
  --ok: #34C76F; --ok-soft: #0F2A1B; --warn: #F59E5B; --warn-soft: #2E1D10; --bad: #F87171; --bad-soft: #301417;
  --c-counter: #5B8DEF; --c-line: #2BD47A; --c-delivery: #F7B53B; --c-cash: #2CC7C5; --c-transfer: #8B8EF5; --c-avg: #64748B;
  --logo: #F2545B; --shadow: none; --shadow-pop: 0 12px 40px rgba(0, 0, 0, .5); color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0A0F1C; --surface: #111827; --surface-2: #0E1524; --line: #1F2A3C; --line-soft: #172133;
  --text: #E6EAF2; --muted: #93A0B4; --faint: #64748B;
  --accent: #5B8DEF; --accent-ink: #8AB0FF; --accent-soft: #16233F; --on-accent: #FFFFFF;
  --ok: #34C76F; --ok-soft: #0F2A1B; --warn: #F59E5B; --warn-soft: #2E1D10; --bad: #F87171; --bad-soft: #301417;
  --c-counter: #5B8DEF; --c-line: #2BD47A; --c-delivery: #F7B53B; --c-cash: #2CC7C5; --c-transfer: #8B8EF5; --c-avg: #64748B;
  --logo: #F2545B; --shadow: none; --shadow-pop: 0 12px 40px rgba(0, 0, 0, .5); color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 400 14.5px/1.6 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
html.booting body { visibility: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.3; text-wrap: balance; }
p { margin: 0; }
.num, .tabnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; background: linear-gradient(90deg, var(--surface) calc(var(--side) - 1px), var(--line) calc(var(--side) - 1px) var(--side), transparent var(--side)); }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 14px 14px; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 6px; }
.brand img { width: 36px; height: 36px; border-radius: 10px; object-fit: contain; background: #fff; border: 1px solid var(--line); }
.brand b { display: block; font-weight: 600; font-size: 15px; letter-spacing: .01em; }
.brand span { display: block; font-size: 12px; color: var(--muted); line-height: 1.3; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav .grp { font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; color: var(--muted); font-weight: 500; text-decoration: none; transition: background .15s, color .15s; }
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.on { background: var(--accent-soft); color: var(--accent-ink); }
.nav a.soon { pointer-events: none; opacity: .55; }
.nav a .tag { margin-left: auto; font-size: 10.5px; font-weight: 500; padding: 0 7px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); color: var(--faint); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.me .av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 13px; flex: none; }
.me b { display: block; font-weight: 500; font-size: 13.5px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me span { display: block; font-size: 11.5px; color: var(--muted); }
.me > div { min-width: 0; flex: 1; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 32px; padding-left: max(32px, env(safe-area-inset-left, 0px)); padding-right: max(32px, env(safe-area-inset-right, 0px)); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid transparent; }
.top.scrolled { border-bottom-color: var(--line); }
.top h1 { font-size: 21px; font-weight: 600; }
.top .sub { color: var(--muted); font-size: 13px; }
.top .titles { min-width: 0; flex: 1; }
.top .tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn.burger { display: none; }
.content { padding: 8px 32px 48px; padding-left: max(32px, env(safe-area-inset-left, 0px)); padding-right: max(32px, env(safe-area-inset-right, 0px)); display: grid; gap: 20px; max-width: 1480px; width: 100%; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 0 4px; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.live.on i { background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 50%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 500; font-size: 13.5px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--line) 50%, var(--faint)); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--bad); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.icon { width: 36px; padding: 0; }
.btn.block { width: 100%; height: 44px; font-size: 15px; }
.btn:disabled { opacity: .55; cursor: default; }
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface); border: 1px solid var(--line); gap: 2px; flex-wrap: wrap; }
.seg button { height: 30px; padding: 0 11px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 500; font-size: 13px; cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--accent-soft); color: var(--accent-ink); }
.dates { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 6px 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.dates input { border: 0; background: transparent; height: 32px; font-size: 13px; padding: 0 2px; min-width: 0; width: 128px; }
.dates span { color: var(--faint); }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; color: var(--muted); }
.input, select.input { height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); width: 100%; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.input.code { letter-spacing: .4em; text-align: center; font-size: 22px; font-weight: 500; height: 54px; }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; translate: 0 -50%; width: 16px; height: 16px; color: var(--faint); }
.search .input { padding-left: 34px; height: 36px; font-size: 13.5px; }

/* ---------- cards & grids ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 16px 20px 0; }
.card-h h3 { font-size: 15px; font-weight: 600; }
.card-h .hint { color: var(--muted); font-size: 12.5px; }
.card-h .end { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-b { padding: 14px 20px 18px; }
.card-b.flush { padding: 10px 0 4px; }
.grid { display: grid; gap: 20px; }
.g-kpi { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.g-kpi.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-kpi.n5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g-kpi.n6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1360px) { .g-kpi.n6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1240px) { .g-kpi.n5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .g-kpi.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.g-2 { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.g-2e { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1240px) { .g-2 { grid-template-columns: 1fr; } .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .g-2e, .g-3 { grid-template-columns: 1fr; } }

.kpi { padding: 16px 18px 15px; display: grid; gap: 4px; align-content: start; position: relative; overflow: hidden; }
.kpi .lb { font-size: 13px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .lb svg { width: 15px; height: 15px; color: var(--faint); }
.kpi .v { font-size: 27px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.25; }
.kpi .v small { font-size: 15px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.kpi .ft { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.kpi .spark { position: absolute; right: 16px; top: 44px; width: 84px; height: 30px; opacity: .9; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 500; font-size: 12px; padding: 0 7px; border-radius: 99px; line-height: 20px; }
.delta.up { color: var(--ok); background: var(--ok-soft); }
.delta.down { color: var(--bad); background: var(--bad-soft); }
.delta.flat { color: var(--muted); background: var(--surface-2); }
.splitbar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--line-soft); margin-top: 6px; }
.splitbar i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.legend b { color: var(--text); font-weight: 500; }

/* chips & pills */
.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.blue { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* alerts */
.alerts { display: grid; gap: 8px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13.5px; }
.alert svg { width: 17px; height: 17px; flex: none; margin-top: 2px; }
.alert.warn { background: var(--warn-soft); } .alert.warn svg { color: var(--warn); }
.alert.bad { background: var(--bad-soft); } .alert.bad svg { color: var(--bad); }
.alert.info svg { color: var(--accent); }
.alert a { margin-left: auto; white-space: nowrap; font-weight: 500; font-size: 12.5px; }
.empty { padding: 26px 16px; text-align: center; color: var(--faint); font-size: 13.5px; }
.empty svg { width: 28px; height: 28px; display: block; margin: 0 auto 8px; opacity: .7; }

/* stats list (label + bar + value) */
.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(0, 2fr) auto; gap: 12px; align-items: center; font-size: 13.5px; }
.bar-row .track { height: 8px; border-radius: 99px; background: var(--line-soft); overflow: hidden; }
.bar-row .track i { display: block; height: 100%; border-radius: 99px; }
.bar-row .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; }
.bar-row .val small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.queue-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.qt { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-soft); display: grid; gap: 2px; }
.qt b { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; }
.qt span { font-size: 12.5px; color: var(--muted); }
.qt em { font-style: normal; font-size: 12px; color: var(--warn); }

/* tables */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 8px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl th.r { text-align: right; }
.tbl td:first-child, .tbl th:first-child { padding-left: 20px; }
.tbl td:last-child, .tbl th:last-child { padding-right: 20px; }
.tbl tfoot td { font-weight: 600; border-top: 1px solid var(--line); border-bottom: 0; }
.person { display: flex; align-items: center; gap: 9px; min-width: 0; }
.av { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 600; flex: none; background: var(--accent-soft); color: var(--accent-ink); }
.person b { font-weight: 500; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--faint); flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
/* Phone: wide tables become stacked cards (each cell carries its column name). */
@media (max-width: 640px) {
  table.tbl.stack thead { display: none; }
  table.tbl.stack, .tbl.stack tbody, .tbl.stack tr, .tbl.stack td { display: block; width: 100%; }
  .tbl.stack tr { padding: 10px 16px; border-bottom: 1px solid var(--line-soft); }
  .tbl.stack td { border: 0; padding: 3px 0 !important; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .tbl.stack td::before { content: attr(data-l); color: var(--muted); font-size: 12px; text-align: left; flex: none; }
  .tbl.stack td.head { text-align: left; padding-bottom: 6px !important; display: block; }
  .tbl.stack td.head::before { display: none; }
  .tbl.stack tfoot { display: block; }
}

/* steps timeline (delivery) */
.steps { display: flex; gap: 4px; align-items: center; }
.steps i { width: 22px; height: 5px; border-radius: 99px; background: var(--line); display: block; }
.steps i.on { background: var(--c-delivery); }
.steps i.done { background: var(--ok); }
.stamps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; font-size: 12px; }
.stamps div { padding: 6px 8px; border-radius: 8px; background: var(--surface-2); min-width: 0; }
.stamps b { display: block; font-weight: 500; font-size: 11.5px; color: var(--muted); }
.stamps span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map { height: 340px; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.map .leaflet-container { font: inherit; background: var(--surface-2); }

/* charts */
.chart { position: relative; width: 100%; min-height: 160px; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { fill: var(--faint); font-size: 11px; font-family: var(--font); }
.chart .grid line { stroke: var(--line-soft); }
.chart .axis line { stroke: var(--line); }
.chart [data-tip] { cursor: default; }
.chart .hit { fill: transparent; }
.chart .hit:hover + .hl, .chart .col:hover .hl { opacity: 1; }
.chart .hl { opacity: 0; transition: opacity .1s; }
#tip { position: fixed; z-index: 100; pointer-events: none; background: var(--text); color: var(--surface); font-size: 12.5px; line-height: 1.5; padding: 7px 10px; border-radius: 9px; box-shadow: var(--shadow-pop); max-width: 260px; white-space: pre-line; }
.heat { display: grid; grid-template-columns: 34px repeat(24, minmax(0, 1fr)); gap: 3px; font-size: 11px; color: var(--faint); }
.heat .c { aspect-ratio: 1.6; border-radius: 4px; background: var(--accent); min-height: 10px; }
.heat .h { text-align: center; }
.heat .d { display: flex; align-items: center; }
.heat-wrap { overflow-x: auto; }
.heat-wrap .heat { min-width: 560px; }

/* attendance calendar */
.cal-wrap { overflow-x: auto; }
table.cal { border-collapse: separate; border-spacing: 3px; font-size: 11.5px; }
.cal th { font-weight: 500; color: var(--faint); padding: 2px; text-align: center; min-width: 30px; }
.cal th.n { text-align: left; min-width: 110px; padding-left: 16px; font-size: 12.5px; color: var(--text); position: sticky; left: 0; background: var(--surface); z-index: 1; }
.cal td { width: 30px; height: 30px; border-radius: 7px; text-align: center; background: var(--surface-2); color: var(--faint); cursor: pointer; font-variant-numeric: tabular-nums; }
.cal td.ok { background: var(--ok-soft); color: var(--ok); }
.cal td.late { background: var(--warn-soft); color: var(--warn); }
.cal td.absent { background: var(--bad-soft); color: var(--bad); }
.cal td.off { background: transparent; color: var(--line); cursor: default; }
.cal td.open { box-shadow: inset 0 0 0 1.5px var(--accent); }
.cal td.sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.cal th.we { color: var(--muted); }

/* people cards (staff work) */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.pc { padding: 16px 18px; display: grid; gap: 12px; }
.pc-h { display: flex; align-items: center; gap: 10px; }
.pc-h .av { width: 38px; height: 38px; font-size: 13px; }
.pc-h b { font-weight: 600; display: block; }
.pc-h span { font-size: 12px; color: var(--muted); }
.pc .stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pc .stats div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.pc .stats b { display: block; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pc .stats span { font-size: 11.5px; color: var(--muted); }

/* auth screens */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); background: radial-gradient(1200px 500px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.auth-card { width: 100%; max-width: 420px; padding: 32px 30px 28px; display: grid; gap: 18px; }
.auth-card.wide { max-width: 560px; }
.auth-logo { display: flex; align-items: center; gap: 12px; }
.auth-logo img { width: 46px; height: 46px; border-radius: 12px; border: 1px solid var(--line); background: #fff; object-fit: contain; }
.auth-logo b { display: block; font-size: 18px; font-weight: 600; }
.auth-logo span { font-size: 13px; color: var(--muted); }
.auth h2 { font-size: 20px; }
.auth form { display: grid; gap: 14px; }
.form-err { color: var(--bad); background: var(--bad-soft); padding: 9px 12px; border-radius: 10px; font-size: 13px; }
.note { font-size: 12.5px; color: var(--muted); background: var(--surface-2); padding: 10px 12px; border-radius: 10px; }
.qr { display: grid; place-items: center; padding: 14px; background: #fff; border-radius: 12px; border: 1px solid var(--line); width: max-content; margin: 0 auto; }
.qr img, .qr svg { width: 180px; height: 180px; image-rendering: pixelated; display: block; }
.secret { font-family: ui-monospace, Menlo, monospace; font-size: 13px; letter-spacing: .08em; word-break: break-all; text-align: center; color: var(--muted); }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; font-family: ui-monospace, Menlo, monospace; font-size: 15px; }
.codes span { padding: 8px 10px; border-radius: 8px; background: var(--surface-2); text-align: center; border: 1px dashed var(--line); }
.steps-n { display: grid; gap: 10px; counter-reset: s; font-size: 13.5px; }
.steps-n div { display: flex; gap: 10px; }
.steps-n div::before { counter-increment: s; content: counter(s); flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 600; display: grid; place-items: center; margin-top: 1px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13.5px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }

/* modal */
.modal-bg { position: fixed; inset: 0; z-index: 80; background: rgba(15, 23, 42, .4); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-pop); padding: 22px 22px 18px; display: grid; gap: 14px; animation: rise .18s; }
.modal h3 { font-size: 17px; }
.modal .acts { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.98); } }
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: grid; gap: 8px; }
.toast { background: var(--text); color: var(--surface); padding: 10px 14px; border-radius: 10px; font-size: 13.5px; box-shadow: var(--shadow-pop); animation: rise .2s; max-width: 340px; }
.toast.bad { background: var(--bad); color: #fff; }

.skel { background: linear-gradient(90deg, var(--line-soft), var(--surface-2), var(--line-soft)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 10px; }
@keyframes sk { to { background-position: -200% 0; } }
.section-title { display: flex; align-items: baseline; gap: 10px; margin-top: 6px; }
.section-title h2 { font-size: 16px; }
.section-title span { color: var(--muted); font-size: 13px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 20px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 4px; margin-right: 14px; color: var(--muted); font-weight: 500; font-size: 13.5px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- responsive shell ---------- */
@media (max-width: 1024px) {
  .shell { grid-template-columns: 1fr; background: none; }
  .side { position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: min(290px, 86vw); transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-pop); padding-left: max(14px, env(safe-area-inset-left, 0px)); }
  .shell.drawer .side { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 55; background: rgba(15, 23, 42, .35); }
  .btn.burger { display: inline-flex; }
  .top, .content { padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
}
@media (max-width: 640px) {
  .top { padding-top: 10px; padding-bottom: 10px; gap: 10px; }
  .top, .content { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .top h1 { font-size: 18px; }
  .top .tools { width: 100%; }
  .top .tools .seg { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .content { gap: 14px; padding-bottom: 32px; }
  .grid { gap: 14px; }
  .g-kpi, .g-kpi.n4, .g-kpi.n5, .g-kpi.n6 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 13px 14px; }
  .kpi .v { font-size: 21px; }
  .kpi .spark { display: none; }
  .card-h { padding: 14px 16px 0; }
  .card-b { padding: 12px 16px 16px; }
  .tbl td:first-child, .tbl th:first-child { padding-left: 16px; }
  .tbl td:last-child, .tbl th:last-child { padding-right: 16px; }
  .bar-row { grid-template-columns: minmax(80px, 1fr) minmax(0, 1.2fr) auto; gap: 8px; }
  .stamps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-card { padding: 26px 20px 22px; }
  .dates input { width: 112px; }
}
