:root {
    /* Blooming360 brand palette */
    --pine: #184B44;      /* Pino Verde Oscuro */
    --fern: #56AD71;      /* Verde Helecho */
    --mint: #A8DDB5;      /* Verde Menta */
    --smoke: #F1F3F5;     /* Blanco Humo */
    --stone: #8D99A6;     /* Gris Piedra */
    --midnight: #060712;  /* Azul Medianoche */

    --app-bg: var(--smoke);
    --app-surface: #ffffff;
    --app-border: #e3e8e5;
    --app-text: var(--midnight);
    --app-muted: var(--stone);
    --app-accent: var(--pine);
    --app-secondary: var(--fern);
}

body {
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    letter-spacing: 0.01em;
}

h1, h2, h3, h4, h5, h6,
.navbar-brand,
.modal-title,
.dash-saludo,
.stat-valor,
.kpi-valor,
.chart-titulo,
.badge-estado,
.btn,
.form-label {
    font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
}

/* ---------- Login ---------- */

.auth-body {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(160deg, var(--smoke) 0%, #f8faf9 45%, #e7f1eb 100%);
}

.auth-wrapper {
    width: 100%;
    max-width: 26rem;
}

.auth-card {
    border: 1px solid var(--app-border);
    border-radius: 1.25rem;
    box-shadow: 0 10px 30px rgb(24 75 68 / 0.08);
    background: var(--app-surface);
}

.auth-logo-img {
    display: block;
    height: 4.5rem;
    width: auto;
    margin: 0 auto;
}

/* ---------- Panel ---------- */

.admin-body {
    background: var(--app-bg);
    color: var(--app-text);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.admin-body main {
    flex: 1;
}

.app-navbar {
    background: var(--app-surface);
    border-bottom: 1px solid var(--app-border);
}

.brand-logo {
    height: 2rem;
    width: auto;
    object-fit: contain;
}

.app-navbar .nav-link {
    border-radius: 0.6rem;
    color: var(--app-muted);
    font-size: 0.925rem;
}

.app-navbar .nav-link:hover {
    color: var(--app-accent);
    background: var(--app-bg);
}

.app-navbar .nav-link.active {
    background: var(--midnight);
    color: #fff;
}

.user-avatar {
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 50%;
    background: var(--app-accent);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.user-actions {
    border-top: 1px solid var(--app-border);
    padding: 0.75rem 0 0.5rem;
    margin-top: 0.5rem;
}

@media (min-width: 992px) {
    .user-actions {
        border-top: 0;
        padding: 0;
        margin-top: 0;
    }
}

.panel-card {
    border: 1px solid var(--app-border);
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgb(24 75 68 / 0.06);
    background: var(--app-surface);
}

.empty-icon {
    width: 4rem;
    height: 4rem;
    border-radius: 1.25rem;
    background: var(--mint);
    color: var(--app-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}

.app-footer {
    border-top: 1px solid var(--app-border);
    background: var(--app-surface);
}

/* ---------- Controles ---------- */

.form-control:focus,
.form-select:focus {
    border-color: var(--app-accent);
    box-shadow: 0 0 0 0.2rem rgb(24 75 68 / 0.1);
}

.btn {
    border-radius: 0.6rem;
}

.btn-pine {
    --bs-btn-bg: var(--pine);
    --bs-btn-border-color: var(--pine);
    --bs-btn-color: #fff;
    --bs-btn-hover-bg: #123d36;
    --bs-btn-hover-border-color: #123d36;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: #0f332e;
    --bs-btn-active-border-color: #0f332e;
    --bs-btn-active-color: #fff;
}

.btn-outline-pine {
    --bs-btn-color: var(--pine);
    --bs-btn-border-color: var(--pine);
    --bs-btn-hover-bg: var(--pine);
    --bs-btn-hover-border-color: var(--pine);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: #123d36;
    --bs-btn-active-border-color: #123d36;
    --bs-btn-active-color: #fff;
}

@media (max-width: 575.98px) {
    .auth-card {
        border-radius: 1rem;
    }

    .app-navbar .nav-link {
        font-size: 0.95rem;
        padding: 0.6rem 0.75rem;
    }
}

/* ---------- Configuración: accordion ---------- */

.accordion-item {
    border: 1px solid var(--app-border);
    border-radius: 0.8rem !important;
    margin-bottom: 0.75rem;
    overflow: hidden;
    background: var(--app-surface);
}

.accordion-button {
    font-weight: 600;
    color: var(--app-text);
    background: var(--app-surface);
}

.accordion-button:not(.collapsed) {
    color: var(--pine);
    background: var(--mint);
    box-shadow: none;
}

.accordion-button:focus {
    box-shadow: 0 0 0 0.2rem rgb(24 75 68 / 0.08);
}

/* ---------- Configuración: tablas ---------- */

.dt-scroll {
    border-radius: 0.6rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.dt-scroll .table-dt {
    width: 100% !important;
    margin-bottom: 0;
}

/* Columna de acciones fija a la derecha al desplazar */
.dt-scroll .table-dt th:last-child,
.dt-scroll .table-dt td:last-child {
    position: sticky;
    right: 0;
    z-index: 1;
    background: var(--app-surface);
    box-shadow: -8px 0 10px -8px rgb(6 7 18 / 0.14);
}

.dt-scroll .table-dt thead th:last-child {
    z-index: 2;
}

.dt-scroll .table-dt tbody tr:hover td:last-child {
    background: #f3faf5;
}

.table-dt thead th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--stone);
    font-weight: 600;
    background: transparent;
    border-bottom: 2px solid var(--smoke);
    padding: 0.6rem 0.75rem;
    white-space: nowrap;
}

.table-dt tbody td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--smoke);
    vertical-align: middle;
    font-size: 0.875rem;
}

.table-dt tbody tr:hover td {
    background: rgb(168 221 181 / 0.14);
}

.dt-id {
    color: var(--stone);
    font-variant-numeric: tabular-nums;
}

div.dt-container .dt-search input,
div.dt-container .dt-length select {
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    padding: 0.3rem 0.7rem;
    font-size: 0.85rem;
    background: var(--app-surface);
}

div.dt-container .dt-length select {
    padding: 0.25rem 0.6rem;
}

div.dt-container .dt-paging .dt-paging-button {
    border: 1px solid var(--app-border) !important;
    border-radius: 0.45rem !important;
    margin: 0 0.15rem;
    color: var(--app-text) !important;
    background: var(--app-surface) !important;
    padding: 0.3rem 0.65rem;
}

div.dt-container .dt-paging .dt-paging-button:hover:not(.disabled),
div.dt-container .dt-paging .dt-paging-button.current:hover:not(.disabled) {
    background: var(--mint) !important;
    border-color: var(--mint) !important;
    color: var(--pine) !important;
}

div.dt-container .dt-paging .dt-paging-button.current {
    background: var(--pine) !important;
    border-color: var(--pine) !important;
    color: #fff !important;
}

div.dt-container .dt-info {
    color: var(--stone);
    font-size: 0.8rem;
}

.dt-acciones {
    text-align: center;
}

.btn-icon {
    width: 1.9rem;
    height: 1.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0.5rem;
    padding: 0;
    font-size: 0.8rem;
    color: var(--stone);
    background: transparent;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.btn-icon:hover {
    background: var(--smoke);
    color: var(--pine);
}

.btn-icon.danger:hover {
    background: rgb(220 53 69 / 0.1);
    color: #dc3545;
}

.badge-estado {
    display: inline-block;
    padding: 0.28em 0.7em;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-estado.activo {
    background: var(--mint);
    color: var(--pine);
}

.badge-estado.inactivo {
    background: var(--smoke);
    color: var(--stone);
}

/* ---------- Configuración: detalles ---------- */

.detalle-fila {
    padding: 0.45rem 0.25rem;
    border-bottom: 1px solid var(--smoke);
}

.detalle-fila:last-child {
    border-bottom: 0;
}

.detalle-label {
    color: var(--stone);
    font-size: 0.8rem;
    font-weight: 600;
}

.detalle-valor {
    font-size: 0.875rem;
}

#toastCrud {
    border: 1px solid var(--app-border);
    border-radius: 0.7rem;
    box-shadow: 0 8px 24px rgb(6 7 18 / 0.12);
    background: var(--app-surface);
    color: var(--app-text);
}

/* ---------- Vehículos: cards de combustible ---------- */

.text-pine {
    color: var(--pine);
}

.vehicle-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.vehicle-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgb(24 75 68 / 0.1);
}

.foto-previa {
    max-width: 100%;
    max-height: 6rem;
    border-radius: 0.5rem;
    border: 1px solid var(--app-border);
    object-fit: cover;
}

.foto-mini {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 0.45rem;
    border: 1px solid var(--app-border);
    object-fit: cover;
}

.foto-mini:hover {
    opacity: 0.8;
}

#buscarVehiculo {
    min-width: 16rem;
    border: 1px solid var(--app-border);
    border-radius: 0.6rem;
}

/* ---------- Mantenimientos ---------- */

.chip-estado {
    border: 1px solid var(--app-border);
    border-radius: 999px;
    font-size: 0.8rem;
    padding: 0.3rem 0.85rem;
    color: var(--app-muted);
    background: var(--app-surface);
}

.chip-estado:hover {
    background: var(--smoke);
    color: var(--app-text);
}

.chip-estado.active {
    background: var(--pine);
    border-color: var(--pine);
    color: #fff;
}

.badge-estado.mant-pendiente {
    background: #fff1d6;
    color: #8a5a00;
}

.badge-estado.mant-en-proceso {
    background: #d9ecff;
    color: #1d5f9e;
}

.badge-estado.mant-completado {
    background: var(--mint);
    color: var(--pine);
}

.badge-estado.mant-cancelado {
    background: var(--smoke);
    color: var(--stone);
}

.badge-estado.mant-vencido {
    background: #fbdcdc;
    color: #a32121;
}

.badge-estado.prioridad-baja {
    background: var(--smoke);
    color: var(--stone);
}

.badge-estado.prioridad-media {
    background: #e8eef5;
    color: #3d5a80;
}

.badge-estado.prioridad-alta {
    background: #fff1d6;
    color: #8a5a00;
}

.badge-estado.prioridad-critica {
    background: #fbdcdc;
    color: #a32121;
}

/* ---------- Reportes ---------- */

.kpi-card {
    border: 1px solid var(--app-border);
    border-radius: 0.9rem;
    background: var(--app-surface);
    box-shadow: 0 1px 3px rgb(24 75 68 / 0.05);
}

.kpi-label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--stone);
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.kpi-valor {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--pine);
    font-variant-numeric: tabular-nums;
}

.kpi-valor.kpi-small {
    font-size: 1.05rem;
    line-height: 1.35;
    color: var(--app-text);
}

.chart-card {
    border: 1px solid var(--app-border);
    border-radius: 0.9rem;
    background: var(--app-surface);
}

.chart-titulo {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--app-text);
    margin-bottom: 0.75rem;
}

.chart-card canvas {
    max-height: 260px;
}

.impacto-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.impacto-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgb(24 75 68 / 0.1);
}

.semaforo {
    width: 0.95rem;
    height: 0.95rem;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgb(6 7 18 / 0.06);
}

.semaforo-verde {
    background: #3cae6b;
}

.semaforo-amarillo {
    background: #e0a61e;
}

.semaforo-rojo {
    background: #d64545;
}

.semaforo-gris {
    background: #9aa5b1;
}

.mini-metrica {
    background: var(--smoke);
    border-radius: 0.6rem;
    padding: 0.45rem 0.2rem;
}

.mini-valor {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--app-text);
    font-variant-numeric: tabular-nums;
}

.mini-label {
    font-size: 0.65rem;
    color: var(--stone);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.alerta-lista {
    border-top: 1px solid var(--smoke);
    padding-top: 0.5rem;
    max-height: 9rem;
    overflow-y: auto;
}

/* ---------- Dashboard ---------- */

.dash-hero {
    background: linear-gradient(135deg, var(--pine) 0%, #0e3832 60%, #060712 100%);
    border-radius: 1.25rem;
    padding: 1.5rem 1.75rem;
    color: #fff;
    box-shadow: 0 10px 28px rgb(24 75 68 / 0.25);
}

.dash-hero .btn-light {
    border: 1px solid rgb(255 255 255 / 0.25);
    background: rgb(255 255 255 / 0.1);
    color: #fff;
}

.dash-hero .btn-light:hover {
    background: rgb(255 255 255 / 0.2);
    color: #fff;
}

.dash-fecha {
    text-transform: capitalize;
    font-size: 0.8rem;
    color: var(--mint);
    margin: 0;
}

.dash-saludo {
    font-size: 1.5rem;
    font-weight: 700;
}

.dash-sub {
    color: rgb(255 255 255 / 0.75);
    font-size: 0.9rem;
}

.stat-card {
    border: 1px solid var(--app-border);
    border-radius: 1rem;
    background: var(--app-surface);
    box-shadow: 0 1px 3px rgb(24 75 68 / 0.05);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgb(24 75 68 / 0.1);
}

.stat-icon {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.stat-icon-pine {
    background: var(--pine);
    color: #fff;
}

.stat-icon-fern {
    background: rgb(86 173 113 / 0.18);
    color: var(--pine);
}

.stat-icon-mint {
    background: var(--mint);
    color: var(--pine);
}

.stat-icon-stone {
    background: #fff1d6;
    color: #8a5a00;
}

.stat-valor {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--app-text);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.stat-label {
    font-size: 0.72rem;
    color: var(--stone);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.leyenda-dot {
    display: inline-block;
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    margin-right: 0.25rem;
}

.dash-fila {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.25rem;
    border-bottom: 1px solid var(--smoke);
}

.dash-fila:last-child {
    border-bottom: 0;
}

.dash-fila-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.6rem;
    background: var(--smoke);
    color: var(--pine);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#graficaMensualDash {
    max-height: 280px;
}

#graficaFlota {
    max-height: 280px;
}

@media (max-width: 575.98px) {
    .dash-hero {
        padding: 1.1rem 1.2rem;
        border-radius: 1rem;
    }

    .dash-saludo {
        font-size: 1.2rem;
    }

    .stat-card .card-body {
        gap: 0.45rem;
        padding: 0.6rem;
    }

    .stat-icon {
        width: 1.8rem;
        height: 1.8rem;
        border-radius: 0.6rem;
        font-size: 0.9rem;
    }

    .stat-valor {
        font-size: 0.88rem;
    }

    .stat-label {
        font-size: 0.6rem;
    }
}

@media (max-width: 575.98px) {
    .table-dt thead th,
    .table-dt tbody td {
        padding: 0.5rem 0.6rem;
    }

    .table-dt tbody td {
        font-size: 0.8rem;
    }

    .dt-scroll .table-dt th:last-child,
    .dt-scroll .table-dt td:last-child {
        box-shadow: -6px 0 8px -6px rgb(6 7 18 / 0.18);
    }

    div.dt-container .dt-search {
        width: 100%;
    }

    div.dt-container .dt-search input {
        width: 100%;
    }
}
