* { box-sizing: border-box; }
:root {
  --bg: #f1f1f3;
  --card: #ffffff;
  --red: #ba1f1f;
  --red-dark: #951717;
  --text: #101014;
  --muted: #5e5e66;
  --line: #d9d9de;
  --yellow: #f6d40b;
  --green: #146b38; /* darker than a typical "success green" on purpose — #1a8f4c failed WCAG AA contrast (3.88:1) with white bold button text; this measures ~6.6:1 */
  --green-dark: #0d4d28;
  --yellow-dark: #c9a600;
  --shadow-sm: 0 1px 3px rgba(16, 16, 20, 0.08), 0 1px 2px rgba(16, 16, 20, 0.05);
  /* --shadow-card is the standard elevation for every card-like surface
     app-wide (headers, result cards, dialogs) — restrained on purpose;
     --shadow-md/--shadow-lg are kept only for the few spots that still
     want a stronger lift on hover/selection, not as a resting-state shadow. */
  --shadow-card: 0 2px 8px rgba(16, 16, 20, 0.1), 0 1px 2px rgba(16, 16, 20, 0.05);
  --shadow-md: 0 4px 14px rgba(16, 16, 20, 0.1), 0 1px 3px rgba(16, 16, 20, 0.06);
  --shadow-lg: 0 10px 26px rgba(16, 16, 20, 0.16), 0 2px 6px rgba(16, 16, 20, 0.08);
  --radius-card: 20px;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  /* CONFIRMED ROOT CAUSE of an intermittent mobile-WebKit test failure
     ("Clicking the checkbox did not change its state" on
     #sessions-live-toggle, admin-phase2-devices-sessions.spec.js): with
     no touch-action set and pinch-zoom still enabled (the viewport meta
     tag has no user-scalable=no), WebKit must wait to disambiguate a
     single tap from the start of a double-tap-to-zoom gesture before
     committing to a click — a real, variable delay (observed up to
     ~160ms in this app) between the tap and the resulting native
     checked-state change/'change' event. That's not just test timing —
     it's genuine input latency for every real touch user of this kiosk/
     admin app on iOS Safari. touch-action: manipulation tells the
     browser this page doesn't need that gesture recognition, so taps
     commit immediately; page-level pinch-zoom on non-interactive areas
     is unaffected. */
  touch-action: manipulation;
}

/* Keyboard-only focus indicator — visible and high-contrast, but doesn't
   draw an outline on a mouse/touch tap (only on real keyboard focus). */
:focus-visible {
  outline: 3px solid #1a56db;
  outline-offset: 2px;
  border-radius: 4px;
}
/* main.js/admin.js's showView()/focusHeading() move DOM focus to each new
   view's heading via a plain .focus() call — tabindex="-1" is the ONLY
   place this attribute is ever used in this app (confirmed: grep the
   codebase) — purely so a screen reader announces the view change, the
   same way a real page navigation would land focus near the top of new
   content. A heading is never part of the normal Tab order (tabindex=-1
   guarantees that), so a sighted keyboard user can never land here by
   tabbing — but Chromium/WebKit's own :focus-visible heuristic still
   treats a script-triggered .focus() as "visible", drawing the outline
   on every single view change regardless of input method. Suppressing it
   here is intentionally scoped to exactly that pattern, not a blanket
   focus-outline removal: every real interactive control (buttons, links,
   inputs, selects) keeps the outline above untouched. */
[tabindex="-1"]:focus-visible {
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

#app-shell {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  min-height: 100vh; /* fallback for browsers without dvh support */
  min-height: 100dvh; /* correct on mobile Safari — 100vh includes the address bar area and causes layout jumps as it shows/hides */
}

.view { display: none; }
.view.active {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 32px);
  min-height: calc(100dvh - 32px);
  animation: atl-fade-in 220ms ease;
}
@keyframes atl-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 16px 20px;
  text-align: center;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}
.chip {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: #fdeaea;
  color: var(--red-dark);
}
.chip-outline {
  background: transparent;
  border: 1.5px solid var(--line);
  color: var(--muted);
}
.on-site-line, .sync-line {
  margin: 8px 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}
.on-site-line:empty, .sync-line:empty { display: none; margin: 0; }
.sync-warn { color: #91720b !important; font-weight: 600; }
.sync-warn::before { content: '⚠ '; }
.brand-row {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.brand-row.with-actions { justify-content: space-between; }
.brand-logo {
  height: 34px;
  display: block;
}
.brand-left {
  font-weight: 700;
  color: var(--red);
  font-size: 1.1rem;
}
/* .hero-card is admin-only now (both kiosk screens have moved to
   .kiosk-page-header/.kiosk-page-title — see below) — same charcoal
   heading treatment as the kiosk redesign, not the old red. */
.hero-card h1 {
  margin: 8px 0 4px;
  font-size: clamp(1.4rem, 4.2vw, 1.9rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.hero-card p { color: var(--muted); margin: 0 0 6px; font-size: 0.95rem; }

/* Shared compact header for every kiosk sub-screen (site picker, kiosk
   setup, staff scan, visitor choice/registration/sign-out search) —
   replaces the old oversized .hero-card + red heading on those screens
   specifically (deliberately a NEW class, not a redefinition of
   .hero-card itself: admin.html also uses .hero-card for its login and
   dashboard header and is out of scope here). Branding + site context on
   one compact line, with a Back control when there's somewhere
   meaningful to go back to. Each screen's own purpose-specific heading
   still follows below this, as plain text — no card wrapper needed once
   the page itself already sits on the app's own soft-grey background. */
.kiosk-page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0 2px;
}
.kiosk-page-back {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 120ms ease, transform 100ms ease;
}
.kiosk-page-back svg { width: 20px; height: 20px; }
.kiosk-page-back:active { transform: scale(0.95); }
@media (hover: hover) {
  .kiosk-page-back:hover { border-color: #c7c7cc; }
}
.kiosk-page-header-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.kiosk-page-header-brand .brand-logo { height: 28px; flex-shrink: 0; }
.kiosk-page-header-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kiosk-page-header-site {
  margin-left: auto;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40%;
}

/* Each screen's own heading, now plain text below the compact header
   rather than inside a card. */
.kiosk-page-title {
  margin: 18px 0 4px;
  font-size: clamp(1.4rem, 4vw, 1.9rem);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.kiosk-page-sub { margin: 0 0 18px; color: var(--muted); font-size: 0.98rem; }

/* Kiosk setup is a single form-driven task, not a dashboard — constrain
   it to a readable measure and centre it instead of letting the pairing
   code input and status text stretch across the full #app-shell width on
   a wide tablet/desktop. */
#view-kiosk-setup .kiosk-page-title,
#view-kiosk-setup .kiosk-page-sub,
#view-kiosk-setup .form-card {
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}
#view-kiosk-setup .kiosk-page-title,
#view-kiosk-setup .kiosk-page-sub { width: 100%; }

/* ===== Kiosk home: two-column layout =====
   Landscape tablets/desktops (>=820px): a ~30% info column (branding,
   site, clock, stats) beside a ~70% main column (greeting + actions).
   Narrower screens: the info column becomes a compact header card above
   the actions instead of a tall sidebar — see .kiosk-info-col below. */
.kiosk-shell {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
  min-height: 0;
}
@media (min-width: 820px) {
  .kiosk-shell { flex-direction: row; align-items: stretch; gap: 44px; }
}

.kiosk-info-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
@media (min-width: 820px) {
  .kiosk-info-col {
    flex: 0 0 30%;
    max-width: 320px;
    gap: 20px;
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
  }
}

.kiosk-brand-row { display: flex; align-items: center; gap: 12px; }
.kiosk-brand-row .brand-logo { height: 32px; flex-shrink: 0; }
.kiosk-brand-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.kiosk-brand-name { font-weight: 600; font-size: 0.92rem; color: var(--text); }
.kiosk-brand-sub { font-size: 0.76rem; color: var(--muted); font-weight: 600; }

.kiosk-site-block { display: flex; flex-direction: column; gap: 2px; }
.kiosk-site-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.kiosk-site-name {
  font-size: clamp(1.2rem, 2.4vw, 1.6rem);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.15;
}

/* Pushes the clock/stats to the bottom of the tall sidebar on landscape
   only — on the compact narrow header this is hidden entirely, since
   "lower down in the column" has no meaning once everything's one
   horizontal block instead of a tall column. */
.kiosk-info-spacer { display: none; }
@media (min-width: 820px) {
  .kiosk-info-spacer { display: block; flex: 1; min-height: 16px; }
}

/* Groups clock+date with the two stat cards so they can sit side by side
   on a compact narrow header (display:contents on landscape un-wraps
   them back into the plain vertical stack the spacer above expects). */
.kiosk-info-bottom-row { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 14px; }
@media (min-width: 820px) {
  .kiosk-info-bottom-row { display: contents; }
}

.kiosk-clock-block { line-height: 1; }
.kiosk-clock-time {
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.kiosk-clock-date { margin-top: 6px; font-size: 0.9rem; color: var(--muted); font-weight: 500; }

/* Hidden by default (see app/weather.js) — only ever shown once a real
   reading has loaded, never as a loading/placeholder state. */
.kiosk-weather {
  display: none;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}
.kiosk-weather-now { display: flex; align-items: center; gap: 6px; }
.kiosk-weather-icon { font-size: 1.05rem; line-height: 1; }
.kiosk-weather-temp { font-weight: 700; color: var(--text); }
/* Today's noon/5pm only — hidden entirely by app/weather.js if both have
   already passed today, rather than shown empty. */
.kiosk-weather-forecast { display: flex; gap: 12px; font-size: 0.82rem; }
.kiosk-weather-slot { color: var(--muted); }

.kiosk-stats-row { display: flex; gap: 10px; }
.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow-card);
  min-width: 84px;
}
@media (min-width: 820px) {
  .stat-card { flex: 1; padding: 14px 16px; }
}
.stat-card-number { font-size: 1.4rem; font-weight: 700; color: var(--text); line-height: 1.1; }
.stat-card-label { font-size: 0.74rem; color: var(--muted); font-weight: 600; }
@media (min-width: 820px) {
  .stat-card-number { font-size: 1.7rem; }
}
/* A stat card that opens a read-only list (see #onsite-modal-overlay) —
   resets the default <button> chrome back to plain .stat-card styling,
   then adds just enough affordance (cursor, hover/active) to read as
   tappable without looking different from its non-interactive sibling
   at rest. */
.stat-card-button {
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  align-items: flex-start;
  transition: border-color 120ms ease, transform 100ms ease;
}
.stat-card-button:active { transform: scale(0.97); }
@media (hover: hover) {
  .stat-card-button:hover { border-color: #c7c7cc; }
}

/* ===== Kiosk home: main column (greeting + actions) ===== */
.kiosk-main-col {
  display: flex;
  flex-direction: column;
  /* Top-aligned so the greeting sits level with the info column's brand
     row (both are the first child of sibling flex columns starting at
     the same y-position) — reads as one unified header line across the
     full width, not a main column that's vertically centered independent
     of the info column beside it. Any surplus height on a tall viewport
     collects below the actions, same reasoning as the rest of this
     layout: normal breathing room, not a symptom of content "floating". */
  justify-content: flex-start;
  gap: 20px;
  flex: 1;
  min-width: 0;
}

.kiosk-intro { text-align: left; }
.kiosk-intro h1 {
  margin: 0 0 4px;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.kiosk-intro-sub { margin: 0; color: var(--muted); font-size: 1.02rem; }
.kiosk-intro .sync-line { margin-top: 8px; text-align: left; }

.kiosk-choices { display: flex; flex-direction: column; gap: 14px; }
.staff-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) {
  .staff-choices { grid-template-columns: 1fr; }
}

/* The two primary action cards — deliberately neutral (charcoal / white),
   not colour-coded green/red: before either is tapped, signing in and
   signing out are equally valid, everyday choices, not a "safe" option
   and a "danger" option. Colour is reserved for actual status afterwards
   (see .result-icon / .status-badge on the confirmation screens). */
.action-card {
  border: 1.5px solid transparent;
  border-radius: 20px;
  padding: 22px;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  text-align: left;
  gap: 20px;
  /* Scales with viewport HEIGHT, same reasoning as the previous kiosk-btn
     sizing: a short phone, a tall tablet portrait and a wide-but-short
     tablet landscape each get cards proportioned to their own available
     space instead of one fixed size. */
  min-height: clamp(200px, 32vh, 400px);
  box-shadow: var(--shadow-card);
  transition: transform 150ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 150ms ease, border-color 150ms ease;
}
.action-card-icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.action-card-icon svg { width: 22px; height: 22px; }
.action-card-text { display: flex; flex-direction: column; gap: 4px; }
.action-card-title { font-size: clamp(1.35rem, 2.4vw, 1.65rem); font-weight: 600; letter-spacing: -0.01em; }
.action-card-desc { font-size: 0.9rem; font-weight: 500; line-height: 1.35; }

.action-card.clock-in {
  background: linear-gradient(165deg, #27272c, #18181b);
  border-color: #18181b;
  color: #fff;
}
.action-card.clock-in .action-card-icon { background: rgba(255, 255, 255, 0.12); color: #fff; }
.action-card.clock-in .action-card-desc { color: rgba(255, 255, 255, 0.66); }

.action-card.clock-out {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}
.action-card.clock-out .action-card-icon { background: #f0f0f2; color: var(--text); }
.action-card.clock-out .action-card-desc { color: var(--muted); }

.action-card:active { transform: scale(0.98) translateY(1px); box-shadow: none; }
@media (hover: hover) {
  .action-card:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(16, 16, 20, 0.16); }
  .action-card.clock-out:hover { border-color: #c7c7cc; }
}

/* Secondary action — clearly reachable but visually deferring to the two
   primary cards above it: an outlined bar, not a third card of equal
   weight. */
.secondary-action {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 24px 20px;
  cursor: pointer;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color 120ms ease, transform 100ms ease;
}
.secondary-action .icon { display: flex; color: var(--muted); flex-shrink: 0; }
.secondary-action .icon svg { width: 26px; height: 26px; }
.secondary-action:active { transform: scale(0.99); }
@media (hover: hover) {
  .secondary-action:hover { border-color: #c7c7cc; }
}
.kiosk-btn-text { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; }
.kiosk-btn-label { line-height: 1.2; font-weight: 600; font-size: 1.05rem; color: var(--text); }
.kiosk-sub { font-size: 0.85rem; font-weight: 500; color: var(--muted); }

/* Short viewports (small phones, e.g. 320x568): the default sizes above
   push content underneath the fixed Admin/Change-site footer, since that
   footer stays pinned to the bottom of the viewport regardless of scroll
   position. Shrinking here (well above the 44px touch-target minimum) is
   what keeps the whole home screen visible without scrolling instead of
   relying on scroll + hoping the fixed footer never lands on content. */
@media (max-height: 700px) {
  .hero-card { padding: 14px 20px; margin-bottom: 10px; }
  .hero-card h1 { font-size: clamp(1.4rem, 5vw, 2rem); margin: 4px 0; }
  .kiosk-shell { gap: 12px; }
  .kiosk-info-col { padding: 10px 14px; gap: 8px; }
  .kiosk-clock-time { font-size: clamp(1.5rem, 5vw, 2.1rem); }
  .kiosk-clock-date { margin-top: 2px; font-size: 0.8rem; }
  .kiosk-intro h1 { font-size: clamp(1.3rem, 5vw, 1.7rem); }
  .kiosk-choices { gap: 8px; }
  .staff-choices { gap: 8px; }
  .action-card { min-height: 128px; padding: 14px; gap: 10px; }
  .action-card-icon { width: 36px; height: 36px; border-radius: 10px; }
  .action-card-icon svg { width: 18px; height: 18px; }
  .action-card-title { font-size: 1.15rem; }
  .action-card-desc { font-size: 0.8rem; }
  .secondary-action { padding: 20px 16px; }
}
/* The shortest realistic target (e.g. 320x568) needs a further step down
   — even the compaction above still leaves the clamp()'d card heights
   too tall to fit everything above the fixed footer without overlap. */
@media (max-height: 600px) {
  .kiosk-info-col { padding: 8px 12px; gap: 6px; }
  .kiosk-brand-sub { display: none; }
  .kiosk-clock-time { font-size: 1.3rem; }
  .kiosk-stats-row { gap: 6px; }
  .stat-card { padding: 6px 10px; min-width: 64px; }
  .stat-card-number { font-size: 1.05rem; }
  .kiosk-intro h1 { font-size: 1.1rem; margin-bottom: 2px; }
  .kiosk-intro-sub { font-size: 0.85rem; }
  .sync-line { font-size: 0.78rem; }
  .action-card { min-height: 84px; padding: 10px; }
}

/* Below this width the two action cards STACK (one column, see
   .staff-choices above) — meaning two of them now compete for the same
   vertical space one used to. The height-based clamp() alone (tuned for
   cards side by side) would leave each one still tall enough to overflow
   a normal phone in portrait even though its height is "tall" by the
   max-height tiers' standards. Deliberately does NOT touch
   .kiosk-info-col/clock/stats sizing here — those are already governed
   by height (the max-height tiers above), and redeclaring them at this
   width too would just fight that: whichever rule is later in the file
   wins regardless of which media condition is "more specific", so two
   independent tiers must compact DIFFERENT properties, not the same
   ones, or a viewport matching both (narrow AND short) gets whichever
   was written last rather than the more compact of the two. Positioned
   AFTER the .action-card base rule (and after the max-height tiers
   above) on purpose, for the same reason — source order must put this
   last so it always wins over the wider default. */
@media (max-width: 560px) {
  .action-card { min-height: clamp(112px, 17vh, 220px); }
}

/* The overlap of both constraints at once (a short AND narrow phone,
   e.g. 375x667) needs more than either tier alone provides — two stacked
   cards plus a full info header is a lot to fit under ~700px. Last in
   the file on purpose: this must win outright over both tiers above for
   viewports matching all three conditions. */
@media (max-width: 560px) and (max-height: 700px) {
  .kiosk-info-col { padding: 8px 12px; gap: 6px; }
  .kiosk-brand-sub { display: none; }
  .kiosk-clock-time { font-size: 1.5rem; }
  .kiosk-clock-date { font-size: 0.76rem; margin-top: 0; }
  .kiosk-stats-row { gap: 6px; }
  .stat-card { padding: 6px 10px; min-width: 64px; }
  .stat-card-number { font-size: 1.1rem; }
  .kiosk-site-name { font-size: 1.05rem; }
  .action-card { min-height: 100px; padding: 12px; gap: 8px; }
  .action-card-icon { width: 32px; height: 32px; border-radius: 9px; }
  .action-card-icon svg { width: 16px; height: 16px; }
  .action-card-title { font-size: 1.05rem; }
  .action-card-desc { font-size: 0.76rem; }
  .secondary-action { padding: 19px 16px; }
}

/* Top-anchored, same as every other kiosk screen — not centered in the
   full viewport height, so it reads as one continuous flow (header, then
   the site grid) instead of floating with big voids above and below on
   a tall tablet. */
#view-site.active { padding-top: 6vh; }

.site-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.site-card {
  position: relative;
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: var(--radius-card);
  padding: 20px 14px;
  min-height: 140px;
  font-size: 1.05rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  opacity: 0;
  animation: atl-pop-in 320ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: var(--pop-delay, 0ms);
  transition: transform 150ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 150ms ease, border-color 150ms ease;
}
/* One restrained, neutral treatment for every card — no per-card accent
   rotation. A row of same-coloured "stickers" read as more decorative
   than informative; the selected state (below) is what actually needs
   to stand out. */
.site-icon-badge {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #f0f0f2;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.site-icon-badge svg { width: 24px; height: 24px; }
.site-name { line-height: 1.25; }
.site-check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--text);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 150ms ease, transform 150ms ease;
}
.site-card:active { transform: scale(0.97); }
@media (hover: hover) {
  .site-card:hover { border-color: #c7c7cc; transform: translateY(-2px); box-shadow: var(--shadow-card); }
}
.site-card.selected { border-color: var(--text); background: #f6f6f7; box-shadow: var(--shadow-card); }
.site-card.selected .site-icon-badge { background: var(--text); color: #fff; }
.site-card.selected .site-check { opacity: 1; transform: scale(1); }

#btn-site-continue {
  margin-top: 18px;
  opacity: 0.5;
  transform: translateY(8px);
  transition: opacity 220ms ease, transform 220ms ease;
}
#btn-site-continue.visible { opacity: 1; transform: translateY(0); }

/* Face-scan screen's PIN fallback link — plain, low-emphasis text, not a
   button, since it's a secondary path most people never need. */
.scan-pin-fallback { text-align: center; margin: 4px 0 0; }
.scan-pin-fallback a {
  color: var(--muted);
  font-size: 0.92rem;
  text-decoration: underline;
  padding: 10px 6px; /* real tap target despite the small visible text */
  margin: -10px -6px;
  display: inline-block;
}
.scan-pin-fallback a:hover, .scan-pin-fallback a:active { color: var(--text); }

/* PIN sign-in (#view-staff-pin) */
.pin-dots {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 32px 0 8px;
}
.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: transparent;
  transition: background 120ms ease, border-color 120ms ease;
}
.pin-dot.filled { background: var(--text); border-color: var(--text); }
.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 320px;
  margin: 20px auto 0;
}
.pin-key {
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: #fff;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 120ms ease, transform 100ms ease;
}
.pin-key:active { transform: scale(0.94); }
@media (hover: hover) {
  .pin-key:hover { border-color: #c7c7cc; }
}
.pin-key-backspace { font-size: 1.2rem; color: var(--muted); }

.footer-link {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  text-align: center;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(transparent, var(--bg) 40%);
}
.footer-link a {
  display: inline-block;
  /* Was color: var(--muted) at opacity: 0.75 — that combination measured
     3.34:1 against the page background under axe-core (WCAG AA needs
     4.5:1 for this text size). Full-opacity var(--muted), the same as
     every other secondary/subtitle text in the app, already passes. */
  color: var(--muted);
  font-size: 0.8rem;
  text-decoration: none;
  /* The visible text stays small on purpose (this is a secondary, rarely
     used link) but the actual tappable area still needs to clear a real
     touch target — padding does that without inflating the text itself. */
  padding: 14px 10px;
  margin: -14px -10px;
  min-height: 44px;
  box-sizing: border-box;
}
.footer-link a:hover, .footer-link a:active { color: var(--text); }
/* keep page content from being hidden behind the fixed footer bar */
#view-home, #view-login, #view-site { padding-bottom: 44px; }

/* Short viewports: a fixed-position footer can't adapt to how tall the
   content above it happens to be — and that height genuinely varies with
   real data (e.g. the on-site-summary line's text length). Rather than
   trying to precisely budget pixels so everything always juuust fits
   (fragile — breaks again the next time any content on this screen
   changes), the footer stops being fixed here and simply becomes the
   last thing on the page, the way a normal footer behaves — guaranteeing
   it can never overlap anything, instead of merely making overlap less
   likely. This must come after the base .footer-link/padding-bottom
   rules above (same selector specificity — later wins), not before. */
@media (max-height: 700px) {
  .footer-link { position: static; background: none; margin-top: 12px; }
  #view-home, #view-login, #view-site { padding-bottom: 0; }
}

.install-banner {
  width: 100%;
  margin-top: 14px;
  padding: 12px;
  border: none;
  border-radius: 14px;
  background: var(--text);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}
.install-hint {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 14px;
  background: #eef2ff;
  color: #33396b;
  font-size: 0.88rem;
  text-align: center;
}
/* Buttons */
.btn-red, .btn-yellow, .btn-black, .btn-light, .btn-green {
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 100ms ease, opacity 100ms ease, box-shadow 100ms ease;
}
button:active:not(:disabled) { transform: scale(0.97); box-shadow: none; }
.btn-red { background: linear-gradient(155deg, var(--red), var(--red-dark)); color: #fff; }
.btn-yellow { background: linear-gradient(155deg, var(--yellow), var(--yellow-dark)); color: var(--text); }
.btn-black { background: linear-gradient(165deg, #27272c, #18181b); color: #fff; }
.btn-light { background: #fff; color: var(--text); border: 1.5px solid var(--line); box-shadow: none; }
.btn-light:active:not(:disabled) { background: #f6f6f8; }
.btn-green { background: linear-gradient(155deg, #1c8449, var(--green)); color: #fff; }
button:disabled {
  background: #e2e2e6 !important;
  color: #9a9aa2 !important;
  cursor: not-allowed;
  box-shadow: none !important;
  border-color: transparent !important;
}
button.small { padding: 10px 14px; font-size: 0.9rem; }
.btn-block { width: 100%; }
.btn-icon { display: inline-flex; vertical-align: -3px; margin-right: 2px; }
.btn-icon svg { width: 16px; height: 16px; }

/* Admin is a back-office tool, used mostly with a mouse/keyboard on a
   desktop or office tablet — not a walk-up public touchscreen, so its
   buttons don't need the kiosk's oversized touch-target padding. Scoped
   to body.admin-page, which never contains a .kiosk-btn, so this can't
   affect the kiosk screens at all. */
body.admin-page .btn-red,
body.admin-page .btn-yellow,
body.admin-page .btn-black,
body.admin-page .btn-light,
body.admin-page .btn-green {
  padding: 11px 16px;
  font-size: 0.92rem;
}

/* Camera / scan view */
.scan-wrap {
  position: relative;
  width: 100%;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: #000;
  aspect-ratio: 4 / 3;
  max-height: 68vh;
  margin: 0 auto 14px;
}
/* Mirrored so the preview behaves like a mirror (move left, your reflection
   moves left) instead of a security-camera feed — this is purely a display
   transform on the <video> element; face-api.js still reads the real,
   unflipped frames from the underlying stream, so detection/matching
   accuracy is completely unaffected. Cropped to a circle sized to
   --guide-size (see .scan-guide below) rather than filling the whole
   dark .scan-wrap — per the Face ID-style dial reference, everything
   outside the circle is plain dark background, not video bleed. */
.scan-wrap video {
  position: absolute;
  top: 50%; left: 50%;
  width: var(--guide-size);
  height: var(--guide-size);
  transform: translate(-50%, -50%) scaleX(-1);
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
@media (min-width: 700px) {
  /* More width to work with once the screen isn't phone-narrow — a wider
     aspect ratio uses that room instead of just growing taller and
     hitting the max-height cap sooner. */
  .scan-wrap { aspect-ratio: 16 / 10; }
}

/* Shown instead of the camera when no staff are enrolled at all — same
   footprint as .scan-wrap (so the layout doesn't jump when one replaces
   the other) but deliberately a light, static card, not a black video
   frame, so it reads as "nothing to see here" rather than "camera
   loading". */
.scan-empty-state {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  border-radius: var(--radius-card);
  background: #fff;
  border: 1.5px solid var(--line);
  aspect-ratio: 4 / 3;
  max-height: 68vh;
  margin: 0 auto 14px;
  padding: 32px;
}
@media (min-width: 700px) {
  .scan-empty-state { aspect-ratio: 16 / 10; }
}
.scan-empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #f0f0f2;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.scan-empty-icon svg { width: 28px; height: 28px; }
.scan-empty-title { margin: 4px 0 0; font-weight: 600; font-size: 1.1rem; color: var(--text); }
.scan-empty-desc { margin: 0; color: var(--muted); font-size: 0.92rem; max-width: 32ch; }

/* Face ID-style circular "dial" capture guide, per direct reference
   images: the live face video (cropped to a circle above) sits inside a
   ring of individual tick marks, with a diagonal light sweep across the
   face while actively scanning. Replaces two earlier attempts (a plain
   circle outline, then a corner-bracket viewfinder) that didn't match
   what was actually being asked for. --guide-size is shared with
   .scan-progress-ring below so the two stay concentric. */
/* vmin, not a %, on purpose: --guide-size is used for BOTH width and
   height on the video/guide/ring below to force a true circle. .scan-wrap
   itself is 4:3 (wider than tall) — a % value would resolve against a
   different axis length for width vs. height (container width vs.
   container height), producing an oval, not a circle. Confirmed as the
   actual cause on a real device, not a hypothetical. vmin is relative to
   the viewport, not the containing block, so it gives the same pixel
   value regardless of which axis it's applied to. */
.scan-wrap { --guide-size: min(62vmin, 300px); }
.scan-guide {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: var(--guide-size);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  overflow: hidden; /* clips the scan-line sweep below to the circle */
  pointer-events: none;
}
/* Diagonal light sweep across the face — purely a "actively reading"
   motion cue, not a real scan mechanism. mix-blend-mode lets it read as
   a highlight over the video showing through .scan-guide's transparent
   background, rather than an opaque band sitting on top of it. */
.scan-guide::after {
  content: '';
  position: absolute;
  inset: -20%;
  background: linear-gradient(115deg, transparent 42%, rgba(56, 189, 248, 0.55) 50%, transparent 58%);
  background-size: 220% 220%;
  animation: atl-scan-sweep 2.6s linear infinite;
  mix-blend-mode: screen;
}
@keyframes atl-scan-sweep {
  0% { background-position: 110% 110%; }
  100% { background-position: -10% -10%; }
}
.scan-wrap.scan-wrap-error .scan-guide::after { animation: none; opacity: 0; }

/* Enrollment-only: a ring of individual tick marks (not a smooth arc)
   around the guide circle, each turning from white to green as
   --ring-progress (a degree value, set from app/admin.js) sweeps past
   it. Not used on the kiosk sign-in scan screen, which has no discrete
   photo-count progress to show (it scans continuously until a match).
   Two masks intersected: a repeating-conic-gradient of short wedges (the
   tick shape/spacing) and a radial-gradient ring band (the tick
   length) — together they reveal the element's own conic-gradient
   background (the white-to-green colour transition) only where an
   actual tick sits, which is what makes individual ticks appear to
   "turn green" as progress crosses them, with no per-tick markup/JS. */
.scan-progress-ring {
  position: absolute;
  top: 50%; left: 50%;
  width: calc(var(--guide-size) + 44px);
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%) rotate(-90deg);
  border-radius: 50%;
  background: conic-gradient(#34d399 var(--ring-progress, 0deg), rgba(255, 255, 255, 0.55) 0deg);
  -webkit-mask-image:
    repeating-conic-gradient(#000 0deg 3deg, transparent 3deg 9deg),
    radial-gradient(farthest-side, transparent calc(100% - 16px), #000 calc(100% - 16px));
  mask-image:
    repeating-conic-gradient(#000 0deg 3deg, transparent 3deg 9deg),
    radial-gradient(farthest-side, transparent calc(100% - 16px), #000 calc(100% - 16px));
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
  pointer-events: none;
  transition: background 260ms ease;
}
.scan-status {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.65));
  color: #fff;
  text-align: center;
  font-weight: 600;
  transition: background 150ms ease;
}
/* Distinct visual treatment (not just different text) once a camera error
   is showing — a solid red band reads as "stopped, needs attention" at a
   glance, instead of looking like an ordinary in-progress status message. */
.scan-status.scan-status-error {
  background: rgba(122, 20, 20, 0.92);
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.scan-wrap.scan-wrap-error .scan-guide { border-color: rgba(255, 255, 255, 0.25); }

/* Connection-required state: the camera itself is fine (still visible,
   still positioned against) — only matching is failing — so this stays a
   bottom band like the default state, not the full-frame block used for
   an actual camera error. Amber, matching the app's existing "needs
   attention but not broken" color language (.sync-warn). */
.scan-status.scan-status-connection {
  background: linear-gradient(transparent, rgba(122, 86, 0, 0.88));
}

.tech-details {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  margin: 12px 0;
  font-size: 0.85rem;
}
.tech-details summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.tech-details pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.75rem;
  background: #f6f6f8;
  border-radius: 10px;
  padding: 10px;
  margin: 10px 0;
  max-height: 240px;
  overflow-y: auto;
}

.result-card {
  background: #fff;
  border-radius: var(--radius-card);
  padding: 26px 24px;
  text-align: center;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  animation: atl-pop-in 260ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes atl-pop-in {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
.result-card.match { border-color: var(--green); }
.result-card.out { border-color: var(--red-dark); }
.result-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  animation: atl-pop-in 320ms cubic-bezier(0.34, 1.56, 0.64, 1) 80ms both;
}
.result-icon svg { width: 32px; height: 32px; }
.result-icon.in { background: #e4f6ec; color: var(--green); }
.result-icon.out { background: #fdeaea; color: var(--red-dark); }
.result-card h2 { margin: 0 0 6px; }
.result-card .status-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 999px;
  font-weight: 700;
  margin-bottom: 10px;
  /* Visual emphasis via CSS, not by writing "CLOCK IN" into the actual
     text content — some screen readers spell out all-caps text letter by
     letter instead of reading it as a word, and the underlying text
     should stay normal sentence case regardless of how it's styled. */
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.status-badge.in { background: #e4f6ec; color: var(--green); }
.status-badge.out { background: #fdeaea; color: var(--red); }

/* Forms (visitor / admin) */
.form-card {
  background: #fff;
  border-radius: var(--radius-card);
  padding: 18px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.form-card h3 { margin-top: 0; }
.step-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
  margin: 18px 0 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.step-label:first-of-type { margin-top: 4px; padding-top: 0; border-top: none; }
.consent-box {
  background: #fff8e6;
  border: 1px solid #f0deac;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 500 !important;
  font-size: 0.9rem !important;
  display: flex !important;
  align-items: center;
  gap: 10px;
}
label { display: block; margin-bottom: 12px; font-weight: 600; font-size: 0.95rem; }
/* Plain native checkboxes (13px, unstyled) are hard to hit accurately on
   a tablet — every checkbox in the app is a consent/toggle the admin
   taps deliberately, so size and brand-color them like the rest of the
   touch targets here instead of leaving browser defaults. */
input[type='checkbox'] {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  margin: 0;
  accent-color: var(--red);
  cursor: pointer;
}
input, select, textarea {
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 1rem;
  font-family: inherit;
}
.toggle-row { display: flex; gap: 10px; }
.toggle-row button { flex: 1; transition: background 120ms ease, color 120ms ease; }
.toggle-row button.selected { background: var(--red-dark); color: #fff; }
.toggle-row button.selected.in { background: var(--green); color: #fff; }
.toggle-row button.selected.out { background: var(--red); color: #fff; }

.chip-select {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}
.chip-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 10px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--text);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease, transform 120ms ease;
}
.chip-icon { font-size: 1.3rem; display: flex; }
.chip-icon svg { width: 20px; height: 20px; }
.chip-option:active { transform: scale(0.97); }
@media (hover: hover) {
  .chip-option:not(.selected):hover { border-color: #c7c7cc; }
}
.chip-option.selected {
  border-color: var(--text);
  background: var(--text);
  color: #fff;
}

.field-hint {
  min-height: 1.2em;
  color: var(--red-dark);
  font-weight: 600;
  font-size: 0.88rem;
  margin: -4px 0 0;
}
#caps-lock-hint.field-hint { color: #91720b; margin-bottom: 8px; }

.password-field { position: relative; display: block; }
.password-field input { padding-right: 64px; }
.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 6px 10px;
  cursor: pointer;
  min-height: 32px;
}

/* Sign-out: pick your name from who's currently in, instead of retyping
   the whole form you already filled in on the way in. */
.person-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}
.person-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  cursor: pointer;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}
.person-row-name { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.person-row-sub { font-size: 0.85rem; color: var(--muted); }
.person-row:active { transform: scale(0.98); }
@media (hover: hover) {
  .person-row:hover { border-color: #c7c7cc; box-shadow: var(--shadow-card); }
}
/* Plain, non-interactive variant for the read-only "who's on site" list
   (#onsite-modal-overlay) — same card look, but no pointer/hover/active
   affordance, since tapping a row here does nothing (deliberately: no
   sign-out from this view). */
.person-row.readonly { cursor: default; }
.person-row.readonly:active { transform: none; }
@media (hover: hover) {
  .person-row.readonly:hover { border-color: var(--line); box-shadow: var(--shadow-sm); }
}

.sticky-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--bg);
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom, 0px));
  margin-top: auto;
}
.sticky-bar .btn-block {
  width: auto;
  flex: 1;
}

/* Admin navigation — a plain-flex icon+label tab bar that scrolls
   horizontally on narrow screens (kept reachable via a sticky top position
   so the active tab is never lost while scrolling a long table) and
   becomes a real left sidebar once there's room, via .admin-layout below.
   Deliberately its own component (not a restyle of the generic
   .toggle-row utility, which is still used for several unrelated button
   rows elsewhere in admin.html/admin.js). */
body.admin-page #app-shell { max-width: 900px; }
@media (min-width: 900px) {
  body.admin-page #app-shell { max-width: 1180px; }
  /* The wider shell above is meant for the tabbed admin dashboard
     (.admin-layout) only — the sign-in screen is a single centered card
     and would look stretched and hard to scan at 1180px. */
  body.admin-page #view-login .hero-card,
  body.admin-page #view-login .form-card {
    max-width: 440px;
    margin-left: auto;
    margin-right: auto;
  }
}

.admin-layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}
@media (min-width: 900px) {
  .admin-layout { flex-direction: row; align-items: flex-start; gap: 24px; }
}

.admin-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  position: sticky;
  top: 0;
  z-index: 5;
  background: linear-gradient(var(--bg), var(--bg) 70%, transparent);
  padding: 4px 2px 10px;
  margin: 0 -2px;
  /* Fades the last visible tab's trailing edge so a horizontally-scrollable
     bar reads as "more to the right" rather than looking like the full,
     final set of tabs — mask-image degrades harmlessly to a hard edge on
     browsers that don't support it (still scrollable either way). */
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), rgba(0, 0, 0, 0.25));
  mask-image: linear-gradient(to right, #000 calc(100% - 28px), rgba(0, 0, 0, 0.25));
}
.admin-tabs::-webkit-scrollbar { display: none; }
@media (min-width: 900px) {
  .admin-tabs { -webkit-mask-image: none; mask-image: none; }
}
@media (min-width: 900px) {
  .admin-tabs {
    flex-direction: column;
    flex: 0 0 210px;
    position: sticky;
    top: 16px;
    background: none;
    padding: 0;
    overflow-x: visible;
  }
}

.admin-tab-btn {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease, transform 100ms ease;
}
.admin-tab-btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.admin-tab-btn:active { transform: scale(0.97); }
@media (hover: hover) {
  .admin-tab-btn:hover { border-color: #c7c7cc; color: var(--text); }
}
.admin-tab-btn.selected { background: var(--text); border-color: var(--text); color: #fff; }
.admin-tab-btn .tab-sub { opacity: 0.7; font-weight: 600; }
@media (min-width: 900px) {
  .admin-tab-btn { width: 100%; }
}

.admin-content { min-width: 0; flex: 1; }

/* On-site list / dashboard */
.roster-table { width: 100%; min-width: 560px; border-collapse: collapse; background: #fff; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-sm); }
.roster-table th, .roster-table td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.roster-table th { background: #f6f6f8; font-weight: 700; text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.03em; color: var(--muted); white-space: nowrap; }
.roster-table tbody tr:hover { background: #fafafc; }
.roster-table tbody tr:last-child td { border-bottom: none; }
/* Every loading/empty/error placeholder row in this app uses a single
   colspan cell spanning the whole table (a real data row never sets
   colspan) — styling that pattern generically gives every table a
   consistent, calmer "nothing to show yet" look without needing a class
   on each one individually. */
.roster-table td[colspan] {
  text-align: center;
  color: var(--muted);
  padding: 22px 12px;
  font-size: 0.9rem;
}
.roster-table tr.long-open { background: #fff8e6; }
.roster-table tr.long-open td:first-child { border-left: 3px solid #b8860b; }
.duration-warning { color: #91720b; font-weight: 700; }
.duration-warning::before { content: '⚠ '; }

.roster-headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.headcount-badge {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}
.roster-site-picker { margin-bottom: 0; flex: 1; min-width: 180px; }

.warning-box {
  background: #fff4e0;
  border: 1px solid #e8b94e;
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 14px;
  font-size: 0.9rem;
}
.warning-box strong { color: #8a5a00; display: block; margin-bottom: 6px; }

/* Phase 2 shadow data — visually distinct from .warning-box (amber,
   "something needs attention") since this isn't a warning, it's a
   standing reminder that the whole panel is inert/non-authoritative. */
.shadow-banner {
  background: #eaf1ff;
  border: 1px solid #a9c4f5;
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 14px;
  font-size: 0.9rem;
}
.shadow-banner strong { color: #2a4a8f; display: block; margin-bottom: 4px; }
.pill.shadow { background: #eaf1ff; color: #2a4a8f; }
.pill.pending { background: #f0f0f0; color: #555; }
.pill.revoked { background: #ffe0e0; color: #a02020; }
@media print {
  /* Muster print view: only the muster panel's content is meant to be
     printed during an incident — everything else (nav, other tabs, the
     shadow-data banner itself, action buttons) is noise on a printed
     sign-in sheet. */
  body.printing-muster .no-print {
    display: none !important;
  }
}

.roster-table tr.needs-attention { background: #fff4e0; }

/* Offline muster snapshot warning — deliberately loud (not just another
   .warning-box) since this is a safety-critical "the data on screen may
   not reflect who is actually on site right now" state, and must be
   impossible to miss during a real emergency. Left visible in print
   output on purpose (no .no-print class) — a printed muster taken while
   offline must carry this warning too. */
.offline-banner {
  background: #7a1414;
  color: #fff;
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 14px;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
}

.pairing-code {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  background: #f6f6f8;
  border-radius: 8px;
  padding: 2px 8px;
  display: inline-block;
}
.roster-table td button + button { margin-left: 6px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; }
.pill.employee { background: #e8edff; color: #3b4fb0; }
.pill.visitor { background: #fff4d9; color: #91720b; }
.pill.lorry { background: #ffe6d9; color: #b0521f; }

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 600;
}
.toast.hidden { display: none; }
.muted { color: var(--muted); font-size: 0.85rem; }

.sync-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.sync-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #f6f6f8;
  border-radius: 12px;
  padding: 12px 14px;
}
.sync-stat-label { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.sync-stat-value { font-size: 1.15rem; font-weight: 700; color: var(--text); }

/* Discard is a one-way, unrecoverable action (the record was never saved
   to the server) — visually distinct from the ordinary btn-light Retry
   next to it, on purpose, so the two are never confused at a glance. */
.btn-discard {
  background: #fdeaea;
  color: var(--red-dark);
  border: 1.5px solid #f3c6c6;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  padding: 8px 14px;
}
.btn-discard:hover { background: var(--red); color: #fff; border-color: var(--red); }

/* .edit-time-overlay/.edit-time-box (app/admin.js's manual time-
   correction modal) share these rules but are deliberately NOT also
   named .modal-overlay/.modal-box — an existing test
   (admin-sync.spec.js) locates the discard-confirmation modal via the
   bare `.modal-box` selector on the assumption exactly one exists at a
   time; the edit-time modal is permanently present in the DOM (just
   display:none), which would make that a two-element match. */
.modal-overlay, .edit-time-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 16, 20, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}
.modal-box, .edit-time-box {
  background: #fff;
  border-radius: var(--radius-card);
  padding: 22px;
  max-width: 440px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}
.modal-box h3, .edit-time-box h3 { margin-top: 0; }
/* Section divider inside the read-only "who's on site" modal (see
   #onsite-modal-overlay), when both staff and visitors are shown
   together — same eyebrow-label treatment as .kiosk-site-label. */
.onsite-modal-section-label {
  margin: 4px 0 -2px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.onsite-modal-section-label:first-child { margin-top: 0; }
.modal-summary {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.9rem;
}
.modal-summary th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  padding: 4px 10px 4px 0;
  vertical-align: top;
  white-space: nowrap;
}
.modal-summary td { padding: 4px 0; word-break: break-word; }
