/* DocuField's own look (the CRM's "instrument" palette): white work area, light-teal sidebar, Archivo,
   deep teal for actions and money, logo teal only for marks. Dark mode is the same palette inverted. */
:root {
  --bg: #FFFFFF; --panel: #FFFFFF; --panel-2: #F3F6F6; --side: #F0F7F6; --side-on: #D6EFEB; --side-line: #DAE5E3;
  --ink: #172033; --ink-2: #2B3A4E; --muted: #5A6778; --faint: #B5C0C4; --line: #DFE5E7; --line-2: #D5DEE0; --row-line: #EEF2F2;
  --accent: #0A7A6C; --accent-hover: #075E53; --accent-ink: #FFFFFF; --mark: #1BC0AA;
  --accent-soft: #E3F4F1; --accent-soft-ink: #075E53; --accent-soft-line: #A9DDD4;
  --fire: #C9423B; --fire-ink: #A8352F; --fire-soft: #FBECEB;
  --water: #2F75D0; --damage: #915A08; --other: #8A96A3; --ok: #0A7A6C;
  --warn-ink: #915A08; --warn-text: #6B4306; --warn-soft: #FDF3E0; --warn-line: #F2D9A8;
  --stage-soft: #EEEAF8; --stage-ink: #4A2E92;
  --radius: 12px; --shadow: 0 1px 2px rgba(23,32,51,.05); --shadow-pop: 0 8px 24px rgba(23,32,51,.12);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0F1720; --panel: #16212B; --panel-2: #1D2A35; --side: #121D26; --side-on: #183A37; --side-line: #22313C;
  --ink: #E8EEF1; --ink-2: #C9D3DA; --muted: #8C9AA7; --faint: #4F5E6A; --line: #26343F; --line-2: #2E3E4A; --row-line: #22303A;
  --accent: #1BA896; --accent-hover: #2CC2AE; --accent-ink: #FFFFFF; --mark: #1BC0AA;
  --accent-soft: #163A36; --accent-soft-ink: #7FDCCB; --accent-soft-line: #24564F;
  --fire: #E0605A; --fire-ink: #F08A84; --fire-soft: #3A1F20;
  --water: #5B9BE8; --damage: #D9A54A; --other: #7C8894; --ok: #2CC2AE;
  --warn-ink: #E3B25E; --warn-text: #F0D3A0; --warn-soft: #33281A; --warn-line: #5A4524;
  --stage-soft: #2A2442; --stage-ink: #C4B5F5;
  --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-pop: 0 8px 24px rgba(0,0,0,.45);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body { font: 14px/1.45 "Archivo", "Helvetica Neue", Arial, system-ui, sans-serif; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; border-radius: 8px; min-height: 36px; padding: 0 14px; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
button:hover:not(:disabled) { background: var(--accent-hover); }
button.ghost { background: var(--panel); color: var(--ink); border: 1px solid var(--line-2); }
button.ghost:hover:not(:disabled) { background: var(--panel-2); }
button.danger { background: var(--panel); color: var(--fire-ink); border: 1px solid var(--line-2); }
button.danger:hover:not(:disabled) { background: var(--fire-soft); }
button.small { min-height: 30px; padding: 0 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; min-height: 40px; padding: 8px 12px; width: 100%; }
textarea { min-height: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--mark) 45%, transparent); outline-offset: 0; border-color: var(--mark); }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--accent); }
label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 12px 0 4px; }
h1 { font-size: 26px; font-weight: 800; font-stretch: 104%; margin: 0 0 12px; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 700; font-stretch: 104%; margin: 0 0 10px; }
h3 { font-weight: 700; }
small { color: var(--muted); }
code { background: var(--panel-2); border-radius: 4px; padding: 0 4px; font-size: 12px; }
summary { cursor: pointer; }
.muted { color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.empty { text-align: center; color: var(--muted); padding: 48px 16px; }
h3.eyebrow { margin: 0 0 8px; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }

/* Layout: sidebar | page */
#app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; background: linear-gradient(90deg, var(--side) 0 240px, var(--bg) 240px); }
#app.bare { grid-template-columns: 1fr; background: var(--side); }
#sidebar { background: var(--side); border-right: 1px solid var(--side-line); padding: 16px 12px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; padding: 6px 8px 2px; }
.brand .wm { display: block; width: 100%; max-width: 200px; height: auto; }
.auth .brand .wm { max-width: 260px; }
.wm-dark, :root[data-theme="dark"] .wm-light { display: none !important; }
:root[data-theme="dark"] .wm-dark { display: block !important; }
#sidebar nav { display: flex; flex-direction: column; gap: 2px; }
#sidebar .section { display: flex; align-items: center; gap: 8px; padding: 14px 10px 6px; }
#sidebar .section:first-child { padding-top: 6px; }
#sidebar nav a { display: flex; align-items: center; gap: 10px; color: var(--ink-2); padding: 8px 10px; border-radius: 8px; position: relative; }
#sidebar nav a:hover { background: color-mix(in srgb, var(--side-on) 55%, transparent); color: var(--ink); }
#sidebar nav a.on { background: var(--side-on); color: var(--ink); font-weight: 600; padding-left: 14px; }
#sidebar nav a.on::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 3px; background: var(--mark); }
#sidebar .ico { width: 18px; height: 18px; flex: none; color: var(--muted); display: grid; place-items: center; }
#sidebar .ico svg { width: 17px; height: 17px; }
#sidebar a.on .ico { color: var(--accent); }
#sidebar .dot, #tabbar .dot { width: 8px; height: 8px; background: var(--fire); border-radius: 50%; margin-left: auto; }
#sidebar .who { margin-top: auto; display: flex; gap: 10px; align-items: center; padding: 10px 8px 0; border-top: 1px solid var(--side-line); }
#sidebar .who > div:nth-child(2) { min-width: 0; flex: 1; }
#sidebar .who b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#sidebar .who small { display: block; font-size: 11px; }
#sidebar .signout { min-height: 30px; padding: 0 10px; font-size: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-soft-ink); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
#view { min-width: 0; padding: 0 28px 48px; }
#tabbar { display: none; }

/* Page header (title + one line of context), like the CRM's pages */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 20px 28px; margin: 0 -28px 20px; border-bottom: 1px solid var(--line); }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); }
.page-head .sub b { color: var(--accent); }
.page-head .sub .hot { color: var(--fire); }
.crumbs { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs .sep { color: var(--faint); }
.crumbs b { font-weight: 600; }

/* Feed */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; position: sticky; top: 0; z-index: 500; background: var(--bg); padding: 8px 0 12px; }
.searchbox { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 12px; min-height: 40px; background: var(--panel); flex: 1 1 260px; }
.searchbox svg { flex: none; color: var(--muted); }
.searchbox input { border: 0; min-height: 38px; padding: 0; background: transparent; }
.searchbox input:focus { outline: none; }
.searchbox:focus-within { border-color: var(--mark); outline: 2px solid color-mix(in srgb, var(--mark) 45%, transparent); }
.toolbar select { width: auto; }
.daynav { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 8px; padding: 2px; background: var(--panel); }
.daynav button { background: transparent; color: var(--ink-2); border: 0; min-height: 34px; padding: 0 10px; font-weight: 600; }
.daynav button:hover:not(:disabled) { background: var(--panel-2); }
.daynav input[type=date] { border: 0; min-height: 34px; padding: 0 6px; width: auto; background: transparent; color: var(--muted); }
.day-head { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; margin: 18px 0 8px; }
.day-head::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.day-head span { background: var(--panel-2); color: var(--ink-2); border-radius: 999px; padding: 1px 8px; font-size: 11px; letter-spacing: 0; }
.inc { display: grid; grid-template-columns: 4px 20px minmax(0, 1fr) auto; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 14px 0; margin-bottom: 10px; cursor: pointer; overflow: hidden; box-shadow: var(--shadow); transition: border-color .15s; }
.inc:hover { border-color: var(--accent-soft-line); }
.inc .edge { background: var(--edge, var(--faint)); margin: -14px 0; }
.inc .sel { margin-top: 3px; }
.inc.fresh { border-color: var(--mark); box-shadow: 0 0 0 2px color-mix(in srgb, var(--mark) 30%, transparent); }
.inc .what { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.inc .what > b { font-weight: 700; font-size: 15px; }
.fam-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.chip-live { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--fire-soft); color: var(--fire-ink); }
.chip-out { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); color: var(--ink-2); }
.conf { font-size: 12px; font-weight: 600; color: var(--accent); }
.conf.warn, .conf.bad { color: var(--warn-ink); }
.addr { color: var(--ink-2); margin-top: 4px; }
.inc .brief-line { margin-top: 4px; color: var(--muted); font-size: 13px; }
.meta { color: var(--muted); font-size: 12px; display: flex; gap: 6px 12px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.meta .tag { display: inline-flex; gap: 4px; align-items: center; }
.meta .closed { color: var(--fire-ink); }
.right { text-align: right; font-size: 12px; color: var(--muted); white-space: nowrap; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.right .val { font-weight: 800; font-size: 18px; color: var(--accent); line-height: 1.2; }
.right .num { color: var(--ink-2); font-weight: 600; }
.ai-tag { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--warn-ink); }
.ai-tag.boxed { background: var(--warn-soft); border: 1px solid var(--warn-line); border-radius: 6px; padding: 2px 8px; font-size: 11px; }
.flame { color: var(--fire); }
.pager { display: flex; justify-content: center; gap: 8px; align-items: center; margin: 14px 0; color: var(--muted); flex-wrap: wrap; }
.bulk { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; margin-bottom: 4px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--panel-2); border-radius: 8px; padding: 3px; }
.seg button { background: transparent; color: var(--muted); min-height: 32px; padding: 0 12px; border-radius: 6px; font-size: 13px; }
.seg button:hover:not(:disabled) { background: transparent; color: var(--ink); }
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(23,32,51,.12); }

/* Map */
.map { height: calc(100vh - 200px); min-height: 360px; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; }
.map.full { height: calc(100vh - 190px); }
.leaflet-container { background: #EEF2F2; font: inherit; }
.pin { background: none; border: 0; }
.pin .p { width: 32px; height: 32px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--c); display: grid; place-items: center; box-shadow: 0 2px 6px rgba(23,32,51,.35); border: 2px solid #fff; }
.pin .p svg { transform: rotate(45deg); width: 17px; height: 17px; color: #fff; }
.pin.approx .p { border-style: dashed; opacity: .8; }
.marker-cluster { background: color-mix(in srgb, var(--mark) 30%, transparent); border-radius: 50%; }
.marker-cluster div { width: 30px; height: 30px; margin: 5px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; display: grid; place-items: center; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--ink); border-radius: 10px; }
.leaflet-popup-content { margin: 12px 14px; min-width: 220px; }
.map-count { position: absolute; z-index: 600; top: 10px; left: 50px; background: var(--panel); border: 1px solid var(--line); padding: 5px 10px; border-radius: 8px; font-size: 12px; box-shadow: var(--shadow); }

/* Incident page */
.detail { max-width: 1180px; display: flex; flex-direction: column; gap: 20px; }
.lead-top { display: flex; flex-wrap: wrap; gap: 20px; }
.lead-top .map { flex: 1 1 420px; min-width: 0; height: 340px; min-height: 0; }
.lead { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.lead .title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lead .title strong { font-size: 20px; font-weight: 800; font-stretch: 104%; }
.badge { display: inline-block; background: var(--c); color: #fff; font-weight: 700; font-size: 12px; letter-spacing: .04em; padding: 3px 9px; border-radius: 6px; text-transform: uppercase; max-width: 100%; }
.est-big { font-size: 40px; font-weight: 800; color: var(--accent); line-height: 1; margin-top: 6px; }
.est-why { color: var(--muted); margin-top: 6px; }
.disclaimer { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; padding: 10px 12px; border-radius: 8px; font-size: 13px; line-height: 1.45; color: var(--warn-text); background: var(--warn-soft); border: 1px solid var(--warn-line); }
.disclaimer svg { flex: none; margin-top: 1px; }
.lead .where { font-size: 18px; font-weight: 700; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pills .pill { font-size: 13px; padding: 4px 11px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; }
.facts span { border: 1px solid var(--line); color: var(--ink-2); border-radius: 8px; padding: 5px 10px; font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
a.btn, .actions button { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 700; }
a.btn:hover { background: var(--accent-hover); color: #fff; }
a.btn.ghost, .actions button.ghost { background: var(--panel); color: var(--ink); border: 1px solid var(--line-2); font-weight: 600; }
a.btn.ghost:hover { background: var(--panel-2); color: var(--ink); }
.two-col { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.two-col > .card { flex: 1 1 340px; min-width: 0; }
.two-col > .card:first-child { flex: 999 1 480px; }
.brief { margin: 0; font-size: 16px; line-height: 1.55; }
.expect { margin: 12px 0 0; color: var(--ink-2); line-height: 1.55; }
.expect b { color: var(--ink); }
.facts-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.facts-grid b { display: block; font-size: 18px; font-weight: 800; }
.facts-grid small { display: block; font-size: 12px; margin-top: 2px; }
.status-card { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.status-card h2 { margin: 0 8px 0 0; }
.status-card .chip { min-height: 40px; padding: 0 16px; font-size: 14px; }
.tabs-card { padding: 0; overflow: hidden; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 8px; overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; color: var(--muted); border-radius: 0; min-height: 46px; padding: 0 14px; border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs button:hover:not(:disabled) { background: none; color: var(--ink); }
.tabs button.on { color: var(--ink); border-color: var(--accent); font-weight: 700; }
.tabs sup { background: var(--panel-2); color: var(--ink-2); border-radius: 999px; padding: 0 6px; font-size: 10px; margin-left: 4px; font-weight: 600; }
#tab-body { padding: 14px 22px 18px; }
#tab-body .card { box-shadow: none; }
.entry { padding: 10px 0; border-bottom: 1px solid var(--row-line); }
.entry:last-child { border-bottom: 0; }
.entry .when { color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; margin-bottom: 4px; }
.entry .text { text-transform: uppercase; }
.page-list .entry { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 10px; box-shadow: var(--shadow); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; }
.phones a { margin-right: 10px; white-space: nowrap; }
.dnc { color: var(--fire-ink); font-size: 11px; font-weight: 700; }
.old { background: var(--fire-soft); color: var(--fire-ink); padding: 1px 6px; border-radius: 4px; font-size: 11px; font-weight: 700; }
.new { background: var(--accent-soft); color: var(--accent-soft-ink); padding: 1px 6px; border-radius: 4px; font-size: 11px; font-weight: 700; }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: 110%; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-pop); min-width: 190px; z-index: 900; overflow: hidden; padding: 4px; }
.menu-list button { display: block; width: 100%; text-align: left; background: none; color: var(--ink); border-radius: 6px; font-weight: 500; }
.menu-list button:hover:not(:disabled) { background: var(--panel-2); }
.toolbar .menu-list button { display: inline-flex; width: auto; }
.toolbar .menu-list button:not(.ghost) { background: var(--accent); color: #fff; }

/* Search */
.filters { display: grid; gap: 12px; }
.filter-row { display: grid; grid-template-columns: 110px 1fr; gap: 10px; align-items: start; }
.filter-row > b { padding-top: 8px; font-size: 11px; font-weight: 600; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; min-height: 32px; border: 1px solid var(--line-2); background: var(--panel); color: var(--ink-2); border-radius: 999px; padding: 0 12px; font-size: 13px; font-weight: 600; }
.chip:hover:not(:disabled) { background: var(--panel-2); }
.chip.on, .chip.on:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent-soft-line); color: var(--accent-soft-ink); }
.typepick { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; background: var(--panel); }
.typepick label { display: flex; gap: 8px; align-items: center; color: var(--ink); margin: 5px 0; font-size: 13px; font-weight: 400; }
.typepick .grp { font-weight: 600; color: var(--muted); margin-top: 10px; font-size: 11px; letter-spacing: .06em; }
.search-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; }
.bars { display: grid; gap: 6px; }
.bar { display: grid; grid-template-columns: 200px 1fr 60px; gap: 10px; align-items: center; font-size: 12px; }
.bar .fill { height: 14px; border-radius: 4px; background: var(--mark); min-width: 2px; }
.bar .k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .n { text-align: right; }
.queries button { width: 100%; text-align: left; margin-bottom: 6px; }

/* Account */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--row-line); }
.switch:last-child { border-bottom: 0; }
.switch small { display: block; }
.toggle { position: relative; width: 42px; height: 24px; flex: none; margin: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle span { position: absolute; inset: 0; background: var(--line-2); border-radius: 999px; transition: .2s; cursor: pointer; }
.toggle span::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(23,32,51,.2); }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::before { transform: translateX(18px); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--panel-2); color: var(--ink-2); }
.pill.ok { background: var(--accent-soft); color: var(--accent-soft-ink); }
.pill.warn { background: var(--warn-soft); color: var(--warn-ink); }
.pill.bad, .pill.live { background: var(--fire-soft); color: var(--fire-ink); }
.pill.stage, .pill.stage-contacted, .pill.stage-inspected { background: var(--stage-soft); color: var(--stage-ink); }
.pill.stage-signed { background: var(--accent-soft); color: var(--accent-soft-ink); }
.pill.stage-lost { text-decoration: line-through; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
td, th { padding: 9px 8px; border-bottom: 1px solid var(--row-line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
td select { min-height: 32px; padding: 4px 8px; }

/* Sign-in */
.auth { max-width: 400px; margin: 12vh auto; padding: 28px; }
.auth .brand { padding: 0; margin-bottom: 22px; }
.auth h2 { font-size: 20px; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); box-shadow: var(--shadow-pop); padding: 10px 16px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 2000; font-weight: 500; }
#toast.show { opacity: 1; }
#audio-prompt { position: fixed; right: 20px; bottom: 20px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-pop); border-radius: 12px; padding: 14px 16px; display: flex; gap: 10px; align-items: center; z-index: 1500; max-width: calc(100vw - 32px); }
#audio-prompt small { display: block; }

/* Incidents hidden by default (score.hidden), seen only with "Show all" */
.inc.is-hidden { opacity: .62; }
.inc.is-hidden:hover { opacity: 1; }
.tag.hidden-why { font-style: italic; }
.show-all { white-space: nowrap; font-size: 13px; color: var(--ink); gap: 6px; font-weight: 500; }

@media (max-width: 860px) {
  #app { grid-template-columns: 1fr; background: var(--bg); }
  #sidebar { display: none; }
  .bulk, .daynav input[type=date] { display: none; }
  .page-head .muted { font-size: 13px; }
  #view { padding: 0 16px calc(84px + env(safe-area-inset-bottom)); }
  .page-head { margin: 0 -16px 14px; padding: 14px 16px; }
  h1 { font-size: 22px; }
  #tabbar:not([hidden]) { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 1000; }
  #tabbar a { display: grid; justify-items: center; gap: 2px; color: var(--muted); font-size: 11px; font-weight: 500; padding: 8px 0 6px; position: relative; }
  #tabbar a svg { width: 22px; height: 22px; }
  #tabbar a.on { color: var(--accent); font-weight: 700; }
  .inc { grid-template-columns: 4px minmax(0, 1fr); gap: 8px 12px; }
  .inc .sel { display: none; }
  .inc .right { grid-column: 2; flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; text-align: left; white-space: normal; }
  .right .val { font-size: 16px; }
  .search-layout { grid-template-columns: 1fr; }
  .filter-row { grid-template-columns: 1fr; gap: 6px; }
  .bar { grid-template-columns: 110px 1fr 40px; }
  .map { height: calc(100vh - 260px); }
  .map.full { height: calc(100vh - 220px); }
  .lead-top .map { height: 220px; flex-basis: 100%; }
  .est-big { font-size: 32px; }
  .status-card .chip { min-height: 36px; padding: 0 12px; }
  #tab-body { padding: 10px 16px 14px; }
  #audio-prompt { left: 16px; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
}
