:root {
    --brand: #f59e0b;
    --brand-dark: #d97706;
    --brand-soft: #fef3c7;
    --ink: #111827;
    --bg-app: #f3f4f6;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-soft: #e5e7eb;
    --radius-lg: 14px;
    --shadow-card: 0 4px 18px rgba(17, 24, 39, 0.07);
    --bs-link-color: #b45309;
    --bs-link-color-rgb: 180, 83, 9;
    --bs-link-hover-color: #92400e;
}
html { box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }
body { background: var(--bg-app); color: var(--text-main); font-family: 'Inter', system-ui, sans-serif; }

.btn-primary { --bs-btn-bg: var(--brand-dark); --bs-btn-border-color: var(--brand-dark); --bs-btn-hover-bg: #b45309; --bs-btn-hover-border-color: #b45309; --bs-btn-active-bg: #92400e; --bs-btn-active-border-color: #92400e; --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); }
.btn-outline-primary { --bs-btn-color: var(--brand-dark); --bs-btn-border-color: var(--brand-dark); --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark); --bs-btn-active-bg: #b45309; --bs-btn-active-border-color: #b45309; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(245, 158, 11, .25); }
.form-check-input:checked { background-color: var(--brand-dark); border-color: var(--brand-dark); }
.text-bg-primary { background-color: var(--brand-dark) !important; }
.nav-pills .nav-link.active { background: var(--brand-dark); }

/* ---------- Shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 250px; flex-shrink: 0; background: var(--ink); padding: 1.25rem .85rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar-brand { display: flex; align-items: center; gap: .6rem; color: #fff; font-weight: 800; font-size: 1.05rem; padding: 0 .5rem 1.25rem; }
.sidebar-nav { display: flex; flex-direction: column; gap: .15rem; }
.nav-section { color: rgba(255,255,255,.4); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; padding: .9rem .9rem .3rem; }
.nav-link-item { display: flex; align-items: center; gap: .7rem; color: rgba(255,255,255,.72); text-decoration: none; padding: .55rem .85rem; border-radius: 9px; font-size: .9rem; font-weight: 500; }
.nav-link-item i { font-size: 1.05rem; width: 1.2rem; text-align: center; }
.nav-link-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link-item.active { background: rgba(245,158,11,.16); color: #fbbf24; box-shadow: inset 3px 0 0 var(--brand); }
.sidebar-user { display: flex; align-items: center; gap: .6rem; padding: .9rem .6rem .3rem; border-top: 1px solid rgba(255,255,255,.1); margin-top: .75rem; }
.avatar-circle { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: var(--ink); display: flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0; }
.sidebar-user-info { overflow: hidden; flex-grow: 1; }
.sidebar-user-name { color: #fff; font-size: .86rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { color: rgba(255,255,255,.5); font-size: .75rem; }
.sidebar-logout { color: rgba(255,255,255,.6); font-size: 1.1rem; }
.sidebar-logout:hover { color: #fff; }
.sidebar-offcanvas { background: var(--ink); width: 270px; }
.sidebar-offcanvas .offcanvas-header { border-bottom: 1px solid rgba(255,255,255,.1); }
.app-main { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar { background: var(--ink); padding: .65rem 1rem; gap: .5rem; position: sticky; top: 0; z-index: 1020; }
.topbar-toggle { border: none; font-size: 1.4rem; color: #fbbf24; padding: 0 .25rem; }
.topbar-brand { font-weight: 800; color: #fff; display: flex; align-items: center; gap: .45rem; }
.app-content { flex-grow: 1; padding: 1.5rem 1.75rem 1rem; }
.app-footer { padding: 2rem 0 .5rem; text-align: center; }
@media (max-width: 991.98px) { .app-content { padding: 1rem; } }

/* ---------- Componentes ---------- */
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; }
.page-header h1 { font-size: 1.45rem; font-weight: 800; margin: 0; }
.page-header .subtitle { color: var(--text-muted); font-size: .9rem; margin: .15rem 0 0; }
.card { border: 1px solid var(--border-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.card-header { background: #fff; border-bottom: 1px solid var(--border-soft); font-weight: 700; border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important; }
.table { margin-bottom: 0; }
.table > thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 700; background: #f9fafb; white-space: nowrap; }
.table td { vertical-align: middle; }
.stat-card { padding: 1rem 1.1rem; display: flex; align-items: center; gap: .9rem; height: 100%; }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.35rem; flex-shrink: 0; }
.stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.stat-label { color: var(--text-muted); font-size: .82rem; margin-top: .2rem; }
.bg-soft-success { background: #dcfce7; color: #15803d; }
.bg-soft-danger { background: #fee2e2; color: #b91c1c; }
.bg-soft-warning { background: #fef3c7; color: #b45309; }
.bg-soft-info { background: #e0f2fe; color: #0369a1; }
.bg-soft-dark { background: #e5e7eb; color: #111827; }
.empty-state { text-align: center; color: var(--text-muted); padding: 2.5rem 1rem; }
.empty-state i { font-size: 2.2rem; display: block; margin-bottom: .5rem; opacity: .6; }
.dl-grid { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; font-size: .9rem; margin: 0; }
.dl-grid dt { color: var(--text-muted); font-weight: 500; }
.dl-grid dd { margin: 0; font-weight: 600; }
.pre-wrap { white-space: pre-wrap; }

/* ---------- Checklist móvil ---------- */
.vehicle-tile { display: block; text-decoration: none; color: inherit; border: 1px solid var(--border-soft); border-radius: var(--radius-lg); background: #fff; padding: 1rem; box-shadow: var(--shadow-card); height: 100%; }
.vehicle-tile:hover { border-color: var(--brand); color: inherit; }
.vehicle-tile.disabled { opacity: .65; }
.vehicle-tile .code { font-size: 1.25rem; font-weight: 800; }
.check-section { margin-bottom: 1rem; }
.check-item { padding: .85rem 1rem; border-bottom: 1px solid var(--border-soft); }
.check-item:last-child { border-bottom: 0; }
.check-item .question { font-weight: 600; margin-bottom: .5rem; }
.check-item.is-fail { background: #fef2f2; }
.check-item.is-missing { outline: 2px solid #dc3545; outline-offset: -2px; }
.answer-group { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.answer-group .btn { font-weight: 700; padding: .6rem .25rem; }
.fail-extra { display: none; margin-top: .6rem; }
.check-item.is-fail .fail-extra { display: block; }
.sig-pad { width: 100%; height: 180px; border: 2px dashed #cbd5e1; border-radius: 10px; background: #fff; touch-action: none; display: block; }
.sticky-submit { position: sticky; bottom: 0; background: linear-gradient(rgba(243,244,246,0), var(--bg-app) 35%); padding: 1rem 0 .5rem; z-index: 10; }

/* ---------- Login ---------- */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; background: radial-gradient(circle at 20% 10%, #374151, var(--ink) 60%); }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 18px; box-shadow: 0 20px 50px rgba(0,0,0,.35); padding: 2rem; }
.auth-brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.3rem; margin-bottom: .25rem; }
.auth-subtitle { color: var(--text-muted); font-size: .9rem; margin-bottom: 1.5rem; }

/* ---------- Etiquetas QR imprimibles ---------- */
.qr-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.qr-label { border: 2px solid var(--ink); border-radius: 12px; padding: .9rem; text-align: center; background: #fff; page-break-inside: avoid; break-inside: avoid; }
.qr-label .qr-code { display: flex; justify-content: center; margin: .5rem 0; }
.qr-label .qr-title { font-size: 1.6rem; font-weight: 800; letter-spacing: .03em; }
.qr-label .qr-hint { font-size: .75rem; color: #374151; }
@media print {
    .sidebar, .app-topbar, .no-print, .app-footer, .alert { display: none !important; }
    .app-content { padding: 0; }
    body { background: #fff; }
}
