/* Tokens y modo oscuro: copia de theme.css del sistema de tickets (sección general). */
:root,
[data-bs-theme="light"] {
    --app-bg: #f8f9fa;
    --app-surface: #ffffff;
    --app-surface-alt: #f1f3f5;
    --app-surface-hover: #f3f4f6;
    --app-text: #212529;
    --app-text-soft: #495057;
    --app-muted: #6c757d;
    --app-border: #dee2e6;
    --app-border-strong: #ced4da;
    --app-warning-soft: #fff9e6;
    --app-danger-soft: #ffeef0;
    --app-success-soft: #dcf8c6;
    --app-shadow-color: rgba(0, 0, 0, .12);
}

[data-bs-theme="dark"] {
    color-scheme: dark;
    --app-bg: #121416;
    --app-surface: #1d2024;
    --app-surface-alt: #272b30;
    --app-surface-hover: #30353b;
    --app-text: #e9ecef;
    --app-text-soft: #ced4da;
    --app-muted: #adb5bd;
    --app-border: #41464b;
    --app-border-strong: #59616a;
    --app-warning-soft: #3c310d;
    --app-danger-soft: #3b1f24;
    --app-success-soft: #173a25;
    --app-shadow-color: rgba(0, 0, 0, .42);
    --dgr-bg: var(--app-bg);
    --dgr-gray: var(--app-border);
}

body {
    background-color: var(--app-bg);
    color: var(--app-text);
}

[data-bs-theme="dark"] body,
[data-bs-theme="dark"] main,
[data-bs-theme="dark"] .bg-body,
[data-bs-theme="dark"] .bg-body-tertiary {
    color: var(--app-text);
}

/* Utilidades Bootstrap de color fijo que no cambian con data-bs-theme. */
[data-bs-theme="dark"] .bg-white,
[data-bs-theme="dark"] .bg-light {
    background-color: var(--app-surface) !important;
    color: var(--app-text) !important;
}

[data-bs-theme="dark"] .text-dark {
    color: var(--app-text) !important;
}

[data-bs-theme="dark"] .text-muted {
    color: var(--app-muted) !important;
}

[data-bs-theme="dark"] .text-secondary,
[data-bs-theme="dark"] .text-body-secondary,
[data-bs-theme="dark"] .link-secondary {
    color: var(--app-text-soft) !important;
}

[data-bs-theme="dark"] .border,
[data-bs-theme="dark"] .border-top,
[data-bs-theme="dark"] .border-end,
[data-bs-theme="dark"] .border-bottom,
[data-bs-theme="dark"] .border-start {
    border-color: var(--app-border) !important;
}

[data-bs-theme="dark"] .shadow,
[data-bs-theme="dark"] .shadow-sm,
[data-bs-theme="dark"] .shadow-lg {
    --bs-box-shadow: 0 .5rem 1rem var(--app-shadow-color);
    --bs-box-shadow-sm: 0 .125rem .35rem var(--app-shadow-color);
    --bs-box-shadow-lg: 0 1rem 3rem var(--app-shadow-color);
}

[data-bs-theme="dark"] footer,
[data-bs-theme="dark"] .admin-nav-wrapper,
[data-bs-theme="dark"] .admin-nav-container {
    background: var(--app-surface) !important;
    color: var(--app-text);
    border-color: var(--app-border) !important;
}

[data-bs-theme="dark"] .admin-tab-item {
    color: var(--app-text-soft);
}

[data-bs-theme="dark"] .admin-tab-item:hover,
[data-bs-theme="dark"] .admin-tab-item.active {
    color: var(--dgr-orange, #f39200);
}

[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .modal-content,
[data-bs-theme="dark"] .offcanvas,
[data-bs-theme="dark"] .dropdown-menu,
[data-bs-theme="dark"] .list-group-item,
[data-bs-theme="dark"] .accordion-item,
[data-bs-theme="dark"] .popover {
    background-color: var(--app-surface);
    color: var(--app-text);
    border-color: var(--app-border);
}

[data-bs-theme="dark"] .card-header,
[data-bs-theme="dark"] .card-footer,
[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer,
[data-bs-theme="dark"] .offcanvas-header,
[data-bs-theme="dark"] .accordion-button,
[data-bs-theme="dark"] .input-group-text {
    background-color: var(--app-surface-alt);
    color: var(--app-text);
    border-color: var(--app-border);
}

[data-bs-theme="dark"] .dropdown-item,
[data-bs-theme="dark"] .nav-link:not(.active),
[data-bs-theme="dark"] .page-link {
    color: var(--app-text-soft);
}

[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus,
[data-bs-theme="dark"] .list-group-item-action:hover,
[data-bs-theme="dark"] .list-group-item-action:focus,
[data-bs-theme="dark"] .page-link:hover {
    background-color: var(--app-surface-hover);
    color: var(--app-text);
}

[data-bs-theme="dark"] .nav-tabs {
    border-bottom-color: var(--app-border);
}

[data-bs-theme="dark"] .nav-tabs .nav-link.active {
    background-color: var(--app-surface);
    border-color: var(--app-border) var(--app-border) var(--app-surface);
}

[data-bs-theme="dark"] :is(.alert-light, .btn-light, .badge.bg-light) {
    background-color: var(--app-surface-alt) !important;
    color: var(--app-text) !important;
    border-color: var(--app-border) !important;
}

[data-bs-theme="dark"] .btn-outline-dark {
    --bs-btn-color: var(--app-text-soft);
    --bs-btn-border-color: var(--app-border-strong);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #3b4853;
    --bs-btn-hover-border-color: #697986;
    --bs-btn-focus-shadow-rgb: 105, 121, 134;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #3b4853;
    --bs-btn-active-border-color: #697986;
    color: var(--app-text-soft);
    border-color: var(--app-border-strong);
}

[data-bs-theme="dark"] .table {
    --bs-table-color: var(--app-text);
    --bs-table-bg: var(--app-surface);
    --bs-table-border-color: var(--app-border);
    --bs-table-striped-color: var(--app-text);
    --bs-table-striped-bg: rgba(255, 255, 255, .035);
    --bs-table-hover-color: var(--app-text);
    --bs-table-hover-bg: var(--app-surface-hover);
    color: var(--app-text);
    border-color: var(--app-border);
}

[data-bs-theme="dark"] .table-light {
    --bs-table-color: var(--app-text);
    --bs-table-bg: var(--app-surface-alt);
    --bs-table-border-color: var(--app-border);
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .form-check-input,
[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    background-color: var(--app-surface-alt);
    color: var(--app-text);
    border-color: var(--app-border-strong);
}

[data-bs-theme="dark"] .form-control::placeholder {
    color: var(--app-muted);
    opacity: 1;
}

[data-bs-theme="dark"] .form-control:disabled,
[data-bs-theme="dark"] .form-select:disabled,
[data-bs-theme="dark"] .form-control[readonly] {
    background-color: #24282c;
    color: #91989f;
}
