/* Modo claro (default) — variables extra */
:root,
[data-theme="light"] {
    color-scheme: light;
    --roadex-navy: #16214a;
    --roadex-navy-dark: #0f1733;
    --roadex-sidebar: #eef1f6;
    --roadex-sidebar-active: #dce4f3;
    --roadex-bg: #f4f5f7;
    --roadex-border: #d8dee8;
    --roadex-text: #1f2937;
    --roadex-muted: #6b7280;
    --roadex-link: #2563eb;
    --roadex-surface: #ffffff;
    --roadex-surface-alt: #f8f9fc;
    --roadex-heading: #111827;
    --roadex-sidebar-text: #374151;
    --roadex-badge-bg: #e5e7eb;
    --roadex-input-bg: #ffffff;
    --roadex-input-text: #111827;
    --roadex-menu-bg: #ffffff;
    --roadex-menu-text: #1f2937;
    --roadex-menu-hover: #f1f5f9;
    --roadex-shadow: rgba(0, 0, 0, 0.08);
    --roadex-overlay: rgba(15, 23, 42, 0.35);
}

/* Modo oscuro */
[data-theme="dark"] {
    color-scheme: dark;
    --roadex-navy: #1a2744;
    --roadex-navy-dark: #111827;
    --roadex-sidebar: #1e293b;
    --roadex-sidebar-active: #334155;
    --roadex-bg: #0f172a;
    --roadex-border: #334155;
    --roadex-text: #e2e8f0;
    --roadex-muted: #94a3b8;
    --roadex-link: #60a5fa;
    --roadex-surface: #1e293b;
    --roadex-surface-alt: #172033;
    --roadex-heading: #f1f5f9;
    --roadex-sidebar-text: #cbd5e1;
    --roadex-badge-bg: #334155;
    --roadex-input-bg: #0f172a;
    --roadex-input-text: #e2e8f0;
    --roadex-menu-bg: #1e293b;
    --roadex-menu-text: #e2e8f0;
    --roadex-menu-hover: #334155;
    --roadex-shadow: rgba(0, 0, 0, 0.35);
    --roadex-overlay: rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] body.app-body {
    background: var(--roadex-bg);
    color: var(--roadex-text);
}

[data-theme="dark"] .page-header {
    border-bottom-color: var(--roadex-border);
}

[data-theme="dark"] .page-header h1 {
    color: var(--roadex-heading);
}

[data-theme="dark"] .module-readonly-banner {
    background: color-mix(in srgb, var(--roadex-surface-alt) 80%, transparent);
    border-color: var(--roadex-border);
    color: var(--roadex-muted);
}

[data-theme="dark"] .sidebar-nav a {
    color: var(--roadex-sidebar-text);
}

[data-theme="dark"] .sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .sidebar-nav a.active {
    color: #93c5fd;
    border-left-color: #60a5fa;
}

[data-theme="dark"] .topbar-search input {
    background: var(--roadex-input-bg);
    color: var(--roadex-input-text);
}

[data-theme="dark"] .topbar-search i {
    color: var(--roadex-muted);
}

[data-theme="dark"] .topbar-user {
    background: #e2e8f0;
    color: var(--roadex-navy-dark);
}

[data-theme="dark"] .btn-roadex-icon {
    background: var(--roadex-surface);
    border-color: var(--roadex-border);
    color: var(--roadex-text);
}

[data-theme="dark"] .btn-roadex-outline {
    background: var(--roadex-surface);
    border-color: var(--roadex-border);
    color: var(--roadex-text);
}

[data-theme="dark"] .btn-roadex-outline.is-active {
    background: var(--roadex-navy);
    border-color: var(--roadex-navy);
    color: #ffffff;
}

[data-theme="dark"] .section-label,
[data-theme="dark"] .section-badge {
    color: var(--roadex-text);
}

[data-theme="dark"] .section-badge {
    background: var(--roadex-badge-bg);
}

[data-theme="dark"] .service-card,
[data-theme="dark"] .empty-state,
[data-theme="dark"] .page-placeholder {
    background: var(--roadex-surface);
    border-color: var(--roadex-border);
}

[data-theme="dark"] .service-card-top {
    border-bottom-color: var(--roadex-border);
}

[data-theme="dark"] .service-card-type,
[data-theme="dark"] .service-card-auth {
    color: var(--roadex-heading);
}

[data-theme="dark"] .service-card-plate,
[data-theme="dark"] .service-card-date {
    color: var(--roadex-text);
}

[data-theme="dark"] .service-card-label {
    color: var(--roadex-muted);
}

[data-theme="dark"] .service-card-thumb {
    background: var(--roadex-badge-bg);
}

[data-theme="dark"] .service-card:hover {
    box-shadow: 0 8px 20px var(--roadex-shadow);
}

[data-theme="dark"] .topbar-lang-menu,
[data-theme="dark"] .topbar-profile-menu {
    background: var(--roadex-menu-bg);
    box-shadow: 0 12px 32px var(--roadex-shadow);
}

[data-theme="dark"] .topbar-lang-menu button,
[data-theme="dark"] .profile-menu-logout {
    color: var(--roadex-menu-text);
}

[data-theme="dark"] .topbar-lang-menu button:hover,
[data-theme="dark"] .topbar-lang-menu button.active,
[data-theme="dark"] .profile-menu-logout:hover {
    background: var(--roadex-menu-hover);
    color: #93c5fd;
}

[data-theme="dark"] .profile-menu-name {
    color: var(--roadex-heading);
}

[data-theme="dark"] .profile-menu-user {
    color: var(--roadex-muted);
}

[data-theme="dark"] .profile-menu-divider {
    background: var(--roadex-border);
}

[data-theme="dark"] .asignacion-error {
    background: rgba(127, 29, 29, 0.35);
    color: #fecaca;
    border-color: rgba(248, 113, 113, 0.45);
}

[data-theme="dark"] .asignacion-btn-outline {
    background: var(--roadex-surface-alt);
    border-color: var(--roadex-border);
    color: var(--roadex-text);
}

[data-theme="dark"] .asignacion-stepper {
    background: var(--roadex-surface);
}

[data-theme="dark"] .filter-item-btn,
[data-theme="dark"] .filter-drawer-footer {
    background: var(--roadex-surface);
}

[data-theme="dark"] .filter-item-btn:hover {
    background: var(--roadex-surface-alt);
}


[data-theme="dark"] .servicio-detail-panel {
    background: var(--roadex-surface);
    color: var(--roadex-text);
}

[data-theme="dark"] .detail-panel-header {
    background: var(--roadex-surface);
}

[data-theme="dark"] .detail-panel-title {
    color: #f8fafc;
}

[data-theme="dark"] .detail-icon-btn {
    background: var(--roadex-badge-bg);
    color: #f1f5f9;
    border-color: #475569;
}

[data-theme="dark"] .detail-icon-btn:hover {
    background: #475569;
    color: #ffffff;
    border-color: #64748b;
}

[data-theme="dark"] .detail-label {
    color: var(--roadex-muted);
}

[data-theme="dark"] .detail-value {
    color: var(--roadex-heading);
}

[data-theme="dark"] .detail-file-link {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(96, 165, 250, 0.35);
}

[data-theme="dark"] .detail-file-link:hover {
    background: rgba(59, 130, 246, 0.22);
}

[data-theme="dark"] .detail-lesionado-card {
    background: var(--roadex-surface);
    border-color: var(--roadex-border);
}

[data-theme="dark"] .detail-lesionado-head h4 {
    color: var(--roadex-heading);
}

[data-theme="dark"] .detail-dx-grid th {
    background: var(--roadex-surface-alt);
}

[data-theme="dark"] .asignacion-drawer {
    background: var(--roadex-surface-alt);
}

[data-theme="dark"] .asignacion-header,
[data-theme="dark"] .asignacion-footer,
[data-theme="dark"] .form-section {
    background: var(--roadex-surface);
}

[data-theme="dark"] .asignacion-step-title,
[data-theme="dark"] .asignacion-title {
    color: var(--roadex-heading);
}

[data-theme="dark"] .asignacion-step-desc,
[data-theme="dark"] .asignacion-kicker {
    color: var(--roadex-muted);
}

[data-theme="dark"] .form-field label {
    color: var(--roadex-muted);
}

[data-theme="dark"] .file-upload-zone {
    background: var(--roadex-surface-alt);
    border-color: var(--roadex-border);
    color: var(--roadex-muted);
}

[data-theme="dark"] .file-upload-zone:hover,
[data-theme="dark"] .file-upload-zone.dragover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}

[data-theme="dark"] .file-upload-zone i {
    color: var(--roadex-muted);
}

[data-theme="dark"] .file-list li {
    background: var(--roadex-surface-alt);
    border-color: var(--roadex-border);
    color: var(--roadex-text);
}

[data-theme="dark"] .file-download-link {
    color: #93c5fd;
}

[data-theme="dark"] .dx-suggestions {
    background: var(--roadex-surface-alt);
    border-color: var(--roadex-border);
}

[data-theme="dark"] .dx-suggestion-item {
    color: var(--roadex-text);
}

[data-theme="dark"] .dx-suggestion-item:hover {
    background: rgba(59, 130, 246, 0.12);
}

[data-theme="dark"] .dx-grid th {
    background: var(--roadex-surface);
    color: var(--roadex-heading);
}

[data-theme="dark"] .dx-grid td {
    color: var(--roadex-text);
}

[data-theme="dark"] .dx-add-btn,
[data-theme="dark"] .dx-remove-btn {
    background: var(--roadex-surface-alt);
    border-color: var(--roadex-border);
    color: var(--roadex-text);
}

[data-theme="dark"] .dx-preview {
    color: var(--roadex-muted);
}

[data-theme="dark"] .form-field input,
[data-theme="dark"] .form-field select,
[data-theme="dark"] .form-field textarea {
    background: var(--roadex-input-bg);
    border-color: var(--roadex-border);
    color: var(--roadex-input-text);
}

[data-theme="dark"] .form-field select:disabled {
    background: var(--roadex-surface-alt);
    color: var(--roadex-muted);
    opacity: 1;
}

[data-theme="dark"] .asignacion-close {
    background: var(--roadex-badge-bg);
    color: var(--roadex-text);
}

[data-theme="dark"] .confirm-save-box {
    background: var(--roadex-surface);
    color: var(--roadex-text);
}

[data-theme="dark"] body {
    background: var(--roadex-bg);
}

[data-theme="dark"] .login-box {
    background: var(--roadex-surface);
    box-shadow: 0 8px 24px var(--roadex-shadow);
}

[data-theme="dark"] .login-box h2 {
    color: #93c5fd;
}

[data-theme="dark"] .login-box input {
    background: var(--roadex-input-bg);
    border-color: var(--roadex-border);
    color: var(--roadex-input-text);
}

[data-theme="dark"] .login-lang-btn {
    background: var(--roadex-surface);
    border-color: var(--roadex-border);
    color: var(--roadex-text);
}

[data-theme="dark"] .login-lang-btn.active {
    background: var(--roadex-navy);
    border-color: var(--roadex-navy);
    color: #fff;
}

.topbar-theme-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    border-radius: 6px;
    width: 34px;
    height: 34px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.topbar-theme-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.login-toolbar {
    position: fixed;
    top: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-theme-btn {
    width: 34px;
    height: 34px;
    border: 1px solid #cbd5e1;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: #334155;
}

.login-theme-btn:hover {
    background: #f1f5f9;
}

[data-theme="dark"] .login-theme-btn {
    background: var(--roadex-surface);
    border-color: var(--roadex-border);
    color: var(--roadex-text);
}

[data-theme="dark"] .login-theme-btn:hover {
    background: var(--roadex-menu-hover);
}

[data-theme="dark"] .service-card-badge-curso {
    background: rgba(59, 130, 246, 0.22);
    color: #93c5fd;
}

[data-theme="dark"] .service-card-badge-completado {
    background: rgba(34, 197, 94, 0.18);
    color: #86efac;
}

[data-theme="dark"] .service-card-estado {
    color: var(--roadex-muted);
}

[data-theme="dark"] .view-toggle-btn.is-active {
    background: #334155;
    border-color: #475569;
    color: #f8fafc;
}

[data-theme="dark"] .detail-docs-missing {
    background: var(--roadex-surface-alt);
    border-color: var(--roadex-border);
    color: var(--roadex-muted);
}

[data-theme="dark"] .detail-docs-group,
[data-theme="dark"] .lesiones-rc-doc-group {
    border-color: var(--roadex-border);
}

[data-theme="dark"] .doc-categoria-box,
[data-theme="dark"] .evidencia-sitio-picker-box {
    background: var(--roadex-surface);
    color: var(--roadex-text);
}

[data-theme="dark"] .doc-categoria-option,
[data-theme="dark"] .evidencia-sitio-picker-option {
    background: var(--roadex-surface-alt);
    border-color: var(--roadex-border);
    color: var(--roadex-link);
}

[data-theme="dark"] .doc-categoria-option:hover,
[data-theme="dark"] .evidencia-sitio-picker-option:hover {
    background: #334155;
    border-color: var(--roadex-link);
}

[data-theme="dark"] .detail-footer-completar-btn {
    color: #86efac;
}
