:root {
    color-scheme: light;
    --guinda: #9f2241;
    --guinda-dark: #70152b;
    --guinda-soft: #f7e8ed;
    --oro: #bc955c;
    --oro-dark: #8f6938;
    --ink: #1f2937;
    --muted: #667085;
    --line: #d8dee3;
    --surface: #ffffff;
    --page: #f4f1ee;
    --danger: #9f1d35;
    --warning: #7a541f;
    --success: #17633a;
    --shadow: 0 24px 60px rgba(50, 33, 39, 0.16);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select,
textarea {
    font: inherit;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.auth-identity {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100vh;
    padding: 42px;
    background: var(--guinda);
    color: #ffffff;
}

.auth-identity::after {
    content: "";
    display: block;
    width: min(420px, 80%);
    height: 8px;
    background: var(--oro);
    border-radius: 999px;
}

.auth-kicker {
    margin: 26px 0 14px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.auth-title {
    max-width: 640px;
    margin: 0;
    font-size: 42px;
    line-height: 1.1;
}

.auth-copy {
    max-width: 560px;
    margin: 18px 0 0;
    color: rgba(255, 255, 255, 0.82);
    font-size: 18px;
    line-height: 1.55;
}

.auth-panel-wrap {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 32px 24px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(244, 241, 238, 0.92)),
        var(--page);
}

.auth-panel {
    width: min(100%, 430px);
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 6px solid var(--guinda);
    border-radius: 8px;
    padding: 34px;
    box-shadow: var(--shadow);
}

.auth-panel h1 {
    margin: 0 0 8px;
    font-size: 26px;
    line-height: 1.2;
}

.auth-panel p {
    margin: 0 0 20px;
    color: var(--muted);
    line-height: 1.45;
}

.field {
    margin-top: 16px;
}

label {
    display: block;
    margin: 0 0 8px;
    color: #344054;
    font-weight: 700;
}

input {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    background: #ffffff;
    color: var(--ink);
}

textarea {
    width: 100%;
    min-height: 110px;
    resize: vertical;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    background: #ffffff;
    color: var(--ink);
}

select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    background: #ffffff;
    color: var(--ink);
}

input:focus {
    border-color: var(--guinda);
    outline: 3px solid rgba(159, 34, 65, 0.16);
}

select:focus,
textarea:focus {
    border-color: var(--guinda);
    outline: 3px solid rgba(159, 34, 65, 0.16);
}

.primary-button,
.secondary-button {
    min-height: 42px;
    border-radius: 6px;
    padding: 9px 14px;
    font-weight: 700;
    cursor: pointer;
}

.primary-button {
    width: 100%;
    margin-top: 22px;
    border: 0;
    background: var(--guinda);
    color: #ffffff;
}

.primary-button:hover,
.primary-button:focus {
    background: var(--guinda-dark);
}

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

.secondary-button:hover,
.secondary-button:focus {
    border-color: var(--guinda-dark);
    color: var(--guinda-dark);
    background: var(--guinda-soft);
}

.alert {
    margin: 0 0 18px;
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.4;
    white-space: pre-line;
}

.alert-error {
    border: 1px solid rgba(159, 29, 53, 0.28);
    background: rgba(159, 29, 53, 0.08);
    color: var(--danger);
}

.alert-warning {
    border: 1px solid rgba(188, 149, 92, 0.55);
    background: rgba(188, 149, 92, 0.14);
    color: var(--warning);
}

.field-warning {
    color: var(--warning);
}

.alert-success {
    border: 1px solid rgba(23, 99, 58, 0.24);
    background: rgba(23, 99, 58, 0.08);
    color: var(--success);
}

.import-config-summary {
    margin: 0 0 18px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--oro);
    border-radius: 6px;
    background: rgba(188, 149, 92, 0.08);
}

.import-config-summary p {
    margin: 0;
    line-height: 1.5;
}

.import-config-summary p + p {
    margin-top: 4px;
}

.import-config-details {
    margin-top: 10px;
}

.import-config-details summary {
    width: fit-content;
    color: var(--guinda-dark);
    font-weight: 700;
    cursor: pointer;
}

.import-config-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    margin: 12px 0 0;
}

.import-config-columns div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 9px;
    border: 1px solid rgba(188, 149, 92, 0.32);
    border-radius: 5px;
    background: var(--surface);
}

.import-config-columns dt,
.import-config-columns dd {
    margin: 0;
}

.import-config-columns dd {
    color: var(--guinda-dark);
    font-weight: 700;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 28px;
    background: var(--guinda);
    color: #ffffff;
    border-bottom: 5px solid var(--oro);
}

.app-brand {
    display: flex;
    align-items: center;
    flex: 0 1 auto;
    gap: 14px;
    min-width: 0;
    min-height: 64px;
    padding-right: 24px;
    border-right: 1px solid rgba(255, 255, 255, 0.28);
}

.app-brand > div {
    min-width: 0;
}

.app-header h1 {
    margin: 0;
    font-size: 18px;
    line-height: 1.2;
}

.app-header p {
    margin: 4px 0 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: 13px;
    line-height: 1.25;
}

.header-session {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
}

.session-user {
    display: grid;
    gap: 2px;
    min-width: 0;
    text-align: right;
}

.session-user strong {
    max-width: 260px;
    overflow: hidden;
    color: #ffffff;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.session-user span {
    color: rgba(255, 255, 255, 0.72);
    font-size: 12px;
    font-weight: 700;
}

.app-main {
    max-width: 1120px;
    margin: 0 auto;
    padding: 32px 24px;
}

.app-main-wide {
    max-width: 1760px;
    padding-left: 18px;
    padding-right: 18px;
}

.app-main-transferencias {
    max-width: 1680px;
    padding-left: 18px;
    padding-right: 18px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 12px 28px rgba(50, 33, 39, 0.08);
}

.panel h2 {
    margin: 0;
    font-size: 24px;
}

.subsection-title {
    font-size: 18px;
}

.panel p {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.5;
}

.accordion-panel {
    padding: 0;
    border-left: 5px solid var(--guinda);
    background: #ffffff;
    box-shadow: none;
    overflow: hidden;
}

.accordion-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    cursor: pointer;
    list-style: none;
    transition: background-color 0.2s ease;
}

.accordion-summary::-webkit-details-marker {
    display: none;
}

.accordion-summary::marker {
    content: "";
    font-size: 0;
}

.accordion-summary::after {
    content: "";
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    margin-right: 4px;
    border-right: 2px solid var(--guinda);
    border-bottom: 2px solid var(--guinda);
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.2s ease;
}

.accordion-summary > div {
    flex: 1;
    min-width: 0;
}

.accordion-summary h2 {
    font-size: 17px;
}

.accordion-summary:hover {
    background: rgba(188, 149, 92, 0.08);
}

.accordion-panel[open] .accordion-summary {
    border-bottom: 1px solid var(--line);
    background: rgba(188, 149, 92, 0.1);
}

.accordion-panel[open] .accordion-summary::after {
    transform: rotate(225deg) translate(-2px, -2px);
}

.accordion-panel > form,
.accordion-panel > .form-panel,
.accordion-panel > .empty-state,
.accordion-panel > .accordion-controls {
    margin: 16px;
}

.accordion-controls {
    margin-bottom: 0;
}

.header-actions {
    display: flex;
    align-items: stretch;
    flex-wrap: wrap;
    gap: 0;
    align-self: stretch;
    margin-left: 10px;
}

.header-home-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    min-height: 64px;
    color: #ffffff;
    text-decoration: none;
}

.header-home-link svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.header-link {
    min-height: 64px;
    display: inline-flex;
    align-items: center;
    border: 0;
    border-radius: 0;
    padding: 0 16px;
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
}

.header-home-link:hover,
.header-home-link:focus,
.header-link:hover,
.header-link:focus {
    background: var(--guinda-dark);
    color: #ffffff;
}

.nav-menu {
    position: relative;
    display: flex;
}

.header-actions .nav-menu > summary {
    min-height: 64px;
    display: inline-flex;
    align-items: center;
    border: 0;
    border-radius: 0;
    padding: 0 16px;
    background: transparent;
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
    -webkit-appearance: none;
    appearance: none;
}

.header-actions .nav-menu > summary::-webkit-details-marker {
    display: none;
}

.header-actions .nav-menu > summary::marker {
    content: "";
    font-size: 0;
}

.nav-menu[open] summary,
.nav-menu summary:hover,
.nav-menu summary:focus {
    background: var(--guinda-dark);
    color: #ffffff;
}

.header-actions .nav-menu-list {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 30;
    display: none;
    min-width: 280px;
    border: 0;
    border-top: 4px solid var(--oro);
    border-radius: 0 0 8px 8px;
    padding: 14px 0;
    background: var(--guinda-dark);
    box-shadow: 0 18px 42px rgba(50, 33, 39, 0.32);
}

.nav-menu:focus-within .nav-menu-list,
.nav-menu[open] .nav-menu-list {
    display: grid;
}

.header-actions .nav-menu-list a,
.header-actions .nav-menu-list a:link,
.header-actions .nav-menu-list a:visited {
    border-radius: 0;
    padding: 11px 20px;
    color: rgba(255, 255, 255, 0.82);
    font-weight: 700;
    text-decoration: none;
    line-height: 1.25;
}

.header-actions .nav-menu-list a:hover,
.header-actions .nav-menu-list a:focus {
    background: rgba(188, 149, 92, 0.2);
    color: #ffffff;
    text-decoration: none;
}

.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.heading-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.fiscal-year-form {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0 0;
}

.fiscal-year-form label {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.fiscal-year-form select {
    min-height: 36px;
    width: auto;
    min-width: 110px;
    padding: 7px 10px;
}

.modal-fiscal-year-form {
    margin-bottom: 16px;
}

.primary-link-button,
.secondary-link-button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    padding: 9px 14px;
    font-weight: 700;
    text-decoration: none;
}

.primary-link-button {
    background: var(--guinda);
    color: #ffffff;
}

.secondary-link-button {
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--ink);
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 780px;
}

.data-table th,
.data-table td {
    border-bottom: 1px solid var(--line);
    padding: 12px;
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    background: var(--guinda);
    color: #ffffff;
    font-size: 14px;
}

.numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 18px 0 22px;
}

.empty-state {
    margin-top: 18px;
    border: 1px solid var(--line);
    border-left: 5px solid var(--oro);
    border-radius: 8px;
    padding: 18px;
    background: #ffffff;
}

.empty-state h3 {
    margin: 0;
    font-size: 18px;
}

.empty-state p {
    margin: 8px 0 0;
    color: var(--muted);
}

.access-scope-note {
    margin: 12px 0 18px;
    border: 1px solid rgba(188, 149, 92, 0.34);
    border-left: 5px solid var(--oro);
    border-radius: 8px;
    padding: 12px 14px;
    background: rgba(188, 149, 92, 0.1);
    color: var(--ink);
    font-weight: 700;
}

.history-panel {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 16px;
    margin: 18px 0 20px;
    padding: 16px;
    border: 1px solid var(--line);
    border-left: 5px solid var(--oro);
    border-radius: 8px;
    background: #ffffff;
}

.history-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 12px;
}

.history-form .field {
    margin-top: 0;
}

.active-cut-note {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid rgba(23, 99, 58, 0.18);
    border-radius: 8px;
    padding: 12px 14px;
    background: rgba(23, 99, 58, 0.07);
    color: var(--success);
}

.active-cut-note span {
    font-size: 13px;
    font-weight: 700;
}

.active-cut-note strong {
    margin-top: 4px;
    color: var(--ink);
}

.summary-card {
    border: 1px solid var(--line);
    border-left: 5px solid var(--oro);
    border-radius: 8px;
    padding: 14px 16px;
    background: #ffffff;
}

.summary-card span,
.cell-note {
    display: block;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}

.summary-card strong {
    display: block;
    margin-top: 6px;
    font-size: 18px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border: 1px solid rgba(159, 34, 65, 0.22);
    border-radius: 999px;
    padding: 5px 10px;
    background: var(--guinda-soft);
    color: var(--guinda-dark);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.saldos-table-wrap {
    border: 1px solid var(--line);
    border-radius: 8px;
}

.table-search-panel {
    position: sticky;
    bottom: 12px;
    z-index: 8;
    margin: 18px 0;
    border: 1px solid var(--line);
    border-left: 5px solid var(--guinda);
    border-radius: 8px;
    padding: 16px;
    background: #ffffff;
    box-shadow: 0 14px 32px rgba(50, 33, 39, 0.16);
}

.table-search-panel label {
    margin-bottom: 8px;
}

.saldos-table {
    min-width: 2540px;
    table-layout: fixed;
}

.saldos-table th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.saldos-table td {
    font-size: 14px;
}

.sticky-col {
    position: sticky;
    z-index: 2;
    background: #ffffff;
    box-shadow: 1px 0 0 var(--line);
}

.saldos-table th.sticky-col {
    z-index: 4;
    background: var(--guinda);
}

.totals-row .sticky-col {
    background: var(--guinda-soft);
}

.sticky-ubp {
    left: 0;
    width: 86px;
    min-width: 86px;
}

.sticky-nombre {
    left: 86px;
    width: 155px;
    min-width: 155px;
}

.sticky-centro {
    left: 241px;
    width: 170px;
    min-width: 170px;
}

.sticky-partida {
    left: 411px;
    width: 145px;
    min-width: 145px;
}

.sticky-clave {
    left: 556px;
    width: 132px;
    min-width: 132px;
}

.sticky-total-label {
    left: 0;
    width: 688px;
    min-width: 688px;
}

.sticky-nombre,
.sticky-centro,
.sticky-partida {
    font-size: 12px;
    line-height: 1.25;
}

.sticky-nombre strong,
.sticky-partida .cell-note {
    display: block;
    white-space: normal;
}

.clave-presupuestal-column {
    width: 132px;
    max-width: 132px;
    overflow-wrap: anywhere;
    white-space: normal;
}

.totals-row td {
    background: var(--guinda-soft);
    color: var(--guinda-dark);
    font-weight: 800;
}

.row-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.row-actions form {
    margin: 0;
}

.row-actions a,
.link-button {
    border: 0;
    background: transparent;
    color: var(--guinda);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 0;
    text-decoration: none;
}

.danger-link {
    color: var(--danger);
}

.icon-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(159, 34, 65, 0.22);
    border-radius: 6px;
    background: #ffffff;
    color: var(--guinda);
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.icon-action svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.icon-action:hover {
    border-color: rgba(159, 34, 65, 0.42);
    background: var(--guinda-soft);
}

.icon-action-danger {
    border-color: rgba(159, 29, 53, 0.26);
    color: var(--danger);
}

.icon-action-danger:hover {
    border-color: rgba(159, 29, 53, 0.48);
    background: rgba(159, 29, 53, 0.08);
}

.form-panel {
    max-width: 980px;
}

.app-main-wide .form-panel {
    max-width: none;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.manual-month-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

@media (max-width: 860px) {
    .manual-month-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.field-full {
    grid-column: 1 / -1;
}

.field-help,
.field-error {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.35;
}

.field-help {
    color: var(--muted);
}

.field-error {
    color: var(--danger);
}

.module-section {
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

.module-section h2 {
    margin: 0;
    font-size: 20px;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.ubp-search-panel {
    position: static;
    box-shadow: none;
}

.saldo-validation-card {
    margin: 14px 0 16px;
    border: 1px solid var(--line);
    border-left: 5px solid var(--guinda);
    border-radius: 8px;
    padding: 14px 16px;
    background: #ffffff;
}

.saldo-validation-card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.saldo-validation-card strong {
    display: block;
    margin-top: 4px;
    color: var(--ink);
    font-size: 17px;
}

.saldo-validation-card p {
    margin: 6px 0 0;
    color: var(--muted);
    line-height: 1.4;
}

.saldo-transfer-request-link {
    margin-top: 12px;
}

.saldo-validation-success {
    border-left-color: var(--success);
    background: rgba(23, 99, 58, 0.07);
}

.saldo-validation-warning {
    border-left-color: var(--danger);
    background: rgba(159, 29, 53, 0.07);
}

.saldo-validation-warning strong {
    color: var(--danger);
}

/* FUR en proceso de la misma clave: advertencia informativa, no bloquea la captura */
.saldo-validation-proceso {
    border-left-color: var(--oro);
    background: rgba(188, 149, 92, 0.1);
}

.saldo-validation-proceso strong {
    color: var(--warning);
}

.saldo-validation-proceso ul {
    margin: 8px 0 0;
    padding-left: 18px;
    color: var(--ink);
    line-height: 1.45;
}

.saldo-validation-proceso p {
    color: var(--ink);
}

.saldo-validation-proceso .field-help {
    color: var(--muted);
    font-size: 13px;
}

.ubp-permission-wrap {
    max-height: 480px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.ubp-permission-table {
    min-width: 1180px;
}

.ubp-permission-table th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.ubp-permission-table td {
    font-size: 13px;
}

.ubp-permission-table input[type="checkbox"] {
    width: 18px;
    min-height: 18px;
}

.ubp-permission-table input[type="radio"] {
    width: 18px;
    min-height: 18px;
}

.module-option {
    display: flex;
    gap: 10px;
    min-height: 76px;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    font-weight: 400;
}

.module-option input {
    width: 18px;
    min-height: 18px;
    margin-top: 2px;
}

.module-option span {
    display: grid;
    gap: 4px;
}

.module-option small {
    color: var(--muted);
    line-height: 1.35;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 26px;
}

.transfer-form {
    max-width: none;
}

.excel-transfer-panel {
    max-width: 720px;
    border: 1px solid var(--line);
    border-left: 5px solid var(--oro);
    border-radius: 8px;
    padding: 16px;
    background: #ffffff;
}

.template-download-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 14px;
    border: 1px solid rgba(188, 149, 92, 0.34);
    border-left: 5px solid var(--oro);
    border-radius: 8px;
    padding: 12px 14px;
    background: rgba(188, 149, 92, 0.08);
}

.template-download-box p {
    margin: 0;
}

.template-download-box .secondary-link-button {
    flex: 0 0 auto;
}

.transfer-history-panel {
    margin-top: 22px;
}

.transfer-table {
    min-width: 1420px;
}

.transfer-table td {
    vertical-align: top;
}

.manual-transfer-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.manual-transfer-table th,
.manual-transfer-table td {
    padding: 10px 9px;
    font-size: 13px;
}

.manual-transfer-table th:nth-child(1),
.manual-transfer-table td:nth-child(1) {
    width: 7%;
}

.manual-transfer-table th:nth-child(2),
.manual-transfer-table td:nth-child(2) {
    width: 7%;
}

.manual-transfer-table th:nth-child(3),
.manual-transfer-table td:nth-child(3) {
    width: 24%;
}

.manual-transfer-table th:nth-child(4),
.manual-transfer-table td:nth-child(4) {
    width: 24%;
}

.manual-transfer-table th:nth-child(5),
.manual-transfer-table td:nth-child(5) {
    width: 8%;
}

.manual-transfer-table th:nth-child(6),
.manual-transfer-table td:nth-child(6) {
    width: 7%;
}

.manual-transfer-table th:nth-child(7),
.manual-transfer-table td:nth-child(7) {
    width: 8%;
}

.manual-transfer-table th:nth-child(8),
.manual-transfer-table td:nth-child(8) {
    width: 10%;
}

.manual-transfer-table th:nth-child(9),
.manual-transfer-table td:nth-child(9) {
    width: 5%;
    text-align: center;
}

.manual-transfer-table td:nth-child(3),
.manual-transfer-table td:nth-child(4),
.manual-transfer-table td:nth-child(7),
.manual-transfer-table td:nth-child(8) {
    overflow-wrap: anywhere;
}

.manual-transfer-table td:nth-child(1),
.manual-transfer-table td:nth-child(2),
.manual-transfer-table td:nth-child(5),
.manual-transfer-table td:nth-child(6),
.manual-transfer-table td:nth-child(7) {
    overflow-wrap: break-word;
}

.manual-transfer-table .cell-note {
    display: block;
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.25;
}

.manual-transfer-table td:nth-child(9) form {
    display: inline-flex;
    margin: 0;
}

.solicitud-transfer-table {
    min-width: 1320px;
}

.solicitud-transfer-table th:nth-child(1),
.solicitud-transfer-table td:nth-child(1) {
    width: 145px;
}

.solicitud-transfer-table th:nth-child(2),
.solicitud-transfer-table td:nth-child(2) {
    width: 120px;
}

.solicitud-transfer-table th:nth-child(3),
.solicitud-transfer-table td:nth-child(3) {
    width: 360px;
}

.solicitud-transfer-table th:nth-child(4),
.solicitud-transfer-table td:nth-child(4),
.solicitud-transfer-table th:nth-child(5),
.solicitud-transfer-table td:nth-child(5) {
    width: 150px;
}

.solicitud-transfer-table th:nth-child(9),
.solicitud-transfer-table td:nth-child(9) {
    width: 90px;
    text-align: center;
}

.solicitud-transfer-table td:nth-child(9) form {
    display: flex;
    justify-content: center;
    margin: 0;
}

.dashboard-request-panel {
    margin-top: 22px;
}

.dashboard-request-table {
    min-width: 820px;
}

.request-filter-form {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
}

.request-filter-form label {
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 13px;
}

.request-filter-form select {
    min-width: 150px;
    min-height: 38px;
    padding: 7px 10px;
}

.request-filter-form .secondary-button {
    min-height: 38px;
}

.review-request-table {
    min-width: 1580px;
}

.review-request-table th:nth-child(3),
.review-request-table td:nth-child(3) {
    width: 330px;
}

.review-request-table th:nth-child(7),
.review-request-table td:nth-child(7),
.review-request-table th:nth-child(8),
.review-request-table td:nth-child(8) {
    width: 220px;
}

.review-request-table th:nth-child(9),
.review-request-table td:nth-child(9) {
    width: 280px;
}

.status-aceptada {
    border-color: rgba(23, 99, 58, 0.24);
    background: rgba(23, 99, 58, 0.08);
    color: var(--success);
}

.status-rechazada,
.status-cancelada {
    border-color: rgba(159, 29, 53, 0.24);
    background: rgba(159, 29, 53, 0.08);
    color: var(--danger);
}

.review-meta {
    margin-top: 7px;
}

.review-open-button {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    border: 1px solid var(--guinda);
    border-radius: 6px;
    padding: 6px 12px;
    background: #ffffff;
    color: var(--guinda);
    cursor: pointer;
    font-weight: 700;
}

.review-open-button:hover,
.review-open-button:focus {
    background: var(--guinda-soft);
}

.review-modal {
    width: min(680px, calc(100% - 32px));
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    border: 1px solid var(--line);
    border-top: 6px solid var(--guinda);
    border-radius: 12px;
    padding: 0;
    background: #ffffff;
    color: var(--ink);
    box-shadow: var(--shadow);
}

.review-modal::backdrop {
    background: rgba(31, 41, 55, 0.62);
    backdrop-filter: blur(2px);
}

.review-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px 18px;
    border-bottom: 1px solid var(--line);
}

.review-modal-header h2 {
    margin: 4px 0 0;
    font-size: 24px;
}

.review-modal-kicker {
    color: var(--guinda);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.review-modal-close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: var(--guinda-soft);
    color: var(--guinda);
    cursor: pointer;
    font-size: 26px;
    line-height: 1;
}

.review-modal-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 20px 24px 0;
}

.review-modal-summary > div {
    border: 1px solid var(--line);
    border-left: 4px solid var(--oro);
    border-radius: 7px;
    padding: 11px 12px;
}

.review-modal-summary span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.review-modal-summary strong {
    display: block;
    margin-top: 5px;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

.review-modal form {
    padding: 20px 24px 24px;
}

.review-modal textarea {
    min-height: 110px;
}

.review-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.accept-button,
.reject-button {
    min-height: 36px;
    border-radius: 6px;
    padding: 7px 10px;
    color: #ffffff;
    cursor: pointer;
    font-weight: 700;
}

.accept-button {
    border: 1px solid var(--success);
    background: var(--success);
}

.reject-button {
    border: 1px solid var(--danger);
    background: var(--danger);
}

.accept-button:hover,
.accept-button:focus,
.reject-button:hover,
.reject-button:focus {
    filter: brightness(0.9);
}

.adjustment-manual-table th:nth-child(3),
.adjustment-manual-table td:nth-child(3) {
    width: 9%;
}

.adjustment-manual-table th:nth-child(4),
.adjustment-manual-table td:nth-child(4) {
    width: 38%;
}

.transfer-excel-table {
    min-width: 1060px;
    table-layout: fixed;
}

.transfer-excel-table th:nth-child(1),
.transfer-excel-table td:nth-child(1) {
    width: 150px;
}

.transfer-excel-table th:nth-child(2),
.transfer-excel-table td:nth-child(2) {
    width: 300px;
}

.transfer-excel-table th:nth-child(3),
.transfer-excel-table td:nth-child(3) {
    width: 110px;
}

.transfer-excel-table th:nth-child(4),
.transfer-excel-table td:nth-child(4),
.transfer-excel-table th:nth-child(5),
.transfer-excel-table td:nth-child(5) {
    width: 120px;
}

.transfer-excel-table th:nth-child(6),
.transfer-excel-table td:nth-child(6) {
    width: 100px;
}

.transfer-excel-table th:nth-child(7),
.transfer-excel-table td:nth-child(7) {
    overflow-wrap: anywhere;
    font-size: 13px;
    line-height: 1.35;
    white-space: pre-line;
}

.transfer-excel-table th:nth-child(8),
.transfer-excel-table td:nth-child(8) {
    width: 96px;
    text-align: center;
}

.transfer-excel-table td:nth-child(2) .cell-note {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-name-with-extension {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.file-name-with-extension span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-name-with-extension em {
    flex: 0 0 auto;
    border: 1px solid rgba(159, 34, 65, 0.2);
    border-radius: 4px;
    padding: 1px 5px;
    background: var(--guinda-soft);
    color: var(--guinda-dark);
    font-size: 12px;
    font-style: normal;
    font-weight: 800;
}

.transfer-excel-table td:nth-child(8) form {
    display: inline-flex;
    margin: 0;
}

.transfer-excel-table td:nth-child(8) .secondary-button {
    min-height: 34px;
    padding: 6px 9px;
    font-size: 12px;
    white-space: nowrap;
}

.transfer-preview-table {
    min-width: 980px;
}

.transfer-preview-table th:nth-child(1),
.transfer-preview-table td:nth-child(1) {
    width: 70px;
}

.transfer-preview-table th:nth-child(2),
.transfer-preview-table td:nth-child(2) {
    width: 130px;
}

.transfer-preview-table th:nth-child(4),
.transfer-preview-table td:nth-child(4) {
    width: 120px;
}

.preview-apply-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
}

.compact-button {
    width: auto;
    margin-top: 0;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(31, 41, 55, 0.46);
}

.modal-backdrop[hidden] {
    display: none;
}

.modal-panel {
    width: min(100%, 620px);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    border: 1px solid var(--line);
    border-top: 6px solid var(--guinda);
    border-radius: 8px;
    padding: 24px;
    background: #ffffff;
    box-shadow: var(--shadow);
}

.modal-panel-wide {
    width: min(100%, 920px);
}

.modal-panel .section-heading {
    margin-bottom: 10px;
}

.modal-history-panel {
    margin-bottom: 0;
}

.fur-detail-table input {
    min-width: 160px;
}

.fur-detail-table td:first-child,
.fur-detail-table th:first-child {
    width: 150px;
}

.fur-detail-table td:nth-child(2),
.fur-detail-table th:nth-child(2) {
    width: 170px;
}

.fur-ubp-wrap {
    max-height: 520px;
}

.fur-ubp-table {
    min-width: 2760px;
    table-layout: fixed;
}

.fur-col-select {
    width: 96px;
}

.fur-col-ubp {
    width: 86px;
}

.fur-col-nombre {
    width: 170px;
}

.fur-col-centro {
    width: 180px;
}

.fur-col-partida {
    width: 160px;
}

.fur-col-clave {
    width: 230px;
}

.fur-col-month,
.fur-col-total {
    width: 130px;
}

.fur-ubp-table th,
.fur-ubp-table td {
    white-space: nowrap;
}

.fur-ubp-table th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.fur-sticky-col {
    position: sticky;
    z-index: 2;
    background: #ffffff;
    box-shadow: 1px 0 0 var(--line);
}

.fur-ubp-table th.fur-sticky-col {
    z-index: 4;
    background: var(--guinda);
}

.fur-sticky-select {
    left: 0;
    width: 96px;
    min-width: 96px;
    text-align: center;
}

.fur-sticky-ubp {
    left: 96px;
    width: 86px;
    min-width: 86px;
}

.fur-sticky-nombre {
    left: 182px;
    width: 170px;
    min-width: 170px;
}

.fur-sticky-centro {
    left: 352px;
    width: 180px;
    min-width: 180px;
}

.fur-sticky-partida {
    left: 532px;
    width: 160px;
    min-width: 160px;
}

.fur-sticky-clave {
    left: 692px;
    width: 230px;
    min-width: 230px;
    max-width: 230px;
}

.fur-sticky-nombre,
.fur-sticky-centro,
.fur-sticky-partida {
    font-size: 12px;
    line-height: 1.25;
}

.fur-ubp-table .fur-sticky-nombre,
.fur-ubp-table .fur-sticky-centro,
.fur-ubp-table .fur-sticky-partida,
.fur-ubp-table .fur-sticky-partida .cell-note,
.fur-ubp-table .fur-sticky-clave {
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.info-grid > div {
    border: 1px solid var(--line);
    border-left: 5px solid var(--oro);
    border-radius: 8px;
    padding: 12px 14px;
    background: #ffffff;
}

.info-grid span,
.info-grid small {
    display: block;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}

.info-grid strong {
    display: block;
    margin-top: 5px;
    line-height: 1.35;
}

.workflow-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.workflow-card {
    border: 1px solid var(--line);
    border-left: 5px solid var(--guinda);
    border-radius: 8px;
    background: #ffffff;
    overflow: hidden;
}

.workflow-card-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    cursor: pointer;
    list-style: none;
    transition: background-color 0.2s ease;
}

.workflow-card-heading::-webkit-details-marker {
    display: none;
}

.workflow-card-heading:hover {
    background: rgba(188, 149, 92, 0.08);
}

.workflow-card[open] .workflow-card-heading {
    border-bottom: 1px solid var(--line);
    background: rgba(188, 149, 92, 0.1);
}

.workflow-card-heading h3 {
    flex: 1;
    margin: 0;
    font-size: 17px;
}

.workflow-toggle {
    width: 10px;
    height: 10px;
    margin-right: 4px;
    border-right: 2px solid var(--guinda);
    border-bottom: 2px solid var(--guinda);
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.2s ease;
}

.workflow-card[open] .workflow-toggle {
    transform: rotate(225deg) translate(-2px, -2px);
}

.workflow-card-content {
    padding: 16px;
}

.workflow-card p {
    color: var(--muted);
    line-height: 1.45;
}

.quote-grid {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr) minmax(120px, 0.45fr);
    gap: 10px;
}

.quote-option {
    align-self: end;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    margin: 0;
    font-weight: 700;
}

.quote-option input {
    width: 18px;
    min-height: 18px;
}

.compact-actions {
    margin-top: 12px;
}

.compact-info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

@media (max-width: 860px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-identity {
        min-height: auto;
        padding: 28px 24px;
    }

    .auth-identity::after {
        margin-top: 26px;
    }

    .auth-title {
        font-size: 32px;
    }

    .auth-panel-wrap {
        min-height: auto;
        padding: 24px;
    }

    .workflow-grid,
    .quote-grid,
    .compact-info-grid {
        grid-template-columns: 1fr;
    }

    .auth-panel {
        width: min(100%, 420px);
    }
}

/* Excepcion: los saldos mensuales conservan su formato amplio y desplazable. */
.horizontal-scroll-hint {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 14px 0 8px !important;
    border: 1px solid rgba(188, 149, 92, 0.4);
    border-left: 5px solid var(--oro);
    border-radius: 7px;
    padding: 10px 12px;
    background: rgba(188, 149, 92, 0.1);
    color: var(--ink) !important;
    font-size: 13px;
    font-weight: 700;
}

.horizontal-scroll-hint span {
    color: var(--guinda);
    font-size: 22px;
    line-height: 1;
}

.table-wrap.saldos-table-wrap,
.table-wrap.fur-ubp-wrap {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-color: var(--guinda) var(--guinda-soft);
    scrollbar-width: auto;
}

table.data-table.saldos-table {
    width: 2540px;
    min-width: 2540px !important;
    max-width: none;
    table-layout: fixed !important;
    font-size: 14px;
}

table.data-table.saldos-table th,
table.data-table.saldos-table td {
    padding: 12px;
}

table.data-table.saldos-table .numeric {
    white-space: nowrap;
}

table.data-table.saldos-table .sticky-col {
    position: sticky;
    z-index: 2;
    background: #ffffff;
    box-shadow: 1px 0 0 var(--line);
}

table.data-table.saldos-table th.sticky-col {
    z-index: 4;
    background: var(--guinda);
}

table.data-table.saldos-table .sticky-ubp {
    left: 0 !important;
    width: 86px !important;
    min-width: 86px !important;
}

table.data-table.saldos-table .sticky-nombre {
    left: 86px !important;
    width: 155px !important;
    min-width: 155px !important;
}

table.data-table.saldos-table .sticky-centro {
    left: 241px !important;
    width: 170px !important;
    min-width: 170px !important;
}

table.data-table.saldos-table .sticky-partida {
    left: 411px !important;
    width: 145px !important;
    min-width: 145px !important;
}

table.data-table.saldos-table .sticky-clave {
    left: 556px !important;
    width: 132px !important;
    min-width: 132px !important;
}

table.data-table.saldos-table .sticky-total-label {
    left: 0 !important;
    width: 688px !important;
    min-width: 688px !important;
}

table.data-table.fur-ubp-table {
    width: 2760px;
    min-width: 2760px !important;
    max-width: none;
    table-layout: fixed !important;
    font-size: 13px;
}

table.data-table.fur-ubp-table th,
table.data-table.fur-ubp-table td {
    padding: 12px;
    white-space: nowrap;
}

table.data-table.fur-ubp-table .fur-sticky-col {
    position: sticky;
    z-index: 2;
    background: #ffffff;
    box-shadow: 1px 0 0 var(--line);
}

table.data-table.fur-ubp-table th.fur-sticky-col {
    z-index: 4;
    background: var(--guinda);
}

table.data-table.fur-ubp-table .fur-sticky-select {
    left: 0 !important;
    width: 96px !important;
    min-width: 96px !important;
}

table.data-table.fur-ubp-table .fur-sticky-ubp {
    left: 96px !important;
    width: 86px !important;
    min-width: 86px !important;
}

table.data-table.fur-ubp-table .fur-sticky-nombre {
    left: 182px !important;
    width: 170px !important;
    min-width: 170px !important;
}

table.data-table.fur-ubp-table .fur-sticky-centro {
    left: 352px !important;
    width: 180px !important;
    min-width: 180px !important;
}

table.data-table.fur-ubp-table .fur-sticky-partida {
    left: 532px !important;
    width: 160px !important;
    min-width: 160px !important;
}

table.data-table.fur-ubp-table .fur-sticky-clave {
    left: 692px !important;
    width: 230px !important;
    min-width: 230px !important;
    max-width: 230px !important;
}

table.data-table.fur-ubp-table .fur-sticky-nombre,
table.data-table.fur-ubp-table .fur-sticky-centro,
table.data-table.fur-ubp-table .fur-sticky-partida,
table.data-table.fur-ubp-table .fur-sticky-partida .cell-note,
table.data-table.fur-ubp-table .fur-sticky-clave {
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
}

@media (max-width: 560px) {
    .auth-panel {
        padding: 22px;
        width: 100%;
    }

    .auth-title {
        font-size: 28px;
    }

    .auth-copy {
        font-size: 16px;
    }

    .app-header {
        align-items: flex-start;
        flex-direction: column;
        padding: 18px;
    }

    .app-brand {
        width: 100%;
        min-height: auto;
        padding-right: 0;
        padding-bottom: 14px;
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.24);
    }

    .app-main {
        padding: 24px 16px;
    }

    .section-heading,
    .form-actions,
    .heading-actions {
        flex-direction: column;
    }

    .header-actions {
        width: 100%;
        align-items: stretch;
        margin-left: 0;
    }

    .header-session {
        width: 100%;
        justify-content: space-between;
        margin-left: 0;
    }

    .session-user {
        text-align: left;
    }

    .header-link,
    .nav-menu summary {
        width: 100%;
        justify-content: space-between;
    }

    .nav-menu-list {
        position: static;
        margin-top: 8px;
        box-shadow: none;
    }

    .primary-link-button,
    .secondary-link-button,
    .compact-button {
        width: 100%;
    }

    .form-grid,
    .info-grid,
    .module-grid,
    .summary-grid,
    .history-panel,
    .history-form {
        grid-template-columns: 1fr;
    }

    .review-modal-summary {
        grid-template-columns: 1fr;
    }

    .review-modal-actions {
        flex-direction: column-reverse;
    }

    .review-modal-actions button {
        width: 100%;
    }
}

/* Politica global: todas las tablas deben permanecer dentro del ancho de su pagina. */
.table-wrap {
    max-width: 100%;
    overflow-x: hidden;
}

table.data-table {
    width: 100%;
    min-width: 0 !important;
    max-width: 100%;
    table-layout: fixed !important;
}

table.data-table th,
table.data-table td {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    overflow-wrap: break-word;
    word-break: normal;
    white-space: normal;
}

table.data-table .cell-note,
table.data-table .clave-presupuestal-column {
    overflow-wrap: anywhere;
    word-break: break-word;
}

table.data-table .numeric {
    white-space: normal;
}

table.data-table input,
table.data-table select,
table.data-table textarea,
table.data-table button,
table.data-table a {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
}

table.data-table .sticky-col,
table.data-table .fur-sticky-col {
    position: static;
    left: auto !important;
    box-shadow: none;
}

table.data-table th.sticky-col,
table.data-table th.fur-sticky-col {
    background: var(--guinda);
}

.review-request-table th:nth-child(1),
.review-request-table td:nth-child(1) {
    width: 9% !important;
}

.review-request-table th:nth-child(2),
.review-request-table td:nth-child(2) {
    width: 8% !important;
}

.review-request-table th:nth-child(3),
.review-request-table td:nth-child(3) {
    width: 20% !important;
}

.review-request-table th:nth-child(4),
.review-request-table td:nth-child(4),
.review-request-table th:nth-child(5),
.review-request-table td:nth-child(5) {
    width: 8% !important;
}

.review-request-table th:nth-child(6),
.review-request-table td:nth-child(6) {
    width: 11% !important;
}

.review-request-table th:nth-child(7),
.review-request-table td:nth-child(7) {
    width: 14% !important;
}

.review-request-table th:nth-child(8),
.review-request-table td:nth-child(8) {
    width: 12% !important;
}

.review-request-table th:nth-child(9),
.review-request-table td:nth-child(9) {
    width: 10% !important;
}

.dashboard-request-table th:nth-child(2),
.dashboard-request-table td:nth-child(2) {
    width: 34% !important;
}

.saldos-table,
.fur-ubp-table {
    font-size: 11px;
}

.saldos-table th,
.saldos-table td,
.fur-ubp-table th,
.fur-ubp-table td {
    padding: 6px 4px;
}

@media (max-width: 860px) {
    table.data-table {
        font-size: 11px;
    }

    table.data-table th,
    table.data-table td {
        padding: 6px 4px;
    }
}

/* Saldos UBP: barra de exportacion a PDF */
.table-export-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0 0 10px;
    border: 1px solid var(--line);
    border-left: 5px solid var(--oro);
    border-radius: 8px;
    padding: 10px 14px;
    background: #ffffff;
}

.table-export-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.table-export-info strong {
    color: var(--guinda-dark);
}

.table-export-info .field-help {
    margin: 0;
    overflow-wrap: anywhere;
}

.table-export-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.table-export-actions button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

@media (max-width: 860px) {
    .table-export-actions,
    .table-export-actions button {
        width: 100%;
    }
}

/* FUR: historial de autorizaciones. table.data-table fuerza celdas width:auto !important,
   asi que los anchos se definen con <colgroup> (la columna Detalle concentra el texto). */
.fur-history-table .fur-history-fecha { width: 12%; }
.fur-history-table .fur-history-accion { width: 15%; }
.fur-history-table .fur-history-usuario { width: 14%; }
.fur-history-table .fur-history-rol { width: 12%; }
.fur-history-table .fur-history-estatus { width: 13%; }
.fur-history-table .fur-history-detalle { width: 34%; }

/* Boton para confirmar acciones sensibles */
.danger-button {
    border: 1px solid var(--danger);
    border-radius: 8px;
    padding: 10px 16px;
    background: var(--danger);
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
}

.danger-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

/* FUR: ventana para confirmar cancelaciones escribiendo una palabra */
.confirm-panel {
    width: min(100%, 460px);
    border-top-color: var(--danger);
}

.confirm-panel h2 {
    margin: 0 0 8px;
    color: var(--danger);
}

.confirm-panel #confirm-input {
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Boton de accion destructiva con borde (cancelar DAF u OC): se ve como boton, no como link */
.danger-outline-button {
    border-color: var(--danger);
    color: var(--danger);
    background: #ffffff;
}

.danger-outline-button:hover,
.danger-outline-button:focus {
    border-color: var(--danger);
    color: #ffffff;
    background: var(--danger);
}

/* Usuarios: resumen de claves (UBP) asignadas a una unidad administrativa */
.assigned-ubps {
    margin: 0 0 16px;
    border: 1px solid var(--line);
    border-left: 5px solid var(--oro);
    border-radius: 8px;
    padding: 14px 16px;
    background: #fffdf9;
}

.assigned-ubps-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
}

.assigned-ubps-heading strong {
    color: var(--guinda-dark);
}

.assigned-ubps-heading .field-help,
.assigned-ubps > .field-help {
    margin: 0;
}

.assigned-ubps .table-wrap {
    margin: 0;
}

.assigned-ubp-badge {
    display: inline-block;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 700;
}

.assigned-ubp-badge-guardada {
    background: rgba(23, 99, 58, 0.1);
    color: var(--success);
}

.assigned-ubp-badge-nueva {
    background: rgba(188, 149, 92, 0.18);
    color: var(--warning);
}

.assigned-ubp-badge-quitada {
    background: rgba(159, 29, 53, 0.1);
    color: var(--danger);
}

tr.assigned-ubp-quitada td:not(:nth-last-child(-n + 2)) {
    color: var(--muted);
    text-decoration: line-through;
}

/* Catalogos > Roles */
.role-rule-note {
    margin: 0 0 14px;
    border: 1px solid var(--line);
    border-left: 5px solid var(--oro);
    border-radius: 8px;
    padding: 12px 14px;
    background: #fffdf9;
}

.role-rule-note strong {
    color: var(--guinda-dark);
}

.role-rule-note p {
    margin: 4px 0 0;
    color: var(--ink);
}

.module-option-locked {
    background: #f8f9fb;
    cursor: not-allowed;
}

/* Pagina de inicio: bienvenida */
.welcome-panel {
    border-left: 5px solid var(--guinda);
}

.welcome-panel h2 {
    margin-top: 0;
    color: var(--guinda-dark);
}

.welcome-panel p {
    line-height: 1.5;
}

/* Paginador de tablas (table-paginator.js) */
.table-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 10px 0 0;
}

.table-pager-info {
    color: var(--muted);
    font-size: 13px;
}

.table-pager-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.table-pager-button {
    min-width: 36px;
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 6px 10px;
    background: #ffffff;
    color: var(--guinda);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.table-pager-button:hover:not(:disabled),
.table-pager-button:focus-visible {
    border-color: var(--guinda);
    background: var(--guinda-soft);
}

.table-pager-button.is-current,
.table-pager-button.is-current:hover:not(:disabled) {
    border-color: var(--guinda);
    background: var(--guinda);
    color: #ffffff;
}

.table-pager-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.table-pager-gap {
    padding: 0 2px;
    color: var(--muted);
}

/* Reportes: uso del recurso por unidad administrativa */
.report-subtitle {
    margin: 24px 0 10px;
    font-size: 17px;
}

.usage-meter {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 170px;
}

.usage-meter-bar {
    flex: 1;
    height: 10px;
    border-radius: 999px;
    background: var(--guinda-soft);
    overflow: hidden;
}

.usage-meter-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--guinda);
}

.usage-meter-fill.is-over {
    background: var(--danger);
}

.usage-meter strong {
    min-width: 52px;
    text-align: right;
    font-size: 13px;
}

.report-keys-toggle {
    display: block;
    text-align: left;
    margin-top: 6px;
    border: 0;
    padding: 0;
    background: none;
    color: var(--guinda);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.report-keys-toggle:hover,
.report-keys-toggle:focus-visible {
    text-decoration: underline;
}

.report-keys-row > td {
    padding: 4px 12px 14px;
    background: #fbf9f7;
}

.report-keys-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.report-keys-table th,
.report-keys-table td {
    border-bottom: 1px solid var(--line);
    padding: 7px 8px;
    text-align: left;
    vertical-align: top;
}

.data-table .report-keys-table th {
    position: static;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: none;
}

.report-keys-table .numeric {
    text-align: right;
    white-space: nowrap;
}

.report-keys-table td:first-child {
    min-width: 220px;
}

.report-keys-table .report-keys-budget {
    min-width: 140px;
    overflow-wrap: anywhere;
    color: var(--muted);
}

.report-export-bar {
    margin: 12px 0 0;
}

/* Bitacora de cargas de Saldos UBP */
.status-pendiente-carga {
    border-color: rgba(122, 84, 31, 0.28);
    background: rgba(188, 149, 92, 0.14);
    color: var(--warning);
}

.upload-log-file {
    word-break: break-word;
}

.upload-log-count-error {
    color: var(--danger);
    font-weight: 700;
}

.upload-log-count-warning {
    color: var(--warning);
    font-weight: 700;
}

.upload-log-inline-note {
    display: inline;
    margin-left: 8px;
}

.upload-log-event {
    display: inline-block;
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    background: var(--guinda-soft);
    color: var(--guinda-dark);
}

.upload-log-event-success {
    background: rgba(23, 99, 58, 0.1);
    color: var(--success);
}

.upload-log-event-warning {
    background: rgba(188, 149, 92, 0.18);
    color: var(--warning);
}

.upload-log-event-error {
    background: rgba(159, 29, 53, 0.1);
    color: var(--danger);
}

.upload-log-search {
    position: static;
    box-shadow: none;
}

.upload-log-rows-wrap {
    max-height: 560px;
    overflow-y: auto;
}

.upload-log-rows th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.upload-log-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.upload-log-actions form {
    margin: 0;
}

.upload-log-actions .compact-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 6px 12px;
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
}

/* Bitacora de cargas: table.data-table fuerza table-layout fixed y oculta el desborde,
   asi que los anchos se definen con <colgroup> para que la columna Acciones tenga espacio. */
.upload-log-table .ul-col-id { width: 4%; }
.upload-log-table .ul-col-fecha { width: 9%; }
.upload-log-table .ul-col-archivo { width: 18%; }
.upload-log-table .ul-col-usuario { width: 10%; }
.upload-log-table .ul-col-estado { width: 11%; }
.upload-log-table .ul-col-filas { width: 8%; }
.upload-log-table .ul-col-errores { width: 6%; }
.upload-log-table .ul-col-advertencias { width: 10%; }
.upload-log-table .ul-col-total { width: 10%; }
.upload-log-table .ul-col-acciones { width: 14%; }
.upload-log-actions .icon-action { flex: none; }
.upload-log-actions a.icon-action {
    border: 1px solid rgba(159, 34, 65, 0.22);
    border-radius: 6px;
    background: #ffffff;
    color: var(--guinda);
    text-decoration: none;
}
.upload-log-actions a.icon-action:hover,
.upload-log-actions a.icon-action:focus {
    border-color: rgba(159, 34, 65, 0.42);
    background: var(--guinda-soft);
}

/* Importacion de Saldos UBP: captura de datos de claves presupuestales nuevas */
.new-ubps-status {
    margin: 0.5rem 0 0.75rem;
    font-weight: 600;
}

.field-success {
    color: var(--success);
}

.new-ubps-table th,
.new-ubps-table td {
    vertical-align: top;
}

table.data-table.new-ubps-table th:nth-child(1),
table.data-table.new-ubps-table td:nth-child(1) {
    width: 4% !important;
}

table.data-table.new-ubps-table th:nth-child(2),
table.data-table.new-ubps-table td:nth-child(2) {
    width: 17% !important;
}

table.data-table.new-ubps-table th:nth-child(3),
table.data-table.new-ubps-table td:nth-child(3) {
    width: 8% !important;
}

table.data-table.new-ubps-table th:nth-child(4),
table.data-table.new-ubps-table td:nth-child(4) {
    width: 7% !important;
}

table.data-table.new-ubps-table th:nth-child(5),
table.data-table.new-ubps-table td:nth-child(5) {
    width: 15% !important;
}

table.data-table.new-ubps-table th:nth-child(6),
table.data-table.new-ubps-table td:nth-child(6) {
    width: 6% !important;
}

table.data-table.new-ubps-table th:nth-child(7),
table.data-table.new-ubps-table td:nth-child(7) {
    width: 16% !important;
}

table.data-table.new-ubps-table th:nth-child(8),
table.data-table.new-ubps-table td:nth-child(8) {
    width: 7% !important;
}

table.data-table.new-ubps-table th:nth-child(9),
table.data-table.new-ubps-table td:nth-child(9) {
    width: 20% !important;
}

.new-ubps-table td.new-ubps-clave {
    font-variant-numeric: tabular-nums;
}

.new-ubps-table td.numeric {
    font-variant-numeric: tabular-nums;
}

.new-ubps-table input[type="text"] {
    width: 100%;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
    font-size: 0.85rem;
}

.new-ubps-table input.is-missing,
.ubp-incompleta-form input.is-missing {
    border-color: var(--oro);
    background: rgba(188, 149, 92, 0.14);
}

.ubp-incompleta-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 0.6rem 0.9rem;
    align-items: end;
}

.ubp-incompleta-form .field {
    margin: 0;
}

.ubp-incompleta-card {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.9rem 1rem;
    margin-bottom: 0.9rem;
    background: var(--surface);
}

.ubp-incompleta-card h3 {
    margin: 0 0 0.6rem;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
}

.ubp-incompleta-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
}

.ubp-incompleta-heading h3 {
    margin: 0;
}

.missing-chip {
    display: inline-block;
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 12px;
    font-weight: 700;
    background: rgba(188, 149, 92, 0.18);
    color: var(--warning);
}


/* Avisos con texto largo escrito en varias lineas del codigo: el texto fluye normal */
.alert.alert-flow {
    white-space: normal;
}

/* Solicitud de transferencias: confirmacion de la solicitud recien registrada */
.solicitud-registrada {
    border-left: 4px solid var(--success);
}

.solicitud-registrada h2 {
    color: var(--success);
}

.solicitud-registrada-datos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 0.75rem 1.25rem;
    margin: 0 0 1rem;
}

.solicitud-registrada-datos dt {
    font-size: 0.8rem;
    color: var(--muted);
    font-weight: 600;
}

.solicitud-registrada-datos dd {
    margin: 0.15rem 0 0;
    font-weight: 600;
}

.solicitud-registrada-datos .cell-note {
    display: block;
    font-weight: 400;
}

/* Solicitudes de transferencia: aceptada sin transferir (espera) y transferencia realizada */
.status-espera-transferencia {
    border-color: rgba(188, 149, 92, 0.55);
    background: rgba(188, 149, 92, 0.16);
    color: var(--warning);
}

.status-transferida {
    border-color: rgba(23, 99, 58, 0.24);
    background: rgba(23, 99, 58, 0.08);
    color: var(--success);
}

.solicitud-transfer-table .status-badge {
    display: inline-block;
    max-width: 100%;
    white-space: normal;
    line-height: 1.3;
    min-height: 0;
}

/* Detalle del FUR: historial de autorizaciones agrupado en una fila con "Ver detalle" */
table.data-table.fur-history-summary-table > thead > tr > th:nth-child(1),
table.data-table.fur-history-summary-table > tbody > tr:not(.fur-history-detail-row) > td:nth-child(1) {
    width: 16% !important;
}

table.data-table.fur-history-summary-table > thead > tr > th:nth-child(2),
table.data-table.fur-history-summary-table > tbody > tr:not(.fur-history-detail-row) > td:nth-child(2) {
    width: 14% !important;
}

table.data-table.fur-history-summary-table > thead > tr > th:nth-child(3),
table.data-table.fur-history-summary-table > tbody > tr:not(.fur-history-detail-row) > td:nth-child(3) {
    width: 36% !important;
}

table.data-table.fur-history-summary-table > thead > tr > th:nth-child(4),
table.data-table.fur-history-summary-table > tbody > tr:not(.fur-history-detail-row) > td:nth-child(4) {
    width: 18% !important;
}

table.data-table.fur-history-summary-table > thead > tr > th:nth-child(5),
table.data-table.fur-history-summary-table > tbody > tr:not(.fur-history-detail-row) > td:nth-child(5) {
    width: 16% !important;
}

.fur-history-detail-row[hidden] {
    display: none;
}

.fur-history-detail-row > td {
    background: var(--page);
    padding: 12px;
}

.fur-history-detail-wrap {
    margin: 0;
}

/* Justificaciones y motivos con minimo de caracteres: campo marcado y mensaje legible */
textarea.is-invalid,
input.is-invalid {
    border-color: var(--danger) !important;
    background: rgba(159, 29, 53, 0.05);
    box-shadow: 0 0 0 3px rgba(159, 29, 53, 0.14);
}

.field-min-error {
    margin: 8px 0 0;
    color: var(--danger);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
}

/* Mis Saldos UBP: historial por mes de los FUR de las claves del usuario */
table.data-table.fur-historial-table > thead > tr > th:nth-child(1),
table.data-table.fur-historial-table > tbody > tr:not(.fur-historial-detalle) > td:nth-child(1) { width: 12% !important; }
table.data-table.fur-historial-table > thead > tr > th:nth-child(7),
table.data-table.fur-historial-table > tbody > tr:not(.fur-historial-detalle) > td:nth-child(7) { width: 14% !important; }

.fur-historial-detalle[hidden] {
    display: none;
}

.fur-historial-detalle > td {
    background: var(--page);
    padding: 12px;
}

.fur-historial-furs .status-badge {
    display: inline-block;
    white-space: normal;
    line-height: 1.3;
    min-height: 0;
}

/* Saldos UBP: cada saldo mensual abre la ventana con sus movimientos */
.saldo-mes-link {
    border: 0;
    background: none;
    padding: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    text-decoration: underline dotted rgba(159, 34, 65, 0.45);
    text-underline-offset: 3px;
}

.saldo-mes-link:hover,
.saldo-mes-link:focus-visible {
    color: var(--guinda);
    text-decoration-style: solid;
}

.saldo-movimientos-panel {
    max-height: 88vh;
    overflow-y: auto;
}

.saldo-movimientos-table td.numeric {
    white-space: nowrap;
    width: 22%;
}

.saldo-mov-subtotal td {
    background: var(--page);
}

.saldo-mov-total td {
    background: rgba(23, 99, 58, 0.08);
    font-size: 1.05rem;
}

.saldo-mov-mas {
    color: var(--success);
    font-weight: 600;
}

.saldo-mov-menos {
    color: var(--danger);
    font-weight: 600;
}

.saldo-mov-cancelado {
    color: var(--muted);
    text-decoration: line-through;
}

.saldo-mov-heading {
    margin: 1.25rem 0 0.25rem;
    font-size: 1rem;
}

.saldo-mov-cancelados {
    margin-top: 1rem;
}

.saldo-mov-cancelados summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--muted);
}

table.data-table.saldo-movimientos-table th:first-child,
table.data-table.saldo-movimientos-table td:first-child {
    width: 74% !important;
}

table.data-table.saldo-movimientos-table th.numeric,
table.data-table.saldo-movimientos-table td.numeric {
    width: 26% !important;
    text-align: right;
}
