/* ── Pulse ── */
/* One rectangle: both columns stretch to the same row height at any zoom.
   The right column's content sets that height; the map stage flexes to
   fill its card, and if the map's minimum is taller, Top issues (the last
   row, 1fr) absorbs the difference. */
.pv-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: var(--gap); align-items: stretch; }
.pv-side { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; gap: var(--gap); min-width: 0; }
.pv-side > .card { min-width: 0; }
.pv > .pv-grid > *, .pv-side > * { transition: opacity 0.2s var(--ease); }
.pv.is-loading .pv-side > * { opacity: 0.55; }
.pv.is-stale .pv-grid { opacity: 0.35; filter: grayscale(0.6); pointer-events: none; }
.pv-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 16px; color: var(--fg-faint); font-size: 13px; text-align: center; }

/* ── KPIs: label, number, one line of context. Tiles that open a slice
   of complaints are links; the total isn't (the header action is). ── */
.pv-kpis { overflow: hidden; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { position: relative; display: flex; flex-direction: column; gap: 4px; padding: var(--pad); min-width: 0; }
.kpi + .kpi::before { content: ''; position: absolute; left: 0; top: var(--pad); bottom: var(--pad); border-left: 1px solid var(--line); }
.kpi.is-link { transition: background 0.15s; }
.kpi.is-link:hover { background: var(--raised); }
.kpi.is-link:hover::before, .kpi.is-link:hover + .kpi::before { opacity: 0; }
.kpi-go { position: absolute; top: var(--pad); right: var(--pad); color: var(--fg-faint); opacity: 0; transition: opacity 0.15s; }
.kpi.is-link:hover .kpi-go { opacity: 1; color: var(--brand); }
.kpi-l { font-size: 12.5px; font-weight: 500; color: var(--fg-muted); }
.kpi-v { font-family: var(--display); font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.kpi-v i { font-style: normal; font-size: 18px; color: var(--fg-muted); margin-left: 1px; }
.kpi-s { font-size: 11.5px; color: var(--fg-faint); }
.kpi-s .delta { font-size: 12px; }

/* ── trend ── */
.pv-trend-body { position: relative; padding: 8px var(--pad) var(--pad) calc(var(--pad) - 14px); min-height: 200px; overflow: hidden; } /* the chart can never widen its card */
.trend-svg { display: block; overflow: visible; }
.trend-svg .tg { stroke: var(--line); stroke-dasharray: 2 4; }
.trend-svg .tl { fill: var(--fg-faint); font-size: 11px; font-family: var(--body); }
.trend-svg .tline { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend-svg .tdot { fill: var(--brand-hi); stroke: var(--surface); stroke-width: 2; }
.trend-svg .tcross { stroke: var(--fg-faint); stroke-dasharray: 3 3; }
.trend-svg .thit { cursor: crosshair; }
.ttip { position: absolute; pointer-events: none; display: flex; flex-direction: column; gap: 1px; padding: 7px 10px; border-radius: var(--r-sm); font-size: 11.5px; color: var(--fg-muted); background: var(--raised); border: 1px solid var(--line-2); box-shadow: var(--shadow); white-space: nowrap; }
.ttip b { color: var(--fg); font-size: 13px; }

/* ── top issues ── */
.issues { list-style: none; padding: 8px calc(var(--pad) - 10px) calc(var(--pad) - 10px); }
.issue { border-radius: var(--r-sm); }
.issue.is-sel { background: var(--brand-tint); box-shadow: inset 0 0 0 1px var(--brand-deep); }
.issue-btn { display: grid; grid-template-columns: 26px minmax(0, 1fr) minmax(56px, 22%) 48px 58px; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border-radius: var(--r-sm); text-align: left; transition: background 0.15s; }
.issue-btn:hover { background: var(--raised); }
.issue.is-sel .issue-btn:hover { background: transparent; }
.issue-rank { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; font-size: 11.5px; font-weight: 600; color: var(--fg-muted); background: var(--sunken); border: 1px solid var(--line); }
.issue.is-sel .issue-rank { color: var(--brand-hi); border-color: var(--brand-deep); }
.issue-name { display: flex; flex-direction: column; min-width: 0; }
.issue-name b { font-size: 13px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.issue-name small { font-size: 11px; color: var(--fg-faint); }
.issue-bar { height: 7px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.issue-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand-deep), var(--brand)); }
.issue-n { font-size: 13px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.issue-d { font-size: 11.5px; text-align: right; }
.issue-go { display: flex; align-items: center; justify-content: flex-end; gap: 5px; padding: 0 10px 10px; font-size: 12.5px; font-weight: 600; color: var(--brand-hi); }
:root[data-theme='light'] .issue-go { color: var(--brand-deep); }
.issue-go:hover { text-decoration: underline; }

/* ── map card ── */
.pv-map { overflow: hidden; display: flex; flex-direction: column; }
#pvMap, .gm { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.pv-sel { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: var(--gap) var(--pad) 0; padding: 12px 14px; border-radius: var(--r-sm); background: var(--raised); border: 1px solid var(--line-2); }
.pv-sel-owner { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--fg-muted); }
.pv-sel-owner b { color: var(--fg); font-weight: 600; }
.pv-sel-owner:hover b { color: var(--brand); }
.pv-sel-main { display: flex; flex-direction: column; min-width: 0; flex: 1 1 160px; }
.pv-sel-k { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-faint); font-weight: 600; }
.pv-sel-name { font-family: var(--display); font-size: 17px; font-weight: 650; }
.pv-sel-main small { font-size: 11.5px; color: var(--fg-muted); }
.pv-sel-stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--fg-muted); }
.pv-sel-stats b { color: var(--fg); font-variant-numeric: tabular-nums; }
.pv-sel-act { display: flex; gap: 6px; align-items: center; }

.gm-stage { position: relative; flex: 1; min-height: 440px; margin-top: var(--gap); transition: opacity 0.2s var(--ease); }
.gm-stage.is-loading { opacity: 0.55; }
/* out of flow: the map fills the stage and never sizes it (the city's tall
   aspect ratio would otherwise set the row height) */
.gm-svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: pan-y; cursor: grab; user-select: none; }
.gm-svg.is-zoomed { touch-action: none; }
.gm-svg.is-panning { cursor: grabbing; }
.gm-shapes path { stroke: var(--map-edge); stroke-width: 0.6; vector-effect: non-scaling-stroke; cursor: pointer; transition: opacity 0.15s, filter 0.15s; }
.gm-shapes path:hover { filter: brightness(1.25); stroke: var(--fg); stroke-width: 1.2; }
.gm-shapes.has-sel path.is-empty { fill: var(--map-void); stroke: var(--map-void); }
.gm-shapes.has-sel path.is-empty:hover { filter: none; stroke: var(--line-2); }
.gm-gcc { fill: none; stroke: var(--brand); stroke-opacity: 0.8; stroke-width: 1.4; vector-effect: non-scaling-stroke; pointer-events: none; }

/* jurisdiction note: below the map (never over it), in the card's own inset */
.gm-note { flex: none; margin: 0; padding: 10px var(--pad) var(--pad); font-size: 11.5px; line-height: 1.45; color: var(--fg-faint); }
.gm-zoom { position: absolute; top: 0; right: var(--pad); display: flex; flex-direction: column; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); overflow: hidden; box-shadow: var(--shadow); }
.gm-zoom button { display: grid; place-items: center; width: 34px; height: 34px; color: var(--fg-muted); }
.gm-zoom button + button { border-top: 1px solid var(--line); }
.gm-zoom button:hover { color: var(--fg); background: var(--raised); }

/* the legend sits below the map (in flow), never over it */
.gm-legend { position: relative; flex: none; align-self: flex-start; width: 200px; margin: var(--gap) var(--pad) 0; padding: 10px 12px 22px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line-2); }
.gm-legend-t { display: block; font-size: 11.5px; color: var(--fg-muted); margin-bottom: 7px; }
.gm-legend-bar { display: block; height: 8px; border-radius: 99px; background: linear-gradient(90deg, var(--map-lo), var(--map-hi)); }
.gm-legend-ticks { position: absolute; left: 12px; right: 12px; bottom: 6px; height: 12px; }
.gm-legend-ticks i { position: absolute; transform: translateX(-50%); font-style: normal; font-size: 10.5px; color: var(--fg-faint); font-variant-numeric: tabular-nums; }
.gm-legend-ticks i:first-child { transform: none; }
.gm-legend-ticks i:last-child { transform: translateX(-100%); }

.gm-tip { position: absolute; z-index: 3; pointer-events: none; min-width: 170px; padding: 10px 12px; border-radius: var(--r-sm); font-size: 12px; background: var(--raised); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); }
.gm-tip > b { display: block; font-family: var(--display); font-size: 14px; margin-bottom: 5px; }
.gm-tip-row { display: flex; justify-content: space-between; gap: 14px; color: var(--fg-muted); line-height: 1.7; }
.gm-tip-row b { color: var(--fg); font-variant-numeric: tabular-nums; }
.gm-tip-empty { color: var(--fg-faint); }
