.atlas-shell {
  --atlas-ink: var(--ink, #171814);
  --atlas-muted: var(--muted, #5d665f);
  --atlas-line: var(--line, rgba(20, 26, 22, 0.14));
  --atlas-paper: var(--paper-soft, #fffdfa);
  --atlas-green: var(--green, var(--forest, #1f6b43));
  --atlas-deep: var(--green-deep, var(--forest-deep, #092a1c));
  color: var(--atlas-ink);
}

.atlas-shell button,
.atlas-shell input,
.atlas-shell select {
  font: inherit;
}

.atlas-shell button,
.atlas-shell summary,
.atlas-shell [role="option"] {
  -webkit-tap-highlight-color: transparent;
}

.atlas-label {
  color: var(--atlas-muted);
}

.atlas-workflow-shell {
  display: grid;
  gap: clamp(22px, 3vw, 36px);
}

.atlas-command-bar {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 14px clamp(18px, 3vw, 34px);
  align-items: end;
  padding: 0 0 22px;
  border-bottom: 1px solid var(--atlas-line);
}

.atlas-crop-picker {
  display: grid;
  gap: 8px;
  max-width: 620px;
}

.atlas-crop-picker > label,
.atlas-control-compact label,
.atlas-district-search label {
  color: var(--atlas-muted);
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.atlas-combobox-wrap {
  position: relative;
}

.atlas-crop-input,
.atlas-control-compact select,
.atlas-district-search input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--atlas-line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--atlas-ink);
  padding: 10px 13px;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.atlas-crop-input {
  min-height: 58px;
  padding-right: 46px;
  font-family: var(--serif, Georgia, serif);
  font-size: clamp(1.15rem, 1.5vw, 1.36rem);
}

.atlas-crop-input:focus,
.atlas-control-compact select:focus,
.atlas-district-search input:focus {
  outline: none;
  border-color: var(--atlas-green);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(31, 107, 67, 0.12);
}

.atlas-crop-cue {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-52%);
  color: var(--atlas-green);
  pointer-events: none;
  font-size: 1.2rem;
}

.atlas-native-crop-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.atlas-combobox-options {
  position: absolute;
  z-index: 40;
  top: calc(100% + 7px);
  left: 0;
  right: 0;
  max-height: min(360px, 52vh);
  overflow-y: auto;
  border: 1px solid rgba(9, 42, 28, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.985);
  box-shadow: 0 24px 54px rgba(18, 41, 28, 0.16);
  padding: 7px;
  overscroll-behavior: contain;
}

.atlas-combobox-option {
  min-height: 44px;
  display: flex;
  align-items: center;
  border-radius: 5px;
  padding: 9px 11px;
  color: var(--atlas-ink);
  cursor: pointer;
}

.atlas-combobox-option:hover,
.atlas-combobox-option.is-active {
  background: rgba(31, 107, 67, 0.09);
  color: var(--atlas-deep);
}

.atlas-combobox-option[aria-selected="true"] {
  font-weight: 600;
}

.atlas-combobox-option[aria-selected="true"]::after {
  content: "Selected";
  margin-left: auto;
  color: var(--atlas-green);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.atlas-combobox-empty {
  margin: 0;
  padding: 13px;
  color: var(--atlas-muted);
}

.atlas-refine {
  position: relative;
  align-self: end;
}

.atlas-refine-summary {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--atlas-line);
  border-radius: 999px;
  list-style: none;
  color: var(--atlas-deep);
  padding: 10px 18px;
  cursor: pointer;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.atlas-refine-summary::-webkit-details-marker {
  display: none;
}

.atlas-refine-summary::after {
  content: "+";
  font-size: 1rem;
}

.atlas-refine[open] .atlas-refine-summary::after {
  content: "−";
}

.atlas-refine-summary:hover,
.atlas-refine-summary:focus-visible {
  outline: none;
  border-color: var(--atlas-deep);
  background: var(--atlas-deep);
  color: #fff;
}

.atlas-refine-panel {
  position: absolute;
  z-index: 35;
  top: calc(100% + 10px);
  right: 0;
  width: min(430px, calc(100vw - 40px));
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  border: 1px solid rgba(9, 42, 28, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.99);
  box-shadow: 0 24px 60px rgba(18, 41, 28, 0.16);
  padding: 20px;
}

.atlas-control-compact {
  display: grid;
  gap: 7px;
}

.atlas-control-year,
.atlas-toggle,
.atlas-action {
  grid-column: 1 / -1;
}

.atlas-toggle {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  border-top: 1px solid var(--atlas-line);
  padding-top: 14px;
  color: var(--atlas-muted);
  cursor: pointer;
}

.atlas-toggle input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--atlas-green);
}

.atlas-toggle b,
.atlas-toggle small {
  display: block;
}

.atlas-toggle b {
  color: var(--atlas-ink);
  font-weight: 600;
}

.atlas-toggle small {
  margin-top: 3px;
  line-height: 1.4;
}

.atlas-action {
  width: max-content;
  min-height: 44px;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: var(--atlas-deep);
  padding: 4px 0;
  cursor: pointer;
}

.atlas-action:hover,
.atlas-action:focus-visible {
  outline: none;
  color: var(--atlas-green);
}

.atlas-coverage-line {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: baseline;
  color: var(--atlas-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.atlas-coverage-line strong {
  color: var(--atlas-deep);
  font-weight: 600;
}

.atlas-coverage-line span {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.atlas-mobile-modes {
  display: none;
}

.atlas-decision-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.62fr) minmax(340px, 0.88fr);
  gap: clamp(24px, 3vw, 42px);
  align-items: start;
}

.atlas-map-card {
  position: relative;
  display: flex;
  min-height: clamp(640px, 70vh, 740px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(20, 26, 22, 0.1);
  background: #f1f2ec;
  box-shadow: 0 22px 54px rgba(21, 39, 29, 0.08);
}

.atlas-map-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 28px 0;
}

.atlas-map-title {
  margin: 6px 0 0;
  max-width: 22ch;
  font-family: var(--serif, Georgia, serif);
  font-size: clamp(1.55rem, 2.2vw, 2.15rem);
  font-weight: 400;
  line-height: 1.08;
}

.atlas-map-note {
  max-width: 300px;
  margin: 0;
  color: var(--atlas-muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.atlas-map-frame {
  position: relative;
  flex: 1 1 auto;
  min-height: 520px;
  padding: 0 18px 104px;
}

.atlas-svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 500px;
  overflow: visible;
  transform: scale(1.12);
  transform-origin: 50% 49%;
}

.atlas-district {
  stroke: rgba(24, 44, 31, 0.25);
  stroke-width: 0.5;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: fill 150ms ease-out, stroke 150ms ease-out, filter 150ms ease-out;
}

.atlas-district:hover {
  stroke: var(--atlas-deep);
  stroke-width: 1.2;
  filter: brightness(0.95) contrast(1.06);
}

.atlas-district.is-selected {
  stroke: var(--atlas-deep);
  stroke-width: 2;
  filter: drop-shadow(0 2px 2px rgba(9, 42, 28, 0.16));
}

.atlas-selection-label line {
  stroke: var(--atlas-deep);
  stroke-width: 1.15;
  vector-effect: non-scaling-stroke;
}

.atlas-selection-label circle {
  fill: var(--atlas-deep);
  stroke: #fff;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.atlas-selection-label rect {
  fill: rgba(255, 255, 255, 0.97);
  stroke: rgba(9, 42, 28, 0.22);
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
}

.atlas-selection-label text {
  fill: var(--atlas-deep);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.atlas-marker {
  stroke: rgba(255, 255, 255, 0.96);
  stroke-width: 1.8;
  filter: drop-shadow(0 5px 8px rgba(15, 47, 29, 0.18));
}

.atlas-legend {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 20px;
  border: 1px solid rgba(16, 21, 18, 0.08);
  background: rgba(255, 255, 255, 0.93);
  backdrop-filter: blur(12px);
  padding: 13px 14px;
}

.atlas-legend-title {
  margin: 0 0 8px;
  color: var(--atlas-muted);
}

.atlas-legend-scale,
.atlas-legend-labels {
  display: grid;
  grid-template-columns: repeat(var(--atlas-legend-count, 5), minmax(0, 1fr));
}

.atlas-legend-scale {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
}

.atlas-legend-swatch--crop-0 { background: #eef1e8; }
.atlas-legend-swatch--crop-1 { background: #cadfbe; }
.atlas-legend-swatch--crop-2 { background: #91bf82; }
.atlas-legend-swatch--crop-3 { background: #4f9a63; }
.atlas-legend-swatch--crop-4 { background: #1f6b43; }
.atlas-legend-swatch--empty { background: #e8e7e1; }

.atlas-legend-labels {
  gap: 7px;
  margin-top: 7px;
  color: var(--atlas-muted);
  font-size: 0.62rem;
  line-height: 1.35;
}

.atlas-legend-labels span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.atlas-legend-missing {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  color: var(--atlas-muted);
  font-size: 0.66rem;
}

.atlas-legend-missing > span {
  width: 30px;
  height: 10px;
  flex: 0 0 auto;
  border: 1px solid rgba(24, 44, 31, 0.15);
  background: repeating-linear-gradient(125deg, #e8e7e1 0 4px, #c9ccc4 4px 5px, #e8e7e1 5px 9px);
}

.atlas-intelligence-pane {
  min-width: 0;
  border-top: 1px solid var(--atlas-line);
}

.atlas-pane-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--atlas-line);
}

.atlas-pane-tab,
.atlas-mode-button {
  min-height: 46px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--atlas-muted);
  padding: 10px 8px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.atlas-pane-tab:hover,
.atlas-pane-tab:focus-visible,
.atlas-pane-tab.is-active,
.atlas-mode-button:hover,
.atlas-mode-button:focus-visible,
.atlas-mode-button.is-active {
  outline: none;
  color: var(--atlas-deep);
  border-bottom-color: var(--atlas-green);
}

.atlas-pane-panel {
  padding-top: 22px;
}

.atlas-brief-district {
  margin: 7px 0 0;
  font-family: var(--serif, Georgia, serif);
  font-size: clamp(2rem, 3.2vw, 3.25rem);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.025em;
}

.atlas-decision-block {
  margin-top: 22px;
  border-top: 1px solid var(--atlas-line);
  padding-top: 16px;
}

.atlas-decision-block > span {
  display: block;
  margin-bottom: 8px;
  color: var(--atlas-green);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.atlas-decision-block strong {
  display: block;
  color: var(--atlas-ink);
  font-family: var(--serif, Georgia, serif);
  font-size: clamp(1.18rem, 1.8vw, 1.55rem);
  font-weight: 400;
  line-height: 1.22;
}

.atlas-decision-block p {
  margin: 8px 0 0;
  color: var(--atlas-muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.atlas-decision-block--signal strong {
  color: var(--atlas-deep);
  font-size: clamp(1.35rem, 2.2vw, 1.8rem);
}

.atlas-decision-block--field {
  border-left: 3px solid var(--atlas-green);
  background: rgba(31, 107, 67, 0.055);
  padding: 16px 16px 17px;
}

.atlas-field-brief-link {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  margin-top: 22px;
  border-bottom: 1px solid currentColor;
  color: var(--atlas-deep);
  padding-bottom: 4px;
  font-weight: 600;
}

.atlas-field-brief-link:hover,
.atlas-field-brief-link:focus-visible {
  color: var(--atlas-green);
}

.atlas-evidence-details {
  margin-top: 24px;
  border-top: 1px solid var(--atlas-line);
  border-bottom: 1px solid var(--atlas-line);
  padding: 14px 0;
}

.atlas-evidence-details summary {
  width: max-content;
  cursor: pointer;
  color: var(--atlas-deep);
  list-style: none;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.atlas-evidence-details summary::-webkit-details-marker {
  display: none;
}

.atlas-evidence-details summary::after { content: " +"; }
.atlas-evidence-details[open] summary::after { content: " −"; }

.atlas-evidence-list {
  margin: 16px 0 0;
}

.atlas-evidence-list > div {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 16px;
  padding: 11px 0;
  border-top: 1px solid var(--atlas-line);
}

.atlas-evidence-list dt {
  color: var(--atlas-muted);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.atlas-evidence-list dd {
  margin: 0;
  color: var(--atlas-muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.atlas-side-head {
  display: grid;
  gap: 18px;
}

.atlas-side-head h3 {
  margin: 6px 0 0;
  font-family: var(--serif, Georgia, serif);
  font-size: clamp(1.65rem, 2.2vw, 2.15rem);
  font-weight: 400;
  line-height: 1.05;
}

.atlas-district-search {
  display: grid;
  gap: 6px;
}

.atlas-ranking-list {
  display: grid;
  margin-top: 16px;
  border-top: 1px solid var(--atlas-line);
}

.atlas-rank-row {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 54px;
  border: 0;
  border-bottom: 1px solid var(--atlas-line);
  background: transparent;
  padding: 10px 0;
  text-align: left;
  cursor: pointer;
  color: var(--atlas-ink);
}

.atlas-rank-row:hover,
.atlas-rank-row:focus-visible,
.atlas-rank-row.is-selected {
  outline: none;
  color: var(--atlas-green);
}

.atlas-rank-row.is-selected {
  box-shadow: inset 3px 0 0 var(--atlas-green);
  padding-left: 10px;
}

.atlas-rank-index {
  color: var(--atlas-muted);
}

.atlas-rank-row strong,
.atlas-rank-row small {
  display: block;
}

.atlas-rank-row strong {
  font-size: 0.94rem;
}

.atlas-rank-row small {
  margin-top: 3px;
  color: var(--atlas-muted);
  line-height: 1.4;
}

.atlas-rank-toggle {
  width: max-content;
  margin-top: 14px;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: var(--atlas-deep);
  padding: 4px 0;
  cursor: pointer;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.atlas-projects {
  margin-top: 24px;
  border-top: 1px solid var(--atlas-line);
  padding-top: 18px;
}

.atlas-project-list {
  display: grid;
  margin-top: 10px;
}

.atlas-project-row {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 12px;
  align-items: start;
  padding: 11px 0;
  border-top: 1px solid var(--atlas-line);
}

.atlas-project-dot {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--atlas-green);
}

.atlas-project-row strong,
.atlas-project-row em {
  display: block;
}

.atlas-project-row em {
  margin-top: 3px;
  color: var(--atlas-muted);
  font-style: normal;
  font-size: 0.8rem;
}

.atlas-empty {
  padding: 16px 0;
  color: var(--atlas-muted);
}

[hidden] {
  display: none !important;
}

@media (min-width: 901px) {
  .atlas-map-card {
    position: sticky;
    top: 88px;
  }
}

@media (max-width: 1080px) {
  .atlas-decision-grid {
    grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.8fr);
  }

  .atlas-map-card {
    min-height: 610px;
  }

  .atlas-map-frame {
    min-height: 490px;
  }
}

@media (max-width: 900px) {
  .atlas-command-bar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .atlas-decision-grid {
    grid-template-columns: 1fr;
  }

  .atlas-map-card {
    position: relative;
    top: auto;
    min-height: 590px;
  }

  .atlas-map-frame {
    min-height: 470px;
  }

  .atlas-intelligence-pane {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .atlas-workflow-shell {
    gap: 20px;
  }

  .atlas-command-bar {
    grid-template-columns: 1fr auto;
    align-items: end;
    padding-bottom: 18px;
  }

  .atlas-crop-picker {
    min-width: 0;
  }

  .atlas-crop-input {
    min-height: 52px;
    font-size: 1.08rem;
  }

  .atlas-refine-summary {
    min-height: 48px;
    padding-inline: 15px;
  }

  .atlas-refine-panel {
    position: fixed;
    z-index: 80;
    inset: auto 14px 14px;
    width: auto;
    max-height: min(72vh, 620px);
    overflow-y: auto;
    grid-template-columns: 1fr;
    border-radius: 14px;
  }

  .atlas-coverage-line {
    font-size: 0.78rem;
  }

  .atlas-coverage-line span {
    width: 100%;
    font-size: 0.66rem;
  }

  .atlas-mobile-modes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid var(--atlas-line);
    border-bottom: 1px solid var(--atlas-line);
  }

  .atlas-pane-tabs {
    display: none;
  }

  .atlas-shell[data-mobile-mode="ranking"] [data-atlas-pane="map"],
  .atlas-shell[data-mobile-mode="ranking"] [data-atlas-brief-panel] {
    display: none;
  }

  .atlas-shell[data-mobile-mode="ranking"] [data-atlas-ranking-panel] {
    display: block !important;
  }

  .atlas-shell[data-mobile-mode="map"] [data-atlas-ranking-panel] {
    display: none !important;
  }

  .atlas-map-card {
    min-height: 0;
  }

  .atlas-map-head {
    display: grid;
    gap: 12px;
    padding: 20px 20px 0;
  }

  .atlas-map-note {
    max-width: none;
  }

  .atlas-map-frame {
    min-height: 335px;
    padding: 0 6px 12px;
  }

  .atlas-svg {
    min-height: 320px;
    transform: scale(1.04);
  }

  .atlas-legend {
    position: static;
    margin: 0 16px 16px;
  }

  .atlas-intelligence-pane {
    border-top: 0;
  }

  .atlas-pane-panel {
    padding-top: 8px;
  }

  .atlas-brief-district {
    font-size: clamp(2rem, 10vw, 2.8rem);
  }

  .atlas-decision-block strong {
    font-size: 1.22rem;
  }

  .atlas-decision-block--signal strong {
    font-size: 1.42rem;
  }

  .atlas-evidence-list > div {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .atlas-combobox-options {
    max-height: min(340px, 48vh);
  }
}

@media (max-width: 460px) {
  .atlas-command-bar {
    gap: 11px 10px;
  }

  .atlas-refine-summary {
    font-size: 0.67rem;
    padding-inline: 13px;
  }

  .atlas-map-title {
    font-size: 1.48rem;
  }

  .atlas-legend-labels {
    font-size: 0.58rem;
    gap: 3px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .atlas-district,
  .atlas-crop-input,
  .atlas-control-compact select,
  .atlas-district-search input {
    transition: none;
  }
}
