:root {
  --ink: #233b33;
  --green: #2c624d;
  --muted: #586c63;
  --paper: #f4f6f2;
  --line: #d5dfd7;
  --accent: #e5eee6;
  --radius: 10px;
  --header: #173c33;
  --header-text: #d6e6d8;
  --header-hover: #285144;
  --highlight: #efd19a;
}

.site-header {
  height: 68px;
  min-height: 68px;
  padding: 0 28px;
  gap: 24px;
  background: var(--header);
  color: white;
  border-bottom-color: #315649;
}

.brand {
  gap: 10px;
  min-width: 0;
  font-size: 20px;
  letter-spacing: .06em;
}

.brand-mark {
  padding: 0;
  border: 1px solid #688374;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
}

.brand-mark img {
  display: block;
  width: 38px;
  height: 38px;
}

.brand small {
  color: var(--header-text);
  font-size: .75rem;
  letter-spacing: 0;
}

.site-header nav {
  align-self: center;
  align-items: center;
  gap: 6px;
}

.site-header nav a {
  justify-content: center;
  min-height: 38px;
  padding: 6px 13px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--header-text);
  line-height: 1.2;
  text-align: center;
}

.site-header nav a:hover,
.site-header nav a.active {
  background: var(--header-hover);
  color: white;
}

.site-header nav a.active {
  border-color: #537767;
  color: var(--highlight);
}

.site-header .admin-link {
  color: var(--header-text);
  line-height: 1.3;
}

.site-header .admin-link:hover {
  text-decoration: underline;
}

.site-header .language-switcher {
  border-color: #537767;
  background: transparent;
}

.site-header .language-switcher button {
  color: var(--header-text);
}

.site-header .language-switcher button:hover {
  background: var(--header-hover);
  color: white;
}

.site-header .language-switcher button[aria-pressed="true"] {
  background: var(--highlight);
  color: var(--header);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline-color: var(--green);
}

.site-header :focus-visible {
  outline-color: var(--highlight);
}

.field label {
  color: var(--muted);
  font-size: .875rem;
}

.field input,
.field select {
  border-color: var(--line);
  border-radius: 7px;
  font-size: .875rem;
}

.field input::placeholder {
  color: var(--muted);
}

.button {
  border-radius: 7px;
  font-size: .875rem;
}

.button:hover {
  background: var(--accent);
}

.button.primary:hover {
  background: #214a3a;
}

.eyebrow {
  color: var(--green);
}

th {
  background: var(--accent);
}

tbody tr:hover {
  background: #f7faf7;
}

.badge {
  background: var(--accent);
  color: var(--green);
}

.map-layout {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 68px);
  min-height: 660px;
}

.atlas-tools {
  padding: 16px 28px;
  background: white;
  border-bottom: 1px solid var(--line);
}

.atlas-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
  margin-bottom: 14px;
}

.atlas-title h1 {
  margin: 0;
  font-size: clamp(1.35rem, 1.9vw, 1.75rem);
  letter-spacing: -.025em;
}

.atlas-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 14px;
  margin: 0;
  padding: 6px 12px;
  border-radius: 7px;
  background: var(--paper);
  color: var(--muted);
  font-size: .8125rem;
  line-height: 1.5;
}

.atlas-stats strong {
  margin-right: 2px;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}

.atlas-filters {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.atlas-filters > .field,
.atlas-filter-panel .field {
  min-width: 0;
  margin: 0;
}

.atlas-filters label {
  margin-bottom: 5px;
}

.atlas-filters > .filter-actions {
  grid-column: 3;
  grid-row: 1;
  gap: 6px;
  min-height: 40px;
  margin: 0;
}

.atlas-extra {
  grid-column: 1 / -1;
}

.atlas-extra > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: fit-content;
  min-height: 40px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
  color: var(--green);
  cursor: pointer;
  font-size: .875rem;
  font-weight: 600;
  list-style: none;
}

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

.atlas-extra[open] > summary,
.atlas-extra > summary:hover {
  border-color: #a2b9a9;
  background: var(--accent);
}

.atlas-extra[open] > summary span {
  transform: rotate(45deg);
}

.atlas-filter-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.atlas-extra:not([open]) .atlas-filter-panel {
  display: none;
}

.map-shell {
  flex: 1;
  min-height: 430px;
  margin: 14px 28px 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #e7ece9;
}

.map-toolbar {
  top: 16px;
  left: 16px;
}

.map-toolbar .button,
.map-status {
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px #173c3318;
}

.map-status {
  top: 66px;
  left: 16px;
  max-width: min(420px, calc(100% - 65px));
  padding: 9px 12px;
  border-radius: 7px;
}

.map-status.error {
  border-left: 4px solid #a3482e;
}

.map-page .leaflet-control-layers {
  margin-top: 12px;
}

.species-legend {
  left: 16px;
  bottom: 26px;
  width: 440px;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  border-color: var(--line);
  border-radius: 9px;
  background: #fffffff7;
  color: var(--ink);
  box-shadow: 0 2px 12px #173c3320;
}

.legend-heading {
  grid-column: 1 / -1;
  min-height: 32px;
  padding: 6px 12px;
}

.legend-preview {
  display: none;
}

.legend-list,
.legend-statuses {
  padding: 5px 12px;
  border-color: var(--line);
}

.legend-list {
  max-height: none;
}

.legend-statuses {
  border-left: 1px solid var(--line);
}

.legend-row,
.legend-statuses .legend-row {
  gap: 6px;
  padding: 3px 0;
  border: 0;
  font-size: .75rem;
}

.legend-row .plant-symbol,
.legend-row .plant-symbol svg {
  width: 17px;
  height: 17px;
}

.site-footer {
  padding: 18px 28px;
  background: var(--paper);
}

.site-footer .organization-credit {
  max-width: 1100px;
}

@media (max-width: 1050px) {
  .site-header {
    height: auto;
    flex-wrap: wrap;
    gap: 10px 16px;
    padding: 10px 20px;
  }

  .header-tools {
    gap: 10px;
  }

  .atlas-tools {
    padding: 14px 20px;
  }

  .map-layout {
    height: auto;
    min-height: 0;
  }

  .map-shell {
    flex: none;
    height: 70dvh;
    min-height: 540px;
    margin-inline: 20px;
  }
}

@media (max-width: 680px) {
  .site-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
    padding: 10px 16px 8px;
  }

  .brand {
    font-size: 18px;
  }

  .brand small {
    line-height: 1.3;
  }

  .brand-mark img {
    width: 34px;
    height: 34px;
  }

  .header-tools {
    grid-column: 2;
    grid-row: 1;
    max-width: 138px;
    gap: 6px;
  }

  .header-tools .admin-link {
    font-size: .75rem;
    text-align: right;
  }

  .site-header nav {
    grid-column: 1 / -1;
    justify-content: space-between;
    gap: 2px;
    height: auto;
    margin: 0;
  }

  .site-header nav a {
    flex: 1;
    padding: 5px;
    font-size: .875rem;
  }

  .atlas-tools {
    padding: 14px 16px;
  }

  .atlas-title {
    display: block;
    margin-bottom: 12px;
  }

  .atlas-stats {
    margin-top: 8px;
  }

  .atlas-filters {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .atlas-filters > .filter-actions {
    grid-column: auto;
    grid-row: auto;
  }

  .atlas-filters .filter-actions .primary {
    flex: 1;
  }

  .atlas-extra > summary {
    width: 100%;
  }

  .atlas-filter-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .map-shell {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
    margin: 12px;
  }

  #map {
    height: 58dvh;
    min-height: 360px;
  }

  .map-toolbar {
    top: 12px;
    left: 12px;
  }

  .map-status {
    top: 62px;
    left: 12px;
  }

  .species-legend {
    position: relative;
    left: auto;
    bottom: auto;
    width: 100%;
    max-width: none;
    border-width: 1px 0 0;
    border-radius: 0;
    background: white;
    box-shadow: none;
  }

  .site-footer {
    padding: 16px;
  }
}
