:root {
    --blue-dark: #0c2b47;
    --blue: #164d70;
    --blue-light: #287fae;
    --blue-soft: #e8f3f9;

    --background: #f6f8fa;
    --white: #ffffff;
    --text: #233142;
    --muted: #627487;
    --border: #dbe5ec;

    --green: #287a6d;
    --amber: #a86e17;
    --orange: #b95d24;
    --wine: #9e3244;

    --shadow: 0 10px 28px rgba(12, 43, 71, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--background);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.6;
}

.container {
    width: min(1160px, calc(100% - 40px));
    margin: 0 auto;
}

/* ==========================================================
   NAVEGACIÓN
   ========================================================== */

.header {
    position: sticky;
    top: 0;
    z-index: 30;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
}

.nav-container {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--blue-dark);
    font-size: 1.1rem;
    font-weight: 700;
    text-decoration: none;
}

.logo-icon {
    font-size: 1.4rem;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 18px;
}

.nav a {
    color: #4b5f70;
    font-size: 0.93rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.nav a:hover {
    color: var(--blue-light);
}

.nav-dashboard {
    padding: 8px 11px;
    border-radius: 7px;
    color: var(--blue-dark) !important;
    background: var(--blue-soft);
}

/* ==========================================================
   HERO
   ========================================================== */

.hero {
    padding: 98px 0;
    color: var(--white);
    background:
        linear-gradient(
            125deg,
            rgba(12, 43, 71, 0.98),
            rgba(22, 77, 112, 0.92)
        ),
        radial-gradient(
            circle at top right,
            rgba(65, 168, 215, 0.85),
            transparent 42%
        );
}

.hero-content {
    max-width: 800px;
}

.eyebrow {
    margin: 0 0 11px;
    color: #bee8fa;
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.eyebrow.dark {
    color: var(--blue-light);
}

.hero h1 {
    max-width: 760px;
    margin: 0;
    font-size: clamp(2.5rem, 5vw, 4.4rem);
    line-height: 1.08;
}

.hero h1 span {
    color: #9cddfa;
}

.hero-description {
    max-width: 710px;
    margin: 24px 0 31px;
    color: #e2f2fa;
    font-size: 1.12rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 13px;
}

.button-primary,
.button-secondary {
    display: inline-block;
    padding: 13px 21px;
    border-radius: 8px;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.2s ease, background 0.2s ease;
}

.button-primary {
    color: var(--blue-dark);
    background: #bce8fa;
}

.button-primary:hover {
    background: #d8f3ff;
    transform: translateY(-2px);
}

.button-secondary {
    border: 1px solid rgba(255, 255, 255, 0.6);
    color: var(--white);
    background: rgba(255, 255, 255, 0.08);
}

.button-secondary:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: translateY(-2px);
}

/* ==========================================================
   SECCIONES GENERALES
   ========================================================== */

.summary-section,
.analysis-section,
.detail-section,
.source-section {
    padding: 76px 0;
}

.section-title {
    max-width: 780px;
    margin-bottom: 28px;
}

.section-title h2,
.source-section h2 {
    margin: 0 0 12px;
    color: var(--blue-dark);
    font-size: clamp(1.85rem, 3vw, 2.45rem);
    line-height: 1.2;
}

.section-title p:last-child {
    margin: 0;
    color: var(--muted);
}

/* ==========================================================
   ESTADO Y MÉTRICAS
   ========================================================== */

.status-box {
    margin-bottom: 25px;
    padding: 14px 18px;
    border-left: 4px solid var(--blue-light);
    border-radius: 8px;
    color: #1e5274;
    background: var(--blue-soft);
    font-size: 0.94rem;
    font-weight: 600;
}

.status-box.error {
    border-left-color: var(--wine);
    color: #7d2232;
    background: #fcecef;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}

.metric-card,
.chart-card,
.small-metric {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--white);
    box-shadow: var(--shadow);
}

.metric-card {
    padding: 23px;
}

.metric-label,
.small-metric p {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 600;
}

.metric-value {
    display: block;
    margin: 7px 0 5px;
    color: var(--blue-dark);
    font-size: 2rem;
    line-height: 1.15;
}

.metric-text {
    font-size: 1.45rem;
}

.metric-note {
    color: var(--green);
    font-size: 0.88rem;
    font-weight: 700;
}

/* ==========================================================
   GRÁFICAS
   ========================================================== */

.analysis-section {
    background: var(--white);
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 22px;
}

.chart-card {
    overflow: hidden;
    padding: 23px;
}

.chart-card::before {
    content: "";
    display: block;
    width: 62px;
    height: 4px;
    margin-bottom: 16px;
    border-radius: 99px;
    background: var(--blue-light);
}

.chart-card-header h3 {
    margin: 0 0 6px;
    color: var(--blue-dark);
    font-size: 1.18rem;
}

.chart-description {
    min-height: 48px;
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 0.92rem;
}

.chart {
    width: 100%;
    min-height: 410px;
}

.reading-guide {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    margin-top: 25px;
    padding: 22px 24px;
    border: 1px solid #d7e7ee;
    border-radius: 14px;
    background: #f4fafc;
}

.reading-guide h3 {
    margin: 0 0 7px;
    color: var(--blue-dark);
    font-size: 1.05rem;
}

.reading-guide p {
    max-width: 710px;
    margin: 0;
    color: #526577;
    font-size: 0.94rem;
}

.risk-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.risk-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border-radius: 999px;
    color: #334155;
    background: var(--white);
    font-size: 0.84rem;
    font-weight: 700;
}

.risk-item i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.risk-item.bajo i {
    background: var(--green);
}

.risk-item.medio i {
    background: var(--amber);
}

.risk-item.alto i {
    background: var(--orange);
}

.risk-item.critico i {
    background: var(--wine);
}

/* ==========================================================
   DETALLE MUNICIPAL
   ========================================================== */

.detail-section {
    background: #eef5f8;
}

.selector-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 23px;
}

.selector-container label {
    color: var(--blue-dark);
    font-weight: 700;
}

.selector-container select {
    min-width: 260px;
    padding: 10px 12px;
    border: 1px solid #b9cbd8;
    border-radius: 8px;
    color: var(--text);
    background: var(--white);
    font-size: 1rem;
}

.detail-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}

.small-metric {
    padding: 20px;
}

.small-metric strong {
    display: block;
    margin-top: 7px;
    color: var(--blue-dark);
    font-size: 1.7rem;
}

/* ==========================================================
   FUENTE
   ========================================================== */

.source-section {
    background: var(--white);
}

.source-grid {
    display: grid;
    grid-template-columns: 1.6fr 0.8fr;
    gap: 45px;
    align-items: start;
}

.source-grid p {
    color: #475569;
}

.source-link {
    display: inline-block;
    margin-top: 10px;
    color: var(--blue-light);
    font-weight: 700;
    text-decoration: none;
}

.source-link:hover {
    text-decoration: underline;
}

.notice-box {
    padding: 23px;
    border: 1px solid #ead087;
    border-radius: 14px;
    background: #fff9e9;
}

.notice-box h3 {
    margin: 0 0 9px;
    color: #725213;
}

.notice-box p {
    margin: 0;
    color: #675a35;
}

/* ==========================================================
   FOOTER
   ========================================================== */

.footer {
    padding: 24px 0;
    color: #c9d8e4;
    background: var(--blue-dark);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    font-size: 0.88rem;
}

.footer p {
    margin: 0;
}

/* ==========================================================
   RESPONSIVE
   ========================================================== */

@media (max-width: 960px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

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

@media (max-width: 760px) {
    .reading-guide {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 620px) {
    .nav-container {
        padding: 15px 0;
        flex-direction: column;
        align-items: flex-start;
    }

    .nav {
        gap: 13px;
    }

    .hero {
        padding: 72px 0;
    }

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

    .selector-container {
        align-items: stretch;
        flex-direction: column;
    }

    .selector-container select {
        width: 100%;
    }

    .footer-content {
        flex-direction: column;
    }
}