/* Layout follows the UX doc's information architecture: search on top,
   map upper-left, details beside the map, matrix below. Sequential orange
   palette; color never carries meaning alone (legend labels + tooltips). */

:root {
  --accent: #e6550d;
  --border: #d0d0d0;
  --text: #24292e;
  --muted: #6a737d;
}

* { box-sizing: border-box; }

/* The dashboard renders INSIDE the Zolan site chrome (layout: default in
   index.html) — typography and page font come from the site theme, so this
   sheet scopes everything under .dashboard-app and styles only the app. */
.dashboard-app {
  margin: 0 auto;
  max-width: 1080px;
  padding: 0 16px 32px;
  color: var(--text);
  line-height: 1.5;
}

.dashboard-app header h1 { margin: 20px 0 4px; font-size: 1.5rem; }
.subtitle { margin: 0 0 16px; color: var(--muted); max-width: 70ch; }
.subtitle em { color: var(--accent); font-style: normal; font-weight: 600; }

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafafa;
}
.controls label { font-weight: 600; font-size: 0.9rem; }
.controls input, .controls select {
  padding: 6px 10px;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 220px;
}
.controls input:focus, .controls select:focus { outline: 2px solid var(--accent); }
#search-message {
  font-size: 0.85rem;
  color: var(--accent);
}
#search-message:empty { display: none; }

#load-error {
  margin-top: 20px;
  padding: 14px 16px;
  border: 1px solid var(--accent);
  border-left-width: 4px;
  border-radius: 8px;
  background: #fff7f2;
}
#load-error strong { display: block; margin-bottom: 6px; font-size: 1.05rem; }
#load-error p { margin: 6px 0; font-size: 0.92rem; }
#load-error a { color: var(--accent); }
#load-error code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: #f0f0f0;
  padding: 1px 5px;
  border-radius: 4px;
}

.dashboard-main {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(260px, 2fr);
  gap: 20px;
  margin-top: 20px;
}
@media (max-width: 760px) { .dashboard-main { grid-template-columns: 1fr; } }

#map-section { position: relative; }
#map { width: 100%; height: auto; display: block; touch-action: none; }

.county {
  stroke: #ffffff;
  stroke-width: 0.8;
  cursor: pointer;
  /* Keep outlines hairline regardless of the viewBox zoom level: stroke-width
     is interpreted in screen px, not scaled SVG units. */
  vector-effect: non-scaling-stroke;
}
.county:hover, .county:focus { stroke: var(--text); stroke-width: 1.6; outline: none; }
.county.selected { stroke: var(--text); stroke-width: 2.2; }

/* Zoom controls overlaid on the map's top-right corner. */
.zoom-controls {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.zoom-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.zoom-btn:hover { background: #f2f2f2; }
.zoom-btn:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.zoom-btn:active { background: #e8e8e8; }

#legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 8px;
  font-size: 0.85rem;
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-swatch {
  width: 18px; height: 14px;
  border: 1px solid var(--border);
  display: inline-block;
}
.map-note { font-size: 0.8rem; color: var(--muted); margin-top: 6px; }

#details {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  align-self: start;
}
#details h2 { margin: 0 0 6px; font-size: 1.15rem; }
#details-hint { color: var(--muted); font-size: 0.9rem; }
.detail-group h3 {
  margin: 14px 0 4px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 3px;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.92rem;
  padding: 2px 0;
}
.detail-row .value { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.detail-row .value.na { color: var(--muted); font-weight: 400; }

/* Per-county recommendation (docs/DECISIONS.md 2026-07-07): rendered as the
   first detail-group so the priority class + action is the first thing read. */
.detail-group.recommendation h3 { color: var(--text); border-bottom-color: var(--accent); }
.recommendation-rule { color: var(--muted); font-size: 0.85rem; margin: 4px 0 8px; }
.recommendation-action { margin: 0 0 8px; }
.recommendation-drivers-label { margin: 0 0 2px; font-size: 0.85rem; color: var(--muted); }
.recommendation-drivers { margin: 0; padding-left: 20px; font-size: 0.92rem; }

#matrix-section {
  margin-top: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}
#matrix-section h2 { margin: 0 0 8px; font-size: 1.15rem; }
#matrix-placeholder .pending {
  color: var(--muted);
  font-style: italic;
}

/* Risk vs Access scatter. Vector SVG scaled to the section width; dots reuse
   the accent orange and get the same .selected stroke emphasis as map counties. */
#matrix-svg { width: 100%; height: auto; display: block; max-width: 640px; margin: 0 auto; }

.mtx-frame { fill: none; stroke: var(--border); stroke-width: 1; }
.mtx-axis { stroke: var(--text); stroke-width: 1; }
.mtx-quadrant-line {
  stroke: var(--muted);
  stroke-width: 1;
  stroke-dasharray: 4 3;
}
/* The high-risk + low-access corner: a subtle tint that draws the eye without
   shouting (the deserts / critical-intervention quadrant). */
.mtx-critical-zone { fill: var(--accent); fill-opacity: 0.07; }

.mtx-dot {
  fill: var(--accent);
  fill-opacity: 0.72;
  stroke: #ffffff;
  stroke-width: 0.8;
  cursor: pointer;
}
.mtx-dot:hover, .mtx-dot:focus { stroke: var(--text); stroke-width: 1.6; outline: none; }
.mtx-dot.selected {
  stroke: var(--text);
  stroke-width: 2.2;
  fill-opacity: 1;
}

.mtx-axis-title {
  font-size: 12px;
  font-weight: 600;
  fill: var(--text);
  text-anchor: middle;
}
.mtx-quad-label {
  font-size: 10px;
  fill: var(--muted);
  text-anchor: middle;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.mtx-quad-label-critical { fill: var(--accent); font-weight: 600; }

.mtx-caption {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 8px 0 0;
  max-width: 70ch;
}

.data-credits { margin-top: 24px; font-size: 0.85rem; color: var(--muted); }
