/* app.css — OnRecord. Phone first: an officer will use this in a car, often at night.
   Two places: Record (dark, one big button, the transcript) and Report (light, three steps:
   details, draft, use). Police navy, hi-vis yellow for the one action that matters on each
   screen, and the black-and-white Sillitoe check under the header. */
:root {
  --ink: #0f1b2d; --muted: #5a6577; --line: #d5dce6; --bg: #f3f5f8; --card: #ffffff;
  --navy: #0a2342; --navy-dark: #081b34; --navy-2: #13325c; --navy-soft: #e8eef6; --navy-mid: #1c3f6e;
  --on-navy: #ffffff; --on-navy-muted: #b9c6d8; --on-navy-faint: #8fa3be;
  --hivis: #ffd100; --hivis-dark: #e6bc00; --hivis-soft: #fff6c2;
  --red: #b42318; --red-bg: #fee4e2; --rec: #ff5a4e; --green: #1f7a4d; --green-bg: #ddf3e6;
  --radius: 14px; --font: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --tabs-h: 0px; --top-h: 68px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); -webkit-text-size-adjust: 100%; }
body.dark { background: var(--navy); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.25rem; letter-spacing: -0.01em; font-weight: 800; } h2 { font-size: 1.05rem; color: var(--navy); font-weight: 800; }
p { margin: 0.4rem 0; }
a { color: var(--navy-mid); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.offline-note { background: var(--navy-2); color: #fff; text-align: center; font-size: 0.85rem; padding: 8px 16px; border-bottom: 2px solid var(--hivis); }
.banner { background: var(--hivis); color: var(--navy); padding: 8px 16px; font-size: 0.85rem; border-bottom: 1px solid var(--hivis-dark); text-align: center; }

/* Header: navy, with the Sillitoe check (two rows of black-and-white squares) beneath it. */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 12px 16px; background: var(--navy); color: #fff; position: relative; margin-bottom: 12px; }
.top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -12px; height: 12px;
  background: repeating-conic-gradient(#111 0 25%, #fff 0 50%) 0 0 / 12px 12px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .sub { margin: 1px 0 0; font-size: 0.8rem; opacity: 0.85; }
.mark { width: 32px; height: 32px; flex: none; border-radius: 8px; background: var(--hivis);
  background-image: linear-gradient(135deg, transparent 0 46%, var(--navy) 46% 54%, transparent 54%); box-shadow: inset 0 0 0 3px var(--navy); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.status { font-size: 0.75rem; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,0.14); max-width: 100%; text-align: center; }
.status.live { background: var(--green-bg); color: var(--green); }
.status.mock { background: var(--hivis-soft); color: var(--navy); }
.status.off { background: var(--red-bg); color: var(--red); }
.signout { font-size: 0.75rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.5); }
.signout:hover { background: rgba(255,255,255,0.14); }
.who { font-size: 0.75rem; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,0.14); color: #fff; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main { max-width: 1080px; margin: 0 auto; padding: 6px 16px calc(28px + env(safe-area-inset-bottom)); }
.gate { max-width: 640px; margin: 24px auto; }
.muted { color: var(--muted); } .small { font-size: 0.85rem; }
.empty { color: var(--muted); background: var(--card); border: 1px dashed #b7c1cf; border-radius: var(--radius); padding: 16px; text-align: center; }

/* ── Buttons ── */
button { font: inherit; font-weight: 700; padding: 11px 16px; border-radius: 10px; border: 1px solid transparent; cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--hivis); outline-offset: 2px; }
a.button { display: inline-block; text-decoration: none; text-align: center; font-weight: 700; padding: 11px 16px; border-radius: 10px; border: 1px solid transparent; }
.primary { background: var(--hivis); color: var(--navy); border-color: var(--hivis-dark); } .primary:not(:disabled):hover { background: var(--hivis-dark); }
.secondary { background: #fff; color: var(--navy); border-color: #b7c1cf; } .secondary:not(:disabled):hover { background: var(--navy-soft); }
.danger { background: #fff; color: var(--red); border-color: var(--red); } .danger:hover { background: var(--red-bg); }
.ghost { background: transparent; color: var(--on-navy); border-color: rgba(255,255,255,0.4); } .ghost:hover { background: rgba(255,255,255,0.08); }
.big { min-height: 52px; font-size: 1rem; font-weight: 800; border-radius: 12px; }
.wide { width: 100%; }
.tiny { padding: 6px 10px; font-size: 0.8rem; border-radius: 8px; }
.pill-btn { padding: 8px 14px; border-radius: 999px; font-size: 0.85rem; font-weight: 800; min-height: 38px; }

/* ── Forms ── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0 0 14px; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 12px; }
.hint { color: var(--muted); font-size: 0.8rem; }
.grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 0.82rem; font-weight: 700; color: var(--ink); }
.label-row { display: flex; justify-content: space-between; gap: 8px; }
.from-signin { color: var(--green); font-weight: 700; font-size: 0.75rem; }
label.check { flex-direction: row; align-items: center; font-weight: 500; font-size: 0.92rem; min-height: 44px; }
label.check input { margin-right: 10px; width: 22px; height: 22px; accent-color: var(--navy); }
select, input[type=text], input[type=password], textarea { font: inherit; font-weight: 400; color: var(--ink); padding: 11px 12px; border: 1px solid #b7c1cf; border-radius: 10px; background: #fff; width: 100%; min-height: 46px; }
select:focus, input:focus, textarea:focus { outline: 3px solid var(--hivis); outline-offset: 0; border-color: var(--navy); }
textarea { resize: vertical; min-height: 140px; line-height: 1.5; }

.row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.row.wrap { flex-wrap: wrap; }
.notice { background: var(--navy-soft); border: 1px solid #c5d3e6; color: var(--navy); padding: 10px 12px; border-radius: 10px; }
.error { background: var(--red-bg); border: 1px solid #f5b5af; color: var(--red); padding: 10px 12px; border-radius: 10px; }

/* ══ RECORD ══ */
.view-record { color: var(--on-navy); display: flex; flex-direction: column; gap: 16px; }
.rec-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.eyebrow { color: var(--on-navy-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 800; }
.rec-sub { margin: 2px 0 0; color: #d7e0ec; font-size: 0.92rem; }
.type-pill { flex: 0 1 auto; max-width: 50%; }
.type-pill select { width: auto; max-width: 100%; min-height: 38px; padding: 6px 30px 6px 12px; border-radius: 999px; border: 0; font-weight: 700; font-size: 0.85rem; color: var(--navy); }
.rec-centre { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 6px 0; }
.rec-timer { font-family: var(--mono); font-size: 2.75rem; font-weight: 500; letter-spacing: 0.02em; line-height: 1; }
.rec-state { display: flex; align-items: center; gap: 8px; color: #d7e0ec; font-size: 0.9rem; min-height: 1.5em; text-align: center; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--on-navy-muted); flex: none; }
.rec-dot.on { background: var(--rec); animation: pulse 1.2s infinite; }
.rec-dot.offline { background: var(--hivis); animation: pulse 2s infinite; }
.rec-button { width: 132px; height: 132px; border-radius: 50%; padding: 0; background: var(--hivis); border: 6px solid rgba(255,209,0,0.3); box-shadow: 0 0 0 10px rgba(255,209,0,0.1); display: flex; align-items: center; justify-content: center; color: var(--navy); }
.rec-button:hover { background: #ffdb33; }
.rec-button .mic { width: 22px; height: 34px; border-radius: 11px; margin: 0 0 10px; }
.rec-button .mic::after { left: -8px; right: -8px; bottom: -11px; height: 14px; border-width: 3px; border-radius: 0 0 16px 16px; }
.rec-button .stop { display: none; width: 38px; height: 38px; border-radius: 6px; background: var(--navy); }
.rec-button.on .mic { display: none; } .rec-button.on .stop { display: block; }
.rec-label { color: var(--on-navy-muted); font-size: 0.85rem; }
.rec-notice { margin: 0; font-size: 0.8rem; color: var(--on-navy-muted); background: rgba(255,255,255,0.06); border-radius: 10px; padding: 8px 12px; }
.rec-coverage { background: rgba(255,255,255,0.06); border-radius: 10px; padding: 8px 12px; font-size: 0.85rem; color: #d7e0ec; }
.rec-coverage summary { cursor: pointer; font-weight: 700; color: var(--on-navy); min-height: 28px; }
.rec-coverage ul { margin: 6px 0 2px; padding-left: 18px; } .rec-coverage li { margin: 2px 0; }
.transcript { background: var(--navy-2); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.transcript-head { display: flex; justify-content: space-between; gap: 8px; font-size: 0.75rem; color: var(--on-navy-muted); }
.transcript textarea { background: transparent; color: var(--on-navy); border: 0; padding: 0; min-height: 170px; font-size: 1rem; line-height: 1.55; }
.transcript textarea::placeholder { color: var(--on-navy-faint); }
.transcript textarea:focus { outline: none; box-shadow: none; }
.transcript:focus-within { box-shadow: 0 0 0 3px var(--hivis); }
.rec-actions { display: flex; gap: 10px; }
.rec-actions .primary { flex: 1; }
body.dark .foot { color: var(--on-navy-faint); }
body.dark .foot strong { color: var(--on-navy-muted); }

/* ══ REPORT ══ */
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0 0 14px; }
.step-tab { display: flex; flex-direction: column; gap: 6px; background: none; border: 0; padding: 4px 0 6px; text-align: left; font-size: 0.78rem; font-weight: 600; color: var(--muted); border-radius: 4px; min-height: 44px; }
.step-tab .bar { height: 4px; border-radius: 2px; background: var(--line); }
.step-tab.done .bar { background: var(--navy); }
.step-tab[aria-current="step"] { color: var(--navy); font-weight: 800; }

.notes-card { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 14px; color: var(--ink); font-weight: 400; }
.notes-card:hover { border-color: #9fb0c6; }
.notes-icon { width: 40px; height: 40px; flex: none; border-radius: 10px; background: var(--navy); color: var(--hivis); display: flex; align-items: center; justify-content: center; }
.notes-icon .mic { margin: 0 0 6px; }
.notes-text { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.notes-text .muted { font-size: 0.85rem; }
.notes-more { font-size: 0.85rem; font-weight: 800; color: var(--navy); }

/* Lookup */
details.lookup { background: var(--card); border: 1px dashed #8a97a8; border-radius: var(--radius); padding: 12px 14px; margin: 0 0 14px; }
details.lookup summary { cursor: pointer; display: flex; flex-direction: column; gap: 2px; color: var(--ink); list-style: none; }
details.lookup summary::-webkit-details-marker { display: none; }
details.lookup summary strong { color: var(--navy); }
.lookup-forms { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 8px; }
.lookup-form { display: flex; gap: 6px; flex-wrap: wrap; }
.lookup-form input { flex: 1 1 120px; }
.lookup-form button { white-space: nowrap; }
.lookup-results { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.hit { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: #fafbfd; }
.hit h4 { margin: 0 0 6px; font-size: 0.95rem; color: var(--navy); }
.hit label.field { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; font-size: 0.9rem; color: var(--ink); margin: 3px 0; min-height: 36px; }
.hit label.field input { width: auto; accent-color: var(--navy); }
.hit .sens { color: var(--red); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.hit .use { margin-top: 6px; }
.record-data { margin: 0 0 14px; background: var(--hivis-soft); border: 1px solid var(--hivis-dark); border-radius: 10px; padding: 8px 12px; font-size: 0.9rem; }
.record-data ul { margin: 4px 0 0; padding-left: 0; list-style: none; }
.record-data li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-top: 1px solid rgba(10,35,66,0.08); }
.record-data li button { padding: 0 6px; font-size: 0.8rem; background: none; border: 0; color: var(--red); cursor: pointer; }

/* Draft */
.gap-bar { position: sticky; top: calc(var(--top-h) + 4px); z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--hivis-soft); border: 1px solid var(--hivis-dark); border-radius: 12px; padding: 8px 8px 8px 14px; margin: 0 0 10px; font-weight: 800; box-shadow: 0 4px 12px rgba(10,35,66,0.08); }
.progress { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.progress span { font-size: 0.7rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: #e3e8ef; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.progress span.done { background: var(--navy); color: #fff; }
.progress span.live { background: var(--hivis); color: var(--navy); animation: pulse 1s infinite; }
.sections { display: flex; flex-direction: column; gap: 12px; margin: 0 0 14px; }
.sec { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; background: var(--navy-soft); }
.sec-head h3 { margin: 0; font-size: 0.75rem; color: var(--navy); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 800; }
.sec-head .pill { font-size: 0.75rem; padding: 3px 10px; border-radius: 999px; background: var(--hivis); color: var(--navy); font-weight: 800; border: 0; cursor: pointer; font-family: inherit; min-height: 28px; }
.sec textarea { border: 0; border-radius: 0; min-height: 90px; padding: 12px 14px; font-size: 0.97rem; line-height: 1.55; }
.sec textarea:focus { outline: none; box-shadow: inset 0 0 0 3px var(--hivis); }
.sec .markers { list-style: none; margin: 0; padding: 10px 14px 12px; display: grid; gap: 10px; border-top: 1px solid var(--hivis-dark); background: var(--hivis-soft); }
.sec .markers li { display: grid; gap: 5px; }
.sec .markers .ask { font-size: 0.88rem; font-weight: 700; color: var(--ink); }
.sec .markers .ask::before { content: "To confirm: "; font-weight: 400; }
.sec .markers .fill { display: flex; gap: 6px; }
.sec .markers input { flex: 1; min-width: 0; min-height: 44px; }
.sec .markers button { white-space: nowrap; min-height: 44px; }
.sec .markers [data-act="fill"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.sec .refine { display: flex; gap: 8px; padding: 8px 14px 12px; border-top: 1px solid var(--line); background: #f7f9fc; }
.sec .refine input { flex: 1; min-height: 40px; padding: 8px 10px; font-size: 0.9rem; }
.sec .refine button { white-space: nowrap; }
.sec.busy { opacity: 0.7; }

/* Use */
.check-line { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: var(--hivis-soft); border: 1px solid var(--hivis-dark); font-weight: 600; }
.check-line.ok { background: var(--green-bg); border-color: #a6dcbd; color: var(--green); }
.check-list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 8px; }
.ci { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); }
.ci-mark { width: 24px; height: 24px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.8rem; }
.ci.ok .ci-mark { background: var(--green-bg); color: var(--green); }
.ci.gap .ci-mark { background: var(--hivis); color: var(--navy); }
.ci.miss .ci-mark { background: var(--red-bg); color: var(--red); }
.ci.na .ci-mark { background: #e3e8ef; color: var(--muted); }
.ci-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; align-items: flex-start; }
.ci-text { font-size: 0.92rem; }
.ci-meta { font-size: 0.8rem; color: var(--muted); }
.ci.miss .ci-meta { color: var(--red); font-weight: 600; }
.ci button { margin-top: 2px; min-height: 36px; }
.use-actions { display: flex; flex-direction: column; gap: 10px; margin: 0 0 8px; }
.use-actions .secondary { border-color: var(--navy); }
.clear-zone { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 14px; text-align: center; }

/* ── Record and Report: two buttons under the header, sticky so they stay in reach ── */
.tabs { position: sticky; top: 0; z-index: 15; display: flex; justify-content: center; gap: 8px; padding: 10px 16px; background: var(--bg); }
body.dark .tabs { background: var(--navy); }
.tab { flex: 0 1 220px; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; padding: 8px 18px; border-radius: 999px; border: 1px solid #b7c1cf; background: #fff; color: var(--navy); font-size: 0.95rem; font-weight: 700; }
.tab:hover { background: var(--navy-soft); }
.tab[aria-current="page"] { background: var(--navy); border-color: var(--navy); color: #fff; }
body.dark .tab { background: transparent; color: var(--on-navy-muted); border-color: rgba(255,255,255,0.35); }
body.dark .tab:hover { background: rgba(255,255,255,0.08); }
body.dark .tab[aria-current="page"] { background: var(--hivis); border-color: var(--hivis); color: var(--navy); }
.tab .mic { margin: 0 0 6px; }

/* The microphone glyph, drawn in CSS (no icon font, no inline SVG needed). */
.mic { display: inline-block; width: 10px; height: 15px; border-radius: 5px; background: currentColor; position: relative; }
.mic::after { content: ""; position: absolute; left: -4px; right: -4px; bottom: -6px; height: 8px; border: 2px solid currentColor; border-top: 0; border-radius: 0 0 10px 10px; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* Acceptable-use dialog */
.overlay { position: fixed; inset: 0; background: rgba(6,22,48,0.72); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 20; }
.dialog { background: #fff; color: var(--ink); border-radius: var(--radius); max-width: 560px; width: 100%; padding: 20px; border-top: 6px solid var(--hivis); }
.dialog h2 { margin-bottom: 8px; }
.dialog ul { padding-left: 20px; margin: 8px 0 16px; } .dialog li { margin: 6px 0; }

.idle-bar { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabs-h) + 12px + env(safe-area-inset-bottom)); z-index: 25; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--hivis-soft); color: var(--ink); border: 2px solid var(--hivis-dark); border-radius: 12px; padding: 10px 10px 10px 14px; font-weight: 700; font-size: 0.9rem; box-shadow: 0 6px 20px rgba(0,0,0,0.25); max-width: 616px; margin: 0 auto; }
.foot { margin-top: 20px; color: var(--muted); font-size: 0.78rem; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + 16px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 0.9rem; box-shadow: 0 6px 20px rgba(0,0,0,0.25); z-index: 30; border: 2px solid var(--hivis); max-width: calc(100% - 32px); }

/* ── Wider screens: use the width rather than a phone column ── */
@media (min-width: 900px) {
  .view-record { max-width: 820px; margin: 0 auto; }
  #stepDetails .grid { grid-template-columns: 1fr 1fr; column-gap: 16px; }
  .use-actions { flex-direction: row; } .use-actions button { flex: 1; }
  #stepUse { max-width: 820px; margin: 0 auto; }
}
@media (min-width: 1000px) {
  .sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
