:root {
  --ink: #16201c;
  --muted: #64716b;
  --line: #d7dfda;
  --paper: #f3f6f4;
  --panel: #ffffff;
  --soft: #e8eeea;
  --green: #0b7a53;
  --green-dark: #075f41;
  --blue: #1f5ea8;
  --amber: #a85b08;
  --red: #ad2e24;
  --shadow: 0 12px 34px rgba(21, 36, 29, 0.14);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { color: var(--ink); background: var(--paper); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; letter-spacing: 0; overflow: hidden; }
button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
.hidden { display: none !important; }
.preview-notice { padding: 12px 14px; border-bottom: 1px solid #d7b56d; background: #fff8e8; color: #5d430f; }
.preview-notice strong, .preview-notice span { display: block; }
.preview-notice strong { font-size: 12px; margin-bottom: 4px; }
.preview-notice span { font-size: 11px; line-height: 1.45; }
.preview-notice a { display: inline-flex; margin-top: 8px; color: #174f3c; font-size: 11px; font-weight: 800; }
body.preview-mode .run-section, body.preview-mode .boundary-section { background: #f4f6f5; }

.topbar { height: 58px; display: grid; grid-template-columns: 320px 1fr auto; align-items: center; border-bottom: 1px solid var(--line); background: var(--panel); position: relative; z-index: 1002; }
.brand { height: 100%; padding: 0 18px; display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 17px; font-weight: 750; border-right: 1px solid var(--line); }
.brand-mark { width: 26px; height: 26px; border: 2px solid var(--ink); border-radius: 50%; position: relative; background: radial-gradient(circle, var(--green) 0 4px, transparent 5px); }
.brand-mark::after { content: ""; position: absolute; width: 9px; height: 2px; right: -5px; bottom: 1px; background: var(--ink); transform: rotate(45deg); }
.workspace-title { display: flex; align-items: baseline; gap: 12px; padding: 0 18px; min-width: 0; }
.workspace-title strong { font-size: 15px; }
.workspace-title span { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { height: 100%; padding: 0 14px; display: flex; align-items: center; gap: 8px; }

.workspace-shell { height: calc(100vh - 58px); display: grid; grid-template-columns: 320px minmax(360px, 1fr) 420px; min-width: 0; }
.control-panel, .results-panel { min-width: 0; background: var(--panel); overflow-y: auto; }
.control-panel { border-right: 1px solid var(--line); }
.results-panel { border-left: 1px solid var(--line); }
.workflow-progress { list-style: none; margin: 0; padding: 11px 14px; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); border-bottom: 1px solid var(--line); background: #f8faf9; }
.workflow-progress li { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: start; gap: 3px; min-width: 0; color: var(--muted); font-size: 9px; font-weight: 750; text-align: center; }
.workflow-progress li:not(:last-child)::after { content: ""; position: absolute; z-index: 0; left: calc(50% + 10px); right: calc(-50% + 10px); top: 9px; height: 1px; background: var(--line); }
.workflow-progress li span { position: relative; z-index: 1; width: 19px; height: 19px; display: grid; place-items: center; flex: 0 0 19px; border: 1px solid var(--line); border-radius: 50%; background: #fff; font-size: 9px; }
.workflow-progress li.active { color: var(--ink); }
.workflow-progress li.active span { color: #fff; border-color: var(--green); background: var(--green); }
.workflow-progress li.complete span { color: var(--green-dark); border-color: #add5c0; background: #dff3e8; }
.control-section { padding: 18px; border-bottom: 1px solid var(--line); }
.control-section > label, .run-section > label { display: block; font-size: 12px; font-weight: 750; margin-bottom: 8px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 12px; font-weight: 750; margin-bottom: 10px; }

.search-control { display: grid; grid-template-columns: 1fr 40px; gap: 7px; }
input, select { width: 100%; height: 40px; border: 1px solid var(--line); border-radius: 5px; padding: 0 11px; color: var(--ink); background: #fff; }
input:focus, select:focus { outline: 2px solid rgba(11, 122, 83, .2); border-color: var(--green); }
.icon-button { width: 38px; height: 38px; padding: 0; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); color: var(--ink); }
.icon-button:hover:not(:disabled) { background: var(--soft); }
.icon-button svg { width: 18px; height: 18px; }
.icon-button.primary { background: var(--green); color: #fff; border-color: var(--green); }
.icon-button.danger { color: var(--red); }
.command-button, .primary-button, .secondary-button, .compare-bar button { min-height: 38px; border-radius: 5px; border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 13px; font-weight: 700; background: var(--panel); color: var(--ink); }
.command-button svg, .compare-bar svg { width: 17px; }
.primary-button, .compare-bar button { background: var(--green); border-color: var(--green); color: #fff; }
.secondary-button { background: var(--panel); }
.text-button { border: 0; padding: 0; background: transparent; color: var(--green); font-size: 12px; font-weight: 750; }

.search-results { margin-top: 8px; display: grid; gap: 4px; max-height: 190px; overflow-y: auto; }
.search-result { width: 100%; text-align: left; border: 1px solid transparent; background: var(--paper); padding: 9px 10px; border-radius: 4px; }
.search-result:hover { border-color: var(--green); background: #f7fbf8; }
.search-result.selected { border-color: var(--green); background: #eef7f2; box-shadow: inset 3px 0 0 var(--green); }
.search-result strong, .search-result span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-result strong { font-size: 12px; }
.search-result span { font-size: 11px; color: var(--muted); margin-top: 3px; }
.search-result span:last-child:not(:first-child) { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; }
.search-result .precision { color: var(--amber); font-weight: 700; }
.inline-message { color: var(--muted); font-size: 12px; padding: 8px 0; }
.inline-message.error { color: var(--red); }
.scope-notice { margin-bottom: 8px; padding: 8px 9px; border-left: 3px solid var(--amber); background: #fff7e8; color: #74420b; font-size: 10px; line-height: 1.4; }
.selected-location { margin-top: 9px; padding: 8px 10px; border-left: 3px solid var(--green); background: var(--paper); }
.selected-location strong, .selected-location span { display: block; overflow-wrap: anywhere; }
.selected-location strong { font-size: 11px; }
.selected-location span { margin-top: 2px; color: var(--muted); font-size: 10px; line-height: 1.4; }

.status { padding: 3px 7px; border-radius: 999px; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.status.neutral { color: var(--muted); background: var(--soft); }
.status.ready { color: var(--green-dark); background: #dff3e8; }
.status.warning { color: var(--amber); background: #fff0d5; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.segmented button { min-height: 37px; border: 0; border-right: 1px solid var(--line); background: #fff; display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 750; }
.segmented button:last-child { border-right: 0; }
.segmented button.active { background: var(--soft); color: var(--ink); }
.segmented svg { width: 16px; }
.boundary-actions { display: flex; align-items: center; gap: 7px; margin-top: 10px; }
.boundary-actions .icon-button { width: 34px; height: 34px; }
.boundary-actions .icon-button.active { color: #fff; border-color: var(--green); background: var(--green); }
.boundary-actions span { margin-left: auto; color: var(--muted); font-size: 11px; }

.dataset-list { display: grid; gap: 6px; max-height: 235px; overflow-y: auto; }
.dataset-option { display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; align-items: center; min-height: 36px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; }
.dataset-option input { width: 15px; height: 15px; accent-color: var(--green); }
.dataset-option > span { min-width: 0; }
.dataset-option strong, .dataset-option > span small { display: block; overflow: hidden; text-overflow: ellipsis; }
.dataset-option strong { font-size: 12px; }
.dataset-option small { color: var(--muted); font-size: 10px; line-height: 1.3; }
.dataset-option .dataset-scope { margin-top: 2px; white-space: normal; }
.dataset-option > small { max-width: 74px; text-align: right; }
.dataset-option.unavailable { opacity: .55; }
.skeleton-row { height: 35px; width: 100%; background: var(--soft); border-radius: 4px; animation: pulse 1.4s infinite; }
.skeleton-row.short { width: 72%; }
@keyframes pulse { 50% { opacity: .5; } }

.run-section { padding: 18px; }
.proximity-label { margin-top: 12px; }
.run-button { width: 100%; min-height: 43px; margin-top: 10px; border: 0; border-radius: 5px; background: var(--green); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 9px; }
.run-button:hover:not(:disabled) { background: var(--green-dark); }
.run-button svg { width: 18px; }
.run-message { min-height: 16px; color: var(--muted); font-size: 11px; margin: 8px 0 0; }
.run-message.error { color: var(--red); }

.map-region { position: relative; min-width: 0; overflow: hidden; background: #d9e3dd; }
.map-provider-state { position: absolute; z-index: 700; top: 14px; left: 50%; transform: translateX(-50%); max-width: min(520px, calc(100% - 28px)); padding: 9px 12px; border: 1px solid #bd7b27; background: #fff8e8; color: #6c430c; font-size: 12px; line-height: 1.4; box-shadow: 0 2px 8px rgba(17,28,23,.12); }
.status-link { color: var(--muted); font-size: 12px; text-decoration: none; }
.status-link:hover { text-decoration: underline; }
#map { position: absolute; inset: 0; overflow: hidden; }
.map-context { position: absolute; z-index: 500; top: 14px; left: 14px; max-width: min(390px, calc(100% - 150px)); padding: 9px 11px; background: rgba(255,255,255,.96); border: 1px solid var(--line); border-left: 3px solid var(--green); border-radius: 5px; box-shadow: 0 6px 18px rgba(21,36,29,.12); pointer-events: none; }
.map-context strong, .map-context span { display: block; overflow-wrap: anywhere; }
.map-context strong { font-size: 11px; }
.map-context span { margin-top: 2px; color: var(--muted); font-size: 10px; }
.map-actions { position: absolute; z-index: 500; top: 14px; right: 14px; display: flex; gap: 6px; }
.map-actions .icon-button { width: 34px; height: 34px; background: rgba(255,255,255,.96); box-shadow: 0 3px 10px rgba(21,36,29,.12); }
.map-actions .icon-button.active { color: #fff; border-color: var(--green); background: var(--green); }
.map-layer-menu { position: absolute; top: 40px; right: 0; width: 230px; max-height: min(520px, calc(100vh - 120px)); overflow-y: auto; padding: 7px 10px; border: 1px solid var(--line); border-radius: 5px; background: rgba(255,255,255,.98); box-shadow: 0 6px 18px rgba(21,36,29,.14); }
.map-layer-menu label { display: grid; grid-template-columns: 16px 1fr; gap: 8px; align-items: center; min-height: 30px; font-size: 11px; font-weight: 700; }
.map-layer-menu input { width: 14px; height: 14px; padding: 0; accent-color: var(--green); }
.map-layer-menu-heading { display: block; margin: 6px -2px 2px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.map-legend { position: absolute; z-index: 500; bottom: 14px; left: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; max-width: calc(100% - 84px); padding: 8px 10px; background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: 5px; box-shadow: 0 6px 18px rgba(21,36,29,.12); font-size: 10px; color: var(--muted); }
.legend-swatch { display: inline-block; width: 10px; height: 10px; margin-right: 4px; border-radius: 2px; vertical-align: -1px; }
.legend-swatch.postcode { border: 2px dashed #3f6f62; background: rgba(123,183,165,.2); }
.legend-swatch.property { border: 2px solid var(--green); border-radius: 50%; background: #fff; }
.legend-swatch.linked { border: 3px solid var(--green); border-radius: 50%; background: #e09a2d; }
.legend-swatch.intelligence { border: 2px solid #8a3fa0; border-radius: 50%; background: transparent; }
.legend-swatch.site { background: var(--green); }
.legend-swatch.approved { border-radius: 50%; background: #1f9d68; }
.legend-swatch.refused { border-radius: 50%; background: #d5483e; }
.legend-swatch.pending { border-radius: 50%; background: #e09a2d; }
.legend-swatch.finding { background: var(--red); }
.legend-swatch.nearby { background: var(--amber); }
.leaflet-container { font-family: inherit; }
.leaflet-draw-toolbar a { background-color: #fff; }
.property-point { background: #fff; border: 2px solid var(--green); border-radius: 50%; }

.results-empty { height: 100%; min-height: 360px; padding: 36px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--muted); }
.results-empty svg { width: 30px; height: 30px; margin-bottom: 14px; color: var(--green); }
.results-empty strong { color: var(--ink); font-size: 15px; }
.results-empty span { max-width: 280px; margin-top: 7px; font-size: 12px; line-height: 1.55; }
.results-header { padding: 18px; border-bottom: 1px solid var(--line); }
.results-header h1 { font-size: 19px; margin: 0 0 5px; }
.results-header p { margin: 0; font-size: 11px; color: var(--muted); }
.results-header p + p { margin-top: 5px; }
.location-overview-meta { padding: 12px 18px; display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--line); }
.location-overview-meta span { padding: 4px 7px; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); color: var(--muted); font-size: 10px; font-weight: 700; }
.location-overview-guide { padding: 14px 18px; border-bottom: 1px solid var(--line); background: #f7faf8; }
.location-overview-guide strong, .location-overview-guide span { display: block; }
.location-overview-guide strong { font-size: 12px; }
.location-overview-guide span { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.location-overview-actions { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 7px; }
.location-overview-actions button, .location-overview-actions a { min-height: 36px; padding: 0 11px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink); font-size: 11px; font-weight: 750; text-decoration: none; }
.location-overview-actions .primary { border-color: var(--green); background: var(--green); color: #fff; }
.location-overview-actions svg { width: 15px; height: 15px; }
.decision-overview { padding: 11px 18px; border-bottom: 1px solid var(--line); background: #fbfcfb; }
.decision-overview strong, .decision-overview span { display: block; }
.decision-overview strong { font-size: 11px; }
.decision-overview span { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.property-link-overview { padding: 11px 18px; border-bottom: 1px solid var(--line); border-left: 3px solid var(--muted); background: #fbfcfb; }
.property-link-overview.matched { border-left-color: var(--green); background: #f0f8f4; }
.property-link-overview strong, .property-link-overview span { display: block; }
.property-link-overview strong { font-size: 11px; }
.property-link-overview span { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.planning-context { padding: 14px 18px 18px; }
.planning-context-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.planning-context-head strong { font-size: 12px; }
.planning-context-head span { color: var(--muted); font-size: 10px; text-align: right; }
.planning-context-note { margin: 0 0 10px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.planning-context-row { width: 100%; padding: 10px 8px; border: 1px solid transparent; border-top-color: var(--line); background: transparent; text-align: left; }
.planning-context-row:first-of-type { border-top: 0; }
.planning-context-row:hover, .planning-context-row.selected { border-color: #8bbca5; background: #f0f8f4; }
.planning-context-row.property-linked { border-left: 3px solid var(--green); background: #f7fbf9; }
.planning-context-row.property-linked.selected { background: #e6f4ec; }
.planning-context-row strong, .planning-context-row span { display: block; overflow-wrap: anywhere; }
.planning-context-row strong { font-size: 11px; line-height: 1.4; }
.planning-context-row span { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.planning-row-heading { display: flex !important; align-items: start; justify-content: space-between; gap: 8px; margin: 0 !important; }
.planning-row-heading strong { color: var(--ink); min-width: 0; }
.planning-row-badges { display: flex !important; flex: none; flex-wrap: wrap; justify-content: flex-end; gap: 4px; margin: 0 !important; }
.property-link-pill { display: inline-flex; align-items: center; min-height: 21px; padding: 2px 6px; border: 1px solid #71ab90; border-radius: 4px; color: #075f41; background: #e6f4ec; font-size: 9px; font-weight: 800; line-height: 1.2; }
.decision-pill { display: inline-flex; flex: none; align-items: center; min-height: 21px; padding: 2px 6px; border-radius: 4px; font-size: 9px; font-weight: 800; line-height: 1.2; }
.decision-pill.approved { color: #075f41; background: #dff3e8; }
.decision-pill.refused { color: #84241c; background: #fde8e6; }
.decision-pill.pending { color: #7a4708; background: #fff0d5; }
.decision-pill.other { color: #315268; background: #e6f0f5; }
.planning-record-detail { padding: 15px 18px; border-bottom: 1px solid var(--line); background: #f8faf9; }
.planning-detail-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.planning-detail-head span, .planning-detail-head strong { display: block; }
.planning-detail-head span { color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.planning-detail-head strong { margin-top: 3px; font-size: 13px; }
.planning-record-detail h2 { margin: 13px 0 5px; font-size: 14px; line-height: 1.35; }
.planning-record-detail > p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.planning-record-detail dl { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px 14px; margin: 14px 0 0; }
.planning-record-detail dl div { min-width: 0; }
.planning-record-detail dt { color: var(--muted); font-size: 9px; font-weight: 750; }
.planning-record-detail dd { margin: 2px 0 0; font-size: 10px; overflow-wrap: anywhere; }
.official-record-link { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; margin-top: 13px; padding: 0 9px; border: 1px solid var(--line); border-radius: 5px; color: var(--blue); background: #fff; font-size: 10px; font-weight: 800; text-decoration: none; }
.official-record-link svg { width: 14px; height: 14px; }
.application-intelligence { border-bottom: 1px solid var(--line); background: #fff; }
.application-intelligence-head { min-height: 57px; padding: 12px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); background: #f1f7f4; }
.application-intelligence-head span, .application-intelligence-head h3 { display: block; }
.application-intelligence-head span { color: var(--green-dark); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.application-intelligence-head h3 { margin: 3px 0 0; font-size: 13px; line-height: 1.3; }
.application-intelligence-head b { flex: none; color: var(--muted); font-size: 9px; }
.intelligence-row { padding: 13px 18px; border-bottom: 1px solid var(--line); }
.intelligence-row:last-child { border-bottom: 0; }
.intelligence-row-head { display: grid; grid-template-columns: 25px minmax(0,1fr); gap: 8px; align-items: start; }
.intelligence-row-head svg { width: 17px; height: 17px; margin-top: 2px; color: var(--green); }
.intelligence-row-head span, .intelligence-row-head strong { display: block; overflow-wrap: anywhere; }
.intelligence-row-head span { color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.intelligence-row-head strong { margin-top: 2px; font-size: 11px; line-height: 1.4; }
.intelligence-row dl { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px 13px; margin: 10px 0 0 33px; }
.intelligence-row dl div { min-width: 0; }
.intelligence-row dt { color: var(--muted); font-size: 9px; font-weight: 750; }
.intelligence-row dd { margin: 2px 0 0; font-size: 10px; line-height: 1.35; overflow-wrap: anywhere; }
.intelligence-source { display: inline-flex; align-items: center; gap: 5px; min-height: 28px; margin: 9px 0 0 33px; color: var(--blue); font-size: 9px; font-weight: 800; text-decoration: none; }
.intelligence-source svg { width: 12px; height: 12px; }
.intelligence-provenance { margin: 8px 0 0 33px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.intelligence-state { margin: 0; padding: 14px 18px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.intelligence-state.error { color: var(--red); }
.planning-context-state { padding: 10px 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.planning-context-state.error { color: var(--red); }
.summary-strip { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.summary-stat { padding: 13px 10px; border-right: 1px solid var(--line); }
.summary-stat:last-child { border-right: 0; }
.summary-stat strong, .summary-stat span { display: block; }
.summary-stat strong { font-size: 19px; }
.summary-stat span { color: var(--muted); font-size: 10px; margin-top: 2px; }
.summary-stat.attention strong { color: var(--red); }
.summary-stat.clear strong { color: var(--green-dark); }
.finding-list { padding: 12px 18px 18px; }
.finding-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.finding-row:last-child { border-bottom: 0; }
.finding-title { display: grid; grid-template-columns: 9px 1fr auto; gap: 9px; align-items: start; }
.finding-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; background: var(--muted); }
.finding-row.attention .finding-dot { background: var(--red); }
.finding-row.clear .finding-dot { background: var(--green); }
.finding-row.uncertain .finding-dot { background: var(--amber); }
.finding-title strong { font-size: 12px; line-height: 1.4; }
.finding-title button { border: 0; background: transparent; padding: 0; color: var(--muted); }
.finding-title svg { width: 16px; }
.finding-row p { margin: 5px 0 0 17px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.dataset-detail { margin: 7px 0 0 17px; display: grid; gap: 7px; }
.feature-row { border-left: 2px solid var(--line); padding: 5px 0 5px 9px; font-size: 11px; }
.feature-row a { color: var(--blue); text-decoration: none; }
.feature-row span { display: block; color: var(--muted); margin-top: 2px; }
.result-actions { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; }
.result-actions a, .result-actions button { min-height: 36px; display: inline-flex; align-items: center; gap: 7px; padding: 0 11px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink); text-decoration: none; font-size: 11px; font-weight: 750; }
.result-actions .primary { border-color: var(--green); background: var(--green); color: #fff; }
.result-actions svg { width: 15px; }

.drawer { position: fixed; z-index: 1200; top: 0; right: 0; bottom: 0; width: min(460px, 94vw); background: var(--panel); box-shadow: var(--shadow); display: grid; grid-template-rows: auto 1fr auto; }
.drawer-header { min-height: 72px; padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.drawer-header strong, .drawer-header span { display: block; }
.drawer-header span { color: var(--muted); font-size: 11px; margin-top: 3px; }
.saved-list { overflow-y: auto; }
.saved-site { border-bottom: 1px solid var(--line); }
.saved-site-head { padding: 13px 16px; display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.saved-site-head strong, .saved-site-head span { display: block; }
.saved-site-head strong { font-size: 13px; }
.saved-site-head span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.saved-site-actions { display: flex; gap: 5px; }
.saved-site-actions .icon-button { width: 32px; height: 32px; }
.assessment-choice { padding: 8px 16px 8px 28px; background: var(--paper); border-top: 1px solid var(--line); display: grid; grid-template-columns: 18px 1fr auto; gap: 7px; align-items: center; font-size: 11px; }
.assessment-choice input { width: 14px; height: 14px; accent-color: var(--green); }
.assessment-choice button { border: 0; background: transparent; color: var(--blue); font-size: 11px; font-weight: 750; }
.compare-bar { padding: 13px 16px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.compare-bar span { color: var(--muted); font-size: 11px; }
.scrim { position: fixed; inset: 0; z-index: 1100; background: rgba(18, 27, 23, .42); }

dialog { width: min(430px, calc(100vw - 28px)); border: 0; border-radius: 6px; padding: 0; color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(18,27,23,.5); }
#key-form { padding: 18px; }
.export-dialog-body { padding: 18px; }
.export-choice { width: 100%; display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: center; padding: 12px; margin-top: 8px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink); text-align: left; }
.export-choice:hover { border-color: var(--green); background: #f7fbf8; }
.export-choice svg { width: 20px; color: var(--green); }
.export-choice strong, .export-choice small { display: block; }
.export-choice small { margin-top: 2px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.dialog-heading { display: flex; justify-content: space-between; align-items: start; margin-bottom: 18px; }
.dialog-heading strong, .dialog-heading span { display: block; }
.dialog-heading span { color: var(--muted); font-size: 11px; margin-top: 4px; }
#key-form label { display: block; font-size: 12px; font-weight: 750; margin-bottom: 7px; }
.key-note { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.key-note a { color: var(--blue); }
.commercial-links { display: flex; gap: 8px; align-items: center; }
.commercial-links a { font-weight: 700; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.error-text { min-height: 16px; color: var(--red); font-size: 11px; margin: 6px 0 0; }

@media (max-width: 1150px) {
  .workspace-shell { grid-template-columns: 300px 1fr 350px; }
  .topbar { grid-template-columns: 300px 1fr auto; }
}

@media (max-width: 850px) {
  body { overflow: auto; }
  .topbar { position: sticky; top: 0; grid-template-columns: auto 1fr auto; }
  .brand { border-right: 0; padding: 0 11px; }
  .brand span:last-child, .workspace-title span, .command-button span { display: none; }
  .workspace-title { padding: 0 8px; }
  .top-actions { padding: 0 8px; gap: 5px; }
  .command-button { width: 38px; padding: 0; }
  .workspace-shell { height: auto; min-height: calc(100vh - 58px); display: grid; grid-template-columns: 1fr; grid-template-rows: auto 46vh auto; }
  .control-panel { border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .control-section, .run-section { border-right: 1px solid var(--line); }
  .datasets-section, .run-section { border-bottom: 0; }
  .map-region { min-height: 360px; }
  #map { position: absolute; }
  .results-panel { border-left: 0; border-top: 1px solid var(--line); overflow: visible; min-height: 420px; }
}

@media (max-width: 600px) {
  .control-panel { grid-template-columns: minmax(0, 1fr); }
  .control-section, .run-section { border-right: 0; border-bottom: 1px solid var(--line); }
  .dataset-list { max-height: 180px; }
  .map-region { min-height: 380px; }
  .map-context { top: 8px; left: 8px; max-width: calc(100% - 150px); }
  .map-actions { top: 8px; right: 8px; }
  .map-layer-menu { max-height: 330px; }
  .map-legend { left: 8px; bottom: 8px; gap: 8px; }
  .summary-strip { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .summary-stat strong { font-size: 16px; }
  .intelligence-row dl { grid-template-columns: minmax(0,1fr); }
}
