:root {
  --bg: #f3f4f6; --panel: #ffffff; --ink: #111827; --muted: #5b6472; --line: #d7dbe1;
  --accent: #1d4ed8; --accent-ink: #fff; --head: #14181f; --head-ink: #f9fafb;
  --red: #c62828; --purple: #6a1b9a; --green: #2e7d32; --grey: #9aa1ab; --amber: #f59e0b;
  --ctrl: #1d4ed8; --fg: #c2410c; --chip: #eef0f3; --sel: #111827; --sel-ink: #fff;
  --evac: #fde2e7; --lobby: #dcfce7; --stay: #f1faf2;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1116; --panel: #171b22; --ink: #e8eaee; --muted: #9aa3b0; --line: #2a303a;
    --accent: #3b82f6; --head: #0a0c10; --chip: #232934; --sel: #e8eaee; --sel-ink: #0e1116;
    --grey: #5d6673; --evac: #4a1d28; --lobby: #12351f; --stay: #14301b;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1116; --panel: #171b22; --ink: #e8eaee; --muted: #9aa3b0; --line: #2a303a;
  --accent: #3b82f6; --head: #0a0c10; --chip: #232934; --sel: #e8eaee; --sel-ink: #0e1116;
  --grey: #5d6673; --evac: #4a1d28; --lobby: #12351f; --stay: #14301b;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pad { padding: 16px; }
.center { text-align: center; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 12px 12px 96px; }
.narrow { max-width: 460px; margin: 0 auto; padding: 24px 16px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 20px 0 8px; }
h3 { font-size: 15px; margin: 14px 0 6px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

/* header */
.top { position: sticky; top: 0; z-index: 20; background: var(--head); color: var(--head-ink); padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); display: flex; align-items: center; gap: 8px; }
.top .title { flex: 1; min-width: 0; }
.top .title b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.top .title span { font-size: 12px; opacity: .8; }
.top button { background: transparent; border: 1px solid #ffffff40; color: var(--head-ink); border-radius: 8px; padding: 6px 10px; min-height: 36px; }
.conn { font-size: 12px; padding: 3px 8px; border-radius: 99px; white-space: nowrap; }
.conn.live { background: #14532d; color: #bbf7d0; }
.conn.wait { background: #78350f; color: #fde68a; }
.conn.off { background: #7f1d1d; color: #fecaca; }
.demo { background: #f59e0b; color: #111; text-align: center; font-size: 12px; font-weight: 600; padding: 3px; }

/* forms */
label.f { display: block; margin: 12px 0 4px; font-weight: 600; font-size: 14px; }
input.in, select.in, textarea.in { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); min-height: 46px; }
textarea.in { min-height: 90px; resize: vertical; }
.btn { border: 0; border-radius: 10px; padding: 12px 16px; min-height: 46px; font-weight: 600; background: var(--chip); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--red); color: #fff; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 10px 0; }
.list .item { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 8px 0; width: 100%; text-align: left; }
.list .item b { display: block; }
.err { color: var(--red); font-weight: 600; margin-top: 10px; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--chip); }

/* role picker */
.roles { display: grid; grid-template-columns: 1fr; gap: 10px; }
.roles button { text-align: left; padding: 16px; border-radius: 12px; border: 2px solid var(--line); background: var(--panel); font-size: 17px; font-weight: 600; }
.roles button small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.roles button.ctrl { border-left: 8px solid var(--ctrl); }
.roles button.fgr { border-left: 8px solid var(--fg); }

/* bottom tabs */
.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 25; display: flex; background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { flex: 1; border: 0; background: none; padding: 8px 4px 10px; min-height: 58px; font-size: 12px; color: var(--muted); position: relative; }
.tabs button .ic { display: block; font-size: 20px; line-height: 1.2; }
.tabs button.on { color: var(--accent); font-weight: 700; }
.badge { position: absolute; top: 4px; left: 50%; margin-left: 8px; background: var(--amber); color: #111; border-radius: 99px; font-size: 11px; font-weight: 800; padding: 0 6px; min-width: 18px; }

/* banner */
.banner { display: block; width: 100%; border: 0; text-align: left; background: var(--amber); color: #111; font-weight: 700; padding: 10px 12px; border-radius: 10px; margin: 8px 0; }
.banner.urgent { background: var(--red); color: #fff; animation: pulse 1.2s infinite alternate; }
@keyframes pulse { to { filter: brightness(1.25); } }

/* summary */
.sum { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0; }
.sum div { border-radius: 10px; padding: 6px 8px; color: #fff; font-size: 12px; }
.sum b { display: block; font-size: 20px; }
.sum .r { background: var(--red); } .sum .p { background: var(--purple); } .sum .g { background: var(--green); } .sum .n { background: var(--grey); }
.facts { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; margin: 6px 0; }
.facts span { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; }

/* tower */
.toolbar { display: flex; gap: 8px; margin: 8px 0; padding: 6px 0; }
.toolbar input { flex: 1; }
.floor { display: flex; align-items: stretch; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; margin: 6px 0; overflow: hidden; }
.floor.evac { background: var(--evac); }
.floor.stay { background: var(--stay); }
.floor.lobby { box-shadow: inset 4px 0 0 var(--green); }
.fl { width: 64px; flex: none; padding: 6px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; }
.fl b { font-size: 20px; line-height: 1; }
.fl.fire b { color: var(--red); }
.tag { font-size: 9px; font-weight: 800; letter-spacing: .02em; padding: 1px 4px; border-radius: 4px; background: var(--chip); white-space: nowrap; }
.tag.FIRE { background: var(--red); color: #fff; } .tag.SEARCH { background: #1e40af; color: #fff; }
.tag.LOBBY { background: var(--green); color: #fff; } .tag.BRIDGEHEAD { background: #065f46; color: #fff; } .tag.EVAC { background: #be185d; color: #fff; }
.tiles { flex: 1; display: flex; flex-wrap: wrap; gap: 5px; padding: 6px; align-content: flex-start; }
.tile { min-width: 54px; min-height: 46px; padding: 4px 6px; border-radius: 8px; border: 0; color: #fff; font-weight: 700; font-size: 15px; position: relative; line-height: 1.1; }
.tile small { display: block; font-size: 11px; font-weight: 600; opacity: .95; }
.tile.R { background: var(--red); } .tile.P { background: var(--purple); } .tile.G { background: var(--green); } .tile.N { background: var(--grey); }
.tile.space { border-radius: 16px; font-style: italic; }
.tile.ack::after { content: ""; position: absolute; top: -4px; right: -4px; width: 14px; height: 14px; border-radius: 50%; background: var(--amber); border: 2px solid var(--panel); }
.tile.pending { outline: 2px dashed var(--amber); outline-offset: 1px; }
.tile.hit { outline: 3px solid var(--accent); outline-offset: 2px; }
.tile.add { background: transparent; color: var(--muted); border: 2px dashed var(--line); font-weight: 400; }
.advice { font-size: 10px; font-weight: 700; }

/* sheet (bottom drawer) */
.sheet { position: fixed; inset: 0; z-index: 50; background: #0008; display: flex; align-items: flex-end; justify-content: center; }
.sheet .in { background: var(--bg); width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 0 14px calc(20px + env(safe-area-inset-bottom)); }
.sheet .sh { position: sticky; top: 0; background: var(--bg); padding: 14px 0 8px; display: flex; align-items: center; gap: 8px; z-index: 2; border-bottom: 1px solid var(--line); }
.sheet .sh h2 { margin: 0; flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 2px solid transparent; background: var(--chip); border-radius: 10px; padding: 10px 12px; min-height: 46px; font-weight: 600; font-size: 15px; }
.chip.on { background: var(--sel); color: var(--sel-ink); }
.chip.R.on { background: var(--red); color: #fff; } .chip.P.on, .chip.X.on { background: var(--purple); color: #fff; } .chip.G.on { background: var(--green); color: #fff; }
.chip.num { min-width: 52px; }
.side { border-radius: 12px; padding: 10px 12px; margin: 10px 0; background: var(--panel); border: 1px solid var(--line); }
.side.ctrl { border-left: 6px solid var(--ctrl); } .side.fgr { border-left: 6px solid var(--fg); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; }
.savebar { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0 0; display: flex; gap: 8px; }

/* log */
.entry { background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--grey); border-radius: 10px; padding: 8px 10px; margin: 6px 0; font-size: 14px; }
.entry.control { border-left-color: var(--ctrl); } .entry.fireground { border-left-color: var(--fg); }
.entry.msg { border-left-width: 8px; }
.entry.urgent { box-shadow: 0 0 0 2px var(--red); }
.entry .meta { font-size: 12px; color: var(--muted); }
.entry .who { font-weight: 700; color: var(--ink); }
.entry .acks { font-size: 12px; color: var(--green); margin-top: 4px; }
.entry .need { margin-top: 6px; }
.compose { position: fixed; left: 0; right: 0; bottom: calc(58px + env(safe-area-inset-bottom)); z-index: 24; background: var(--panel); border-top: 1px solid var(--line); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.compose .row { flex-wrap: nowrap; max-width: 1100px; width: 100%; margin: 0 auto; }
.compose select, .compose input.in { min-height: 44px; padding: 8px 10px; }
.compose .urg { white-space: nowrap; font-weight: 700; color: var(--red); display: flex; align-items: center; gap: 4px; flex: none; }
.compose select.in { flex: 1 1 auto; width: auto; }
.compose .urg input { width: 22px; height: 22px; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 60; background: var(--head); color: var(--head-ink); padding: 10px 16px; border-radius: 10px; font-weight: 600; max-width: 90vw; }

@media (min-width: 720px) {
  .roles { grid-template-columns: 1fr 1fr; }
  .tile { min-width: 60px; min-height: 50px; }
  .fl { width: 84px; }
}
@media print {
  .top, .tabs, .compose, .toolbar, button { display: none !important; }
  .entry { break-inside: avoid; }
}

/* v0.2 */
label.check { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0; font-size: 14px; font-weight: 600; }
label.check input { width: 22px; height: 22px; flex: none; margin: 0; }
.qr { display: flex; justify-content: center; margin: 12px 0; }
.qr svg { width: 200px; height: 200px; background: #fff; border-radius: 8px; }
.exbar { background: repeating-linear-gradient(45deg, #f59e0b, #f59e0b 12px, #111 12px, #111 24px); color: #fff; text-align: center; font-weight: 800; letter-spacing: .2em; font-size: 12px; padding: 3px; text-shadow: 0 0 3px #000; }
.pill.ex { background: var(--amber); color: #111; }
.badge.inline { position: static; margin: 0 0 0 4px; }
.facts .warn, .amber { color: #b45309; }
.facts .warn { border-color: var(--amber); font-weight: 700; }
.tile.stale { box-shadow: 0 0 0 3px var(--amber); }
.item.staleitem { border-color: var(--amber); box-shadow: inset 4px 0 0 var(--amber); }
.tallyrow { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.tallyrow .tn { font-size: 22px; min-width: 36px; text-align: center; }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.thumb { display: flex; flex-direction: column; width: 120px; text-decoration: none; color: var(--ink); font-size: 12px; gap: 4px; }
.thumb img { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.thumb.pdf b { display: flex; align-items: center; justify-content: center; width: 120px; height: 90px; border-radius: 8px; background: var(--chip); border: 1px solid var(--line); }
.thumb span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.entry.partner { border-left-color: #0e7490; }
.replay { position: sticky; top: 0; z-index: 15; border-color: var(--accent); }
a.btn { display: inline-flex; align-items: center; text-decoration: none; color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .facts .warn, :root:not([data-theme="light"]) .amber { color: #fbbf24; } }
:root[data-theme="dark"] .facts .warn, :root[data-theme="dark"] .amber { color: #fbbf24; }

/* v0.3 fallback list */
pre.fb { white-space: pre-wrap; word-break: break-word; font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--card, #fff); border: 1px solid var(--line, #ccc); border-radius: 8px; padding: 12px; user-select: text; -webkit-user-select: text; }
@media print {
  body.printfb #app, body.printfb .sh, body.printfb .sheet .row, body.printfb .sheet p { display: none !important; }
  body.printfb .sheet { position: static !important; background: none !important; }
  body.printfb .sheet > .in { max-height: none !important; overflow: visible !important; box-shadow: none !important; }
  body.printfb pre.fb { border: 0; font-size: 11pt; color: #000; background: #fff; }
}

/* v0.3: coloured choice buttons. Pale before selection so the right one is easy to spot,
   solid with a tick once selected. */
:root { --pale-R: #fde4e4; --pale-P: #efe3f7; --pale-G: #e2f2e3; --pale-R-ink: #8e1c1c; --pale-P-ink: #561679; --pale-G-ink: #1f5d23; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --pale-R: #3a1a1c; --pale-P: #2e1b3a; --pale-G: #17301a; --pale-R-ink: #f3b4b4; --pale-P-ink: #dcbcef; --pale-G-ink: #b5e0b8; } }
:root[data-theme="dark"] { --pale-R: #3a1a1c; --pale-P: #2e1b3a; --pale-G: #17301a; --pale-R-ink: #f3b4b4; --pale-P-ink: #dcbcef; --pale-G-ink: #b5e0b8; }
.chip.R, .chip.X { background: var(--pale-R); color: var(--pale-R-ink); border-color: color-mix(in srgb, var(--red) 25%, transparent); }
.chip.P { background: var(--pale-P); color: var(--pale-P-ink); border-color: color-mix(in srgb, var(--purple) 25%, transparent); }
.chip.G { background: var(--pale-G); color: var(--pale-G-ink); border-color: color-mix(in srgb, var(--green) 25%, transparent); }
.chip.R.on, .chip.X.on { background: var(--red); color: #fff; border-color: var(--red); }
.chip.P.on { background: var(--purple); color: #fff; border-color: var(--purple); }
.chip.G.on { background: var(--green); color: #fff; border-color: var(--green); }
.chip.R.on::before, .chip.X.on::before, .chip.P.on::before, .chip.G.on::before { content: "✓ "; }
.floor.unknownfl { border-left: 4px dashed var(--amber); }
.floor.unknownfl .fl b { color: var(--amber); }
.banner.moveflat { text-align: left; cursor: default; }
.unkhint { flex: 1 1 160px; align-self: center; }
/* short dialogs (add a flat) open at the top, next to the keyboard */
.sheet.attop { align-items: flex-start; }
.sheet.attop .in { border-radius: 0 0 16px 16px; padding-top: env(safe-area-inset-top); }
@media (min-width: 700px) { .sheet.attop { padding-top: 8vh; } .sheet.attop .in { border-radius: 16px; } }
/* new incident: building search */
.blist .bscroll { max-height: min(52vh, 460px); overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 4px; -webkit-overflow-scrolling: touch; }
details.notlisted { margin-top: 18px; }
details.notlisted > summary { cursor: pointer; font-weight: 700; font-size: 17px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; list-style-position: inside; }
details.notlisted[open] > summary { margin-bottom: 8px; }

/* v0.3: fire / smoke band across the top of a tile (option H). Every tile reserves the band's
   space so flat numbers line up whether or not a band is showing. */
.tile:not(.add) { padding-top: 16px; }
.tile.bf::before, .tile.bs::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 12px; border-bottom: 2px solid #fff; border-radius: inherit; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.tile.bf::before { background: linear-gradient(#ffd400, #ff5a00); }
.tile.bs::before { background: linear-gradient(#8a9099, #000); }
.condlabel { display: inline-block; font-weight: 700; padding: 4px 10px; border-radius: 8px; }
.condlabel.bf { background: linear-gradient(#ffd400, #ff5a00); color: #111; }
.condlabel.bs { background: linear-gradient(#8a9099, #000); color: #fff; }
.chip.CF { background: #fff6cc; color: #6b4e00; border-color: #f2d36b; }
.chip.CS { background: #e4e6e9; color: #23272d; border-color: #b9bec5; }
.chip.CF.on { background: linear-gradient(#ffd400, #ff5a00); color: #111; border-color: #ff5a00; }
.chip.CS.on { background: linear-gradient(#8a9099, #000); color: #fff; border-color: #000; }
.chip.CF.on::before, .chip.CS.on::before { content: "✓ "; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.CF { background: #3a3110; color: #ffe27a; border-color: #6b5a1a; } :root:not([data-theme="light"]) .chip.CS { background: #2a2e34; color: #d5d9de; border-color: #4a5058; } }
:root[data-theme="dark"] .chip.CF { background: #3a3110; color: #ffe27a; border-color: #6b5a1a; }
:root[data-theme="dark"] .chip.CS { background: #2a2e34; color: #d5d9de; border-color: #4a5058; }

/* tile layout: band (top) / number (middle-left) / persons (bottom-left) + BA team (bottom-right) */
.tile:not(.add) { display: inline-grid; grid-template-columns: auto auto; grid-template-rows: 1fr auto; column-gap: 4px; align-items: center; text-align: left; min-width: 58px; min-height: 58px; padding: 16px 6px 3px; vertical-align: top; }
.tile .tn { grid-column: 1 / 3; font-size: 17px; font-weight: 800; line-height: 1.05; overflow-wrap: anywhere; }
.tile .tp, .tile .tt { font-size: 11px; font-weight: 700; line-height: 1.2; min-height: 13px; }
.tile .tp { justify-self: start; }
.tile .tt { justify-self: end; }
.tile.space .tn { font-size: 13px; }
.item .tile:not(.add) { min-width: 54px; min-height: 52px; }
/* blocked in by smoke/fire OUTSIDE the flat: striped band (solid band = inside the flat) */
.tile.xf::before, .tile.xs::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 12px; border-bottom: 2px solid #fff; border-radius: inherit; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.tile.xf::before { background: repeating-linear-gradient(135deg, #ffb000 0 5px, #fff 5px 9px); }
.tile.xs::before { background: repeating-linear-gradient(135deg, #3b4047 0 5px, #fff 5px 9px); }
.condlabel.xf { background: repeating-linear-gradient(135deg, #ffe08a 0 6px, #fff 6px 11px); color: #111; border: 1px solid #ffb000; }
.condlabel.xs { background: repeating-linear-gradient(135deg, #c9ccd1 0 6px, #fff 6px 11px); color: #111; border: 1px solid #3b4047; }

/* Save buttons float above the bottom tab bar while their form is on screen */
.savebar { z-index: 15; padding: 10px 0; background: linear-gradient(transparent, var(--bg) 30%); }
body:has(.tabs) .savebar { bottom: calc(58px + env(safe-area-inset-bottom)); }
.sheet .savebar { bottom: 0; }
.unkslim { display: block; width: 100%; text-align: left; margin: 6px 0; padding: 10px 12px; border: 2px dashed var(--amber); border-radius: 10px; background: transparent; color: var(--ink); font-weight: 600; font-size: 14px; }
.facts .pr b.r { color: var(--red); } .facts .pr b.p { color: var(--purple); }

/* ===== v0.4 (5 Dec 2026): tile scheme Y4, layout Q, stair columns, corridor band on the floor box ===== */
:root { --tR: #c62828; --tP: #8e5cc2; --tN: #b7bcc4; --tG: #a9dcab; --tD: #24272c; --stay: #e6f1fb; --stayink: #1f5f9e; --evacink: #a3122e;
  --evstair: #9fd3a8; --sgap: 3px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --tN: #8f97a3; --tG: #8fcf93; --tD: #000; --stay: #14263a; --stayink: #9cc8f2; --evacink: #ff9fb1; --evstair: #3f8a4c; } }
:root[data-theme="dark"] { --tN: #8f97a3; --tG: #8fcf93; --tD: #000; --stay: #14263a; --stayink: #9cc8f2; --evacink: #ff9fb1; --evstair: #3f8a4c; }
.tile.R { background: var(--tR); color: #fff; } .tile.P { background: var(--tP); color: #fff; }
.tile.N { background: var(--tN); color: #111; } .tile.G { background: var(--tG); color: #111; } .tile.D { background: var(--tD); color: #fff; box-shadow: inset 0 0 0 1px #555; }
.tile.R:not(.mini) { box-shadow: 0 0 0 2px var(--panel), 0 0 0 5px var(--tR); margin: 3px; }
.sum .p { background: var(--tP); } .sum .g { background: var(--tG); color: #111; } .sum .n { background: var(--tN); color: #111; } .sum .r { background: var(--tR); }
.facts .pr b.p { color: var(--tP); }
/* tile grid: number | symbol / BA | people */
.tile:not(.add) { display: inline-grid; grid-template-columns: 1fr 18px; grid-template-rows: 1fr 18px; column-gap: 3px; align-items: center; text-align: left; min-width: 60px; width: 60px; min-height: 60px; padding: 15px 4px 3px 6px; vertical-align: top; }
.tile .tn { grid-column: 1; grid-row: 1; font-size: 17px; font-weight: 800; line-height: 1.05; overflow-wrap: anywhere; }
.tile .ts { grid-column: 2; grid-row: 1; justify-self: center; align-self: center; }
.tile .tt { grid-column: 1; grid-row: 2; justify-self: start; align-self: end; min-height: 0; }
.tile .tp { grid-column: 2; grid-row: 2; justify-self: center; align-self: end; min-height: 0; }
.tile .ba { display: inline-block; font-size: 10px; font-weight: 800; line-height: 15px; background: rgba(0,0,0,.42); color: #fff; border-radius: 3px; padding: 0 3px; }
.tile .cnt { display: grid; place-items: center; min-width: 16px; height: 16px; border-radius: 8px; background: #fff; color: #111; font-size: 9.5px; font-weight: 800; padding: 0 3px; }
.tile.N .cnt, .tile.G .cnt { background: #111; color: #fff; }
.tile .tick { font-size: 17px; font-weight: 900; line-height: 16px; display: block; text-align: center; }
.sym { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; box-shadow: 0 0 0 1.5px #fff; }
.sym svg { width: 16px; height: 16px; display: block; }
.sym.run svg, .sym.house svg { width: 11px; height: 11px; }
.symline { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.tile.space { border-radius: 16px; font-style: italic; }
.tile.space .tn { font-size: 12px; }
.tile.xf::before, .tile.xs::before { display: none; }
/* floors: calm rows, advice colour on the floor box and behind the flats */
.tower { margin-top: 2px; }
.floor { background: transparent; border: 0; border-radius: 0; margin: 0; overflow: visible; border-bottom: var(--sgap) solid var(--bg); }
.floor.evac, .floor.stay { background: transparent; }
.floor > .fl, .floor > .tiles { background: var(--panel); }
.floor.evac > .fl, .floor.evac > .tiles { background: var(--evac); }
.floor.stay > .fl, .floor.stay > .tiles { background: var(--stay); }
.floor.evac .advice { color: var(--evacink); } .floor.stay .advice { color: var(--stayink); }
.floor.lobby { box-shadow: none; } .floor.lobby > .fl { box-shadow: inset 4px 0 0 var(--green); }
.floor.unknownfl { border-left: 0; } .floor.unknownfl > .fl { box-shadow: inset 4px 0 0 var(--amber); }
.fl { align-items: flex-start; border-right: 0; border-radius: 8px 0 0 8px; text-align: left; border: 0; font: inherit; color: inherit; position: relative; cursor: pointer; }
.floor > .tiles { border-radius: 0 8px 8px 0; }
.fl.cs, .fl.cf { padding-top: 15px; }
.fl.cs::before, .fl.cf::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 10px; border-radius: 8px 0 0 0; }
.fl.cs::before { background: linear-gradient(#8a9099, #000); } .fl.cf::before { background: linear-gradient(#ffd400, #ff5a00); }
/* stairs */
.stairs { display: flex; flex: none; gap: 3px; padding: 0 4px; }
.stc { position: relative; width: 38px; padding: 0; border: 0; background: transparent; display: block; }
.stc .shaft { position: absolute; left: 3px; right: 3px; top: 0; bottom: calc(-1 * var(--sgap)); display: block; }
.floor:last-child .stc .shaft { bottom: 0; }
.stc .shaft.stop { border-top-left-radius: 14px; border-top-right-radius: 14px; }
.stc .shaft.sbot { border-bottom-left-radius: 14px; border-bottom-right-radius: 14px; bottom: 0; }
.shaft .zig { position: absolute; inset: 0; width: 100%; height: 100%; }
.shaft .zig path { fill: none; stroke: var(--grey); stroke-width: 2.2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.shaft.ghost { box-shadow: inset 1.5px 0 0 var(--grey), inset -1.5px 0 0 var(--grey); }
.shaft.ghost.stop { box-shadow: inset 1.5px 0 0 var(--grey), inset -1.5px 0 0 var(--grey), inset 0 1.5px 0 var(--grey); }
.shaft.ghost.sbot { box-shadow: inset 1.5px 0 0 var(--grey), inset -1.5px 0 0 var(--grey), inset 0 -1.5px 0 var(--grey); }
.shaft.ev { background: var(--evstair); } .shaft.clear { background: var(--tG); }
.shaft.bs { background: linear-gradient(#8a9099, #000); } .shaft.bf { background: linear-gradient(#ffd400, #ff5a00); }
.shaft.ev .zig path, .shaft.clear .zig path, .shaft.bs .zig path, .shaft.bf .zig path { stroke: rgba(255,255,255,.85); }
.stc .scnt { position: absolute; right: 0; bottom: 3px; min-width: 16px; height: 16px; border-radius: 8px; display: grid; place-items: center; padding: 0 3px; font-size: 9.5px; font-weight: 800; color: #fff; box-shadow: 0 0 0 1.5px #fff; z-index: 1; }
.stc .scnt.P { background: var(--tP); } .stc .scnt.R { background: var(--tR); } .stc .scnt.N { background: #111; } .stc .scnt.D { background: var(--tD); }
.stc .sba { position: absolute; left: 0; bottom: 3px; font-size: 9px; font-weight: 800; line-height: 13px; background: #111; color: #fff; border-radius: 3px; padding: 0 2px; z-index: 1; }
.stc.ack::after { content: ""; position: absolute; top: 2px; right: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--amber); border: 2px solid var(--panel); z-index: 2; }
.floorhead { display: flex; align-items: flex-end; font-size: 10px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-top: 8px; }
.floorhead .fhfl { width: 64px; flex: none; padding-left: 6px; }
.floorhead .stairs { align-items: flex-end; }
.sth { width: 38px; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 800; padding: 2px 0; border-radius: 5px; display: inline-flex; justify-content: center; align-items: center; gap: 1px; }
.sth.ev { background: #00843d; color: #fff; }
.sth.ev.bad { background: var(--amber); color: #111; }
.sth svg { width: 13px; height: 13px; }
.sth.ev.bad svg circle, .sth.ev.bad svg path { fill: #111; }
.floorhead .fhflats { padding-left: 8px; }
@media (min-width: 720px) { .floorhead .fhfl { width: 84px; } }
.banner.warnban { background: #fff4d6; color: #5a3b00; border: 2px solid var(--amber); text-align: left; width: 100%; }
/* key */
details.key { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin: 12px 0; font-size: 13px; }
details.key summary { font-weight: 700; cursor: pointer; }
.keyg { display: grid; gap: 8px; margin-top: 8px; }
.keyg > div { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tile.mini { width: 34px !important; min-width: 34px !important; min-height: 34px !important; height: 34px; padding: 10px 2px 2px 3px !important; grid-template-columns: 1fr 16px !important; grid-template-rows: 1fr !important; margin: 0 !important; display: inline-grid !important; flex: none; }
.tile.mini::before { height: 8px !important; }
.tile.mini .tp { grid-row: 1; }
.kfl { display: inline-block; padding: 2px 8px; border-radius: 6px; font-weight: 700; font-size: 12px; }
.kfl.evac { background: var(--evac); color: var(--evacink); } .kfl.stay { background: var(--stay); color: var(--stayink); }
.kshaft { position: relative; display: inline-block; width: 22px; height: 30px; border-radius: 8px; }
.kshaft .zig { position: absolute; inset: 0; width: 100%; height: 100%; }
.kshaft .zig path { fill: none; stroke: var(--grey); stroke-width: 2; vector-effect: non-scaling-stroke; }
.kshaft.ev { background: var(--evstair); } .kshaft.ev .zig path { stroke: #fff; }
.kshaft.ghost { box-shadow: inset 0 0 0 1.5px var(--grey); }
.item .tile:not(.add) { margin: 3px; }
.tile .tn { white-space: nowrap; overflow-wrap: normal; font-size: 16px; }
.tile .tn.wide { grid-column: 1 / 3; }
.tile.space .tn { white-space: normal; font-size: 11px; line-height: 1.1; }
.tiles { gap: 8px; }
.tile.R:not(.mini) { margin: 0; box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--tR); }
/* v0.4.1: stairs start green; others pale grey once an evacuation stair is chosen; taller corridor band with a word */
.shaft.other { background: var(--tN); } .shaft.other .zig path { stroke: rgba(255,255,255,.9); }
.kshaft.other { background: var(--tN); } .kshaft.other .zig path { stroke: #fff; }
.fl.cs, .fl.cf { padding-top: 22px; }
.fl.cs::before, .fl.cf::before { display: none; }
.fl .cband { position: absolute; left: 0; right: 0; top: 0; height: 17px; border-radius: 8px 0 0 0; font-size: 10px; font-weight: 900; letter-spacing: .06em; line-height: 17px; padding-left: 6px; border-bottom: 2px solid #fff; }
.fl.cs .cband { background: linear-gradient(90deg, #000, #4a4f57); color: #fff; }
.fl.cf .cband { background: linear-gradient(90deg, #ff5a00, #ffd400); color: #111; }
.fselg { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.tile.fsel { opacity: .45; }
.tile.fsel.on { opacity: 1; outline: 3px solid var(--accent); outline-offset: 2px; }
.savebar.fm { display: grid; gap: 6px; }
.savebar.fm .btn { margin-top: 0 !important; }

/* v0.5: one flat screen for everyone */
.stchips .chip.st { display: inline-flex; align-items: center; gap: 6px; }
.chip.st .sym { width: 18px; height: 18px; position: static; }
.chip.st.D.on { background: var(--tD); color: #fff; border-color: var(--tD); }
.pcount { font-size: 26px; min-width: 48px; text-align: center; }
.banner.newban { background: #fff4d6; color: #5a3d00; border-color: #e8b33a; text-align: left; }
:root[data-theme="dark"] .banner.newban { background: #3a2c08; color: #ffe3a0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .banner.newban { background: #3a2c08; color: #ffe3a0; } }
.lastnote { background: var(--card, transparent); border-left: 3px solid #8e5cc2; padding: 6px 10px; margin: 8px 0; }
.wfl { font-weight: 400; color: var(--muted, #5b6370); }
.top .title .rolebtn { font: inherit; font-size: 12px; font-weight: 700; padding: 1px 8px; min-height: 0; border-radius: 999px; border: 1px solid #ffffff60; background: #ffffff1a; color: var(--head-ink); opacity: 1; }
.fl .tag.BRIDGEHEAD { font-size: 8px !important; padding: 1px 2px !important; letter-spacing: -.02em; max-width: 100%; overflow: hidden; }
/* v0.5.4: sheets open in the middle on tablets and desktops; Undo in the toast */
@media (min-width: 700px) { .sheet:not(.attop) { align-items: center; } .sheet:not(.attop) .in { border-radius: 16px; max-height: 86vh; } }
.toast { display: flex; align-items: center; gap: 12px; }
.toast.hidden { display: none; }
.toast .undo { background: #fff; color: #111; border: 0; border-radius: 8px; padding: 6px 12px; font-weight: 700; min-height: 36px; }
.toast span { white-space: nowrap; }
/* v0.6: Common column, select mode */
.commcol { flex: none; width: 58px; display: flex; flex-direction: column; gap: 5px; padding: 6px 3px; align-items: center; }
.floor > .commcol { background: var(--panel); }
.floor.evac > .commcol { background: var(--evac); }
.floor.stay > .commcol { background: var(--stay); }
.commcol .tile { min-width: 52px; width: 52px; padding: 4px 4px; }
.commcol .tile .tn { font-size: 11px; white-space: normal; overflow-wrap: anywhere; }
.commcol .tile.add { min-height: 36px; }
.floorhead .fhcomm { width: 58px; flex: none; text-align: center; }
.tile, .fl { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.tile.fsel { opacity: .5; }
.tile.fsel.on { opacity: 1; outline: 3px solid #1f5fd1; outline-offset: 2px; }
.selbar { position: fixed; left: 8px; right: 8px; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 40; max-width: 640px; margin: 0 auto; background: var(--head); color: var(--head-ink); border-radius: 14px; padding: 10px 12px; box-shadow: 0 6px 24px #0005; }
.selbar b { display: block; font-size: 14px; margin-bottom: 6px; }
.selbar .btns { display: flex; flex-wrap: wrap; gap: 6px; }
.selbar .btn { background: #ffffff22; color: var(--head-ink); border: 0; }
.selbar .btn.g { background: #2e7d32; color: #fff; }
.selbar .btn:disabled { opacity: .5; }
/* Phones: make room for the Common column and keep three flats per row */
@media (max-width: 440px) {
  .fl { width: 52px; padding: 5px 4px; }
  .floorhead .fhfl { width: 52px; }
  .stc, .sth { width: 30px; }
  .stairs { padding: 0 2px; }
  .commcol { width: 48px; padding: 5px 2px; }
  .floorhead .fhcomm { width: 48px; }
  .commcol .tile, .commcol .tile:not(.add) { min-width: 44px; width: 44px; }
  .tiles { gap: 6px; padding: 5px; }
  .tile:not(.add) { min-width: 54px; width: 54px; min-height: 56px; }
  .fl .advice { font-size: 10px; }
}
/* Light unless chosen (Ben, 5 Dec 2026); form boxes always readable */
:root, :root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
input.in, select.in, textarea.in { color: var(--ink); }
input.in::placeholder, textarea.in::placeholder { color: var(--muted); opacity: 1; }

/* v0.7 (Ben, 5 Dec 2026): role colour, slim building header, floor box labels and colours, fixed zigzag */
.top.role-control { --rc: #2f80ed; } .top.role-ic { --rc: #ffffff; } .top.role-fire { --rc: #e53935; }
.top.role-search { --rc: #f5c400; } .top.role-evac { --rc: #2ecc71; } .top.role-partner { --rc: #b388ff; }
.top[class*="role-"] { border-bottom: 4px solid var(--rc); }
.top[class*="role-"] .title .rolebtn { border: 2px solid var(--rc); background: transparent; display: inline-block; padding: 0 8px; border-radius: 999px; font-weight: 700; }
.big { display: grid; gap: 6px; margin: 2px 0 6px; }
.bigchip { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 14px; min-height: 42px; cursor: pointer; }
.bigchip .grow { flex: 1; }
.bigchip .bi { width: 22px; display: grid; place-items: center; flex: none; }
.bigchip .bi .sym { position: static; width: 20px; height: 20px; }
.bigchip .go { color: var(--muted); white-space: nowrap; font-size: 13px; }
.bigchip.fire { background: #fff5f5; border-color: #f3b0b0; }
.bigchip.all { border-color: #c62828; box-shadow: inset 4px 0 0 #c62828; }
.persons { margin: 4px 0 10px; }
/* floor box: number, FIRE / BRIDGEHEAD labels under it, advice with its symbol at the bottom */
.fl .tag.FIRE { font-size: 9px; padding: 1px 4px; background: var(--tR); color: #fff; }
.fl .advice { margin-top: auto; display: flex; align-items: center; gap: 3px; flex-wrap: wrap; font-weight: 700; line-height: 1.1; }
.fl .advice .sym { position: static; width: 15px; height: 15px; flex: none; }
.floor.bh > .fl, .floor.bh > .tiles, .floor.bh > .commcol { background: #e3f5e1 !important; }
.floor.bh > .fl { box-shadow: none; }
.floor.bh .advice.e { color: var(--evacink); } .floor.bh .advice.s { color: var(--stayink); }
/* coloured advice buttons: evacuate pale red, stay put pale blue, bridgehead pale green */
.advbtns { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.advb { display: inline-flex; align-items: center; gap: 6px; border: 2px solid transparent; border-radius: 10px; padding: 10px 14px; font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; }
.advb .sym { position: static; width: 18px; height: 18px; }
.advb.e { background: #fde4ec; color: #9b1b3a; } .advb.s { background: #e6f1fb; color: #1f5fa8; } .advb.b { background: #e3f5e1; color: #1f6b3a; }
.advb.on { border-color: currentColor; }
.advb.sm { padding: 5px 8px; font-size: 13px; gap: 4px; } .advb.sm .sym { width: 15px; height: 15px; }
.slist { display: grid; gap: 4px; }
.srow { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); }
.srow b { min-width: 28px; font-size: 16px; } .srow .grow { flex: 1; }
.srow.evac { background: #fde4ec; } .srow.stay { background: #e6f1fb; } .srow.bh { box-shadow: inset 4px 0 0 #1f6b3a; }
/* paler grey for not known, and a bold bright ring for search matches */
:root { --tN: #d4d8de; }
.tile.N { color: #30343a; }
.tile.hit { outline: 0; box-shadow: 0 0 0 3px #fff, 0 0 0 6px #ff7a00; }
.tower .flash { animation: flash 1.6s ease-out 2; }
@keyframes flash { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,122,0,0); } 30% { box-shadow: 0 0 0 3px #fff, 0 0 0 7px #ff7a00; } }
/* stair zigzag at a fixed size (no stretching): one flight per floor at the top of the cell, then straight down */
.shaft .zig { inset: auto; top: 0; left: 0; width: 100%; height: 40px; }
.shaft::after { content: ''; position: absolute; left: calc(20% - 1.1px); width: 2.2px; top: 40px; bottom: 0; background: rgba(255,255,255,.85); }
.shaft.ghost::after { background: var(--grey); }
.kshaft .zig { height: 100%; }
.sth svg circle, .sth svg path { fill: #9aa1ab; }
.sth.ev svg circle, .sth.ev svg path { fill: #fff; }
.unkslim { display: none; }
@media (max-width: 440px) {
  .fl { width: 56px; }
  .fl .advice { font-size: 9.5px; }
  .fl .tag.BRIDGEHEAD { font-size: 7px !important; }
}
.fladv .advice { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; } .fladv .advice .sym { position: static; width: 18px; height: 18px; }
.fladv .advice.e { color: var(--evacink); } .fladv .advice.s { color: var(--stayink); }
/* v0.7.1 zigzag: repeats every 24px at a fixed size; aligned across floors by alignZig() */
.shaft .zig, .shaft::after { display: none; }
.shaft, .kshaft { background-repeat: repeat-y; background-size: 100% 24px; }
.shaft.ghost, .kshaft { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 24' preserveAspectRatio='none'%3E%3Cpath d='M2.5 0 L7.5 12 L2.5 24' fill='none' stroke='%239aa1ab' stroke-width='2' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E"); }
.shaft.ev, .shaft.other, .shaft.clear, .shaft.bs, .shaft.bf, .kshaft.ev, .kshaft.other { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 24' preserveAspectRatio='none'%3E%3Cpath d='M2.5 0 L7.5 12 L2.5 24' fill='none' stroke='white' stroke-opacity='.9' stroke-width='2' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E"); }
.shaft.ev { background-color: var(--evstair); } .shaft.other, .kshaft.other { background-color: var(--tN); } .shaft.clear { background-color: var(--tG); } .kshaft.ev { background-color: var(--evstair); }
.shaft.bs { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 24' preserveAspectRatio='none'%3E%3Cpath d='M2.5 0 L7.5 12 L2.5 24' fill='none' stroke='white' stroke-opacity='.9' stroke-width='2' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E"), linear-gradient(#8a9099, #000); background-size: 100% 24px, 100% 100%; background-repeat: repeat-y, no-repeat; }
.shaft.bf { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 24' preserveAspectRatio='none'%3E%3Cpath d='M2.5 0 L7.5 12 L2.5 24' fill='none' stroke='white' stroke-opacity='.9' stroke-width='2' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E"), linear-gradient(#ffd400, #ff5a00); background-size: 100% 24px, 100% 100%; background-repeat: repeat-y, no-repeat; }
.stratnow { border-radius: 10px; padding: 10px 12px; background: var(--chip); display: grid; gap: 2px; }
.stratnow.all { background: #fde4ec; box-shadow: inset 4px 0 0 #c62828; }
.stc .shaft, .kshaft { background-size: 100% 24px; background-repeat: repeat-y; }
.stc .shaft.bs, .stc .shaft.bf { background-size: 100% 24px, 100% 100%; background-repeat: repeat-y, no-repeat; }
