:root {
  --ink: #173f35;
  --ink-deep: #0c2c25;
  --ink-soft: #527068;
  --forest: #245e4e;
  --green: #4d8a68;
  --mint: #dceee5;
  --mint-light: #f1f7f3;
  --lime: #d7ea91;
  --lime-strong: #bed768;
  --sand: #f4f0e6;
  --paper: #fbfcf8;
  --white: #fff;
  --coral: #da775f;
  --amber: #dcae4a;
  --blue: #5f91a7;
  --line: #dce5df;
  --shadow: 0 20px 50px rgba(25, 59, 49, 0.08);
  --radius: 22px;
  --sidebar: 280px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.auth-pending .sidebar, .auth-pending .app-shell { visibility: hidden; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { letter-spacing: -0.035em; }

.skip-link { position: fixed; left: 1rem; top: -4rem; z-index: 10000; background: white; padding: .75rem 1rem; border-radius: 8px; }
.skip-link:focus { top: 1rem; }
.hidden { display: none !important; }
.sr-only { height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; white-space: nowrap; width: 1px; clip: rect(0, 0, 0, 0); clip-path: inset(50%); }

.sidebar {
  background: var(--ink-deep);
  color: #d9e8e0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  left: 0;
  padding: 34px 22px 24px;
  position: fixed;
  top: 0;
  width: var(--sidebar);
  z-index: 900;
}
.brand { align-items: center; display: flex; gap: 13px; }
.brand strong, .brand small { display: block; line-height: 1.1; }
.brand strong { color: #fff; font-size: 18px; letter-spacing: -.02em; }
.brand small { color: #9db9ae; font-size: 12px; margin-top: 5px; text-transform: uppercase; letter-spacing: .11em; }
.brand-mark { align-items: center; border: 4px solid var(--lime); border-radius: 50%; display: inline-flex; flex: 0 0 auto; height: 44px; justify-content: center; position: relative; width: 44px; }
.brand-mark::before { border: 3px solid #62a278; border-radius: 50%; content: ""; height: 18px; position: absolute; width: 18px; }
.brand-mark span { background: var(--ink-deep); border-radius: 50%; height: 8px; width: 8px; z-index: 1; }
.main-nav { display: grid; gap: 7px; margin-top: 62px; }
.main-nav a { align-items: center; border-radius: 12px; color: #aac1b7; display: flex; font-size: 15px; font-weight: 650; gap: 14px; padding: 13px 14px; transition: .2s ease; }
.main-nav a span { color: #87a99c; display: inline-flex; font-size: 20px; justify-content: center; width: 20px; }
.main-nav a:hover { background: rgba(255,255,255,.05); color: white; }
.main-nav a.active { background: rgba(215,234,145,.12); color: var(--lime); }
.main-nav a.active span { color: var(--lime); }
.app-shell { margin-left: var(--sidebar); min-height: 100vh; }
.topbar {
  align-items: center;
  backdrop-filter: blur(12px);
  background: rgba(251,252,248,.9);
  border-bottom: 1px solid var(--line);
  display: flex;
  height: 82px;
  justify-content: space-between;
  padding: 0 4.5%;
  position: sticky;
  top: 0;
  z-index: 800;
}
.context-title small, .context-title strong { display: block; line-height: 1.3; }
.context-title small { color: var(--ink-soft); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.context-title strong { font-size: 17px; }
.topbar-actions { align-items: center; display: flex; gap: 10px; }
.region-picker { align-items: center; border: 1px solid var(--line); border-radius: 11px; display: flex; gap: 9px; height: 46px; padding: 0 14px; }
.region-picker span { color: var(--ink-soft); font-size: 12px; text-transform: uppercase; }
.region-picker select { background: transparent; border: 0; color: var(--ink); font-size: 14px; font-weight: 650; max-width: 230px; outline: 0; }
.button { align-items: center; border: 0; border-radius: 11px; cursor: pointer; display: inline-flex; font-size: 14px; font-weight: 750; gap: 8px; justify-content: center; min-height: 48px; padding: 0 21px; transition: transform .18s ease, background .18s ease, box-shadow .18s ease; }
.button:hover { transform: translateY(-1px); }
.button-dark { background: var(--ink); color: white; }
.button-dark:hover { background: var(--ink-deep); }
.button-ghost { border: 1px solid var(--line); background: transparent; }
.button-light { background: white; border: 1px solid rgba(23,63,53,.12); }
.button-accent { background: var(--lime); color: var(--ink-deep); box-shadow: 0 8px 18px rgba(145,166,75,.15); }
.button-accent:hover { background: var(--lime-strong); }
.button.full { width: 100%; }
.avatar { background: var(--lime); border: 0; border-radius: 50%; cursor: pointer; font-size: 13px; font-weight: 800; height: 46px; width: 46px; }
.menu-button { display: none; }

main { overflow: hidden; }
.hero { align-items: flex-end; background: var(--sand); display: flex; justify-content: space-between; min-height: 390px; padding: 78px 6.5% 66px; position: relative; }
.hero::after { background: radial-gradient(circle, rgba(69,120,91,.16) 1px, transparent 1.5px); background-size: 16px 16px; content: ""; height: 200px; opacity: .4; position: absolute; right: 0; top: 0; width: 340px; }
.hero > div { position: relative; z-index: 1; }
.eyebrow, .section-kicker { color: var(--green); font-size: 12px; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.eyebrow { align-items: center; display: flex; gap: 8px; margin-bottom: 18px; }
.eyebrow span { background: var(--green); height: 1px; width: 23px; }
.hero h1 { color: var(--ink-deep); font-family: Georgia, "Times New Roman", serif; font-size: clamp(48px, 4.5vw, 72px); font-weight: 400; line-height: .98; margin-bottom: 24px; }
.hero h1 em { color: var(--green); font-weight: 400; }
.hero p { color: #64766f; font-size: 18px; line-height: 1.65; margin-bottom: 0; max-width: 720px; }

.dashboard-grid { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); padding: 30px 6.5% 18px; scroll-margin-top: 100px; }
.panel { background: white; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 1px rgba(23,63,53,.015); }
.panel-heading { align-items: flex-start; display: flex; justify-content: space-between; padding: 28px 28px 0; }
.panel-heading h2 { font-family: Georgia, serif; font-size: 29px; font-weight: 400; line-height: 1.2; margin: 6px 0 0; }
.donut-panel { overflow: hidden; }
.donut-heading { align-items: center; gap: 28px; }
.donut-card-actions { align-items: center; display: flex; flex: 0 0 auto; gap: 12px; }
.donut-card-actions .region-picker { border-radius: 14px; height: 52px; min-width: 330px; padding: 0 18px; }
.donut-card-actions .region-picker select { flex: 1; font-size: 15px; max-width: 250px; }
.donut-card-actions .export-button { min-height: 52px; padding: 0 19px; white-space: nowrap; }
.dimension-count { background: var(--mint-light); border: 1px solid var(--line); border-radius: 18px; color: var(--green); font-size: 12px; font-weight: 800; padding: 6px 11px; }
.donut-toolbar { align-items: center; display: flex; gap: 18px; justify-content: space-between; padding: 24px 28px 0; }
.donut-filters { background: var(--mint-light); border: 1px solid var(--line); border-radius: 12px; display: inline-flex; padding: 4px; }
.donut-filters button { background: transparent; border: 0; border-radius: 9px; color: var(--ink-soft); cursor: pointer; font-size: 13px; font-weight: 750; min-height: 38px; padding: 0 13px; transition: .18s ease; }
.donut-filters button:hover { color: var(--ink); }
.donut-filters button.active { background: white; box-shadow: 0 2px 8px rgba(23,63,53,.09); color: var(--ink); }
.donut-method { color: var(--ink-soft); font-size: 13px; line-height: 1.55; margin: 15px 28px 0; max-width: 720px; }
.donut-content { align-items: center; display: grid; gap: 34px; grid-template-columns: minmax(290px, .82fr) minmax(390px, 1.18fr); padding: 24px 32px 30px; }
.chart-wrap { aspect-ratio: 1; isolation: isolate; margin: 0 auto; max-width: 390px; min-height: 280px; position: relative; width: 100%; }
.chart-wrap canvas { position: relative; z-index: 1; }
.chart-center { align-items: center; background: white; border: 1px solid var(--line); border-radius: 50%; box-shadow: 0 8px 28px rgba(23,63,53,.1); display: flex; flex-direction: column; height: clamp(108px, 36%, 132px); justify-content: center; left: 50%; pointer-events: none; position: absolute; top: 50%; transform: translate(-50%, -50%); width: clamp(108px, 36%, 132px); z-index: 2; }
.chart-center strong { font-family: Georgia, serif; font-size: 35px; font-weight: 400; line-height: 1; }
.chart-center span { color: var(--ink-soft); font-size: 12px; font-weight: 800; letter-spacing: .1em; margin-top: 6px; text-transform: uppercase; }
.donut-reading { display: grid; gap: 18px; min-width: 0; }
.donut-legend { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 430px; overflow-y: auto; padding: 2px; scrollbar-gutter: stable; }
.legend-item { align-items: center; background: white; border: 1px solid transparent; border-radius: 10px; cursor: pointer; display: grid; gap: 9px; grid-template-columns: 9px minmax(0, 1fr) auto; min-height: 56px; padding: 8px 10px; text-align: left; transition: .18s ease; }
.legend-item:hover { background: var(--mint-light); border-color: var(--line); }
.legend-item.active { background: var(--mint-light); border-color: rgba(77,138,104,.35); box-shadow: inset 0 0 0 1px rgba(77,138,104,.06); }
.legend-item i { border-radius: 50%; height: 9px; width: 9px; }
.legend-item span { min-width: 0; }
.legend-item span b, .legend-item span small { display: block; overflow-wrap: anywhere; }
.legend-item span b { color: var(--ink); font-size: 13px; }
.legend-item span small { color: var(--ink-soft); font-size: 12px; margin-top: 2px; }
.legend-item > strong { font-size: 13px; text-align: right; }
.legend-group { color: var(--ink); font-size: 12px; font-weight: 850; grid-column: 1 / -1; letter-spacing: .1em; margin: 6px 0 0; text-transform: uppercase; }
.legend-item:focus-visible, .donut-filters button:focus-visible { outline: 3px solid rgba(77,138,104,.35); outline-offset: 2px; }
.chart-tooltip { background: rgba(12,44,37,.96); border: 1px solid rgba(255,255,255,.12); border-radius: 12px; box-shadow: 0 14px 34px rgba(8,35,29,.24); color: white; display: grid; gap: 2px; left: 0; max-width: min(260px, calc(100% - 16px)); opacity: 0; overflow-wrap: anywhere; padding: 11px 13px; pointer-events: none; position: absolute; top: 0; transition: opacity .12s ease; visibility: hidden; width: max-content; z-index: 5; }
.chart-tooltip-pillar { color: var(--lime); font-size: 10px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.chart-tooltip-title { font-size: 14px; font-weight: 800; line-height: 1.25; margin: 2px 0 4px; }
.chart-tooltip-value, .chart-tooltip-gap { font-size: 12px; line-height: 1.35; }
.chart-tooltip-meta { border-top: 1px solid rgba(255,255,255,.14); color: #b6cbc3; font-size: 10px; line-height: 1.35; margin-top: 5px; padding-top: 5px; }
.donut-detail { --dimension-color: var(--green); background: linear-gradient(135deg, var(--mint-light), white); border: 1px solid var(--line); border-radius: 16px; padding: 18px 19px; }
.donut-detail-topline { align-items: center; display: flex; gap: 12px; justify-content: space-between; }
.donut-detail-topline > span { color: var(--green); font-size: 12px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.donut-detail-topline > strong { border-radius: 14px; font-size: 12px; padding: 5px 8px; }
.donut-detail-topline > strong.positive { background: #e3f1e7; color: #397653; }
.donut-detail-topline > strong.transition { background: #f5efd9; color: #8b6a28; }
.donut-detail-topline > strong.critical { background: #f8e5e0; color: #aa513e; }
.donut-detail h3 { font-family: Georgia, serif; font-size: 23px; font-weight: 400; margin: 8px 0 14px; }
.donut-detail-values { display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); }
.donut-detail-values > div { border-left: 1px solid var(--line); padding-left: 10px; }
.donut-detail-values > div:first-child { border-left: 0; padding-left: 0; }
.donut-detail-values strong, .donut-detail-values span { display: block; }
.donut-detail-values strong { font-family: Georgia, serif; font-size: 21px; font-weight: 400; }
.donut-detail-values span { color: var(--ink-soft); font-size: 12px; line-height: 1.25; margin-top: 3px; text-transform: uppercase; }
.donut-detail-track { background: #e6ece8; border-radius: 6px; height: 7px; margin-top: 15px; overflow: hidden; }
.donut-detail-track i { background: var(--dimension-color); border-radius: inherit; display: block; height: 100%; transition: width .35s ease; width: 0; }
.donut-detail p { color: var(--ink-soft); font-size: 13px; line-height: 1.55; margin: 12px 0 0; }
.panel-note { align-items: center; background: var(--mint-light); border-radius: 0 0 var(--radius) var(--radius); color: var(--ink-soft); display: flex; font-size: 14px; gap: 10px; min-height: 52px; padding: 10px 28px; }
.pulse { background: var(--green); border-radius: 50%; box-shadow: 0 0 0 4px rgba(77,138,104,.12); height: 6px; min-width: 6px; }
.map-panel, .comparison-panel { margin: 0 6.5% 18px; overflow: hidden; scroll-margin-top: 100px; }
.map-heading { align-items: center; padding-bottom: 16px; }
.map-filters { display: flex; gap: 6px; }
.filter-chip { align-items: center; background: white; border: 1px solid var(--line); border-radius: 22px; cursor: pointer; display: flex; font-size: 13px; font-weight: 650; gap: 8px; padding: 9px 13px; }
.filter-chip:not(.active) { opacity: .45; }
.dot { border-radius: 50%; height: 6px; width: 6px; }
.region-dot { background: var(--green); }
.project-dot { background: var(--amber); }
.observation-dot { background: var(--coral); }
#map { background: #edf1ea; height: 470px; width: 100%; }
.map-legend { align-items: center; color: var(--ink-soft); display: flex; font-size: 12px; gap: 9px; padding: 12px 28px; }
.map-legend > span { color: var(--ink); font-size: 13px; font-weight: 750; margin-right: 7px; }
.gradient { background: linear-gradient(90deg, #d87b61, #dbc66a, #68a57e); border-radius: 4px; height: 5px; width: 110px; }
.map-sources { align-items: center; border-top: 1px solid var(--line); color: var(--ink-soft); display: flex; font-size: 12px; gap: 14px; padding: 12px 28px; }
.map-sources a { color: var(--green); font-weight: 750; }
.leaflet-container { font-family: inherit; }
.leaflet-popup-content-wrapper { border-radius: 12px; box-shadow: var(--shadow); }
.leaflet-popup-content { margin: 18px 19px; }
.map-popup h3 { font-family: Georgia, serif; font-size: 21px; font-weight: 400; line-height: 1.2; margin: 7px 0 9px; }
.map-popup p { color: var(--ink-soft); font-size: 14px; line-height: 1.5; margin: 0; }
.map-popup > small { color: var(--ink-soft); display: block; font-size: 12px; margin-top: 9px; }
.popup-kicker { color: var(--green); font-size: 12px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.popup-topline { align-items: center; color: var(--ink-soft); display: flex; font-size: 12px; justify-content: space-between; }
.popup-solution { border-bottom: 1px solid var(--line); padding-bottom: 11px; }
.popup-donut { background: var(--mint-light); border-radius: 8px; display: grid; margin-top: 11px; padding: 9px 10px; }
.popup-donut span { color: var(--green); font-size: 12px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.popup-donut strong { font-family: Georgia, serif; font-size: 18px; font-weight: 400; margin-top: 3px; }
.popup-donut small { color: var(--ink-soft); font-size: 12px; }
.popup-benefits { display: grid; gap: 7px; margin: 11px 0; }
.popup-benefits div { border-left: 2px solid var(--lime-strong); padding-left: 8px; }
.popup-benefits div:last-child { border-color: var(--green); }
.popup-benefits dt { color: var(--ink); font-size: 12px; font-weight: 850; text-transform: uppercase; }
.popup-benefits dd { color: var(--ink-soft); font-size: 12px; line-height: 1.45; margin: 3px 0 0; }
.popup-sources { align-items: center; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; font-size: 12px; gap: 9px; padding-top: 11px; }
.popup-sources span { color: var(--ink-soft); text-transform: uppercase; }
.popup-sources a { color: var(--green); font-weight: 750; }
.marker-pin { align-items: center; border: 2px solid white; border-radius: 50% 50% 50% 5px; box-shadow: 0 2px 8px rgba(0,0,0,.2); color: white; display: flex; font-size: 10px; height: 26px; justify-content: center; transform: rotate(-45deg); width: 26px; }
.marker-pin span { transform: rotate(45deg); }
.marker-project { background: var(--amber); }
.marker-observation { background: var(--coral); }

.comparison-panel { min-height: 520px; padding-bottom: 28px; }
.comparison-panel .panel-heading { gap: 24px; }
.comparison-description { color: var(--ink-soft); font-size: 14px; line-height: 1.55; margin: 10px 0 0; max-width: 680px; }
.comparison-table { padding: 24px 28px 0; }
.comparison-table > .loading-line + .loading-line { margin-top: 12px; }
.table-scroll { border: 1px solid var(--line); border-radius: 14px; max-height: 560px; overflow: auto; }
.territory-table { border-collapse: separate; border-spacing: 0; font-size: 14px; min-width: 1180px; width: 100%; }
.territory-table caption { background: #fafbf9; border-bottom: 1px solid var(--line); caption-side: top; color: var(--ink-soft); font-size: 12px; line-height: 1.45; padding: 11px 16px; text-align: left; }
.territory-table th { background: white; color: var(--ink-soft); font-size: 11px; font-weight: 850; letter-spacing: .07em; padding: 13px 14px; position: sticky; text-align: left; text-transform: uppercase; top: 0; white-space: nowrap; z-index: 2; }
.territory-table td { border-top: 1px solid var(--line); padding: 15px 14px; vertical-align: middle; }
.territory-table tbody tr { transition: background-color .15s ease; }
.territory-table tbody tr:hover { background: #f9fbf8; }
.rank-cell { color: var(--ink-soft); font-family: Georgia, serif; font-size: 17px; text-align: center; width: 48px; }
.territory-name { align-items: center; display: grid; gap: 10px; grid-template-columns: 42px minmax(150px, 1fr); }
.territory-name > span { background: var(--sand); border-radius: 8px; color: var(--green); font-size: 11px; font-weight: 850; padding: 7px 5px; text-align: center; }
.territory-name > strong { font-size: 14px; line-height: 1.35; }
.population-cell strong, .population-cell small, .score-metric strong, .score-metric small, .balance-metric strong, .balance-metric small, .coverage-metric strong, .coverage-metric span, .coverage-metric small { display: block; }
.population-cell strong { font-size: 14px; }
.population-cell small, .score-metric small, .balance-metric small, .coverage-metric small { color: var(--ink-soft); font-size: 11px; margin-top: 3px; }
.score-metric { min-width: 145px; }
.score-metric strong { font-size: 15px; }
.score-track { background: #e7ede9; border-radius: 5px; display: block; height: 5px; margin-top: 9px; overflow: hidden; width: 100%; }
.score-track i { background: var(--coral); border-radius: inherit; display: block; height: 100%; }
.score-metric.transition .score-track i { background: var(--amber); }
.score-metric.positive .score-track i { background: var(--green); }
.score-metric.unavailable strong { color: var(--ink-soft); }
.balance-metric { min-width: 135px; }
.balance-metric strong { font-family: Georgia, serif; font-size: 23px; font-weight: 400; }
.balance-metric > span { border-radius: 12px; display: inline-block; font-size: 11px; font-weight: 800; margin-top: 5px; padding: 4px 7px; }
.balance-metric.positive > span { background: #e3f1e7; color: #397653; }
.balance-metric.transition > span { background: #f5efd9; color: #8b6a28; }
.balance-metric.critical > span { background: #f8e5e0; color: #aa513e; }
.balance-metric.unavailable > span { background: #edf0ed; color: var(--ink-soft); }
.coverage-metric { min-width: 145px; }
.coverage-metric strong { font-family: Georgia, serif; font-size: 22px; font-weight: 400; }
.coverage-metric span { color: var(--ink); font-size: 12px; margin-top: 2px; }

.content-section { padding: 52px 6.5% 28px; scroll-margin-top: 82px; }
.small-button { background: var(--mint-light); border: 1px solid var(--line); border-radius: 9px; color: var(--green); cursor: pointer; font-size: 14px; font-weight: 800; padding: 8px 12px; }
.status-badge { background: var(--mint-light); border-radius: 20px; color: var(--green); display: inline-block; font-size: 12px; font-weight: 800; padding: 5px 9px; text-transform: uppercase; }
.status-badge.pending, .status-badge.planned, .status-badge.draft { background: #f6f0df; color: #9b762f; }
.status-badge.rejected, .status-badge.paused { background: #f8e5e0; color: #b65c48; }
.evidence-section { padding-top: 20px; }
.evidence-section .panel { min-height: 380px; }
.evidence-list { padding: 18px 28px 26px; }
.evidence-item { align-items: flex-start; border-bottom: 1px solid var(--line); display: grid; gap: 12px; grid-template-columns: 9px 1fr auto; padding: 15px 0; }
.evidence-marker { background: var(--green); border-radius: 50%; height: 7px; margin-top: 5px; width: 7px; }
.evidence-item.pending .evidence-marker { background: var(--amber); }
.evidence-item strong, .evidence-item small { display: block; }
.evidence-item strong { font-size: 14px; }
.evidence-item small { color: var(--ink-soft); font-size: 12px; margin-top: 4px; }

.participation-section { background: var(--ink-deep); color: white; display: grid; gap: 7%; grid-template-columns: .85fr 1.15fr; margin-top: 48px; padding: 76px 6.5%; scroll-margin-top: 82px; }
.section-kicker.light { color: var(--lime); }
.participation-intro h2 { font-family: Georgia, serif; font-size: 42px; font-weight: 400; line-height: 1.12; margin: 12px 0 19px; }
.participation-intro p { color: #a7bdb4; font-size: 15px; line-height: 1.7; max-width: 470px; }
.participation-intro .button { margin-top: 10px; }
.contribution-list { display: grid; gap: 10px; }
.contribution-card { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); border-radius: 16px; display: grid; gap: 17px; grid-template-columns: 1fr auto; min-height: 128px; padding: 20px 22px; }
.contribution-kind { color: var(--lime); font-size: 12px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.contribution-card h3 { font-family: Georgia, serif; font-size: 22px; font-weight: 400; margin: 5px 0; }
.contribution-card p { color: #a7bdb4; font-size: 13px; margin: 0; }
.vote-button { align-items: center; align-self: center; background: rgba(215,234,145,.09); border: 1px solid rgba(215,234,145,.2); border-radius: 9px; color: var(--lime); cursor: pointer; display: flex; flex-direction: column; font-size: 12px; height: 53px; justify-content: center; width: 49px; }
.vote-button span { font-size: 12px; }

.modal { background: white; border: 0; border-radius: 22px; box-shadow: 0 30px 90px rgba(8,35,29,.25); color: var(--ink); max-height: calc(100vh - 40px); overflow: auto; padding: 36px; width: min(520px, calc(100vw - 30px)); }
.modal::backdrop { backdrop-filter: blur(4px); background: rgba(8,35,29,.6); }
.modal-close { background: var(--mint-light); border: 0; border-radius: 50%; cursor: pointer; font-size: 17px; height: 28px; line-height: 1; position: absolute; right: 15px; top: 15px; width: 28px; }
.modal-brand { align-items: center; display: flex; gap: 12px; margin-bottom: 23px; }
.modal-brand .brand-mark span { background: white; }
.modal-brand strong, .modal-brand small { display: block; }
.modal-brand strong { font-family: Georgia, serif; font-size: 23px; font-weight: 400; }
.modal-brand small, .modal-description { color: var(--ink-soft); font-size: 14px; }
.tab-list { background: var(--mint-light); border-radius: 12px; display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 22px; padding: 4px; }
.tab-list button { background: transparent; border: 0; border-radius: 9px; cursor: pointer; font-size: 14px; font-weight: 750; min-height: 44px; padding: 10px; }
.tab-list button.active { background: white; box-shadow: 0 2px 6px rgba(23,63,53,.08); }
.modal-form { display: grid; gap: 16px; }
.modal-form label { color: var(--ink-soft); display: grid; font-size: 14px; font-weight: 750; gap: 8px; }
.modal-form input, .modal-form select, .modal-form textarea { background: white; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); min-height: 50px; outline: 0; padding: 12px 14px; width: 100%; }
.modal-form input:focus, .modal-form select:focus, .modal-form textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(77,138,104,.1); }
.modal-form textarea { min-height: 85px; resize: vertical; }
.form-hint { color: var(--ink-soft); font-size: 13px; margin: 0; text-align: center; }
.resource-modal h2 { font-family: Georgia, serif; font-size: 31px; font-weight: 400; margin: 7px 0 6px; }
.modal-description { margin-bottom: 18px; }
.form-grid { grid-template-columns: 1fr 1fr; }
.form-grid .wide, .form-grid .button { grid-column: 1 / -1; }

.user-popover { background: white; border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow); display: grid; padding: 16px; position: fixed; right: 4.5%; top: 72px; width: 210px; z-index: 1100; }
.user-popover strong { font-size: 15px; }
.user-popover small { color: var(--ink-soft); font-size: 12px; }
.user-popover button { background: transparent; border: 0; border-top: 1px solid var(--line); color: var(--coral); cursor: pointer; font-size: 13px; margin-top: 12px; padding: 11px 0 0; text-align: left; }
.toast-region { bottom: 20px; display: grid; gap: 8px; position: fixed; right: 20px; z-index: 2000; }
.toast { animation: toast-in .2s ease; background: var(--ink-deep); border-radius: 11px; box-shadow: var(--shadow); color: white; font-size: 14px; max-width: 380px; padding: 14px 17px; }
.toast.error { background: #8e4435; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

/* Login */
.login-page { background: var(--ink-deep); min-height: 100vh; overflow-x: hidden; }
.login-shell { display: grid; grid-template-columns: minmax(540px, 1.14fr) minmax(590px, .86fr); min-height: 100vh; }
.login-story { background: linear-gradient(145deg, #0d3129 0%, var(--ink-deep) 72%); color: white; display: flex; flex-direction: column; min-height: 100vh; overflow: hidden; padding: 44px 6.5% 36px; position: relative; }
.login-brand { position: relative; z-index: 2; }
.login-story-content { margin: auto 0; max-width: 790px; padding: 50px 0; position: relative; z-index: 2; }
.territory-signature { align-items: center; display: flex; gap: 14px; margin-bottom: 38px; }
.territory-signature > span { align-items: center; background: var(--lime); border-radius: 11px; box-shadow: 0 10px 28px rgba(215,234,145,.1); color: var(--ink-deep); display: flex; font-size: 16px; font-weight: 900; height: 48px; justify-content: center; letter-spacing: -.03em; width: 58px; }
.territory-signature strong, .territory-signature small { display: block; line-height: 1.25; }
.territory-signature strong { font-size: 17px; }
.territory-signature small { color: #8eaaa0; font-size: 13px; margin-top: 3px; }
.login-story h1 { font-family: Georgia, serif; font-size: clamp(62px, 5.2vw, 92px); font-weight: 400; line-height: .96; margin: 19px 0 30px; }
.login-story h1 em { color: var(--lime); font-weight: 400; }
.login-story-content > p { color: #afc4bc; font-size: 18px; line-height: 1.7; max-width: 700px; }
.territory-facts { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); margin-top: 38px; max-width: 760px; }
.territory-facts > div { background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.1); border-radius: 15px; display: grid; min-height: 118px; padding: 20px; }
.territory-facts > div:first-child { padding-left: 20px; }
.territory-facts strong { color: white; font-family: Georgia, serif; font-size: 31px; font-weight: 400; line-height: 1; }
.territory-facts span { color: #d0dfd9; font-size: 14px; margin-top: 11px; }
.territory-facts small { color: #87a69b; font-size: 12px; margin-top: 4px; }
.login-reference { color: #78998d; font-size: 12px; line-height: 1.5; margin: 0; max-width: 760px; position: relative; z-index: 2; }
.login-reference a { color: #acc5bb; text-decoration: underline; text-underline-offset: 2px; }
.login-rings { bottom: -210px; height: 650px; opacity: .14; position: absolute; right: -180px; width: 650px; }
.login-rings span { border: 1px solid var(--lime); border-radius: 50%; inset: 0; position: absolute; }
.login-rings span:nth-child(2) { inset: 70px; }
.login-rings span:nth-child(3) { background: radial-gradient(circle, transparent 0 15%, var(--lime) 16% 17%, transparent 18%); inset: 140px; }
.login-access { align-items: center; background: linear-gradient(135deg, #f5f1e8, #eef4ed); display: flex; justify-content: center; min-height: 100vh; padding: 44px 5%; position: relative; }
.login-access::before { background: radial-gradient(circle, rgba(36,94,78,.14) 1px, transparent 1.7px); background-size: 22px 22px; content: ""; height: 240px; position: absolute; right: 0; top: 0; width: 320px; }
.login-access::after { background: var(--lime); border-radius: 50%; bottom: 6%; content: ""; filter: blur(90px); height: 180px; opacity: .2; position: absolute; right: 10%; width: 180px; }
.login-card { background: rgba(255,255,255,.94); border: 1px solid rgba(23,63,53,.09); border-radius: 28px; box-shadow: 0 35px 90px rgba(23,63,53,.14); padding: 38px 40px 32px; position: relative; width: min(640px, 100%); z-index: 1; }
.login-card-heading { margin-bottom: 25px; }
.login-card-heading h2 { font-family: Georgia, serif; font-size: 43px; font-weight: 400; margin: 20px 0 8px; }
.login-card-heading > p { color: var(--ink-soft); font-size: 16px; line-height: 1.5; margin: 0; }
.login-status { align-items: center; color: var(--ink-soft); display: flex; font-size: 12px; font-weight: 650; gap: 8px; }
.login-status i { background: var(--amber); border-radius: 50%; height: 6px; width: 6px; }
.login-status i.online { background: #64a976; box-shadow: 0 0 0 3px rgba(100,169,118,.12); }
.login-status i.offline { background: var(--coral); }
.profile-access-heading { display: grid; gap: 4px; }
.profile-access-heading strong { font-size: 16px; }
.profile-access-heading span { color: var(--ink-soft); font-size: 13px; }
.profile-login-grid { display: grid; gap: 11px; grid-template-columns: 1fr 1fr; }
.profile-login-button { align-items: center; background: #f7faf7; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); cursor: pointer; display: flex; gap: 12px; min-height: 78px; padding: 14px; text-align: left; transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; width: 100%; }
.profile-login-button.admin { background: linear-gradient(135deg, #edf7f1, #f3f8dc); border-color: rgba(77,138,104,.28); grid-column: 1 / -1; min-height: 88px; padding: 16px; }
.profile-login-button:hover { border-color: var(--green); box-shadow: 0 8px 22px rgba(36,94,78,.09); transform: translateY(-1px); }
.profile-login-button:disabled { cursor: wait; opacity: .68; transform: none; }
.profile-login-button > span:nth-child(2) { flex: 1; min-width: 0; }
.profile-login-button strong, .profile-login-button small { display: block; }
.profile-login-button strong { font-size: 14px; line-height: 1.3; }
.profile-login-button.admin strong { font-size: 16px; }
.profile-login-button small { color: var(--ink-soft); font-size: 12px; line-height: 1.4; margin-top: 4px; }
.profile-login-button > b { color: var(--green); font-size: 20px; }
.profile-login-icon { align-items: center; background: white; border: 1px solid rgba(77,138,104,.2); border-radius: 11px; color: var(--green); display: flex; flex: 0 0 44px; font-size: 12px; font-weight: 850; height: 44px; justify-content: center; letter-spacing: .04em; }
.profile-login-button.admin .profile-login-icon { background: var(--green); border-color: var(--green); color: white; }
.login-divider { align-items: center; color: var(--ink-soft); display: flex; font-size: 12px; gap: 11px; letter-spacing: .04em; text-transform: uppercase; }
.login-divider::before, .login-divider::after { background: var(--line); content: ""; flex: 1; height: 1px; }
.password-field { display: block; position: relative; }
.password-field input { padding-right: 58px; }
.password-field button { background: transparent; border: 0; color: var(--green); cursor: pointer; font-size: 12px; font-weight: 800; position: absolute; right: 11px; top: 50%; transform: translateY(-50%); }
.login-message { background: #f8e7e2; border-radius: 10px; color: #9d4937; font-size: 13px; margin: -5px 0 13px; padding: 12px 13px; }
.login-message.success { background: var(--mint-light); color: var(--green); }
.login-privacy { border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 12px; margin: 23px 0 0; padding-top: 18px; text-align: center; }

.skeleton { animation: shimmer 1.4s infinite linear; background: linear-gradient(100deg, #f0f3ef 20%, #fafbf8 40%, #f0f3ef 60%); background-size: 200% 100%; border-color: transparent; }
.loading-line { animation: shimmer 1.4s infinite linear; background: linear-gradient(100deg, #edf1ed 20%, #fafbf8 40%, #edf1ed 60%); background-size: 200% 100%; border-radius: 6px; height: 42px; }
@keyframes shimmer { to { background-position-x: -200%; } }
.empty-state { color: var(--ink-soft); font-size: 14px; padding: 30px 0; text-align: center; }

@media (max-width: 1180px) {
  .login-shell { display: block; }
  .login-story { min-height: auto; padding: 38px 7% 34px; }
  .login-story-content { margin: 0; padding: 78px 0 60px; }
  .login-access { min-height: auto; padding: 70px 6%; }
}

@media (max-width: 1200px) {
  :root { --sidebar: 220px; }
  .hero { align-items: flex-start; flex-direction: column; gap: 30px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .donut-heading { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 1150px) {
  .donut-content { grid-template-columns: 1fr; }
  .chart-wrap { max-width: 390px; }
}

@media (max-width: 900px) {
  :root { --sidebar: 232px; }
  .sidebar { box-shadow: 15px 0 50px rgba(0,0,0,.25); transform: translateX(-105%); transition: transform .25s ease; }
  body.menu-open .sidebar { transform: translateX(0); }
  .app-shell { margin-left: 0; }
  .menu-button { background: transparent; border: 0; display: block; font-size: 20px; }
  .topbar { padding: 0 4%; }
  .context-title { display: none; }
  .hero, .dashboard-grid, .content-section { padding-left: 5%; padding-right: 5%; }
  .donut-card-actions { width: 100%; }
  .donut-toolbar { align-items: flex-start; flex-direction: column; gap: 12px; }
  .donut-content { grid-template-columns: 1fr; }
  .map-panel, .comparison-panel { margin-left: 5%; margin-right: 5%; }
  .participation-section { grid-template-columns: 1fr; padding-left: 5%; padding-right: 5%; }
  .login-story { min-height: 520px; padding: 28px 7%; }
  .login-story-content { padding: 50px 0 34px; }
  .login-story h1 { font-size: 45px; }
  .login-reference { display: none; }
  .login-access { min-height: calc(100vh - 520px); padding: 35px 5%; }
}

@media (max-width: 560px) {
  .topbar-actions { gap: 5px; }
  .hero { min-height: auto; padding-bottom: 42px; padding-top: 42px; }
  .hero h1 { font-size: 39px; }
  .donut-card-actions { align-items: stretch; display: grid; grid-template-columns: 1fr; }
  .donut-card-actions .region-picker { min-width: 0; width: 100%; }
  .donut-card-actions .region-picker select { min-width: 0; width: 100%; }
  .donut-card-actions .export-button { width: 100%; }
  .donut-content { padding-left: 20px; padding-right: 20px; }
  .chart-wrap { min-height: 0; }
  .chart-center strong { font-size: 30px; }
  .donut-filters { display: grid; grid-template-columns: 1fr; width: 100%; }
  .donut-filters button { width: 100%; }
  .donut-legend { grid-template-columns: 1fr; }
  .legend-group { grid-column: 1 / -1; }
  .donut-detail-values { grid-template-columns: 1fr; }
  .donut-detail-values > div { border-left: 0; border-top: 1px solid var(--line); padding: 9px 0 0; }
  .donut-detail-values > div:first-child { border-top: 0; padding-top: 0; }
  .map-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .map-filters { overflow-x: auto; width: 100%; }
  #map { height: 340px; }
  .comparison-panel .panel-heading { align-items: flex-start; flex-direction: column; gap: 14px; }
  .comparison-table { padding-left: 18px; padding-right: 18px; }
  .contribution-card { grid-template-columns: 1fr auto; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide, .form-grid .button { grid-column: auto; }
  .map-sources { align-items: flex-start; flex-direction: column; gap: 4px; }
  .login-story { min-height: auto; }
  .login-story-content { padding: 42px 0 28px; }
  .login-story h1 { font-size: 42px; }
  .login-story-content > p, .territory-signature { display: none; }
  .territory-facts { gap: 8px; grid-template-columns: 1fr; margin-top: 26px; }
  .territory-facts > div, .territory-facts > div:first-child { align-items: center; grid-template-columns: 115px 1fr; min-height: 0; padding: 14px 16px; }
  .territory-facts strong { font-size: 24px; }
  .territory-facts span { font-size: 13px; margin-top: 0; }
  .territory-facts small { display: none; }
  .login-access { min-height: auto; padding: 30px 4%; }
  .login-card { border-radius: 20px; padding: 28px 24px; }
  .login-card-heading h2 { font-size: 36px; }
  .profile-login-grid { grid-template-columns: 1fr; }
  .profile-login-button.admin { grid-column: auto; }
}

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