/* Fondo de página: no depende de Tailwind dark: (SSR + islas WASM) */
html,
body {
    min-height: 100%;
    margin: 0;
}

html {
    background-color: #f9fafb;
}

html.dark {
    background-color: #1a1a27;
}

html.dark body {
    background-color: #1a1a27 !important;
}

body {
    background-color: inherit;
}

/* Shell del portal: mismo color que html en claro/oscuro (sobrescribe Mud si hace falta) */
.fd-app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #f9fafb;
}

html.dark .fd-app-shell {
    background-color: #1a1a27;
}

.fd-app-main {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    background-color: #f9fafb;
}

html.dark .fd-app-main {
    background-color: #1a1a27;
}

/* Páginas de auditoría: fondo coherente al navegar entre rutas WASM */
.fd-portal-audit-page {
    background-color: transparent;
}

html.dark .fd-portal-audit-page {
    background-color: #1a1a27;
    min-height: 100%;
}

/* Tarjetas y tipografía del portal (no dependen del primer render de Blazor) */
.fd-portal-card {
    background-color: #ffffff;
    border-color: #e5e7eb;
}

html.dark .fd-portal-card {
    background-color: #232333 !important;
    border-color: #374151 !important;
}

.fd-portal-text-primary {
    color: #1f2937;
}

html.dark .fd-portal-text-primary {
    color: #f3f4f6 !important;
}

.fd-portal-text-secondary {
    color: #6b7280;
}

html.dark .fd-portal-text-secondary {
    color: #9ca3af !important;
}

.fd-portal-code-inline {
    font-size: 0.75rem;
    line-height: 1rem;
    color: #4b5563;
}

html.dark .fd-portal-code-inline {
    color: #d1d5db !important;
    background-color: #1a1a27;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    border: 1px solid #374151;
}

html.dark .fd-portal-tabs-panel {
    background-color: #232333;
}

html.dark .fd-portal-table {
    background-color: #232333;
    border-color: #374151;
}

/* MudBlazor en portal oscuro (tabs, tablas, expansion panels) */
html.dark .fd-portal-tabs .mud-tabs-tabbar {
    background-color: #1a1a27;
    border-bottom: 1px solid #374151;
}

html.dark .fd-portal-tabs .mud-tab.mud-tab-active {
    color: #ff5d00;
}

html.dark .fd-portal-tabs .mud-tab:not(.mud-tab-active) {
    color: #9ca3af;
}

html.dark .fd-portal-tabs .mud-tabs-panels {
    background-color: #232333;
}

html.dark .fd-portal-expansion .mud-expand-panel {
    background-color: #232333;
    color: #eceff1;
}

html.dark .fd-portal-expansion .mud-expand-panel-header {
    background-color: #1a1a27;
}

html.dark .fd-portal-expansion .mud-expand-panel-content {
    background-color: #232333;
}

html.dark .fd-portal-table .mud-table-root {
    color: #e5e7eb;
}

html.dark .fd-portal-table .mud-table-head .mud-table-cell {
    color: #cbd5e1;
}

html.dark .fd-portal-table .mud-table-body .mud-table-cell {
    color: #e5e7eb;
}

html.dark .fd-portal-table .mud-table-cell {
    color: #e5e7eb !important;
}

html.dark .fd-portal-table .mud-table-root .mud-table-body {
    background-color: #232333;
}

html.dark .fd-portal-tabs {
    border-color: #374151 !important;
}

/* Dropdown de MudSelect (popover en body; fuera del contenedor fd-portal-audit) */
html.dark .mud-popover-provider .mud-list,
html.dark .mud-popover .mud-list {
    background-color: #1a1a27 !important;
}

html.dark .mud-popover-provider .mud-list-item-text,
html.dark .mud-popover .mud-list-item-text {
    color: #f3f4f6 !important;
}

html.dark .fd-portal-tabs .mud-input-input,
html.dark .fd-portal-tabs .mud-input-slot input,
html.dark .fd-portal-tabs input.mud-input-slot,
html.dark .fd-portal-tabs .mud-input > input {
    color: #f3f4f6 !important;
    -webkit-text-fill-color: #f3f4f6 !important;
}

html.dark .fd-portal-tabs .mud-input-label {
    color: #d1d5db !important;
}

html.dark .fd-portal-tabs .mud-input-adornment {
    color: #94a3b8 !important;
}

html.dark .fd-portal-tabs .mud-input-input::placeholder,
html.dark .fd-portal-tabs .mud-input-slot input::placeholder,
html.dark .fd-portal-tabs .mud-input > input::placeholder {
    color: #94a3b8 !important;
    opacity: 1;
}

/* Filtros y formularios en páginas de auditoría (fuera de tabs) */
html.dark .fd-portal-audit .mud-input-input,
html.dark .fd-portal-audit .mud-input-slot input,
html.dark .fd-portal-audit input.mud-input-slot,
html.dark .fd-portal-audit .mud-input > input,
html.dark .fd-portal-audit .mud-select-input {
    color: #f3f4f6 !important;
    -webkit-text-fill-color: #f3f4f6 !important;
}

html.dark .fd-portal-audit .mud-input-label {
    color: #d1d5db !important;
}

/* Etiqueta outlined: quitar recuadro blanco (notch del borde) */
html.dark .fd-portal-audit .mud-input-label-inputcontrol,
html.dark .fd-portal-audit .mud-input-label-outlined,
html.dark .fd-portal-select .mud-input-label-inputcontrol,
html.dark .fd-portal-select .mud-input-label-outlined {
    background-color: #232333 !important;
}

html.dark .fd-portal-audit .mud-input-outlined legend span,
html.dark .fd-portal-select .mud-input-outlined legend span {
    background-color: #232333 !important;
    color: #d1d5db !important;
}

html.dark .fd-portal-audit .mud-input-outlined fieldset,
html.dark .fd-portal-select .mud-input-outlined fieldset {
    border-color: #4b5563 !important;
}

html.dark .fd-portal-audit .mud-input-adornment,
html.dark .fd-portal-audit .mud-input-control .mud-input-outlined-border {
    color: #94a3b8 !important;
}

html.dark .fd-portal-audit .mud-input-outlined .mud-input-outlined-border {
    border-color: #4b5563 !important;
}

html.dark .fd-portal-audit .mud-input-outlined.mud-input-focused .mud-input-outlined-border {
    border-color: #ff5d00 !important;
}

html.dark .fd-portal-audit .mud-input-input::placeholder,
html.dark .fd-portal-audit .mud-input-slot input::placeholder,
html.dark .fd-portal-audit .mud-input > input::placeholder {
    color: #94a3b8 !important;
    opacity: 1;
}

html.dark .fd-portal-audit .mud-checkbox .mud-typography,
html.dark .fd-portal-audit .mud-checkbox-label {
    color: #e5e7eb !important;
}

html.dark .fd-portal-audit .mud-button-outlined.mud-button-outlined-default {
    color: #e5e7eb !important;
    border-color: #4b5563 !important;
}

html.dark .fd-portal-audit .mud-button-outlined.mud-button-outlined-default:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

html.dark .fd-portal-table .mud-table-row:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.03);
}

html.dark .fd-portal-table .mud-table-row:hover {
    background-color: rgba(255, 93, 0, 0.08) !important;
}

html.dark .fd-portal-audit-dialog.mud-dialog {
    background-color: #232333 !important;
    color: #e5e7eb;
}

html.dark .fd-portal-audit-dialog .mud-dialog-title {
    background-color: #232333;
    color: #f3f4f6;
    border-bottom: 1px solid #374151;
}

html.dark .fd-portal-audit-dialog .mud-dialog-content {
    background-color: #232333;
    color: #e5e7eb;
}

html.dark .fd-portal-audit-dialog .mud-dialog-actions {
    background-color: #232333;
    border-top: 1px solid #374151;
}

html.dark .fd-portal-audit-dialog .mud-button-text {
    color: #e5e7eb !important;
}

html.dark .fd-profile-page .mud-input-input,
html.dark .fd-profile-page .mud-input-slot input,
html.dark .fd-profile-page .mud-input > input,
html.dark .fd-dialog-form .mud-input-input,
html.dark .fd-dialog-form .mud-input-slot input,
html.dark .fd-dialog-form .mud-input > input {
    color: #f3f4f6 !important;
    -webkit-text-fill-color: #f3f4f6 !important;
}

html.dark .fd-profile-page .mud-input-label,
html.dark .fd-dialog-form .mud-input-label {
    color: #d1d5db !important;
}

html.dark .fd-profile-page .mud-input-adornment,
html.dark .fd-dialog-form .mud-input-adornment {
    color: #94a3b8 !important;
}

html.dark .fd-profile-page .mud-input-input::placeholder,
html.dark .fd-profile-page .mud-input-slot input::placeholder,
html.dark .fd-profile-page .mud-input > input::placeholder,
html.dark .fd-dialog-form .mud-input-input::placeholder,
html.dark .fd-dialog-form .mud-input-slot input::placeholder,
html.dark .fd-dialog-form .mud-input > input::placeholder {
    color: #94a3b8 !important;
    opacity: 1;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxsaW5rIiBvdmVyZ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zkgNjkuMzE3OSAyNjcuODc5IDY3LjExODIgMjY2LjQ0OCA2Ni4wMTgzIDI2My41ODYgNjYuMDQ4NVoiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

html.dark .fd-portal-select .mud-input-base-input,
html.dark .fd-portal-select .mud-input-label,
html.dark .fd-portal-select .mud-input-adornment.mud-input-adornment-end.mud-icon-button,
html.dark .mud-select-dark-mode .mud-input-base-input,
html.dark .mud-select-dark-mode .mud-input-label,
html.dark .mud-select-dark-mode .mud-input-adornment.mud-input-adornment-end.mud-icon-button {
    color: #fff !important;
}

html.dark .fd-portal-select .mud-input-slot,
html.dark .fd-portal-select .mud-select-input,
html.dark .fd-portal-select input,
html.dark .mud-select-dark-mode .mud-input-slot,
html.dark .mud-select-dark-mode .mud-select-input,
html.dark .mud-select-dark-mode input {
    color: #f3f4f6 !important;
    -webkit-text-fill-color: #f3f4f6 !important;
}

html.dark .fd-portal-select .mud-list.mud-list-dense.mud-list-padding,
html.dark .mud-select-dark-mode .mud-list.mud-list-dense.mud-list-padding {
    background-color: #1a1a27 !important;
}

html.dark .fd-portal-select .mud-list-item-text,
html.dark .fd-portal-select .mud-list-item.mud-selected .mud-list-item-text,
html.dark .fd-portal-select .mud-list-item.mud-hover:hover .mud-list-item-text,
html.dark .mud-select-dark-mode .mud-list-item-text,
html.dark .mud-select-dark-mode .mud-list-item.mud-selected .mud-list-item-text,
html.dark .mud-select-dark-mode .mud-list-item.mud-hover:hover .mud-list-item-text {
    color: #fff !important;
}

html.dark .fd-portal-select .mud-list-item.mud-selected,
html.dark .mud-select-dark-mode .mud-list-item.mud-selected {
    background-color: #374151 !important;
}

html.dark .fd-portal-select .mud-list-item.mud-hover:hover,
html.dark .mud-select-dark-mode .mud-list-item.mud-hover:hover {
    background-color: #374151 !important;
}

html.dark .fd-perm-switch .mud-switch-label {
    color: #e5e7eb !important;
    opacity: 1 !important;
}

html.dark .fd-perm-switch .mud-switch-label .mud-typography {
    color: #e5e7eb !important;
}

html.dark .fd-perm-switch.mud-disabled .mud-switch-label {
    color: #9ca3af !important;
}

.fd-perm-switch-text {
    color: #374151;
    font-weight: 500;
}

html.dark .fd-perm-switch-text {
    color: #e5e7eb !important;
}