:root {
  --navy: #0b2545;
  --navy-2: #123a6d;
  --ink: #1c2733;
  --muted: #5b6b7c;
  --line: #d7dee7;
  --bg: #f2f5f9;
  --green: #1e9e4f;
  --yellow: #e6b800;
  --red: #d93a2b;
  --gray: #6b7684;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); }
.topbar { background: var(--navy); color: #fff; padding: 16px 22px; }
.topbar h1 { margin: 0 0 4px; font-size: 22px; }
.topbar .sub { margin: 0; color: #c8d6ea; font-size: 13px; max-width: 900px; }
.layout { display: flex; gap: 16px; padding: 16px; align-items: flex-start; }
.sidebar { width: 340px; flex: 0 0 340px; display: flex; flex-direction: column; gap: 16px; }
.maincol { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.card h2 { margin: 0 0 10px; font-size: 16px; color: var(--navy); }
.card h3 { margin: 16px 0 6px; font-size: 14px; color: var(--navy); }
.lbl { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 10px 0 4px; }
input[type="text"], input[type="password"], select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; background: #fff;
}
input[type="range"] { width: 100%; }
button {
  padding: 8px 12px; border: 1px solid var(--navy-2); background: #fff; color: var(--navy-2);
  border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer;
}
button:hover { background: #eaf1fa; }
button.primary { background: var(--navy-2); color: #fff; width: 100%; margin-top: 12px; }
button.primary:hover { background: var(--navy); }
button.active { background: var(--navy-2); color: #fff; }
button:disabled { opacity: .55; cursor: wait; }
#demoScanBtn { width: 100%; margin-top: 8px; }
.row { display: flex; gap: 8px; align-items: flex-end; }
.row.wrap { flex-wrap: wrap; align-items: center; }
.row .grow { flex: 1; }
.row .shrink { width: 76px; }
.muted { color: var(--muted); font-size: 13px; }
.status { font-size: 13px; margin-top: 8px; min-height: 16px; }
.status.err { color: var(--red); }
.status.ok { color: var(--green); }
.results-list { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.result-item { text-align: left; width: 100%; font-weight: 500; }
.result-item small { display: block; color: var(--muted); font-weight: 400; }
.selected-box { margin-top: 10px; background: #eef6ee; border: 1px solid #bfe0bf; border-radius: 8px; padding: 10px; font-size: 13px; }
.hidden { display: none !important; }
.legend-box { margin-top: 12px; font-size: 13px; line-height: 1.9; background: #f7fafc; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; border: 1px solid rgba(0,0,0,.25); }
.dot.green { background: var(--green); } .dot.yellow { background: var(--yellow); }
.dot.red { background: var(--red); } .dot.gray { background: var(--gray); }
.statbar { background: var(--navy); color: #fff; border-radius: 10px; padding: 12px 18px; display: flex; gap: 28px; flex-wrap: wrap; align-items: center; }
.stat { display: flex; flex-direction: column; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #a9c0dd; }
.stat-value { font-size: 20px; font-weight: 700; }
.stat.chips { flex-direction: row; gap: 8px; margin-left: auto; }
.chip { border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; }
.chip.high { background: #14532d; color: #bbf7d0; }
.chip.med { background: #713f12; color: #fde68a; }
.chip.low { background: #7f1d1d; color: #fecaca; }
#map { height: 560px; border-radius: 10px; border: 1px solid var(--line); z-index: 0; }
.homeowner-strip { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 18px; display: flex; gap: 36px; flex-wrap: wrap; }
.homeowner-strip > div { display: flex; flex-direction: column; }
.strip-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.homeowner-strip strong { font-size: 18px; color: var(--navy); }
.demo-banner { background: #fff3cd; border: 1px solid #e6b800; color: #6b5900; border-radius: 10px; padding: 10px 14px; font-weight: 700; font-size: 13px; }
.error-banner { background: #fdeceb; border: 1px solid var(--red); color: #7c1d14; border-radius: 10px; padding: 10px 14px; font-weight: 600; font-size: 13px; }
.results-card h2 { margin-top: 0; }
.summary-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.summary-chips .chip { background: #eef2f7; color: var(--navy); border: 1px solid var(--line); }
.diag-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line); }
details { margin-top: 12px; }
summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--navy-2); }
.zip-list { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; }
.zip-row { display: flex; justify-content: space-between; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--line); font-size: 13px; cursor: pointer; background: none; border-top: none; border-left: none; border-right: none; font-weight: 500; color: var(--ink); text-align: left; }
.zip-row:hover { background: #eef4fb; }
.zip-row small { color: var(--muted); }
.rank-pin { border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.45); color: #fff; font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; }
.rank-pin.green { background: var(--green); }
.rank-pin.yellow { background: var(--yellow); color: #3d3100; }
.rank-pin.red { background: var(--red); }
.rank-pin.gray { background: var(--gray); }
.focus-item { border: 1px solid var(--line); border-left: 5px solid var(--red); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; font-size: 14px; }
.focus-item.yellow-band { border-left-color: var(--yellow); }
.focus-item .scores { color: var(--muted); font-size: 12px; margin-top: 4px; }
.focus-item .headline { font-weight: 600; }
#focusActions li { margin-bottom: 6px; font-size: 14px; }
.sector-table td:first-child { font-weight: 700; }
.foot { padding: 0 16px 20px; }
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex: none; }
  #map { height: 420px; }
}
