/* ═══════════════════════════════════════════════════════════════════════════
   Gestión personal — sistema de diseño (mismo lenguaje que el panel de bots)
   Tema claro/oscuro con tokens; las variables antiguas (--color-*) y las de
   cada sección (--en-*, --ec-*, --tc-*) apuntan aquí, así toda la app cambia
   de tema a la vez.
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
    --bg: #f4f5f7; --surface: #ffffff; --surface-2: #f8f9fb; --surface-3: #f1f3f6;
    --border: #e4e7ec; --border-strong: #d0d5dd;
    --text: #101828; --text-2: #344054; --muted: #667085; --faint: #98a2b3;
    --accent: #4f46e5; --accent-hover: #4338ca; --accent-text: #ffffff; --accent-fg: #4338ca;
    --accent-weak: #eef2ff; --accent-ring: rgba(79, 70, 229, .22);
    --green: #12b76a; --green-text: #027a48; --green-weak: #ecfdf3;
    --amber: #f79009; --amber-text: #b54708; --amber-weak: #fffaeb;
    --red: #f04438; --red-text: #b42318; --red-weak: #fef3f2;
    --blue: #2e90fa; --blue-text: #175cd3; --blue-weak: #eff8ff;
    --gray-dot: #98a2b3;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-card: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 20px -12px rgba(16, 24, 40, .14);
    --shadow-lg: 0 16px 32px -8px rgba(16, 24, 40, .18), 0 4px 8px -4px rgba(16, 24, 40, .06);
    --radius: 10px; --radius-sm: 8px; --radius-lg: 14px;
    --content-width: 1320px;
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0b0d12; --surface: #12151c; --surface-2: #161a23; --surface-3: #1c212c;
        --border: #242a38; --border-strong: #313849;
        --text: #eef1f6; --text-2: #c9cfda; --muted: #8e97aa; --faint: #626b7e;
        --accent: #6366f1; --accent-hover: #5458e8; --accent-text: #ffffff; --accent-fg: #a5b4fc;
        --accent-weak: rgba(99, 102, 241, .14); --accent-ring: rgba(129, 140, 248, .35);
        --green: #32d583; --green-text: #4ade80; --green-weak: rgba(50, 213, 131, .11);
        --amber: #fdb022; --amber-text: #fbbf24; --amber-weak: rgba(253, 176, 34, .11);
        --red: #f97066; --red-text: #fb7185; --red-weak: rgba(249, 112, 102, .11);
        --blue: #53b1fd; --blue-text: #84caff; --blue-weak: rgba(83, 177, 253, .11);
        --gray-dot: #626b7e;
        --shadow-sm: none; --shadow-card: 0 1px 2px rgba(0, 0, 0, .35);
        --shadow-lg: 0 18px 36px -10px rgba(0, 0, 0, .6);
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #0b0d12; --surface: #12151c; --surface-2: #161a23; --surface-3: #1c212c;
    --border: #242a38; --border-strong: #313849;
    --text: #eef1f6; --text-2: #c9cfda; --muted: #8e97aa; --faint: #626b7e;
    --accent: #6366f1; --accent-hover: #5458e8; --accent-text: #ffffff; --accent-fg: #a5b4fc;
    --accent-weak: rgba(99, 102, 241, .14); --accent-ring: rgba(129, 140, 248, .35);
    --green: #32d583; --green-text: #4ade80; --green-weak: rgba(50, 213, 131, .11);
    --amber: #fdb022; --amber-text: #fbbf24; --amber-weak: rgba(253, 176, 34, .11);
    --red: #f97066; --red-text: #fb7185; --red-weak: rgba(249, 112, 102, .11);
    --blue: #53b1fd; --blue-text: #84caff; --blue-weak: rgba(83, 177, 253, .11);
    --gray-dot: #626b7e;
    --shadow-sm: none; --shadow-card: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-lg: 0 18px 36px -10px rgba(0, 0, 0, .6);
    color-scheme: dark;
}

/* Variables antiguas y de cada sección → tokens comunes */
:root {
    --color-bg: var(--bg); --color-surface: var(--surface); --color-border: var(--border);
    --color-text: var(--text); --color-text-muted: var(--muted);
    --color-primary: var(--accent); --color-primary-dark: var(--accent-fg);
    --color-danger: var(--red-text); --color-warning: var(--amber-text);
    --shadow: var(--shadow-card);

    --en-bg: var(--surface-2); --en-surface: var(--surface); --en-border: var(--border);
    --en-ink: var(--text); --en-ink-muted: var(--muted); --en-ink-faint: var(--faint);
    --en-accent: var(--accent); --en-accent-soft: var(--accent-weak);
    --en-good: var(--green-text); --en-good-soft: var(--green-weak);
    --en-warn: var(--amber-text); --en-warn-soft: var(--amber-weak);
    --en-shadow: var(--shadow-card); --en-radius: var(--radius-lg);

    --ec-bg: var(--surface-2); --ec-surface: var(--surface); --ec-border: var(--border);
    --ec-ink: var(--text); --ec-ink-muted: var(--muted); --ec-ink-faint: var(--faint);
    --ec-accent: var(--accent); --ec-accent-soft: var(--accent-weak);
    --ec-good: var(--green-text); --ec-good-soft: var(--green-weak);
    --ec-warn: var(--amber-text); --ec-warn-soft: var(--amber-weak);
    --ec-danger: var(--red-text);
    --ec-shadow: var(--shadow-card); --ec-radius: var(--radius-lg);
}

/* ── Base ───────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
/* Con un <dialog> abierto (showModal) no se desplaza la página de detrás. */
html:has(dialog[open]) { overflow: hidden; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14.5px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-fg); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; letter-spacing: -.015em; }
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-weight: 650; }
code { font-family: var(--mono); font-size: .86em; background: var(--surface-3); border: 1px solid var(--border); padding: .05em .35em; border-radius: 5px; }
::selection { background: var(--accent-ring); }
.i { flex-shrink: 0; vertical-align: -3px; }
svg text { fill: currentColor; }

/* ── Barra superior ─────────────────────────────────────────────────────── */
.topbar {
    position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(1.6) blur(10px); -webkit-backdrop-filter: saturate(1.6) blur(10px); border-bottom: 1px solid var(--border);
}
.topbar-inner { max-width: var(--content-width); margin: 0 auto; padding: 0 32px; height: 60px; display: flex; align-items: center; gap: 22px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 15px; text-decoration: none; flex-shrink: 0; letter-spacing: -.01em; }
.brand:hover { color: var(--text); }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff;
    background: linear-gradient(135deg, #6366f1, #8b5cf6); box-shadow: 0 2px 6px rgba(99, 102, 241, .35); flex-shrink: 0; }
.main-nav { display: flex; gap: 2px; flex: 1; min-width: 0; }
.main-nav a {
    display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 8px; color: var(--muted);
    font-weight: 550; font-size: 13.5px; text-decoration: none; white-space: nowrap; transition: background .12s, color .12s;
}
.main-nav a:hover { color: var(--text); background: var(--surface-3); }
.main-nav a.active { color: var(--accent-fg); background: var(--accent-weak); }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.topbar-link, .user-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; color: var(--text-2);
    font-size: 13px; font-weight: 550; text-decoration: none; border: 1px solid var(--border);
}
.topbar-link:hover, .user-chip:hover { border-color: var(--border-strong); background: var(--surface-3); color: var(--text); }
.topbar-link .i:last-child { opacity: .55; }
.theme-switch { display: flex; gap: 2px; background: var(--surface-3); border-radius: 8px; padding: 3px; }
.theme-switch button { border: 0; background: none; color: var(--muted); padding: 4px 6px; border-radius: 5px; cursor: pointer; display: grid; place-items: center; }
.theme-switch button:hover { color: var(--text); }
.theme-switch button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-card); }
.logout-form { margin: 0; display: flex; }
.page { max-width: var(--content-width); margin: 0 auto; padding: 28px 32px 72px; }

/* ── Cabeceras de página ────────────────────────────────────────────────── */
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.4rem; }
.page-header h1 { margin: 0; }
.header-right { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; margin-left: auto; }

.titulo-con-volver { display: flex; align-items: center; gap: .75rem; }
.titulo-con-volver h1 { margin: 0; }
.list-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.25rem; }
.list-header .chip-row { margin-bottom: 0; }
.back-icon {
    display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex-shrink: 0;
    border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
    font-size: 1.05rem; text-decoration: none; cursor: pointer; box-shadow: var(--shadow-sm);
}
.back-icon:hover { border-color: var(--accent); color: var(--accent-fg); }

/* ── Mensajes ───────────────────────────────────────────────────────────── */
/* Flotan arriba a la derecha: se ven aunque la página vuelva a mitad de scroll, y se cierran solos */
.messages { list-style: none; padding: 0; margin: 0; position: fixed; top: 78px; right: 20px; z-index: 60;
    display: flex; flex-direction: column; gap: .5rem; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.message {
    display: flex; gap: 10px; align-items: flex-start; padding: .75rem 1rem; border-radius: var(--radius);
    background: var(--surface); color: var(--green-text); border: 1px solid color-mix(in srgb, var(--green) 30%, var(--border));
    box-shadow: var(--shadow-lg); font-size: .92rem; font-weight: 500; pointer-events: auto; cursor: pointer;
    animation: aviso-entra .28s cubic-bezier(.2, .8, .2, 1);
    transition: opacity .3s, transform .3s;
}
.message.saliendo { opacity: 0; transform: translateX(16px); }
@keyframes aviso-entra { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) { .messages { top: auto; bottom: 16px; right: 16px; } }
.message .i { margin-top: 2px; }
.message.error { color: var(--red-text); border-color: color-mix(in srgb, var(--red) 35%, var(--border)); }
.message.warning { color: var(--amber-text); border-color: color-mix(in srgb, var(--amber) 35%, var(--border)); }
.message.info { color: var(--text-2); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }

/* ── Botones ────────────────────────────────────────────────────────────── */
.btn, .icon-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: .5rem .95rem; border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); text-decoration: none;
    font: 500 .9rem var(--font); cursor: pointer; box-shadow: var(--shadow-sm); white-space: nowrap; line-height: 1.3;
    transition: background .12s, border-color .12s, color .12s;
}
.btn:hover, .icon-btn:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-strong); }
.btn:focus-visible, .icon-btn:focus-visible, .action-btn:focus-visible, .chip:focus-visible, a:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-text); }
.btn-danger { color: var(--red-text); }
.btn-danger:hover { background: var(--red-weak); border-color: var(--red); color: var(--red-text); }
.btn-sm { padding: .3rem .65rem; font-size: .82rem; }
.btn-block { width: 100%; }
.icon-btn { padding: 0; width: 34px; height: 34px; }
.ghost { background: none; border-color: transparent; box-shadow: none; }
.ghost:hover { background: var(--surface-3); border-color: transparent; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }
 .actions-compact { flex-direction: column; align-items: stretch; }
 .actions-compact form { display: contents; }

.action-btn {
    display: flex; align-items: center; gap: .45rem; padding: .38rem .75rem .38rem .42rem; border-radius: 999px;
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); text-decoration: none;
    font: 600 .8rem var(--font); text-align: left; cursor: pointer; width: 100%;
    transition: border-color .15s, background .15s, transform .08s;
}
.action-btn:hover { border-color: var(--accent); background: var(--surface-2); color: var(--text); }
.action-btn:active { transform: scale(.98); }
.action-btn-icon { display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; background: var(--surface-3); color: var(--muted); }
.action-btn-icon svg { width: 12px; height: 12px; }
.action-btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.action-btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-text); }
.action-btn-primary .action-btn-icon { background: rgba(255, 255, 255, .2); color: #fff; }
.actions-column { display: flex; flex-direction: column; align-items: stretch; gap: .3rem; width: 178px; }
.evcc-estado { display: flex; flex-direction: column; gap: .15rem; font-size: .72rem; text-align: center; }
.evcc-estado-ok { color: var(--muted); }
.evcc-estado-error { color: var(--red-text); cursor: help; }

/* Botón flotante de añadir */
.fab {
    position: fixed; right: 1.6rem; bottom: 1.6rem; width: 54px; height: 54px; border-radius: 16px;
    background: var(--accent); color: var(--accent-text); border: none; font-size: 1.7rem; line-height: 1;
    box-shadow: 0 10px 24px -6px color-mix(in srgb, var(--accent) 60%, transparent); cursor: pointer; z-index: 10;
    display: grid; place-items: center; transition: transform .15s, background .15s;
}
.fab:hover { background: var(--accent-hover); transform: translateY(-2px); }

/* ── Tarjetas y secciones ───────────────────────────────────────────────── */
.section, .detail-header, .ficha-notas, .form-card, .auth-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
}
.section { padding: 1.15rem 1.25rem; margin-bottom: 1.25rem; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .85rem; gap: .5rem; flex-wrap: wrap; }
.section-header h2 { font-size: 1.02rem; margin: 0; }
.total-historico { font-size: 1.1rem; font-weight: 700; font-family: var(--mono); color: var(--text); }
.section-toolbar { display: flex; justify-content: flex-end; margin-bottom: .75rem; }
.empty-state {
    text-align: center; color: var(--muted); padding: 3rem 1rem; background: var(--surface);
    border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
}
.empty-state p { margin: .35rem 0; }

/* ── Insignias y chips ──────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 600; padding: .14rem .55rem;
    border-radius: 6px; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border);
}
.badge.activo { background: var(--green-weak); color: var(--green-text); border-color: transparent; }
.badge.inactivo { background: var(--surface-3); color: var(--muted); }
.badge.combustion { background: var(--amber-weak); color: var(--amber-text); border-color: transparent; }
.badge.electrico { background: var(--blue-weak); color: var(--blue-text); border-color: transparent; }

.chip-row { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1rem; }
.chip {
    display: inline-flex; align-items: center; padding: .34rem .9rem; border-radius: 999px; border: 1px solid var(--border-strong);
    background: var(--surface); color: var(--text-2); font-size: .84rem; font-weight: 600; text-decoration: none;
}
.chip:hover { border-color: var(--accent); color: var(--accent-fg); }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

/* Elegir una opción de un conjunto pequeño como botones (radio/checkbox ocultos) */
.chip-toggle {
    position: relative; display: flex; align-items: center; justify-content: center; flex: 1; min-width: 90px;
    padding: 9px 12px; border-radius: 9px; border: 1px solid var(--border-strong); font-size: .85rem; font-weight: 600;
    color: var(--muted); cursor: pointer; transition: border-color .12s, background .12s, color .12s; user-select: none; background: var(--surface);
}
.chip-toggle input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.chip-toggle:hover { border-color: var(--accent); }
.chip-toggle:has(input:checked) { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.chip-toggle.chip-verde:has(input:checked) { background: var(--green-text); border-color: var(--green-text); color: var(--surface); }
.chip-toggle.chip-rojo:has(input:checked) { background: var(--red); border-color: var(--red); color: #fff; }

.periodo-toggle { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.periodo-btn { background: var(--surface); border: none; padding: .35rem .9rem; font: 600 .84rem var(--font); color: var(--muted); cursor: pointer; }
.periodo-btn:hover { color: var(--text); }
.periodo-btn + .periodo-btn { border-left: 1px solid var(--border); }
.periodo-btn.active { background: var(--accent); color: var(--accent-text); }

/* Selector de periodo estándar (Energía: FV, Informe, Simulador) */
.periodo-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.periodo-chips + .periodo-chips { margin-top: 6px; }
.periodo-chip {
    display: inline-flex; align-items: center; padding: 5px 13px; border-radius: 999px; font-size: .76rem; font-weight: 600;
    text-decoration: none; color: var(--muted); border: 1px solid var(--border); background: var(--surface);
    transition: border-color .15s, color .15s, background .15s;
}
button.periodo-chip { cursor: pointer; font-family: inherit; }
.periodo-chip:hover { border-color: var(--accent); color: var(--accent-fg); }
.periodo-chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.periodo-chip.small { padding: 4px 10px; font-size: .72rem; }
.periodo-personalizado { margin-top: 8px; }
.periodo-personalizado summary { font-size: .76rem; font-weight: 600; color: var(--muted); cursor: pointer; user-select: none; list-style: none; }
.periodo-personalizado summary::-webkit-details-marker { display: none; }
.periodo-personalizado summary::before { content: "▸ "; }
.periodo-personalizado[open] summary::before { content: "▾ "; }
.periodo-personalizado-form { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.periodo-personalizado-form .field { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.periodo-personalizado-form label { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); }
.periodo-personalizado-form input[type="date"] { width: auto; padding: 6px 9px; font-size: .82rem; }
.periodo-personalizado-form button.periodo-chip { border: none; background: var(--accent); color: var(--accent-text); cursor: pointer; }
.periodo-personalizado-form button.periodo-chip:hover { background: var(--accent-hover); }

/* ── Portada ────────────────────────────────────────────────────────────── */
.hub-wrap { font-family: var(--font); }
.hub-header { text-align: center; margin: 3rem 0 2.75rem; }
.hub-header h1 { font-size: 2.4rem; font-weight: 800; letter-spacing: -.035em; margin-bottom: .45rem; }
.hub-header p { color: var(--muted); font-size: 1.08rem; font-weight: 500; margin: 0; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.25rem; max-width: 1120px; margin: 0 auto; }
.hub-tile {
    position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .9rem;
    text-align: center; padding: 2.75rem 1.5rem; min-height: 250px; border-radius: 22px; text-decoration: none; color: var(--text); cursor: pointer;
    background: linear-gradient(165deg, color-mix(in srgb, var(--hub-color, var(--accent)) 11%, var(--surface)), var(--surface) 62%);
    border: 1px solid var(--border); box-shadow: var(--shadow-card);
    transition: transform .22s cubic-bezier(.2, .8, .2, 1), box-shadow .22s ease, border-color .22s ease;
}
.hub-tile::before {
    content: ""; position: absolute; top: -70px; left: 50%; width: 240px; height: 240px; transform: translateX(-50%);
    border-radius: 50%; pointer-events: none; opacity: .16;
    background: radial-gradient(circle, var(--hub-color, var(--accent)) 0%, transparent 72%);
}
.hub-tile:hover { transform: translateY(-5px); border-color: color-mix(in srgb, var(--hub-color, var(--accent)) 55%, var(--border)); box-shadow: 0 24px 40px -20px color-mix(in srgb, var(--hub-color, var(--accent)) 55%, transparent); color: var(--text); }
.hub-tile-icon {
    position: relative; width: 84px; height: 84px; border-radius: 24px; display: flex; align-items: center; justify-content: center; font-size: 2.6rem;
    background: linear-gradient(155deg, var(--hub-color, var(--accent)), var(--hub-color-dark, var(--accent-hover)));
    box-shadow: 0 14px 26px -10px var(--hub-color, var(--accent)), inset 0 1px 1px rgba(255, 255, 255, .3); color: #fff;
}
.hub-tile-title { position: relative; font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; }
.hub-tile-sub { position: relative; font-size: .88rem; font-weight: 500; color: var(--muted); line-height: 1.45; max-width: 230px; }

.hub-tile.disabled { cursor: default; opacity: .55; }
.hub-tile.disabled:hover { transform: none; border-color: var(--border); box-shadow: var(--shadow-card); }
.hub-tile.disabled .hub-tile-icon { background: var(--faint); box-shadow: none; }

/* ── Flota: listado y alta ──────────────────────────────────────────────── */
.vehicle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.vehicle-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
    padding: .75rem .75rem 1rem; text-decoration: none; color: var(--text); display: flex; flex-direction: column; align-items: center;
    text-align: center; gap: .35rem; cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s;
}
.vehicle-card:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.vehicle-card .titulo { font-weight: 700; font-size: 1.02rem; margin-top: .35rem; letter-spacing: -.01em; }
.vehicle-card .subtitulo { color: var(--muted); font-size: .86rem; font-family: var(--mono); }
.vehicle-card .meta { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem; margin-top: .35rem; }
.vehicle-card-foto { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; background: var(--surface-3); }
.vehicle-card-foto-vacia {
    display: flex; align-items: center; justify-content: center; border: 1px dashed var(--border-strong);
    background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398a2b3' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 17h14M5 17a2 2 0 1 0 4 0M15 17a2 2 0 1 0 4 0M3 17v-5l2-5a2 2 0 0 1 1.9-1.4h10.2A2 2 0 0 1 19 7l2 5v5'/%3E%3Cpath d='M3 12h18'/%3E%3C/svg%3E") center / 56px no-repeat;
}

.wizard-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; margin-top: 1.25rem; }
.wizard-option {
    display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 2.25rem 1rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
    color: var(--text); text-decoration: none; font: 700 1.05rem var(--font); flex: 1 1 180px; max-width: 220px; cursor: pointer;
    transition: border-color .15s, transform .15s;
}
.wizard-option:hover { border-color: var(--accent); color: var(--accent-fg); transform: translateY(-2px); }
.wizard-grid-modal { margin-top: .5rem; }
.wizard-grid-modal .wizard-option { padding: 1.2rem 1rem; font-size: .93rem; flex-basis: 140px; }
.wizard-option.disabled { cursor: default; color: var(--muted); background: var(--surface-2); }
.wizard-option.disabled:hover { border-color: var(--border); color: var(--muted); transform: none; }

.informe-opciones { display: flex; gap: .85rem; flex-wrap: wrap; margin-top: .5rem; }
.informe-opcion {
    flex: 1 1 160px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem; text-align: center;
    padding: 1.4rem 1.1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card); color: var(--text); text-decoration: none; font-family: inherit; cursor: pointer;
}
.informe-opcion:hover { border-color: var(--accent); }
.informe-opcion-titulo { font-size: 1.02rem; font-weight: 700; }
.informe-opcion-sub { font-size: .8rem; color: var(--muted); line-height: 1.35; }
.secciones-informe { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.seccion-toggle {
    padding: .45rem 1.1rem; border-radius: 999px; font: 600 .85rem var(--font); cursor: pointer;
    background: var(--red-weak); color: var(--red-text); border: 1px solid color-mix(in srgb, var(--red) 30%, transparent);
    transition: background .12s, color .12s, border-color .12s;
}
.seccion-toggle:hover { border-color: var(--red); }
.seccion-toggle.activa { background: var(--green-weak); color: var(--green-text); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.informe-paso-2-actions { margin-top: 1.1rem; }

/* ── Flota: ficha del vehículo ──────────────────────────────────────────── */
.detail-header-row { display: flex; align-items: flex-start; gap: .75rem; margin-bottom: 1.4rem; }
.detail-header-row .back-icon { margin-top: .2rem; }
.detail-header { padding: 1.15rem 1.25rem; flex: 1; min-width: 0; }
.detail-header h1 { margin-bottom: .2rem; }

.vehiculo-foto { width: 160px; max-width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); background: var(--surface-3); flex-shrink: 0; }
.vehiculo-foto-vacia { display: flex; align-items: center; justify-content: center; border: 1px dashed var(--border-strong); color: var(--muted); font-size: .85rem; }
.vehiculo-nav-arrow {
    width: 34px; height: 34px; border-radius: 9px; background: var(--surface); border: 1px solid var(--border-strong); color: var(--text-2);
    box-shadow: var(--shadow-sm); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; line-height: 1; text-decoration: none; flex-shrink: 0;
}
a.vehiculo-nav-arrow:hover { border-color: var(--accent); color: var(--accent-fg); }
.vehiculo-nav-disabled { opacity: .35; box-shadow: none; }

/* Cabecera de la ficha: ‹ foto | título, etiquetas y datos | acciones › */
.veh-head { display: grid; grid-template-columns: auto 220px minmax(0, 1fr) auto auto; align-items: center; gap: 22px; padding: 1.1rem 1.15rem; }
.veh-head .vehiculo-foto { width: 220px; aspect-ratio: 4 / 3; border-radius: 12px; }
.veh-head-main { min-width: 0; align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
.veh-head-main h1 { font-size: 1.6rem; margin: 0 0 .55rem; letter-spacing: -.02em; }
.veh-head-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge.matricula { font-family: var(--mono); letter-spacing: .02em; }
.veh-head-stats { display: flex; flex-wrap: wrap; gap: 10px 36px; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.veh-stat-label { font-size: .72rem; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.veh-stat-value { font-family: var(--mono); font-size: 1.35rem; font-weight: 600; letter-spacing: -.01em; margin-top: 2px; }
.veh-stat-value small { font-size: .8rem; color: var(--muted); font-weight: 500; }
.veh-stat-sub { font-size: .78rem; color: var(--muted); }
.veh-stat-vacio { font-family: var(--font); font-size: 1rem; color: var(--muted); font-weight: 500; }
.veh-head .actions-column { width: 180px; }
.veh-head-nav { display: flex; flex-direction: column; align-items: center; gap: 10px; }
@media (max-width: 1000px) {
    .veh-head { grid-template-columns: auto 160px minmax(0, 1fr) auto; }
    .veh-head .vehiculo-foto { width: 160px; }
    .veh-head .actions-column { grid-column: 2 / 4; grid-row: 2; width: auto; flex-direction: row; flex-wrap: wrap; }
    .veh-head .actions-column .actions { flex-direction: row; flex-wrap: wrap; }
    .veh-head .actions-column .action-btn { width: auto; }
    .veh-head > .vehiculo-nav-arrow:last-child { grid-column: 4; grid-row: 1; }
}
@media (max-width: 640px) {
    .veh-head { grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; }
    .veh-head .vehiculo-foto { width: 100%; grid-column: 2; }
    .veh-head-main { grid-column: 1 / -1; grid-row: 2; }
    .veh-head .actions-column { grid-column: 1 / -1; grid-row: 3; }
    .veh-head > .vehiculo-nav-arrow:last-child { grid-column: 3; grid-row: 1; }
    .veh-head-main h1 { font-size: 1.35rem; }
}
.ficha-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }
.ficha-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
    padding: 1.05rem 1.15rem; position: relative; overflow: hidden;
}
.ficha-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--ficha-color, var(--border)); }
.ficha-card-general { --ficha-color: #2a78d6; }
.ficha-card-compra { --ficha-color: #eb6834; }
.ficha-card-motor { --ficha-color: #7c6cf0; }
.ficha-card-baja { --ficha-color: var(--red); }
.ficha-card-header { display: flex; align-items: center; gap: .55rem; font-weight: 700; margin-bottom: .8rem; color: var(--ficha-color, var(--text)); }
.ficha-card-header span { color: var(--text); }
.ficha-item { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; padding: .42rem 0; border-bottom: 1px solid var(--border); }
.ficha-item:last-child { border-bottom: none; }
.ficha-item-label { font-size: .82rem; color: var(--muted); }
.ficha-item-value { font-size: .93rem; font-weight: 600; text-align: right; }
.ficha-notas { margin-top: 1rem; padding: 1.1rem; white-space: pre-line; }

/* Resumen de hoy (tarjetas de estado) */
.resumen-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem; margin-bottom: 1.5rem; }
.stat-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
    padding: .9rem 1rem; text-align: center; display: flex; flex-direction: column; align-items: center; position: relative; overflow: hidden;
}
.stat-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--stat-color, var(--border)); }
.stat-card.estado-ok { --stat-color: var(--green); }
.stat-card.estado-proximo { --stat-color: var(--amber); background: linear-gradient(180deg, var(--amber-weak), var(--surface) 70%); }
.stat-card.estado-vencido { --stat-color: var(--red); background: linear-gradient(180deg, var(--red-weak), var(--surface) 70%); }
.stat-label {
    font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; margin-bottom: .3rem;
    line-height: 1.3; min-height: 2.6em; display: flex; align-items: center; justify-content: center; gap: .35rem;
}
.icon-neumatico { flex-shrink: 0; }
.stat-value { font-size: 1.08rem; font-weight: 700; font-family: var(--mono); }
.stat-value-vacio { color: var(--muted); font-weight: 500; font-size: .98rem; font-family: var(--font); }
.stat-sub { font-size: .8rem; color: var(--muted); margin-top: .15rem; }
.estado-vencido .stat-sub { color: var(--red-text); font-weight: 600; }
.estado-proximo .stat-sub { color: var(--amber-text); font-weight: 600; }

.ver-todos {
    display: inline-flex; align-items: center; margin-top: .75rem; padding: .4rem .8rem; border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-size: .84rem; font-weight: 600; text-decoration: none; cursor: pointer;
}
.ver-todos:hover { border-color: var(--accent); color: var(--accent-fg); }
.paginacion { display: flex; align-items: center; gap: 1rem; justify-content: center; margin-top: 1.25rem; font-size: .9rem; color: var(--muted); }

/* Pestañas de la ficha */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; overflow-x: auto; scrollbar-width: none; }
.tab-btn {
    background: none; border: none; padding: .65rem .9rem; font: 600 .9rem var(--font); color: var(--muted); cursor: pointer;
    border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--text); border-bottom-color: var(--accent); }
/* Móvil: cabeceras de Energía y Economía que no cabían en una línea y estiraban la página */
@media (max-width: 720px) {
    .en-topbar, .ec-topbar { flex-wrap: wrap; }
    .en-nav { flex-basis: 100%; flex-wrap: wrap; }
    .ec-topbar .ec-title { flex: 1 1 60%; min-width: 0; }
    .ec-split-2 > * { min-width: 0; }
}
/* En el móvil, todas las pestañas a la vista en varias filas (sin desplazar a los lados) */
@media (max-width: 720px) {
    .tabs { flex-wrap: wrap; gap: 6px; overflow: visible; border-bottom: none; margin-bottom: 1rem; }
    .tab-btn { padding: .45rem .8rem; margin: 0; font-size: .85rem; border: 1px solid var(--border); border-radius: 999px;
        background: var(--surface); color: var(--text-2); }
    .tab-btn.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text);
        box-shadow: 0 4px 10px -4px var(--accent-ring); }
}
.tab-panel h3 { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 0 0 .6rem; }
.tab-panel .section + h3 { margin-top: 0; }

/* ── Tablas ─────────────────────────────────────────────────────────────── */
.table-scroll { width: 100%; overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data-table th, table.data-table td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data-table th { color: var(--muted); font-weight: 600; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); }
table.data-table th:first-child { border-top-left-radius: 8px; }
table.data-table th:last-child { border-top-right-radius: 8px; }
table.data-table tbody tr:hover td { background: var(--surface-2); }
table.data-table tr:last-child td { border-bottom: none; }

/* Trayectos: totales y mapa */
.viajes-totales { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; margin: 0 0 1rem; }
.viajes-totales > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: .65rem .8rem; }
.viajes-totales .t { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin-bottom: .2rem; }
.viajes-totales .v { display: block; font: 700 1.3rem var(--mono); color: var(--text); font-variant-numeric: tabular-nums; }
.viajes-totales .u { font-size: .74rem; color: var(--muted); }
.mapa-trayectos { height: 380px; border-radius: 14px; border: 1px solid var(--border); margin-bottom: .5rem; z-index: 0; }
.mapa-trayectos .leaflet-tile { filter: none; }
.mapa-nota { font-size: .76rem; color: var(--muted); margin: 0 0 1rem; }
.viajes-periodo { margin: 0 0 .5rem; }

/* Cabecera del viaje: degradado con la ruta y las cifras grandes */

/* Barra de batería: verde lo que queda al final, ámbar lo gastado en el viaje */
.vd-bat { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: .7rem .85rem; }
.vd-bat-track { position: relative; height: 16px; border-radius: 8px; overflow: hidden; background: color-mix(in srgb, var(--muted) 20%, transparent); }
.vd-bat-fin { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 8px 0 0 8px; background: linear-gradient(90deg, #15803d, #22c55e); }
.vd-bat-usada { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, #f59e0b 80%, transparent); }
.vd-bat-cap { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; margin-top: .55rem; font-size: .8rem; color: var(--text-2); }
.vd-bat-cap .usada { color: #b45309; font-weight: 700; }
.vd-bat-cap .aut { color: var(--muted); }
/* Mosaico de métricas con icono */

/* Ventana de un viaje (página de Trayectos) */

.ver-trayectos { display: inline-flex; margin-top: .8rem; }
/* Detalle de un viaje (página) */
.via-nav { display: flex; gap: .5rem; }
.btn.disabled { opacity: .45; pointer-events: none; }
.via-chevron { font-size: 1.3rem; color: var(--muted); text-align: center; }

.mapa-viaje { border-radius: 14px; border: 1px solid var(--border); z-index: 0; }

/* Detalle de viaje: tarjetas simétricas y compactas (td-*) */
.td-page .list-header { margin-bottom: .7rem; }
.td-page .section { padding: .6rem .85rem; margin-bottom: 0; }
.td-resumen { text-align: center; }
.td-route { display: flex; align-items: center; justify-content: center; gap: .5rem; flex-wrap: wrap; font-size: 1.12rem; font-weight: 750; color: var(--text); }
.td-route svg { width: 19px; height: 19px; fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.td-when { margin-top: .2rem; color: var(--muted); font-size: .85rem; }
.td-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .5rem; margin: .55rem 0; }
.td-card { background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: .45rem .6rem; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: .15rem; }
.td-card .k { font-size: .64rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.td-card .v { font: 700 1rem var(--mono); color: var(--text); font-variant-numeric: tabular-nums; }
.td-card .sub { font-size: .7rem; font-weight: 600; color: var(--green-text); }

.td-lugares { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin: .5rem 0; }
.td-lugar { margin: 0; text-align: center; padding: .45rem .7rem; }
.td-lugar .tit { font-size: .68rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin-bottom: .15rem; }
.td-lugar .dir { font-size: .92rem; font-weight: 600; color: var(--text); line-height: 1.35; }
.td-lugar .dir span { font-size: .82rem; font-weight: 500; color: var(--muted); }
.td-lugar .dir span::before { content: " · "; color: var(--border); }
.td-mapa { margin: .5rem 0 0; padding: 0; background: none; border: none; box-shadow: none; }
.td-mapa #mapa-viaje { height: calc(100vh - 600px); min-height: 210px; border-radius: 12px; border: 1px solid var(--border); z-index: 0; }
@media (max-width: 860px) {
    .td-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .td-lugares { grid-template-columns: 1fr; }
    .td-lugar .dir { min-height: 0; }
    .td-mapa #mapa-viaje { height: 300px; }
}

/* Eléctrico vs diésel (pestaña Trayectos) */

.ev-ok { color: var(--green-text); font-weight: 700; }
.ev-ko { color: #dc2626; font-weight: 700; }
.ev-tarjetas { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; margin-bottom: 1rem; }
.ev-tarjetas > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: .7rem .85rem; display: flex; flex-direction: column; gap: .25rem; }
.ev-tarjetas .k { font-size: .68rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.ev-tarjetas .v { font: 700 1.25rem var(--mono); color: var(--text); font-variant-numeric: tabular-nums; }
.ev-bateria { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: .75rem .9rem; margin-bottom: 1rem; }
.ev-bat-top, .ev-bat-bot { display: flex; justify-content: space-between; font-size: .82rem; color: var(--text-2); }
.ev-bat-top { margin-bottom: .45rem; }
.ev-bat-bot { margin-top: .45rem; color: var(--muted); }
.ev-bat-track { height: 12px; background: color-mix(in srgb, var(--muted) 22%, transparent); border-radius: 7px; overflow: hidden; }
.ev-bat-fill { height: 100%; background: linear-gradient(90deg, #15803d, #22c55e); border-radius: 7px; }
table.ev-comp { width: 100%; border-collapse: collapse; }
table.ev-comp th, table.ev-comp td { padding: .5rem .7rem; border-bottom: 1px solid var(--border); font-size: .9rem; }
table.ev-comp th.num, table.ev-comp td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.ev-comp .ev-total td { border-top: 2px solid var(--border); font-weight: 700; }
.ev-hist-wrap { overflow-x: auto; }
table.ev-hist { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.ev-hist th, table.ev-hist td { padding: .35rem .55rem; border-bottom: 1px solid var(--border); font-size: .82rem; white-space: nowrap; }
table.ev-hist th { color: var(--muted); text-transform: uppercase; letter-spacing: .02em; font-size: .68rem; }
table.ev-hist th.num, table.ev-hist td.num { text-align: right; }
.ev-nota { margin-top: .4rem; font-size: .76rem; color: var(--muted); font-style: italic; }
@media (max-width: 720px) { .ev-tarjetas { grid-template-columns: 1fr; } }

.viaje-fila { cursor: pointer; }
table.tarjetas-movil tr.viaje-fila.sel, table.data-table tr.viaje-fila.sel td { background: var(--accent-weak); }
table.tarjetas-movil tr.viaje-fila.sel { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (max-width: 720px) {
    .viajes-totales { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .mapa-trayectos { height: 300px; }
}

/* Cifras del último tramo completo de un eléctrico (Evolución) */
.tramo-cifras { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin: .4rem 0 .6rem; }
.tramo-cifras .v { display: block; font: 700 1.35rem var(--mono); color: var(--text); font-variant-numeric: tabular-nums; }
.tramo-cifras .u { font-size: .78rem; color: var(--muted); }
@media (max-width: 720px) { .tramo-cifras { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Quién lo apuntó desde Telegram (tablas de Flota) */
.apuntado-por { margin-left: .35rem; font-size: .78em; font-weight: 500; color: var(--muted); white-space: nowrap; }

/* En el móvil, cada fila de las tablas de Flota es una tarjeta (sin desplazarse a los lados) */
@media (max-width: 720px) {
    .table-scroll:has(> table.tarjetas-movil) { overflow: visible; }
    .section:has(table.tarjetas-movil) { background: none; border: none; box-shadow: none; padding: 0; }
    .ec-table-wrap:has(> table.tarjetas-movil) { background: none; border: none; box-shadow: none; padding: 0; overflow: visible; }
    table.tarjetas-movil td.actions form { flex: 1; display: flex; }
    table.tarjetas-movil td.actions form .btn { flex: 1; }
    table.tarjetas-movil thead { display: none; }
    table.tarjetas-movil, table.tarjetas-movil tbody { display: block; }
    table.tarjetas-movil tr {
        display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem .7rem;
        padding: .85rem .95rem; margin-bottom: .65rem; border: 1px solid var(--border); border-radius: 12px;
        background: var(--surface); box-shadow: var(--shadow-sm, 0 1px 2px rgba(16, 24, 40, .05));
    }
    table.tarjetas-movil tbody tr:hover td { background: none; }
    table.tarjetas-movil td { display: block; padding: 0; border: none; white-space: normal; font-size: .9rem;
        font-variant-numeric: tabular-nums; overflow-wrap: break-word; min-width: 0; }
    table.tarjetas-movil td::before { content: attr(data-label); display: block; margin-bottom: 1px;
        font-size: .66rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
    table.tarjetas-movil td.vacia { display: none; }
    table.tarjetas-movil td.ancha { grid-column: span 2; }
    table.tarjetas-movil td.completa { grid-column: 1 / -1; }
    /* Primera columna (la fecha) como título de la tarjeta */
    table.tarjetas-movil td:first-child { grid-column: 1 / -1; font-size: 1rem; font-weight: 700;
        padding-bottom: .5rem; border-bottom: 1px solid var(--border); }
    table.tarjetas-movil td:first-child::before { display: none; }
    /* Botones abajo, a lo ancho */
    table.tarjetas-movil td.actions { grid-column: 1 / -1; display: flex; gap: .5rem; padding-top: .6rem;
        margin-top: .1rem; border-top: 1px solid var(--border); }
    table.tarjetas-movil td.actions::before { display: none; }
    table.tarjetas-movil td.actions .btn { flex: 1; justify-content: center; text-align: center; }
}
@media (max-width: 340px) {
    table.tarjetas-movil tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── Formularios ────────────────────────────────────────────────────────── */
.page-narrow { max-width: 880px; margin: 0 auto; }
.form-card { padding: 1.5rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1.5rem; align-items: start; }
.form-card > .field:has(textarea), .form-card > .field:has(input[type="file"]), .form-card > fieldset, .form-card > .actions { grid-column: 1 / -1; }
.field { margin-bottom: 1rem; }
.field-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.field-row .field { flex: 1 1 180px; }

.field label { display: block; font-weight: 550; margin-bottom: .35rem; font-size: .86rem; color: var(--text-2); }
.field .help-text { display: block; color: var(--muted); font-size: .79rem; margin-top: .3rem; }
.field .errorlist { list-style: none; padding: 0; margin: .3rem 0 0; color: var(--red-text); font-size: .84rem; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=time],
input[type=email], input[type=url], input[type=search], input[type=tel], input[type=file], select, textarea {
    width: 100%; padding: .55rem .7rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font: 400 .93rem var(--font);
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
input[type=file] { padding: .4rem; font-size: .85rem; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; }
textarea { min-height: 5rem; resize: vertical; }
.checkbox-field { display: flex; align-items: center; gap: .5rem; }
.checkbox-field input { width: auto; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin: 0 0 1rem; }
legend { padding: 0 .4rem; font-weight: 650; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.adjunto-row { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; border-bottom: 1px dashed var(--border-strong); padding-bottom: .75rem; margin-bottom: .75rem; }
.adjunto-row .field { flex: 1; min-width: 160px; margin-bottom: 0; }
.adjunto-existente { display: flex; justify-content: space-between; align-items: center; padding: .4rem 0; border-bottom: 1px solid var(--border); }
.adjunto-existente:last-child { border-bottom: none; }
.adjunto-icono { display: inline-flex; margin-right: .25rem; }
.adjunto-icono:hover { opacity: .75; }
.form-error { color: var(--red-text); font-weight: 600; }

/* ── Ventanas modales ───────────────────────────────────────────────────── */
dialog.modal {
    border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 1.4rem 1.6rem;
    width: min(640px, 94vw); max-height: 85vh; overflow-y: auto; background: var(--surface); color: var(--text);
}
dialog.modal::backdrop { background: rgba(10, 12, 18, .55); backdrop-filter: blur(2px); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .9rem; }
.modal-header h2 { margin: 0; font-size: 1.08rem; }
.modal-close { background: none; border: none; font-size: 1.15rem; cursor: pointer; color: var(--muted); line-height: 1; padding: .3rem; border-radius: 6px; }
.modal-close:hover { color: var(--text); background: var(--surface-3); }

/* Popup de confirmación (eliminar) */
dialog.modal-confirmar { width: min(400px, 92vw); padding: 1.6rem 1.6rem 1.3rem; text-align: center; }
dialog.modal-confirmar[open] { animation: confirmar-entra .18s cubic-bezier(.2, .8, .2, 1); }
@keyframes confirmar-entra { from { opacity: 0; transform: translateY(6px) scale(.97); } to { opacity: 1; transform: none; } }
.confirmar-icono { width: 48px; height: 48px; margin: 0 auto .9rem; border-radius: 50%; display: grid; place-items: center;
    background: var(--red-weak); color: var(--red-text); box-shadow: 0 0 0 7px color-mix(in srgb, var(--red-weak) 50%, transparent); }
.modal-confirmar h2 { margin: 0 0 .35rem; font-size: 1.12rem; }
.confirmar-detalle { margin: 0 0 .25rem; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.confirmar-aviso { margin: 0 0 1.3rem; color: var(--muted); font-size: .88rem; }
.confirmar-acciones { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.confirmar-acciones .btn { justify-content: center; padding: .6rem; }
.btn-danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger-solid:hover { background: color-mix(in srgb, var(--red) 88%, #000); border-color: color-mix(in srgb, var(--red) 88%, #000); color: #fff; }
.btn-danger-solid:disabled { opacity: .7; cursor: progress; }

/* ── Acceso ─────────────────────────────────────────────────────────────── */
.auth-card { max-width: 400px; margin: 4rem auto; padding: 2rem; box-shadow: var(--shadow-lg); }
.auth-card h1 { font-size: 1.45rem; }
.auth-card .btn { width: 100%; padding: .65rem; }
.auth-card-link { text-align: center; margin: 1rem 0 0; font-size: .85rem; }
.auth-mark { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; margin-bottom: 1rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6); box-shadow: 0 6px 16px -4px rgba(99, 102, 241, .5); }
.auth-sub { color: var(--muted); margin: -.2rem 0 1.4rem; }
body:has(.auth-card.login) .page { min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(1100px 560px at 50% -10%, var(--accent-weak), transparent 70%); max-width: none; }
body:has(.auth-card.login) .auth-card { margin: 0; width: 100%; }

/* ── Gráficas de evolución (Flota) ──────────────────────────────────────── */
.chart-wrap { margin-bottom: 1.5rem; }
.chart-wrap:last-child { margin-bottom: 0; }
.chart-title { font-size: .95rem; font-weight: 700; margin-bottom: 1rem; }
.chart-nota { font-size: .82rem; color: var(--muted); margin: -.5rem 0 .9rem; }
.chart-single { display: flex; align-items: flex-end; justify-content: center; gap: 1.5rem; overflow-x: auto; padding-bottom: .25rem; }
.chart-single-bar { display: flex; flex-direction: column; align-items: center; min-width: 58px; flex-shrink: 0; }
.chart-bars {
    display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: 140px; width: 100%;
    background-image: repeating-linear-gradient(to top, var(--border) 0, var(--border) 1px, transparent 1px, transparent 25%);
}
.chart-bar { width: 18px; border-radius: 5px 5px 0 0; min-height: 3px; cursor: default; transition: filter .15s ease; }
.chart-bar:hover { filter: brightness(1.1); }
.bar-single, .bar-seguro { background: linear-gradient(180deg, #4f97e8, #2a78d6); }
.bar-itv           { background: linear-gradient(180deg, #f0895e, #eb6834); }
.bar-impuesto      { background: linear-gradient(180deg, #8b7cf0, #6553d6); }
.bar-mantenimiento { background: linear-gradient(180deg, #3fc797, #1baf7a); }
.bar-combustible   { background: linear-gradient(180deg, #f4b52e, #eda100); }
.bar-recargas      { background: linear-gradient(180deg, #ee97b8, #e87ba4); }
.bar-ahorro        { background: linear-gradient(180deg, #35c235, #0ca30c); }
.chart-axis-label { font-size: .76rem; color: var(--muted); margin-top: .6rem; font-family: var(--mono); }
.chart-bar-value { font-size: .84rem; font-weight: 700; color: var(--text); margin-bottom: .6rem; white-space: nowrap; font-family: var(--mono); }
.chart-sub { font-size: .72rem; color: var(--muted); margin-top: .2rem; white-space: nowrap; }
.chart-delta, .soc-delta { display: inline-block; font-size: .68rem; font-weight: 700; margin-left: .3rem; padding: .05rem .45rem; border-radius: 999px; font-family: var(--mono); }
.delta-up { color: var(--red-text); background: var(--red-weak); }
.delta-down { color: var(--green-text); background: var(--green-weak); }
.soc-delta { background: var(--surface-3); color: var(--muted); }
.chart-group-titulo { margin: 1.75rem 0 .75rem; font-size: 1rem; }
.chart-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; flex-wrap: wrap; gap: .5rem; }
.chart-section-header .chart-title { margin-bottom: 0; }

/* ── Torre de control (mismo sistema, números en mono) ──────────────────── */
.tc-page {
    --tc-ground: var(--surface-2); --tc-surface: var(--surface); --tc-surface-raised: var(--surface-3); --tc-border: var(--border);
    --tc-ink: var(--text); --tc-ink-muted: var(--muted); --tc-ink-faint: var(--faint); --tc-accent: var(--accent);
    --tc-good: var(--green-text); --tc-good-soft: var(--green-weak); --tc-warn: var(--amber-text); --tc-warn-soft: var(--amber-weak);
    --tc-critical: var(--red-text); --tc-critical-soft: var(--red-weak);
    --tc-cat-seguro: #2a78d6; --tc-cat-itv: #eb6834; --tc-cat-impuesto: #7c6cf0; --tc-cat-mantenimiento: #1baf7a;
    --tc-cat-combustible: #eda100; --tc-cat-recargas: #e87ba4; --tc-cat-neumaticos: #8a8576;
    --tc-shadow: var(--shadow-card);
    color: var(--tc-ink);
}
.tc-page-title { font-weight: 700; }
.tc-page .titulo-con-volver { margin-bottom: 14px; }
.tc-hero {
    background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 7%, var(--surface)), var(--surface) 60%);
    border: 1px solid var(--tc-border); border-radius: var(--radius-lg); padding: 18px clamp(16px, 3vw, 28px); margin-bottom: 14px; box-shadow: var(--tc-shadow);
}
.tc-hero-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tc-hero-eyebrow { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-fg); font-weight: 700; margin-bottom: 2px; }
.tc-year-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.tc-year-chip { font-family: var(--mono); font-size: .72rem; font-weight: 500; color: var(--tc-ink-muted); text-decoration: none; padding: 3px 9px; border-radius: 999px; border: 1px solid transparent; }
.tc-year-chip:hover { border-color: var(--tc-border); color: var(--text); }
.tc-year-chip.active { background: var(--accent); color: var(--accent-text); }
.tc-hero-title { font-weight: 600; font-size: clamp(1.02rem, 1.7vw, 1.25rem); color: var(--tc-ink); margin: 4px 0 16px; letter-spacing: -.01em; text-wrap: balance; }
.tc-hero-stats { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); gap: 16px; text-align: center; }
.tc-hero-stat { border-left: 1px solid var(--tc-border); padding: 0 16px; }
.tc-hero-stat:first-child { border-left: none; padding-left: 0; }
.tc-hero-stat:last-child { padding-right: 0; }
.tc-hero-num { font-family: var(--mono); font-weight: 600; font-size: clamp(1.35rem, 2.4vw, 1.8rem); line-height: 1; color: var(--tc-ink); display: block; letter-spacing: -.02em; }
.tc-hero-stat.urgent .tc-hero-num { color: var(--tc-warn); }
.tc-hero-unit { font-family: var(--mono); font-size: .78rem; color: var(--tc-ink-muted); margin-left: 3px; }
.tc-hero-label { display: block; margin-top: 6px; font-size: .74rem; color: var(--tc-ink-muted); line-height: 1.35; }
.tc-grid-main { display: grid; grid-template-columns: 1.1fr .9fr; gap: 14px; margin-bottom: 14px; }
.tc-panel { background: var(--tc-surface); border: 1px solid var(--tc-border); border-radius: var(--radius-lg); padding: 16px clamp(14px, 3vw, 22px) 16px; box-shadow: var(--tc-shadow); }
.tc-panel h2 { font-weight: 650; font-size: 1rem; margin: 0 0 2px; }
.tc-panel-sub { font-size: .74rem; color: var(--tc-ink-faint); margin: 0 0 10px; }
.tc-timeline { list-style: none; margin: 0; padding: 0; }
.tc-timeline li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--tc-border); }
.tc-timeline li:first-child { border-top: none; padding-top: 0; }
.tc-chip { font-family: var(--mono); font-size: .7rem; font-weight: 500; padding: 3px 7px; border-radius: 999px; white-space: nowrap; text-align: center; min-width: 60px; }
.tc-chip.critical { background: var(--tc-critical-soft); color: var(--tc-critical); }
.tc-chip.warn { background: var(--tc-warn-soft); color: var(--tc-warn); }
.tc-chip.good { background: var(--tc-good-soft); color: var(--tc-good); }
.tc-tl-main { min-width: 0; }
.tc-tl-vehiculo { font-weight: 600; font-size: .86rem; }
.tc-tl-tramite { font-size: .74rem; color: var(--tc-ink-muted); }
.tc-tl-right { text-align: right; }
.tc-tl-fecha { font-family: var(--mono); font-size: .76rem; color: var(--tc-ink-muted); }
.tc-tl-coste { font-family: var(--mono); font-size: .8rem; font-weight: 500; margin-top: 1px; }
.tc-bars { display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px; }
.tc-bar-row { display: grid; grid-template-columns: 104px 1fr auto; align-items: center; gap: 8px; }
.tc-bar-name { font-size: .76rem; color: var(--tc-ink-muted); }
.tc-bar-track { height: 8px; background: var(--tc-surface-raised); border-radius: 99px; overflow: hidden; }
.tc-bar-fill { height: 100%; border-radius: 99px; }
.tc-bar-combustible { background: var(--tc-cat-combustible); }
.tc-bar-seguro { background: var(--tc-cat-seguro); }
.tc-bar-mantenimiento { background: var(--tc-cat-mantenimiento); }
.tc-bar-recargas { background: var(--tc-cat-recargas); }
.tc-bar-impuesto { background: var(--tc-cat-impuesto); }
.tc-bar-itv { background: var(--tc-cat-itv); }
.tc-bar-neumaticos { background: var(--tc-cat-neumaticos); }
.tc-bar-value { font-family: var(--mono); font-size: .76rem; color: var(--tc-ink); text-align: right; min-width: 64px; }
.tc-fleet-health { display: flex; gap: 18px; padding-top: 10px; border-top: 1px solid var(--tc-border); flex-wrap: wrap; }
.tc-fh-item { display: flex; align-items: baseline; gap: 6px; }
.tc-fh-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tc-fh-dot.good { background: var(--green); }
.tc-fh-dot.warn { background: var(--amber); }
.tc-fh-dot.critical { background: var(--red); }
.tc-fh-num { font-family: var(--mono); font-weight: 500; font-size: .88rem; }
.tc-fh-label { font-size: .74rem; color: var(--tc-ink-faint); }
.tc-fleet-section > h2 { font-weight: 650; font-size: 1rem; margin: 6px 0 10px; }
.tc-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.tc-tile {
    position: relative; display: block; background: var(--tc-surface); border: 1px solid var(--tc-border); border-radius: var(--radius-lg);
    padding: 12px 14px 10px; box-shadow: var(--tc-shadow); transition: border-color .15s, transform .15s; text-decoration: none; color: inherit;
}
.tc-tile:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); transform: translateY(-2px); }
.tc-tile-top { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.tc-tile-foto { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; flex-shrink: 0; background: var(--tc-surface-raised); }
.tc-tile-foto-vacia { border: 1px dashed var(--border-strong); }
.tc-tile-info { flex: 1; min-width: 0; }
.tc-tile-name { font-weight: 650; font-size: .92rem; line-height: 1.2; color: var(--tc-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-tile-plate { font-family: var(--mono); font-size: .7rem; color: var(--tc-ink-faint); margin-top: 2px; }
.tc-status-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.tc-status-dot.good { background: var(--green); box-shadow: 0 0 0 3px var(--green-weak); }
.tc-status-dot.warn { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-weak); }
.tc-status-dot.critical { background: var(--red); box-shadow: 0 0 0 3px var(--red-weak); }
.tc-status-dot.none { background: var(--gray-dot); box-shadow: 0 0 0 3px var(--surface-3); }
.tc-tile-row { display: flex; justify-content: space-between; align-items: baseline; font-size: .76rem; padding: 3px 0; border-top: 1px solid var(--tc-border); }
.tc-tile-row:first-of-type { border-top: none; }
.tc-tile-row .k { color: var(--tc-ink-faint); }
.tc-tile-row .v { font-family: var(--mono); color: var(--tc-ink); text-align: right; }
.tc-tile-row .v.warn { color: var(--tc-warn); }
.tc-tile-exempt { font-size: .72rem; color: var(--tc-ink-faint); font-style: italic; padding: 3px 0; }

/* ── Vista previa tipo "papel" (HTML de correo/PDF con colores propios) ── */
 .informe-preview-card {
    background: #ffffff !important; color: #1f2430; color-scheme: light; border-color: #e4e7ec !important;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .page, .topbar-inner { padding-left: 22px; padding-right: 22px; }
}
@media (max-width: 1080px) {
    .main-nav a span, .topbar-link span, .user-chip span { display: none; }
    .main-nav a { padding: 8px 10px; }
}
@media (max-width: 900px) {
    .tc-grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .topbar-inner { flex-wrap: wrap; height: auto; padding: 10px 16px 0; gap: 10px; }
    .brand { order: 1; }
    .topbar-actions { order: 2; margin-left: auto; }
    /* Menú principal como barra de iconos con su nombre debajo: caben todas las secciones sin desplazar */
    .main-nav { order: 3; flex-basis: 100%; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
        gap: 2px; padding-bottom: 8px; }
    .main-nav a { flex-direction: column; justify-content: center; gap: 3px; padding: 6px 2px; font-size: 11.5px; }
    .main-nav a span { display: inline; max-width: 100%; text-align: center; line-height: 1.15; white-space: normal; hyphens: auto; overflow-wrap: anywhere; }
    .theme-switch { display: none; }
    .page { padding: 20px 16px 72px; }
}
@media (max-width: 760px) {
    .hub-header { margin: 1.5rem 0 1.75rem; }
    .hub-header h1 { font-size: 1.9rem; }
    .hub-tile { min-height: 190px; padding: 2rem 1.25rem; }
    .tc-hero-stats { grid-template-columns: repeat(2, 1fr); row-gap: 20px; }
    .tc-hero-stat:nth-child(3) { border-left: none; padding-left: 0; }
    .tc-timeline li { grid-template-columns: auto 1fr; }
    .tc-tl-right { grid-column: 2; text-align: left; padding-left: 0; margin-top: -4px; }
}
@media (max-width: 640px) {
    .page-header { flex-direction: column; align-items: stretch; }
    .actions-column { width: 100%; }
}

/* ── Seguimiento (incidentes, estilo Pasithea) ──────────────────────────── */
:root {
    --pa-orange: #ea580c; --pa-violet: #7c3aed; --pa-sky: #0284c7; --pa-amber: #d97706;
    --pa-emerald: #059669; --pa-red: #dc2626;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --pa-orange: #fb923c; --pa-violet: #a78bfa; --pa-sky: #38bdf8; --pa-amber: #fbbf24;
        --pa-emerald: #34d399; --pa-red: #f87171;
    }
}
:root[data-theme="dark"] {
    --pa-orange: #fb923c; --pa-violet: #a78bfa; --pa-sky: #38bdf8; --pa-amber: #fbbf24;
    --pa-emerald: #34d399; --pa-red: #f87171;
}
.t-orange { --t: var(--pa-orange); } .t-violet { --t: var(--pa-violet); } .t-sky, .t-chip-sky, .t-btn-sky { --t: var(--pa-sky); }
.t-amber, .t-chip-amber, .t-btn-amber { --t: var(--pa-amber); } .t-stone { --t: var(--text-2); }
.pa-int-baja { --t: var(--pa-emerald); } .pa-int-media { --t: var(--pa-amber); } .pa-int-alta { --t: var(--pa-red); }

.pa { max-width: 42rem; margin: 0 auto; }
.pa-estrecho { max-width: 40rem; }
.pa-ancho { max-width: 56rem; }
.pa-top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.6rem; }
.pa-back { display: inline-flex; align-items: center; gap: .3rem; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
    border-radius: 999px; padding: .5rem 1rem; font-size: .9rem; font-weight: 500; text-decoration: none; transition: background .15s, border-color .15s; }
.pa-back:hover { background: var(--surface-3); border-color: var(--faint); }
.pa-btn { display: inline-flex; align-items: center; gap: .35rem; background: var(--text); color: var(--surface); border-radius: 999px; padding: .5rem 1rem;
    font-size: .9rem; font-weight: 600; text-decoration: none; }
.pa-paso-txt { color: var(--faint); font-size: .9rem; }
.pa-title { text-align: center; font-size: 1.5rem; font-weight: 500; margin: 0 0 1.5rem; }
.pa-resumen { text-align: center; color: var(--muted); margin: .25rem 0 1.5rem; }

/* Tarjetas grandes (portada y categorías) */
.pa-cards { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
.pa-card { display: flex; flex-direction: column; align-items: center; gap: .9rem; text-align: center; padding: 2.5rem 2rem; text-decoration: none;
    background: var(--surface); border: 1px solid var(--border); border-radius: 1.5rem; color: var(--text);
    transition: transform .15s, box-shadow .15s, border-color .15s; }
.pa-card:hover { transform: translateY(-2px) scale(1.015); border-color: var(--border-strong); box-shadow: var(--shadow-lg); }
.pa-card:active { transform: scale(.99); }
.pa-card-title { font-size: 1.5rem; font-weight: 600; }
.pa-card-desc { color: var(--muted); font-size: 1rem; }
.pa-badge { display: flex; align-items: center; justify-content: center; width: 5.5rem; height: 5.5rem; border-radius: 1.25rem;
    color: var(--t); background: color-mix(in srgb, var(--t) 14%, transparent); }
.pa-badge-sm { width: 3.75rem; height: 3.75rem; border-radius: 1rem; }
.pa-badge-xs { width: 3rem; height: 3rem; border-radius: .9rem; flex-shrink: 0; }
.pa-cards-sm .pa-card { padding: 1.75rem 1.5rem; border-radius: 1.25rem; }
.pa-cards-sm .pa-card-title { font-size: 1.1rem; font-weight: 550; }
.pa-cards-sm .pa-card-desc { font-size: .9rem; }
.pa-seccion { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 .75rem; }
@media (min-width: 640px) {
    .pa-cards { grid-template-columns: 1fr 1fr; }
    
}

/* Asistente */
.pa-edit-head { display: flex; align-items: center; justify-content: space-between; margin: -.5rem 0 1.5rem; }
.pa-edit-head h1 { margin: 0; font-size: 1.3rem; font-weight: 500; }
.pa-link-borrar { display: inline-flex; align-items: center; gap: .3rem; color: var(--red-text); font-size: .9rem; text-decoration: none; }
.pa-paso { display: flex; flex-direction: column; gap: 2.5rem; }
.pa-paso[hidden] { display: none; }
.pa-q { border-radius: .9rem; }
.pa-label { display: block; font-size: 1.125rem; font-weight: 500; color: var(--text); margin: 0 0 .75rem; }
.pa-label-sub { font-weight: 400; color: var(--muted); font-size: 1rem; }
.pa-grupo { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 1rem 0 .5rem; }
.pa-q .pa-grupo:first-of-type, .pa-ancho .pa-grupo:first-of-type { margin-top: 0; }
.pa-hint { color: var(--faint); font-size: .875rem; margin: -.4rem 0 .9rem; }
.pa-opciones { display: grid; gap: .5rem; border-radius: .9rem; }
.pa-col2 { grid-template-columns: 1fr 1fr; }
.pa-col3 { grid-template-columns: repeat(3, 1fr); }
.pa-chip { position: relative; display: flex; align-items: center; justify-content: center; text-align: center; min-height: 3.6rem;
    padding: .9rem 1rem; border: 1px solid var(--border-strong); border-radius: .9rem; background: var(--surface); color: var(--text-2);
    font-size: 1rem; font-weight: 500; cursor: pointer; user-select: none; transition: transform .15s, background .15s, border-color .15s; }
.pa-chip:hover { transform: scale(1.02); border-color: var(--faint); background: var(--surface-2); }
.pa-chip:active { transform: scale(.98); }
.pa-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.pa-chip:has(input:checked) { background: var(--text); border-color: var(--text); color: var(--surface); box-shadow: var(--shadow-sm); }
.pa-chip:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--accent-ring); }
.pa-chip-grande { min-height: 5rem; font-size: 1.3rem; font-weight: 600; }
.pa-chip.pa-int-baja, .pa-chip.pa-int-media, .pa-chip.pa-int-alta { border-bottom: 4px solid var(--t); }
.pa-chip[class*="pa-int-"]:has(input:checked) { background: var(--t); border-color: var(--t); color: #fff; }
.pa-input { width: 100%; border: 1px solid var(--border-strong); border-radius: .9rem; padding: 1rem; font-size: 1rem; background: var(--surface); color: var(--text); }
textarea.pa-input { min-height: 0; }
.pa-si { margin-top: .75rem; }
.pa-si[hidden] { display: none; }
.pa-si .pa-label { font-size: 1rem; }
.pa-mal .pa-opciones { box-shadow: 0 0 0 2px var(--pa-red); }
.pa-mal .pa-opciones:has(input:checked) { box-shadow: none; }
.pa-mal > .pa-input, .pa-mal .pa-si .pa-input { border-color: var(--pa-red); box-shadow: 0 0 0 2px var(--pa-red); }
.pa-err { color: var(--pa-red); font-size: .875rem; margin: .5rem 0 0; }
.pa-err[hidden] { display: none; }
.pa-aviso { background: var(--red-weak); color: var(--red-text); border-radius: .6rem; padding: .6rem .8rem; }
.pa-cuando { color: var(--muted); font-size: .95rem; margin-top: -1rem; }
.pa-cuando summary { cursor: pointer; }
.pa-cuando strong { color: var(--text-2); font-weight: 600; }
.pa-cuando .pa-input { margin-top: .75rem; max-width: 18rem; }
.pa-next { width: 100%; border: 0; border-radius: .9rem; background: var(--text); color: var(--surface); padding: 1.15rem; font-size: 1.1rem;
    font-weight: 500; cursor: pointer; transition: opacity .15s; }
.pa-next:hover { opacity: .88; }

/* Histórico */
.pa-pills { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1.5rem; }
.pa-pill { border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); border-radius: 999px; padding: .4rem .9rem;
    font-size: .875rem; font-weight: 500; text-decoration: none; }
.pa-pill.on { color: var(--t); background: color-mix(in srgb, var(--t) 14%, transparent); border-color: transparent; }
.pa-pill-quitar { font-size: .85rem; color: var(--muted); }
.pa-mes { display: flex; align-items: center; gap: .5rem; font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
    color: var(--muted); margin: 1.6rem 0 .6rem; }
.pa-mes span { background: var(--surface-3); border-radius: 999px; padding: 0 .5rem; font-size: .75rem; }
.pa-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .75rem; }
.pa-tag { border-radius: 999px; padding: .15rem .65rem; font-size: .78rem; font-weight: 600; color: var(--t); background: color-mix(in srgb, var(--t) 14%, transparent); }
.pa-res { display: inline-block; border-radius: 6px; padding: .05rem .45rem; font-size: .75rem; font-weight: 600; letter-spacing: 0; text-transform: none;
    color: var(--t); background: color-mix(in srgb, var(--t) 14%, transparent); }
.pa-res-si { --t: var(--pa-emerald); } .pa-res-parte { --t: var(--pa-amber); } .pa-res-no { --t: var(--pa-red); } .pa-res-info { --t: var(--pa-violet); }
.pa-inc { background: var(--surface); border: 1px solid var(--border); border-radius: 1rem; overflow: hidden; transition: box-shadow .15s, border-color .15s; }
.pa-inc:hover, .pa-inc[open] { box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--t) 35%, var(--border)); }
.pa-inc > summary { list-style: none; display: flex; gap: .9rem; align-items: flex-start; padding: .9rem 1rem; cursor: pointer; }
.pa-inc > summary::-webkit-details-marker { display: none; }
.pa-inc-dia { flex: none; width: 3.1rem; padding: .45rem 0 .4rem; border-radius: .75rem; text-align: center; display: flex; flex-direction: column;
    background: color-mix(in srgb, var(--t) 13%, transparent); color: var(--t); box-shadow: inset 0 -3px 0 var(--t); }
.pa-inc-dia strong { font-size: 1.35rem; line-height: 1.1; font-weight: 650; }
.pa-inc-dia small { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.pa-inc-cab { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .45rem; }
.pa-inc-l1 { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .9rem; font-size: .85rem; color: var(--muted); }
.pa-inc-l1 > span:not(.pa-tag) { display: inline-flex; align-items: center; gap: .3rem; }
.pa-inc-l1 .pa-tag { margin-left: auto; }
.pa-inc-lugar { color: var(--text-2); font-weight: 500; }
.pa-inc-chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.pa-inc-chips span { font-size: .75rem; padding: .15rem .55rem; border-radius: 999px; color: var(--pa-orange);
    background: color-mix(in srgb, var(--pa-orange) 11%, transparent); }
.pa-inc-resumen { color: var(--text-2); font-size: .92rem; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pa-inc[open] .pa-inc-resumen, .pa-inc[open] .pa-inc-marcas { display: none; }
.pa-inc-marcas { display: flex; flex-wrap: wrap; gap: .35rem; }
.pa-inc-flecha { flex: none; color: var(--faint); align-self: center; transition: transform .2s; }
.pa-inc[open] .pa-inc-flecha { transform: rotate(90deg); }
.pa-inc-cuerpo { padding: .25rem 1rem 1rem 5rem; }
.pa-inc-sec { position: relative; padding: 0 0 .9rem 1.1rem; border-left: 2px solid var(--border); }
.pa-inc-sec::before { content: ""; position: absolute; left: -6px; top: .3rem; width: 10px; height: 10px; border-radius: 50%;
    background: var(--surface); border: 2px solid var(--t); }
.pa-inc-sec h3 { display: flex; align-items: center; gap: .5rem; margin: 0 0 .25rem; font-size: .72rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.pa-inc-sec p { margin: 0; color: var(--text); font-size: .93rem; line-height: 1.55; }
.pa-inc-sec blockquote { margin: 0; padding: .5rem .75rem; border-radius: .6rem; font-style: italic; color: var(--text-2);
    background: color-mix(in srgb, var(--pa-violet) 8%, transparent); }
.pa-inc-sancion p { display: inline-block; padding: .3rem .6rem; border-radius: .5rem; background: var(--red-weak); color: var(--red-text); }
.pa-inc-sancion::before { border-color: var(--pa-red); }
.pa-inc-pie { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding-top: .75rem;
    border-top: 1px solid var(--border); font-size: .8rem; color: var(--muted); }
.pa-inc-pie span::first-letter { text-transform: uppercase; }
.pa-inc-pie .pa-pill { display: inline-flex; align-items: center; gap: .3rem; color: var(--text-2); }
@media (max-width: 560px) {
    .pa-inc > summary { gap: .7rem; padding: .8rem .8rem; }
    .pa-inc-cuerpo { padding: .25rem .9rem 1rem 1.1rem; }
}
.pa-vacio { color: var(--muted); text-align: center; padding: 2rem 0; }

/* Catálogos */
.pa-cat-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.pa-cat-head h1 { margin: 0; font-size: 1.5rem; font-weight: 500; }
.pa-cat-head p { margin: .2rem 0 0; color: var(--muted); font-size: .9rem; }
.pa-itemgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
@media (min-width: 640px) { .pa-itemgrid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .pa-itemgrid { grid-template-columns: repeat(4, 1fr); } }
.pa-itembtn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; min-height: 4.5rem; padding: .9rem;
    text-align: center; border-radius: .9rem; border: 1px solid color-mix(in srgb, var(--t) 30%, transparent);
    background: color-mix(in srgb, var(--t) 8%, var(--surface)); color: var(--text); font-weight: 500; text-decoration: none; transition: box-shadow .15s, transform .15s; }
.pa-itembtn:hover { border-color: var(--t); box-shadow: var(--shadow-card); }
.pa-itembtn:active { transform: scale(.98); }
.pa-itembtn.off { background: var(--surface-3); border-color: var(--border); color: var(--faint); }
.pa-itembtn small { font-size: .72rem; }
.pa-addbar { position: sticky; bottom: 0; z-index: 20; display: flex; gap: .6rem; margin: 1.5rem -1rem 0; padding: 1rem;
    background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -6px 16px rgba(0, 0, 0, .05); }
.pa-addbar .pa-input { flex: 1; min-width: 0; padding: .85rem 1rem; }
.pa-addbar .pa-add-sel { flex: 0 1 13rem; }
.pa-add-btn { border: 0; border-radius: .9rem; padding: .85rem 1.5rem; font-size: 1rem; font-weight: 500; color: #fff; background: var(--t); cursor: pointer; }
.pa-add-btn:hover { filter: brightness(.92); }
.pa-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 1.25rem; padding: 1.5rem; }
@media (max-width: 640px) {
    .pa-col3 { gap: .4rem; }
    .pa-chip-grande { font-size: 1.1rem; }
    .pa-addbar { flex-wrap: wrap; }
    .pa-addbar .pa-add-sel { flex-basis: 100%; }
}

/* Seguimiento · Evolución */
.pa-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; margin-bottom: 1.5rem; }
.pa-kpi { background: var(--surface); border: 1px solid var(--border); border-radius: .9rem; padding: 1rem .5rem;
    text-align: center; display: flex; flex-direction: column; gap: .2rem; }
.pa-kpi strong { font-size: 1.5rem; font-weight: 600; color: var(--t, var(--text)); }
.pa-kpi span { font-size: .75rem; color: var(--muted); }
.pa-graf { margin-bottom: 1rem; padding: 1.1rem 1.1rem 1.25rem; }
.pa-graf h2 { font-size: 1rem; font-weight: 500; margin: 0 0 .9rem; }
.pa-graf .pa-graf-sub { font-size: .75rem; color: var(--muted); margin: -.7rem 0 .9rem; }
.pa-graf .pa-vacio { padding: .25rem 0; text-align: left; font-size: .875rem; }
.pa-barras { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: .4rem; align-items: end; height: 190px; }
.pa-barra { display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }
.pa-barra-num { font-size: .7rem; color: var(--muted); height: 1rem; }
.pa-barra-pila { flex: 1; width: 100%; max-width: 2.5rem; display: flex; flex-direction: column-reverse; border-bottom: 1px solid var(--border-strong); }
.pa-barra-pila i { display: block; background: var(--t); }
.pa-barra-pila i:last-child { border-radius: 4px 4px 0 0; }
.pa-barra-et { font-size: .68rem; color: var(--muted); margin-top: .35rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pa-leyenda { display: flex; gap: 1rem; justify-content: center; margin-top: .9rem; font-size: .75rem; color: var(--muted); }
.pa-leyenda span { display: inline-flex; align-items: center; gap: .35rem; }
.pa-leyenda i { width: .7rem; height: .7rem; border-radius: 3px; background: var(--t); }
.pa-rank { display: flex; flex-direction: column; gap: .75rem; }
.pa-rank-txt { display: flex; justify-content: space-between; gap: .5rem; font-size: .875rem; color: var(--text-2); margin-bottom: .25rem; }
.pa-rank-txt strong { font-weight: 500; color: var(--text); }
.pa-rank-pista { height: 1.1rem; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.pa-rank-pista i { display: block; height: 100%; border-radius: 999px; background: color-mix(in srgb, var(--t) 75%, transparent); }
@media (max-width: 560px) {
    .pa-kpis { grid-template-columns: repeat(2, 1fr); }
    .pa-barras { gap: .2rem; }
}

/* --- Comparativa EV vs diésel (flota/comparativa_page.html) --- */
.cmp { max-width: var(--content-width); margin: 0 auto; }
.cmp-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.cmp-head h1 { font-size: 1.35rem; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.cmp-sub { color: var(--muted); font-size: .85rem; margin: 2px 0 0; }
.cmp-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.cmp .kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 16px 18px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 4px; }
.cmp .kpi-hero { background: linear-gradient(135deg, var(--accent), var(--accent-hover)); border-color: transparent; color: var(--accent-text); }
.cmp .kpi-hero .kpi-lbl, .cmp .kpi-hero .kpi-sub { color: rgba(255,255,255,.82); }
.cmp .kpi-lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.cmp .kpi-val { font-family: var(--mono); font-size: 1.55rem; font-weight: 600; letter-spacing: -.02em; }
.cmp .kpi-sub { font-size: .8rem; color: var(--muted); }
.cmp .batt-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.cmp .batt-stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.cmp .batt-stat.prev { border-left: 3px solid var(--amber); }
.cmp .batt-stat.user { border-left: 3px solid var(--green); }
.cmp .batt-stat.tot { border-left: 3px solid var(--accent); }
.cmp .batt-n { font-family: var(--mono); font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; }
.cmp .batt-l { font-size: .78rem; color: var(--text-2); }
.cmp .batt-l em { color: var(--muted); font-style: normal; }
@media (max-width: 560px) { .cmp .batt-stats { grid-template-columns: 1fr; } }
.cmp .batt-track { height: 16px; border-radius: 999px; background: var(--surface-3); display: flex; overflow: hidden; border: 1px solid var(--border); }
.cmp .batt-prev { background: var(--amber); }
.cmp .batt-user { background: var(--green); }

.cmp .dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.cmp-selector { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.cmp-selector label { font-weight: 650; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.cmp-select { position: relative; display: inline-flex; }
.cmp-select select { appearance: none; -webkit-appearance: none; padding: 10px 40px 10px 15px; border: 1px solid var(--border-strong);
    border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; font-size: .9rem; font-weight: 550;
    min-width: 220px; cursor: pointer; box-shadow: var(--shadow-sm); transition: border-color .12s, box-shadow .12s; }
.cmp-select select:hover { border-color: var(--accent); }
.cmp-select select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.cmp-select svg { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.cmp-mini { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 16px; }
.cmp-mini > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 11px 13px; }
.cmp-mini .l { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.cmp-mini .v { font-family: var(--mono); font-size: 1.1rem; font-weight: 600; margin-top: 3px; }
.cmp-mini .v.pos { color: var(--green-text); }
table.cmp-t th, table.cmp-t td { text-align: right; }
table.cmp-t th:first-child, table.cmp-t td:first-child { text-align: left; }
table.cmp-t td.num { font-family: var(--mono); }
table.cmp-t .pos { color: var(--green-text); font-weight: 600; }
table.cmp-t tfoot td { font-weight: 700; border-top: 2px solid var(--border-strong); border-bottom: none; }
.cmp-t-wrap { overflow-x: auto; }
.cmp .ev-col { color: var(--accent-fg); }
.cmp .di-col { color: var(--amber-text); }
.cmp .section-header .meta { color: var(--muted); font-size: .82rem; font-family: var(--mono); }
.cmp-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.cmp-charts .section { margin-bottom: 0; }
@media (max-width: 760px) { .cmp-charts { grid-template-columns: 1fr; } }
.cmp .chart-box { position: relative; height: 240px; }
.cmp-note { color: var(--muted); font-size: .76rem; margin: 10px 0 0; line-height: 1.5; }
.cmp-proy { background: linear-gradient(135deg, var(--accent-weak), var(--surface)); }
.cmp .proy-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.cmp .proy-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 16px; text-align: center; box-shadow: var(--shadow-sm); }
.cmp .proy-anios { display: block; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; }
.cmp .proy-val { display: block; font-family: var(--mono); font-size: 1.45rem; font-weight: 600; color: var(--green-text); margin-top: 6px; letter-spacing: -.02em; }
@media (max-width: 640px) { .cmp .proy-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .cmp-head h1 { font-size: 1.15rem; } .cmp .kpi-val { font-size: 1.3rem; } }

/* ── Ajustes: menú lateral + un apartado a la vez ───────────────────────── */
.ajx { --nav-w: 280px; max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr);
    background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-card); min-height: calc(100vh - 140px); overflow: hidden; }
.ajx .t-general { --tono: var(--accent); --tono-txt: var(--accent-fg); --tono-weak: var(--accent-weak); }
.ajx .t-energia { --tono: var(--amber); --tono-txt: var(--amber-text); --tono-weak: var(--amber-weak); }
.ajx .t-conexiones { --tono: var(--blue); --tono-txt: var(--blue-text); --tono-weak: var(--blue-weak); }

/* Menú */
.ajx-nav { background: var(--surface-2); border-right: 1px solid var(--border); padding: 22px 14px; display: flex; flex-direction: column; gap: 2px; }
.ajx-nav-top { padding: 0 6px 14px; }
.ajx-nav-top h1 { font-size: 1.45rem; font-weight: 800; letter-spacing: -.025em; margin: 0 0 14px; }
.aj-search { display: flex; align-items: center; gap: 8px; padding: 0 10px; height: 36px; color: var(--faint);
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px; transition: border-color .15s, box-shadow .15s; }
.aj-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); color: var(--accent-fg); }
.aj-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font: inherit; font-size: .86rem; padding: 0; box-shadow: none; height: auto; }
.aj-search kbd { font-family: var(--mono); font-size: .68rem; color: var(--muted); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: var(--surface-2); }
.ajx-grupo { margin-top: 14px; display: flex; flex-direction: column; gap: 2px; }
.ajx-grupo-titulo { font-size: .68rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); padding: 0 10px 6px; }
.ajx-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; color: var(--text-2); text-decoration: none; transition: background .12s, color .12s; }
.ajx-item:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.ajx-item.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.ajx-item-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0;
    background: var(--tono-weak, var(--surface-3)); color: var(--tono-txt, var(--text-2)); }
.ajx-item-txt { flex: 1; min-width: 0; font-size: .88rem; font-weight: 600; line-height: 1.2; }
.ajx-item-txt small { display: block; font-size: .72rem; font-weight: 500; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ajx-item-cuenta { font-size: .72rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.ajx-chev { display: none; color: var(--faint); }
.ajx-vacio { font-size: .82rem; color: var(--muted); padding: 10px; margin: 0; }

.aj-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--gray-dot); }
.aj-dot.n-ok, .aj-dot.n-sync { background: var(--green); box-shadow: 0 0 0 3px var(--green-weak); }
.aj-dot.n-aviso { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-weak); }
.aj-dot.n-off { background: var(--gray-dot); box-shadow: 0 0 0 3px var(--surface-3); }
.aj-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: .74rem; font-weight: 600;
    white-space: nowrap; background: var(--surface-3); color: var(--muted); flex-shrink: 0; }
.aj-pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.aj-pill.n-ok { background: var(--green-weak); color: var(--green-text); }
.aj-pill.n-sync { background: var(--blue-weak); color: var(--blue-text); }
.aj-pill.n-sync i { animation: aj-latido 1.2s ease-in-out infinite; }
.aj-pill.n-aviso { background: var(--amber-weak); color: var(--amber-text); }
@keyframes aj-latido { 50% { opacity: .25; transform: scale(.7); } }
.aj-meta { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.aj-meta li { font-size: .76rem; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); padding: 3px 9px; border-radius: 7px; font-variant-numeric: tabular-nums; }
.aj-meta li.mal { color: var(--red-text); background: var(--red-weak); border-color: transparent; }

/* Contenido */
.ajx-main { padding: 30px 36px 40px; min-width: 0; }
.ajx-panel { max-width: 760px; animation: ajx-entra .2s ease-out; }
@keyframes ajx-entra { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.ajx-panel .messages { margin: 0 0 18px; }
.ajx-panel .message { margin-bottom: 14px; }

/* Resumen */
.ajr-hero { display: flex; align-items: center; gap: 22px; padding: 22px 24px; border-radius: 16px; border: 1px solid var(--border);
    background: radial-gradient(120% 160% at 0% 0%, var(--accent-weak), transparent 60%), var(--surface); margin-bottom: 8px; }
.ajr-hero h2 { margin: 0 0 4px; font-size: 1.2rem; font-weight: 700; letter-spacing: -.01em; }
.ajr-hero p { margin: 0; color: var(--muted); font-size: .88rem; }
.aj-ring { --pct: 0; width: 76px; height: 76px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center;
    background: conic-gradient(var(--green) calc(var(--pct) * 1%), var(--surface-3) 0); }
.aj-ring > span { width: 60px; height: 60px; border-radius: 50%; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; }
.aj-ring strong { font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.aj-ring small { font-size: .66rem; color: var(--muted); }
.ajr-titulo { font-size: .72rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); margin: 26px 0 8px; }
.ajr-lista { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.ajr-fila { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: var(--muted); text-decoration: none; border-top: 1px solid var(--border); transition: background .12s; }
.ajr-fila:first-child { border-top: 0; }
.ajr-fila:hover { background: var(--surface-2); text-decoration: none; }
.ajr-fila-ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; background: var(--tono-weak, var(--surface-3)); color: var(--tono-txt, var(--text-2)); }
.ajr-fila-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ajr-fila-txt b { color: var(--text); font-size: .9rem; font-weight: 600; }
.ajr-fila-txt small { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }

/* Apartado */
.ajp-volver { display: none; align-items: center; gap: 4px; border: 0; background: none; color: var(--accent-fg); font: inherit; font-size: .88rem; font-weight: 600; padding: 0; margin-bottom: 16px; cursor: pointer; }
.ajp-head { padding-bottom: 22px; margin-bottom: 22px; border-bottom: 1px solid var(--border); }
.ajp-head-fila { display: flex; align-items: center; gap: 16px; }
.ajp-ico { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; flex-shrink: 0; color: var(--accent-fg);
    background: linear-gradient(145deg, var(--accent-weak), color-mix(in srgb, var(--accent) 16%, var(--surface))); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent); }
.ajp-head-txt { flex: 1; min-width: 0; }
.ajp-head h2 { margin: 0; font-size: 1.4rem; font-weight: 800; letter-spacing: -.02em; }
.ajp-head p { margin: 3px 0 0; color: var(--muted); font-size: .9rem; }
.ajp-bloque { border: 1px solid var(--border); border-radius: 14px; padding: 20px 22px; margin-bottom: 16px; background: var(--surface); }
.ajp-bloque h3 { margin: 0 0 14px; font-size: .98rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.ajp-bloque-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.ajp-bloque-head h3 { margin: 0; }
.ajp-bloque-aviso { border-color: color-mix(in srgb, var(--amber) 45%, var(--border)); background: var(--amber-weak); }
.ajp-bloque .actions { margin-top: 6px; }
.ajp-num { font-size: .72rem; font-weight: 700; color: var(--muted); background: var(--surface-3); border-radius: 999px; padding: 1px 8px; }
.ajp-fila-dato { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.ajp-fila-dato span { color: var(--muted); }
.ajp-fila-dato + .actions { margin-top: 16px; }
.ajp-nota { font-size: .82rem; color: var(--muted); margin: 0; }
/* Fichas de informes y avisos */
.inf-activo { display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin-bottom: 16px; border-radius: 14px; cursor: pointer;
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, var(--surface)), var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border)); }
.inf-activo b { display: block; font-size: .98rem; }
.inf-activo small { color: var(--muted); font-size: .82rem; }
.inf-sw { position: relative; flex: none; width: 46px; height: 26px; }
.inf-sw input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.inf-sw i { position: absolute; inset: 0; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--border-strong); transition: background .2s; }
.inf-sw i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); transition: transform .2s; }
.inf-sw input:checked + i { background: var(--accent); border-color: var(--accent); }
.inf-sw input:checked + i::after { transform: translateX(20px); }
.inf-sw input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.inf-canales { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.inf-canal { position: relative; cursor: pointer; }
.inf-canal input { position: absolute; top: 12px; right: 12px; }
.inf-canal-c { display: flex; flex-direction: column; gap: 3px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); transition: border-color .15s, background .15s, box-shadow .15s; }
.inf-canal-c .i { color: var(--muted); }
.inf-canal-c small { color: var(--muted); font-size: .8rem; }
.inf-canal input:checked + .inf-canal-c { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.inf-canal input:checked + .inf-canal-c .i { color: var(--accent); }
.inf-dest { margin-top: 12px; }
.inf-pie { display: flex; flex-direction: column; gap: 10px; }
.inf-ultimo { display: flex; align-items: center; gap: 8px; font-size: .86rem; padding: 10px 14px; border-radius: 10px; background: var(--surface-2); }
.inf-ultimo i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.inf-ultimo.ok i { background: #10b981; } .inf-ultimo.error i { background: #ef4444; } .inf-ultimo.espera i { background: #f59e0b; }
.inf-ultimo.error { color: #b91c1c; }
.inf-form:has(.inf-activo input:not(:checked)) .ajp-bloque { opacity: .55; }
.ajp-ayuda { border-radius: 14px; padding: 16px 18px; background: var(--surface-2); border: 1px dashed var(--border-strong); }
.ajp-ayuda h4 { margin: 0 0 6px; font-size: .8rem; font-weight: 700; display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.ajp-ayuda p { margin: 0; font-size: .84rem; line-height: 1.6; color: var(--muted); }
.ajx .form-hint { color: var(--muted); font-size: .82rem; line-height: 1.5; margin: 0 0 .9rem; }
.ajx code, dialog.modal code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; font-size: .85em; }
.ajp-historial { max-height: 300px; overflow-y: auto; }
.ajp-historial table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.ajp-historial tr { border-bottom: 1px solid var(--border); }
.ajp-historial td { padding: 6px 8px 6px 0; vertical-align: top; }
.ajp-historial .h-fecha { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.ajp-historial .h-estado { white-space: nowrap; font-weight: 600; }
.ajp-historial .h-msg { color: var(--muted); word-break: break-word; }
.h-ok { color: var(--green-text); } .h-mal { color: var(--red-text); } .h-aviso { color: var(--amber-text); } .h-neutro { color: var(--faint); }
.sensor-list { display: flex; flex-direction: column; }
.sensor-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 2px; border-top: 1px solid var(--border); }
.sensor-row:first-child { border-top: none; }
.sensor-row-main { min-width: 0; }
.sensor-row-label { font-weight: 600; font-size: .9rem; line-height: 1.35; word-break: break-word; }
.sensor-row-sub { font-size: .74rem; color: var(--faint); margin-top: 2px; word-break: break-all; }
.sensor-row-sub code { background: none; padding: 0; }
.btn-inline-edit { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--border); background: none; color: var(--muted); cursor: pointer; flex-shrink: 0; }
.btn-inline-edit:hover { color: var(--accent-fg); border-color: var(--accent); background: var(--accent-weak); }

/* Móvil: como los ajustes del teléfono — lista y, al tocar, el apartado a pantalla completa */
@media (max-width: 860px) {
    .ajx { grid-template-columns: 1fr; border: 0; box-shadow: none; background: none; border-radius: 0; min-height: 0; overflow: visible; }
    .ajx-nav { border: 0; background: none; padding: 0; }
    .ajx-nav-top { padding: 0 0 6px; }
    .ajx-item-resumen { display: none; }
    .ajx-grupo { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 4px; }
    .ajx-grupo-titulo { padding: 10px 10px 4px; }
    .ajx-item { padding: 10px; }
    .ajx-item.on { box-shadow: none; background: none; }
    .ajx-chev { display: block; }
    .ajx-main { padding: 0; }
    .ajx-main #resumen { display: none; }
    .ajx.en-panel .ajx-nav { display: none; }
    .ajx:not(.en-panel) .ajx-main { display: none; }
    .ajp-volver { display: inline-flex; }
    .ajp-head-fila { flex-wrap: wrap; }
    .ajp-head-fila { gap: 6px 14px; }
    .ajp-head-txt { flex-basis: calc(100% - 70px); }
    .ajp-head-fila .aj-pill { order: 3; margin-left: 66px; }
    .ajp-head h2 { font-size: 1.25rem; }
    .ajp-bloque { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { .ajx-panel { animation: none; } .aj-pill.n-sync i { animation: none; } }

/* ── Energía: panel principal (todo en una pantalla) ────────────────────── */
.page:has(> .env) { padding-top: 14px; padding-bottom: 12px; }
.env { --env-solar: #fbbf24; --env-red: #fb7185; --env-export: #818cf8; --env-casa: #a5b4fc; --env-coche: #34d399;
    display: flex; flex-direction: column; gap: 12px; }
.env-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.env-back { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
    background: var(--surface); border: 1px solid var(--border); color: var(--muted); transition: all .15s; }
.env-back:hover { border-color: var(--accent); color: var(--accent-fg); transform: translateX(-2px); }
.env-head-txt { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 12px; }
.env-head h1 { margin: 0; font-size: 1.45rem; font-weight: 800; letter-spacing: -.025em; }
.env-head p { margin: 0; font-size: .84rem; color: var(--muted); }
.env-head p::first-letter { text-transform: uppercase; }
.env-nav { display: flex; gap: 3px; padding: 3px; background: var(--surface-3); border-radius: 11px; }
.env-nav a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 8px; font-size: .8rem; font-weight: 600;
    color: var(--text-2); text-decoration: none; transition: background .15s, color .15s, box-shadow .15s; }
.env-nav a:hover { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); text-decoration: none; }
.env-aviso { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 9px; font-size: .8rem;
    background: var(--surface); border: 1px dashed var(--border-strong); color: var(--muted); }
.env-aviso.error { background: var(--amber-weak); border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent); color: var(--amber-text); }
.env-aviso a { color: inherit; font-weight: 700; }

/* Cuadrícula */
/* Altura exacta de lo que queda de ventana (barra 61 + márgenes 26 + cabecera 38 + hueco 12), con un mínimo */
.env-bento { height: max(540px, calc(100dvh - 137px)); display: grid; gap: 12px; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: auto minmax(0, 1fr) auto; }
.env-a-live { grid-column: 1 / 9; grid-row: 1 / 3; display: flex; }
.env-a-kpis { grid-column: 9 / 13; grid-row: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.env-a-mes { grid-column: 9 / 13; grid-row: 2; }
.env-mini { grid-column: span 3; grid-row: 3; }

/* Entrada animada (solo la primera vez: la clase .entrando se quita sola) */
.env.entrando .env-in { animation: env-sube .55s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes env-sube { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.env.entrando .crece > div { animation: env-crece .9s cubic-bezier(.2, .8, .2, 1) both; animation-delay: .25s; transform-origin: left; }
@keyframes env-crece { from { transform: scaleX(0); } }
.env.entrando .g-val { animation: env-anillo 1.1s cubic-bezier(.2, .8, .2, 1) both; animation-delay: .3s; }
@keyframes env-anillo { from { stroke-dasharray: 0 100; } }
.env.entrando .env-donut { animation: env-gira-in 1s cubic-bezier(.2, .8, .2, 1) both; animation-delay: .35s; }
@keyframes env-gira-in { from { transform: rotate(-120deg) scale(.7); opacity: 0; } }
.env.entrando .env-dia i { animation: env-barra-sube .7s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(.3s + var(--j) * 18ms); }
@keyframes env-barra-sube { from { transform: scaleY(0); } }

/* Tarjeta en directo: estilo panel de control (oscura en los dos temas) */
.env-live { position: relative; overflow: hidden; flex: 1; display: flex; flex-direction: column; border-radius: 20px; padding: 12px 18px 12px; color: #e6e9f8;
    background:
        radial-gradient(70% 90% at 30% 45%, rgba(99, 102, 241, .22), transparent 70%),
        radial-gradient(50% 70% at 100% 100%, rgba(251, 191, 36, .10), transparent 65%),
        linear-gradient(160deg, #141831, #090b16);
    box-shadow: 0 0 0 1px rgba(129, 140, 248, .18), 0 24px 48px -22px rgba(10, 12, 30, .75), inset 0 1px 0 rgba(255, 255, 255, .06); }
/* Rejilla de fondo con perspectiva suave + línea de escaneo */
.env-live::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .55; z-index: 1;
    background-image: linear-gradient(rgba(129, 140, 248, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(129, 140, 248, .07) 1px, transparent 1px);
    background-size: 26px 26px; -webkit-mask-image: radial-gradient(ellipse 75% 70% at 40% 50%, #000 30%, transparent 85%); mask-image: radial-gradient(ellipse 75% 70% at 40% 50%, #000 30%, transparent 85%); }
.env-live::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 100%; pointer-events: none;
    background: linear-gradient(180deg, transparent, rgba(129, 140, 248, .07) 70%, rgba(165, 180, 252, .16) 98%, transparent) top / 100% 90px no-repeat;
    animation: hud-escaneo 8s linear infinite; z-index: 2; will-change: transform; }
/* La línea recorre la tarjeta entera; con transform (no "top") para no repintar la tarjeta en cada fotograma */
@keyframes hud-escaneo { from { transform: translateY(-90px); } to { transform: translateY(100%); } }
.hud-esq { position: absolute; width: 14px; height: 14px; border-color: rgba(165, 180, 252, .55); border-style: solid; border-width: 0; pointer-events: none; z-index: 1; }
.hud-esq.tl { top: 8px; left: 8px; border-top-width: 2px; border-left-width: 2px; border-top-left-radius: 6px; }
.hud-esq.tr { top: 8px; right: 8px; border-top-width: 2px; border-right-width: 2px; border-top-right-radius: 6px; }
.hud-esq.bl { bottom: 8px; left: 8px; border-bottom-width: 2px; border-left-width: 2px; border-bottom-left-radius: 6px; }
.hud-esq.br { bottom: 8px; right: 8px; border-bottom-width: 2px; border-right-width: 2px; border-bottom-right-radius: 6px; }

.env-live-head { position: relative; display: flex; align-items: center; gap: 10px; }
.env-live-head h2 { margin: 0; font-size: 1rem; font-weight: 700; color: #fff; letter-spacing: .01em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 8px rgba(0, 0, 0, .5); }
.env-live-badge { display: inline-flex; align-items: center; gap: 6px; font-size: .62rem; font-weight: 800; letter-spacing: .14em;
    text-transform: uppercase; color: #6ee7b7; background: rgba(52, 211, 153, .1); border: 1px solid rgba(52, 211, 153, .25); padding: 3px 9px; border-radius: 6px; }
.env-live-badge i { width: 6px; height: 6px; border-radius: 50%; background: #34d399; animation: env-pulso 2s infinite; }
@keyframes env-pulso { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .6); } 70%, 100% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); } }
.hud-reloj { font-family: var(--mono); font-size: .8rem; color: #a5b4fc; letter-spacing: .12em; padding: 3px 8px; border-radius: 6px; background: rgba(129, 140, 248, .08); border: 1px solid rgba(129, 140, 248, .18); font-variant-numeric: tabular-nums; }
.env-precio { display: flex; align-items: baseline; gap: 6px; padding: 4px 10px; border-radius: 8px; background: rgba(253, 230, 138, .06); border: 1px solid rgba(253, 230, 138, .2); }
.env-precio small { font-size: .62rem; color: #fcd34d; text-transform: uppercase; letter-spacing: .1em; font-weight: 800; }
.env-precio b { font-family: var(--mono); font-size: .95rem; color: #fde68a; text-shadow: 0 0 12px rgba(253, 230, 138, .45); }
.env-precio span { font-size: .7rem; color: #a3a9c4; }
.env-live-grid { position: relative; flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); gap: 18px; align-items: stretch; }

/* Diagrama */
.env-flow { position: relative; min-height: 0; display: flex; flex-direction: column; }
.env-flow > svg { width: 100%; flex: 1; min-height: 200px; display: block; overflow: visible; }
.fl-track { fill: none; stroke: rgba(165, 180, 252, .09); stroke-width: 2; stroke-dasharray: 1 5; stroke-linecap: round; }
.fl-on { fill: none; stroke-width: 2; stroke-linecap: round; stroke-dasharray: 1 7; opacity: .7; animation: fl-mover var(--dur, 1.5s) linear infinite; }
@keyframes fl-mover { to { stroke-dashoffset: -16; } }
/* Resplandor sin filtros (los filtros SVG con partículas animadas se recalculaban en cada fotograma) */
.fl-neon { fill: none; stroke-width: 7; opacity: .16; stroke-linecap: round; }
.fl-solar { stroke: var(--env-solar); color: var(--env-solar); }
.fl-red { stroke: var(--env-red); color: var(--env-red); }
.fl-coche { stroke: var(--env-coche); color: var(--env-coche); }
.fl-dot { stroke: none; fill: currentColor; }
.fl-dot.estela1 { opacity: .5; }
.fl-dot.estela2 { opacity: .25; }
.fl-nodo { color: #6b7194; }
.fl-nodo.activo { color: var(--c); }
.fl-n-solar { --c: var(--env-solar); } .fl-n-red { --c: var(--env-red); } .fl-n-casa { --c: var(--env-casa); } .fl-n-coche { --c: var(--env-coche); }
.fl-disco { fill: url(#hud-disco); stroke: rgba(255, 255, 255, .1); stroke-width: 1.5; }
.fl-nodo.activo .fl-disco { stroke: color-mix(in srgb, var(--c) 55%, transparent); }
.fl-orbita { fill: none; stroke: currentColor; stroke-width: 1; stroke-dasharray: 2 7; opacity: .45; transform-box: fill-box; transform-origin: center; animation: fl-gira var(--dur, 24s) linear infinite; }
.fl-orbita-casa { stroke-dasharray: 14 6 2 6; opacity: .5; animation-direction: reverse; }
.fl-arco-fondo { fill: none; stroke: rgba(255, 255, 255, .06); stroke-width: 3; }
.fl-arco { fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
.fl-arco-solar { stroke: var(--env-solar); color: var(--env-solar); }
.fl-arco-red { stroke: var(--env-red); color: var(--env-red); }
.fl-nodo .fl-halo { fill: none; stroke: currentColor; stroke-width: 1.5; opacity: 0; transform-box: fill-box; transform-origin: center; }
.fl-nodo.activo .fl-halo { animation: fl-halo var(--dur, 2.4s) ease-out infinite; }
@keyframes fl-halo { 0% { opacity: .6; transform: scale(1); } 100% { opacity: 0; transform: scale(1.55); } }
.fl-gira { transform-box: fill-box; transform-origin: center; animation: fl-gira 14s linear infinite; }
@keyframes fl-gira { to { transform: rotate(360deg); } }
.fl-flota { transform-box: fill-box; transform-origin: center; animation: env-flota 4s ease-in-out infinite; }
@keyframes env-flota { 50% { transform: translateY(-2px) rotate(-8deg); } }
.fl-nodo text { text-anchor: middle; }
.fl-v { fill: #fff; font-size: 15px; font-weight: 700; font-family: var(--mono); letter-spacing: -.02em; }
.fl-v-casa { font-size: 18px; }
/* Depósito de líquido de la casa */
.liq-ola { stroke: none; }
.liq-fondo { fill: url(#liq-red); }
.liq-delante { fill: url(#liq-sol); }
.liq-atras { fill: #fde68a; opacity: .75; }   /* ola trasera del sol: amarillo claro, sin tonos marrones */
.liq-mezcla { fill: none; stroke: rgba(255, 255, 255, .28); stroke-width: 2; }   /* frontera sol/red: brillo claro (una sombra oscura sobre amarillo se ve marrón) */
.liq-espuma { fill: none; stroke: rgba(255, 246, 214, .55); stroke-width: .7; }
.liq-burbujas circle { fill: rgba(255, 255, 255, .1); stroke: rgba(255, 255, 255, .55); stroke-width: .45; }
.liq-burbujas circle.b-brillo { fill: rgba(255, 255, 255, .85); stroke: none; }
.liq-brillo { fill: none; stroke: rgba(255, 255, 255, .22); stroke-width: 2; stroke-linecap: round; }
.fl-n-casa text { paint-order: stroke; stroke: rgba(6, 8, 20, .6); stroke-width: 3px; stroke-linejoin: round; }
.fl-u { fill: #8b91b3; font-size: 8.5px; font-weight: 700; letter-spacing: .14em; font-family: var(--font); }
.fl-k { fill: #a3a9c4; font-size: 9.5px; font-weight: 800; letter-spacing: .14em; font-family: var(--font); }
.fl-nodo.activo .fl-k { fill: var(--c); }

/* Lecturas */
.env-live-datos { display: flex; flex-direction: column; justify-content: space-between; gap: 6px; min-width: 0; padding: 4px 0; }
.hud-total { position: relative; display: flex; flex-direction: column; padding: 7px 12px 5px; border-radius: 12px; background: rgba(10, 13, 30, .86); border: 1px solid rgba(129, 140, 248, .2); }
.hud-total-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hud-total-top > span:first-child { font-size: .66rem; color: #8b91b3; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.hud-estado { font-size: .64rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 2px 7px; border-radius: 5px; }
.hud-estado.red { color: #fda4af; background: rgba(251, 113, 133, .12); }
.hud-estado.mixto { color: #fde68a; background: rgba(251, 191, 36, .12); }
.hud-estado.solar, .hud-estado.vierte { color: #6ee7b7; background: rgba(52, 211, 153, .12); }
.hud-total b { display: flex; align-items: baseline; gap: 6px; font-family: var(--mono); font-size: 2.15rem; font-weight: 700; letter-spacing: -.04em; line-height: 1.1;
    color: #fff; text-shadow: 0 0 22px rgba(165, 180, 252, .45); font-variant-numeric: tabular-nums; }
.hud-total small { font-size: .9rem; color: #8b91b3; font-weight: 700; letter-spacing: .1em; text-shadow: none; }
.hud-osc { display: block; width: 100%; height: 40px; margin-top: 2px; overflow: visible; }
.hud-osc-rejilla { stroke: rgba(129, 140, 248, .1); stroke-width: 1; vector-effect: non-scaling-stroke; fill: none; }
.hud-osc-area { fill: rgba(129, 140, 248, .14); stroke: none; }
.hud-osc-linea { fill: none; stroke: #a5b4fc; stroke-width: 1.8; vector-effect: non-scaling-stroke; stroke-linejoin: round; filter: drop-shadow(0 0 4px rgba(165, 180, 252, .7)); }
.hud-osc-solar { fill: none; stroke: var(--env-solar); stroke-width: 1.4; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; opacity: .8; }
.hud-osc-punto { fill: #fff; animation: env-latido 1.5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes env-latido { 50% { transform: scale(1.6); opacity: .6; } }
.env-barra { display: flex; height: 6px; border-radius: 99px; overflow: hidden; background: rgba(255, 255, 255, .07); }
.env-barra > div { transition: width .6s cubic-bezier(.2, .8, .2, 1); box-shadow: 0 0 10px currentColor; }
.env-barra.fina { height: 4px; margin-top: 5px; }
.env-leyenda { display: flex; flex-wrap: wrap; gap: 3px 14px; margin-top: -5px; font-size: .72rem; color: #c3c8de; }
.env-leyenda span, .env-filas span { display: inline-flex; align-items: center; gap: 6px; }
.env-leyenda i, .env-filas i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.env-leyenda i { box-shadow: 0 0 6px currentColor; }
.env-gauges { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.env-gauge { display: flex; align-items: center; gap: 8px; padding: 6px 9px; border-radius: 10px; background: rgba(10, 13, 30, .84); border: 1px solid rgba(255, 255, 255, .07); min-width: 0; }
.env-gauge svg { width: 44px; height: 44px; flex-shrink: 0; }
.env-gauge .g-track { fill: none; stroke: rgba(255, 255, 255, .1); stroke-width: 10; stroke-linecap: round; }
.env-gauge .g-val { fill: none; stroke-width: 10; stroke-linecap: round; filter: drop-shadow(0 0 3px currentColor); }
.env-gauge text { fill: #fff; font-size: 21px; font-weight: 700; text-anchor: middle; font-family: var(--mono); }
.env-gauge b { display: block; font-size: .74rem; color: #fff; }
.env-gauge small { display: block; font-size: .66rem; color: #a3a9c4; margin-top: 1px; line-height: 1.3; }
.env-gauge a { color: #a5b4fc; font-weight: 600; }
.env-noche { background: linear-gradient(150deg, rgba(99, 102, 241, .2), rgba(8, 10, 22, .4)); }
.env-noche-ico { position: relative; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fde68a; background: rgba(253, 230, 138, .08); flex-shrink: 0; }
.env-noche-ico .i { animation: env-flota 4s ease-in-out infinite; filter: drop-shadow(0 0 6px rgba(253, 230, 138, .6)); }
.env-noche-ico i { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #fff; animation: env-brilla 2.6s ease-in-out infinite; }
.env-noche-ico i:nth-of-type(1) { top: 6px; right: 6px; }
.env-noche-ico i:nth-of-type(2) { bottom: 9px; left: 5px; animation-delay: .9s; }
.env-noche-ico i:nth-of-type(3) { top: 14px; left: 8px; width: 2px; height: 2px; animation-delay: 1.7s; }
@keyframes env-brilla { 0%, 100% { opacity: .15; } 50% { opacity: 1; } }
.hud-fila { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; align-items: end; padding-top: 7px; border-top: 1px solid rgba(255, 255, 255, .07); }
.hud-dato small { display: block; font-size: .62rem; color: #8b91b3; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-dato b { font-family: var(--mono); font-size: .86rem; color: #fff; }
.hud-dato-barra { grid-column: 1 / -1; }
.hud-dato-barra small { text-transform: none; letter-spacing: 0; font-weight: 600; }
.hud-tramos-barra { position: relative; display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; height: 8px; }
.hud-tramos-barra i { border-radius: 2px; opacity: .55; }
.hud-tramos-barra .t-p1 { background: #2a78d6; } .hud-tramos-barra .t-p2 { background: #eb6834; } .hud-tramos-barra .t-p3 { background: #1baf7a; }
.hud-ahora { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: #fff; border-radius: 2px; box-shadow: 0 0 8px #fff, 0 0 2px #fff; }
.hud-ahora::after { content: ""; position: absolute; top: -5px; left: -3px; border: 4px solid transparent; border-top-color: #fff; }
.hud-tramos-eje { display: flex; justify-content: space-between; margin-top: 3px; font-size: .58rem; color: #6b7194; font-family: var(--mono); }
.env-vacio { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; margin: auto; color: #a3a9c4; font-size: .9rem; }

/* Cielo de la tarjeta en directo (lo pinta static/js/cielo.js) */
.env-live-cuerpo { position: relative; z-index: 1; flex: 1; min-height: 0; display: flex; flex-direction: column; text-shadow: 0 1px 3px rgba(4, 6, 16, .55); }
/* Luz ambiente: JS la pinta con el color del cielo (día claro, noche oscura, gris si llueve) */
.cielo-luz { position: absolute; inset: 0; pointer-events: none; transition: background 3s ease; }
.cielo-luz canvas { position: absolute; left: 0; top: 0; z-index: 1; }
.fl-n-red.vertiendo { --c: #34d399; }
.cielo { position: absolute; left: 0; right: 0; top: 0; height: 54%; overflow: hidden; pointer-events: none;
    -webkit-mask-image: linear-gradient(#000 72%, transparent); mask-image: linear-gradient(#000 72%, transparent); }
.cielo-fondo { position: absolute; inset: 0; background: #0b1024; transition: background 3s ease; }
/* Velo oscuro arriba: la cabecera se lee sobre cualquier cielo */
.cielo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(6, 8, 20, .62), rgba(6, 8, 20, .18) 30%, transparent 55%); }
.cielo canvas { position: absolute; left: 0; top: 0; }
.cielo-nubes { position: absolute; left: 0; right: 0; top: 0; height: 82%; opacity: 0; transition: opacity 3s ease;
    filter: brightness(calc(var(--relampago, 1) * (1 - var(--nube-oscura, 0) * .45)));
    -webkit-mask-image: linear-gradient(#000 45%, transparent); mask-image: linear-gradient(#000 45%, transparent); }
.cielo.con-nubes .cielo-nubes { opacity: 1; }
.cielo:not(.con-nubes) .cielo-nubes { visibility: hidden; }
.cielo:not(.con-nubes) .nube-capa { animation-play-state: paused; }
.cielo.con-niebla .cielo-nubes { top: 30%; height: 70%; -webkit-mask-image: linear-gradient(transparent, #000 35%, #000 80%, transparent); mask-image: linear-gradient(transparent, #000 35%, #000 80%, transparent); }
.cielo.con-niebla .cielo-fondo::after { content: ""; position: absolute; inset: 35% 0 0; background: linear-gradient(transparent, rgba(196, 203, 214, .5)); }
.nube-capa { position: absolute; left: 0; width: 160%; animation-name: nube-deriva; animation-timing-function: linear; animation-iteration-count: infinite; will-change: transform, opacity; }
.nube-capa.c0 { top: -6%; height: 72%; }
.nube-capa.c1 { top: 6%; height: 100%; }
@keyframes nube-deriva { 0% { transform: translateX(0); opacity: 0; } 14%, 86% { opacity: 1; } 100% { transform: translateX(-37.5%); opacity: 0; } }
.cielo-horizonte { position: absolute; left: 3%; right: 3%; bottom: 20%; display: flex; justify-content: flex-end; gap: 12px;
    font-family: var(--mono); font-size: .62rem; color: rgba(226, 232, 255, .7); text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.cielo-horizonte span { display: inline-flex; align-items: center; gap: 4px; }
/* La red cuesta / el sol ahorra, en €/h */
.hud-euros { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hud-euro { padding: 6px 10px; border-radius: 10px; background: rgba(10, 13, 30, .84); border: 1px solid rgba(255, 255, 255, .07); }
.hud-euro small { display: block; font-size: .6rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #8b91b3; }
.hud-euro b { font-family: var(--mono); font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.hud-euro.red b { color: #fda4af; text-shadow: 0 0 12px rgba(251, 113, 133, .35); }
.hud-euro.sol b { color: #fde68a; text-shadow: 0 0 12px rgba(251, 191, 36, .35); }
.hud-tiempo { display: inline-flex; align-items: center; gap: 7px; min-width: 0; font-size: .74rem; color: #dbe2ff; padding: 3px 9px; border-radius: 8px;
    background: rgba(10, 13, 30, .8); border: 1px solid rgba(255, 255, 255, .12); white-space: nowrap; }
.hud-tiempo b { font-weight: 700; color: #fff; }
.hud-tiempo span { display: inline-flex; align-items: center; gap: 3px; color: #b9c0dc; font-variant-numeric: tabular-nums; }
.fl-k2 { fill: var(--env-coche) !important; font-size: 8px; animation: env-brilla 1.6s ease-in-out infinite; }

/* Indicadores */
.env-kpi { position: relative; overflow: hidden; display: flex; flex-direction: column; padding: 12px 14px; border-radius: 16px; background: var(--surface);
    border: 1px solid var(--border); box-shadow: var(--shadow-card); transition: transform .2s, box-shadow .2s; }
.env-kpi:hover, .env-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.env-kpi.destacado { background: linear-gradient(150deg, var(--accent-weak), var(--surface) 75%); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.env-kpi.destacado::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%);
    transform: translateX(-100%); animation: env-brillo 6s ease-in-out infinite 2s; pointer-events: none; }
@keyframes env-brillo { 0%, 70% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.env-kpi-top { display: flex; align-items: center; gap: 8px; font-size: .74rem; font-weight: 600; color: var(--muted); }
.env-kpi-ico { width: 26px; height: 26px; border-radius: 8px; display: inline-grid; place-items: center; flex-shrink: 0; }
.c-casa { background: var(--accent-weak); color: var(--accent-fg); }
.c-mes { background: var(--blue-weak); color: var(--blue-text); }
.c-coste { background: var(--amber-weak); color: var(--amber-text); }
.c-factura { background: var(--accent); color: var(--accent-text); }
.c-sol { background: var(--amber-weak); color: var(--amber-text); }
.c-coche { background: var(--green-weak); color: var(--green-text); }
.c-uso { background: var(--red-weak); color: var(--red-text); }
.env-kpi-v { margin-top: auto; padding-top: 6px; font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.env-kpi-v small, .env-grande small { font-size: .78rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.env-kpi-v.vacio, .env-grande.vacio { color: var(--faint); }
.env-kpi-sub { margin-top: 3px; font-size: .7rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.env-kpi-sub b { color: var(--text-2); }
.env-delta { display: inline-block; font-size: .68rem; font-weight: 700; padding: 0 6px; border-radius: 999px; margin-right: 3px; }
.env-delta.baja { background: var(--green-weak); color: var(--green-text); }
.env-delta.sube { background: var(--amber-weak); color: var(--amber-text); }

/* Tarjetas */
.env-card { display: flex; flex-direction: column; min-height: 0; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border);
    box-shadow: var(--shadow-card); transition: transform .2s, box-shadow .2s; }
.env-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.env-card-head h3 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: .86rem; font-weight: 700; white-space: nowrap; }
.env-card-head h3::first-letter { text-transform: uppercase; }
.env-card-nota { display: inline-flex; align-items: center; gap: 4px; font-size: .7rem; color: var(--muted); white-space: nowrap; }
.env-card-nota b { color: var(--text-2); }
.env-chip { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 600; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); padding: 2px 8px; border-radius: 999px; }
.env-hueco { margin: auto; font-size: .8rem; color: var(--muted); text-align: center; }
.env-grande { font-size: 1.35rem; font-weight: 800; letter-spacing: -.025em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.env-barra-claro { display: flex; height: 7px; border-radius: 99px; overflow: hidden; background: var(--surface-3); margin-top: 8px; }
.env-barra-claro.gruesa { height: 10px; margin-top: 0; }
.env-filas { display: flex; flex-direction: column; margin-top: auto; padding-top: 6px; }
.env-filas > div { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; border-top: 1px solid var(--border); font-size: .76rem; }
.env-filas > div:first-child { border-top: 0; }
.env-filas span { color: var(--muted); }
.env-filas b { font-family: var(--mono); font-size: .76rem; font-weight: 600; white-space: nowrap; }
.env-filas em { font-style: normal; font-size: .66rem; color: var(--muted); margin-left: 5px; font-family: var(--font); }
.env-tramos { flex: 1; display: flex; align-items: center; gap: 12px; }
.env-tramos .env-filas { flex: 1; margin: 0; padding: 0; }
.env-donut-wrap { position: relative; width: 84px; height: 84px; flex-shrink: 0; }
.env-donut { width: 100%; height: 100%; }
.env-donut circle { transition: stroke-width .2s; }
.env-donut circle:hover { stroke-width: 18; }
.env-donut-centro { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; pointer-events: none; }
.env-donut-centro b { font-size: 1.05rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.env-donut-centro small { font-size: .62rem; color: var(--muted); }

/* Consumo diario */
.env-dias { position: relative; flex: 1; min-height: 70px; display: flex; align-items: flex-end; gap: 3px; padding-top: 6px; }
.env-dia { flex: 1; height: 100%; display: flex; align-items: flex-end; cursor: default; }
.env-dia i { display: block; width: 100%; height: max(var(--h), 3px); border-radius: 4px 4px 2px 2px; transform-origin: bottom;
    background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 45%, transparent)); opacity: .75; transition: opacity .15s, filter .15s; }
.env-dia:hover i { opacity: 1; filter: brightness(1.15); }
/* Barras apiladas por uso: de abajo arriba vehículo, climatización y resto */
.env-dia i.apilada { display: flex; flex-direction: column-reverse; overflow: hidden; background: none; opacity: .9; }
.env-dia i.apilada b { display: block; width: 100%; flex: none; }
.env-dias-leyenda { display: inline-flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; font-size: .7rem; color: var(--muted); }
.env-dias-leyenda i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 1px; }
.env-dia.hoy i { background: linear-gradient(180deg, #f59e0b, rgba(245, 158, 11, .45)); opacity: 1; }
.env-dia.futuro i { height: 3px; background: var(--surface-3); opacity: 1; }
.env-dia.sin i { height: 3px; background: var(--border-strong); }
.env-dias-media { position: absolute; left: 0; right: 0; border-top: 1px dashed color-mix(in srgb, var(--text) 30%, transparent); pointer-events: none; z-index: 1; }
.env-dias-media span { position: absolute; right: 0; top: -15px; font-size: .62rem; color: var(--muted); background: var(--surface); padding: 0 4px; border-radius: 4px; }
.env-dias-eje { display: flex; justify-content: space-between; font-size: .62rem; color: var(--faint); margin-top: 3px; }
.env-tip { position: absolute; z-index: 50; transform: translate(-50%, -100%); pointer-events: none; white-space: nowrap; font-size: .74rem; font-weight: 600;
    background: #111827; color: #fff; padding: 4px 9px; border-radius: 7px; box-shadow: 0 6px 16px rgba(0, 0, 0, .25); }
.env-tip.largo { white-space: pre-line; width: max-content; max-width: 320px; font-weight: 500; line-height: 1.45; padding: 8px 12px; border-radius: 10px; }
[data-tip] { cursor: help; }
[data-desglose] { cursor: pointer; }

/* Pantallas de escritorio bajas: la tarjeta en directo, más compacta */
@media (min-width: 1101px) and (max-height: 760px) {
    .hud-total b { font-size: 1.85rem; }
    .env-gauge { padding: 4px 8px; }
    .env-gauge svg { width: 36px; height: 36px; }
    .hud-tramos-eje { display: none; }
    .hud-fila > .hud-dato:not(.hud-dato-barra) { display: none; }
    .hud-osc { height: 26px; }
    .hud-euro { padding: 3px 8px; }
    .hud-euro b { font-size: .9rem; }
    .env-live-datos { gap: 4px; }
    .env-live { padding-bottom: 8px; }
    .hud-fila { padding-top: 5px; }
}
/* Pantallas medianas y móvil: se apila y se permite el scroll */
@media (max-width: 1100px), (max-height: 620px) {
    .env-bento { height: auto; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; }
    .env-a-live, .env-a-kpis, .env-a-mes { grid-column: 1 / -1; grid-row: auto; }
    .env-a-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .env-a-mes { min-height: 170px; }
    .env-mini { grid-column: span 1; grid-row: auto; }
}
@media (max-width: 720px) {
    .env-head-txt { flex-direction: column; gap: 0; }
    .env-nav { width: 100%; }
    .env-nav a { flex: 1; justify-content: center; padding: 7px 4px; font-size: .74rem; gap: 4px; }
    .env-live { padding: 14px; }
    .env-live-head { flex-wrap: wrap; }
    .env-live-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .env-live-head h2 { flex: 1 1 auto; }
    .hud-total b { font-size: 2rem; }
    .hud-tiempo { order: 5; width: 100%; justify-content: center; }
    .env-a-kpis { grid-template-columns: 1fr 1fr; }
    .env-bento { grid-template-columns: minmax(0, 1fr); }
    .env-gauges { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
    .env *, .env *::before, .env *::after { animation: none !important; transition: none !important; }
}
