
/* Layout: a single gatehouse-sign column — big two-way choice up top, the form below, today's log at the bottom. */
:root {
  --bg: #eef1ec;
  --surface: #ffffff;
  --ink: #18221b;
  --muted: #5b6a5f;
  --line: #d3dbd4;
  --accent: #1f5f3f;
  --accent-ink: #ffffff;
  --out: #a6461e;
  --out-ink: #ffffff;
  --on-site: #17663e;
  --on-site-bg: #dcefe3;
  --left-bg: #ebe7e2;
  --display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --body: "Familjen Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111713; --surface: #1a221c; --ink: #e6ede7; --muted: #95a59a; --line: #2c3830;
    --accent: #4fb07e; --accent-ink: #0c140f; --out: #e07a4c; --out-ink: #1a0d06;
    --on-site: #7fd3a3; --on-site-bg: #1d3626; --left-bg: #262a26; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111713; --surface: #1a221c; --ink: #e6ede7; --muted: #95a59a; --line: #2c3830;
  --accent: #4fb07e; --accent-ink: #0c140f; --out: #e07a4c; --out-ink: #1a0d06;
  --on-site: #7fd3a3; --on-site-bg: #1d3626; --left-bg: #262a26; color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 28px 48px;
}
.wrap { max-width: 560px; margin: 0 auto; display: grid; gap: 28px; }
header { display: grid; gap: 4px; }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
h1 { font-family: var(--display); font-weight: 800; font-size: clamp(40px, 11vw, 60px); line-height: .95; margin: 0; text-transform: uppercase; letter-spacing: .01em; text-wrap: balance; }
h2 { font-family: var(--display); font-weight: 700; font-size: 26px; text-transform: uppercase; margin: 0; letter-spacing: .02em; }
.lede { color: var(--muted); margin: 6px 0 0; }

.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice button {
  font-family: var(--display); font-weight: 800; font-size: 30px; text-transform: uppercase; letter-spacing: .03em;
  border: 2px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 22px 12px 18px; border-radius: 6px; cursor: pointer; display: grid; gap: 2px; justify-items: center;
}
.choice button small { font-family: var(--body); font-weight: 500; font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--muted); }
.choice button[aria-pressed="true"].in { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.choice button[aria-pressed="true"].out { background: var(--out); border-color: var(--out); color: var(--out-ink); }
.choice button[aria-pressed="true"] small { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 22px 20px; display: grid; gap: 16px; }
form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 15px; }
label span.opt { font-weight: 400; color: var(--muted); }
input, select {
  font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 12px; width: 100%;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .row2 { grid-template-columns: 1fr; } }
.primary {
  font: inherit; font-weight: 600; font-size: 17px; border: 0; border-radius: 4px; padding: 15px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink);
}
.primary.out { background: var(--out); color: var(--out-ink); }
.primary:disabled { background: var(--line); color: var(--muted); cursor: default; }
.hint { color: var(--muted); font-size: 14px; margin: 0; }

.pass { border: 2px dashed var(--line); border-radius: 6px; padding: 18px; display: grid; gap: 6px; text-align: center; }
.pass .big { font-family: var(--display); font-weight: 800; font-size: 34px; text-transform: uppercase; line-height: 1; }
.pass .time { font-family: var(--mono); font-size: 14px; color: var(--muted); }

.onsite-list { display: grid; gap: 8px; }
.onsite-list button {
  font: inherit; text-align: left; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 12px 14px; cursor: pointer; color: var(--ink);
}
.onsite-list button[aria-pressed="true"] { border-color: var(--out); box-shadow: inset 0 0 0 1px var(--out); }
.onsite-list .who { min-width: 0; }
.onsite-list .who b { display: block; overflow-wrap: anywhere; }
.onsite-list .who span { color: var(--muted); font-size: 14px; }
.mono { font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.log-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.count { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.count b { color: var(--on-site); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 460px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
tr:last-child td { border-bottom: 0; }
td .sub { color: var(--muted); font-size: 13px; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill.on { background: var(--on-site-bg); color: var(--on-site); }
.pill.off { background: var(--left-bg); color: var(--muted); }
.pill.late { background: var(--out); color: var(--out-ink); }
.empty { padding: 22px; text-align: center; color: var(--muted); }
.status { font-size: 14px; color: var(--out); margin: 0; }
.daypick { display: flex; gap: 8px; align-items: center; }
.daypick input { width: auto; padding: 8px 10px; font-size: 14px; }
@media (prefers-reduced-motion: no-preference) { .choice button, .primary { transition: background .15s, border-color .15s, color .15s; } }

.topbar { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; }
.ghost { font:inherit; font-size:14px; background:transparent; color:var(--ink); border:1px solid var(--line); border-radius:4px; padding:8px 12px; cursor:pointer; }
.ghost:hover { border-color: var(--muted); }
.qr-card { display:grid; gap:12px; justify-items:center; text-align:center; }
.qr-card #qr { background:#fff; padding:14px; border-radius:6px; line-height:0; }
.qr-card #qr img, .qr-card #qr canvas { width:240px; height:240px; image-rendering:pixelated; }
.url { font-family:var(--mono); font-size:13px; overflow-wrap:anywhere; color:var(--muted); }
@media print {
  body { background:#fff; color:#000; padding:0; }
  .no-print { display:none !important; }
  .print-only { display:grid !important; }
}
.print-only { display:none; }
.sign { place-items:center; text-align:center; gap:24px; padding:40px 0; }
.sign h1 { font-size:96px; color:#000; }
.sign p { font-size:26px; margin:0; color:#000; }
.sign #qr-print img, .sign #qr-print canvas { width:420px; height:420px; image-rendering:pixelated; }

[hidden] { display: none !important; }

.gate-tag { justify-self: start; font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-ink); background: var(--accent); padding: 6px 12px; border-radius: 4px; margin-bottom: 8px; }
.gates { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; min-width: 0; }
.gates legend { font-weight: 600; font-size: 15px; padding: 0; margin-bottom: 6px; }
.gate-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.gate { display: block; cursor: pointer; }
.gate input { position: absolute; opacity: 0; pointer-events: none; }
.gate span { display: block; text-align: center; font-weight: 600; padding: 12px 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg); }
.gate input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.gate input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.foot { text-align: center; padding-top: 8px; }
.foot a { color: var(--muted); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; padding: 8px 12px; display: inline-block; }
.foot a:hover { color: var(--ink); }
.signs { display: none; }
@media print { .signs { display: block; } .sign { page-break-after: always; break-after: page; display: grid !important; } .sign:last-child { page-break-after: auto; break-after: auto; } }

.qr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.qr-name { font-family: var(--display); font-weight: 700; font-size: 20px; text-transform: uppercase; margin: 0; }
.qr-card .qr { background: #fff; padding: 12px; border-radius: 6px; line-height: 0; }
.qr-card .qr img { width: 150px; height: 150px; image-rendering: pixelated; }
.sign .sign-gate { font-family: var(--display); font-weight: 800; font-size: 54px; text-transform: uppercase; }
.sign .qr-print img { width: 420px; height: 420px; image-rendering: pixelated; }
