/* Field agents app. System fonts only (no downloads), flat colours, no blur filters: cheap on low-end phones. */
:root {
    color-scheme: dark;
    --bg: #0b0f16;
    --panel: #121925;
    --panel-2: #182131;
    --line: #232e40;
    --line-2: #2f3c52;
    --text: #e8edf4;
    --muted: #8d9ab0;
    --accent: #f59e2b;
    --accent-ink: #1a1206;
    --accent-soft: #f59e2b1f;
    --green: #3ecf8e;
    --red: #ff7a6e;
    --amber: #ffc46b;
    --blue: #6aa8ff;
    --violet: #b48cff;
    --r: 18px;
    font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100dvh; overscroll-behavior-y: none; padding-bottom: env(safe-area-inset-bottom); }
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
button, a, label, summary { touch-action: manipulation; user-select: none; -webkit-user-select: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Header ---------- */

.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: calc(14px + env(safe-area-inset-top)) 16px 14px; background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { min-width: 0; }
.brand div { display: grid; gap: 3px; }
.brand strong { font-size: 11px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--accent); }
body.in .brand strong { display: none; }
.brand span, .brand small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand span { font-size: 15px; font-weight: 700; }
.brand small { font-size: 12px; color: var(--muted); }
.net { flex: none; width: 10px; height: 10px; margin-right: 4px; border-radius: 50%; background: var(--muted); }
.net.on { background: var(--green); box-shadow: 0 0 0 4px #3ecf8e2e; }
.net.off { background: var(--amber); box-shadow: 0 0 0 4px #ffc46b2e; animation: pulse 1.6s ease-in-out infinite; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- Layout ---------- */

.screen { max-width: 560px; margin: 0 auto; padding: 16px 16px 24px; }
.card { padding: 16px; margin-bottom: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 12px; }
/* Text-looking button inside a sentence */
.inline-link { background: none; border: 0; padding: 0; font: inherit; color: var(--blue); text-decoration: underline; cursor: pointer; }
.center-text { text-align: center; margin-top: 12px; }
h1 { font-size: 26px; line-height: 1.2; margin: 16px 0 8px; letter-spacing: -.3px; }
h2 { font-size: 17px; margin: 0; }

.hero { padding: 24px 4px 20px; text-align: center; }
.hero img { border-radius: 18px; }
.hero .muted { max-width: 340px; margin: 0 auto; }

.step { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
/* Steps number themselves, skipping hidden cards */
#report-form { counter-reset: step; }
.step b::before { counter-increment: step; content: counter(step); }
.step b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; }

/* ---------- Fields ---------- */

.field { display: block; margin-top: 14px; }
.field:first-child, .step + .field, [data-for] > .field:first-child { margin-top: 0; }
[data-for] + [data-for] { margin-top: 14px; }
.field > span { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: #b9c3d2; }
.field em { font-style: normal; font-weight: 500; color: var(--muted); }

input, select, textarea { width: 100%; padding: 13px 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg); color: var(--text); font: inherit; font-size: 16px; appearance: none; -webkit-appearance: none; transition: border-color .15s; }
input[type=checkbox] { appearance: auto; -webkit-appearance: checkbox; width: 20px; height: 20px; padding: 0; flex: 0 0 20px; accent-color: var(--accent); }
.field > span:has(input[type=checkbox]) { justify-content: flex-start; align-items: center; gap: 10px; }
input::placeholder, textarea::placeholder { color: #4f5d74; }
/* Count fields start at a legible 0 that gives way as soon as a number is entered */
input[type=number]::placeholder { color: var(--muted); opacity: 1; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: none; min-height: 92px; }
input[type=number] { -moz-appearance: textfield; font-variant-numeric: tabular-nums; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pin { letter-spacing: 8px; font-size: 20px; text-align: center; }

/* Custom polling-unit chooser: bounded, searchable choices with the same selected treatment as segments. */
.unit-picker { width: 100%; min-width: 0; }
.unit-picker > summary { display: flex; align-items: center; gap: 10px; padding: 13px 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg); cursor: pointer; list-style: none; }
.unit-picker > summary::-webkit-details-marker { display: none; }
.unit-picker > summary span { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.unit-picker > summary svg { flex: none; color: var(--accent); }
.unit-picker .chevron { color: var(--muted); }
.unit-picker[open] .chevron { transform: rotate(180deg); }
.unit-menu { margin-top: 8px; padding: 10px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg); }
.unit-options { display: grid; gap: 4px; max-height: 280px; overflow-y: auto; margin-top: 8px; }
.unit-choice { display: grid; gap: 4px; width: 100%; min-width: 0; padding: 12px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--text); text-align: left; font: inherit; overflow-wrap: anywhere; cursor: pointer; }
.unit-choice small { color: var(--muted); }
.unit-choice[aria-pressed="true"] { background: var(--panel-2); border-color: var(--line-2); }
.unit-choice:hover { background: var(--panel); }
.unit-choice:focus-visible, .unit-picker > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pair .field { margin-top: 0; }

/* Report kind tiles: flat squares; the chosen one is filled solid */
.kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kind { --c: var(--accent); display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
/* The fifth field-agent action fills the final row without an empty grid cell. */
.kind[data-kind="result"] { grid-column: 1 / -1; align-items: center; text-align: center; }
.kind:active { background: var(--panel-2); }
.kind svg { width: 22px; height: 22px; margin-bottom: 10px; color: var(--c); stroke-width: 1.8; }
.kind strong { font-size: 15px; font-weight: 600; }
.kind small { font-size: 12px; color: var(--muted); }
.kind.active { border-color: var(--c); background: var(--c); color: #0b0f16; }
.kind.active svg, .kind.active small { color: #0b0f16; }
.k-incident { --c: var(--red); }
.k-report { --c: var(--blue); }
.k-result { --c: var(--green); }
.k-checkin { --c: var(--violet); }
.k-collation { --c: var(--amber); }

/* Segmented radio groups */
.segments { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line-2); }
.segments.wrap { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.segments label { position: relative; }
.segments input { position: absolute; opacity: 0; pointer-events: none; }
.segments span { display: block; padding: 9px 4px; border-radius: 9px; font-size: 13px; font-weight: 600; text-align: center; color: var(--muted); cursor: pointer; transition: background-color .15s, color .15s; }
.segments input:checked + span { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.segments input:focus-visible + span { outline: 2px solid var(--accent); }
.severity .s-warning input:checked + span { background: #3a2c0f; color: var(--amber); }
.severity .s-serious input:checked + span { background: #3d2214; color: #ff9f5a; }
.severity .s-critical input:checked + span { background: #3f1a18; color: var(--red); }

/* Each party has one full-width row, with matching side padding while editing and saved. */
.votes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.vote.field { display: flex; align-items: center; gap: 20px; min-width: 0; min-height: 64px; margin: 0; padding: 0 20px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--panel-2); }
.vote.field > span { flex: none; margin: 0; }
.vote:focus-within { border-color: var(--accent); }
.vote input { flex: 1; min-width: 0; padding: 12px 0; border: 0; background: transparent; text-align: right; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; box-shadow: none; }
#results-figures .saved-count { min-height: 64px; padding: 0 20px; }
#results-saved-note { margin-top: 10px; }
#results-dialog h2 { margin: 0 0 8px; font-size: 18px; }
#results-dialog p { margin-bottom: 0; }

/* Tappable option list (incident types): radios styled as tiles */
/* Option lists (incident types, PU status): each group is one ruled list. The chosen row fills solid with a tick. */
#incident-types, #pu-status { display: grid; gap: 22px; }
.incident-group { --c: var(--blue); display: block; }
.incident-group.s-warning { --c: var(--amber); }
.incident-group.s-serious { --c: #ff9f5a; }
.incident-group.s-critical { --c: var(--red); }
.incident-group.s-ok { --c: var(--green); }
.incident-group h4 { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.incident-group h4::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 2px; background: var(--c); vertical-align: 1px; }
.incident-group label { position: relative; display: block; }
.incident-group label + label .incident-text { border-top: 0; }
.incident-group label:first-of-type .incident-text { border-radius: 8px 8px 0 0; }
.incident-group label:last-of-type .incident-text { border-radius: 0 0 8px 8px; }
.incident-group label:only-of-type .incident-text { border-radius: 8px; }
.incident-group input { position: absolute; opacity: 0; pointer-events: none; }
.incident-text { position: relative; display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 52px; padding: 11px 48px 11px 16px; border: 1px solid var(--line-2); background: var(--panel); cursor: pointer; }
.incident-text strong { font-size: 15px; font-weight: 600; line-height: 1.25; }
.incident-text small { font-size: 12.5px; line-height: 1.3; color: var(--muted); }
.incident-check { position: absolute; right: 16px; top: 50%; width: 18px; height: 18px; margin-top: -9px; }
.incident-group label:active .incident-text { background: var(--panel-2); }
.incident-group input:checked ~ .incident-text { background: var(--c); border-color: var(--c); color: #0b0f16; }
.incident-group input:checked ~ .incident-text small { color: #0b0f16cc; }
.incident-group input:checked ~ .incident-check { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230b0f16' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12.5l5 5L20 6.5'/%3E%3C/svg%3E") center / 18px no-repeat; }
.incident-group input:focus-visible ~ .incident-text { outline: 2px solid var(--accent); outline-offset: 2px; position: relative; z-index: 1; }
.state-grid { display: block; }

/* ---------- Buttons ---------- */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 16px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--panel-2); color: var(--text); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; transition: transform .1s, opacity .15s, background-color .15s; }
.btn:active { transform: scale(.98); }
.btn.block { width: 100%; }
.btn.accent { border-color: transparent; background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.small { min-height: 36px; padding: 0 14px; border-radius: 10px; font-size: 13px; }
.btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.btn.busy svg { animation: spin .8s linear infinite; }
.icon-btn { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 10px; background: none; color: var(--muted); cursor: pointer; }
.icon-btn:active { background: var(--panel-2); }
.icon-btn:disabled { opacity: .35; }
.icon-btn.busy svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Action dock stays reachable above the keyboard and home bar while the form scrolls */
.dock { position: sticky; bottom: 0; z-index: 3; margin: 0 -16px 20px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); }
.dock .hint { margin: 0 0 10px; font-size: 13px; color: var(--muted); text-align: center; }
.dock #form-error { color: var(--amber); }
.dock .pair { margin-bottom: 6px; }
.delivery-actions .btn { min-width: 0; padding-inline: 8px; font-size: clamp(12px, 3.4vw, 15px); gap: 6px; }
.delivery-actions .btn svg { flex-shrink: 0; }

/* Delivery notice: solid pill with breathing room above the form; hidden while empty */
#delivery-status { display: flex; align-items: center; gap: 10px; margin: 14px 0 20px; padding: 12px 14px; border-radius: 12px; background: var(--panel); color: var(--text); font-size: 14px; font-weight: 600; line-height: 1.35; }
#delivery-status:empty { display: none; }
#delivery-status::before { content: ""; flex: none; width: 22px; height: 22px; border-radius: 50%; background: #2a3446 center / 14px no-repeat; }
#delivery-status[data-tone="error"] { background: #3f1a18; color: #ffb4ac; }
#delivery-status[data-tone="error"]::before { background-color: #6b2a25; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffb4ac' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M12 6v8M12 18h.01'/%3E%3C/svg%3E"); }
.error { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: #3f1a18; color: #ffb4ac; font-size: 14px; }
#login-form .btn { margin-top: 18px; }

/* GPS status card */
.gps { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; }
.gps div { flex: 1; min-width: 0; }
.gps strong { font-size: 14px; }
.gps p { margin: 1px 0 0; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.gps-ico { width: 26px; height: 26px; color: var(--muted); }
.gps.ok .gps-ico { color: var(--green); }
.gps.wait .gps-ico { color: var(--amber); animation: pulse 1.6s ease-in-out infinite; }
.gps.far { border-color: #5a3d14; }
.gps.far .gps-ico { color: var(--amber); }
.gps.bad { border-color: #5a2420; }
.gps.bad .gps-ico { color: var(--red); }

/* ---------- Install banner ---------- */

.install { display: flex; align-items: center; gap: 12px; max-width: 528px; margin: 12px auto 0; padding: 12px 8px 12px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); animation: rise .3s ease-out; }
@media (max-width: 560px) { .install { margin: 12px 16px 0; } }
.install .ico { width: 28px; height: 28px; color: var(--accent); }
.install div { flex: 1; min-width: 0; }
.install strong { font-size: 14px; }
.install p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.install p svg { width: 14px; height: 14px; vertical-align: -2px; color: var(--blue); }
@keyframes rise { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- History ---------- */

.badge { flex: none; padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; background: var(--panel-2); color: var(--muted); }
.badge.approved { background: #12301f; color: var(--green); }
.badge.rejected { background: #3f1a18; color: var(--red); }
.badge.pending { background: #2a1d0b; color: var(--amber); }
.badge.review { background: #1a2440; color: var(--blue); }
.badge.local { background: #2a1d0b; color: var(--amber); border: 1px dashed #5a3d14; }

.signout { display: flex; margin: 20px auto 0; }

/* ---------- Toast ---------- */

.toast { position: fixed; left: 50%; top: calc(64px + env(safe-area-inset-top)); z-index: 9; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px; background: #12301f; border: 1px solid #1f5236; color: #b6f2d3; font-size: 14px; font-weight: 600; box-shadow: 0 12px 30px #0008; animation: rise .25s ease-out; }

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

/* Calculated ballot totals remain visibly locked until the agent requests an override. */
.field > label > span { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: #b9c3d2; }
.field input:disabled { color: var(--muted); background: var(--panel); opacity: .7; cursor: not-allowed; }

/* Clock and camera stay inside focused dialogs on small screens. */
dialog { color: var(--text); background: var(--panel); border: 1px solid var(--line-2); border-radius: 18px; width: min(360px, calc(100vw - 32px)); max-height: 90dvh; overflow: auto; padding: 18px; }
dialog::backdrop { background: #000b; }
/* Every modal keeps its text and its buttons apart, so the buttons never crowd the copy above them */
dialog:not(.clock) .pair { margin-top: 20px; }
dialog h2 + p { margin-top: 0; }
#collation-confirm h2 { margin: 0; font-size: 18px; }

/* Time field: reads like an input, opens the clock */
.clock-pick { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 50px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg); color: var(--text); font: inherit; font-size: 16px; font-weight: 600; text-align: left; cursor: pointer; transition: border-color .15s; }
.clock-pick:active, .clock-pick:focus-visible { border-color: var(--accent); }
.clock-pick svg { width: 18px; height: 18px; color: var(--accent); }
.clock-pick .val { flex: 1; font-variant-numeric: tabular-nums; }
.clock-pick.empty .val { color: #4f5d74; font-weight: 500; }
.clock-pick .chev { color: var(--muted); }
/* Implicit "now" time: a quiet text line, not a field; "Edit" signals it can be tapped. */
.clock-pick.inline { min-height: 32px; padding: 0; border: 0; background: none; font-size: 15px; }
.clock-pick.inline .edit { color: var(--accent); font-size: 13px; font-weight: 600; }
.clock-pick.inline:not(.auto) { min-height: 50px; padding: 0 14px; border: 1px solid var(--line-2); background: var(--bg); }
.field > small { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); }

/* Clock dialog */
.clock-title { margin: 0 0 12px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.clock-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.clock-read { display: flex; align-items: center; gap: 2px; font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; }
.clock-read b { color: var(--muted); font-weight: 600; }
.clock-read button { padding: 2px 8px; border: 0; border-radius: 10px; background: none; color: var(--muted); font: inherit; cursor: pointer; }
.clock-read button[aria-pressed=true] { background: var(--accent-soft); color: var(--accent); }
.clock-ampm { display: grid; gap: 4px; padding: 4px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg); }
.clock-ampm button { padding: 6px 12px; border: 0; border-radius: 8px; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.clock-ampm button[aria-pressed=true] { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.clock-hint { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
#clock-face { position: relative; width: 260px; height: 260px; max-width: 100%; margin: 14px auto 18px; border-radius: 50%; background: var(--bg); border: 1px solid var(--line); }
#clock-face button { position: absolute; z-index: 1; width: 40px; height: 40px; transform: translate(-50%, -50%); border: 0; border-radius: 50%; background: none; color: var(--text); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
#clock-face button[aria-pressed=true] { background: var(--accent); color: var(--accent-ink); }
#clock-hand { position: absolute; left: calc(50% - 1px); top: 18%; height: 32%; width: 2px; background: var(--accent); transform-origin: bottom; transition: transform .15s; }
.clock-pivot { position: absolute; left: calc(50% - 4px); top: calc(50% - 4px); width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
#camera-video, #sheet-preview { width: 100%; max-height: 65dvh; object-fit: contain; border-radius: 12px; }
/* One camera action, followed by a compact saved-photo state. */
.camera-box { margin-bottom: 12px; }
.sheet-capture { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 76px; border: 1px dashed var(--line-2); background: var(--panel-2); }
.sheet-capture svg { flex: 0 0 26px; width: 26px; height: 26px; color: var(--accent); }
#sheet-feedback { margin: 10px 0 0; text-align: center; line-height: 1.45; }
#sheet-file-link { display: inline-block; margin: 10px 12px 0; font-size: 13px; }
/* The EC8A held for this unit, standing where the Take button was */
.sheet-held { margin: 0; overflow: hidden; border: 1px solid var(--line-2); border-radius: 14px; background: var(--panel-2); }
.sheet-held img { display: block; width: 100%; max-height: 240px; object-fit: cover; background: var(--bg); }
.sheet-held figcaption { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; font-size: 13px; color: var(--muted); }
.sheet-held figcaption b { color: var(--text); }
.sheet-held.waiting { border-color: #5a3d14; }
.sheet-held.waiting figcaption { color: var(--amber); }
/* Upload modal: picture, a bar, then what is happening and how long is left */
#sheet-dialog h2 { margin: 0 0 12px; font-size: 18px; }
#sheet-preview { margin-bottom: 14px; background: var(--bg); }
#sheet-document { display: block; margin-bottom: 14px; }
.sheet-progress { height: 8px; overflow: hidden; border-radius: 99px; background: var(--panel-2); }
.sheet-progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .2s; }
.sheet-progress.done i { background: var(--green); }
.sheet-progress.fail i { background: var(--amber); }
.sheet-status { min-height: 2.6em; margin: 10px 0 0; font-size: 14px; color: var(--muted); }
.sheet-status b { color: var(--text); }

/* Agent replies stay visually attached to the report they update. */
.agent-response { margin: 12px 0; padding: 12px; border-left: 2px solid var(--accent); border-radius: 8px; background: var(--panel-2); }
.agent-response p { white-space: pre-wrap; overflow-wrap: anywhere; }

/* An incomplete draft cannot hand off an SMS, even when the link remains visible. */
#sms-open[aria-disabled="true"] { opacity: .35; cursor: not-allowed; pointer-events: none; }

/* Number pad: docked sheet for count fields (see numpad.js) */
body.np-open { padding-bottom: calc(var(--np-h, 0px) + 12px); }
.numpad { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line-2); border-radius: 20px 20px 0 0; box-shadow: 0 -12px 32px #0009; max-width: 560px; margin: 0 auto; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.np-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 4px 6px; }
.np-info { display: flex; flex-direction: column; min-width: 0; }
.np-label { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-value { font-size: 28px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.np-value.empty { color: #4f5d74; }
.np-clear { padding: 10px 14px; border: 0; border-radius: 10px; background: none; color: var(--blue); font: inherit; font-size: 14px; font-weight: 600; }
/* Keep the dismiss action visible beside Clear without squeezing the party label. */
.np-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.np-close { min-height: 44px; padding: 10px 14px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel-2); color: var(--text); font: inherit; font-size: 14px; font-weight: 700; }
.np-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.np-warn { margin: 0 4px 8px; padding: 8px 10px; border-radius: 10px; background: #3a2c0f; color: var(--amber); font-size: 13px; }
.np-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.np-keys button { height: 44px; border: 0; border-radius: 10px; background: var(--panel-2); color: var(--text); font: inherit; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.np-keys button:active { background: var(--line-2); }
.np-keys .np-back { display: grid; place-items: center; color: var(--muted); }
.np-keys .np-back svg { width: 28px; height: 28px; }
.np-next { width: 100%; height: 44px; margin-top: 6px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font: inherit; font-size: 17px; font-weight: 700; }
.np-next.done { background: var(--green); }
.np-next:active { filter: brightness(.9); }
/* Count fields keep the focus ring while their pad is open; read-only must not look disabled */
input[type=number][readonly] { cursor: pointer; caret-color: transparent; }
@media (max-height: 560px) { .np-keys button { height: 44px; font-size: 22px; } .np-value { font-size: 26px; } }

/* Group digits in the field itself while retaining raw numeric inputs for reports and accessibility. */
.field > .np-number-field, .np-number-field { position: relative; display: block; min-width: 0; margin: 0; }
.np-number-field > input { color: transparent; -webkit-text-fill-color: transparent; }
.np-number-field > input::placeholder { color: transparent; -webkit-text-fill-color: transparent; }
.np-number-display { position: absolute; inset: 0; display: flex; align-items: center; padding: 13px 14px; color: var(--text); font-size: 16px; font-weight: 400; font-variant-numeric: tabular-nums; pointer-events: none; }
.np-number-field.empty .np-number-display { color: var(--muted); }
/* Override the party-label span rule so editable values fill the remaining row width. */
.vote.field > .np-number-field { flex: 1; }
.vote .np-number-display { justify-content: flex-end; padding: 12px 0; font-size: 22px; font-weight: 700; }
.np-locked > .np-number-field { display: none; }

/* Recorded numbers read as text; tapping asks before changing (numpad.js) */
.np-locked > input[type=number], .np-locked > span > input[type=number] { display: none; }
.np-text { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); font: inherit; text-align: left; }
.np-text b { font-size: 20px; font-variant-numeric: tabular-nums; }
.np-text i { font-style: normal; font-size: 12px; font-weight: 600; color: var(--accent); }
.vote.np-locked .np-text { border: 0; border-radius: 0; background: none; padding: 12px 0; justify-content: flex-end; flex: 1; min-width: 0; }
.vote.np-locked .np-text i { display: none; }
#np-confirm h2 { margin: 0 0 6px; font-size: 18px; }
#np-confirm .np-c-body { margin: 0; }

/* Saved counts: read-only figures, tap to edit after confirming */
.saved-counts { display: grid; gap: 8px; }
.saved-count { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 56px; padding: 0 16px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--panel-2); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.saved-count:active { transform: scale(.99); }
.saved-count span { font-size: 13px; font-weight: 600; color: #b9c3d2; }
.saved-count b { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
#counts-saved .muted { margin-top: 10px; }
#counts-dialog h2 { margin: 0 0 8px; font-size: 18px; }
#counts-dialog p { margin-bottom: 0; }

/* ---------- Desk requests ---------- */
/* Header inbox: the badge counts questions still waiting for a reply */
.bar .requests-btn { position: relative; margin-left: auto; color: var(--text); }
.bar .requests-btn svg { width: 22px; height: 22px; }
.requests-btn b { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--red); color: #1a0806; font-size: 11px; line-height: 18px; text-align: center; }
.requests-banner { display: flex; align-items: center; gap: 12px; width: 100%; border-color: #5a3d14; background: #2a1d0b; color: var(--text); font: inherit; text-align: left; cursor: pointer; animation: rise .3s ease-out; }
.requests-banner svg { width: 26px; height: 26px; color: var(--amber); }
.requests-banner span { display: grid; gap: 2px; }
.requests-banner small { color: var(--muted); font-size: 12px; }
.requests-head { display: flex; align-items: center; gap: 6px; margin: 0 0 12px -8px; }
.requests-head h1 { margin: 0; font-size: 20px; }
.requests-head svg { width: 22px; height: 22px; }
.alerts-card { display: flex; align-items: center; gap: 12px; }
.alerts-card .ico { width: 26px; height: 26px; color: var(--accent); }
.alerts-card div { flex: 1; min-width: 0; }
.alerts-card p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.requests { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.requests li { min-width: 0; }
.requests li.empty { padding: 28px 14px; border: 1px dashed var(--line); border-radius: 12px; text-align: center; color: var(--muted); }
.requests h3 { margin: 14px 0 0; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.2px; }
/* One request: status and age, what it is about, the question, then where. Wraps rather than clips on narrow phones. */
.request { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; width: 100%; padding: 14px 14px 12px 16px; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: background-color .15s, transform .1s; }
.request:active { background: var(--panel-2); transform: scale(.99); }
.request::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--line-2); }
.request.open { border-color: #5a3d14; background: #1d1a14; }
.request.open::before { background: var(--amber); }
.request.done::before { background: var(--green); opacity: .6; }
.request-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.request-top time { flex: none; font-size: 12px; color: var(--muted); }
.request-title { font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.request-q { margin: 0; font-size: 14px; line-height: 1.45; color: #c7d0dc; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.request-reply { margin: 0; padding: 8px 10px; border-radius: 10px; background: var(--panel-2); font-size: 13px; line-height: 1.4; color: var(--muted); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.request-reply b { color: var(--text); }
.request-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; font-size: 12px; color: var(--muted); }
.request-foot span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.request-foot svg { width: 16px; height: 16px; flex: none; transform: rotate(180deg); }
/* Bottom sheet: pinned to the bottom edge, full width on phones */
dialog.sheet { width: 100%; max-width: 560px; margin: auto auto 0; border-radius: 18px 18px 0 0; border-bottom: 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 88dvh; }
dialog.sheet[open] { animation: sheet-up .22s ease-out; }
dialog.sheet h2 { margin: 2px 0 10px; font-size: 17px; }
.query-question { margin: 0 0 6px; padding: 12px; border-radius: 12px; background: var(--panel-2); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.45; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Collation: the coordinator's own ward or LGA, shown as fixed text rather than a picker */
/* Compact status summary and two distinct touch targets, matching sheet capture. */
.collation-current { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 14px; margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.collation-current strong { color: var(--text); font-size: 14px; }
.collation-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.collation-actions.incident-group label .incident-text { min-height: 68px; border-top-width: 1px; border-radius: 14px; padding: 14px 38px 14px 14px; }
.collation-actions .incident-text { background: var(--panel-2); }
.collation-actions .incident-check { right: 12px; }
#collation-hint { margin: 10px 0 16px; text-align: center; }


