.plan-main { display: flex; flex-direction: column; gap: 12px; padding-bottom: 16px; }
/* The state plan uses the whole window width. It stays a 2D map; there is no 3D region picker. */
.hx-main.plan-main { max-width: none; }
/* ACQ-TXMAP-2: a framed, map-first page. Header (title, purpose, headline), then the frame: rail · map · panel. */
.plan-head { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: flex-start; justify-content: space-between; }
.plan-head-text { min-width: 0; flex: 1 1 480px; }
.plan-main .plan-title { margin: 0; font-size: 22px; font-weight: 600; line-height: 1.2; }
.plan-head .aq-purpose { margin: 4px 0 0; max-width: 760px; font-size: 14px; line-height: 1.45; color: var(--muted); }
.plan-state { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 600; }
.plan-state select { height: 32px; width: auto; min-width: 140px; }
.plan-headline { margin: 0; max-width: 980px; font-size: 16px; line-height: 1.45; }
.plan-headline a { color: inherit; font-weight: 600; font-variant-numeric: tabular-nums; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.plan-headline a:hover { text-decoration-color: var(--accent); }
.plan-headline a[aria-current="true"] { color: var(--accent); text-decoration-color: var(--accent); }
.plan-kicker { margin: 0 0 8px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

.plan-frame {
  display: grid; grid-template-columns: 264px minmax(0, 1fr) 344px; gap: 12px;
  height: calc(100dvh - var(--bar-h, 60px) - 176px); min-height: 560px;
}
.plan-frame[data-rail="closed"] { grid-template-columns: 208px minmax(0, 1fr) 344px; }
.plan-rail, .plan-panel {
  min-width: 0; min-height: 0; overflow: auto; box-sizing: border-box;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
.plan-rail { display: flex; flex-direction: column; gap: 16px; padding: 16px; font-size: 13px; }
.plan-rail-section { margin: 0; }
.plan-rail-hint { margin: 8px 0 0; font-size: 12px; line-height: 1.45; color: var(--muted); }
.plan-seg { display: flex; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden; }
.plan-seg a {
  flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; height: 32px; padding: 0 8px;
  font-size: 13px; font-weight: 600; color: var(--ink); text-decoration: none; border-right: 1px solid var(--line-strong);
}
.plan-seg a:last-child { border-right: 0; }
.plan-seg a:hover:not([aria-current="true"]) { background: var(--surface-2); }
.plan-seg a[aria-current="true"] { background: var(--accent); color: var(--on-accent); }
.plan-seg a:focus-visible { outline: 2px solid var(--focus, var(--accent)); outline-offset: -2px; }
.plan-legend ul, .plan-layers ul, .plan-models { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.plan-legend li { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 8px; align-items: center; line-height: 1.3; }
.plan-legend-count { font-family: var(--mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.plan-layers label { display: grid; grid-template-columns: 16px 16px minmax(0, 1fr); gap: 8px; align-items: center; cursor: pointer; line-height: 1.3; }
.plan-layers input { margin: 0; accent-color: var(--accent); }
.plan-rail-toggle { align-self: flex-end; margin-bottom: -8px; }
.plan-swatch { width: 16px; height: 12px; border-radius: 4px; display: inline-block; box-sizing: border-box; }
.plan-swatch-line { background: transparent; border: 2px solid currentColor; }
.plan-swatch-none { visibility: hidden; }
.plan-swatch-hatch { background: repeating-linear-gradient(135deg, var(--plan-hatch) 0 2px, transparent 2px 5px); border: 1px dashed var(--plan-hatch); }
.plan-swatch-proposed { background: transparent; border: 2px dashed var(--accent); }
.plan-map-wrap { min-width: 0; min-height: 0; position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.plan-map { position: absolute; inset: 0; }
.plan-map-note {
  position: absolute; z-index: 2; left: 8px; bottom: 8px; margin: 0;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-radius: 6px; padding: 4px 8px; font-size: 12px;
}
.plan-map-note[hidden] { display: none; }
.plan-about { margin-top: 4px; font-size: 13px; }
.plan-about summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.plan-about .plan-vintage { margin-top: 4px; max-width: 980px; }
.plan-vintage { margin: 0; font-size: 12px; line-height: 1.45; }
@media (max-width: 1100px) {
  .plan-frame, .plan-frame[data-rail="closed"] { grid-template-columns: 232px minmax(0, 1fr) 300px; }
}
@media (max-width: 960px) {
  .plan-frame, .plan-frame[data-rail="closed"] { display: flex; flex-direction: column; height: auto; min-height: 0; }
  .plan-map-wrap { order: -1; height: 70vh; flex: none; }
  .plan-rail, .plan-panel { overflow: visible; }
}

/* The panel: proposal, selection, models here, Ask the AI, then the region's facts. */
.plan-panel { padding: 16px; font-size: 13px; line-height: 1.45; }
.plan-panel p { font-size: 13px; }
.plan-panel h2 { margin: 0 0 8px; font-size: 18px; font-weight: 600; line-height: 1.2; }
.plan-panel h3 { margin: 16px 0 8px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.plan-panel-lead { margin: 0 0 8px; font-size: 14px; line-height: 1.45; }
.plan-models li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 8px; align-items: baseline; font-size: 13px; }
.plan-link { appearance: none; border: 0; padding: 0; background: none; color: var(--accent); font: 600 13px/1.3 var(--font); cursor: pointer; text-align: left; }
.plan-link:hover { text-decoration: underline; }
.plan-proposal {
  margin: 0 0 16px; padding: 12px; display: grid; gap: 8px;
  border: 1px dashed var(--accent); border-radius: 10px; background: var(--surface);
}
.plan-proposal p { margin: 0; }
.plan-proposal-kicker { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.plan-proposal-sentence { font-size: 14px; line-height: 1.45; }
.plan-proposal-detail, .plan-proposal-legend { font-size: 13px; line-height: 1.45; color: var(--muted); }
.plan-proposal-legend { display: flex; gap: 8px; align-items: center; }
.plan-proposal-trust { font-size: 11px; color: var(--muted); }
.plan-proposal .plan-actions { margin-top: 0; }
.plan-ask { margin-top: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.plan-panel .plan-ask h3 { margin-top: 0; }
.plan-ask-lead { margin: 0 0 8px; font-size: 13px; line-height: 1.45; }
.plan-ask-examples { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.plan-ask-example {
  appearance: none; width: 100%; text-align: left; padding: 8px 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: 13px/1.4 var(--font);
}
.plan-ask-example:hover { background: var(--soft); }
.plan-ask-example:focus-visible, .plan-link:focus-visible { outline: 2px solid var(--focus, var(--accent)); outline-offset: 2px; }
.plan-flow { display: grid; gap: 8px; font-size: 13px; }
.plan-flow label { display: flex; gap: 8px; align-items: center; }
.plan-flow input[type="number"] { width: 4.5rem; }
.plan-flow p { margin: 0; }
.plan-flow-legend {
  position: absolute; z-index: 4; left: 8px; bottom: 36px; margin: 0; max-width: 280px;
  white-space: pre-line; pointer-events: none;
  background: color-mix(in srgb, var(--hx-card) 92%, transparent);
  border: 1px solid var(--hx-border); border-radius: 6px; padding: 4px 8px; font-size: 12px;
}
.plan-hover {
  position: absolute; z-index: 2; pointer-events: none; max-width: 320px;
  white-space: pre-line;
  background: var(--hx-card); color: var(--hx-fg); border: 1px solid var(--hx-border);
  border-radius: 6px; padding: 4px 8px; font-size: 12px;
}
.plan-map-note {
  position: absolute; z-index: 2; left: 8px; bottom: 8px; margin: 0;
  background: color-mix(in srgb, var(--hx-card) 92%, transparent);
  border-radius: 6px; padding: 4px 8px; font-size: 12px;
}
.plan-facts { display: grid; grid-template-columns: 9rem 1fr; gap: 4px 8px; font-size: 13px; margin: 0; }
.plan-facts dt { color: var(--hx-muted, #667); }
.plan-chip { display: inline-block; border-radius: 999px; padding: 1px 8px; background: var(--aq-hover); font-size: 12px; }
.plan-run .run-hint, .plan-panel .run-hint { margin: 0 0 8px; }
.plan-run.muted { color: var(--hx-muted); }
.plan-run.featured { font-weight: 650; }
.plan-run .run-status { margin-left: 0; }
.plan-pilot { outline: 2px solid var(--finding-proposed); border-radius: 999px; }
.plan-panel ul { margin: 0; padding-left: 18px; font-size: 13px; }
.plan-panel button:disabled { opacity: .65; }
.plan-queue { border: 1px solid var(--hx-border); border-radius: 8px; background: var(--hx-card); padding: 8px 10px; overflow-x: auto; }
.plan-queue summary { cursor: pointer; font-size: 13px; letter-spacing: .03em; text-transform: uppercase; }
.plan-queue-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; font-size: 13px; }
.plan-queue table { width: 100%; border-collapse: collapse; font-size: 13px; }
.plan-queue th, .plan-queue td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--hx-border); vertical-align: top; }
.plan-queue tbody tr { cursor: pointer; }
.plan-queue tbody tr:hover { background: var(--aq-hover); }
.plan-edit label { display: block; margin: 8px 0; font-size: 13px; }
.plan-edit input[type="text"], .plan-edit input[type="number"], .plan-edit input[type="url"], .plan-edit select, .plan-edit textarea {
  display: block; width: 100%; margin-top: 4px; padding: 4px 8px; box-sizing: border-box;
}
.plan-edit-row { display: flex; gap: 8px; align-items: end; }
.plan-edit-row label { flex: 1; }
.plan-preview { border: 1px dashed var(--hx-border); border-radius: 6px; padding: 8px; margin-top: 6px; font-size: 13px; }
.plan-preview-svg svg { width: 160px; height: 100px; display: block; border: 1px solid var(--hx-border); border-radius: 4px; }
.plan-thumb { display: block; margin-top: 8px; }
.plan-thumb img { width: 100%; max-width: 320px; height: auto; display: block; border: 1px solid var(--hx-border); border-radius: 4px; background: #f4f1ea; }
.plan-run-label {
  background: var(--surface); color: var(--ink); border: 1px solid var(--danger); border-radius: 4px;
  padding: 1px 4px; font: 11px/1.3 var(--font); white-space: nowrap; pointer-events: none;
}
.plan-doc { max-width: 760px; }
.plan-doc-source { margin-top: 18px; font-size: 12px; }
.plan-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.plan-weights, .plan-status-tags { margin: 18px 0; }
.plan-rank-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.plan-rank-pair ol { margin: 0; padding-left: 1.2em; }
.plan-weights table { width: 100%; border-collapse: collapse; }
.plan-weights th, .plan-weights td { text-align: left; padding: 4px 8px 4px 0; vertical-align: baseline; }
@media (max-width: 960px) {
  .plan-rank-pair { grid-template-columns: 1fr; }
}

.plan-county-label {
  pointer-events: none; white-space: nowrap;
  font-size: 11px; font-weight: 600; letter-spacing: .02em; color: #2b2f28;
  text-shadow: 0 0 2px #f4f1ea, 0 0 3px #f4f1ea, 0 0 4px #f4f1ea;
}
/* ACQ-UI-FIX-1022: district names, from zoom 7 with the districts layer on; italic in the district line colour. */
.plan-district-label {
  pointer-events: none; white-space: nowrap;
  font-size: 12px; font-weight: 600; font-style: italic; color: #1f4e79;
  text-shadow: 0 0 2px #f4f1ea, 0 0 3px #f4f1ea, 0 0 4px #f4f1ea;
}
.plan-pick { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; }
.plan-pick li { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.plan-pick .hx-btn { padding: 2px 10px; font-size: 12px; }
.plan-coverage-none { font-weight: 600; margin: 4px 0; }

/* Shared map controls (ACQ-MAP-STACK-1, ACQ-MAP-UX-1). Icon buttons share one size. One panel open. */
.map-icon-btn {
  width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid var(--hx-border); background: var(--hx-card); color: var(--hx-fg); cursor: pointer;
}
.map-icon-btn:hover { background: var(--aq-hover); }
.map-icon-btn:focus-visible { outline: 2px solid var(--hx-accent); outline-offset: 2px; }
.map-icon-btn[hidden], .map-find-box[hidden], .map-find-panel[hidden], .map-stack-panel[hidden], .map-stack-dot[hidden] { display: none; }
.map-icon-btn[aria-expanded="true"] { background: color-mix(in srgb, var(--hx-accent) 16%, var(--hx-card)); border-color: var(--hx-accent); }
.map-icon { display: block; }
.maplibregl-map { container-type: inline-size; container-name: aqmap; }
.map-chrome {
  position: absolute; inset: 0; z-index: 4; box-sizing: border-box; pointer-events: none;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px; padding: 8px;
}
.map-chrome-tl, .map-chrome-bl { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; max-width: 100%; }
.map-chrome-tl { grid-column: 1; grid-row: 1; }
.map-chrome-tr { grid-column: 2; grid-row: 1; justify-self: end; align-self: start; position: relative; z-index: 7; }
.map-chrome-bl { grid-column: 1; grid-row: 3; }
.map-chrome-br { grid-column: 2; grid-row: 3; justify-self: end; align-self: end; position: relative; z-index: 9; }
.map-chrome-tl > *, .map-chrome-tr > *, .map-chrome-bl > *, .map-chrome-br > * { pointer-events: auto; max-width: 100%; }
.map-chrome[data-layers="open"] .map-chrome-tl,
.map-chrome[data-layers="open"] .map-chrome-bl { visibility: hidden; }
.map-chrome .maplibregl-ctrl { margin: 0; float: none; }
.map-chrome .plan-legend, .map-chrome .plan-flow-legend, .map-chrome .plan-map-note {
  position: static; left: auto; right: auto; top: auto; bottom: auto; max-width: 100%; margin: 0; z-index: auto;
}
.map-legend-toggle {
  display: none; height: 28px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--hx-border);
  background: var(--hx-card); color: var(--hx-fg); font: 600 12px/1 var(--hx-sans); cursor: pointer;
}
.map-legend-toggle:focus-visible { outline: 2px solid var(--hx-accent); outline-offset: 2px; }
@container aqmap (max-width: 559px) {
  .map-legend-toggle { display: inline-flex; align-items: center; }
  .snake-flow-legend:not([data-open="1"]) .map-legend-body,
  .plan-legend:not([data-open="1"]) .map-legend-body,
  .plan-flow-legend:not([data-open="1"]) .map-legend-body { display: none; }
  .snake-flow-cap { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
}
.map-stack-control, .map-find-control { position: relative; background: transparent; color: var(--hx-fg); font-size: 13px; max-width: 100%; box-shadow: none; }
.map-stack-toggle { position: relative; }
.map-stack-dot {
  position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 999px; background: var(--hx-warn); pointer-events: none;
}
.map-stack-panel, .map-find-panel {
  position: absolute; z-index: 8; top: calc(100% + 8px); overflow: auto;
  width: min(320px, calc(100cqw - 16px)); max-width: calc(100cqw - 16px); max-height: calc(100cqh - 16px);
  border: 1px solid var(--hx-border); border-radius: 12px; background: var(--hx-card); color: var(--hx-fg);
  box-shadow: 0 12px 40px var(--aq-shadow);
}
.map-stack-panel { right: 0; padding: 12px; }
.map-find-panel { left: 0; padding: 4px; min-width: min(220px, calc(100cqw - 16px)); }
.map-stack-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 12px; }
.map-stack-title { font-size: 14px; font-weight: 600; }
.map-stack-close, .map-find-close, .map-find-chevron, .map-stack-info { width: 32px; height: 32px; flex: none; }
.map-stack-preset-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px;
}
.map-stack-presets {
  display: flex; flex: 1 1 180px; min-width: 0; flex-wrap: wrap;
  border: 1px solid var(--hx-border); border-radius: 999px; overflow: hidden; margin: 0;
}
.map-stack-presets button {
  appearance: none; -webkit-appearance: none;
  flex: 1 1 auto; min-width: max-content; height: 28px; border: 0; border-right: 1px solid var(--hx-border); border-radius: 0;
  background: var(--hx-card); color: var(--hx-fg); -webkit-text-fill-color: var(--hx-fg);
  font: 600 12px/1 var(--hx-sans); padding: 0 8px; cursor: pointer; white-space: nowrap;
}
.map-stack-presets button:last-child { border-right: 0; }
.map-stack-presets button:hover:not(:disabled):not([aria-pressed="true"]) { background: var(--aq-hover); }
.map-stack-presets button[aria-pressed="true"] {
  background: var(--hx-accent); color: var(--aq-on-accent); -webkit-text-fill-color: var(--aq-on-accent);
}
.map-stack-presets button[aria-pressed="true"]:hover:not(:disabled) { background: var(--hx-accent-hover); }
.map-stack-presets button:focus-visible { outline: 2px solid var(--hx-accent); outline-offset: -2px; }
.map-stack-presets button:disabled { opacity: 0.5; cursor: default; }
.map-stack-custom {
  flex: none; display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 999px;
  background: var(--hx-accent-soft); color: var(--hx-accent-fg); font: 600 12px/1 var(--hx-sans);
}
.map-stack-geology-note { margin: 0 0 12px; font-size: 12px; line-height: 1.45; color: var(--hx-muted); }
.map-stack-fallback-row { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 12px; }
.map-stack-fallback-line { margin: 0; flex: 1; font-size: 13px; line-height: 1.45; }
.map-stack-info { border-radius: 999px; font: 600 13px/1 var(--hx-sans); }
.map-stack-row { display: flex; gap: 8px; align-items: center; margin: 0 0 8px; cursor: pointer; }
.map-stack-slider { width: 100%; margin: 0 0 8px 24px; max-width: calc(100% - 24px); }
.map-stack-chip {
  margin-top: 8px; padding: 4px 8px; border-radius: 6px; white-space: normal;
  background: var(--hx-warn-soft); color: var(--hx-warn); border: 1px solid var(--hx-warn-border);
}
.map-stack-hover { z-index: 3; }
.map-stack-water { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--hx-border); }
.map-stack-water-label { font-weight: 600; font-size: 12px; margin-bottom: 8px; }
.map-stack-water-styles { display: flex; gap: 12px; }
.map-stack-motion { margin-top: 12px; }
.map-find-box {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 4px 0 12px; box-sizing: border-box;
  border-radius: 999px; border: 1px solid var(--hx-border); background: var(--hx-card);
  width: min(280px, 100%); min-width: 0; max-width: 100%;
}
.map-find-box:focus-within { outline: 2px solid var(--hx-accent); outline-offset: 2px; border-color: var(--hx-accent); }
.map-find-box :is(input, button):focus,
.map-find-box :is(input, button):focus-visible { outline: none; box-shadow: none; }
.map-find-mark { flex: none; color: var(--hx-muted); }
.map-find-input {
  appearance: none; -webkit-appearance: none;
  flex: 1; min-width: 0; height: 28px; border: 0; background: transparent; color: inherit;
  font: 600 14px/1.2 var(--hx-sans); padding: 0;
}
.map-find-input:focus { outline: none; }
.map-find-input::-webkit-search-decoration,
.map-find-input::-webkit-search-cancel-button,
.map-find-input::-webkit-search-results-button { display: none; appearance: none; }
.map-find-group {
  margin: 8px 4px 4px; font: 600 11px/1.2 var(--hx-sans); letter-spacing: .06em;
  text-transform: uppercase; color: var(--hx-muted);
}
.map-find-option {
  display: block; width: 100%; text-align: left; min-height: 32px; padding: 6px 8px; border: 0; border-radius: 8px;
  background: transparent; color: var(--hx-fg); font: 600 13px/1.3 var(--hx-sans); cursor: pointer;
}
.map-find-option:hover, .map-find-option:focus-visible { background: var(--aq-hover); }
.map-find-option:focus-visible { outline: 2px solid var(--hx-accent); outline-offset: -2px; }
.map-find-option[data-mapped="false"], .map-find-option:disabled { color: var(--hx-muted); cursor: default; }
@media (prefers-reduced-motion: reduce) {
  .map-stack-panel, .map-find-panel, .map-find-box { transition: none; }
}
/* The global a:hover colour would hide the label of a filled link button (Start project here). */
.plan-panel a.hx-btn, .plan-panel a.hx-btn:hover { color: var(--on-accent); text-decoration: none; }
