/* ── Reset y base ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body, .mud-main-content {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: #F8FAFC;
    color: #1E293B;
    font-size: 14px;
}

/* ── Header de página ── */
.page-header {
    background: #1E293B;
    color: white;
    padding: 16px 20px;
}

    .page-header h1 {
        font-size: 18px;
        font-weight: 700;
    }

/* ── Toolbar búsqueda ── */
.toolbar {
    background: white !important;
    padding: 10px 16px !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    border-bottom: 1px solid #E2E8F0 !important;
    flex-wrap: nowrap !important;
    overflow-x: auto;
}

.toolbar-left {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    flex: 1 !important;
    min-width: 0 !important;
    flex-wrap: nowrap !important;
}

.toolbar-actions {
    display: flex !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
    align-items: center !important;
}

.search-input {
    flex: 1 1 140px !important;
    min-width: 100px !important;
    max-width: 350px !important;
    width: auto !important;
    border: 1px solid #E2E8F0 !important;
    border-radius: 8px !important;
    padding: 8px 12px !important;
    font-size: 14px !important;
    outline: none !important;
    background: #F8FAFC !important;
}

    .search-input:focus {
        border-color: #2563EB;
    }

.radio-group {
    display: flex;
    gap: 12px;
}

    .radio-group label {
        display: flex;
        align-items: center;
        gap: 4px;
        cursor: pointer;
        font-size: 13px;
        color: #475569;
    }

.badge {
    background: #EFF6FF;
    color: #2563EB;
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 600;
}

/* ── Lista vehículos ── */
.vl-header {
    background: #1E293B !important;
    color: white !important;
    padding: 14px 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

.vl-title {
    font-size: 18px !important;
    font-weight: 700 !important;
}

.vl-count {
    background: #2563EB !important;
    color: white !important;
    border-radius: 20px !important;
    padding: 2px 10px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
}

.vl-toolbar {
    background: white !important;
    padding: 10px 12px !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    border-bottom: 1px solid #E2E8F0 !important;
}

.vl-search {
    flex: 1 !important;
    border: 1px solid #E2E8F0 !important;
    border-radius: 8px !important;
    padding: 8px 12px !important;
    font-size: 14px !important;
    outline: none !important;
    background: #F8FAFC !important;
    min-width: 0 !important;
    width: 0 !important; /* flex se encarga del ancho */
}

    .vl-search:focus {
        border-color: #2563EB !important;
    }

.vl-filters {
    display: flex !important;
    gap: 4px !important;
    flex-shrink: 0 !important;
}

.vl-filter-btn {
    padding: 6px 12px !important;
    border-radius: 20px !important;
    border: 1px solid #E2E8F0 !important;
    background: white !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #64748B !important;
    cursor: pointer !important;
    white-space: nowrap !important;
}

    .vl-filter-btn.active {
        background: #2563EB !important;
        color: white !important;
        border-color: #2563EB !important;
    }

.vl-list {
    padding: 8px 12px !important;
}

.vl-card {
    display: flex !important;
    align-items: center !important;
    background: white !important;
    border: 1px solid #E2E8F0 !important;
    border-radius: 10px !important;
    margin-bottom: 6px !important;
    cursor: pointer !important;
    transition: box-shadow .15s, border-color .15s !important;
    overflow: hidden !important;
}

    .vl-card:hover {
        box-shadow: 0 2px 8px rgba(0,0,0,.08) !important;
        border-color: #BFDBFE !important;
    }

.vl-card--selected {
    border-color: #2563EB !important;
    background: #F0F7FF !important;
}

.vl-card-bar {
    width: 5px !important;
    background: #10B981 !important;
    align-self: stretch !important;
    flex-shrink: 0 !important;
}

.vl-card--selected .vl-card-bar {
    background: #2563EB !important;
}

.vl-card-body {
    flex: 1 !important;
    padding: 12px 12px !important;
    min-width: 0 !important;
}

.vl-card-top {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
}

.vl-placa {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #1E293B !important;
}

.vl-sub {
    font-size: 12px !important;
    color: #64748B !important;
}

.vl-card-actions {
    display: flex !important;
    gap: 8px !important;
    margin-top: 10px !important;
}

.vl-btn-reg {
    padding: 7px 16px !important;
    background: #2563EB !important;
    color: white !important;
    border: none !important;
    border-radius: 7px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
}

.vl-btn-hist {
    padding: 7px 16px !important;
    background: #475569 !important;
    color: white !important;
    border: none !important;
    border-radius: 7px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
}

.vl-btn-reg:hover {
    background: #1D4ED8 !important;
}

.vl-btn-hist:hover {
    background: #334155 !important;
}

.vl-arrow {
    font-size: 20px !important;
    color: #94A3B8 !important;
    padding: 0 12px !important;
    flex-shrink: 0 !important;
}

/* ── Lista vehículos (estilos legacy, mantener por compatibilidad) ── */
.vehicle-list {
    padding: 8px 12px;
}

.vehicle-card {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: box-shadow .15s, border-color .15s;
}

    .vehicle-card:hover {
        box-shadow: 0 2px 8px rgba(0,0,0,.08);
        border-color: #BFDBFE;
    }

    .vehicle-card.selected {
        border-color: #2563EB;
        background: #EFF6FF;
    }

.card-indicator {
    width: 4px;
    border-radius: 2px;
    background: #10B981;
    align-self: stretch;
    margin-right: 12px;
}

.card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.card-placa {
    font-size: 15px;
    font-weight: 700;
    color: #1E293B;
}

.card-sub {
    font-size: 12px;
    color: #64748B;
}

.card-arrow {
    font-size: 22px;
    color: #94A3B8;
    margin-left: 8px;
}

/* ── Historial ── */
.hist-list {
    padding: 8px 12px;
}

.hist-card {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: box-shadow .15s;
}

    .hist-card:hover {
        box-shadow: 0 2px 8px rgba(0,0,0,.08);
    }

.hist-info {
    flex: 1;
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.hist-lbl {
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: #94A3B8;
    margin-bottom: 2px;
}

.hist-val {
    font-size: 14px;
    font-weight: 700;
    color: #1E293B;
}

.hist-sub {
    font-size: 12px;
    color: #64748B;
}

/* ── Cabecera vehículo (header oscuro) ── */
.veh-header {
    background: #1E293B;
    color: white;
    display: flex;
    gap: 24px;
    padding: 12px 16px;
    flex-wrap: wrap;
}

.veh-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.veh-lbl {
    font-size: 9px;
    font-weight: 700;
    color: #94A3B8;
}

.veh-val {
    font-size: 14px;
    font-weight: 700;
}

/* ── Barra datos mantenimiento ── */
.datos-bar {
    background: white;
    border-bottom: 1px solid #E2E8F0;
    display: flex;
    gap: 16px;
    padding: 10px 16px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.dato-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.dato-lbl {
    font-size: 9px;
    font-weight: 700;
    color: #94A3B8;
}

.dato-val-ro {
    background: #F1F5F9;
    color: #64748B;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
}

.dato-input {
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    background: white;
    outline: none;
    color: #1E293B;
}

    .dato-input:focus {
        border-color: #2563EB;
    }

    .dato-input:disabled {
        background: #F1F5F9;
        color: #94A3B8;
    }

/* ── Secciones título ── */
.section-title {
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 700;
    color: #64748B;
}

.section-dark {
    background: #0F172A;
    color: #94A3B8;
    padding: 8px 16px;
    font-size: 11px;
    font-weight: 700;
}

/* ── Banda modo ── */
.banda {
    padding: 8px 16px;
    color: white;
    font-size: 12px;
    font-weight: 700;
}

/* ── Tarjeta detalle ── */
.det-card {
    background: white;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: 14px;
    margin: 6px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.det-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.det-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 120px;
}

.det-lbl {
    font-size: 9px;
    font-weight: 700;
    color: #94A3B8;
}

.det-select, .det-input {
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 13px;
    background: #F8FAFC;
    color: #1E293B;
    outline: none;
    width: 100%;
}

    .det-select:focus, .det-input:focus {
        border-color: #2563EB;
        background: white;
    }

    .det-select:disabled, .det-input:disabled {
        background: #F1F5F9;
        color: #94A3B8;
    }

.text-right {
    text-align: right;
}

/* ── Registro de cambios ── */
.rc-table {
    background: white;
    margin: 0 12px;
    border: 1px solid #E2E8F0;
    border-radius: 0 0 8px 8px;
    overflow: auto;
}

.rc-header {
    display: grid;
    grid-template-columns: 130px 130px 1fr 1fr 160px;
    background: #1E293B;
    color: #94A3B8;
    font-size: 10px;
    font-weight: 700;
    padding: 8px 12px;
    gap: 8px;
}

.rc-row {
    display: grid;
    grid-template-columns: 130px 130px 1fr 1fr 160px;
    padding: 8px 12px;
    gap: 8px;
    border-top: 1px solid #F1F5F9;
    font-size: 12px;
}

    .rc-row:hover {
        background: #F8FAFC;
    }

.rc-old {
    color: #EF4444;
}

.rc-new {
    color: #10B981;
}

.rc-muted {
    color: #94A3B8;
}

/* ── Botones ── */
.btn-primary, .btn-secondary, .btn-amber, .btn-add, .btn-del {
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    font-size: 13px;
    padding: 10px 20px;
    transition: filter .15s;
}

.btn-primary {
    background: #2563EB;
    color: white;
}

.btn-secondary {
    background: #475569;
    color: white;
}

.btn-amber {
    background: #F59E0B;
    color: white;
}

.btn-add {
    background: #EFF6FF;
    color: #2563EB;
    border: 1px solid #BFDBFE;
    margin: 4px 12px;
    width: calc(100% - 24px);
}

.btn-del {
    background: #FEE2E2;
    color: #EF4444;
    padding: 8px 12px;
    align-self: flex-end;
}

.btn-primary:hover, .btn-secondary:hover, .btn-amber:hover {
    filter: brightness(.9);
}

/* ── Barra de acciones inferior ── */
.action-bar {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #E2E8F0;
    position: sticky;
    bottom: 0;
}

/* ── Loading / Error / Empty ── */
.loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 24px 16px;
    color: #64748B;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #E2E8F0;
    border-top-color: #2563EB;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.empty {
    text-align: center;
    padding: 40px 16px;
    color: #94A3B8;
    font-size: 15px;
}

.alert-error {
    background: #FEE2E2;
    color: #B91C1C;
    padding: 10px 16px;
    margin: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
}

/* ── Grid detalle (modo Ver) ── */
.det-grid-wrap {
    overflow-x: auto;
    margin: 0 12px 8px;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
}

.det-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 600px;
}

    .det-grid thead tr {
        background: #0F172A;
    }

    .det-grid thead th {
        color: #94A3B8;
        font-size: 11px;
        font-weight: 700;
        padding: 10px 12px;
        text-align: left;
        white-space: nowrap;
    }

    .det-grid tbody tr {
        border-top: 1px solid #F1F5F9;
        background: white;
    }

        .det-grid tbody tr:nth-child(even) {
            background: #F8FAFC;
        }

        .det-grid tbody tr:hover {
            background: #EFF6FF;
        }

    .det-grid tbody td {
        padding: 9px 12px;
        color: #1E293B;
        vertical-align: middle;
    }

/* Badges tipo */
.badge-tipo {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

    .badge-tipo.prev {
        background: #DCFCE7;
        color: #166534;
    }

    .badge-tipo.corr {
        background: #FEE2E2;
        color: #991B1B;
    }

/* ── Grid registro de cambios ── */
.rc-wrap {
    overflow-x: auto;
    margin: 0 12px 8px;
    border: 1px solid #E2E8F0;
    border-radius: 0 0 8px 8px;
}

.rc-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    min-width: 500px;
}

    .rc-grid thead tr {
        background: #1E293B;
    }

    .rc-grid thead th {
        color: #94A3B8;
        font-size: 10px;
        font-weight: 700;
        padding: 9px 12px;
        text-align: left;
        white-space: nowrap;
    }

    .rc-grid tbody tr {
        border-top: 1px solid #F1F5F9;
        background: white;
    }

        .rc-grid tbody tr:nth-child(even) {
            background: #F8FAFC;
        }

    .rc-grid tbody td {
        padding: 8px 12px;
        vertical-align: middle;
    }

/* helpers */
.text-muted {
    color: #94A3B8;
}

.text-right {
    text-align: right;
}

.rc-old {
    color: #EF4444;
}

.rc-new {
    color: #10B981;
    font-weight: 600;
}

/* ── Fix Bootstrap override para Web ── */
.det-grid thead tr,
.rc-grid thead tr {
    background: #0F172A !important;
}

.det-grid thead th,
.rc-grid thead th {
    color: #94A3B8 !important;
    background: transparent !important;
    border: none !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    padding: 10px 12px !important;
    text-align: left !important;
    white-space: nowrap !important;
}

.det-grid tbody td,
.rc-grid tbody td {
    padding: 9px 12px !important;
    color: #1E293B !important;
    border: none !important;
    border-top: 1px solid #F1F5F9 !important;
    vertical-align: middle !important;
}

.det-grid tbody tr:nth-child(even),
.rc-grid tbody tr:nth-child(even) {
    background: #F8FAFC !important;
}

.det-grid tbody tr:hover,
.rc-grid tbody tr:hover {
    background: #EFF6FF !important;
}

.rc-grid tbody tr:nth-child(even) {
    background: #F8FAFC !important;
}

.rc-old {
    color: #EF4444 !important;
}

.rc-new {
    color: #10B981 !important;
    font-weight: 600 !important;
}

.badge-tipo.prev {
    background: #DCFCE7 !important;
    color: #166534 !important;
}

.badge-tipo.corr {
    background: #FEE2E2 !important;
    color: #991B1B !important;
}

.section-dark {
    background: #0F172A !important;
    color: #94A3B8 !important;
    padding: 8px 16px !important;
}

.banda {
    color: white !important;
}

.veh-header {
    background: #1E293B !important;
    color: white !important;
}

.veh-lbl {
    color: #94A3B8 !important;
}

.veh-val {
    color: white !important;
}

/* ── Combo producto ── */
.prod-combo-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

    .prod-combo-wrap .det-input {
        flex: 1;
    }

.prod-badge-ok {
    font-size: 11px;
    font-weight: 700;
    color: #10B981;
    white-space: nowrap;
}

.prod-badge-manual {
    font-size: 11px;
    font-weight: 700;
    color: #F59E0B;
    white-space: nowrap;
}

.det-lbl-hint {
    font-size: 9px;
    color: #CBD5E1;
    font-weight: 400;
}

/* ── Tipo Cant - Litros stepper ──────────────────────────── */
.cant-ml-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.btn-cant {
    background: #1E3A5F !important;
    color: #fff !important;
    border: none;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .btn-cant:hover {
        background: #2563EB !important;
    }

.cant-ml-val {
    font-size: 1rem;
    font-weight: 700;
    color: #FFFFFF !important;
    background: #1E3A5F;
    border: 1px solid #2563EB;
    border-radius: 6px;
    min-width: 72px;
    padding: 4px 8px;
    text-align: center;
}

/* ── Toolbar unificado con acciones ─────────────────────── */
.toolbar-full {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    padding: 10px 16px !important;
    background: #0F172A !important;
    border-bottom: 1px solid #1E3A5F !important;
    flex-wrap: wrap !important;
}

.toolbar-left {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
    flex: 1 !important;
    min-width: 0 !important;
}

    .toolbar-left .search-input {
        flex: 1 1 180px !important;
        max-width: 420px !important;
        width: auto !important;
        min-width: 120px !important;
    }

.toolbar-actions {
    display: flex !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
    align-items: center !important;
}
