/* ========== Mantenimiento Coche — tema premium (degradados, 3D, animación) ========== */
:root {
    --bg-deep: #050810;
    --bg-card: rgba(18, 24, 42, 0.72);
    --bg-card-solid: #121a2e;
    --bg-sidebar: rgba(10, 14, 28, 0.92);
    --text: #f1f5ff;
    --text-muted: #94a3c8;
    --accent: #38bdf8;
    --accent-2: #a78bfa;
    --accent-3: #f472b6;
    --accent-hot: #22d3ee;
    --success: #34d399;
    --danger: #fb7185;
    --warning: #fbbf24;
    --radius: 18px;
    --radius-sm: 12px;
    --sidebar-width: 268px;
    --topbar-h: 54px;
    --tap-min: 44px;
    --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
    --shadow-3d: 0 4px 6px -1px rgba(0, 0, 0, 0.35), 0 12px 24px -4px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.06) inset, 0 1px 0 rgba(255, 255, 255, 0.1) inset;
    --glow-accent: 0 0 40px rgba(56, 189, 248, 0.22);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Keyframes ---------- */
@keyframes mesh-shift {
    0%,
    100% {
        opacity: 1;
        transform: scale(1) translate(0, 0);
    }
    33% {
        opacity: 0.92;
        transform: scale(1.05) translate(2%, -1%);
    }
    66% {
        opacity: 0.95;
        transform: scale(1.02) translate(-1%, 2%);
    }
}

@keyframes orb-float {
    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(4%, -6%) scale(1.08);
    }
}

@keyframes orb-float-2 {
    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(-5%, 4%) scale(1.05);
    }
}

@keyframes gradient-border {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes shimmer {
    0% {
        transform: translateX(-120%) skewX(-12deg);
    }
    100% {
        transform: translateX(220%) skewX(-12deg);
    }
}

@keyframes pulse-soft {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.35);
    }
    50% {
        box-shadow: 0 0 24px 4px rgba(56, 189, 248, 0.12);
    }
}

@keyframes fade-rise {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes title-shine {
    0%,
    100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: rgba(56, 189, 248, 0.2);
}

body {
    margin: 0;
    font-family: var(--font);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Fondo animado solo en panel */
body.panel-page {
    position: relative;
    isolation: isolate;
    background: var(--bg-deep);
    overflow-x: hidden;
}

body.panel-page::before,
body.panel-page::after {
    content: "";
    position: fixed;
    inset: -20%;
    z-index: 0;
    pointer-events: none;
}

body.panel-page::before {
    background: radial-gradient(ellipse 100% 80% at 10% 0%, rgba(99, 102, 241, 0.45), transparent 55%),
        radial-gradient(ellipse 80% 60% at 95% 15%, rgba(14, 165, 233, 0.38), transparent 50%),
        radial-gradient(ellipse 70% 50% at 50% 100%, rgba(244, 114, 182, 0.2), transparent 45%),
        radial-gradient(ellipse 50% 40% at 70% 60%, rgba(34, 211, 238, 0.12), transparent 40%), var(--bg-deep);
    animation: mesh-shift 22s ease-in-out infinite alternate;
}

body.panel-page::after {
    background: radial-gradient(circle at 20% 80%, rgba(56, 189, 248, 0.08), transparent 35%),
        radial-gradient(circle at 80% 70%, rgba(167, 139, 250, 0.1), transparent 40%);
    animation: orb-float 16s ease-in-out infinite;
    opacity: 0.85;
}

a {
    color: var(--accent-hot);
    text-decoration: none;
    transition: color 0.2s var(--ease-smooth), text-shadow 0.2s;
}
a:hover {
    color: #7dd3fc;
    text-decoration: none;
    text-shadow: 0 0 20px rgba(56, 189, 248, 0.35);
}

.link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 0.6rem;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(167, 139, 250, 0.12));
    border: 1px solid rgba(56, 189, 248, 0.28);
    color: #7dd3fc;
    transition: transform 0.25s var(--ease-spring), box-shadow 0.25s, background 0.25s;
}
.link:hover {
    transform: translateY(-2px) translateZ(0);
    box-shadow: 0 8px 24px rgba(56, 189, 248, 0.2);
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(167, 139, 250, 0.18));
}

/* ========== Auth ========== */
.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
        max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background: var(--bg-deep);
}

.auth-page::before,
.auth-page::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
    z-index: 0;
}

.auth-page::before {
    width: min(120vw, 720px);
    height: min(120vw, 720px);
    top: -25%;
    left: -20%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.55), transparent 65%);
    animation: orb-float 14s ease-in-out infinite;
}

.auth-page::after {
    width: min(100vw, 560px);
    height: min(100vw, 560px);
    bottom: -30%;
    right: -15%;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.45), transparent 65%);
    animation: orb-float-2 18s ease-in-out infinite;
}

.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: clamp(1.35rem, 4vw, 2.1rem);
    border-radius: var(--radius);
    background: linear-gradient(155deg, rgba(22, 30, 52, 0.92) 0%, rgba(12, 18, 36, 0.88) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: var(--shadow-3d), 0 0 80px rgba(56, 189, 248, 0.08);
    transform: perspective(1200px) rotateX(2deg);
    transition: transform 0.4s var(--ease-smooth), box-shadow 0.4s;
    animation: fade-rise 0.7s var(--ease-smooth) both;
}

.auth-card:hover {
    transform: perspective(1200px) rotateX(0deg) translateY(-4px);
    box-shadow: var(--shadow-3d), 0 24px 48px rgba(0, 0, 0, 0.4), var(--glow-accent);
}

.auth-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(130deg, rgba(56, 189, 248, 0.5), rgba(167, 139, 250, 0.35), rgba(244, 114, 182, 0.25));
    background-size: 200% 200%;
    animation: gradient-border 8s ease infinite;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.auth-card h1 {
    margin: 0 0 0.35rem;
    font-size: clamp(1.45rem, 4vw, 1.75rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(120deg, #fff 0%, #bae6fd 40%, #c4b5fd 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: title-shine 6s ease-in-out infinite;
}

.auth-subtitle {
    color: var(--text-muted);
    margin: 0 0 1.35rem;
    font-size: 0.92rem;
}

.auth-form label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.auth-form input {
    width: 100%;
    padding: 0.75rem 1rem;
    margin-bottom: 0.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.35);
    color: var(--text);
    font-size: 16px;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.auth-form input:focus {
    outline: none;
    border-color: rgba(56, 189, 248, 0.55);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.15), 0 8px 24px rgba(0, 0, 0, 0.25);
    transform: translateY(-1px);
}

.auth-form button {
    margin-top: 0.4rem;
}

.auth-link {
    text-align: center;
    margin-top: 1.2rem;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.auth-link a {
    font-weight: 600;
}

/* ========== Alerts ========== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.88rem;
    line-height: 1.45;
    animation: fade-rise 0.45s var(--ease-smooth) both;
    backdrop-filter: blur(8px);
}

.alert-success {
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.2), rgba(16, 185, 129, 0.08));
    color: #6ee7b7;
    border: 1px solid rgba(52, 211, 153, 0.35);
    box-shadow: 0 4px 20px rgba(52, 211, 153, 0.1);
}

.alert-danger {
    background: linear-gradient(135deg, rgba(251, 113, 133, 0.18), rgba(244, 63, 94, 0.08));
    color: #fda4af;
    border: 1px solid rgba(251, 113, 133, 0.35);
    box-shadow: 0 4px 20px rgba(251, 113, 133, 0.08);
}

/* ========== Buttons ========== */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--tap-min);
    padding: 0.55rem 1.15rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border: none;
    cursor: pointer;
    overflow: hidden;
    transform-style: preserve-3d;
    transition: transform 0.22s var(--ease-spring), box-shadow 0.22s, filter 0.22s;
}

.btn::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 45%);
    opacity: 0.5;
    pointer-events: none;
    border-radius: inherit;
}

.btn:active {
    transform: scale(0.97) translateY(1px);
}

.btn-primary {
    color: #0c1222;
    background: linear-gradient(145deg, #7dd3fc 0%, #38bdf8 35%, #0ea5e9 100%);
    box-shadow: 0 4px 0 #0369a1, 0 8px 24px rgba(14, 165, 233, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-primary:hover {
    filter: brightness(1.08);
    box-shadow: 0 5px 0 #0369a1, 0 14px 32px rgba(14, 165, 233, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.45);
    transform: translateY(-2px);
}

.btn-primary:active {
    box-shadow: 0 2px 0 #0369a1, 0 4px 16px rgba(14, 165, 233, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-block {
    width: 100%;
}

.btn-outline {
    color: var(--text-muted);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.btn-outline:hover {
    color: var(--text);
    border-color: rgba(56, 189, 248, 0.35);
    background: linear-gradient(180deg, rgba(56, 189, 248, 0.12), rgba(255, 255, 255, 0.04));
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.btn-sm {
    min-height: 40px;
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
    border-radius: 10px;
}

.btn-danger {
    color: #fecdd3;
    background: linear-gradient(180deg, rgba(251, 113, 133, 0.25), rgba(244, 63, 94, 0.12));
    border: 1px solid rgba(251, 113, 133, 0.4);
    box-shadow: 0 4px 0 rgba(190, 18, 60, 0.35), 0 8px 20px rgba(244, 63, 94, 0.15);
}

.btn-danger:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

/* ========== Panel layout ========== */
.panel-page {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
}

.sidebar {
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    z-index: 100;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    background: linear-gradient(180deg, rgba(12, 16, 32, 0.97) 0%, rgba(8, 11, 24, 0.98) 100%);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.45), inset -1px 0 0 rgba(255, 255, 255, 0.04);
    transition: transform 0.38s var(--ease-smooth);
}

.sidebar-header {
    padding: 0.8rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--topbar-h);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.06), transparent);
}

.logo {
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -0.03em;
    background: linear-gradient(120deg, #f8fafc, #7dd3fc, #c4b5fd);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: title-shine 10s ease-in-out infinite;
}

.sidebar-close {
    display: none;
    width: var(--tap-min);
    height: var(--tap-min);
    border: none;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
    color: var(--text);
    border-radius: var(--radius-sm);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    font-size: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s var(--ease-spring);
}
.sidebar-close:hover {
    transform: scale(1.05) rotate(90deg);
}
.sidebar-close::before,
.sidebar-close::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 2px;
    background: linear-gradient(90deg, #7dd3fc, #c4b5fd);
    border-radius: 1px;
}
.sidebar-close::before {
    transform: rotate(45deg);
}
.sidebar-close::after {
    transform: rotate(-45deg);
}

.sidebar-nav {
    flex: 1;
    padding: 0.6rem 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sidebar-nav-group {
    margin-top: 0.45rem;
}

.sidebar-nav-group:first-child {
    margin-top: 0;
}

.sidebar-vehicle + .sidebar-nav-group {
    margin-top: 0.35rem;
}

.sidebar-nav-group-title {
    display: block;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0.35rem 1rem 0.2rem;
    opacity: 0.9;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    min-height: var(--tap-min);
    padding: 0.55rem 1rem;
    margin: 0.2rem 0.65rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transform: translateZ(0);
    transition: color 0.25s, transform 0.25s var(--ease-spring), box-shadow 0.25s;
}

.sidebar-nav a::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.15), transparent);
    opacity: 0;
    transition: opacity 0.25s;
}

.sidebar-nav a:hover {
    color: var(--text);
    transform: translateX(4px);
    box-shadow: inset 3px 0 0 rgba(56, 189, 248, 0.5);
}

.sidebar-nav a:hover::before {
    opacity: 1;
}

.sidebar-nav a.active {
    color: #e0f2fe;
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.22), rgba(167, 139, 250, 0.08));
    box-shadow: inset 4px 0 0 #38bdf8, 0 8px 24px rgba(56, 189, 248, 0.12);
    border-left: none;
}

.sidebar-nav a.active::before {
    opacity: 1;
}

.sidebar-footer {
    padding: 1rem;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.25), transparent);
}

.user-name {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.55rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: stretch;
}

.sidebar-footer-actions .btn {
    flex: 1;
    min-width: 0;
}

.main-wrap {
    position: relative;
    z-index: 1;
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
}

.topbar {
    padding: 0.55rem max(0.85rem, env(safe-area-inset-right)) 0.55rem
        max(0.85rem, env(safe-area-inset-left));
    padding-top: max(0.55rem, env(safe-area-inset-top));
    min-height: calc(var(--topbar-h) + env(safe-area-inset-top));
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 50;
    background: linear-gradient(180deg, rgba(15, 22, 40, 0.82), rgba(12, 18, 34, 0.72));
    backdrop-filter: blur(20px) saturate(1.3);
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.menu-toggle {
    display: none;
    width: var(--tap-min);
    height: var(--tap-min);
    border: none;
    background: linear-gradient(145deg, rgba(56, 189, 248, 0.2), rgba(167, 139, 250, 0.12));
    color: var(--text);
    border-radius: var(--radius-sm);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    font-size: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    transition: transform 0.25s var(--ease-spring);
}
.menu-toggle:hover {
    transform: scale(1.06);
}
.menu-toggle::before {
    content: "";
    display: block;
    width: 18px;
    height: 2px;
    background: linear-gradient(90deg, #e0f2fe, #c4b5fd);
    border-radius: 1px;
    box-shadow: 0 6px 0 #c4b5fd, 0 -6px 0 #7dd3fc;
}

.page-title {
    margin: 0;
    font-size: clamp(0.98rem, 3vw, 1.2rem);
    font-weight: 750;
    letter-spacing: -0.02em;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.35);
}

.content {
    flex: 1;
    padding: max(0.85rem, env(safe-area-inset-right)) max(0.85rem, env(safe-area-inset-left));
    padding-bottom: max(1.1rem, env(safe-area-inset-bottom));
    padding-top: 0.85rem;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    perspective: 1400px;
}

.panel-page:has(.sidebar.open) .main-wrap::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 99;
    background: rgba(3, 6, 18, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fade-rise 0.35s var(--ease-smooth) both;
}

/* ========== Cards ========== */
.card {
    position: relative;
    border-radius: var(--radius);
    padding: clamp(1rem, 3vw, 1.35rem);
    margin-bottom: clamp(0.75rem, 2vw, 1.1rem);
    background: linear-gradient(155deg, rgba(28, 38, 64, 0.75) 0%, rgba(16, 22, 42, 0.82) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-3d), 0 0 0 1px rgba(56, 189, 248, 0.04) inset;
    transform-style: preserve-3d;
    transform: perspective(1000px) rotateX(0deg) translateZ(0);
    transition: transform 0.45s var(--ease-smooth), box-shadow 0.45s, border-color 0.35s;
    animation: fade-rise 0.55s var(--ease-smooth) both;
    animation-delay: calc(var(--card-i, 0) * 0.06s);
}

.card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(120% 80% at 10% 0%, rgba(56, 189, 248, 0.14), transparent 55%);
    pointer-events: none;
    opacity: 0.55;
    z-index: 0;
}

.card > * {
    position: relative;
    z-index: 1;
}

.card:hover {
    transform: perspective(1000px) rotateX(1.2deg) translateY(-6px) translateZ(12px);
    border-color: rgba(56, 189, 248, 0.25);
    box-shadow: var(--shadow-3d), 0 20px 50px rgba(0, 0, 0, 0.35), 0 0 60px rgba(56, 189, 248, 0.08);
}

.card h3 {
    position: relative;
    margin: 0 0 0.85rem;
    font-size: 0.98rem;
    font-weight: 750;
    letter-spacing: -0.02em;
    color: #f1f5ff;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}

.card-km {
    background: linear-gradient(145deg, rgba(56, 189, 248, 0.18) 0%, rgba(15, 22, 42, 0.9) 45%, rgba(167, 139, 250, 0.1) 100%);
    border: 1px solid rgba(56, 189, 248, 0.25);
    animation: pulse-soft 4s ease-in-out infinite;
}

.card-km .big-number {
    position: relative;
    font-size: clamp(1.85rem, 8vw, 2.5rem);
    font-weight: 800;
    margin: 0 0 0.2rem;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(120deg, #fff 0%, #7dd3fc 45%, #e9d5ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 4px 12px rgba(56, 189, 248, 0.25));
}

.card-km .big-number span {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    -webkit-text-fill-color: var(--text-muted);
    background: none;
}

.muted {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.5;
}

/* ========== Dashboard ========== */
.dashboard {
    display: grid;
    gap: clamp(0.75rem, 2vw, 1.1rem);
}

@media (min-width: 600px) {
    .dashboard {
        grid-template-columns: minmax(0, 240px) minmax(0, 1fr);
        align-items: start;
    }
}

.upcoming-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.upcoming-list li {
    padding: 0.75rem 0.8rem;
    margin-bottom: 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.25), rgba(56, 189, 248, 0.04));
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.65rem;
    transition: transform 0.25s var(--ease-spring), box-shadow 0.25s;
    transform-style: preserve-3d;
}

.upcoming-list li:hover {
    transform: translateY(-3px) translateZ(4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
}

.upcoming-list li:last-child {
    margin-bottom: 0;
}

.upcoming-list li.overdue {
    color: #fecdd3;
    border-color: rgba(251, 113, 133, 0.4);
    background: linear-gradient(135deg, rgba(251, 113, 133, 0.15), rgba(0, 0, 0, 0.2));
    box-shadow: 0 0 24px rgba(251, 113, 133, 0.12);
}

.upcoming-list li strong {
    flex: 1 1 100%;
    font-size: 0.92rem;
}

.upcoming-list li span {
    font-size: 0.76rem;
    color: #cbd5e1;
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.upcoming-list li.overdue span {
    color: inherit;
    background: rgba(251, 113, 133, 0.2);
    border-color: rgba(251, 113, 133, 0.3);
}

/* ========== Forms ========== */
.form-inline,
.form-add label,
.settings-grid .card label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.form-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
}

.form-inline label {
    margin-bottom: 0;
}

.form-inline input,
.form-add input,
.form-add select,
.form-add textarea,
.settings-grid input {
    padding: 0.72rem 0.95rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.2));
    color: var(--text);
    font-size: 16px;
    width: 100%;
    max-width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.form-add input,
.form-add select,
.form-add textarea {
    margin-bottom: 0.85rem;
}

.custom-type-wrap {
    margin-bottom: 0.85rem;
    animation: fade-rise 0.35s var(--ease-smooth) both;
}

.custom-type-wrap[hidden] {
    display: none !important;
}

/* Kilometraje: número + foto para IA */
.form-km-update .km-field-block {
    flex: 1 1 100%;
    min-width: 0;
}

.form-km-update .km-input-row {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.5rem;
}

.form-km-update .km-input-row input[type="number"] {
    flex: 1 1 160px;
    min-width: 0;
    margin-bottom: 0;
}

.form-km-update .km-input-row .btn {
    flex: 0 0 auto;
    align-self: center;
}

.odometer-photo-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.km-photo-hint {
    margin-top: 0;
    margin-bottom: 0.85rem;
}

.odometer-ai-status {
    margin-top: 0.5rem;
    margin-bottom: 0;
    font-size: 0.85rem;
    line-height: 1.4;
}

.odometer-ai-ok {
    color: #6ee7b7;
}

.odometer-ai-err {
    color: #fda4af;
}

/* Modal cámara cuentakilómetros */
.odometer-camera-sheet .odometer-camera-hint {
    margin-bottom: 0.75rem;
}

.odometer-video-wrap {
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #000;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.odometer-video-wrap video {
    display: block;
    width: 100%;
    max-height: min(52vh, 420px);
    object-fit: cover;
    vertical-align: middle;
}

.odometer-canvas-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    left: -9999px;
}

.odometer-camera-actions {
    margin-top: 0.25rem;
}

.odometer-gallery-fallback {
    margin: 0.75rem 0 0;
    text-align: center;
}

.admin-user-list .admin-user-item .vehicle-info strong {
    flex: 1 1 100%;
}

@media (min-width: 400px) {
    .admin-user-list .admin-user-item .vehicle-info strong {
        flex: 0 1 auto;
    }
}

.admin-user-role {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.35rem 0.55rem;
    border-radius: 999px;
    white-space: nowrap;
}

.admin-user-role--admin {
    color: #6ee7b7;
    background: rgba(52, 211, 153, 0.14);
    border: 1px solid rgba(52, 211, 153, 0.35);
}

.admin-user-role--user {
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.form-add button,
.settings-grid .btn {
    margin-top: 0.2rem;
    width: 100%;
}

@media (min-width: 480px) {
    .form-add button,
    .settings-grid .btn {
        width: auto;
    }
}

.form-inline input:focus,
.form-add input:focus,
.form-add select:focus,
.form-add textarea:focus,
.settings-grid input:focus {
    outline: none;
    border-color: rgba(56, 189, 248, 0.55);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12), 0 12px 28px rgba(0, 0, 0, 0.25);
    transform: translateY(-1px);
}

.settings-grid {
    display: grid;
    gap: clamp(0.75rem, 2vw, 1.1rem);
    max-width: none;
}

@media (min-width: 640px) {
    .settings-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 900px) {
    .settings-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.settings-grid .card form {
    margin-top: 0.4rem;
}

.settings-grid input {
    margin-bottom: 0.85rem;
}

@media (min-width: 480px) {
    .form-add input,
    .form-add select,
    .form-add textarea {
        max-width: 440px;
    }
    .form-vehicle input {
        max-width: 440px;
    }
}

/* ========== History ========== */
.history-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.history-list li {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    padding: 0.85rem 0.8rem;
    margin-bottom: 0.55rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(145deg, rgba(0, 0, 0, 0.22), rgba(99, 102, 241, 0.05));
    transition: transform 0.28s var(--ease-smooth), box-shadow 0.28s;
}

.history-list li:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
    border-color: rgba(167, 139, 250, 0.25);
}

.history-list li:last-child {
    margin-bottom: 0;
}

@media (min-width: 560px) {
    .history-list li {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        padding: 0.75rem 0.9rem;
    }
}

.history-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    min-width: 0;
}

@media (min-width: 560px) {
    .history-item {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.5rem;
    }
}

.history-item strong {
    font-size: 0.92rem;
}

.history-item .next {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.history-actions {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    flex-shrink: 0;
    width: 100%;
}

@media (min-width: 560px) {
    .history-actions {
        width: auto;
        align-items: center;
    }
}

.history-actions .btn,
.history-actions button {
    flex: 1;
}

@media (min-width: 560px) {
    .history-actions .btn,
    .history-actions button {
        flex: none;
    }
}

.history-actions .form-delete {
    margin: 0;
    display: flex;
    flex: 1;
}

@media (min-width: 560px) {
    .history-actions .form-delete {
        flex: none;
    }
}

.form-delete {
    margin: 0;
}

/* ========== Sidebar vehicle ========== */
.sidebar-vehicle {
    padding: 0.75rem 0.9rem;
    margin: 0.4rem 0.65rem 0.55rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(56, 189, 248, 0.2);
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.1), rgba(0, 0, 0, 0.2));
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.sidebar-vehicle label {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #7dd3fc;
    margin-bottom: 0.45rem;
}

.vehicle-switch-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: stretch;
}

.vehicle-select {
    flex: 1;
    min-width: 0;
    min-height: var(--tap-min);
    padding: 0.5rem 0.65rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.35);
    color: var(--text);
    font-size: 0.86rem;
}

.vehicle-switch-form .btn {
    min-height: var(--tap-min);
}

/* ========== Mis coches ========== */
.vehicle-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.vehicle-item {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding: 1rem 0.85rem;
    margin-bottom: 0.55rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(160deg, rgba(30, 41, 70, 0.6), rgba(10, 14, 28, 0.5));
    transition: transform 0.3s var(--ease-smooth), box-shadow 0.3s;
}

.vehicle-item:hover {
    transform: translateY(-4px) rotateX(2deg);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35), 0 0 40px rgba(167, 139, 250, 0.08);
}

.vehicle-item:last-child {
    margin-bottom: 0;
}

@media (min-width: 560px) {
    .vehicle-item {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
    }
}

.vehicle-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.7rem;
}

.vehicle-info strong {
    flex: 1 1 100%;
    font-size: 0.98rem;
}

@media (min-width: 400px) {
    .vehicle-info strong {
        flex: 0 1 auto;
    }
}

.vehicle-info .plate {
    font-family: ui-monospace, "SF Mono", monospace;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    background: linear-gradient(180deg, rgba(56, 189, 248, 0.2), rgba(0, 0, 0, 0.3));
    border: 1px solid rgba(56, 189, 248, 0.25);
}

.vehicle-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.5rem;
    width: 100%;
}

@media (min-width: 560px) {
    .vehicle-actions {
        width: auto;
        justify-content: flex-end;
        align-items: center;
    }
}

.vehicle-actions .btn {
    flex: 1;
    min-width: 0;
}

@media (min-width: 560px) {
    .vehicle-actions .btn {
        flex: 0 0 auto;
    }
}

.form-inline-sm {
    display: inline;
    margin: 0;
    flex: 1;
}

@media (min-width: 560px) {
    .form-inline-sm {
        flex: 0 0 auto;
    }
}

.form-inline-sm button {
    width: 100%;
}

@media (min-width: 560px) {
    .form-inline-sm button {
        width: auto;
    }
}

.form-delete-inline {
    display: inline;
    margin: 0;
    flex: 1;
}

@media (min-width: 560px) {
    .form-delete-inline {
        flex: 0 0 auto;
    }
}

.form-delete-inline button {
    width: 100%;
}

@media (min-width: 560px) {
    .form-delete-inline button {
        width: auto;
    }
}

.badge-active {
    font-size: 0.72rem;
    font-weight: 700;
    color: #6ee7b7;
    padding: 0.4rem 0.65rem;
    border-radius: 999px;
    text-align: center;
    flex: 1;
    align-self: center;
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.25), rgba(16, 185, 129, 0.1));
    border: 1px solid rgba(52, 211, 153, 0.35);
    box-shadow: 0 0 20px rgba(52, 211, 153, 0.12);
}

@media (min-width: 560px) {
    .badge-active {
        flex: 0 0 auto;
    }
}

/* ========== Modal ========== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right))
        max(0.75rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
    background: rgba(3, 6, 18, 0.65);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    perspective: 1200px;
}

.modal[hidden] {
    display: none;
}

@media (min-width: 540px) {
    .modal {
        align-items: center;
    }
}

.modal-content {
    position: relative;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 1.15rem 1.15rem max(1.15rem, env(safe-area-inset-bottom));
    max-width: 460px;
    width: 100%;
    max-height: min(92vh, 92dvh);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: linear-gradient(165deg, rgba(28, 38, 64, 0.95), rgba(12, 18, 36, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom: none;
    box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.5), 0 0 80px rgba(56, 189, 248, 0.06);
    transform-origin: bottom center;
    animation: fade-rise 0.4s var(--ease-smooth) both;
}

@media (min-width: 540px) {
    .modal-content {
        border-radius: var(--radius);
        border: 1px solid rgba(255, 255, 255, 0.12);
        padding: 1.35rem;
        max-height: 85vh;
        transform-origin: center;
    }
}

.modal-content::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.15);
}

@media (min-width: 540px) {
    .modal-content::before {
        display: none;
    }
}

.modal-content h3 {
    margin: 0 0 1rem;
    font-size: 1.05rem;
    font-weight: 800;
    background: linear-gradient(90deg, #f8fafc, #7dd3fc);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.modal-content label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
}

.modal-content input,
.modal-content select,
.modal-content textarea {
    width: 100%;
    padding: 0.72rem 0.95rem;
    margin-bottom: 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.35);
    color: var(--text);
    font-size: 16px;
}

.modal-actions {
    display: flex;
    flex-direction: column-reverse;
    gap: 0.55rem;
    margin-top: 1rem;
}

.modal-actions .btn {
    width: 100%;
}

@media (min-width: 400px) {
    .modal-actions {
        flex-direction: row;
        justify-content: flex-end;
    }
    .modal-actions .btn {
        width: auto;
        min-width: 108px;
    }
}

/* ========== Cron table ========== */
.card:has(.log-table) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.log-table {
    width: 100%;
    min-width: 520px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.86rem;
}

.log-table th,
.log-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    vertical-align: top;
}

.log-table th {
    color: #94a3c8;
    font-weight: 750;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: linear-gradient(180deg, rgba(56, 189, 248, 0.12), rgba(0, 0, 0, 0.2));
    position: sticky;
    top: 0;
}

.log-table tbody tr {
    transition: background 0.2s;
}

.log-table tbody tr:hover td {
    background: rgba(56, 189, 248, 0.06);
}

.log-table .log-details {
    max-width: 320px;
    word-break: break-word;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.45;
}

@media (max-width: 719px) {
    .card:has(.log-table) {
        overflow-x: visible;
    }

    .log-table {
        min-width: 0;
        display: block;
    }

    .log-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .log-table tbody {
        display: block;
    }

    .log-table tr {
        display: block;
        margin-bottom: 0.6rem;
        padding: 0.75rem 0.85rem;
        border-radius: var(--radius-sm);
        border: 1px solid rgba(255, 255, 255, 0.1);
        background: linear-gradient(145deg, rgba(0, 0, 0, 0.28), rgba(56, 189, 248, 0.05));
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    }

    .log-table td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 1rem;
        padding: 0.4rem 0;
        border: none;
        text-align: right;
        font-size: 0.83rem;
    }

    .log-table td::before {
        content: "";
        flex-shrink: 0;
        font-size: 0.64rem;
        font-weight: 750;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: #7dd3fc;
        padding-top: 0.15rem;
    }

    .log-table td:nth-child(1)::before {
        content: "Fecha";
    }
    .log-table td:nth-child(2)::before {
        content: "Correos";
    }
    .log-table td:nth-child(3)::before {
        content: "Destinatarios";
    }

    .log-table .log-details {
        max-width: none;
    }
}

/* ========== Mobile ========== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 16px 0 48px rgba(0, 0, 0, 0.55);
    }

    .sidebar-close {
        display: flex;
    }

    .menu-toggle {
        display: flex;
    }

    .main-wrap {
        margin-left: 0;
    }

    .content {
        max-width: none;
    }

    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .form-inline .btn {
        width: 100%;
    }

    .card:hover {
        transform: perspective(1000px) rotateX(0deg) translateY(-2px) translateZ(0);
    }
}

@media (max-width: 480px) {
    :root {
        --radius: 16px;
    }

    .auth-card {
        transform: none;
    }
    .auth-card:hover {
        transform: translateY(-2px);
    }

    .btn-sm {
        min-height: var(--tap-min);
    }
}

@media (min-width: 1024px) {
    .content {
        max-width: 1080px;
        padding-left: 1.35rem;
        padding-right: 1.35rem;
    }
}

/* ========== Accesibilidad: menos movimiento ========== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    body.panel-page::before,
    body.panel-page::after,
    .auth-page::before,
    .auth-page::after {
        animation: none;
    }

    .card-km {
        animation: none;
    }

    .card:hover,
    .upcoming-list li:hover,
    .history-list li:hover,
    .vehicle-item:hover {
        transform: none;
    }
}
