:root {
    --color-background: #f8fafc;
    --color-surface: #ffffff;
    --color-border: #dbe3ef;
    --color-text: #0f1f33;
    --color-muted: #4a5b73;
    --color-primary: #005ce6;
    --color-primary-soft: #eff6ff;
    --color-success: #16a34a;
    --shadow-soft: 0 10px 30px rgb(15 31 51 / 0.06);
    --header-height: 5.75rem;
    --sidebar-width: 19.75rem;
    --sidebar-collapsed-width: 5.25rem;
    --footer-height: 4rem;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--color-text);
    background: var(--color-background);
}

button,
a {
    font: inherit;
}

.svg-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--header-height) 1fr;
    grid-template-areas:
        "header header"
        "sidebar content";
    transition: grid-template-columns 160ms ease;
}

.app-shell.sidebar-collapsed {
    grid-template-columns: var(--sidebar-collapsed-width) 1fr;
}

.app-header {
    grid-area: header;
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 1px 8px rgb(15 31 51 / 0.04);
    z-index: 2;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.brand-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.brand-logo {
    width: 17.5rem;
    height: calc(var(--header-height) - 0.5rem);
    object-fit: contain;
    object-position: left center;
}

.icon-button,
.logout-button,
.user-menu-button {
    border: 0;
    color: #18365f;
    background: transparent;
    cursor: pointer;
}

.icon-button,
.logout-button {
    width: 2.5rem;
    height: 2.5rem;
    display: inline-grid;
    place-items: center;
    border-radius: 0.5rem;
}

.icon-button:hover,
.logout-button:hover,
.user-menu-button:hover {
    background: var(--color-primary-soft);
}

.user-menu-button {
    min-height: 2.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0 0.65rem;
    border-radius: 0.5rem;
    font-weight: 600;
}

.user-menu {
    position: relative;
}

.user-menu-panel {
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0;
    z-index: 6;
    min-width: 10rem;
    padding: 0.35rem;
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 0.35rem;
    box-shadow: 0 18px 45px rgb(15 31 51 / 0.16);
}

.user-menu-panel a {
    min-height: 2.35rem;
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    color: #18365f;
    text-decoration: none;
    border-radius: 0.3rem;
}

.user-menu-panel a:hover,
.user-menu-panel a.active {
    color: var(--color-primary);
    background: var(--color-primary-soft);
}

.header-icon {
    width: 1.35rem;
    height: 1.35rem;
}

.logout-button .svg-icon {
    width: 1.35rem;
    height: 1.35rem;
}

.chevron {
    width: 1.05rem;
    height: 1.05rem;
    color: var(--color-muted);
}

.app-sidebar {
    grid-area: sidebar;
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
}

.main-menu {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 1rem 0.85rem;
    overflow-y: auto;
}

.menu-item {
    min-height: 3.15rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1rem;
    color: #18365f;
    text-decoration: none;
    border-radius: 0.5rem;
    white-space: nowrap;
}

.menu-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.menu-group-title {
    padding: 0.75rem 1rem 0.25rem;
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.submenu-item {
    min-height: 2.65rem;
    padding-left: 1.5rem;
}

.menu-item:hover,
.menu-item.active {
    color: var(--color-primary);
    background: var(--color-primary-soft);
}

.menu-icon {
    width: 1.35rem;
    height: 1.35rem;
    flex: 0 0 1.35rem;
}

.menu-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-collapsed .brand-logo {
    width: 4.75rem;
    object-fit: cover;
    object-position: left center;
}

.sidebar-collapsed .menu-item {
    justify-content: center;
    padding: 0;
}

.sidebar-collapsed .menu-label,
.sidebar-collapsed .menu-group-title,
.sidebar-collapsed .sidebar-version {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.sidebar-status {
    min-height: var(--footer-height);
    flex: 0 0 var(--footer-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 2rem;
    border-top: 1px solid var(--color-border);
    color: var(--color-muted);
}

.app-content {
    grid-area: content;
    min-width: 0;
    padding: 2rem 2.25rem;
}

.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    margin: 0;
    font-size: 2rem;
    line-height: 1.2;
}

.page-header p {
    margin: 0.65rem 0 0;
    color: var(--color-muted);
    font-size: 1.05rem;
}

.placeholder-panel {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    max-width: 74rem;
    padding: 1.4rem;
    border: 1px solid #93c5fd;
    border-radius: 0.5rem;
    color: #12396d;
    background: linear-gradient(90deg, #eff6ff, #ffffff);
    box-shadow: var(--shadow-soft);
}

.placeholder-icon {
    width: 2.25rem;
    height: 2.25rem;
    display: grid;
    place-items: center;
    flex: 0 0 2.25rem;
    color: var(--color-primary);
    border: 0.16rem solid var(--color-primary);
    border-radius: 50%;
    font-weight: 800;
}

.placeholder-icon .svg-icon {
    width: 1.35rem;
    height: 1.35rem;
}

.placeholder-panel h2 {
    margin: 0;
    font-size: 1.05rem;
}

.placeholder-panel p {
    margin: 0.55rem 0 0;
    color: #294461;
}

/* ---------------------------------------------------------------- Inicio */

.home-view {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
}

.home-hero,
.home-readiness {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-soft);
}

.home-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.5rem;
}

.home-kicker {
    margin: 0 0 0.35rem;
    color: var(--color-primary);
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
}

.home-hero h1,
.home-section-title-row h2 {
    margin: 0;
    color: #102341;
}

.home-hero h1 {
    font-size: 2rem;
    line-height: 1.2;
}

.home-hero p {
    margin: 0.6rem 0 0;
    color: var(--color-muted);
}

.home-period {
    min-width: 12rem;
    padding: 0.85rem 1rem;
    color: #18365f;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.45rem;
}

.home-period span,
.status-card-title {
    display: block;
    color: var(--color-muted);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
}

.home-period strong {
    display: block;
    margin-top: 0.3rem;
    font-size: 1.15rem;
}

.home-readiness {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1.25rem;
    align-items: center;
    padding: 1.25rem;
}

.home-readiness-main {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}

.home-readiness-main h2 {
    margin: 0;
    font-size: 1.25rem;
}

.home-readiness-main p {
    margin: 0.35rem 0 0;
    color: var(--color-muted);
}

.home-readiness-main.home-warning p,
.status-card.status-warning span:last-child {
    color: #92400e;
}

.home-primary-actions,
.home-section-title-row {
    display: flex;
    gap: 0.75rem;
}

.home-primary-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

/*
 * El estado de los datos con los que se calcula la nómina. Lo muestran Inicio y Cálculo de Nómina
 * con las mismas tarjetas, así que el estilo tampoco se escribe dos veces.
 */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 1rem;
}

/*
 * En Inicio la separación la pone el gap de la vista; en Nómina la grilla arranca la página, así
 * que se separa ella misma de la tabla que sigue.
 */
.payroll-view .status-grid {
    margin-bottom: 1.75rem;
}

.status-card {
    min-height: 10rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 1.1rem;
    color: #18365f;
    text-decoration: none;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-soft);
}

.status-card:hover {
    border-color: #93c5fd;
}

.status-card strong {
    color: #102341;
    font-size: 1.25rem;
}

.status-card span:last-child {
    color: var(--color-muted);
    line-height: 1.35;
}

.home-section-title-row {
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e6edf5;
}

.home-payrolls .table-scroll {
    min-height: 0;
}

.page-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.35rem;
}

.page-title-row h1 {
    margin: 0;
    font-size: 2rem;
    line-height: 1.2;
}

.primary-button,
.secondary-button,
.danger-button,
.edit-button,
.delete-button {
    min-height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0 1rem;
    border-radius: 0.35rem;
    cursor: pointer;
}

.button-icon {
    width: 1.05rem;
    height: 1.05rem;
}

.primary-button {
    color: #ffffff;
    background: var(--color-primary);
    border: 1px solid var(--color-primary);
    box-shadow: 0 8px 18px rgb(0 92 230 / 0.18);
}

.secondary-button {
    color: #18365f;
    background: #ffffff;
    border: 1px solid var(--color-border);
}

.danger-button {
    color: #ffffff;
    background: #dc2626;
    border: 1px solid #dc2626;
}

.filter-panel,
.table-panel,
.form-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-soft);
}

.filter-panel {
    display: grid;
    grid-template-columns: minmax(12rem, 1fr) minmax(13rem, 1fr) minmax(13rem, 1fr) minmax(10rem, 0.75fr) minmax(10rem, 0.75fr) auto;
    gap: 1.25rem;
    align-items: end;
    margin-bottom: 1.35rem;
    padding: 1.25rem;
}

.catalog-filter-panel {
    grid-template-columns: minmax(14rem, 1fr) minmax(10rem, 0.45fr) auto;
}

/* Four filters plus the clear button, all on one line. */
.rules-filter-panel {
    grid-template-columns:
        minmax(13rem, 1fr) minmax(11rem, 0.7fr) minmax(11rem, 0.7fr) minmax(10rem, 0.6fr) auto;
}

/* Six filters plus the clear button. */
.payroll-filter-panel {
    grid-template-columns:
        minmax(12rem, 1fr) repeat(5, minmax(9rem, 0.6fr)) auto;
}

/* Un solo buscador y el botón: la lista se lee por persona y no tiene nada más que filtrar. */
.report-filter-panel {
    grid-template-columns: minmax(14rem, 1fr) minmax(12rem, 0.7fr) minmax(12rem, 0.7fr) auto;
}

/* El buscador y el estado, con el botón al final: es todo lo que un préstamo tiene que filtrar. */
.loan-filter-panel {
    grid-template-columns: minmax(14rem, 1fr) minmax(10rem, 0.45fr) auto;
}

.branch-filter-panel {
    grid-template-columns: minmax(14rem, 1fr) minmax(13rem, 1fr) minmax(10rem, 0.55fr) auto;
}

.field-control {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    min-width: 0;
    color: #102341;
    font-weight: 600;
}

.field-control strong {
    color: #dc2626;
}

/* Carries the marker of a dato importante that is still undefined next to its label. */
.field-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* Una aclaración corta de lo que tiene encima. Va en gris para no competir con el dato. */
.field-hint {
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 400;
}

.field-control .field-hint {
    margin-top: -0.25rem;
}

.field-control input,
.field-control select,
.field-control textarea,
.multi-select-button {
    width: 100%;
    min-height: 2.6rem;
    padding: 0 0.85rem;
    color: #18365f;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 0.35rem;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.2;
    outline: none;
}

.field-control textarea {
    min-height: 6rem;
    padding-top: 0.75rem;
    resize: vertical;
}

.field-control select {
    appearance: none;
    padding-right: 2.35rem;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--color-muted) 50%),
        linear-gradient(135deg, var(--color-muted) 50%, transparent 50%);
    background-position:
        calc(100% - 1.05rem) 50%,
        calc(100% - 0.75rem) 50%;
    background-repeat: no-repeat;
    background-size:
        0.35rem 0.35rem,
        0.35rem 0.35rem;
}

.field-control input:disabled,
.field-control select:disabled,
.field-control textarea:disabled {
    color: #64748b;
    background: #f1f5f9;
    cursor: not-allowed;
}

.field-control input:focus,
.field-control select:focus,
.field-control textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgb(0 92 230 / 0.12);
}

.search-field {
    position: relative;
}

.search-field input {
    padding-right: 2.4rem;
}

.search-field span,
.search-field > .svg-icon {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-muted);
}

.search-field .svg-icon {
    width: 1.1rem;
    height: 1.1rem;
}

.clear-filters-button {
    white-space: nowrap;
}

.multi-select {
    position: relative;
}

.multi-select-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    cursor: pointer;
}

.multi-select-button::after {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    margin-left: 0.75rem;
    border-right: 0.12rem solid var(--color-muted);
    border-bottom: 0.12rem solid var(--color-muted);
    transform: translateY(-0.15rem) rotate(45deg);
    flex: 0 0 0.5rem;
}

.multi-select.open .multi-select-button {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgb(0 92 230 / 0.12);
}

.multi-select-menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    z-index: 5;
    display: none;
    max-height: 15rem;
    overflow-y: auto;
    padding: 0.35rem;
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 0.35rem;
    box-shadow: 0 18px 45px rgb(15 31 51 / 0.16);
}

.multi-select.open .multi-select-menu {
    display: block;
}

.multi-select-option {
    width: 100%;
    min-height: 2.3rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0 0.55rem;
    color: #18365f;
    text-align: left;
    background: transparent;
    border: 0;
    border-radius: 0.3rem;
    cursor: pointer;
}

.multi-select-option:hover {
    background: var(--color-primary-soft);
}

/*
 * Lo elegido se marca como una casilla y no como un tilde que aparece de la nada: la casilla vacía
 * ya está ahí sin elegir, así se ve que la opción se puede marcar y la lista no se corre al
 * hacerlo. Sólo el tilde se enciende, para que marcar y desmarcar sea el mismo movimiento.
 */
.multi-select-check {
    width: 1.05rem;
    height: 1.05rem;
    flex: 0 0 1.05rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 0.25rem;
}

.multi-select-check .svg-icon {
    width: 0.8rem;
    height: 0.8rem;
    opacity: 0;
}

.multi-select-option.selected {
    color: #102341;
    background: #e3edfd;
    font-weight: 600;
}

.multi-select-option.selected:hover {
    background: #d7e5fb;
}

.multi-select-option.selected .multi-select-check {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.multi-select-option.selected .multi-select-check .svg-icon {
    opacity: 1;
}

/*
 * Un filtro con algo elegido se nota con el menú cerrado, que es como se lo mira casi siempre: el
 * campo lleva el color del sistema y su texto pesa más, para que no parezca vacío mientras está
 * escondiendo filas.
 */
.multi-select.has-selection .multi-select-button {
    color: #102341;
    border-color: var(--color-primary);
    font-weight: 600;
}

.table-panel {
    overflow: hidden;
}

.table-scroll {
    min-height: 22rem;
    overflow-x: auto;
}

/*
 * Cuántos registros deja ver el filtro, arriba de la tabla y alineado con su primera columna. Va
 * dentro del panel de la tabla y no entre los filtros, porque cada pantalla arma sus filtros con
 * una grilla propia. Mientras no hay nada que contar queda vacío, y entonces tampoco ocupa lugar.
 */
.table-count {
    margin: 0;
    padding: 0.85rem 1.25rem;
    color: var(--color-muted);
    border-bottom: 1px solid #e6edf5;
    font-size: 0.9rem;
    font-weight: 600;
}

.table-count:empty {
    display: none;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th,
.data-table td {
    padding: 0.9rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid #e6edf5;
}

.data-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: #102341;
    background: #fbfdff;
    font-weight: 700;
}

.data-table td {
    color: #18365f;
    background: #ffffff;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 1.55rem;
    padding: 0 0.55rem;
    border-radius: 0.3rem;
    font-size: 0.85rem;
}

.status-badge.active {
    color: #047857;
    background: #dcfce7;
    border: 1px solid #86efac;
}

.status-badge.inactive {
    color: #475569;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
}

.status-badge.error {
    color: #b91c1c;
    background: #fee2e2;
    border: 1px solid #fca5a5;
}

.report-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.summary-card {
    padding: 1.25rem 1.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 0.6rem;
    box-shadow: var(--shadow-soft);
}

.summary-card h3 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.summary-card dl {
    margin: 0;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.4rem 0.75rem;
}

.summary-card dt {
    margin: 0;
    color: var(--color-muted);
}

.summary-card dd {
    margin: 0;
    font-weight: 600;
    text-align: right;
}

/* Una lista de valores que el usuario agrega y quita línea por línea. */
.repeatable-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.repeatable-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.repeatable-row input {
    flex: 1 1 auto;
    min-width: 0;
}

.checkbox-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
}

.checkbox-option {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 400;
}

/* Una casilla no es un campo de texto: la regla de .field-control la estiraría a todo el ancho del
   campo y a la altura de un input. Acá vuelve a su tamaño propio. */
.checkbox-option input[type="checkbox"] {
    width: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    accent-color: var(--color-primary);
    flex: 0 0 auto;
}

.repeatable-remove-button {
    flex: 0 0 auto;
    padding: 0 0.7rem;
}

.repeatable-add-button {
    align-self: flex-start;
    margin-top: 0.2rem;
}

.report-list-panel {
    margin-bottom: 1.5rem;
}

.report-list-panel h3 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

/* A report list sizes to its rows: it shows five of them until the user asks for all. */
.report-list-panel .table-scroll {
    min-height: 0;
}

.report-list-toggle {
    margin-top: 0.6rem;
    padding: 0;
    color: var(--color-primary);
    background: none;
    border: 0;
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.report-message-list {
    margin: 0;
    padding-left: 1.25rem;
    color: var(--color-text);
}

.report-message-list li {
    margin-bottom: 0.35rem;
}

.employee-name-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.warning-icon {
    width: 1.15rem;
    height: 1.15rem;
    display: inline-grid;
    place-items: center;
    flex: 0 0 1.15rem;
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 50%;
}

.warning-icon .svg-icon {
    width: 0.85rem;
    height: 0.85rem;
    stroke-width: 2.3;
}

/* Marca de una fila de la nómina con cambios hechos a mano, hermana de .warning-icon. Es un botón:
   abre la lista de cambios de esa persona. */
.manual-change-icon {
    width: 1.15rem;
    height: 1.15rem;
    display: inline-grid;
    place-items: center;
    flex: 0 0 1.15rem;
    margin: 0 0.35rem 0 0;
    padding: 0;
    color: #1e40af;
    background: #dbeafe;
    border: 1px solid #3b82f6;
    border-radius: 50%;
    vertical-align: -0.15rem;
    cursor: pointer;
}

.manual-change-icon:hover,
.manual-change-icon:focus-visible {
    background: #bfdbfe;
}

.manual-change-icon .svg-icon {
    width: 0.75rem;
    height: 0.75rem;
    stroke-width: 2.3;
}

/* Marca de un dato que la importación cambió y nadie revisó todavía, hermana de .warning-icon. Lleva
   el azul de .manual-change-icon: no falta nada, hay algo que mirar. */
.review-icon {
    width: 1.15rem;
    height: 1.15rem;
    display: inline-grid;
    place-items: center;
    flex: 0 0 1.15rem;
    color: #1e40af;
    background: #dbeafe;
    border: 1px solid #3b82f6;
    border-radius: 50%;
}

.review-icon .svg-icon {
    width: 0.75rem;
    height: 0.75rem;
    stroke-width: 2.3;
}

/* Marca de un dato en orden, hermana de .warning-icon. */
.ok-icon {
    width: 1.15rem;
    height: 1.15rem;
    display: inline-grid;
    place-items: center;
    flex: 0 0 1.15rem;
    color: #166534;
    background: #dcfce7;
    border: 1px solid #22c55e;
    border-radius: 50%;
}

.ok-icon .svg-icon {
    width: 0.85rem;
    height: 0.85rem;
    stroke-width: 2.3;
}

/* El marco del marcador en una tarjeta de estado, un poco mayor que en una fila de listado. */
.status-icon {
    width: 1.5rem;
    height: 1.5rem;
    flex: 0 0 1.5rem;
    margin-top: 0.1rem;
}

.status-icon .svg-icon {
    width: 1rem;
    height: 1rem;
}

.missing-value {
    color: #92400e;
    font-style: italic;
}

.row-actions {
    display: flex;
    gap: 0.75rem;
}

.edit-button,
.delete-button {
    min-height: 2rem;
    padding: 0 0.8rem;
    background: #ffffff;
    font-weight: 600;
}

.edit-button .svg-icon,
.delete-button .svg-icon {
    width: 0.95rem;
    height: 0.95rem;
}

.edit-button {
    color: var(--color-primary);
    border: 1px solid #93c5fd;
}

.delete-button {
    color: #dc2626;
    border: 1px solid #fca5a5;
}

.empty-state {
    margin: 0;
    padding: 2rem;
    color: var(--color-muted);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-top: 0.55rem;
    color: var(--color-muted);
}

.breadcrumb button {
    padding: 0;
    color: var(--color-primary);
    background: transparent;
    border: 0;
    cursor: pointer;
}

.breadcrumb-icon {
    width: 1rem;
    height: 1rem;
}

.form-card {
    padding: 1.5rem;
}

.form-error {
    margin: 0 0 1rem;
    padding: 0.8rem 1rem;
    color: #991b1b;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.35rem;
    font-weight: 600;
}

.form-message {
    margin: 0 0 1rem;
    padding: 0.8rem 1rem;
    border-radius: 0.35rem;
    font-weight: 600;
}

.form-message.info {
    color: #1e40af;
    background: #eff6ff;
    border: 1px solid #93c5fd;
}

.form-message.success {
    color: #047857;
    background: #dcfce7;
    border: 1px solid #86efac;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 2rem;
    row-gap: 1.25rem;
}

.form-grid-wide {
    grid-column: 1 / -1;
}

/* Un campo que ocupa todo el ancho de su form-grid, para una lista larga de opciones. */
.field-control-wide {
    grid-column: 1 / -1;
}

/*
 * Selector de un elemento con búsqueda por tipeo. Se usa donde la lista es demasiado larga para un
 * select: el usuario escribe y solo quedan las opciones que coinciden.
 */
.search-select {
    position: relative;
    display: block;
}

.search-select-menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    z-index: 5;
    max-height: 15rem;
    overflow-y: auto;
    padding: 0.35rem;
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 0.35rem;
    box-shadow: 0 18px 45px rgb(15 31 51 / 0.16);
}

.search-select-option {
    width: 100%;
    min-height: 2.3rem;
    display: flex;
    align-items: center;
    padding: 0 0.55rem;
    color: #18365f;
    text-align: left;
    background: transparent;
    border: 0;
    border-radius: 0.3rem;
    cursor: pointer;
}

.search-select-option:hover,
.search-select-option.active {
    background: var(--color-primary-soft);
}

.search-select-empty {
    padding: 0.55rem;
    color: #64748b;
    font-size: 0.9rem;
}

/* Sections of a long form, as used by the calculation rules. */
.form-section-title {
    margin: 1.75rem 0 0.9rem;
    padding-bottom: 0.5rem;
    color: #102341;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-bottom: 1px solid #e2e8f0;
}

.form-card > .form-section-title:first-of-type {
    margin-top: 0;
}

.form-hint {
    margin: 0 0 0.9rem;
    color: #64748b;
    font-size: 0.9rem;
}

/* Tables whose rows are edited in place: the steps and conditions of a rule. */
.editable-table td {
    padding: 0.4rem 0.6rem;
    vertical-align: middle;
}

.editable-table input,
.editable-table select {
    width: 100%;
    min-height: 2.4rem;
    padding: 0 0.7rem;
    color: #18365f;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 0.35rem;
    font-family: inherit;
    font-size: 0.92rem;
}

/*
 * Un ajuste que derivó el cálculo de los datos importados. Se lee como parte de la lista, pero sin
 * campos: no se edita porque el próximo cálculo lo vuelve a leer.
 */
.derived-adjustment td {
    color: #475569;
    background: #f8fafc;
}

.derived-adjustment td:first-child {
    font-variant-numeric: tabular-nums;
}

/* Importe editable; en descuentos lleva el signo fijo al lado del campo. */
.signed-amount {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.signed-amount-sign {
    color: #64748b;
    font-variant-numeric: tabular-nums;
}

.editable-table td:last-child {
    width: 3.5rem;
    text-align: right;
}

.cell-note {
    margin-top: 0.15rem;
    color: #64748b;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.78rem;
}

.narrow-form-card {
    max-width: 44rem;
}

.single-column-form {
    grid-template-columns: 1fr;
}

.password-rules {
    margin-top: 1.4rem;
    padding: 1rem;
    color: #18365f;
    background: #f8fafc;
    border: 1px solid #e6edf5;
    border-radius: 0.5rem;
}

.password-rules h2 {
    margin: 0;
    font-size: 1rem;
}

.password-rules p {
    margin: 0.55rem 0 0;
    color: var(--color-muted);
}

.password-rules ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem 1rem;
    margin: 0.8rem 0 0;
    padding: 0;
    list-style: none;
}

.password-rules li {
    color: #92400e;
}

.password-rules li::before {
    content: "•";
    margin-right: 0.45rem;
}

.password-rules li.fulfilled {
    color: #047857;
}

.password-rules li.fulfilled::before {
    content: "✓";
}

.switch-field {
    align-items: flex-start;
}

.switch-line {
    min-height: 2.6rem;
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
}

.switch-line input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
}

.switch-track {
    width: 3rem;
    height: 1.55rem;
    position: relative;
    display: inline-block;
    border-radius: 999px;
    background: #cbd5e1;
    transition: background 120ms ease;
}

.switch-track::after {
    content: "";
    width: 1.2rem;
    height: 1.2rem;
    position: absolute;
    top: 0.175rem;
    left: 0.2rem;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 4px rgb(15 31 51 / 0.24);
    transition: transform 120ms ease;
}

.switch-line input:checked + .switch-track {
    background: #16a34a;
}

.switch-line input:checked + .switch-track::after {
    transform: translateX(1.4rem);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.6rem;
    padding-top: 1.4rem;
    border-top: 1px solid #e6edf5;
}

.form-actions .secondary-button,
.form-actions .primary-button {
    min-width: 8rem;
}

.confirm-dialog {
    width: min(28rem, calc(100vw - 2rem));
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    box-shadow: 0 24px 80px rgb(15 31 51 / 0.28);
}

.confirm-dialog::backdrop {
    background: rgb(15 31 51 / 0.34);
}

.confirm-dialog form {
    padding: 1.4rem;
}

.confirm-dialog h2 {
    margin: 0;
    font-size: 1.25rem;
}

.confirm-dialog p {
    margin: 0.8rem 0 0;
    color: var(--color-muted);
}

.confirm-dialog .dialog-warning {
    margin: 0.8rem 0 0;
    padding: 0.8rem 1rem;
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 0.35rem;
    font-weight: 600;
}

/* Lo que falta para calcular, tal como lo pregunta el diálogo antes de elegir el período. */
.confirm-dialog .dialog-warning-list {
    margin: 0.8rem 0 0;
    padding: 0.8rem 1rem 0.8rem 2rem;
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 0.35rem;
    font-weight: 600;
}

.confirm-dialog .dialog-warning-list li + li {
    margin-top: 0.4rem;
}

/**
 * La nómina lleva doce columnas y tiene que entrar entera en la pantalla, sin desplazamiento
 * horizontal: doce veces el respiro de las demás tablas se iba en aire entre las cifras. Acá el
 * espacio lateral es el justo para que las columnas no se toquen.
 */
.payroll-table th,
.payroll-table td {
    padding: 0.75rem 0.7rem;
}

.payroll-table th:first-child,
.payroll-table td:first-child {
    padding-left: 1rem;
}

.payroll-table th:last-child,
.payroll-table td:last-child {
    padding-right: 1rem;
}

/** La columna del desplegable sólo lleva el símbolo; su encabezado es para el lector de pantalla. */
.payroll-table .toggle-column {
    width: 2.5rem;
}

/**
 * Código, cédula y nombre van apilados en una sola columna: son los tres lo mismo - quién es la
 * persona - y separados costaban tres columnas de una tabla que ya es ancha. Los dos números van
 * arriba y atenuados, porque de un vistazo se busca por el nombre.
 */
.payroll-table .employee-cell {
    line-height: 1.35;
    /* El código y la cédula van siempre en una línea; el nombre puede ocupar dos. */
    white-space: nowrap;
    /* Ni tan angosta que el nombre caiga en pedazos, ni tan ancha que empuje a las cifras. */
    min-width: 11rem;
}

.payroll-table .employee-cell span {
    display: block;
}

.payroll-table .employee-id {
    font-size: 0.78rem;
    color: var(--color-muted);
    font-variant-numeric: tabular-nums;
}

.payroll-table .employee-name {
    font-weight: 600;
    /* Un nombre largo no puede empujar el resto de la tabla fuera de la pantalla: se parte. */
    white-space: normal;
    max-width: 15rem;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.confirm-dialog .form-grid {
    margin-top: 1.4rem;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
    margin-top: 1.4rem;
}

@media (max-width: 56rem) {
    .app-shell,
    .app-shell.sidebar-collapsed {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "content";
    }

    .app-sidebar {
        position: fixed;
        top: var(--header-height);
        bottom: 0;
        left: 0;
        width: min(var(--sidebar-width), 88vw);
        transform: translateX(0);
        transition: transform 160ms ease;
        z-index: 3;
        box-shadow: var(--shadow-soft);
    }

    .sidebar-collapsed .app-sidebar {
        transform: translateX(-100%);
    }

    .brand-logo {
        width: 13rem;
        height: calc(var(--header-height) - 0.75rem);
    }

    .app-header,
    .app-content {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .filter-panel,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .page-title-row,
    .form-actions,
    .home-hero,
    .home-readiness,
    .home-section-title-row {
        align-items: stretch;
        flex-direction: column;
    }

    .home-readiness {
        display: flex;
    }

    .home-primary-actions {
        justify-content: flex-start;
    }

}

.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.75rem;
    width: min(28rem, 100%);
}

.auth-logo {
    height: 3rem;
}

.auth-card {
    width: 100%;
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.auth-card h1 {
    margin: 0;
    font-size: 1.4rem;
}

.auth-hint {
    margin: 0;
    color: var(--color-muted);
}


/* ---------------------------------------------------------------- Nómina */

.page-actions {
    display: flex;
    gap: 0.75rem;
}

.payroll-table td.numeric,
.payroll-table th.numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.payroll-table td.total {
    font-weight: 600;
}

.payroll-summary-row .link-button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0;
    color: #18365f;
    background: none;
    border: 0;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}

.payroll-summary-row .link-button:hover {
    color: var(--color-primary, #1d4ed8);
}

.payroll-detail-row > td {
    background: #f8fafc;
}

/*
 * El detalle de un Empleado en tres columnas: de qué salió lo que ganó, lo que se le corrigió a
 * mano y cómo queda liquidado. Las tres arrancan en la misma línea, y los bloques de cada una se
 * leen uno debajo del otro.
 */
.payroll-detail {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
    gap: 1.5rem;
    padding: 1rem 0.5rem;
}

.detail-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}

/* En una pantalla angosta las tres columnas no entran; los bloques se leen entonces en una sola. */
@media (max-width: 56rem) {
    .payroll-detail {
        grid-template-columns: 1fr;
    }
}

/*
 * Bajar el detalle que se está mirando. Va debajo de las tres columnas y no arriba de ellas: es lo
 * último que se hace con el detalle, después de haberlo leído y corregido.
 */
.payroll-detail-actions {
    display: flex;
    justify-content: flex-end;
    padding: 0 0.5rem 1rem;
}

.detail-block .field-hint {
    display: block;
    margin: 0.5rem 0 0;
}

.detail-block h3 {
    margin: 0 0 0.6rem;
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.detail-figures {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.3rem 1rem;
    margin: 0 0 0.6rem;
}

.detail-figures dt {
    color: #475569;
    font-size: 0.9rem;
}

.detail-figures dd {
    margin: 0;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    text-align: right;
}

/* Lo único del detalle que se escribe en vez de leerse: los días trabajados del mes. */
.detail-figures .figure-input {
    width: 100%;
    max-width: 9rem;
    padding: 0.15rem 0.4rem;
    color: inherit;
    font: inherit;
    font-variant-numeric: tabular-nums;
    text-align: right;
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 0.3rem;
}

/* Un mes que no se trabajó entero no paga el salario fijo completo: se marca para que eso no
   pase inadvertido entre los importes que sí salen del cálculo. */
.detail-figures .figure-input.manual-figure {
    background: #fffbeb;
    border-color: #f59e0b;
}

/* Los días llevan al lado el mes con el que se los compara, así que el campo no ocupa toda la
   celda: dos dígitos y el "de 30" que les da la escala. */
.detail-figures dd.days-figure {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
}

.detail-figures .figure-input.days-input {
    width: 3.2rem;
    max-width: 3.2rem;
    text-align: center;
}

.detail-figures .figure-suffix {
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 400;
}

.inner-table {
    background: #ffffff;
}

.inner-table td.numeric,
.inner-table th.numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
}


/* ------------------------------------------------- Reihenfolge der Regeln */

.icon-flipped {
    transform: rotate(180deg);
}

.order-column {
    width: 4.5rem;
    white-space: nowrap;
}

.order-actions {
    display: flex;
    gap: 0.2rem;
}

.order-actions .icon-button {
    padding: 0.25rem;
    color: #475569;
    background: none;
    border: 1px solid #cbd5e1;
    border-radius: 0.3rem;
    cursor: pointer;
}

.order-actions .icon-button:hover:not(:disabled) {
    color: #18365f;
    background: #f1f5f9;
}

.order-actions .icon-button:disabled {
    color: #cbd5e1;
    border-color: #e2e8f0;
    cursor: default;
}

/* A value the user cannot type, but has to understand. */
.readonly-value {
    margin: 0;
    padding: 0.55rem 0.85rem;
    color: #475569;
    background: #f1f5f9;
    border: 1px dashed #cbd5e1;
    border-radius: 0.35rem;
    font-size: 0.95rem;
}

/* ---------------------------------------------------------------- Listas de una nómina */

.report-view .panel-hint {
    margin: 0;
    padding: 1rem 1.25rem 0;
    color: #475569;
    font-size: 0.95rem;
}

.report-table td.numeric,
.report-table th.numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* La suma de cada columna, debajo de la lista y separada de ella. */
.report-table tfoot td {
    color: #102341;
    background: #f8fafc;
    border-top: 2px solid #cbd5e1;
    border-bottom: 0;
    font-weight: 700;
}

/* ---------------------------------------------------------------- Backup / Restauración */

.backup-card {
    max-width: 52rem;
    padding: 1.5rem;
}

.backup-card + .backup-card {
    margin-top: 1.5rem;
}

.backup-card p {
    margin: 0 0 1rem;
    color: #475569;
}

.backup-card .backup-facts:empty {
    display: none;
}

/* El aviso de que restaurar reemplaza todo, con el mismo tono que el del diálogo. */
.backup-card .backup-warning {
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 0.35rem;
    padding: 0.8rem 1rem;
    font-weight: 600;
}

/* ------------------------------------------------- Cambios manuales de la nómina */

/* La lista de cambios manuales y el resultado de aplicarlos: más anchos que una pregunta, porque
   muestran una tabla, y con la lista desplazable para que los botones queden siempre a la vista. */
.changes-dialog {
    width: min(64rem, calc(100vw - 2rem));
}

.changes-dialog .dialog-subtitle {
    color: var(--color-muted);
    font-weight: 400;
}

.changes-filters {
    display: grid;
    grid-template-columns: minmax(14rem, 1fr) minmax(10rem, 0.5fr) minmax(10rem, 0.5fr);
    gap: 1rem;
    align-items: end;
    margin-top: 1.2rem;
}

.changes-dialog .table-count {
    padding: 0.85rem 0 0.5rem;
    border-bottom: 0;
}

.changes-list {
    max-height: min(55vh, 36rem);
    overflow: auto;
    margin-top: 0.8rem;
}

.changes-group + .changes-group {
    margin-top: 1.1rem;
}

.changes-group h3 {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.9rem;
    margin: 0 0 0.4rem;
    font-size: 1rem;
}

.changes-group .employee-id {
    color: var(--color-muted);
    font-size: 0.8rem;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}

.reapply-options {
    flex-direction: column;
    margin-top: 1.1rem;
}

.reapply-options .option-count {
    color: var(--color-muted);
}

/* El mismo botón que abre la lista desde la nómina; acá sólo necesita aire sobre las casillas. */
.reapply-review {
    margin-top: 1rem;
}

@media (max-width: 56rem) {
    .changes-filters {
        grid-template-columns: 1fr;
    }
}

/* Cada persona lleva su propia tabla, y con el ancho automático cada una repartiría sus columnas
   según lo que escribe. Con anchos fijos las columnas quedan una debajo de la otra en toda la lista;
   un motivo largo se parte en vez de correrlas. */
.changes-table {
    table-layout: fixed;
}

.changes-table th:nth-child(1) { width: 20%; }
.changes-table th:nth-child(2) { width: 15%; }
.changes-table th:nth-child(3) { width: 16%; }
.changes-table th:nth-child(4) { width: 16%; }
.changes-table th:nth-child(5) { width: 33%; }

.changes-table td {
    overflow-wrap: anywhere;
}
