:root {
    --bg: #f6f7f9; --panel: #fff; --text: #1d2330; --muted: #667085; --line: #e3e6eb;
    --accent: #1f6feb; --accent-soft: #e8f0fe; --playing: #fff4d6; --mark: #ffe58a; --bad: #b42318;
    --alert: #b54708; --alert-soft: #fff1e0; --emergency: #d92d20; --emergency-soft: #fde8e7; --fresh: #e6f6ea;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0f1216; --panel: #171b21; --text: #e6e9ee; --muted: #9aa4b2; --line: #2a303a;
        --accent: #5b9dff; --accent-soft: #1b2a42; --playing: #3a3016; --mark: #7a6320; --bad: #ff8a80;
        --alert: #f5a35b; --alert-soft: #3a2614; --emergency: #ff6b60; --emergency-soft: #3d1614; --fresh: #15301d;
        color-scheme: dark;
    }
}
/* the same rules when dark is chosen in the theme switch */
    :root[data-theme="dark"] {
        --bg: #0f1216; --panel: #171b21; --text: #e6e9ee; --muted: #9aa4b2; --line: #2a303a;
        --accent: #5b9dff; --accent-soft: #1b2a42; --playing: #3a3016; --mark: #7a6320; --bad: #ff8a80;
        --alert: #f5a35b; --alert-soft: #3a2614; --emergency: #ff6b60; --emergency-soft: #3d1614; --fresh: #15301d;
        color-scheme: dark;
    }

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; padding-bottom: 5.5rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h2 { font-size: 1.1rem; margin: 0 0 .5rem; }
h3 { font-size: 1rem; margin: 1.2rem 0 .4rem; }
header.top { background: var(--panel); border-bottom: 1px solid var(--line); padding: .6rem 1rem; }
header.top h1 { font-size: 1.1rem; margin: 0 0 .4rem; }
header.top h1 a { color: inherit; }
nav.tabs { display: flex; flex-wrap: wrap; gap: .2rem; margin-bottom: .6rem; }
nav.tabs a { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .7rem; border-radius: 6px; color: var(--muted); }
svg.icon { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
nav.tabs .icon { width: 1.2em; height: 1.2em; flex: none; }
nav.tabs a.current { background: var(--accent-soft); color: var(--text); font-weight: 600; }
form.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; }
form.filters label { display: flex; flex-direction: column; font-size: .75rem; color: var(--muted); gap: .15rem; }
input, select { font: inherit; font-size: .9rem; padding: .3rem .4rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); min-width: 0; }
form.filters select { max-width: 16rem; }
form.filters .tg select { max-width: 22rem; }
form.filters input[name=radio] { width: 9rem; }
form.filters input[name=q] { width: 12rem; }
form.add-alert input[name=value], form.add-alert input[name=name] { width: 100%; }
button, .button { font: inherit; font-size: .9rem; padding: .3rem .7rem; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
main { max-width: 1100px; margin: 0 auto; padding: .8rem 1rem; }
div.summary { color: var(--muted); font-size: .85rem; margin: .2rem 0 .8rem; display: flex; flex-wrap: wrap; gap: .3rem 1rem; align-items: center; }
div.summary .count { flex: 1 1 auto; }
div.summary .live { display: inline-flex; gap: .3rem; align-items: center; cursor: pointer; }
button.listen-live { font-size: .8rem; padding: .1rem .6rem; border-radius: 999px; border-color: var(--accent); color: var(--accent); }
button.listen-live.on { background: var(--emergency); border-color: var(--emergency); color: #fff; }
div.summary .stat { margin-right: .8rem; color: var(--muted); }
div.summary .stat.on { color: var(--text); font-weight: 600; }
.hidden-note { font-size: .8rem; color: var(--muted); align-self: center; }
.chips a { display: inline-block; background: var(--accent-soft); border-radius: 999px; padding: 0 .6rem; margin-right: .3rem; color: var(--text); }
.explain { margin: 0 0 .8rem; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.panel.pad { padding: .9rem 1rem; }
article.conv { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; margin-bottom: .8rem; overflow: hidden; }
article.conv.alert { border-color: var(--alert); }
article.conv.emergency { border-color: var(--emergency); box-shadow: 0 0 0 1px var(--emergency); }
article.conv.fresh { animation: fresh 3s ease-out; }
@keyframes fresh { from { background: var(--fresh); } to { background: var(--panel); } }
article.conv > header { display: flex; gap: .6rem; align-items: center; padding: .55rem .8rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
article.conv > header .title { flex: 1 1 18rem; min-width: 0; }
article.conv > header .tg { font-weight: 600; }
.badge { display: inline-block; font-size: .72rem; font-weight: 600; border-radius: 4px; padding: 0 .35rem; margin-left: .3rem; vertical-align: 1px; }
.badge.alert { background: var(--alert-soft); color: var(--alert); }
.badge.corrected { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.badge.emergency { background: var(--emergency); color: #fff; }
.badge.fire-ban { background: #dc262622; color: #b91c1c; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.play-conv { white-space: nowrap; }
.retranscribe-conv { white-space: nowrap; font-size: .85rem; padding: .25rem .6rem; }
.retranscribe-conv:hover { border-color: var(--accent); color: var(--accent); }
.retranscribe-conv.busy { opacity: .7; cursor: wait; }
ol.calls { list-style: none; margin: 0; padding: 0; }
ol.calls > li { display: grid; grid-template-columns: 2.2rem 9rem 1fr; gap: 0 .6rem; padding: .45rem .8rem; border-top: 1px solid var(--line); align-items: start; }
ol.calls > li:first-child { border-top: 0; }
li.call.playing { background: var(--playing); }
li.call.alert { box-shadow: inset 3px 0 0 var(--alert); }
li.call.missing .play { opacity: .35; }
li.call.missing .time::after { content: 'audio missing'; display: block; font-size: .75rem; color: var(--bad); }
li.call .play { width: 2rem; height: 2rem; padding: 0; border-radius: 50%; }
li.missed { color: var(--muted); background: repeating-linear-gradient(-45deg, transparent 0 8px, var(--bg) 8px 16px); }
ol.calls > li.missed { padding-top: .15rem; padding-bottom: .15rem; align-items: center; font-size: .85rem; }
li.missed .missed-icon { width: 2rem; text-align: center; color: var(--bad); }
li.missed .text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
ol.calls .time { font-variant-numeric: tabular-nums; }
/* an incident's conversations: events heard in a call are marked on its left, other timeline events sit between the calls */
ol.incident-calls > li { grid-template-columns: 3.6rem 9rem 1fr; }
li.call .lead { display: flex; flex-direction: column; align-items: center; gap: .2rem; }
.call-mark { display: flex; flex-direction: column; align-items: center; line-height: 1; cursor: help; }
.call-mark .event-icon { font-size: 1.7rem; width: 1.9rem; height: 1.9rem; display: inline-flex; align-items: center; justify-content: center; }
.call-mark .event-icon .pic, .call-mark .event-icon.pic { width: 1.9rem; height: 1.9rem; display: inline-block; }
.call-mark .mark-label { font-size: .62rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
li.conv-event { background: var(--bg); color: var(--muted); align-items: center; }
li.conv-event .event-lead { display: flex; justify-content: center; }
li.conv-event .event-lead .event-icon { font-size: 1.5rem; width: 1.9rem; height: 1.9rem; display: inline-flex; align-items: center; justify-content: center; }
li.conv-event .event-lead .event-icon .pic, li.conv-event .event-lead .event-icon.pic { width: 1.9rem; height: 1.9rem; display: inline-block; }
ol.calls > li.conv-break { display: block; text-align: center; padding: .25rem .8rem; background: var(--bg); }
li.conv-break .break-chip { font-size: .8rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: .1rem .6rem; }
ol.inter-events { margin: .5rem 0; border: 1px dashed var(--line); border-radius: 6px; overflow: hidden; }
.since-response { font-weight: 600; }
ol.calls .caller { font-weight: 600; font-size: .85rem; line-height: 1.25; overflow-wrap: anywhere; margin-bottom: .1rem; }
ol.calls .caller a.radio { color: inherit; }
ol.calls .caller .name-radio { font-weight: normal; }
.caller-icon { font-size: 1.1rem; margin-right: .25rem; vertical-align: middle; }
.caller-icon.pic { font-size: 1.6rem; }
ol.calls .text { min-width: 0; overflow-wrap: anywhere; }
.who { font-size: .8rem; color: var(--muted); }
.who a { color: inherit; border-bottom: 1px dotted currentColor; }
.who a:hover { color: var(--accent); text-decoration: none; }
button.edit-transcript { border: 0; background: none; padding: 0 .25rem; font-size: .85rem; color: var(--muted); cursor: pointer; }
button.edit-transcript:hover { color: var(--accent); }
.transcript-editor { margin: .2rem 0 .3rem; }
li.editing .badge.corrected, li.editing button.edit-transcript { display: none; }
.transcript-editor textarea { width: 100%; font: inherit; padding: .35rem .45rem; border: 1px solid var(--accent); border-radius: 6px;
    background: var(--bg); color: var(--text); resize: vertical; min-height: 2.6rem; }
.editor-actions { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-top: .3rem; }
.editor-actions button { font-size: .8rem; padding: .2rem .55rem; }
.editor-note.error { color: var(--bad); }
.editor-trained { margin-top: .3rem; }
.training-loading { min-height: 6rem; }
.badge.unsure { background: #d9770622; color: #d97706; }
.badge.public-hidden { background: #dc262622; color: #b91c1c; }
.badge.unusable { background: #64748b22; color: #64748b; }
.badge.tentative { background: #0284c722; color: #0284c7; }
.badge.queue-reason { font-weight: 500; font-size: .75rem; padding: .1rem .4rem; border-radius: 4px; }
.badge.queue-unsure { background: #d9770622; color: #d97706; }
.badge.queue-radios { background: #2563eb22; color: #2563eb; }
.badge.queue-rare_tg { background: #05966922; color: #059669; }
.queue-progress { margin-bottom: .8rem; }
.queue-stage { display: flex; align-items: baseline; gap: .5rem; font-size: .95rem; }
.queue-explainer { margin-top: .4rem; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .4rem; }
.queue-explainer .training-link { font-weight: 500; }
.queue-nav { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.queue-tab { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .75rem; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--text); font-size: .85rem; background: var(--panel); }
.queue-tab:hover { border-color: var(--muted); }
.queue-tab.current { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 500; }
.queue-tab .queue-pill { background: color-mix(in srgb, var(--text) 12%, transparent); color: inherit; padding: 0 .4rem; border-radius: 999px; font-size: .75rem; }
.queue-tab.current .queue-pill { background: rgba(255, 255, 255, .25); color: #fff; }
button.not-unusable-btn { border: 1px solid var(--line, #8884); background: none; border-radius: 4px; padding: 0 .35rem; font-size: .72rem; color: var(--muted); cursor: pointer; margin-left: .3rem; vertical-align: 1px; }
button.not-unusable-btn:hover { color: var(--text); border-color: var(--muted); }
.public-note { margin: 0 0 .75rem; }
header.top div.who { float: right; margin: .1rem 0 0 1rem; }
.editor-trained.error { color: var(--bad); }
form.filters label.check > span:last-child { display: inline-flex; gap: .3rem; align-items: center; color: var(--text); font-size: .9rem; padding: .3rem 0; }
button.name-radio { border: 0; background: none; padding: 0 .2rem; font-size: .8rem; color: var(--muted); cursor: pointer; }
button.name-radio:hover { color: var(--accent); }
mark { background: var(--mark); color: inherit; }
details { margin-top: .25rem; }
details summary { cursor: pointer; font-size: .8rem; color: var(--muted); }
table.kv, table.packets { border-collapse: collapse; font-size: .8rem; margin: .3rem 0; }
table.kv th { text-align: left; color: var(--muted); font-weight: normal; padding: .1rem .8rem .1rem 0; vertical-align: top; white-space: nowrap; }
table.kv td { padding: .1rem 0; overflow-wrap: anywhere; }
td.copies .copy { padding: .1rem 0; }
td.copies .copy.current { font-weight: 600; }
td.copies button { font-size: .85rem; }
td.copies audio { height: 1.8rem; width: 14rem; max-width: 60vw; vertical-align: middle; }
.radio-data { padding: .3rem .8rem .6rem; border-top: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }
table.packets th, table.packets td { text-align: left; padding: .15rem .6rem .15rem 0; vertical-align: top; }
table.packets td.detail { max-width: 36rem; overflow-wrap: anywhere; }
table.list { border-collapse: collapse; width: 100%; font-size: .9rem; }
table.list th { text-align: left; color: var(--muted); font-weight: normal; font-size: .8rem; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
table.list td { padding: .4rem .6rem; border-top: 1px solid var(--line); vertical-align: middle; }
table.list tbody tr:nth-child(even) td, table.list:not(:has(tbody)) tr:nth-child(even) td { background: color-mix(in srgb, var(--text) 2.5%, var(--panel)); }
table.incidents tbody.incident:nth-of-type(odd) td { background: color-mix(in srgb, var(--text) 4%, var(--panel)); }
table.list tr[data-href] { cursor: pointer; }
table.list tr:hover td, table.list tbody tr:hover td, table.incidents tbody.incident:has(tr[data-href]:hover) td { background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
table.list tr.emergency td { background: var(--emergency-soft); }
table.list tr.disabled td { color: var(--muted); background: color-mix(in srgb, var(--muted) 9%, var(--panel)) !important; }
table.list tr.disabled td strong { color: var(--muted); font-weight: 500; }
table.list tr.disabled .badge:not(.disabled-tag) { opacity: .5; }
table.list tr.disabled .badge.disabled-tag { background: var(--muted); color: var(--panel); opacity: 1; font-size: .7rem; vertical-align: 1px; }
table.list tr.disabled button[value="toggle_alert"], table.list tr.disabled .btn-enable {
    background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
table.list tr.disabled button[value="toggle_alert"]:hover, table.list tr.disabled .btn-enable:hover { filter: brightness(1.1); }
form.inline { display: flex; gap: .3rem; flex-wrap: wrap; margin: 0; }
.aliases { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.aliases form.alias { display: inline-block; background: var(--accent-soft); border-radius: 999px; padding: 0 .6rem; margin: 0; }
table.radios input[name=name] { width: 12rem; }
table.radios input[name=notes] { width: 16rem; }
nav.pages { display: flex; flex-wrap: wrap; gap: .3rem; justify-content: center; margin: 1rem 0; }
nav.pages a, nav.pages span { padding: .25rem .6rem; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
nav.pages span.current { background: var(--accent); color: #fff; border-color: var(--accent); }
nav.pages span.gap { border: 0; background: none; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
dialog { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); padding: 1rem; width: min(24rem, 92vw); }
dialog::backdrop { background: rgb(0 0 0 / .35); }
dialog label { display: flex; flex-direction: column; gap: .2rem; font-size: .8rem; color: var(--muted); margin-bottom: .6rem; }
dialog label.alias-offer { flex-direction: row; align-items: flex-start; gap: .4rem; color: var(--text); font-size: .85rem; }
dialog label.alias-offer[hidden] { display: none; }
.suggest-host { position: relative; }
.suggest-list { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin: .15rem 0 0; padding: .2rem 0; list-style: none;
    max-height: 14rem; overflow-y: auto; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px;
    box-shadow: 0 6px 18px rgb(0 0 0 / .18); min-width: 12rem; }
.suggest-list li { padding: .35rem .6rem; cursor: pointer; display: flex; flex-direction: column; font-size: .9rem; line-height: 1.25; }
.suggest-list li span { font-size: .75rem; color: var(--muted); }
.suggest-list li:hover, .suggest-list li.active { background: var(--accent-soft); }
dialog .station-aliases { display: flex; flex-direction: column; gap: .3rem; margin: -.2rem 0 .6rem; }
dialog .station-aliases[hidden] { display: none; }
dialog .station-aliases .aliases span { background: var(--accent-soft); border-radius: 999px; padding: 0 .6rem; font-size: .85rem; }
dialog .station-aliases .alias-add { display: flex; gap: .4rem; }
dialog .station-aliases .alias-new { flex: 1; }
dialog .error { color: var(--bad); font-size: .85rem; margin: 0 0 .6rem; }
dialog .actions { display: flex; gap: .5rem; justify-content: flex-end; }
#toasts { position: fixed; right: 1rem; bottom: 4.5rem; z-index: 20; display: flex; flex-direction: column; gap: .5rem; max-width: min(24rem, 92vw); }
.toast { background: var(--panel); border: 1px solid var(--alert); border-left: 4px solid var(--alert); border-radius: 8px; padding: .5rem .7rem; box-shadow: 0 4px 16px rgb(0 0 0 / .15); cursor: pointer; font-size: .85rem; }
.toast.emergency { border-color: var(--emergency); }
.toast b { display: block; }
#player { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--panel); border-top: 1px solid var(--line); padding: .5rem 1rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
#keys-dialog h3 { margin: 0 0 .6rem; }
table.keys { border-collapse: collapse; width: 100%; font-size: .9rem; margin-bottom: .6rem; }
table.keys th { text-align: left; font-size: .75rem; color: var(--muted); padding: .5rem 0 .2rem; }
table.keys td { padding: .15rem .5rem .15rem 0; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 .35rem; font: inherit; font-size: .8rem; background: var(--panel); }
#player #keys-open { margin-left: auto; padding: .1rem .5rem; }
#player[hidden], dialog:not([open]) { display: none; }
#player .now { flex: 1 1 14rem; min-width: 0; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#player audio { flex: 2 1 16rem; height: 2.2rem; min-width: 0; }
#player select { font-size: .85rem; padding: .2rem; }
#player label { display: inline-flex; gap: .3rem; align-items: center; cursor: pointer; white-space: nowrap; }
#player .listen-bar { display: inline-flex; gap: .3rem; align-items: center; }
#player .listen-group { max-width: 9rem; }
/* nothing playing: only Listen live, as a small pill at the bottom left (clear of a map's attribution) */
#player.idle { right: auto; left: .8rem; bottom: .8rem; padding: .3rem .4rem; border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 2px 8px #0002; }
#player.idle > :not(.listen-bar) { display: none; }
#conversations.oldest-first { display: flex; flex-direction: column-reverse; }
@media (max-width: 640px) {
    ol.calls > li { grid-template-columns: 2.2rem 1fr; }
    ol.incident-calls > li { grid-template-columns: 3.6rem 1fr; }
    ol.calls .text { grid-column: 1 / -1; }
    form.filters { display: grid; grid-template-columns: 1fr 1fr; }
    form.filters label.wide { grid-column: 1 / -1; }
    form.filters select, form.filters input, form.filters .tg select, form.filters input[name=radio], form.filters input[name=q], form.add-alert input[name=value] { width: 100%; max-width: none; }
    main { padding: .6rem .5rem; }
    table.radios input[name=name], table.radios input[name=notes] { width: 100%; }
}
section.training { margin-bottom: .8rem; }
.training-head { display: flex; flex-wrap: wrap; gap: .2rem .6rem; align-items: baseline; }
.training-head .stage { margin-left: auto; font-size: .85rem; color: var(--accent); font-weight: 600; }
.training .bar { position: relative; height: .7rem; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; margin: .6rem 0 1.5rem; }
.training .bar .fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 999px; }
.training .bar .mark { position: absolute; top: -.25rem; bottom: -.25rem; width: 2px; background: var(--muted); }
.training .bar .mark.reached { background: var(--accent); }
.training .bar .mark > span { position: absolute; top: 1.05rem; transform: translateX(-50%); white-space: nowrap; font-size: .72rem; color: var(--muted); }
.training .bar .mark:last-child > span { transform: translateX(-100%); }
.training .bar.runs .mark.run > span { top: -1.15rem; }          /* past runs above the bar, the next run below */
.training .bar.runs { margin-top: 1.6rem; }
.training .bar.runs:has(.mark.run:nth-of-type(3)) { margin-top: 2.8rem; }
.training .bar.runs .mark.run:nth-of-type(even) > span { top: -2.3rem; }   /* alternate labels so neighbours don't overlap */
.training-stats, .training-groups { display: flex; flex-wrap: wrap; gap: .2rem 1.1rem; margin-top: .3rem; }
.training p { margin: .5rem 0 0; }
li.call.training-done { opacity: .55; }
li.call.other-site { opacity: .55; }
.training .since-run { display: flex; flex-wrap: wrap; gap: .2rem .5rem; align-items: baseline; font-size: .9rem; margin: -.6rem 0 .3rem; }
.training .since-run .stage { margin-left: auto; font-size: .85rem; color: var(--accent); font-weight: 600; }
table.agencies { margin-top: .6rem; }
.table-scroll { overflow-x: auto; }
table.agencies td.agency { max-width: 20rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.list .num { text-align: right; font-variant-numeric: tabular-nums; }
details.models { margin-bottom: .8rem; padding: .6rem 1rem; }
details.models summary { cursor: pointer; font-weight: 600; }
details.models tr.live-model td { background: var(--accent-soft); }
.swatch { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; vertical-align: -1px; }
.models, .health-history, .health-host, .receiver-stats, .receiver-host, .health-coverage { --m0: #98a2b3; --m1: #1f6feb; --m2: #16a34a; --m3: #b54708; --m4: #7c3aed;
    --m5: #0e9384; --m6: #c11574; --m7: #ca8504; --m8: #475467; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .models, :root:not([data-theme="light"]) .health-history, :root:not([data-theme="light"]) .health-host, :root:not([data-theme="light"]) .receiver-stats, :root:not([data-theme="light"]) .receiver-host, :root:not([data-theme="light"]) .health-coverage { --m0: #667085; --m1: #5b9dff; --m2: #4ade80; --m3: #f5a35b; --m4: #a78bfa;
        --m5: #2ed3b7; --m6: #f670c7; --m7: #fdb022; --m8: #98a2b3; }
}
/* the same rules when dark is chosen in the theme switch */
    :root[data-theme="dark"] .models, :root[data-theme="dark"] .health-history, :root[data-theme="dark"] .health-host, :root[data-theme="dark"] .receiver-stats, :root[data-theme="dark"] .receiver-host, :root[data-theme="dark"] .health-coverage { --m0: #667085; --m1: #5b9dff; --m2: #4ade80; --m3: #f5a35b; --m4: #a78bfa;
        --m5: #2ed3b7; --m6: #f670c7; --m7: #fdb022; --m8: #98a2b3; }

.swatch.m0, .wer-chart .m0 { background: var(--m0); fill: var(--m0); }
.swatch.m1, .wer-chart .m1 { background: var(--m1); fill: var(--m1); }
.swatch.m2, .wer-chart .m2 { background: var(--m2); fill: var(--m2); }
.swatch.m3, .wer-chart .m3 { background: var(--m3); fill: var(--m3); }
.swatch.m4, .wer-chart .m4 { background: var(--m4); fill: var(--m4); }
.swatch.m5, .wer-chart .m5 { background: var(--m5); fill: var(--m5); }
.swatch.m6, .wer-chart .m6 { background: var(--m6); fill: var(--m6); }
.swatch.m7, .wer-chart .m7 { background: var(--m7); fill: var(--m7); }
.swatch.m8, .wer-chart .m8 { background: var(--m8); fill: var(--m8); }
.wer-chart { width: 100%; max-width: 640px; height: auto; display: block; }
.wer-chart .grid { stroke: var(--line); }
.wer-chart text { font-size: 10px; fill: var(--muted); }
.wer-chart text.value { fill: var(--text); }
.job-chart { max-width: 720px; }
.job-chart .dead, .swatch.dead { fill: var(--emergency); background: var(--emergency); }
.job-chart .queue { fill: var(--m3); }
.wer-chart.host-chart path { fill: none; stroke-width: 1.5; }
.host-chart path { stroke-linecap: round; }
.host-chart path.m1 { stroke: var(--m1); }
.host-chart path.m2 { stroke: var(--m2); }
.host-chart path.m3 { stroke: var(--m3); }
.host-chart path.m4 { stroke: var(--m4); }
.host-chart path.m5 { stroke: var(--m5); }
.host-chart path.m6 { stroke: var(--m6); }
.host-chart path.m7 { stroke: var(--m7); }
.host-chart path.m8 { stroke: var(--m8); }
.host-chart line.limit { stroke: var(--bad); stroke-width: 1; stroke-dasharray: 5 4; }
.swatch.limit { background: var(--bad); height: 2px; vertical-align: 3px; }
.host-chart path.max { opacity: .35; stroke-width: 1; }
.host-chart .hover { fill: transparent; }
.host-chart .hover:hover { fill: var(--line); opacity: .5; }
.swatch.faint { opacity: .35; }
.wer-chart.job-chart rect { stroke: none; }
.health-history h4 .swatch { margin-left: .6rem; }
/* Health page charts (chart_box): full width of the panel at a fixed height, the labels in HTML so they keep their size */
.chart-box { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr); grid-template-rows: 130px 1.3rem; margin: .3rem 0 .9rem; font-size: 10px; color: var(--muted); }
.chart-box .chart-y { position: relative; }
.chart-box .chart-y span { position: absolute; right: .4rem; transform: translateY(50%); line-height: 1; }
.chart-box svg.wer-chart { width: 100%; height: 100%; max-width: none; overflow: visible; }
.chart-box svg line, .chart-box svg path { vector-effect: non-scaling-stroke; }
.chart-box .chart-x { grid-column: 2; position: relative; overflow: hidden; }
.chart-box .chart-x span { position: absolute; top: .25rem; white-space: nowrap; }
@media (max-width: 640px) { table.agencies td.agency { max-width: 9rem; } }

/* Incidents */
.badge.open { background: var(--fresh); color: var(--text); }
div.summary .stale { color: var(--alert); }
article.incident { padding: .8rem 1rem; margin-bottom: 1rem; }
article.incident h2 { margin: 0 0 .5rem; font-size: 1.15rem; }
article.incident h3, h3.section { font-size: .9rem; margin: 1rem 0 .4rem; }
article.incident table.kv { font-size: .9rem; }
ol.timeline { list-style: none; margin: 0 0 .8rem; padding: 0; font-size: .85rem; position: relative; }
ol.timeline li { overflow-wrap: anywhere; }
ol.timeline.pages-list li { display: grid; grid-template-columns: 4.5rem 1fr; gap: 0 .6rem; padding: .15rem 0; }
ol.timeline:not(.pages-list) li.timeline-event {
    display: grid;
    grid-template-columns: 6.8rem 24px 1fr;
    gap: 0 .6rem;
    padding: 0;
    position: relative;
}
ol.timeline.days:not(.pages-list) li.timeline-event {
    grid-template-columns: 8.4rem 24px 1fr;
}

/* Continuous timeline spine and branch lines */
ol.timeline .spine-col {
    position: relative;
    width: 24px;
    align-self: stretch;
    min-height: calc(var(--gap, 0px) + 3.4rem);
    display: flex;
    justify-content: center;
}
ol.timeline .spine-col .spine-line {
    position: absolute;
    top: 0;
    bottom: -1px;
    left: 11px;
    width: 2px;
    background: color-mix(in srgb, var(--line) 60%, var(--muted));
}
ol.timeline > li.timeline-event:first-of-type .spine-col .spine-line {
    top: calc(var(--gap, 0px) + 1.7rem);
}
ol.timeline > li.timeline-event:last-of-type .spine-col .spine-line {
    bottom: auto;
    height: calc(var(--gap, 0px) + 1.7rem);
}
ol.timeline .spine-col .branch-line {
    position: absolute;
    top: calc(var(--gap, 0px) + 1.7rem);
    left: 11px;
    width: 13px;
    height: 2px;
    transform: translateY(-50%);
    background: color-mix(in srgb, var(--line) 60%, var(--muted));
}
ol.timeline .spine-col .node-dot {
    position: absolute;
    top: calc(var(--gap, 0px) + 1.7rem);
    left: 12px;
    width: 8px;
    height: 8px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: var(--accent);
    border: 1px solid var(--bg);
    z-index: 1;
}

/* Compressed break row for long gaps (>= 30 mins) */
ol.timeline li.timeline-break {
    display: grid;
    grid-template-columns: 6.8rem 24px 1fr;
    gap: 0 .6rem;
    align-items: center;
    padding: 0;
}
ol.timeline.days li.timeline-break {
    grid-template-columns: 8.4rem 24px 1fr;
}
ol.timeline li.timeline-break .time {
    display: none;
}
ol.timeline li.timeline-break .spine-break {
    grid-column: 2 / -1;
    display: flex;
    align-items: center;
    position: relative;
    height: 28px;
}
ol.timeline li.timeline-break .break-line {
    position: absolute;
    top: 0;
    bottom: -1px;
    left: 11px;
    width: 0;
    border-left: 2px dashed color-mix(in srgb, var(--line) 60%, var(--muted));
}
ol.timeline li.timeline-break .break-chip {
    margin-left: 24px;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .15rem .55rem;
    font-size: .74rem;
    font-weight: 500;
    color: var(--muted);
    background: color-mix(in srgb, var(--line) 35%, transparent);
    border: 1px dashed var(--line);
    border-radius: 999px;
    user-select: none;
}
ol.timeline li.timeline-break .break-chip .break-icon {
    opacity: .8;
}

/* Timeline time column with absolute and relative times */
ol.timeline:not(.pages-list) .time {
    padding-top: calc(var(--gap, 0px) + .35rem);
    padding-bottom: .35rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    min-height: 2.7rem;
    text-align: right;
    line-height: 1.25;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    user-select: none;
}
ol.timeline:not(.pages-list) .time .clock {
    font-size: .83rem;
    font-weight: 500;
}
ol.timeline:not(.pages-list) .time .ago {
    font-size: .72rem;
    color: var(--muted);
    opacity: .85;
}

/* Event content and icons */
ol.timeline .event-content {
    padding-top: calc(var(--gap, 0px) + .35rem);
    padding-bottom: .35rem;
    min-height: 2.7rem;
    display: flex;
    align-items: center;
    gap: .65rem;
    min-width: 0;
    overflow-wrap: anywhere;
    line-height: 1.4;
}
ol.timeline .event-icon {
    font-size: 2.7rem;
    line-height: 1;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
ol.timeline .event-icon.pic,
ol.timeline .event-icon .pic {
    width: 2.7rem;
    height: 2.7rem;
    display: inline-block;
}
ol.timeline .emoji-icon {
    font-size: 2.3rem;
}

/* Radio conversation formatting */
ol.timeline .radio-entry {
    display: inline;
}
ol.timeline .radio-entry a {
    font-weight: 600;
}
ol.timeline .radio-entry .summary {
    display: inline;
    margin: 0;
    color: var(--text);
}

ol.timeline .ambulance { color: #16a34a; }
ol.timeline .flagged { font-weight: 600; }
ol.timeline .flagged .muted { font-weight: normal; }
details[data-key="incident-pages"] summary { overflow-wrap: anywhere; }
.link-why { margin: .6rem 0 .2rem; }
.link-why span + span::before { content: " · "; }

/* Resources */
.suggestions { padding: .6rem 1rem; margin-bottom: .8rem; }
.suggestions h3 { font-size: .9rem; margin: 0 0 .2rem; }
.suggestions ul { margin: 0; padding-left: 1.1rem; font-size: .9rem; }
.suggestions li { padding: .15rem 0; }
button.name-radio.suggest { border: 1px solid var(--accent); color: var(--accent); font-size: .8rem; padding: 0 .4rem; border-radius: 999px; }
.linked-incident a { font-weight: 600; }
button.unlink-incident { border: 0; background: none; padding: 0 .25rem; font-size: .8rem; color: var(--muted); cursor: pointer; }
button.unlink-incident:hover { color: var(--alert); }
.linked-incident.removed { color: var(--muted); }
.attach-box { margin: .3rem 0; max-width: 34rem; }
.attach-box input { width: 100%; }
.attach-box ul { list-style: none; margin: .3rem 0 0; padding: 0; max-height: 14rem; overflow-y: auto; }
.attach-box li { padding: .15rem 0; }
button.remove-call { border: 0; background: none; padding: 0 .25rem; font-size: .8rem; color: var(--muted); cursor: pointer; }
button.remove-call:hover { color: var(--alert); }
li.call.off-incident { opacity: .55; }
.badge.off-incident { background: var(--bg); color: var(--muted); }
.badge.open.going { background: var(--alert-soft); color: var(--alert); }
.badge.done { background: var(--bg); color: var(--muted); }
.badge.agency-mfs { background: #d92d2022; color: #d92d20; }
.badge.agency-cfs { background: #eab30833; color: #a16207; }
.badge.agency-ses { background: #f9731622; color: #c2410c; }
.badge.agency-both { background: linear-gradient(90deg, #d92d2022 50%, #eab30833 50%); color: var(--text); }
abbr.kcode { text-decoration: underline dotted; text-underline-offset: 2px; cursor: help; }
table.list.suggest td { vertical-align: top; }

/* Agency colours: a stripe and a tint on each conversation's header */
article.conv { --agency: #98a2b3; }
article.conv.agency-mfs { --agency: #d92d20; }        /* red */
article.conv.agency-cfs { --agency: #eab308; }        /* yellow */
article.conv.agency-ses { --agency: #f97316; }        /* orange */
article.conv.agency-saas { --agency: #16a34a; }       /* green */
article.conv.agency-security { --agency: #2563eb; }   /* blue */
article.conv.agency-dew { --agency: #8b5a2b; }        /* brown */
article.conv.agency-sapol { --agency: #1e3a8a; }      /* navy */
article.conv.agency-transport { --agency: #9333ea; }  /* purple */
article.conv.agency-health { --agency: #0d9488; }     /* teal */
article.conv.agency-stjohn { --agency: #65a30d; }     /* lime */
article.conv.agency-disaster { --agency: #db2777; }   /* pink */
article.conv.agency-power { --agency: #a16207; }      /* dark gold */
article.conv.agency-water { --agency: #0891b2; }      /* cyan */
article.conv.agency-surf { --agency: #e11d48; }       /* rose */
article.conv.agency-roads { --agency: #475569; }      /* slate */
article.conv > header { border-left: 6px solid var(--agency); background: color-mix(in srgb, var(--agency) 13%, var(--panel)); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) article.conv.agency-sapol { --agency: #6d83d9; }
    :root:not([data-theme="light"]) article.conv.agency-roads { --agency: #94a3b8; }
    :root:not([data-theme="light"]) article.conv > header { background: color-mix(in srgb, var(--agency) 20%, var(--panel)); }
    :root:not([data-theme="light"]) .badge.agency-cfs { color: #eab308; }
    :root:not([data-theme="light"]) .badge.agency-mfs { color: #f87171; }
    :root:not([data-theme="light"]) .badge.agency-ses { color: #fb923c; }
}
/* the same rules when dark is chosen in the theme switch */
    :root[data-theme="dark"] article.conv.agency-sapol { --agency: #6d83d9; }
    :root[data-theme="dark"] article.conv.agency-roads { --agency: #94a3b8; }
    :root[data-theme="dark"] article.conv > header { background: color-mix(in srgb, var(--agency) 20%, var(--panel)); }
    :root[data-theme="dark"] .badge.agency-cfs { color: #eab308; }
    :root[data-theme="dark"] .badge.agency-mfs { color: #f87171; }
    :root[data-theme="dark"] .badge.agency-ses { color: #fb923c; }


/* A conversation linked to an incident: a mark at the right of its header */
a.incident-mark { margin-left: auto; display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .25rem .6rem; border-radius: 10px;
    border: 2px solid var(--line); background: var(--panel); color: var(--text); line-height: 1; }
a.incident-mark:hover { text-decoration: none; border-color: var(--accent); }
a.incident-mark .icon { font-size: 1.7rem; }
td.type-icon { font-size: 1.3rem; line-height: 1; text-align: center; padding-right: 0; width: 1.6em; }
td.type-icon .pic { font-size: 2rem; }
/* One icon out of icons.webp (index.php sets the image and its size) */
.pic { display: inline-block; width: 1em; height: 1em; vertical-align: middle; background-repeat: no-repeat; }
a.incident-mark .icon .pic { font-size: 2.4rem; }
a.incident-mark .ref { font-size: .7rem; font-weight: 600; white-space: nowrap; }
a.incident-mark.open { border-color: var(--emergency); }
a.incident-mark.maybe { opacity: .6; border-style: dashed; }
dialog label .hint { font-size: .72rem; }
table.radios input[name=resource] { text-transform: uppercase; }

/* Incidents: the open ones in their own block at the top; status under the number */
h3.section.open-now { color: var(--emergency); }
.table-wrap.open-now { border-color: var(--emergency); }
table.incidents td.ref .badge { margin-left: 0; margin-top: .15rem; }
/* Each incident is a tbody: its row, then its summary across Incident to Address (render_incident_row) */
table.incidents tr.summary-row td { border-top: 0; padding-top: 0; }
table.incidents .row-summary { max-width: 48rem; font-size: .85rem; line-height: 1.35; }
table.incidents .row-summary .label { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin-right: .2rem; }
table.incidents tbody.incident:has(tr.fresh) td { animation: fresh 3s ease-out; }
/* Alert SA: while the feed lists an incident its badge and feed lines link out (alertsa_link() in lib.php) */
a.alertsa { text-decoration: none; color: inherit; }
a.alertsa .badge::after, .alertsa-line a.alertsa::after { content: " ↗"; font-weight: normal; }
.alertsa-line a.alertsa { text-decoration: underline dotted; }
a.alertsa:hover .badge { filter: brightness(1.15); }
table.incidents tr.fresh td, table.page-stream tr.fresh td { animation: fresh 3s ease-out; }
.incident-nav { display: flex; gap: 1rem; align-items: center; }
.incident-nav .live { display: inline-flex; gap: .3rem; align-items: center; cursor: pointer; }
.incident-nav .follow { margin-left: auto; display: inline-flex; gap: .3rem; align-items: center; }

/* One incident: the map a fixed size at the top right, with the summary and a timeline of any
   length flowing beside it and then under it (stacked, map last, on a phone) */
article.incident { display: flow-root; }
article.incident h2 { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
article.incident h2 .type-icon { font-size: 1.8rem; line-height: 1; }
article.incident h2 .type-icon .pic { font-size: 2.6rem; }
.ticker { font-size: 1.05rem; font-weight: 600; margin-bottom: .3rem; }
.ticker .elapsed { font-variant-numeric: tabular-nums; }
.incident-map { display: flex; flex-direction: column; gap: .3rem; float: right; width: min(40%, 34rem); margin: 0 0 .8rem 1rem; }
.incident-map iframe, .incident-leaflet { width: 100%; height: 22rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
ol.timeline.days.pages-list li { grid-template-columns: 6.5rem 1fr; }
ol.timeline .radio-entry a { font-weight: 600; }
#conversations > article.conv:target { outline: 2px solid var(--accent); outline-offset: 2px; }
.wind-control { background: color-mix(in srgb, var(--panel) 88%, transparent); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
    padding: .25rem .5rem; display: flex; align-items: center; gap: .4rem; font-size: .75rem; line-height: 1.25; max-width: 11rem; }
.wind-control.far { opacity: .55; }
.wind-control svg { flex: none; color: #2563eb; }
.map-popout { width: 30px; height: 30px; line-height: 30px; text-align: center; font-size: 1.1rem; background: #fff; color: #333; text-decoration: none; cursor: pointer; }
body.map-popped { overflow: hidden; }
.incident-map.popped { position: fixed; inset: 0; z-index: 2000; float: none; width: auto; margin: 0; padding: 1rem; background: var(--bg); }
.incident-map.popped .incident-leaflet { flex: 1; height: auto; }
@media (max-width: 760px) {
    article.incident { display: flex; flex-direction: column; gap: 1rem; }
    .incident-map { float: none; width: auto; margin: 0; order: 2; }
    .incident-map iframe, .incident-leaflet { height: 16rem; }
    ol.timeline:not(.pages-list) li.timeline-event,
    ol.timeline:not(.pages-list) li.timeline-break {
        grid-template-columns: 5.6rem 20px 1fr;
        gap: 0 .4rem;
    }
    ol.timeline.days:not(.pages-list) li.timeline-event,
    ol.timeline.days:not(.pages-list) li.timeline-break {
        grid-template-columns: 6.6rem 20px 1fr;
    }
    ol.timeline .spine-col .spine-line,
    ol.timeline li.timeline-break .break-line {
        left: 9px;
    }
    ol.timeline .spine-col .branch-line {
        left: 9px;
        width: 11px;
    }
    ol.timeline .spine-col .node-dot {
        left: 10px;
    }
}
ol.timeline .radio-event a { margin-left: .2rem; }
ol.timeline .weather-line { color: var(--muted); }

/* Settings tab */
.settings-intro { margin-bottom: 1rem; }
.settings-tabs { margin: .6rem 0 0; padding-top: .6rem; border-top: 1px solid var(--line); gap: .35rem; }
.settings-tabs a.settings-tab { padding: .35rem .75rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); font-size: .88rem; text-decoration: none; }
.settings-tabs a.settings-tab:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.settings-tabs a.settings-tab.current { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.settings-search { margin: .6rem 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .8rem; }
.settings-search input[type=search] { flex: 1 1 18rem; max-width: 36rem; min-width: 0; font-size: 1rem; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); }
mark.settings-hit { background: color-mix(in srgb, #f5c400 55%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }
.settings-toc { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .8rem; margin: 0 0 .8rem; padding: .45rem .75rem; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.settings-toc a { font-weight: 500; }
.settings-toc code { font-size: .78rem; font-weight: 400; }
.settings-section { margin-bottom: 1rem; scroll-margin-top: 1rem; }
.settings-section-head { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; margin: 0 0 .2rem; }
.settings-section-head h3 { margin: 0; font-size: 1.05rem; }
.settings-section-head .section-key { font-family: ui-monospace, monospace; font-size: .82rem; color: var(--muted); }
table.settings { width: 100%; border-collapse: collapse; margin: .5rem 0 .8rem; }
table.settings th, table.settings td { text-align: left; vertical-align: top; padding: .45rem .5rem; border-top: 1px solid var(--line); }
table.settings th { width: 15rem; font-weight: 500; font-size: .88rem; }
table.settings tr.settings-subheading th { font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: color-mix(in srgb, var(--text) 3.5%, var(--panel)); padding: .4rem .5rem; }
table.settings .setting-label { display: block; font-weight: 600; color: var(--text); line-height: 1.25; }
table.settings .setting-var { display: block; font-family: ui-monospace, monospace; font-weight: 400; font-size: .76rem; color: var(--muted); margin-top: .12rem; }
table.settings td.value { width: 22rem; }
table.settings input.wide { width: 100%; box-sizing: border-box; }
table.settings textarea.wide { width: 100%; box-sizing: border-box; font: .8rem/1.35 ui-monospace, monospace; resize: vertical; }
table.settings input.num { width: 8rem; }
table.settings tr.ini-only { opacity: .65; }
table.settings details summary { cursor: pointer; color: var(--accent); }
table.settings details p { margin: .3rem 0 0; }
.source { font-weight: 600; }
.source-saved-here { color: var(--accent); }
.restart-needed { border: 1px solid var(--line); border-left: 4px solid #d97706; border-radius: 6px; padding: .5rem .8rem; margin: .6rem 0; }
.restart-needed ul { margin: .3rem 0 0; padding-left: 1.2rem; }
.saved-note { color: #16a34a; font-weight: 600; }
@media (max-width: 760px) {
    table.settings, table.settings tbody, table.settings tr, table.settings th, table.settings td { display: block; width: auto; }
    table.settings th { border-top: 1px solid var(--line); padding-bottom: 0; }
    table.settings td { border-top: 0; }
}

/* Radio suggestions: one radio's calls, loaded below the tables */
#radio-listen { margin-top: 1.2rem; scroll-margin-top: 1rem; }
#radio-listen article.radio-calls header { display: flex; align-items: center; gap: .6rem; }
#radio-listen article.radio-calls header .title { flex: 1; }
.close-radio-calls { background: none; border: 0; font-size: 1.1rem; cursor: pointer; color: var(--muted); }

.incident-summary { background: var(--accent-soft); border-radius: 6px; padding: .45rem .7rem; margin: .3rem 0 .7rem; line-height: 1.4; }
.incident-summary .label { font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin-right: .3rem; }
.incident-detail { margin: -.3rem 0 .7rem; padding: 0 .7rem; }
.incident-detail > summary { cursor: pointer; font-size: .85rem; color: var(--muted); }
.incident-detail p { margin: .4rem 0; line-height: 1.45; }
article.conv > header .conv-summary { font-size: .88rem; font-style: italic; margin-top: .3rem; padding: .25rem .5rem; border-left: 3px solid var(--line); border-radius: 0 6px 6px 0;
    background: color-mix(in srgb, var(--text) 7%, transparent); }   /* a tint of the text colour: shows on any agency colour, light or dark */

/* Accounts: login pages, the Users tab, who is logged in */
body.auth { padding: 0; min-height: 100vh; display: grid; place-items: center; }
.auth-box { width: min(24rem, calc(100vw - 2rem)); margin: 1rem; }
.auth-box h1 { font-size: 1.3rem; margin: 0 0 .8rem; }
.auth-box form, .account form, .account-security form, .user-edit form { display: flex; flex-direction: column; gap: .6rem; }
.auth-box form label, .account form label, .account-security form label, .user-edit form label { display: flex; flex-direction: column; gap: .15rem; font-size: .8rem; color: var(--muted); }
.auth-box form button, .account form button, .account-security form button, .user-edit form button { align-self: flex-start; }
.auth-box form.logout { margin-top: 1rem; }
.auth-error { color: var(--bad); background: var(--emergency-soft); border-radius: 6px; padding: .4rem .6rem; }
button.linkish { background: none; border: 0; padding: 0; color: var(--accent); font-size: inherit; }
button.danger { color: var(--bad); }
header.top form.who { float: right; display: flex; gap: .5rem; align-items: baseline; margin: .1rem 0 0 1rem; }
.flash { background: var(--fresh); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .8rem; margin-bottom: .8rem; }
.flash.error { background: var(--emergency-soft); color: var(--bad); }
.temp-password { margin-top: .4rem; }
.temp-password code { font-size: 1.05rem; background: var(--panel); padding: .1rem .4rem; border-radius: 4px; user-select: all; }

/* Your account page layout */
.account-page { max-width: 56rem; margin: 0 auto; }
.account-page .panel { margin-bottom: 1.25rem; }
.account-page .panel:last-child { margin-bottom: 0; }
.account-page h2 { margin-top: 0; margin-bottom: .4rem; font-size: 1.15rem; }
.account-page h3 { margin: 0 0 .4rem; font-size: .95rem; }
.account-page .intro { margin: 0 0 1.2rem; }

.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1.5rem 2.5rem; align-items: start; }
.account-details, .account-security { min-width: 0; }
.account-details table.kv { margin-bottom: .6rem; }
.account-security form { max-width: 22rem; }

/* Notification methods & channels */
.channels-wrap { overflow-x: auto; margin-bottom: 1.25rem; }
.channels-list { width: 100%; }
.channels-empty { margin-bottom: 1.25rem; }
.channel-options { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.channel-actions { text-align: right; }

.browser-push-card { background: color-mix(in srgb, var(--accent) 3%, var(--bg)); border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.1rem; margin-bottom: 1.25rem; }
.browser-push-header h3 { margin: 0 0 .2rem; }
.browser-push-header .desc { margin: 0 0 .8rem; }
.browser-subs-list { width: 100%; margin-bottom: .9rem; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
.browser-subscribe-row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.browser-subscribe-row label { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--text); margin: 0; }
.browser-subscribe-row input[type="text"] { width: 14rem; }

.channel-kind { padding: 1rem 0; border-top: 1px solid var(--line); }
.channel-kind h3 { margin: 0 0 .2rem; }
.channel-kind .desc { margin: 0 0 .8rem; }
.channel-kind .browser-subs-list { margin-top: 0; }
.add-channel-section { padding-top: 1.1rem; border-top: 1px solid var(--line); }
.add-channel-section h3 { margin: 0 0 .2rem; }
.add-channel-section p { margin: 0 0 .8rem; }
.alerts-channel-form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }
.alerts-channel-form label.wide { flex: 1 1 14rem; }
.alerts-channel-form .alert-address-input { width: 100%; }
.alerts-channel-form .alert-method-desc { flex-basis: 100%; margin-top: .2rem; }

/* Alerts & Matches page layout */
.alerts-page, .matches-page { max-width: 56rem; margin: 0 auto; }
.alerts-page .panel, .matches-page .panel { margin-bottom: 1.25rem; }
.alerts-page .panel:last-child, .matches-page .panel:last-child { margin-bottom: 0; }
.alerts-page h2, .matches-page h2 { margin-top: 0; margin-bottom: .4rem; font-size: 1.15rem; }
.alerts-page h3, .matches-page h3 { margin: 0 0 .4rem; font-size: 1rem; }
.full-alert summary { cursor: pointer; }
.full-alert .more { color: var(--accent, #2563eb); white-space: nowrap; }
.full-alert[open] summary .more { display: none; }
.full-alert .full-body { white-space: pre-wrap; margin-top: .35rem; padding: .5rem .65rem; border-left: 3px solid var(--border, #ccc); word-break: break-word; }
.alerts-page form.alerts-for, .matches-page form.alerts-for { margin-bottom: 1.25rem; }

.rules-wrap { margin-bottom: 1.4rem; }
.rules-list { width: 100%; }
.rules-list th.rule-actions-header { text-align: right; }
.rules-list .rule-info-col { min-width: 0; }
.rules-list .rule-header { display: flex; align-items: baseline; gap: .45rem; flex-wrap: wrap; margin-bottom: .25rem; }
.rules-list .rule-name strong { font-size: .95rem; font-weight: 600; color: var(--text); }
.rules-list .rule-name strong.rule-unnamed { color: var(--text); font-weight: 600; }
.rules-list .rule-details { line-height: 1.4; display: flex; flex-wrap: wrap; gap: .3rem .45rem; align-items: baseline; }
.rules-list .rule-details .sep { opacity: .45; }
.rules-list .rule-actions { text-align: right; vertical-align: middle; width: 1%; white-space: nowrap; }
.rules-list .rule-actions .actions-group { display: inline-flex; align-items: center; justify-content: flex-end; gap: .3rem; flex-wrap: nowrap; }
.rules-list .rule-actions button,
.rules-list .rule-actions .button { font-size: .82rem; padding: .2rem .5rem; margin: 0; white-space: nowrap; }
.rules-list .rule-actions form.inline { display: inline-flex; margin: 0; gap: .3rem; }

@media (max-width: 640px) {
    .rules-list .rule-actions .actions-group { flex-wrap: wrap; }
    .rules-list .rule-actions { white-space: normal; }
}

/* Edit rule dialog */
dialog.alert-edit-dialog { width: min(36rem, 94vw); max-height: 90vh; overflow-y: auto; }
dialog.alert-edit-dialog h3 { margin: 0 0 .8rem; font-size: 1.1rem; }
dialog.alert-edit-dialog form { display: flex; flex-direction: column; gap: .7rem; }
dialog.alert-edit-dialog .dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .6rem; padding-top: .7rem; border-top: 1px solid var(--line); }

.add-rule-section { padding-top: 1.1rem; border-top: 1px solid var(--line); }
.add-rule-section h3 { margin: 0 0 .2rem; }
.add-rule-section .desc { margin: 0 0 .8rem; }

/* Alert rule form components (Add & Edit) */
.rule-name-row { width: 100%; display: flex; flex-direction: column; margin-bottom: .4rem; }
.rule-name-label { width: 100%; }
.rule-name-input-wrap { display: flex; gap: .5rem; width: 100%; align-items: center; margin-top: .15rem; }
.rule-name-input-wrap input { flex: 1 1 auto; width: 100%; min-width: 0; }
.btn-suggest { flex: none; font-size: .85rem; padding: .3rem .7rem; white-space: nowrap; }

.rule-top-options { width: 100%; display: flex; flex-wrap: wrap; gap: 1.2rem; align-items: flex-end; margin-bottom: .6rem; }
.rule-channel-label { display: flex; flex-direction: column; gap: .2rem; min-width: 15rem; flex: 1 1 15rem; }
.rule-top-options label.tick { margin-bottom: .3rem; align-self: flex-end; }

.rule-type-value-row { width: 100%; display: flex; flex-wrap: wrap; gap: .7rem; align-items: flex-end; margin-bottom: .3rem; }
.rule-type-label { flex: 0 0 12rem; }
.rule-value-label { flex: 1 1 16rem; min-width: 0; }
.rule-value-label input { width: 100%; }

.rule-location-fields { width: 100%; display: flex; flex-direction: column; gap: .6rem; margin-bottom: .6rem; }
.rule-field-group { width: 100%; }
.rule-field-group label.wide input { width: 100%; }
.distance-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }
.distance-label { flex: 0 0 auto; }
.distance-km-wrap { white-space: nowrap; display: inline-flex; align-items: center; gap: .35rem; }
.distance-km-wrap input { width: 5.5rem; }
.place-label { flex: 1 1 14rem; min-width: 0; }
.place-label input { width: 100%; }
.distance-row button { flex: 0 0 auto; font-size: .85rem; padding: .3rem .65rem; }

.rule-actions-row { width: 100%; display: flex; gap: .5rem; align-items: center; margin-top: .4rem; }
.btn-clear { background: var(--panel); border: 1px solid var(--line); }
.btn-clear:hover { background: var(--fresh); }

section.users { margin-bottom: .8rem; }
section.users h2 { margin: 0 0 .5rem; font-size: 1rem; }
.users-wrap { overflow-x: auto; margin-bottom: .8rem; }
table.users-list tr.disabled td { color: var(--muted); }
table.users-list td { vertical-align: top; }
table.users-list td:last-child { width: 1%; }
.user-edit summary { cursor: pointer; color: var(--accent); white-space: nowrap; }
.user-edit[open] { min-width: 16rem; }
.user-edit form { margin-top: .6rem; padding-top: .6rem; border-top: 1px solid var(--line); }
.user-edit label.check { flex-direction: row; align-items: center; color: var(--text); }
.roles dl { display: grid; grid-template-columns: auto 1fr; gap: .2rem 1rem; margin: 0; }
.roles dd { margin: 0; }
.roles h3 { margin: 0 0 .4rem; font-size: .9rem; }
/* Viewers can't change anything: no editing controls */
body.read-only .name-radio, body.read-only .edit-transcript, body.read-only .attach-line, body.read-only .remove-call, body.read-only form[method=post]:not(.who):not(.keep) { display: none; }
.hour-bar { display: inline-block; height: .7em; background: color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 2px; max-width: 70%; vertical-align: baseline; }
.twin-ref { color: var(--muted); font-weight: normal; white-space: nowrap; }      /* the SES twin of a fire incident (scanner/twins.py) */

/* Roles page and Alerts tab */
table.roles-grid th, table.roles-grid td.tick { text-align: center; white-space: nowrap; }
table.roles-grid th:first-child { text-align: left; }
table.roles-grid td.tick input { width: 1.1rem; height: 1.1rem; }
table.roles-grid tr.section th { text-align: left; padding-top: 1rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--line); }
table.roles-grid tbody tr:hover td { background: color-mix(in srgb, var(--accent) 6%, var(--panel)); }
.score-reasons { margin: .2rem 0 0; padding-left: 1.2rem; }
.badge.score { background: var(--emergency-soft); }
form.filters label.tick, form.inline label.tick { flex-direction: row; align-items: center; gap: .3rem; color: var(--text); font-size: .85rem; align-self: end; padding-bottom: .35rem; }
form.inline label.tick { align-self: center; padding: 0; }
.alerts-help, .alerts-status-callout { margin-bottom: 1.25rem; }
.alerts-help summary h2 { display: inline; }
.alerts-help ol li { margin: .3rem 0; }
.alert-preview-out .preview { margin-top: .8rem; }
.push-sample { max-width: 26rem; border: 1px solid var(--line); border-radius: .8rem; padding: .6rem .8rem; margin: .5rem 0 .8rem; background: var(--panel); box-shadow: 0 1px 4px rgba(0,0,0,.15); }

/* Menus: dropdown groups, the account menu, one ☰ list on phones */
nav.menus { align-items: center; }
details.menu { position: relative; }
details.menu > summary, details.menu-all > summary { list-style: none; cursor: pointer; }
details.menu > summary::-webkit-details-marker, details.menu-all > summary::-webkit-details-marker { display: none; }
nav.menus details.menu > summary { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .7rem; border-radius: 6px; color: var(--muted); }
nav.menus details.menu > summary .icon { width: 1.2em; height: 1.2em; flex: none; }
nav.menus details.menu > summary.current { background: var(--accent-soft); color: var(--text); font-weight: 600; }
details.menu[open] > summary { color: var(--text); }
details.menu .caret { font-size: .7em; opacity: .7; margin-left: .1rem; }
details.menu > .menu-items { position: absolute; z-index: 60; top: 100%; left: 0; min-width: 14rem; margin-top: .2rem; padding: .3rem;
    display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.menu-items a, .menu-items button { display: flex; align-items: center; gap: .45rem; padding: .4rem .6rem; border-radius: 6px; color: var(--text); font-size: .9rem; }
.menu-items a:hover, .menu-items button:hover { background: color-mix(in srgb, var(--accent) 10%, var(--panel)); text-decoration: none; }
.menu-items a.current { background: var(--accent-soft); font-weight: 600; }
.menu-items .icon { width: 1.1em; height: 1.1em; flex: none; }
.menu-items form { margin: 0; border-top: 1px solid var(--line); margin-top: .2rem; padding-top: .2rem; }
.menu-items form button { width: 100%; text-align: left; border: 0; background: none; cursor: pointer; }
header.top details.account { float: right; margin: .1rem 0 0 1rem; }
header.top details.account > summary { padding: .15rem .4rem; border-radius: 6px; color: var(--text); }
header.top details.account > summary .muted { margin-left: .3rem; }
details.account > .menu-items { left: auto; right: 0; min-width: 12rem; }
details.menu-all { display: none; }
@media (max-width: 640px) {
    .menubar { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem; margin-bottom: .6rem; }
    nav.menus { margin-bottom: 0; flex-wrap: nowrap; }
    nav.menus > a:not(.primary), nav.menus > details.menu:not(.primary) { display: none; }
    nav.menus > a.primary, nav.menus details.menu.primary > summary { min-height: 2rem; box-sizing: border-box; }
    details.menu-all { display: block; margin-left: auto; }
    details.menu-all[open] { flex-basis: 100%; order: 3; }
    details.menu-all > summary { display: inline-flex; align-items: center; min-height: 2rem; box-sizing: border-box; padding: .3rem .7rem; border: 1px solid var(--line); border-radius: 6px; }
    details.menu-all > .menu-items { display: flex; flex-direction: column; margin-top: .3rem; }
    details.menu-sub > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .45rem; padding: .5rem .6rem; border-radius: 6px; font-weight: 600; }
    details.menu-sub > summary::-webkit-details-marker { display: none; }
    details.menu-sub > summary .icon { width: 1.1em; height: 1.1em; flex: none; }
    details.menu-sub > summary .caret { margin-left: auto; transition: transform .15s; }
    details.menu-sub[open] > summary .caret { transform: rotate(180deg); }
    details.menu-sub > a { margin-left: 1.2rem; padding: .55rem .6rem; }
    details.menu-all > .menu-items > a { padding: .5rem .6rem; font-weight: 600; }
    header.top details.account > summary .muted { display: none; }
}

/* Settings: a "NAME = NUMBER" list edited as rows */
.pairs-editor { display: flex; flex-direction: column; gap: .3rem; margin-top: .3rem; }
.pairs-editor .pair { display: flex; gap: .3rem; align-items: center; }
.pairs-editor .pair input.name { flex: 1; min-width: 8rem; }
.pairs-editor .pair input.number { width: 5.5rem; }
.pairs-editor .head { display: flex; gap: .3rem; font-size: .75rem; color: var(--muted); }
.pairs-editor .head span:first-child { flex: 1; }
.pairs-editor .head span:nth-child(2) { width: 5.5rem; }
.pairs-editor .actions { display: flex; gap: .4rem; }

/* Alerts tab: drawing an area for a rule */
.area-map-box { flex-basis: 100%; }
.area-mode { display: flex; gap: .6rem; align-items: center; }
.area-handle { background: #fff; border: 2px solid #2c6fbb; border-radius: 2px; cursor: ew-resize; }
.area-map { height: 360px; max-height: 60vh; margin: 6px 0; border: 1px solid var(--line, #ccc); border-radius: 6px; }

/* Map tab and ambulance jobs */
.incident-map-big { height: 70vh; min-height: 320px; border-radius: 8px; border: 1px solid var(--line); margin: 0.5rem 0; }
.map-layers { display: inline-flex; gap: 0.8rem; flex-wrap: wrap; align-items: center; }
form.filters .map-layers label.check { flex-direction: row; align-items: center; gap: .3rem; }
.map-key { display: inline-block; width: 0.8em; height: 0.8em; border-radius: 50%; background: var(--key); margin-right: 0.25em; vertical-align: -0.05em; }
.map-key-warning { background: transparent; border: 2px solid #f59e0b; }
.map-key-hotspot { background: radial-gradient(circle, #dc2626 35%, #f59e0b 70%, #92400e); }
.map-plane { background: none; border: none; }
.map-plane-svg svg { display: block; transition: transform 1s ease-out; fill: currentColor; stroke: #fff; stroke-width: 1; stroke-linejoin: round; overflow: visible; }
.map-plane-svg svg .rotor { fill: none; stroke: currentColor; stroke-width: 1; opacity: 0.55; }
.map-plane > span { display: block; font-size: 18px; line-height: 20px; text-align: center; text-shadow: 0 0 2px #fff, 0 0 2px #fff; }
form.map-controls label[hidden] { display: none; }
form.map-controls .map-layers { grid-column: 1 / -1; }
.map-pin > span { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; box-sizing: border-box;
                border-radius: 50%; background: #fff; border: 3px solid var(--key); font-size: 18px; line-height: 1;
                box-shadow: 0 1px 3px #0005; }
.map-pin .pic { font-size: 20px; }
.map-popup { min-width: 200px; line-height: 1.4; }
.map-popup-icon { float: right; font-size: 1.8rem; margin-left: 0.4rem; }
.map-popup-icon .pic { font-size: 2rem; }

/* Clients & Health pages (T10) */
.user-subtabs { margin-bottom: 1rem; }
.radio-subtabs { margin-bottom: 1rem; }
.badge.status-k1 { background: #0284c722; color: #0284c7; }
.badge.status-k2 { background: #ea580c22; color: #ea580c; }
.badge.status-k5 { background: #16a34a22; color: #16a34a; }
.badge.status-generic { background: var(--line); color: var(--text); }
.badge.status-ack { background: var(--line); color: var(--muted); }
.nsm-desc { font-size: .88rem; }
table.list.nsm-updates td { vertical-align: top; }
table.list.nsm-updates .linked-incident { line-height: 1.35; }
.health-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.health-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .8rem 1rem; }
.health-card h4 { margin: 0 0 .3rem; font-size: .85rem; color: var(--muted); font-weight: normal; }
.health-card .stat { font-size: 1.5rem; font-weight: 600; line-height: 1.2; }
.health-card .sub { font-size: .8rem; color: var(--muted); margin-top: .2rem; }
.health-card.bad { border-color: var(--bad); }
.health-card.bad .stat { color: var(--bad); }
.budget-bar-wrap { background: var(--bg); border: 1px solid var(--line); border-radius: 4px; height: 8px; overflow: hidden; margin-top: .4rem; }
.budget-bar { height: 100%; background: var(--accent); border-radius: 3px; }
.budget-bar.over { background: var(--bad); }
.dead-actions { display: inline-flex; gap: .3rem; }
.dead-actions form { display: inline; }
.section-actions { float: right; margin-top: -.2rem; }
.health-page .panel { margin-bottom: 1rem; }
.health-overview .section-actions { margin-top: .2rem; }
.health-overview .live { display: inline-flex; gap: .35rem; align-items: center; cursor: pointer; }
.health-overview .live .live-status { font-weight: normal; }


/* Feedback page */
.feedback-page { display: grid; gap: .9rem; }
/* Contributor guide (?view=contribute) */
.contribute { display: grid; gap: .9rem; max-width: 60rem; }
.contribute h2 { margin-top: 0; }
.contribute li { margin: .25rem 0; }
.contribute-settings { width: auto; margin: .5rem 0; }
.contribute-settings th { text-align: left; padding-right: 1rem; white-space: nowrap; }
.contribute-copy { user-select: all; word-break: break-all; }
.feedback-form label { display: flex; flex-direction: column; gap: .2rem; font-size: .8rem; color: var(--muted); margin-bottom: .6rem; }
.feedback-form select { max-width: 16rem; }
.feedback-form textarea { width: 100%; box-sizing: border-box; font: inherit; padding: .4rem .5rem; resize: vertical; }
.feedback-item { border-top: 1px solid var(--line); padding: .6rem 0; }
.feedback-item.handled .feedback-message { color: var(--muted); }
.feedback-message { margin: .3rem 0; white-space: normal; overflow-wrap: anywhere; }
.badge.feedback-kind { background: var(--accent-soft); color: var(--accent); margin-left: 0; }
.feedback-filter { margin: .3rem 0 .4rem; }

/* Near me (http/nearby.php) */
#nearby-map { height: 18rem; margin: .5rem 0 1rem; border-radius: 8px; }
.nearby-list { list-style: none; margin: 0; padding: 0; }
.nearby-list li { padding: .55rem 0; border-top: 1px solid var(--line); }
.nearby-list li:first-child { border-top: 0; }
.nearby-list .pic { font-size: 1.4rem; margin-right: .3rem; }
#nearby-start label.check { flex-direction: row; align-items: center; gap: .3rem; }

/* Now (the front page, http/now.php) */
.now-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.now-page h3 .more { font-weight: normal; margin-left: .5rem; }
.now-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: .9rem; margin-top: 1rem; }
.now-grid section h3 { margin: 0 0 .4rem; font-size: .95rem; }
.now-grid .explain { margin-bottom: .5rem; }
.now-list { list-style: none; margin: 0; padding: 0; }
.now-list li { padding: .4rem 0; border-top: 1px solid var(--line); }
.now-list li:first-child { border-top: 0; }
.now-list .pic { vertical-align: middle; }
table.list.compact td { padding: .3rem .4rem; }
.badge.score { background: var(--bg); color: var(--muted); }
.badge.score.alert { background: var(--alert-soft); color: var(--alert); }

/* Aircraft page (aircraft.php) */
.aircraft-list .aircraft-reg { white-space: nowrap; margin: .1rem 0; }
.aircraft-list .badge { margin-left: 0; }
.badge.reg-confirmed { background: #16a34a22; color: #15803d; }
.badge.reg-possible { background: #64748b22; color: #475569; }
.badge.reg-earlier { background: #16a34a11; color: #64748b; }
form.inline-form { display: inline; margin: 0; }
button.as-link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; }
button.as-link.danger { color: #b91c1c; }
.aircraft-form label { display: inline-block; margin: .2rem .6rem .2rem 0; }
.aircraft-list tr.aircraft-edit td { border-top: 0; padding-top: 0; }

/* Fire weather page (http/fireweather.php): AFDRS rating colours, as scanner/weather.py AFDRS_BANDS */
table.fireweather td.num { text-align: right; font-variant-numeric: tabular-nums; }
.fdr { display: inline-block; padding: .05rem .5rem; border-radius: .6rem; font-size: .8rem; font-weight: 600; color: #1d2433; border: 1px solid rgba(0,0,0,.25); }
.fdr-white { background: #fff; } .fdr-green { background: #7ccf7c; } .fdr-yellow { background: #ffe14d; }
.fdr-orange { background: #ffa033; } .fdr-red { background: #e5392b; color: #fff; }
.fdr-stale { color: var(--bad); }
table.fireweather .trend { font-size: .75rem; margin-left: .15rem; }
table.fireweather .trend-up { color: var(--bad); } table.fireweather .trend-down { color: #1a7f37; } table.fireweather .trend-stable { color: var(--muted); }

/* Footer for public visitors (holds the theme switch) */
footer.site-foot { text-align: center; padding: .6rem 1rem 0; }
/* Appliance status board (?view=appliances) */
.badge.appliance-paged { background: var(--accent-soft); color: var(--accent); }
.badge.appliance-responding { background: #f59e0b33; color: #b45309; }
.badge.appliance-scene { background: var(--alert-soft); color: var(--alert); }
.badge.appliance-departed, .badge.appliance-available { background: #16a34a22; color: #15803d; }
.badge.appliance-clear, .badge.appliance-unavailable { background: #6b728022; color: var(--muted); }
table.appliance-board tr.group-row th { text-align: left; background: var(--accent-soft); font-size: .85rem; }

/* Help (?view=help): the tutorials */
.help { display: grid; gap: .9rem; max-width: 60rem; }
.help h2 { margin-top: 0; }
.help li { margin: .25rem 0; }
.help-nav { display: flex; flex-wrap: wrap; gap: .4rem; }
.help-nav a { padding: .35rem .8rem; border: 1px solid var(--line); border-radius: 2rem; background: var(--panel); }
.help-nav a.current { background: var(--accent-soft); border-color: var(--accent); font-weight: 600; text-decoration: none; }
.help-closed { color: var(--muted); }
.help section[id] { scroll-margin-top: 1rem; }
.help table.list td, .help table.list th { vertical-align: top; }

li.call.switching { outline: 1px dashed var(--muted); outline-offset: 2px; }
li.call.switched { box-shadow: inset 3px 0 0 var(--accent); animation: fresh 3s ease-out; }
.badge.switch.switching { opacity: .8; }
.badge.switch.switched { background: var(--accent); color: var(--panel); }

/* Share this page (app.js): phones only, where an installed app has no address bar */
header.top .share-page { display: none; }
@media (max-width: 640px) {
    header.top .share-page { display: inline-block; float: right; margin: .1rem 0 0 .6rem; font-size: .8rem; padding: .15rem .5rem; }
}
