:root {
  color-scheme: light;
  --navy: #15181c;
  --accent: #2f7dbf;
  --accent-dark: #1f5f93;
  --cream: #f4f2ed;
  --paper: #fffdf9;
  --ink: #0f172a;
  --muted: #64748b;
  --warm-muted: #8a7b68;
  --line: #e3dacd;
  --line-cool: #e2e8f0;
  --green: #15803d;
  --gold: #b45309;
  --red: #b91c1c;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.05), 0 10px 40px rgba(0, 0, 0, 0.1);
}

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }

body {
  margin: 0;
  min-height: 100vh;
  padding-top: 58px;
  background: var(--cream);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, Inter, "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0;
}

button, input { font: inherit; }
button { border: 0; cursor: pointer; }
svg:not(.leaflet-zoom-animated) { width: 18px; height: 18px; stroke-width: 2.25; } /* icon sizing; never the Leaflet vector layer SVG */

.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  padding: 0 18px;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.2);
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.topbar-brand strong {
  display: block;
  font-size: 19px;
  font-weight: 950;
  line-height: 1;
}

.topbar-brand small {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.brand-dot {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 950;
  letter-spacing: 0;
  box-shadow: 0 5px 18px rgba(47, 125, 191, 0.34);
}

.topbar-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.11);
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  font-weight: 850;
}

.app-shell {
  display: grid;
  grid-template-columns: 372px minmax(0, 1fr);
  min-height: calc(100vh - 58px);
}

.sidebar {
  padding: 16px 14px 24px;
  overflow: auto;
  background: #f1f5f9;
  border-right: 1px solid var(--line-cool);
}

.brand { display: none; }

.panel, .score-panel, .metric-card, .report-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
  margin-bottom: 12px;
}

.section-title, .report-header, .button-row, .input-action {
  display: flex;
  align-items: center;
}

.section-title {
  gap: 8px;
  margin-bottom: 14px;
  color: var(--navy);
}

.section-title h2, .report-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0;
}

.stack { display: grid; gap: 12px; }

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1.5px solid #dde3ec;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 11px 13px;
  outline: none;
  font-weight: 700;
  letter-spacing: 0;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(47, 125, 191, 0.12);
}

input::placeholder { color: #a5b1c0; }

input[type="range"] {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--accent);
}

.input-action { gap: 8px; }

.icon-button, .primary, .secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: 10px;
  font-weight: 900;
  white-space: nowrap;
}

.icon-button {
  width: 46px;
  flex: 0 0 auto;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(47, 125, 191, 0.28);
}

.primary {
  padding: 0 15px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(47, 125, 191, 0.28);
}

.secondary {
  padding: 0 14px;
  background: #fff;
  color: var(--navy);
  border: 1px solid var(--line-cool);
}

.button-row { gap: 9px; flex-wrap: wrap; }
.input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.range-stack { display: grid; gap: 15px; }
.range-stack label { grid-template-columns: 1fr auto; align-items: center; }
.range-stack input { grid-column: 1 / -1; }

output {
  color: var(--accent-dark);
  font-variant-numeric: tabular-nums;
  font-weight: 950;
}

.workspace {
  min-width: 0;
  padding: 16px;
  overflow: auto;
}

.map-band {
  position: relative;
  height: min(38vh, 390px);
  min-height: 300px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: #cbd5e1;
}

#map { height: 100%; width: 100%; }

.map-status {
  position: absolute;
  left: 16px;
  bottom: 16px;
  display: grid;
  gap: 2px;
  max-width: min(560px, calc(100% - 32px));
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 253, 249, 0.95);
  border: 1px solid var(--line);
  box-shadow: 0 12px 35px rgba(20, 16, 13, 0.16);
}

.map-status strong { font-weight: 900; }
.map-status span { color: var(--warm-muted); font-size: 12px; font-weight: 700; }

.summary-grid {
  display: grid;
  grid-template-columns: minmax(300px, 1.45fr) repeat(4, minmax(140px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.score-panel {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 132px;
  padding: 18px;
}

.score-ring {
  --score-color: var(--muted);
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  flex: 0 0 auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--paper) 55%, transparent 57%),
    conic-gradient(var(--score-color) calc(var(--score, 0) * 1%), #e9edf2 0);
}

.score-ring span {
  font-size: 30px;
  font-weight: 950;
  line-height: 1;
}

.score-ring small {
  margin-top: -25px;
  color: var(--warm-muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.score-panel h2 {
  margin: 4px 0 7px;
  font-size: 25px;
  font-weight: 950;
  letter-spacing: 0;
}

.score-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.42;
}

.eyebrow {
  margin: 0;
  color: var(--warm-muted);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.metric-card {
  display: grid;
  align-content: center;
  min-height: 132px;
  min-width: 0;
  padding: 17px;
  container-type: inline-size;
}

.metric-card span, .metric-card small {
  color: var(--muted);
  font-weight: 750;
}

.metric-card strong {
  margin: 5px 0;
  font-size: clamp(18px, 1.7vw, 28px);
  font-size: clamp(16px, 14cqi, 30px); /* scale to the card's own width so big dollar figures never overflow */
  white-space: nowrap;
  min-width: 0;
  font-weight: 950;
  letter-spacing: 0;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.report-panel {
  padding: 18px;
  min-width: 0;
}

.report-panel.wide { grid-column: 1 / -1; }

.report-header {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.radius-table {
  display: grid;
  grid-template-columns: 0.7fr repeat(4, 1fr);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.radius-table div {
  min-width: 0;
  padding: 11px 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
  font-weight: 750;
}

.radius-table div:nth-child(5n) { border-right: 0; }
.radius-table div:nth-last-child(-n + 5) { border-bottom: 0; }

.radius-table .head {
  background: #f8fafc;
  color: var(--muted);
  font-weight: 950;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.resident-demographics { margin-top: 18px; min-width: 0; }
.resident-demographics h3 { margin: 0 0 10px; font-size: 15px; }
.demo-sex-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.demo-sex-card { border: 1px solid var(--line); background: #f8fafc; border-radius: 10px; padding: 10px; }
.demo-sex-card strong, .demo-sex-card span { display: block; }
.demo-sex-card span { margin-top: 5px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.demo-table-scroll { margin-top: 12px; max-width: 100%; overflow-x: auto; }
.demo-age-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.demo-age-table caption { text-align: left; font-weight: 750; padding: 0 0 8px; }
.demo-age-table th, .demo-age-table td { padding: 8px 6px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.demo-age-table th:first-child { text-align: left; }
.demo-age-table thead { color: var(--muted); background: #f8fafc; }
.demo-source { margin-bottom: 0; font-size: 11px; line-height: 1.5; }

.signal-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.signal {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}

.signal strong {
  display: block;
  margin-bottom: 5px;
  font-weight: 900;
}

.signal span, .money-grid span, .memo li, .bar-list span { color: var(--muted); }

.money-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.money {
  padding: 13px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #edf2f7;
}

.money strong {
  display: block;
  margin-top: 5px;
  font-size: 21px;
  font-weight: 950;
}

.bar-list {
  display: grid;
  gap: 12px;
  margin-top: 17px;
}

.bar-row {
  display: grid;
  grid-template-columns: 145px 1fr 44px;
  gap: 10px;
  align-items: center;
}

.bar-row strong { font-weight: 950; }

.bar-track {
  height: 10px;
  border-radius: 99px;
  background: #e2e8f0;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--accent);
}

.pill, .timestamp {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 11px;
  border-radius: 20px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 950;
}

.memo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.memo-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 15px;
  background: #fff;
}

.memo h3 {
  margin: 0 0 9px;
  font-size: 15px;
  font-weight: 900;
}

.memo ul { margin: 0; padding-left: 18px; }
.memo li { margin: 7px 0; line-height: 1.42; }
.leaflet-popup-content-wrapper { border-radius: 10px; }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 330px minmax(0, 1fr); }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .score-panel { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
  body { padding-top: 58px; background: #f1f5f9; }
  .topbar { padding: 0 12px; }
  .topbar-brand small, .topbar-actions { display: none; }
  .app-shell { display: block; }
  .sidebar { padding: 12px 10px; border-right: 0; }
  .workspace { padding: 10px; }
  .map-band { height: 320px; min-height: 300px; }
  .summary-grid, .content-grid, .memo, .signal-list { grid-template-columns: 1fr; }
  .report-panel.wide, .score-panel { grid-column: auto; }
  .money-grid { grid-template-columns: 1fr 1fr; }
  .radius-table { font-size: 12px; }
}

@media (max-width: 520px) {
  .topbar-brand strong { font-size: 17px; }
  .input-grid, .money-grid { grid-template-columns: 1fr; }
  .score-panel { align-items: flex-start; flex-direction: column; }
  .metric-card { min-height: 96px; }
  .bar-row { grid-template-columns: 1fr 44px; }
  .bar-row span:first-child { grid-column: 1 / -1; }
  .radius-table div { padding: 9px 7px; font-size: 11px; }
  .radius-table .head { font-size: 9px; }
}

@media print {
  body { padding-top: 0; background: #fff; }
  .topbar, .sidebar, .map-band, .report-header .button-row { display: none; }
  .app-shell, .content-grid, .summary-grid, .memo { display: block; }
  .workspace { padding: 0; }
  .report-panel, .metric-card, .score-panel {
    box-shadow: none;
    break-inside: avoid;
    margin-bottom: 12px;
  }
}


/* Tunnel sizing */
select {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line-cool);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  text-transform: none;
  letter-spacing: 0;
}
.full-width { width: 100%; margin-top: 12px; }
#apply-tunnel { background: var(--accent); color: #fff; }
#apply-tunnel:hover { background: var(--accent-dark); }
.hint { margin: 10px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.tunnel-reco { display: grid; gap: 6px; margin-bottom: 14px; }
.tunnel-reco p { margin: 0; line-height: 1.5; }
#tunnel-pill[data-fit="fits"] { background: #ecfdf3; color: var(--green); }
#tunnel-pill[data-fit="big"] { background: #fef2f2; color: var(--red); }
.tunnel-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 12px; }
.tunnel-table { display: grid; grid-template-columns: 0.7fr 1fr 0.9fr 0.9fr 0.6fr 0.9fr 0.9fr 0.9fr 1fr; min-width: 820px; }
.tunnel-table div { padding: 10px 9px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; font-weight: 750; font-size: 13.5px; white-space: nowrap; }
.tunnel-table .head { background: #f8fafc; color: var(--muted); font-weight: 950; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.tunnel-table div.selected { background: #eff6ff; }
.fit-badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 900; }
.fit-fits { background: #ecfdf3; color: var(--green); }
.fit-stretch { background: #fffbeb; color: var(--gold); }
.fit-big, .fit-parcel { background: #fef2f2; color: var(--red); }
span.fit-fits, span.fit-stretch, span.fit-big, span.fit-parcel { padding: 1px 7px; border-radius: 12px; font-weight: 900; }
.ai-box { margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.ai-box p { margin: 0 0 8px; line-height: 1.5; }
.ai-box p:last-child { margin-bottom: 0; }
#ai-tunnel { margin-top: 12px; }

/* Market data + saved sites (2026-10-13) */
.market-hint { margin: 0 0 12px; }
.market-grid label { align-content: start; }
.market-grid .src { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: none; letter-spacing: 0; line-height: 1.35; min-height: 15px; }
.market-grid .src[data-kind="you"] { color: var(--accent-dark); }
.market-grid .src[data-kind="est"] { color: #b45309; }
.saved-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.saved-row .secondary { min-height: 42px; white-space: nowrap; }
.saved-row .secondary[data-saved="yes"] { color: var(--accent-dark); }
.wash-pop a { color: var(--accent-dark); }
.search-msg { margin: -4px 0 0; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.search-msg[data-kind="ok"] { color: var(--green, #15803d); }
.search-msg[data-kind="warn"] { color: #b45309; }
.search-msg[data-kind="error"] { color: var(--red, #b91c1c); font-weight: 650; }
.map-style-switch { display: flex; gap: 2px; padding: 3px; background: rgba(255,255,255,0.96); border-radius: 10px; box-shadow: 0 2px 10px rgba(15,23,42,0.22); }
.map-style-switch button { min-height: 32px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: #334155; font: 700 13px/1 system-ui, -apple-system, sans-serif; cursor: pointer; }
.map-style-switch button:hover { background: #eef2f7; }
.map-style-switch button.on { background: var(--accent, #2f7dbf); color: #fff; }

/* Accounts (2026-10-13) */
.auth-overlay { position: fixed; inset: 0; z-index: 5000; display: grid; place-items: center; padding: 18px; background: rgba(15, 23, 42, 0.62); backdrop-filter: blur(4px); }
.auth-overlay[hidden] { display: none; }
.auth-card { width: min(400px, 100%); display: grid; gap: 14px; padding: 26px; border-radius: 16px; background: #fff; box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35); }
.auth-brand { display: flex; gap: 10px; align-items: center; }
.auth-brand strong { display: block; font-size: 16px; }
.auth-brand small { color: var(--muted); font-size: 12px; }
.auth-card h2 { margin: 4px 0 0; font-size: 20px; }
.auth-submit { min-height: 46px; border-radius: 10px; background: var(--accent, #2f7dbf); color: #fff; font-weight: 800; font-size: 15px; }
.auth-submit:disabled { opacity: 0.6; }
.auth-error { margin: 0; color: var(--red, #b91c1c); font-size: 13px; font-weight: 650; }
.auth-switch, .auth-fine { margin: 0; font-size: 13px; color: var(--muted); text-align: center; }
.auth-switch a { color: var(--accent-dark, #1f5f96); font-weight: 750; }
.topbar-user { color: rgba(255,255,255,0.78); font-size: 13px; font-weight: 650; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-btn { cursor: pointer; }
a.topbar-pill { text-decoration: none; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.radius-control { margin-bottom: 12px; }
.radius-control > span { display: flex; justify-content: space-between; align-items: center; }
.radius-control output { color: var(--accent-dark); font-weight: 850; }
.radius-control .src { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: none; line-height: 1.35; }
.neighbors { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line, #e5e7eb); }
.nb-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.nb-score { padding: 3px 9px; border-radius: 999px; background: #eaf2fb; color: var(--accent-dark, #1f5f96); font-weight: 850; font-size: 12px; }
.nb-sum { margin: 6px 0 8px; color: var(--muted); font-size: 12px; }
.nb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.nb-list li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 8px; border-radius: 8px; background: #f8fafc; }
.nb-list li.anchor { background: #eaf2fb; font-weight: 750; }
.nb-list em { font-style: normal; color: var(--muted); white-space: nowrap; }

/* ---------- Phone layout (2026-10-13). Desktop untouched. ---------- */
[hidden] { display: none !important; }

@media (max-width: 820px) {
  html { -webkit-text-size-adjust: 100%; }
  body { padding-top: 56px; }
  input, select, textarea { font-size: 16px !important; } /* stops iPhone zoom-on-tap */

  /* Top bar: one clean line */
  .topbar { height: 56px; padding: 0 10px; gap: 8px; }
  .topbar-brand { min-width: 0; gap: 8px; }
  .topbar-brand strong { font-size: 16px; white-space: nowrap; }
  .topbar-brand small, .topbar-user { display: none !important; }
  .topbar-actions { display: flex !important; gap: 6px; flex-shrink: 0; }
  .topbar-pill { min-height: 32px; padding: 0 10px; font-size: 12px; white-space: nowrap; display: inline-flex; align-items: center; }

  /* Field order: search, map, results, then the detailed inputs */
  .app-shell { display: flex !important; flex-direction: column; }
  .sidebar, .workspace { display: contents !important; }
  .sidebar > .panel, .workspace > section { margin: 0 10px 12px; }
  .sidebar > .panel:nth-of-type(1) { order: 1; margin-top: 10px; }
  .map-band { order: 2; margin: 0 0 12px !important; height: 52vh !important; min-height: 300px; border-radius: 0; }
  .summary-grid { order: 3; }
  .sidebar > .panel:nth-of-type(4) { order: 4; }
  .sidebar > .panel:nth-of-type(5) { order: 5; }
  .content-grid { order: 6; }
  .sidebar > .panel:nth-of-type(2) { order: 7; }
  .sidebar > .panel:nth-of-type(3) { order: 8; }

  /* Results: score full width, key numbers two across */
  .summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .summary-grid .score-panel { grid-column: 1 / -1; flex-direction: row; align-items: center; }
  .metric-card { min-height: 0; padding: 12px; }
  .metric-card strong { font-size: 22px; }

  /* Panels */
  .panel, .report-panel { padding: 14px; border-radius: 14px; }
  .section-title h2, .report-header h2 { font-size: 17px; }
  .input-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .market-grid { grid-template-columns: 1fr; }
  .saved-row { grid-template-columns: minmax(0, 1fr) auto; }
  .saved-row select { min-width: 0; }
  .button-row { flex-wrap: wrap; }
  .button-row > button { flex: 1 1 140px; }

  /* Collapsible input panels */
  .panel.collapsible > .section-title { cursor: pointer; user-select: none; }
  .panel.collapsible > .section-title::after { content: "Show"; margin-left: auto; font-size: 12px; font-weight: 800; color: var(--accent-dark, #1f5f96); }
  .panel.collapsible.open > .section-title::after { content: "Hide"; }
  .panel.collapsible:not(.open) > :not(.section-title) { display: none !important; }
  .panel.collapsible:not(.open) > .section-title { margin-bottom: 0; }

  /* Wide tables scroll inside their box, never the page */
  .tunnel-table, .radius-table { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Map controls big enough for thumbs */
  .map-style-switch button { min-height: 36px; padding: 0 12px; }
  .leaflet-control-zoom a { width: 36px !important; height: 36px !important; line-height: 36px !important; }

  .auth-card { padding: 22px 18px; }
}

@media (max-width: 380px) {
  .input-grid, .summary-grid { grid-template-columns: 1fr; }
}

/* Field help tooltips (2026-10-13) */
.lbl { min-width: 0; }
.tip {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  margin-left: 5px;
  vertical-align: -2px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  color: #94a3b8;
  font: italic 800 10px/1 Georgia, "Times New Roman", serif;
  text-transform: none;
  letter-spacing: 0;
  cursor: help;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.tip::before { content: ""; position: absolute; inset: -9px; } /* bigger tap target */
.tip:hover, .tip:focus-visible, .tip.open { color: var(--accent); }
.tip:focus-visible { box-shadow: 0 0 0 3px rgba(47, 125, 191, 0.25); }
.tip-bubble {
  position: fixed;
  left: var(--tip-x, 8px);
  top: var(--tip-y, 8px);
  z-index: 4000;
  width: max-content;
  max-width: min(260px, calc(100vw - 16px));
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--navy);
  color: #fff;
  box-shadow: var(--shadow-lg);
  font: normal 550 12.5px/1.45 -apple-system, BlinkMacSystemFont, Inter, "Segoe UI", system-ui, sans-serif;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  white-space: normal;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.12s ease, visibility 0.12s;
}
@media (hover: hover) { .tip:hover .tip-bubble { visibility: visible; opacity: 1; } }
.tip:focus-visible .tip-bubble, .tip.open .tip-bubble { visibility: visible; opacity: 1; }
@media print { .tip { display: none; } }

/* ---------- Parcel panel (real county appraisal data) ---------- */
.parcel-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
.parcel-head .eyebrow { display: block; margin: 0 0 2px; }
.parcel-owner { display: block; font-size: 1.15rem; line-height: 1.25; }
.parcel-head small { display: block; color: var(--muted); }
.parcel-size { font-size: 1rem; text-align: right; }
.parcel-size small { color: var(--muted); }
.parcel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 18px; margin: 0; }
.parcel-grid > div { min-width: 0; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.parcel-grid dt { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--warm-muted); margin-bottom: 2px; }
.parcel-grid dd { margin: 0; overflow-wrap: anywhere; }
.parcel-grid dd small { color: var(--muted); }
.parcel-body .na { color: var(--muted); font-style: italic; }
.flag-high { color: var(--red); font-weight: 700; }
.parcel-src { margin: 10px 0 0; font-size: 0.82rem; color: var(--muted); }
.parcel-src a { color: var(--accent-dark); font-weight: 700; }
.parcel-tip { font-size: 12px; }
.parcel-toggle button { white-space: nowrap; }
@media (max-width: 520px) {
  .parcel-grid { grid-template-columns: 1fr; }
  .parcel-size { text-align: left; }
}
@media print { .parcel-src a { color: inherit; } }

/* Keep Leaflet controls (z-index 1000) inside the map so they never float over the sticky top bar. */
#map { isolation: isolate; }

/* Area research and acquisition study. */
[hidden] { display: none !important; }
.project-mode-label { display: grid; gap: 6px; margin: 12px 0; }
.project-mode-label select { width: 100%; min-height: 42px; }
.area-ai-panel { margin-bottom: 16px; }
.area-ai-panel textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--line, #d8dfe8); border-radius: 10px; padding: 12px; font: inherit; resize: vertical; min-height: 80px; margin-top: 8px; }
.area-ai-controls { display: flex; align-items: end; gap: 10px; margin: 12px 0; }
.area-ai-controls label { flex: 1; display: grid; gap: 6px; }
.area-ai-controls input { width: 100%; box-sizing: border-box; }
.area-ai-controls button { min-height: 44px; white-space: nowrap; }
.area-ai-examples { display: flex; flex-wrap: wrap; gap: 8px; }
.area-ai-examples button { border: 1px solid #d4dde8; background: #f3f6fa; color: #274665; padding: 8px 12px; border-radius: 20px; cursor: pointer; }
.area-candidates { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 10px; }
.area-candidates article { border: 1px solid #d4dde8; border-radius: 10px; padding: 12px; }
.area-candidates button { display: block; margin-top: 10px; }
#area-ai-results { overflow-wrap: anywhere; }
#area-ai-results li { margin-bottom: 8px; }
.deal-basis { grid-column: 1 / -1; font-size: 13px; line-height: 1.6; color: #516077; }
@media (max-width: 600px) { .area-ai-controls { flex-wrap: wrap; } .area-ai-controls label { flex-basis: 100%; } .area-ai-controls button { flex: 1; } .area-candidates { grid-template-columns: 1fr; } }
@media print { .area-ai-controls, .area-ai-examples, .area-candidates button { display: none; } }
@media (max-width: 820px) {
  html, body { max-width: 100%; overflow-x: clip; }
}

/* Industry-specific property screening and conversational research. */
.industry-market-panel{margin:18px 0}.industry-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.industry-metric{border:1px solid #dbe4ed;border-radius:12px;padding:14px;background:#f8fafc;display:flex;flex-direction:column;gap:7px;min-width:0}.industry-metric>span{font-size:12px;font-weight:700;color:#475569}.industry-metric>strong{font-size:23px;color:#0f172a}.industry-metric>small{font-size:11px;color:#475569;line-height:1.5}.industry-columns{display:grid;grid-template-columns:1fr 1fr;gap:26px}.industry-columns h3{font-size:15px;margin:16px 0 10px}.industry-columns li{font-size:13px;line-height:1.6;margin:5px 0}.industry-competitors{display:grid;gap:8px;max-height:360px;overflow:auto}.industry-competitors article{display:flex;flex-direction:column;gap:4px;padding:10px 12px;border:1px solid #e2e8f0;border-radius:9px}.industry-competitors span,.industry-competitors small{font-size:12px;color:#475569}.ai-conversation{display:grid;gap:12px;max-height:480px;overflow:auto;margin-bottom:14px;overflow-wrap:anywhere}.ai-message{padding:14px;border-radius:12px;background:#f1f5f9;line-height:1.65;font-size:14px;white-space:pre-wrap}.ai-message.user{background:#e0f2fe;margin-left:10%}.ai-message.assistant{background:#f8fafc;border:1px solid #dbe4ed;margin-right:3%}.ai-message strong{display:block;margin-bottom:7px;color:#0f172a}.sizing-inputs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:14px 0}.sizing-inputs label{font-size:12px}.sizing-inputs input{width:100%;min-width:0}.fit-review{color:#475569;background:#f1f5f9}
@media(max-width:700px){.industry-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.industry-columns{grid-template-columns:1fr;gap:8px}.sizing-inputs{grid-template-columns:1fr}.industry-metric>strong{font-size:20px}.area-ai-panel .report-header{flex-wrap:wrap;gap:10px}}

.property-voice{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:12px 0}.voice-toggle{display:flex;align-items:center;gap:7px;font-size:13px}.voice-toggle input{width:18px;height:18px;margin:0}#voice-audio{width:100%;max-width:420px;margin:8px 0}#voice-audio[hidden]{display:none}

.property-brief-panel{margin:18px 0}.property-brief-panel>h2{font-size:24px;margin:8px 0}.property-brief-panel p{line-height:1.6}.brief-columns{display:grid;grid-template-columns:1fr 1fr;gap:24px}.brief-columns h3{font-size:16px;margin:16px 0 8px}.brief-columns li{font-size:14px;line-height:1.65;margin:8px 0;overflow-wrap:anywhere}.context-sources{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:12px 0}.context-source{display:flex;flex-direction:column;gap:8px;padding:14px;border:1px solid #dbe4ed;border-radius:12px;background:#f8fafc;overflow-wrap:anywhere}.context-source strong{font-size:13px}.context-source span,.context-source a{font-size:12px;line-height:1.5}.evidence-sources{border-top:1px solid #dbe4ed;margin-top:16px;padding-top:14px}.evidence-sources summary{cursor:pointer;font-weight:700}.metric-card strong{overflow-wrap:anywhere;max-width:100%}@media(max-width:800px){.brief-columns,.context-sources{grid-template-columns:1fr;gap:6px}.property-brief-panel>h2{font-size:22px}}

.delete-site{color:#9f1239;justify-content:center;min-height:44px}.saved-site-notice{display:flex;align-items:center;gap:8px;flex-wrap:wrap;border:1px solid #cbd5e1;background:#f1f5f9;border-radius:10px;padding:10px;font-size:12px;line-height:1.5}.saved-site-notice span{flex:1;min-width:0;overflow-wrap:anywhere}.saved-site-notice button{min-height:40px}

.property-brief-panel{scroll-margin-top:85px}
