:root {
  --bg: #7d837e;
  --ink: #13211f;
  --muted-ink: #5c6a66;
  --surface: rgba(238, 247, 235, 0.7);
  --surface-strong: rgba(248, 253, 246, 0.84);
  --surface-subtle: rgba(224, 241, 232, 0.55);
  --line: rgba(34, 62, 55, 0.14);
  --accent: #108d79;
  --accent-2: #d58628;
  --danger: #d64d47;
  --warning: #d9ad26;
  --ok: #18a979;
  --shadow: 0 22px 80px rgba(22, 36, 35, 0.28);
  --radius: 8px;
  --glass-blur: blur(22px) saturate(1.25);
  --toolbar-height: 82px;
  --lower-stack-height: clamp(340px, 40svh, 430px);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background:
    radial-gradient(
      circle at 18% 8%,
      rgba(216, 233, 212, 0.34),
      transparent 28rem
    ),
    radial-gradient(
      circle at 78% 4%,
      rgba(118, 189, 187, 0.3),
      transparent 24rem
    ),
    var(--bg);
  color: var(--ink);
  overflow-x: hidden;
  overflow-y: auto;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.workspace {
  width: 100vw;
  min-height: max(720px, 100svh);
  margin: 0;
  padding: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}

.glass {
  background: var(--surface);
  /* border: 1px solid rgba(255, 255, 255, 0.48); */
  box-shadow: var(--shadow);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.search-box svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.map-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 320px;
  height: auto;
  overflow: hidden;
  border-radius: 0;
  border: 0;
  background: #9bcfc9;
}

.map-chart {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
}

.map-loading {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  min-width: 260px;
  padding: 14px 18px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  color: var(--muted-ink);
  background: rgba(246, 252, 242, 0.74);
  box-shadow: 0 16px 44px rgba(22, 36, 35, 0.16);
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.map-loading.is-hidden {
  display: none;
}

.map-controls {
  position: absolute;
  top: calc((100% - var(--lower-stack-height) + var(--toolbar-height)) / 2);
  left: 22px;
  z-index: 7;
  display: grid;
  gap: 8px;
  padding: 8px;
  border-radius: 999px;
  transform: translateY(-50%);
  background: rgba(239, 249, 235, 0.62);
  box-shadow: 0 18px 52px rgba(22, 36, 35, 0.18);
}

.map-controls button {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.66);
  transition:
    background 180ms ease,
    transform 180ms ease;
}

.map-controls button:hover {
  background: rgba(255, 255, 255, 0.88);
  transform: translateY(-1px);
}

.map-controls svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.map-vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(
      180deg,
      rgba(15, 35, 32, 0.1),
      transparent 32%,
      rgba(15, 35, 32, 0.24)
    ),
    radial-gradient(
      circle at 56% 42%,
      transparent 0 38%,
      rgba(29, 55, 49, 0.16)
    );
  pointer-events: none;
}

.map-toolbar {
  position: absolute;
  z-index: 8;
  top: 0;
  left: 0;
  right: 0;
  min-height: var(--toolbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px clamp(20px, 4vw, 44px);
  border-radius: 0;
  box-shadow: 0 16px 50px rgba(30, 48, 48, 0.16);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted-ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(19px, 1.8vw, 26px);
  line-height: 1.1;
  letter-spacing: 0;
}

.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.filter-group {
  position: relative;
  z-index: 20;
}

.filters button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid rgba(27, 52, 48, 0.12);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.66);
}

.filters button.is-active {
  border-color: rgba(16, 141, 121, 0.34);
  color: #0b5d51;
  background: rgba(229, 250, 242, 0.82);
  box-shadow: 0 8px 22px rgba(14, 80, 72, 0.12);
}

.filters button.is-open {
  background: rgba(255, 255, 255, 0.9);
}

.filter-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  width: min(960px, calc(100vw - 48px));
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  grid-template-rows: repeat(2, max-content);
  align-items: start;
  justify-content: end;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0;
}

.filter-popover[hidden] {
  display: none;
}

.filters .filter-chip {
  min-height: 34px;
  padding: 0 12px;
  color: rgba(19, 33, 31, 0.76);
  background: rgba(255, 255, 255, 0.68);
}

.filters .filter-chip:hover,
.filters .filter-chip.is-selected {
  border-color: rgba(16, 141, 121, 0.36);
  color: #0b5d51;
  background: rgba(229, 250, 242, 0.95);
}

.floating-card {
  position: absolute;
  z-index: 6;
  top: 156px;
  right: clamp(28px, 8vw, 170px);
  width: min(430px, 36vw);
  min-width: 340px;
  padding: 24px;
  border-radius: 8px;
}

.selected-heading {
  min-width: 0;
}

.selected-heading p {
  margin: 5px 0 0;
  color: var(--muted-ink);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
}

.selected-location {
  display: flex;
  align-items: flex-start;
  gap: 7px;
}

.inline-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.selected-location .inline-icon {
  margin-top: 3px;
  color: rgba(16, 141, 121, 0.82);
}

.selected-heading h2 {
  overflow-wrap: anywhere;
}

.mini-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 22px 0 0;
}

.mini-facts div {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.44);
}

.fact-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fact-label .inline-icon {
  width: 14px;
  height: 14px;
  color: rgba(16, 141, 121, 0.72);
}

.mini-facts dd {
  overflow-wrap: anywhere;
}

.species-block {
  margin-top: 16px;
}

.species-heading {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: var(--muted-ink);
  font-size: 12px;
  font-weight: 700;
}

.species-heading .inline-icon {
  width: 15px;
  height: 15px;
  color: rgba(16, 141, 121, 0.76);
}

.species-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.species-empty {
  color: var(--muted-ink);
  font-size: 13px;
  font-weight: 700;
}

dt {
  color: var(--muted-ink);
  font-size: 11px;
  font-weight: 700;
}

dd {
  margin: 4px 0 0;
  font-weight: 800;
}

.lower-stack {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  height: var(--lower-stack-height);
  pointer-events: none;
}

.macro-panel {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-content: start;
  gap: 1px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border-radius: 16px 16px 0 0;
  background: rgba(229, 243, 233, 0.72);
  pointer-events: auto;
}

.metric {
  position: relative;
  min-width: 0;
  padding: 18px clamp(24px, 2.8vw, 46px);
  text-align: left;
}

.metric-content {
  max-width: 100%;
}

.metric + .metric::before {
  content: "";
  position: absolute;
  left: 0;
  top: 22px;
  bottom: 22px;
  width: 1px;
  background: var(--line);
}

.metric span,
.metric small,
.detail-grid span {
  display: block;
  color: var(--muted-ink);
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin: 6px 0 4px;
  font-size: clamp(30px, 3.5vw, 46px);
  line-height: 0.95;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.detail-panel {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 46px;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(320px, 0.8fr);
  gap: 12px;
  padding: 12px;
  height: calc(100% - 160px);
  border-radius: 8px;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  pointer-events: auto;
}

.site-footer {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 12px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  color: rgba(19, 33, 31, 0.58);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  pointer-events: auto;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
}

.facility-list,
.facility-detail {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: clamp(18px, 2.2vw, 28px);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.34);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.facility-list::-webkit-scrollbar,
.facility-detail::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar {
  display: none;
}

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

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(300px, 42%);
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--muted-ink);
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(27, 52, 48, 0.1);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.table-wrap {
  overflow: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
}

th,
td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(34, 62, 55, 0.1);
  text-align: left;
  font-size: 14px;
}

th {
  color: var(--muted-ink);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

tbody tr {
  transition:
    background 180ms ease,
    transform 180ms ease;
}

tbody tr:hover,
tbody tr.is-selected {
  background: rgba(255, 255, 255, 0.48);
}

tbody tr {
  cursor: pointer;
}

.empty-row {
  padding: 22px;
  color: var(--muted-ink);
  text-align: center;
  font-weight: 700;
}

.name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.path-cell {
  color: rgba(19, 33, 31, 0.86);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.row-status {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 5px rgba(24, 169, 121, 0.11);
}

.row-status.medium {
  background: var(--warning);
  box-shadow: 0 0 0 5px rgba(217, 173, 38, 0.13);
}

.row-status.low,
.row-status.pending {
  background: #d58628;
  box-shadow: 0 0 0 5px rgba(213, 134, 40, 0.13);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(16, 141, 121, 0.1);
  color: #0c6658;
  font-size: 12px;
  font-weight: 800;
}

.type-pill-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 6px;
}

.detail-card {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.detail-card p:not(.eyebrow) {
  color: var(--muted-ink);
  line-height: 1.65;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: auto 0 18px;
}

.detail-grid div {
  min-height: 74px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
}

.detail-grid strong {
  display: block;
  margin-top: 8px;
  overflow-wrap: anywhere;
}

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

:focus-visible {
  outline: 3px solid rgba(16, 141, 121, 0.58);
  outline-offset: 3px;
}

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

@media (max-width: 1080px) {
  body {
    overflow: auto;
  }

  .workspace {
    height: auto;
    min-height: 100svh;
  }

  .map-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .floating-card {
    top: auto;
    right: 20px;
    bottom: 52px;
    width: min(380px, calc(100% - 40px));
  }

  .macro-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .detail-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .workspace {
    width: 100%;
    padding: 10px;
    overflow-x: hidden;
  }

  .map-stage {
    height: 560px;
  }

  .map-toolbar {
    min-height: auto;
    border-radius: 0 0 34px 0;
    padding: 18px;
    overflow: hidden;
  }

  .filters {
    width: 100%;
    max-width: 100%;
    flex-wrap: nowrap;
    justify-content: flex-start;
    padding-bottom: 2px;
  }

  .filter-group {
    flex: 0 0 auto;
  }

  .filter-popover {
    left: 0;
    right: auto;
    width: min(960px, calc(100vw - 36px));
    justify-content: start;
  }

  .filters button {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0 12px;
  }

  .floating-card {
    left: 20px;
    right: 20px;
    width: auto;
    min-width: 0;
    bottom: 28px;
    padding: 20px;
  }

  .mini-facts {
    grid-template-columns: 1fr;
  }

  .macro-panel {
    grid-template-columns: 1fr;
  }

  .metric {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .panel-title {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box {
    width: 100%;
    min-width: 0;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}
