/*
 * Reporte de gastos por cuenta contable — Contabilidad. Landing tipo artículo: cada sección lleva su figura.
 * Concepto: "del saldo al detalle". El hero es el resumen por centro contable (código, nombre, debe, haber, saldo) con el
 * centro de saldo más alto marcado y su detalle abierto debajo, por cuenta contable o por gastos (radios + :has, sin JS);
 * las cuentas suman exactamente el saldo del centro. El ejemplo práctico repite ese recorrido como niveles con sangría.
 * Azul = debe (cargos); verde = haber (abonos); dorado = el centro o la fila que se está revisando.
 * Display Chivo, cuerpo Inter, cifras tabulares.
 * Momento animado único: al cargar, el detalle del centro marcado se despliega bajo el resumen.
 */
[data-function-layout="gastos"] {
    --rg-ink: #041f49;
    --rg-gold: #fac63f;
    --rg-pick: #fff6dc;
    --rg-debit: #1f5f99;
    --rg-debit-tint: #e2edf6;
    --rg-credit: #2e6a4e;
    --rg-paper: #f3f5f8;
    --rg-line: #c3ccd7;
    --rg-rule: #e1e6ed;
    --rg-muted: #46505e;
    --rg-text: #1f2a3d;
    --rg-display: "Chivo", "Hanken Grotesk", ui-sans-serif, sans-serif;
    --rg-ease: cubic-bezier(.2, .7, .2, 1);
}

[data-function-layout="gastos"] .cv-hero-title,
[data-function-layout="gastos"] .cv-section-title { font-family: var(--rg-display); font-weight: 800; letter-spacing: -.02em; }

[data-function-layout="gastos"] .cv-hero-title,
[data-function-layout="gastos"] .cv-section-title,
[data-function-layout="gastos"] .cv-form-title { font-family: var(--rg-display); font-weight: 800; letter-spacing: -.025em; }
[data-function-layout="gastos"] .cv-section-title { font-size: clamp(1.75rem, 2.7vw, 2.5rem); line-height: 1.12; }
[data-function-layout="gastos"] .rg-narrow { max-width: 50rem; }
[data-function-layout="gastos"] .rg-subtitle { margin: 1.75rem 0 0; font-family: var(--rg-display); font-size: 1.25rem; font-weight: 800; }

/* ---------- Superficies ---------- */
[data-function-layout="gastos"] .rg-paper { background: var(--rg-paper); }
[data-function-layout="gastos"] .rg-navy { background: var(--rg-ink); color: #fff; }
[data-function-layout="gastos"] .rg-navy .cv-section-title,
[data-function-layout="gastos"] .rg-navy .rg-subtitle { color: #fff; }
[data-function-layout="gastos"] .rg-split { display: grid; gap: 2.5rem 4rem; align-items: center; }
[data-function-layout="gastos"] .rg-lead { max-width: 42rem; margin-top: 1.25rem; color: var(--rg-text); font-size: clamp(1.0625rem, 1.4vw, 1.1875rem); line-height: 1.75; }
[data-function-layout="gastos"] .rg-subtitle + .rg-lead { margin-top: .6rem; }
[data-function-layout="gastos"] .rg-lead--light { color: rgb(255 255 255 / .88); }

/* ---------- Hero ---------- */
[data-function-layout="gastos"] #inicio { background: linear-gradient(155deg, #041f49 0%, #0a2c5c 70%, #0f3870 100%); color: #fff; }
[data-function-layout="gastos"] #inicio .function-hero__media img { object-position: 65% 50%; }
[data-function-layout="gastos"] #inicio .function-hero__overlay {
    background:
        linear-gradient(180deg, transparent 65%, rgb(4 31 73 / .7) 100%),
        linear-gradient(90deg, rgb(4 31 73 / .97) 0%, rgb(4 31 73 / .9) 42%, rgb(10 44 92 / .72) 70%, rgb(15 56 112 / .55) 100%);
}
[data-function-layout="gastos"] .rh-hero-layout { position: relative; z-index: 1; align-items: center; }
[data-function-layout="gastos"] #inicio .cv-hero-title { max-width: 12ch; color: #fff; font-size: clamp(2.5rem, 5vw, 4.4rem); line-height: 1.02; }
[data-function-layout="gastos"] #inicio .cv-hero-description { max-width: 34rem; margin-top: 1.5rem; color: rgb(255 255 255 / .86); }
[data-function-layout="gastos"] .rg-hero__actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }
[data-function-layout="gastos"] #inicio .cv-primary-button { border-color: var(--rg-gold); background: var(--rg-gold); color: var(--rg-ink); box-shadow: 0 14px 30px rgb(0 0 0 / .3); }
[data-function-layout="gastos"] #inicio .cv-primary-button:hover,
[data-function-layout="gastos"] #inicio .cv-primary-button:focus-visible { background: #ffd666; }
[data-function-layout="gastos"] #inicio .cv-secondary-button { border-color: rgb(255 255 255 / .7); background: transparent; color: #fff; }
[data-function-layout="gastos"] #inicio .cv-secondary-button:hover,
[data-function-layout="gastos"] #inicio .cv-secondary-button:focus-visible { background: #fff; color: var(--rg-ink); }
[data-function-layout="gastos"] #inicio .cv-primary-button:focus-visible,
[data-function-layout="gastos"] #inicio .cv-secondary-button:focus-visible { outline: 3px solid var(--rg-gold); outline-offset: 3px; }

[data-function-layout="gastos"] #inicio .cv-hero-title { max-width: 18ch; font-size: clamp(2.1rem, 3.6vw, 3.1rem); line-height: 1.08; }
[data-function-layout="gastos"] #inicio .cv-hero-description { font-size: 1.02rem; }

/* El reporte: resumen por centro y el detalle del centro marcado. */
[data-function-layout="gastos"] .rg-report { justify-self: center; width: 100%; max-width: 33rem; margin: 0; padding: 1.1rem 1.2rem 1rem; border-radius: .55rem; background: #fff; box-shadow: 0 24px 50px rgb(0 0 0 / .35); color: var(--rg-text); font-variant-numeric: tabular-nums; }
[data-function-layout="gastos"] .rg-report .cv-icon { width: 15px; height: 15px; flex-basis: 15px; flex-shrink: 0; }
[data-function-layout="gastos"] .rg-report__head { display: flex; align-items: flex-start; justify-content: space-between; gap: .8rem; padding-bottom: .7rem; border-bottom: 1px solid var(--rg-rule); }
[data-function-layout="gastos"] .rg-report__title { margin: 0; }
[data-function-layout="gastos"] .rg-report__title b { display: block; color: var(--rg-ink); font-family: var(--rg-display); font-size: 1.12rem; font-weight: 800; }
[data-function-layout="gastos"] .rg-report__title span { color: var(--rg-muted); font-size: .78rem; font-weight: 600; }
[data-function-layout="gastos"] .rg-report__export { display: inline-flex; flex-shrink: 0; align-items: center; gap: .35rem; padding: .3rem .55rem; border-radius: .35rem; box-shadow: inset 0 0 0 1.5px var(--rg-ink); color: var(--rg-ink); font-size: .72rem; font-weight: 700; white-space: nowrap; }
/* Resumen y detalle por cuenta comparten columnas para que las cifras queden alineadas. */
[data-function-layout="gastos"] .rg-summary,
[data-function-layout="gastos"] .rg-accounts { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .78rem; }
[data-function-layout="gastos"] .rg-summary { margin-top: .6rem; }
[data-function-layout="gastos"] .rg-summary th,
[data-function-layout="gastos"] .rg-summary td,
[data-function-layout="gastos"] .rg-accounts th,
[data-function-layout="gastos"] .rg-accounts td { padding: .42rem .3rem; border-bottom: 1px solid var(--rg-rule); text-align: right; white-space: nowrap; }
[data-function-layout="gastos"] .rg-summary tr > :nth-child(1),
[data-function-layout="gastos"] .rg-accounts tr > :nth-child(1) { width: 3.3rem; color: var(--rg-muted); font-weight: 600; text-align: left; }
[data-function-layout="gastos"] .rg-summary tr > :nth-child(2),
[data-function-layout="gastos"] .rg-accounts tr > :nth-child(2) { color: var(--rg-ink); font-weight: 600; line-height: 1.3; text-align: left; white-space: normal; }
[data-function-layout="gastos"] .rg-summary tr > :nth-child(n+3),
[data-function-layout="gastos"] .rg-accounts tr > :nth-child(n+3) { width: 4.7rem; }
[data-function-layout="gastos"] .rg-summary thead th { padding-top: 0; border-bottom: 2px solid var(--rg-ink); color: var(--rg-muted); font-size: .68rem; font-weight: 700; white-space: normal; }
[data-function-layout="gastos"] .rg-summary thead th:nth-child(3) { color: var(--rg-debit); }
[data-function-layout="gastos"] .rg-summary thead th:nth-child(4) { color: var(--rg-credit); }
[data-function-layout="gastos"] .rg-summary td:nth-child(5),
[data-function-layout="gastos"] .rg-accounts td:nth-child(5) { color: var(--rg-ink); font-weight: 700; }
/* El centro con el saldo considerable: su fila se une al detalle que se abre debajo. */
[data-function-layout="gastos"] .rg-summary tr.is-open > * { border-bottom: 0; background: var(--rg-pick); }
[data-function-layout="gastos"] .rg-summary tr.is-open > :first-child { box-shadow: inset 3px 0 0 var(--rg-gold); }
[data-function-layout="gastos"] .rg-detail { padding: .55rem .6rem .65rem; border-radius: 0 0 .45rem .45rem; background: var(--rg-pick); box-shadow: inset 3px 0 0 var(--rg-gold); animation: rg-open .55s var(--rg-ease) .45s backwards; }
[data-function-layout="gastos"] .rg-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .3rem; min-width: 0; margin: 0; padding: 0; border: 0; }
[data-function-layout="gastos"] .rg-tabs legend { margin: 0 0 .35rem; padding: 0; color: var(--rg-ink); font-size: .74rem; font-weight: 700; }
[data-function-layout="gastos"] .rg-tabs label { position: relative; cursor: pointer; }
[data-function-layout="gastos"] .rg-tabs input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
[data-function-layout="gastos"] .rg-tabs span { display: block; padding: .38rem .5rem; border-radius: .35rem; background: #fff; box-shadow: inset 0 0 0 1.5px var(--rg-line); color: var(--rg-ink); font-size: .78rem; font-weight: 700; text-align: center; transition: background-color .15s, color .15s; }
[data-function-layout="gastos"] .rg-tabs label:hover span { background: var(--rg-paper); }
[data-function-layout="gastos"] .rg-tabs input:checked + span { background: var(--rg-ink); box-shadow: none; color: #fff; }
[data-function-layout="gastos"] .rg-tabs input:focus-visible + span { outline: 3px solid var(--rg-gold); outline-offset: 2px; }
[data-function-layout="gastos"] .rg-view { margin-top: .45rem; }
[data-function-layout="gastos"] .rg-view--1 { display: none; }
[data-function-layout="gastos"] .rg-accounts { background: #fff; }
[data-function-layout="gastos"] .rg-expenses { margin: 0; padding: 0; background: #fff; list-style: none; }
[data-function-layout="gastos"] .rg-expenses li { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr) auto; align-items: center; gap: .5rem; padding: .45rem .5rem; border-bottom: 1px solid var(--rg-rule); font-size: .78rem; }
[data-function-layout="gastos"] .rg-expenses time { color: var(--rg-muted); font-weight: 600; }
[data-function-layout="gastos"] .rg-expenses b { display: block; overflow: hidden; color: var(--rg-ink); text-overflow: ellipsis; white-space: nowrap; }
[data-function-layout="gastos"] .rg-expenses small { display: block; color: var(--rg-muted); font-size: .7rem; }
[data-function-layout="gastos"] .rg-expenses strong { color: var(--rg-ink); }
[data-function-layout="gastos"] .rg-view__note { display: flex; align-items: center; gap: .4rem; margin: .5rem 0 0; color: var(--rg-ink); font-size: .76rem; font-weight: 700; }
[data-function-layout="gastos"] .rg-report figcaption { margin-top: .7rem; color: var(--rg-muted); font-size: .72rem; }
/* Vista "Por gastos". shortcut: sin :has se ve siempre el detalle por cuenta (navegadores previos a 2023). */
@supports selector(:has(*)) {
    [data-function-layout="gastos"] .rg-detail:has(input[value="1"]:checked) .rg-view--0 { display: none; }
    [data-function-layout="gastos"] .rg-detail:has(input[value="1"]:checked) .rg-view--1 { display: block; animation: rg-fade .3s var(--rg-ease); }
}

/* ---------- Comunes ---------- */
[data-function-layout="gastos"] .rg-num { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; margin-right: .6rem; border-radius: 50%; background: var(--rg-ink); color: #fff; font-family: var(--rg-display); font-size: .74rem; font-style: normal; font-weight: 800; vertical-align: 1px; }
[data-function-layout="gastos"] .rg-table { width: 100%; margin-top: 1.8rem; border-collapse: collapse; table-layout: fixed; }
[data-function-layout="gastos"] .rg-table thead th { padding: .8rem 1rem; border-bottom: 3px solid var(--rg-rule); color: var(--rg-muted); font-size: .95rem; font-weight: 700; text-align: left; }
[data-function-layout="gastos"] .rg-table tbody th,
[data-function-layout="gastos"] .rg-table td { padding: .95rem 1rem; border-bottom: 1px solid var(--rg-rule); font-size: 1.02rem; line-height: 1.5; text-align: left; vertical-align: top; }
[data-function-layout="gastos"] .rg-table tbody th { color: var(--rg-ink); font-family: var(--rg-display); font-weight: 700; }
[data-function-layout="gastos"] .rg-table td { color: var(--rg-muted); font-weight: 500; }

/* ---------- 1. Hojas separadas frente a reporte conectado ---------- */
[data-function-layout="gastos"] .rg-versus { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; margin: 0; }
[data-function-layout="gastos"] .rg-versus .cv-icon { width: 16px; height: 16px; flex-basis: 16px; flex-shrink: 0; }
[data-function-layout="gastos"] .rg-versus > div { display: grid; align-content: start; gap: .5rem; padding: 1rem; border-radius: .55rem; }
[data-function-layout="gastos"] .rg-versus__before { background: var(--rg-paper); outline: 1.5px dashed var(--rg-line); outline-offset: -1.5px; }
[data-function-layout="gastos"] .rg-versus__after { background: #fff; box-shadow: inset 0 0 0 1.5px var(--rg-ink); }
[data-function-layout="gastos"] .rg-versus__label { margin: 0 0 .2rem; color: var(--rg-ink); font-family: var(--rg-display); font-size: 1.05rem; font-weight: 800; }
[data-function-layout="gastos"] .rg-versus ul { display: grid; gap: .4rem; margin: 0; padding: 0; list-style: none; }
/* Archivos desalineados a propósito: cada uno viene de un área distinta. */
[data-function-layout="gastos"] .rg-versus li { display: flex; align-items: center; gap: .4rem; width: fit-content; max-width: 100%; padding: .4rem .55rem; border-radius: .35rem; background: #fff; box-shadow: 0 4px 10px rgb(4 31 73 / .08); color: var(--rg-text); font-size: .76rem; font-weight: 600; overflow-wrap: anywhere; }
[data-function-layout="gastos"] .rg-versus li:nth-child(2) { margin-left: .8rem; }
[data-function-layout="gastos"] .rg-versus li:nth-child(3) { margin-left: .3rem; }
[data-function-layout="gastos"] .rg-versus li .cv-icon { color: var(--rg-credit); }
[data-function-layout="gastos"] .rg-versus__note { display: flex; align-items: center; gap: .4rem; margin: .3rem 0 0; color: var(--rg-muted); font-size: .8rem; font-weight: 700; }
[data-function-layout="gastos"] .rg-versus__after .rg-versus__note { color: var(--rg-credit); }
[data-function-layout="gastos"] .rg-versus__node { display: flex; align-items: center; gap: .45rem; margin: 0; padding: .55rem .7rem; border-radius: .4rem; background: var(--rg-paper); color: var(--rg-ink); font-size: .86rem; font-weight: 700; }
[data-function-layout="gastos"] .rg-versus__node--report { background: var(--rg-ink); color: #fff; }
[data-function-layout="gastos"] .rg-versus__node--report .cv-icon { color: var(--rg-gold); }
[data-function-layout="gastos"] .rg-versus__arrow { position: relative; justify-self: center; width: 2px; height: 1.2rem; background: var(--rg-ink); }
[data-function-layout="gastos"] .rg-versus__arrow::after { content: ""; position: absolute; bottom: -.1rem; left: 50%; width: .45rem; height: .45rem; border-right: 2px solid var(--rg-ink); border-bottom: 2px solid var(--rg-ink); transform: translateX(-50%) rotate(45deg); }

/* ---------- 2. Esquema de columnas y accesos ---------- */
[data-function-layout="gastos"] .rg-scheme { margin: 1.6rem 0 0; padding: clamp(1rem, 3vw, 1.4rem); border-radius: .6rem; background: #fff; }
[data-function-layout="gastos"] .rg-scheme .cv-icon { width: 15px; height: 15px; flex-basis: 15px; flex-shrink: 0; }
[data-function-layout="gastos"] .rg-scheme__label { margin: 0 0 .7rem; color: var(--rg-muted); font-size: .86rem; font-weight: 700; }
[data-function-layout="gastos"] .rg-scheme__cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem; margin: 0; padding: 0; list-style: none; }
[data-function-layout="gastos"] .rg-scheme__cols li { padding: .6rem .65rem; border-radius: .35rem; background: var(--rg-paper); box-shadow: inset 0 3px 0 var(--rg-ink); color: var(--rg-ink); font-size: .86rem; font-weight: 700; }
[data-function-layout="gastos"] .rg-scheme__cols li:nth-child(3) { box-shadow: inset 0 3px 0 var(--rg-debit); }
[data-function-layout="gastos"] .rg-scheme__cols li:nth-child(4) { box-shadow: inset 0 3px 0 var(--rg-credit); }
[data-function-layout="gastos"] .rg-scheme i { display: inline-grid; place-items: center; width: 1.35rem; height: 1.35rem; margin-right: .45rem; border-radius: 50%; background: var(--rg-ink); color: #fff; font-family: var(--rg-display); font-size: .7rem; font-style: normal; vertical-align: 1px; }
[data-function-layout="gastos"] .rg-scheme__actions { display: flex; flex-wrap: wrap; gap: .45rem; margin: .8rem 0 0; padding: 0; list-style: none; }
[data-function-layout="gastos"] .rg-scheme__actions li { display: inline-flex; align-items: center; gap: .35rem; padding: .4rem .75rem .4rem .4rem; border-radius: .4rem; box-shadow: inset 0 0 0 1.5px var(--rg-ink); color: var(--rg-ink); font-size: .86rem; font-weight: 700; }
[data-function-layout="gastos"] .rg-scheme__actions i { margin-right: .1rem; }
[data-function-layout="gastos"] .rg-table--contents thead th:first-child { width: 34%; }

/* ---------- 3. Cinco pasos sobre azul ---------- */
[data-function-layout="gastos"] .rg-usage { display: grid; gap: .9rem; margin: 2rem 0 0; padding: 0; list-style: none; }
[data-function-layout="gastos"] .rg-usage li { position: relative; display: grid; align-content: start; gap: .5rem; padding: 1.05rem 1.05rem 1.2rem; border-radius: .5rem; background: rgb(255 255 255 / .06); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .16); }
[data-function-layout="gastos"] .rg-usage__head { display: flex; align-items: center; justify-content: space-between; color: var(--rg-gold); }
[data-function-layout="gastos"] .rg-usage__head .cv-icon { width: 20px; height: 20px; flex-basis: 20px; }
[data-function-layout="gastos"] .rg-usage__head i { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--rg-gold); color: var(--rg-ink); font-family: var(--rg-display); font-style: normal; font-weight: 800; }
[data-function-layout="gastos"] .rg-usage h3 { margin: .3rem 0 0; color: #fff; font-family: var(--rg-display); font-size: 1.1rem; font-weight: 800; line-height: 1.3; }
[data-function-layout="gastos"] .rg-usage p { margin: 0; color: rgb(255 255 255 / .82); font-size: .96rem; line-height: 1.5; }

/* ---------- 4. Ejemplo: el recorrido con sangría por nivel ---------- */
[data-function-layout="gastos"] .rg-callout { margin-top: 1.4rem; padding: 1.1rem 1.2rem; border-radius: .5rem; background: var(--rg-paper); box-shadow: inset 4px 0 0 var(--rg-gold); }
[data-function-layout="gastos"] .rg-callout__title { display: flex; align-items: center; gap: .5rem; margin: 0 0 .45rem; color: var(--rg-ink); font-family: var(--rg-display); font-size: 1.1rem; font-weight: 800; }
[data-function-layout="gastos"] .rg-callout__title .cv-icon { width: 18px; height: 18px; flex-basis: 18px; flex-shrink: 0; color: var(--rg-debit); }
[data-function-layout="gastos"] .rg-callout p:not(.rg-callout__title) { margin: 0; color: var(--rg-text); font-size: 1rem; line-height: 1.6; }
[data-function-layout="gastos"] .rg-drill { margin: 0; padding: clamp(1.1rem, 3vw, 1.5rem); border-radius: .6rem; background: var(--rg-paper); }
[data-function-layout="gastos"] .rg-drill ol { margin: 0; padding: 0; list-style: none; }
[data-function-layout="gastos"] .rg-drill__level { position: relative; display: grid; gap: .15rem; margin-top: .6rem; padding: .7rem .9rem; border-radius: .45rem; background: #fff; }
[data-function-layout="gastos"] .rg-drill__level:first-child { margin-top: 0; }
/* Cada nivel cuelga del anterior con un conector en ángulo. */
[data-function-layout="gastos"] .rg-drill__level:not(:first-child)::before { content: ""; position: absolute; top: -.6rem; left: -.95rem; width: .8rem; height: 1.85rem; border-bottom: 2px solid var(--rg-line); border-left: 2px solid var(--rg-line); border-bottom-left-radius: .35rem; }
[data-function-layout="gastos"] .rg-drill__level--1 { margin-left: 1.6rem; }
[data-function-layout="gastos"] .rg-drill__level--2 { margin-left: 3.2rem; }
[data-function-layout="gastos"] .rg-drill__level--3 { margin-left: 4.8rem; background: var(--rg-pick); box-shadow: inset 3px 0 0 var(--rg-gold); }
[data-function-layout="gastos"] .rg-drill b { color: var(--rg-ink); font-family: var(--rg-display); font-size: .98rem; font-weight: 800; }
[data-function-layout="gastos"] .rg-drill span { color: var(--rg-muted); font-size: .88rem; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- 5. Beneficios ---------- */
[data-function-layout="gastos"] .rg-benefits .rg-benefits__icon { color: var(--rg-debit); }

/* ---------- 6. Conexión con el ERP ---------- */
[data-function-layout="gastos"] .rg-sources { display: flex; flex-wrap: wrap; gap: .45rem; margin: 1.2rem 0 0; padding: 0; list-style: none; }
[data-function-layout="gastos"] .rg-sources li { padding: .35rem .75rem; border-radius: 2rem; background: var(--rg-paper); color: var(--rg-ink); font-size: .88rem; font-weight: 700; }
[data-function-layout="gastos"] .rg-chain { width: 100%; max-width: 60rem; margin-top: 1.4rem; border-collapse: collapse; table-layout: fixed; }
[data-function-layout="gastos"] .rg-chain thead th { padding: .75rem 1rem; border-bottom: 3px solid var(--rg-rule); color: var(--rg-muted); font-size: .95rem; font-weight: 700; text-align: left; }
[data-function-layout="gastos"] .rg-chain thead th:first-child { width: 36%; }
[data-function-layout="gastos"] .rg-chain tbody th,
[data-function-layout="gastos"] .rg-chain td { padding: .85rem 1rem; border-bottom: 1px solid var(--rg-rule); font-size: 1.02rem; line-height: 1.5; text-align: left; vertical-align: middle; }
[data-function-layout="gastos"] .rg-chain tbody th { color: var(--rg-ink); font-family: var(--rg-display); font-weight: 700; }
[data-function-layout="gastos"] .rg-chain td { color: var(--rg-muted); }
[data-function-layout="gastos"] .rg-chain__icon { display: inline-grid; place-items: center; width: 2.2rem; height: 2.2rem; margin-right: .7rem; border-radius: .45rem; background: var(--rg-paper); color: var(--rg-ink); vertical-align: middle; }
[data-function-layout="gastos"] .rg-chain__icon .cv-icon { width: 18px; height: 18px; flex-basis: 18px; }
[data-function-layout="gastos"] .rg-chain tr.is-current > * { background: var(--rg-pick); }
[data-function-layout="gastos"] .rg-chain tr.is-current th { box-shadow: inset 4px 0 0 var(--rg-gold); }
[data-function-layout="gastos"] .rg-chain tr.is-current .rg-chain__icon { background: var(--rg-ink); color: var(--rg-gold); }

/* ---------- 7. Comparación: la columna de Evidence va marcada ---------- */
[data-function-layout="gastos"] .rg-table--compare thead th:first-child { width: 20%; }
[data-function-layout="gastos"] .rg-table--compare thead th:nth-child(3) { box-shadow: inset 0 4px 0 var(--rg-gold); color: var(--rg-ink); }
[data-function-layout="gastos"] .rg-table--compare td:nth-child(3) { background: var(--rg-pick); color: var(--rg-ink); font-weight: 600; }

/* ---------- 8. Contenido relacionado ---------- */
/* El id gana a la regla compartida, que va después en el archivo. */
[data-function-layout="gastos"] #relacion-function .rg-related { display: grid; gap: .8rem; margin-top: 1.6rem; }
[data-function-layout="gastos"] .rg-related .rg-related__link { background: #fff; box-shadow: inset 0 0 0 1.5px var(--rg-ink); }
[data-function-layout="gastos"] .rg-related .rg-related__link:hover { box-shadow: inset 0 0 0 2.5px var(--rg-ink); }
[data-function-layout="gastos"] .rg-related .rg-related__link:focus-visible { outline-color: var(--rg-ink); }
[data-function-layout="gastos"] .rg-related .rg-related__icon { background: var(--rg-debit-tint); color: var(--rg-debit); }

@media (min-width: 640px) {
    [data-function-layout="gastos"] .rg-usage { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 768px) {
    [data-function-layout="gastos"] #relacion-function .rg-related { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    [data-function-layout="gastos"] .rg-scheme__cols { grid-template-columns: 1fr 1.8fr 1fr 1fr 1fr; }
}
@media (min-width: 1024px) {
    [data-function-layout="gastos"] .rg-usage { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    /* Flecha entre pasos en la fila de cinco. */
    [data-function-layout="gastos"] .rg-usage li:not(:last-child)::after { content: ""; position: absolute; top: 1.95rem; right: -.65rem; width: .42rem; height: .42rem; border-top: 2px solid rgb(255 255 255 / .5); border-right: 2px solid rgb(255 255 255 / .5); transform: rotate(45deg); }
    [data-function-layout="gastos"] #relacion-function .rg-related { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Capacidades ---------- */
[data-function-layout="gastos"] .rg-capabilities { display: grid; gap: .75rem; margin: 2.25rem 0 0; padding: 0; list-style: none; }
[data-function-layout="gastos"] .rg-capabilities li { display: grid; grid-template-columns: 2.75rem minmax(0, 1fr); gap: .9rem; align-items: center; padding: 1rem 1.1rem; border-radius: .5rem; background: #fff; box-shadow: inset 0 0 0 1px var(--rg-rule); }
[data-function-layout="gastos"] .rg-capabilities__icon { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: .45rem; background: var(--rg-on-tint); color: var(--rg-on); }
[data-function-layout="gastos"] .rg-capabilities__icon .cv-icon { width: 21px; height: 21px; flex-basis: 21px; }
[data-function-layout="gastos"] .rg-capabilities p { margin: 0; color: var(--rg-ink); font-size: 1.0625rem; font-weight: 600; line-height: 1.45; }

/* ---------- Problemas: problema / respuesta ---------- */
[data-function-layout="gastos"] .rg-fixes { width: 100%; margin-top: 2.5rem; border-collapse: collapse; table-layout: fixed; }
[data-function-layout="gastos"] .rg-fixes thead th { padding: 1rem 1.25rem; border-bottom: 3px solid var(--rg-rule); color: var(--rg-muted); font-family: var(--rg-display); font-size: 1.15rem; font-weight: 800; text-align: left; }
[data-function-layout="gastos"] .rg-fixes thead th:last-child { border-bottom-color: var(--rg-ink); color: var(--rg-ink); }
[data-function-layout="gastos"] .rg-fixes tbody th,
[data-function-layout="gastos"] .rg-fixes td { padding: 1.2rem 1.25rem; border-bottom: 1px solid var(--rg-rule); font-size: 1.0625rem; line-height: 1.6; text-align: left; vertical-align: middle; }
[data-function-layout="gastos"] .rg-fixes tbody th { color: var(--rg-text); font-weight: 700; }
[data-function-layout="gastos"] .rg-fixes td { background: var(--rg-paper); color: var(--rg-ink); font-weight: 600; }
[data-function-layout="gastos"] .rg-fixes__icon { display: inline-grid; place-items: center; width: 2.2rem; height: 2.2rem; margin-right: .75rem; border-radius: .4rem; background: #e3e8ef; color: var(--rg-muted); vertical-align: middle; }
[data-function-layout="gastos"] .rg-fixes__icon .cv-icon { width: 18px; height: 18px; flex-basis: 18px; }
[data-function-layout="gastos"] .rg-fixes__check { display: inline-grid; margin-right: .6rem; vertical-align: -.3em; color: var(--rg-on); }
[data-function-layout="gastos"] .rg-fixes__check .cv-icon { width: 20px; height: 20px; flex-basis: 20px; stroke-width: 2.4; }

/* ---------- Beneficios ---------- */
[data-function-layout="gastos"] .rg-benefits { display: grid; gap: 1.5rem 3rem; margin: 2.25rem 0 0; padding: 0; list-style: none; }
[data-function-layout="gastos"] .rg-benefits li { display: grid; grid-template-columns: 3rem minmax(0, 1fr); gap: 1rem; align-items: start; padding-top: 1.25rem; border-top: 3px solid var(--rg-ink); }
[data-function-layout="gastos"] .rg-benefits__icon { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: .45rem; background: #fff; box-shadow: inset 0 0 0 1px var(--rg-rule); color: var(--rg-ink); }
[data-function-layout="gastos"] .rg-benefits__icon .cv-icon { width: 22px; height: 22px; flex-basis: 22px; }
[data-function-layout="gastos"] .rg-benefits p { margin: .3rem 0 0; color: var(--rg-ink); font-size: 1.125rem; font-weight: 600; line-height: 1.5; }

/* ---------- Cómo encaja: funciones relacionadas ---------- */
[data-function-layout="gastos"] .rg-related { display: grid; gap: .75rem; }
[data-function-layout="gastos"] .rg-related__title { margin: 0; color: #fff; font-family: var(--rg-display); font-size: 1.25rem; font-weight: 800; }
[data-function-layout="gastos"] .rg-related__link { display: grid; grid-template-columns: 3rem minmax(0, 1fr) auto; gap: 1rem; align-items: center; padding: 1.1rem 1.2rem; border-radius: .55rem; background: #fff; color: var(--rg-ink); text-decoration: none; box-shadow: 0 18px 36px rgb(0 0 0 / .25); transition: box-shadow .2s; }
[data-function-layout="gastos"] .rg-related__link:hover { box-shadow: 0 18px 36px rgb(0 0 0 / .25), inset 0 0 0 2px var(--rg-gold); }
[data-function-layout="gastos"] .rg-related__link:focus-visible { outline: 3px solid var(--rg-gold); outline-offset: 3px; }
[data-function-layout="gastos"] .rg-related__icon { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: .45rem; background: var(--rg-on-tint); color: var(--rg-on); }
[data-function-layout="gastos"] .rg-related__icon .cv-icon { width: 22px; height: 22px; flex-basis: 22px; }
[data-function-layout="gastos"] .rg-related__link b { display: block; font-family: var(--rg-display); font-size: 1.15rem; font-weight: 800; }
[data-function-layout="gastos"] .rg-related__link small { display: block; margin-top: .2rem; color: var(--rg-muted); font-size: .92rem; font-weight: 500; line-height: 1.45; }
[data-function-layout="gastos"] .rg-related__go .cv-icon { width: 20px; height: 20px; flex-basis: 20px; }

/* ---------- Responsive ---------- */
@media (min-width: 768px) {
    [data-function-layout="gastos"] .rg-capabilities,
    [data-function-layout="gastos"] .rg-benefits { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
    [data-function-layout="gastos"] .rh-hero-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    [data-function-layout="gastos"] .rg-split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    [data-function-layout="gastos"] .rg-capabilities { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
    [data-function-layout="gastos"] #inicio .function-hero__overlay { background: linear-gradient(180deg, rgb(4 31 73 / .95) 0%, rgb(4 31 73 / .86) 50%, rgb(10 44 92 / .7) 100%); }
    [data-function-layout="gastos"] #inicio .cv-hero-title { max-width: none; }
}
@media (max-width: 767px) {
    [data-function-layout="gastos"] .rg-hero__actions > * { width: 100%; }
    [data-function-layout="gastos"] .rg-fixes thead { display: none; }
    [data-function-layout="gastos"] .rg-fixes,
    [data-function-layout="gastos"] .rg-fixes tbody,
    [data-function-layout="gastos"] .rg-fixes tr,
    [data-function-layout="gastos"] .rg-fixes tbody th,
    [data-function-layout="gastos"] .rg-fixes td { display: block; width: 100%; }
    [data-function-layout="gastos"] .rg-fixes tr { padding: .75rem 0; border-bottom: 1px solid var(--rg-rule); }
    [data-function-layout="gastos"] .rg-fixes tbody th,
    [data-function-layout="gastos"] .rg-fixes td { padding: .65rem .85rem; border-bottom: 0; }
    [data-function-layout="gastos"] .rg-fixes tbody th::before,
    [data-function-layout="gastos"] .rg-fixes td::before { content: attr(data-label); display: block; margin-bottom: .35rem; color: var(--rg-muted); font-size: .82rem; font-weight: 700; }
    [data-function-layout="gastos"] .rg-related__link { grid-template-columns: 3rem minmax(0, 1fr); }
    [data-function-layout="gastos"] .rg-related__go { display: none; }
}

/* ---------- Keyframes ---------- */

@media (prefers-reduced-motion: reduce) {
    [data-function-layout="gastos"] *,
    [data-function-layout="gastos"] *::before,
    [data-function-layout="gastos"] *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 767px) {
    [data-function-layout="gastos"] .rg-report { padding: .95rem .8rem; }
    [data-function-layout="gastos"] .rg-report__head { flex-wrap: wrap; }
    /* En el hero móvil quedan código, nombre y saldo; debe y haber se ven en escritorio. */
    [data-function-layout="gastos"] .rg-summary tr > :nth-child(3),
    [data-function-layout="gastos"] .rg-summary tr > :nth-child(4),
    [data-function-layout="gastos"] .rg-accounts tr > :nth-child(3),
    [data-function-layout="gastos"] .rg-accounts tr > :nth-child(4) { display: none; }
    [data-function-layout="gastos"] .rg-versus { grid-template-columns: minmax(0, 1fr); }
    [data-function-layout="gastos"] .rg-drill__level--1 { margin-left: 1.2rem; }
    [data-function-layout="gastos"] .rg-drill__level--2 { margin-left: 2.4rem; }
    [data-function-layout="gastos"] .rg-drill__level--3 { margin-left: 3.6rem; }
    [data-function-layout="gastos"] .rg-table--compare thead,
    [data-function-layout="gastos"] .rg-chain thead { display: none; }
    [data-function-layout="gastos"] .rg-table--compare,
    [data-function-layout="gastos"] .rg-table--compare tbody,
    [data-function-layout="gastos"] .rg-table--compare tr,
    [data-function-layout="gastos"] .rg-table--compare tbody th,
    [data-function-layout="gastos"] .rg-table--compare td,
    [data-function-layout="gastos"] .rg-chain,
    [data-function-layout="gastos"] .rg-chain tbody,
    [data-function-layout="gastos"] .rg-chain tr,
    [data-function-layout="gastos"] .rg-chain tbody th,
    [data-function-layout="gastos"] .rg-chain td { display: block; width: 100%; }
    [data-function-layout="gastos"] .rg-table--compare tr,
    [data-function-layout="gastos"] .rg-chain tr { padding: .8rem .5rem; border-bottom: 1px solid var(--rg-rule); }
    [data-function-layout="gastos"] .rg-table--compare tbody th,
    [data-function-layout="gastos"] .rg-table--compare td,
    [data-function-layout="gastos"] .rg-chain tbody th,
    [data-function-layout="gastos"] .rg-chain td { padding: .3rem 0; border: 0; }
    /* En móvil cada valor lleva el nombre de su columna. */
    [data-function-layout="gastos"] .rg-table--compare td::before { content: attr(data-label); display: block; color: var(--rg-muted); font-size: .76rem; font-weight: 700; }
    [data-function-layout="gastos"] .rg-table--compare td:nth-child(3) { padding: .4rem .5rem; border-radius: .35rem; }
    [data-function-layout="gastos"] .rg-chain tr.is-current { background: var(--rg-pick); box-shadow: inset 4px 0 0 var(--rg-gold); }
    [data-function-layout="gastos"] .rg-chain tr.is-current > * { background: none; box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
    [data-function-layout="gastos"] .rg-detail,
    [data-function-layout="gastos"] .rg-view { animation: none !important; }
    [data-function-layout="gastos"] .rg-tabs span { transition: none; }
}

@keyframes rg-open { from { clip-path: inset(0 0 100% 0); } }
@keyframes rg-fade { from { opacity: 0; } }
