/* Tablet screens: high contrast for daylight, large targets for gloves (R6). Light theme only: outdoor glare.
   D74: the ResortHuddle look, near white and near black with grey outline icons; colour only where it means something
   (levels, recording, a report sent back). */
:root {
    color-scheme: light;
    --bg: #fafafa;
    --surface: #ffffff;
    --ink: #111111;
    --muted: #5c5c5c;
    --line: #d4d4d4;
    --rule: #e8e8e8;
    --icon: #555555;
    --navy: #1c1c1c;
    --navy-ink: #ffffff;
    --brand: #1c1c1c;
    --brand-dark: #000000;
    --alert: #c8102e;
    --alert-dark: #a00d25;
    --ok-bg: #dff3e6;
    --ok-ink: #14532d;
    --warn-bg: #fff1d6;
    --warn-ink: #7a4a00;
    --focus: #2563eb;
    --radius: 14px;
    --target: 64px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 18px/1.4 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

h1 { font-size: 1.6rem; margin: 0; }
h2 { font-size: 1.2rem; margin: 0 0 12px; }
h3 { font-size: 1rem; margin: 16px 0 8px; }
a { color: inherit; }

.visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

.muted { color: var(--muted); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
/* Blazor moves focus to the page title after navigation for screen readers; no ring needed there. */
h1:focus, h1:focus-visible { outline: none; }

/* ---------- Frame ---------- */

.topbar {
    display: flex; align-items: center; gap: 16px;
    min-height: 64px; padding: 0 20px;
    background: var(--surface); color: var(--ink); border-bottom: 1px solid var(--rule);
}

/* D74, D79: the ResortHuddle logo (home), then the module the screen belongs to. */
.wordmark {
    display: inline-flex; align-items: center; gap: 0.4em;
    font-weight: 400; font-size: 1.25rem; letter-spacing: -0.02em; text-decoration: none; color: var(--ink);
}
.wordmark b { font-weight: 700; }
.logo-mark { flex: none; width: 1.3em; height: 1.3em; color: var(--brand); }
.module {
    display: inline-flex; align-items: center; gap: 8px; padding-left: 16px; border-left: 1px solid var(--line);
    font-weight: 600; text-decoration: none; color: var(--ink);
}
.module .module-icon { color: var(--icon); }
.resort, .user { color: var(--muted); }
/* D159, D160: whose perspective the screen shows, until there is a sign-in: obvious on every screen. */
.user-pick {
    display: inline-flex; align-items: center; gap: 6px; min-width: 0; padding: 2px 4px 2px 12px;
    border: 2px solid var(--focus); border-radius: 999px; background: #eef4ff; color: var(--ink);
}
.user-pick-label { color: var(--focus); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.user-pick select {
    min-height: 32px; max-width: 15em; padding: 0 4px; border: 0; background: transparent; color: var(--ink);
    font: inherit; font-size: 0.95rem; font-weight: 700; cursor: pointer;
}
.user-pick select:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.user-pick-about { max-width: 18em; padding-right: 8px; overflow: hidden; color: var(--muted); font-size: 0.8rem; white-space: nowrap; text-overflow: ellipsis; }
.user-box { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
/* D166: what waits for the person picked, beside their name. */
.user-todo { padding: 4px 10px; border-radius: 999px; background: var(--alert); color: #fff; font-size: 0.8rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.user-todo:hover { background: var(--alert-dark); }
.hub-page { position: relative; }
.hub-user { position: absolute; top: 14px; right: 20px; }
.witness-add { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; }
.find-call { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
.find-call input { min-height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.spacer { flex: 1; }

.preview-banner {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px;
    margin: 0; padding: 8px 20px;
    background: var(--warn-bg); color: var(--warn-ink); font-size: 0.85rem;
}

/* Browser preview: switch between the roles' screens. */
.role-tabs { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.role-label { margin-right: 4px; font-weight: 600; }
.role-tab {
    padding: 4px 12px; border: 1px solid currentColor; border-radius: 999px;
    color: var(--warn-ink); text-decoration: none; font-weight: 600; font-size: 0.85rem;
}
.role-tab.on { background: var(--navy); border-color: var(--navy); color: var(--navy-ink); }

/* ---------- ResortHuddle home (D74) ---------- */

.hub-page { min-height: 100vh; padding: 48px 20px 40px; background: var(--bg); }
.hub-head { max-width: 1180px; margin: 0 auto; padding-bottom: 36px; border-bottom: 1px solid var(--rule); text-align: center; }
.hub-head h1 { font-size: 3.4rem; font-weight: 600; letter-spacing: -0.01em; }
.hub-head .wordmark { font-size: inherit; }
.hub-actions { margin: 18px 0 0; }
.hub-tagline { margin: 14px 0 0; font-size: 1.9rem; font-weight: 400; color: var(--muted); }
.hub-sections {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px;
    max-width: 1320px; margin: 28px auto 0;
}
.hub-section { padding: 18px 18px 12px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
.hub-section-head { display: flex; align-items: center; gap: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--rule); text-decoration: none; color: var(--ink); }
.hub-section-head .module-icon { flex: none; color: var(--icon); }
.hub-section-head > span { display: flex; flex-direction: column; gap: 2px; }
.hub-name { font-size: 1.4rem; font-weight: 600; }
.hub-purpose { font-size: 0.92rem; color: var(--muted); }
.hub-entries { margin: 6px 0 0; padding: 0; list-style: none; }
.hub-entry {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding: 6px 8px;
    margin: 0 -8px; border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 500;
}
.hub-entry:hover, .hub-section-head:hover .hub-name { background: var(--bg); }
.hub-entry.planned, .hub-entry.from-incident { color: var(--muted); font-weight: 400; }
.hub-tag { flex: none; padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; font-size: 0.75rem; color: var(--muted); }
.hub-foot { margin: 40px 0 0; text-align: center; color: var(--muted); font-size: 0.9rem; }

.planned-page { display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 640px; margin: 8vh auto 0; text-align: center; }
.planned-page .module-icon { color: var(--icon); }
.planned-section { margin: 0; font-size: 0.95rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.planned-page h1 { font-size: 2.6rem; font-weight: 600; }
.planned-page .hub-tagline { margin: 0; font-size: 1.4rem; }
.planned-page .button { margin-top: 16px; }

@media (max-width: 1100px) {
    .hub-sections { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
    .hub-head h1 { font-size: 2.4rem; }
    .hub-tagline { font-size: 1.3rem; }
    .hub-sections { grid-template-columns: minmax(0, 1fr); }
}

main { max-width: 1280px; margin: 0 auto; padding: 20px 20px 120px; }

.badge {
    display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px;
    border-radius: 999px; font-size: 0.85rem; font-weight: 600; white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok-ink); }
.badge.warn { background: var(--warn-bg); color: var(--warn-ink); }

/* ---------- Buttons and chips ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.chips:first-child { margin-top: 0; }

.chip, .button {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    min-height: var(--target); min-width: var(--target); padding: 0 22px;
    border: 2px solid var(--line); border-radius: var(--radius);
    background: var(--surface); color: var(--ink);
    font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
    touch-action: manipulation;
}
.chip:hover:not(:disabled), .button:hover { border-color: var(--navy); }
.chip.on { background: var(--navy); border-color: var(--navy); color: var(--navy-ink); }
.chip:disabled { opacity: 0.55; cursor: not-allowed; }
.chip.ghost, .button.ghost { background: transparent; }

.chip .box {
    display: inline-grid; place-items: center; width: 26px; height: 26px;
    border: 2px solid currentColor; border-radius: 6px; font-size: 1rem; line-height: 1;
}

.chip-hint { font-size: 0.75rem; font-weight: 500; padding: 2px 8px; border-radius: 999px; background: var(--ok-bg); color: var(--ok-ink); }
.chip.on .chip-hint { background: rgba(255, 255, 255, 0.18); color: var(--navy-ink); }
.chip:disabled .chip-hint { background: transparent; color: var(--muted); }

.button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.button.primary:hover:not(:disabled) { background: var(--brand-dark); border-color: var(--brand-dark); }
.button:disabled { opacity: 0.5; cursor: not-allowed; }

.row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }

/* ---------- Home ---------- */

.actions { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 16px; margin-bottom: 20px; }

.big {
    display: flex; flex-direction: column; justify-content: center; gap: 4px;
    min-height: 140px; padding: 20px 24px;
    border: 2px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink);
    font: inherit; font-size: 1.4rem; font-weight: 700; text-align: left; text-decoration: none; cursor: pointer;
}
.big small { font-size: 0.9rem; font-weight: 500; color: var(--muted); }
.big.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-size: 1.7rem; }
.big.primary small { color: rgba(255, 255, 255, 0.85); }
.big.on { border-color: var(--navy); box-shadow: inset 0 0 0 2px var(--navy); }

.panel, .step, .preview {
    background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px;
}
.panel { margin-bottom: 16px; }

.toast { margin: 0 0 16px; padding: 14px 18px; border-radius: var(--radius); background: var(--ok-bg); color: var(--ok-ink); font-weight: 600; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list a { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: var(--target); justify-content: center; padding: 10px 0; text-decoration: none; }
.list.compact li { min-height: 44px; }

/* ---------- Start screen ---------- */

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }

.elapsed {
    min-width: 88px; padding: 8px 14px; border-radius: 999px; text-align: center;
    background: var(--surface); border: 2px solid var(--line); font-weight: 700; font-variant-numeric: tabular-nums;
}
.elapsed.done { background: var(--ok-bg); border-color: var(--ok-bg); color: var(--ok-ink); }

.start-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.steps { display: grid; gap: 16px; }

.step h2 { display: flex; align-items: center; gap: 12px; }
/* D91: the questions that decide the forms, Yes or No, unanswered rows marked until picked. */
.yes-nos { display: grid; gap: 6px; margin-top: 12px; }
.yes-nos.incident { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 6px 18px; }
.yes-no { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 4px 4px 10px; border-left: 3px solid var(--warn-ink); border-radius: 4px; }
.yes-no.answered { border-left-color: transparent; }
.yes-no.optional { border-left-color: transparent; }
.yes-no.disabled .yn-label { color: var(--muted); }
.yn-label { font-weight: 600; }
.yn-buttons { display: inline-flex; gap: 8px; flex: none; }
.chip.yn { min-width: 76px; justify-content: center; }
.yes-no .chip-hint { flex-basis: 100%; }
.start-open { margin: 0 0 12px; padding: 8px 10px; border-radius: 6px; background: var(--warn-bg); color: var(--warn-ink); font-size: 0.9rem; font-weight: 600; }
.step-detail { margin-top: 12px; padding: 12px 14px; border-left: 3px solid var(--line); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; }
/* D234: on snow, the place as the dispatch desk takes it: the run from the resort's list, the exact location, the GPS only
   if known with the runs nearest it. */
.where-at { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 16px; align-items: center; margin-top: 12px; padding: 12px 14px; border-left: 3px solid var(--line); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; }
.where-row { display: contents; }
.where-label { font-weight: 500; }
.where-at .run-input { display: flex; align-items: center; gap: 8px; }
.where-at .gps-near { grid-column: 2; margin-top: 0; }
/* D103, D105: where on snow and what a person was doing are picks the form waits for (marked until picked); the cause
   on a person's card is optional. Each shows the place's few answers under its question. */
.detail-label, .quick-label { display: block; margin: 0 0 10px; }
.quick-row { padding: 10px 0 4px; }
.num {
    display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none;
    border-radius: 50%; background: var(--navy); color: var(--navy-ink); font-size: 1rem;
}

.stepper { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.stepper output { min-width: 110px; text-align: center; font-weight: 700; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
/* D150: a collision between the people, under their cards. */
.cards + .together { margin-top: 14px; }
.card { border: 2px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card h3 { margin-top: 0; }

.preview { position: sticky; top: 16px; }
.preview h2 + * { margin-top: 0; }
.preview h2:not(:first-child) { margin-top: 20px; }
.modules, .reports { list-style: none; margin: 0; padding: 0; }
.modules li { padding: 8px 0; border-top: 1px solid var(--line); }
.modules li:first-child { border-top: 0; }
.modules strong { display: block; }
.modules span { color: var(--muted); font-size: 0.9rem; }
.reports li { padding: 10px 12px; margin-bottom: 8px; border-radius: 10px; background: var(--ok-bg); color: var(--ok-ink); font-weight: 600; }
.note { margin: 16px 0 0; color: var(--muted); font-size: 0.85rem; }
.summary { margin: -8px 0 16px; color: var(--muted); }

.action-bar {
    position: fixed; left: 0; right: 0; bottom: 0;
    display: flex; justify-content: flex-end; gap: 12px; padding: 14px 20px;
    background: var(--surface); border-top: 1px solid var(--line);
}
.action-bar .button { min-width: 180px; }

/* ---------- Narrow screens (phone, portrait) ---------- */

@media (max-width: 900px) {
    .start-grid { grid-template-columns: 1fr; }
    .preview { position: static; }
    .actions { grid-template-columns: 1fr 1fr; }
    .actions .big.primary { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
    main { padding: 16px 16px 120px; }
    .topbar { flex-wrap: wrap; padding: 8px 16px; }
    .resort, .user { display: none; }
    .user-pick select { max-width: 11em; }
    .user-pick-about { display: none; }
    .hub-user { position: static; display: flex; justify-content: center; margin: -32px 0 16px; }
    .cards { grid-template-columns: 1fr; }
    .chip, .button { padding: 0 16px; }
    .action-bar .button { flex: 1; min-width: 0; }
}

/* ---------- Incident form ---------- */

.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tab {
    min-height: 52px; padding: 0 20px; border: 2px solid var(--line); border-radius: 999px;
    background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
}
.tab.on { background: var(--navy); border-color: var(--navy); color: var(--navy-ink); }

.count { margin-left: auto; font-size: 0.85rem; font-weight: 600; color: var(--warn-ink); background: var(--warn-bg); padding: 4px 10px; border-radius: 999px; }
.count.done { color: var(--ok-ink); background: var(--ok-bg); }

.field { padding: 12px 0; border-top: 1px solid var(--line); }
.field:first-of-type { border-top: 0; }
.field-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.field-label { font-weight: 600; flex: 1; min-width: 200px; }
.field.known .field-label { font-weight: 500; color: var(--muted); }
.field-value { font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.field-help { margin: 6px 0 8px; color: var(--muted); font-size: 0.9rem; }
.field-check { margin: 6px 0 0; color: var(--warn-ink); font-size: 0.9rem; }
/* D227, D233: under the GPS, as on the dispatch board: the nearest runs with their distance; a tap names the run. */
.gps-near { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 10px; }
.gps-label { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.gps-hint { color: var(--muted); font-size: 0.9rem; }
.gps-near .chip b { font-weight: 500; color: var(--muted); }
.gps-near .chip.on b { color: inherit; }
.needed { margin-left: 8px; font-size: 0.75rem; font-weight: 600; color: var(--warn-ink); background: var(--warn-bg); padding: 2px 8px; border-radius: 999px; }
.source { font-size: 0.75rem; font-weight: 600; color: var(--ok-ink); background: var(--ok-bg); padding: 2px 8px; border-radius: 999px; }
.link { background: none; border: 0; padding: 8px; color: var(--focus); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }
/* D224: Find another call reads as part of its sentence. */
.link.find-call { padding: 0; }

.input {
    width: 100%; min-height: var(--target); padding: 12px 14px; border: 2px solid var(--line); border-radius: var(--radius);
    font: inherit; background: var(--surface); color: var(--ink);
}
textarea.input { min-height: 120px; resize: vertical; }
.input.short { width: auto; min-width: 180px; }
.row-inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-inline .input:not(.short) { flex: 1; min-width: 220px; }

.body-part { display: inline-flex; align-items: center; gap: 4px; }
.na-row { margin-top: 8px; }
.chip.na { min-width: 88px; }
.na-row:empty { display: none; }
.part-injuries { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.part-injuries.missing { border-color: var(--warn-ink); }
.part-injuries .part-name { font-weight: 600; }
.body-part.on { padding-right: 4px; border-radius: var(--radius); background: #ececec; }
.side {
    min-width: 48px; min-height: 48px; border: 2px solid var(--line); border-radius: 10px;
    background: var(--surface); font: inherit; font-weight: 700; cursor: pointer;
}
.side.on { background: var(--navy); border-color: var(--navy); color: var(--navy-ink); }

.run-grade { display: inline-flex; align-items: center; gap: 5px; vertical-align: middle; }
.run-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); }
.run-dot.easiest { background: #1b8a3a; }
.run-dot.more_difficult { background: #1d4ed8; border-radius: 2px; }
.run-dot.most_difficult, .run-dot.extreme { background: #111; transform: rotate(45deg); border-radius: 2px; }

.signature-pad { position: relative; border: 2px dashed var(--line); border-radius: var(--radius); background: #fff; }
.signature-pad canvas { display: block; width: 100%; height: 180px; touch-action: none; }
.signature-line { position: absolute; left: 16px; right: 16px; bottom: 36px; border-top: 1px solid var(--line); font-size: 0.8rem; color: var(--muted); padding-top: 2px; pointer-events: none; }
.signature-done { display: flex; align-items: center; gap: 12px; }
.signature-done img, .signature-thumb { height: 56px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.signature-thumb { height: 36px; }
/* D114: what the patroller notes about each injured part, under its injuries; a needed one still missing is marked. */
.part-detail { margin-top: 12px; }
.part-detail-label { display: block; margin-bottom: 6px; font-size: 0.9rem; color: var(--secondary); }
.part-detail.missing .part-detail-label::before {
    content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--attention); vertical-align: 0.1em;
}
.part-detail .chips { margin-top: 0; }
/* D117: a minute earlier or later beside Now, two small square buttons kept together. */
.nudge { display: inline-flex; gap: 6px; }
.nudge .chip { min-width: 48px; justify-content: center; font-size: 1.25rem; font-weight: 600; }
/* D116: the part's name, and beside it the primary injury checkbox when there are several parts. */
.part-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.part-head .part-name { flex: 1; }
.part-primary .chip { margin: 0; }
.part-primary.missing::before {
    content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--attention); vertical-align: 0.1em;
}
.chips.scale { gap: 6px; }
.chips.scale .chip { min-width: 46px; padding-left: 10px; padding-right: 10px; justify-content: center; }
/* D110: a measure's boxes with their unit, and the switch between metric and imperial. */
.measure { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.input.tiny { width: 7.5em; }
.measure .unit { color: var(--secondary); margin-right: 6px; }
/* D106: a photo taken on the tablet, shown as taken, then Take again. */
.photo-done img { display: block; max-width: min(100%, 320px); max-height: 240px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 8px; }
.photo-take { position: relative; cursor: pointer; }

.guest-card { border: 2px solid var(--navy); }
.kit { list-style: none; margin: 0; padding: 0; }
.kit li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.kit li:first-child { border-top: 0; }
.kit-name { flex: 1 1 100%; font-weight: 600; }
.kit-status { font-size: 0.8rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.kit-status.todo { background: var(--warn-bg); color: var(--warn-ink); }
.kit-status.done { background: var(--ok-bg); color: var(--ok-ink); }
.kit-status.later { background: #ececec; color: var(--muted); }

.conditions-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    margin-bottom: 16px; padding: 12px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-decoration: none;
}
.conditions-bar.todo { background: var(--warn-bg); color: var(--warn-ink); border-color: transparent; }

.guest-mode { font-size: 1.1rem; }
.guest-mode .step { margin-bottom: 16px; }
.guest-intro { padding: 8px 0 16px; }
.guest-intro h1 { font-size: 1.8rem; }
.attest { margin: 16px 0 4px; font-weight: 600; }

/* ---------- Generated forms (print) ---------- */

.print-toolbar {
    position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.print-page { padding: 24px 16px 48px; overflow-x: auto; }

@media print {
    html, body { background: #fff; }
    .print-toolbar, .preview-banner, .topbar { display: none !important; }
    .print-page { padding: 0; }
    .gap { background: transparent !important; outline: none !important; }
    @page { size: letter; margin: 0.35in; }
}

/* D121: a newer resort setup is waiting for a reload. */
.setup-notice { margin: 0; padding: 8px 20px; background: var(--warn-bg); color: var(--warn-ink); font-size: 0.9rem; }
.setup-notice .link { margin-left: 8px; font-weight: 600; }

/* D120: the full report: a summary of the record, then each form of the kit from a new page. */
.full-report { max-width: 8in; margin: 0 auto; color: var(--ink); }
.fr-head { padding-bottom: 10px; margin-bottom: 16px; border-bottom: 2px solid var(--ink); }
.fr-resort { margin: 0; font-weight: 600; color: var(--muted); }
.fr-head h1 { margin: 4px 0; font-size: 1.6rem; }
.fr-line { margin: 2px 0; }
.fr-contents h2 { margin: 0 0 4px; font-size: 1rem; }
.fr-contents ol { margin: 0 0 0 20px; padding: 0; }
.fr-contents .link { margin-left: 10px; font-size: 0.85rem; }
.fr-part { margin: 28px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line); font-size: 1.3rem; break-after: avoid; }
.fr-part small { margin-left: 8px; font-size: 0.9rem; font-weight: 400; color: var(--muted); }
.fr-section { margin: 12px 0; break-inside: avoid; }
.fr-section h3 { margin: 0 0 6px; font-size: 0.85rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.fr-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 24px; margin: 0; }
.fr-fields > div { display: grid; grid-template-columns: 11em 1fr; gap: 8px; }
.fr-fields > div.wide { grid-column: 1 / -1; }
.fr-fields dt { color: var(--muted); }
.fr-fields dd { margin: 0; white-space: pre-line; }
.fr-image { max-width: 3in; max-height: 2.4in; border: 1px solid var(--line); }
.fr-image.signature { max-height: 0.9in; }
.fr-parts { margin: 0; padding-left: 18px; }
.fr-noted { display: block; color: var(--muted); }
.fr-vitals { width: 100%; border-collapse: collapse; }
.fr-vitals th, .fr-vitals td { padding: 3px 6px; border: 1px solid var(--line); font-size: 0.9rem; text-align: left; }
.fr-form { margin-top: 40px; padding-top: 24px; border-top: 3px double var(--line); }
@media (max-width: 700px) {
    .fr-fields, .fr-fields > div { grid-template-columns: 1fr; gap: 2px; }
}
@media print {
    .screen-only { display: none !important; }
    .full-report { max-width: none; }
    .fr-form { break-before: page; margin-top: 0; padding-top: 0; border-top: 0; }
}

.hint-warn { margin-right: auto; align-self: center; font-weight: 600; color: var(--warn-ink); }
.empty-note { border: 2px dashed var(--line); }

/* ---------- Dictation (R35, D13) ---------- */

/* D90: the microphone in the lower right corner of the box it fills; the status shows beside it, inside the box. */
.voice-box { position: relative; display: block; }
.row-inline > .voice-box.single, .row-inline > .plain-box { flex: 1; min-width: 220px; }
.plain-box { display: block; }
.plain-box .input { width: 100%; }
.voice-box .input { width: 100%; }
.voice-box textarea.input { padding-right: 68px; }
.voice-box.single .input { padding-right: 60px; }
.dictate { position: absolute; right: 14px; bottom: 12px; display: flex; flex-direction: row-reverse; align-items: center; gap: 8px; }
.voice-box.single .dictate { top: 50%; bottom: auto; right: 8px; transform: translateY(-50%); }
.dictate-button {
    display: inline-grid; place-items: center; width: 46px; height: 46px; padding: 0;
    border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink); cursor: pointer;
}
.voice-box.single .dictate-button { width: 40px; height: 40px; }
.dictate-button:hover { border-color: var(--ink); }
.dictate-button .mic { width: 22px; height: 22px; fill: currentColor; stroke: currentColor; }
.dictate-button.listening { background: var(--alert); border-color: var(--alert); color: #fff; }
.dictate-button.listening .mic { animation: listening 1.2s ease-in-out infinite; }
.dictate-status { padding: 2px 8px; border-radius: 8px; background: var(--surface); color: var(--muted); font-size: 0.85rem; font-style: italic; white-space: nowrap; }
@keyframes listening { 50% { opacity: 0.35; } }

/* ---------- Review (R19) ---------- */

.return-banner { margin: 0 0 16px; padding: 12px 16px; border-radius: var(--radius); background: var(--warn-bg); color: var(--warn-ink); }
.return-note { display: block; color: var(--warn-ink); font-size: 0.9rem; }
.submit-box { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.submit-box .button { width: 100%; }

/* Sets of vitals (D61): one line per set, oldest first, the next set typed in the last line. */
.vitals-grid { display: flex; flex-direction: column; gap: 6px; overflow-x: auto; }
.vitals-line { display: grid; grid-template-columns: 7.5rem repeat(7, minmax(4.5rem, 1fr)) 6rem; gap: 8px; align-items: center; min-width: 44rem; font-variant-numeric: tabular-nums; }
.vitals-line.head { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.vitals-line:not(.head):not(.new) { padding: 6px 0; border-bottom: 1px solid var(--line); }
.vitals-line.new .input { width: 100%; min-width: 0; padding-left: 8px; padding-right: 8px; }

/* R13, R43: a locked draft (sent for review, voided, or checked out elsewhere) reads but does not change. */
fieldset.locked-form { display: grid; gap: 16px; border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.locked-form:disabled a.button, fieldset.locked-form:disabled .link, fieldset.locked-form:disabled canvas { pointer-events: none; opacity: 0.55; }
.lock-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; background: var(--surface); border: 2px solid var(--line); }
.lock-banner.warn { background: var(--warn-bg); color: var(--warn-ink); }
.return-banner ul { margin: 6px 0 0; padding-left: 20px; }
.return-banner p { margin: 0 0 4px; }
/* D199: each question is a link to the answer it is about. */
.return-banner .go-to { padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; text-decoration: underline; cursor: pointer; }
.field.asked { border-left: 4px solid var(--warn-ink); padding-left: 10px; }
.field-question { margin: 6px 0; padding: 6px 10px; border-radius: 8px; background: var(--warn-bg); color: var(--warn-ink); font-size: 0.95rem; }

/* R7: handing the tablet back takes the patroller's PIN. */
.hand-back { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.pin-field { display: grid; gap: 4px; font-weight: 600; }
.pin-field .input { width: 10rem; letter-spacing: 0.3em; }

/* R49: paperwork still open the day after. */
.badge.late { background: #fde2e4; color: #9b1028; }

/* Diagrams drawn on the tablet (collision course, accident site, tube park). */
.signature-pad.drawing canvas { height: 420px; }
.signature-pad.drawing .signature-line { top: 8px; bottom: auto; border-top: 0; }
.signature-done.drawing img { max-width: 100%; max-height: 420px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* R51: a part sent to someone outside patrol. */
.task-line { margin: 4px 0; font-weight: 600; color: var(--warn-ink); }
.task-line.done { color: var(--ok-ink, #1f6b3a); }

/* ---------- Settings look (D93) ---------- */

/* The incident form reads like the iPad's Settings: grey page, white groups of rows with thin separators, the section
   name above in small capitals, notes under it in grey. A row answered shows its answer on the right and a chevron; a
   needed answer still missing has an orange dot; the side keeps every part and report with what is still to go. */
:root { --grouped: #f2f2f7; --separator: #d8d8dc; --secondary: #66666b; --attention: #d9480f; }

.chev { flex: none; width: 9px; height: 9px; margin: 0 4px 0 2px; border-top: 2.5px solid #b4b4b9; border-right: 2.5px solid #b4b4b9; transform: rotate(45deg); }
.chev.down { transform: rotate(135deg); margin-top: -5px; }
.chev.up { transform: rotate(-45deg); margin-top: 5px; }

.row-btn {
    display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; margin: 0; padding: 0;
    border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.row-btn .field-label { flex: 1; min-width: 0; font-weight: 400; color: var(--ink); }
.field.known .row-btn .field-label { font-weight: 400; color: var(--ink); }
.row-btn .field-value { flex: 0 1 auto; max-width: 58%; justify-content: flex-end; flex-wrap: wrap; text-align: right; font-weight: 400; color: var(--secondary); }
.row-btn.long { flex-wrap: wrap; padding: 10px 0; row-gap: 4px; }
.row-btn.long .field-label { flex: 1 1 calc(100% - 40px); }
.row-btn.long .field-value { order: 3; flex: 1 1 100%; max-width: none; justify-content: flex-start; text-align: left; white-space: pre-line; }
.field.editing .field-head, .field.missing .field-head { min-height: 44px; }
.done-link { margin-left: auto; text-decoration: none; }
.field.missing.required > .field-head .field-label::before {
    content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 10px; border-radius: 50%;
    background: var(--attention); vertical-align: 0.05em;
}
.flash { animation: flash 1.4s ease-out; }
@keyframes flash { 0%, 40% { background: #fff1e6; box-shadow: inset 4px 0 0 var(--attention); } }

body:has(.ios-form) { background: var(--grouped); }
.ios-form .page-head h1 { font-size: 2rem; letter-spacing: -0.01em; }

.form-split { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 28px; align-items: start; }
.ios-form .form-side {
    position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto;
    padding: 0 2px 16px; border: 0; border-radius: 0; background: none;
}
.part-title { margin: 4px 4px 0; font-size: 1.8rem; }

.group-title, .ios-form .step > h2 {
    display: flex; align-items: center; gap: 10px; margin: 22px 16px 8px;
    font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--secondary);
}
.ios-form .step > h2 .count { text-transform: none; letter-spacing: 0; }
/* D236: a complete part folds to its title line; a tap on the title opens it again. */
.fold { display: flex; align-items: center; gap: 10px; width: 100%; margin: 0; padding: 6px 0; border: 0; background: none; color: inherit;
    font: inherit; text-transform: inherit; letter-spacing: inherit; text-align: left; cursor: pointer; }
.fold:hover { color: var(--ink); }
.fold-body[hidden], .group[hidden] { display: none; }
.ios-form .step, .ios-form .guest-card, .ios-form .empty-note { padding: 0; border: 0; border-radius: 0; background: none; }
.ios-form fieldset.locked-form { gap: 4px; }
.group { margin: 0; padding: 0; border-radius: 12px; background: var(--surface); overflow: hidden; }
.group + .group, .group-foot + .group, .group-title + .group { margin-top: 0; }
.group + .group { margin-top: 18px; }
.group-foot { margin: 8px 16px 0; color: var(--secondary); font-size: 0.85rem; }

.group > * { position: relative; }
.group > * + *::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 1px solid var(--separator); }
.group > .field { padding: 10px 16px 14px; border-top: 0; }
.group > .field.known:not(.editing) { padding-top: 0; padding-bottom: 0; }

.row-link {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 56px; padding: 0 16px;
    border: 0; background: var(--surface); color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer;
}
.row-link.strong { font-weight: 600; }
.row-link:hover, .group .row-btn:hover, .kit-row:hover { background: #f7f7f9; }
.row-plain { margin: 0; padding: 12px 16px; }
.send-row { display: flex; flex-wrap: wrap; gap: 10px; }
.send-row .input { flex: 1; min-width: 220px; }
/* D138: who of the other departments worked that day, one click to send them the part. */
.send-suggest { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.send-suggest .chip small { margin-left: 4px; color: var(--muted); font-weight: 400; }
.send-suggest .chip.on small { color: inherit; }

.ios-form .chip { border: 0; border-radius: 12px; background: #ececf0; font-weight: 500; }
.ios-form .chip:hover:not(:disabled) { background: #e2e2e7; }
.ios-form .chip.on { background: var(--ink); color: #fff; font-weight: 600; }
.ios-form .input { border: 0; border-radius: 10px; background: var(--grouped); }
.ios-form .side { border: 0; background: #ececf0; }
.ios-form .side.on { background: var(--ink); }
.ios-form .part-injuries { border: 0; background: var(--grouped); }
.ios-form .part-injuries.missing { box-shadow: inset 4px 0 0 var(--attention); }

/* The side: progress, parts, reports, submit. */
.form-progress { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 12px; background: var(--surface); }
.progress-text { font-size: 1.15rem; font-weight: 700; color: var(--attention); }
.form-progress.done .progress-text { color: var(--ok-ink); }
.next-missing { width: 100%; }
.ios-form .tabs.group { display: block; }
.ios-form .tab.row-btn { min-height: 56px; padding: 0 16px; border: 0; border-radius: 0; background: var(--surface); font-weight: 500; }
.ios-form .tab.row-btn.on { background: var(--ink); color: #fff; }
.ios-form .tab.row-btn.on .chev { border-color: rgba(255, 255, 255, 0.7); }
.part-name { flex: 1; }
.part-name small { margin-left: 6px; font-weight: 400; color: var(--secondary); }
.tab.on .part-name small { color: rgba(255, 255, 255, 0.75); }
.badge-count { min-width: 30px; padding: 2px 9px; border-radius: 999px; background: var(--attention); color: #fff; font-size: 0.85rem; font-weight: 700; text-align: center; }
.badge-count.done { background: none; color: var(--ok-ink); font-weight: 600; }
.tab.on .badge-count.done { color: #b6ecc6; }
.ios-form .kit.group li { display: block; padding: 0; border-top: 0; }
.kit-row { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 10px 16px; color: var(--ink); text-decoration: none; }
.ios-form .kit-row .kit-name { flex: 1; font-weight: 500; }
.ios-form .start-open { border-radius: 12px; }
.ios-form .submit-box { margin-top: 18px; padding: 0; border: 0; }

.ios-form .vitals-step > .field-help { margin: 0 16px 8px; font-size: 0.85rem; color: var(--secondary); }
.ios-form .vitals-grid { padding: 12px 16px; border-radius: 12px; background: var(--surface); }

@media (max-width: 900px) {
    .form-split { grid-template-columns: minmax(0, 1fr); }
    .ios-form .form-side { position: static; max-height: none; overflow: visible; }
    /* On a phone the count and Next missing stay at the bottom of the screen. */
    .form-progress {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; flex-direction: row; align-items: center; justify-content: space-between;
        padding: 12px 16px; border-radius: 0; box-shadow: 0 -1px 0 var(--separator);
    }
    .next-missing { width: auto; }
}

/* D94: the same settings look on every page of the form flow: the start screen, the guest's and the witness's pages,
   a collected form and the shift conditions. */
.group.pad { padding: 14px 16px; }
.ios-form .step > h2 .num { width: 22px; height: 22px; font-size: 0.75rem; }
.ios-form .step > .field-help { margin: 0 16px 8px; color: var(--secondary); font-size: 0.85rem; }
.ios-form .group > .attest { margin: 0; padding: 14px 16px 0; }
.ios-form .page-head + .summary { margin: -8px 4px 8px; }

/* Start screen: the Yes or No questions as settings rows, the answer as a two-part switch on the right. */
.ios-form .yes-nos, .ios-form .yes-nos.incident { grid-template-columns: minmax(0, 1fr); gap: 0; margin: 12px -16px -14px; }
.ios-form .yes-no { min-height: 60px; padding: 8px 16px; border-left: 0; border-top: 1px solid var(--separator); border-radius: 0; }
.ios-form .yes-no:not(.answered) .yn-label::before {
    content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 10px; border-radius: 50%;
    background: var(--attention); vertical-align: 0.05em;
}
.ios-form .yn-label { font-weight: 400; }
.ios-form .yn-buttons { gap: 2px; padding: 3px; border-radius: 12px; background: #ececf0; }
.ios-form .chip.yn { min-height: 44px; min-width: 76px; border-radius: 9px; background: transparent; }
.ios-form .chip.yn.on { background: var(--ink); color: #fff; }
.ios-form .step-detail { margin: 12px -16px -14px; padding: 12px 16px 14px; border-left: 0; border-top: 1px solid var(--separator); border-radius: 0; background: #fafafc; }
.ios-form .needs-pick > .detail-label::before, .ios-form .needs-pick > .quick-label::before {
    content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 10px; border-radius: 50%;
    background: var(--attention); vertical-align: 0.05em;
}
.ios-form .quick-row { padding: 12px 16px 14px; border-top: 1px solid var(--separator); }
/* D99: No to the rest, the last row of a list of Yes or No questions. */
.ios-form .yes-nos > .no-rest { justify-content: flex-end; border-top: 1px solid var(--separator); color: var(--focus); font-weight: 600; }
/* D150: the people's own box under their cards holds only its Yes or No rows. */
.ios-form .together .yes-nos { margin: -14px -16px; }
.ios-form .together .yes-no:first-child { border-top: 0; }
.ios-form .cards { gap: 0 20px; }
.ios-form .card { padding: 0; border: 0; border-radius: 0; }
.ios-form .card > h3, .ios-form .preview > h2, .ios-form .preview > h3 {
    margin: 22px 16px 8px; font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--secondary);
}
.ios-form .stepper output { font-weight: 600; }

/* The side of the start screen and of a collected form: what the answers build, as grouped lists. */
.ios-form .preview { padding: 0; border: 0; border-radius: 0; background: none; }
.ios-form .preview > h2:first-child { margin-top: 0; }
.ios-form .preview .modules, .ios-form .preview .reports, .ios-form .preview > .kit { border-radius: 12px; background: var(--surface); overflow: hidden; }
.ios-form .preview .modules li { padding: 10px 16px; border-top: 1px solid var(--separator); }
.ios-form .preview .modules li:first-child { border-top: 0; }
.ios-form .preview .reports li { margin: 0; padding: 12px 16px; border-radius: 0; border-top: 1px solid var(--separator); background: var(--surface); color: var(--ink); font-weight: 500; }
.ios-form .preview .reports li:first-child { border-top: 0; }
.ios-form .preview:not(.form-side) > .kit li { padding: 12px 16px; }
.ios-form .preview > .note, .ios-form .preview > .muted, .ios-form .preview > p { margin: 8px 16px 0; color: var(--secondary); font-size: 0.85rem; }

/* On a laptop, mouse and keyboard: the same screens with controls sized for a pointer, not a gloved finger (R6 stays on
   touch screens). */
@media (pointer: fine) {
    :root { --target: 48px; }
    html, body { font-size: 17px; }
    .row-btn, .row-link, .kit-row, .ios-form .tab.row-btn { min-height: 48px; }
    .ios-form .yes-no { min-height: 52px; }
    .ios-form .chip.yn { min-height: 38px; }
    .side { min-width: 40px; min-height: 40px; }
}

/* D95: a long list in columns: its groups side by side, each a heading over its options, one under the other. A long
   list without groups: buttons of one width in even columns. */
.chips.even { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.option-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 14px 18px; margin-top: 10px; }
.option-group-name { display: block; margin: 0 0 6px 2px; font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--secondary, #66666b); }
.option-group .chips { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 0; }
.option-group .chip { justify-content: flex-start; text-align: left; }

/* D96: the body map beside the list of parts. */
.body-picker { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(0, 1fr); gap: 16px 24px; align-items: start; margin-top: 10px; }
.body-map { width: 100%; height: auto; user-select: none; }
.body-map .bm { fill: #e4e4ea; stroke: #fff; stroke-width: 2; cursor: pointer; transition: fill 0.12s; }
.body-map .bm:hover { fill: #cfcfd7; }
.body-map .bm.on { fill: var(--attention, #d9480f); }
/* D112: the spine on the back view, darker than the back so the midline reads at a glance. */
.body-map .bm.spine { fill: #b9b9c4; }
.body-map .bm.spine:hover { fill: #9d9daa; }
.body-map .bm.spine.on { fill: var(--attention, #d9480f); stroke: #7a2a05; }
.body-map .bm:focus-visible { outline: none; stroke: var(--focus); stroke-width: 3; }
.bm-view { font-size: 13px; font-weight: 600; fill: var(--secondary, #66666b); text-anchor: middle; text-transform: uppercase; letter-spacing: 0.06em; }
.bm-side { font-size: 14px; font-weight: 700; fill: var(--ink); text-anchor: middle; }
.body-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px 16px; }
.body-list .option-group { margin: 0; }
.body-list .body-part { display: flex; align-items: center; gap: 4px; }
.body-list .body-part .chip { flex: 1; min-width: 0; }
.body-list .chip { min-height: 42px; padding: 0 12px; }
.body-list .side { min-width: 34px; min-height: 34px; }
.body-list { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

@media (max-width: 760px) {
    .body-picker { grid-template-columns: minmax(0, 1fr); }
    .body-map { max-width: 420px; justify-self: center; }
}
