:root {
    --color-bg: #f4f6fb;
    --color-surface: #ffffff;
    --color-surface-alt: #f8fafc;
    --color-border: #e3e8ef;
    --color-border-strong: #cbd5e1;
    --color-text: #0f172a;
    --color-text-soft: #475569;
    --color-text-mute: #94a3b8;
    --color-accent: #2563eb;
    --color-accent-soft: #dbeafe;
    --color-celeste: #74acdf;
    --color-celeste-dark: #4a90c2;
    --color-sun: #f6b40e;
    --color-success: #16a34a;
    --color-danger: #dc2626;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.06);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Menlo', monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== Header ===== */
.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    padding-bottom: 20px;
    gap: 24px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}

.brand-stripe {
    flex: 1;
    display: block;
}

.brand-stripe--top, .brand-stripe--bot {
    background: var(--color-celeste);
}

.brand-stripe--mid {
    background: #fff;
    position: relative;
}

.brand-stripe--mid::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-sun);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.brand-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--color-text);
}

.brand-subtitle {
    margin: 2px 0 0;
    font-size: 0.8rem;
    color: var(--color-text-mute);
    font-weight: 500;
}

.header-meta {
    display: flex;
    gap: 28px;
    align-items: center;
}

.meta-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.meta-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-mute);
    font-weight: 600;
}

.meta-value {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text);
}

.meta-value--accent {
    color: var(--color-accent);
}

/* ===== Section Nav ===== */
.section-nav {
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
}

.nav-inner {
    display: flex;
    gap: 4px;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--color-text-soft);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.nav-tab:hover {
    color: var(--color-text);
    background: var(--color-surface-alt);
}

.nav-tab.is-active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
}

.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--color-surface-alt);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-text-soft);
}

.nav-tab.is-active .nav-icon {
    background: var(--color-accent-soft);
    color: var(--color-accent);
}

/* ===== Main / Sections ===== */
.main-content {
    flex: 1;
    padding-top: 32px;
    padding-bottom: 56px;
}

.dash-section {
    animation: fade-in 0.25s ease;
}

.dash-section[hidden] {
    display: none;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 24px;
    gap: 24px;
    flex-wrap: wrap;
}

.section-title {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-text);
}

.section-desc {
    margin: 6px 0 0;
    color: var(--color-text-soft);
    font-size: 0.95rem;
}

.section-badge {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text-soft);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.section-title-sub {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text-mute);
    letter-spacing: 0;
    margin-left: 2px;
}

.section-empty {
    background: var(--color-surface);
    border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius-lg);
    padding: 40px 24px;
    text-align: center;
    color: var(--color-text-soft);
    font-size: 0.95rem;
}

.section-empty p {
    margin: 0;
    max-width: 540px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== Panel de síntesis matusiana (Gestión) ===== */
.synthesis-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 32px;
    box-shadow: var(--shadow-sm);
}

.synthesis-header {
    margin-bottom: 20px;
}

.synthesis-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.01em;
}

.synthesis-subtitle {
    margin: 6px 0 0;
    color: var(--color-text-soft);
    font-size: 0.88rem;
    line-height: 1.45;
}

.belt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.belt-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
    background: var(--color-surface-alt);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.belt-card[data-state="ok"]      { border-left: 4px solid var(--color-success); }
.belt-card[data-state="warn"]    { border-left: 4px solid var(--color-sun); }
.belt-card[data-state="alert"]   { border-left: 4px solid var(--color-danger); }
.belt-card[data-state="pending"] { border-left: 4px solid var(--color-border-strong); }

.belt-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.belt-card-title {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.01em;
}

.belt-card-sub {
    display: block;
    margin-top: 2px;
    font-size: 0.72rem;
    color: var(--color-text-mute);
    font-weight: 500;
}

.belt-card-state {
    flex: 0 0 auto;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 10px;
    border-radius: 999px;
    line-height: 1.4;
}

.belt-card-state--ok      { color: var(--color-success); background: rgba(22, 163, 74, 0.12); }
.belt-card-state--warn    { color: #b45309; background: rgba(245, 158, 11, 0.16); }
.belt-card-state--alert   { color: var(--color-danger); background: rgba(220, 38, 38, 0.12); }
.belt-card-state--pending { color: var(--color-text-mute); background: var(--color-surface); }

.belt-card-score {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.belt-card-score-value {
    font-family: var(--font-mono);
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.02em;
}

.belt-card-score-unit {
    font-size: 0.78rem;
    color: var(--color-text-mute);
    font-weight: 600;
}

.belt-card-bars {
    display: flex;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
}

.belt-card-bar { display: block; }
.belt-card-bar--pos { background: var(--color-success); }
.belt-card-bar--neu { background: var(--color-text-mute); }
.belt-card-bar--neg { background: var(--color-danger); }
.belt-card-bar--pen { background: var(--color-border-strong); }

.belt-card-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.74rem;
    color: var(--color-text-soft);
}

.belt-card-legend strong {
    color: var(--color-text);
    font-weight: 700;
    margin-right: 2px;
}

.belt-card-legend-total {
    margin-left: auto;
    color: var(--color-text-mute);
}

/* ===== Alerta de gobernabilidad ===== */
.alert-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.alert-card[data-level="green"]  { border-color: rgba(22, 163, 74, 0.35);  background: rgba(22, 163, 74, 0.06); }
.alert-card[data-level="yellow"] { border-color: rgba(245, 158, 11, 0.35); background: rgba(245, 158, 11, 0.08); }
.alert-card[data-level="red"]    { border-color: rgba(220, 38, 38, 0.35);  background: rgba(220, 38, 38, 0.06); }

.alert-card-icon {
    font-size: 1.2rem;
    line-height: 1;
    margin-top: 2px;
}

.alert-card[data-level="green"]  .alert-card-icon { color: var(--color-success); }
.alert-card[data-level="yellow"] .alert-card-icon { color: #b45309; }
.alert-card[data-level="red"]    .alert-card-icon { color: var(--color-danger); }

.alert-card-body { flex: 1; }

.alert-card-title {
    margin: 0 0 4px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.01em;
}

.alert-card-desc {
    margin: 0;
    font-size: 0.85rem;
    color: var(--color-text-soft);
    line-height: 1.5;
}

/* ===== Sub-sección operativos del cinturón CIGOB ===== */
.subsection-head {
    margin-bottom: 16px;
}

.subsection-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.01em;
}

.subsection-desc {
    margin: 4px 0 0;
    font-size: 0.88rem;
    color: var(--color-text-soft);
}

/* ===== Nota metodológica ===== */
.methodology-note {
    margin-top: 32px;
    padding: 24px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    border-left: 4px solid var(--color-celeste);
}

.methodology-title {
    margin: 0 0 10px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.methodology-note p {
    margin: 0 0 10px;
    color: var(--color-text-soft);
    font-size: 0.92rem;
    line-height: 1.6;
}

.methodology-note p:last-child {
    margin-bottom: 0;
}

.methodology-note strong {
    color: var(--color-text);
    font-weight: 700;
}

.methodology-aside {
    margin-top: 12px !important;
    padding-top: 12px;
    border-top: 1px dashed var(--color-border);
    font-size: 0.85rem !important;
    color: var(--color-text-mute) !important;
    font-style: italic;
}

/* ===== Páginas internas (autores, metodología, legales) ===== */
.brand--link {
    text-decoration: none;
    color: inherit;
}

.back-link {
    color: var(--color-text-soft);
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: background 0.15s, color 0.15s;
}

.back-link:hover,
.back-link:focus-visible {
    background: var(--color-surface-alt);
    color: var(--color-accent);
    outline: none;
}

.page-article {
    max-width: 760px;
    margin: 0 auto;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 40px 48px;
    box-shadow: var(--shadow-sm);
}

.page-article-head {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--color-border);
}

.page-eyebrow {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-accent);
    font-weight: 700;
    margin-bottom: 8px;
}

.page-title {
    margin: 0 0 12px;
    font-size: 2rem;
    font-weight: 800;
    color: var(--color-text);
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.page-lead {
    margin: 0;
    font-size: 1.02rem;
    line-height: 1.55;
    color: var(--color-text-soft);
}

.page-section {
    margin-top: 28px;
}

.page-section:first-of-type {
    margin-top: 0;
}

.page-section-title {
    margin: 0 0 12px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.01em;
}

.page-section p {
    margin: 0 0 12px;
    color: var(--color-text);
    font-size: 0.95rem;
    line-height: 1.65;
}

.page-section p:last-child { margin-bottom: 0; }

.page-section a {
    color: var(--color-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.page-section a:hover { text-decoration: none; }

.page-section code {
    font-family: var(--font-mono);
    font-size: 0.86em;
    background: var(--color-surface-alt);
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid var(--color-border);
}

.page-note {
    margin-top: 12px !important;
    font-size: 0.85rem !important;
    color: var(--color-text-mute) !important;
    font-style: italic;
}

.feature-list,
.numbered-list {
    margin: 0 0 12px;
    padding-left: 22px;
    color: var(--color-text);
    font-size: 0.95rem;
    line-height: 1.65;
}

.feature-list li,
.numbered-list li {
    margin-bottom: 6px;
}

.numbered-list { padding-left: 26px; }

/* Equipo */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin: 16px 0 12px;
}

.team-card {
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
}

.team-card-name {
    margin: 0 0 4px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.01em;
}

.team-card-role {
    margin: 0 0 8px !important;
    font-size: 0.78rem !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-accent) !important;
    font-weight: 600;
    line-height: 1.3 !important;
}

.team-card-bio {
    margin: 0 !important;
    font-size: 0.88rem !important;
    color: var(--color-text-soft) !important;
    line-height: 1.5 !important;
}

.contact-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.95rem;
}

.contact-list li {
    color: var(--color-text);
}

.contact-list strong {
    display: inline-block;
    min-width: 100px;
    color: var(--color-text-soft);
    font-weight: 600;
}

/* Cinturones explicados (metodología) */
.belt-explainer {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin: 16px 0;
}

.belt-explainer-card {
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-accent);
    border-radius: var(--radius-md);
    padding: 16px;
}

.belt-explainer-title {
    margin: 0 0 8px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.belt-tag {
    display: inline-block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--color-accent-soft);
    color: var(--color-accent);
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 700;
    line-height: 1.4;
}

.belt-explainer-card p {
    margin: 0 !important;
    font-size: 0.88rem !important;
    color: var(--color-text-soft) !important;
    line-height: 1.55 !important;
}

/* Status pills (en metodología) */
.status-list {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--color-text);
}

.status-pill {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 10px;
    border-radius: 999px;
    margin-right: 8px;
    line-height: 1.4;
    vertical-align: middle;
}

.status-pill--live  { color: var(--color-success); background: rgba(22, 163, 74, 0.10); }
.status-pill--cache { color: var(--color-text-soft); background: var(--color-surface-alt); }
.status-pill--est   { color: #b45309; background: rgba(245, 158, 11, 0.14); }
.status-pill--err   { color: var(--color-danger); background: rgba(220, 38, 38, 0.10); }

/* Header con back-link */
.site-header .header-inner {
    align-items: center;
}

@media (max-width: 720px) {
    .page-article {
        padding: 28px 22px;
    }
    .page-title { font-size: 1.5rem; }
}

/* ===== Widgets Grid ===== */
.widgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.widget {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    min-height: 200px;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s;
}

.widget:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.widget--placeholder {
    border-style: dashed;
    border-color: var(--color-border-strong);
    background: repeating-linear-gradient(
        45deg,
        var(--color-surface),
        var(--color-surface) 10px,
        var(--color-surface-alt) 10px,
        var(--color-surface-alt) 20px
    );
}

.widget-placeholder {
    height: 100%;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-mute);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ===== Widget content ===== */
.widget--indicator {
    display: flex;
    flex-direction: column;
    padding: 18px 20px 20px;
    gap: 14px;
}

.widget-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.widget-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.widget-subtitle {
    display: block;
    margin-top: 4px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-mute);
    font-weight: 600;
}

.widget-head-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.widget-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.4;
}

.widget-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.widget-status--live      { color: var(--color-success); background: rgba(22, 163, 74, 0.10); }
.widget-status--cache     { color: var(--color-text-soft); background: var(--color-surface-alt); }
.widget-status--loading   { color: var(--color-text-mute); background: var(--color-surface-alt); }
.widget-status--error     { color: var(--color-danger); background: rgba(220, 38, 38, 0.10); }
.widget-status--estimated { color: #b45309; background: rgba(245, 158, 11, 0.14); }

.widget-status--loading::before {
    animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; }
    50%      { opacity: 1; }
}

.trend-empty {
    color: var(--color-text-mute);
    font-size: 0.82rem;
    padding: 6px 0;
    font-style: italic;
}

.widget-info {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid var(--color-border-strong);
    background: var(--color-surface-alt);
    color: var(--color-text-soft);
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 700;
    font-style: italic;
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.widget-info:hover,
.widget-info:focus-visible {
    background: var(--color-accent-soft);
    color: var(--color-accent);
    border-color: var(--color-accent);
    outline: none;
}

.widget-value-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.widget-value {
    font-family: var(--font-mono);
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.02em;
    line-height: 1;
}

.widget-value-unit {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-soft);
}

.widget-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.widget-tag--positive {
    background: rgba(22, 163, 74, 0.12);
    color: var(--color-success);
}

.widget-tag--negative {
    background: rgba(220, 38, 38, 0.12);
    color: var(--color-danger);
}

.widget-tag--neutral {
    background: var(--color-surface-alt);
    color: var(--color-text-soft);
}

.widget-period {
    font-size: 0.78rem;
    color: var(--color-text-mute);
    font-weight: 500;
}

.widget-trend {
    border-top: 1px dashed var(--color-border);
    padding-top: 12px;
    margin-top: 2px;
}

.trend-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-mute);
    font-weight: 600;
    margin-bottom: 8px;
}

.trend-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.trend-row {
    display: grid;
    grid-template-columns: 50px 1fr auto;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
}

.trend-period {
    font-family: var(--font-mono);
    color: var(--color-text-soft);
    font-weight: 500;
}

.trend-bar {
    position: relative;
    height: 6px;
    background: var(--color-surface-alt);
    border-radius: 3px;
    overflow: hidden;
}

.trend-bar-fill {
    position: absolute;
    top: 0;
    bottom: 0;
    background: var(--color-accent);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.trend-bar-fill--positive { background: var(--color-success); }
.trend-bar-fill--negative { background: var(--color-danger); }

.trend-value {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--color-text);
    text-align: right;
    font-size: 0.78rem;
}

.widget-secondary {
    display: flex;
    gap: 16px;
    padding: 8px 12px;
    background: var(--color-surface-alt);
    border-radius: var(--radius-sm);
    flex-wrap: wrap;
}

.widget-secondary-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 auto;
    min-width: 90px;
}

.widget-secondary-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-mute);
    font-weight: 600;
}

.widget-secondary-value {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
}

/* ===== Modal ===== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fade-in 0.18s ease;
}

.modal[hidden] {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
}

.modal-panel {
    position: relative;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--color-border);
}

.modal-eyebrow {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-accent);
    font-weight: 700;
    margin-bottom: 4px;
}

.modal-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.01em;
}

.modal-close {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--color-surface-alt);
    color: var(--color-text-soft);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.modal-close:hover,
.modal-close:focus-visible {
    background: var(--color-border);
    color: var(--color-text);
    outline: none;
}

.modal-body {
    padding: 8px 24px 24px;
    overflow-y: auto;
}

.modal-section {
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}

.modal-section:last-child {
    border-bottom: none;
}

.modal-section-title {
    margin: 0 0 6px;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-mute);
    font-weight: 700;
}

.modal-section p {
    margin: 0;
    color: var(--color-text);
    font-size: 0.9rem;
    line-height: 1.55;
}

.modal-source-list {
    margin: 0;
    padding-left: 18px;
    color: var(--color-text);
    font-size: 0.88rem;
    line-height: 1.55;
}

.modal-source-list li + li {
    margin-top: 4px;
}

body.modal-open {
    overflow: hidden;
}

/* ===== Footer ===== */
.site-footer {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 24px 0;
    margin-top: auto;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-credit {
    margin: 0;
    color: var(--color-text-mute);
    font-size: 0.85rem;
}

.footer-links {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--color-text-soft);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: color 0.15s;
}

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

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-meta {
        gap: 20px;
        flex-wrap: wrap;
    }

    .nav-inner {
        overflow-x: auto;
    }

    .nav-tab {
        white-space: nowrap;
    }

    .section-title {
        font-size: 1.4rem;
    }
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
