/* Visitor Desk styles. Colours are tokens at the top; dark mode redefines the same tokens. */
body { margin: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }
/* Layout: left menu (drawer on phones), sticky top bar carrying today's In / Out / Inside on every page, one working column below. */
:root {
  --h: 174;
  --bg: #f2f5f4; --surface: #ffffff; --surface-2: #e8eded; --line: #d3dbda;
  --fg: #17201f; --muted: #586766;
  --accent: hsl(var(--h) 64% 26%); --accent-soft: hsl(var(--h) 45% 91%); --on-accent: #ffffff;
  --ok: #1c7139; --ok-soft: #dff2e5; --warn: #855600; --warn-soft: #fbedd0; --bad: #a3271f; --bad-soft: #fbe3e0;
  --info: #1b5cb0; --info-soft: #e0ecfb; --violet: #6537b8; --violet-soft: #ece5fa; --pink: #a22b68; --pink-soft: #fae2ed; --orange: #9a4a12; --orange-soft: #fbe7d7; --cyan: #0a6a7a; --cyan-soft: #d8f0f4;
  --go: #1c7a3e; --on-go: #ffffff; --out: #a85800; --on-out: #ffffff; --stop: #b3261e; --on-stop: #ffffff;
  --paper: #ffffff; --ink: #111716; --ink-soft: #4d5957; --paper-line: #cfd6d5; --paper-accent: hsl(var(--h) 64% 26%);
  --f-display: "Barlow Semi Condensed", "Arial Narrow", Arial, sans-serif;
  --f-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", Consolas, "Courier New", monospace;
  --r: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1514; --surface: #172020; --surface-2: #202b2a; --line: #2f3d3b;
    --fg: #e6eeec; --muted: #98a9a7;
    --accent: hsl(var(--h) 55% 62%); --accent-soft: hsl(var(--h) 35% 17%); --on-accent: #07110f;
    --ok: #6fd08c; --ok-soft: #15301f; --warn: #f0be5a; --warn-soft: #3a2c0d; --bad: #f2867d; --bad-soft: #3b1815;
    --info: #8ab8f5; --info-soft: #14294a; --violet: #b9a2f2; --violet-soft: #2a1f4d; --pink: #f09ac0; --pink-soft: #44182d; --orange: #f2a56c; --orange-soft: #432210; --cyan: #6fd0e0; --cyan-soft: #0d3138;
    --go: #3fae69; --on-go: #06140b; --out: #f0b44c; --on-out: #1f1400; --stop: #f2867d; --on-stop: #240806;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1514; --surface: #172020; --surface-2: #202b2a; --line: #2f3d3b;
  --fg: #e6eeec; --muted: #98a9a7;
  --accent: hsl(var(--h) 55% 62%); --accent-soft: hsl(var(--h) 35% 17%); --on-accent: #07110f;
  --ok: #6fd08c; --ok-soft: #15301f; --warn: #f0be5a; --warn-soft: #3a2c0d; --bad: #f2867d; --bad-soft: #3b1815;
    --info: #8ab8f5; --info-soft: #14294a; --violet: #b9a2f2; --violet-soft: #2a1f4d; --pink: #f09ac0; --pink-soft: #44182d; --orange: #f2a56c; --orange-soft: #432210; --cyan: #6fd0e0; --cyan-soft: #0d3138;
    --go: #3fae69; --on-go: #06140b; --out: #f0b44c; --on-out: #1f1400; --stop: #f2867d; --on-stop: #240806;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--fg); font-family: var(--f-body); font-size: 15px; line-height: 1.5; }
h1, h2, h3, p, ul, figure { margin: 0; }
h1 { font-family: var(--f-display); font-weight: 600; font-size: 24px; line-height: 1.15; }
h2 { font-family: var(--f-display); font-weight: 600; font-size: 19px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.spacer { flex: 1; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.login-art { background: var(--accent); color: var(--on-accent); padding: clamp(24px, 6vw, 72px); display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.login-art h1 { font-size: clamp(28px, 4vw, 42px); overflow-wrap: anywhere; }
.login-art .tag { font-family: var(--f-display); letter-spacing: .14em; text-transform: uppercase; font-size: 14px; }
.login-art ul { list-style: none; padding: 0; margin-top: 14px; display: grid; gap: 8px; font-size: 16px; }
.login-art li { display: flex; gap: 10px; align-items: baseline; }
.login-art li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.login-side { display: grid; place-items: center; padding: 32px 16px; }
.login-card { width: 100%; max-width: 380px; display: grid; gap: 16px; }
.login-card h2 { font-size: 26px; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.brand { display: flex; gap: 10px; align-items: center; padding: 0 8px 12px; }
.brand-mark { width: 36px; height: 36px; border-radius: 8px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-family: var(--f-display); font-weight: 600; font-size: 16px; flex: none; }
.login-art .brand-mark { background: var(--on-accent); color: var(--accent); width: 48px; height: 48px; font-size: 20px; }
.brand b { display: block; font-weight: 600; font-size: 14px; line-height: 1.25; overflow-wrap: anywhere; }
.brand span { font-size: 12px; color: var(--muted); }
.nav-group { font-family: var(--f-display); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 12px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 8px; color: var(--fg); text-decoration: none; }
.nav .chip-ic { width: 28px; height: 28px; } .nav .ic { width: 16px; height: 16px; }
.nav a:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side-foot { margin-top: auto; padding: 14px 10px 0; font-size: 12px; color: var(--muted); }
.col { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px clamp(16px, 3vw, 32px); }
.top h1 { flex: 1; min-width: 0; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
.icon-btn svg, .tabbar svg { width: 22px; height: 22px; }
.menu-btn { display: none; }
.counters { display: flex; gap: 8px; }
.ctr { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 5px 14px 5px 6px; cursor: pointer; min-width: 0; text-align: left; }
.ctr:hover { border-color: var(--k); }
.ctr .tx { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.ctr .tx span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.ctr .tx b { font-family: var(--f-mono); font-size: 19px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--k); }
.user { display: flex; align-items: center; gap: 10px; }
.user .who2 { font-size: 13px; line-height: 1.25; text-align: right; }
.user .who2 span { display: block; color: var(--muted); font-size: 12px; }
.main { padding: 20px clamp(16px, 3vw, 32px) 48px; min-width: 0; }
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 8; }
.tabbar { display: none; }

/* ---------- shared pieces ---------- */
.pill { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; border: 0; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.plain { background: var(--surface-2); color: var(--muted); }
button.pill { cursor: pointer; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn.wide { width: 100%; min-height: 46px; }
kbd { font-family: var(--f-mono); font-size: 11px; border: 1px solid currentColor; border-radius: 4px; padding: 0 5px; opacity: .8; }
.hint { font-size: 13px; color: var(--muted); }
.err { color: var(--bad); font-size: 13px; }
.empty { padding: 28px 14px; text-align: center; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; align-items: center; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 12px; color: var(--muted); }
.field input, .field select, .toolbar input, .toolbar select { height: 42px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); padding: 0 12px; width: 100%; min-width: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px 16px; margin-top: 16px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 14px; }
.toolbar .field { flex: 1 1 150px; max-width: 240px; }
.toolbar > input { flex: 1 1 220px; max-width: 340px; background: var(--surface); }
.toolbar .field input, .toolbar .field select { background: var(--surface); }
.sumline { font-size: 13px; color: var(--muted); margin-bottom: 12px; }

/* ---------- icons and colour ---------- */
.ic { width: 18px; height: 18px; flex: none; }
.btn.small .ic { width: 16px; height: 16px; }
.k-green { --k: var(--ok); --k-soft: var(--ok-soft); } .k-amber { --k: var(--warn); --k-soft: var(--warn-soft); } .k-red { --k: var(--bad); --k-soft: var(--bad-soft); }
.k-blue { --k: var(--info); --k-soft: var(--info-soft); } .k-violet { --k: var(--violet); --k-soft: var(--violet-soft); } .k-pink { --k: var(--pink); --k-soft: var(--pink-soft); }
.k-orange { --k: var(--orange); --k-soft: var(--orange-soft); } .k-cyan { --k: var(--cyan); --k-soft: var(--cyan-soft); } .k-accent { --k: var(--accent); --k-soft: var(--accent-soft); }
.chip-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--k-soft); color: var(--k); flex: none; }
.pill.k { background: var(--k-soft); color: var(--k); }
.btn.tint { background: var(--k-soft); color: var(--k); border-color: transparent; }
.btn.tint:hover { background: var(--k-soft); border-color: var(--k); }
.btn.go { background: var(--go); border-color: var(--go); color: var(--on-go); }
.btn.out { background: var(--out); border-color: var(--out); color: var(--on-out); }
.btn.stop { background: var(--stop); border-color: var(--stop); color: var(--on-stop); }
.btn.go:hover { background: var(--go); filter: brightness(1.08); } .btn.out:hover { background: var(--out); filter: brightness(1.08); } .btn.stop:hover { background: var(--stop); filter: brightness(1.08); }
.hic { display: flex; align-items: center; gap: 10px; }
h3 { font-family: var(--f-display); font-weight: 600; font-size: 17px; }
/* gate checks: red = deposit at gate, blue = declare, green = confirm */
.checks { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; }
.checks h3 .pill { font-family: var(--f-body); }
.ckgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 12px; }
.ckg { background: var(--k-soft); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; align-content: start; }
.ckh { font-size: 12px; color: var(--k); font-weight: 500; }
.ck { display: flex; align-items: center; gap: 10px; min-height: 30px; cursor: pointer; }
.ck input { width: 18px; height: 18px; accent-color: var(--k); flex: none; }
.ckd { display: grid; gap: 6px; padding-left: 28px; }
.ckd input { height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 0 10px; width: 100%; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.reqm { color: var(--bad); margin-left: 3px; }
/* tag list input: type, press Enter, the entry becomes a chip */
.tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 42px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); padding: 5px 8px; }
.tags:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.tagwrap { display: contents; }
.tags input { flex: 1 1 180px; min-width: 120px; width: auto; height: 30px; border: 0; background: transparent; outline: 0; padding: 0 4px; }
.tagchip { display: inline-flex; align-items: center; gap: 4px; background: var(--violet-soft); color: var(--violet); border-radius: 6px; padding: 2px 4px 2px 10px; font-size: 13px; font-weight: 500; }
.tagchip button { border: 0; background: transparent; color: inherit; cursor: pointer; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 4px; }
.tagchip button:hover { background: var(--surface); }
.tagchip .ic { width: 13px; height: 13px; }
.passes { display: grid; gap: 14px; min-width: 0; align-content: start; }
.rt input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.ckret { margin-top: 12px; padding: 8px 12px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-size: 13px; }

/* ---------- gate desk ---------- */
.desk { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.search { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 2px solid var(--accent); border-radius: 14px; padding: 6px 16px; }
.search svg { width: 22px; height: 22px; color: var(--muted); flex: none; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: 0; padding: 12px 0; font-size: 22px; font-weight: 500; letter-spacing: .02em; }
.search input::placeholder { color: var(--muted); font-weight: 400; letter-spacing: 0; font-size: 16px; }
.keys { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); margin: 8px 4px 16px; }
.person { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.person .who { flex: 1; min-width: 160px; }
.person .who b { display: block; font-size: 18px; font-weight: 600; line-height: 1.25; }
.person .who span { font-size: 13px; color: var(--muted); }
.av { border-radius: 50%; background: var(--k-soft, var(--accent-soft)); color: var(--k, var(--accent)); display: grid; place-items: center; font-weight: 600; flex: none; object-fit: cover; }
dl { margin: 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 24px; border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; width: 100%; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line); padding: 10px 4px; }
.row:last-child { border-bottom: 0; }
button.row { cursor: pointer; }
button.row:hover { background: var(--surface-2); }
.row .t { flex: 1; min-width: 150px; }
.rt .mono { white-space: nowrap; }
.whoc { display: inline-flex; align-items: center; gap: 10px; text-align: left; }
.rowmain { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 180px; background: transparent; border: 0; border-radius: 8px; padding: 2px; text-align: left; cursor: pointer; }
.rowmain:hover b { text-decoration: underline; }
.row .t b { display: block; font-weight: 500; }
.row .t span { font-size: 12px; color: var(--muted); }
.cam { margin-top: 12px; display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.cam video { width: 260px; max-width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--surface-2); transform: scaleX(-1); }
.cam-btns { display: flex; flex-direction: column; gap: 8px; }
.passwrap { display: grid; grid-template-columns: minmax(0, 330px) minmax(0, 1fr); gap: 24px; align-items: start; }
.pass { background: var(--paper); color: var(--ink); border: 1px solid var(--paper-line); border-radius: 12px; overflow: hidden; }
.pass-top { background: var(--paper-accent); color: #ffffff; padding: 10px 14px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.pass-top b { font-family: var(--f-display); font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.pass-top span { font-family: var(--f-display); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; }
.pass-body { padding: 14px; display: flex; gap: 12px; align-items: center; }
.pass-body .av { background: #e6ebea; color: var(--ink); }
.pass-name { font-family: var(--f-display); font-size: 22px; font-weight: 600; line-height: 1.1; overflow-wrap: anywhere; }
.pass-co { font-size: 13px; color: var(--ink-soft); }
.pass-type { display: inline-block; margin-top: 6px; border: 1.5px solid var(--paper-accent); color: var(--paper-accent); font-family: var(--f-display); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; padding: 0 8px; border-radius: 4px; }
.pass-grid { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 12px; padding: 12px 14px; border-top: 1px dashed var(--paper-line); }
.pass-grid dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; align-content: start; }
.pass-grid dt { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.pass-grid dd { margin: 0; font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.pass-grid .wide { grid-column: 1 / -1; }
.qr { width: 96px; height: 96px; background: #ffffff; }
.qr svg { display: block; width: 100%; height: 100%; }
.pass-foot { border-top: 1px dashed var(--paper-line); padding: 8px 14px; display: flex; justify-content: space-between; gap: 10px; font-size: 11px; color: var(--ink-soft); }
.pass-foot .mono { color: var(--ink); font-weight: 500; font-size: 13px; }
/* pass design 1: classic label */
.pass.t-classic { max-width: 330px; }
.av.sq { border-radius: 8px; }
/* pass design 2: portrait ID card */
.pass.t-card { max-width: 240px; text-align: center; }
.t-card .pc-top { background: var(--paper-accent); color: #ffffff; padding: 12px 10px 36px; }
.t-card .pc-top b { display: block; font-family: var(--f-display); font-size: 16px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.t-card .pc-top span { font-family: var(--f-display); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; }
.t-card .pc-photo { margin: -28px auto 8px; padding: 4px; background: var(--paper); border-radius: 12px; width: max-content; }
.t-card .pc-photo .av { background: #e6ebea; color: var(--ink); }
.t-card .pass-name, .t-card .pass-co { padding: 0 12px; }
.t-card .pc-facts { display: grid; gap: 6px; padding: 10px 12px; }
.t-card dt, .t-slip dt { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.t-card dd { margin: 0; font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.t-card .pc-bot { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 12px 12px; border-top: 1px dashed var(--paper-line); }
.t-card .pc-bot .qr { width: 72px; height: 72px; flex: none; }
.t-card .pc-bot b { display: block; font-size: 15px; font-weight: 500; }
.t-card .pc-bot small { font-size: 11px; color: var(--ink-soft); }
.t-card .pc-type { background: var(--paper-accent); color: #ffffff; font-family: var(--f-display); font-weight: 600; letter-spacing: .2em; text-transform: uppercase; padding: 6px; font-size: 15px; }
/* pass design 3: 80 mm thermal slip, black only */
.pass.t-slip { max-width: 300px; border-radius: 2px; font-family: var(--f-mono); font-size: 12px; padding: 14px 14px 10px; }
.t-slip .ps-head { text-align: center; display: grid; gap: 2px; padding-bottom: 8px; }
.t-slip .ps-head b { font-size: 15px; font-weight: 500; text-transform: uppercase; overflow-wrap: anywhere; }
.t-slip .ps-head span { font-size: 11px; color: var(--ink-soft); }
.t-slip .ps-head em { font-style: normal; letter-spacing: .14em; text-transform: uppercase; margin-top: 4px; }
.t-slip .ps-sec { border-top: 1px dashed var(--ink); padding: 8px 0; }
.t-slip .ps-two { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.t-slip .ps-main { display: flex; gap: 10px; align-items: flex-start; }
.t-slip .av { background: #e6ebea; color: var(--ink); filter: grayscale(1); }
.t-slip dl { display: grid; gap: 4px; flex: 1; min-width: 0; }
.t-slip dl div { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 6px; align-items: baseline; }
.t-slip dd { margin: 0; overflow-wrap: anywhere; }
.t-slip .ps-qr { display: flex; align-items: center; gap: 10px; }
.t-slip .ps-qr .qr { width: 84px; height: 84px; flex: none; }
.t-slip .ps-sign { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding-top: 30px; }
.t-slip .ps-sign div { border-top: 1px solid var(--ink); padding-top: 3px; font-size: 10px; text-align: center; }
.t-slip .ps-foot { text-align: center; font-size: 11px; padding-top: 8px; }
.designs { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 16px; align-items: start; }
.design { display: grid; gap: 14px; justify-items: center; }
.design[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.design .dh { justify-self: stretch; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.design .pass { width: 100%; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-right: 1px solid var(--line); background: var(--surface); padding: 7px 12px; font-size: 13px; cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* ---------- tables ---------- */
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td small { display: block; color: var(--muted); font-size: 12px; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.act { text-align: right; white-space: nowrap; }
.more { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); }
.sharebar { display: inline-block; width: 90px; height: 8px; background: var(--surface-2); border-radius: 4px; vertical-align: middle; margin-right: 8px; overflow: hidden; }
.sharebar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

/* ---------- charts ---------- */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 16px; }
.chart figcaption { font-family: var(--f-display); font-weight: 600; font-size: 17px; }
.chart .sub { font-size: 12px; color: var(--muted); }
.plot { position: relative; height: 210px; margin-top: 26px; padding-left: 26px; }
.grid-l { position: absolute; left: 26px; right: 0; border-top: 1px solid var(--line); }
.grid-l span { position: absolute; right: 100%; margin-right: 6px; top: -9px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bcols { position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2px; height: 100%; }
.bcol { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 0; outline-offset: -2px; }
.bcol .bw { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bcol .bar { width: 100%; max-width: 26px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 0; }
.bcol:hover .bar, .bcol:focus-visible .bar { filter: brightness(1.2); }
.bcol .bl { height: 24px; line-height: 24px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.bcol:hover::after, .bcol:focus-visible::after { content: attr(data-tip); position: absolute; top: -24px; left: 50%; transform: translateX(-50%); background: var(--fg); color: var(--bg); font-size: 12px; padding: 2px 8px; border-radius: 6px; white-space: nowrap; z-index: 2; }
.bcol:nth-child(-n+2):hover::after, .bcol:nth-child(-n+2):focus-visible::after { left: 0; transform: none; }
.bcol:nth-last-child(-n+2):hover::after, .bcol:nth-last-child(-n+2):focus-visible::after { left: auto; right: 0; transform: none; }

/* ---------- masters ---------- */
dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--fg); padding: 22px; width: min(560px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.sw { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.sw[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--fg); }
.setup { display: grid; gap: 18px; max-width: 600px; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 8px; font-weight: 500; max-width: calc(100% - 32px); z-index: 30; }

@media (max-width: 1040px) { .desk, .passwrap { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) {
  .login { grid-template-columns: minmax(0, 1fr); align-content: start; }
  .login-art { padding: 28px 20px; } .login-art ul { display: none; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; height: auto; width: 270px; max-width: 86%; z-index: 9; transform: translateX(-105%); transition: transform .18s ease; padding-top: calc(18px + env(safe-area-inset-top, 0px)); }
  .side.open { transform: none; }
  .menu-btn { display: grid; }
  .top { padding: 8px 16px; gap: 8px 10px; }
  .top h1 { font-size: 21px; }
  .counters { order: 5; flex-basis: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ctr { gap: 8px; padding: 5px 6px 5px 5px; } .ctr .chip-ic { width: 28px; height: 28px; }
  .user .who2 { display: none; }
  .main { padding-bottom: 110px; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--surface); border-top: 1px solid var(--line); padding: 4px 8px calc(4px + env(safe-area-inset-bottom, 0px)); }
  .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; background: transparent; border: 0; border-radius: 8px; padding: 6px 2px; font-size: 11px; color: var(--muted); cursor: pointer; }
  .tabbar button[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  .search input { font-size: 19px; } .search input::placeholder { font-size: 14px; }
}
@media (max-width: 680px) {
  .rt thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .rt tr { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .rt tr:last-child { border-bottom: 0; }
  .rt td { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 3px 0; border: 0; text-align: right; }
  .rt td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: none; }
  .rt td:first-child { font-weight: 600; }
  .rt td .cv { min-width: 0; overflow-wrap: anywhere; }
  .rt td.act { padding-top: 8px; }
  .toolbar .field { max-width: none; flex-basis: 140px; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }
@media print {
  body * { visibility: hidden; }
  .pass, .pass * { visibility: visible; }
  .passes { position: absolute; left: 0; top: 0; display: block; }
  .pass { break-after: page; margin-bottom: 6mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pass.t-slip { border: 0; }
}

/* ---------- app additions ---------- */
.side-foot label { display: block; margin-bottom: 4px; }
.side-foot select { width: 100%; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); padding: 0 8px; }

/* ---------- maker's credit ---------- */
.powered { font-size: 12px; color: var(--muted); }
.powered b { color: var(--fg); font-weight: 600; }
.side .powered { padding: 12px 10px 0; }
.login-card .powered { text-align: center; margin-top: 6px; }

/* sign-in page drawing: it is drawn in the panel's text colour, so it follows the brand colour and dark mode */
.login-art { position: relative; overflow: hidden; }
.login-art > * { position: relative; z-index: 1; }
.login-art > .login-scene { position: absolute; z-index: 0; left: 0; bottom: 0; width: 100%; height: 58%; overflow: visible; pointer-events: none; }
@media (min-width: 901px) { .login-art { justify-content: flex-start; padding-top: clamp(28px, 9vh, 96px); } }
@media (min-width: 901px) and (max-height: 640px) { .login-art > .login-scene { height: 44%; } }
@media (max-width: 900px) { .login-art > .login-scene { display: none; } }

/* ---------- help panel (SOP) ---------- */
#help { position: fixed; inset: 0 0 0 auto; margin: 0; height: 100%; max-height: none; width: min(430px, 100%); max-width: 100%; border: 0; border-left: 1px solid var(--line); border-radius: 0; padding: 0; z-index: 25; overflow-y: auto; }
.help-head { position: sticky; top: 0; z-index: 1; background: var(--surface); border-bottom: 1px solid var(--line); padding: calc(12px + env(safe-area-inset-top, 0px)) 18px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.help-body { padding: 4px 18px 32px; }
.help-role { font-family: var(--f-display); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: 18px; }
#help details { border-bottom: 1px solid var(--line); padding: 10px 0; scroll-margin-top: 70px; }
#help summary { cursor: pointer; font-weight: 600; }
#help details[open] summary { color: var(--accent); }
#help ol { margin: 10px 0 4px; padding-left: 22px; display: grid; gap: 7px; }
@media (min-width: 1180px) { body.help-open .col { padding-right: 430px; } }
@media (max-width: 900px) { #u-help .lbl { display: none; } }

/* company logo */
/* the tile takes the logo's own shape: a square or round logo is up to 44 px, a wide one up to 86 px across, a tall one up to 44 px high; nothing is stretched or cut */
.brand-mark.has-logo { width: auto; height: auto; min-width: 40px; min-height: 40px; max-width: 92px; padding: 2px; background: #fff; border: 1px solid var(--line); overflow: hidden; }
.brand-mark.has-logo img { display: block; width: auto; height: auto; max-width: 86px; max-height: 44px; }
.logo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.logo-prev { width: 132px; height: 72px; flex: none; border: 1px dashed var(--line); border-radius: 8px; background: #fff; color: #5b6665; font-size: 13px; display: grid; place-items: center; padding: 6px; }
.logo-prev img { display: block; max-width: 100%; max-height: 58px; object-fit: contain; }
.logo-btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* import from Excel */
a.btn { text-decoration: none; color: inherit; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
a.btn.tint { color: var(--k); }
.imp { display: grid; gap: 14px; }
.imp-steps { margin: 0; padding-left: 22px; display: grid; gap: 12px; }
.imp-steps li > div { margin-top: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#imp-result .tablewrap { max-height: 230px; overflow: auto; margin-top: 8px; }
#imp-result td { font-size: 13px; }
