/* ============================================================
   RESIDENTIAL WILDFIRE EXPOSURE — Design System
   Aligned with Fire Aware global amber/dark tokens (style.css)
   ============================================================ */

/* ── Token bridge: page inherits :root amber tokens, adds green secondary ── */
.residential-report-page {
  --res-green:       #35624E;
  --res-green-light: #5a9070;
  --res-green-dim:   rgba(53, 98, 78, 0.18);
  --res-ring-10:     rgba(217, 119, 6, 0.55);
  --res-ring-25:     rgba(217, 119, 6, 0.35);
  --res-ring-50:     rgba(217, 119, 6, 0.18);
}

.residential-report-page [hidden] { display: none !important; }

/* Brand name in topbar */
.brand-name { font-size: 18px; font-weight: 700; line-height: 1.2; }

/* ── Layout ── */
.res-report-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(16px, 3vw, 32px) clamp(12px, 2vw, 24px) 72px;
}

/* ============================================================
   HERO
   ============================================================ */
.res-report-hero {
  border-radius: 24px;
  padding: clamp(28px, 5vw, 58px);
  color: #f5e6d3;
  background:
    radial-gradient(ellipse at 92% 8%,  rgba(217,119,6,.28), transparent 40%),
    radial-gradient(ellipse at 10% 90%, rgba(53,98,78,.22),  transparent 44%),
    linear-gradient(135deg, #1a0f0a 0%, #2d1a0e 55%, #1C2927 100%);
  border: 1px solid rgba(217,119,6,.28);
  box-shadow:
    0 24px 60px rgba(0,0,0,.22),
    inset 0 1px 0 rgba(245,158,11,.12);
  position: relative;
  overflow: hidden;
  animation: res-hero-drift 18s ease-in-out infinite alternate;
}

@keyframes res-hero-drift {
  0%   { background-position: 0% 0%;   }
  100% { background-position: 100% 100%; }
}

.res-report-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d97706' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
  pointer-events: none;
  opacity: .7;
}

.res-eyebrow {
  margin: 0 0 10px;
  color: var(--accent, #d97706);
  text-transform: uppercase;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .1em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.res-report-hero h1 {
  max-width: 780px;
  margin: 0 0 12px;
  font-size: clamp(28px, 5vw, 50px);
  line-height: 1.07;
  font-weight: 700;
  letter-spacing: -.02em;
  color: #fdf4e7;
}

.res-report-hero > p:not(.res-eyebrow) {
  max-width: 740px;
  color: #c9b89e;
  line-height: 1.65;
  margin: 0 0 24px;
}

/* ── Search form ── */
.res-search-form {
  margin-top: 8px;
  max-width: 860px;
}

.res-search-form label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #e8d5be;
}

.res-search-row {
  display: flex;
  gap: 10px;
}

.res-search-row input {
  flex: 1;
  min-width: 0;
  border: 1.5px solid rgba(217,119,6,.35);
  border-radius: 11px;
  background: rgba(255,255,255,.06);
  color: #fdf4e7;
  padding: 13px 16px;
  font: inherit;
  font-size: 15px;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: border-color .2s, box-shadow .2s, background .2s;
}

.res-search-row input::placeholder { color: rgba(205,185,160,.55); }

.res-search-row input:focus-visible {
  outline: none;
  border-color: var(--accent, #d97706);
  background: rgba(255,255,255,.1);
  box-shadow: 0 0 0 3px rgba(217,119,6,.32), 0 0 18px rgba(217,119,6,.18);
}

.residential-report-page button:focus-visible {
  outline: 3px solid var(--accent, #d97706);
  outline-offset: 2px;
}

.res-search-row .btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #fff;
  padding: 13px 20px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(217,119,6,.4);
  transition: transform .18s, box-shadow .18s, filter .18s;
}

.res-search-row .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(217,119,6,.55);
  filter: brightness(1.08);
}

.res-search-row button:disabled {
  opacity: .6;
  cursor: progress;
  transform: none !important;
}

.res-privacy-note {
  max-width: 780px;
  color: rgba(200,180,155,.7);
  font-size: 11px;
  line-height: 1.6;
  margin-top: 10px;
}

.res-status {
  min-height: 20px;
  margin: 14px 0 0;
  font-size: 12.5px;
  font-weight: 600;
  color: #c9b89e;
  display: flex;
  align-items: center;
  gap: 6px;
}

.res-status[data-state='error']   { color: #ffc4b4; }
.res-status[data-state='warning'] { color: #ffe5a8; }
.res-status[data-state='success'] { color: #b8f0c8; }

/* ============================================================
   PLACE PICKER
   ============================================================ */
.res-place-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 18px;
}

.res-place-picker label {
  font-size: 13px;
  font-weight: 700;
}

.res-place-picker select {
  flex: 1;
  min-width: min(100%, 300px);
  padding: 10px 12px;
  border: 1.5px solid var(--hairline);
  border-radius: 9px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .2s;
}

.res-place-picker select:focus-visible {
  outline: none;
  border-color: var(--accent, #d97706);
  box-shadow: 0 0 0 3px rgba(217,119,6,.22);
}

.res-place-picker .btn-primary {
  border: 0;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent, #d97706), var(--accent-dark, #b45309));
  color: #fff;
  padding: 11px 16px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(217,119,6,.35);
  transition: transform .18s, box-shadow .18s;
}

.res-place-picker .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(217,119,6,.5);
}

.res-place-picker p { flex-basis: 100%; margin: 0; }

/* ============================================================
   EVIDENCE SECTION
   ============================================================ */
/* scroll-margin-top clears the sticky topbar when residential-report.js brings
   a freshly produced assessment into view (the repo's anchored headings use the
   same 96px offset). */
.res-report-section { padding-top: 30px; scroll-margin-top: 96px; }

/* ── Location heading ── */
.res-location-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.res-location-heading h2 {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
  font-size: clamp(22px, 3.5vw, 34px);
  font-weight: 700;
  letter-spacing: -.02em;
}

.res-location-heading .res-eyebrow { margin-bottom: 4px; }

.res-muted {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  margin: 4px 0 0;
}

.res-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.res-actions .btn-secondary {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  border: 1.5px solid var(--hairline);
  background: var(--panel);
  color: var(--text);
  border-radius: 9px;
  padding: 9px 13px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .18s, background .18s, transform .18s, box-shadow .18s;
}

.res-actions .btn-secondary:hover {
  border-color: var(--accent, #d97706);
  background: rgba(217,119,6,.06);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(217,119,6,.18);
}

/* ── Caveats / alerts ── */
.res-caveat {
  padding: 13px 16px;
  border-left: 4px solid var(--accent, #d97706);
  border-radius: 10px;
  background: rgba(217,119,6,.07);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.6;
  margin: 16px 0;
}

.res-alert-note {
  padding: 13px 16px;
  border-left: 4px solid #e05c3a;
  border-radius: 10px;
  background: rgba(224,92,58,.08);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.6;
  margin: 16px 0;
}

/* ============================================================
   STAT BAR (Phase 3)
   ============================================================ */
.res-stat-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 20px 0 24px;
}

.res-stat-card {
  background: var(--panel);
  border: 1.5px solid var(--hairline);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 3px 14px rgba(0,0,0,.06);
  position: relative;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}

.res-stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent, #d97706), var(--accent-light, #fb923c));
  border-radius: 14px 14px 0 0;
}

.res-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(217,119,6,.15);
  border-color: rgba(217,119,6,.35);
}

.res-stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin: 0 0 6px;
}

.res-stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin: 0 0 4px;
  letter-spacing: -.03em;
}

.res-stat-sub {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.res-stat-value--sm { font-size: 16px; }

/* History limit note */
.res-history-limit { margin-top: 8px; }
.res-risk-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-top: 6px;
}

.res-risk-badge.risk-none    { background: rgba(34,197,94,.14);  color: #16a34a; }
.res-risk-badge.risk-low     { background: rgba(132,204,22,.14); color: #65a30d; }
.res-risk-badge.risk-mod     { background: rgba(217,119,6,.14);  color: #b45309; }
.res-risk-badge.risk-high    { background: rgba(239,68,68,.14);  color: #dc2626; }
.res-risk-badge.risk-unknown { background: rgba(107,114,128,.14);color: #6b7280; }

/* ============================================================
   MAP CONTAINER (Phase 2)
   ============================================================ */
.res-map-panels-grid {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 16px;
  margin: 0 0 16px;
  align-items: start;
}

.res-map-container {
  background: var(--panel);
  border: 1.5px solid var(--hairline);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
  position: sticky;
  top: 88px;
}

#resExposureMap {
  width: 100%;
  height: 480px;
  display: block;
}

.res-map-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--surface);
  border-top: 1px solid var(--hairline);
  font-size: 11px;
  color: var(--muted);
}

.res-map-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
}

.res-map-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.4);
}

.res-map-dot.dot-active   { background: #e05c3a; }
.res-map-dot.dot-history  { background: #d97706; }
.res-map-dot.dot-selected { background: #3b82f6; }

.res-panels-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ============================================================
   PANELS
   ============================================================ */
.res-panel {
  min-width: 0;
  border: 1.5px solid var(--hairline);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 3px 14px rgba(0,0,0,.055);
  overflow: hidden;
  transition: box-shadow .2s;
}

.res-panel:hover { box-shadow: 0 6px 24px rgba(0,0,0,.09); }

.res-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
}

.res-panel-heading h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 7px;
}

.res-panel-heading h3 i.fa-fire       { color: #e05c3a; }
.res-panel-heading h3 i.fa-clock-rotate-left { color: var(--accent, #d97706); }

.res-panel-body { padding: 14px 16px; }

.res-source-label {
  font-family: 'JetBrains Mono', monospace;
  color: var(--muted);
  font-size: 10px;
  text-align: right;
  flex-shrink: 0;
  white-space: nowrap;
}

/* ── Fire record cards ── */
.res-list { display: grid; gap: 8px; }

.res-record {
  border: 1.5px solid var(--hairline);
  border-left: 4px solid var(--hairline);
  border-radius: 10px;
  padding: 11px 13px;
  background: var(--surface);
  transition: transform .18s, box-shadow .18s, border-left-color .18s;
  animation: res-card-in .35s ease both;
}

.res-record:hover {
  transform: translateX(2px);
  box-shadow: 0 4px 14px rgba(0,0,0,.08);
}

.res-record.fire-active    { border-left-color: #e05c3a; }
.res-record.fire-history   { border-left-color: var(--accent, #d97706); }
.res-record.fire-held      { border-left-color: #f59e0b; }
.res-record.fire-control   { border-left-color: #22c55e; }

@keyframes res-card-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0);   }
}

.res-record > div {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.res-record strong {
  overflow-wrap: anywhere;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.res-record span {
  color: var(--muted);
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  text-align: right;
  flex-shrink: 0;
}

.res-record small {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.res-cause-icon {
  font-size: 12px;
  flex-shrink: 0;
}

.res-empty-result {
  border-radius: 10px;
  padding: 16px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
  text-align: center;
}

/* ── Panel summary muted text ── */
.res-panel-body .res-muted { margin: 0 0 12px; }

/* ============================================================
   SKELETON LOADERS (Phase 5)
   ============================================================ */
.res-skeleton {
  border-radius: 10px;
  overflow: hidden;
  padding: 11px 13px;
  background: var(--surface);
  border: 1.5px solid var(--hairline);
  display: grid;
  gap: 8px;
}

.res-skeleton-line {
  height: 11px;
  border-radius: 6px;
  background: linear-gradient(90deg,
    var(--surface)  0%,
    var(--hairline) 45%,
    var(--surface)  90%);
  background-size: 200% 100%;
  animation: res-shimmer 1.6s ease-in-out infinite;
}

.res-skeleton-line.w-75  { width: 75%; }
.res-skeleton-line.w-50  { width: 50%; }
.res-skeleton-line.w-90  { width: 90%; }

@keyframes res-shimmer {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}

.res-skeleton-stat {
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(90deg,
    var(--surface) 0%, var(--hairline) 45%, var(--surface) 90%);
  background-size: 200% 100%;
  animation: res-shimmer 1.6s ease-in-out infinite;
  margin-bottom: 8px;
}

/* ============================================================
   CHART PANEL (Phase 4)
   ============================================================ */
.res-chart-panel {
  margin: 0 0 16px;
}

.res-chart-wrap {
  padding: 16px;
}

.res-decade-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 80px;
  margin-top: 8px;
}

.res-decade-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.res-decade-bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--accent, #d97706), rgba(217,119,6,.4));
  min-height: 3px;
  transition: height .6s cubic-bezier(0.34,1.56,0.64,1);
  position: relative;
  cursor: pointer;
}

.res-decade-bar:hover { filter: brightness(1.15); }

.res-decade-bar-label {
  font-size: 9px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
}

.res-dist-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.res-dist-card {
  border: 1.5px solid var(--hairline);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--surface);
  text-align: center;
}

.res-dist-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.res-dist-lbl {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 3px;
}

/* ============================================================
   SOURCES PANEL
   ============================================================ */
.res-sources { margin: 0 0 16px; }

.res-sources > summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 13.5px;
  padding: 14px 16px;
  -webkit-user-select: none;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  list-style: none;
  transition: background .15s;
}

.res-sources > summary:hover { background: var(--surface); }
.res-sources > summary::before {
  content: '›';
  font-size: 16px;
  color: var(--accent, #d97706);
  transition: transform .2s;
}
.res-sources[open] > summary::before { transform: rotate(90deg); }

.res-sources ul {
  padding: 0 16px 16px 28px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
}

.res-sources li + li { margin-top: 8px; }

/* ============================================================
   GUIDANCE — FireSmart HIZ (Phase 6)
   ============================================================ */
.res-guidance {
  margin: 0 0 16px;
}

.res-guidance-body { padding: 16px; }

.res-guidance h3 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
}

.res-guidance > p:not(.res-eyebrow),
.res-guidance-body > p:not(.res-eyebrow) {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.65;
  margin: 0 0 16px;
}

.res-hiz-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 0 0 16px;
}

.res-hiz-card {
  border: 1.5px solid var(--hairline);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}

.res-hiz-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,.1);
}

.res-hiz-header {
  padding: 10px 12px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.res-hiz-zone-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.hiz-z1 .res-hiz-zone-dot { background: #ef4444; }
.hiz-z2 .res-hiz-zone-dot { background: #f59e0b; }
.hiz-z3 .res-hiz-zone-dot { background: #22c55e; }

.hiz-z1 .res-hiz-header { border-top: 3px solid #ef4444; }
.hiz-z2 .res-hiz-header { border-top: 3px solid #f59e0b; }
.hiz-z3 .res-hiz-header { border-top: 3px solid #22c55e; }

.res-hiz-header strong {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}

.res-hiz-body {
  padding: 0 12px 12px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
}

.res-hiz-expand-btn {
  all: unset;
  cursor: pointer;
  font-size: 11px;
  color: var(--accent, #d97706);
  font-weight: 700;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.res-hiz-detail {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.6;
  padding-top: 6px;
  border-top: 1px solid var(--hairline);
}

.res-guidance ul {
  padding-left: 20px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.75;
}

.res-guidance li + li { margin-top: 8px; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.res-empty {
  padding: 60px 24px;
  text-align: center;
  color: var(--muted);
}

.res-empty > i {
  color: var(--accent, #d97706);
  font-size: 36px;
  margin-bottom: 16px;
  display: block;
  opacity: .75;
}

.res-empty h3 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 18px;
}

.res-empty p {
  max-width: 480px;
  margin: 0 auto;
  font-size: 13.5px;
  line-height: 1.6;
}

/* ============================================================
   EMERGENCY CTA STRIP (Phase 6)
   ============================================================ */
.res-emergency-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 12px;
  background: rgba(224,92,58,.1);
  border: 1.5px solid rgba(224,92,58,.3);
  margin: 0 0 16px;
  flex-wrap: wrap;
}

.res-emergency-strip i { color: #e05c3a; font-size: 18px; flex-shrink: 0; }
.res-emergency-strip p { margin: 0; flex: 1; min-width: 200px; font-size: 13px; font-weight: 600; }
.res-emergency-strip a.btn-emergency {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 9px;
  background: #e05c3a;
  color: #fff;
  font-weight: 700;
  font-size: 12.5px;
  text-decoration: none;
  flex-shrink: 0;
  transition: filter .18s, transform .18s;
}
.res-emergency-strip a.btn-emergency:hover { filter: brightness(1.1); transform: translateY(-1px); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 960px) {
  .res-map-panels-grid {
    grid-template-columns: 1fr;
  }
  .res-map-container {
    position: static;
  }
  #resExposureMap { height: 340px; }
}

@media (max-width: 720px) {
  .res-report-wrap { padding: 12px 10px 40px; }
  .res-search-row, .res-location-heading { align-items: stretch; flex-direction: column; }
  .res-search-row .btn-primary { min-height: 46px; }
  .res-actions { flex-wrap: wrap; }
  .res-place-picker { align-items: stretch; flex-direction: column; }
  .res-hiz-grid { grid-template-columns: 1fr; }
  .res-stat-bar { grid-template-columns: repeat(2, 1fr); }
  .res-panel-heading { flex-wrap: wrap; }
  .res-source-label { text-align: left; }
  .res-dist-grid { grid-template-columns: repeat(3,1fr); gap: 6px; }
}

@media (max-width: 480px) {
  .res-stat-bar { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   PRINT (Phase 8 — branded PDF export)
   ============================================================ */
/* ============================================================
   SEARCH SUGGESTIONS AUTOCOMPLETE
   ============================================================ */
.res-search-input-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
}

.res-search-input-wrap input {
  width: 100%;
  padding-left: 42px;
  padding-right: 42px;
}

.res-input-icon {
  position: absolute;
  left: 15px;
  color: rgba(217, 119, 6, 0.75);
  font-size: 15px;
  pointer-events: none;
  z-index: 2;
}

.res-input-clear {
  position: absolute;
  right: 12px;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #f5e6d3;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.15s, transform 0.15s;
  z-index: 2;
}

.res-input-clear:hover {
  background: rgba(217, 119, 6, 0.45);
  transform: scale(1.1);
}

.res-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 1000;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: rgba(24, 15, 10, 0.96);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1.5px solid rgba(217, 119, 6, 0.38);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(217, 119, 6, 0.15);
  max-height: 360px;
  overflow-y: auto;
  animation: res-sug-in 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes res-sug-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.res-suggestions li {
  padding: 8px 12px;
  border-radius: 9px;
  font-size: 13.5px;
  color: #f7eedf;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 11px;
  transition: background 0.12s, transform 0.1s;
  line-height: 1.35;
}

.res-suggestions li:hover,
.res-suggestions li[aria-selected="true"] {
  background: rgba(217, 119, 6, 0.22);
}

.res-suggestions li[aria-selected="true"] {
  outline: 1.5px solid rgba(217, 119, 6, 0.6);
}

.res-sug-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(217, 119, 6, 0.16);
  color: var(--accent, #d97706);
  font-size: 13px;
  flex-shrink: 0;
}

.res-sug-content {
  flex: 1;
  min-width: 0;
}

.res-sug-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.res-sug-name {
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.res-sug-match {
  color: #fbbf24;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.res-sug-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 5px;
  flex-shrink: 0;
}

.res-sug-badge--city       { background: rgba(59, 130, 246, 0.22); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.4); }
.res-sug-badge--town       { background: rgba(16, 185, 129, 0.22); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.4); }
.res-sug-badge--district   { background: rgba(236, 72, 153, 0.22); color: #f472b6; border: 1px solid rgba(236, 72, 153, 0.4); }
.res-sug-badge--resort     { background: rgba(6, 182, 212, 0.22);  color: #67e8f9; border: 1px solid rgba(6, 182, 212, 0.4); }
.res-sug-badge--community  { background: rgba(139, 92, 246, 0.22); color: #c4b5fd; border: 1px solid rgba(139, 92, 246, 0.4); }
.res-sug-badge--address    { background: rgba(245, 158, 11, 0.22); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.4); }
.res-sug-badge--postal     { background: rgba(168, 85, 247, 0.22); color: #d8b4fe; border: 1px solid rgba(168, 85, 247, 0.4); }

.res-sug-sub {
  font-size: 11.5px;
  color: rgba(215, 195, 170, 0.72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.res-sug-action-hint {
  font-size: 11px;
  color: rgba(217, 119, 6, 0.85);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}

.res-suggestions li:hover .res-sug-action-hint,
.res-suggestions li[aria-selected="true"] .res-sug-action-hint {
  opacity: 1;
}

.res-sug-loading,
.res-sug-empty {
  padding: 11px 14px;
  font-size: 12.5px;
  color: rgba(210, 190, 165, 0.85);
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: default;
}

.res-sug-loading { color: var(--accent, #d97706); }

.res-suggestions-footer {
  padding: 7px 12px;
  font-size: 11px;
  color: rgba(180, 155, 125, 0.75);
  border-top: 1px solid rgba(217, 119, 6, 0.16);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  cursor: default;
}

.res-suggestions-footer kbd {
  background: rgba(255, 255, 255, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-family: inherit;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f5e6d3;
}

/* ============================================================
   MAP BASEMAP TABS
   ============================================================ */
.res-map-tabs {
  display: flex;
  gap: 2px;
  padding: 8px 10px 6px;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
}

.res-map-tab {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  transition: background .15s, color .15s;
}

.res-map-tab:hover { background: var(--hairline); color: var(--text); }

.res-map-tab.active {
  background: var(--accent, #d97706);
  color: #fff;
  box-shadow: 0 2px 8px rgba(217,119,6,.4);
}

.res-map-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  margin-left: auto;
}

.res-map-toggle input { cursor: pointer; accent-color: var(--accent, #d97706); }

/* ============================================================
   INTEL PANELS GRID (fire-details pattern)
   ============================================================ */
.res-intel-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 0 0 16px;
}

/* ── stat-row pattern (mirrors fire-details.html) ── */
.res-stat-rows { display: flex; flex-direction: column; }

.res-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 13px;
}

.res-stat-row:last-child { border-bottom: none; }

.res-stat-row-label {
  color: var(--muted);
  flex-shrink: 0;
  max-width: 55%;
  line-height: 1.4;
}

.res-stat-row-value {
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  text-align: right;
  color: var(--text);
  word-break: break-word;
}

.res-stat-missing {
  color: var(--muted);
  font-weight: 400;
  font-style: italic;
  opacity: .7;
  font-family: inherit;
}

.res-stat-hint {
  cursor: help;
  opacity: .5;
  font-style: normal;
  font-family: inherit;
  margin-left: 3px;
}

.res-stat-note {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed var(--hairline);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--muted);
}

.res-stat-link {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--accent, #d97706);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  text-decoration: none;
  transition: filter .15s;
}
.res-stat-link:hover { filter: brightness(1.12); }

/* ── 7-day forecast strip ── */
.res-forecast-strip {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.res-forecast-day {
  flex: 0 0 62px;
  text-align: center;
  padding: 8px 4px;
  border: 1.5px solid var(--hairline);
  border-radius: 10px;
  background: var(--surface);
  font-size: 11px;
}

.res-forecast-dow  { font-weight: 700; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 3px; }
.res-forecast-icon { font-size: 15px; margin: 3px 0; color: var(--accent, #d97706); display: block; }
.res-forecast-hi   { font-family: 'JetBrains Mono', monospace; font-weight: 700; color: var(--text); font-size: 13.5px; }
.res-forecast-lo   { font-family: 'JetBrains Mono', monospace; color: var(--muted); font-size: 11.5px; }
.res-forecast-wind { color: var(--muted); font-size: 9.5px; margin-top: 3px; }

@media (max-width: 720px) {
  .res-intel-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   AQI GAUGE CARD & COLOUR BAR
   ============================================================ */
.res-aqi-gauge-card {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1.5px solid var(--hairline);
  margin-bottom: 12px;
}

.res-aqi-gauge-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.res-aqi-val-group {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.res-aqi-num {
  font-size: 28px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1;
  color: var(--text);
}

.res-aqi-unit {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}

.res-aqi-category-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
}

.res-aqi--good           { background: rgba(34, 197, 94, 0.16);  color: #16a34a; border: 1px solid rgba(34, 197, 94, 0.35); }
.res-aqi--mod            { background: rgba(234, 179, 8, 0.16);  color: #ca8a04; border: 1px solid rgba(234, 179, 8, 0.35); }
.res-aqi--sensitive      { background: rgba(249, 115, 22, 0.16); color: #ea580c; border: 1px solid rgba(249, 115, 22, 0.35); }
.res-aqi--unhealthy      { background: rgba(220, 38, 38, 0.16);  color: #dc2626; border: 1px solid rgba(220, 38, 38, 0.35); }
.res-aqi--very-unhealthy { background: rgba(147, 51, 234, 0.16); color: #9333ea; border: 1px solid rgba(147, 51, 234, 0.35); }
.res-aqi--hazardous      { background: rgba(136, 19, 55, 0.16);  color: #be123c; border: 1px solid rgba(136, 19, 55, 0.35); }

.res-aqi-bar-track {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, #22c55e 0%, #eab308 17%, #f97316 33%, #ef4444 50%, #8b5cf6 67%, #701a75 100%);
  position: relative;
  margin: 10px 0 6px;
}

.res-aqi-needle {
  position: absolute;
  top: -4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent, #d97706);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transform: translateX(-50%);
  transition: left 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.res-aqi-scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 9.5px;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 4px;
}

/* FWI Danger Pill Badges */
.res-fwi-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
}
.res-fwi--low      { background: rgba(34, 197, 94, 0.16); color: #16a34a; }
.res-fwi--moderate { background: rgba(234, 179, 8, 0.16); color: #ca8a04; }
.res-fwi--high     { background: rgba(249, 115, 22, 0.16); color: #ea580c; }
.res-fwi--veryhigh { background: rgba(220, 38, 38, 0.16); color: #dc2626; }
.res-fwi--extreme  { background: rgba(147, 51, 234, 0.16); color: #9333ea; }

@media print {
  .topbar, .side-nav, .side-nav-toggle, .search-widget,
  .footer, .res-search-form, .res-actions,
  #reportEmpty, #placePicker,
  .res-map-container, .res-emergency-strip { display: none !important; }

  body, .residential-report-page {
    background: #fff !important;
    color: #111 !important;
  }

  .res-report-wrap { max-width: none; padding: 0; }

  /* Branded print header */
  .res-report-section::before {
    content: 'Fire Aware · Residential Wildfire Exposure Report · ' attr(data-generated);
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #555;
    border-bottom: 2px solid #d97706;
    padding-bottom: 8px;
    margin-bottom: 20px;
  }

  .res-report-hero {
    background: #fff !important;
    color: #111 !important;
    box-shadow: none;
    border: 1.5px solid #ccc;
    padding: 18px;
    animation: none;
  }

  .res-report-hero h1, .res-report-hero > p:not(.res-eyebrow) { color: #111; }
  .res-privacy-note { color: #666; }
  .res-report-section[hidden] { display: none !important; }
  .res-report-hero .res-status,
  .res-report-hero .res-status[data-state] { display: none !important; }

  .res-panel, .res-record, .res-caveat, .res-alert-note, .res-stat-card {
    break-inside: avoid;
    box-shadow: none;
    background: #fff !important;
    color: #111 !important;
  }

  .res-stat-bar { gap: 8px; }
  .res-stat-value { color: #111; }
  .res-muted { color: #555; }
  .res-source-label { color: #777; }

  /* Print footer disclaimer */
  .res-guidance::after {
    content: 'This report is generated from public data sources and does not constitute a property risk assessment, insurance underwriting opinion, or safety guarantee. See source notes for coverage limits.';
    display: block;
    font-size: 9px;
    color: #777;
    border-top: 1px solid #ccc;
    padding-top: 8px;
    margin-top: 16px;
    line-height: 1.5;
  }

  a { color: #111; }
  a[href]::after {
    content: ' (' attr(href) ')';
    font-size: 9px;
    color: #555;
  }
}

/* ============================================================
   MY LOCATION · COMPARISON · NEARBY SERVICES
   ============================================================ */

/* ── "Use my location" control ──
   The hero search row gains a third control. It matches the submit button's
   height so the row stays on one line; the 720px breakpoint already stacks
   the row, where this button becomes full width. Busy state reuses the
   FontAwesome `fa-spin` class (no new keyframes, so the global
   prefers-reduced-motion kill in style.css covers it). */
.res-locate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px solid rgba(217, 119, 6, .5);
  border-radius: 11px;
  background: rgba(255, 255, 255, .08);
  color: #fdf4e7;
  padding: 13px 18px;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s, border-color .18s, transform .18s;
}

.res-locate-btn:hover {
  background: rgba(217, 119, 6, .22);
  border-color: rgba(217, 119, 6, .8);
}

.res-locate-btn:disabled { opacity: .6; cursor: progress; }

/* ── Comparison panel ── */
.res-compare-controls {
  display: flex;
  align-items: stretch;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 10px;
}

.res-compare-controls .res-search-input-wrap { flex: 1 1 320px; }

.res-compare-controls input {
  width: 100%;
  border: 1.5px solid var(--hairline);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  padding: 12px 42px;
  font: inherit;
  font-size: 14.5px;
  transition: border-color .2s, box-shadow .2s;
}

.res-compare-controls input::placeholder { color: var(--muted); }

.res-compare-controls input:focus-visible {
  outline: none;
  border-color: var(--accent, #d97706);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, .25);
}

.res-compare-controls .res-input-icon { color: var(--muted); }

.res-compare-controls .res-input-clear {
  background: color-mix(in srgb, var(--muted) 22%, transparent);
  color: var(--text);
}

.res-compare-controls .res-locate-btn {
  background: var(--surface);
  color: var(--text);
  border-color: var(--hairline);
}

.res-compare-controls .res-locate-btn:hover {
  border-color: var(--accent, #d97706);
  background: color-mix(in srgb, var(--accent, #d97706) 12%, var(--surface));
}

.res-compare .res-status { margin: 4px 0 0; color: var(--muted); }
.res-compare .res-status[data-state='error']   { color: #b91c1c; }
.res-compare .res-status[data-state='warning'] { color: #b45309; }
.res-compare .res-status[data-state='success'] { color: #35624E; }

.res-compare-table-wrap { overflow-x: auto; margin-top: 14px; }

.res-compare-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 13px;
}

.res-compare-table caption {
  caption-side: top;
  text-align: left;
  font-size: 11.5px;
  color: var(--muted);
  padding: 0 0 10px;
  line-height: 1.5;
}

.res-compare-table th,
.res-compare-table td {
  text-align: left;
  vertical-align: top;
  padding: 8px 10px;
  border-bottom: 1px solid var(--hairline);
}

.res-compare-table thead th {
  font-size: 12.5px;
  border-bottom-width: 2px;
}

.res-compare-table tbody th {
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.res-compare-table tr.res-compare-group th {
  padding-top: 16px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent, #d97706);
  border-bottom: none;
}

.res-compare-table td.res-compare-missing {
  color: var(--muted);
  font-style: italic;
}

.res-compare-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

/* ── Nearby-service lists (evacuation orders/alerts, fire stations) ── */
.res-service-list { display: grid; gap: 8px; margin-top: 12px; }

.res-service-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--surface);
  font-size: 12.5px;
}

.res-service-item strong {
  display: block;
  font-size: 13px;
  color: var(--text);
}

.res-service-item span { color: var(--muted); }

.res-service-item.res-service--order {
  border-color: rgba(220, 38, 38, .45);
  background: color-mix(in srgb, #dc2626 8%, var(--surface));
}

.res-service-item.res-service--alert {
  border-color: rgba(245, 158, 11, .45);
  background: color-mix(in srgb, #f59e0b 8%, var(--surface));
}

.res-service-distance {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  white-space: nowrap;
  color: var(--muted);
}

.res-service-inside { color: #b91c1c; font-weight: 700; }

@media (max-width: 720px) {
  .res-search-row .res-locate-btn { min-height: 46px; }
  .res-compare-controls { flex-direction: column; align-items: stretch; }
  .res-compare-controls .res-locate-btn { min-height: 46px; }
  .res-compare-table { min-width: 0; font-size: 12.5px; }
  .res-compare-table th,
  .res-compare-table td { padding: 7px 6px; }
}

/* Comparison point colour (map legend + markers) */
.res-map-dot.dot-compare { background: #7c3aed; }

/* Evacuation panel is a <details> so its large layer stays opt-in */
.res-evac-panel > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  list-style: none;
}

.res-evac-panel > summary::-webkit-details-marker { display: none; }

.res-evac-panel > summary::after {
  content: '\f078';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 11px;
  color: var(--muted);
  margin-left: auto;
  transition: transform .18s;
}

.res-evac-panel[open] > summary::after { transform: rotate(180deg); }

.res-evac-panel > summary:hover { background: color-mix(in srgb, var(--accent, #d97706) 8%, transparent); }
.res-evac-panel > summary:focus-visible { outline: 3px solid var(--accent, #d97706); outline-offset: -3px; }
.res-evac-panel > summary .res-source-label { margin-left: auto; }

.res-evac-panel[open] > summary .res-source-label { margin-left: 0; }
