/* Shared backoffice layout. Keep public portal styles independent. */
.admin-shell {
    --admin-control-height: 2.75rem;
    --admin-layer-sticky: 30;
    font-size: 0.9375rem;
}

.admin-sidebar { position: relative; }
.admin-topbar {
    z-index: var(--admin-layer-sticky);
    background: var(--chc-surface);
    box-shadow: none;
    backdrop-filter: none;
}
.admin-topbar-inner {
    max-width: 1480px;
    margin-inline: auto;
}
@media (min-width: 1024px) {
    .admin-topbar { padding-inline-start: 4rem; }
    .admin-topbar > .admin-sidebar-toggle {
        position: absolute;
        inset-inline-start: 1rem;
        top: 50%;
        transform: translateY(-50%);
        border-radius: 0.5rem;
    }
    .admin-topbar > .admin-sidebar-toggle:hover {
        transform: translateY(-50%);
        background: var(--chc-background, #f6f6f4);
    }
}
.admin-topbar-context > div { overflow: hidden; }
.admin-topbar-context .admin-eyebrow {
    font-size: 0.75rem;
    text-transform: none;
    letter-spacing: 0;
}
.admin-content { min-width: 0; }
.admin-dossier-name { margin: 0.5rem 0 0; font-size: 1.5rem; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.admin-content > section { gap: 1.5rem; }
.admin-page-header,
.admin-data-header { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
.admin-page-header > .min-w-0,
.admin-data-heading { flex: 1 1 24rem; min-width: 0; }
.admin-page-header h1 {
    font-size: 2rem;
    line-height: 1.2;
    letter-spacing: -0.025em;
    overflow-wrap: anywhere;
    text-wrap: balance;
}
.admin-data-header h2 { font-size: 1.125rem; line-height: 1.4; }
.admin-page-header p,
.admin-data-header p { max-width: 72ch; font-weight: 400; line-height: 1.6; }
.admin-page-actions,
.admin-data-actions { flex: 0 1 auto; justify-content: flex-end; }
.admin-page-actions > *,
.admin-data-actions > * { min-width: 0; max-width: 100%; }
.admin-page-meta { font-weight: 500; gap: 0.5rem 1rem; }
.admin-page-meta > span + span::before { content: "·"; margin-right: 1rem; }
.admin-data-surface { min-width: 0; border-radius: 0.75rem; box-shadow: none; }
.admin-data-header,
.admin-toolbar { padding: 1rem 1.25rem; }
.admin-toolbar { container-type: inline-size; }
.admin-filter-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; gap: 0.75rem; }
.admin-toolbar-actions,
.admin-filter-row--export { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem; }
.admin-filter-row > .chc-field { min-width: 0; }
.admin-filter-row--export > .chc-field { flex: 1 1 20rem; }
.admin-filter-row > .rz-button,
.admin-toolbar-actions > * { flex: 0 0 auto; max-width: 100%; }
.admin-toolbar-actions > :first-child { flex: 1 1 17rem; }
.admin-toolbar > .chc-field { width: min(100%, 36rem); }
.admin-shell .chc-field { min-width: 0; }
.admin-shell .chc-field-label { font-size: 0.8125rem; font-weight: 700; line-height: 1.5; }
.admin-shell .chc-field-help { font-weight: 400; line-height: 1.5; overflow-wrap: anywhere; }
.admin-shell .rz-button:not(.rz-numeric-button),
.admin-shell .admin-link-button,
.admin-dialog-footer .rz-button { min-height: var(--admin-control-height, 2.75rem); border-radius: 0.5rem; }
.admin-shell .rz-button .rz-button-text,
.admin-shell .admin-link-button { font-size: 0.875rem; font-weight: 600; white-space: normal; line-height: 1.4; }
.admin-shell .rz-button .rz-button-box { justify-content: center; }
.admin-metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.admin-metric-grid:has(> :nth-child(5)) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.admin-metric-card { min-width: 0; border-radius: 0.75rem; box-shadow: none; padding: 1rem; grid-template-columns: minmax(0, 1fr) auto; align-content: start; }
.admin-metric-topline { grid-column: 2; grid-row: 1; align-self: start; }
.admin-metric-icon { width: 2.25rem; height: 2.25rem; border-radius: 0.5rem; }
.admin-metric-label { grid-column: 1; grid-row: 1; text-transform: none; line-height: 1.5; }
.admin-metric-card > strong,
.admin-metric-skeleton-value { grid-column: 1 / -1; grid-row: 2; }
.admin-metric-card > small,
.admin-metric-skeleton-help,
.admin-metric-card > .admin-progress { grid-column: 1 / -1; }
.admin-metric-card strong { font-size: 1.75rem; line-height: 1.25; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.admin-metric-card strong.admin-metric-value-text { font-size: 1.125rem; line-height: 1.5; overflow-wrap: break-word; }
.admin-metric-label { font-weight: 600; }
.admin-metric-card small { overflow-wrap: anywhere; font-weight: 400; }
.admin-dashboard-layout { display: grid; min-width: 0; gap: 1.25rem; }
.admin-dashboard-layout > * { min-width: 0; }
.admin-shell .rz-data-grid,
.admin-shell .rz-datatable { min-width: 0; max-width: 100%; border-radius: 0; }
.admin-shell .rz-data-grid-data { overflow-x: auto; overscroll-behavior-x: contain; }
.admin-grid-wide .rz-grid-table { min-width: 960px; }
.admin-shell .rz-data-grid:not(.admin-grid-wide) .rz-grid-table { min-width: 100%; }
.admin-shell .rz-grid-table { border-radius: 0 !important; overflow: visible; }
.admin-shell .rz-grid-table thead th { text-transform: none; letter-spacing: 0 !important; font-size: 0.8125rem !important; }
.admin-shell .rz-grid-table td { padding-block: 0.875rem; }
.admin-shell .rz-cell-data { line-height: 1.5; white-space: normal; overflow-wrap: anywhere; }
.admin-shell .rz-cell-data > .rz-button { white-space: nowrap; }
.admin-shell .rz-cell-data small { font-weight: 400; }
.applicant-cell > span { flex: 0 0 auto; }
.applicant-cell > div { min-width: 0; }
.admin-shell .rz-paginator { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0.75rem 1rem; }
.admin-shell .rz-paginator-element { min-width: 2.75rem; min-height: 2.75rem; }
.admin-shell .status-badge { max-width: 100%; white-space: normal; line-height: 1.4; }
.admin-row-actions { margin-top: 0.5rem; }
.admin-row-actions summary { width: fit-content; min-height: 2.75rem; padding: 0.625rem 0.25rem; cursor: pointer; color: var(--chc-teal-dark); font-weight: 600; }
.admin-row-actions summary:focus-visible { outline: 2px solid var(--chc-teal-dark); outline-offset: 2px; }
.admin-row-actions[open] > div { padding-block: 0.25rem; }
.admin-shell .admin-sticky-actionbar { flex-wrap: wrap; min-width: 0; }
.admin-shell .admin-sticky-actionbar > * { min-width: 0; }
.admin-skip-link {
    position: fixed; top: 0.5rem; left: 0.5rem; z-index: 40;
    padding: 0.75rem 1rem; border-radius: 0.5rem;
    background: var(--chc-teal-dark); color: white; transform: translateY(-160%);
}
.admin-skip-link:focus { transform: translateY(0); }
.admin-shell a:focus-visible,
.admin-shell button:focus-visible { outline: 2px solid var(--chc-teal-dark); outline-offset: 2px; }
.admin-shell .nav-link.active:focus-visible { outline-color: white; outline-offset: -4px; }
#admin-main-content { scroll-margin-top: 7rem; }

/* CSS isolation cannot target an ancestor belonging to MainLayout from NavMenu. */
@media (min-width: 1024px) {
    .admin-sidebar { position: sticky; top: 0; height: 100dvh; overflow: hidden; }
    .admin-shell--collapsed .admin-brand { justify-content: center; gap: 0; padding: 1rem 0.5rem; }
    .admin-shell--collapsed .admin-brand img { width: 2.75rem; }
    .admin-shell--collapsed .admin-brand .min-w-0 { display: none; }
    .admin-shell--collapsed .nav-list { padding-inline: 0.5rem; }
    .admin-shell--collapsed .nav-link,
    .admin-shell--collapsed .admin-logout,
    .admin-shell--collapsed .admin-developer-credit { justify-content: center; gap: 0; padding-inline: 0; min-height: 44px; }
    .admin-shell--collapsed .nav-link span,
    .admin-shell--collapsed .admin-logout span,
    .admin-shell--collapsed .admin-developer-credit span {
        position: absolute; width: 1px; height: 1px; overflow: hidden;
        clip-path: inset(50%); white-space: nowrap;
    }
    .admin-shell--collapsed .admin-sidebar-footer { padding-inline: 0.5rem; }
    .admin-topbar-inner { grid-template-columns: minmax(0, 1fr) minmax(12rem, 1fr) auto; }
    .admin-current-user { max-width: 14rem; }
}
@media (min-width: 1440px) {
    .admin-dashboard-layout { grid-template-columns: minmax(0, 1fr) 320px; }
}
@media (max-width: 1199px) {
    .admin-metric-grid,
    .admin-metric-grid:has(> :nth-child(5)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-metric-grid:has(> :nth-child(5)) > :last-child { grid-column: 1 / -1; }
}
@container (min-width: 850px) {
    .admin-filter-row:not(.admin-filter-row--export) { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; }
    .admin-filter-row:has(> .rz-button:nth-child(4)) { grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)) auto; }
}
@container (max-width: 560px) {
    .admin-filter-row { grid-template-columns: minmax(0, 1fr); }
    .admin-filter-row--export > .chc-field { flex-basis: 100%; }
    .admin-filter-row > .rz-button { flex: 1 1 10rem; }
}
@media (max-width: 767px) {
    .admin-shell .rz-frozen-cell-right { position: static !important; right: auto !important; }
    .admin-topbar-inner { grid-template-columns: minmax(0, 1fr) auto; }
    .admin-page-actions,
    .admin-data-actions { justify-content: flex-start; width: 100%; }
    .admin-page-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
    .admin-page-actions > :last-child:nth-child(odd) { grid-column: 1 / -1; }
    .admin-page-actions > *,
    .admin-data-actions > * { flex: 1 1 auto; width: auto; }
    .admin-page-header h1 { font-size: 1.75rem; }
    .admin-content { padding: 1.25rem 1rem 3rem; }
    .admin-content:has(.admin-sticky-actionbar) { padding-bottom: 14rem; }
    .admin-data-header,
    .admin-toolbar { padding: 1rem; }
}
@media (max-width: 359px) {
    .admin-page-actions { grid-template-columns: minmax(0, 1fr); }
    .admin-metric-grid,
    .admin-metric-grid:has(> :nth-child(5)) { grid-template-columns: minmax(0, 1fr); }
    .admin-page-actions > *, .admin-data-actions > * { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .admin-shell { transition: none; }
}

/* Normalize all admin form dialogs without changing Radzen dropdown internals. */
.rz-dialog-wrapper:has(.admin-dialog-content) { align-items: center; }
.rz-dialog:has(.admin-dialog-content) { max-width: calc(100vw - 1rem); }
.rz-dialog:has(.admin-dialog-content) .rz-dialog-title { white-space: normal; line-height: 1.4; }
.admin-dialog-body > .grid { min-width: 0; }
.admin-dialog-content { container-type: inline-size; }
.admin-dialog-body.grid,
.admin-dialog-body .grid { align-content: start; }
.admin-dialog-body.grid { grid-auto-rows: max-content; }
.admin-dialog-content .chc-field { min-width: 0; align-content: start; }
.admin-dialog-content .rz-button:not(.rz-numeric-button) { min-height: 2.75rem; }
.admin-dialog-content .rz-numeric-button,
.admin-shell .rz-numeric-button { min-height: 0; border-radius: 0; padding: 0; box-shadow: none; }
.admin-dialog-content .rz-button-text { white-space: normal; line-height: 1.4; }
.admin-dialog-tabs { flex-shrink: 0; }
.admin-dialog-footer {
    position: static;
    /* Keep actions inside the padded content: negative margins are clipped by form overflow. */
    margin: 0;
    padding: 0.75rem 0.25rem 0.25rem;
    gap: 0.75rem;
}
.admin-dialog-footer .rz-button { flex-shrink: 0; }
.admin-dialog-content :is(input, textarea)::placeholder { color: var(--chc-muted); opacity: 1; }
@container (max-width: 480px) {
    .admin-dialog-body.grid,
    .admin-dialog-body .grid { grid-template-columns: minmax(0, 1fr); }
    .admin-dialog-footer { flex-direction: column; align-items: stretch; }
    .admin-dialog-footer .rz-button,
    .admin-dialog-footer .admin-link-button { width: 100%; flex: 0 0 auto; }
}

/* Evita que controles y mensajes largos amplíen el formulario de acceso. */
.auth-shell form { min-width: 0; grid-template-columns: minmax(0, 1fr); }
.auth-shell .chc-field { min-width: 0; }
.auth-shell input, .auth-shell .rz-textbox { box-sizing: border-box; max-width: 100%; }
.auth-shell button { min-width: 0; white-space: normal; }
.auth-shell .form-alert { overflow-wrap: anywhere; }

/* Riel colapsado: solo iconos, sin el punto de etapa (Mosaico CHC). */
.admin-shell--collapsed .nav-link::after { display: none !important; }
