:root {
  --field-ink: #173029;
  --field-ink-soft: #314941;
  --canopy: #2f7654;
  --canopy-wash: #dcebe2;
  --survey-blue: #2b6f8a;
  --survey-blue-wash: #d9e9ef;
  --dry-soil: #a7462b;
  --dry-soil-wash: #f4ded5;
  --ripe-grain: #a87f27;
  --ripe-grain-wash: #f2e7c9;
  --slate: #5e6e67;
  --fog: #edf2ef;
  --paper: #f9fbf9;
  --white: #ffffff;
  --control: #e6ede9;
  --line: rgba(23, 48, 41, 0.13);
  --line-strong: rgba(23, 48, 41, 0.24);
  --focus: #116b93;
  --shadow-panel: 0 0 0 1px rgba(23, 48, 41, 0.055), 0 1px 2px rgba(23, 48, 41, 0.035), 0 8px 30px rgba(23, 48, 41, 0.045);
  --radius-control: 7px;
  --radius-panel: 12px;
  --font-body: 'Aptos', 'Candara', 'Segoe UI', sans-serif;
  --font-display: 'Georgia Pro', 'Georgia', serif;
  --font-data: 'Cascadia Mono', 'Consolas', monospace;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--fog);
  color: var(--field-ink);
  font-family: var(--font-body);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(rgba(23, 48, 41, 0.026) 1px, transparent 1px),
    var(--fog);
  background-size: 100% 32px;
  overflow-x: clip;
}

button,
input,
select {
  font: inherit;
}

button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex='0']:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 58%, transparent);
  outline-offset: 2px;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

code {
  font-family: var(--font-data);
  font-size: 0.88em;
  color: var(--field-ink);
  background: var(--control);
  border-radius: 4px;
  padding: 2px 5px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 5000;
  padding: 10px 14px;
  color: white;
  background: var(--field-ink);
  border-radius: var(--radius-control);
  transform: translateY(-140%);
  transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-header {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 28px;
  color: #f5faf7;
  background: var(--field-ink);
}

.brand-lockup,
.header-context,
.mode-chip {
  display: flex;
  align-items: center;
}

.brand-lockup {
  gap: 11px;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 420;
  letter-spacing: -0.02em;
}

.brand-name strong {
  font-weight: 650;
}

.brand-mark {
  width: 29px;
  height: 27px;
  position: relative;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  transform: skewY(-7deg);
}

.brand-mark i {
  display: block;
  height: 3px;
  background: #7cc39a;
  border-radius: 10px 2px 10px 2px;
}

.brand-mark i:nth-child(1) { width: 18px; margin-left: 9px; }
.brand-mark i:nth-child(2) { width: 25px; margin-left: 2px; }
.brand-mark i:nth-child(3) { width: 19px; }

.header-context {
  gap: 16px;
  color: rgba(245, 250, 247, 0.7);
  font-size: 13px;
}

.mode-chip {
  min-height: 36px;
  gap: 7px;
  padding: 7px 10px;
  color: #eff9f3;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 99px;
  cursor: pointer;
  transition: background-color 150ms cubic-bezier(0.23, 1, 0.32, 1), transform 120ms cubic-bezier(0.23, 1, 0.32, 1);
}

.mode-chip:hover { background: rgba(255, 255, 255, 0.12); }
.mode-chip:active { transform: scale(0.97); }

.mode-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9dd3b3;
  box-shadow: 0 0 0 3px rgba(157, 211, 179, 0.13);
}

.demo-notice {
  min-height: 34px;
  padding: 7px 28px;
  color: #573516;
  background: #f0dfb6;
  border-bottom: 1px solid rgba(87, 53, 22, 0.14);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

.demo-notice button {
  padding: 0;
  margin-left: 8px;
  color: inherit;
  background: none;
  border: 0;
  border-bottom: 1px solid currentColor;
  cursor: pointer;
  font-weight: 650;
}

.workspace {
  width: min(1680px, 100%);
  min-height: calc(100vh - 133px);
  margin: 0 auto;
  padding: 20px 24px 28px;
}

.command-bar {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.search-control,
.select-control {
  height: 42px;
  display: flex;
  align-items: center;
  color: var(--slate);
  background: color-mix(in srgb, var(--control) 82%, white);
  border: 1px solid transparent;
  border-radius: var(--radius-control);
}

.search-control:focus-within,
.select-control:focus-within {
  border-color: color-mix(in srgb, var(--focus) 45%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 13%, transparent);
}

.search-control {
  width: min(360px, 31vw);
  position: relative;
}

.control-icon {
  position: absolute;
  left: 12px;
  display: grid;
  pointer-events: none;
}

.control-icon svg { width: 18px; height: 18px; }

.search-control input,
.select-control select {
  width: 100%;
  height: 100%;
  color: var(--field-ink);
  background: transparent;
  border: 0;
  outline: 0;
}

.search-control input {
  padding: 0 12px 0 39px;
}

.search-control input::placeholder { color: #718079; opacity: 1; }

.select-control select {
  padding: 0 34px 0 12px;
  cursor: pointer;
}

.command-spacer { flex: 1; }

.quiet-button,
.action-button,
.icon-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-control);
  cursor: pointer;
  transition:
    background-color 150ms cubic-bezier(0.23, 1, 0.32, 1),
    color 150ms cubic-bezier(0.23, 1, 0.32, 1),
    transform 120ms cubic-bezier(0.23, 1, 0.32, 1);
}

.quiet-button:active,
.action-button:active,
.icon-button:active { transform: scale(0.97); }

.quiet-button {
  padding: 0 12px;
  color: var(--field-ink-soft);
  background: transparent;
  border: 1px solid var(--line);
}

.quiet-button:hover,
.quiet-button[aria-pressed='true'] {
  color: #174e66;
  background: var(--survey-blue-wash);
  border-color: rgba(43, 111, 138, 0.25);
}

.action-button {
  padding: 0 15px;
  color: white;
  background: var(--field-ink);
  border: 1px solid var(--field-ink);
  font-weight: 650;
  box-shadow: 0 1px 1px rgba(8, 34, 26, 0.1);
}

.action-button:hover { background: #24483e; }

.field-ledger {
  min-height: 78px;
  display: grid;
  grid-template-columns: minmax(260px, 1.05fr) 26px minmax(540px, 2fr);
  align-items: stretch;
  margin-bottom: 12px;
  color: #eaf4ef;
  background: #23463c;
  border-radius: var(--radius-panel);
  overflow: hidden;
  box-shadow: var(--shadow-panel);
}

.ledger-primary {
  display: grid;
  grid-template-columns: auto 1fr;
  align-content: center;
  column-gap: 18px;
  padding: 13px 20px;
}

.ledger-label {
  grid-row: 1 / span 2;
  align-self: center;
  padding-right: 18px;
  color: rgba(234, 244, 239, 0.63);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  font-family: var(--font-data);
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.ledger-primary strong {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 510;
  line-height: 1.04;
  letter-spacing: -0.015em;
}

.ledger-primary strong em {
  color: #f2c26f;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.ledger-primary > span:last-child {
  color: rgba(234, 244, 239, 0.67);
  font-size: 12px;
}

.ledger-tick {
  opacity: 0.24;
  background: repeating-linear-gradient(90deg, transparent 0 5px, white 5px 6px, transparent 6px 11px);
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.ledger-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0;
  padding: 0 8px;
}

.ledger-metrics > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 12px 16px;
  border-left: 1px solid rgba(255, 255, 255, 0.09);
}

.ledger-metrics > div:first-child { border-left: 0; }

.ledger-metrics dt {
  color: rgba(234, 244, 239, 0.57);
  font-family: var(--font-data);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ledger-metrics dd {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 660;
  font-variant-numeric: tabular-nums;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  grid-template-rows: minmax(470px, calc(100vh - 336px)) auto;
  gap: 12px;
}

.panel {
  background: rgba(249, 251, 249, 0.97);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
}

.map-panel { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; }
.alert-panel { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; min-height: 580px; }
.detail-panel { grid-column: 1; grid-row: 2; min-height: 356px; }

.panel-heading {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--slate);
  font-family: var(--font-data);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.1em;
  line-height: 1.4;
  text-transform: uppercase;
}

.panel-heading h1,
.panel-heading h2,
.detail-heading h2,
.dialog-header h2 {
  margin: 0;
  color: var(--field-ink);
  font-family: var(--font-display);
  font-weight: 520;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.panel-heading h1 { font-size: 23px; }
.panel-heading h2 { font-size: 22px; }

.map-date {
  margin: 0;
  color: var(--slate);
  font-size: 12px;
  white-space: nowrap;
}

.map-date span {
  width: 7px;
  height: 7px;
  display: inline-block;
  margin-right: 6px;
  background: var(--canopy);
  border-radius: 50%;
}

.map-date strong {
  color: var(--field-ink-soft);
  font-weight: 650;
}

.map-stage {
  min-height: 360px;
  flex: 1;
  position: relative;
  background:
    radial-gradient(circle at 34% 44%, rgba(47, 118, 84, 0.12), transparent 38%),
    linear-gradient(35deg, transparent 48%, rgba(43, 111, 138, 0.05) 49%, rgba(43, 111, 138, 0.05) 50%, transparent 51%),
    #e6eee9;
  background-size: auto, 58px 58px, auto;
}

#map { width: 100%; height: 100%; min-height: 360px; background: transparent; }

.local-map { position: relative; overflow: hidden; }

.geo-map {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.map-grid-line {
  stroke: rgba(23, 48, 41, 0.075);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.region-outline {
  fill: rgba(203, 221, 211, 0.64);
  stroke: #71857b;
  stroke-width: 1.5;
  stroke-dasharray: 8 7;
  vector-effect: non-scaling-stroke;
}

.parcel-shape { cursor: pointer; }
.parcel-shape path { stroke-width: 2; vector-effect: non-scaling-stroke; transition: fill-opacity 150ms cubic-bezier(0.23, 1, 0.32, 1), stroke-width 150ms cubic-bezier(0.23, 1, 0.32, 1); }
.parcel-shape text { fill: var(--field-ink); font-family: var(--font-data); font-size: 8px; font-weight: 700; letter-spacing: 0.05em; paint-order: stroke; stroke: rgba(249, 251, 249, 0.9); stroke-width: 2px; pointer-events: none; }
.parcel-shape.status-critical path { fill: #c85d34; stroke: #8c321d; }
.parcel-shape.status-watch path { fill: #d4ae57; stroke: #7a5918; }
.parcel-shape.status-stable path { fill: #4e9870; stroke: #205d42; }
.parcel-shape.status-no-data path { fill: #89958f; stroke: #4c5d56; stroke-dasharray: 5 4; }
.parcel-shape path { fill-opacity: 0.62; }
.parcel-shape:hover path,
.parcel-shape:focus-visible path { fill-opacity: 0.88; stroke-width: 3; }
.parcel-shape:focus-visible { outline: none; }
.parcel-shape.is-selected path { fill-opacity: 0.9; stroke: #10251f; stroke-width: 4; }
.parcel-shape.is-filtered { opacity: 0.08; pointer-events: none; }

.map-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 650;
  display: grid;
  overflow: hidden;
  border-radius: 7px;
  box-shadow: 0 2px 14px rgba(23, 48, 41, 0.09);
}

.map-controls button {
  width: 40px;
  height: 40px;
  color: var(--field-ink);
  background: rgba(249, 251, 249, 0.95);
  border: 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  font-family: var(--font-data);
  font-size: 20px;
}

.map-controls button:last-child { border-bottom: 0; }
.map-controls button:hover { background: var(--canopy-wash); }

.map-watermark {
  position: absolute;
  top: 17px;
  left: 18px;
  z-index: 500;
  color: rgba(23, 48, 41, 0.32);
  font-family: var(--font-data);
  font-size: 9px;
  letter-spacing: 0.15em;
  pointer-events: none;
}

.map-privacy {
  position: absolute;
  top: 40px;
  left: 18px;
  z-index: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(320px, calc(100% - 100px));
  padding: 8px 10px;
  color: var(--field-ink-soft);
  background: rgba(249, 251, 249, 0.9);
  border: 1px solid rgba(23, 48, 41, 0.12);
  border-radius: var(--radius-control);
  box-shadow: 0 2px 10px rgba(23, 48, 41, 0.06);
  font-size: 10px;
  backdrop-filter: blur(7px);
}

.map-privacy[hidden] { display: none; }
.map-privacy svg { width: 16px; height: 16px; flex: 0 0 auto; }

.map-legend {
  position: absolute;
  bottom: 16px;
  left: 50%;
  z-index: 600;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 11px;
  color: var(--field-ink-soft);
  background: rgba(249, 251, 249, 0.92);
  border: 1px solid rgba(23, 48, 41, 0.12);
  border-radius: 99px;
  box-shadow: 0 2px 12px rgba(23, 48, 41, 0.07);
  transform: translateX(-50%);
  backdrop-filter: blur(8px);
  white-space: nowrap;
  font-size: 10px;
}

.map-legend span { display: flex; align-items: center; gap: 5px; }

.legend-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px 5px 2px 5px;
}

.legend-swatch.status-critical { background: var(--dry-soil); }
.legend-swatch.status-watch { background: var(--ripe-grain); }
.legend-swatch.status-stable { background: var(--canopy); }
.legend-swatch.status-no-data { background: #89958f; }

.leaflet-control-zoom {
  border: 0 !important;
  box-shadow: 0 2px 14px rgba(23, 48, 41, 0.09) !important;
}

.leaflet-control-zoom a {
  width: 38px !important;
  height: 38px !important;
  line-height: 38px !important;
  color: var(--field-ink) !important;
  background: rgba(249, 251, 249, 0.93) !important;
  border-color: var(--line) !important;
}

.leaflet-control-attribution {
  color: var(--slate) !important;
  background: rgba(249, 251, 249, 0.74) !important;
  font-size: 9px !important;
}

.leaflet-tooltip {
  padding: 8px 10px !important;
  color: #eff8f3 !important;
  background: var(--field-ink) !important;
  border: 0 !important;
  border-radius: 5px !important;
  box-shadow: 0 6px 20px rgba(23, 48, 41, 0.18) !important;
  font-family: var(--font-body) !important;
  font-size: 12px !important;
}

.leaflet-tooltip-top::before { border-top-color: var(--field-ink) !important; }
.leaflet-interactive { transition: fill-opacity 150ms cubic-bezier(0.23, 1, 0.32, 1), stroke-width 150ms cubic-bezier(0.23, 1, 0.32, 1); }

.alert-heading { border-bottom: 0; padding-bottom: 4px; }

.count-badge {
  min-width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--field-ink);
  background: var(--control);
  border-radius: 50%;
  font-family: var(--font-data);
  font-size: 12px;
}

.queue-caption {
  margin: 0;
  padding: 0 18px 13px;
  color: var(--slate);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.45;
}

.alert-list {
  min-height: 250px;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(23, 48, 41, 0.28) transparent;
}

.alert-item {
  width: 100%;
  min-height: 78px;
  display: grid;
  grid-template-columns: 28px 31px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 11px 15px 11px 12px;
  color: var(--field-ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  text-align: left;
  transition: background-color 150ms cubic-bezier(0.23, 1, 0.32, 1), transform 120ms cubic-bezier(0.23, 1, 0.32, 1);
}

.alert-item:hover { background: rgba(220, 235, 226, 0.48); }
.alert-item:active { transform: scale(0.992); }
.alert-item.is-selected { background: var(--canopy-wash); box-shadow: inset 3px 0 var(--canopy); }

.priority-rank {
  color: #87938e;
  font-family: var(--font-data);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.status-glyph {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 4px 10px 4px 10px;
  font-family: var(--font-data);
  font-size: 12px;
  font-weight: 700;
}

.status-glyph.status-critical { color: #7c2817; background: var(--dry-soil-wash); }
.status-glyph.status-watch { color: #73510f; background: var(--ripe-grain-wash); }
.status-glyph.status-stable { color: #1c5f3f; background: var(--canopy-wash); }
.status-glyph.status-no-data { color: #4e5d57; background: #e2e7e4; }

.alert-copy,
.alert-reading { min-width: 0; display: flex; flex-direction: column; }

.alert-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 680;
  font-size: 14px;
}

.alert-meta {
  overflow: hidden;
  margin-top: 2px;
  color: var(--slate);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-reading { align-items: flex-end; padding-left: 8px; }

.alert-reading strong {
  font-family: var(--font-data);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.alert-reading small { margin-top: 2px; color: var(--slate); font-size: 9px; white-space: nowrap; }

.queue-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px;
  padding: 13px;
  color: #5c4d27;
  background: #f3ead5;
  border-radius: 8px;
}

.queue-footer svg { width: 23px; height: 23px; flex: 0 0 auto; }
.queue-footer p { margin: 0; font-size: 11px; line-height: 1.45; }

.empty-state {
  min-height: 260px;
  display: grid;
  place-items: center;
  align-content: center;
  padding: 28px;
  color: var(--slate);
  text-align: center;
}

.empty-state > span { margin-bottom: 9px; color: var(--canopy); font-family: var(--font-display); font-size: 42px; }
.empty-state strong { color: var(--field-ink); }
.empty-state p { margin: 5px 0 14px; font-size: 12px; }
.empty-state button { min-height: 40px; padding: 0 12px; color: var(--field-ink); background: var(--control); border: 0; border-radius: var(--radius-control); cursor: pointer; }

.detail-heading {
  min-height: 94px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.detail-identity {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 10px;
  align-items: center;
}

.detail-identity .status-pill { grid-row: 1 / span 3; }
.detail-identity .eyebrow { grid-column: 2; }
.detail-identity h2 { grid-column: 2; font-size: 25px; line-height: 1.02; }
.detail-identity > p:last-child { grid-column: 2; margin: 2px 0 0; color: var(--slate); font-size: 12px; }

.status-pill {
  min-height: 42px;
  display: inline-grid;
  place-items: center;
  align-self: stretch;
  padding: 6px 10px;
  border-radius: 5px 12px 5px 12px;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.status-pill.status-critical { color: #7c2817; background: var(--dry-soil-wash); }
.status-pill.status-watch { color: #73510f; background: var(--ripe-grain-wash); }
.status-pill.status-stable { color: #1c5f3f; background: var(--canopy-wash); }
.status-pill.status-no-data { color: #4e5d57; background: #e2e7e4; }

.campaign-switch {
  display: inline-flex;
  padding: 3px;
  background: var(--control);
  border-radius: 8px;
}

.campaign-switch button {
  min-height: 36px;
  padding: 0 12px;
  color: var(--slate);
  background: transparent;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
  font-size: 11px;
}

.campaign-switch button[aria-pressed='true'] {
  color: var(--field-ink);
  background: white;
  box-shadow: 0 1px 3px rgba(23, 48, 41, 0.09);
  font-weight: 650;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 0;
}

.chart-zone { min-width: 0; padding: 13px 18px 17px; border-right: 1px solid var(--line); }

.chart-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 7px;
}

.chart-metrics > div {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 0 10px;
  border-left: 1px solid var(--line);
}

.chart-metrics > div:first-child { padding-left: 0; border-left: 0; }
.chart-metrics span { color: var(--slate); font-size: 10px; }

.chart-metrics strong {
  font-family: var(--font-data);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.tone-critical { color: var(--dry-soil); }
.tone-watch { color: #805d18; }
.tone-stable { color: var(--canopy); }
.tone-no-data { color: var(--slate); }

.chart-frame { height: 224px; }

.trend-chart { width: 100%; height: 100%; display: flex; flex-direction: column; }
.trend-chart svg { width: 100%; min-height: 0; flex: 1; overflow: visible; }
.chart-line { fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.chart-grid { stroke: rgba(23, 48, 41, 0.085); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-axis-label { fill: #6e7d76; font-family: var(--font-data); font-size: 9px; }
.chart-point { fill: var(--paper); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart-point-current { stroke: var(--canopy); }
.chart-point-history { stroke: var(--survey-blue); }
.chart-legend { min-height: 24px; display: flex; align-items: center; gap: 18px; padding-left: 42px; color: var(--slate); font-size: 10px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 26px; display: inline-block; border-top: 2px solid var(--slate); }
.chart-legend .legend-current { border-color: var(--canopy); }
.chart-legend .legend-baseline { border-color: #718178; border-top-style: dashed; }
.chart-legend .legend-history { border-color: var(--survey-blue); }

.decision-note {
  position: relative;
  margin: 15px;
  padding: 15px;
  background: #f0f4f1;
  border-left: 3px solid var(--slate);
  border-radius: 0 8px 8px 0;
}

.decision-note.status-border-critical { border-left-color: var(--dry-soil); }
.decision-note.status-border-watch { border-left-color: var(--ripe-grain); }
.decision-note.status-border-stable { border-left-color: var(--canopy); }

.decision-note h3 {
  margin: 0 0 8px;
  color: var(--field-ink);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 540;
  line-height: 1.16;
  text-wrap: pretty;
}

.decision-note > p:not(.eyebrow):not(.field-note) {
  margin: 0 0 13px;
  color: var(--field-ink-soft);
  font-size: 11px;
  line-height: 1.48;
  text-wrap: pretty;
}

.decision-note dl { display: grid; gap: 6px; margin: 0; }

.decision-note dl div {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  font-size: 10px;
}

.decision-note dt { color: var(--slate); }
.decision-note dd { margin: 0; color: var(--field-ink); font-weight: 600; }

.field-note {
  margin: 12px 0 0 !important;
  padding: 9px 10px;
  color: #5c4d27 !important;
  background: #f2ead9;
  border-radius: 6px;
  font-size: 10px !important;
}

.field-note span { margin-right: 5px; font-family: var(--font-data); }

.field-evidence {
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.field-evidence > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.field-evidence > div:first-child strong { font-family: var(--font-data); font-size: 11px; }
.field-evidence > p { margin: 4px 0 9px !important; color: var(--slate) !important; font-size: 10px !important; }
.field-evidence .quiet-button { width: 100%; min-height: 36px; background: rgba(255,255,255,.55); font-size: 11px; }
.field-evidence .text-button {
  min-height: 30px;
  margin: -4px 0 8px;
  padding: 0;
  color: #7b3e2e;
  background: transparent;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  font: 600 10px/1.2 var(--font-body);
}

.app-footer {
  min-height: 35px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 28px;
  color: #6a7872;
  border-top: 1px solid var(--line);
  font-size: 10px;
}

.app-footer span:nth-child(2) { flex: 1; text-align: center; }

.app-footer button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  color: var(--field-ink-soft);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-weight: 600;
}

.app-footer svg { width: 15px; height: 15px; }

.method-dialog {
  width: min(700px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  padding: 0;
  color: var(--field-ink);
  background: var(--paper);
  border: 0;
  border-radius: 14px;
  box-shadow: 0 26px 90px rgba(13, 35, 28, 0.28);
}

.method-dialog::backdrop { background: rgba(13, 35, 28, 0.58); backdrop-filter: blur(3px); }

.dialog-header {
  min-height: 79px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 { font-size: 27px; }

.icon-button {
  width: 42px;
  padding: 0;
  color: var(--field-ink-soft);
  background: var(--control);
  border: 0;
}

.dialog-body { max-height: calc(100vh - 235px); padding: 0 20px; overflow-y: auto; }

.dialog-body section { padding: 18px 0; border-bottom: 1px solid var(--line); }
.dialog-body section:last-child { border-bottom: 0; }

.dialog-body h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 540;
}

.dialog-body p,
.dialog-body li {
  color: var(--field-ink-soft);
  font-size: 13px;
  line-height: 1.58;
  text-wrap: pretty;
}

.dialog-body p { margin: 0; }
.dialog-body ol { margin: 8px 0 12px; padding-left: 22px; }
.dialog-body li { margin-bottom: 5px; }

.threshold-table {
  display: grid;
  gap: 1px;
  margin-top: 13px;
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.threshold-table > div {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 14px;
  padding: 10px 12px;
  background: white;
  font-size: 12px;
}

.threshold-table span { color: var(--slate); }
.privacy-note { padding: 11px 12px; background: var(--survey-blue-wash); border-radius: 7px; }

.dialog-actions {
  min-height: 69px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
}

.dialog-actions a {
  margin-right: auto;
  color: var(--survey-blue);
  font-size: 12px;
  font-weight: 650;
}

.data-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 13px;
}

.data-actions button {
  min-height: 42px;
  padding: 8px 11px;
  color: var(--field-ink-soft);
  background: var(--control);
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
  text-align: left;
}

.data-actions button:hover { border-color: var(--line-strong); background: white; }
.data-actions .danger-link { color: #7c2817; background: var(--dry-soil-wash); }
.permission-note { margin-top: 12px !important; color: var(--slate) !important; font-size: 11px !important; }

.visit-dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  color: var(--field-ink);
  background: var(--paper);
  border: 0;
  border-radius: 14px;
  box-shadow: 0 26px 90px rgba(13, 35, 28, 0.28);
}

.visit-dialog::backdrop { background: rgba(13, 35, 28, 0.58); backdrop-filter: blur(3px); }
.visit-dialog .dialog-header h2 { font-size: 23px; }
.visit-form-body { display: grid; gap: 15px; padding: 18px 20px; }
.visit-form-body label { display: grid; gap: 6px; color: var(--field-ink-soft); font-size: 12px; font-weight: 650; }
.visit-form-body label small { color: var(--slate); font-weight: 400; }
.visit-form-body input,
.visit-form-body select,
.visit-form-body textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  color: var(--field-ink);
  background: var(--control);
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  outline: 0;
  resize: vertical;
}

.visit-form-body textarea { min-height: 90px; line-height: 1.45; }
.visit-form-body input:focus,
.visit-form-body select:focus,
.visit-form-body textarea:focus { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 13%, transparent); }
.visit-form-body .privacy-note { padding: 10px 11px; font-size: 11px; }
.visit-form-body .check-setting { grid-template-columns: 22px 1fr; align-items: center; gap: 9px; }
.visit-form-body .check-setting input { width: 20px; min-height: 20px; margin: 0; accent-color: var(--canopy); }

.loading-band,
.loading-detail,
.loading-list { width: 100%; padding: 16px; }
.loading-band { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); align-items: center; gap: 24px; }
.loading-band span,
.loading-detail span,
.loading-list i { display: block; border-radius: 5px; background: linear-gradient(90deg, rgba(255,255,255,.08), rgba(255,255,255,.2), rgba(255,255,255,.08)); background-size: 220% 100%; animation: loading-sweep 1.3s linear infinite; }
.loading-band span { height: 24px; }
.loading-list { display: grid; gap: 1px; padding: 0; }
.loading-list i { height: 78px; border-radius: 0; background: linear-gradient(90deg, #edf2ef, #f9fbf9, #edf2ef); background-size: 220% 100%; border-bottom: 1px solid var(--line); }
.loading-detail { display: grid; gap: 16px; }
.loading-detail span { height: 40px; background: linear-gradient(90deg, #edf2ef, #f9fbf9, #edf2ef); background-size: 220% 100%; }
.loading-detail span:nth-child(2) { height: 190px; }
.loading-map { width: 100%; height: 100%; display: grid; place-items: center; color: var(--slate); font-family: var(--font-data); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.loading-map span::before { content: ''; width: 10px; height: 10px; display: inline-block; margin-right: 8px; border: 2px solid rgba(23,48,41,.18); border-top-color: var(--canopy); border-radius: 50%; animation: spin 800ms linear infinite; vertical-align: -3px; }

.empty-data-state { min-height: 330px; display: grid; place-items: center; align-content: center; padding: 30px; text-align: center; }
.empty-data-state > span { color: var(--canopy); font-family: var(--font-display); font-size: 48px; }
.empty-data-state h2 { margin: 2px 0 7px; font-family: var(--font-display); font-size: 27px; font-weight: 540; }
.empty-data-state > p:not(.eyebrow) { max-width: 520px; margin: 0 0 16px; color: var(--slate); line-height: 1.5; }
.empty-data-state > div { display: flex; gap: 8px; }

@keyframes loading-sweep { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 5000;
  max-width: min(410px, calc(100vw - 32px));
  padding: 12px 14px;
  color: white;
  background: var(--field-ink);
  border-left: 4px solid #7cc39a;
  border-radius: 7px;
  box-shadow: 0 12px 44px rgba(13, 35, 28, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms cubic-bezier(0.23, 1, 0.32, 1), transform 180ms cubic-bezier(0.23, 1, 0.32, 1);
  font-size: 13px;
}

.toast[data-tone='warning'] { border-left-color: #e2b75f; }
.toast[data-tone='error'] { border-left-color: #e17755; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

.fatal-state {
  max-width: 580px;
  margin: 72px auto;
  padding: 30px;
  background: white;
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-panel);
  text-align: center;
}

.fatal-state > span { width: 48px; height: 48px; display: grid; place-items: center; margin: 0 auto; color: #7c2817; background: var(--dry-soil-wash); border-radius: 8px 18px 8px 18px; font-family: var(--font-data); font-weight: 700; }
.fatal-state h1 { font-family: var(--font-display); }

@media (max-width: 1150px) {
  .workspace-grid { grid-template-columns: minmax(0, 1fr) 330px; }
  .field-ledger { grid-template-columns: minmax(240px, 1fr) 18px minmax(450px, 1.7fr); }
  .ledger-primary { column-gap: 12px; padding-inline: 14px; }
  .ledger-metrics > div { padding-inline: 10px; }
  .detail-grid { grid-template-columns: minmax(0, 1fr) 275px; }
  .chart-metrics { grid-template-columns: repeat(2, 1fr); row-gap: 5px; }
  .chart-metrics > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .quiet-button span { display: none; }
  .quiet-button { width: 42px; padding: 0; }
}

@media (max-width: 860px) {
  .app-header { padding: 0 16px; }
  .header-context > span:first-child { display: none; }
  .demo-notice { padding-inline: 16px; text-align: left; }
  .workspace { width: auto; max-width: none; margin: 0; padding: 14px 12px 24px; }
  .command-bar { overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .search-control { min-width: 245px; width: 245px; }
  .select-control { min-width: 160px; }
  .command-spacer { display: none; }
  .field-ledger { grid-template-columns: 1fr; }
  .ledger-primary { min-height: 74px; }
  .ledger-tick { display: none; }
  .ledger-metrics { min-height: 66px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
  .workspace-grid { grid-template-columns: 1fr; grid-template-rows: 500px auto auto; }
  .map-panel { grid-column: 1; grid-row: 1; }
  .alert-panel { grid-column: 1; grid-row: 2; min-height: 0; }
  .detail-panel { grid-column: 1; grid-row: 3; }
  .alert-list { max-height: 360px; }
  .detail-grid { grid-template-columns: 1fr; }
  .chart-zone { border-right: 0; border-bottom: 1px solid var(--line); }
  .decision-note { min-height: 0; }
  .app-footer { padding: 8px 14px; flex-wrap: wrap; }
  .app-footer span:nth-child(2) { display: none; }
  .app-footer button { margin-left: auto; }
}

@media (max-width: 560px) {
  .app-header { width: 100vw; max-width: 100vw; min-height: 58px; position: relative; gap: 10px; overflow: hidden; }
  .brand-lockup { min-width: 0; flex-shrink: 1; }
  .brand-name { font-size: 20px; }
  .header-context { display: none; }
  .demo-notice { font-size: 11px; }
  .demo-notice button { display: block; margin: 3px 0 0; }
  .workspace-grid { grid-template-rows: 470px auto auto; }
  .ledger-primary { grid-template-columns: 86px 1fr; }
  .ledger-primary strong { font-size: 20px; }
  .ledger-metrics { grid-template-columns: repeat(2, 1fr); }
  .ledger-metrics > div:nth-child(3) { border-left: 0; border-top: 1px solid rgba(255, 255, 255, 0.09); }
  .ledger-metrics > div:nth-child(4) { border-top: 1px solid rgba(255, 255, 255, 0.09); }
  .panel-heading h1 { font-size: 19px; }
  .map-date { display: none; }
  .map-legend { max-width: calc(100% - 28px); gap: 9px; overflow-x: auto; justify-content: flex-start; border-radius: 7px; }
  .map-privacy { left: 10px; top: 38px; }
  .map-watermark { left: 11px; }
  .detail-heading { align-items: flex-start; flex-direction: column; }
  .detail-identity { width: 100%; }
  .campaign-switch { width: 100%; }
  .campaign-switch button { flex: 1; }
  .chart-zone { padding-inline: 12px; }
  .chart-metrics { grid-template-columns: repeat(2, 1fr); }
  .chart-metrics > div { display: flex; flex-direction: column; gap: 1px; }
  .chart-metrics > div:nth-child(3) { padding-left: 0; }
  .chart-frame { height: 220px; }
  .threshold-table > div { grid-template-columns: 1fr; gap: 3px; }
  .dialog-actions { align-items: stretch; flex-direction: column; }
  .dialog-actions a { margin: 0; text-align: center; }
  .dialog-actions .action-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (forced-colors: active) {
  .legend-swatch,
  .status-glyph,
  .status-pill { border: 1px solid currentColor; }
  .leaflet-interactive { fill: Canvas !important; stroke: LinkText !important; }
}
