/* ============================================================
   DISPATCH PRO — Evac Portal v2
   Real MapLibre map, live /api/evac/portal/* data, smooth
   FLIP-style fullscreen morph, click interactions.
   ============================================================ */

@import "../themes/evacuation-public.css";

html,body { margin:0; padding:0; height:100%; }
body {
  background:var(--bg); color:var(--fg);
  font-family:"Sora", system-ui, sans-serif;
  min-height:100vh; -webkit-font-smoothing:antialiased;
  letter-spacing:-.005em;
  transition: background .3s ease, color .3s ease;
}
body.immersive { background:var(--map-bg); overflow:hidden; }

.maplibregl-ctrl-attrib { font-size:var(--font-size-3xs); }
[data-theme="dark"] .maplibregl-ctrl-attrib,
[data-theme="navy"] .maplibregl-ctrl-attrib { background:rgba(0,0,0,.6); color:#aaa; }
[data-theme="dark"] .maplibregl-ctrl-attrib a,
[data-theme="navy"] .maplibregl-ctrl-attrib a { color:#ddd; }
.maplibregl-popup-content {
  border-radius:10px; padding:.85rem 1rem; box-shadow:var(--shadow-pop);
  font-family:"Sora", sans-serif; color:var(--fg);
  background:var(--surface); border:1px solid var(--line);
}
.maplibregl-popup-close-button { color:var(--fg-3); font-size:1.1rem; padding:.15rem .35rem; }
/* A popup reads above the open legend (z-index 20), never under it (SC-20261117-0021). */
.maplibregl-popup { z-index:25; }
.pop-pre { font-size:.65rem; font-weight:700; margin-bottom:.25rem; }
.pop-title { font-weight:600; font-size:.92rem; margin-bottom:.2rem; letter-spacing:-.01em; line-height:1.25; }
.pop-sub { font-size:.74rem; color:var(--fg-3); margin-bottom:.4rem; }
.pop-body { font-size:.78rem; color:var(--fg-2); line-height:1.45; }
.pop-meta { font-size:.65rem; color:var(--fg-3); margin-top:.35rem; font-family:"JetBrains Mono", monospace; }
.pop-chip { display:inline-block; padding:.16rem .5rem; border-radius:5px; color:#fff; font-size:.62rem; font-weight:700; }

/* Demo mode banner */
.demo-banner {
  position:fixed; top:0; inset-inline-start:0; inset-inline-end:0; z-index:600;
  background:#DC2626; color:#fff;
  padding:.4rem .85rem;
  font-size:.72rem; font-weight:600;
  text-align:center;
  border-bottom:1px solid rgba(0,0,0,.15);
  box-shadow: 0 1px 4px rgba(220,38,38,.3);
}
body.has-demo-banner .stage { padding-top:30px; }

/* stage */
.stage { padding:0; position:relative; z-index:2; }
body.immersive .stage { position:fixed; inset:0; overflow:hidden; }
.frame { margin:0 auto; max-width:100%;  position:relative; }
.stage.desktop .frame { max-width:unset; }
body.immersive .stage .frame {
  position:absolute; left:50%; transform:translateX(-50%);
  top:0; bottom:0; width:100%; max-width:100%;
  background:var(--map-bg); overflow:hidden; padding:0;
}
body.has-demo-banner.immersive .stage .frame { top:30px; }

/* shared MapLibre instance — z:50 in dashboard so it paints above .container
   (z:7) within its physical slot rect; lowered to z:5 in immersive so the
   immersive-layer chrome (z:11+) renders above the map. */
#map {
  position:absolute;
  background:var(--map-bg);
  z-index:50;
  overflow:hidden;
  transition: border-radius .4s cubic-bezier(.32,.72,0,1);
  margin-top: 7.5px;
}
body.immersive #map { z-index:5; }

.dash, .immersive-layer { transition: opacity .25s ease; }
/* overflow:hidden — the hidden layer's chips are placed for a wide screen and
   would otherwise make a phone page scroll sideways while it is not shown. */
body:not(.immersive) .immersive-layer { opacity:0; pointer-events:none; visibility:hidden; overflow:hidden; transition: opacity .25s ease, visibility 0s linear .25s; }
body.immersive .immersive-layer { opacity:1; visibility:visible; pointer-events:auto; transition: opacity .25s ease .1s, visibility 0s linear; }
body.immersive .dash { opacity:0; pointer-events:none; }

/* dashboard chrome */
.dash .head {
  background:var(--surface);
  border-bottom:1px solid var(--line);
  padding: .25rem clamp(4rem, 5vw, 6rem);
  display:flex;
  align-items:center;
  gap:var(--spacing-md);
  justify-content:space-between;
  flex-wrap:wrap;
  z-index: 999;
  position: sticky;
  top: 0px;
  height: 55px;
}
.brand { display:flex; align-items:center; gap:.65rem; font-weight:600; font-size:.95rem; letter-spacing:-.01em; }
.brand .logo {
  width: 45px;
  height: 45px;
  border-radius:var(--radius-md);
  /* background: linear-gradient(135deg, var(--accent), var(--accent-2)); */
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:.75rem;
  margin-inline-start: 5px;
  margin-top: -5px;
}
.brand .logo img { width:100%; height:100%; object-fit:cover; border-radius:var(--radius-md); }
.brand small { display:block; font-weight:400; font-size:.7rem; color:var(--fg-3); letter-spacing:0; margin-top:.05rem; }
.nav { display:flex; align-items:center; gap:.25rem; }
.nav a {
  padding:.4rem .7rem; border-radius:7px;
  font-size:.78rem; font-weight:500;
  color:var(--fg-2); text-decoration:none;
}
.nav a:hover, .nav a.current { background:var(--surface-2); color:var(--fg); }
.head-right { display:flex; align-items:center; gap:.5rem; flex-wrap:wrap; }
.pill {
  display:inline-flex; align-items:center; gap:.4rem;
  padding:.3rem .6rem; border-radius:999px;
  font-size:.7rem; font-weight:500;
  background:var(--surface-2); border:1px solid var(--line); color:var(--fg-2);
}
.pill .dot { width:6px; height:6px; border-radius:50%; background:var(--ok); }
.pill.live .dot {
  background:var(--evac);
  box-shadow: 0 0 0 3px rgba(220,38,38,.15);
  animation: pulse 1.6s infinite;
}
@keyframes pulse { 50% { opacity:.4; } }

.dash .container {
  padding: clamp(1.25rem, 3vw, 2rem) clamp(1rem, 3vw, 2rem) 3rem;
  /* max-width:1600px; */
  margin:0 auto;
  position:relative;
  z-index:7;
  padding: 1.25rem clamp(4.5rem, 5.5vw, 6rem);
}
.page-head { display:flex; align-items:flex-end; justify-content:space-between; gap:var(--spacing-md); margin-bottom:1.5rem; flex-wrap:wrap; }
.page-head h1 { margin:0; font-size:1.8rem; font-weight:600; letter-spacing:-.02em; line-height:1.1; }
.page-head .sub { margin-top:.3rem; font-size:.85rem; color:var(--fg-2); }
.page-head .actions { display:flex; gap:.5rem; flex-wrap:wrap; }

.btn.fs-toggle .label-immersive, body.immersive .btn.fs-toggle .label-dashboard { display:none; }
body.immersive .btn.fs-toggle .label-immersive { display:inline; }

.kpis { display:grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap:.85rem; margin-bottom:1.25rem; }
/* The portal's card surface. */
.kpi, .dash .map-card, .panel-card, .kb-item, .resource-card, .help-card {
  background:var(--surface); border:1px solid var(--line);
  border-radius:var(--radius-native); box-shadow:var(--shadow);
}
.kpi { padding:1rem 1.1rem; }
.kpi .lbl { font-size:.7rem; color:var(--fg-3); font-weight:500; }
.kpi .v { margin-top:.4rem; font-size:1.85rem; font-weight:600; letter-spacing:-.025em; font-variant-numeric:tabular-nums; line-height:1; }
.kpi .delta { margin-top:.35rem; font-size:.72rem; color:var(--fg-2); display:inline-flex; gap:.3rem; align-items:center; font-family:"JetBrains Mono", monospace; }
.kpi .delta.up { color:var(--evac); }
.kpi .delta.flat { color:var(--fg-3); }
.kpi.evac .v { color:var(--evac); }
.kpi.warn .v { color:var(--warn); }
.kpi.normal .v { color:var(--ok); }

.order {
  background: linear-gradient(180deg, var(--evac-soft), transparent), var(--surface);
  border:1px solid var(--line);
  /* border-bottom: 3px solid var(--evac); */
  border-radius:var(--radius-native);
  padding: 1.1rem 1.25rem 1.2rem;
  margin-bottom:1.5rem;
  display:grid;
  grid-template-columns: auto 1fr auto;
  gap:var(--spacing-md);
  align-items:flex-start;
  box-shadow:var(--shadow);
}
.order.empty {
  background: linear-gradient(180deg, rgba(22,163,74,.06), transparent), var(--surface);
  border-inline-start-color:var(--ok);
}
.order .ic {
  width:34px; height:34px; border-radius:var(--radius-md);
  background:var(--evac); color:var(--text-on-accent);
  display:flex; align-items:center; justify-content:center;
  font-size:.82rem; margin-top:.1rem;
}
.order.empty .ic { background:var(--ok); }
.order .head-line {
  font-size:.7rem;
  color:var(--evac); font-weight:600;
  display:flex; gap:.5rem; align-items:center;
}
.order.empty .head-line { color:var(--ok); }
.order .head-line .ts { color:var(--fg-3); }
.order h2 { margin:.25rem 0 .35rem; font-size:1.15rem; font-weight:600; letter-spacing:-.01em; }
.order p { margin:0; font-size:.88rem; color:var(--fg-2); line-height:1.5; max-width:64ch; }
.order .order-actions { display:flex; flex-direction:column; gap:.45rem; }

.dash .grid { display:grid; grid-template-columns: minmax(0, 1fr) 360px; gap:1.25rem; }
@media (max-width:1080px) { .dash .grid { grid-template-columns: 1fr; } }

.dash .map-card { overflow:hidden; position:relative; }
.map-toolbar {
  padding: .65rem .85rem;
  border-bottom:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:.5rem;
  flex-wrap:wrap;
  background:var(--surface);
  position:relative;
  z-index: 1143;
}
.map-tabs { display:flex; gap:.2rem; }
.map-tabs button {
  appearance:none; border:0; background:transparent; cursor:pointer;
  padding:.35rem .65rem; border-radius:var(--radius-sm);
  font:inherit; font-size:.74rem; font-weight:500; color:var(--fg-2);
}
.map-tabs button[aria-pressed="true"] { background:var(--surface-2); color:var(--fg); }
/* The magnifier sits over the field; data-field-icon="start" makes its room. */
.map-search { flex:1; max-width:320px; min-width:180px; position:relative; }
.map-search i { position:absolute; inset-inline-start:var(--control-px); top:50%; transform:translateY(-50%); color:var(--fg-3); font-size:.75rem; pointer-events:none; }
/* Google Places autocomplete dropdown */
.pac-container {
  border-radius:var(--radius-md); border:1px solid var(--line);
  box-shadow:var(--shadow-pop); margin-top:4px;
  font-family:"Sora", sans-serif; background:var(--surface);
}
.pac-item { padding:.5rem .75rem; font-size:.8rem; color:var(--fg); border-top:1px solid var(--line-soft); }
.pac-item:hover, .pac-item-selected { background:var(--surface-2); }
.pac-item-query { color:var(--fg); font-weight:500; }
.pac-matched { color:var(--accent); font-weight:600; }
.pac-icon { display:none; }

.map-slot {position:relative;aspect-ratio: 16 / 9.5;background:var(--map-bg);}

.meta-row {
  display:grid; grid-template-columns: repeat(3, 1fr); gap:.75rem;
  padding:.85rem; border-top:1px solid var(--line);
  background:var(--surface); position:relative; z-index:6;
}
.meta-row .item {
  background:var(--surface-2); border:1px solid var(--line);
  border-radius:var(--radius-md); padding:.65rem .8rem;
}
.meta-row .item .l { font-size:.65rem; color:var(--fg-3); font-weight:500; }
.meta-row .item .v { margin-top:.15rem; font-size:.95rem; font-weight:600; letter-spacing:-.01em; font-variant-numeric:tabular-nums; }
.meta-row .item .s { font-size:.72rem; color:var(--fg-2); margin-top:.05rem; }

.panel-card { overflow:hidden; }
.panel-card + .panel-card {margin-top: 20px;}

div#safety-feed-panel {
    max-height: 575px;
    overflow-y: auto;
}

div#alerts-panel {
    margin-top: 0px;
}
.panel-card .panel-head { padding:.75rem .95rem; border-bottom:1px solid var(--line); display:flex; align-items:center; justify-content:space-between; }
.panel-card .panel-head h3 { margin:0; font-size:.82rem; font-weight:600; letter-spacing:-.005em; color:var(--fg); display:flex; align-items:center; gap:.45rem; }
.panel-card .panel-head h3 i { color:var(--fg-3); font-size:.78rem; }
.panel-card .panel-head .badge { font-size:.66rem; color:var(--fg-2); padding:.15rem .45rem; background:var(--surface-2); border-radius:999px; border:1px solid var(--line); }
.panel-card .panel-body { padding:.5rem .95rem; min-height:60px; }
.panel-card .panel-body[data-alerts-list],
.panel-card .panel-body[data-safety-list] {
  max-height: 380px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.panel-card .panel-foot { padding:.65rem .95rem; border-top:1px solid var(--line); font-size:.72rem; }
.panel-card .panel-foot a { color:var(--accent); text-decoration:none; font-weight:500; }

.alert {
  display:grid; grid-template-columns: auto 1fr auto;
  gap:.7rem; align-items:center;
  padding:.65rem 0;
  border-bottom:1px solid var(--line-soft);
  cursor:pointer; transition: background .15s ease;
}
.alert:last-child { border-bottom:0; }
.alert:hover { background:var(--surface-2); }
.alert .tag {
  font-size:.62rem; font-weight:700;
  padding:.16rem .4rem; border-radius:5px;
  background:var(--evac-soft); color:var(--evac); line-height:1.1;
}
.alert.warn .tag { background:var(--warn-soft); color:var(--warn); }
.alert.shelter .tag { background:var(--shelter-soft); color:var(--shelter); }
.alert .z { font-size:.86rem; font-weight:500; font-variant-numeric:tabular-nums; }
.alert .d { font-size:.74rem; color:var(--fg-2); margin-top:.1rem; }
.alert .t { text-align:end; font-family:"JetBrains Mono", monospace; font-size:.72rem; color:var(--fg-2); white-space:nowrap; }
.empty-state { text-align:center; padding:1.25rem .5rem; color:var(--fg-3); font-size:.85rem; }
.empty-state i { font-size:1.3rem; color:var(--ok); display:block; margin-bottom:.35rem; }
.loading-row { text-align:center; padding:.85rem; color:var(--fg-3); font-size:.78rem; }
.subscribe-status { margin-top:.55rem; font-size:.78rem; padding:.4rem .55rem; border-radius:var(--radius-sm); }
.subscribe-status.ok { background:rgba(22,163,74,.10); color:var(--ok); border:1px solid rgba(22,163,74,.25); }
.subscribe-status.err { background:var(--evac-soft); color:var(--evac); border:1px solid rgba(220,38,38,.25); }

.ip {
  display:grid; grid-template-columns: 30px 1fr auto;
  gap:.7rem; align-items:center;
  padding:.7rem 0; border-bottom:1px solid var(--line-soft);
  cursor:pointer; transition: background .15s ease;
}
.ip:last-child { border-bottom:0; }
.ip:hover { background:var(--surface-2); }
.ip .ic {
  width:28px; height:28px; border-radius:7px;
  background:var(--evac-soft); color:var(--evac);
  display:flex; align-items:center; justify-content:center;
  font-size:.78rem; flex-shrink:0;
}
.ip.moderate .ic { background:var(--warn-soft); color:var(--warn); }
.ip.minor .ic { background:var(--info-soft); color:var(--info); }
.ip.test .ic { background:var(--surface-2); color:var(--fg-3); }
.ip .feed-row {
  font-family:"JetBrains Mono", monospace;
  font-size:.62rem; color:var(--fg-3);
  display:flex; gap:.35rem; align-items:center;
}
.ip .feed-row .feed { background:var(--surface-2); color:var(--fg-2); padding:.1rem .35rem; border-radius:4px; font-weight:500; }
.ip .ev { margin-top:.15rem; font-size:.86rem; font-weight:500; }
.ip .wh { margin-top:.05rem; font-size:.74rem; color:var(--fg-2); }
.ip .sev {
  font-size:.6rem; font-weight:600;
  padding:.15rem .4rem; border-radius:5px;
  background:var(--evac-soft); color:var(--evac); white-space:nowrap;
}
.ip.moderate .sev { background:var(--warn-soft); color:var(--warn); }
.ip.minor .sev { background:var(--info-soft); color:var(--info); }
.ip.test .sev { background:var(--surface-2); color:var(--fg-3); }

.sub-panel { padding:1rem 1.1rem 1.1rem; }
.sub-panel h3 { margin:0 0 .25rem; font-size:.95rem; font-weight:600; letter-spacing:-.01em; }
.sub-panel p { margin:0 0 .75rem; font-size:.82rem; color:var(--fg-2); }
.sub-panel input + input { margin-top:.4rem; }
.sub-panel .btn { width:100%; margin-top:.55rem; }

.dash .foot {
  margin-top:1.5rem; padding-top:1rem;
  border-top:1px solid var(--line);
  font-size:.72rem; color:var(--fg-3);
  display:flex; justify-content:space-between; gap:.5rem; flex-wrap:wrap;
}
.dash .foot code { font-family:"JetBrains Mono", monospace; font-size:.7rem; }
.dash .foot a { color:var(--fg-2); text-decoration:none; }
.dash .foot a:hover { color:var(--accent); }

/* immersive */
.immersive-layer { position:absolute; inset:0; pointer-events:none; }
.immersive-layer > * { pointer-events:auto; }

.imm-topbar {
  position:absolute; top:.3rem; inset-inline-start:.75rem; inset-inline-end:.75rem; z-index:13;
  background:var(--surface); border:1px solid var(--line);
  border-radius:var(--radius-native); box-shadow:var(--shadow-pop);
  padding:.55rem .85rem;
  display:flex; align-items:center; gap:var(--spacing-md);
}
.imm-topbar .head-right { margin-inline-start:auto; }
.imm-kpis {position:absolute;top: 4.75rem;inset-inline-end: .8rem;z-index:11;display:flex;gap:.5rem;}
.imm-kpi { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius-lg); padding:.55rem .8rem; box-shadow:var(--shadow-pop); min-width:84px; }
.imm-kpi .v { font-size:1.15rem; font-weight:600; letter-spacing:-.02em; line-height:1; font-variant-numeric:tabular-nums; }
.imm-kpi .l { font-size:.62rem; color:var(--fg-3); font-weight:600; margin-top:.2rem; }
.imm-kpi.evac .v { color:var(--evac); }
.imm-kpi.warn .v { color:var(--warn); }
.imm-kpi.normal .v { color:var(--ok); }
.imm-kpi.info .v { color:var(--accent); }

.imm-panel {
  position:absolute;
  inset-inline-start:.75rem;
  top: 4.75rem;
  bottom:.75rem;
  z-index:12;
  width:440px;
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius-card);
  box-shadow:var(--shadow-pop);
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.imm-panel .order {
  margin:0; border-radius:13px 13px 0 0;
  border-inline-end:0; border-top:0;
  padding: 1rem 1.15rem 1.05rem;
  display:block; box-shadow:none;
}
.imm-panel .order .head-line { display:flex; align-items:center; gap:.5rem; }
.imm-panel .order .head-line .ts { margin-inline-start:auto; }
.imm-panel .order .meta { margin-top:.7rem; display:flex; gap:.35rem; flex-wrap:wrap; }
.imm-panel .order .meta .m {
  display:inline-flex; align-items:center; gap:.3rem;
  font-size:.72rem; color:var(--fg-2);
  background:var(--surface-2); border:1px solid var(--line);
  padding:.18rem .45rem; border-radius:5px;
}
.imm-panel .order .meta .m i { color:var(--accent); font-size:.7rem; }
.imm-panel .order .actions { margin-top:.85rem; display:flex; gap:.4rem; }
.imm-panel .order .actions .btn { flex:1; }
.imm-panel .order .actions .btn-icon { flex:0 0 auto; }
.imm-panel .order .actions .btn-danger { background-color:var(--evac); color:var(--text-on-accent); }

.imm-panel-body { flex:1 1 auto; overflow-y:auto; overflow-x:hidden; min-height:0; }
.imm-panel-body::-webkit-scrollbar { width:6px; }
.imm-panel-body::-webkit-scrollbar-thumb { background:rgba(0,0,0,.15); border-radius:3px; }
[data-theme="dark"] .imm-panel-body::-webkit-scrollbar-thumb,
[data-theme="navy"] .imm-panel-body::-webkit-scrollbar-thumb { background:rgba(255,255,255,.15); }

.imm-sect { padding: .65rem 1.15rem 0; border-top:1px solid var(--line-soft); }
.imm-sect-head { display:flex; align-items:baseline; justify-content:space-between; padding:.6rem 0 .35rem; }
.imm-sect-head h3 { margin:0; font-size:.78rem; font-weight:600; letter-spacing:-.005em; display:flex; align-items:center; gap:.4rem; }
.imm-sect-head h3 i { color:var(--accent); font-size:.78rem; }
.imm-sect-head .badge { font-size:.66rem; color:var(--fg-3); background:var(--surface-2); padding:.15rem .45rem; border-radius:999px; border:1px solid var(--line); font-weight:500; }

.imm-map-controls { position:absolute; inset-inline-end:1.25rem; bottom:5rem; z-index:11; display:flex; flex-direction:column; gap:.35rem; }
.imm-map-controls .btn { box-shadow:var(--shadow-pop); }

.imm-chips {
  position:absolute; bottom:1rem; z-index:11;
  display:flex; gap:.45rem; flex-wrap:wrap;
  inset-inline-start: calc(440px + 1.5rem);
  max-width: calc(100% - 440px - 4.5rem);
}
.imm-chip { background:var(--surface); border:1px solid var(--line); border-radius:10px; padding:.5rem .7rem; display:flex; align-items:center; gap:.55rem; box-shadow:var(--shadow-pop); font-size:.78rem; }
.imm-chip .ic { width:28px; height:28px; border-radius:7px; display:flex; align-items:center; justify-content:center; font-size:.82rem; }
.imm-chip.w .ic { background:var(--info-soft); color:var(--info); }
.imm-chip.f .ic { background:var(--evac-soft); color:var(--evac); }
.imm-chip.r .ic { background:var(--warn-soft); color:var(--warn); }
.imm-chip .v { font-weight:600; font-size:.88rem; letter-spacing:-.01em; font-variant-numeric:tabular-nums; line-height:1; }
.imm-chip .l { font-size:.62rem; color:var(--fg-3); font-weight:600; margin-top:.15rem; }

/* IPAWS markers */
.ipaws-marker {
  width:28px; height:28px; border-radius:50%;
  background:var(--evac); color:#fff;
  display:flex; align-items:center; justify-content:center;
  border:3px solid var(--surface);
  box-shadow: 0 4px 10px rgba(0,0,0,.25);
  cursor:pointer; font-size:.7rem; position:relative;
}
.ipaws-marker.moderate { background:var(--warn); color:#1F2933; }
.ipaws-marker.minor { background:var(--info); }
.ipaws-marker.test { background:var(--fg-3); border-style:dashed; }
.ipaws-marker::before {
  content:''; position:absolute; inset:-5px; border-radius:50%;
  background:currentColor; opacity:.15;
  animation: ringPulse 2s infinite;
}
.ipaws-marker.test::before, .ipaws-marker.minor::before { animation:none; opacity:0; }
@keyframes ringPulse {
  0% { transform:scale(.85); opacity:.4; }
  100% { transform:scale(1.6); opacity:0; }
}

/* Resource markers (shelters, staging, medical, command posts) */
.resource-marker {
  width:26px; height:26px; border-radius:7px;
  background:var(--surface); color:var(--shelter);
  display:flex; align-items:center; justify-content:center;
  border:2px solid var(--shelter);
  box-shadow: 0 3px 8px rgba(0,0,0,.2);
  cursor:pointer; font-size:.72rem;
}
.resource-marker.shelter { color:var(--shelter); border-color:var(--shelter); }
.resource-marker.staging { color:var(--info); border-color:var(--info); }
.resource-marker.medical { color:var(--evac); border-color:var(--evac); }
.resource-marker.command_post,
.resource-marker.cp { color:var(--accent); border-color:var(--accent); }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2), var(--line) 50%, var(--surface-2));
  background-size: 200% 100%;
  animation: skeleton 1.4s linear infinite;
  border-radius:4px; color:transparent;
  display:inline-block; min-width:2.5rem;
}
@keyframes skeleton { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.live-ts { font-family:"JetBrains Mono", monospace; font-size:.65rem; color:var(--fg-3); margin-inline-start:.3rem; }

/* dashboard mobile */
@media (max-width: 640px) {
  /* head-right wraps to a second row on phones; the desktop height:55px
     would clip it and paint the sticky header over the page heading. */
  .dash .head { padding: .65rem .9rem; gap:.5rem; height:auto; min-height:55px; }
  .dash .nav, .dash .brand small, .map-search, body.immersive .imm-topbar .nav, body.immersive .brand small, body.immersive .imm-kpis, body.immersive .imm-chips { display:none; }
  .dash .head-right { width:100%; justify-content:space-between; }
  .dash .container { padding: 1.1rem .9rem 2rem; }
  .dash .page-head { flex-direction:column; align-items:flex-start; gap:.85rem; margin-bottom:1.1rem; }
  .dash .page-head h1 { font-size:1.35rem; }
  .dash .page-head .actions { width:100%; }
  .dash .page-head .actions .btn { flex:1; }
  .dash .kpis { grid-template-columns: 1fr 1fr; gap:.6rem; margin-bottom:1rem; }
  .dash .kpi { padding:.85rem .85rem .9rem; }
  .dash .kpi .v { font-size:var(--font-size-3xl); }
  .dash .order { grid-template-columns: auto 1fr; gap:.85rem; padding: 1rem; margin-bottom:1.1rem; }
  .dash .order h2 { font-size:1.05rem; }
  .dash .order .order-actions { grid-column: 1 / -1; flex-direction:row; flex-wrap:wrap; gap:.4rem; }
  .dash .order .order-actions .btn { flex:1 1 auto; white-space:nowrap; }
  .map-toolbar { gap:.4rem; padding:.55rem .7rem; }
  .meta-row { grid-template-columns: 1fr; gap:.5rem; padding:.7rem; }
  .map-slot { aspect-ratio: 4 / 5; }

  /* Immersive mobile: bottom sheet */
  body.immersive .imm-topbar { padding:.45rem .65rem; gap:.5rem; }
  body.immersive .imm-topbar .head-right .pill { padding:.3rem .55rem; font-size:.65rem; }
  body.immersive .imm-panel {
    inset-inline-start:0; inset-inline-end:0; bottom:0; top:auto; width:auto;
    border-radius:18px 18px 0 0;
    border:0; border-top:1px solid var(--line);
    box-shadow: 0 -16px 40px -10px rgba(0,0,0,.3);
    max-height:62%;
  }
  body.immersive .imm-panel .order { margin-top:.75rem; border-radius:0; padding:.85rem 1rem .95rem; }
  body.immersive .imm-panel .order h2 { font-size:1.05rem; }
  body.immersive .imm-panel .order p { font-size:.8rem; }
  body.immersive .imm-sect { padding-inline-start:1rem; padding-inline-end:1rem; }
  body.immersive .imm-map-controls { bottom: calc(62% + .75rem); inset-inline-end:.6rem; }
}

::selection { background:var(--accent); color:#fff; }

.toast {
  position:fixed; top:60px; inset-inline-end:1rem; z-index:500;
  background:var(--fg); color:var(--bg);
  padding:.7rem 1rem; border-radius:var(--radius-md);
  font-size:.8rem; font-weight:500;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  opacity:0; transform:translateX(calc(20px * var(--dir-sign, 1)));
  transition: opacity .25s ease, transform .25s ease;
  pointer-events:none; max-width:300px;
}
.toast.show { opacity:1; transform:translateX(0); }

/* ============================================================
   V2 enhancements — safety feeds, weather, map tools, knowledge
   base, resources, help form
   ============================================================ */

.sidebar-col { display:flex; flex-direction:column; }
.panel-foot .foot-note { color:var(--fg-3); font-size:.7rem; }

/* --- map toolbar tools + layers menu --- */
.map-toolbar-actions { display:flex; gap:.35rem; }
.map-tool-btn.active { background:var(--accent-soft); border-color:var(--accent); color:var(--accent); }

.map-layers-menu {
  position:absolute; top:.6rem; inset-inline-end:.6rem; z-index:30;
  background:var(--surface); border:1px solid var(--line);
  border-radius:10px; box-shadow:var(--shadow-pop);
  padding:.55rem .35rem; min-width:208px;
  font-size:.78rem;
}
.map-layers-menu[hidden] { display:none; }
.map-layers-menu-head {
  font-size:.66rem; font-weight:700;
  color:var(--fg-3); padding:.1rem .55rem .4rem;
}
.map-layers-menu label {
  display:flex; align-items:center; gap:.5rem;
  padding:.32rem .55rem; border-radius:var(--radius-sm); cursor:pointer;
  color:var(--fg-2);
}
.map-layers-menu label:hover { background:var(--surface-2); color:var(--fg); }
.map-layers-menu input { accent-color:var(--accent); cursor:pointer; }
.lyr-sw { width:12px; height:12px; border-radius:3px; flex-shrink:0; }
.lyr-sw.zones { background:var(--ok); }
.lyr-sw.hazards, .lyr-sw.closures { background:#dc2626; }
.lyr-sw.routes { background:var(--route-open); height:5px; }
.lyr-sw.resources { background:var(--shelter); }
.lyr-sw.weather { background:#d97706; }
.lyr-sw.radar { background:linear-gradient(135deg,#22c55e,#3b82f6,#a855f7); }

/* Weather overlay opacity slider (inside the layers menu) */
.map-layers-opacity {
  margin-top:.35rem; padding:.55rem .55rem .3rem;
  border-top:1px solid var(--line);
}
.mlo-label {
  display:flex; justify-content:space-between;
  font-size:.7rem; font-weight:600; color:var(--fg-2); margin-bottom:.35rem;
}
.mlo-label span:last-child { color:var(--accent); font-variant-numeric:tabular-nums; }
#wxOpacity {
  width:100%; height:4px; -webkit-appearance:none; appearance:none;
  background:var(--line); border-radius:3px; outline:none; cursor:pointer;
}
#wxOpacity::-webkit-slider-thumb {
  -webkit-appearance:none; appearance:none;
  width:15px; height:15px; border-radius:50%;
  background:var(--accent); border:2px solid var(--surface);
  box-shadow:0 1px 3px rgba(0,0,0,.3); cursor:pointer;
}
#wxOpacity::-moz-range-thumb {
  width:15px; height:15px; border-radius:50%;
  background:var(--accent); border:2px solid var(--surface); cursor:pointer;
}

/* Theme cycle button — keep it compact in the header */
.btn.theme-toggle i { width:1em; text-align:center; }
.lyr-sw.ipaws { background:var(--evac); border-radius:50%; }
.lyr-sw.quakes { background:#92400e; border-radius:50%; }
.lyr-sw.fires { background:#ea580c; border-radius:50%; }
.lyr-sw.fire-perimeters { background:rgba(255,90,31,.28); border:1.5px solid #ff5a1f; }
.lyr-sw.public-evac-zones { background:rgba(220,38,38,.14); border:1.5px dashed var(--evac); }
.lyr-sw.road-closures { background:var(--evac); border-radius:50%; }

/* --- map legend --- */
.map-legend {
  position:absolute; inset-inline-start:.6rem; bottom:.6rem; z-index:20;
  background:var(--surface); border:1px solid var(--line);
  border-radius:var(--radius-md); box-shadow:var(--shadow);
  padding:.45rem .6rem; display:flex; flex-direction:column; gap:.18rem;
  font-size:.66rem; color:var(--fg-2);
}
.legend-row { display:flex; align-items:center; gap:.4rem; }
.legend-row.legend-heading { font-weight:600; color:var(--fg); }
.lg-sw { width:11px; height:11px; border-radius:2px; flex-shrink:0; }
.lg-dot { width:11px; height:11px; border-radius:50%; flex-shrink:0; }
.lg-dot.fire { background:#ea580c; }
.lg-dot.quake { background:#92400e; }
.lg-dot.closure { background:var(--evac); }
/* Route and closure keys drawn as the lines on the map: a white-cased line (SC-20261117-0021). */
.lg-sw.route-open, .lg-sw.route-closed, .lg-sw.closure-line { width:18px; height:6px; border-radius:var(--radius-pill); box-shadow:0 0 0 1.5px var(--surface), 0 0 0 2.5px var(--line); }
.lg-sw.route-open { background:var(--route-open); }
.lg-sw.route-closed { background:repeating-linear-gradient(90deg, var(--route-closed) 0 5px, var(--surface) 5px 8px); }
.lg-sw.closure-line { background:repeating-linear-gradient(90deg, var(--closure-line) 0 6px, var(--surface) 6px 8px); }
.lg-sw.public-evac { background:rgba(220,38,38,.14); border:1.5px dashed var(--evac); }

/* --- legend layer toggles — big on/off buttons for the noisiest feeds --- */
.legend-toggles {display:flex;gap:.4rem;flex-direction: column;}
.legend-divider { height:1px; background:var(--line); margin:.2rem 0 .1rem; }
.legend-toggle {
  flex:1 1 0;
  min-width:80px;
  display:flex;
  flex-direction: row;
  align-items:center;
  gap:.2rem;
  padding:.5rem .4rem;
  font-family:inherit;
  cursor:pointer;
  background:var(--surface-2);
  color:var(--fg-3);
  border:2px solid var(--line);
  border-radius:9px;
  transition:background .13s ease, border-color .13s ease, color .13s ease, box-shadow .13s ease;
}
.legend-toggle:hover { border-color:var(--fg-3); }
.legend-toggle i { font-size:1.15rem; line-height:1; }
.legend-toggle .lt-label {font-size:.72rem;font-weight:700;margin-inline-end: auto;}
.legend-toggle .lt-state {
  font-size:.58rem;
  font-weight:800;
  letter-spacing:.07em;
  padding:.07rem .42rem;
  border-radius:999px;
  background:rgba(120,120,128,.22);
  color:var(--fg-3);
  width: 35px;
}
.legend-toggle.on {color: #fff;}

.legend-toggle[data-legend-toggle="firePerimeters"].on {
    background: #d72d2dc9;
    border-color: #d72d2dc9;
    box-shadow: 0 3px 10px rgba(14, 116, 144, .42);
}
.legend-toggle[data-legend-toggle="roadClosures"].on {
    background: #727faac9;
    border-color: #727faac9;
    box-shadow: 0 3px 10px rgba(14, 116, 144, .42);
}
.legend-toggle[data-legend-toggle="publicEvacZones"].on {
    background: #a90505e3;
    border-color: #a90505e3;
    box-shadow: 0 3px 10px rgba(14, 116, 144, .42);
}
.legend-toggle.on .lt-state { background:rgba(255,255,255,.3); color:#fff; }
.legend-toggle[data-legend-toggle="fires"].on {
  background:#ea580c; border-color:#ea580c; box-shadow:0 3px 10px rgba(234,88,12,.42);
}
.legend-toggle[data-legend-toggle="cameras"].on {
  background:#0e7490; border-color:#0e7490; box-shadow:0 3px 10px rgba(14,116,144,.42);
}
.legend-toggle:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }

/* --- quake + fire markers --- */
.quake-marker {
  border-radius:50%; background:rgba(146,64,14,.85); color:#fff;
  display:flex; align-items:center; justify-content:center;
  border:2px solid var(--surface); box-shadow:0 3px 8px rgba(0,0,0,.3);
  cursor:pointer; font-variant-numeric:tabular-nums;
}
.quake-marker.mid { background:rgba(217,119,6,.9); }
.quake-marker.big { background:rgba(220,38,38,.92); }
.quake-mag { font-size:.62rem; font-weight:700; }
.quake-marker.big .quake-mag { font-size:.74rem; }
.fire-marker {
  width:28px;
  height:28px;
  border-radius:50%;
  background:#ea580c;
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  border:3px solid var(--surface);
  box-shadow:0 4px 10px rgba(234,88,12,.4);
  cursor:pointer;
  font-size:.72rem;
}
.fire-marker.perimeter { background:#FF5A1F; box-shadow:0 4px 10px rgba(255,90,31,.4); }
/* Genasys Protect road closures / traffic control points — no-entry look */
.closure-marker {
  width:28px;
  height:28px;
  border-radius:50%;
  background:var(--evac);
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  border:3px solid var(--surface);
  box-shadow:0 4px 10px rgba(220,38,38,.4);
  cursor:pointer;
  font-size:.72rem;
}

/* --- weather widget --- */
.weather-body { padding:.85rem .95rem 1rem; }
.wx-now { display:flex; align-items:center; gap:.85rem; margin-bottom:.7rem; }
.wx-temp { font-size:2.6rem; font-weight:600; letter-spacing:-.03em; line-height:1; color:var(--fg); }
.wx-now-detail { min-width:0; }
.wx-cond { font-size:.86rem; font-weight:600; letter-spacing:-.01em; }
.wx-sub { font-size:.74rem; color:var(--fg-2); margin-top:.15rem; }
.wx-forecast { display:grid; grid-template-columns:repeat(3,1fr); gap:.5rem; }
.wx-period {
  background:var(--surface-2); border:1px solid var(--line);
  border-radius:var(--radius-md); padding:.55rem .4rem; text-align:center;
}
.wx-period-name { font-size:.64rem; font-weight:600; color:var(--fg-2); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.wx-period-icon { width:38px; height:38px; object-fit:contain; margin:.2rem auto; border-radius:var(--radius-sm); }
.wx-period-temp { font-size:var(--font-size-lg); font-weight:600; letter-spacing:-.02em; }
.wx-period-desc { font-size:.62rem; color:var(--fg-3); line-height:1.25; margin-top:.1rem; }

/* --- info sections (knowledge base + resources + help) --- */
.info-section { margin-top:2.25rem; scroll-margin-top:5rem; }
.section-head { margin-bottom:1rem; }
.section-head h2 {
  margin:0; font-size:1.2rem; font-weight:600; letter-spacing:-.02em;
  display:flex; align-items:center; gap:.55rem;
}
.section-head h2 i { color:var(--accent); font-size:var(--font-size-lg); }
.section-head p { margin:.25rem 0 0; font-size:.85rem; color:var(--fg-2); }

/* knowledge base */
.kb-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:.75rem; align-items:start; } /* an open card never stretches its row neighbor into a blank box */
@media (max-width:760px) { .kb-grid { grid-template-columns:1fr; } }
.kb-item { overflow:hidden; }
.kb-item summary {
  list-style:none; cursor:pointer; padding:.85rem 1rem;
  font-size:.88rem; font-weight:600; letter-spacing:-.01em;
  display:flex; align-items:center; gap:.6rem;
}
.kb-item summary::-webkit-details-marker { display:none; }
.kb-item summary::after {
  content:'\f078'; font-family:'Font Awesome 6 Free'; font-weight:900;
  margin-inline-start:auto; font-size:.7rem; color:var(--fg-3);
  transition:transform .2s ease;
}
.kb-item[open] summary::after { transform:rotate(180deg); }
.kb-item summary i { color:var(--accent); font-size:.9rem; width:1.1rem; text-align:center; }
.kb-item summary:hover { background:var(--surface-2); }
.kb-body { padding:0 1rem 1rem; font-size:.83rem; color:var(--fg-2); line-height:1.55; }
.kb-body p { margin:.25rem 0 .5rem; }
.kb-body ul, .kb-body ol { margin:.25rem 0; padding-inline-start:1.2rem; }
.kb-body li { margin:.25rem 0; }
.kb-body .kb-status-list { list-style:none; padding-inline-start:0; }
.kb-status-list li { display:flex; align-items:flex-start; gap:.5rem; }
.kb-dot { width:11px; height:11px; border-radius:50%; flex-shrink:0; margin-top:.32rem; }
/* Each status dot takes its color from the shared status table (views/evac-portal), the operator map's palette. */

/* resources */
.resource-grid {display:grid;grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));gap:.75rem;}
.resource-card {
  display:flex; align-items:center; gap:.7rem;
  padding:.85rem .9rem; text-decoration:none; color:var(--fg);
  transition:transform .12s ease, box-shadow .12s ease;
}
.resource-card:hover { transform:translateY(-2px); box-shadow:var(--shadow-pop); }
.rc-ic {
  width:38px; height:38px; border-radius:9px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  color:#fff; font-size:var(--font-size-lg);
}
.rc-red { background:#dc2626; }
.rc-blue { background:#0284c7; }
.rc-indigo { background:#6366f1; }
.rc-sky { background:#0ea5e9; }
.rc-green { background:#16a34a; }
.rc-amber { background:#d97706; }
.resource-card b { display:block; font-size:.85rem; font-weight:600; letter-spacing:-.01em; }
.resource-card span { display:block; font-size:.72rem; color:var(--fg-3); margin-top:.1rem; }

/* help form: sized to its text, not a wide box of small fields (SC-20261117-0021, page 7) */
.help-card { padding:1rem 1.1rem; max-width:720px; }
.help-form { display:flex; flex-direction:column; gap:.6rem; }
.help-row { display:grid; grid-template-columns:1fr 1fr; gap:.6rem .75rem; }
@media (max-width:560px) { .help-row { grid-template-columns:1fr; } }
.help-form label {
  display:flex; flex-direction:column; gap:.25rem;
  font-size:.8rem; font-weight:600; color:var(--fg-2);
}
.help-form :is(input, select, textarea) { font-weight:400; font-size:.9rem; }
.help-form textarea { min-height:0; resize:vertical; }
.help-actions { display:flex; align-items:center; gap:.85rem; flex-wrap:wrap; }
.help-status { font-size:.8rem; }
.help-status.ok { color:var(--ok); }
.help-status.err { color:var(--evac); }

@media (max-width:640px) {
  .info-section { margin-top:1.75rem; }
  .wx-temp { font-size:2.2rem; }
}

/* --- main column: map-card + info sections stacked under the map --- */
.main-col { display:flex; flex-direction:column; min-width:0; }
.main-col .info-section { margin-top:1.5rem; }
.main-col .info-section:first-of-type { margin-top:1.25rem; }

/* --- collapsible alert groups (evac first, warnings collapsed) --- */
.alert-group { border-bottom:1px solid var(--line); }
.alert-group:last-child { border-bottom:0; }
.alert-group summary {
  list-style:none; cursor:pointer;
  display:flex; align-items:center; gap:.5rem;
  padding:.6rem .15rem; font-size:.8rem; font-weight:600;
}
.alert-group summary::-webkit-details-marker { display:none; }
.alert-group summary::after {
  content:'\f078'; font-family:'Font Awesome 6 Free'; font-weight:900;
  font-size:.6rem; color:var(--fg-3); transition:transform .2s ease;
}
.alert-group[open] summary::after { transform:rotate(180deg); }
.alert-group summary:hover { background:var(--surface-2); }
.ag-tag {
  font-size:.58rem; font-weight:700;
  padding:.15rem .42rem; border-radius:5px; line-height:1.1;
  background:var(--evac-soft); color:var(--evac);
}
.ag-tag.warn { background:var(--warn-soft); color:var(--warn); }
.ag-tag.shelter { background:var(--shelter-soft); color:var(--shelter); }
.ag-label { color:var(--fg); }
.ag-count {
  margin-inline-start:auto; font-size:.66rem; color:var(--fg-2);
  background:var(--surface-2); border:1px solid var(--line);
  border-radius:999px; padding:.1rem .5rem; font-weight:600;
}
.alert-group .alert:first-of-type { border-top:1px solid var(--line-soft); }

/* --- geolocation marker --- */
.user-loc-marker {
  display:flex; align-items:flex-end; justify-content:center;
  color:var(--accent); font-size:1.9rem; line-height:1;
  filter:drop-shadow(0 2px 5px rgba(0,0,0,.45));
  cursor:pointer;
}

/* --- map hover tooltip --- */
.map-tooltip {
  position:absolute; z-index:40; max-width:280px;
  background:var(--surface); border:1px solid var(--line);
  border-radius:10px; box-shadow:var(--shadow-pop);
  padding:.6rem .75rem; pointer-events:none;
  opacity:0; transform:translateY(4px);
  transition:opacity .12s ease, transform .12s ease;
}
.map-tooltip.show { opacity:1; transform:translateY(0); }
.map-tooltip-title {
  display:flex; align-items:center; gap:.45rem;
  font-size:.85rem; font-weight:600; letter-spacing:-.01em; color:var(--fg);
}
.map-tooltip-title i { color:var(--accent); font-size:.8rem; }
.map-tooltip-title .mtt-text { white-space:nowrap; }
.map-tooltip-status {
  margin-inline-start:auto; font-size:.58rem; font-weight:700;
  padding:.14rem .4rem; border-radius:5px;
  background:var(--surface-2); color:var(--fg-2); white-space:nowrap;
}
.map-tooltip-status.evacuation { background:var(--evac); color:var(--text-on-accent); }
.map-tooltip-status.warning { background:var(--warn); color:var(--text-on-accent); }
.map-tooltip-status.shelter { background:var(--shelter); color:var(--text-on-accent); }
.map-tooltip-status.normal,
.map-tooltip-status.all_clear { background:var(--ok); color:var(--text-on-accent); }
.map-tooltip-subtitle { margin-top:.2rem; font-size:.74rem; color:var(--fg-3); }

/* --- wildfire camera marker + layer swatch --- */
.camera-marker {
  width:28px; height:28px; border-radius:7px;
  background:#0f172a; color:#fff;
  display:flex; align-items:center; justify-content:center;
  border:2px solid #fff; box-shadow:0 3px 8px rgba(0,0,0,.35);
  cursor:pointer; font-size:.72rem;
}
.camera-marker:hover { background:var(--accent); }
.lyr-sw.cameras { background:#0f172a; border-radius:4px; }
.traffic-camera-marker {
  width:26px; height:26px; border-radius:50%;
  background:#0891b2; color:#fff;
  display:flex; align-items:center; justify-content:center;
  border:2px solid #fff; box-shadow:0 3px 8px rgba(0,0,0,.35);
  cursor:pointer; font-size:.62rem;
}
.traffic-camera-marker:hover { background:var(--accent); }
.lyr-sw.traffic { background:#0891b2; }

/* --- rich detail popups (wildfire, camera) --- */
.pop-detail { min-width:240px; }
.pop-rows { margin-top:.5rem; display:flex; flex-direction:column; gap:.2rem; }
.pop-row { display:flex; justify-content:space-between; gap:var(--spacing-md); font-size:.76rem; }
.pop-row-k { color:var(--fg-3); }
.pop-link { display:inline-block; margin-top:.55rem; font-size:.78rem; font-weight:600; color:var(--info); text-decoration:underline; text-underline-offset:2px; }
.pop-row-v { color:var(--fg); font-weight:500; text-align:end; }
.pop-progress-label { font-size:.7rem; font-weight:600; color:var(--ok); margin-top:.45rem; }
.pop-progress {
  margin-top:.2rem; height:6px; border-radius:3px;
  background:var(--surface-2); overflow:hidden;
}
.pop-progress-fill { height:100%; background:var(--ok); border-radius:3px; }
.pop-cam-hint {
  margin-top:.55rem; padding-top:.5rem; border-top:1px solid var(--line-soft);
  font-size:.7rem; color:var(--accent);
}
.pop-cam-hint i { margin-inline-end:.2rem; }
.pop-cam-frame {
  margin-top:.5rem; border-radius:var(--radius-md); overflow:hidden;
  background:var(--surface-2); border:1px solid var(--line);
  min-height:120px; display:flex; align-items:center; justify-content:center;
}
.pop-cam-img { width:100%; display:block; }
.pop-cam-fallback { font-size:.75rem; color:var(--fg-3); padding:1.5rem; }

/* --- subscribe panel — core feature, surfaced prominently --- */
#subscribe-panel.sub-panel {
  background:
    linear-gradient(160deg, var(--accent-soft), transparent 60%),
    var(--surface);
  border:1px solid var(--accent);
  box-shadow:0 0 0 3px var(--accent-ring), var(--shadow);
}
#subscribe-panel.sub-panel h3 { color:var(--accent); font-size:var(--font-size-lg); }
#subscribe-panel.sub-panel h3 i, .ride-panel h3 i { color:var(--accent); }

/* ── Need a ride out? (resident self-request; hidden until enabled) ── */
.ride-panel { border-color:var(--line); }
.ride-panel .ride-911 { color:var(--evac); text-decoration:none; }
.ride-form { display:flex; flex-direction:column; gap:.75rem; }
.ride-form fieldset { border:0; padding:0; margin:0; display:flex; flex-direction:column; gap:.6rem; min-width:0; }
.ride-form legend { font-size:var(--font-size-lg); font-weight:600; letter-spacing:-.01em; margin-bottom:.35rem; padding:0; }
.ride-form legend small, .ride-form label small { font-weight:400; color:var(--fg-3); }
.ride-form label { display:flex; flex-direction:column; gap:.3rem; font-size:.78rem; font-weight:600; color:var(--fg-2); }
.ride-form :is(input, select, textarea) { font-weight:400; }
.ride-progress { font-size:.72rem; color:var(--fg-3); font-weight:600; }
.ride-toggles { display:flex; flex-direction:column; gap:.5rem; }
/* .ride-form scope: a choice row beats the column layout of the form's labels. */
.ride-form .ride-toggle {
  flex-direction:row; align-items:center; gap:.75rem; min-height:56px; padding:.6rem .85rem;
  background:var(--surface-2); border:1px solid var(--line); border-radius:var(--radius-native);
  font-size:.95rem; font-weight:500; color:var(--fg); cursor:pointer;
}
.ride-toggle input { margin:0; accent-color:var(--accent); flex:0 0 auto; }
.ride-toggle:has(input:checked) { border-color:var(--accent); background:var(--accent-soft); }
.ride-toggle:focus-within { box-shadow:0 0 0 3px var(--accent-ring); }
.ride-actions { display:flex; gap:.5rem; align-items:stretch; }
.ride-wide { width:100%; }
.ride-actions .btn[data-ride-back] { flex:0 0 auto; }
.ride-status:empty { display:none; }
.ride-done { display:flex; flex-direction:column; gap:.6rem; }
.ride-done[hidden] { display:none; }
.ride-done-kicker { font-size:.7rem; color:var(--ok); font-weight:600; }
.ride-done-ref { font-size:1.1rem; }
.ride-done-ref strong { font-family:"JetBrains Mono", monospace; }
.ride-done p { margin:0; font-size:.85rem; color:var(--fg-2); }
.ride-done .ride-911-btn { color:var(--evac); border-color:var(--evac); }
.ride-disclaimer { margin:.85rem 0 0; font-size:.74rem; color:var(--fg-3); line-height:1.45; }
.ride-coordinator { display:inline-flex; gap:.4rem; align-items:center; margin-top:.4rem; font-size:.8rem; color:var(--accent); text-decoration:none; }
.dash .order .order-actions .btn[data-action="request-ride"] { border-color:var(--accent); color:var(--accent); }

/* ── Report damage (resident self-report; hidden until an active event takes reports) ── */
.damage-panel .ride-done a { color:var(--accent); }
.dash .order .order-actions .btn[data-action="report-damage"] { border-color:var(--accent); color:var(--accent); }

/* ---------- Address lookup, zone status posts, multi-place sign-up (SC-20261116-0021) ----------
   A status always reads as text plus an icon (the shape cue in config/evacZoneStatuses.json);
   the status color is only the 4px edge of the result, never the only signal. */
.evac-public .sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.lookup-card { padding:1rem 1.1rem; margin-bottom:1rem; }
.lookup-card h2 { margin:0 0 .25rem; font-size:1rem; font-weight:600; display:flex; align-items:center; gap:.5rem; }
.lookup-card .lookup-hint { margin:0 0 .75rem; font-size:.85rem; color:var(--fg-2); }
.lookup-form { display:flex; flex-wrap:wrap; gap:.5rem; }
.lookup-form input { flex:1 1 16rem; min-width:0; font-size:1rem; }
.lookup-form .btn { flex:0 0 auto; }
.lookup-result:empty { display:none; }
.lookup-result { margin-top:.85rem; display:grid; gap:.6rem; }
.lookup-result .lk-msg { font-size:.9rem; color:var(--fg-2); }
.lookup-result .lk-msg.err { color:var(--evac); }
.lk-zone { display:grid; grid-template-columns:auto 1fr; gap:.25rem .75rem; align-items:start; padding:.75rem .85rem; border:1px solid var(--line); border-inline-start:4px solid var(--lk-color, var(--line)); border-radius:var(--radius-sm); background:var(--surface-2); }
.lk-zone .lk-icon { grid-row:span 3; font-size:1.5rem; line-height:1; padding-top:.15rem; color:var(--fg); }
.lk-zone .lk-status { font-size:1.05rem; font-weight:700; color:var(--fg); }
.lk-zone .lk-zone-name { font-size:.85rem; color:var(--fg-2); }
.lk-zone .lk-do { font-size:.9rem; color:var(--fg); }
.lk-zone .lk-actions { grid-column:2; display:flex; flex-wrap:wrap; gap:.4rem; margin-top:.35rem; }
.lk-place { font-size:.8rem; color:var(--fg-3); }
/* Find My Evacuation Information (SC-20261117-0021): routes, closures, sites, who and when, "Which one?", Pick on map. */
.lookup-result .lk-msg.lk-clear { font-size:.95rem; font-weight:600; color:var(--fg); }
.lookup-result .lk-meta { font-size:.78rem; color:var(--fg-2); }
.lk-section { display:grid; gap:.15rem; padding-top:.5rem; border-top:1px solid var(--line-soft); }
.lk-section-title { margin:0; font-size:.85rem; font-weight:600; display:flex; align-items:center; gap:.4rem; color:var(--fg); }
.lk-section .lk-empty { font-size:.82rem; color:var(--fg-2); }
.lk-section .lk-more { justify-self:start; margin-top:.25rem; }
.lr-ic.site { background:var(--accent); }
.lk-help { margin-top:.1rem; }
.lk-choices { display:grid; gap:.35rem; }
.lk-choice { text-align:start; font:inherit; font-size:.9rem; color:var(--fg); background:var(--surface-2); border:1px solid var(--line); border-radius:var(--radius-sm); padding:.55rem .7rem; cursor:pointer; min-height:2.75rem; }
.lk-choice:hover { border-color:var(--accent); }
.lk-choice:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.map-pick-banner { position:absolute; top:.6rem; inset-inline:0; margin-inline:auto; width:max-content; max-width:calc(100% - 1.2rem); z-index:5; display:flex; align-items:center; gap:.6rem; padding-block:.45rem; padding-inline:.8rem .5rem; background:var(--surface); color:var(--fg); border:1px solid var(--line); border-radius:var(--radius-md); box-shadow:var(--shadow-pop); font-size:.88rem; }
.map-pick-banner[hidden] { display:none; }

.feed-posts:empty { display:none; }
.feed-posts { padding-block:.25rem; }
/* Each history post is one collapsed row: time, title, one status chip per status (SC-20261117-0021). */
.zone-post { border-bottom:1px solid var(--line-soft); }
.zone-post:last-of-type { border-bottom:0; }
.zone-post > summary { list-style:none; cursor:pointer; display:grid; grid-template-columns:32px 1fr auto; gap:.65rem; padding:.6rem 0; align-items:start; }
.zone-post.no-logo > summary { grid-template-columns:1fr auto; }
.zone-post > summary::-webkit-details-marker { display:none; }
.zone-post > summary::after {
  content:'\f078'; font-family:'Font Awesome 6 Free'; font-weight:900;
  font-size:.6rem; color:var(--fg-3); transition:transform .2s ease; margin-top:.2rem;
}
.zone-post[open] > summary::after { transform:rotate(180deg); }
.zone-post > summary:hover { background:var(--surface-2); }
.zone-post > summary:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.zone-post .zp-logo { width:32px; height:32px; border-radius:var(--radius-sm); object-fit:contain; background:var(--surface-2); }
.zone-post .zp-meta { font-size:.72rem; color:var(--fg-3); display:flex; gap:.4rem; flex-wrap:wrap; }
.zone-post .zp-meta .feed { background:var(--surface-2); color:var(--fg-2); padding:.1rem .35rem; border-radius:4px; font-weight:500; }
.zone-post .zp-title { margin-top:.15rem; font-size:.86rem; font-weight:600; }
.zone-post .zp-chips { margin-top:.25rem; display:flex; flex-wrap:wrap; gap:.3rem; }
.zone-post .zp-chip { font-size:.72rem; color:var(--fg-2); background:var(--surface-2); border:1px solid var(--line); border-radius:var(--radius-pill); padding:.08rem .5rem; }
.zone-post .zp-body { padding:0 0 .6rem; }
.zone-post:not(.no-logo) .zp-body { padding-inline-start:calc(32px + .65rem); }
.zone-post .zp-line { margin:.3rem 0 0; font-size:.82rem; line-height:1.45; overflow-wrap:anywhere; }
.zone-post .zp-line i { margin-inline-end:.35rem; }
.zp-more { border:0; background:none; padding:0; color:var(--accent); font:inherit; font-weight:600; cursor:pointer; text-decoration:underline; }
.zp-older { width:100%; margin:.35rem 0; justify-content:center; color:var(--accent); }

.sub-form { display:grid; gap:.85rem; container:subform / inline-size; }
.sub-places { border:0; padding:0; margin:0; display:grid; gap:.5rem; min-width:0; }
.sub-places legend { font-size:.82rem; font-weight:600; margin-bottom:.35rem; padding:0; }
[data-sub-places] { display:grid; gap:.5rem; }
/* Narrow card (the sidebar column): place kind and remove on one line, the
   address full width under them. A wide card puts all three on one line. */
.sub-place {
  display:grid; gap:.4rem; align-items:center;
  grid-template-columns:minmax(0, 1fr) auto;
  grid-template-areas:"kind remove" "addr addr";
}
.sub-place + .sub-place { padding-top:.5rem; border-top:thin solid var(--line); }
.sub-place .sub-place-kind { grid-area:kind; justify-self:start; width:auto; min-width:9rem; max-width:100%; }
.sub-place .sub-place-address { grid-area:addr; width:100%; min-width:0; }
.sub-place .sub-place-remove { grid-area:remove; }
/* The only row has nothing to remove (removing it would just add a blank one). */
.sub-place:only-child .sub-place-remove { display:none; }
.sub-place .sub-place-zone { grid-column:1 / -1; font-size:.76rem; color:var(--fg-2); }
.sub-panel .sub-place .btn { width:auto; margin-top:0; }
.sub-panel .sub-places > .sub-add-place { width:auto; margin-top:0; justify-self:start; color:var(--accent); }
.sub-contact { display:grid; gap:.6rem; }
.sub-field { display:grid; gap:.25rem; font-size:.82rem; font-weight:500; min-width:0; }
.sub-field input { width:100%; min-width:0; }
.sub-panel .sub-note { margin:0; font-size:.76rem; }
.sub-panel .sub-form > .btn { margin-top:.15rem; }
.subscribe-status ul { margin:.35rem 0 0; padding-inline-start:1.1rem; }
@container subform (min-width: 30rem) {
  .sub-place {
    grid-template-columns:minmax(8rem, 10rem) minmax(0, 1fr) auto;
    grid-template-areas:"kind addr remove";
  }
  .sub-place + .sub-place { padding-top:0; border-top:0; }
  .sub-place .sub-place-kind { width:100%; min-width:0; }
  .sub-contact { grid-template-columns:repeat(2, minmax(0, 1fr)); }
}
@media (max-width:560px) {
  .lookup-form .btn { flex:1 1 100%; }
}

/* --- SC-20261116-0021 public page fixes --------------------------------- */
/* Skip link: the first Tab stop, shown when it has focus. */
.evac-public .skip-link {
  position:absolute; inset-inline-start:.75rem; top:-100px; z-index:2000;
  background:var(--surface); color:var(--fg);
  border:2px solid var(--accent); border-radius:var(--radius-md);
  padding:.5rem .85rem; font-weight:600; text-decoration:none;
}
.evac-public .skip-link:focus { top:.5rem; }

/* A workspace logo shows whole, at its own aspect ratio, inside the header height. */
.brand .logo.logo-image { width:auto; max-width:min(220px, 45vw); height:45px; margin-top:0; }
.brand .logo.logo-image img { width:auto; height:100%; max-width:100%; object-fit:contain; border-radius:0; }

/* Every zone under an order, named and wrapping (a long list folds into <details>). */
.order .order-main { min-width:0; }
.order .order-zones:empty { display:none; }
.order .order-zones { margin-top:.6rem; font-size:.82rem; }
.order .order-zones-heading,
.order .order-zone-details > summary { font-weight:600; color:var(--fg); margin-bottom:.3rem; }
.order .order-zone-details > summary { cursor:pointer; }
.order .order-zone-list { list-style:none; margin:0; padding:0; display:flex; flex-wrap:wrap; gap:.3rem .4rem; }
.order .order-zone-list li {
  background:var(--surface-2); border:1px solid var(--line); border-radius:999px;
  padding:.15rem .55rem; color:var(--fg); overflow-wrap:anywhere;
}

/* Collapsible map legend (closed on load on a phone). */
.map-legend .legend-collapse { align-self:flex-start; }
.map-legend .legend-body { display:flex; flex-direction:column; gap:.18rem; }
.map-legend.collapsed .legend-body { display:none; }

/* The header grows instead of painting over the page when its controls wrap
   (longer words in other languages); below 1500px the theme and fullscreen
   buttons are icons with their names in aria-label / title. */
.dash .head { height:auto; min-height:55px; }
@media (max-width:1500px) {
  .dash .head .theme-label,
  .dash .head .label-dashboard { display:none; }
}

/* Phone: one compact header row (icon buttons, the logo carries the name). */
@media (max-width:640px) {
  .dash .head { flex-wrap:nowrap; min-height:0; padding:.4rem .75rem; }
  .dash .head-right { width:auto; flex-wrap:nowrap; gap:.35rem; justify-content:flex-end; }
  .dash .head .pill.live,
  .dash .head .theme-label,
  .dash .head .label-dashboard,
  .dash .head .head-btn-label { display:none; }
  .dash .brand { min-width:0; flex:1 1 auto; }
  .dash .brand .brand-name { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .dash .brand.has-image-logo .brand-name { display:none; }
  .brand .logo.logo-image { max-width:42vw; height:38px; }
}

/* The map legend (layer toggles + zone status key) fits the map it sits on.
   #map is a size container; the legend reflows by the map's own height and
   width, so the dashboard slot, the expanded map and a phone each get a layout
   that fits. Scrolling inside the legend is the last resort, never spill-over. */
#map { container:evmap / size; }
.map-legend {
  max-height:calc(100% - 1.2rem); max-width:calc(100% - 1.2rem);
  overflow:auto; overscroll-behavior:contain;
}
.legend-rows { display:flex; flex-direction:column; gap:.18rem; }
.legend-rows .legend-row { line-height:1.25; }
/* A short map: toggles in two compact columns, the key in two columns. */
@container evmap (max-height: 42.5rem) {
  .legend-toggles { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:.3rem; }
  .legend-toggle { min-width:0; padding:.3rem .4rem; gap:.3rem; border-width:thin; border-radius:var(--radius-sm); }
  .legend-toggle i { font-size:.9rem; }
  .legend-toggle .lt-label { font-size:.66rem; line-height:1.15; }
  .legend-toggle .lt-state { width:auto; font-size:.52rem; padding:.05rem .32rem; }
  .legend-rows { display:grid; grid-template-columns:repeat(2, max-content); gap:.15rem .9rem; }
}
/* A very short, wide map (landscape phone, small laptop): three key columns. */
@container evmap (max-height: 26.25rem) and (min-width: 43.75rem) {
  .legend-toggles { grid-template-columns:repeat(3, minmax(0, 1fr)); }
  .legend-rows { grid-template-columns:repeat(3, max-content); }
}
/* A narrow map: the legend spans the map and its columns share the width. */
@container evmap (max-width: 35rem) {
  .map-legend:not(.collapsed) { inset-inline-end:.6rem; }
  .legend-toggles { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:.3rem; }
  .legend-rows { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:.15rem .6rem; }
}

/* --- active evacuation routes + active road closures cards (SC-20261117-0021) --- */
.panel-card .panel-body.list-body { max-height:320px; overflow-y:auto; scrollbar-width:thin; }
.list-row { display:grid; grid-template-columns:28px 1fr auto; gap:.65rem; align-items:center; padding:.6rem 0; border-bottom:1px solid var(--line-soft); cursor:pointer; transition:background .15s ease; }
.list-row:last-child { border-bottom:0; }
.list-row:hover { background:var(--surface-2); }
.list-row:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.lr-ic { width:28px; height:28px; border-radius:var(--radius-sm); display:flex; align-items:center; justify-content:center; font-size:.8rem; color:var(--surface); background:var(--route-open); }
.lr-ic.route.congested { background:var(--route-congested); }
.lr-ic.route.closed { background:var(--route-closed); }
.lr-ic.closure { background:var(--closure-line); }
.lr-body { min-width:0; }
.lr-title { font-size:.86rem; font-weight:600; overflow-wrap:anywhere; }
.lr-sub { font-size:.74rem; color:var(--fg-2); margin-top:.1rem; overflow-wrap:anywhere; }
.lr-tag { font-size:.62rem; font-weight:700; padding:.16rem .42rem; border-radius:var(--radius-sm); white-space:nowrap; background:var(--route-tag-bg); color:var(--route-tag-ink); }
.lr-tag.route.congested { background:var(--warn-soft); color:var(--warn); }
.lr-tag.route.closed { background:var(--surface-2); color:var(--fg-2); }
.lr-tag.closure { background:var(--evac-soft); color:var(--evac); }
.pop-chip.route-chip { background:var(--route-open); }
.pop-chip.route-chip.congested { background:var(--route-congested); }
.pop-chip.route-chip.closed { background:var(--route-closed); }
