@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@500;600;700&display=swap");

:root {
  --pine-950: #0b2b20;
  --pine-900: #123b2b;
  --pine-800: #194a36;
  --pine-700: #286448;
  --pine-600: #3f7b59;
  --moss-500: #7aa05c;
  --moss-300: #b7cd99;
  --mist: #edf2ec;
  --paper: #f7f9f6;
  --white: #ffffff;
  --ink: #17271f;
  --muted: #66766e;
  --line: #dce4dd;
  --amber: #d7a545;
  --orange: #df8a3e;
  --red: #c94b3f;
  --shadow-sm: 0 4px 14px rgb(11 43 32 / 8%);
  --shadow-lg: 0 18px 50px rgb(11 43 32 / 16%);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: "DM Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  text-rendering: optimizeLegibility;
}
button, select { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.skip-link {
  position: fixed; left: 1rem; top: -5rem; z-index: 9999;
  padding: .75rem 1rem; border-radius: 6px; background: white; color: var(--pine-900);
}
.skip-link:focus { top: 1rem; }

.topbar {
  height: 74px; display: flex; align-items: center; justify-content: space-between;
  padding: 8px 22px; color: white; background:
    linear-gradient(90deg, rgb(11 43 32 / 98%), rgb(18 59 43 / 96%)),
    radial-gradient(circle at 30% -30%, #51735e 0, transparent 45%);
  border-bottom: 1px solid rgb(255 255 255 / 10%);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 190px; }
.brand-emblem {
  position: relative; width: 52px; height: 52px; overflow: hidden; flex: 0 0 auto;
  border: 1px solid rgb(255 255 255 / 28%); border-radius: 50%; background: white;
  box-shadow: inset 0 0 0 3px rgb(255 255 255 / 80%);
}
.brand-emblem img {
  position: absolute; width: 82px; max-width: none; height: 82px;
  left: -15px; top: -1px;
}
.brand-wordmark strong {
  display: block; font: 700 25px/1 "Manrope", sans-serif; letter-spacing: -.045em;
}
.brand-wordmark strong span { color: #f1f5ef; }
.brand-wordmark strong { color: #a8c36e; }
.brand-wordmark small {
  display: block; margin-top: 5px; color: #b9cabf; font: 600 8px/1 "Manrope", sans-serif;
  letter-spacing: .19em; text-transform: uppercase;
}
.topbar-context { display: flex; align-items: center; gap: 12px; }
.context-label {
  padding-right: 12px; border-right: 1px solid rgb(255 255 255 / 20%);
  color: #9fb4a8; font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
}
.topbar-context > strong { font: 600 13px "Manrope", sans-serif; }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px; margin-left: 5px; padding: 6px 9px;
  border: 1px solid rgb(255 255 255 / 14%); border-radius: 999px; background: rgb(255 255 255 / 7%);
  color: #c8d5cd; font-size: 9px; font-weight: 600;
}
.status-pill i, .live-indicator i, .source-status i {
  width: 6px; height: 6px; border-radius: 50%; background: #edbd55; box-shadow: 0 0 0 3px rgb(237 189 85 / 13%);
}

.demo-alert {
  min-height: 34px; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 6px 20px; background: #fbf5e6; border-bottom: 1px solid #eadbb5; color: #68552b;
}
.demo-alert p { margin: 0; font-size: 10.5px; }
.demo-alert.real-data { background: #e8f3e8; border-bottom-color: #c5dcc7; color: #295c3a; }
.demo-alert.pending-data { background: #fbf5e6; color: #68552b; }
.demo-alert.error-data { background: #f6e5e2; border-bottom-color: #e2bbb5; color: #7f352e; }
.alert-icon {
  display: grid; place-items: center; width: 17px; height: 17px; border: 1px solid #b99342;
  border-radius: 50%; font-size: 9px; font-weight: 700;
}

.workspace {
  height: calc(100vh - 140px); min-height: 650px; display: grid;
  grid-template-columns: 312px minmax(450px, 1fr) 340px;
}
.sidebar, .detail-panel {
  overflow-y: auto; scrollbar-width: thin; scrollbar-color: #c4d0c7 transparent; background: var(--white);
}
.sidebar { border-right: 1px solid var(--line); padding: 22px; }
.detail-panel { border-left: 1px solid var(--line); padding: 22px; }

.section-kicker, .eyebrow {
  color: var(--pine-600); font: 700 8.5px/1.2 "Manrope", sans-serif;
  letter-spacing: .13em; text-transform: uppercase;
}
.product-heading { padding: 0 2px 20px; border-bottom: 1px solid var(--line); }
.product-heading h1 {
  max-width: 255px; margin: 8px 0 8px; color: var(--pine-950);
  font: 700 21px/1.18 "Manrope", sans-serif; letter-spacing: -.03em;
}
.product-heading p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.control-panel, .reading-card, .source-card, .method-card {
  margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line);
}
.control-panel { padding-top: 18px; }
.panel-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.panel-heading h2, .source-card h2 {
  margin: 3px 0 0; color: var(--ink); font: 700 13px/1.2 "Manrope", sans-serif;
}
.panel-icon {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px;
  background: var(--mist); color: var(--pine-700); font-size: 15px;
}
.control-panel label {
  display: flex; align-items: center; gap: 7px; margin: 13px 0 6px;
  color: #465a50; font-size: 9.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
}
.control-panel label span {
  display: grid; place-items: center; width: 17px; height: 17px; border-radius: 4px;
  background: #eaf0ea; color: var(--pine-700); font-size: 7px;
}
select {
  width: 100%; height: 41px; padding: 0 36px 0 11px; border: 1px solid #d4ded6; border-radius: 7px;
  background: linear-gradient(180deg, #fff, #fbfcfb); color: var(--ink); font-size: 11.5px;
  box-shadow: 0 1px 2px rgb(11 43 32 / 3%);
}
select:hover { border-color: #b7c7bb; }
select:focus, button:focus-visible { outline: 3px solid rgb(63 123 89 / 20%); outline-offset: 2px; }
.field-help { display: block; margin: 5px 0 0 2px; color: var(--muted); font-size: 8px; line-height: 1.35; }
.reset-button, .print-button, .source-catalog-button {
  width: 100%; border: 0; border-radius: 7px; cursor: pointer; font-weight: 700;
}
.reset-button {
  margin-top: 14px; padding: 10px; border: 1px solid #d8e2da;
  background: var(--white); color: var(--pine-700); font-size: 10.5px;
}
.reset-button:hover { background: var(--mist); }

.reading-heading, .source-card-head, .source-summary-line {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.live-indicator, .source-status {
  display: inline-flex; align-items: center; gap: 5px; color: #718078; font-size: 8px; font-weight: 600;
}
.live-indicator i { background: #6ea77b; box-shadow: 0 0 0 3px rgb(110 167 123 / 14%); }
.reading-card h2 { margin: 7px 0 7px; font: 700 17px/1.2 "Manrope", sans-serif; letter-spacing: -.02em; }
.reading-card > p { margin: 0; color: var(--muted); font-size: 10.5px; line-height: 1.55; }
.method-rule {
  display: flex; gap: 9px; align-items: flex-start; margin-top: 12px; padding: 10px;
  border: 1px solid #e8d9b4; border-radius: 6px; background: #fbf6e9; color: #65532f;
}
.method-rule > span {
  display: grid; place-items: center; flex: 0 0 17px; height: 17px;
  border: 1px solid #c5a258; border-radius: 50%; font-size: 8px; font-weight: 800;
}
.method-rule p { margin: 0; font-size: 9.5px; line-height: 1.45; }
.method-rule strong { display: block; margin-bottom: 1px; }

.source-card { padding: 14px; border: 1px solid #dce6de; border-radius: 8px; background: #f7faf7; }
.source-card-head { align-items: flex-start; }
.source-status {
  padding: 4px 6px; border-radius: 999px; background: #f5ead0; color: #806629; white-space: nowrap;
}
.source-status {
  background: #e3f0e5; color: #2a6841;
}
.source-status i { background: #5b9a6b; box-shadow: 0 0 0 3px rgb(91 154 107 / 14%); }
.source-status.pending { background: #f5ead0; color: #806629; }
.source-status.pending i { background: #d1a344; box-shadow: 0 0 0 3px rgb(209 163 68 / 14%); }
.source-summary-line { margin-top: 12px; font-size: 9px; }
.source-summary-line strong { color: var(--pine-800); }
.source-summary-line span { color: var(--muted); }
#source-summary > p { margin: 6px 0 10px; color: var(--muted); font-size: 9.5px; line-height: 1.45; }
.source-catalog-button {
  display: flex; justify-content: space-between; padding: 9px 0 0; border-top: 1px solid #dce6de;
  border-radius: 0; background: transparent; color: var(--pine-700); font-size: 9.5px;
}
.method-card { border-bottom: 0; }
.method-toggle, .legend-title {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  border: 0; background: none; padding: 0; font-size: 10px; font-weight: 700; cursor: pointer;
}
.method-toggle > span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.method-toggle i { color: var(--pine-600); font-style: normal; font-size: 15px; }
.evidence-list { list-style: none; padding: 10px 0 0; margin: 0; }
.evidence-list li { display: flex; gap: 8px; margin: 9px 0; font-size: 9.5px; line-height: 1.35; }
.evidence-list strong { display: block; }
.evidence { width: 9px; height: 9px; margin-top: 2px; border-radius: 50%; flex: 0 0 auto; }
.confirmed { background: #2e7b63; }
.potential { background: #84a95f; }
.inferred { background: #c18c43; }
.hypothesis { background: white; border: 2px dashed #8b776a; }

.map-shell { min-width: 0; position: relative; background: #d7ded7; }
#map { width: 100%; height: 100%; background: #e4e8e1; }
.group-loading-overlay {
  position: absolute; z-index: 760; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 7px;
  background: rgb(238 243 237 / 82%); color: var(--pine-950); text-align: center;
  backdrop-filter: blur(2px);
}
.group-loading-overlay[hidden] { display: none; }
.group-loading-overlay strong { font: 700 15px "Manrope", sans-serif; }
.group-loading-overlay small { color: var(--muted); font-size: 9px; }
.loading-spinner {
  width: 28px; height: 28px; border: 3px solid #b8c9bd; border-top-color: var(--pine-700);
  border-radius: 50%; animation: ecomap-spin .75s linear infinite;
}
@keyframes ecomap-spin { to { transform: rotate(360deg); } }
.map-toolbar {
  position: absolute; z-index: 700; left: 15px; right: 15px; top: 14px; min-height: 56px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 13px;
  border: 1px solid rgb(255 255 255 / 82%); border-radius: 8px; background: rgb(255 255 255 / 95%);
  box-shadow: var(--shadow-sm); pointer-events: none; backdrop-filter: blur(8px);
}
.map-toolbar strong {
  display: block; margin-top: 3px; color: var(--pine-950);
  font: 700 15px/1.1 "Manrope", sans-serif; letter-spacing: -.02em;
}
.map-toolbar > div:first-child { min-width: 205px; flex: 1 1 auto; }
.map-stats { display: flex; flex: 0 0 auto; gap: 4px; color: var(--muted); }
.map-stats span {
  min-width: 58px; padding: 5px 6px; border-left: 1px solid var(--line); text-align: center;
}
.map-stats b { display: block; color: var(--pine-900); font: 700 15px/1 "Manrope", sans-serif; }
.map-stats small { display: block; margin-top: 3px; font-size: 7.5px; text-transform: uppercase; letter-spacing: .08em; }
#metric-tertiary-count { font-size: 11.5px; white-space: nowrap; }

.map-symbol-note {
  position: absolute; z-index: 705; right: 16px; top: 84px; display: flex; align-items: center; gap: 8px;
  max-width: 310px; padding: 7px 10px; border: 1px solid rgb(255 255 255 / 78%); border-radius: 999px;
  background: rgb(255 255 255 / 96%); color: var(--pine-950); box-shadow: var(--shadow-sm);
  font-size: 10px; pointer-events: none; backdrop-filter: blur(7px);
}
.map-symbol-note span {
  width: 14px; height: 14px; flex: 0 0 14px; border: 3px solid white; border-radius: 50%;
  background: #c9473e; box-shadow: 0 0 0 1px currentColor;
}
.map-symbol-note strong { font-weight: 700; }

.map-note {
  position: absolute; z-index: 700; left: 50%; bottom: 10px; transform: translateX(-50%);
  padding: 5px 9px; border: 1px solid rgb(255 255 255 / 20%); border-radius: 999px;
  background: rgb(11 43 32 / 88%); color: #d6e2da; font-size: 8px; white-space: nowrap;
  pointer-events: none; backdrop-filter: blur(5px);
}
.map-note span { margin-right: 5px; color: #f1c96c; font-weight: 800; letter-spacing: .08em; }
.legend {
  position: absolute; z-index: 700; left: 15px; bottom: 40px; width: 210px;
  padding: 12px; border: 1px solid rgb(255 255 255 / 75%); border-radius: 8px;
  background: rgb(255 255 255 / 96%); box-shadow: var(--shadow-sm); backdrop-filter: blur(8px);
}
.legend-title { margin-bottom: 9px; font-size: 10px; }
.legend-title > span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.legend-title i { color: var(--pine-600); font-style: normal; }
.legend-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; color: #53665f; font-size: 9px; }
.legend-swatch { width: 21px; height: 10px; border: 1px solid rgb(20 52 43 / 16%); border-radius: 2px; }
.legend-real-point { width: 10px; height: 10px; border: 2px solid white; border-radius: 50%; background: #2b7181; box-shadow: 0 0 0 1px #2b7181; }
.legend-real-line { width: 22px; height: 0; border-top: 3px solid #2b7181; }
.legend-real-polygon { width: 20px; height: 10px; border: 2px solid #2b7181; border-radius: 2px; background: rgb(43 113 129 / 25%); }
.legend-infrastructure { width: 22px; height: 0; border-top: 2px dashed #6f6a5d; }
.legend-occurrence { width: 13px; height: 13px; border: 3px solid white; border-radius: 50%; background: #c9473e; box-shadow: 0 0 0 1px #43386b, 0 0 0 3px rgb(245 213 116 / 38%); }
.amphib-occurrence-icon { background: transparent; border: 0; }
.amphib-occurrence-symbol {
  width: 24px; height: 24px; display: grid; place-items: center; box-sizing: border-box;
  border: 3px solid white; border-radius: 50%; background: #4b327c;
  box-shadow: 0 0 0 2px #f5d574, 0 3px 8px rgb(16 40 31 / 48%);
  color: #f5d574; font-size: 11px; line-height: 1;
  transition: transform .14s ease, box-shadow .14s ease;
}
.amphib-occurrence-icon:hover .amphib-occurrence-symbol {
  transform: scale(1.25);
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px #f5d574, 0 4px 10px rgb(16 40 31 / 52%);
}
.legend-swatch.unavailable { background: repeating-linear-gradient(135deg, #d4dad5 0 4px, #eef1ee 4px 8px); }
.legend-divider { height: 1px; margin: 8px 0; background: var(--line); }
.water-marker {
  width: 19px; height: 19px; border: 3px solid white; border-radius: 50% 50% 50% 10%;
  background: #2b7181; box-shadow: 0 2px 5px rgb(0 0 0 / 28%); transform: rotate(-45deg);
}
.water-marker::after { content: ""; display: block; width: 4px; height: 4px; margin: 4px; border-radius: 50%; background: #c9edf0; }

.leaflet-container { font: inherit; }
.leaflet-control-zoom { margin-top: 84px !important; border: 0 !important; box-shadow: var(--shadow-sm) !important; }
.leaflet-control-zoom a { color: var(--pine-900) !important; }
.leaflet-control-attribution { font-size: 7px; }
.leaflet-popup-content-wrapper { border-radius: 7px; box-shadow: var(--shadow-lg); }
.leaflet-popup-content { margin: 12px 14px; }
.popup-kicker { color: var(--pine-600); font-size: 8px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.popup-title { margin: 4px 0 6px; font: 700 14px "Manrope", sans-serif; letter-spacing: -.02em; }
.popup-meta { color: var(--muted); font-size: 9.5px; line-height: 1.45; }
.popup-link { margin-top: 8px; color: var(--pine-700); font-size: 9.5px; font-weight: 700; }

.detail-empty {
  min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px 0; text-align: center; color: var(--muted);
}
.empty-icon {
  display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 16px;
  border: 1px solid #c5d2c8; border-radius: 50%; background: #f5f8f5; color: var(--pine-600); font-size: 26px;
}
.detail-empty h2 { margin: 7px 0 5px; color: var(--pine-950); font: 700 19px "Manrope", sans-serif; letter-spacing: -.03em; }
.detail-empty > p { max-width: 245px; margin: 0; font-size: 10.5px; line-height: 1.55; }
.empty-steps { display: flex; align-items: center; margin-top: 24px; color: #75857d; font-size: 7.5px; text-transform: uppercase; letter-spacing: .05em; }
.empty-steps span { display: flex; align-items: center; gap: 4px; }
.empty-steps b { display: grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: #eaf0ea; color: var(--pine-700); font-size: 7px; }
.empty-steps i { width: 10px; height: 1px; margin: 0 4px; background: #ccd7cf; }
.detail-head { display: flex; justify-content: space-between; gap: 12px; }
.detail-head h2 { margin: 6px 0 2px; color: var(--pine-950); font: 700 20px/1.2 "Manrope", sans-serif; letter-spacing: -.03em; }
.detail-head p { margin: 0; color: var(--muted); font-size: 9px; }
.close-detail, #source-drawer-close {
  width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 6px;
  background: white; color: #718078; cursor: pointer; font-size: 18px;
}
.category-badge {
  display: inline-flex; align-items: center; gap: 5px; margin: 13px 0 10px; padding: 5px 8px;
  border-radius: 999px; background: #e8f0e8; color: var(--pine-700);
  font-size: 8px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
}
.category-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--pine-600); }
.diagnosis-summary { padding: 12px; border-radius: 7px; background: linear-gradient(135deg, #133e2e, #21573f); color: white; }
.diagnosis-summary span { color: #b8cdbf; font-size: 7.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.diagnosis-summary p { margin: 5px 0 0; font-size: 10px; line-height: 1.5; }
.diagnosis-list { margin: 13px 0 0; border-top: 1px solid var(--line); }
.diagnosis-list div {
  display: grid; grid-template-columns: 42% 1fr; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--line); align-items: start;
}
.diagnosis-list .diagnosis-group-label {
  display: block; margin: 8px 0 0; padding: 7px 9px; border: 1px solid #d8e2da;
  border-radius: 5px; background: #f2f6f1; color: var(--pine-700);
  font-size: 8px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
}
.diagnosis-list dt { color: var(--muted); font-size: 8px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.diagnosis-list dd { margin: 0; font-size: 10px; font-weight: 600; line-height: 1.4; }
.diagnosis-list dd small { display: block; margin-top: 2px; color: var(--muted); font-size: 8px; font-weight: 400; }
.factor-list { margin: 0; padding-left: 14px; }
.factor-list li { margin: 0 0 5px; font-size: 8.5px; font-weight: 500; }
.factor-list li:last-child { margin-bottom: 0; }
.factor-list li.is-missing { color: #8b5c38; }
.temporal-section { margin-top: 16px; }
.temporal-section h3, .traceability-details summary {
  margin: 0 0 8px; color: var(--muted); font-size: 8px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase;
}
.temporal-chart {
  min-height: 92px; display: flex; align-items: flex-end; gap: 5px; padding: 10px 8px 5px;
  border: 1px solid var(--line); border-radius: 7px; background: #f9fbf8; overflow-x: auto;
}
.year-bar {
  position: relative; min-width: 31px; height: 70px; display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 16px; border-bottom: 1px solid #cbd6cd;
}
.year-bar > span {
  display: block; width: 13px; min-height: 4px; border-radius: 3px 3px 0 0; background: var(--pine-600);
}
.year-bar > b { position: absolute; top: -1px; color: var(--pine-800); font-size: 7px; }
.year-bar > small { position: absolute; bottom: 0; color: var(--muted); font-size: 7px; }
.empty-value { margin: auto; color: var(--muted); font-size: 9px; }
.detail-block h3 { margin: 15px 0 4px; color: var(--muted); font-size: 8px; letter-spacing: .07em; text-transform: uppercase; }
.detail-block p { margin: 0; font-size: 10px; line-height: 1.5; }
.rationale-block ul { margin: 6px 0 0; padding-left: 17px; }
.rationale-block li { margin: 5px 0; color: #4f6258; font-size: 9.5px; line-height: 1.45; }
.action-box { margin-top: 14px; padding: 12px; border-left: 3px solid var(--moss-500); background: #edf4ea; }
.action-box span { color: var(--pine-600); font-size: 7.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.action-box p { margin: 4px 0 0; font-size: 10px; font-weight: 600; line-height: 1.45; }
.confidence-note { color: var(--muted); font-size: 8.5px; line-height: 1.45; }
.traceability-details { margin-top: 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.traceability-details summary { margin: 0; padding: 11px 0; color: var(--pine-700); cursor: pointer; }
#detail-sources { padding-bottom: 10px; }
.trace-source { padding: 9px 0; border-top: 1px solid var(--line); }
.trace-source strong { display: block; font-size: 9.5px; }
.trace-source span, .trace-source small { display: block; margin-top: 2px; color: var(--muted); font-size: 8.5px; line-height: 1.4; }
.calculation-trace { margin-top: 9px; padding: 10px; border-radius: 6px; background: #f2f6f1; }
.calculation-trace > strong { display: block; margin-bottom: 7px; font-size: 9px; }
.calculation-trace div { display: flex; justify-content: space-between; gap: 10px; font-size: 8.5px; }
.calculation-trace p { margin: 1px 0 6px; color: var(--muted); font-size: 7.5px; line-height: 1.35; }
.print-button { margin-top: 7px; padding: 11px; background: var(--pine-900); color: white; font-size: 10px; }
.print-button:hover { background: var(--pine-800); }

.drawer-backdrop { position: fixed; z-index: 1490; inset: 0; background: rgb(7 28 20 / 45%); backdrop-filter: blur(2px); }
.source-drawer {
  position: fixed; z-index: 1500; top: 0; right: 0; bottom: 0; width: min(520px, 94vw);
  overflow-y: auto; padding: 26px; background: #f8faf7; box-shadow: -20px 0 60px rgb(7 28 20 / 22%);
  transform: translateX(102%); transition: transform .25s ease;
}
.source-drawer.is-open { transform: translateX(0); }
.source-drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.source-drawer-head h2 { margin: 6px 0 4px; font: 700 24px "Manrope", sans-serif; letter-spacing: -.04em; }
.source-drawer-head p { margin: 0; max-width: 400px; color: var(--muted); font-size: 10.5px; line-height: 1.5; }
.source-policy { display: flex; gap: 10px; margin: 20px 0; padding: 12px; border: 1px solid #cfdfd1; border-radius: 8px; background: #edf5ed; }
.source-policy > span { display: grid; place-items: center; flex: 0 0 20px; height: 20px; border-radius: 50%; background: var(--pine-700); color: white; font-size: 10px; }
.source-policy p { margin: 0; font-size: 9.5px; line-height: 1.45; }
.source-policy strong { display: block; }
.drawer-reading { padding: 14px; border-radius: 8px; background: var(--pine-950); color: white; }
.drawer-reading > span { color: #a9beb0; font-size: 8px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.drawer-reading strong { display: block; margin: 4px 0; font: 700 15px "Manrope", sans-serif; }
.drawer-reading p { margin: 0; color: #c7d5cd; font-size: 9.5px; line-height: 1.5; }
.source-entry { margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: white; box-shadow: 0 2px 7px rgb(11 43 32 / 3%); }
.source-entry-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.source-entry h3 { margin: 0; font: 700 13px "Manrope", sans-serif; }
.source-state { padding: 4px 7px; border-radius: 999px; font-size: 7.5px; font-weight: 700; white-space: nowrap; }
.source-state.verified { background: #e1f0e4; color: #28623e; }
.source-state.pending { background: #f6ecd5; color: #7a6026; }
.source-state.blocked { background: #f4dfdc; color: #8f4037; }
.source-entry dl { margin: 12px 0 0; border-top: 1px solid var(--line); }
.source-entry dl div { display: grid; grid-template-columns: 120px 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.source-entry dt { color: var(--muted); font-size: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.source-entry dd { margin: 0; font-size: 9.5px; line-height: 1.4; }
.source-entry a, .source-doc-link { display: inline-block; margin-top: 10px; color: var(--pine-700); font-size: 9px; font-weight: 700; text-decoration: none; }
.source-variables { margin: 10px 0 0; color: var(--muted); font-size: 8.5px; line-height: 1.4; }
.source-doc-link { margin: 18px 0; font-size: 10px; }

footer {
  min-height: 32px; display: flex; align-items: center; justify-content: space-between;
  padding: 7px 20px; background: #edf1ec; color: #718078; font-size: 8px;
}
footer p { margin: 0; }
footer span { margin: 0 4px; }

@media (max-width: 1100px) {
  .workspace { grid-template-columns: 290px minmax(430px, 1fr); }
  .detail-panel {
    position: fixed; z-index: 1000; top: 108px; right: 0; bottom: 32px; width: min(370px, 94vw);
    transform: translateX(102%); transition: transform .25s ease; box-shadow: -12px 0 36px rgb(11 43 32 / 14%);
  }
  .detail-panel.is-open { transform: translateX(0); }
}

@media (max-width: 720px) {
  .topbar { height: 64px; padding: 7px 12px; }
  .brand-emblem { width: 44px; height: 44px; }
  .brand-emblem img { width: 70px; height: 70px; left: -13px; }
  .brand-wordmark strong { font-size: 21px; }
  .brand-wordmark small, .context-label, .status-pill { display: none; }
  .topbar-context > strong { max-width: 105px; text-align: right; font-size: 10px; }
  .demo-alert { min-height: 44px; align-items: flex-start; justify-content: flex-start; padding: 7px 12px; }
  .demo-alert p { font-size: 9px; line-height: 1.4; }
  .workspace { height: auto; min-height: 0; display: flex; flex-direction: column; }
  .sidebar { order: 2; overflow: visible; padding: 18px; border: 0; }
  .product-heading h1 { max-width: 100%; }
  .map-shell { order: 1; height: 63vh; min-height: 480px; }
  .control-panel { display: grid; grid-template-columns: 1fr; }
  .control-panel .panel-heading, .control-panel .reset-button, .control-panel label, .control-panel select, .field-help { grid-column: 1; }
  .control-panel label { margin-top: 10px; }
  .map-toolbar { left: 8px; right: 8px; top: 8px; min-height: 50px; }
  .map-stats { display: none; }
  .leaflet-control-zoom { margin-top: 72px !important; }
  .legend { left: 8px; bottom: 39px; width: 196px; }
  
.map-symbol-note {
  position: absolute; z-index: 705; right: 16px; top: 84px; display: flex; align-items: center; gap: 8px;
  max-width: 310px; padding: 7px 10px; border: 1px solid rgb(255 255 255 / 78%); border-radius: 999px;
  background: rgb(255 255 255 / 96%); color: var(--pine-950); box-shadow: var(--shadow-sm);
  font-size: 10px; pointer-events: none; backdrop-filter: blur(7px);
}
.map-symbol-note span {
  width: 14px; height: 14px; flex: 0 0 14px; border: 3px solid white; border-radius: 50%;
  background: #c9473e; box-shadow: 0 0 0 1px currentColor;
}
.map-symbol-note strong { font-weight: 700; }

.map-note { bottom: 7px; max-width: 92%; overflow: hidden; text-overflow: ellipsis; }
  .detail-panel { top: 108px; bottom: 0; padding-bottom: 30px; }
  .source-drawer { padding: 20px 16px; }
  .source-entry dl div { grid-template-columns: 100px 1fr; }
  footer { display: block; padding: 9px 12px; line-height: 1.5; }
}

@media print {
  @page { size: A4; margin: 16mm; }
  body { background: white; }
  .topbar { color: var(--ink); background: white; border-bottom: 2px solid var(--pine-900); padding: 0 0 12px; }
  .brand-wordmark strong span { color: var(--pine-900); }
  .brand-wordmark small, .topbar-context { color: var(--muted); }
  .demo-alert { margin-top: 10px; border: 1px solid #d9bd80; }
  .sidebar, .map-shell, footer, .close-detail, .print-button, .detail-empty, .source-drawer, .drawer-backdrop { display: none !important; }
  .workspace { display: block; height: auto; min-height: 0; }
  .detail-panel { position: static; display: block; width: auto; overflow: visible; border: 0; padding: 24px 0; transform: none; box-shadow: none; }
  .detail-panel article { display: block !important; }
  .diagnosis-summary { color: var(--ink); background: #edf4ea; border: 1px solid var(--line); }
  .confidence-note::after { content: " · Diagnosi generada des del prototip EcoMap."; }
}


/* EcoMap: tooltips legibles i lectura cartogràfica separada */
.leaflet-tooltip.ecomap-tooltip {
  max-width: min(280px, 70vw);
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.25;
  z-index: 1000;
}
.leaflet-tooltip-pane { z-index: 900 !important; }
.leaflet-popup-pane { z-index: 910 !important; }
.legend-analysis-ring {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 4px solid #df8a3e;
  border-radius: 50%;
  background: transparent;
  box-sizing: border-box;
  margin-right: 8px;
  vertical-align: middle;
}


/* Correccions finals de llegibilitat del mapa */
.leaflet-tooltip.ecomap-occurrence-tooltip {
  min-width: max-content;
  max-width: min(360px, 82vw);
  white-space: nowrap;
  writing-mode: horizontal-tb !important;
  text-orientation: mixed !important;
  word-break: normal;
  overflow-wrap: normal;
}
.leaflet-tooltip.ecomap-tooltip {
  writing-mode: horizontal-tb !important;
  text-orientation: mixed !important;
}

/* Panell informatiu dinàmic sota el mapa */
.fauna-panel { margin: 18px 24px 24px; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.fauna-panel-head { display:flex; justify-content:space-between; gap:24px; align-items:flex-start; }
.fauna-panel-head h2 { margin:4px 0 6px; }
.fauna-panel-head p { margin:0; max-width:760px; color:var(--muted); }
.fauna-panel-metrics { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.fauna-metric { padding:8px 10px; border:1px solid var(--line); border-radius:12px; min-width:92px; }
.fauna-metric b,.fauna-metric small { display:block; }
.fauna-metric small { color:var(--muted); margin-top:2px; }
.fauna-species-head { display:flex; justify-content:space-between; gap:16px; align-items:end; margin-top:22px; border-top:1px solid var(--line); padding-top:18px; }
.fauna-species-head h3 { margin:0; }
.fauna-species-head small { color:var(--muted); }
.species-cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(210px,1fr)); gap:10px; margin-top:12px; }
.species-card { border:1px solid var(--line); border-radius:14px; padding:13px; background:#fff; }
.species-card h4 { margin:0 0 4px; font-size:1rem; font-style:normal; writing-mode:horizontal-tb; }
.species-card .scientific { font-style:italic; color:var(--muted); font-size:.88rem; margin-bottom:10px; }
.species-card dl { margin:0; display:grid; gap:5px; }
.species-card dl div { display:flex; justify-content:space-between; gap:10px; font-size:.84rem; }
.species-card dt { color:var(--muted); }
.species-card dd { margin:0; text-align:right; }
.fauna-method { margin-top:16px; border-top:1px solid var(--line); padding-top:14px; }
.fauna-method summary { cursor:pointer; font-weight:700; }
.fauna-method p { color:var(--muted); line-height:1.55; }
@media (max-width:800px){.fauna-panel{margin:12px;padding:16px}.fauna-panel-head,.fauna-species-head{display:block}.fauna-panel-metrics{justify-content:flex-start;margin-top:12px}.fauna-species-head small{display:block;margin-top:5px}}


/* EcoMap Alt Urgell v1 */
.visually-hidden {
  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;
}
.workspace {
  height: auto;
  min-height: 760px;
  display: grid;
  grid-template-columns: 312px minmax(0, 1fr);
}
.map-shell { min-height: 760px; }
#map { min-height: 760px; height: 760px; }
.fauna-selector { margin: 16px 0 10px; }
.fauna-selector-title {
  display: block; margin-bottom: 8px; color: #465a50; font-size: 9.5px; font-weight: 800;
  letter-spacing: .07em; text-transform: uppercase;
}
.fauna-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.fauna-button {
  min-height: 36px; padding: 8px 9px; border: 1px solid #d4ded6; border-radius: 8px;
  background: #fff; color: var(--pine-900); cursor: pointer; font-size: 10.5px; font-weight: 700;
  text-align: left;
}
.fauna-button:hover:not(:disabled) { border-color: #8faf99; background: #f2f7f2; }
.fauna-button.is-active, .fauna-button.is-active:hover:not(:disabled) { border-color: var(--pine-700); background: var(--pine-900); color: white; }
.fauna-button.is-pending { color: #8b958f; background: #f5f7f5; cursor: default; }
.fauna-selector > small { display: block; margin-top: 8px; color: var(--muted); font-size: 8.8px; line-height: 1.45; }
.detail-section-below {
  margin: 18px 24px 0; padding: 0; border: 0; background: transparent;
}
.detail-section-below > .detail-panel {
  position: static !important; transform: none !important; width: 100% !important; max-width: none !important;
  min-height: 180px; overflow: visible; border: 1px solid var(--line); border-radius: 18px;
  padding: 22px; background: #fff; box-shadow: none;
}
.detail-section-below .detail-empty { min-height: 170px; }
.detail-section-below .detail-empty > p { max-width: 760px; }
.fauna-panel { margin-top: 14px; }
.species-card .scientific { writing-mode: horizontal-tb !important; transform: none !important; }
@media (max-width: 900px) {
  .workspace { display: block; min-height: 0; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .map-shell, #map { min-height: 620px; height: 620px; }
}

/* Preserve the visual identity; allow long source names and all species cards. */
.species-card { min-width: 0; overflow-wrap: anywhere; }
.species-card details { font-size: .82rem; }
.species-card p { font-size: .85rem; }
.species-card button { border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; color: var(--pine-900); background: #f2f7f2; cursor:pointer; }
#source-status-list article { border-top: 1px solid var(--line); padding: 8px 0; }
#source-status-list h4 { margin-bottom: 4px; }
#source-status-list a { color: var(--pine-700); }
#visibility-summary { color: var(--muted); font-size: .9rem; line-height: 1.5; }
.fauna-panel-head { flex-wrap: wrap; }
.fauna-panel-metrics { justify-content: flex-start; }
.fauna-metric { max-width: 260px; overflow-wrap: anywhere; }
.leaflet-popup-content { overflow-wrap: anywhere; }
@media (min-width: 901px) {
  .map-shell { align-self: stretch; }
  #map { position: absolute; inset: 0; height: 100%; }
}
.fauna-panel > .reading-card { margin: 0 0 18px; }
/* Keep Leaflet's absolute children anchored and clipped after viewport changes. */
#map { position: relative; }
.map-shell { overflow: hidden; }
@media (min-width: 901px) { #map { position: absolute; } }
.fauna-panel .detail-section-below { margin: 14px 0; }
.fauna-panel .detail-section-below .detail-empty { min-height: 90px; }
.fauna-panel .detail-section-below > .detail-panel { min-height: 0; }
#more-species { margin-top: 14px; max-width: 260px; }

/* Interpretative revision: retain map and controls, shorten the metric strip. */
.ecology-intro {padding:18px 22px;margin-bottom:18px;border-left:4px solid #567f65;background:#f1f6f2;border-radius:8px;max-width:1100px}
.ecology-intro h2 {margin:0 0 10px;font-size:1.3rem}
.ecology-intro p,.ecology-reading p {line-height:1.65;max-width:100ch}
.fauna-panel-head {display:block}
.fauna-panel-metrics {grid-template-columns:repeat(auto-fit,minmax(145px,1fr));gap:10px}
.ecology-reading {margin:20px 0}
.species-illustration {margin:0 0 12px}
.species-illustration img {width:100%;height:160px;object-fit:contain;background:#f3f5f2;border-radius:6px}
.species-illustration figcaption {font-size:.72rem;line-height:1.4;margin-top:5px;overflow-wrap:anywhere}
#selected-datasets {overflow-wrap:anywhere}

/* The active reading contains guidance, so it must be readable at normal size. */
.fauna-panel > .reading-card > p {font-size:13px;line-height:1.65;margin:8px 0;max-width:100ch}

/* Keep technical filters available while emphasizing the numbered main selection. */
.control-panel label.secondary-filter-label { font-weight: 500; letter-spacing: 0; text-transform: none; }
.control-panel select.secondary-filter { height: 36px; background: #f4f7f4; box-shadow: none; }
