/* =========================================================
   SDAU DOUKKALA 2045 — PLATAFORMA TERRITORIAL
   Sistema visual: editorial / institucional refinado
   Verde forestal + ocre + cálidos neutros pergamino
   Source Serif 4 (titulares) · Geist (UI) · Geist Mono (cifras)
   ========================================================= */

/* ===== TOKENS ===== */
:root {
    /* Marca */
    --primary: #1b4332;
    --primary-2: #2d6a4f;
    --primary-3: #40916c;
    --primary-ink: #0f2a1f;
    --primary-soft: #ecf1ed;
    --accent: #a17e1a;
    --accent-2: #c19a2d;
    --accent-soft: #f4ecd6;

    /* Neutros cálidos */
    --bg: #f7f4ee;
    --bg-2: #efeae0;
    --bg-3: #e5dfd1;
    --surface: #ffffff;
    --surface-2: #fbf9f4;
    --border: #e3ddd0;
    --border-2: #d4cdb9;
    --border-strong: #b9b09a;

    /* Tinta */
    --ink: #1a1f1a;
    --ink-2: #3d423d;
    --ink-3: #5e635d;
    --muted: #87847b;
    --muted-2: #a8a59a;

    /* Categorías (acentos de 1-2px, no rellenos) */
    --cat-demo: #4a6fa5;       /* azul tinta */
    --cat-territory: #2d6a4f;  /* verde */
    --cat-economy: #a17e1a;    /* ocre */
    --cat-industry: #6b4423;   /* terracota oscuro */
    --cat-tourism: #b56d3a;    /* terracota */
    --cat-environment: #4f7c5e;/* verde salvia */
    --cat-housing: #8a4f6d;    /* malva apagado */
    --cat-infra: #4a4a4a;      /* grafito */

    /* Estados */
    --ok: #2d6a4f;
    --warn: #b8771c;
    --info: #4a6fa5;
    --danger: #a83232;
    --ok-soft: #e3eee6;
    --warn-soft: #f5e9d2;
    --info-soft: #e2e8f1;
    --danger-soft: #f1dcdc;

    /* Aliases retro-compatibles (para inline styles del JS heredado) */
    --text: var(--ink);
    --text-light: var(--muted);
    --card-bg: var(--surface);
    --card-header-bg: var(--surface-2);

    /* Tipografía */
    --serif: 'Source Serif 4', 'Source Serif Pro', Georgia, serif;
    --sans: 'Geist', 'Inter', system-ui, -apple-system, sans-serif;
    --mono: 'Geist Mono', 'IBM Plex Mono', 'JetBrains Mono', ui-monospace, monospace;

    /* Geometría */
    --sidebar-w: 256px;
    --topnav-h: 56px;
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(20, 30, 20, 0.04);
    --shadow: 0 2px 6px rgba(20, 30, 20, 0.05), 0 1px 2px rgba(20, 30, 20, 0.04);
    --shadow-lg: 0 8px 24px rgba(20, 30, 20, 0.08), 0 2px 6px rgba(20, 30, 20, 0.05);
    --shadow-xl: 0 16px 40px rgba(20, 30, 20, 0.12);
    --t: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-fast: 120ms ease;
}

body.dark {
    --primary: #6db58a;
    --primary-2: #4f9a72;
    --primary-3: #3a7e5b;
    --primary-ink: #b8d8c4;
    --primary-soft: #1a2823;
    --accent: #d4ad4a;
    --accent-2: #b8923a;
    --accent-soft: #2a2418;
    --bg: #12150f;
    --bg-2: #181c14;
    --bg-3: #1f231a;
    --surface: #1a1e16;
    --surface-2: #15180f;
    --border: #2a2e23;
    --border-2: #353a2c;
    --border-strong: #4a5040;
    --ink: #ebe8df;
    --ink-2: #c2c0b5;
    --ink-3: #98968d;
    --muted: #7a7870;
    --muted-2: #5a5851;
    --ok: #6db58a;
    --warn: #d4ad4a;
    --info: #7d9bcc;
    --danger: #d47272;
    --ok-soft: #1d2820;
    --warn-soft: #2a2418;
    --info-soft: #1c2230;
    --danger-soft: #2a1c1c;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
    --shadow: 0 2px 8px rgba(0,0,0,0.5);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.6);
    --shadow-xl: 0 20px 50px rgba(0,0,0,0.7);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
*:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

html { scroll-behavior: smooth; }
body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'ss01', 'cv11';
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; }

/* Tipografía editorial */
h1, h2, h3, h4, h5 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.01em; color: var(--ink); }
h1 { font-size: 2.4rem; line-height: 1.05; letter-spacing: -0.025em; }
h2 { font-size: 1.85rem; line-height: 1.1; letter-spacing: -0.02em; }
h3 { font-size: 1.35rem; line-height: 1.2; font-weight: 600; }
h4 { font-size: 1rem; line-height: 1.3; font-weight: 600; }
h5 { font-size: 0.92rem; line-height: 1.3; font-weight: 600; }

.eyebrow {
    font-family: var(--sans);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}
.mono { font-family: var(--mono); font-feature-settings: 'tnum' 1; }

/* ===== SPLASH ===== */
.splash-screen {
    position: fixed; inset: 0; z-index: 99999;
    background: var(--primary);
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}
.splash-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-inner { text-align: center; color: #fff; max-width: 380px; padding: 0 20px; }
.splash-emblem {
    width: 56px; height: 56px; margin: 0 auto 22px;
    border: 2px solid var(--accent-2);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--accent-2); font-size: 1.4rem;
}
.splash-inner .eyebrow { color: var(--accent-2); margin-bottom: 8px; opacity: 1; }
.splash-inner h1 { font-family: var(--serif); font-size: 1.8rem; font-weight: 500; color: #fff; margin-bottom: 28px; line-height: 1.15; }
.splash-bar { width: 200px; height: 2px; background: rgba(255,255,255,0.15); margin: 0 auto 14px; overflow: hidden; }
.splash-bar-fill { width: 35%; height: 100%; background: var(--accent-2); animation: splashLoad 1.4s ease-in-out infinite; }
.splash-sub { font-size: 0.78rem; opacity: 0.7; letter-spacing: 0.05em; }
@keyframes splashLoad { 0% { transform: translateX(-100%); } 60%,100% { transform: translateX(285%); } }

/* ===== TOP NAV ===== */
.top-nav {
    position: fixed; top: 0; left: 0; right: 0; height: var(--topnav-h); z-index: 1000;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 18px;
}
.nav-left { display: flex; align-items: center; gap: 14px; min-width: var(--sidebar-w); padding-right: 18px; border-right: 1px solid var(--border); height: 100%; margin-right: 6px; }
.nav-left { margin-left: -18px; padding-left: 18px; }
.sidebar-toggle {
    background: transparent; border: none; color: var(--ink-2);
    font-size: 0.95rem; cursor: pointer; padding: 7px 10px; border-radius: var(--radius-sm);
    transition: var(--t-fast);
}
.sidebar-toggle:hover { background: var(--bg-2); color: var(--primary); }

.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
    width: 30px; height: 30px;
    background: var(--primary);
    color: var(--accent-2);
    display: flex; align-items: center; justify-content: center;
    border-radius: 4px;
    font-family: var(--serif);
    font-size: 0.95rem; font-weight: 700;
    letter-spacing: -0.02em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name { font-family: var(--serif); font-size: 0.95rem; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.brand-sub { font-size: 0.62rem; color: var(--muted); margin-top: 3px; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 500; }

.nav-center { flex: 1; display: flex; align-items: center; padding: 0 24px; }
.nav-breadcrumb { display: flex; align-items: center; gap: 10px; font-size: 0.82rem; color: var(--muted); }
.nav-breadcrumb .sep { color: var(--muted-2); }
.nav-breadcrumb .current { color: var(--ink); font-weight: 500; }

.nav-right { display: flex; align-items: center; gap: 6px; }

.global-search { position: relative; }
.global-search input {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--ink);
    padding: 7px 12px 7px 32px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem; width: 220px;
    transition: var(--t);
    outline: none;
    font-family: inherit;
}
.global-search input::placeholder { color: var(--muted-2); }
.global-search input:focus { background: var(--surface); border-color: var(--primary-3); box-shadow: 0 0 0 3px var(--primary-soft); width: 280px; }
.global-search > i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 0.78rem; pointer-events: none; }
.global-search .kbd {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    font-family: var(--mono); font-size: 0.62rem; color: var(--muted);
    background: var(--surface); border: 1px solid var(--border-2);
    padding: 1px 5px; border-radius: 3px;
    pointer-events: none;
}
.global-search input:focus + .kbd { display: none; }

.search-results {
    position: absolute; top: calc(100% + 6px); left: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    width: 380px; max-height: 420px; overflow-y: auto;
    display: none; z-index: 2000;
}
.search-results.show { display: block; animation: slideDown 180ms ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.search-result-group { padding: 6px 0; border-bottom: 1px solid var(--border); }
.search-result-group:last-child { border-bottom: none; }
.search-result-header {
    font-family: var(--sans); font-size: 0.62rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.12em;
    color: var(--muted); padding: 8px 16px 4px;
}
.search-result-item {
    padding: 9px 16px; cursor: pointer;
    display: flex; align-items: center; gap: 10px;
    font-size: 0.85rem; color: var(--ink);
    transition: var(--t-fast);
}
.search-result-item:hover { background: var(--bg-2); color: var(--primary); }
.search-result-item i { color: var(--muted); width: 14px; font-size: 0.78rem; }
.search-empty { padding: 24px; text-align: center; color: var(--muted); font-size: 0.85rem; }

.nav-lang { display: flex; align-items: center; padding: 2px; gap: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-left: 4px; }
.lang-btn-sm {
    padding: 4px 8px; font-size: 0.7rem; border-radius: 3px;
    border: none; background: transparent; color: var(--muted);
    cursor: pointer; font-weight: 600;
    transition: var(--t-fast);
    font-family: var(--sans);
    min-width: 26px;
}
.lang-btn-sm:hover { color: var(--ink); }
.lang-btn-sm.active { background: var(--primary); color: #fff; }

.icon-btn {
    background: transparent; border: 1px solid transparent;
    color: var(--ink-2); cursor: pointer;
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.82rem;
    transition: var(--t-fast);
}
.icon-btn:hover { background: var(--bg-2); color: var(--primary); }

.nav-user {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 10px 4px 6px;
    border-left: 1px solid var(--border);
    margin-left: 6px;
    font-size: 0.78rem;
    color: var(--ink-2);
}
.nav-user-avatar {
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--primary-soft); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.72rem; font-weight: 600;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed; left: 0; top: var(--topnav-h); bottom: 0; width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    z-index: 90;
    display: flex; flex-direction: column;
    transition: transform var(--t);
}
.sidebar.collapsed { transform: translateX(-100%); }
.sidebar-menu { flex: 1; padding: 14px 12px 24px; overflow-y: auto; }

.sidebar-section { margin-bottom: 18px; }
.sidebar-section-label {
    font-family: var(--sans);
    font-size: 0.62rem; font-weight: 600;
    letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--muted);
    padding: 4px 12px 8px;
}

.menu-item {
    display: flex; align-items: center; gap: 11px;
    padding: 8px 12px;
    margin: 1px 0;
    border-radius: var(--radius-sm);
    font-size: 0.86rem; font-weight: 500;
    color: var(--ink-2);
    transition: var(--t-fast);
    position: relative;
    cursor: pointer;
}
.menu-item i { width: 18px; text-align: center; font-size: 0.86rem; color: var(--muted); transition: var(--t-fast); }
.menu-item:hover { background: var(--bg-2); color: var(--ink); }
.menu-item:hover i { color: var(--ink-2); }
.menu-item.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}
.menu-item.active i { color: var(--primary); }
.menu-item.active::before {
    content: ''; position: absolute;
    left: -12px; top: 7px; bottom: 7px;
    width: 2px; background: var(--primary);
    border-radius: 0 2px 2px 0;
}
.menu-item .menu-badge {
    margin-left: auto;
    font-family: var(--mono); font-size: 0.66rem; font-weight: 500;
    color: var(--muted);
    background: var(--bg-2);
    padding: 1px 6px; border-radius: 3px;
}
.menu-item.active .menu-badge { background: rgba(27, 67, 50, 0.12); color: var(--primary); }

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    font-size: 0.72rem; color: var(--muted);
}
.sidebar-status { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-weight: 500; }
.live-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 0 0 rgba(45, 106, 79, 0.5);
    animation: pulse 1.8s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(45, 106, 79, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(45, 106, 79, 0); }
}
.sidebar-foot-sm { font-size: 0.66rem; color: var(--muted-2); margin-top: 2px; }

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: var(--sidebar-w);
    margin-top: var(--topnav-h);
    padding: 32px 36px 60px;
    min-height: calc(100vh - var(--topnav-h));
    transition: margin var(--t);
    max-width: 1600px;
}
.main-content.expanded { margin-left: 0; }
.page { display: none; }
.page.active { display: block; animation: pageIn 280ms cubic-bezier(0.4, 0, 0.2, 1); }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ===== EDITORIAL HEADER PATTERN ===== */
.section-title {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 24px; flex-wrap: wrap;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}
.section-title-left { display: flex; flex-direction: column; gap: 8px; }
.section-title h3 { font-family: var(--serif); font-size: 1.65rem; font-weight: 500; letter-spacing: -0.02em; }
.section-title-desc { font-size: 0.86rem; color: var(--ink-3); max-width: 56ch; }
.section-title-aside { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ===== DASHBOARD HERO (editorial) ===== */
.dashboard-hero {
    position: relative; overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 40px;
    margin-bottom: 28px;
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 40px;
    align-items: center;
}
.dashboard-hero::before {
    content: '';
    position: absolute; left: 0; top: 0; bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, var(--primary), var(--accent));
}
.hero-content { display: flex; flex-direction: column; gap: 14px; }
.hero-eyebrow { display: flex; align-items: center; gap: 10px; }
.hero-eyebrow .eyebrow { color: var(--primary); font-weight: 700; }
.hero-eyebrow .divider { width: 24px; height: 1px; background: var(--border-2); }
.hero-eyebrow .date { font-size: 0.7rem; color: var(--muted); font-family: var(--mono); }

.dashboard-hero h2 {
    font-family: var(--serif);
    font-size: 2.2rem;
    font-weight: 500;
    line-height: 1.08;
    letter-spacing: -0.025em;
    color: var(--ink);
    max-width: 22ch;
}
.dashboard-hero h2 .accent { color: var(--primary); font-style: italic; font-weight: 500; }
.hero-subtitle { font-size: 0.95rem; color: var(--ink-3); line-height: 1.55; max-width: 50ch; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

.btn-hero, .btn-hero-outline {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-weight: 500; font-size: 0.85rem;
    cursor: pointer;
    transition: var(--t);
    border: 1px solid transparent;
    font-family: inherit;
}
.btn-hero {
    background: var(--primary); color: #fff;
    border-color: var(--primary);
}
.btn-hero:hover { background: var(--primary-ink); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-hero-outline {
    background: transparent; color: var(--ink);
    border-color: var(--border-2);
}
.btn-hero-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

.hero-stat {
    border-left: 1px solid var(--border);
    padding-left: 32px;
    display: flex; flex-direction: column; gap: 10px;
}
.hero-stat-value {
    font-family: var(--serif);
    font-size: 4.2rem;
    font-weight: 400;
    line-height: 0.95;
    letter-spacing: -0.04em;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}
.hero-stat-suffix { font-size: 0.86rem; color: var(--ink-3); margin-top: -2px; }
.hero-stat-label { font-size: 0.78rem; color: var(--muted); font-weight: 500; }
.hero-stat-meta { display: flex; gap: 18px; margin-top: 8px; }
.hero-meta-item { display: flex; flex-direction: column; }
.hero-meta-num { font-family: var(--mono); font-size: 1rem; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.hero-meta-lbl { font-size: 0.68rem; color: var(--muted); margin-top: 2px; letter-spacing: 0.04em; }

/* ===== KPI CARDS — refinadas, líneas finas ===== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 28px;
}
.kpi-card {
    background: var(--surface);
    padding: 20px 22px;
    display: flex; flex-direction: column; gap: 6px;
    position: relative;
    transition: var(--t-fast);
    cursor: default;
}
.kpi-card:hover { background: var(--surface-2); }
.kpi-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--cat-territory);
    opacity: 0;
    transition: opacity var(--t-fast);
}
.kpi-card:hover::before { opacity: 1; }
.kpi-card.kpi-blue::before { background: var(--cat-demo); }
.kpi-card.kpi-green::before { background: var(--cat-territory); }
.kpi-card.kpi-orange::before { background: var(--cat-economy); }
.kpi-card.kpi-red::before { background: var(--cat-economy); }
.kpi-card.kpi-purple::before { background: var(--cat-industry); }
.kpi-card.kpi-teal::before { background: var(--cat-tourism); }

.kpi-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.kpi-label-top {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.kpi-icon-sm {
    color: var(--muted);
    font-size: 0.85rem;
    width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border);
    border-radius: 4px;
    flex-shrink: 0;
}
.kpi-blue .kpi-icon-sm { color: var(--cat-demo); border-color: var(--cat-demo); background: rgba(74, 111, 165, 0.06); }
.kpi-green .kpi-icon-sm { color: var(--cat-territory); border-color: var(--cat-territory); background: rgba(45, 106, 79, 0.06); }
.kpi-orange .kpi-icon-sm { color: var(--cat-economy); border-color: var(--cat-economy); background: rgba(161, 126, 26, 0.06); }
.kpi-red .kpi-icon-sm { color: var(--cat-economy); border-color: var(--cat-economy); background: rgba(161, 126, 26, 0.06); }
.kpi-purple .kpi-icon-sm { color: var(--cat-industry); border-color: var(--cat-industry); background: rgba(107, 68, 35, 0.06); }
.kpi-teal .kpi-icon-sm { color: var(--cat-tourism); border-color: var(--cat-tourism); background: rgba(181, 109, 58, 0.06); }

.kpi-value {
    font-family: var(--serif);
    font-size: 2rem;
    font-weight: 500;
    color: var(--ink);
    line-height: 1.05;
    letter-spacing: -0.025em;
    font-variant-numeric: tabular-nums;
}
.kpi-value > span[data-count] { font-family: inherit; }
.kpi-label {
    font-size: 0.78rem;
    color: var(--ink-3);
    margin-top: 2px;
    line-height: 1.4;
}
.kpi-trend {
    font-size: 0.72rem;
    font-family: var(--mono);
    color: var(--muted);
    margin-top: 10px;
    display: flex; align-items: center; gap: 6px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}
.kpi-trend.up { color: var(--ok); }
.kpi-trend i { font-size: 0.66rem; }

/* ===== GENERIC CARDS ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--t-fast);
}
.card-header {
    padding: 16px 22px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px;
}
.card-header h4 {
    font-family: var(--serif);
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--ink);
    letter-spacing: -0.01em;
}
.card-header-meta { display: flex; align-items: center; gap: 10px; font-size: 0.72rem; color: var(--muted); font-family: var(--mono); }
.card-action {
    background: transparent; border: 1px solid transparent;
    color: var(--muted); cursor: pointer;
    width: 28px; height: 28px; border-radius: var(--radius-sm);
    font-size: 0.78rem;
    display: inline-flex; align-items: center; justify-content: center;
    transition: var(--t-fast);
}
.card-action:hover { background: var(--bg-2); color: var(--primary); border-color: var(--border); }
.card-body { padding: 22px; }
.card-body > canvas { max-height: 280px; }

.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 20px; }
.mt-3 { margin-top: 20px; }
.mt-2 { margin-top: 12px; }
.p-0 { padding: 0 !important; }
.w-100 { width: 100%; }

/* ===== GIS PAGE ===== */
.page.gis-page.active { display: flex; flex-direction: column; gap: 14px; }
.gis-toolbar {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    gap: 12px;
}
.gis-layers { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.gis-layers-label {
    font-size: 0.66rem;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding-right: 10px;
    margin-right: 4px;
    border-right: 1px solid var(--border);
    height: 22px;
    display: flex; align-items: center;
}
.layer-toggle {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 0.78rem; font-weight: 500;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--t-fast);
    color: var(--ink-2);
}
.layer-toggle:hover { background: var(--bg-2); }
.layer-toggle input { accent-color: var(--primary); cursor: pointer; margin: 0; }
.layer-toggle input:checked + span { color: var(--ink); font-weight: 600; }

.gis-tools { display: flex; gap: 4px; align-items: center; padding-left: 12px; border-left: 1px solid var(--border); }
.gis-tool-btn {
    width: 32px; height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--ink-2);
    transition: var(--t-fast);
    font-size: 0.78rem;
}
.gis-tool-btn:hover { background: var(--bg-2); color: var(--primary); border-color: var(--border-2); }
.gis-tool-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.gis-legend {
    display: flex; gap: 16px; flex-wrap: wrap; align-items: center;
    padding: 9px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.72rem;
    color: var(--ink-3);
}
.gis-legend-title {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    padding-right: 12px;
    border-right: 1px solid var(--border);
    margin-right: 4px;
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.legend-square { width: 8px; height: 8px; border-radius: 1px; display: inline-block; }

#gisMap, #dashboardMap {
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.gis-info-panel {
    position: fixed; right: 22px; top: 110px; width: 360px; max-height: 75vh;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xl);
    z-index: 500; overflow-y: auto;
    padding: 22px;
    animation: slideInRight 0.28s ease;
}
@keyframes slideInRight { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.gis-info-close {
    position: absolute; top: 14px; right: 14px;
    background: transparent; border: 1px solid var(--border);
    cursor: pointer; font-size: 0.78rem;
    width: 26px; height: 26px; border-radius: var(--radius-sm);
    color: var(--ink-2);
    transition: var(--t-fast);
    display: flex; align-items: center; justify-content: center;
}
.gis-info-close:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.gis-info-panel h4 { font-family: var(--serif); margin-bottom: 14px; padding-right: 32px; color: var(--ink); font-weight: 500; font-size: 1.2rem; }
.gis-info-panel p { font-size: 0.84rem; margin: 6px 0; color: var(--ink-2); line-height: 1.6; }
.gis-info-panel p strong { color: var(--muted); font-weight: 500; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; display: block; margin-bottom: 2px; }

/* ===== PROJECTS ===== */
.page-header-bar {
    display: flex; justify-content: space-between; align-items: flex-end;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap; gap: 16px;
}
.page-header-bar h3 {
    font-family: var(--serif);
    font-size: 1.65rem;
    font-weight: 500;
    letter-spacing: -0.02em;
}
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.project-search { width: 220px; }
.form-control, .form-select {
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.83rem;
    background: var(--surface);
    color: var(--ink);
    transition: var(--t-fast);
    outline: none;
    font-family: inherit;
}
.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%2387847b' d='M5 6 0 0h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}
.form-control:focus, .form-select:focus { border-color: var(--primary-3); box-shadow: 0 0 0 3px var(--primary-soft); }
.form-control::placeholder { color: var(--muted-2); }

.projects-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 24px;
    overflow: hidden;
}
.ps-item {
    background: var(--surface);
    padding: 16px 20px;
    display: flex; flex-direction: column; gap: 4px;
}
.ps-val {
    font-family: var(--serif);
    font-size: 1.65rem;
    font-weight: 500;
    color: var(--ink);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.ps-lbl {
    font-size: 0.7rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}

.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.project-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--t);
    position: relative;
    cursor: pointer;
}
.project-card:hover {
    border-color: var(--border-2);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}
.project-card-header {
    padding: 16px 18px 12px;
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 10px;
}
.project-card-header h5 {
    font-family: var(--serif);
    font-size: 1.02rem;
    font-weight: 500;
    line-height: 1.3;
    color: var(--ink);
    letter-spacing: -0.01em;
}
.project-card-body { padding: 0 18px 18px; }
.project-desc {
    font-size: 0.82rem;
    color: var(--ink-3);
    line-height: 1.5;
    margin-bottom: 14px;
}
.project-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.project-tag {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: var(--radius-xs);
    background: var(--bg-2);
    color: var(--ink-2);
    font-weight: 500;
    display: inline-flex; align-items: center; gap: 5px;
    font-family: var(--sans);
}
.project-tag i { color: var(--muted); font-size: 0.68rem; }
.project-tag .num { font-family: var(--mono); font-feature-settings: 'tnum'; }

.project-progress { display: flex; flex-direction: column; gap: 5px; }
.progress-bar-bg { height: 4px; background: var(--bg-2); border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 4px; transition: width 1s cubic-bezier(0.4, 0, 0.2, 1); background: var(--primary); }
.progress-label {
    display: flex; justify-content: space-between;
    font-size: 0.7rem; color: var(--muted);
    font-weight: 500;
}
.progress-label .cat { text-transform: uppercase; letter-spacing: 0.05em; }
.progress-label .pct { font-family: var(--mono); color: var(--ink-2); font-weight: 600; }

/* Status badges */
.status-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    border: 1px solid transparent;
}
.status-badge::before {
    content: ''; width: 5px; height: 5px; border-radius: 50%;
    background: currentColor; flex-shrink: 0;
}
.status-active { background: var(--ok-soft); color: var(--ok); border-color: rgba(45, 106, 79, 0.2); }
.status-planned { background: var(--warn-soft); color: var(--warn); border-color: rgba(184, 119, 28, 0.2); }
.status-completed { background: var(--info-soft); color: var(--info); border-color: rgba(74, 111, 165, 0.2); }

/* ===== INDICATORS ===== */
.indicators-tabs {
    display: flex; gap: 0;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--border);
}
.ind-tab {
    padding: 12px 22px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.86rem; font-weight: 500;
    color: var(--muted);
    transition: var(--t-fast);
    font-family: inherit;
    position: relative;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.ind-tab:hover { color: var(--ink); }
.ind-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}
.indicators-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}
.indicator-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    transition: var(--t-fast);
    display: flex; flex-direction: column; gap: 12px;
    position: relative;
}
.indicator-card:hover { border-color: var(--border-2); box-shadow: var(--shadow); }
.indicator-card h5 {
    font-family: var(--sans);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0;
}
.indicator-value {
    font-family: var(--serif);
    font-size: 2rem;
    font-weight: 500;
    line-height: 1.05;
    letter-spacing: -0.025em;
    font-variant-numeric: tabular-nums;
}
.indicator-target {
    font-size: 0.74rem;
    color: var(--muted);
    font-family: var(--mono);
}
.indicator-target::before { content: '→ '; color: var(--muted-2); }
.indicator-bar { height: 4px; background: var(--bg-2); border-radius: 4px; overflow: hidden; }
.indicator-bar-fill { height: 100%; border-radius: 4px; transition: width 1.1s cubic-bezier(0.4, 0, 0.2, 1); }
.indicator-progress-label {
    font-size: 0.72rem;
    color: var(--ink-2);
    text-align: right;
    font-weight: 600;
    font-family: var(--mono);
}

/* ===== MODELS ===== */
.models-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(480px, 1fr)); gap: 20px; }
.model-params {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.model-params label {
    display: grid;
    grid-template-columns: 1fr 1fr 64px;
    align-items: center;
    gap: 12px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--ink-2);
}
.model-params input[type="range"] { accent-color: var(--primary); cursor: pointer; height: 2px; }
.model-params span:last-child {
    font-family: var(--mono); font-weight: 600;
    font-size: 0.85rem;
    color: var(--primary);
    background: var(--primary-soft);
    padding: 3px 8px;
    border-radius: var(--radius-xs);
    text-align: center;
}

/* ===== SCENARIOS ===== */
.scenarios-container { display: grid; grid-template-columns: 320px 1fr; gap: 20px; }
.scenario-param { margin-bottom: 18px; }
.scenario-param label {
    display: flex; justify-content: space-between; align-items: baseline;
    font-size: 0.8rem; font-weight: 500; color: var(--ink-2);
    margin-bottom: 6px;
}
.scenario-param input[type="range"] { width: 100%; accent-color: var(--primary); cursor: pointer; }
.scenario-param span {
    font-family: var(--mono); font-weight: 600;
    font-size: 0.85rem;
    color: var(--primary);
}
.scenario-presets {
    display: flex; gap: 6px;
    margin-top: 20px; padding-top: 16px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}
.scenario-presets .preset-label {
    font-size: 0.62rem; font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    width: 100%; margin-bottom: 4px;
}
.scenario-results { display: flex; flex-direction: column; gap: 20px; }
.scenario-results > .card { display: flex; flex-direction: column; }
.scenario-results > .card .card-body { flex: 1; }
.scenario-summary .card-body { font-size: 0.88rem; padding: 8px 22px 16px; }
.scenario-metric {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.86rem;
    color: var(--ink-2);
}
.scenario-metric:last-child { border: none; }
.scenario-metric-val {
    font-family: var(--mono); font-weight: 600;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}
.scenario-metric-val.positive { color: var(--ok); }
.scenario-metric-val.negative { color: var(--danger); }

/* ===== FINANCING ===== */
.financing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 20px; }
.table {
    width: 100%; border-collapse: collapse;
    font-size: 0.85rem;
}
.table th {
    background: var(--surface-2);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border-2);
    color: var(--muted);
    cursor: pointer; user-select: none;
    transition: var(--t-fast);
    white-space: nowrap;
}
.table th:hover { color: var(--primary); background: var(--primary-soft); }
.table th i { opacity: 0.4; font-size: 0.62rem; margin-left: 4px; }
.table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--ink-2);
    vertical-align: middle;
}
.table td:nth-child(3),
.table td:nth-child(4),
.table td:nth-child(5) { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 500; }
.table tbody tr { transition: var(--t-fast); }
.table tbody tr:hover { background: var(--bg-2); }
.table tbody tr:last-child td { border-bottom: none; }

/* ===== PARTNERS ===== */
.partners-search {
    display: flex; gap: 10px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}
.partners-search .form-control { flex: 1; min-width: 240px; padding: 10px 14px; font-size: 0.88rem; }
.partners-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.partner-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: var(--t-fast);
    display: flex; gap: 14px;
    align-items: flex-start;
}
.partner-card:hover { border-color: var(--border-2); box-shadow: var(--shadow); }
.partner-icon {
    font-size: 1.05rem;
    color: var(--primary);
    width: 40px; height: 40px;
    background: var(--primary-soft);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.partner-info { flex: 1; min-width: 0; }
.partner-name {
    font-family: var(--serif);
    font-size: 0.98rem;
    font-weight: 500;
    line-height: 1.3;
    color: var(--ink);
    letter-spacing: -0.005em;
    margin-bottom: 4px;
}
.partner-type {
    display: inline-block;
    font-size: 0.62rem; font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 8px;
}
.partner-desc {
    font-size: 0.8rem;
    color: var(--ink-3);
    line-height: 1.5;
}

/* ===== TRANSPARENCY ===== */
.transparency-kpi {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 22px;
}
.trans-kpi {
    background: var(--surface);
    padding: 22px 24px;
    display: flex; flex-direction: column; gap: 6px;
    text-align: left;
}
.trans-val {
    font-family: var(--serif);
    font-size: 2.4rem;
    font-weight: 500;
    color: var(--ink);
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.trans-label {
    font-size: 0.75rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}

.documents-list { display: flex; flex-direction: column; gap: 6px; }
.doc-item {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--t-fast);
    cursor: pointer;
    background: var(--surface);
}
.doc-item:hover { background: var(--bg-2); border-color: var(--border-2); }
.doc-icon {
    font-size: 1rem;
    color: var(--primary);
    width: 36px; height: 36px;
    background: var(--primary-soft);
    border-radius: var(--radius-xs);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.doc-info { flex: 1; }
.doc-title { font-size: 0.88rem; font-weight: 500; color: var(--ink); }
.doc-date { font-size: 0.72rem; color: var(--muted); margin-top: 2px; font-family: var(--mono); }
.doc-item .ext-icon { color: var(--muted-2); font-size: 0.78rem; }

.exec-bar-item { margin-bottom: 16px; }
.exec-bar-label {
    display: flex; justify-content: space-between;
    font-size: 0.85rem;
    color: var(--ink-2);
    margin-bottom: 6px;
    font-weight: 500;
}
.exec-bar-label span:last-child { font-family: var(--mono); color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.exec-bar-bg { height: 5px; background: var(--bg-2); border-radius: 4px; overflow: hidden; }
.exec-bar-fill {
    height: 100%; border-radius: 4px;
    background: var(--primary);
    transition: width 1.1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== TIMELINE ===== */
.timeline-container {
    position: relative;
    padding-left: 32px;
}
.timeline-container::before {
    content: '';
    position: absolute; left: 8px; top: 12px; bottom: 12px;
    width: 1px;
    background: var(--border-2);
}
.timeline-item {
    position: relative;
    margin-bottom: 18px;
    padding: 22px 26px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: var(--t-fast);
}
.timeline-item:hover { border-color: var(--border-2); box-shadow: var(--shadow); }
.timeline-item::before {
    content: '';
    position: absolute;
    left: -28px; top: 28px;
    width: 11px; height: 11px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--primary);
}
.timeline-item.current::before { background: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.timeline-year {
    font-family: var(--mono);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}
.timeline-phase {
    font-family: var(--serif);
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--ink);
    letter-spacing: -0.015em;
    margin-bottom: 8px;
}
.timeline-desc {
    font-size: 0.88rem;
    color: var(--ink-3);
    line-height: 1.55;
    max-width: 70ch;
}
.timeline-tasks {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 6px 18px;
}
.timeline-task {
    font-size: 0.8rem;
    color: var(--ink-2);
    display: flex; align-items: flex-start; gap: 8px;
    padding: 3px 0;
}
.timeline-task i { color: var(--primary); margin-top: 4px; font-size: 0.6rem; flex-shrink: 0; }

/* ===== TOAST ===== */
.toast-container {
    position: fixed; top: 72px; right: 22px;
    z-index: 2000;
    display: flex; flex-direction: column; gap: 8px;
    pointer-events: none;
}
.toast-item {
    background: var(--surface);
    color: var(--ink);
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    display: flex; align-items: center; gap: 10px;
    min-width: 260px;
    font-size: 0.85rem;
    animation: toastIn 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
}
.toast-item.success { border-left-color: var(--ok); }
.toast-item.warning { border-left-color: var(--warn); }
.toast-item.danger { border-left-color: var(--danger); }
.toast-item.info { border-left-color: var(--info); }
.toast-item i { font-size: 0.95rem; }
.toast-item.success i { color: var(--ok); }
.toast-item.warning i { color: var(--warn); }
.toast-item.danger i { color: var(--danger); }
.toast-item.info i { color: var(--info); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
.toast-item.fadeout { animation: toastOut 0.28s forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

/* ===== BACK TO TOP ===== */
.back-to-top {
    position: fixed; bottom: 24px; right: 24px;
    width: 38px; height: 38px;
    background: var(--surface);
    color: var(--ink-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    box-shadow: var(--shadow);
    opacity: 0; visibility: hidden;
    transform: translateY(8px);
    transition: var(--t);
    z-index: 999;
    font-size: 0.85rem;
}
.back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== BUTTONS ===== */
.btn {
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 500;
    border: 1px solid var(--border-2);
    transition: var(--t-fast);
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--surface);
    color: var(--ink-2);
    font-family: inherit;
}
.btn:hover { background: var(--bg-2); border-color: var(--border-strong); }
.btn-sm { padding: 5px 11px; font-size: 0.78rem; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-ink); border-color: var(--primary-ink); color: #fff; }

.btn-outline-success { background: transparent; border-color: var(--ok); color: var(--ok); }
.btn-outline-success:hover { background: var(--ok); color: #fff; }
.btn-outline-warning { background: transparent; border-color: var(--warn); color: var(--warn); }
.btn-outline-warning:hover { background: var(--warn); color: #fff; }
.btn-outline-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger); color: #fff; }

/* ===== LEAFLET refinement ===== */
.leaflet-popup-content-wrapper {
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--border);
    padding: 2px;
}
.leaflet-popup-tip { background: var(--surface); box-shadow: var(--shadow); }
.leaflet-popup-content { font-size: 0.84rem; margin: 12px 16px; font-family: var(--sans); }
.popup-title {
    font-family: var(--serif); font-weight: 500;
    color: var(--primary);
    margin-bottom: 6px;
    font-size: 1rem;
    letter-spacing: -0.01em;
    line-height: 1.2;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.popup-info {
    font-size: 0.78rem;
    color: var(--ink-2);
    line-height: 1.65;
}
.popup-info span {
    font-family: var(--mono); font-weight: 500;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.leaflet-control-zoom a {
    background: var(--surface) !important;
    color: var(--ink-2) !important;
    border-color: var(--border) !important;
    font-family: var(--sans);
}
.leaflet-control-zoom a:hover {
    background: var(--bg-2) !important;
    color: var(--primary) !important;
}
.leaflet-bar { box-shadow: var(--shadow) !important; border-radius: var(--radius-sm) !important; overflow: hidden; }
.leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.86) !important;
    color: var(--muted) !important;
    font-size: 0.66rem !important;
    padding: 2px 6px !important;
}
.leaflet-control-attribution a { color: var(--ink-2) !important; }
body.dark .leaflet-tile { filter: brightness(0.7) invert(1) contrast(0.9) hue-rotate(200deg) saturate(0.4) brightness(0.85); }
body.dark .leaflet-control-attribution { background: rgba(20, 24, 18, 0.85) !important; color: var(--muted) !important; }

.custom-marker { background: transparent; border: none; }
.project-pin {
    width: 22px; height: 22px;
    border-radius: 50% 50% 50% 0;
    background: var(--primary);
    transform: rotate(-45deg);
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s ease;
}
.project-pin i { transform: rotate(45deg); color: #fff; font-size: 0.7rem; }
.project-pin:hover { transform: rotate(-45deg) scale(1.18); }

.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background: rgba(27, 67, 50, 0.16) !important;
}
.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background: var(--primary) !important;
    color: #fff !important;
    font-family: var(--mono) !important;
    font-weight: 600 !important;
    border: 2px solid #fff !important;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(135, 132, 123, 0.35); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(135, 132, 123, 0.6); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1300px) {
    .dashboard-hero { grid-template-columns: 1fr; gap: 28px; }
    .hero-stat { border-left: none; padding-left: 0; border-top: 1px solid var(--border); padding-top: 24px; }
    .hero-stat-value { font-size: 3.6rem; }
}
@media (max-width: 1100px) {
    .global-search input { width: 160px; }
    .global-search input:focus { width: 220px; }
    .main-content { padding: 24px 22px; }
}
@media (max-width: 992px) {
    :root { --topnav-h: 52px; }
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-xl); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 20px 18px 60px; }
    .nav-left { min-width: 0; border-right: none; padding-right: 0; }
    .scenarios-container { grid-template-columns: 1fr; }
    .dashboard-grid,
    .models-grid,
    .financing-grid { grid-template-columns: 1fr; }
    .nav-center { display: none; }
    .global-search { display: none; }
    .dashboard-hero { padding: 28px 22px; }
    .dashboard-hero h2 { font-size: 1.7rem; }
    .hero-stat-value { font-size: 2.8rem; }
}
@media (max-width: 640px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .projects-grid { grid-template-columns: 1fr; }
    .brand-text { display: none; }
    .nav-lang { display: none; }
    .nav-user { display: none; }
    .gis-info-panel { width: calc(100vw - 32px); right: 16px; }
    .hero-actions { flex-direction: column; align-items: stretch; }
    .btn-hero, .btn-hero-outline { width: 100%; justify-content: center; }
}

/* ===== RTL ===== */
html[dir="rtl"] .sidebar { left: auto; right: 0; border-right: none; border-left: 1px solid var(--border); }
html[dir="rtl"] .main-content { margin-left: 0; margin-right: var(--sidebar-w); }
html[dir="rtl"] .menu-item.active::before { left: auto; right: -12px; border-radius: 2px 0 0 2px; }
html[dir="rtl"] .global-search > i { left: auto; right: 11px; }
html[dir="rtl"] .global-search input { padding: 7px 32px 7px 12px; }
html[dir="rtl"] .timeline-container { padding-left: 0; padding-right: 32px; }
html[dir="rtl"] .timeline-container::before { left: auto; right: 8px; }
html[dir="rtl"] .timeline-item::before { left: auto; right: -28px; }
html[dir="rtl"] .dashboard-hero::before { left: auto; right: 0; }
html[dir="rtl"] .back-to-top { right: auto; left: 24px; }
html[dir="rtl"] .toast-container { right: auto; left: 22px; }
html[dir="rtl"] .nav-left { border-right: none; border-left: 1px solid var(--border); padding-right: 0; padding-left: 18px; margin-right: 0; margin-left: 6px; }
html[dir="rtl"] .nav-user { border-left: none; border-right: 1px solid var(--border); margin-left: 0; margin-right: 6px; }
@media (max-width: 992px) {
    html[dir="rtl"] .main-content { margin-right: 0; }
}
