/* =========================================
   CHECKLIST VEHÍCULO - F03-PRSP-02
   Estilos principales + Login + Roles
   ========================================= */

/* ===== LOGIN SCREEN ===== */
.login-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #1d4ed8 100%);
    padding: 20px;
}

.login-bg-overlay {
    position: absolute;
    inset: 0;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(59,130,246,.25) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(30,64,175,.3) 0%, transparent 50%);
    pointer-events: none;
}

.login-card {
    background: rgba(255,255,255,.97);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,.5);
    position: relative;
    z-index: 1;
    animation: loginIn .4s ease;
}

@keyframes loginIn {
    from { opacity: 0; transform: translateY(30px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo-icon {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
    margin: 0 auto 14px;
    box-shadow: 0 8px 20px rgba(30,64,175,.4);
}

.login-logo h1 {
    font-size: 20px;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: .5px;
}

.login-logo p {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
    font-weight: 500;
}

.login-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: #f1f5f9;
    border-radius: 12px;
    padding: 4px;
}

.login-tab {
    flex: 1;
    padding: 10px 8px;
    border: none;
    border-radius: 10px;
    background: transparent;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all .2s;
}

.login-tab.active {
    background: white;
    color: #1e40af;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
}

.login-tab-content { display: none; }
.login-tab-content.active { display: block; }

.input-pass-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-pass-wrap input {
    width: 100%;
    padding-right: 44px;
}

.btn-eye {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    font-size: 15px;
    transition: color .2s;
}

.btn-eye:hover { color: #1e40af; }

.btn-login {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    transition: all .2s;
    box-shadow: 0 4px 12px rgba(30,64,175,.3);
    letter-spacing: .3px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(30,64,175,.4);
}

.btn-login-conductor {
    background: linear-gradient(135deg, #065f46, #059669);
    box-shadow: 0 4px 12px rgba(5,150,105,.3);
}

.btn-login-conductor:hover {
    box-shadow: 0 8px 20px rgba(5,150,105,.4);
}

.login-error {
    background: #fef2f2;
    border: 1.5px solid #fca5a5;
    color: #dc2626;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 11px;
    color: #94a3b8;
    border-top: 1px solid #e2e8f0;
    padding-top: 16px;
}

/* ===== ROL CHIP EN SIDEBAR ===== */
.rol-chip {
    margin: 0 12px 8px;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: .3px;
}

.rol-chip.rol-administrador { background: rgba(252,211,77,.2); color: #fde68a; }
.rol-chip.rol-director { background: rgba(167,139,250,.2); color: #c4b5fd; }
.rol-chip.rol-conductor { background: rgba(110,231,183,.2); color: #6ee7b7; }

/* ===== LOGOUT BUTTON ===== */
.btn-logout {
    background: rgba(255,255,255,.15);
    border: none;
    color: rgba(255,255,255,.7);
    width: 34px; height: 34px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all .2s;
    flex-shrink: 0;
}

.btn-logout:hover { background: rgba(220,38,38,.5); color: white; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,.15);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===== CONDUCTOR BANNER ===== */
.conductor-banner {
    background: linear-gradient(90deg, #065f46, #059669);
    color: white;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
}

.conductor-banner i { font-size: 28px; opacity: .8; }
.conductor-banner span { font-size: 18px; font-weight: 800; display: block; }
.conductor-banner small { font-size: 12px; opacity: .85; }

/* ===== CONDUCTOR WELCOME ===== */
.conductor-welcome {
    text-align: center;
    padding: 32px 20px 20px;
    margin-bottom: 20px;
}

.conductor-welcome-icon {
    width: 80px; height: 80px;
    background: linear-gradient(135deg, #065f46, #059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: white;
    margin: 0 auto 16px;
    box-shadow: 0 8px 20px rgba(5,150,105,.3);
}

.conductor-welcome h2 { font-size: 22px; font-weight: 800; color: #1e293b; }
.conductor-welcome p  { font-size: 14px; color: #64748b; margin-top: 6px; }

/* ===== READONLY FIELD ===== */
.readonly-field {
    padding: 9px 12px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #1e40af;
}

/* ===== APP SCREEN ===== */
#appScreen {
    width: 100%;
    min-height: 100vh;
}

:root {
    --primary: #1e40af;
    --primary-light: #3b82f6;
    --primary-dark: #1e3a8a;
    --secondary: #64748b;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --info: #0891b2;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --sidebar-w: 260px;
    --topbar-h: 64px;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
    --radius: 10px;
    --radius-lg: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(160deg, #1e3a8a 0%, #1e40af 60%, #2563eb 100%);
    min-height: 100vh;
    position: fixed;
    left: 0; top: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width .3s ease;
    box-shadow: 4px 0 20px rgba(30,64,175,.3);
}

.sidebar-header {
    padding: 20px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,.15);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
}

.logo-area > i {
    font-size: 28px;
    color: #93c5fd;
}

.logo-title {
    display: block;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    color: white;
}

.logo-sub {
    display: block;
    font-size: 10px;
    color: #93c5fd;
    font-weight: 500;
}

.sidebar-toggle {
    background: rgba(255,255,255,.15);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background .2s;
}

.sidebar-toggle:hover { background: rgba(255,255,255,.25); }

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    color: rgba(255,255,255,.75);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all .2s;
    position: relative;
}

.nav-item i { font-size: 16px; width: 20px; text-align: center; }

.nav-item:hover {
    background: rgba(255,255,255,.15);
    color: white;
}

.nav-item.active {
    background: rgba(255,255,255,.2);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.badge {
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 20px;
    margin-left: auto;
    min-width: 20px;
    text-align: center;
}

.badge-warning { background: var(--warning); }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,.15);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

.user-info > i {
    font-size: 24px;
    color: #93c5fd;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-name { display: block; font-size: 13px; font-weight: 600; }
.user-role { display: block; font-size: 11px; color: #93c5fd; }

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left .3s ease;
}

/* ===== TOPBAR ===== */
.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow);
}

.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }

.page-title { font-size: 18px; font-weight: 700; color: var(--text); }

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--secondary);
    display: none;
    padding: 6px;
    border-radius: 6px;
}

.btn-icon:hover { background: var(--bg); }

.alert-bell {
    position: relative;
    cursor: pointer;
    font-size: 20px;
    color: var(--secondary);
    transition: color .2s;
}

.alert-bell:hover { color: var(--warning); }

.bell-badge {
    position: absolute;
    top: -6px; right: -6px;
    background: var(--danger);
    color: white;
    font-size: 9px;
    font-weight: 700;
    width: 18px; height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.date-display {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    background: var(--bg);
    padding: 6px 12px;
    border-radius: 8px;
}

/* ===== ALERTS PANEL ===== */
.alerts-panel {
    background: #fef3c7;
    border-bottom: 2px solid #f59e0b;
    padding: 12px 24px;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #92400e;
    padding: 4px 0;
}

.alert-item i { color: #d97706; }

/* ===== VIEW CONTAINER ===== */
.view-container { padding: 24px; flex: 1; }

.view { display: none; }
.view.active { display: block; }

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    border-left: 4px solid transparent;
    transition: transform .2s, box-shadow .2s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-blue { border-color: var(--primary-light); }
.stat-green { border-color: var(--success); }
.stat-orange { border-color: var(--warning); }
.stat-red { border-color: var(--danger); }

.stat-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-blue .stat-icon { background: #dbeafe; color: var(--primary-light); }
.stat-green .stat-icon { background: #dcfce7; color: var(--success); }
.stat-orange .stat-icon { background: #fef3c7; color: var(--warning); }
.stat-red .stat-icon { background: #fee2e2; color: var(--danger); }

.stat-number { display: block; font-size: 28px; font-weight: 800; line-height: 1; }
.stat-label { display: block; font-size: 12px; color: var(--text-muted); font-weight: 500; margin-top: 4px; }

/* ===== CARDS ===== */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.card-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h3 i { color: var(--primary-light); }

.card-body { padding: 20px; }
.card-actions { display: flex; align-items: center; gap: 10px; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }

/* ===== DASHBOARD GRID ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    margin-bottom: 0;
}

/* ===== UNIDADES GRID (DASHBOARD) ===== */
.unidades-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.unidad-card {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 10px;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    position: relative;
}

.unidad-card:hover { border-color: var(--primary-light); box-shadow: var(--shadow-md); }

.unidad-card.aprobado { border-color: var(--success); background: #f0fdf4; }
.unidad-card.pendiente { border-color: var(--warning); background: #fffbeb; }
.unidad-card.sin-checklist { border-color: var(--border); }
.unidad-card.rechazado { border-color: var(--danger); background: #fef2f2; }

.unidad-num {
    font-size: 16px;
    font-weight: 800;
    color: var(--primary);
    display: block;
}

.unidad-repartidor {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unidad-status {
    display: inline-block;
    margin-top: 6px;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
}

.status-aprobado { background: #dcfce7; color: var(--success); }
.status-pendiente { background: #fef3c7; color: var(--warning); }
.status-rechazado { background: #fee2e2; color: var(--danger); }
.status-sin { background: #f1f5f9; color: var(--secondary); }

/* ===== DATA TABLE ===== */
.table-responsive { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead th {
    background: var(--bg);
    padding: 10px 14px;
    text-align: left;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background .15s;
}

.data-table tbody tr:hover { background: #f8fafc; }

.data-table tbody td {
    padding: 12px 14px;
    color: var(--text);
    vertical-align: middle;
}

/* ===== STATUS BADGES ===== */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-aprobado { background: #dcfce7; color: var(--success); }
.badge-pendiente { background: #fef3c7; color: var(--warning); }
.badge-rechazado { background: #fee2e2; color: var(--danger); }
.badge-completado { background: #dcfce7; color: var(--success); }
.badge-vencido { background: #fee2e2; color: var(--danger); }
.badge-info { background: #dbeafe; color: var(--primary); font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 20px; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all .2s;
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }

.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }

.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #b45309; }

.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ===== FORMS ===== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-full { grid-column: 1 / -1; }

label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

input[type="text"],
input[type="date"],
input[type="time"],
select,
textarea {
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    background: var(--surface);
    transition: border-color .2s;
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

textarea { resize: vertical; min-height: 80px; }

.required { color: var(--danger); }

.search-input {
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    width: 220px;
}

/* ===== FORM SECTION (Checklist) ===== */
.form-section {
    margin-bottom: 24px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.section-title {
    background: var(--bg);
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.form-section .form-grid { padding: 16px; }

.textarea-obs { width: 100%; min-height: 100px; margin: 0 16px 16px; width: calc(100% - 32px); }

/* ===== CHECKLIST ITEMS ===== */
.checklist-category {
    margin-bottom: 0;
}

.cat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--primary-dark);
}

.cat-icon {
    width: 28px; height: 28px;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
}

.cat-DOCUMENTOS .cat-icon { background: #dbeafe; color: var(--primary); }
.cat-EXTERIOR .cat-icon { background: #dcfce7; color: var(--success); }
.cat-INTERIOR .cat-icon { background: #fef3c7; color: var(--warning); }
.cat-MOTOR .cat-icon { background: #fee2e2; color: var(--danger); }
.cat-SEGURIDAD .cat-icon { background: #f3e8ff; color: #7c3aed; }
.cat-COMBUSTIBLE .cat-icon { background: #ffedd5; color: #ea580c; }
.cat-LIMPIEZA .cat-icon { background: #ecfeff; color: var(--info); }

.checklist-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.checklist-item-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    transition: background .15s;
}

.checklist-item-row:hover { background: #f8fafc; }

.item-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

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

.radio-opt {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.radio-opt input { display: none; }

.radio-btn {
    width: 54px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    border: 1.5px solid var(--border);
    background: var(--bg);
    color: var(--text-muted);
    cursor: pointer;
    transition: all .15s;
    user-select: none;
}

.radio-opt input:checked + .radio-btn.ok { background: #dcfce7; border-color: var(--success); color: var(--success); }
.radio-opt input:checked + .radio-btn.mal { background: #fee2e2; border-color: var(--danger); color: var(--danger); }
.radio-opt input:checked + .radio-btn.na { background: #f1f5f9; border-color: var(--secondary); color: var(--secondary); }

/* ===== FORM ACTIONS ===== */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 0 0;
    border-top: 1px solid var(--border);
    margin-top: 20px;
}

/* ===== FILTROS ===== */
.filtros-historial, .filtros-servicios {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filtros-historial .form-group,
.filtros-servicios .form-group { min-width: 160px; }

/* ===== APROBACIONES ===== */
.aprobaciones-list { display: flex; flex-direction: column; gap: 16px; }

.aprobacion-card {
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow .2s;
}

.aprobacion-card:hover { box-shadow: var(--shadow-md); }

.aprobacion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 10px;
}

.aprobacion-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.aprobacion-meta {
    display: flex;
    gap: 16px;
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.aprobacion-meta span { display: flex; align-items: center; gap: 6px; }
.aprobacion-meta i { color: var(--primary-light); }

/* ===== CONFIG ITEMS ===== */
.config-category-block { margin-bottom: 20px; }

.config-cat-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary-dark);
    padding: 8px 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.config-item-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: background .15s;
}

.config-item-row:hover { background: var(--bg); }

.config-item-name { flex: 1; font-size: 13px; }

/* Toggle Switch */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 22px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--border);
    transition: .3s;
    border-radius: 22px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 16px; width: 16px;
    left: 3px; bottom: 3px;
    background: white;
    transition: .3s;
    border-radius: 50%;
}
input:checked + .slider { background: var(--primary); }
input:checked + .slider:before { transform: translateX(22px); }

/* ===== ALERTAS LIST ===== */
.alertas-list { display: flex; flex-direction: column; gap: 10px; }

.alerta-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 1.5px solid;
    font-size: 13px;
}

.alerta-critica { border-color: #fca5a5; background: #fef2f2; }
.alerta-urgente { border-color: #fcd34d; background: #fffbeb; }
.alerta-normal { border-color: #93c5fd; background: #eff6ff; }

.alerta-icon { font-size: 20px; }
.alerta-critica .alerta-icon { color: var(--danger); }
.alerta-urgente .alerta-icon { color: var(--warning); }
.alerta-normal .alerta-icon { color: var(--primary); }

.alerta-info { flex: 1; }
.alerta-titulo { font-weight: 700; color: var(--text); }
.alerta-sub { color: var(--text-muted); font-size: 12px; }
.alerta-dias { font-weight: 700; font-size: 14px; }
.alerta-critica .alerta-dias { color: var(--danger); }
.alerta-urgente .alerta-dias { color: var(--warning); }
.alerta-normal .alerta-dias { color: var(--primary); }

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(2px);
}

.modal-overlay.open { display: flex; }

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalIn .25s ease;
}

.modal-lg { max-width: 820px; }

@keyframes modalIn {
    from { opacity: 0; transform: scale(.95) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 { font-size: 16px; font-weight: 700; }

.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-muted);
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
    transition: all .2s;
}

.modal-close:hover { background: var(--bg); color: var(--danger); }

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* ===== DETALLE CHECKLIST ===== */
.detalle-header {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.detalle-field label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.detalle-field span { font-size: 14px; font-weight: 600; display: block; margin-top: 2px; }

.detalle-items-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.detalle-items-table th { background: var(--bg); padding: 8px 12px; text-align: left; font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.detalle-items-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }

.resultado-ok { color: var(--success); font-weight: 700; }
.resultado-mal { color: var(--danger); font-weight: 700; }
.resultado-na { color: var(--secondary); }

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 24px; right: 24px;
    background: var(--text);
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    z-index: 999;
    transform: translateY(100px);
    opacity: 0;
    transition: all .3s ease;
    box-shadow: var(--shadow-lg);
    max-width: 360px;
}

.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state i { font-size: 48px; margin-bottom: 12px; opacity: .3; display: block; }
.empty-state p { font-size: 15px; }

/* ===== TEXT UTILS ===== */
.text-muted { color: var(--text-muted); font-size: 13px; }

/* ===== ALERTAS TALLER ===== */
.alerta-taller-card {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    overflow: hidden;
    transition: box-shadow .2s;
}
.alerta-taller-card:hover { box-shadow: var(--shadow-md); }
.alerta-taller-pendiente { border-color: #fca5a5; background: #fff8f8; }
.alerta-taller-agendado  { border-color: #fcd34d; background: #fffdf0; }
.alerta-taller-resuelto  { border-color: #86efac; background: #f0fdf4; opacity: .75; }

.atcard-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap; gap: 8px;
}
.atcard-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.atcard-unidad { font-size: 17px; font-weight: 800; color: var(--primary); }
.atcard-item   { font-size: 14px; font-weight: 600; color: var(--danger); }
.atcard-cat    { font-size: 11px; background: var(--bg); padding: 2px 8px; border-radius: 20px; color: var(--text-muted); font-weight: 600; }
.atcard-estado { font-size: 13px; font-weight: 700; }

.atcard-meta {
    display: flex; flex-wrap: wrap; gap: 14px;
    padding: 10px 16px;
    font-size: 12px; color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.atcard-meta span { display: flex; align-items: center; gap: 5px; }
.atcard-meta i { color: var(--primary-light); }

.atcard-actions {
    padding: 10px 16px;
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}

/* ===== DETALLE UNIDAD ===== */
.detalle-unidad-header {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}
.du-back { flex-shrink: 0; }
.du-info { display: flex; align-items: center; gap: 16px; flex: 1; min-width: 240px; }
.du-icon {
    width: 60px; height: 60px;
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; color: white;
    box-shadow: 0 4px 12px rgba(30,64,175,.3);
    flex-shrink: 0;
}
.du-info h2 { font-size: 20px; font-weight: 800; margin-bottom: 6px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.du-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 13px; color: var(--text-muted); }
.du-meta span { display: flex; align-items: center; gap: 5px; }
.du-meta i { color: var(--primary-light); }
.du-acciones { display: flex; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }

/* ===== IMPORT ZONE ===== */
.import-zone {
    border: 2.5px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    background: var(--bg);
}
.import-zone:hover, .import-zone.drag-over {
    border-color: var(--primary-light);
    background: #eff6ff;
}
.import-icon { font-size: 52px; color: var(--primary-light); margin-bottom: 12px; }
.import-zone h3 { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.import-zone p  { font-size: 14px; color: var(--text-muted); }

/* ===== BADGE DANGER ===== */
.badge-danger { background: var(--danger) !important; }
.badge-secondary { background: var(--secondary); color: white; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px; }

/* ===== SECCIÓN KILOMETRAJE ===== */
#seccionKilometraje {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border-top: 3px solid #0ea5e9;
    border-bottom: 3px solid #0ea5e9;
}
#seccionKilometraje .section-title {
    color: #0369a1;
}
#seccionKilometraje input[type="number"] {
    font-size: 18px;
    font-weight: 700;
    color: #1e40af;
    border: 2px solid #93c5fd;
    border-radius: 10px;
    padding: 12px 48px 12px 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
#seccionKilometraje input[type="number"]:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
    outline: none;
}
/* Campo fecha/hora de solo lectura en checklist */
#chkFechaDisplay, #chkHoraDisplay {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    background: #f1f5f9;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    padding: 9px 14px;
    cursor: not-allowed;
    user-select: none;
}
/* Panel flotante de alerta km final */
#kmFinalAlertaPanel {
    animation: slideUp 0.4s ease;
}

/* ===== MODAL TABS ===== */
.modal-tab {
    flex: 1;
    padding: 8px 6px;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    color: var(--secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all .2s;
    white-space: nowrap;
}
.modal-tab.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.mu-tab-content { display: none; }
.mu-tab-content.active { display: block; }

/* ===== REPORTES GRID ===== */
.reportes-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.reporte-card {
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: all .2s;
    background: white;
    position: relative;
}
.reporte-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.reporte-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    flex-shrink: 0;
}
.reporte-info h4 { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.reporte-info p { font-size: 11px; color: var(--text-muted); line-height: 1.4; }
.reporte-badge {
    position: absolute;
    top: 10px; right: 10px;
    background: #dbeafe;
    color: var(--primary);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
}
.reporte-badge-full {
    background: #ccfbf1;
    color: #0d9488;
}

/* ===== BACKUP GRID ===== */
.backup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
.backup-section {
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    background: #fafbfc;
}
.backup-header {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.backup-header h4 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.backup-header p { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.backup-checks {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.backup-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: white;
    transition: background .15s;
}
.backup-check:hover { background: #eff6ff; }
.backup-check input { accent-color: var(--primary); width: 15px; height: 15px; }
.backup-check i { color: var(--primary-light); font-size: 13px; }
.backup-preview-info {
    background: #f0fdf4;
    border: 1.5px solid #86efac;
    border-radius: 8px;
    padding: 14px;
    font-size: 13px;
}
.backup-preview-info h4 { font-weight: 700; color: #15803d; margin-bottom: 8px; }
.backup-preview-info ul { padding-left: 16px; color: var(--text-muted); }
.backup-preview-info li { margin-bottom: 4px; }

/* ===== RESPONSIVE BÁSICO (el resto en css/responsive.css) ===== */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
}

/* ===================================================
   MOBILE OVERLAY (sidebar backdrop)
   =================================================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 99;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; animation: fadeOverlay .2s ease; }
@keyframes fadeOverlay { from { opacity:0; } to { opacity:1; } }

/* Touch friendly */
.nav-item, .btn, .btn-login {
    -webkit-tap-highlight-color: transparent;
}
.view-container, .sidebar-nav, .modal-body {
    -webkit-overflow-scrolling: touch;
}
