/* ==========================================================================
   GRID Y TARJETA DE PAGINA — .grid-*, .status-badge. Ver §6.0, §6.1, §6.8.
   Archivo 6 de 9. El ORDEN de los nueve importa: Docs/DESIGN-LANGUAGE.md.
   ========================================================================== */
/* Row-detail (BL-9): contenedor del panel de detalle al expandir una fila */
.grid-row-detail{
    background-color: var(--mud-palette-background-gray);
    border-radius: 8px;
}
/* Row-detail (BL-9): título de sección del panel de detalle */
.grid-row-detail__title{
    font-weight: 600;
    color: var(--mud-palette-text-secondary);
}
/* Row-detail (BL-9): etiqueta de cada campo del detalle */
.grid-row-detail__field-label{
    font-size: 0.72rem;
    color: var(--mud-palette-text-secondary);
    text-transform: none;
    letter-spacing: 0.02em;
}
/* Row-detail (BL-9): valor de cada campo del detalle */
.grid-row-detail__field-value{
    font-size: 0.875rem;
    font-weight: 500;
}
/* Matches the fieldset radius override this file makes inside the grid toolbar. */
.grid-hierarchy .mud-input.mud-input-outlined{
    border-radius: var(--gh-r-control);
}
/* Bandejas y tarjetas. La bandeja es el div de adentro, no el td. Ver §8, trampas 9 y 10. */
.grid-hierarchy .mud-table-child-content{
    padding: 0;
    border: 0;
    background: transparent;
}
/* El margen derecho se devuelve: la tarjeta L0 ya aporta su padding de ese lado. */
.grid-hierarchy .mud-table-child-content > .mud-data-grid{
    background: var(--gh-tray-1);
    border: 1px solid var(--gh-line-tray-1);
    border-radius: var(--gh-r-tray-1);
    padding: var(--gh-pad-tray);
    margin: 0 0 18px var(--gh-indent);
}
.grid-hierarchy .mud-table-child-content .mud-table-child-content > .mud-data-grid{
    background: var(--gh-tray-2);
    border-color: var(--gh-line-tray-2);
    border-radius: var(--gh-r-tray-2);
    /* The 6px is what turns the uniform 8px `border-spacing` into the 14px the
       guide asks for between whole policy+detail groups. */
    margin: 0 0 var(--gh-gap-group-extra) var(--gh-indent);
}
/* SEGUNDA FORMA DE DETALLE — GridRowDetail, 8 pantallas. Sin esto quedan con inset 0. Ver §6.1. */
.grid-hierarchy .mud-table-child-content > .grid-row-detail{
    background: var(--gh-tray-1);
    border: 1px solid var(--gh-line-tray-1);
    border-radius: var(--gh-r-tray-1);
    margin: 0 0 18px var(--gh-indent);
}
/* Segundo nivel, si alguna pantalla llega a anidar un detalle dentro de otro. */
.grid-hierarchy .mud-table-child-content .mud-table-child-content > .grid-row-detail{
    background: var(--gh-tray-2);
    border-color: var(--gh-line-tray-2);
    border-radius: var(--gh-r-tray-2);
    margin: 0 0 var(--gh-gap-group-extra) var(--gh-indent);
}
.grid-hierarchy .grid-row-detail__title{
    color: var(--gh-label-2);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.grid-hierarchy .grid-row-detail__field-label{
    color: var(--gh-label-2);
}
.grid-hierarchy .mud-table-child-content .mud-table-root{
    border-spacing: 0 var(--gh-gap-rows);
}
/* Bordes arriba/abajo en todas las celdas, izquierda/derecha solo en los extremos. Ver §8, trampa 9. */
.grid-hierarchy .mud-table-child-content .mud-table-body > .mud-table-row > .mud-table-cell:not(.mud-table-child-content){
    background: var(--gh-row-1);
    border: 0;
    border-top: 1px solid var(--gh-line-row-1);
    border-bottom: 1px solid var(--gh-line-row-1);
    padding: var(--gh-pad-row-1);
    font-size: 14px;
    color: var(--gh-body);
    box-shadow: var(--gh-row-shadow);
    transition: background-color .15s ease, border-color .15s ease;
}
/* A `tr` cannot carry a radius, so the row's outer corners live on its first and
   last cell. */
.grid-hierarchy .mud-table-child-content .mud-table-body > .mud-table-row > .mud-table-cell:not(.mud-table-child-content):first-child{
    border-left: 1px solid var(--gh-line-row-1);
    border-radius: var(--gh-r-row-1) 0 0 var(--gh-r-row-1);
}
.grid-hierarchy .mud-table-child-content .mud-table-body > .mud-table-row > .mud-table-cell:not(.mud-table-child-content):last-child{
    border-right: 1px solid var(--gh-line-row-1);
    border-radius: 0 var(--gh-r-row-1) var(--gh-r-row-1) 0;
}
/* Guide §7: L1/L2 rows are already cards, so hover moves the BORDER, not the
   fill. Only the outer L0 row changes background. */
.grid-hierarchy .mud-table-child-content .mud-table-body > .mud-table-row:hover > .mud-table-cell:not(.mud-table-child-content){
    border-color: var(--gh-line-row-1-hover);
}
.grid-hierarchy .mud-table-child-content .mud-table-child-content .mud-table-body > .mud-table-row > .mud-table-cell:not(.mud-table-child-content){
    background: var(--gh-row-2);
    border-top-color: var(--gh-line-row-2);
    border-bottom-color: var(--gh-line-row-2);
    padding: var(--gh-pad-row-2);
    font-size: 13.5px;
}
.grid-hierarchy .mud-table-child-content .mud-table-child-content .mud-table-body > .mud-table-row:hover > .mud-table-cell:not(.mud-table-child-content){
    border-color: var(--gh-line-row-2-hover);
}
.grid-hierarchy .mud-table-child-content .mud-table-child-content .mud-table-body > .mud-table-row > .mud-table-cell:not(.mud-table-child-content):first-child{
    border-left-color: var(--gh-line-row-2);
    border-radius: var(--gh-r-row-2) 0 0 var(--gh-r-row-2);
}
.grid-hierarchy .mud-table-child-content .mud-table-child-content .mud-table-body > .mud-table-row > .mud-table-cell:not(.mud-table-child-content):last-child{
    border-right-color: var(--gh-line-row-2);
    border-radius: 0 var(--gh-r-row-2) var(--gh-r-row-2) 0;
}
/* Nivel 0 — la tarjeta externa, su cabecera y sus filas. */
/* CHROME DE TARJETA, compartida por los grids con y sin jerarquia. Ver §6.0. */
/* Excepcion documentada a §6.0: embebida pero con filas anidadas. Compuesto (0,2,0) para ganar por especificidad. */
.grid-hierarchy.grid-embedded{
    border: 0;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    background: transparent;
}
.grid-card,
.grid-hierarchy{
    border: 1px solid var(--gh-line-card);
    border-radius: var(--gh-r-card);
    /* Reemplaza al pa-10, que era !important. Ver §2.1 y §8, trampa 6. */
    padding: var(--gh-pad-card);
    /* El parametro Elevation es inerte con Outlined="true". Ver §8, trampa 1. */
    box-shadow: none;
}
/* TARJETA DE PAGINA — toda la pagina es UNA tarjeta. Opt-in por pagina. Ver §6.8. */
.grid-page-card{
    background: var(--mud-palette-surface);
    border: 1px solid var(--gh-line-card);
    border-radius: var(--gh-r-card);
    /* Seguro: los popovers de MudBlazor renderizan en un div hermano, fuera de este subarbol. Ver §6.8. */
    overflow: hidden;
}
.grid-page-card__head{
    display: flex;
    align-items: center;
    gap: 20px;
    /* 32px para que el titular alinee con la busqueda y la primera columna del grid. */
    padding: 22px 32px 18px;
}
.grid-page-card__head .titleHeader{
    flex: 1;
    margin: 0;
}
.grid-page-card .grid-card,
.grid-page-card .grid-hierarchy{
    border: none;
    border-radius: 0;
    box-shadow: none;
}
/* Tab strip spans the full card width, hairline meeting both edges, while the
   tabs themselves start at the same 32px as the title. */
.grid-page-card .mud-tabs-tabbar{
    padding: 0 32px;
    border-bottom: 1px solid var(--gh-line-divider);
}
/* MudBlazor las empaqueta pegadas y el badge renderiza FUERA de su caja. Ver §8, trampa 25. */
.grid-page-card .mud-tabs-tabbar .mud-tab{
    margin-right: 28px;
    /* El badge renderiza fuera de la caja del tab: sin este espacio lo recorta. Ver §6.8. */
    padding-right: 30px;
}
.grid-page-card .mud-tabs-tabbar .mud-tab:last-child{
    margin-right: 0;
}
.grid-search .mud-input.mud-input-outlined{
    background-color: transparent;
}
/* Enfasis sin volver a meter el relleno, que es el marcador de "campo de formulario". Ver §6.8. */
.grid-search .mud-input-outlined-border{
    border-width: 1.5px;
    transition: border-color .15s ease;
}
.grid-search .mud-input-adornment .mud-icon-root{
    color: var(--mud-palette-primary);
}
.grid-search .mud-input.mud-input-outlined:hover .mud-input-outlined-border,
.grid-search .mud-input.mud-input-outlined:focus-within .mud-input-outlined-border{
    border-color: var(--mud-palette-primary);
}
.grid-search .mud-input.mud-input-outlined:focus-within{
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--mud-palette-primary) 16%, transparent);
}
.grid-hierarchy > .mud-table-container .mud-table-head .mud-table-cell{
    font-size: 13.5px;
    font-weight: 700;
    color: var(--gh-head);
    text-transform: none;
    letter-spacing: 0;
    /* Sin esto el th cae al default de MudBlazor (16/24px) y el encabezado no
       aterriza sobre su dato, que usa los 22px de --gh-pad-row-0. */
    padding-inline: 22px;
    border-bottom: 1px solid var(--gh-line-divider);
}
/* :not(.mud-table-child-content) es LOAD-BEARING en las dos. Ver §8, trampa 8. */
.grid-hierarchy > .mud-table-container .mud-table-body > .mud-table-row > .mud-table-cell:not(.mud-table-child-content){
    padding: var(--gh-pad-row-0);
    font-size: 14px;
    color: var(--gh-body);
    border-bottom-color: var(--gh-line-divider);
    transition: background-color .15s ease;
}
.grid-hierarchy > .mud-table-container .mud-table-body > .mud-table-row:hover > .mud-table-cell:not(.mud-table-child-content){
    background-color: var(--gh-surf-hover);
}
.grid-hierarchy > .mud-table-container .mud-table-body > .mud-table-row > .mud-table-cell:nth-child(2),
.grid-hierarchy .mud-table-child-content .mud-table-body > .mud-table-row > .mud-table-cell:not(.mud-table-child-content):nth-child(2),
.grid-hierarchy .mud-table-child-content .mud-table-child-content .mud-table-body > .mud-table-row > .mud-table-cell:not(.mud-table-child-content):first-child{
    font-weight: 600;
    color: var(--gh-strong);
}
/* Amounts are values, so they take the strong colour and weight too (§4). */
.grid-hierarchy td.grid-numeric{
    font-weight: 600;
    color: var(--gh-strong);
}
/* El embudo va al lado de su texto, no en el borde de la columna. Ver §8, trampa 22. */
.grid-hierarchy .mud-table-cell .column-header{
    justify-content: flex-start;
    gap: 8px;
}
/* justify-content solo no alcanza: sortable-column-header lleva width 100%. Ver §8, trampa 22. */
.grid-hierarchy .mud-table-cell .column-header .sortable-column-header{
    width: auto;
}
/* `align-right` es el vocabulario del modulo `.ap` y pide lo mismo que
   `grid-numeric`: sin esto el encabezado se queda a la izquierda del dato. */
.grid-hierarchy th.grid-numeric .column-header,
.grid-hierarchy th.align-right .column-header{
    justify-content: flex-end;
}
/* --------------------------------------------------------------------------
   Toolbar, chevrons and pager (guide §6.2 / §6.3 / §6.4)
   Scoped to `.grid-hierarchy`, so the app-wide 8px control radius from slice 3
   stays untouched everywhere else.
   -------------------------------------------------------------------------- */
.grid-hierarchy .mud-input.mud-input-outlined .mud-input-outlined-border{
    border-color: var(--field-border);
    border-radius: var(--gh-r-control);
}
/* :not() para que el select del pager no herede los 52px de la busqueda. */
.grid-hierarchy .mud-input-control:not(.mud-table-pagination-select) .mud-input{
    min-height: 52px;
}
.grid-hierarchy .mud-button-filled{
    min-height: 52px;
    padding: 0 22px;
    border-radius: var(--gh-r-control);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .08em;
}
/* La cadena > .mud-table-cell > es REQUERIDA: un descendiente alcanza los thead anidados. Ver §8, trampa 8. */
.grid-hierarchy .mud-table-body > .mud-table-row > .mud-table-cell > button.mud-icon-button{
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background-color: transparent;
    color: var(--gh-icon-chevron);
    transition: color .15s ease;
}
/* :focus-visible, NO :focus, que se queda pegado tras un click. Ver §8, trampa 13. */
.grid-hierarchy .mud-table-body > .mud-table-row > .mud-table-cell > button.mud-icon-button:hover,
.grid-hierarchy .mud-table-body > .mud-table-row > .mud-table-cell > button.mud-icon-button:focus-visible{
    background-color: transparent;
    color: var(--gh-strong);
}
/* min-width y no width; y el :has() debe igualar la cadena o pierde especificidad. Ver §8, trampas 12 y 26. */
.grid-hierarchy > .mud-table-container .mud-table-body > .mud-table-row > .mud-table-cell:has(> button.mud-icon-button),
.grid-hierarchy .mud-table-child-content .mud-table-body > .mud-table-row > .mud-table-cell:has(> button.mud-icon-button){
    min-width: 48px;
    width: 48px;
    padding-left: 12px;
    padding-right: 8px;
}
/* Dos elementos llevan clase de pager y MudBlazor pone su border-top en el interno. Ver §8, trampa 19. */
.grid-card > .mud-table-pagination,
.grid-hierarchy > .mud-table-pagination{
    /* MudBlazor lo deja en display inline, asi que el padding no gobierna su altura. Ver §8, trampa 14. */
    display: block;
    padding: 8px 16px 2px;
    border-top: 1px solid var(--gh-line-divider);
}
.grid-hierarchy .mud-table-row-details .mud-table-pagination,
.grid-hierarchy .mud-table-row-details .mud-table-pagination-toolbar,
.grid-hierarchy .mud-table-row-details .mud-table-pagination .mud-input-root,
.grid-hierarchy .mud-table-row-details .mud-table-pagination .mud-typography{
    font-size: 11.5px;
}
.grid-hierarchy .mud-table-row-details .mud-table-pagination .mud-button-root{
    width: 26px;
    height: 26px;
}
.grid-hierarchy .mud-table-row-details .mud-table-pagination .mud-icon-root{
    font-size: 16px;
}
.grid-hierarchy .mud-table-pagination-toolbar{
    border-top: 0;
    min-height: 0;
}
.grid-hierarchy .mud-table-pagination .mud-button-root{
    color: var(--gh-icon-pager);
}
/* El bloque de reduced-motion es una lista CERRADA. Ver §4.1. */
.grid-hierarchy button:focus-visible{
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
}
/* Micro-labels — decrecen de L1 a L2. Espejan la forma de clases de MudBlazor
   por especificidad, no por estetica. Ver §1.6 y §8, trampa 7. */
.grid-hierarchy .mud-table-child-content .mud-table-head .mud-table-cell,
/* Grid PLANO: el selector de arriba exige anidamiento y nunca matchea. Ver §6.8. */
.grid-flat-snapshot > .mud-table-container .mud-table-head .mud-table-cell{
    background: transparent;
    border: 0;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--gh-label-1);
}
.grid-hierarchy .mud-table-child-content .mud-table-child-content .mud-table-head .mud-table-cell{
    font-size: 10.5px;
    letter-spacing: .10em;
    color: var(--gh-label-2);
}
/* :has() solo alcanza filas que si tienen detalle; las colapsadas conservan su separador. Ver §6.1. */
.grid-hierarchy .mud-table-body > .mud-table-row:has(+ .mud-table-row > .mud-table-child-content) > .mud-table-cell{
    border-bottom: 0;
}
/* Estado de fila — el color marca atencion requerida, no paso del proceso. Ver §1.3. */
.status-badge{
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}
.status-badge__dot{
    width: 7px;
    height: 7px;
    border-radius: 999px;
    flex-shrink: 0;
    background: currentColor;
}
.status-badge--open{
    background: var(--status-info-bg);
    color: var(--status-info-fg);
}
.status-badge--open .status-badge__dot{
    background: var(--status-info-dot);
}
.status-badge--closed{
    background: var(--status-neutral-bg);
    color: var(--status-neutral-fg);
}
.status-badge--reopen{
    background: var(--status-warn-bg);
    color: var(--status-warn-fg);
}
.status-badge--reopen .status-badge__dot{
    background: var(--status-warn-dot);
}
/* Anything the API sends that is not a known AccidentStatus member. Rendered
   plainly rather than guessing a semantic colour. */
.status-badge--unknown{
    background: var(--status-neutral-bg);
    color: var(--status-neutral-fg);
    font-style: italic;
}
.status-badge--ok{
    background: var(--status-ok-bg);
    color: var(--status-ok-fg);
}
.status-badge--ok .status-badge__dot{
    background: var(--status-ok-dot);
}
.status-badge--danger{
    background: var(--status-danger-bg);
    color: var(--status-danger-fg);
}
.status-badge--danger .status-badge__dot{
    background: var(--status-danger-dot, currentColor);
}
/* tnum se restata porque esta clase tambien cae en th, que la regla global no cubre. */
.grid-numeric{
    text-align: right;
    font-feature-settings: "tnum" 1;
}
/* Un valor vacio es informacion real: toma el piso de 4.5:1. Ver §2.5. */
.grid-empty{
    color: var(--gh-empty);
    font-style: italic;
}
