/* Open Iconic removed - using Material Icons via MudBlazor */

/* ============================================= */
/* DUAL SIDEBAR NAVIGATION - RAIL + DETAIL       */
/* ============================================= */

/* NavRail hover effects (global to bypass scoped CSS) */
button.nav-rail-item {
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.15s ease !important;
}

button.nav-rail-item:hover {
    background-color: color-mix(in srgb, var(--mud-palette-primary) 15%, transparent) !important;
    color: var(--mud-palette-primary) !important;
    transform: scale(1.1) !important;
}

button.nav-rail-item:hover .mud-icon-root,
button.nav-rail-item:hover .mud-svg-icon {
    filter: drop-shadow(0 0 3px var(--mud-palette-primary));
}

button.nav-rail-item.active {
    background-color: var(--mud-palette-primary) !important;
    color: white !important;
}

button.nav-rail-item.active:hover {
    background-color: var(--mud-palette-primary-darken) !important;
    transform: scale(1.05) !important;
}

/* MudMainContent: constrain to available flex space alongside fixed sidebars */
.mud-main-content {
    transition: margin-left 0.2s ease, width 0.2s ease;
    min-width: 0;          /* Allow flex shrink below content width */
    overflow-x: hidden;    /* Clip overflow — grids handle their own scroll */
}

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 14px; /* Restored default size for MudBlazor compatibility */
}

/* MudAutocomplete dropdown z-index fix */
.mud-popover-provider {
    z-index: 9999 !important;
}

.mud-elevation-8 {
    z-index: 9999 !important;
}

/* AutocompleteField specific styles - override generic rules */
.autocomplete-field-dropdown .mud-popover {
    position: absolute !important;
    z-index: 10000 !important;
    transform: translateY(0) !important;
}

.autocomplete-field-dropdown .mud-list {
    z-index: 10000 !important;
}

/* Dashboard Widget Styles */
.donut-chart-widget .chart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 8px;
}

.donut-chart-widget .chart-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
}

.donut-chart-widget .chart-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
}

.donut-chart-widget .legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.donut-chart-widget .legend-item:hover {
    background-color: rgba(0,0,0,0.04);
}

.donut-chart-widget .legend-color {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.donut-chart-widget .legend-info {
    flex: 1;
    min-width: 0;
}

.donut-chart-widget .mud-chart-legend {
    display: none !important;
}

@media (max-width: 768px) {
    .donut-chart-widget .chart-container {
        gap: 12px;
        padding: 4px;
    }
    
    .donut-chart-widget .legend-item {
        padding: 4px 6px;
    }
    
    .donut-chart-widget .legend-color {
        width: 12px;
        height: 12px;
    }
}

/* MudBlazor component font sizes - removed !important to allow proper floating label positioning */
.mud-typography {
    font-size: 14px;
}

.mud-input {
    font-size: 14px; /* Must use default size for floating labels to work */
}

.mud-button {
    font-size: 13px;
}

.mud-table {
    font-size: 12px;
}

.mud-data-grid {
    font-size: 12px;
}

h1:focus:not(:focus-visible) {
    outline: none;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--mud-palette-primary, #1976d2);
    color: #fff;
    padding: 8px 16px;
    z-index: 10000;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
}

a, .btn-link {
    color: #0071c1;
}

/* Bootstrap buttons replaced by MudBlazor components */
/* Focus styles replaced by MudBlazor theme */

.content {
    padding-top: 1.1rem;
}

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

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

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

/* MudBlazor NavMenu text visibility and theme support */
.mud-nav-link-text {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: inherit !important;
}

.mud-navmenu .mud-nav-link-text,
.mud-navmenu div {
    font-size: 14px !important;
    display: block !important;
    visibility: visible !important;
}

/* Navigation menu text visibility - light theme */
.mud-list-item .mud-list-item-text,
.mud-list-item span,
.mud-list-item .mud-text {
    color: var(--mud-palette-text-primary, rgba(0, 0, 0, 0.87)) !important;
    opacity: 1 !important;
    display: block !important;
    visibility: visible !important;
}

/* Navigation menu text visibility - dark theme */
.mud-theme-dark .mud-list-item .mud-list-item-text,
.mud-theme-dark .mud-list-item span,
.mud-theme-dark .mud-list-item .mud-text {
    color: var(--mud-palette-text-primary, rgba(255, 255, 255, 0.87)) !important;
}

/* Navigation submenu background - light theme */
.mud-drawer-content div[style*="background-color: #f5f5f5"],
.mud-drawer-content div[style*="background-color: #f0f8ff"],
.mud-drawer-content div[style*="background-color: #fff8dc"],
.mud-drawer-content div[style*="background-color: #f0fff0"],
.mud-drawer-content div[style*="background-color: #ffe4e1"] {
    background-color: var(--mud-palette-background-grey, #f5f5f5) !important;
    border-left: 3px solid var(--mud-palette-primary, #1976d2) !important;
}

/* Navigation submenu background - dark theme */
.mud-theme-dark .mud-drawer-content div[style*="background-color: #f5f5f5"],
.mud-theme-dark .mud-drawer-content div[style*="background-color: #f0f8ff"],
.mud-theme-dark .mud-drawer-content div[style*="background-color: #fff8dc"],
.mud-theme-dark .mud-drawer-content div[style*="background-color: #f0fff0"],
.mud-theme-dark .mud-drawer-content div[style*="background-color: #ffe4e1"] {
    background-color: var(--mud-palette-surface, #1e1e2a) !important;
    border-left: 3px solid var(--mud-palette-primary, #776be7) !important;
}

/* Dark theme drawer background fixes */
.mud-theme-dark .mud-drawer {
    background-color: var(--mud-palette-drawer-background, #16161e) !important;
}

.mud-theme-dark .mud-drawer-content {
    background-color: var(--mud-palette-drawer-background, #16161e) !important;
}

/* Panel borders — body prefix raises specificity above MudBlazor's !important rules */
body .mud-paper {
    border: 1px solid var(--mud-palette-lines-default, rgba(128, 128, 128, 0.25)) !important;
}
body .mud-drawer .mud-paper,
body .mud-dialog-root .mud-paper,
body .mud-popover .mud-paper {
    border: none !important;
}

/* Dark theme list items */
.mud-theme-dark .mud-list-item {
    background-color: transparent !important;
    color: var(--mud-palette-text-primary, rgba(255, 255, 255, 0.87)) !important;
}

.mud-theme-dark .mud-list-item:hover {
    background-color: var(--mud-palette-action-hover, rgba(255, 255, 255, 0.08)) !important;
}

.mud-theme-dark .mud-list-item-icon {
    color: var(--mud-palette-text-secondary, rgba(255, 255, 255, 0.6)) !important;
}

/* Dark theme navigation links */
.mud-theme-dark .mud-nav-link,
.mud-theme-dark .mud-nav-link-text {
    color: var(--mud-palette-text-primary, rgba(255, 255, 255, 0.87)) !important;
}

.mud-theme-dark .mud-nav-link:hover {
    background-color: var(--mud-palette-action-hover, rgba(255, 255, 255, 0.08)) !important;
}

/* Complete CSS reset for MudBlazor inputs - let framework handle everything natively */

/* Remove custom padding - let MudBlazor handle input padding */

/* MudButton styling fix - ensure proper colors and backgrounds for both themes */
.mud-button-filled {
    background-color: var(--mud-palette-action-default, #e0e0e0) !important;
    color: var(--mud-palette-action-default-text, #000000) !important;
}

.mud-button-filled.mud-success {
    background-color: var(--mud-palette-success, #4caf50) !important;
    color: var(--mud-palette-success-text, #ffffff) !important;
}

.mud-button-filled.mud-primary {
    background-color: var(--mud-palette-primary, #1976d2) !important;
    color: var(--mud-palette-primary-text, #ffffff) !important;
}

.mud-button-filled.mud-error {
    background-color: var(--mud-palette-error, #f44336) !important;
    color: var(--mud-palette-error-text, #ffffff) !important;
}

.mud-button-filled.mud-warning {
    background-color: var(--mud-palette-warning, #ff9800) !important;
    color: var(--mud-palette-warning-text, #ffffff) !important;
}

.mud-button-filled.mud-info {
    background-color: var(--mud-palette-info, #2196f3) !important;
    color: var(--mud-palette-info-text, #ffffff) !important;
}

/* Dark theme specific adjustments */
.mud-theme-dark .mud-button-filled {
    background-color: var(--mud-palette-action-default, #424242) !important;
    color: var(--mud-palette-action-default-text, #ffffff) !important;
}

/* MudSelect dropdown positioning fix */
.mud-select-popover {
    position: fixed !important;
    transform: none !important;
    left: auto !important;
    top: auto !important;
}

/* Ensure dropdown appears correctly aligned with select input */
.mud-select .mud-popover-provider {
    position: relative;
}

.mud-popover-open .mud-popover {
    z-index: 9999 !important;
}

/* MudAutocomplete dropdown positioning fix - use absolute positioning for proper alignment */
.mud-autocomplete .mud-popover-provider {
    position: relative !important;
}

.mud-autocomplete .mud-popover {
    position: absolute !important;
    z-index: 9999 !important;
    transform: translateY(0) !important;
}

/* AutocompleteField positioning - ensure container is relative */
.autocomplete-field-dropdown .mud-popover-provider {
    position: relative !important;
}

/* Dynamic Filter Component Styles */
.mud-button-loading {
    opacity: 0.8 !important;
    transition: all 0.3s ease;
}

.mud-button-loading:hover {
    opacity: 0.9 !important;
}

/* Botones estándar de MudBlazor - sin override específico */

.mud-button-filled.mud-primary:disabled {
    background-color: rgba(25, 118, 210, 0.6) !important;
    color: rgba(255, 255, 255, 0.7) !important;
    cursor: not-allowed;
    box-shadow: none !important;
}

.mud-button-outlined.mud-primary:disabled {
    border-color: rgba(25, 118, 210, 0.6) !important;
    color: rgba(25, 118, 210, 0.6) !important;
    cursor: not-allowed;
}

/* Botón en estado de loading (más claro para indicar proceso) */
.mud-button-loading.mud-button-outlined.mud-primary {
    background-color: transparent !important;
    border-color: #1976d2 !important;
    color: #1976d2 !important;
}

/* Fix para tema oscuro */
.mud-theme-dark .mud-button-filled.mud-primary:not(.mud-button-loading) {
    background-color: #776be7 !important; /* Material Design Deep Purple 400 */
    color: #ffffff !important;
}

.mud-theme-dark .mud-button-filled.mud-primary:not(.mud-button-loading):hover {
    background-color: #6c5ce7 !important;
}

.mud-theme-dark .mud-button-filled.mud-primary:disabled {
    background-color: rgba(119, 107, 231, 0.6) !important;
    color: rgba(255, 255, 255, 0.7) !important;
}

/* Mejoras para el botón de restablecer */
.mud-button-reset {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.mud-button-reset:hover:not(:disabled) {
    background-color: var(--mud-palette-secondary-hover, rgba(156, 39, 176, 0.08)) !important;
}

.mud-button-reset:disabled {
    color: var(--mud-palette-text-disabled) !important;
    opacity: 0.6 !important;
}

/* Corrección para dropdown de filtros - posicionamiento mejorado */
.filter-card-container {
    position: relative;
    overflow: visible !important;
    z-index: 10;
}

.filter-card-container .mud-popover-provider {
    position: relative !important;
    z-index: 11;
}

/* Dropdown de filtros con posicionamiento fijo respecto al viewport */
.filter-dropdown {
    z-index: 2000 !important;
    position: fixed !important;
    width: auto !important;
    min-width: 200px !important;
    max-width: 400px !important;
}

.filter-dropdown .mud-list {
    max-height: 300px !important;
    overflow-y: auto !important;
    border-radius: 4px !important;
    box-shadow: 0 8px 16px rgba(0,0,0,0.15) !important;
    background: var(--mud-palette-surface, #ffffff) !important;
    border: 1px solid var(--mud-palette-lines-default, rgba(0,0,0,0.12)) !important;
}

/* Asegurar que solo los popovers de filtros específicos usen position fixed */
.filter-card-container .mud-select .mud-popover,
.filter-card-container .mud-select .mud-popover-provider .mud-popover {
    z-index: 2000 !important;
    position: fixed !important;
}


/* Contenedores padre deben permitir overflow visible */
.mud-stack:has(.filter-card-container),
.mud-paper:has(.filter-card-container),
.mud-container:has(.filter-card-container) {
    overflow: visible !important;
}

/* Asegurar que la grilla esté en un nivel bajo */
.mud-data-grid {
    z-index: 1 !important;
    position: relative;
}

/* Contenedor principal de filtros debe tener overflow visible pero posicionamiento normal */
.mud-collapse .mud-collapse-content {
    overflow: visible !important;
    position: relative !important;
    z-index: auto !important;
}

/* Asegurar que el componente de filtros no flote sobre la grilla */
.mud-collapse {
    position: relative;
    z-index: auto;
}

/* Contenedores principales: permitir overflow solo para dropdowns pero mantener layout normal */
.mud-container {
    overflow: visible !important;
}

/* Dialogs: prevenir desbordamiento horizontal causado por MudGrid márgenes negativos */
.mud-dialog .mud-dialog-content {
    overflow-x: hidden !important;
}
/* Neutralizar márgenes negativos de MudGrid dentro de dialogs */
.mud-dialog .mud-grid {
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}
.mud-dialog .mud-paper:not(.mud-dialog) {
    max-width: 100% !important;
    box-sizing: border-box !important;
}
/* Prevenir que expansion panels desborden el dialog */
.mud-dialog .mud-expand-panel-content,
.mud-dialog .mud-collapse-content {
    overflow-x: hidden !important;
}

/* Grilla debe mantener su posicionamiento normal */
.mud-data-grid {
    z-index: 1 !important;
    position: relative;
    overflow: hidden !important; /* Prevenir que la grilla interfiera con layout */
}

/* Contenedor de filtros: posicionamiento relativo normal */
.mud-paper:has(.filter-card-container) {
    position: relative;
    z-index: 10;
    overflow: visible !important;
}

/* Asegurar que el componente DynamicFilterComponent no interfiera con la grilla */
.mud-paper:has(.filter-card-container) {
    margin-bottom: 16px !important; /* Espacio entre filtros y grilla */
}

/* Evitar que los filtros avanzados aparezcan superpuestos */
.mud-collapse-container {
    position: relative !important;
    z-index: auto !important;
}

/* Layout normal para el contenedor de la página */
.mud-container .mud-grid .mud-item {
    position: relative;
    z-index: auto;
}

/* ============================================= */
/* RESPONSIVE DATA GRID - MOBILE OPTIMIZATIONS */
/* ============================================= */

/*
 * Force table layout on mobile instead of MudBlazor's card mode.
 * MudBlazor adds classes like .mud-xs-table, .mud-sm-table etc. that switch to card layout.
 * We override this to keep table layout while still hiding columns with HideSmall.
 */

/* Force table layout structure on ALL screen sizes */
.mud-data-grid .mud-table,
.mud-xs-table,
.mud-sm-table,
.mud-md-table {
    display: table !important;
    width: 100% !important;
}

.mud-data-grid .mud-table-container {
    overflow-x: auto !important;
}

.mud-data-grid .mud-table-head,
.mud-xs-table .mud-table-head,
.mud-sm-table .mud-table-head,
.mud-md-table .mud-table-head {
    display: table-header-group !important;
}

.mud-data-grid .mud-table-body,
.mud-xs-table .mud-table-body,
.mud-sm-table .mud-table-body,
.mud-md-table .mud-table-body {
    display: table-row-group !important;
}

.mud-data-grid .mud-table-row,
.mud-xs-table .mud-table-row,
.mud-sm-table .mud-table-row,
.mud-md-table .mud-table-row {
    display: table-row !important;
}

.mud-data-grid .mud-table-cell,
.mud-xs-table .mud-table-cell,
.mud-sm-table .mud-table-cell,
.mud-md-table .mud-table-cell {
    display: table-cell !important;
}

/* Hide the data-label pseudo-element that shows column title in each cell (card mode) */
.mud-data-grid .mud-table-cell::before,
.mud-xs-table .mud-table-cell::before,
.mud-sm-table .mud-table-cell::before,
.mud-md-table .mud-table-cell::before {
    display: none !important;
    content: none !important;
}

/* Uniform row borders - ensure all cells in a row have consistent borders */
.mud-data-grid .mud-table-body .mud-table-row .mud-table-cell {
    border-bottom: 1px solid var(--mud-palette-table-lines, rgba(0, 0, 0, 0.12)) !important;
}

.mud-data-grid .mud-table-head .mud-table-row .mud-table-cell {
    border-bottom: 1px solid var(--mud-palette-table-lines, rgba(0, 0, 0, 0.12)) !important;
}

/* Action buttons column - sticky to the right, single kebab (⋮) menu icon */
.mud-table-cell.action-buttons-cell,
th.action-buttons-cell {
    position: sticky !important;
    right: 0 !important;
    z-index: 4 !important;
    background-color: var(--mud-palette-surface) !important;
    white-space: nowrap;
    width: 48px;
    min-width: 48px;
    max-width: 48px;
    box-shadow: -3px 0 6px rgba(0, 0, 0, 0.12);
    text-align: center;
}

@media (max-width: 960px) {
    /* MudBlazor native HideSmall support - hide cells with mud-table-cell-hide class */
    .mud-table-cell-hide {
        display: none !important;
        visibility: collapse !important;
        width: 0 !important;
        max-width: 0 !important;
        min-width: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
        overflow: hidden !important;
    }

    /* Also support header cells */
    th.mud-table-cell-hide,
    td.mud-table-cell-hide,
    .mud-table-head .mud-table-cell-hide,
    .mud-table-body .mud-table-cell-hide {
        display: none !important;
    }


    /* Force single line per row - compact cells (exclude hidden cells) */
    .mud-data-grid .mud-table-cell:not(.mud-table-cell-hide) {
        display: table-cell !important;
        padding: 4px 6px !important;
        font-size: 12px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 150px !important;
        vertical-align: middle !important;
    }

    .mud-data-grid .mud-table-head .mud-table-cell:not(.mud-table-cell-hide) {
        display: table-cell !important;
        padding: 6px !important;
        font-size: 11px !important;
        white-space: nowrap !important;
    }

    /* Single line for cell content */
    .mud-data-grid .mud-table-cell > div,
    .mud-data-grid .mud-table-cell > span,
    .mud-data-grid .mud-table-cell .mud-typography {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    /* Reduce grid height on mobile */
    .mud-data-grid {
        max-height: 450px !important;
    }

    /* ABM Header - stack buttons vertically on mobile */
    .abm-header .mud-button-group {
        flex-wrap: wrap !important;
        gap: 4px !important;
    }

    /* Search bar - full width on mobile */
    .abm-search-bar .mud-input {
        min-width: 100% !important;
    }

    /* Pagination controls - compact on mobile */
    .pagination-controls {
        flex-wrap: wrap !important;
        gap: 8px !important;
        justify-content: center !important;
    }

    .pagination-controls .mud-button {
        min-width: 36px !important;
        padding: 4px 8px !important;
    }

}

/* Extra small screens (phones in portrait) */
@media (max-width: 600px) {
    /* Even more compact on very small screens */
    .mud-data-grid .mud-table-cell:not(.mud-table-cell-hide) {
        padding: 3px 4px !important;
        font-size: 11px !important;
        max-width: 100px !important;
    }

    /* Stack form fields */
    .mud-grid .mud-item {
        flex-basis: 100% !important;
        max-width: 100% !important;
    }

    /* Compact paper padding */
    .mud-paper {
        padding: 8px !important;
    }

    /* ABM buttons - icon only on very small screens */
    .abm-header .mud-button .mud-button-label {
        display: none !important;
    }

    .abm-header .mud-button .mud-icon-root {
        margin: 0 !important;
    }


    .action-buttons .mud-icon-root {
        font-size: 14px !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   Responsive Column Priority System
   Uses CSS Container Queries (not media queries) so columns react
   to the actual available content width, not the viewport width.
   This handles the sidebar open/closed state automatically.

   Container context is defined on #main-content (MainLayout.razor).

   P1 = always visible (no class needed)
   P2 = hidden when content area < 550px  (phones portrait)
   P3 = hidden when content area < 700px  (phones landscape / small tablets)
   P4 = hidden when content area < 880px  (tablets)
   P5 = hidden when content area < 1100px (narrow desktop / tablet landscape)
   P6 = hidden when content area < 1400px (laptops 14"–15.6")
   Usage: HeaderClass="@P6" CellClass="@P6" on PropertyColumn/TemplateColumn
   ═══════════════════════════════════════════════════════════════ */
#main-content {
    container-type: inline-size;
    container-name: main-content;
    /* Prevent the element from expanding with table content (which would break container queries) */
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
}
@container main-content (max-width: 1399px) {
    th.col-priority-6, td.col-priority-6,
    .mud-table-cell.col-priority-6 { display: none !important; }
}
@container main-content (max-width: 1099px) {
    th.col-priority-5, td.col-priority-5,
    .mud-table-cell.col-priority-5 { display: none !important; }
}
@container main-content (max-width: 879px) {
    th.col-priority-4, td.col-priority-4,
    .mud-table-cell.col-priority-4 { display: none !important; }
}
@container main-content (max-width: 699px) {
    th.col-priority-3, td.col-priority-3,
    .mud-table-cell.col-priority-3 { display: none !important; }
}
@container main-content (max-width: 549px) {
    th.col-priority-2, td.col-priority-2,
    .mud-table-cell.col-priority-2 { display: none !important; }
}

/* Phone-only: compress P1 columns to fit small screens */
@container main-content (max-width: 430px) {
    .mud-data-grid .mud-table-cell:not(.mud-table-cell-hide),
    .mud-data-grid th:not(.mud-table-cell-hide) {
        max-width: 120px !important;
        font-size: 10px !important;
        padding: 2px 3px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

}

/* ═══════════════════════════════════════════════════════════════
   Media query fallbacks for phones — complement the container queries above.
   Container queries can fail to fire when the table content forces the container
   wider than the viewport. These @media rules are based on viewport width and
   always fire reliably on phones regardless of container expansion.
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 549px) {
    th.col-priority-2, td.col-priority-2, .mud-table-cell.col-priority-2 { display: none !important; }
}
@media (max-width: 699px) {
    th.col-priority-3, td.col-priority-3, .mud-table-cell.col-priority-3 { display: none !important; }
}
@media (max-width: 879px) {
    th.col-priority-4, td.col-priority-4, .mud-table-cell.col-priority-4 { display: none !important; }
}
@media (max-width: 1099px) {
    th.col-priority-5, td.col-priority-5, .mud-table-cell.col-priority-5 { display: none !important; }
}
@media (max-width: 1399px) {
    th.col-priority-6, td.col-priority-6, .mud-table-cell.col-priority-6 { display: none !important; }
}

/* ============================================= */
/* HABILITADO - ESTILO VISUAL DE FILA            */
/* ============================================= */

.mud-table-row.row-deshabilitado td {
    opacity: 0.5;
    border-left: 3px solid var(--mud-palette-error) !important;
}

.mud-table-row.row-deshabilitado:hover td {
    opacity: 0.7;
}

/* La fila seleccionada siempre prevalece */
.mud-table-row.row-selected.row-deshabilitado td {
    opacity: 1 !important;
    border-left: 3px solid var(--mud-palette-primary) !important;
}
