/* ──────────────────────────────────────────
   EURIBOR.COM.ES  –  Design System
   ────────────────────────────────────────── */

/* ── Tema oscuro (por defecto) ── */
:root {
    --bg:           #0c1222;
    --surface:      #162032;
    --surface2:     #1e2d45;
    --border:       #2a3f5f;
    --text:         #e8edf5;
    --text-muted:   #8899b4;
    --accent:       #38bdf8;
    --accent-dark:  #0ea5e9;
    --bajada:       #10b981;
    --bajada-leve:  #34d399;
    --estable:      #fbbf24;
    --subida-leve:  #f97316;
    --subida:       #ef4444;
    --radius:       12px;
    --radius-sm:    8px;
    --shadow:       0 4px 24px rgba(0,0,0,.4);
    --transition:   .2s ease;
    --hero-grad2:   #0f1e38;
}

/* ── Tema claro ── */
:root[data-theme="light"] {
    --bg:           #f0f4f8;
    --surface:      #ffffff;
    --surface2:     #e8edf5;
    --border:       #c8d3e1;
    --text:         #0c1222;
    --text-muted:   #5a6b82;
    --accent:       #0284c7;
    --accent-dark:  #0369a1;
    --shadow:       0 4px 24px rgba(0,0,0,.08);
    --hero-grad2:   #dde6f0;
}

/* ── Transición suave al cambiar tema ── */
body, .site-header, .hero, .card, .chart-wrap,
.data-table, .data-table th, .data-table td, .data-table tr,
.site-footer, .btn, .form-control, .alert,
.main-nav, .pagination a, .pagination span, .tab-btn {
    transition: background-color .25s ease, border-color .2s ease, color .15s ease, box-shadow .25s ease !important;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; overflow-x: hidden; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-dark); }

img { max-width: 100%; display: block; }

h1,h2,h3,h4 { line-height: 1.25; font-weight: 700; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.3rem, 3vw, 1.8rem); }
h3 { font-size: 1.2rem; }

/* ── Layout ── */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

.main-content { flex: 1; padding-bottom: 3rem; }

/* ── Header ── */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--text) !important;
    font-weight: 800;
    font-size: 1.25rem;
    white-space: nowrap;
}

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

.main-nav {
    display: flex;
    gap: .25rem;
    align-items: center;
}

.main-nav a {
    color: var(--text-muted);
    padding: .4rem .8rem;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 500;
    transition: all var(--transition);
}

.main-nav a:hover, .main-nav a.active {
    color: var(--accent);
    background: rgba(56,189,248,.08);
}

/* ── Dropdown "Más" ── */
.nav-dropdown {
    position: relative;
}
.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: .3rem;
    color: var(--text-muted);
    padding: .4rem .8rem;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    transition: all var(--transition);
    white-space: nowrap;
}
.nav-dropdown-toggle:hover,
.nav-dropdown.open .nav-dropdown-toggle {
    color: var(--accent);
    background: rgba(56,189,248,.08);
}
.nav-dropdown-toggle svg {
    width: 12px; height: 12px;
    transition: transform .2s;
    flex-shrink: 0;
}
.nav-dropdown.open .nav-dropdown-toggle svg {
    transform: rotate(180deg);
}
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + .35rem);
    right: 0;
    min-width: 190px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
    z-index: 200;
    overflow: hidden;
    flex-direction: column;
}
.nav-dropdown.open .nav-dropdown-menu {
    display: flex;
}
.nav-dropdown-menu a {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .6rem 1rem;
    color: var(--text-muted);
    font-size: .88rem;
    font-weight: 500;
    border-radius: 0;
    transition: all var(--transition);
    border-bottom: 1px solid var(--border);
}
.nav-dropdown-menu a:last-child { border-bottom: none; }
.nav-dropdown-menu a:hover {
    color: var(--accent);
    background: rgba(56,189,248,.06);
}
.nav-dropdown-menu a .nav-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: .4rem;
}
.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
}

/* ── Botón de tema ── */
.theme-toggle {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
    font-size: 1.05rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color var(--transition), background var(--transition);
    line-height: 1;
}
.theme-toggle:hover {
    border-color: var(--accent);
    background: rgba(56,189,248,.1);
}

/* ── Hero ── */
.hero {
    background: linear-gradient(135deg, var(--surface) 0%, var(--hero-grad2) 100%);
    border-bottom: 1px solid var(--border);
    padding: 3rem 0 2.5rem;
    text-align: center;
}

.hero-eyebrow {
    color: var(--accent);
    font-size: .85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .1em;
    margin-bottom: .5rem;
}

.hero h1 { margin-bottom: 1rem; }

.hero-intro {
    color: var(--text-muted);
    font-size: .92rem;
    line-height: 1.6;
    max-width: 640px;
    margin: 0 auto 1rem;
}

/* ── Valor actual del Euríbor (display grande) ── */
.euribor-now {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: var(--surface2);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 3rem;
    margin: 1.5rem auto;
    position: relative;
}

.euribor-now .euribor-value {
    font-size: clamp(3rem, 8vw, 5rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -2px;
}

.euribor-now .euribor-unit {
    font-size: 1rem;
    color: var(--text-muted);
    margin-top: .25rem;
}

.euribor-now .euribor-date {
    font-size: .8rem;
    color: var(--text-muted);
    margin-top: .5rem;
}

/* ── Trend badge ── */
.trend-badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .35rem .9rem;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-top: .75rem;
}

.trend-badge.bajada-fuerte, .trend-badge.bajada  { background: rgba(16,185,129,.15); color: var(--bajada); }
.trend-badge.estable        { background: rgba(251,191,36,.12); color: var(--estable); }
.trend-badge.subida-leve    { background: rgba(249,115,22,.12); color: var(--subida-leve); }
.trend-badge.subida-fuerte, .trend-badge.subida  { background: rgba(239,68,68,.12); color: var(--subida); }

/* ── Tabs (12M / 6M / 3M) ── */
.plazo-tabs {
    display: flex;
    gap: .5rem;
    justify-content: center;
    margin: 1.5rem 0;
}

.plazo-tab {
    padding: .55rem 1.4rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-muted);
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.plazo-tab:hover { border-color: var(--accent); color: var(--accent); }
.plazo-tab.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }

/* ── Media mensual destacada ── */
.media-mensual-card {
    background: var(--surface);
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 2rem;
}
.media-mensual-card .mm-label {
    font-size: .8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: .3rem;
}
.media-mensual-card .mm-value {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--accent);
}
.media-mensual-card .mm-sub {
    font-size: .85rem;
    color: var(--text-muted);
    margin-top: .3rem;
}
.media-mensual-card .mm-provisional {
    display: inline-block;
    background: rgba(251,191,36,.12);
    color: var(--estable);
    font-size: .72rem;
    font-weight: 700;
    padding: .2rem .7rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-top: .5rem;
}

/* ── Cards ── */
.section { padding: 2.5rem 0; }

.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: .6rem;
}

.section-title .icon { font-size: 1.3rem; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    transition: transform var(--transition), border-color var(--transition);
}

.card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.card .card-label {
    font-size: .78rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: .5rem;
}

.card .card-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}

.card .card-sub {
    font-size: .78rem;
    color: var(--text-muted);
    margin-top: .4rem;
}

.card.card-accent { border-color: var(--accent); }
.card.card-green  { border-color: var(--bajada); }
.card.card-red    { border-color: var(--subida); }

/* ── Chart container ── */
.chart-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    position: relative;
}

/* max-height no aplica a #mainChart (usa height 100% en su wrapper) */
.chart-wrap canvas:not(#mainChart) { max-height: 360px; }

/* ── Data table ── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
}

.data-table th {
    background: var(--surface2);
    padding: .75rem 1rem;
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    text-align: left;
}

.data-table td {
    padding: .65rem 1rem;
    font-size: .9rem;
    border-top: 1px solid var(--border);
}

.data-table tr:hover td { background: var(--surface2); }

.data-table .today-row td {
    background: rgba(56,189,248,.06);
}

/* ── Trend indicators ── */
.trend-up   { color: var(--subida); }
.trend-down { color: var(--bajada); }
.trend-flat { color: var(--estable); }

.trend-arrow { font-weight: 700; }

/* ── Revision cards (hipoteca) ── */
.revision-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.revision-card h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--accent);
}

.revision-result {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    text-align: center;
}

.revision-result .rr-label {
    font-size: .75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.revision-result .rr-value {
    font-size: 1.5rem;
    font-weight: 800;
    margin-top: .2rem;
}

/* ── Info box for mortgage holders ── */
.info-hipoteca {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    background: rgba(56,189,248,.06);
    border: 1px solid rgba(56,189,248,.2);
    border-radius: var(--radius-sm);
    padding: .85rem 1.15rem;
    margin-bottom: 1.5rem;
}
.info-hipoteca-icon { font-size: 1.2rem; flex-shrink: 0; line-height: 1.5; }
.info-hipoteca-text { color: var(--text-muted); font-size: .88rem; line-height: 1.55; margin: 0; }
.info-hipoteca-text strong { color: var(--text); }

/* ── Breadcrumb ── */
.breadcrumb {
    padding: 1rem 0 .5rem;
    font-size: .82rem;
    color: var(--text-muted);
    display: flex;
    gap: .4rem;
    align-items: center;
    flex-wrap: wrap;
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { opacity: .5; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .6rem 1.4rem;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    font-family: inherit;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg);
}
.btn-primary:hover { background: var(--accent-dark); color: var(--bg); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* ── Alerts ── */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: .9rem;
}

.alert-success { background: rgba(16,185,129,.12); border-left: 3px solid var(--bajada); color: var(--bajada); }
.alert-error   { background: rgba(239,68,68,.12);  border-left: 3px solid var(--subida); color: var(--subida); }
.alert-info    { background: rgba(56,189,248,.08);  border-left: 3px solid var(--accent); color: var(--accent); }

/* ── Form controls ── */
.form-group { margin-bottom: 1.25rem; }

.form-group label {
    display: block;
    font-size: .88rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: .4rem;
}

.form-control {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .65rem 1rem;
    color: var(--text);
    font-size: .9rem;
    font-family: inherit;
    transition: border-color var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
}

/* ── Two-col grid ── */
.two-col-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

/* ── Footer ── */
.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 3rem 0 1.5rem;
    margin-top: auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.footer-col p, .footer-col li {
    font-size: .88rem;
    color: var(--text-muted);
    margin-top: .6rem;
}

.footer-col h4 {
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-muted);
    margin-bottom: .6rem;
}

.footer-col ul { list-style: none; }
.footer-col ul li { padding: .2rem 0; }

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
    text-align: center;
    font-size: .82rem;
    color: var(--text-muted);
}

/* ── FAQ ── */
.faq-item {
    margin-bottom: .75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.25rem;
}
.faq-item summary {
    cursor: pointer;
    font-weight: 600;
    font-size: .95rem;
}
.faq-item .faq-answer {
    margin: .75rem 0 0;
    color: var(--text-muted);
    line-height: 1.65;
    font-size: .9rem;
}

/* ── Tabs genéricos ── */
.tabs {
    display: flex;
    gap: .25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.tab-btn {
    padding: .6rem 1.1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    margin-bottom: -1px;
}

.tab-btn.active, .tab-btn:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Legend ── */
.legend {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    font-size: .8rem;
    color: var(--text-muted);
    margin-top: .75rem;
}

/* ── Accesibilidad: tamaño de texto ── */
html[data-fontsize="small"]  { font-size: 14px; }
html[data-fontsize="large"]  { font-size: 18px; }

.font-size-controls {
    display: flex;
    align-items: center;
    gap: 1px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px;
    flex-shrink: 0;
}

.font-size-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-family: 'Inter', system-ui, sans-serif;
    font-weight: 700;
    line-height: 1;
    border-radius: 4px;
    transition: background var(--transition), color var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.font-size-btn[data-size="small"]   { font-size: .72rem; width: 24px; height: 28px; }
.font-size-btn[data-size="default"] { font-size: .88rem; width: 28px; height: 28px; }
.font-size-btn[data-size="large"]   { font-size: 1.05rem; width: 28px; height: 28px; }

.font-size-btn:hover  { background: rgba(56,189,248,.12); color: var(--accent); }
.font-size-btn.fs-active { background: rgba(56,189,248,.18); color: var(--accent); }

/* ── Responsive tablet ── */
@media (max-width: 960px) {
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .revision-result { grid-template-columns: 1fr; gap: .75rem; }
}

/* ── Responsive mobile ── */
@media (max-width: 768px) {
    .nav-toggle { display: flex; }

    .main-nav {
        display: none;
        position: fixed;
        top: 65px;
        left: 0;
        right: 0;
        z-index: 200;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        box-shadow: 0 8px 24px rgba(0,0,0,.4);
        flex-direction: column;
        padding: 1rem;
        gap: .25rem;
    }

    .main-nav.open { display: flex; }
    .main-nav a { padding: .65rem 1rem; }

    /* Dropdown en móvil: se muestra inline, sin posición absoluta */
    .nav-dropdown { width: 100%; }
    .nav-dropdown-toggle {
        width: 100%;
        justify-content: space-between;
        padding: .65rem 1rem;
        font-size: .9rem;
    }
    .nav-dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        border-left: 2px solid var(--accent);
        margin-left: 1rem;
        border-radius: 0;
        background: transparent;
    }
    .nav-dropdown.open .nav-dropdown-menu { display: flex; }
    .nav-dropdown-menu a { padding: .5rem 1rem; font-size: .88rem; }

    .two-col-grid { grid-template-columns: 1fr; gap: 1.5rem; }
    .footer-grid { grid-template-columns: 1fr; }
    .euribor-now { padding: 1.25rem 2rem; }
    .data-table { font-size: .82rem; }
    .data-table th, .data-table td { padding: .5rem .6rem; }
    .plazo-tabs { flex-wrap: wrap; }
}

@media (max-width: 480px) {
    .card-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
    .font-size-controls { display: none; }
}

/* ── Selector de plazo tipo dropdown ── */
.plazo-dropdown {
    position: relative;
    display: inline-block;
    margin: 1.5rem 0;
}
.plazo-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1rem;
    font-weight: 600;
    padding: .65rem 1.25rem;
    cursor: pointer;
    font-family: inherit;
    transition: border-color var(--transition), background var(--transition);
    white-space: nowrap;
}
.plazo-dropdown-btn:hover { border-color: var(--accent); }
.plazo-dropdown.open .plazo-dropdown-btn {
    border-color: var(--accent);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}
.plazo-dropdown-arrow {
    font-size: .8rem;
    color: var(--text-muted);
    transition: transform .18s;
    margin-left: .25rem;
}
.plazo-dropdown.open .plazo-dropdown-arrow { transform: rotate(180deg); }
.plazo-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 100%;
    background: var(--surface);
    border: 1px solid var(--accent);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    list-style: none;
    z-index: 50;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.plazo-dropdown.open .plazo-dropdown-menu { display: block; }
.plazo-dropdown-item {
    display: block;
    width: 100%;
    padding: .6rem 1.25rem;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: .92rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
}
.plazo-dropdown-item:hover { background: var(--surface2); color: var(--accent); }
.plazo-dropdown-item.active { color: var(--accent); font-weight: 700; }

/* ── Hero twin: valor hoy + media mensual lado a lado ── */
.hero-twin {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    max-width: 700px;
    margin: 0 auto 0.5rem;
    text-align: left;
}
.hero-twin-card {
    background: var(--surface2);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.8rem 2rem;
    display: flex;
    flex-direction: column;
    gap: .2rem;
    position: relative;
}
.hero-twin-card.media { border-color: var(--accent); }
.twin-label {
    font-size: .7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .1em;
    font-weight: 700;
    margin-bottom: .1rem;
}
.twin-date {
    font-size: .77rem;
    color: var(--text-muted);
    margin-bottom: .2rem;
}
.twin-value {
    font-size: clamp(2.6rem, 6vw, 4.2rem);
    font-weight: 900;
    line-height: 1.05;
    letter-spacing: -2px;
}
.twin-unit {
    font-size: .8rem;
    color: var(--text-muted);
    margin-bottom: .3rem;
}
@media (max-width: 580px) {
    .hero-twin { grid-template-columns: 1fr; }
}

/* ── Predicción cierre mensual ── */
.prediccion-card {
    background: var(--surface);
    border: 1px dashed var(--accent);
    border-radius: var(--radius);
    padding: 1.1rem 1.4rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: .75rem;
}
.prediccion-icon { font-size: 1.6rem; flex-shrink: 0; }
.prediccion-body { flex: 1; }
.prediccion-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    font-weight: 600;
}
.prediccion-value { font-size: 1.5rem; font-weight: 900; color: var(--accent); }
.prediccion-sub { font-size: .8rem; color: var(--text-muted); margin-top: .15rem; }

/* ── Gráfico navegable ── */
.chart-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.chart-nav-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}
.chart-nav-btns { display: flex; gap: .5rem; align-items: center; }
.chart-nav-btn {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    padding: .3rem .7rem;
    font-size: .85rem;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}
.chart-nav-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.chart-nav-btn:disabled { opacity: .35; cursor: default; }

/* ── Filas predichas en tabla de mes ── */
.predicted-row td {
    color: var(--text-muted) !important;
    font-style: italic;
    background: rgba(56,189,248,.03) !important;
}
.predicted-badge {
    display: inline-block;
    font-size: .65rem;
    background: rgba(56,189,248,.12);
    color: var(--accent);
    border-radius: 4px;
    padding: .1rem .35rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    vertical-align: middle;
    margin-left: .3rem;
}

/* ── Página de día individual ── */
.dia-hero {
    background: linear-gradient(135deg, var(--surface) 0%, var(--hero-grad2) 100%);
    border-bottom: 1px solid var(--border);
    padding: 2.5rem 0 2rem;
}
.dia-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
}
.dia-nav-center { text-align: center; flex: 1; }

/* ── Introducción del mes ── */
.mes-intro {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    padding: 1.5rem 1.75rem;
    margin-bottom: 2rem;
}
.mes-intro-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: .9rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.mes-intro-body {
    font-size: .92rem;
    line-height: 1.75;
    color: var(--text-muted);
}
.mes-intro-body p { margin: 0; }
.mes-intro-body p + p { margin-top: .75rem; }
.mes-intro-body strong { color: var(--text); font-weight: 700; }
.mes-intro-body a { color: var(--accent); font-weight: 600; }

/* ── Texto SEO de la página de día ── */
.dia-seo-text {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    padding: 1.5rem 1.75rem;
    margin-bottom: 2rem;
}
.dia-seo-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: .9rem;
}
.dia-seo-body {
    font-size: .92rem;
    line-height: 1.75;
    color: var(--text-muted);
}
.dia-seo-body p { margin: 0; }
.dia-seo-body p + p { margin-top: .75rem; }
.dia-seo-body strong { color: var(--text); font-weight: 700; }
.dia-seo-body a { color: var(--accent); font-weight: 600; }

/* ── Canvas navChart altura mínima ── */
#navChart { min-height: 280px; }

/* ── Gráfico principal unificado ── */
/* Chart.js con maintainAspectRatio:false necesita altura en el CONTENEDOR,
   no min-height en el canvas. La altura la ponemos en .chart-wrap#mainWrap */
#mainWrap { height: 380px; }
@media (max-width: 600px) { #mainWrap { height: 260px; } }
#mainChart { width: 100% !important; height: 100% !important; }

.main-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0;
}

.main-chart-tabs {
    display: flex;
    gap: .35rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .25rem;
}

.main-chart-tab-btn {
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    font-size: .82rem;
    font-weight: 600;
    padding: .4rem .9rem;
    transition: background .15s, color .15s;
    white-space: nowrap;
}

.main-chart-tab-btn:hover {
    background: var(--surface);
    color: var(--text);
}

.main-chart-tab-btn.active {
    background: var(--accent);
    color: #fff;
}

/* ── Pills de periodo del gráfico ── */
.chart-period-pills {
    display: flex;
    gap: .3rem;
    flex-wrap: wrap;
    margin-top: .65rem;
}
.period-pill {
    padding: .22rem .65rem;
    border-radius: 99px;
    border: 1px solid var(--border);
    background: none;
    color: var(--text-muted);
    font-size: .76rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    white-space: nowrap;
}
.period-pill:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.period-pill.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

@media (max-width: 600px) {
    .main-chart-header { flex-direction: column; align-items: flex-start; }
    .main-chart-tab-btn { font-size: .76rem; padding: .35rem .65rem; }
}

/* ── Texto introductorio homepage ── */
.intro-texto {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    margin-top: 1.5rem;
    font-size: .92rem;
    line-height: 1.65;
    color: var(--text-muted);
}
.intro-texto p { margin: 0 0 .5rem; }
.intro-texto p:last-of-type { margin-bottom: 0; }
.intro-texto strong { color: var(--text); }
.intro-texto-link {
    display: inline-block;
    margin-top: .5rem;
    font-size: .82rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}
.intro-texto-link:hover { text-decoration: underline; }

/* ── Estadísticas históricas ── */
.hist-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.hist-stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .9rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .2rem;
}
.hist-stat-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
}
.hist-stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.15;
}
.hist-stat-sub {
    font-size: .76rem;
    color: var(--text-muted);
}
.hist-stats-texto {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    font-size: .91rem;
    line-height: 1.7;
    color: var(--text-muted);
}
.hist-stats-texto p { margin: 0 0 .6rem; }
.hist-stats-texto p:last-child { margin-bottom: 0; }
.hist-stats-texto strong { color: var(--text); }

/* ── Paginación histórico ── */
.historico-pag-wrap { margin-bottom: .75rem; }
.historico-pag-inner {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    align-items: center;
}
.historico-pag-btn {
    padding: .35rem .75rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: var(--radius-sm);
    font-size: .82rem;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    white-space: nowrap;
}
.historico-pag-btn:hover:not(.disabled) { background: var(--surface-alt, var(--border)); }
.historico-pag-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: 600;
}
.historico-pag-btn.disabled {
    opacity: .4;
    cursor: not-allowed;
}
.historico-pag-num { min-width: 5.5rem; text-align: center; }

/* ── Previsión Euríbor ── */
.forecast-disclaimer {
    background: color-mix(in srgb, #f59e0b 8%, var(--surface));
    border: 1px solid color-mix(in srgb, #f59e0b 35%, var(--border));
    border-left: 3px solid #f59e0b;
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    font-size: .88rem;
    line-height: 1.6;
    color: var(--text-muted);
}
.forecast-disclaimer strong { color: var(--text); }

.forecast-summary-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 1.25rem 0;
}
.forecast-card {
    flex: 1 1 160px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .9rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: .25rem;
}
.forecast-card-accent {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}
.forecast-card-label {
    font-size: .75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.forecast-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
}
.forecast-card-sub {
    font-size: .78rem;
    color: var(--text-muted);
}
.forecast-badge {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 99px;
    font-size: .72rem;
    font-weight: 600;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.forecast-badge-accent {
    background: color-mix(in srgb, var(--accent) 12%, var(--surface));
    border-color: var(--accent);
    color: var(--accent);
}

/* ── Bloque de anuncio AdSense ── */
.adsense-block {
    margin: 1.5rem 0;
    text-align: center;
    overflow: hidden;
}

/* Banner horizontal debajo del menú */
.adsense-header-banner {
    margin: 0;
    padding: .4rem 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    text-align: center;
    overflow: hidden;
}
.adsense-header-banner:empty { display: none; }

/* ── Resumen / análisis IA ── */
.ai-resumen {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 1.1rem 1.25rem;
    margin-top: 1.25rem;
}
.ai-resumen-header {
    margin-bottom: .6rem;
}
.ai-badge {
    display: inline-block;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--accent);
    background: rgba(2, 132, 199, 0.1);
    border: 1px solid rgba(2, 132, 199, 0.3);
    border-radius: 99px;
    padding: .2rem .65rem;
}
.ai-resumen-texto {
    font-size: .91rem;
    line-height: 1.75;
    color: var(--text-muted);
}
.ai-resumen-texto p { margin: 0 0 .65rem; }
.ai-resumen-texto p:last-child { margin-bottom: 0; }
.ai-resumen-texto strong { color: var(--text); }
