/* GPEX analytical workspaces
   Shared identity and navigation live in shell.css. Scientific display
   ramps remain independent from the neutral interface colours. */

:root {
  color-scheme: light;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --text: var(--ink, #12243b);
  --text-soft: #4e6077;
  --muted: var(--slate, #65748a);
  --border: var(--line, #e2e8f0);
  --panel-radius: 18px;
  --panel-pad: 20px;
  --workspace-gap: 16px;
  --page-gutter: 30px;
  --panel-shadow: 0 3px 18px rgba(18, 36, 59, .035);
  --success: #27634f;
  --danger: #aa4352;
  --navy-ramp: linear-gradient(90deg, #edf3f8 0%, #c4d4e4 25%, #86a6c6 50%, #466d96 75%, #122d4d 100%);
  --difference-ramp: linear-gradient(90deg, #2166ac 0%, #f7f7f7 50%, #b2182b 100%);
  /* This categorical colour matches the stable-zone map output. */
  --stable-zone: #244d73;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper, #f5f7fa); }
body.dashboard-page {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background: var(--paper, #f5f7fa);
  font-size: 13px;
  line-height: 1.55;
}
[hidden] { display: none !important; }
main:focus { outline: none; }
main a, .app-footer a { color: var(--navy, #122b48); text-underline-offset: 3px; }
main a:hover, .app-footer a:hover { color: #436589; }
main :focus-visible, .app-footer :focus-visible, .error-banner :focus-visible {
  outline: 2px solid #557ba4;
  outline-offset: 3px;
}
::selection { color: #12243b; background: #dfe9f3; }

/* Page hierarchy */
.workspace-intro, .workspace, .compare-workspace,
.builder-workspace, .stability-workspace, .app-footer, .error-banner {
  width: calc(100% - var(--page-gutter) * 2);
  max-width: 1920px;
  margin-inline: auto;
}
.workspace-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 5px 23px;
}
.workspace-intro-copy { min-width: 0; }
.workspace-kicker {
  margin: 0 0 5px;
  color: #748195;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .16em;
  line-height: 1.6;
}
.workspace-intro h1 {
  margin: 0;
  color: var(--ink, #12243b);
  font-size: clamp(30px, 2.8vw, 42px);
  font-weight: 760;
  letter-spacing: -.055em;
  line-height: 1.12;
}
.workspace-subtitle { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.workspace-context { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.context-stats { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 11px; }
.context-stats > span { white-space: nowrap; }
.context-stats > span + span { border-left: 1px solid #d8e0e9; padding-left: 14px; }
.context-stats strong { color: #43576f; font-weight: 600; }
.context-location { display: flex; align-items: center; gap: 7px; margin: 0; color: var(--muted); font-size: 11px; }
.context-location svg { width: 16px; height: 16px; flex: 0 0 16px; }

/* Map first in source order; three stable columns on larger screens. */
.workspace, .compare-workspace, .builder-workspace, .stability-workspace {
  display: grid;
  gap: var(--workspace-gap);
  height: max(600px, calc(100dvh - var(--gpex-header-height, 76px) - 174px));
  max-height: 1050px;
  min-width: 0;
  align-items: stretch;
  grid-template-areas: "controls map results";
}
.workspace { grid-template-columns: 280px minmax(0, 1fr) 316px; }
.compare-workspace { grid-template-columns: 270px minmax(0, 1fr) 326px; }
.builder-workspace { grid-template-columns: 306px minmax(0, 1fr) 326px; }
.stability-workspace { grid-template-columns: 286px minmax(0, 1fr) 326px; }
.workspace > *, .compare-workspace > *, .builder-workspace > *, .stability-workspace > * { min-width: 0; min-height: 0; }
.contents, .builder-controls, .stability-controls, .compare-workspace > .compare-side:first-of-type { grid-area: controls; }
.inspector, .builder-results, .stability-results, .compare-workspace > .compare-side:last-of-type { grid-area: results; }
.map-panel, .compare-map-panel, .builder-map-panel, .stability-map-panel { grid-area: map; }
.sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--workspace-gap);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #cad4df transparent;
  padding: 1px 2px 10px;
}
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { border-radius: 10px; background: #cad4df; }
.sidebar > .panel { flex: 0 0 auto; }
.panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--panel-radius);
  background: var(--surface);
  box-shadow: var(--panel-shadow);
  overflow: clip;
}
.panel-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px var(--panel-pad) 16px;
  border-bottom: 1px solid #edf1f5;
}
.panel-heading-copy { min-width: 0; }
.panel-heading h2 {
  margin: 0;
  color: var(--ink, #12243b);
  font-size: 17px;
  font-weight: 740;
  letter-spacing: -.025em;
  line-height: 1.3;
}
.panel-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 9px;
  color: #233e60;
  background: #eef3f9;
}
.panel-icon svg { width: 23px; height: 23px; }
.eyebrow { display: block; margin-bottom: 4px; color: #738196; font-size: 9px; font-weight: 700; letter-spacing: .12em; }
.panel > section { padding: 17px var(--panel-pad); border-bottom: 1px solid #edf1f5; }
.panel > section:last-child { border-bottom: 0; }
.panel h3 { margin: 0 0 12px; color: #1b314d; font-size: 13px; font-weight: 720; line-height: 1.45; }
.panel p { margin-top: 0; overflow-wrap: break-word; }
.panel p:last-child { margin-bottom: 0; }
.panel .muted { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.panel .small-note { margin: 10px 0 0; color: #718096; font-size: 10.5px; line-height: 1.7; }
.scenario-description { margin: 0; color: #54677f; font-size: 12px; line-height: 1.75; }
.result-context { margin: 0 0 12px; color: #506984; font-size: 12px; font-weight: 600; }
.count-badge, .group-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 23px;
  height: 23px;
  padding: 0 6px;
  border-radius: 6px;
  background: #edf3fa;
  color: #2b4667;
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.evidence-section > h3 { display: flex; align-items: center; justify-content: space-between; }
.evidence-section > .small-note.evidence-intro { margin-top: -5px; }

/* Native disclosures keep secondary information available and keyboard usable. */
main details { min-width: 0; }
main details > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  list-style: none;
  color: #233953;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.5;
  cursor: pointer;
  user-select: none;
}
main summary::-webkit-details-marker { display: none; }
main summary::marker { content: ""; }
main details > summary::after {
  content: "";
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  margin-left: auto;
  margin-right: 3px;
  border: solid #62758d;
  border-width: 0 1.6px 1.6px 0;
  transform: rotate(-45deg);
  transition: transform 180ms ease;
}
main details[open] > summary::after { transform: rotate(45deg); }
main details > summary:hover { color: #41668f; }
main details[open] > summary { margin-bottom: 7px; }
main .disclosure { border-bottom: 1px solid #edf1f5; }
main .disclosure:last-child { border-bottom: 0; }
main .disclosure > summary { margin: 0; padding: 16px var(--panel-pad); font-size: 12px; }
main .disclosure > summary > span:not(.panel-icon) { flex: 1; min-width: 0; }
main .disclosure-body { padding: 0 var(--panel-pad) 18px; }
main .disclosure-body > h3 { margin-top: 20px; }
main .disclosure-body > p:last-child { margin-bottom: 0; }
main .utility-card > .disclosure > summary { min-height: 65px; font-size: 12px; }
.utility-card .panel-icon { width: 29px; height: 29px; flex-basis: 29px; background: #f2f5f9; }
.utility-card .panel-icon svg { width: 20px; height: 20px; }
.panel > section > .disclosure { margin: 14px calc(-1 * var(--panel-pad)) -17px; border-top: 1px solid #edf1f5; }
.panel > section > .disclosure > summary { font-size: 11px; }
.location-card section > div > details { margin-top: 10px; border-top: 1px solid #edf1f5; }

/* Forms and controls */
main button, main input, main select, main textarea, .error-banner button { font: inherit; max-width: 100%; }
main button, .error-banner button {
  min-height: 36px;
  padding: 8px 11px;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  background: #fff;
  color: #2c415c;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}
main button:hover:not(:disabled), .error-banner button:hover { border-color: #9fafc2; background: #f8fafc; }
main button:active:not(:disabled) { background: #edf2f7; }
main button:disabled { color: #8c99aa; background: #f1f4f7; border-color: #e8edf2; cursor: not-allowed; box-shadow: none; }
main .primary-button { min-height: 42px; color: #fff; border-color: #183551; background: #183551; box-shadow: 0 3px 8px rgba(18, 43, 72, .1); }
main .primary-button:hover:not(:disabled) { color: #fff; border-color: #284b70; background: #284b70; }
.field-label { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 7px; color: #50627a; font-size: 11px; font-weight: 600; }
.field-label output { color: #223f61; font-weight: 650; font-variant-numeric: tabular-nums; }
main select, main .text-input {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid #d8e1eb;
  border-radius: 8px;
  background-color: #fff;
  color: #203853;
  font-size: 12px;
  line-height: 1.5;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
main select:hover:not(:disabled), main .text-input:hover:not(:disabled) { border-color: #9aafc5; }
main select:focus-visible, main .text-input:focus-visible { outline: none; border-color: #6383a5; box-shadow: 0 0 0 3px #e5edf6; }
main select:disabled, main .text-input:disabled { color: #8695a7; background: #f4f7fa; cursor: not-allowed; }
main textarea.text-input { min-height: 88px; resize: vertical; }
main input[type="checkbox"], main input[type="radio"] { flex: 0 0 16px; width: 16px; height: 16px; margin: 3px 0 0; accent-color: #203f62; cursor: pointer; }
main input[type="range"] { display: block; width: 100%; height: 22px; padding: 0; margin: 5px 0 10px; accent-color: #2d5279; cursor: pointer; }
.evidence-opacity-label { margin-top: 19px; }
.layer-row, .custom-scenario-row { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; color: #2b415c; font-size: 12px; line-height: 1.6; cursor: pointer; }
.layer-row > span, .custom-scenario-row > span { flex: 1; min-width: 0; }
.layer-row small, .custom-scenario-row small { display: block; margin-top: 3px; color: #758499; font-size: 10px; line-height: 1.65; }
.scenario-toggle { margin-top: 9px; padding-bottom: 0; color: #193652; }
.evidence-name { display: block; color: #2b415b; font-size: 11.5px; font-weight: 650; }
.evidence-group { margin-top: 4px; border-bottom: 1px solid #eaf0f5; }
.evidence-group:last-child { border-bottom: 0; }
.evidence-group > summary { min-height: 48px; font-size: 12px; font-weight: 550; }
.evidence-group[open] { margin-inline: -8px; padding-inline: 8px; border-radius: 9px; background: #f8fafc; }
.evidence-group[open] > summary { margin-bottom: 0; }
.evidence-group-body { padding: 0 2px 8px; }
.evidence-group-body .layer-row + .layer-row { border-top: 1px solid #e9eef4; }
.evidence-theme-icon { width: 21px; height: 21px; flex: 0 0 21px; color: #526d8f; }
.group-name { flex: 1; min-width: 0; }
.group-count { min-width: 20px; height: 20px; color: #7a8a9d; background: #f0f4f8; font-size: 9px; }
.evidence-group[data-active="true"] > summary { color: #143859; font-weight: 700; }
.evidence-group[data-active="true"] .group-count { color: #fff; background: #315478; }

/* Statistics and scientific audit */
.facts { margin: 0; }
.facts > div { padding: 9px 0; border-bottom: 1px solid #edf1f5; }
.facts > div:last-child { border-bottom: 0; }
.facts dt { color: #75849a; font-size: 10.5px; }
.facts dd { margin: 3px 0 0; color: #29415c; font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; }
.weight-row { margin: 12px 0; }
.weight-row:first-child { margin-top: 2px; }
.weight-row:last-child { margin-bottom: 0; }
.weight-label { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; color: #586c84; font-size: 11px; }
.weight-label strong { color: #213c5b; font-weight: 700; font-variant-numeric: tabular-nums; }
meter { display: block; width: 100%; height: 8px; margin-top: 6px; border: 0; }
meter::-webkit-meter-bar { height: 6px; border: 0; border-radius: 4px; background: #eaf0f5; }
meter::-webkit-meter-optimum-value { border-radius: 4px; background: #46688c; }
meter::-moz-meter-bar { border-radius: 4px; background: #46688c; }
.audit-row, .consistency-row, .metric-row, .builder-stat-row, .stability-stat-row, .location-metric-row, .delta-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 9px 0;
  border-bottom: 1px solid #edf1f5;
  color: #6e7e92;
  font-size: 10.5px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.audit-row:last-child, .consistency-row:last-child, .metric-row:last-child, .builder-stat-row:last-child, .stability-stat-row:last-child, .location-metric-row:last-child, .delta-row:last-child { border-bottom: 0; }
.audit-row > :last-child, .consistency-row > :last-child, .metric-row > :last-child, .builder-stat-row > :last-child, .stability-stat-row > :last-child, .location-metric-row > :last-child, .delta-row > :last-child { color: #2b435f; text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.metric-section { margin: 19px 0 5px; color: #516a84; font-size: 9px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.consistency-ok, .location-high, .delta-value.positive, .compare-location-delta-positive { color: var(--success) !important; }
.consistency-review, .delta-value.negative, .compare-location-delta-negative { color: var(--danger) !important; }
.location-not-high, .delta-value.neutral, .compare-location-delta-neutral { color: #6c7c90 !important; }
.builder-validity, .location-status { margin: 0 0 10px; padding: 12px; border: 1px solid #e1e8ef; border-radius: 9px; color: #5d718a; background: #f6f8fb; font-size: 10.5px; font-weight: 600; line-height: 1.7; overflow-wrap: anywhere; }
.builder-validity.pending, .location-status.loading { color: #59718a; background: #f3f7fb; }
.builder-validity.valid, .location-status.available { color: #29604d; border-color: #d8e8df; background: #f1f8f4; }
.builder-validity.invalid, .location-status.unavailable { color: #9a4050; border-color: #efdbe0; background: #fcf3f5; }
.panel .builder-validity { margin: 0; }
.panel .inspector-empty { padding: 8px 3px 18px; text-align: center; font-size: 12px; line-height: 1.8; }
.inspector-empty::before {
  content: "";
  display: block;
  width: 62px;
  height: 62px;
  margin: 0 auto 15px;
  border-radius: 50%;
  background: linear-gradient(#385b7d, #385b7d) center/25px 1.5px no-repeat,
              linear-gradient(#385b7d, #385b7d) center/1.5px 25px no-repeat,
              radial-gradient(circle, #eef3f9 8px, #385b7d 8px, #385b7d 9.3px, #eef3f9 9.3px);
}
.location-contribution-block, .location-evidence-block, .compare-location-evidence-block { padding: 10px 0; border-bottom: 1px solid #edf1f5; }
.location-contribution-heading { display: flex; justify-content: space-between; align-items: start; gap: 10px; color: #65778e; font-size: 11px; }
.location-contribution-heading strong { color: #2a4563; text-align: right; font-variant-numeric: tabular-nums; }
.location-contribution-block small, .location-evidence-block small, .compare-location-evidence-block small { display: block; margin-top: 5px; color: #7b8a9d; font-size: 10px; line-height: 1.6; }

/* Map surfaces and small, restrained glass overlays */
.map-panel, .compare-map-panel, .builder-map-panel, .stability-map-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--panel-radius);
  background: #fff;
  box-shadow: var(--panel-shadow);
}
.map-toolbar, .compare-map-toolbar {
  position: relative;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  min-height: 64px;
  padding: 12px 16px;
  border-bottom: 1px solid #e7edf4;
  background: #fff;
}
.map-toolbar > div:first-child, .compare-map-toolbar > div:first-child, .map-toolbar-title { flex: 1 1 auto; min-width: 0; }
.map-toolbar strong, .compare-map-toolbar strong { display: block; color: #1c3554; font-size: 15px; font-weight: 730; letter-spacing: -.025em; }
.map-toolbar small, .compare-map-toolbar small { display: block; margin-top: 4px; color: #738299; font-size: 10px; line-height: 1.5; }
.map-toolbar .map-scenario-name { max-width: 35ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-toolbar-actions, .compare-toolbar-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 7px; flex: 0 1 auto; }
.map-palette-control { display: inline-flex; align-items: center; gap: 7px; padding: 3px 4px 3px 9px; min-height: 36px; border: 1px solid #dbe4ee; border-radius: 8px; background: #fff; }
.map-palette-control > span { color: #6a7a90; font-size: 10px; }
main .map-palette-control select { width: 80px; min-width: 80px; min-height: 27px; padding: 3px 3px 3px 5px; border: 0; border-radius: 5px; box-shadow: none; font-size: 11px; }
.map-canvas-wrap { position: relative; flex: 1 1 0; min-height: 320px; margin: 8px; border-radius: 11px; overflow: hidden; background: #e8eef2; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; background: #e8eef2; }
#builder-map, #stability-map { position: relative; flex: 1 1 0; min-height: 320px; margin: 8px; border-radius: 11px; overflow: hidden; background: #e8eef2; }
.map-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 5px 14px; flex: 0 0 auto; padding: 9px 14px; min-height: 37px; border-top: 1px solid #edf1f5; color: #75869a; background: #fff; font-size: 9px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.map-state-line { flex-basis: 100%; color: #657a93; }
.map-state-line small { font: inherit; }
.floating-legend { position: absolute; z-index: 10; bottom: 17px; left: 16px; width: 218px; max-width: calc(100% - 32px); padding: 12px 13px 10px; border: 1px solid rgba(218, 227, 237, .85); border-radius: 10px; background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 3px 12px rgba(25, 47, 71, .12); pointer-events: none; }
.floating-legend strong { display: block; margin-bottom: 7px; color: #27425f; font-size: 11px; font-weight: 650; }
.floating-legend small { display: block; margin-top: 5px; color: #78879a; font-size: 9px; }
#prospectivity-ramp, .compare-ramp, .builder-ramp, .difference-ramp, .stable-zone-ramp, .stability-ramp-empty { height: 9px; border-radius: 4px; }
#prospectivity-ramp, .compare-ramp, .builder-ramp { background: var(--navy-ramp); }
.difference-ramp { background: var(--difference-ramp); }
.stable-zone-ramp { background: var(--stable-zone); }
.stability-ramp-empty { background: #e7edf3; }
.ramp-labels { display: flex; justify-content: space-between; gap: 10px; margin-top: 5px; color: #627892; font-size: 9px; font-variant-numeric: tabular-nums; }
.compare-legend, .builder-legend, .stability-legend { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 18px; flex: 0 0 auto; padding: 10px 16px; border-top: 1px solid #edf1f5; background: #fff; }
.compare-legend strong, .builder-legend strong, .stability-legend strong { display: block; color: #35516f; font-size: 10.5px; font-weight: 650; }
.compare-legend small, .builder-legend small, .stability-legend small { display: block; margin-top: 2px; color: #7c8b9e; font-size: 9px; }
.compare-ramp-wrap, .builder-ramp-wrap, .stability-ramp-wrap { flex: 1 1 155px; max-width: 230px; }
main .ol-control { padding: 3px; border: 1px solid rgba(211, 222, 234, .9); border-radius: 9px; background: rgba(255, 255, 255, .94); box-shadow: 0 3px 10px rgba(26, 44, 68, .12); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
main .ol-control button { display: block; width: 31px; height: 31px; min-height: 31px; margin: 1px; padding: 0; border: 0; border-radius: 5px; color: #173954; background: transparent; box-shadow: none; font-size: 22px; font-weight: 450; line-height: 1; }
main .ol-control button:hover:not(:disabled) { color: #173954; background: #e9f0f7; }
main .ol-zoom { top: 12px; right: 12px; left: auto; }
main .ol-scale-line { right: 10px; bottom: 24px; left: auto; padding: 4px 6px; border-radius: 5px; background: rgba(255, 255, 255, .84); }
main .ol-scale-line-inner { color: #27425f; border-color: #27425f; font-size: 9px; }
main .ol-attribution { right: 4px; bottom: 3px; max-width: calc(100% - 8px); padding: 1px 5px; border: 0; border-radius: 4px; box-shadow: none; background: rgba(255, 255, 255, .87); font-size: 8px; }
main .ol-attribution ul, main .ol-attribution a { color: #61758b; text-shadow: none; }
main .ol-attribution button { width: 20px; height: 20px; min-height: 20px; font-size: 11px; }

/* Scenario comparison */
.compare-map-toolbar { flex-wrap: wrap; }
.compare-map-toolbar > div:first-child { flex-basis: 100%; }
.compare-toolbar-actions { width: 100%; justify-content: flex-start; }
.view-mode-switch { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid #e3eaf2; border-radius: 9px; background: #f3f6fa; }
main .view-mode-button { min-height: 29px; padding: 5px 12px; border: 0; border-radius: 6px; background: transparent; color: #657a91; font-size: 10px; box-shadow: none; }
main .view-mode-button.active { color: #163858; background: #fff; box-shadow: 0 1px 5px rgba(27, 48, 74, .1); }
.swipe-control-bar { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; min-height: 38px; padding: 6px 16px; color: #708399; background: #f8fafc; border-bottom: 1px solid #e9eef4; font-size: 10px; }
.swipe-control-bar label { flex: 0 0 auto; }
.swipe-control-bar input { flex: 1 1 0; width: 0; min-width: 45px; margin: 0; }
#swipe-value { width: 34px; color: #2d4865; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.compare-map-shell { position: relative; flex: 1 1 0; min-height: 320px; margin: 8px; border-radius: 11px; overflow: hidden; isolation: isolate; background: #e8eef2; }
.compare-map { position: absolute; inset: 0; width: 100%; height: 100%; }
.compare-map-overlay { z-index: 5; clip-path: inset(0 0 0 50%); pointer-events: none; }
.swipe-divider { position: absolute; z-index: 20; top: 0; bottom: 0; left: 50%; width: 2px; transform: translateX(-1px); background: #fff; box-shadow: 0 0 0 1px rgba(17, 39, 63, .2); pointer-events: none; }
.swipe-handle { position: absolute; top: 50%; left: 50%; display: grid; place-items: center; width: 38px; height: 38px; transform: translate(-50%, -50%); border: 3px solid #fff; border-radius: 50%; color: #fff; background: #2d4d70; box-shadow: 0 3px 12px rgba(18, 43, 68, .24); font-size: 18px; }
.compare-map-label { position: absolute; z-index: 15; top: 12px; display: flex; align-items: center; gap: 7px; max-width: 43%; padding: 7px 9px; border: 1px solid #dce5ef; border-radius: 8px; background: rgba(255,255,255,.96); box-shadow: 0 2px 7px rgba(19, 40, 65, .07); color: #2a4563; pointer-events: none; }
.compare-map-label-left { left: 12px; }
.compare-map-label-right { right: 12px; }
.compare-map-label span, .compare-location-scenarios span { display: grid; place-items: center; width: 22px; height: 22px; flex: 0 0 22px; border-radius: 5px; background: #e8eff7; color: #254767; font-size: 10px; font-weight: 750; }
.compare-map-label strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; font-weight: 600; }
.difference-map-label { left: 50%; right: auto; max-width: 75%; transform: translateX(-50%); }
.compare-map .ol-zoom { top: 62px; left: 12px; right: auto; }
.compare-location-scenarios { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 8px 0 12px; }
.compare-location-scenarios > div { display: flex; align-items: flex-start; gap: 6px; min-width: 0; padding: 8px; border-radius: 7px; background: #f3f7fb; }
.compare-location-scenarios strong { min-width: 0; color: #3a5574; font-size: 10px; font-weight: 650; line-height: 1.5; overflow-wrap: anywhere; }
.compare-location-table { width: 100%; max-width: 100%; margin-top: 7px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.compare-location-table-header, .compare-location-table-row { display: grid; grid-template-columns: minmax(91px, 1.3fr) repeat(3, minmax(53px, .9fr)); gap: 7px; min-width: 272px; }
.compare-location-table-header { padding: 7px 0; border-bottom: 1px solid #dce5ef; color: #7a8ba0; font-size: 9px; font-weight: 650; }
.compare-location-table-row { padding: 8px 0; border-bottom: 1px solid #edf1f5; color: #61758d; font-size: 10px; }
.compare-location-table-header > :not(:first-child), .compare-location-table-row > :not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }

/* Model Builder */
.judgment-group { margin-top: 8px; border: 1px solid #e2e9f1; border-radius: 10px; background: #fbfcfe; }
.judgment-group > summary { padding: 13px 12px; font-size: 11px; }
.judgment-group[open] > summary { margin-bottom: 0; border-bottom: 1px solid #e8eef5; }
.judgment-pair { margin-inline: 12px; padding: 13px 0; border-top: 1px solid #e8eef5; }
.judgment-pair:first-of-type { border-top: 0; }
.judgment-criteria { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; margin-bottom: 8px; color: #49637e; font-size: 10px; font-weight: 600; }
.judgment-versus { color: #8a99aa; font-size: 9px; }
main .judgment-select { min-height: 37px; padding-inline: 7px; font-size: 10.5px; }
.builder-action-stack { display: grid; gap: 8px; }
.builder-action-stack > button { width: 100%; }
.builder-action-card { position: sticky; bottom: 0; z-index: 4; box-shadow: 0 -5px 18px rgba(25, 45, 69, .06); }
.saved-scenario, .custom-audit-row { margin-top: 9px; padding: 12px; border: 1px solid #e3eaf2; border-radius: 9px; background: #f9fbfd; }
.saved-scenario:first-child, .custom-audit-row:first-child { margin-top: 0; }
.saved-scenario-name, .custom-audit-row strong, .custom-scenario-row strong { display: block; color: #2e4a68; font-size: 11px; font-weight: 650; }
.saved-scenario-date, .custom-audit-row small { display: block; margin-top: 4px; color: #7c8da1; font-size: 9px; }
.saved-scenario-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
main .saved-scenario-actions button { min-height: 29px; padding: 5px 9px; font-size: 10px; }

/* Sensitivity and persistence */
.stability-mode-switch { display: grid; gap: 7px; }
main .stability-mode { position: relative; width: 100%; min-height: 44px; padding: 11px 13px; text-align: left; color: #5b718a; background: #fff; font-size: 11px; }
main .stability-mode::after { content: ""; position: absolute; right: 13px; top: 50%; width: 6px; height: 6px; border: solid #8a9baf; border-width: 1.5px 1.5px 0 0; transform: translateY(-50%) rotate(45deg); }
main .stability-mode.active { border-color: #b9cadb; color: #163858; background: #edf3f9; box-shadow: inset 3px 0 0 #41658b; }
main .stability-mode.active:hover { background: #e5eef7; }
.display-mode-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; padding: 4px; margin-bottom: 18px; border: 1px solid #e1e8f0; border-radius: 9px; background: #f3f6fa; }
main .display-mode-button { min-height: 38px; padding: 7px; border: 0; border-radius: 6px; color: #6c7f96; background: transparent; font-size: 10px; }
main .display-mode-button.active { color: #193d60; background: #fff; box-shadow: 0 1px 5px rgba(28, 49, 75, .1); }
.stability-run-button { width: 100%; margin-top: 12px; }
.custom-scenario-row + .custom-scenario-row { border-top: 1px solid #edf1f5; }
.stability-membership-row { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 9px; padding: 10px 0; border-bottom: 1px solid #edf1f5; }
.stability-membership-row > span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: 10px; font-weight: 700; }
.stability-member-yes { color: #2d6a52; background: #eaf5ee; }
.stability-member-no { color: #9f4555; background: #f9ecef; }
.stability-membership-row strong { display: block; color: #395572; font-size: 10.5px; }
.stability-membership-row small { display: block; margin-top: 3px; color: #7b8ca0; font-size: 9.5px; }

/* Service state and scientific scope remain available without competing with maps. */
.error-banner { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 15px; padding: 12px 16px; border: 1px solid #eacfd7; border-radius: 10px; background: #fdf2f5; color: #934053; font-size: 12px; }
.app-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 5px 17px; color: #7c8b9d; font-size: 9px; line-height: 1.6; }
.app-footer > p { max-width: 103ch; margin: 0; }
.footer-utility { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 14px; flex: 0 0 auto; }
.footer-utility > a { color: #7a8ca2; text-decoration: none; font-size: 9px; }
.status { display: inline-flex; align-items: center; gap: 6px; color: #71879b; font-size: 9px; }
.status::before { content: ""; width: 5px; height: 5px; flex: 0 0 5px; border-radius: 50%; background: #94a7bb; }
.status[data-state="ready"]::before { background: #55846f; }
.status[data-state="error"] { color: #9e4b5a; }
.status[data-state="error"]::before { background: #b46773; }

/* Responsive layouts preserve useful map space and avoid page-level overflow. */
@media (min-width: 1600px) {
  :root { --page-gutter: 38px; --workspace-gap: 19px; }
  .workspace { grid-template-columns: 294px minmax(0, 1fr) 338px; }
  .compare-workspace { grid-template-columns: 286px minmax(0, 1fr) 346px; }
  .builder-workspace { grid-template-columns: 326px minmax(0, 1fr) 346px; }
  .stability-workspace { grid-template-columns: 302px minmax(0, 1fr) 346px; }
  .compare-map-toolbar { flex-wrap: nowrap; }
  .compare-map-toolbar > div:first-child { flex-basis: auto; }
  .compare-toolbar-actions { width: auto; justify-content: flex-end; }
}
@media (max-width: 1320px) {
  :root { --page-gutter: 22px; --panel-pad: 17px; --workspace-gap: 13px; }
  .workspace { grid-template-columns: 246px minmax(0, 1fr) 282px; }
  .compare-workspace { grid-template-columns: 242px minmax(0, 1fr) 292px; }
  .builder-workspace { grid-template-columns: 274px minmax(0, 1fr) 292px; }
  .stability-workspace { grid-template-columns: 258px minmax(0, 1fr) 292px; }
  .panel-heading { gap: 9px; }
  .panel-heading h2 { font-size: 15px; }
  .panel-heading .panel-icon { width: 30px; height: 30px; flex-basis: 30px; }
  .panel-heading .panel-icon svg { width: 21px; height: 21px; }
  .map-toolbar { flex-wrap: wrap; }
  .map-toolbar > div:first-child { flex-basis: 100%; }
  .map-toolbar-actions { justify-content: flex-start; }
  .context-stats { font-size: 10px; }
}
@media (max-width: 1100px) {
  .workspace, .compare-workspace, .builder-workspace, .stability-workspace {
    height: auto;
    max-height: none;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "map map" "controls results";
    align-items: start;
    gap: 18px;
  }
  .map-panel, .compare-map-panel, .builder-map-panel, .stability-map-panel { height: 630px; }
  .sidebar { overflow: visible; padding: 0; }
  .panel-heading h2 { font-size: 17px; }
  .map-toolbar { flex-wrap: nowrap; }
  .map-toolbar > div:first-child { flex-basis: auto; }
  .map-toolbar-actions { justify-content: flex-end; }
  .compare-map-toolbar { flex-wrap: nowrap; }
  .compare-map-toolbar > div:first-child { flex-basis: auto; }
  .compare-toolbar-actions { width: auto; justify-content: flex-end; }
  .builder-action-card { position: static; }
  .workspace-context { max-width: 40%; }
  .context-stats { flex-wrap: wrap; justify-content: flex-end; gap: 5px 11px; }
  .context-stats > span + span { padding-left: 11px; }
  .app-footer { align-items: flex-start; }
}
@media (max-width: 760px) {
  :root { --page-gutter: 14px; --workspace-gap: 14px; --panel-pad: 18px; }
  .workspace-intro { align-items: flex-start; padding: 23px 3px 21px; }
  .workspace-intro h1 { font-size: 33px; }
  .workspace-subtitle { max-width: 40ch; font-size: 12px; line-height: 1.7; }
  .workspace-context { display: none; }
  .workspace, .compare-workspace, .builder-workspace, .stability-workspace { grid-template-columns: minmax(0, 1fr); grid-template-areas: "map" "controls" "results"; gap: 15px; }
  .map-panel, .compare-map-panel, .builder-map-panel, .stability-map-panel { height: 550px; }
  .compare-map-panel { height: 620px; }
  .map-toolbar { flex-wrap: wrap; gap: 9px; padding: 12px; }
  .map-toolbar > div:first-child { flex-basis: 100%; }
  .map-toolbar-actions { justify-content: flex-start; }
  .compare-map-toolbar { flex-wrap: wrap; padding: 12px; }
  .compare-map-toolbar > div:first-child { flex-basis: 100%; }
  .compare-toolbar-actions { width: 100%; justify-content: flex-start; gap: 6px; }
  .map-toolbar button, .compare-toolbar-actions button { min-height: 37px; }
  .map-canvas-wrap, .compare-map-shell, #builder-map, #stability-map { min-height: 250px; margin: 6px; }
  main select, main .text-input, main .judgment-select { font-size: 16px; }
  main .map-palette-control select { min-height: 31px; width: 98px; font-size: 14px; }
  main button { min-height: 42px; }
  main details > summary { min-height: 46px; }
  .floating-legend { bottom: 16px; left: 10px; width: 180px; padding: 10px; }
  .floating-legend strong { font-size: 10px; }
  .map-footer { font-size: 8.5px; padding: 8px 12px; }
  .map-footer > span:last-child { display: none; }
  .map-toolbar .map-scenario-name { max-width: 45ch; }
  .panel-heading h2 { font-size: 17px; }
  .field-label { font-size: 12px; }
  .layer-row { font-size: 13px; }
  .evidence-name { font-size: 12px; }
  .evidence-group > summary { font-size: 13px; }
  .evidence-group-body { padding-bottom: 12px; }
  .panel .small-note { font-size: 11px; }
  .audit-row, .consistency-row, .metric-row, .builder-stat-row, .stability-stat-row, .location-metric-row, .delta-row { font-size: 11px; }
  .app-footer { display: block; padding: 17px 3px 24px; }
  .footer-utility { justify-content: flex-start; margin-top: 12px; }
  .error-banner { align-items: flex-start; font-size: 11px; }
}
@media (max-width: 390px) {
  :root { --page-gutter: 9px; --panel-pad: 16px; }
  .workspace-intro h1 { font-size: 29px; }
  .map-toolbar-actions { gap: 5px; }
  .map-toolbar button, .compare-toolbar-actions > button { padding-inline: 8px; font-size: 10px; }
  .map-palette-control > span { font-size: 9px; }
  .compare-map-label { gap: 5px; padding: 6px; }
  .compare-map-label strong { font-size: 9px; }
  .floating-legend { width: 160px; bottom: 49px; }
}
@media (prefers-reduced-motion: reduce) {
  main button, main select, main .text-input, main details > summary::after { transition: none; }
}
