:root {
    color-scheme: light;
    --mover-bg: #f8f9fa;
    --mover-surface: #ffffff;
    --mover-surface-alt: #f1f3f5;
    --mover-text: #212529;
    --mover-muted: #6c757d;
    --mover-border: #dee2e6;
    --mover-input: #ffffff;
    --mover-primary: #054288;
    --mover-hover: #e9ecef;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --mover-bg: #111827;
    --mover-surface: #1f2937;
    --mover-surface-alt: #273449;
    --mover-text: #e5e7eb;
    --mover-muted: #aeb8c7;
    --mover-border: #3b4a60;
    --mover-input: #172033;
    --mover-primary: #3b82f6;
    --mover-hover: #334155;
    background: var(--mover-bg);
}

body,
.card,
.modal-content,
.dropdown-menu,
.form-control,
.custom-select,
.table,
.nav-scroller {
    transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

html[data-theme="dark"] body,
html[data-theme="dark"] body.bg-light {
    background-color: var(--mover-bg) !important;
    color: var(--mover-text);
}

html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .card,
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .card-body,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .agency-email-item,
html[data-theme="dark"] .login-container,
html[data-theme="dark"] .form-section {
    background-color: var(--mover-surface) !important;
    color: var(--mover-text);
}

html[data-theme="dark"] .text-dark,
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6,
html[data-theme="dark"] label,
html[data-theme="dark"] legend {
    color: var(--mover-text) !important;
}

html[data-theme="dark"] .text-muted,
html[data-theme="dark"] .text-secondary,
html[data-theme="dark"] small,
html[data-theme="dark"] .dataTables_info,
html[data-theme="dark"] .copyright,
html[data-theme="dark"] .form-section p {
    color: var(--mover-muted) !important;
}

html[data-theme="dark"] .border,
html[data-theme="dark"] .border-top,
html[data-theme="dark"] .border-bottom,
html[data-theme="dark"] .card,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer,
html[data-theme="dark"] hr {
    border-color: var(--mover-border) !important;
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .custom-select,
html[data-theme="dark"] .dataTables_wrapper input,
html[data-theme="dark"] .dataTables_wrapper select {
    background-color: var(--mover-input) !important;
    border-color: var(--mover-border) !important;
    color: var(--mover-text) !important;
}

html[data-theme="dark"] .form-control:disabled,
html[data-theme="dark"] .form-control[readonly] {
    background-color: #2d3748 !important;
    color: #cbd5e1 !important;
}

html[data-theme="dark"] .form-control::placeholder {
    color: #8996a9;
}

html[data-theme="dark"] .form-section input[type="text"],
html[data-theme="dark"] .form-section input[type="password"] {
    background-color: var(--mover-input);
    border-color: var(--mover-border);
    color: var(--mover-text);
}

html[data-theme="dark"] .form-section input::placeholder {
    color: #8996a9;
}

html[data-theme="dark"] .table {
    background-color: var(--mover-surface);
    color: var(--mover-text);
}

html[data-theme="dark"] .table th,
html[data-theme="dark"] .table td,
html[data-theme="dark"] .table-bordered,
html[data-theme="dark"] .table-bordered th,
html[data-theme="dark"] .table-bordered td {
    border-color: var(--mover-border) !important;
}

html[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd),
html[data-theme="dark"] table.dataTable tbody tr.odd {
    background-color: #202c3d;
}

html[data-theme="dark"] .table-striped tbody tr:nth-of-type(even),
html[data-theme="dark"] table.dataTable tbody tr.even {
    background-color: var(--mover-surface);
}

html[data-theme="dark"] .table-hover tbody tr:hover,
html[data-theme="dark"] table.dataTable tbody tr:hover {
    background-color: var(--mover-hover) !important;
    color: #ffffff;
}

html[data-theme="dark"] .dropdown-item {
    color: var(--mover-text);
}

html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus {
    background-color: var(--mover-hover);
    color: #ffffff;
}

html[data-theme="dark"] .dropdown-divider {
    border-color: var(--mover-border);
}

html[data-theme="dark"] .nav-tabs,
html[data-theme="dark"] .nav-scroller {
    border-color: var(--mover-border);
}

html[data-theme="dark"] .nav-tabs .nav-link,
html[data-theme="dark"] .nav-underline .nav-link {
    color: #b9c5d6;
}

html[data-theme="dark"] .nav-tabs .nav-link.active,
html[data-theme="dark"] .nav-tabs .nav-item.show .nav-link,
html[data-theme="dark"] .nav-underline .nav-link.active {
    background-color: var(--mover-surface);
    border-color: var(--mover-border) var(--mover-border) var(--mover-surface);
    color: #ffffff;
}

html[data-theme="dark"] .page-link,
html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button {
    background-color: var(--mover-surface) !important;
    border-color: var(--mover-border) !important;
    color: #cbd5e1 !important;
}

html[data-theme="dark"] .page-item.active .page-link,
html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background-color: var(--mover-primary) !important;
    border-color: var(--mover-primary) !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .page-item.disabled .page-link {
    background-color: #1a2332 !important;
    color: #64748b !important;
}

html[data-theme="dark"] .close {
    color: #ffffff;
    text-shadow: none;
}

html[data-theme="dark"] .alert-light,
html[data-theme="dark"] .badge-light {
    background-color: var(--mover-surface-alt);
    border-color: var(--mover-border);
    color: var(--mover-text);
}

html[data-theme="dark"] .swal-modal,
html[data-theme="dark"] .swal-content__input {
    background-color: var(--mover-surface);
    border-color: var(--mover-border);
    color: var(--mover-text);
}

html[data-theme="dark"] .swal-title,
html[data-theme="dark"] .swal-text {
    color: var(--mover-text);
}

html[data-theme="dark"] .trumbowyg-box,
html[data-theme="dark"] .trumbowyg-editor,
html[data-theme="dark"] .trumbowyg-button-pane {
    background-color: var(--mover-input);
    border-color: var(--mover-border);
    color: var(--mover-text);
}

html[data-theme="dark"] .trumbowyg-button-pane button:not(.trumbowyg-disable):hover,
html[data-theme="dark"] .trumbowyg-button-pane button.trumbowyg-active {
    background-color: var(--mover-hover);
}

.theme-toggle {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 50%;
    background: transparent;
    color: #ffffff;
    cursor: pointer;
}

.theme-toggle:hover,
.theme-toggle:focus {
    background: rgba(255, 255, 255, .12);
    color: #ffffff;
    outline: none;
}

.login-theme-toggle {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 10;
    background: rgba(17, 24, 39, .8);
    box-shadow: 0 4px 18px rgba(0, 0, 0, .25);
}

html[data-theme="dark"] body.login-page::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(5, 12, 24, .66);
    pointer-events: none;
}

html[data-theme="dark"] .login-container {
    position: relative;
    border: 1px solid var(--mover-border);
    box-shadow: 0 12px 38px rgba(0, 0, 0, .5);
}

html[data-theme="dark"] .logo-section {
    border-color: var(--mover-border) !important;
}
/* Bloqueo global mientras un formulario modal se está guardando. */
.modal .modal-content {
    position: relative;
}

.modal-saving-overlay {
    position: absolute;
    z-index: 1080;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    cursor: wait;
    background: rgba(255, 255, 255, .72);
    border-radius: inherit;
}

.modal-saving-message {
    display: inline-flex;
    align-items: center;
    padding: .8rem 1rem;
    color: #fff;
    font-weight: 600;
    background: #054288;
    border-radius: .35rem;
    box-shadow: 0 .4rem 1.2rem rgba(0, 0, 0, .22);
}

html[data-theme="dark"] .modal-saving-overlay {
    background: rgba(18, 21, 24, .78);
}
