/* Kiosk clock-in. WCAG 2.2 AA: text contrast 7:1 or better on every colour pair below, targets at
   least 64 px (plan 4.7 UX rule), visible focus, text plus icon on every action, 20 px base type.
   Light scheme only: a shared shop screen is set up once and must look the same for everyone. */
:root {
  --ink: #111827;
  --muted: #374151;
  --line: #4b5563;
  --bg: #ffffff;
  --surface: #f3f4f6;
  --primary: #12305c;
  --primary-ink: #ffffff;
  --in: #0b5d2a;
  --out: #7a1f3d;
  --focus: #1a56db;
  --ok-bg: #e7f5ec; --ok-ink: #0b4a22; --ok-line: #2f7d4b;
  --info-bg: #e6eefb; --info-ink: #12305c; --info-line: #3b5f9a;
  --warn-bg: #fff4d6; --warn-ink: #4d3300; --warn-line: #a86b00;
  --bad-bg: #fde8e8; --bad-ink: #7f1010; --bad-line: #c03030;
  --frame: 70rem;
  --gutter: 16px;
  --radius: 12px;
  --target: 4.5rem;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 125%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.45;
}
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.2; margin: 0 0 0.5rem; }
p { text-wrap: pretty; margin: 0 0 0.75rem; }
h1 { font-size: 1.75rem; }
h1:focus { outline: none; }
[hidden] { display: none !important; }

.frame { width: 100%; max-width: calc(var(--frame) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
@media (min-width: 700px) { :root { --gutter: 32px; } h1 { font-size: 2.1rem; } }

.skip { position: absolute; left: -999px; top: 0; background: var(--primary); color: var(--primary-ink); padding: 0.75rem 1rem; z-index: 10; }
.skip:focus { left: var(--gutter); }

:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; }

/* header */
.top { border-bottom: 2px solid var(--surface); background: var(--bg); padding-top: env(safe-area-inset-top); }
.top-inner {
  max-width: calc(var(--frame) + 2 * var(--gutter)); margin-inline: auto; padding: 0.6rem var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.5rem;
}
.brand { display: flex; align-items: center; min-width: 0; }
.logo { display: block; height: 3rem; width: auto; max-width: 100%; }
.place { text-align: right; }
.place p { margin: 0; }
.site { font-weight: 700; font-size: 1rem; }
.when { color: var(--muted); font-size: 0.9rem; }
.clock { font-size: 1.15rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
@media (max-width: 480px) {
  .logo { height: 2.4rem; }
  .today { display: block; }
}
@media (min-width: 700px) { .logo { height: 3.5rem; } .site { font-size: 1.1rem; } }

/* status line */
.status {
  display: flex; align-items: center; gap: 0.6rem; font-weight: 600; font-size: 1rem;
  padding: 0.7rem max(var(--gutter), calc((100% - var(--frame)) / 2));
  border-bottom: 3px solid transparent;
}
.status span { text-wrap: pretty; }
.status-ok { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok-line); }
.status-info { background: var(--info-bg); color: var(--info-ink); border-color: var(--info-line); }
.status-warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); }
.status-bad { background: var(--bad-bg); color: var(--bad-ink); border-color: var(--bad-line); }

/* icons */
.icon { width: 1.4em; height: 1.4em; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.icon-lg { width: 2.2rem; height: 2.2rem; }
.icon-xl { width: 3.6rem; height: 3.6rem; stroke-width: 2.4; }

/* screens */
main { flex: 1; padding-block: 1.5rem 2rem; }
.screen { display: flex; flex-direction: column; gap: 0.25rem; }
.screen-narrow { max-width: 36rem; }
.lead { font-size: 1.1rem; color: var(--muted); }
.hint { font-size: 0.9rem; color: var(--muted); margin: 0 0 0.4rem; }
.center { text-align: center; }
.notice { display: flex; gap: 0.6rem; align-items: flex-start; background: var(--surface); border-left: 6px solid var(--line); padding: 0.8rem 1rem; border-radius: 6px; font-weight: 600; }
.notice-warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); }
.notice-bad { background: var(--bad-bg); color: var(--bad-ink); border-color: var(--bad-line); margin-top: 0.75rem; }
/* no-storage warning: a full-width band under the status line, text on the page gutter */
#storage-warning {
  max-width: none; margin: 0; border-radius: 0; border-left: 0; border-bottom: 3px solid var(--bad-line);
  padding: 0.7rem max(var(--gutter), calc((100% - var(--frame)) / 2)); text-wrap: pretty;
}
.error { display: flex; gap: 0.6rem; align-items: flex-start; color: var(--bad-ink); background: var(--bad-bg); border-left: 6px solid var(--bad-line); padding: 0.75rem 1rem; border-radius: 6px; font-weight: 600; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  min-height: var(--target); min-width: var(--target); padding: 0.75rem 1.25rem;
  font: inherit; font-size: 1.15rem; font-weight: 700; line-height: 1.2; text-align: center;
  border-radius: var(--radius); border: 3px solid transparent; cursor: pointer;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: 1; background: var(--surface); color: var(--muted); border-color: var(--line); cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-in { background: var(--in); color: #fff; }
.btn-out { background: var(--out); color: #fff; }
.btn-secondary { background: var(--bg); color: var(--ink); border-color: var(--line); align-self: flex-start; margin-top: 1.25rem; }
.btn-wide { width: 100%; }
.btn span, .check-row label { text-wrap: balance; }
.btn:not(:disabled):active { transform: translateY(1px); filter: brightness(0.92); }

/* roster */
.roster { list-style: none; margin: 0.75rem 0 0; padding: 0; display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); }
.btn-name { width: 100%; min-height: 5rem; background: var(--bg); color: var(--ink); border-color: var(--line); font-size: 1.25rem; }
.field { display: flex; flex-direction: column; margin-bottom: 1.1rem; }
.field label { font-weight: 700; margin-bottom: 0.25rem; }
.field input {
  font: inherit; font-size: 1.2rem; min-height: var(--target); padding: 0.5rem 0.9rem;
  border: 3px solid var(--line); border-radius: var(--radius); color: var(--ink); background: var(--bg); width: 100%;
}
.field-search { margin-top: 0.5rem; }

/* clock in / out choice */
.actions { display: grid; gap: 1rem; margin-top: 1rem; grid-template-columns: 1fr; }
@media (min-width: 600px) { .actions { grid-template-columns: 1fr 1fr; } }
.actions .btn { min-height: 8rem; font-size: 1.6rem; flex-direction: column; }

/* PIN */
.screen-pin { max-width: 30rem; margin-inline: auto; width: 100%; align-items: stretch; }
.screen-pin .btn-secondary { align-self: stretch; }
.pin-form { display: flex; flex-direction: column; gap: 1rem; margin-top: 0.5rem; position: relative; }
.pin-label { font-weight: 700; }
.pin-input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; }
.pin-dots { display: flex; justify-content: center; gap: 0.9rem; padding: 0.6rem; border-radius: var(--radius); }
.pin-form:has(.pin-input:focus-visible) .pin-dots { outline: 4px solid var(--focus); outline-offset: 2px; }
.dot { width: 1.3rem; height: 1.3rem; border-radius: 50%; border: 3px solid var(--ink); }
.dot.filled { background: var(--ink); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
.key {
  min-height: var(--target); font: inherit; font-size: 1.7rem; font-weight: 700; color: var(--ink);
  background: var(--surface); border: 3px solid var(--line); border-radius: var(--radius); cursor: pointer;
  display: flex; align-items: center; justify-content: center; touch-action: manipulation;
}
.key-text { font-size: 1.05rem; }
.key .icon { width: 2rem; height: 2rem; }
.key:active { background: #e5e7eb; }

/* confirmation */
.screen-done { align-items: center; text-align: center; max-width: 40rem; margin-inline: auto; padding-top: 1rem; }
.screen-done .btn { margin-top: 1rem; max-width: 24rem; }
.done-mark { width: 7rem; height: 7rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-bottom: 1rem; border: 4px solid; }
.done-ok .done-mark { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok-line); }
.done-warn .done-mark { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); }
.done-bad .done-mark { background: var(--bad-bg); color: var(--bad-ink); border-color: var(--bad-line); }

/* non-memory alternatives on the PIN screen */
.alt-help { margin-top: 0.25rem; text-align: center; font-size: 1rem; }
.btn-badge { background: var(--bg); color: var(--primary); border-color: var(--primary); min-height: 5rem; margin-top: 0.5rem; }

/* badge scan */
.badge-frame { position: relative; width: 100%; aspect-ratio: 4 / 3; background: var(--ink); border-radius: var(--radius); overflow: hidden; margin: 0.5rem 0 0.75rem; }
.badge-video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.badge-target { position: absolute; inset: 18% 24%; border: 4px solid #ffffff; border-radius: 10px; box-shadow: 0 0 0 999px rgba(17, 24, 39, 0.35); }
.screen-badge .btn-primary { margin-top: 0.5rem; }

/* extendable time limit (WCAG 2.2 SC 2.2.1) */
.timeout {
  position: fixed; inset: auto 0 0 0; z-index: 20; background: var(--bg); color: var(--ink);
  border-top: 6px solid var(--warn-line); box-shadow: 0 -8px 24px rgba(17, 24, 39, 0.25);
  padding: 1.25rem var(--gutter) calc(1.25rem + env(safe-area-inset-bottom));
}
/* matches the PIN and badge column (.screen-pin) so the dialog lines up with the screen it covers */
.timeout-inner { max-width: 30rem; margin-inline: auto; display: flex; flex-direction: column; gap: 0.25rem; }
.timeout-title { font-size: 1.5rem; font-weight: 700; line-height: 1.2; text-wrap: balance; margin: 0 0 0.25rem; }
.timeout-body { font-size: 1.1rem; color: var(--muted); }
#timeout-more { min-height: 5.5rem; font-size: 1.4rem; margin-top: 0.5rem; }

/* device check (unreadable saved records) */
.notice-action { align-items: flex-start; margin: 0.75rem 0 0.25rem; }
.notice-action p { margin: 0 0 0.5rem; }
.notice-ok { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok-line); margin-top: 0.75rem; }
.btn-inline { margin-top: 0; align-self: flex-start; }
.step { font-size: 1.25rem; margin-top: 1.5rem; }
.check-list { margin: 0.25rem 0 0.5rem; padding-left: 1.25rem; font-weight: 600; }
.check-list li { margin-bottom: 0.25rem; }
.check-row { display: flex; align-items: center; gap: 0.9rem; min-height: var(--target); margin-bottom: 0.75rem; }
.check-row label { font-weight: 600; }
.check-box { width: 2.2rem; height: 2.2rem; flex: none; accent-color: var(--primary); margin: 0; }

/* form */
.form { margin-top: 1rem; }

.foot { color: var(--muted); font-size: 0.85rem; padding-block: 0.75rem calc(0.75rem + env(safe-area-inset-bottom)); border-top: 2px solid var(--surface); }
.foot p { margin: 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
