/* =====================================================================
   SAX Staff – design tokens + components. Dark-first (nightclub use).
   Status colours follow a fixed, validated set and always ship with a
   label/icon (never colour alone).
   ===================================================================== */
:root {
  color-scheme: dark;
  --page: #0b0a0f;
  --surface-1: #15141a;
  --surface-2: #1c1b23;
  --surface-3: #25242e;
  --hairline: rgba(255, 255, 255, 0.08);
  --hairline-strong: rgba(255, 255, 255, 0.14);
  --grid: #2a2932;
  --axis: #474652;
  --text-primary: #efeef3;
  --text-secondary: #9d9caa;
  --text-tertiary: #6d6c79;

  --accent: #d9b45a;          /* SAX gold – UI chrome only, never data */
  --accent-strong: #e8c773;
  --accent-ink: #18140a;
  --accent-wash: rgba(217, 180, 90, 0.12);

  /* table states (validated vs --surface-1, dark) */
  --st-free: #0aac23;
  --st-held: #fbb315;
  --st-paid: #9887ef;
  --st-unavailable: #4a4955;
  --critical: #dc3c3d;
  --good-text: #53c556;

  /* data series (dark steps of the reference palette) */
  --series-1: #338ced;
  --series-2: #e76624;

  --radius-s: 8px;
  --radius: 14px;
  --radius-l: 20px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 12px 32px -12px rgba(0, 0, 0, 0.6);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --sidebar: 232px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(152, 135, 239, 0.08), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(217, 180, 90, 0.06), transparent 60%),
    var(--page);
  background-attachment: fixed;
  color: var(--text-primary);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
.muted { color: var(--text-secondary); }
.faint { color: var(--text-tertiary); }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------------- shell ---------------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px;
  padding: 22px 14px; border-right: 1px solid var(--hairline);
  background: linear-gradient(180deg, rgba(21, 20, 26, 0.9), rgba(11, 10, 15, 0.9));
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; }
.brand-mark {
  font-weight: 800; letter-spacing: 0.18em; font-size: 20px; color: var(--accent);
  border: 1.5px solid var(--accent); border-radius: 10px; padding: 3px 7px 3px 10px;
}
.brand-sub { font-size: 11px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--text-secondary); line-height: 1.2; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  text-decoration: none; color: var(--text-secondary); font-weight: 520; transition: background .15s, color .15s;
}
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: rgba(255, 255, 255, 0.04); color: var(--text-primary); }
.nav a.active { background: var(--accent-wash); color: var(--accent-strong); }
.nav a.active svg { color: var(--accent); }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 10px 0; border-top: 1px solid var(--hairline); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #3a2f5c, #5b4a2a); font-weight: 700; font-size: 13px;
}
.who { min-width: 0; flex: 1; }
.who b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who span { font-size: 11px; color: var(--text-secondary); text-transform: capitalize; }

.main { min-width: 0; padding: 22px 28px 48px; }
.topbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.topbar h1 { font-size: 24px; }
.topbar .sub { color: var(--text-secondary); font-size: 13px; margin-top: 2px; }
.topbar .spacer { flex: 1; }

.live {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600;
  padding: 5px 10px; border-radius: 99px; background: rgba(10, 172, 35, 0.1); color: var(--good-text);
  border: 1px solid rgba(10, 172, 35, 0.25);
}
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--st-free); box-shadow: 0 0 0 0 rgba(10, 172, 35, 0.6); animation: pulse 2s infinite; }
.live.off { background: rgba(255, 255, 255, 0.04); color: var(--text-secondary); border-color: var(--hairline); }
.live.off i { background: var(--text-tertiary); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(10, 172, 35, 0.55); } 70% { box-shadow: 0 0 0 8px rgba(10, 172, 35, 0); } 100% { box-shadow: 0 0 0 0 rgba(10, 172, 35, 0); } }

/* ---------------- controls ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  padding: 9px 14px; border-radius: 10px; border: 1px solid var(--hairline-strong);
  background: var(--surface-2); font-weight: 600; font-size: 13px; transition: background .15s, transform .05s, border-color .15s;
  white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: linear-gradient(180deg, var(--accent-strong), var(--accent)); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.big { padding: 14px 20px; font-size: 15px; border-radius: 12px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.success { background: rgba(10, 172, 35, 0.16); color: var(--good-text); border-color: rgba(10, 172, 35, 0.35); }

.select, .input {
  background: var(--surface-2); border: 1px solid var(--hairline-strong); border-radius: 10px;
  padding: 9px 12px; min-width: 0; outline: none; transition: border-color .15s;
}
.select:focus, .input:focus { border-color: var(--accent); }
.select { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%), linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%); background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-tertiary); pointer-events: none; }
.input-icon .input { padding-left: 36px; width: 100%; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-1); border: 1px solid var(--hairline); border-radius: 11px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; cursor: pointer; color: var(--text-secondary); font-weight: 560; font-size: 13px; }
.seg button:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.04); }
.seg button.on { background: var(--surface-3); color: var(--text-primary); box-shadow: 0 1px 2px rgba(0, 0, 0, .4); }

.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }

/* ---------------- cards & grid ---------------- */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0)) , var(--surface-1);
  border: 1px solid var(--hairline); border-radius: var(--radius-l); box-shadow: var(--shadow);
  padding: 18px 20px; min-width: 0;
}
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-h h2 { font-size: 15px; }
.card-h > svg { width: 18px; height: 18px; color: var(--accent); flex: none; }
.card-h .muted { font-size: 12px; }
.card-h .spacer { flex: 1; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ---------------- stat tiles ---------------- */
.tiles { display: grid; grid-template-columns: 1.4fr repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.tile { padding: 16px 18px; }
.tile .label { font-size: 12px; color: var(--text-secondary); font-weight: 560; display: flex; align-items: center; gap: 6px; }
.tile .value { font-size: 26px; font-weight: 680; margin-top: 6px; letter-spacing: -0.02em; }
.tile .foot { font-size: 12px; color: var(--text-secondary); margin-top: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tile.hero { background: radial-gradient(500px 160px at 0% 0%, rgba(217, 180, 90, 0.16), transparent 70%), var(--surface-1); border-color: rgba(217, 180, 90, 0.22); }
.tile.hero .value { font-size: 44px; line-height: 1.05; }
.delta { font-weight: 650; display: inline-flex; align-items: center; gap: 3px; }
.delta.up { color: var(--good-text); }
.delta.down { color: #ef7b7b; }
.delta.flat { color: var(--text-secondary); }
.meter { height: 6px; border-radius: 6px; background: rgba(152, 135, 239, 0.16); overflow: hidden; margin-top: 10px; display: flex; gap: 2px; }
.meter i { display: block; height: 100%; border-radius: 6px; }

/* ---------------- status pills & legend ---------------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 7px; border-radius: 99px; font-size: 12px; font-weight: 620; border: 1px solid transparent; white-space: nowrap; }
.pill svg { width: 13px; height: 13px; }
.pill.free { background: rgba(10, 172, 35, 0.13); border-color: rgba(10, 172, 35, 0.3); color: #6fd57b; }
.pill.held { background: rgba(251, 179, 21, 0.12); border-color: rgba(251, 179, 21, 0.32); color: #fcc95a; }
.pill.paid { background: rgba(152, 135, 239, 0.14); border-color: rgba(152, 135, 239, 0.35); color: #bcb0f6; }
.pill.checked_in { background: rgba(152, 135, 239, 0.22); border-color: rgba(152, 135, 239, 0.55); color: #d6cffb; }
.pill.unavailable, .pill.neutral { background: rgba(255, 255, 255, 0.05); border-color: var(--hairline-strong); color: var(--text-secondary); }
.pill.critical { background: rgba(220, 60, 61, 0.14); border-color: rgba(220, 60, 61, 0.4); color: #f08a8a; }
.pill.gold { background: var(--accent-wash); border-color: rgba(217, 180, 90, 0.35); color: var(--accent-strong); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--text-secondary); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; }

/* ---------------- live map ---------------- */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.map-card { padding: 14px; position: relative; overflow: hidden; }
.map-card .card-h { padding: 4px 6px 0; }
.map-svg { width: 100%; height: auto; display: block; touch-action: manipulation; user-select: none; }
.map-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.map-svg .fx { stroke-width: .12; }
.map-svg .fx-shell { fill: none; stroke: rgba(255,255,255,.06); stroke-dasharray: .5 .4; }
.map-svg .fx-room { fill: #121118; stroke: rgba(255,255,255,.22); stroke-width: .18; }
.map-svg .fx-alcove { fill: #121118; stroke: rgba(255,255,255,.22); stroke-width: .18; }
.map-svg .fx-zone { fill: rgba(217,180,90,.025); stroke: rgba(217,180,90,.28); stroke-dasharray: .45 .35; }
.map-svg .fx-floor { fill: url(#floorGlow); stroke: none; }
.map-svg .fx-void { fill: url(#voidHatch); stroke: rgba(255,255,255,.18); stroke-dasharray: .5 .35; }
.map-svg .fx-entrance { fill: rgba(255,255,255,.015); stroke: var(--text-tertiary); stroke-dasharray: .55 .4; }
.map-svg .fx-bar { fill: #3a2f17; stroke: rgba(217,180,90,.7); }
.map-svg .fx-stage { fill: #24202f; stroke: rgba(152,135,239,.55); }
.map-svg .fx-stairs { fill: url(#stairs); stroke: rgba(255,255,255,.2); }
.map-svg .fx-lift { fill: #19181f; stroke: rgba(255,255,255,.2); }
.map-svg .fx-console { fill: #8d8b96; stroke: none; opacity: .55; }
.map-svg .fx-column { fill: #55535f; stroke: none; }
.map-svg .fx-label { fill: var(--text-tertiary); font-size: .78px; font-weight: 700; letter-spacing: .08px; pointer-events: none; }
.map-svg .fx-label-floor { fill: rgba(188,176,246,.45); font-size: 1.05px; letter-spacing: .3px; }
.map-svg .fx-label-bar { fill: rgba(232,199,115,.9); font-size: .7px; }
.map-svg .fx-label-stage { fill: #bcb0f6; }
.map-svg .fx-label-zone { fill: rgba(217,180,90,.7); }
.map-svg .fx-label-void { fill: rgba(255,255,255,.28); }
.map-svg .fx-label-entrance { font-size: .85px; }
.tbl { cursor: pointer; outline: none; }
.tbl .shape { stroke-width: .14; transition: stroke-width .15s; }
.tbl .code { font-weight: 760; fill: var(--text-primary); pointer-events: none; }
.tbl.free .shape { fill: rgba(10, 172, 35, 0.16); stroke: var(--st-free); }
.tbl.held .shape { fill: rgba(251, 179, 21, 0.16); stroke: var(--st-held); stroke-dasharray: .4 .25; animation: march 1.2s linear infinite; }
.tbl.paid .shape { fill: rgba(152, 135, 239, 0.34); stroke: var(--st-paid); filter: url(#glow); }
.tbl.checked_in .shape { fill: rgba(152, 135, 239, 0.62); stroke: #d6cffb; filter: url(#glow); }
.tbl.unavailable .shape { fill: url(#hatch); stroke: var(--st-unavailable); }
.tbl.unavailable .code { fill: var(--text-tertiary); }
.tbl:hover .shape, .tbl:focus-visible .shape { stroke-width: .28; }
.tbl .ring { fill: none; stroke: none; }
.tbl.selected .ring { stroke: var(--accent); stroke-width: .2; }
.tbl .badge-bg { fill: #d6cffb; stroke: var(--surface-1); stroke-width: .15; }
.tbl .badge-ic { stroke: #15141a; stroke-width: .16; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.tbl .timer { font-size: .72px; font-weight: 750; fill: #fcc95a; pointer-events: none; }
.tbl.flash .shape { animation: flash 1.2s ease-out; }
@keyframes march { to { stroke-dashoffset: -1.3; } }
@keyframes flash { 0% { stroke-width: .6; } 100% { stroke-width: .14; } }
.legend svg, .note svg { width: 13px; height: 13px; vertical-align: -2px; }
.map-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 6px 2px; flex-wrap: wrap; }

/* ---------------- side panel / sheet ---------------- */
.panel { position: sticky; top: 16px; padding: 0; overflow: hidden; }
.panel-h { padding: 18px 20px 14px; border-bottom: 1px solid var(--hairline); background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent); }
.panel-h .row { display: flex; align-items: center; gap: 10px; }
.panel-h h2 { font-size: 20px; }
.panel-b { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 16px; max-height: calc(100vh - 220px); overflow: auto; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--text-secondary); }
.kv dd { margin: 0; text-align: right; font-weight: 560; overflow: hidden; text-overflow: ellipsis; }
.section-t { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--text-tertiary); margin-bottom: 8px; }
.items { display: flex; flex-direction: column; gap: 6px; }
.item { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; background: var(--surface-2); border-radius: 10px; font-size: 13px; }
.item small { display: block; color: var(--text-secondary); font-size: 12px; }
.note { padding: 10px 12px; border-radius: 10px; background: var(--accent-wash); border: 1px solid rgba(217, 180, 90, .2); font-size: 13px; }
.close-x { margin-left: auto; border: 0; background: transparent; color: var(--text-secondary); cursor: pointer; padding: 6px; border-radius: 8px; display: none; }
.close-x svg { width: 18px; height: 18px; }
.empty { text-align: center; color: var(--text-secondary); padding: 26px 10px; }
.empty svg { width: 34px; height: 34px; color: var(--text-tertiary); margin-bottom: 8px; }
.client-big { display: flex; align-items: center; gap: 12px; }
.client-big .avatar { width: 44px; height: 44px; font-size: 15px; }
.client-big b { font-size: 16px; display: block; }
.countdown { font-weight: 700; color: #fcc95a; }

/* ---------------- lists / tables ---------------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; font-weight: 600; font-size: 12px; color: var(--text-secondary); padding: 8px 10px; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
table.data td { padding: 10px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.04); white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.r, table.data th.r { text-align: right; font-variant-numeric: tabular-nums; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr.click { cursor: pointer; }
table.data tbody tr.click:hover { background: rgba(255, 255, 255, 0.03); }
.rank { width: 22px; height: 22px; border-radius: 7px; background: var(--surface-3); display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--text-secondary); }
.rank.top { background: var(--accent-wash); color: var(--accent-strong); }
.tag { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--surface-3); font-size: 11px; color: var(--text-secondary); margin-right: 4px; }
.dot-ok, .dot-no { display: inline-flex; width: 18px; height: 18px; border-radius: 50%; align-items: center; justify-content: center; }
.dot-ok { background: rgba(10, 172, 35, 0.16); color: var(--good-text); }
.dot-no { background: rgba(255, 255, 255, 0.05); color: var(--text-tertiary); }
.dot-ok svg, .dot-no svg { width: 11px; height: 11px; }

.prep-row { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.prep-row:last-child { border-bottom: 0; }
.prep-qty { width: 40px; height: 40px; border-radius: 12px; background: var(--surface-3); display: grid; place-items: center; font-weight: 750; font-size: 16px; }
.prep-row small { color: var(--text-secondary); display: block; font-size: 12px; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.chip { font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: 6px; background: rgba(152, 135, 239, 0.16); color: #c9bffa; }

/* ---------------- check-in ---------------- */
.door-head { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; margin-bottom: 16px; }
.door-search .input { font-size: 17px; padding: 15px 16px 15px 44px; border-radius: 14px; }
.door-search svg { left: 15px; width: 20px; height: 20px; }
.door-count { text-align: right; }
.door-count b { font-size: 30px; font-weight: 720; }
.door-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.guest {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; align-items: center;
  padding: 14px 16px; border-radius: 16px; background: var(--surface-1); border: 1px solid var(--hairline);
  transition: border-color .2s, background .2s, opacity .2s;
}
.guest .tcode { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; font-weight: 800; font-size: 15px; background: rgba(152, 135, 239, 0.16); color: #d6cffb; }
.guest b { font-size: 16px; display: block; }
.guest small { color: var(--text-secondary); font-size: 12.5px; }
.guest small .nw { white-space: nowrap; }
.guest.in { opacity: .62; }
.guest.in .tcode { background: rgba(10, 172, 35, 0.16); color: var(--good-text); }
.guest.held .tcode { background: rgba(251, 179, 21, 0.13); color: #fcc95a; }
.guest.just { border-color: rgba(10, 172, 35, 0.6); background: rgba(10, 172, 35, 0.07); }

/* ---------------- charts ---------------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .tick { fill: var(--text-secondary); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .bar { transition: opacity .15s, filter .15s; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart .bar.hover { filter: brightness(1.25); }
.chart .val { fill: var(--text-primary); font-size: 11px; font-weight: 650; }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: 92px 1fr 88px; align-items: center; gap: 10px; font-size: 13px; }
.hbar .track { height: 18px; position: relative; }
.hbar .fill { position: absolute; left: 0; top: 2px; bottom: 2px; border-radius: 0 4px 4px 0; background: var(--series-1); min-width: 2px; transition: width .4s ease; }
.hbar .v { text-align: right; font-variant-numeric: tabular-nums; }
.hbar .v small { color: var(--text-secondary); margin-left: 4px; }
.segbar { display: flex; gap: 2px; height: 28px; margin: 6px 0 12px; }
.segbar div { border-radius: 4px; display: flex; align-items: center; padding-left: 8px; font-size: 12px; font-weight: 700; color: #fff; min-width: 0; overflow: hidden; white-space: nowrap; }

.tooltip {
  position: fixed; z-index: 100; pointer-events: none; min-width: 140px; max-width: 260px;
  background: rgba(28, 27, 35, 0.96); border: 1px solid var(--hairline-strong); border-radius: 10px;
  padding: 9px 11px; font-size: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); backdrop-filter: blur(8px);
}
.tooltip .tv { font-size: 15px; font-weight: 700; }
.tooltip .tl { color: var(--text-secondary); }
.tooltip .tr { display: flex; justify-content: space-between; gap: 14px; }

/* ---------------- calendar ---------------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .dow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--text-tertiary); padding: 0 6px 4px; }
.cal .day { min-height: 112px; background: var(--surface-1); border: 1px solid var(--hairline); border-radius: 12px; padding: 7px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal .day.out { opacity: .38; }
.cal .day.today { border-color: rgba(217, 180, 90, .55); box-shadow: inset 0 0 0 1px rgba(217, 180, 90, .25); }
.cal .dnum { font-size: 12px; font-weight: 650; color: var(--text-secondary); padding: 0 2px 2px; display: flex; justify-content: space-between; align-items: center; }
.cal .today .dnum b { background: var(--accent); color: var(--accent-ink); border-radius: 6px; padding: 0 6px; }
.ev { border-radius: 7px; padding: 5px 7px 5px 9px; font-size: 11.5px; line-height: 1.25; background: var(--surface-2); position: relative; overflow: hidden; cursor: default; }
.ev::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.ev.parties::before { background: var(--series-1); }
.ev.events::before { background: var(--series-2); }
.ev b { display: block; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev span { color: var(--text-secondary); }
.ev.clash { box-shadow: inset 0 0 0 1px rgba(220, 60, 61, .7); }
.agenda { display: none; }

/* ---------------- login ---------------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login {
  width: 100%; max-width: 400px; padding: 34px 32px 30px; border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)), var(--surface-1);
  border: 1px solid var(--hairline-strong); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8), 0 0 0 1px rgba(217, 180, 90, 0.05);
}
.login .brand { justify-content: center; padding: 0 0 6px; }
.login .brand-mark { font-size: 28px; padding: 5px 10px 5px 14px; }
.login p.lead { text-align: center; color: var(--text-secondary); margin: 6px 0 26px; }
.login label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin: 14px 0 6px; }
.login .input { width: 100%; padding: 12px 14px; }
.login .btn { width: 100%; margin-top: 22px; padding: 13px; font-size: 15px; }
.login .err { color: #f08a8a; font-size: 13px; margin-top: 12px; min-height: 18px; text-align: center; }

/* ---------------- drawer (client detail) ---------------- */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 40; animation: fade .2s; }
.drawer { position: fixed; z-index: 50; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); background: var(--surface-1); border-left: 1px solid var(--hairline-strong); box-shadow: -20px 0 60px rgba(0, 0, 0, .5); display: flex; flex-direction: column; animation: slide .25s ease; }
.drawer .panel-b { max-height: none; flex: 1; }
.drawer .close-x { display: inline-flex; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }

/* ---------------- toasts ---------------- */
.toasts { position: fixed; z-index: 200; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--surface-3); border: 1px solid var(--hairline-strong); padding: 10px 16px; border-radius: 12px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: fade .2s; display: flex; gap: 8px; align-items: center; }
.toast.ok { border-color: rgba(10, 172, 35, .45); }
.toast.err { border-color: rgba(220, 60, 61, .5); }
.toast svg { width: 16px; height: 16px; }

.loading { opacity: .55; transition: opacity .2s; }
.demo-banner { background: repeating-linear-gradient(135deg, rgba(217, 180, 90, .12) 0 10px, rgba(217, 180, 90, .06) 10px 20px); border: 1px solid rgba(217, 180, 90, .3); color: var(--accent-strong); border-radius: 12px; padding: 8px 14px; font-size: 12.5px; font-weight: 600; margin-bottom: 16px; }

/* ---------------- responsive ---------------- */
@media (max-width: 1280px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tiles .hero { grid-column: span 3; }
  .map-layout { grid-template-columns: minmax(0, 1fr) 320px; }
}
@media (max-width: 1020px) {
  .map-layout { grid-template-columns: 1fr; }
  .panel { position: fixed; z-index: 60; left: 0; right: 0; bottom: 0; top: auto; border-radius: 22px 22px 0 0; max-height: 78vh; transform: translateY(105%); transition: transform .28s ease; box-shadow: 0 -20px 60px rgba(0, 0, 0, .6); }
  .panel.open { transform: translateY(0); }
  .panel .panel-b { max-height: calc(78vh - 90px); }
  .panel .close-x { display: inline-flex; }
  .g-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  :root { --sidebar: 0px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 30; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--hairline);
    background: rgba(13, 12, 18, 0.94);
  }
  .brand, .sidebar-foot .who, .sidebar-foot { display: none; }
  .nav { flex-direction: row; justify-content: space-around; width: 100%; }
  .nav a { flex-direction: column; gap: 3px; padding: 7px 6px; font-size: 10.5px; flex: 1; text-align: center; }
  .nav a svg { width: 20px; height: 20px; }
  .main { padding: 16px 14px 96px; }
  .topbar h1 { font-size: 20px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tiles .hero { grid-column: span 2; }
  .tile .value { font-size: 22px; }
  .tile.hero .value { font-size: 36px; }
  .g-2, .g-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .door-head { grid-template-columns: 1fr; }
  .door-count { text-align: left; }
  .door-list { grid-template-columns: 1fr; }
  .cal-grid-wrap { display: none; }
  .agenda { display: flex; flex-direction: column; gap: 8px; }
  .hbar { grid-template-columns: 74px 1fr 76px; }
  .mobile-logout { display: inline-flex !important; }
  .shell.single .sidebar { display: none; }
  .shell.single .main { padding-bottom: 32px; }
  .map-svg { min-width: 600px; }
  .map-card .card-h { flex-wrap: wrap; }
  .map-card .card-h .seg { order: 3; width: 100%; }
  .map-card .card-h .seg button { flex: 1; }
  .guest { grid-template-columns: 48px 1fr auto; gap: 10px; padding: 12px; }
  .guest .tcode { width: 48px; height: 48px; font-size: 14px; }
  .guest .btn.big { padding: 12px 14px; }
  .guest small { word-break: keep-all; }
  .topbar .select { flex: 1 1 100%; }
  .map-card { padding: 10px; }
}
.mobile-logout { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (forced-colors: active) {
  .tbl .shape { stroke: CanvasText; }
}
