:root {
  color-scheme: light;
  --bg: #f3f6f8;
  --surface: #ffffff;
  --surface-2: #edf5f6;
  --text: #12202a;
  --muted: #60707f;
  --line: #d8e1e7;
  --accent: #0f766e;
  --accent-2: #2563eb;
  --low: #166534;
  --medium: #a16207;
  --high: #991b1b;
  --unknown: #4b5563;
  --shadow: 0 14px 34px rgba(16, 36, 49, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #eaf2f4 0, var(--bg) 220px),
    var(--bg);
  color: var(--text);
}

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 18px clamp(16px, 4vw, 44px);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 23px;
  font-weight: 720;
  letter-spacing: 0;
}

h2 {
  font-size: 16px;
  margin-bottom: 14px;
}

.topbar p {
  color: var(--muted);
  font-size: 14px;
  margin-top: 2px;
}

.topnav {
  align-items: center;
  display: flex;
  gap: 8px;
}

.topnav a {
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  padding: 8px 10px;
  text-decoration: none;
}

.topnav a:hover,
.topnav a.active {
  background: #e8f4f2;
  border-color: #b9d8d4;
  color: var(--accent);
}

.badge {
  background: #0f172a;
  border: 1px solid #0f172a;
  border-radius: 8px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 8px;
}

main {
  margin: 0 auto;
  max-width: 1380px;
  padding: 24px clamp(14px, 3vw, 32px) 40px;
}

.query-panel,
.panel,
.summary,
.status {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.query-panel {
  padding: 16px;
}

form {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(180px, 1.2fr) minmax(130px, 0.9fr) minmax(100px, 0.6fr) minmax(72px, 0.45fr) minmax(92px, 0.55fr) auto;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 700;
  gap: 6px;
  text-transform: uppercase;
}

input,
select {
  border: 1px solid #c9d1df;
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  min-height: 42px;
  padding: 9px 10px;
  width: 100%;
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 118, 110, 0.14);
}

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

button {
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  min-height: 42px;
  padding: 0 14px;
  white-space: nowrap;
}

button.secondary {
  background: #ffffff;
  border-color: #b9c3d1;
  color: var(--text);
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.status {
  color: var(--muted);
  margin-top: 16px;
  padding: 14px 16px;
}

.neighborhood-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-top: 16px;
  padding: 16px;
}

.neighborhood-header {
  align-items: end;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.neighborhood-header h2 {
  font-size: 18px;
  margin: 0;
}

.neighborhood-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: end;
}

.neighborhood-actions input {
  min-width: 190px;
}

.neighborhood-actions select {
  width: auto;
}

.neighborhood-layout {
  align-items: stretch;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) 360px;
  margin-top: 14px;
}

.neighborhood-map-wrap {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.neighborhood-map {
  min-height: 420px;
}

.neighborhood-map svg {
  display: block;
  height: 420px;
  width: 100%;
}

.neighborhood-water {
  fill: #e6f0f2;
}

.neighborhood-shape {
  cursor: pointer;
  opacity: 0.9;
  stroke: #ffffff;
  stroke-linejoin: round;
  stroke-width: 2.5;
  transition: opacity 120ms ease, stroke-width 120ms ease, transform 120ms ease;
}

.neighborhood-shape:hover,
.neighborhood-shape:focus,
.neighborhood-shape.selected {
  opacity: 1;
  outline: none;
  stroke: #0f172a;
  stroke-width: 4;
}

.risk-fill-low {
  fill: #4ade80;
}

.risk-fill-medium {
  fill: #f59e0b;
}

.risk-fill-high {
  fill: #ef4444;
}

.risk-fill-unknown {
  fill: #94a3b8;
}

.map-note {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 10px 12px;
}

.neighborhood-detail {
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.detail-title-row {
  align-items: start;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.detail-title-row h3 {
  font-size: 20px;
  line-height: 1.2;
  margin: 0;
}

.neighborhood-detail p {
  color: #405060;
  font-size: 14px;
  line-height: 1.45;
  margin-top: 10px;
}

.neighborhood-detail h4 {
  font-size: 13px;
  margin: 14px 0 8px;
  text-transform: uppercase;
}

.neighborhood-metrics {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
  margin-top: 14px;
}

.metric-item {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
}

.metric-item span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-item strong {
  display: block;
  font-size: 14px;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.detail-list {
  font-size: 13px;
}

.neighborhood-table {
  margin-top: 14px;
}

.table-link {
  background: transparent;
  border: 0;
  color: #0f5f59;
  font-size: 14px;
  font-weight: 800;
  min-height: 0;
  padding: 0;
  text-align: left;
  white-space: normal;
}

.table-link:hover {
  text-decoration: underline;
}

.mini-risk {
  border-radius: 7px;
  color: #ffffff;
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 7px;
  text-transform: capitalize;
}

.query-meta {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.validation-pill,
.query-hint {
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 10px;
}

.query-hint {
  color: var(--muted);
  font-weight: 600;
}

.validation-idle {
  background: #f8fafc;
  color: #475569;
}

.validation-valid {
  background: #dcfce7;
  border-color: #bbf7d0;
  color: #166534;
}

.validation-invalid {
  background: #fee2e2;
  border-color: #fecaca;
  color: #991b1b;
}

.report {
  margin-top: 16px;
}

.buyer-brief {
  align-items: center;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: 16px;
}

.buyer-brief p {
  color: #263544;
  font-size: 16px;
  line-height: 1.48;
}

.score-guide {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: end;
  max-width: 390px;
}

.score-guide span {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  padding: 7px 9px;
  white-space: nowrap;
}

.summary {
  display: grid;
  gap: 12px;
  grid-template-columns: 0.7fr 0.5fr 0.7fr 1.8fr;
  padding: 16px;
}

.summary > div {
  border-right: 1px solid var(--line);
  min-width: 0;
  padding-right: 12px;
}

.summary > div:last-child {
  border-right: 0;
}

.eyebrow {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.summary strong {
  display: block;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.risk-pill {
  border-radius: 8px;
  color: #ffffff;
  display: inline-block;
  padding: 7px 10px;
  text-transform: capitalize;
}

.risk-low {
  background: var(--low);
}

.risk-medium {
  background: var(--medium);
}

.risk-high {
  background: var(--high);
}

.risk-unknown {
  background: var(--unknown);
}

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

.report-body {
  align-items: start;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) 380px;
  margin-top: 16px;
}

.panel {
  padding: 16px;
}

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

.visual-stack {
  display: grid;
  gap: 16px;
  position: sticky;
  top: 94px;
}

.visual-card {
  overflow: hidden;
}

.map-frame {
  background: #dbeafe;
  border: 1px solid var(--line);
  border-radius: 8px;
  height: 190px;
  margin-top: 10px;
  overflow: hidden;
}

.map-frame iframe {
  border: 0;
  height: 100%;
  width: 100%;
}

.map-empty {
  align-items: center;
  color: var(--muted);
  display: flex;
  height: 100%;
  justify-content: center;
}

.photo-preview {
  align-items: end;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.82), rgba(37, 99, 235, 0.38)),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.2) 0 22px, rgba(255,255,255,0.08) 22px 44px),
    #12323d;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #ffffff;
  display: flex;
  height: 260px;
  padding: 12px;
}

.photo-embedded {
  background: #e2e8f0;
  display: block;
  padding: 0;
}

.photo-embedded iframe {
  border: 0;
  height: 100%;
  width: 100%;
}

.photo-image {
  background: #e2e8f0;
  display: block;
  overflow: hidden;
  padding: 0;
  position: relative;
}

.photo-image img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.photo-label {
  background: rgba(15, 23, 42, 0.76);
  border-radius: 6px;
  color: #ffffff;
  display: grid;
  gap: 2px;
  left: 10px;
  max-width: calc(100% - 20px);
  padding: 8px 9px;
  position: absolute;
  top: 10px;
}

.photo-preview div {
  display: grid;
  gap: 2px;
}

.photo-preview strong {
  font-size: 16px;
}

.photo-preview span {
  color: rgba(255,255,255,0.82);
  font-size: 13px;
  font-weight: 700;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.link-button {
  background: #eef6f6;
  border: 1px solid #cce3e0;
  border-radius: 6px;
  color: #0f5f59;
  font-size: 13px;
  font-weight: 800;
  padding: 8px 10px;
  text-decoration: none;
}

.link-button:hover {
  border-color: var(--accent);
}

.row-action {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.context-list {
  display: grid;
  gap: 10px;
}

.context-item {
  align-items: start;
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 12px;
}

.context-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.context-value {
  color: #12202a;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
  margin-top: 3px;
}

.context-item p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  margin-top: 5px;
}

.listing-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin-top: 8px;
}

.listing-status {
  color: #0f172a;
  font-size: 20px;
  font-weight: 800;
}

.source-chips {
  display: grid;
  gap: 12px;
}

.source-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.source-chip {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 9px;
  text-transform: capitalize;
}

.source-chip strong {
  color: #0f172a;
}

.source-ok {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #166534;
}

.source-warn {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.source-muted {
  background: #f8fafc;
  color: #64748b;
}

.source-details {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.source-details summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.source-detail-list {
  display: grid;
  gap: 9px;
  margin-top: 10px;
}

.source-detail {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.source-detail strong,
.source-detail span {
  display: block;
}

.source-detail strong {
  font-size: 12px;
  text-transform: uppercase;
}

.source-detail span {
  color: #243244;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  margin-top: 3px;
}

.source-detail p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  margin-top: 5px;
}

.clean-list {
  display: grid;
  gap: 9px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.clean-list li {
  border-left: 3px solid var(--line);
  color: #283241;
  line-height: 1.42;
  padding-left: 10px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 720px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.empty {
  color: var(--muted);
  font-size: 14px;
}

.disclaimer {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin-top: 18px;
}

.chooser {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 32px;
}

.chooser h2 {
  margin: 0;
}

.chooser-lead {
  color: var(--muted);
  margin: 6px 0 24px;
}

.chooser-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(2, 1fr);
}

.chooser-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.chooser-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.chooser-card h3 {
  margin: 0;
}

.chooser-card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
  flex: 1;
}

.chooser-go {
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
  margin-top: 8px;
}

@media (max-width: 840px) {
  .chooser-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 840px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .topnav {
    width: 100%;
  }

  .topnav a {
    flex: 1;
    text-align: center;
  }

  form,
  .summary,
  .buyer-brief,
  .content-grid,
  .report-body,
  .neighborhood-layout {
    grid-template-columns: 1fr;
  }

  .neighborhood-header {
    align-items: stretch;
    flex-direction: column;
  }

  .neighborhood-actions {
    justify-content: stretch;
  }

  .neighborhood-actions input,
  .neighborhood-actions select,
  .neighborhood-actions button {
    flex: 1 1 150px;
  }

  .neighborhood-map,
  .neighborhood-map svg {
    min-height: 320px;
    height: 320px;
  }

  .summary > div {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    padding-bottom: 10px;
  }

  .summary > div:last-child {
    border-bottom: 0;
  }

  .form-actions {
    justify-content: stretch;
  }

  .form-actions button {
    flex: 1;
  }

  .query-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .score-guide {
    justify-content: start;
    max-width: none;
  }

  .context-item {
    grid-template-columns: 1fr;
  }

  .visual-stack {
    position: static;
  }
}
