/* ETN Events Check-in — base styles
   Palette: ink navy for structure, teal for actions, green reserved for "checked in". */
:root {
  --ink: #14213D;
  --ink-soft: #4A5670;
  --muted: #5E6A80;
  --canvas: #EDF1F5;
  --paper: #FFFFFF;
  --line: #D3DAE4;
  --line-soft: #E6EBF1;
  --primary: #0B6B6F;
  --primary-dark: #08575A;
  --primary-tint: #E0F0F0;
  --ok: #1E7B47;
  --ok-tint: #DDF2E5;
  --warn: #8F5A00;
  --warn-tint: #FCEFD6;
  --danger: #B3261E;
  --danger-tint: #FBE3E1;
  --radius-lg: 14px;
  --radius: 10px;
  --radius-sm: 6px;
  --font: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --focus: 0 0 0 3px rgba(11, 107, 111, .35);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
}
h1, h2 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
p { margin: 0; }
a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--primary-dark); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1.5rem;
  padding: .6rem max(1rem, env(safe-area-inset-left));
  padding-top: calc(.6rem + env(safe-area-inset-top));
  background: var(--ink); color: #fff;
}
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; font-weight: 700; text-decoration: none; white-space: nowrap; }
.brand:hover { color: #fff; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 5px; background: var(--primary);
  /* a small tick, the one mark of the brand */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E");
  background-size: 16px; background-position: center; background-repeat: no-repeat;
}
.mainnav { display: flex; gap: .25rem; flex: 1; }
.mainnav a {
  color: #C9D3E6; text-decoration: none; padding: .45rem .75rem; border-radius: var(--radius-sm);
}
.mainnav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.mainnav a[aria-current="page"] { color: #fff; background: rgba(255,255,255,.14); }

.usermenu { position: relative; }
.usermenu summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: .5rem;
  padding: .3rem .5rem; border-radius: 999px; color: #fff;
}
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary:hover { background: rgba(255,255,255,.08); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; color: var(--ink); font-weight: 700;
}
.usermenu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px;
  background: var(--paper); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 10px 30px rgba(20,33,61,.18);
  padding: .5rem; display: grid;
}
.usermenu-email { padding: .5rem .6rem; color: var(--muted); font-size: .875rem; border-bottom: 1px solid var(--line-soft); margin-bottom: .25rem; word-break: break-all; }
.usermenu-panel a, .usermenu-panel .linklike {
  display: block; width: 100%; text-align: left; padding: .6rem; border-radius: var(--radius-sm);
  color: var(--ink); text-decoration: none; font-size: 1rem;
}
.usermenu-panel a:hover, .usermenu-panel .linklike:hover { background: var(--canvas); }

@media (max-width: 640px) {
  .topbar { gap: .75rem; }
  .usermenu-name { display: none; }
}
@media (max-width: 420px) {
  .brand-text { display: none; }
}

/* ---------- Page structure ---------- */
.page { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 4rem; display: grid; gap: 1rem; align-content: start; }
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.pagehead .backlink { flex-basis: 100%; }
.backlink { text-decoration: none; font-size: .95rem; }
.backlink::before { content: "‹ "; }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.panel.narrow { max-width: 480px; width: 100%; margin: 0 auto; }
.panel-head { padding: 1.25rem 1.25rem 0; }
.panel-body { padding: 1.25rem; }
.empty { text-align: center; padding: 3rem 1.25rem; display: grid; gap: .5rem; justify-items: center; }

.split { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 860px) { .split { grid-template-columns: minmax(0, 1fr) 320px; } }

.stack { display: grid; gap: 1.1rem; }
.stack-sm { display: grid; gap: .75rem; }

/* ---------- Flash messages ---------- */
.flash { padding: .85rem 1rem; border-radius: var(--radius); border: 1px solid; font-weight: 700; }
.flash-success { background: var(--ok-tint); border-color: #B5DFC4; color: #145232; }
.flash-error { background: var(--danger-tint); border-color: #F1BDB8; color: #7E1A14; }
.flash-temp { background: var(--warn-tint); border-color: #EDCF92; color: #5E3B00; word-break: break-word; }

/* ---------- Forms ---------- */
.field { display: grid; gap: .35rem; align-content: start; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span:first-child, .field legend { font-weight: 700; font-size: .95rem; padding: 0; }
.req::after { content: " *"; color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=datetime-local], textarea, select {
  width: 100%; font: inherit; color: var(--ink); background: var(--paper);
  border: 1.5px solid var(--line); border-radius: var(--radius); padding: .7rem .8rem; min-height: 48px;
}
textarea { resize: vertical; min-height: 96px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
.hint { color: var(--muted); font-size: .85rem; }
.field-error { color: var(--danger); font-size: .9rem; font-weight: 700; }

.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 4.5rem; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  font: inherit; font-size: .875rem; font-weight: 700; color: var(--primary);
  background: none; border: 0; padding: .4rem .6rem; cursor: pointer; border-radius: var(--radius-sm);
}

.radio-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.radio-chip input { position: absolute; opacity: 0; pointer-events: none; }
.radio-chip span {
  display: inline-block; padding: .6rem 1.1rem; border: 1.5px solid var(--line); border-radius: 999px;
  cursor: pointer; font-weight: 700; min-height: 44px;
}
.radio-chip input:checked + span { border-color: var(--primary); background: var(--primary-tint); color: var(--primary-dark); }
.radio-chip input:focus-visible + span { box-shadow: var(--focus); }

.formactions { display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; padding-top: .25rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  min-height: 44px; padding: .55rem 1.1rem; border-radius: var(--radius); border: 1.5px solid transparent;
  white-space: nowrap;
}
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary { background: var(--paper); color: var(--primary-dark); border-color: var(--primary); }
.btn-secondary:hover { background: var(--primary-tint); }
.btn-quiet { background: transparent; color: var(--primary-dark); border-color: var(--line); }
.btn-quiet:hover { background: var(--canvas); color: var(--primary-dark); }
.btn-danger-quiet { background: transparent; color: var(--danger); border-color: #EBC2BE; }
.btn-danger-quiet:hover { background: var(--danger-tint); }
.linklike { font: inherit; background: none; border: 0; color: var(--primary); cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Toolbar (search + filter) ---------- */
.toolbar { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.search { flex: 1 1 280px; }
.search input {
  padding-left: 2.6rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235E6A80' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: .8rem center; background-size: 20px;
}
.segmented { display: inline-flex; background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 3px; }
.segmented button {
  font: inherit; font-weight: 700; color: var(--muted); background: none; border: 0;
  padding: .5rem .9rem; border-radius: 7px; cursor: pointer; min-height: 40px;
}
.segmented button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* ---------- Table → stacked rows on phones ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .85rem; color: var(--muted); font-weight: 700; padding: .75rem 1rem; border-bottom: 1px solid var(--line); background: #F7F9FB; }
.table td { padding: .8rem 1rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.is-inactive td { background: #F7F8FA; }
.table tr.is-inactive .rowtitle { color: var(--muted); }
.rowtitle { font-weight: 700; text-decoration: none; color: var(--ink); }
.rowtitle:hover { color: var(--primary); text-decoration: underline; }
.rowsub { display: block; color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.notes-cell { color: var(--ink-soft); font-size: .92rem; max-width: 300px; }
.actions { text-align: right; white-space: nowrap; }
.actions form { display: inline; }
.actions .btn { min-height: 40px; padding: .4rem .8rem; }

@media (max-width: 720px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: .85rem 1rem; border-bottom: 1px solid var(--line-soft); }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td { padding: .2rem 0; border: 0; }
  .table td[data-label="Last sign-in"]::before { content: "Last sign-in: "; color: var(--muted); }
  .notes-cell { max-width: none; }
  .notes-cell.is-empty { display: none; }
  .table tr.is-inactive { background: #F7F8FA; }
  .table tr.is-inactive td { background: transparent; }
  .actions { text-align: left; padding-top: .6rem !important; display: flex !important; gap: .5rem; flex-wrap: wrap; }
}

/* ---------- Chips ---------- */
.chips { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .4rem; }
.chip { display: inline-block; font-size: .78rem; font-weight: 700; padding: .15rem .55rem; border-radius: 999px; line-height: 1.5; }
.chip-off { background: #E9ECF0; color: var(--muted); }
.chip-warn { background: var(--danger-tint); color: var(--danger); }
.chip-wait { background: var(--warn-tint); color: var(--warn); }

/* ---------- Facts and activity ---------- */
.facts { margin: 0; display: grid; gap: .5rem; }
.facts div { display: flex; justify-content: space-between; gap: 1rem; font-size: .95rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 700; text-align: right; }
.activity { list-style: none; margin: 0; padding: 0; display: grid; gap: .65rem; }
.activity li { display: grid; gap: .1rem; font-size: .92rem; padding-bottom: .65rem; border-bottom: 1px solid var(--line-soft); }
.activity li:last-child { border-bottom: 0; padding-bottom: 0; }
.activity time { color: var(--muted); font-size: .82rem; }
.activity-warn { color: var(--warn); font-size: .85rem; }

/* ---------- Sign-in "ticket" (auth pages) ---------- */
.is-bare { background: var(--ink); }
.bare-main {
  min-height: 100vh; min-height: 100dvh; display: grid; align-content: center; justify-items: center; gap: 1rem;
  padding: calc(1.5rem + env(safe-area-inset-top)) 1rem calc(1.5rem + env(safe-area-inset-bottom));
}
.bare-main .flash { width: 100%; max-width: 420px; }
.ticket {
  width: 100%; max-width: 420px; background: var(--paper); border-radius: var(--radius-lg);
  position: relative;
  /* punched notches at the tear line, like an event ticket */
  -webkit-mask: radial-gradient(circle 12px at 0 132px, transparent 98%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle 12px at 100% 132px, transparent 98%, #000) right / 51% 100% no-repeat;
          mask: radial-gradient(circle 12px at 0 132px, transparent 98%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle 12px at 100% 132px, transparent 98%, #000) right / 51% 100% no-repeat;
}
.ticket-head {
  height: 132px; padding: 1.5rem 1.75rem; display: grid; align-content: end; gap: .35rem;
  background: var(--primary); color: #fff; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.ticket-head h1 { font-size: 1.5rem; }
.ticket-app { font-size: .95rem; color: #CDE8E8; font-weight: 700; }
.ticket-body {
  padding: 1.75rem; display: grid; gap: 1.1rem;
  background-image: linear-gradient(to right, var(--line) 50%, transparent 50%);
  background-size: 14px 2px; background-repeat: repeat-x; background-position: 0 0;
}
.ticket-foot { text-align: center; font-size: .95rem; }
.center { text-align: center; }

@media (prefers-reduced-motion: no-preference) {
  .ticket { animation: ticket-in .35s ease-out; }
  @keyframes ticket-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}

/* ---------- Step 2: events, counters, sign-in codes ---------- */
.topbar-spacer { flex: 1; }
.login-badge { font-weight: 700; padding: .3rem .8rem; border-radius: 999px; background: rgba(255,255,255,.14); white-space: nowrap; }
.login-badge.is-captain { background: #F5C451; color: var(--ink); }
.btn-topbar { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); min-height: 40px; padding: .35rem .9rem; }
.btn-topbar:hover { background: rgba(255,255,255,.1); color: #fff; }

.segmented-full { display: flex; width: 100%; }
.segmented-full a {
  flex: 1; text-align: center; font-weight: 700; color: var(--muted); text-decoration: none;
  padding: .55rem .5rem; border-radius: 7px; min-height: 40px;
}
.segmented-full a[aria-selected="true"] { background: var(--ink); color: #fff; }
.notice { background: var(--canvas); border-radius: var(--radius); padding: 1rem; display: grid; gap: .35rem; text-align: center; }

.code { font-weight: 700; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.code-lg { font-size: 1.35rem; }
.code-input { font-size: 1.3rem; letter-spacing: .25em; text-transform: uppercase; font-weight: 700; }

.inline-form { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.field-inline { display: flex; align-items: center; gap: .6rem; }
.field-inline > span:first-child { font-size: 1rem; }
.input-short { width: 5.5rem !important; text-align: center; }

.chip-lg { font-size: .85rem; vertical-align: middle; margin-left: .35rem; }
.chip-live, .chip-status-live { background: var(--ok-tint); color: var(--ok); }
.chip-status-draft { background: var(--primary-tint); color: var(--primary-dark); }
.chip-status-ended { background: #E9ECF0; color: var(--muted); }

.event-list { list-style: none; margin: 0; padding: 0; }
.event-row + .event-row { border-top: 1px solid var(--line-soft); }
.event-link { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; padding: .9rem 1.1rem; color: inherit; text-decoration: none; }
.event-link:hover { background: #F7F9FB; color: inherit; }
.event-link:hover .rowtitle { color: var(--primary); text-decoration: underline; }
.event-date { width: 56px; border-radius: var(--radius); border: 1.5px solid var(--line); text-align: center; overflow: hidden; background: var(--paper); }
.event-day { display: block; font-size: 1.35rem; font-weight: 700; line-height: 1.6; }
.event-mon { display: block; font-size: .75rem; font-weight: 700; background: var(--ink); color: #fff; line-height: 1.7; }
.status-live .event-date { border-color: var(--ok); }
.status-live .event-mon { background: var(--ok); }
.status-ended .event-link { opacity: .75; }
.event-main { display: grid; min-width: 0; }
.event-meta { display: grid; justify-items: end; gap: .25rem; text-align: right; }
@media (max-width: 560px) {
  .event-link { grid-template-columns: auto 1fr; }
  .event-meta { grid-column: 2; justify-items: start; text-align: left; display: flex; gap: .6rem; align-items: center; }
}

.grid-2 { display: grid; gap: 1.1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
.quick-picks { display: flex; gap: 1rem; }

.check-grid { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.check-chip input { position: absolute; opacity: 0; pointer-events: none; }
.check-chip span {
  display: grid; gap: .1rem; min-height: 48px; align-content: center; padding: .55rem .8rem .55rem 2.4rem;
  border: 1.5px solid var(--line); border-radius: var(--radius); cursor: pointer; font-weight: 700; position: relative;
}
.check-chip span::before {
  content: ""; position: absolute; left: .8rem; top: 50%; width: 20px; height: 20px; margin-top: -10px;
  border: 2px solid var(--line); border-radius: 5px; background: var(--paper);
}
.check-chip input:checked + span { border-color: var(--primary); background: var(--primary-tint); }
.check-chip input:checked + span::before {
  border-color: var(--primary); background: var(--primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.check-chip input:focus-visible + span { box-shadow: var(--focus); }
.check-chip small { font-weight: 400; color: var(--warn); font-size: .78rem; }
.check-chip.is-busy span { border-style: dashed; }

.status-panel { border-left: 6px solid var(--primary); }
.status-panel.status-live { border-left-color: var(--ok); }
.status-panel.status-ended { border-left-color: var(--line); }
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; padding-top: .25rem; }
.btn-big { min-height: 52px; padding: .7rem 1.6rem; font-size: 1.1rem; }
.btn-sm { min-height: 38px; padding: .3rem .75rem; font-size: .92rem; }
.btn-whatsapp { background: #1F8F4E; color: #fff; }
.btn-whatsapp:hover { background: #18733E; color: #fff; }

.login-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.login-row { display: grid; grid-template-columns: 1fr auto auto; gap: 1rem; align-items: center; padding: .65rem .9rem; }
.login-row + .login-row { border-top: 1px solid var(--line-soft); }
.login-row.is-captain { background: #FFF7E3; }
.login-row.is-changed { background: var(--ok-tint); }
.login-name { font-weight: 700; }
.login-actions { display: flex; gap: .4rem; }
.login-actions form { display: inline; }
@media (max-width: 560px) {
  .login-row { grid-template-columns: 1fr auto; }
  .login-actions { grid-column: 1 / -1; }
}
.facts-stack div { display: grid; gap: .1rem; }
.facts-stack dd { text-align: left; }
.summary-text { color: var(--ink-soft); font-size: .95rem; border-top: 1px solid var(--line-soft); padding-top: .75rem; }

.notice-left { text-align: left; }
.plain-list { margin: 0; padding-left: 1.2rem; }
code { font-size: .9em; background: var(--canvas); padding: .05rem .35rem; border-radius: 4px; word-break: break-all; }

/* ---------- Lanes, attendees ---------- */
.lane-grid { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.lane-item { border: 1.5px solid var(--line); border-radius: var(--radius); padding: .5rem .7rem .6rem; margin: 0; min-width: 0; }
.lane-item.is-on { border-color: var(--primary); background: #F4FAFA; }
.lane-item.is-busy { border-style: dashed; }
.lane-item legend { font-weight: 700; padding: 0 .25rem; }
.lane-item legend small { font-weight: 400; color: var(--warn); font-size: .78rem; }
.lane-choice { display: flex; background: var(--canvas); border-radius: 8px; padding: 3px; gap: 2px; }
.lane-choice label { flex: 1; }
.lane-choice input { position: absolute; opacity: 0; pointer-events: none; }
.lane-choice span { display: block; text-align: center; padding: .4rem .3rem; border-radius: 6px; font-weight: 700; font-size: .9rem; color: var(--muted); cursor: pointer; }
.lane-choice input:checked + span { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(20,33,61,.15); }
.lane-choice input[value="award"]:checked + span { background: #FFF1CC; color: #6B4A00; }
.lane-choice input:focus-visible + span { box-shadow: var(--focus); }

.chip-lane-normal { background: var(--primary-tint); color: var(--primary-dark); }
.chip-lane-award { background: #FFF1CC; color: #6B4A00; }
.badges { display: flex; gap: .3rem; flex-wrap: wrap; }
.badge { display: inline-block; font-size: .8rem; font-weight: 700; padding: .12rem .5rem; border-radius: 6px; border: 1.5px solid; white-space: nowrap; }
.badge-lsa { border-color: #C79A1E; color: #6B4A00; background: #FFF6DB; }
.badge-era { border-color: #7B5CC4; color: #4B2E99; background: #F2EDFC; }
.badge-imi { border-color: #2F7FB8; color: #1D5784; background: #E8F3FB; }
.badge-diet { border-color: #1E7B47; color: #fff; background: #1E7B47; }

.stat-grid { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.stat { border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .85rem; background: var(--paper); }
.stat-num { display: block; font-size: 1.6rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-label { font-size: .85rem; color: var(--muted); }
.stat-sub { font-size: .8rem; color: var(--muted); }

.upload-box { border: 2px dashed var(--line); border-radius: var(--radius); padding: 1rem; display: grid; gap: .75rem; }
.upload-box input[type=file] { font: inherit; max-width: 100%; }
.warn-list { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.warn-list li { padding: .5rem .8rem; border-bottom: 1px solid var(--line-soft); font-size: .92rem; display: grid; grid-template-columns: 4.5rem 1fr; gap: .5rem; }
.warn-list li:last-child { border-bottom: 0; }
.warn-row { color: var(--muted); font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
.table-compact td, .table-compact th { padding: .5rem .7rem; font-size: .92rem; }
.status-dot { display: inline-flex; align-items: center; gap: .35rem; font-weight: 700; font-size: .88rem; white-space: nowrap; }
.status-dot::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.status-dot.is-in { color: var(--ok); }
.status-dot.is-in::before { background: var(--ok); }
.status-dot.is-out { color: var(--muted); }
.table-no { font-weight: 700; font-variant-numeric: tabular-nums; }
.danger-zone { border-top: 1px solid var(--line-soft); padding-top: .8rem; display: grid; gap: .5rem; }
.inline-confirm { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.inline-confirm input { width: 9rem; min-height: 40px; }
.segmented .seg-link { font-weight: 700; color: var(--muted); text-decoration: none; padding: .5rem .9rem; border-radius: 7px; min-height: 40px; display: inline-flex; align-items: center; }
.segmented .seg-link[aria-current="true"] { background: var(--ink); color: #fff; }

/* ---------- Check-in screen ---------- */
.desk { display: grid; gap: .9rem; }
.desk-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.desk-who { font-size: 1.3rem; font-weight: 700; }
.desk-counts { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; text-align: right; }
.count-big { font-size: 1.05rem; color: var(--muted); }
.count-big strong { font-size: 2rem; color: var(--ok); font-variant-numeric: tabular-nums; }
.count-big span { display: block; font-size: .8rem; }
.count-small { font-size: .9rem; color: var(--muted); font-weight: 700; }
.desk-search { position: sticky; top: calc(56px + env(safe-area-inset-top)); z-index: 10; display: flex; gap: .6rem; flex-wrap: wrap;
  background: var(--canvas); padding: .4rem 0; }
.search-big { flex: 1 1 320px; }
.search-big input { min-height: 60px; font-size: 1.25rem; font-weight: 700; border-width: 2px; padding-left: 2.9rem; background-position: .9rem center; background-size: 24px; }
.desk-results { display: grid; gap: .45rem; }
.desk-section { font-size: 1rem; color: var(--muted); margin-top: .5rem; }
.desk-hint { padding: 2rem 0; font-size: 1.05rem; }

.guest { display: grid; grid-template-columns: 1fr auto auto; gap: 1rem; align-items: center; background: var(--paper);
  border: 1.5px solid var(--line); border-radius: var(--radius-lg); padding: .6rem .9rem; }
.guest.is-in { border-color: #9FD2B3; background: #F3FBF6; }
.guest.is-other { background: #F7F8FA; }
.guest-main { min-width: 0; display: grid; gap: .15rem; justify-items: start; }
.guest-name { font-size: 1.15rem; line-height: 1.25; }
.guest-sub { color: var(--muted); font-size: .9rem; }
.guest-remark { font-size: .9rem; color: var(--warn); font-weight: 700; }
.guest-table { text-align: center; min-width: 68px; border-left: 1px solid var(--line-soft); padding-left: 1rem; }
.guest-table span { display: block; font-size: .75rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.guest-table strong { font-size: 1.8rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.guest-actions { display: flex; gap: .5rem; align-items: center; justify-content: flex-end; min-width: 200px; }
.guest-actions [data-view] { order: -1; min-height: 52px; }
.guest-actions .guest-done { order: -2; margin-right: .25rem; }
.btn-checkin { background: var(--ok); color: #fff; min-height: 52px; font-size: 1.15rem; padding: .5rem 1.4rem; min-width: 140px; }
.btn-checkin:hover { background: #17633A; color: #fff; }
.btn-checkin:disabled { opacity: .6; }
.guest-done { color: var(--ok); font-weight: 700; text-align: center; }
.guest-done::before { content: "✓ "; }
.guest-done span { display: block; font-weight: 400; font-size: .85rem; color: var(--muted); }
.guest-redirect { font-weight: 700; color: var(--warn); font-size: .9rem; text-align: center; max-width: 190px; }
@media (max-width: 640px) {
  .guest { grid-template-columns: 1fr auto; }
  .guest-actions { grid-column: 1 / -1; justify-content: stretch; min-width: 0; }
  .guest-actions .btn-checkin { flex: 1; }
  .guest-table { border-left: 0; padding-left: 0; }
}

.desk-toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(1.2rem + env(safe-area-inset-bottom)); z-index: 50;
  width: min(560px, calc(100% - 2rem)); border-radius: var(--radius-lg); padding: 1rem 1.2rem; display: grid; gap: .15rem;
  box-shadow: 0 12px 30px rgba(20,33,61,.25); font-size: 1.05rem; }
.desk-toast span { font-size: 1.5rem; font-weight: 700; }
.toast-ok { background: var(--ok); color: #fff; }
.toast-info { background: var(--ink); color: #fff; }
.toast-warn { background: #F5C451; color: var(--ink); }
.toast-error { background: var(--danger); color: #fff; }
.desk-offline { background: var(--danger-tint); color: #7E1A14; border: 1px solid #F1BDB8; border-radius: var(--radius); padding: .7rem 1rem; font-weight: 700; }

.guest-dialog { border: 0; border-radius: var(--radius-lg); padding: 0; width: min(560px, calc(100% - 1.5rem)); max-height: calc(100dvh - 2rem); color: var(--ink); }
.guest-dialog::backdrop { background: rgba(20,33,61,.55); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 1.1rem 1.2rem .6rem; }
.dialog-head h2 { font-size: 1.3rem; }
.dialog-body { padding: 0 1.2rem; }
.dialog-table { font-size: 1.1rem; color: var(--muted); }
.dialog-table strong { font-size: 1.8rem; color: var(--ink); margin-left: .3rem; }
.dialog-actions { padding: 1rem 1.2rem 1.2rem; display: grid; gap: .5rem; border-top: 1px solid var(--line-soft); margin-top: 1rem; }

.az-bar { position: sticky; top: calc(56px + 76px + env(safe-area-inset-top)); z-index: 9; display: flex; gap: 2px; overflow-x: auto;
  background: var(--canvas); padding: .25rem 0 .4rem; -webkit-overflow-scrolling: touch; }
.az-bar button { flex: 0 0 auto; min-width: 38px; min-height: 38px; font: inherit; font-weight: 700; color: var(--primary-dark);
  background: var(--paper); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.az-bar button:active { background: var(--primary-tint); }
.guest[data-letter] { scroll-margin-top: 190px; }
.guest.just-changed { animation: flash-row 1.2s ease-out; }
@keyframes flash-row { from { box-shadow: 0 0 0 4px rgba(30,123,71,.45); } to { box-shadow: 0 0 0 0 rgba(30,123,71,0); } }
.toggle-chip { display: inline-flex; align-items: center; }
.toggle-chip input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-chip span { display: inline-flex; align-items: center; gap: .4rem; min-height: 60px; padding: 0 1rem; border: 2px solid var(--line); border-radius: var(--radius);
  background: var(--paper); font-weight: 700; color: var(--muted); cursor: pointer; white-space: nowrap; }
.toggle-chip span::before { content: ""; width: 18px; height: 18px; border: 2px solid var(--line); border-radius: 4px; }
.toggle-chip input:checked + span { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-tint); }
.toggle-chip input:checked + span::before { background: var(--primary); border-color: var(--primary); }
.toggle-chip input:focus-visible + span { box-shadow: var(--focus); }
@media (max-width: 640px) { .toggle-chip span { min-height: 48px; } .az-bar { top: calc(56px + 130px + env(safe-area-inset-top)); } }

/* ---------- Dashboard and report ---------- */
.dash-hero .panel-body { display: grid; gap: .8rem; }
.dash-big { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.dash-num { font-size: 3rem; font-weight: 700; line-height: 1; color: var(--ok); font-variant-numeric: tabular-nums; }
.dash-of { font-size: 1.2rem; color: var(--muted); font-weight: 700; }
.dash-pct { margin-left: auto; font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar { display: block; height: 12px; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--ok); border-radius: 999px; transition: width .4s; }
.dash-lanes { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.dash-lanes > div { display: grid; gap: .3rem; font-variant-numeric: tabular-nums; }
.dash-lanes .bar { height: 8px; }
.split-wide { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 980px) { .split-wide { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); } }
.split-even { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 860px) { .split-even { grid-template-columns: 1fr 1fr; } }
.is-idle { color: var(--warn); font-weight: 700; }
.pace { display: flex; align-items: flex-end; gap: 4px; height: 150px; padding-top: 1rem; }
.pace-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.pace-bar { width: 100%; max-width: 34px; background: var(--primary); border-radius: 4px 4px 0 0; }
.pace-n { font-size: .75rem; font-weight: 700; color: var(--ink-soft); }
.pace-t { font-size: .7rem; color: var(--muted); margin-top: .25rem; white-space: nowrap; }
.row-strong td { background: #F7F9FB; }
.desk-head > .btn { align-self: center; }
