* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

:root {
    color-scheme: light;
    --bg: #f5f7fb;
    --panel: #ffffff;
    --text: #172033;
    --ink: #172033;
    --muted: #667085;
    --line: #d9dee8;
    --primary: #0f766e;
    --primary-dark: #115e59;
    --brand: #0f766e;
    --blue: #2563eb;
    --danger: #b42318;
    --warning: #b45309;
    --success: #067647;
    --shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
    --sidebar-bg: #101828;
    --sidebar-card: #1d2939;
    --sidebar-text: #f9fafb;
    --sidebar-text-soft: #98a2b3;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: var(--primary-dark);
    text-decoration: none;
    font-weight: 700;
}

button,
input,
select,
textarea {
    font: inherit;
}

.shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 24px 18px;
}

.sidebar .brand {
    align-items: center;
    color: var(--sidebar-text);
    display: flex;
    font-size: 18px;
    font-weight: 800;
    gap: 10px;
    margin-bottom: 16px;
}

.brand-mark {
    align-items: center;
    background: var(--brand);
    border-radius: 8px;
    color: #fff;
    display: inline-flex;
    font-weight: 900;
    height: 32px;
    justify-content: center;
    width: 32px;
}

.company-logo {
    align-items: center;
    background: #fff;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
    padding: 10px;
}

.company-logo img {
    max-height: 64px;
    max-width: 100%;
    object-fit: contain;
}

/* ---- Configuración de empresa ---- */

.settings-form {
    display: grid;
    gap: 18px;
    max-width: 860px;
}

.settings-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.settings-card-head {
    align-items: flex-start;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 14px;
    padding: 18px 22px;
}

.settings-card-head h2 {
    font-size: 17px;
    margin: 0 0 2px;
}

.settings-card-head .muted {
    font-size: 13px;
    margin: 0;
}

.settings-icon {
    align-items: center;
    background: #ecfdf5;
    border-radius: 8px;
    color: var(--primary);
    display: inline-flex;
    flex-shrink: 0;
    height: 38px;
    justify-content: center;
    width: 38px;
}

.settings-icon svg {
    height: 20px;
    width: 20px;
}

.settings-card-body {
    display: grid;
    gap: 16px;
    padding: 18px 22px 22px;
}

.form-grid .span-2 {
    grid-column: span 2;
}

.switch-row {
    align-items: center;
    cursor: pointer;
    display: flex;
    gap: 16px;
    justify-content: space-between;
}

.switch-text {
    display: grid;
    gap: 3px;
}

.switch-title {
    color: var(--ink);
    font-size: 14px;
    font-weight: 700;
}

.switch-desc {
    color: var(--muted);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.45;
}

.switch {
    display: inline-flex;
    flex-shrink: 0;
    height: 26px;
    position: relative;
    width: 46px;
}

.switch input[type='checkbox'] {
    cursor: pointer;
    height: 100%;
    margin: 0;
    min-height: 0;
    opacity: 0;
    position: absolute;
    width: 100%;
    z-index: 1;
}

.switch-slider {
    background: #cbd5e1;
    border-radius: 999px;
    inset: 0;
    position: absolute;
    transition: background 0.15s ease;
}

.switch-slider::before {
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.3);
    content: '';
    height: 20px;
    left: 3px;
    position: absolute;
    top: 3px;
    transition: transform 0.15s ease;
    width: 20px;
}

.switch input:checked + .switch-slider {
    background: var(--primary);
}

.switch input:checked + .switch-slider::before {
    transform: translateX(20px);
}

.switch input:focus-visible + .switch-slider {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.callout {
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    padding: 12px 14px;
}

.callout-warning {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    color: #92400e;
}

.logo-row {
    align-items: flex-start;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.logo-preview {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    flex-shrink: 0;
    height: 108px;
    justify-content: center;
    padding: 12px;
    width: 180px;
}

.logo-preview img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.logo-preview-empty {
    background: #f1f5f9;
    border-style: dashed;
}

.logo-placeholder {
    align-items: center;
    background: var(--primary);
    border-radius: 12px;
    color: #fff;
    display: inline-flex;
    font-size: 26px;
    font-weight: 900;
    height: 56px;
    justify-content: center;
    width: 56px;
}

.logo-actions {
    display: grid;
    flex: 1;
    gap: 10px;
    min-width: 240px;
}

.logo-actions .muted {
    font-size: 13px;
    margin: 0;
}

input[type='file'] {
    border-style: dashed;
    cursor: pointer;
    padding: 8px;
}

input[type='file']::file-selector-button {
    background: #e2e8f0;
    border: 0;
    border-radius: 6px;
    color: #1f2937;
    cursor: pointer;
    font-weight: 700;
    margin-right: 12px;
    padding: 8px 14px;
}

.schedule-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-save {
    background: linear-gradient(to top, var(--bg) 65%, transparent);
    bottom: 0;
    display: flex;
    justify-content: flex-end;
    padding: 14px 0 4px;
    position: sticky;
    z-index: 5;
}

@media (max-width: 720px) {
    .settings-card-head,
    .settings-card-body {
        padding-left: 16px;
        padding-right: 16px;
    }

    .form-grid .span-2 {
        grid-column: auto;
    }

    .schedule-grid {
        grid-template-columns: 1fr;
    }

    .switch-row {
        align-items: flex-start;
    }

    .switch {
        margin-top: 2px;
    }

    .settings-save .btn {
        width: 100%;
    }
}

.user-card {
    background: var(--sidebar-card);
    border-radius: 8px;
    color: #e5e7eb;
    margin-bottom: 20px;
    padding: 12px;
}

.user-card .user-name {
    font-size: 14px;
    font-weight: 700;
}

.user-card .user-email {
    color: var(--sidebar-text-soft);
    font-size: 11px;
    margin-top: 2px;
    word-break: break-all;
}

.user-card .user-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.user-card .user-role {
    background: var(--brand);
    border-radius: 999px;
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 2px 8px;
    text-transform: uppercase;
}

.user-orgs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 10px;
}

.user-orgs-label {
    color: var(--sidebar-text-soft);
    display: block;
    flex: 1 0 100%;
    font-size: 10px;
    letter-spacing: 0.06em;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.org-chip {
    background: #344054;
    border-radius: 999px;
    color: #e5e7eb;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
}

.muted-chip {
    color: var(--sidebar-text-soft);
    font-size: 11px;
    font-style: italic;
}

.nav {
    display: grid;
    gap: 6px;
}

.nav a {
    border-radius: 8px;
    color: #e5e7eb;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 12px;
}

.nav a:hover {
    background: var(--sidebar-card);
}

.main {
    padding: 28px;
}

.page {
    margin: 0 auto;
    max-width: 1180px;
}

.nav-toggle {
    background: var(--sidebar-bg);
    border: 0;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    color: #fff;
    cursor: pointer;
    display: none;
    font-size: 18px;
    left: 12px;
    line-height: 1;
    padding: 10px 12px;
    position: fixed;
    top: 12px;
    z-index: 30;
}

.sidebar-backdrop {
    background: rgba(16, 24, 40, 0.55);
    display: none;
    inset: 0;
    position: fixed;
    z-index: 18;
}

.sidebar-backdrop.open {
    display: block;
}

@media (max-width: 960px) {
    .shell {
        grid-template-columns: 200px 1fr;
    }
    .sidebar {
        padding: 18px 14px;
    }
    .main {
        padding: 22px;
    }
}

@media (max-width: 720px) {
    .shell {
        grid-template-columns: 1fr;
    }
    .nav-toggle {
        display: inline-flex;
    }
    .sidebar {
        bottom: 0;
        left: 0;
        max-width: 80vw;
        overflow-y: auto;
        position: fixed;
        top: 0;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        width: 260px;
        z-index: 20;
    }
    .sidebar.open {
        box-shadow: 4px 0 16px rgba(0, 0, 0, 0.25);
        transform: translateX(0);
    }
    .main {
        max-width: 100vw;
        overflow-x: hidden;
        padding: 64px 14px 22px;
    }
}

.page-header {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 22px;
}

.page-header h1,
.driver-hero h1,
.result-hero h1 {
    letter-spacing: 0;
    margin: 0;
}

.page-header p,
.driver-hero p,
.result-hero p {
    color: var(--muted);
    margin: 8px 0 0;
}

.eyebrow {
    color: var(--primary-dark);
    display: block;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.panel,
.login-card,
.vehicle-card,
.inspection-section,
.inspection-item,
.result-hero {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel {
    padding: 22px;
}

.panel h2,
.inspection-section h2 {
    font-size: 18px;
    margin: 0 0 14px;
}

.kpi-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 18px;
}

.kpi-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.kpi-sub {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-top: 6px;
}

.kpi-divider {
    color: var(--muted);
    font-weight: 600;
    margin: 0 4px;
}

.tabs {
    border-bottom: 2px solid var(--line);
    display: flex;
    gap: 4px;
    margin-bottom: 18px;
}

.tab {
    border-bottom: 3px solid transparent;
    color: var(--muted);
    font-weight: 700;
    margin-bottom: -2px;
    padding: 10px 18px;
    text-decoration: none;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.tab:hover {
    color: var(--ink);
}

.tab-active {
    border-bottom-color: var(--brand);
    color: var(--brand);
}

@media (max-width: 540px) {
    .tabs {
        overflow-x: auto;
    }
    .tab {
        flex: 1;
        text-align: center;
        white-space: nowrap;
    }
}

.kpi {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px 22px;
    position: relative;
    overflow: hidden;
}

.kpi-grid-modern {
    gap: 18px;
}

.kpi-icon {
    font-size: 56px;
    line-height: 1;
    opacity: 0.12;
    pointer-events: none;
    position: absolute;
    right: 12px;
    top: 14px;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.kpi-link:hover .kpi-icon {
    opacity: 0.22;
    transform: scale(1.08) rotate(-4deg);
}

.kpi-label {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.kpi-value {
    align-items: baseline;
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    line-height: 1;
}

.kpi-value strong {
    color: var(--ink);
    font-size: 38px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
}

.kpi-divider {
    color: var(--muted);
    font-size: 26px;
    font-weight: 500;
}

.status-count {
    border-radius: 999px;
    display: inline-block;
    font-size: 12px;
    font-weight: 900;
    margin-right: 4px;
    min-width: 28px;
    padding: 3px 8px;
    text-align: center;
}

.status-count.count-good {
    background: #dcfce7;
    color: #166534;
}
.status-count.count-warning {
    background: #fef3c7;
    color: #92400e;
}
.status-count.count-bad {
    background: #fee2e2;
    color: #991b1b;
}

.idp-bar {
    background: #e2e8f0;
    border-radius: 999px;
    height: 10px;
    min-width: 120px;
    overflow: hidden;
    width: 100%;
}

.idp-bar-fill {
    background: linear-gradient(90deg, #0f766e, #14b8a6);
    display: block;
    height: 100%;
    transition: width 0.3s ease;
}

.section-collapsible {
    padding: 0;
    overflow: hidden;
}

.section-header {
    align-items: center;
    background: transparent;
    border: 0;
    cursor: pointer;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 16px 20px;
    text-align: left;
    width: 100%;
}

.section-header:hover {
    background: #f8fafc;
}

.section-title-wrap {
    align-items: center;
    display: flex;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.section-icon {
    color: var(--brand);
    font-size: 20px;
    width: 18px;
}

.section-title-text strong {
    display: block;
    font-size: 18px;
}

.section-title-text small {
    display: block;
    font-size: 12px;
    margin-top: 2px;
}

.section-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.status-count.count-pending {
    background: #e2e8f0;
    color: #475569;
}

.section-body {
    border-top: 1px solid var(--line);
    padding: 14px 20px 20px;
}

.section-body[hidden] {
    display: none;
}

.photo-field {
    display: grid;
    gap: 8px;
}

.photo-label {
    color: #334155;
    font-size: 14px;
    font-weight: 700;
}

.photo-controls {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.photo-button {
    align-items: center;
    background: var(--brand);
    border-radius: 12px;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font-weight: 700;
    gap: 10px;
    min-height: 56px;
    padding: 12px 18px;
    position: relative;
    transition: background 0.15s ease, transform 0.1s ease;
}

.photo-button:hover {
    background: var(--primary-dark);
}

.photo-button:active {
    transform: scale(0.98);
}

.photo-button input[type=file] {
    height: 100%;
    left: 0;
    opacity: 0;
    position: absolute;
    top: 0;
    width: 100%;
    cursor: pointer;
}

.photo-icon {
    font-size: 24px;
    line-height: 1;
}

.photo-preview {
    border: 1px solid var(--line);
    border-radius: 8px;
    height: 64px;
    object-fit: cover;
    width: 64px;
}

@media (max-width: 540px) {
    .section-header {
        padding: 12px 14px;
    }
    .section-title-text strong {
        font-size: 16px;
    }
    .section-body {
        padding: 12px 14px 16px;
    }
}

.kpi-total {
    color: var(--muted);
    font-size: 26px;
    font-weight: 700;
}

.kpi-sub {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-top: 10px;
}

.kpi > span:not(.kpi-label):not(.kpi-sub):not(.kpi-divider):not(.kpi-total) {
    color: var(--muted);
    display: block;
    font-size: 13px;
    margin-bottom: 8px;
}

.kpi > strong {
    font-size: 32px;
}

.kpi.danger .kpi-value strong,
.kpi.danger strong {
    color: var(--danger);
}

.kpi.warning .kpi-value strong,
.kpi.warning strong {
    color: var(--warning);
}

.kpi::before {
    border-radius: 14px 0 0 14px;
    bottom: 0;
    content: "";
    left: 0;
    position: absolute;
    top: 0;
    width: 4px;
}

.kpi-accent-blue::before { background: linear-gradient(180deg, #3b82f6, #2563eb); }
.kpi-accent-teal::before { background: linear-gradient(180deg, #14b8a6, #0f766e); }
.kpi-accent-danger::before { background: linear-gradient(180deg, #ef4444, #b91c1c); }
.kpi-accent-warning::before { background: linear-gradient(180deg, #f59e0b, #b45309); }
.kpi-accent-purple::before { background: linear-gradient(180deg, #a855f7, #7c3aed); }

.content-grid,
.action-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: 2fr 1fr;
}

.action-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.table-wrap {
    overflow-x: auto;
}

table {
    border-collapse: collapse;
    min-width: 760px;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 12px 10px;
    text-align: left;
    vertical-align: top;
}

th {
    color: #475569;
    font-size: 12px;
    text-transform: uppercase;
}

.actions {
    align-items: center;
    display: flex;
    gap: 12px;
}

.actions form {
    margin: 0;
}

.link-danger {
    background: transparent;
    border: 0;
    color: var(--danger);
    cursor: pointer;
    font-weight: 700;
    padding: 0;
}

.badge {
    background: #e2e8f0;
    border-radius: 999px;
    color: #334155;
    display: inline-block;
    font-size: 12px;
    font-weight: 800;
    padding: 5px 9px;
}

.badge-approved,
.badge-closed,
.badge-active,
.badge-ok {
    background: #dcfce7;
    color: #166534;
}

.badge-failed,
.badge-not_fit,
.badge-expired,
.badge-missing {
    background: #fee2e2;
    color: #991b1b;
}

.badge-warning,
.badge-pending_reinspection,
.badge-needs_review,
.badge-in_progress,
.badge-open {
    background: #fef3c7;
    color: #92400e;
}

.badge-maintenance,
.badge-inactive,
.badge-draft,
.badge-submitted {
    background: #dbeafe;
    color: #1e40af;
}

.badge-reinspection {
    background: #ede9fe;
    color: #5b21b6;
}

a.badge-reinspection {
    text-decoration: none;
}

a.badge-reinspection:hover {
    background: #ddd6fe;
}

.btn {
    align-items: center;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    font-weight: 800;
    gap: 8px;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #e2e8f0;
    color: #1f2937;
}

.btn-danger {
    background: #fee2e2;
    color: var(--danger);
}

.btn-wide {
    width: 100%;
}

.form-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-stack {
    display: grid;
    gap: 16px;
}

label {
    color: #334155;
    display: grid;
    gap: 7px;
    font-size: 14px;
    font-weight: 700;
}

input,
select,
textarea {
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    color: var(--text);
    min-height: 42px;
    padding: 10px 12px;
    width: 100%;
}

textarea {
    resize: vertical;
}

.check-row {
    align-items: center;
    display: flex;
    gap: 10px;
}

.check-row input {
    height: 20px;
    min-height: 20px;
    width: 20px;
}

.form-actions,
.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-end;
}

.license-fieldset {
    border: 1px solid var(--line);
    border-radius: 12px;
    display: grid;
    gap: 16px;
    margin: 0;
    padding: 16px;
}

.license-fieldset legend {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0 6px;
    text-transform: uppercase;
}

.license-categories {
    display: grid;
    gap: 12px;
    justify-items: start;
}

.license-categories-title {
    font-size: 14px;
    font-weight: 700;
}

.license-categories [data-driver-license-target='rows'] {
    display: grid;
    gap: 12px;
    width: 100%;
}

.license-category-row {
    align-items: end;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto;
}

.license-category-remove {
    min-width: 44px;
}

@media (max-width: 720px) {
    .license-category-row {
        grid-template-columns: minmax(0, 1fr);
    }
}

.muted {
    color: var(--muted);
}

.flash {
    border-radius: 8px;
    font-weight: 700;
    margin-bottom: 16px;
    padding: 12px 14px;
}

.flash-success {
    background: #dcfce7;
    color: #166534;
}

.flash-warning {
    background: #fef3c7;
    color: #92400e;
}

.flash-error {
    background: #fee2e2;
    color: #991b1b;
}

.notice {
    border-left: 4px solid var(--blue);
    margin-bottom: 12px;
    padding: 8px 12px;
}

.notice.warning {
    border-color: var(--warning);
}

.notice.danger {
    border-color: var(--danger);
}

.notice p {
    color: var(--muted);
    margin: 4px 0 0;
}

.login-page {
    align-items: center;
    background: linear-gradient(135deg, #e0f2fe, #f8fafc 45%, #ecfdf5);
    display: flex;
    min-height: 100vh;
    justify-content: center;
}

.login-page .page {
    width: min(460px, 92vw);
}

.login-card {
    display: grid;
    gap: 22px;
    padding: 30px;
}

.login-card h1 {
    font-size: 42px;
    margin: 0;
}

.login-page .page:has(.login-card-wide) {
    width: min(640px, 94vw);
}

.login-card-wide {
    gap: 16px;
}

.login-card-wide h1 {
    font-size: 30px;
}

.muted {
    color: var(--muted);
}

.form-section-title {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    margin: 12px 0 0;
    text-transform: uppercase;
}

.plan-options {
    display: grid;
    gap: 10px;
}

.plan-option {
    align-items: flex-start;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    gap: 10px;
    padding: 12px;
}

.plan-option:has(input:checked) {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.plan-option input {
    margin-top: 3px;
}

.plan-option-body {
    display: grid;
    gap: 2px;
}

.plan-option-name {
    font-weight: 700;
}

.plan-option-limits {
    color: var(--muted);
    font-size: 13px;
}

.mobile-list,
.timeline {
    display: grid;
    gap: 14px;
}

.vehicle-card {
    align-items: center;
    display: grid;
    gap: 18px;
    grid-template-columns: 1fr 220px;
    padding: 18px;
}

.plate {
    color: var(--text);
    display: block;
    font-size: 30px;
    font-weight: 900;
    letter-spacing: 0;
}

.timeline-item {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 10px;
    grid-template-columns: auto 1fr auto;
    padding: 12px;
}

.inspection-form {
    display: grid;
    gap: 18px;
}

.inspection-section {
    overflow: hidden;
}

.section-title {
    background: #eef6f6;
    border-bottom: 1px solid var(--line);
    padding: 18px;
}

.section-title p {
    color: var(--muted);
    margin: 0;
}

.inspection-item {
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
    display: grid;
    gap: 14px;
    padding: 18px;
}

.inspection-item p {
    color: var(--muted);
    margin: 4px 0 0;
}

.critical {
    color: var(--danger);
    margin-left: 2px;
}

.choice-row {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.choice-row-binary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-row label {
    display: block;
}

.choice-row input {
    position: absolute;
    opacity: 0;
}

.choice-row span {
    align-items: center;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    display: flex;
    font-size: 16px;
    font-weight: 900;
    justify-content: center;
    min-height: 54px;
    padding: 10px;
    text-align: center;
}

.choice-row-binary span {
    font-size: 30px;
}

.choice-row-yesno span {
    font-size: 18px;
}

.choice-row input:checked + span {
    background: #dcfce7;
    border-color: var(--success);
    color: #166534;
}

.choice-row label:nth-child(2) input:checked + span {
    background: #fee2e2;
    border-color: var(--danger);
    color: #991b1b;
}

.choice-row label:nth-child(3) input:checked + span {
    background: #dbeafe;
    border-color: var(--blue);
    color: #1e40af;
}

.full {
    grid-column: 1 / -1;
}

.result-hero {
    margin-bottom: 18px;
    padding: 28px;
}

.response-list {
    display: grid;
    gap: 10px;
}

.panel-heading {
    align-items: flex-start;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.panel-heading h2 {
    margin-bottom: 4px;
}

.category-response-list {
    display: grid;
    gap: 16px;
}

.category-response-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.category-response-header {
    align-items: flex-start;
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    padding: 16px;
}

.category-response-header h3 {
    font-size: 17px;
    margin: 0 0 6px;
}

.category-response-header p {
    color: var(--muted);
    margin: 0;
}

.category-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.count-pill {
    border-radius: 8px;
    display: inline-flex;
    font-size: 12px;
    font-weight: 900;
    min-width: 44px;
    padding: 6px 8px;
    justify-content: center;
}

.count-good {
    background: #dcfce7;
    color: #166534;
}

.count-regular {
    background: #fef3c7;
    color: #92400e;
}

.count-bad {
    background: #fee2e2;
    color: #991b1b;
}

.category-response-items {
    display: grid;
}

.category-response-item {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr auto;
    padding: 14px 16px;
}

.category-response-item:last-child {
    border-bottom: 0;
}

.category-response-item .item-main p {
    color: var(--muted);
    margin: 4px 0 0;
}

.response-row {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 12px;
}

.response-M {
    border-color: #fecaca;
    background: #fff7f7;
}

.response-R {
    border-color: #fde68a;
    background: #fffbeb;
}

.obs-thread {
    display: grid;
    gap: 8px;
    margin: 8px 0;
}

.obs-bubble {
    border-radius: 10px;
    max-width: 640px;
    padding: 10px 12px;
}

.obs-bubble p {
    margin: 4px 0 0;
    white-space: pre-line;
}

.obs-author {
    display: flex;
    flex-wrap: wrap;
    font-size: 12px;
    font-weight: 700;
    gap: 6px;
}

.obs-author time {
    color: inherit;
    font-weight: 400;
    opacity: 0.75;
}

.obs-bubble-driver {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-left: 3px solid #94a3b8;
    color: #334155;
}

.obs-bubble-supervisor {
    background: #eff6ff;
    border: 1px solid #dbeafe;
    border-left: 3px solid #3b82f6;
    color: #1e3a8a;
    justify-self: end;
}

textarea.is-required,
input[type=file].is-required {
    border-color: var(--warning);
    box-shadow: 0 0 0 1px var(--warning) inset;
}

.label-required {
    color: var(--warning);
}

.row-attention {
    background: #fffbeb;
}

.plate-wrap {
    display: flex;
    justify-content: flex-start;
    margin: 18px 0;
}

.plate-card {
    align-items: center;
    background: #ffffff;
    border: 3px solid #111827;
    border-radius: 10px;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.18), inset 0 0 0 2px #ffffff;
    display: inline-flex;
    flex-direction: column;
    font-family: "Courier New", ui-monospace, monospace;
    gap: 4px;
    min-width: 260px;
    padding: 12px 24px 10px;
}

.plate-number {
    color: #111827;
    font-size: 48px;
    font-weight: 900;
    letter-spacing: 8px;
    line-height: 1;
    text-transform: uppercase;
}

.plate-meta {
    color: #475569;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    text-align: center;
}

@media (max-width: 540px) {
    .plate-number {
        font-size: 36px;
        letter-spacing: 5px;
    }
    .plate-card {
        min-width: 0;
        padding: 10px 16px 8px;
    }
}

.inspection-modal {
    border: none;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
    max-width: min(520px, 94vw);
    padding: 0;
    width: 100%;
}

.inspection-modal::backdrop {
    background: rgba(15, 23, 42, 0.78);
}

.inspection-modal-body {
    padding: 28px 26px;
}

.inspection-modal h2 {
    margin: 0 0 8px;
}

.loader-steps {
    list-style: none;
    margin: 18px 0 0;
    padding: 0;
}

.loader-steps li {
    align-items: center;
    color: var(--muted);
    display: flex;
    font-size: 15px;
    gap: 10px;
    padding: 8px 0;
    transition: color 0.2s ease;
}

.loader-steps li.step-done {
    color: var(--success);
    font-weight: 700;
}

.loader-steps .step-icon {
    display: inline-flex;
    width: 22px;
    justify-content: center;
}

.inspection-modal-result {
    text-align: center;
    padding: 8px 4px;
}

.inspection-modal-result .result-icon {
    font-size: 64px;
    line-height: 1;
    margin-bottom: 12px;
}

.inspection-modal-result h2 {
    font-size: 26px;
    margin: 0 0 12px;
}

.inspection-modal-result p {
    color: #334155;
    font-size: 17px;
    line-height: 1.45;
    margin: 0 0 22px;
}

.inspection-modal-result .btn {
    width: 100%;
}

.inspection-modal-result.result-approved h2 {
    color: var(--success);
}

.inspection-modal-result.result-needs_review h2 {
    color: var(--warning);
}

.inspection-modal-result.result-failed h2 {
    color: var(--danger);
}

.hidden {
    display: none !important;
}

.row-attention td:first-child {
    border-left: 4px solid var(--warning);
}

.status-value {
    color: var(--ink, #17202a);
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.status-pill {
    align-items: center;
    background: #e2e8f0;
    border-radius: 999px;
    color: #475569;
    display: inline-flex;
    flex: none;
    height: 36px;
    justify-content: center;
    width: 36px;
}

.status-pill svg {
    height: 20px;
    width: 20px;
}

.status-pill-B {
    background: #dcfce7;
    color: #15803d;
}

.status-pill-R {
    background: #fef3c7;
    color: #b45309;
}

.status-pill-M {
    background: #fee2e2;
    color: #b91c1c;
}

.status-pill-A {
    background: #f1f5f9;
    color: #94a3b8;
}

.text-small {
    font-size: 20px;
}

.empty-state {
    text-align: center;
}

.kpi-link {
    color: inherit;
    cursor: pointer;
    display: block;
    text-decoration: none;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.kpi-link:hover {
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
    transform: translateY(-2px);
}

.failure-list {
    list-style: disc inside;
    margin: 0;
    padding: 0;
}

.failure-list li {
    margin-bottom: 6px;
}

.critical {
    color: var(--danger);
    font-weight: 900;
    margin-left: 4px;
}

.filter-grid {
    align-items: end;
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.filter-actions {
    display: flex;
    gap: 10px;
    grid-column: 1 / -1;
    justify-content: flex-end;
}

@media (max-width: 640px) {
    .filter-grid {
        grid-template-columns: 1fr;
    }
    .filter-actions {
        flex-direction: column;
    }
    .filter-actions .btn {
        width: 100%;
    }
}

.link-image {
    color: var(--accent, #0f766e);
    font-weight: 600;
    text-decoration: underline;
}

.image-modal {
    border: none;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.25);
    max-width: min(960px, 92vw);
    max-height: 90vh;
    padding: 0;
    width: auto;
}

.image-modal::backdrop {
    background: rgba(15, 23, 42, 0.75);
}

.image-modal figure {
    margin: 0;
    padding: 16px;
}

.image-modal img {
    display: block;
    max-width: 100%;
    max-height: 70vh;
    height: auto;
    border-radius: 8px;
    margin: 0 auto;
}

.image-modal figcaption {
    color: #475569;
    font-size: 14px;
    margin-top: 12px;
    text-align: center;
}

.image-modal-close {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 28px;
    line-height: 1;
    padding: 8px 14px;
    position: absolute;
    right: 4px;
    top: 4px;
}

@media (max-width: 640px) {
    .image-modal {
        max-width: 96vw;
    }
    .image-modal img {
        max-height: 60vh;
    }
}

@media (max-width: 820px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
        padding: 14px;
    }

    .nav {
        flex-wrap: wrap;
    }

    .page {
        padding: 16px;
    }

    .page-header,
    .vehicle-card {
        align-items: stretch;
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .content-grid,
    .kpi-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .choice-row {
        grid-template-columns: 1fr;
    }

    .timeline-item {
        grid-template-columns: 1fr;
    }

    .category-response-header,
    .category-response-item {
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .category-counts {
        justify-content: flex-start;
    }

    .button-row .btn,
    .form-actions .btn {
        width: 100%;
    }
}

/* Centro de ayuda */
.help-toc {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.help-toc a {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 14px;
    padding: 7px 14px;
}

.help-toc a:hover {
    border-color: var(--primary);
    color: var(--primary-dark);
}

.help-group {
    margin-bottom: 18px;
    scroll-margin-top: 16px;
}

.help-topic {
    border-top: 1px solid var(--line);
}

.help-topic:first-of-type {
    border-top: 0;
}

.help-topic summary {
    cursor: pointer;
    font-weight: 700;
    list-style: none;
    padding: 14px 4px;
    position: relative;
    padding-right: 28px;
}

.help-topic summary::-webkit-details-marker {
    display: none;
}

.help-topic summary::after {
    content: "▸";
    color: var(--muted);
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.15s ease;
}

.help-topic[open] summary::after {
    transform: translateY(-50%) rotate(90deg);
}

.help-topic-body {
    padding: 0 4px 16px;
}

.help-topic-body p,
.help-topic-body ul,
.help-topic-body ol {
    margin: 0 0 10px;
}

.help-topic-body ul,
.help-topic-body ol {
    padding-left: 22px;
}

.help-topic-body li {
    margin-bottom: 6px;
}

.help-steps li {
    margin-bottom: 10px;
}

.help-badges {
    list-style: none;
    padding-left: 0 !important;
}

.help-badges li {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.signature-field {
    display: grid;
    gap: 8px;
}

.signature-label {
    color: #334155;
    font-size: 14px;
    font-weight: 700;
}

.signature-canvas-wrap {
    background: #fff;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.signature-canvas-wrap canvas {
    cursor: crosshair;
    display: block;
    touch-action: none;
    width: 100%;
}

.signature-hint {
    color: #94a3b8;
    font-size: 14px;
    left: 50%;
    pointer-events: none;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    white-space: nowrap;
}

.signature-actions {
    display: flex;
    justify-content: flex-end;
}

.btn-sm {
    font-size: 13px;
    min-height: 34px;
    padding: 6px 12px;
}

.signature-image {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    display: block;
    margin-top: 4px;
    max-width: 260px;
}
