/* =============================================================================
   App · Estilos comunes (sidebar, layout, responsive)
   ============================================================================= */

/* ── Design tokens ── */
:root {
    /* Marca */
    --brand: #e94560;
    --brand-hover: #ff1f47;
    --brand-dark: #d63351;

    /* Fondos */
    --bg: #1e3a8a;
    --bg-deep: #162d6e;
    --bg-darker: #0f2150;
    --bg-section: #1c3278;

    /* Superficies */
    --surface: #2952a3;
    --surface-raised: #234890;
    --surface-input: #1a3580;

    /* Bordes */
    --border: #3b6bc7;
    --border-strong: #4d7cc7;
    --border-hover: #6a96d6;

    /* Texto */
    --text: #ffffff;
    --text-muted: #93bbfd;
    --text-subtle: #b4cdef;
    --text-soft: #c0c8dc;
    --text-faint: #8aabd8;

    /* Estado */
    --success: #22c55e;
    --warning: #eab308;
    --danger: #dc2626;
    --info: #3b82f6;

    /* IA */
    --ai: #6d28d9;

    /* Radios */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-pill: 999px;

    /* Sombras */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.25);
    --shadow-md: 0 6px 18px rgba(0,0,0,0.35);
    --shadow-lg: 0 10px 30px rgba(28,50,120,0.25);
    --shadow-brand: 0 4px 15px rgba(233,69,96,0.35);

    /* Transiciones */
    --t-fast: 0.15s;
    --t-base: 0.2s;
    --t-slow: 0.3s;
}

* { box-sizing: border-box; }
body {
    background: var(--bg);
    color: var(--text);
    margin: 0;
    font-family: "Segoe UI", system-ui, sans-serif;
}

/* ── Sidebar ── */
.sidebar {
    position: fixed; top: 0; left: 0; width: 220px;
    height: 100vh; height: 100dvh;
    background: var(--bg-deep); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; z-index: 100;
    transition: transform var(--t-slow) cubic-bezier(0.32, 0.72, 0, 1);
    overscroll-behavior: contain;
}
.sidebar-nav { overflow-y: auto; }
.sidebar-brand {
    padding: 1.4rem 1.2rem; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 0.6rem;
}
.sidebar-brand-icon {
    width: 32px; height: 32px; border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.85rem; color: var(--text);
}
.sidebar-brand-text { font-size: 0.95rem; font-weight: 700; color: var(--text); }
.sidebar-nav { flex: 1; padding: 1rem 0.8rem; display: flex; flex-direction: column; gap: 0.3rem; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 0.7rem;
    color: var(--text-muted); text-decoration: none; padding: 0.6rem 0.9rem;
    border-radius: var(--radius-md); font-size: 0.85rem; font-weight: 600;
    transition: all var(--t-fast);
}
.sidebar-nav a:hover { color: var(--text); background: var(--surface-raised); }
.sidebar-nav a.active { color: var(--text); background: rgba(233,69,96,0.25); }
.sidebar-nav a.active .sidebar-icon { color: var(--brand); opacity: 1; }
.sidebar-icon { width: 18px; height: 18px; opacity: 0.7; flex-shrink: 0; }
.sidebar-divider {
    border: 0; height: 1px;
    background: var(--border);
    margin: 0.6rem 0.4rem;
}

/* ── About modal · diseño plano y elegante ── */
.about-modal {
    display: none; position: fixed; inset: 0; z-index: 400;
    align-items: center; justify-content: center;
    padding: 1rem;
    --about-accent: #1c3278;
    --about-accent-hover: #162d6e;
    --about-text: #1c2434;
    --about-muted: #6b7280;
    --about-line: #e5e7eb;
    --about-bg: #ffffff;
    --about-bg-soft: #f7f8fa;
}
.about-modal.open {
    display: flex;
    animation: aboutFadeIn 0.2s ease-out;
}
@keyframes aboutFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes aboutPopIn {
    from { opacity: 0; transform: translateY(6px) scale(0.99); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.about-modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(15,23,42,0.45);
    cursor: not-allowed;
}
body.about-modal-open { overflow: hidden; }
.about-modal-box {
    position: relative; z-index: 1;
    width: min(460px, 100%);
    background: var(--about-bg);
    border: 1px solid var(--about-line);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(15,23,42,0.18);
    color: var(--about-text);
    max-height: 90vh; overflow: hidden;
    animation: aboutPopIn 0.25s ease-out;
    outline: none;
}
.about-modal-header {
    display: flex; align-items: center; gap: 0.9rem;
    padding: 1.5rem 1.5rem 1.2rem;
    border-top: 6px solid var(--about-accent);
    border-bottom: 1px solid var(--about-line);
}
.about-modal-icon {
    width: 44px; height: 44px; border-radius: 10px;
    background: var(--brand);
    display: flex; align-items: center; justify-content: center;
    font: 700 0.95rem inherit; letter-spacing: 0.02em;
    color: #fff; flex-shrink: 0;
}
.about-modal-title {
    margin: 0; font-size: 1.1rem; font-weight: 700;
    color: var(--about-text); letter-spacing: -0.01em;
}
.about-modal-sub { margin: 0.2rem 0 0; font-size: 0.8rem; color: var(--about-muted); }
.about-modal-body {
    padding: 1.2rem 1.5rem 0.4rem;
    font-size: 0.88rem; line-height: 1.6; color: #4b5563;
    overflow-y: auto;
}
.about-modal-body p { margin: 0 0 1rem; }
.about-modal-list { margin: 0 0 1rem; padding: 0; list-style: none; }
.about-modal-list li {
    padding: 0.55rem 0.8rem;
    background: var(--about-bg-soft);
    border: 1px solid var(--about-line);
    border-radius: 8px;
    margin-bottom: 0.35rem;
    font-size: 0.84rem; color: #4b5563;
}
.about-modal-list strong { color: var(--about-text); font-weight: 600; margin-right: 0.2rem; }
.about-modal-meta {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem;
    margin: 1rem 0 0.4rem;
}
.about-modal-meta > div {
    padding: 0.65rem 0.85rem;
    background: var(--about-bg-soft);
    border: 1px solid var(--about-line);
    border-radius: 8px;
    display: flex; flex-direction: column; gap: 0.2rem;
}
.about-meta-label {
    font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--about-muted); font-weight: 600;
}
.about-meta-value { font-size: 0.9rem; color: var(--about-text); font-weight: 700; }
.about-modal-footer {
    padding: 1rem 1.5rem 1.2rem;
    display: flex; justify-content: flex-end;
    border-top: 1px solid var(--about-line);
    background: var(--about-bg-soft);
}
.about-modal-btn {
    padding: 0.55rem 1.4rem; border: none; cursor: pointer;
    background: var(--about-accent);
    color: #fff; font: 600 0.88rem inherit;
    border-radius: 8px;
    transition: background var(--t-fast), transform var(--t-fast);
}
.about-modal-btn:hover { background: var(--about-accent-hover); transform: translateY(-1px); }
.about-modal-btn:active { transform: translateY(0); }
.about-modal-btn:focus-visible { outline: 2px solid var(--about-accent); outline-offset: 2px; }
.sidebar-footer {
    padding: 1rem 1.2rem 2.5rem;
    display: flex; align-items: center; justify-content: center;
}

/* FAB de instalación: solo móvil. Vive fuera de la sidebar para que sea visible aunque el menú esté cerrado. */
.pwa-install-fab {
    position: fixed; top: calc(0.6rem + env(safe-area-inset-top, 0px));
    right: calc(0.6rem + env(safe-area-inset-right, 0px));
    z-index: 110;
    width: 112px; height: 112px; border: none; cursor: pointer;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: var(--text); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 10px 28px rgba(233,69,96,0.55);
    transition: transform var(--t-fast);
}
.pwa-install-fab svg { width: 52px; height: 52px; }
.pwa-install-fab:active { transform: scale(0.94); }

/* FAB solo en móvil. En desktop no hay botón de instalación. */
@media (min-width: 861px) {
    .pwa-install-fab { display: none !important; }
}
.sidebar-footer-logo {
    max-width: 100%; height: auto; max-height: 90px;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.92);
    padding: 0.4rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

/* ── Layout ── */
.main-content { margin-left: 220px; padding: 2rem 2rem; }
.tdt-page-container { max-width: 1000px; margin: 0 auto; }

/* ── Hamburger (solo móvil) ── */
.sidebar-toggle {
    display: none; position: fixed; top: 0.7rem; left: 0.7rem; z-index: 200;
    background: var(--surface); border: 1px solid var(--border-strong); color: var(--text);
    width: 42px; height: 42px; border-radius: var(--radius-md); cursor: pointer;
    align-items: center; justify-content: center; font-size: 1.2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    transition: background var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.sidebar-toggle:hover  { background: var(--border-strong); }
.sidebar-toggle:active { transform: scale(0.94); }
.sidebar-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
    z-index: 90;
    opacity: 0; pointer-events: none;
    transition: opacity var(--t-base) ease;
}
.sidebar-backdrop.open { opacity: 1; pointer-events: auto; }
/* Bloquear scroll de fondo cuando el sidebar está abierto */
body.sidebar-open { overflow: hidden; }

/* ── Override del header de la clasificación de 1ª (estilo La Liga) ── */
.tdt-wrap-clasificacion .tdt-header {
    background: linear-gradient(135deg, #0a1b5c 0%, #1d3d8e 100%);
}
.tdt-wrap-clasificacion         .tdt-header h2,
.tdt-wrap-clasificacion         .tdt-header .tdt-subtitle,
.tdt-wrap-clasificacion_segunda .tdt-header h2,
.tdt-wrap-clasificacion_segunda .tdt-header .tdt-subtitle,
.tdt-wrap-jornada_tbl           .tdt-header h2,
.tdt-wrap-jornada_tbl           .tdt-header .tdt-subtitle {
    color: var(--text) !important;
}

/* Cabecera de columnas de la tabla de jornada: blanco y negrita.
   Alineación por className del <th> (text-start/end/center) — el título queda
   a la par de los datos de su columna.
   Nota: duplico la clase (.tdt-wrap-jornada_tbl.tdt-wrap-jornada_tbl) para
   ganar al selector inline de TDataTable, que se inyecta DESPUÉS de este CSS. */
.tdt-wrap-jornada_tbl.tdt-wrap-jornada_tbl table.dataTable thead th,
.tdt-wrap-jornada_tbl.tdt-wrap-jornada_tbl table thead th {
    color: var(--text) !important;
    font-weight: 800 !important;
}
.tdt-wrap-jornada_tbl.tdt-wrap-jornada_tbl table thead th.text-center { text-align: center !important; }
.tdt-wrap-jornada_tbl.tdt-wrap-jornada_tbl table thead th.text-end    { text-align: right  !important; }
.tdt-wrap-jornada_tbl.tdt-wrap-jornada_tbl table thead th.text-start  { text-align: left   !important; }

/* ── Page header (título + selector temporada) ── */
.tdt-page-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem;
}
.tdt-page-header-title { margin: 0; font-size: 1.4rem; color: var(--text); }
.tdt-season-form { display: flex; align-items: center; gap: 0.6rem; margin: 0; }
.tdt-season-label { font-size: 0.85rem; color: var(--text-muted); }
.tdt-season-select {
    background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    padding: 0.4rem 0.8rem; font-size: 0.9rem; cursor: pointer; outline: none;
}

/* ── Leyenda de zonas ── */
.tdt-leyenda {
    display: flex; gap: 1.2rem; flex-wrap: wrap;
    padding: 0.8rem 1.5rem; font-size: 0.78rem; color: var(--text-soft);
}
.tdt-leyenda-item { display: flex; align-items: center; gap: 0.4rem; }
.tdt-leyenda-color {
    width: 10px; height: 10px; border-radius: 3px;
    background: var(--leyenda-color);
}

/* ── Pestañas (Clasificación / Jornadas / Predicciones) ──
   Mismo aspecto en tema claro y oscuro. */
.tdt-tabs { margin-top: 0.5rem; }
.tdt-tabs-nav {
    display: flex; gap: 0.4rem;
    border-bottom: 1px solid #d4dae3;
    margin-bottom: 1.2rem;
}
.tdt-tab {
    appearance: none; background: transparent; color: #6c757d;
    border: 0; border-bottom: 2px solid transparent;
    padding: 0.6rem 1.1rem; margin-bottom: -1px;
    font-family: inherit; font-size: 0.95rem; font-weight: 600; line-height: 1.4; letter-spacing: 0.01em;
    cursor: pointer; transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
    border-top-left-radius: var(--radius-sm); border-top-right-radius: var(--radius-sm);
}
.tdt-tab:hover { color: var(--brand); background: rgba(233,69,96,0.06); }
.tdt-tab.is-active { color: var(--brand); border-bottom-color: var(--brand); }
.tdt-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.tdt-tab-panel[hidden] { display: none; }

@media (max-width: 600px) {
    .tdt-tabs-nav {
        flex-wrap: nowrap; overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .tdt-tabs-nav::-webkit-scrollbar { display: none; }
    .tdt-tab {
        flex: 0 0 auto; white-space: nowrap;
        padding: 0.55rem 0.85rem; font-size: 0.85rem;
    }
}

/* ── Bloque de jornada ── */
.tdt-jornada-block { margin-top: 0; }
.tdt-jornada-controls {
    display: flex; align-items: center; justify-content: center;
    gap: 0.6rem; flex-wrap: wrap;
    margin-top: 0.9rem;
}
.tdt-jornada-nav {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: var(--radius-md);
    background: var(--surface); color: var(--text); text-decoration: none;
    border: 1px solid var(--border-strong);
    font-size: 1.1rem; font-weight: 700; line-height: 1;
    transition: all var(--t-fast);
}
.tdt-jornada-nav:hover {
    background: var(--brand-hover); border-color: var(--brand-hover); transform: translateY(-1px);
}
.tdt-jornada-nav--disabled {
    opacity: 0.35; pointer-events: none;
}

/* ── Loading overlay (común a predicciones y actualizar) ── */
.loading-overlay {
    display: none; position: fixed; inset: 0; z-index: 300;
    background: rgba(0,0,0,0.55);
    align-items: center; justify-content: center; flex-direction: column; gap: 1.2rem;
    animation: overlayIn var(--t-base) ease-out;
}
.loading-overlay.active { display: flex; }
.loading-spinner {
    width: 48px; height: 48px; border: 4px solid rgba(255,255,255,0.15);
    border-top-color: var(--brand); border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.loading-text { font-size: 1rem; font-weight: 600; color: var(--text); letter-spacing: 0.02em; }
.loading-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: -0.6rem; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

/* ─────────────────────────────────────────────────────────────────────────────
   TEMA CLARO (clasificación 1ª y 2ª) — estilo marca.com
   ─────────────────────────────────────────────────────────────────────────── */

body.theme-light {
    background: #ffffff;
    color: #212529;
}

body.theme-light .tdt-page-header-title { color: #1c3278; }
body.theme-light .tdt-season-label      { color: #6c757d; }
body.theme-light .tdt-season-select {
    background: #ffffff; color: #212529;
    border: 1px solid #ced4da;
}

/* Header del widget (gradient navy, mantiene contraste con tabla blanca) */
body.theme-light .tdt-wrap-clasificacion         .tdt-header,
body.theme-light .tdt-wrap-clasificacion_segunda .tdt-header,
body.theme-light .tdt-wrap-jornada_tbl           .tdt-header {
    background: linear-gradient(135deg, #1c3278 0%, #2952a3 100%) !important;
    color: #ffffff !important;
    border-bottom: 3px solid #ff1f47;
}
body.theme-light .tdt-wrap-clasificacion         .tdt-header h2,
body.theme-light .tdt-wrap-clasificacion         .tdt-header .tdt-subtitle,
body.theme-light .tdt-wrap-clasificacion_segunda .tdt-header h2,
body.theme-light .tdt-wrap-clasificacion_segunda .tdt-header .tdt-subtitle,
body.theme-light .tdt-wrap-jornada_tbl           .tdt-header h2,
body.theme-light .tdt-wrap-jornada_tbl           .tdt-header .tdt-subtitle {
    color: #ffffff !important;
}

/* Card-table sin borde de color (light theme) */
body.theme-light .tdt-wrap-clasificacion,
body.theme-light .tdt-wrap-clasificacion_segunda,
body.theme-light .tdt-wrap-jornada_tbl {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(28,50,120,0.08);
    overflow: hidden;
    margin-bottom: 1rem;
}

/* Body de la tabla: fondo blanco, padding generoso */
body.theme-light .tdt-wrap-clasificacion         .tdt-body,
body.theme-light .tdt-wrap-clasificacion_segunda .tdt-body,
body.theme-light .tdt-wrap-jornada_tbl           .tdt-body {
    background: #ffffff !important;
    padding: 0 !important;
}

/* Cabecera de columnas: fila clara con borde inferior fino */
body.theme-light .tdt-wrap-clasificacion         table.dataTable thead th,
body.theme-light .tdt-wrap-clasificacion_segunda table.dataTable thead th,
body.theme-light .tdt-wrap-jornada_tbl           table.dataTable thead th {
    background: #ffffff !important;
    color: #6c757d !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #dee2e6 !important;
    padding: 0.85rem 0.6rem !important;
}

/* Filas: blancas con divisor sutil */
body.theme-light .tdt-wrap-clasificacion         table.dataTable tbody td,
body.theme-light .tdt-wrap-clasificacion_segunda table.dataTable tbody td,
body.theme-light .tdt-wrap-jornada_tbl           table.dataTable tbody td {
    background: #ffffff !important;
    color: #212529 !important;
    border-bottom: 1px solid #f1f3f5 !important;
    padding: 0.9rem 0.6rem !important;
    font-size: 0.95rem !important;
}
body.theme-light .tdt-wrap-clasificacion         table.dataTable tbody tr:hover td,
body.theme-light .tdt-wrap-clasificacion_segunda table.dataTable tbody tr:hover td {
    background: #f8f9fa !important;
}

/* Stripe de zona: borde-izq de color en la primera celda en vez del fondo tintado */
body.theme-light .tdt-wrap-clasificacion         table tbody tr.zona-champions  td:first-child,
body.theme-light .tdt-wrap-clasificacion_segunda table tbody tr.zona-champions  td:first-child {
    border-left: 5px solid #2a9d8f !important;
}
body.theme-light .tdt-wrap-clasificacion         table tbody tr.zona-europa     td:first-child,
body.theme-light .tdt-wrap-clasificacion_segunda table tbody tr.zona-europa     td:first-child {
    border-left: 5px solid #457bd1 !important;
}
body.theme-light .tdt-wrap-clasificacion         table tbody tr.zona-conference td:first-child,
body.theme-light .tdt-wrap-clasificacion_segunda table tbody tr.zona-conference td:first-child {
    border-left: 5px solid #9c88ff !important;
}
body.theme-light .tdt-wrap-clasificacion         table tbody tr.zona-descenso   td:first-child,
body.theme-light .tdt-wrap-clasificacion_segunda table tbody tr.zona-descenso   td:first-child {
    border-left: 5px solid #e94560 !important;
}

/* Posición (primera columna): grande y semi-bold como marca */
body.theme-light .tdt-wrap-clasificacion         table tbody td:first-child,
body.theme-light .tdt-wrap-clasificacion_segunda table tbody td:first-child {
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    color: #495057 !important;
    padding-left: 0.9rem !important;
}

/* Equipo: color marca azul */
body.theme-light .tdt-wrap-clasificacion         table tbody td.fw-semibold,
body.theme-light .tdt-wrap-clasificacion_segunda table tbody td.fw-semibold {
    color: #1c3278 !important;
}

/* Puntos: bold y un toquito más oscuro */
body.theme-light .tdt-wrap-clasificacion         table tbody td.fw-bold,
body.theme-light .tdt-wrap-clasificacion_segunda table tbody td.fw-bold {
    color: #1c3278 !important;
    font-weight: 800 !important;
}

/* Buscador y selector de longitud */
body.theme-light .tdt-wrap-clasificacion         .dataTables_filter input,
body.theme-light .tdt-wrap-clasificacion         .dataTables_length select,
body.theme-light .tdt-wrap-clasificacion_segunda .dataTables_filter input,
body.theme-light .tdt-wrap-clasificacion_segunda .dataTables_length select {
    background: #ffffff !important;
    color: #212529 !important;
    border: 1px solid #ced4da !important;
}
body.theme-light .tdt-wrap-clasificacion         .dataTables_filter label,
body.theme-light .tdt-wrap-clasificacion         .dataTables_length label,
body.theme-light .tdt-wrap-clasificacion         .dataTables_info,
body.theme-light .tdt-wrap-clasificacion_segunda .dataTables_filter label,
body.theme-light .tdt-wrap-clasificacion_segunda .dataTables_length label,
body.theme-light .tdt-wrap-clasificacion_segunda .dataTables_info {
    color: #6c757d !important;
}

/* Leyenda + selectores en tema claro */
body.theme-light .tdt-leyenda { color: #495057; }
body.theme-light .tdt-jornada-nav {
    background: #ffffff; color: #1c3278;
    border-color: #ced4da;
}
body.theme-light .tdt-jornada-nav:hover {
    background: #ff1f47; color: #ffffff; border-color: #ff1f47;
}

/* ── Safety-net: tablas DataTable nunca hacen overflow horizontal ── */
.tdt-wrap-clasificacion .tdt-body,
.tdt-wrap-clasificacion_segunda .tdt-body,
.tdt-wrap-jornada_tbl .tdt-body,
.tdt-wrap-predicciones .tdt-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── Responsive base ── */
@media (max-width: 860px) {
    .sidebar {
        /* Ancho adaptable: 280px o el 80% del viewport, lo menor */
        width: min(280px, 80vw);
        transform: translateX(-100%);
        box-shadow: none;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 0 0 24px rgba(0,0,0,0.35);
    }
    .sidebar-brand { padding: 1.1rem 1rem; }
    .sidebar-nav   { padding: 0.8rem 0.7rem; }
    .sidebar-nav a { padding: 0.7rem 0.9rem; font-size: 0.9rem; }
    .sidebar-icon  { width: 20px; height: 20px; }
    .sidebar-footer { padding: 0.6rem 1rem calc(0.8rem + env(safe-area-inset-bottom, 0px)); }
    .sidebar-footer-logo { max-height: 110px; }

    .sidebar-toggle { display: flex; }
    .main-content { margin-left: 0; padding: 1rem 0.6rem; padding-top: 4rem; }
    .tdt-page-container { max-width: 100%; }

    .tdt-page-header { margin-bottom: 1rem; }
    .tdt-page-header-title { font-size: 1.2rem; }
    .tdt-leyenda { padding: 0.6rem 0.9rem; gap: 0.9rem; font-size: 0.72rem; }
    .tdt-jornada-controls { gap: 0.4rem; }
    .tdt-jornada-nav { width: 38px; height: 38px; font-size: 1rem; }
}
@media (max-width: 480px) {
    .sidebar { width: min(260px, 85vw); }
    .sidebar-brand-text { font-size: 0.9rem; }
    .sidebar-footer-logo { max-height: 95px; }

    .main-content { padding: 0.8rem 0.4rem; padding-top: 4rem; }

    .tdt-page-header-title { font-size: 1.1rem; }
    .tdt-season-form { width: 100%; }
    .tdt-season-select { flex: 1; }
    .tdt-leyenda { padding: 0.5rem 0.6rem; gap: 0.7rem; font-size: 0.68rem; }
    .loading-text { font-size: 0.9rem; }
    .loading-sub { font-size: 0.72rem; }
}
@media (max-width: 360px) {
    .sidebar { width: 88vw; }
    .sidebar-toggle { width: 38px; height: 38px; top: 0.5rem; left: 0.5rem; }
    .main-content { padding-top: 3.5rem; }
}
/* En desktop forzamos sidebar visible (por si quedó "open" en mobile y el usuario amplió) */
@media (min-width: 861px) {
    .sidebar         { transform: none !important; box-shadow: none !important; }
    .sidebar-backdrop { display: none !important; }
    body.sidebar-open { overflow: auto; }
}
