:root {
    --brand-dark: #12263a;
    --brand-mid: #1f4e79;
    --brand-soft: #dce8f2;
    --brand-accent: #c9892b;

    /* Superficies y texto: valores de modo claro (default).
       Redefinidos bajo [data-bs-theme="dark"] mas abajo. */
    --surface-card: rgba(248, 250, 252, 0.95);
    --surface-card-border: rgba(255, 255, 255, 0.35);
    --surface-card-shadow: rgba(7, 17, 27, 0.18);
    --surface-hero: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(220, 232, 242, 0.86));
    --surface-hero-border: rgba(18, 38, 58, 0.08);
    --surface-hero-shadow: rgba(18, 38, 58, 0.08);
    --surface-stat: linear-gradient(180deg, #ffffff, #f5f8fb);
    --surface-stat-border: rgba(18, 38, 58, 0.08);
    --surface-stat-shadow: rgba(18, 38, 58, 0.08);
    --surface-muted: #f9f9f9;
    --surface-muted-hover: #f0f0f0;
    --surface-input: #ffffff;

    --text-strong: #12263a;
    --text-body: #212529;
    --text-muted: #6c757d;
    --text-muted-soft: #6b7280;

    --table-head-bg: #e9f0f6;
    --table-head-color: #12263a;
    --table-row-border: rgba(18, 38, 58, 0.08);

    --badge-soft-bg: #e8f1f8;
    --badge-soft-color: #1f4e79;

    --thumb-placeholder-bg: linear-gradient(135deg, #dfe8ef, #f8fbfd);
    --thumb-placeholder-color: #5a6773;

    --skeleton-a: #f3f3f3;
    --skeleton-b: #e3e3e3;

    --divider-soft: #f0f0f0;
    --border-soft: #ddd;

    color-scheme: light;
}

[data-bs-theme="dark"] {
    --surface-card: rgba(20, 30, 43, 0.94);
    --surface-card-border: rgba(255, 255, 255, 0.08);
    --surface-card-shadow: rgba(0, 0, 0, 0.55);
    --surface-hero: linear-gradient(135deg, rgba(26, 41, 59, 0.96), rgba(15, 26, 39, 0.92));
    --surface-hero-border: rgba(255, 255, 255, 0.08);
    --surface-hero-shadow: rgba(0, 0, 0, 0.4);
    --surface-stat: linear-gradient(180deg, #1a2937, #101c28);
    --surface-stat-border: rgba(255, 255, 255, 0.08);
    --surface-stat-shadow: rgba(0, 0, 0, 0.4);
    --surface-muted: #17232f;
    --surface-muted-hover: #1f2f3d;
    --surface-input: #101c28;

    --text-strong: #eef2f6;
    --text-body: #e4e9ee;
    --text-muted: #a9b6c2;
    --text-muted-soft: #99a7b5;

    --table-head-bg: #1b2e3f;
    --table-head-color: #dce8f2;
    --table-row-border: rgba(255, 255, 255, 0.08);

    --badge-soft-bg: rgba(31, 78, 121, 0.35);
    --badge-soft-color: #a9cdea;

    --thumb-placeholder-bg: linear-gradient(135deg, #1c2c3b, #101a24);
    --thumb-placeholder-color: #9aa7b5;

    --skeleton-a: #1c2b3a;
    --skeleton-b: #253a4c;

    --divider-soft: rgba(255, 255, 255, 0.08);
    --border-soft: rgba(255, 255, 255, 0.15);

    color-scheme: dark;
}

body {
    min-height: 100vh;
    background:
        linear-gradient(135deg, rgba(18, 38, 58, 0.96), rgba(31, 78, 121, 0.88)),
        var(--bg-image, none) center/cover fixed;
    color: var(--text-strong);
}

[data-bs-theme="dark"] body {
    background:
        linear-gradient(135deg, rgba(6, 13, 21, 0.97), rgba(13, 31, 48, 0.94)),
        var(--bg-image, none) center/cover fixed;
}

.glass-shell {
    background: var(--surface-card);
    border: 1px solid var(--surface-card-border);
    box-shadow: 0 16px 40px var(--surface-card-shadow);
    /* El fondo de la card ya es casi opaco (--surface-card ronda 94-95% de
       opacidad), asi que el blur detras apenas se nota pero sigue constando
       tiempo de composicion GPU. 6px (el mismo valor que ya se usaba en
       mobile) da un resultado visualmente equivalente con menos costo,
       sobre todo quando hay varias cards con este efecto en una sola
       pantalla (ej. detalle.html). */
    backdrop-filter: blur(6px);
    color: var(--text-strong);
}

.navbar-brand {
    letter-spacing: 0.06em;
    font-weight: 700;
}

.page-hero {
    border-radius: 1.5rem;
    background: var(--surface-hero);
    border: 1px solid var(--surface-hero-border);
    box-shadow: 0 12px 26px var(--surface-hero-shadow);
    color: var(--text-strong);
}

.section-card {
    border: 0;
    border-radius: 1.25rem;
    box-shadow: 0 12px 26px var(--surface-card-shadow);
}

.vehicle-thumb {
    height: 220px;
    object-fit: cover;
}

.thumb-placeholder {
    height: 220px;
    background: var(--thumb-placeholder-bg);
    color: var(--thumb-placeholder-color);
}

.stat-card {
    border-radius: 1.25rem;
    background: var(--surface-stat);
    border: 1px solid var(--surface-stat-border);
    box-shadow: 0 12px 24px var(--surface-stat-shadow);
    color: var(--text-strong);
}

.small-label {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted-soft);
}

.bg-brand {
    background-color: var(--brand-dark) !important;
}

.btn-brand {
    background: var(--brand-mid);
    border-color: var(--brand-mid);
    color: white;
}

.btn-brand:hover {
    background: #163c5d;
    border-color: #163c5d;
    color: white;
}

.btn-accent {
    background: var(--brand-accent);
    border-color: var(--brand-accent);
    color: white;
}

.btn-accent:hover {
    background: #a96f1a;
    border-color: #a96f1a;
    color: white;
}

.table thead th {
    background: var(--table-head-bg);
    color: var(--table-head-color);
    border-bottom: 0;
}

[data-bs-theme="dark"] .table {
    --bs-table-color: var(--text-body);
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--table-row-border);
}

.badge-soft {
    background: var(--badge-soft-bg);
    color: var(--badge-soft-color);
}

.confirm-modal .modal-content {
    border: 0;
    border-radius: 1.25rem;
    overflow: hidden;
    background: linear-gradient(160deg, rgba(18, 38, 58, 0.98), rgba(22, 60, 93, 0.96));
    color: #f8fafc;
    box-shadow: 0 24px 60px rgba(7, 17, 27, 0.35);
    --confirm-accent: #c9892b;
    --confirm-accent-strong: #a96f1a;
    --confirm-soft: rgba(201, 137, 43, 0.18);
    --confirm-label: rgba(255, 244, 214, 0.72);
}

.confirm-modal .modal-header,
.confirm-modal .modal-footer {
    border-color: rgba(255, 255, 255, 0.08);
}

.confirm-modal .confirm-shell {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.confirm-modal .confirm-icon {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-size: 1.35rem;
    font-weight: 700;
    background: var(--confirm-soft);
    color: var(--confirm-accent);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.confirm-modal .confirm-label {
    color: var(--confirm-label);
}

.confirm-modal .modal-title {
    letter-spacing: 0.03em;
}

.confirm-modal .modal-body {
    color: rgba(248, 250, 252, 0.92);
}

.confirm-modal .confirm-action-button {
    background: var(--confirm-accent);
    border-color: var(--confirm-accent);
    color: #fff;
}

.confirm-modal .confirm-action-button:hover {
    background: var(--confirm-accent-strong);
    border-color: var(--confirm-accent-strong);
    color: #fff;
}

.confirm-modal .btn-close {
    filter: invert(1) grayscale(1) brightness(200%);
}

.confirm-modal.confirm-warning .modal-content {
    --confirm-accent: #c9892b;
    --confirm-accent-strong: #a96f1a;
    --confirm-soft: rgba(201, 137, 43, 0.18);
    --confirm-label: rgba(255, 244, 214, 0.72);
}

.confirm-modal.confirm-danger .modal-content {
    --confirm-accent: #dc3545;
    --confirm-accent-strong: #b02a37;
    --confirm-soft: rgba(220, 53, 69, 0.18);
    --confirm-label: rgba(255, 219, 224, 0.72);
}

.confirm-modal.confirm-info .modal-content {
    --confirm-accent: #4ea1d3;
    --confirm-accent-strong: #2f7fb0;
    --confirm-soft: rgba(78, 161, 211, 0.18);
    --confirm-label: rgba(216, 241, 255, 0.72);
}

.sticky-actions {
    position: sticky;
    top: 1rem;
}

.mobile-action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.mobile-action-group form {
    display: block;
    margin: 0;
}

/* Boton de alternar tema claro/oscuro */
.theme-toggle-btn {
    width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    font-size: 1.05rem;
    transition: background 0.2s ease, transform 0.2s ease;
}

.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #f8fafc;
    transform: translateY(-1px);
}

.theme-toggle-btn:focus-visible {
    outline: 2px solid var(--brand-accent);
    outline-offset: 2px;
}

/* Navbar Optimizado para Mobile y Desktop */
.navbar {
    padding: 0.5rem 0;
}

.navbar-brand {
    font-size: 1.1rem;
    letter-spacing: 0.05em;
}

.navbar-nav .nav-link {
    font-size: 0.95rem;
    padding: 0.5rem 0.75rem !important;
    transition: all 0.2s ease;
}

.navbar-nav .nav-link:hover {
    color: #c9892b !important;
}

.dropdown-menu-dark .dropdown-item {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
}

.dropdown-menu-dark .dropdown-item:hover {
    background-color: rgba(201, 137, 43, 0.2);
    color: #c9892b;
}

@media (max-width: 991.98px) {
    body {
        background:
            linear-gradient(135deg, rgba(18, 38, 58, 0.96), rgba(31, 78, 121, 0.88)),
            var(--bg-image, none) center/cover scroll;
    }

    [data-bs-theme="dark"] body {
        background:
            linear-gradient(135deg, rgba(6, 13, 21, 0.97), rgba(13, 31, 48, 0.94)),
            var(--bg-image, none) center/cover scroll;
    }

    .sticky-actions {
        position: static;
        top: auto;
    }

    .navbar {
        padding: 0.3rem 0;
    }

    .navbar-brand {
        font-size: 0.95rem;
    }

    .navbar-nav {
        gap: 0 !important;
        padding-top: 0.5rem;
    }

    .navbar-nav .nav-link {
        padding: 0.5rem 0.5rem !important;
        font-size: 0.9rem;
    }

    .navbar-nav .badge {
        font-size: 0.75rem;
        margin: 0.5rem 0;
    }

    .dropdown-menu {
        font-size: 0.9rem;
    }

    .navbar .btn {
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    .navbar-brand {
        font-size: 0.85rem;
    }

    .navbar-brand i {
        display: none;
    }

    .navbar-nav .nav-link i {
        margin-right: 0.3rem;
    }

    .navbar-nav .dropdown-toggle::after {
        display: none;
    }

    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

@media (max-width: 767.98px) {
    main.container {
        padding-top: 1rem !important;
        padding-bottom: 1.5rem !important;
    }

    .page-hero,
    .section-card,
    .stat-card {
        border-radius: 1rem;
    }

    .page-hero .display-6 {
        font-size: 1.9rem;
        line-height: 1.15;
    }

    .page-hero .lead {
        font-size: 1rem;
    }

    .vehicle-thumb,
    .thumb-placeholder {
        height: 180px;
    }

    .table-responsive {
        font-size: 0.92rem;
    }

    .mobile-action-group {
        flex-direction: column;
        align-items: stretch !important;
    }

    .mobile-action-group > a,
    .mobile-action-group > button,
    .mobile-action-group > form,
    .mobile-action-group > div {
        width: 100%;
    }

    .mobile-action-group .btn {
        width: 100%;
    }

    .g-recaptcha {
        transform: scale(0.92);
        transform-origin: left top;
    }
}

@media (max-width: 389.98px) {
    .vehicle-thumb,
    .thumb-placeholder {
        height: 160px;
    }

    .g-recaptcha {
        transform: scale(0.86);
    }
}
