/* Moji Door. Design tokens come from the Claude Design handoff (Moji Door Scanner). */

@font-face {
  font-family: 'Archivo Black';
  src: url('/fonts/ArchivoBlack-Regular.ttf') format('truetype');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0d0b0c;
  --canvas: #120f10;
  --panel: #171314;
  --field: #211c1d;
  --line: #332c2d;
  --line-2: #3a3334;
  --text: #f4efe9;
  --muted: #a39a93;
  --ok: #2BD46A;
  --ok-ink: #04140a;
  --dup: #D42A24;
  --dup-ink: #fff;
  --void: #6B1014;
  --void-ink: #fff;
  --warn: #FF8A1F;
  --warn-ink: #1a0d00;
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --display: 'Archivo', 'Archivo Black', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
  /* motion: quick out, gentle settle; a little overshoot for things that pop */
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);
  --ease-spring: cubic-bezier(.3, 1.4, .6, 1);
  /* corners: tags 8, controls 12, cards 16 */
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  color-scheme: dark;
  /* Icons drawn as SVG: arrows and ticks aren't in Archivo or JetBrains Mono, and each phone swaps in its own. */
  --ico-back: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19.5 12h-15M10.5 5.5 4 12l6.5 6.5'/%3E%3C/svg%3E");
  --ico-check-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2304140a' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5.5 12.8l4.2 4.2L18.5 7.8'/%3E%3C/svg%3E");
}
.ico { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

* { box-sizing: border-box; }
/* Touch: no double-tap zoom, no grey tap flash, no text selection or callouts on controls. */
html { -webkit-tap-highlight-color: transparent; touch-action: manipulation; overscroll-behavior: none; }
button, .btn, a, label.check, label.toggle-row, .ev-card, .pick, .radio-card, .seg button, .tabs button { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
/* Every control answers the finger right away. */
button, .btn { transition: transform .1s ease, background-color .15s ease, border-color .15s ease, color .15s ease, opacity .15s ease; }
button:active:not(:disabled), .btn:active { transform: scale(.97); }
a.ev-row:active, .guests li:active { background: rgba(255, 255, 255, .04); }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; -webkit-text-size-adjust: 100%; }
body { overscroll-behavior: none; }
[hidden] { display: none !important; }
a { color: var(--text); }
@media (hover: hover) { a:hover { color: var(--muted); } }
h1, h2, h3 { margin: 0; line-height: 1.1; }
p { margin: 0 0 .75rem; line-height: 1.45; }
small, .muted { color: var(--muted); }
code, .mono { font-family: var(--mono); }
strong { font-weight: 800; }

.label { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 400; }
.label.sm { font-size: 11px; }
.label.xs { font-size: 10.5px; }
.display { font-family: var(--display); font-weight: 900; letter-spacing: -0.02em; }
.logo { display: block; height: 20px; width: auto; }

/* ---------------------------------------------------------------- buttons, fields, tags */

button, .btn {
  appearance: none; font: inherit; cursor: pointer; text-decoration: none; color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  height: 42px; padding: 0 18px; border-radius: var(--r); font-size: 14.5px; font-weight: 800;
  background: transparent; border: 1.5px solid var(--line);
}
@media (hover: hover) { button:hover, .btn:hover { border-color: #4a4243; color: var(--text); } }
button:disabled { opacity: .5; cursor: default; }
button.primary, .btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
@media (hover: hover) { button.primary:hover, .btn.primary:hover { background: #fff; color: var(--bg); } }
button.danger, .btn.danger { color: #ff9b94; border-color: #5b2226; }
button.danger.solid { background: var(--dup); border-color: var(--dup); color: #fff; }
@media (hover: hover) { button.danger.solid:hover { background: #e8352e; border-color: #e8352e; color: #fff; } }
button.ghost, .btn.ghost { border-color: transparent; color: var(--muted); }
button.text-btn { height: auto; padding: 0; border: 0; color: var(--muted); font-size: 13.5px; font-weight: 700; }
@media (hover: hover) { button.text-btn:hover { color: var(--text); } }
button.sm, .btn.sm { height: 36px; }
button.xs, .btn.xs { height: 34px; }
button.lg, .btn.lg { height: 48px; }
button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--field); border: 1.5px solid var(--line); border-radius: var(--r);
  height: 46px; padding: 0 14px; font-size: 16px;
}
/* iPhone draws its own look on fields and buttons (rounded search boxes, extra padding) unless told not to. */
button, .btn, select, textarea, input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]) { -webkit-appearance: none; appearance: none; }
input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; }
textarea { height: auto; padding: 12px 14px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--text); }
input::placeholder { color: #6f6661; }
select { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
label.field { display: flex; flex-direction: column; gap: 7px; margin: 0 0 16px; }
label.field > .label { font-size: 10.5px; }
label.field small { color: var(--muted); font-size: 13px; }
label.check { display: flex; align-items: center; gap: 10px; font-size: 14.5px; margin: 0 0 12px; cursor: pointer; }
label.check input { width: 18px; height: 18px; flex: none; margin: 0; accent-color: var(--text); }
/* iPhone Safari: date fields ignore width:100% and center their value unless they drop the native look. */
input[type="datetime-local"] { -webkit-appearance: none; appearance: none; display: block; min-width: 0; text-align: left; }
input::-webkit-date-and-time-value { text-align: left; margin: 0; }
/* iPhone lays date fields out as flex inside; keeping that puts the date in the middle of the field, not at the top. */
@supports (-webkit-touch-callout: none) {
  input[type="datetime-local"] { display: flex; align-items: center; }
}

.badge { display: inline-block; font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; padding: 5px 9px; border-radius: 6px; border: 1.5px solid var(--text); color: var(--text); white-space: nowrap; line-height: 1.2; }
.tag { display: inline-block; font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; padding: 5px 9px; border-radius: 6px; white-space: nowrap; line-height: 1.2; border: 1.5px solid transparent; }
.tag.in { border-color: var(--text); color: var(--text); }
.tag.void { background: var(--void); color: var(--void-ink); }
.tag.ok { background: var(--ok); color: var(--ok-ink); }
.tag.dup { background: var(--dup); color: var(--dup-ink); }
.tag.warn { background: var(--warn); color: var(--warn-ink); }
.tag.stale { border-color: var(--warn); color: var(--warn); }
.tag.flag { border-color: var(--warn); color: var(--warn); }
.tag.muted { background: var(--field); color: var(--muted); }
.tag.draft { border: 1.5px dashed var(--muted); color: var(--muted); }
.tag.noqr { font-size: 11px; letter-spacing: .08em; text-transform: none; padding: 3px 7px; border: 1.5px dashed var(--muted); color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--ok); }
.dot.bad { background: var(--dup); }
.dot.idle { background: var(--muted); }
.dot.warn { background: var(--warn); }
.badge.sm { font-size: 10.5px; padding: 3px 7px; letter-spacing: .1em; }
.state { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; white-space: nowrap; }
.state .by { color: var(--muted); font-weight: 600; }
.state.muted { color: var(--muted); font-weight: 600; }
.meter { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--ok); border-radius: inherit; transition: width .9s var(--ease-out); }
.meter.big { height: 14px; border-radius: 7px; }

.error { color: #ff9b94; min-height: 1.2em; font-size: 14.5px; }
.ok-text { color: var(--ok); font-size: 14.5px; font-weight: 700; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: min(92vw, 440px); background: var(--field); border: 1.5px solid var(--line); padding: 12px 16px; border-radius: 12px; z-index: 80; font-weight: 700; font-size: 15px; line-height: 1.35; text-align: center; pointer-events: none; }
/* Door: above Find guest and More, so a tap never lands on the message. */
body.door .toast { bottom: calc(100px + env(safe-area-inset-bottom)); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 16px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@keyframes toast-out { to { opacity: 0; transform: translate(-50%, 10px) scale(.98); } }
.toast.enter { animation: toast-in .32s var(--ease-spring) both; }
.toast.leaving { animation: toast-out .2s ease both; }

@media (pointer: coarse) {
  button.sm, .btn.sm { height: 44px; }
  button.xs, .btn.xs { height: 40px; padding: 0 16px; }
  button.text-btn { padding: 12px 6px; margin: -12px -6px; }
  label.check { min-height: 44px; }
  label.check input { width: 22px; height: 22px; }
}

/* ---------------------------------------------------------------- door app (Claude Design v6) */
/* Fluid from 320 to 430 wide: type scales with the screen width, touch targets never shrink. */

body.door { overflow: hidden; height: 100%; }
.door-screen { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg); }
.d-col { flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 480px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 22px calc(30px + env(safe-area-inset-bottom)); min-height: 0; }
.d-title { font-size: clamp(23.12px, 6.98vw, 29.92px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.05; margin: 0; }
.d-sub { font-size: clamp(12.6px, 3.92vw, 17.1px); color: var(--muted); margin: 10px 0 0; line-height: 1.4; }
.d-label { font-family: var(--mono); font-size: clamp(12px, 3.23vw, 14.4px); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.d-label.bright { color: var(--text); }
.d-note { font-size: clamp(12px, 3.47vw, 15.3px); color: var(--muted); margin: 12px 0 0; line-height: 1.4; }
.d-error { color: #ff9b94; font-size: clamp(13.5px, 4.16vw, 16px); font-weight: 700; margin: 0 0 12px; }
.d-error:empty { display: none; }
.d-cta { height: 56px; flex: none; width: 100%; border-radius: var(--r); border: 0; background: var(--text); color: var(--bg); font-size: clamp(15.3px, 4.62vw, 19.8px); font-weight: 800; }
@media (hover: hover) { .d-cta:hover { background: #fff; color: var(--bg); } }
.grow-space { flex: 1; }

/* 01 door PIN */
.pin-logo { height: 22px; align-self: flex-start; margin-bottom: 34px; }
.pin-boxes { display: grid; grid-template-columns: repeat(var(--pin-len, 4), minmax(0, 1fr)); gap: 10px; margin: 28px 0 26px; }
.pin-box { height: clamp(52px, 8.5vh, 72px); height: clamp(52px, 8.5svh, 72px); border-radius: var(--r); border: 1.5px solid var(--line); display: flex; align-items: center; justify-content: center; }
.pin-box.filled { border-color: var(--text); }
.pin-box.filled::after { content: ''; width: 18px; height: 18px; border-radius: 50%; background: var(--text); }
.pin-boxes.shake { animation: shake .38s; }
@keyframes shake { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.keypad button { height: clamp(52px, 8.5vh, 72px); height: clamp(52px, 8.5svh, 72px); border-radius: var(--r); border: 0; background: var(--field); padding: 0; font-size: clamp(20.4px, 6.15vw, 26.4px); font-weight: 800; }
@media (hover: hover) { .keypad button:hover { color: var(--text); background: #2a2425; } }
.keypad button:active { background: var(--line); }
.keypad .key-back { color: var(--muted); }
.keypad .key-ico { width: clamp(24px, 7vw, 30px); height: auto; aspect-ratio: 1; stroke-width: 2; }

/* 02 event and door, and Pick another */
.setup-title { margin-bottom: 24px; }
.setup-col .d-label { margin-bottom: 10px; }
/* The two halves only matter sideways (see the landscape block); upright they're invisible wrappers. */
.pin-a, .setup-a, .setup-b { display: contents; }
/* PIN, event and door screens scroll when a short screen can't fit them, so Start is never out of reach. */
.door-screen > .d-col { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.setup-events, .pick-list { display: flex; flex-direction: column; gap: 10px; }
.pick-list { margin-top: 22px; }
.ev-card { width: 100%; height: auto; display: block; padding: 18px; border-radius: 14px; border: 1.5px solid var(--line); background: transparent; text-align: left; white-space: normal; font-weight: 400; }
@media (hover: hover) { .ev-card:hover { border-color: #4a4243; } }
.ev-card.on { border-color: var(--text); background: var(--panel); }
.ev-card .nm { font-size: clamp(17.68px, 5.34vw, 22.88px); font-weight: 800; line-height: 1.15; }
.ev-card .wh { font-size: clamp(12.6px, 3.92vw, 17.1px); color: var(--muted); margin-top: 4px; }
.ev-card .st { display: flex; gap: 18px; margin-top: 14px; font-size: clamp(12px, 3.69vw, 16.2px); font-weight: 700; }
.ev-card .st .m { color: var(--muted); }
.link-row { flex: none; height: 48px; padding: 0; margin: 0 0 20px; border: 0; background: none; justify-content: flex-start; color: var(--muted); font-size: clamp(12px, 3.69vw, 16.2px); font-weight: 700; }
@media (hover: hover) { .link-row:hover { color: var(--text); } }
.door-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
/* Door names come from the promoter: long ones wrap onto a second line, more than four sit a little tighter. */
.door-grid button { height: auto; min-height: 54px; padding: 6px 12px; border-radius: var(--r); border: 1.5px solid var(--line); font-size: clamp(14.4px, 4.38vw, 18.9px); font-weight: 800; line-height: 1.15; white-space: normal; overflow-wrap: anywhere; }
.door-grid.many button { min-height: 48px; font-size: clamp(13.6px, 4vw, 17px); }
.door-grid button.on { background: var(--text); color: var(--bg); border-color: var(--text); }
/* The phone's own name, under the door names: dashed until it has text, then it reads as the pick. 16px minimum so iPhones don't zoom in. */
.own-name { width: 100%; min-height: 54px; margin-top: 10px; padding: 0 16px; border-radius: var(--r); border: 1.5px dashed var(--line); background: transparent; color: var(--text); font: inherit; font-size: clamp(16px, 4.38vw, 18.9px); font-weight: 800; text-align: center; }
.own-name::placeholder { color: var(--muted); font-weight: 700; opacity: 1; }
.own-name:focus { outline: none; border-style: solid; border-color: var(--text); }
.own-name.on { border-style: solid; border-color: var(--text); background: var(--text); color: var(--bg); caret-color: var(--bg); }
.pick-col { padding-top: 20px; }

/* 03 scan */
#scan { background: radial-gradient(120% 80% at 50% 44%, #3a3532 0%, #1b1817 50%, #070606 100%); }
#video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-ui { position: relative; flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 520px; margin: 0 auto; padding: calc(8px + env(safe-area-inset-top)) 12px calc(24px + env(safe-area-inset-bottom)); min-height: 0; }
.count-card, .oval, .oval-btn, .more-btn { background: rgba(14, 12, 12, .86); border: 1.5px solid rgba(255, 255, 255, .14); }
.scan-top { display: flex; gap: 8px; align-items: stretch; }
.count-card { flex: 1; min-width: 0; border-radius: var(--r-lg); padding: 10px 16px; display: flex; flex-direction: column; justify-content: center; }
.cc-count { white-space: nowrap; line-height: 1; }
.cc-count .n { font-size: clamp(20.16px, 7.39vw, 32.26px); font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.cc-count .of { font-size: clamp(14.4px, 4.38vw, 18.9px); font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.net { display: flex; align-items: center; gap: 7px; margin-top: 6px; font-size: clamp(12px, 3.47vw, 15.3px); font-weight: 700; }
.net .ind { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); flex: none; box-sizing: border-box; }
.net.offline .ind { background: transparent; border: 2.5px solid var(--text); }
.net.error .ind { background: var(--dup); }
.net.loading .ind { background: var(--muted); }
.oval { width: 66px; height: auto; min-height: 54px; flex: none; padding: 0; border-radius: var(--r-lg); font-size: clamp(12px, 3.47vw, 15.3px); font-weight: 800; }
.oval.on { background: var(--text); color: var(--bg); }
.test-banner { border-radius: var(--r-lg); background: var(--text); color: var(--bg); padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.test-banner b { font-size: clamp(15.3px, 4.62vw, 19.8px); font-weight: 800; letter-spacing: .04em; }
.test-banner span { font-size: clamp(12px, 3.47vw, 15.3px); font-weight: 700; }
#scan.test-mode .scan-top { display: none; }

.scan-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; min-height: 0; }
.frame { position: relative; width: min(270px, 68vw, 36vh); width: min(270px, 68vw, 36svh); aspect-ratio: 1; flex: none; }
.frame i { position: absolute; width: 20%; height: 17.4%; border: 0 solid #fff; }
.frame i:nth-child(1) { left: 0; top: 0; border-left-width: 7px; border-top-width: 7px; border-top-left-radius: 22px; }
.frame i:nth-child(2) { right: 0; top: 0; border-right-width: 7px; border-top-width: 7px; border-top-right-radius: 22px; }
.frame i:nth-child(3) { left: 0; bottom: 0; border-left-width: 7px; border-bottom-width: 7px; border-bottom-left-radius: 22px; }
.frame i:nth-child(4) { right: 0; bottom: 0; border-right-width: 7px; border-bottom-width: 7px; border-bottom-right-radius: 22px; }
.scan-hint { font-size: clamp(13.5px, 4.16vw, 18px); font-weight: 700; text-shadow: 0 1px 8px #000; text-align: center; }
.pill { padding: 10px 16px; border-radius: 12px; background: rgba(10, 9, 9, .82); font-size: 16px; font-weight: 700; text-align: center; max-width: 340px; line-height: 1.35; }
#camera-msg { padding: 18px 20px; border-radius: 16px; border: 1.5px solid rgba(255, 255, 255, .14); }
#camera-msg p { margin: 0 0 14px; }
#camera-msg button { height: 46px; padding: 0 22px; }
.scanner-mode { text-align: center; max-width: 300px; }
.scanner-mode h2 { font-size: clamp(23.12px, 6.98vw, 29.92px); font-weight: 800; letter-spacing: -0.02em; margin-bottom: 10px; }
.scanner-mode p { color: var(--muted); font-size: clamp(14.4px, 4.38vw, 17px); }

/* Last check-in: a card like the counts card, same edges as Find guest and More below it. */
.last-admit { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 6px 6px 6px 14px; margin-bottom: 10px; border-radius: var(--r-lg); background: rgba(14, 12, 12, .86); border: 1.5px solid rgba(255, 255, 255, .14); }
.la-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); flex: none; }
.la-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; line-height: 1.2; }
.la-name { font-size: clamp(13.5px, 4.16vw, 17px); font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.la-meta { font-size: clamp(12px, 3.23vw, 14px); font-weight: 600; color: var(--muted); white-space: nowrap; }
.last-admit .oval-btn { height: 44px; padding: 0 16px; border-radius: var(--r); }
.oval-btn { height: 48px; padding: 0 18px; border-radius: var(--r-lg); font-size: clamp(12px, 3.69vw, 16.2px); font-weight: 800; flex: none; }
.scan-actions { display: grid; grid-template-columns: minmax(0, 1fr) 92px; gap: 8px; }
.find-btn { height: 66px; border-radius: var(--r-lg); border: 0; background: var(--text); color: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
@media (hover: hover) { .find-btn:hover { background: #fff; color: var(--bg); } }
.find-btn b { font-size: clamp(15.2px, 4.51vw, 19.2px); font-weight: 800; }
.find-btn span { font-size: clamp(12px, 3.23vw, 14.4px); font-weight: 600; opacity: .7; }
.more-btn { height: 66px; border-radius: var(--r-lg); font-size: clamp(13.5px, 4.16vw, 18px); font-weight: 800; }

/* 12 test mode */
#scan.testing .frame { width: min(160px, 40vw, 20vh); }
#scan.testing .frame i { width: 21%; height: 21%; }
#scan.testing .scan-hint, #scan.testing .last-admit, #scan.testing .scan-actions { display: none; }
.test-sheet { border-radius: 28px 28px 0 0; background: var(--panel); margin: 0 -12px calc(-24px - env(safe-area-inset-bottom)); padding: 22px 22px calc(30px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.qr-raw { font-family: var(--mono); font-size: clamp(12px, 3.69vw, 16.2px); font-weight: 700; background: var(--bg); border-radius: 12px; padding: 14px; word-break: break-all; }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 14px; min-height: 46px; border-bottom: 1px solid var(--line); }
.kv .k { font-family: var(--mono); font-size: clamp(12px, 3vw, 13.5px); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); flex: none; }
.kv .v { font-size: clamp(12.6px, 3.92vw, 17.1px); font-weight: 700; text-align: right; min-width: 0; text-wrap: balance; }
.kv .v.yes { font-size: clamp(15.2px, 4.51vw, 19.2px); font-weight: 800; }
.kv .tag { font-size: clamp(12px, 2.77vw, 12.6px); padding: 6px 9px; }
.two-btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 6px; }
.two-btns button { height: 50px; border-radius: var(--r); font-size: clamp(13.5px, 4.16vw, 18px); font-weight: 800; }
.two-btns button:not(.primary) { border-color: var(--line); }

/* 04–09 results */
.result { position: fixed; inset: 0; z-index: 40; display: flex; cursor: pointer; user-select: none; -webkit-user-select: none; }
.result.admitted { background: var(--ok); color: var(--ok-ink); --ink: var(--ok-ink); --paper: var(--ok); }
.result.duplicate { background: var(--dup); color: var(--dup-ink); --ink: var(--dup-ink); --paper: var(--dup); }
.result.void { background: var(--void); color: var(--void-ink); --ink: var(--void-ink); --paper: var(--void); }
.result.not_found { background: var(--warn); color: var(--warn-ink); --ink: var(--warn-ink); --paper: var(--warn); }
.r-col { flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 520px; margin: 0 auto; padding: env(safe-area-inset-top) 20px env(safe-area-inset-bottom); overflow: hidden; }
.r-top { height: 40px; flex: none; display: flex; align-items: center; justify-content: flex-end; }
.r-offline { font-size: clamp(12px, 3.47vw, 15.3px); font-weight: 800; letter-spacing: .08em; padding: 7px 12px; border-radius: 8px; background: var(--ink); color: var(--paper); }
.r-main { flex: 1; margin-top: 18px; min-height: 0; overflow: hidden; }
.r-glyph { width: clamp(56px, 16.4vw, 70px); height: auto; aspect-ratio: 1; border-radius: 50%; border: 6px solid var(--ink); display: flex; align-items: center; justify-content: center; font-size: clamp(21.17px, 7.75vw, 33.84px); font-weight: 800; line-height: 1; margin-bottom: 16px; }
.r-glyph.small { font-size: clamp(21.76px, 6.57vw, 28.16px); }
.r-word { font-size: clamp(47.38px, 17.35vw, 75.82px); font-weight: 900; line-height: .88; letter-spacing: -0.03em; text-transform: uppercase; }
.result.duplicate .r-word { font-size: clamp(32.26px, 11.82vw, 51.62px); }
.result.void .r-word { font-size: clamp(46.37px, 16.98vw, 74.16px); }
.result.not_found .r-word { font-size: clamp(43.34px, 15.88vw, 69.34px); }
.r-name { font-size: clamp(23.26px, 7.01vw, 30.1px); font-weight: 800; line-height: 1.05; letter-spacing: -0.015em; margin-top: 20px; overflow-wrap: anywhere; }
.r-line1 { font-size: clamp(15.2px, 4.51vw, 19.2px); font-weight: 800; line-height: 1.3; margin-top: 10px; overflow-wrap: anywhere; }
.result.not_found .r-line1 { margin-top: 20px; }
.r-line2 { font-size: clamp(14.4px, 4.38vw, 18.9px); font-weight: 600; line-height: 1.3; margin-top: 6px; overflow-wrap: anywhere; }
.r-badge-row { margin-top: 18px; }
.r-badge { display: inline-block; font-size: clamp(12px, 3.69vw, 16.2px); font-weight: 800; letter-spacing: .1em; text-transform: uppercase; padding: 8px 13px; border-radius: 8px; background: var(--ink); color: var(--paper); }
.r-actions { display: flex; gap: 10px; margin-bottom: 22px; flex: none; }
.r-btn { height: 56px; flex: 1; border-radius: 12px; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); font-size: clamp(15.3px, 4.62vw, 19.8px); font-weight: 800; }
@media (hover: hover) { .r-btn:hover { color: var(--ink); border-color: var(--ink); } }
.r-btn.fill { flex: 2; background: var(--ink); color: var(--paper); }
@media (hover: hover) { .r-btn.fill:hover { color: var(--paper); } }
.r-track { height: 4px; margin: 0 -20px 20px; position: relative; flex: none; }
.r-track::before { content: ''; position: absolute; inset: 0; background: var(--ink); opacity: .2; }
.r-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; background: var(--ink); }
@media (max-height: 640px) {
  .r-glyph { display: none; }
  .r-main { margin-top: 6px; }
}


/* 10 find guest, 11 more, pick another: full-screen pages */
.page { z-index: 30; }
.page-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; max-width: 520px; margin: 0 auto; padding: calc(6px + env(safe-area-inset-top)) 20px 0; flex: none; }
.back { height: 48px; padding: 0 22px 0 18px; border-radius: var(--r); background: var(--field); border: 0; font-size: clamp(13.5px, 4.16vw, 18px); font-weight: 800; gap: 8px; }
.back .ico { width: 1.1em; height: 1.1em; }
.page-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; width: 100%; max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; }
.searchbox { width: calc(100% - 40px); max-width: 480px; margin: 14px auto 0; height: 53px; border-radius: var(--r); background: var(--field); border: 1.5px solid var(--text); display: flex; align-items: center; padding: 0 2px 0 18px; gap: 6px; flex: none; }
.searchbox input { flex: 1; min-width: 0; background: transparent; border: 0; height: 100%; padding: 0; font-size: clamp(16px, 4.51vw, 19.2px); font-weight: 700; }
.searchbox input:focus { outline: none; }
.searchbox .clear { width: 48px; height: 48px; padding: 0; border-radius: 50%; background: var(--line); border: 0; font-size: clamp(12.6px, 3.92vw, 17.1px); font-weight: 800; flex: none; }
.searchbox .clear .ico { width: 18px; height: 18px; stroke-width: 2.6; }
.search-hint { width: 100%; max-width: 520px; margin: 0 auto; padding: 10px 20px 0; font-size: clamp(12px, 3.47vw, 15.3px); color: var(--muted); }
.count-line { width: 100%; max-width: 520px; margin: 0 auto; padding: 16px 20px 8px; display: flex; justify-content: space-between; gap: 10px; flex: none; }
.guests { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.guests li { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 6px 20px; border-bottom: 1px solid var(--line); }
.guests .who { flex: 1; min-width: 0; }
.guests .nm { font-size: clamp(15.3px, 4.62vw, 19.8px); font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.guests .nm .tag.noqr { margin-left: 8px; vertical-align: 2px; }
.guests .meta { font-size: clamp(12px, 3.23vw, 14.4px); color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.guests .admit { height: 48px; padding: 0 20px; border-radius: var(--r); font-size: clamp(13.5px, 4.16vw, 18px); flex: none; }
.guests .in-tag, .guests .void-tag { font-family: var(--mono); font-size: clamp(12px, 3vw, 13.5px); font-weight: 700; letter-spacing: .06em; padding: 8px 10px; border-radius: 8px; white-space: nowrap; flex: none; }
.guests .in-tag { border: 1.5px solid var(--text); }
.guests .void-tag { letter-spacing: .12em; background: var(--void); color: #fff; }
.empty { padding: 20px; color: var(--muted); font-size: clamp(14.4px, 4.38vw, 17px); line-height: 1.45; }
.empty p { margin: 0 0 14px; }
.empty.small { padding: 14px 0; font-size: 15px; }
.check-code { height: 52px; border-radius: var(--r); font-family: var(--mono); font-size: 15px; letter-spacing: .04em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

.more-col { padding-top: 16px; gap: 10px; }
.more-event { padding: 2px 2px 12px; }
.more-event .nm { font-size: clamp(19px, 5.8vw, 24px); font-weight: 800; letter-spacing: -0.01em; line-height: 1.15; overflow-wrap: anywhere; }
.more-event .wh { font-size: clamp(12.6px, 3.92vw, 17.1px); color: var(--muted); margin-top: 5px; line-height: 1.4; }
.sync-card { border-radius: 14px; background: var(--panel); padding: 16px 18px; display: flex; align-items: center; gap: 14px; }
.sync-card .grow { flex: 1; min-width: 0; }
.sync-card .t { font-size: clamp(13.5px, 4.16vw, 18px); font-weight: 800; }
.sync-card .s { font-size: clamp(12px, 3.47vw, 15.3px); color: var(--muted); margin-top: 3px; }
.sync-card button { height: 48px; padding: 0 18px; border-radius: var(--r); font-size: clamp(12.6px, 3.92vw, 17.1px); flex: none; }
.more-head { margin-top: 10px; }
/* Door scan history (#recent only: the admin has its own scans table). Tags end on one edge, Undo has a fixed slot. */
#recent .item { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 8px 0; border-bottom: 1px solid var(--line); }
#recent .who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
#recent .nm { font-size: clamp(13.5px, 4.16vw, 18px); font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
#recent .time { font-family: var(--mono); font-size: clamp(12px, 3.23vw, 14.4px); color: var(--muted); }
#recent .tag { font-size: clamp(12px, 2.54vw, 12.5px); padding: 6px 8px; letter-spacing: .08em; border-radius: 6px; flex: none; }
#recent .undo, #recent .undo-space { width: 68px; flex: none; }
#recent .undo { height: 44px; padding: 0; border-radius: 12px; border: 1.5px solid var(--text); font-size: clamp(12px, 3.69vw, 16.2px); }
.toggle-row { display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 2px 0; border-bottom: 1px solid var(--line); position: relative; cursor: pointer; }
.toggle-row .grow { flex: 1; }
.toggle-row .t { font-size: clamp(13.5px, 4.16vw, 18px); font-weight: 800; }
.toggle-row .s { font-size: clamp(12px, 3.35vw, 14.85px); color: var(--muted); margin-top: 2px; }
.toggle-row input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.switch { width: 88px; height: 48px; border-radius: 14px; flex: none; display: flex; align-items: center; justify-content: flex-start; padding: 4px; border: 1.5px solid var(--line); box-sizing: border-box; transition: background-color .22s ease, border-color .22s ease; }
.switch span { width: 56px; height: 38px; border-radius: 10px; transition: transform .3s var(--ease-spring), background-color .22s ease, color .22s ease; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: clamp(12px, 3vw, 13.5px); font-weight: 700; letter-spacing: .08em; background: var(--field); color: var(--muted); }
.switch span::after { content: 'OFF'; }
.toggle-row input:checked + .grow + .switch { background: var(--text); border-color: var(--text); }
.toggle-row input:checked + .grow + .switch span { transform: translateX(21px); }
.toggle-row input:checked + .grow + .switch span { background: var(--bg); color: var(--text); }
.toggle-row input:checked + .grow + .switch span::after { content: 'ON'; }
.toggle-row input:focus-visible + .grow + .switch { outline: 2px solid var(--text); outline-offset: 2px; }
.signout { height: 50px; width: 100%; flex: none; border-radius: var(--r); border: 1.5px solid var(--line); font-size: clamp(13.5px, 4.16vw, 18px); margin-top: 18px; }

/* confirm sheet */
.d-ask { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .62); display: flex; align-items: flex-end; justify-content: center; }
.d-ask-sheet { width: 100%; max-width: 520px; background: var(--panel); border-radius: 24px 24px 0 0; padding: 28px 22px calc(26px + env(safe-area-inset-bottom)); }
.d-ask .d-title { font-size: clamp(20.4px, 6.15vw, 26.4px); }
.d-ask .two-btns { margin-top: 24px; }

/* Motion: answers to what the person did, quick enough to never slow the door. */
@keyframes d-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes d-sheet { from { opacity: .4; transform: translateY(36px); } to { opacity: 1; transform: none; } }
@keyframes d-pop { 0% { opacity: 0; transform: scale(.5); } 60% { opacity: 1; transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes d-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes d-dot { from { transform: scale(0); } to { transform: scale(1); } }
.door-screen:not(.page).enter > .d-col, .door-screen:not(.page).enter > .scan-ui { animation: d-in .3s cubic-bezier(.2, .8, .2, 1) both; }
.page.enter { animation: d-sheet .32s cubic-bezier(.2, .8, .2, 1) both; }
.result.enter .r-glyph { animation: d-pop .34s cubic-bezier(.2, .8, .2, 1) both; }
.result.enter .r-word, .result.enter .r-name, .result.enter .r-line1, .result.enter .r-line2, .result.enter .r-badge-row, .result.enter .r-actions { animation: d-rise .24s cubic-bezier(.2, .8, .2, 1) both; }
.result.enter .r-name { animation-delay: .03s; }
.result.enter .r-line1, .result.enter .r-line2 { animation-delay: .05s; }
.result.enter .r-badge-row, .result.enter .r-actions { animation-delay: .07s; }
.pin-box.filled::after { animation: d-dot .16s cubic-bezier(.2, .8, .2, 1); }
.keypad button:active { background: var(--line); transform: scale(.94); }
.ev-card:active, .door-grid button:active { transform: scale(.98); }
.test-sheet:not([hidden]) { animation: d-sheet .3s cubic-bezier(.2, .8, .2, 1) both; }
.d-ask:not([hidden]) { animation: a-fade .2s ease both; }
.d-ask:not([hidden]) .d-ask-sheet { animation: d-sheet .3s cubic-bezier(.2, .8, .2, 1) both; }
.last-admit:not([hidden]) { animation: d-in .3s cubic-bezier(.2, .8, .2, 1) both; }

/* Screens move the way you're going: the next step comes in from the right, going back from the left,
   and the scanner opens like a camera. */
@keyframes d-fwd { from { opacity: 0; transform: translateX(36px); } to { opacity: 1; transform: none; } }
@keyframes d-back { from { opacity: 0; transform: translateX(-36px); } to { opacity: 1; transform: none; } }
@keyframes d-open { from { opacity: 0; transform: scale(1.05); } to { opacity: 1; transform: none; } }
.door-screen:not(.page).enter.go-fwd > .d-col { animation: d-fwd .34s var(--ease-out) both; }
.door-screen:not(.page).enter.go-back > .d-col { animation: d-back .34s var(--ease-out) both; }
#scan.enter.go-open > .scan-ui { animation: d-open .42s var(--ease-out) both; }
#video { opacity: 0; transition: opacity .45s ease; }
#video.live { opacity: 1; }
/* The right PIN: the dots go green for a beat before the next step. */
@keyframes d-ok { 0% { transform: scale(1); } 45% { transform: scale(1.35); } 100% { transform: scale(1); } }
.pin-boxes.ok .pin-box { border-color: var(--ok); transition: border-color .12s ease; }
.pin-boxes.ok .pin-box.filled::after { background: var(--ok); animation: d-ok .26s var(--ease-out); }
/* A result's color spreads from where it came from: the scan frame, or the button just tapped.
   The check and the cross draw themselves in. */
@keyframes d-flood { from { clip-path: circle(0 at var(--fx, 50%) var(--fy, 45%)); } to { clip-path: circle(150vmax at var(--fx, 50%) var(--fy, 45%)); } }
.result.enter { animation: d-flood .3s cubic-bezier(.3, .7, .2, 1) backwards; }
.r-glyph svg { width: 62%; height: 62%; overflow: visible; }
.r-glyph svg path { fill: none; stroke: currentColor; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
@keyframes d-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.result.enter .r-glyph svg path { animation: d-draw .3s .12s cubic-bezier(.6, 0, .25, 1) backwards; }
/* Last check-in: a new name swaps in, Undo slides the card away. The count steps down too. */
@keyframes d-swap { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.la-text.swap { animation: d-swap .28s var(--ease-out); }
@keyframes d-la-out { to { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes d-tick-down { 0% { transform: none; } 35% { transform: translateY(3px) scale(.9); color: var(--warn); } 100% { transform: none; } }
.cc-count .n.tick-down { animation: d-tick-down .45s var(--ease-out); }
.net.loading .ind { animation: live-pulse 1.1s ease-in-out infinite; }

/* Leaving: pages drop away, results fade, so nothing just blinks out. Nothing that's leaving takes taps. */
@keyframes d-sheet-out { to { opacity: 0; transform: translateY(44px); } }
@keyframes d-fade-out { to { opacity: 0; } }
.page.leaving { animation: d-sheet-out .22s var(--ease-in) both; pointer-events: none; }
.result.leaving { animation: d-fade-out .16s ease both; pointer-events: none; }
.d-ask.leaving { animation: d-fade-out .2s ease both; pointer-events: none; }
.d-ask.leaving .d-ask-sheet { animation: d-sheet-out .2s var(--ease-in) both; }
.test-sheet.leaving { animation: d-sheet-out .2s var(--ease-in) both; }
.last-admit.leaving { animation: d-la-out .2s var(--ease-in) both; pointer-events: none; }
/* The count ticks up when someone gets in. */
@keyframes d-tick { 0% { transform: none; } 35% { transform: translateY(-3px) scale(1.12); color: var(--ok); } 100% { transform: none; } }
.cc-count .n { display: inline-block; transform-origin: 50% 80%; }
.cc-count .n.tick { animation: d-tick .5s var(--ease-out); }
/* The frame breathes while the camera is live, so staff can tell it's working. */
@keyframes d-breathe { 0%, 100% { transform: none; } 50% { transform: translate(calc(var(--dx) * 5px), calc(var(--dy) * 5px)); } }
.frame i { animation: d-breathe 2.8s ease-in-out infinite; }
.frame i:nth-child(1) { --dx: 1; --dy: 1; }
.frame i:nth-child(2) { --dx: -1; --dy: 1; }
.frame i:nth-child(3) { --dx: 1; --dy: -1; }
.frame i:nth-child(4) { --dx: -1; --dy: -1; }
#scan.testing .frame i { animation: none; }
/* Search results and history rows settle in when a page opens. */
@keyframes d-row { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.d-rows-in > * { animation: d-row .3s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 22ms); }

@media (prefers-reduced-motion: reduce) {
  .pin-boxes.shake, .frame i { animation: none; }
  .r-fill { transition: none !important; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  button:active:not(:disabled), .btn:active, .keypad button:active { transform: none; }
}

/* Phone on its side. The installed app stays upright, but a browser tab turns:
   two columns everywhere, nothing below the fold, type sized by height. */
@media (orientation: landscape) and (max-height: 520px) {
  .door-screen > .d-col { max-width: 820px; padding: calc(12px + env(safe-area-inset-top)) max(28px, env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) max(28px, env(safe-area-inset-left)); }
  .d-title { font-size: clamp(21px, 6.4svh, 28px); }
  /* 01 PIN: title and boxes left, keypad right */
  .pin-col { flex-direction: row; align-items: center; gap: 44px; }
  .pin-a { display: block; flex: 1; min-width: 0; }
  .pin-col > .grow-space { display: none; }
  .pin-logo { margin-bottom: 18px; }
  .pin-boxes { margin: 20px 0 12px; }
  .pin-box { height: clamp(44px, 13svh, 60px); }
  .pin-col > .keypad { flex: 1; min-width: 0; gap: 8px; }
  .keypad button { height: clamp(44px, 18svh, 64px); }
  /* 02 event left, door and Start right */
  .setup-col { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); grid-template-rows: auto 1fr; column-gap: 32px; }
  .setup-title { grid-column: 1 / -1; margin-bottom: 14px; }
  .setup-a, .setup-b { display: flex; flex-direction: column; min-width: 0; }
  .setup-a .link-row { margin-bottom: 0; }
  .setup-b .grow-space { min-height: 14px; }
  .door-grid button, .own-name { min-height: 48px; }
  /* 03 scan: the camera fills the left, counts and buttons stack on the right */
  .scan-ui { max-width: none; display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 300px); grid-template-rows: auto auto 1fr auto auto; column-gap: 16px; padding: calc(10px + env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); }
  .scan-center { grid-column: 1; grid-row: 1 / -1; gap: 12px; }
  .scan-top, .test-banner { grid-column: 2; grid-row: 1; }
  .last-admit { grid-column: 2; grid-row: 4; margin: 8px 0; }
  .scan-actions { grid-column: 2; grid-row: 5; grid-template-columns: minmax(0, 1fr) 84px; }
  .find-btn, .more-btn { height: 58px; }
  .frame { width: min(230px, 56svh); }
  #scan.testing .frame { width: min(150px, 34svh); }
  .test-sheet { grid-column: 2; grid-row: 1 / -1; margin: 0; border-radius: 20px; padding: 16px 18px; gap: 8px; overflow-y: auto; min-height: 0; }
  .kv { min-height: 38px; }
  /* 04–09 results: smaller words, so name and buttons always fit */
  .r-col { max-width: 760px; padding-left: max(28px, env(safe-area-inset-left)); padding-right: max(28px, env(safe-area-inset-right)); }
  .r-top { height: 30px; }
  .r-word { font-size: clamp(30px, 14svh, 60px); }
  .result.duplicate .r-word { font-size: clamp(26px, 10.5svh, 44px); }
  .result.void .r-word, .result.not_found .r-word { font-size: clamp(28px, 12.5svh, 54px); }
  .r-name { font-size: clamp(19px, 6.4svh, 27px); margin-top: 10px; }
  .r-line1 { font-size: clamp(14px, 4.2svh, 18px); margin-top: 6px; }
  .r-line2 { font-size: clamp(13px, 3.9svh, 17px); margin-top: 4px; }
  .r-badge-row { margin-top: 10px; }
  .r-actions { margin-bottom: 12px; }
  .r-btn { height: 48px; }
  .r-track { margin-bottom: 10px; }
  /* sheets and pages: a bit wider, still centered */
  .d-ask-sheet { max-width: 560px; padding-top: 20px; }
}

/* ---------------------------------------------------------------- admin */

body.admin { background: var(--bg); overflow-wrap: break-word; }
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { border-right: 1px solid var(--line); padding: 26px 18px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; }
.side .logo { height: 18px; margin: 0 12px 26px; align-self: flex-start; }
.nav { height: 42px; border-radius: 10px; padding: 0 12px; display: flex; align-items: center; font-size: 15px; font-weight: 600; color: var(--muted); text-decoration: none; }
@media (hover: hover) { .nav:hover { color: var(--text); } }
.nav.active { background: var(--field); color: var(--text); font-weight: 800; }
.side .me { padding: 12px; border-top: 1px solid var(--line); margin-top: auto; }
.side .me .n { font-size: 14px; font-weight: 700; }
.side .me button { margin-top: 6px; }
.main { padding: 34px 44px 48px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px 24px; margin-bottom: 26px; flex-wrap: wrap; }
.ph-text { min-width: 0; }
.crumb { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; font-weight: 700; color: var(--muted); margin-bottom: 10px; }
.crumb a { color: var(--muted); text-decoration: none; }
@media (hover: hover) { .crumb a:hover { color: var(--text); } }
.crumb .sep { color: var(--line-2); font-weight: 400; }
.ph-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; font-size: 15px; color: var(--muted); }
.page-head h1 { font-family: var(--display); font-size: 34px; font-weight: 900; letter-spacing: -0.02em; line-height: 1.05; }
.head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pin-chip { height: 42px; padding: 0 14px; border-radius: 10px; background: var(--field); display: flex; align-items: center; gap: 10px; }
.pin-chip b { font-family: var(--mono); font-size: 17px; font-weight: 700; letter-spacing: .2em; }

/* check-in tally: the same "51 in / 203" the door phones show */
.tally { border: 1.5px solid var(--line); border-radius: var(--r-lg); padding: 24px 28px 22px; margin-bottom: 22px; }
.tally-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.tally-count { white-space: nowrap; line-height: .9; }
.tally-count b { font-family: var(--display); font-size: 80px; font-weight: 900; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.tally-count .in { font-family: var(--display); font-size: 36px; font-weight: 900; letter-spacing: -0.02em; }
.tally-count .of { font-size: 30px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.tally-pct { font-size: 15px; font-weight: 700; color: var(--muted); padding-bottom: 6px; }
.tally-pct b { font-family: var(--mono); color: var(--text); font-size: 17px; }
.tally .meter { margin: 18px 0 16px; }
.tally-facts { display: flex; flex-wrap: wrap; gap: 8px 28px; font-size: 14.5px; color: var(--muted); }
.tally-facts b { color: var(--text); font-weight: 800; font-variant-numeric: tabular-nums; }

/* Ready for doors: one row per step. A mark on the left (its number, a check, or ! when it needs a hand),
   the words, and the one button that moves it on. Lists that need a hand sit under their step. */
.ready-count { font-size: 14px; font-weight: 700; color: var(--muted); white-space: nowrap; }
/* All done: the checklist shrinks to one line. */
.ready-list.ready-done { margin-bottom: 30px; }
.ready-done .rs { padding-top: 14px; padding-bottom: 14px; }
.ready-list { list-style: none; margin: 0 0 36px; padding: 0; border: 1.5px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.rs { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; grid-template-areas: "mark text act" ". fixes fixes"; column-gap: 16px; align-items: start; padding: 18px 20px; border-top: 1px solid var(--line); }
.rs:first-child { border-top: 0; }
.rs-mark { grid-area: mark; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--muted); color: var(--text); display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 13px; font-weight: 700; line-height: 1; }
.rs.todo .rs-mark { border-color: var(--text); }
.rs.done .rs-mark { background: var(--ok); border-color: var(--ok); color: var(--ok-ink); }
.rs.done .rs-mark .ico { width: 16px; height: 16px; stroke-width: 3.2; }
.rs.warn .rs-mark { background: var(--warn); border-color: var(--warn); color: var(--warn-ink); font-family: var(--font); font-size: 17px; font-weight: 900; }
/* The title's first line sits level with the middle of the mark. */
.rs-text { grid-area: text; display: flex; flex-direction: column; gap: 3px; min-width: 0; padding-top: 4px; }
.rs-text strong { font-size: 16px; font-weight: 800; line-height: 1.35; overflow-wrap: anywhere; }
.rs-sub { font-size: 14px; line-height: 1.45; color: var(--muted); }
.rs-act { grid-area: act; align-self: center; display: flex; }
.rs-fixes { grid-area: fixes; list-style: none; margin: 14px 0 -6px; padding: 0; }
.rs-fixes li, .flag-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 14px; align-items: center; font-size: 14.5px; line-height: 1.45; }
.rs-fixes li { padding: 12px 0; border-top: 1px solid var(--line); }
.rs-fixes li > .badge, .flag-list li > .tag { justify-self: start; }
.fx-text { min-width: 0; overflow-wrap: anywhere; }
/* Wide screens: the fixes share columns, so every message starts at the same edge whatever the tag's width. */
@supports (grid-template-columns: subgrid) {
  @media (min-width: 600px) {
    .rs-fixes { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content; column-gap: 14px; }
    .rs-fixes li { grid-column: 1 / -1; grid-template-columns: subgrid; }
  }
}
/* Something at the door needs a look: right under the count. */
.flag-list { list-style: none; margin: -6px 0 26px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.flag-list li { padding: 12px 14px 12px 16px; border: 1.5px solid var(--warn); border-radius: var(--r); }
.downloads { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 40px; }
.alert { border: 2px solid var(--warn); border-radius: 12px; padding: 16px 20px; display: flex; gap: 18px; align-items: flex-start; margin-bottom: 30px; font-size: 15px; line-height: 1.5; }
.alert.info { border-color: var(--line); }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-head h2 { font-size: 20px; font-weight: 900; }
.src-list { border: 1.5px solid var(--line); border-radius: var(--r-lg); margin-bottom: 40px; overflow: hidden; }
.src-row { border-top: 1px solid var(--line); transition: background-color .2s ease; }
.src-row:first-child { border-top: 0; }
.src-row.failed { background: rgba(224, 49, 43, .07); }
/* Fixed columns for the counts: numbers, bars and arrows line up from row to row. */
.src-open { width: 100%; min-width: 0; height: auto; display: grid; grid-template-columns: minmax(0, 1fr) 13.5rem 18px; grid-template-areas: "id nums chev"; align-items: center; justify-content: stretch; gap: 20px; padding: 16px 20px; border: 0; border-radius: 0; background: none; text-align: left; white-space: normal; font-weight: 400; color: var(--text); }
.src-open:active:not(:disabled) { transform: none; }
@media (hover: hover) { .src-row:hover { background: rgba(255, 255, 255, .025); } .src-row.failed:hover { background: rgba(224, 49, 43, .1); } }
.src-open:focus-visible { outline-offset: -2px; }
.src-id { grid-area: id; display: flex; flex-direction: column; align-items: flex-start; gap: 7px; min-width: 0; }
.src-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; max-width: 100%; }
.src-title .badge { flex: none; }
.src-title strong { min-width: 0; font-size: 15px; font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; }
.src-state { display: flex; align-items: center; gap: 7px; font-size: 13px; line-height: 1.35; color: var(--muted); max-width: 100%; }
.src-state .dot { flex: none; }
.src-row.failed .src-state { color: #ff9b94; font-weight: 700; }
.src-nums { grid-area: nums; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 16px; font-size: 13.5px; color: var(--muted); }
.src-nums b { font-family: var(--display); font-size: 21px; font-weight: 900; letter-spacing: -0.02em; color: var(--text); margin-right: 5px; font-variant-numeric: tabular-nums; }
.src-nums .zero b { color: var(--muted); }
.src-nums .meter { flex-basis: 100%; height: 4px; margin-top: 8px; }
.src-open .chev { grid-area: chev; }
.chev { display: flex; font-size: 20px; color: var(--muted); justify-self: end; transition: transform .22s var(--ease-out), color .2s ease; }
@media (hover: hover) { .src-row:hover .chev { transform: translateX(3px); color: var(--text); } }
/* the source sheet */
.src-sheet-state { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; font-size: 15px; font-weight: 700; }
.src-sheet-state .muted { font-weight: 500; }
.src-sheet-state.bad { color: #ff9b94; }
.src-nums.big { margin: 6px 0 24px; }
.src-nums.big b { font-size: 30px; }
.src-nums.big .meter { height: 6px; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.sheet-danger { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.sheet-danger p { flex: 1 1 240px; margin: 0; font-size: 14px; line-height: 1.45; color: var(--muted); }
.callout .lead { margin: 0 0 6px; font-weight: 700; }
.callout .detail { margin: 0; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; }

/* events list */
.ev-list { margin-top: -6px; }
.ev-row { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.2fr) 116px minmax(0, 1.2fr) minmax(0, 1.3fr); gap: 0 22px; align-items: center; padding: 16px 14px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
@media (hover: hover) { a.ev-row:hover { background: rgba(255, 255, 255, .025); color: var(--text); } }
a.ev-row:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; }
.ev-row.ev-head { padding-top: 0; padding-bottom: 12px; }
.ev-row.live { box-shadow: inset 3px 0 0 var(--ok); }
.ev-row .sub { display: block; color: var(--muted); font-size: 13.5px; margin-top: 4px; font-weight: 500; }
.ev-name strong { font-size: 17px; font-weight: 800; }
.ev-row.past .ev-name strong { color: #cfc6bf; }
.ev-when { font-size: 14.5px; }
.ev-count { font-family: var(--mono); font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.ev-count b { color: var(--text); font-size: 15px; }
.ev-in .meter { margin-top: 8px; max-width: 180px; }
.ev-src { font-size: 14px; }
.empty-card p { margin: 0 0 16px; }
.verdict { display: flex; gap: 16px; align-items: flex-start; padding: 16px 18px; border: 1.5px solid var(--line); border-radius: var(--r); margin-bottom: 10px; max-width: 760px; }
.verdict .tag { flex: none; margin-top: 2px; }
.verdict strong { font-size: 17px; font-weight: 800; }
.verdict .sub { display: block; color: var(--muted); margin-top: 4px; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.tab-intro { max-width: 70ch; }
.empty-card { border: 1.5px dashed var(--line); border-radius: var(--r-lg); padding: 22px; color: var(--muted); font-size: 15px; line-height: 1.5; }

.ev-top { display: block; margin-bottom: 20px; }
.ph-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; min-height: 36px; }
.ph-bar .crumb { margin: 0; }
.ev-tabs { position: sticky; top: 0; z-index: 20; display: flex; gap: 32px; margin: 0 0 26px; border-bottom: 1px solid var(--line); background: var(--bg); overflow-x: auto; scrollbar-width: none; }
.ev-tabs::-webkit-scrollbar { display: none; }
.ev-tabs a { flex: none; padding: 14px 0 13px; font-size: 15.5px; font-weight: 700; color: var(--muted); text-decoration: none; transition: color .2s ease; -webkit-user-select: none; user-select: none; }
.ev-tabs a.active { color: var(--text); }
@media (hover: hover) { .ev-tabs a:hover { color: var(--text); } }
.ev-tabs a:focus-visible { outline: 2px solid var(--text); outline-offset: -4px; border-radius: 6px; }
.ev-tabs .ink { position: absolute; left: 0; bottom: 0; width: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--text); pointer-events: none; transition: transform .36s var(--ease-out), width .36s var(--ease-out); }
.ev-tabs.no-anim .ink { transition: none; }
.tabs-mark { height: 0; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; font-size: 14px; }
.empty-line { margin-top: 6px; }
.tally-facts .fact-link { color: var(--muted); text-decoration: none; border-bottom: 1px dashed var(--line-2); }
.tally-facts .fact-link b { color: var(--text); font-weight: 800; }
@media (hover: hover) { .tally-facts .fact-link:hover { color: var(--text); border-bottom-color: var(--muted); } }
.ev-group { padding: 26px 14px 10px; border-bottom: 1px solid var(--line); }
.ev-row.ev-head + .ev-group { padding-top: 14px; }
/* Door tab */
.door-card { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 20px 32px; padding: 22px 24px; border: 1.5px solid var(--line); border-radius: var(--r-lg); }
.door-card.weak { border-color: var(--warn); }
.door-card-main { flex: 1 1 320px; min-width: 0; }
.door-card p { margin: 0; max-width: 58ch; font-size: 14.5px; line-height: 1.5; }
.pin-big { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 14px; }
.pin-big span { width: 56px; height: 68px; display: flex; align-items: center; justify-content: center; border-radius: var(--r); background: var(--field); font-family: var(--mono); font-size: 34px; font-weight: 700; }
.warn-line { color: var(--warn); font-weight: 700; margin: 0 0 8px; font-size: 14.5px; }
.door-card .warn-line { margin-bottom: 8px; }
.door-card-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.offscreen { position: fixed; left: -9999px; top: 0; opacity: 0; }
.toolbar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar-row .search { flex: 1; max-width: 440px; min-width: 220px; height: 44px; }
.seg { display: flex; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; flex-wrap: wrap; }
.seg button { height: 41px; border: 0; border-radius: 0; border-right: 1.5px solid var(--line); padding: 0 14px; font-size: 13.5px; font-weight: 700; background: none; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--text); color: var(--bg); }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; padding: 0 14px 12px; font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 14.5px; vertical-align: middle; }
table.data th:first-child, table.data td:first-child { padding-left: 0; }
table.data th:last-child, table.data td:last-child { padding-right: 0; }
table.data td.guest .tag.noqr { margin-left: 8px; vertical-align: 1px; }
table.data.scans td .sub { margin-top: 2px; }
table.data.scans td.t, table.data.scans td.door { white-space: nowrap; }
table.data td.r, table.data th.r { text-align: right; }
table.data td .sub { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; }
table.data td.email { font-family: var(--mono); font-size: 13px; color: var(--muted); }
table.data td.num { font-family: var(--mono); font-weight: 700; }
table.data tr.click { cursor: pointer; }
@media (hover: hover) { table.data tr.click:hover td { background: rgba(255, 255, 255, .02); } }
table.data .ev-name { font-size: 16px; font-weight: 800; text-decoration: none; }
table.data td .tag + .tag { margin-left: 6px; }
table.data td.st .tag.flag { margin-left: 10px; }
table.data.tickets td.act button { min-width: 78px; }
.more-note { color: var(--muted); font-size: 14px; margin-top: 14px; }
.show-sm { display: none !important; }

/* add source + upload pages */
.step { display: grid; grid-template-columns: 44px 1fr; gap: 0 18px; margin-bottom: 34px; }
.step-n { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--text); display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 14px; font-weight: 700; }
.step h2 { font-size: 20px; font-weight: 900; margin: 5px 0 16px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.pick { min-height: 74px; height: auto; min-width: 0; border-radius: 12px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 6px; padding: 12px 18px; border: 1.5px solid var(--line); background: none; font-size: 17px; font-weight: 800; white-space: normal; text-align: left; }
.pick .label.done { color: var(--ok); display: inline-flex; align-items: center; gap: 4px; }
.pick .label.done .ico { width: 12px; height: 12px; stroke-width: 3; }
.pick.kind { height: auto; display: block; padding: 18px; }
.pick.kind .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pick.kind .d { font-size: 14px; color: var(--muted); margin-top: 8px; line-height: 1.45; font-weight: 400; }
.pick.on { border: 2px solid var(--text); background: var(--panel); }
.pick .label { font-size: 10.5px; }
.pick.on .label { color: var(--text); }
.howto { display: flex; flex-direction: column; gap: 12px; margin: 0 0 22px; padding: 0; list-style: none; counter-reset: how; }
.howto li { display: flex; gap: 14px; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.howto li::before { counter-increment: how; content: counter(how); font-family: var(--mono); font-weight: 700; color: var(--muted); width: 16px; flex: none; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid.three { grid-template-columns: 1fr 1fr 1fr; }
.connect-result { display: flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 700; margin-top: 14px; }
.connect-result .ok { width: 22px; height: 22px; border-radius: 50%; background: var(--ok); color: var(--ok-ink); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.connect-result .ok .ico { width: 14px; height: 14px; stroke-width: 3.2; }
.file-chip { height: 42px; padding: 0 14px; border-radius: 10px; background: var(--field); display: flex; align-items: center; gap: 12px; max-width: 100%; }
.file-chip .f { font-family: var(--mono); font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone { border: 2px dashed var(--line); border-radius: 14px; padding: 34px 24px; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.dropzone.over { border-color: var(--text); background: var(--panel); }
.dropzone input { display: none; }
.dropzone + .error:empty { display: none; }
@media (pointer: coarse) { .dropzone .drop-text { display: none; } } /* nothing to drag on a phone */
table.map td:first-child, table.map th:first-child { padding-left: 0; width: 22%; }
table.map td:nth-child(2) { width: 40%; }
table.map select { height: 42px; border-radius: 9px; font-weight: 700; font-size: 16px; }
table.map select.none { border-color: var(--warn); color: var(--warn); }
table.map td.sample { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.radio-card { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: 12px; border: 1.5px solid var(--line); cursor: pointer; margin-bottom: 10px; position: relative; }
.radio-card input { position: absolute; opacity: 0; }
.radio-card .ring { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--text); display: flex; align-items: center; justify-content: center; flex: none; margin-top: 2px; }
.radio-card .t { font-size: 16px; font-weight: 800; }
.radio-card .d { font-size: 14px; color: var(--muted); margin-top: 4px; line-height: 1.45; }
.radio-card.on { border: 2px solid var(--text); background: var(--panel); }
.radio-card.on .ring::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--text); }
.gap-top { margin-top: 28px; }
.gap-bottom { margin-bottom: 40px; }
.import-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 24px; }

/* Add a source: one step at a time. The picked platform folds into one line with Change next to it. */
.add-flow, .import-flow { max-width: 780px; }
.picked { display: flex; align-items: center; gap: 12px; min-height: 56px; max-width: 440px; padding: 6px 8px 6px 18px; border: 2px solid var(--text); border-radius: var(--r); background: var(--panel); }
.picked strong { font-size: 17px; font-weight: 800; }
.picked .label.done { color: var(--ok); display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; }
.picked .label.done .ico { width: 12px; height: 12px; stroke-width: 3; }
.picked button { margin-left: auto; }
.pick-grid.kinds { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 560px; }
.step.is-picked { margin-bottom: 28px; }
.step.is-picked h2 { margin-bottom: 12px; }
.add-note { margin: -14px 0 0 62px; font-size: 14.5px; }
.after-note { margin: 14px 0 0; font-size: 14px; line-height: 1.5; max-width: 62ch; }
.notes { margin: 0 0 16px; padding: 0 0 0 18px; }
.notes li { font-size: 14.5px; line-height: 1.5; color: var(--muted); margin-bottom: 8px; }
.notes li:last-child { margin-bottom: 0; }
.file-help { margin-top: 26px; }
.file-help > .label { margin-bottom: 14px; }
.file-help .howto { margin: 0; }
.dropzone.working { opacity: .55; pointer-events: none; }
.file-chip input { display: none; }
/* Upload: the preview first; the columns behind it fold away once they were found. */
.map-fold { margin: 22px 0 0; }
.map-fold summary { flex-wrap: wrap; row-gap: 2px; padding: 8px 0; }
.fold-note { font-size: 13.5px; font-weight: 600; color: var(--muted); overflow-wrap: anywhere; }
.fold-note.warn { color: var(--warn); }
.map-fold .table-wrap { margin-bottom: 14px; }
/* Send to staff: the message as it will arrive, then share or copy. */
.share > p.muted { font-size: 15px; line-height: 1.5; margin: 0 0 14px; }
.share-preview { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; margin: 0 0 20px; font-size: 15px; line-height: 1.55; }
.share-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.share-actions.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
/* Door names: the list phones pick from when they sign in, and its edit sheet. */
.door-names { display: flex; flex-wrap: wrap; gap: 8px; }
.name-chip { display: inline-flex; align-items: center; min-height: 36px; padding: 6px 14px; border-radius: 18px; border: 1.5px solid var(--line); font-size: 14.5px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.door-names-note { margin: 12px 0 0; font-size: 14px; line-height: 1.45; }
.names-intro { font-size: 15px; line-height: 1.5; margin: 0 0 16px; }
.name-row { display: grid; grid-template-columns: minmax(0, 1fr) 46px; gap: 8px; margin-bottom: 8px; }
.icon-btn { width: 46px; height: 46px; padding: 0; color: var(--muted); }
.icon-btn .ico { width: 18px; height: 18px; }
.names-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px; margin: 8px 0 22px; }
/* ---- Status: is everything running, and what to do if not */
.sdot { display: inline-block; flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--line-2); }
.sdot.ok { background: var(--ok); }
.sdot.warn { background: var(--warn); }
.sdot.bad { background: var(--dup); }
.nav-status { gap: 8px; }
.status-checked { font-size: 14px; white-space: nowrap; }
.status-hero { display: grid; grid-template-columns: 16px minmax(0, 1fr); column-gap: 16px; align-items: start; padding: 22px 24px; border-radius: var(--r-lg); border: 1.5px solid var(--line); margin-bottom: 34px; }
.status-hero .sd { width: 16px; height: 16px; border-radius: 50%; margin-top: 9px; background: var(--ok); }
.status-hero.ok { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); }
.status-hero.warn { border-color: var(--warn); }
.status-hero.warn .sd { background: var(--warn); }
.status-hero.bad { border-color: var(--dup); background: color-mix(in srgb, var(--dup) 9%, transparent); }
.status-hero.bad .sd { background: var(--dup); }
.status-hero h2 { font-size: clamp(22px, 3vw, 28px); font-weight: 900; letter-spacing: -0.01em; line-height: 1.25; }
.status-hero p { margin: 6px 0 0; color: var(--muted); font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.chk-list { list-style: none; margin: 0 0 36px; padding: 0; border: 1.5px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.chk { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; column-gap: 16px; align-items: start; padding: 16px 20px; border-top: 1px solid var(--line); }
.chk:first-child { border-top: 0; }
.chk-tag { justify-self: start; margin-top: 2px; padding: 4px 7px; border-radius: 6px; font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
.chk.bad .chk-tag { background: var(--dup); color: var(--dup-ink); }
.chk.warn .chk-tag { background: var(--warn); color: var(--warn-ink); }
.chk.info .chk-tag { border: 1px solid var(--line-2); color: var(--muted); }
.chk-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.chk-where { font-size: 12.5px; font-weight: 700; color: var(--muted); overflow-wrap: anywhere; }
.chk-body strong { font-size: 16px; font-weight: 800; line-height: 1.35; overflow-wrap: anywhere; }
.chk-detail { margin: 0; font-size: 14px; line-height: 1.45; color: var(--muted); overflow-wrap: anywhere; }
.chk-fix { margin: 6px 0 0; font-size: 14.5px; line-height: 1.5; }
.chk-fix .label { display: block; margin-bottom: 3px; color: var(--muted); }
.chk > .btn { align-self: center; }
.st-event { border: 1.5px solid var(--line); border-radius: var(--r-lg); margin-bottom: 14px; overflow: hidden; }
.st-event.warn { border-color: color-mix(in srgb, var(--warn) 60%, var(--line)); }
.st-event.bad { border-color: var(--dup); }
.st-event-head { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 18px; column-gap: 14px; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
@media (hover: hover) { .st-event-head:hover { background: var(--panel); } }
.evs-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.evs-name strong { font-size: 17px; font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; }
.evs-name .muted { font-size: 13.5px; }
.evs-count { font-family: var(--mono); font-size: 13px; font-weight: 700; white-space: nowrap; }
.st-event-head .chev { color: var(--muted); }
.ev-chk-list { list-style: none; margin: 0; padding: 4px 20px; }
.ev-chk { display: grid; grid-template-columns: 10px 8.5rem minmax(0, 1fr) auto; column-gap: 14px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.ev-chk:first-child { border-top: 0; }
.ev-chk .num { font-family: var(--mono); font-size: 12.5px; color: var(--muted); text-align: right; overflow-wrap: anywhere; }
.srv-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px 28px; margin: 0 0 36px; }
.srv-facts dt { margin-bottom: 4px; font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.srv-facts dd { margin: 0; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.status-help { padding: 18px 20px; border: 1px dashed var(--line-2); border-radius: var(--r-lg); margin-bottom: 40px; }
.status-help h2 { margin-bottom: 8px; font-size: 16px; font-weight: 800; }
.status-help p, .status-help li { font-size: 14.5px; line-height: 1.55; color: var(--muted); }
.status-help .howto { margin: 0; }
@media (max-width: 599px) {
  .status-hero { padding: 18px; column-gap: 14px; }
  .chk { grid-template-columns: minmax(0, 1fr); row-gap: 10px; padding: 16px; }
  .chk > .btn { justify-self: start; }
  .st-event-head { grid-template-columns: 10px minmax(0, 1fr) 18px; grid-template-areas: "dot name chev" ". count ."; row-gap: 6px; padding: 14px 16px; }
  .st-event-head > .sdot { grid-area: dot; }
  .st-event-head .evs-name { grid-area: name; }
  .st-event-head .evs-count { grid-area: count; }
  .st-event-head .chev { grid-area: chev; }
  .ev-chk-list { padding: 4px 16px; }
  .ev-chk { grid-template-columns: 10px minmax(0, 1fr) auto; grid-template-areas: "dot name num" ". line line"; row-gap: 2px; }
  .ev-chk > .sdot { grid-area: dot; }
  .ev-chk > strong { grid-area: name; }
  .ev-chk > .muted { grid-area: line; }
  .ev-chk > .num { grid-area: num; }
}
/* Door tab: testing a code waits behind a fold. */
.test-fold .test-body { padding: 2px 0 16px; }
.test-fold .tab-intro { font-size: 14.5px; line-height: 1.5; }
.test-fold .verdicts:empty { display: none; }
.test-fold .verdicts { margin-top: 14px; }

/* modals and admin login */
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .65); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal { width: 100%; max-width: 720px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 26px; }
.modal > header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.modal > header h2 { flex: 1; font-size: 22px; font-weight: 900; }
.modal.small { max-width: 460px; }
.modal-back:has(.modal.small) { align-items: center; }
.modal.small > header { margin-bottom: 10px; }
.ask p { color: var(--muted); font-size: 15.5px; line-height: 1.5; margin: 0 0 24px; }
.ask-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.form-foot { display: flex; align-items: center; gap: 12px 18px; flex-wrap: wrap; margin-top: 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.form-foot p { flex: 1 1 260px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.howto-fold { margin: 0 0 20px; border: 1.5px solid var(--line); border-radius: 12px; padding: 0 16px; }
.howto-fold summary { min-height: 48px; display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 800; cursor: pointer; list-style: none; }
.howto-fold summary::-webkit-details-marker { display: none; }
.howto-fold summary::after { content: '+'; margin-left: auto; font-family: var(--mono); font-size: 18px; color: var(--muted); }
.howto-fold[open] summary::after { content: '−'; }
.howto-fold .howto { margin: 2px 0 18px; }
.empty-line { margin-top: 6px; }
table.data tr.off strong { color: var(--muted); }
.modal h3.label { margin: 30px 0 10px; }
.copy-field { display: flex; gap: 8px; }
.copy-field input { font-family: var(--mono); font-size: 13px; }
pre.json { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; max-height: 300px; overflow: auto; font-size: 12px; white-space: pre-wrap; word-break: break-all; }
.callout { border: 1.5px solid var(--line); border-radius: 12px; padding: 14px 16px; font-size: 14.5px; line-height: 1.5; margin-bottom: 16px; }
.callout.warn { border-color: var(--warn); }
.mapping-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.admin-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.admin-login form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 20px; }
.admin-login .brandline { display: flex; align-items: center; gap: 16px; }
.admin-login .brandline .sep { width: 2px; height: 22px; background: var(--line); }
.admin-login h1 { font-family: var(--display); font-size: 34px; font-weight: 900; letter-spacing: -0.02em; }

/* Laptop and tablet widths next to the sidebar: fewer, roomier columns so nothing wraps mid-word or gets cut. */
@media (max-width: 1100px) {
  table.data .hide-md { display: none; }
}
/* Guest names keep their own line next to the other columns. */
@media (min-width: 901px) { table.data.tickets td.guest { min-width: 9.5rem; } }
@media (min-width: 901px) and (max-width: 1100px) {
  /* Events: "Sold on" moves under the venue, the date keeps to its own column. */
  /* Fixed widths, not content widths: each row is its own grid, so only fixed columns line up across rows. */
  .ev-row { grid-template-columns: minmax(0, 1fr) 9.5rem 116px 8.5rem; grid-template-areas: "name when status in" "src when status in"; column-gap: 18px; }
  .ev-name { grid-area: name; }
  .ev-when { grid-area: when; white-space: nowrap; }
  .ev-status { grid-area: status; }
  .ev-in { grid-area: in; }
  .ev-src { grid-area: src; }
  .ev-row.ev-head .ev-src { display: none; }
}
@media (max-width: 900px) {
  .shell { display: block; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 6px; padding: calc(12px + env(safe-area-inset-top)) 14px 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side .logo { margin: 0 12px 0 0; }
  .side .me { margin: 0 0 0 auto; border-top: 0; padding: 0; display: flex; align-items: center; gap: 10px; }
  .side .me .n { display: none; }
  .side .me button { margin: 0; }
  .main { padding: 22px 16px 48px; }
  .page-head { margin-bottom: 20px; }
  .page-head h1 { font-size: 28px; }
  .head-actions { width: 100%; flex-wrap: nowrap; }
  .head-actions > .btn, .head-actions > button { padding: 0 14px; }
  .tally { padding: 18px 18px 16px; border-radius: 16px; }
  .tally-count b { font-size: 58px; }
  .tally-count .in { font-size: 27px; }
  .tally-count .of { font-size: 23px; }
  .tally .meter { margin: 14px 0 12px; height: 12px; }
  .tally-facts { display: grid; grid-template-columns: auto auto; justify-content: start; gap: 6px 22px; font-size: 14px; }
  .ev-row.ev-head { display: none; }
  .ev-group { padding-left: 0; padding-right: 0; }
  .ev-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name status" "when when" "in in" "src src"; gap: 8px 12px; padding: 16px 0; }
  .ev-row.live { box-shadow: none; }
  .ev-name { grid-area: name; }
  .ev-status { grid-area: status; align-self: start; }
  .ev-when { grid-area: when; color: var(--muted); }
  .ev-when span, .ev-when .sub { display: inline; margin: 0; font-size: 14px; }
  .ev-when .sub::before { content: ' · '; }
  .ev-in { grid-area: in; display: flex; align-items: center; gap: 12px; }
  .ev-in .meter { flex: 1; margin: 0; max-width: none; }
  .ev-src { grid-area: src; }
  .ev-src.sub { margin-top: 0; }
  .ev-row.bare { grid-template-areas: "name status" "when when" "src src"; }
  .ev-row.bare .ev-in { display: none; }
  .ev-name strong { display: block; line-height: 26px; }
  .src-nums .meter { max-width: none; }
  .pick.kind .top { flex-direction: column-reverse; align-items: flex-start; gap: 6px; }
  .step { grid-template-columns: 30px minmax(0, 1fr); gap: 0 12px; margin-bottom: 28px; }
  .step > div:last-child { display: contents; }
  .step > div:last-child > :not(h2) { grid-column: 1 / -1; }
  .step-n { width: 30px; height: 30px; font-size: 12.5px; }
  .step h2 { margin: 4px 0 14px; font-size: 19px; }
  .step.is-picked h2 { margin-bottom: 10px; }
  .picked { max-width: none; }
  .add-note { margin: -8px 0 0; }
  .pick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pick { min-height: 62px; padding: 10px 14px; font-size: 16px; }
  .pick.kind { padding: 14px; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .sources { grid-template-columns: 1fr; }
  table.data .hide-sm { display: none; }
  .show-sm { display: block !important; }
  table.data th, table.data td { padding-left: 8px; padding-right: 8px; }
  table.data th:first-child, table.data td:first-child { padding-left: 0; }
  table.data th:last-child, table.data td:last-child { padding-right: 0; }
  table.data td .tag { white-space: normal; }
  table.data td.r .text-btn { white-space: nowrap; }
}
/* Phones: each source stacks (name, then counts); tablets keep one line per source. */
@media (max-width: 699px) {
  .src-open { grid-template-columns: minmax(0, 1fr) 18px; grid-template-areas: "id chev" "nums nums"; row-gap: 14px; padding: 16px; }
  .src-open .chev { align-self: start; margin-top: 4px; }
}
/* Phones: steps put their button under the words; fixes go tag, message, button, each on its own line. */
@media (max-width: 599px) {
  .rs { grid-template-columns: 28px minmax(0, 1fr); grid-template-areas: "mark text" ". act" ". fixes"; column-gap: 14px; padding: 16px; }
  .rs-mark { width: 28px; height: 28px; }
  .rs-text { padding-top: 3px; }
  .rs-act { justify-self: start; margin-top: 12px; }
  .rs-fixes { margin-top: 12px; }
  /* A fix: a small platform tag starts the message and the words flow on under it; the button goes below.
     Long names (EVENTBRITE, BUCKET LISTERS) never squeeze the message into a narrow column. */
  .rs-fixes li, .flag-list li { display: block; }
  .rs-fixes li > .badge, .flag-list li > .tag { margin-right: 8px; padding: 2px 7px; font-size: 10.5px; letter-spacing: .1em; vertical-align: 1px; }
  .rs-fixes li > .fx-text, .flag-list li > .fx-text { display: inline; }
  .rs-fixes li > .btn, .rs-fixes li > button, .flag-list li > button { display: flex; width: fit-content; margin-top: 10px; }
}
@media (max-width: 520px) {
  .head-actions > .btn, .head-actions > button { flex: 1 1 auto; min-width: 0; }
  .tally-pct { display: none; }
}
/* Phones: the top bar keeps to one line. Door app stays one tap away on each event's Door tab (Open door app). */
@media (max-width: 480px) {
  .side .nav-door { display: none; }
}
/* Small phones (iPhone SE, mini): the top bar keeps to one line. */
@media (max-width: 400px) {
  .side { gap: 2px; padding-left: 16px; padding-right: 12px; }
  .side .logo { height: 16px; margin: 0 6px 0 0; }
  .nav { padding: 0 10px; font-size: 14.5px; }
  .side .me .text-btn { font-size: 13.5px; }
}

/* ---------------------------------------------------------------- admin on phones: app-like */

/* A thin bar at the top while the admin waits on the server (hidden for quick answers). */
@keyframes load-bar { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
body.admin::before { content: ''; position: fixed; top: 0; left: 0; width: 40%; height: 2px; background: var(--text); z-index: 100; opacity: 0; transform: translateX(-100%); pointer-events: none; }
body.admin.loading::before { opacity: 1; animation: load-bar 1s .15s ease-in-out infinite both; }
body.modal-open { overflow: hidden; }
.seg::-webkit-scrollbar { display: none; }
@keyframes a-sheet { from { transform: translateY(40px); opacity: .3; } to { transform: none; opacity: 1; } }
@keyframes a-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes a-pop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes a-fade-out { to { opacity: 0; } }
@keyframes a-sheet-out { to { opacity: 0; transform: translateY(32px); } }
.modal-back { animation: a-fade .2s ease both; }
.modal { animation: a-pop .26s var(--ease-out) both; }
.modal-back.leaving { animation: a-fade-out .2s ease both; pointer-events: none; }
.modal:focus { outline: none; }
.modal-back.leaving .modal { animation: a-sheet-out .2s var(--ease-in) both; }

/* ---------------------------------------------------------------- admin motion */
/* Pages slide the way you're going: deeper from the right, back from the left. */
.shell { overflow-x: clip; }
@keyframes page-fwd { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes page-back { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
@keyframes page-fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.main.enter-fwd { animation: page-fwd .38s var(--ease-out) both; }
.main.enter-back { animation: page-back .38s var(--ease-out) both; }
.main.enter-fade { animation: page-fade .32s var(--ease-out) both; }
/* Tabs: the content slides in from the side of the tab you picked. */
@keyframes tab-in-r { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes tab-in-l { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: none; } }
.tab-body.in-r { animation: tab-in-r .32s var(--ease-out) both; }
.tab-body.in-l { animation: tab-in-l .32s var(--ease-out) both; }
/* Lists settle in one row after another (the first 14 only, so long lists never wait). */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.rise { animation: rise .4s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 30ms); }
/* A row that just changed glows once. */
@keyframes flash { from { background-color: rgba(43, 212, 106, .22); } to { background-color: transparent; } }
tr.flash { animation: flash 1.6s ease-out both; }
/* Live events breathe. */
@keyframes live-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .3; transform: scale(.55); } }
.tag.live::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: currentColor; vertical-align: 1px; animation: live-pulse 1.6s ease-in-out infinite; }
/* Folded sections open with a short drop. */
@keyframes open-down { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
details[open] > :not(summary) { animation: open-down .26s var(--ease-out) both; }
.howto-fold summary::after { transition: transform .22s var(--ease-out); }
.howto-fold[open] summary::after { transform: rotate(180deg); }
/* Working: a spinner inside the button that was pressed. */
@keyframes spin { to { transform: rotate(360deg); } }
button.busy::before, .btn.busy::before { content: ''; width: 14px; height: 14px; flex: none; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
button.busy:disabled { opacity: .85; cursor: progress; }
/* Check marks pop in when something worked. */
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
.connect-result .ok { animation: pop .4s var(--ease-spring) both; }
.pick, .radio-card, .seg button, .verdict { transition: border-color .2s ease, background-color .2s ease, color .2s ease, transform .1s ease; }
.pick:active, .radio-card:active { transform: scale(.98); }
/* Toasts say how it went: a check when it worked, a red mark when it didn't. */
.toast.ok, .toast.bad { display: flex; align-items: center; gap: 10px; text-align: left; }
.toast.ok::before, .toast.bad::before { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 900; line-height: 1; animation: pop .4s .08s var(--ease-spring) both; }
.toast.ok::before { content: ''; background: var(--ok) var(--ico-check-dark) center / 14px no-repeat; }
.toast.bad::before { content: '!'; background: var(--dup); color: #fff; }
.toast.bad { border-color: #5b2226; }
/* Wrong password: the form shakes, like the door PIN. */
.admin-login form.shake { animation: shake .38s; }
/* Scans tab: a new scan slides in at the top and glows once. */
@keyframes arrive { from { opacity: 0; background-color: rgba(43, 212, 106, .22); } 30% { opacity: 1; } to { background-color: transparent; } }
table.data tr.arrive td { animation: arrive 1.4s var(--ease-out) both; }
@media (max-width: 600px) { table.data.scans tr.arrive { animation: arrive 1.4s var(--ease-out) both; } table.data.scans tr.arrive td { animation: none; } }
/* Admitted or undone in the list: the status dot pops as the row glows. */
tr.flash .state .dot { animation: pop .45s var(--ease-spring) both; }

@media (max-width: 900px) {
  /* Top bar stays put and blurs what scrolls under it. */
  .side { position: sticky; top: 0; z-index: 30; background: rgba(13, 11, 12, .82); -webkit-backdrop-filter: saturate(150%) blur(16px); backdrop-filter: saturate(150%) blur(16px); }
  .nav { height: 40px; }
  /* The event tabs start on the page's left edge and stay pinned under the top bar. */
  .ev-tabs { top: calc(65px + env(safe-area-inset-top)); margin: 0 -16px 22px; padding: 0 16px; gap: 28px; }
  .ev-tabs a { flex: none; padding: 15px 0 14px; font-size: 15px; }
  .door-card { padding: 18px; }
  .door-card-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); width: 100%; }
  .door-card-actions > :first-child { grid-column: 1 / -1; }
  .pin-big span { width: 50px; height: 62px; font-size: 30px; }
}

@media (max-width: 600px) {
  /* Filters become a row of chips that scrolls. */
  .toolbar-row { gap: 10px; }
  .toolbar-row .search { max-width: none; min-width: 0; flex-basis: 100%; }
  .seg { flex: 0 0 calc(100% + 32px); min-width: 0; flex-wrap: nowrap; overflow-x: auto; border: 0; border-radius: 0; gap: 8px; margin: 0 -16px; padding: 0 16px; scrollbar-width: none; }
  .seg button { flex: none; height: 40px; border: 1.5px solid var(--line); border-radius: 20px; padding: 0 16px; }
  .seg button:last-child { border-right: 1.5px solid var(--line); }
  .seg button.on { border-color: var(--text); }

  /* Tickets as rows: name and what they hold, status under it, Admit on the right. */
  table.data.tickets thead { display: none; }
  table.data.tickets, table.data.tickets tbody { display: block; }
  table.data.tickets tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "guest act" "st act"; column-gap: 14px; row-gap: 6px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); }
  table.data.tickets td { display: block; padding: 0; border: 0; }
  table.data.tickets td.hide-sm { display: none; }
  table.data.tickets td.guest { grid-area: guest; min-width: 0; }
  table.data.tickets td.guest strong { font-size: 16px; }
  table.data.tickets td.guest .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  table.data.tickets td.st { grid-area: st; min-width: 0; }
  table.data.tickets td.act { grid-area: act; }
  table.data.tickets td.act button.xs { height: 44px; padding: 0 18px; }
  table.data.tickets td.st { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; }
  table.data.tickets td.st .tag.flag { margin: 0; }

  /* Scan log as rows: result and time, then who and which door. */
  table.data.scans thead { display: none; }
  table.data.scans, table.data.scans tbody { display: block; }
  table.data.scans tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "res t" "who door"; column-gap: 12px; row-gap: 6px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); }
  table.data.scans td { display: block; padding: 0; border: 0; min-width: 0; }
  table.data.scans td.hide-sm { display: none; }
  table.data.scans td.t { grid-area: t; font-size: 13px; color: var(--muted); }
  table.data.scans td.res { grid-area: res; }
  table.data.scans td.res .sub { display: inline; margin-left: 8px; }
  table.data.scans td.who { grid-area: who; overflow: hidden; }
  table.data.scans td.who .mono { display: block; overflow-wrap: anywhere; font-size: 13px; }
  table.data.scans td.who .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  table.data.scans td.door { grid-area: door; font-size: 13.5px; color: var(--muted); text-align: right; }

  /* Pop-ups become sheets that rise from the bottom, header pinned while the form scrolls. */
  .modal-back { align-items: flex-end; padding: 0; overflow: hidden; }
  .modal { max-width: none; max-height: 92vh; max-height: 92svh; overflow-y: auto; overscroll-behavior: contain; border-radius: 22px 22px 0 0; border-bottom: 0; padding: 0 18px calc(22px + env(safe-area-inset-bottom));  animation-name: a-sheet; }
  .modal > header { position: sticky; top: 0; z-index: 2; background: var(--panel); margin: 0 -18px 14px; padding: 22px 18px 12px; border-bottom: 1px solid var(--line); }
  .modal > header::before { content: ''; position: absolute; top: 8px; left: 50%; width: 38px; height: 4px; border-radius: 2px; background: var(--line-2); transform: translateX(-50%); }
  .modal > header h2 { font-size: 20px; }
  .modal form > .head-actions > button, .modal > div > .head-actions > button { flex: 1 1 auto; height: 50px; }
  .modal .form-grid { gap: 0; }
  .section-head h2 { font-size: 18px; }
  .modal.small > header { border-bottom: 0; margin-bottom: 2px; padding-top: 26px; }
  .modal-back:has(.modal.small) { align-items: flex-end; }
  .ask-actions button { height: 52px; }
  .form-foot > button { width: 100%; height: 48px; }

  /* Back to the page above, the way phone apps do it: one tappable link over the title. */
  .crumb { margin-bottom: 4px; }
  .crumb > * { display: none; }
  .crumb > a:last-of-type { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-top: -10px; font-size: 15px; }
  .ph-bar .crumb > a:last-of-type { margin-top: 0; }
  /* Drawn arrow: the ← character isn't in our font, and iPhone's stand-in sits off the line. */
  .crumb > a:last-of-type::before { content: ''; width: 17px; height: 17px; flex: none; background: currentColor; -webkit-mask: var(--ico-back) center / contain no-repeat; mask: var(--ico-back) center / contain no-repeat; }
  .page-head .head-actions.back-only { display: none; }

  /* Match the columns: field and picker on one line, sample values under the picker. */
  table.data.map thead { display: none; }
  table.data.map, table.data.map tbody { display: block; }
  table.data.map tr { display: grid; grid-template-columns: 104px minmax(0, 1fr); grid-template-areas: "fld col" ". smp"; column-gap: 12px; row-gap: 6px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.data.map td { display: block; padding: 0; border: 0; width: auto; min-width: 0; }
  table.data.map td.fld { grid-area: fld; font-size: 14.5px; line-height: 1.25; }
  table.data.map td.col { grid-area: col; }
  table.data.map td.sample { grid-area: smp; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
  table.data.map td.sample:empty { display: none; }

  /* Preview: name and status, then code and ticket type. */
  table.data.preview thead { display: none; }
  table.data.preview, table.data.preview tbody { display: block; }
  table.data.preview tr { display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr) max-content; grid-template-areas: "name name status" "a b status"; column-gap: 8px; row-gap: 4px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
  table.data.preview td { display: block; padding: 0; border: 0; min-width: 0; }
  table.data.preview td.pv-name { grid-area: name; font-size: 15.5px; }
  table.data.preview td.pv-status { grid-area: status; text-align: right; font-size: 14px; }
  table.data.preview td.pv-code { grid-area: a; max-width: 200px; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  table.data.preview td.pv-ticketType, table.data.preview td.pv-quantity { grid-area: b; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  table.data.preview td.pv-name:first-child ~ td.pv-ticketType { grid-area: a; }
  table.data.preview td.pv-code ~ td.pv-ticketType::before { content: '· '; }
  table.data.preview td.pv-quantity::before { content: 'Qty '; }
  table.data.preview td.pv-ticketType:not(.blank) ~ td.pv-quantity::before { content: '· Qty '; }
  table.data.preview td.blank { display: none; }
  table.data.preview td.pv-ticketType.blank + td.pv-quantity { grid-area: a; }
  table.data.devices thead { display: none; }
}

/* Door phones: Rename and Sign out side by side, wrapping when the row is narrow. */
.row-actions { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; }

/* The smallest phones: logo, Events, Status and Sign out still fit on one line. */
@media (max-width: 360px) {
  .side .logo { height: 14px; margin-right: 2px; }
  .nav { padding: 0 7px; font-size: 14px; }
  .nav-status { gap: 6px; }
  .side .me .text-btn { font-size: 13px; }
  /* The count's four facts one per line: two columns would break "not here yet" across lines. */
  .tally-facts { grid-template-columns: auto; row-gap: 4px; }
  .ev-tabs { gap: 18px; }
  .pin-big { gap: 8px; }
  .pin-big span { width: 44px; height: 56px; font-size: 26px; }
}
