/*
 * Reporte de gastos por centro contable — Contabilidad. Landing tipo artículo: cada sección lleva su figura.
 * Concepto: "abrir el saldo". Un saldo de $0.00 no dice nada por sí solo; el reporte lo abre en los movimientos que lo
 * forman. Cargo (Debe) en verde azulado, abono (Haber) en frambuesa, saldo en azul marino; dorado = acción y cero.
 * Las secciones claras llevan la rejilla de puntos de una hoja de cálculo.
 * El hero es el centro "C VIRTUAL PEÑASQUITO" del ejemplo realista (debe $489.00, haber -$489.00, saldo $0.00) en tres
 * vistas: solo el saldo, el detallado por gastos (folios D-14061 y D-14062, cuenta 5000-001, referencia de almacén) y el
 * detallado por cuenta. Los radios van al inicio de la figura y el CSS los lee con ~ (sin JS ni :has); las tres vistas
 * comparten la celda de la rejilla para que la tarjeta no cambie de alto. Sin líneas sobre la tarjeta.
 * Display Archivo (grotesca firme para cifras y títulos), cuerpo Inter, cifras tabulares.
 * Movimiento: al cargar, la foto se acerca; al cambiar de vista, las filas del detalle bajan una a una y el mensaje
 * entra. Al hacer scroll, los niveles del reporte se escalonan, las barras crecen desde el cero, los pasos suben y el
 * rastro se recorre, solo donde el navegador lo soporta y sin movimiento reducido.
 */
[data-function-layout="gastos-centro"] {
    --cg-ink: #041f49;
    --cg-ink-tint: #e4eaf4;
    --cg-gold: #fac63f;
    --cg-dr: #0d7268;
    --cg-dr-tint: #dcf1ee;
    --cg-cr: #b0264f;
    --cg-cr-tint: #fae3ea;
    --cg-acc: #2f5fb3;
    --cg-acc-tint: #e3ecfb;
    --cg-on: var(--cg-acc);
    --cg-on-tint: var(--cg-acc-tint);
    --cg-paper: #f3f5f8;
    --cg-rule: #e1e6ec;
    --cg-line: #c6cdd6;
    --cg-muted: #4a5260;
    --cg-text: #1f2937;
    --cg-display: "Archivo", "Hanken Grotesk", ui-sans-serif, sans-serif;
    --cg-ease: cubic-bezier(.2, .7, .2, 1);
}
[data-function-layout="gastos-centro"] .cv-hero-title,
[data-function-layout="gastos-centro"] .cv-section-title,
[data-function-layout="gastos-centro"] .cv-form-title { font-family: var(--cg-display); font-weight: 800; letter-spacing: -.025em; }
[data-function-layout="gastos-centro"] .cv-section-title { font-size: clamp(1.75rem, 2.7vw, 2.5rem); line-height: 1.12; }
[data-function-layout="gastos-centro"] .cg-narrow { max-width: 50rem; }
[data-function-layout="gastos-centro"] .cg-subtitle { margin: 1.75rem 0 0; font-family: var(--cg-display); font-size: 1.25rem; font-weight: 800; }

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

/* ---------- Hero ---------- */
[data-function-layout="gastos-centro"] #inicio { background: linear-gradient(155deg, #041f49 0%, #0a2c5c 70%, #0f3870 100%); color: #fff; }
[data-function-layout="gastos-centro"] #inicio .function-hero__media img { object-position: 65% 50%; }
[data-function-layout="gastos-centro"] #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-centro"] .rh-hero-layout { position: relative; z-index: 1; align-items: center; }
[data-function-layout="gastos-centro"] #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-centro"] #inicio .cv-hero-description { max-width: 34rem; margin-top: 1.5rem; color: rgb(255 255 255 / .86); }
[data-function-layout="gastos-centro"] .cg-hero__actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }
[data-function-layout="gastos-centro"] #inicio .cv-primary-button { border-color: var(--cg-gold); background: var(--cg-gold); color: var(--cg-ink); box-shadow: 0 14px 30px rgb(0 0 0 / .3); }
[data-function-layout="gastos-centro"] #inicio .cv-primary-button:hover,
[data-function-layout="gastos-centro"] #inicio .cv-primary-button:focus-visible { background: #ffd666; }
[data-function-layout="gastos-centro"] #inicio .cv-secondary-button { border-color: rgb(255 255 255 / .7); background: transparent; color: #fff; }
[data-function-layout="gastos-centro"] #inicio .cv-secondary-button:hover,
[data-function-layout="gastos-centro"] #inicio .cv-secondary-button:focus-visible { background: #fff; color: var(--cg-ink); }
[data-function-layout="gastos-centro"] #inicio .cv-primary-button:focus-visible,
[data-function-layout="gastos-centro"] #inicio .cv-secondary-button:focus-visible { outline: 3px solid var(--cg-gold); outline-offset: 3px; }

[data-function-layout="gastos-centro"] #inicio .cv-hero-title { max-width: 18ch; font-size: clamp(2.2rem, 3.8vw, 3.2rem); line-height: 1.06; }
[data-function-layout="gastos-centro"] #inicio .cv-hero-description { font-size: .98rem; }

/* La rejilla de puntos de una hoja de cálculo, para las secciones claras. */
[data-function-layout="gastos-centro"] .cg-paper { background-color: var(--cg-paper); background-image: radial-gradient(circle, #dfe4eb 1.1px, transparent 1.5px); background-size: 24px 24px; }

/* La hoja del reporte. */
[data-function-layout="gastos-centro"] .cg-sheet { position: relative; justify-self: center; width: 100%; max-width: 36rem; min-width: 0; margin: 0; overflow: hidden; border-radius: .6rem; background: #fff; box-shadow: 0 24px 50px rgb(0 0 0 / .35); color: var(--cg-text); font-variant-numeric: tabular-nums; }
[data-function-layout="gastos-centro"] .cg-sheet .cv-icon { width: 15px; height: 15px; flex-basis: 15px; flex-shrink: 0; }
[data-function-layout="gastos-centro"] .cg-sheet p { margin: 0; }
[data-function-layout="gastos-centro"] .cg-input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
[data-function-layout="gastos-centro"] .cg-sheet__top { padding: .85rem 1rem .75rem; background: var(--cg-ink); color: #fff; }
[data-function-layout="gastos-centro"] .cg-sheet .cg-sheet__title { display: flex; align-items: center; gap: .45rem; margin-bottom: .55rem; font-family: var(--cg-display); font-size: 1.15rem; font-weight: 700; }
[data-function-layout="gastos-centro"] .cg-sheet__title .cv-icon { color: var(--cg-gold); }
[data-function-layout="gastos-centro"] .cg-sheet__title span { margin-left: auto; padding: .1rem .5rem; border-radius: .3rem; background: rgb(255 255 255 / .12); font-family: Inter, sans-serif; font-size: .7rem; font-weight: 700; }
[data-function-layout="gastos-centro"] .cg-row { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); align-items: center; gap: .5rem; min-height: 2.5rem; padding: .3rem .5rem; font-size: .8rem; font-weight: 700; }
[data-function-layout="gastos-centro"] .cg-row > span:not(:first-child) { text-align: right; }
[data-function-layout="gastos-centro"] .cg-row--head { min-height: 0; padding-top: 0; padding-bottom: .25rem; color: var(--cg-muted); font-size: .6rem; }
[data-function-layout="gastos-centro"] .cg-sheet__top .cg-row--head { color: rgb(255 255 255 / .65); }
[data-function-layout="gastos-centro"] .cg-row--center { border-radius: .35rem; background: rgb(255 255 255 / .1); font-size: .86rem; }
[data-function-layout="gastos-centro"] .cg-row--center > span:first-child { font-family: var(--cg-display); letter-spacing: .01em; }
[data-function-layout="gastos-centro"] .cg-debit { color: var(--cg-dr); }
[data-function-layout="gastos-centro"] .cg-credit { color: var(--cg-cr); }
[data-function-layout="gastos-centro"] .cg-balance { color: var(--cg-ink); font-family: var(--cg-display); }
[data-function-layout="gastos-centro"] .cg-sheet__top .cg-debit { color: #86e3d6; }
[data-function-layout="gastos-centro"] .cg-sheet__top .cg-credit { color: #ffadc4; }
[data-function-layout="gastos-centro"] .cg-sheet__top .cg-balance { color: #fff; font-size: .98rem; transition: color .2s; }
[data-function-layout="gastos-centro"] .cg-switch { display: flex; gap: .25rem; margin: .8rem 1rem 0; padding: .2rem; border-radius: .4rem; background: var(--cg-paper); box-shadow: inset 0 0 0 1px var(--cg-rule); }
[data-function-layout="gastos-centro"] .cg-switch__opt { flex: 1; padding: .4rem .45rem; border-radius: .3rem; color: var(--cg-muted); cursor: pointer; font-size: .72rem; font-weight: 700; text-align: center; transition: background-color .2s, color .2s; }
[data-function-layout="gastos-centro"] .cg-switch__opt:hover { color: var(--cg-ink); }
[data-function-layout="gastos-centro"] .cg-panes { display: grid; margin: .7rem 1rem 0; padding: .5rem .7rem; border-radius: .45rem; background: var(--cg-paper); }
[data-function-layout="gastos-centro"] .cg-pane { grid-area: 1 / 1; min-width: 0; visibility: hidden; }
[data-function-layout="gastos-centro"] .cg-pane .cg-row { padding-right: .3rem; padding-left: .3rem; }
[data-function-layout="gastos-centro"] .cg-pane .cg-row--account { border-top: 1px solid var(--cg-rule); }
[data-function-layout="gastos-centro"] .cg-xrow { display: grid; grid-template-columns: 4.4rem minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1.3fr); align-items: center; gap: .5rem; min-height: 2.75rem; padding: .3rem; border-top: 1px solid var(--cg-rule); font-size: .8rem; font-weight: 700; }
[data-function-layout="gastos-centro"] .cg-xrow > span:nth-child(3) { text-align: right; }
[data-function-layout="gastos-centro"] .cg-sheet .cg-xrow--head { min-height: 0; padding-top: 0; border-top: 0; color: var(--cg-muted); font-size: .6rem; }
[data-function-layout="gastos-centro"] .cg-folio { color: var(--cg-ink); font-family: var(--cg-display); }
[data-function-layout="gastos-centro"] .cg-acct { display: grid; min-width: 0; text-align: left; }
[data-function-layout="gastos-centro"] .cg-acct b { color: var(--cg-ink); font-family: var(--cg-display); font-size: .84rem; }
[data-function-layout="gastos-centro"] .cg-acct small { overflow: hidden; color: var(--cg-muted); font-size: .62rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
[data-function-layout="gastos-centro"] .cg-ref { display: flex; align-items: center; gap: .3rem; color: var(--cg-muted); font-size: .68rem; font-weight: 600; line-height: 1.25; }
[data-function-layout="gastos-centro"] .cg-sheet .cg-ref .cv-icon { width: 13px; height: 13px; flex-basis: 13px; }
[data-function-layout="gastos-centro"] .cg-ghost { display: grid; grid-template-columns: 4.4rem minmax(0, 1.5fr) minmax(0, 1fr); align-items: center; gap: 1rem; min-height: 2.75rem; padding: 0 .3rem; border-bottom: 1px dashed var(--cg-line); }
[data-function-layout="gastos-centro"] .cg-ghost i { height: .5rem; border-radius: 99px; background: #dde2ea; }
[data-function-layout="gastos-centro"] .cg-ghost i:nth-child(2) { width: 70%; }
[data-function-layout="gastos-centro"] .cg-sheet .cg-zero { display: flex; align-items: baseline; justify-content: flex-end; gap: .5rem; padding-top: .4rem; color: var(--cg-ink); font-family: var(--cg-display); font-size: 1.6rem; font-weight: 800; }
[data-function-layout="gastos-centro"] .cg-zero small { color: var(--cg-muted); font-family: Inter, sans-serif; font-size: .66rem; font-weight: 700; }
[data-function-layout="gastos-centro"] .cg-sheet .cg-export { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: .65rem 1rem 0; }
[data-function-layout="gastos-centro"] .cg-export small { margin-right: .15rem; color: var(--cg-muted); font-size: .66rem; font-weight: 700; }
[data-function-layout="gastos-centro"] .cg-export__btn { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .6rem; border-radius: .35rem; box-shadow: inset 0 0 0 1.5px var(--cg-line); color: var(--cg-muted); font-size: .7rem; font-weight: 700; transition: background-color .2s, color .2s, box-shadow .2s; }
[data-function-layout="gastos-centro"] .cg-sheet .cg-export__btn .cv-icon { width: 13px; height: 13px; flex-basis: 13px; }
[data-function-layout="gastos-centro"] .cg-sheet .cg-status { min-height: 2.2em; margin: .6rem 1rem 0; color: var(--cg-ink); font-size: .76rem; font-weight: 700; line-height: 1.4; }
[data-function-layout="gastos-centro"] .cg-s { display: none; }
[data-function-layout="gastos-centro"] .cg-sheet figcaption { padding: .35rem 1rem .8rem; color: var(--cg-muted); font-size: .66rem; }

/* La vista elegida: su botón, su tabla de detalle, el saldo resaltado y su botón de exportación. */
[data-function-layout="gastos-centro"] #cg-m-0:checked ~ .cg-switch .cg-switch__opt--0,
[data-function-layout="gastos-centro"] #cg-m-1:checked ~ .cg-switch .cg-switch__opt--1,
[data-function-layout="gastos-centro"] #cg-m-2:checked ~ .cg-switch .cg-switch__opt--2 { background: var(--cg-ink); color: #fff; }
[data-function-layout="gastos-centro"] #cg-m-0:checked ~ .cg-panes .cg-pane--0,
[data-function-layout="gastos-centro"] #cg-m-1:checked ~ .cg-panes .cg-pane--1,
[data-function-layout="gastos-centro"] #cg-m-2:checked ~ .cg-panes .cg-pane--2 { visibility: visible; }
[data-function-layout="gastos-centro"] #cg-m-0:checked ~ .cg-sheet__top .cg-balance { color: var(--cg-gold); }
[data-function-layout="gastos-centro"] #cg-m-1:checked ~ .cg-export .cg-export__btn--1,
[data-function-layout="gastos-centro"] #cg-m-2:checked ~ .cg-export .cg-export__btn--2 { background: var(--cg-ink); box-shadow: none; color: #fff; }
[data-function-layout="gastos-centro"] #cg-m-0:checked ~ .cg-status .cg-s--0,
[data-function-layout="gastos-centro"] #cg-m-1:checked ~ .cg-status .cg-s--1,
[data-function-layout="gastos-centro"] #cg-m-2:checked ~ .cg-status .cg-s--2 { display: inline; }
[data-function-layout="gastos-centro"] #cg-m-0:focus-visible ~ .cg-switch .cg-switch__opt--0,
[data-function-layout="gastos-centro"] #cg-m-1:focus-visible ~ .cg-switch .cg-switch__opt--1,
[data-function-layout="gastos-centro"] #cg-m-2:focus-visible ~ .cg-switch .cg-switch__opt--2 { outline: 3px solid var(--cg-gold); outline-offset: 1px; }

@media (prefers-reduced-motion: no-preference) {
    [data-function-layout="gastos-centro"] #inicio .function-hero__media img { animation: cg-zoom 18s ease-out both; }
    /* Al cambiar de vista, las filas del detalle bajan una a una, el cero aparece y el mensaje entra. */
    [data-function-layout="gastos-centro"] #cg-m-1:checked ~ .cg-panes .cg-pane--1 .cg-xrow { animation: cg-down .35s var(--cg-ease) backwards; animation-delay: calc(var(--cg-i, 0) * 90ms); }
    [data-function-layout="gastos-centro"] #cg-m-2:checked ~ .cg-panes .cg-row--account { animation: cg-down .35s var(--cg-ease) backwards; }
    [data-function-layout="gastos-centro"] #cg-m-0:checked ~ .cg-panes .cg-zero { animation: cg-tick .35s var(--cg-ease) backwards; }
    [data-function-layout="gastos-centro"] .cg-s { animation: cg-tick .3s var(--cg-ease) backwards; }
}

/* ---------- 1. Del centro contable al detalle de cada gasto ---------- */
[data-function-layout="gastos-centro"] .cg-drill { display: grid; gap: .6rem; margin: 0; padding: 1.4rem; border-radius: .6rem; background: var(--cg-paper); }
[data-function-layout="gastos-centro"] .cg-drill__level { position: relative; margin-left: calc(var(--cg-i) * 1.7rem); padding: .85rem 1rem; border-radius: .5rem; background: #fff; box-shadow: 0 1px 0 var(--cg-rule), 0 10px 24px rgb(4 31 73 / .07); }
/* El codo que baja de un nivel al siguiente. */
[data-function-layout="gastos-centro"] .cg-drill__level + .cg-drill__level::before { content: ""; position: absolute; top: -.6rem; left: -.85rem; width: .85rem; height: 2.05rem; border-bottom: 2px solid var(--cg-line); border-left: 2px solid var(--cg-line); border-bottom-left-radius: .45rem; }
[data-function-layout="gastos-centro"] .cg-drill .cg-drill__name { display: flex; align-items: center; gap: .55rem; margin: 0; color: var(--cg-ink); font-family: var(--cg-display); font-size: 1.08rem; font-weight: 700; }
[data-function-layout="gastos-centro"] .cg-drill__name span { display: grid; flex: none; place-items: center; width: 1.85rem; height: 1.85rem; border-radius: .35rem; background: var(--cg-ink); color: var(--cg-gold); }
[data-function-layout="gastos-centro"] .cg-drill__name .cv-icon { width: 15px; height: 15px; flex-basis: 15px; }
[data-function-layout="gastos-centro"] .cg-drill .cg-drill__fields { display: flex; flex-wrap: wrap; gap: .3rem; margin: .6rem 0 0; }
[data-function-layout="gastos-centro"] .cg-drill__fields span { padding: .2rem .5rem; border-radius: .3rem; background: var(--cg-ink-tint); color: var(--cg-ink); font-size: .8rem; font-weight: 600; }
[data-function-layout="gastos-centro"] .cg-drill__level:nth-child(2) .cg-drill__fields span:nth-child(1) { background: var(--cg-dr-tint); color: var(--cg-dr); }
[data-function-layout="gastos-centro"] .cg-drill__level:nth-child(2) .cg-drill__fields span:nth-child(2) { background: var(--cg-cr-tint); color: var(--cg-cr); }
[data-function-layout="gastos-centro"] .cg-drill__level:nth-child(2) .cg-drill__fields span:nth-child(3) { background: var(--cg-gold); color: var(--cg-ink); }

/* ---------- 4. El cargo y el abono que se anulan en el saldo ---------- */
[data-function-layout="gastos-centro"] .cg-cancel { margin: 0; padding: 1.4rem; border-radius: .6rem; background: #fff; box-shadow: 0 1px 0 var(--cg-rule), 0 14px 34px rgb(4 31 73 / .08); font-variant-numeric: tabular-nums; }
[data-function-layout="gastos-centro"] .cg-cancel p { margin: 0; }
[data-function-layout="gastos-centro"] .cg-cancel .cg-cancel__head { display: flex; align-items: center; gap: .5rem; color: var(--cg-ink); font-family: var(--cg-display); font-size: 1.12rem; font-weight: 800; }
[data-function-layout="gastos-centro"] .cg-cancel__head .cv-icon { width: 17px; height: 17px; flex-basis: 17px; color: var(--cg-acc); }
[data-function-layout="gastos-centro"] .cg-cancel .cg-cancel__acct { margin-top: .25rem; color: var(--cg-muted); font-size: .84rem; font-weight: 600; }
[data-function-layout="gastos-centro"] .cg-cancel__acct b { margin-right: .4rem; color: var(--cg-ink); font-family: var(--cg-display); }
[data-function-layout="gastos-centro"] .cg-cancel__chart { position: relative; display: grid; gap: .7rem; margin-top: 1.2rem; padding: .5rem 0; }
/* El eje del cero. */
[data-function-layout="gastos-centro"] .cg-cancel__chart::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: var(--cg-ink); }
[data-function-layout="gastos-centro"] .cg-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; }
[data-function-layout="gastos-centro"] .cg-bar__folio { display: grid; color: var(--cg-ink); font-family: var(--cg-display); font-size: .95rem; font-weight: 700; }
[data-function-layout="gastos-centro"] .cg-bar__folio small { color: var(--cg-muted); font-family: Inter, sans-serif; font-size: .7rem; font-weight: 700; }
[data-function-layout="gastos-centro"] .cg-bar__fill { display: flex; align-items: center; height: 2.6rem; padding: 0 .8rem; border-radius: 0 .4rem .4rem 0; background: var(--cg-dr); color: #fff; transform-origin: left center; }
[data-function-layout="gastos-centro"] .cg-bar__fill b { font-family: var(--cg-display); font-size: 1.02rem; }
[data-function-layout="gastos-centro"] .cg-bar--debit .cg-bar__folio { grid-area: 1 / 1; padding-right: .9rem; text-align: right; }
[data-function-layout="gastos-centro"] .cg-bar--debit .cg-bar__fill { grid-area: 1 / 2; }
[data-function-layout="gastos-centro"] .cg-bar--credit .cg-bar__fill { grid-area: 1 / 1; justify-content: flex-end; border-radius: .4rem 0 0 .4rem; background: var(--cg-cr); transform-origin: right center; }
[data-function-layout="gastos-centro"] .cg-bar--credit .cg-bar__folio { grid-area: 1 / 2; padding-left: .9rem; }
[data-function-layout="gastos-centro"] .cg-cancel .cg-cancel__total { display: flex; flex-direction: column; align-items: center; gap: .2rem; margin-top: .3rem; color: var(--cg-ink); }
[data-function-layout="gastos-centro"] .cg-cancel__total small { color: var(--cg-muted); font-size: .74rem; font-weight: 700; }
[data-function-layout="gastos-centro"] .cg-cancel__total b { padding: .1rem .85rem; border-radius: .35rem; background: var(--cg-gold); font-family: var(--cg-display); font-size: 1.6rem; font-weight: 800; }
[data-function-layout="gastos-centro"] .cg-cancel .cg-cancel__ref { display: flex; align-items: center; justify-content: center; gap: .35rem; margin-top: .9rem; color: var(--cg-muted); font-size: .8rem; font-weight: 600; }
[data-function-layout="gastos-centro"] .cg-cancel__ref .cv-icon { width: 15px; height: 15px; flex-basis: 15px; }
[data-function-layout="gastos-centro"] .cg-callout { grid-column: 1 / -1; padding: 1.1rem 1.2rem; border-radius: .5rem; background: #fff; box-shadow: inset 4px 0 0 var(--cg-gold); }
[data-function-layout="gastos-centro"] .cg-callout .cg-callout__title { display: flex; align-items: center; gap: .5rem; margin: 0 0 .45rem; color: var(--cg-ink); font-family: var(--cg-display); font-size: 1.25rem; font-weight: 700; }
[data-function-layout="gastos-centro"] .cg-callout__title .cv-icon { width: 18px; height: 18px; flex-basis: 18px; flex-shrink: 0; color: var(--cg-acc); }
[data-function-layout="gastos-centro"] .cg-callout p:not(.cg-callout__title) { max-width: 60rem; margin: 0; color: var(--cg-text); font-size: 1rem; line-height: 1.6; }

/* ---------- 6. El rastro, del reporte al documento de origen ---------- */
[data-function-layout="gastos-centro"] .cg-trace { display: grid; margin: 0; padding: 1.2rem 1.4rem; border-radius: .6rem; background: var(--cg-paper); }
[data-function-layout="gastos-centro"] .cg-trace .cg-trace__node { position: relative; display: flex; align-items: center; gap: .85rem; margin: 0; padding: .55rem 0; }
[data-function-layout="gastos-centro"] .cg-trace__node + .cg-trace__node::before { content: ""; position: absolute; top: -.55rem; left: calc(1.2rem - 1px); height: 1.1rem; border-left: 2px dashed var(--cg-line); }
[data-function-layout="gastos-centro"] .cg-trace__icon { display: grid; flex: none; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 2px var(--cg-ink); color: var(--cg-ink); }
[data-function-layout="gastos-centro"] .cg-trace__icon .cv-icon { width: 16px; height: 16px; flex-basis: 16px; }
[data-function-layout="gastos-centro"] .cg-trace__node:first-child .cg-trace__icon { background: var(--cg-ink); color: var(--cg-gold); }
[data-function-layout="gastos-centro"] .cg-trace__node:last-child .cg-trace__icon { background: var(--cg-gold); box-shadow: none; }
[data-function-layout="gastos-centro"] .cg-trace__node > span:last-child { display: grid; color: var(--cg-ink); font-family: var(--cg-display); font-size: 1.04rem; font-weight: 700; }
[data-function-layout="gastos-centro"] .cg-trace__node small { color: var(--cg-muted); font-family: Inter, sans-serif; font-size: .72rem; font-weight: 700; }

/* ---------- Comunes ---------- */
[data-function-layout="gastos-centro"] .cv-hero-title,
[data-function-layout="gastos-centro"] .cv-section-title,
[data-function-layout="gastos-centro"] .cv-form-title { font-family: var(--cg-display); font-weight: 700; letter-spacing: -.01em; }
[data-function-layout="gastos-centro"] .cv-section-title { font-size: clamp(2rem, 3.1vw, 2.85rem); line-height: 1.06; }
[data-function-layout="gastos-centro"] .cg-narrow { max-width: 50rem; }
[data-function-layout="gastos-centro"] .cg-navy { background: var(--cg-ink); color: #fff; }
[data-function-layout="gastos-centro"] .cg-navy .cv-section-title { color: #fff; }
[data-function-layout="gastos-centro"] .cg-split { display: grid; gap: 2.5rem 4rem; align-items: center; }
[data-function-layout="gastos-centro"] .cg-split--top { align-items: start; margin-top: 1.6rem; }
[data-function-layout="gastos-centro"] .cg-lead { max-width: 42rem; margin-top: 1.25rem; color: var(--cg-text); font-size: clamp(1.0625rem, 1.4vw, 1.1875rem); line-height: 1.75; }
[data-function-layout="gastos-centro"] .cg-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
[data-function-layout="gastos-centro"] .cg-table thead th { padding: .8rem 1rem; border-bottom: 3px solid var(--cg-rule); color: var(--cg-muted); font-size: .95rem; font-weight: 700; text-align: left; }
[data-function-layout="gastos-centro"] .cg-table tbody th,
[data-function-layout="gastos-centro"] .cg-table td { padding: .85rem 1rem; border-bottom: 1px solid var(--cg-rule); font-size: 1.02rem; line-height: 1.5; text-align: left; vertical-align: top; }
[data-function-layout="gastos-centro"] .cg-table tbody th { color: var(--cg-ink); font-family: var(--cg-display); font-size: 1.22rem; font-weight: 700; }
[data-function-layout="gastos-centro"] .cg-table td { color: var(--cg-muted); font-weight: 500; }

/* ---------- 2. Problemas ---------- */
/* El id gana a la regla compartida, que va después en el archivo. */
[data-function-layout="gastos-centro"] #problema-function .cg-benefits li { border-top-color: var(--cg-acc); }
[data-function-layout="gastos-centro"] .cg-benefits .cg-benefits__icon { background: var(--cg-acc-tint); box-shadow: none; color: var(--cg-acc); }

/* ---------- 3. Tabla de datos ---------- */
[data-function-layout="gastos-centro"] .cg-table--data { margin-top: 1.6rem; }
[data-function-layout="gastos-centro"] .cg-table--data thead th:first-child { width: 34%; }
[data-function-layout="gastos-centro"] .cg-table__icon { display: inline-grid; place-items: center; width: 2rem; height: 2rem; margin-right: .6rem; border-radius: .4rem; background: var(--cg-ink); color: var(--cg-gold); vertical-align: -.45rem; }
[data-function-layout="gastos-centro"] .cg-table__icon .cv-icon { width: 16px; height: 16px; flex-basis: 16px; }

/* ---------- 6. Los pasos ---------- */
[data-function-layout="gastos-centro"] .cg-steps { display: grid; gap: 1rem; margin: 2rem 0 0; padding: 0; list-style: none; }
[data-function-layout="gastos-centro"] .cg-steps li { display: grid; align-content: start; gap: .55rem; padding: 1.1rem 1.2rem; border-radius: .5rem; background: rgb(255 255 255 / .06); box-shadow: inset 0 0 0 1.5px rgb(255 255 255 / .18); }
[data-function-layout="gastos-centro"] .cg-steps__head { display: flex; align-items: center; justify-content: space-between; margin: 0; }
[data-function-layout="gastos-centro"] .cg-steps__head i { color: var(--cg-gold); font-family: var(--cg-display); font-size: 2rem; font-style: normal; font-weight: 700; line-height: 1; }
[data-function-layout="gastos-centro"] .cg-steps__icon { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: .4rem; background: var(--cg-gold); color: var(--cg-ink); }
[data-function-layout="gastos-centro"] .cg-steps__icon .cv-icon { width: 17px; height: 17px; flex-basis: 17px; }
[data-function-layout="gastos-centro"] .cg-steps b { color: #fff; font-family: var(--cg-display); font-size: 1.12rem; font-weight: 700; line-height: 1.35; }
[data-function-layout="gastos-centro"] .cg-steps__action { margin: 0; color: rgb(255 255 255 / .88); font-size: .98rem; line-height: 1.5; }
[data-function-layout="gastos-centro"] .cg-steps__result { margin: 0; padding: .55rem .7rem; border-radius: .35rem; background: rgb(255 255 255 / .08); box-shadow: inset 3px 0 0 var(--cg-gold); color: #fff; font-size: .94rem; line-height: 1.45; }
[data-function-layout="gastos-centro"] .cg-steps__result small { display: block; color: rgb(255 255 255 / .7); font-size: .78rem; font-weight: 700; }

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

/* ---------- Entradas al hacer scroll: una distinta por figura ---------- */
@supports (animation-timeline: view()) {
    @media (prefers-reduced-motion: no-preference) {
        /* Los niveles del reporte se escalonan. */
        [data-function-layout="gastos-centro"] .cg-drill__level { animation: cg-from-left linear both; animation-timeline: view(); animation-range: entry 10% cover 30%; }
        /* Las barras crecen desde el cero. */
        [data-function-layout="gastos-centro"] .cg-bar__fill { animation: cg-grow linear both; animation-timeline: view(); animation-range: entry 15% cover 40%; }
        /* Los pasos suben. */
        [data-function-layout="gastos-centro"] .cg-steps li { animation: cg-rise linear both; animation-timeline: view(); animation-range: entry 5% cover 25%; }
        /* El rastro se recorre. */
        [data-function-layout="gastos-centro"] .cg-trace__node { animation: cg-down linear both; animation-timeline: view(); animation-range: entry 10% cover 30%; }
    }
}

@media (min-width: 768px) {
    [data-function-layout="gastos-centro"] #relacion-function .cg-related { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    [data-function-layout="gastos-centro"] .cg-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
    [data-function-layout="gastos-centro"] #relacion-function .cg-related { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    [data-function-layout="gastos-centro"] .cg-steps { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- Capacidades ---------- */
[data-function-layout="gastos-centro"] .cg-capabilities { display: grid; gap: .75rem; margin: 2.25rem 0 0; padding: 0; list-style: none; }
[data-function-layout="gastos-centro"] .cg-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(--cg-rule); }
[data-function-layout="gastos-centro"] .cg-capabilities__icon { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: .45rem; background: var(--cg-on-tint); color: var(--cg-on); }
[data-function-layout="gastos-centro"] .cg-capabilities__icon .cv-icon { width: 21px; height: 21px; flex-basis: 21px; }
[data-function-layout="gastos-centro"] .cg-capabilities p { margin: 0; color: var(--cg-ink); font-size: 1.0625rem; font-weight: 600; line-height: 1.45; }

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

/* ---------- Beneficios ---------- */
[data-function-layout="gastos-centro"] .cg-benefits { display: grid; gap: 1.5rem 3rem; margin: 2.25rem 0 0; padding: 0; list-style: none; }
[data-function-layout="gastos-centro"] .cg-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(--cg-ink); }
[data-function-layout="gastos-centro"] .cg-benefits__icon { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: .45rem; background: #fff; box-shadow: inset 0 0 0 1px var(--cg-rule); color: var(--cg-ink); }
[data-function-layout="gastos-centro"] .cg-benefits__icon .cv-icon { width: 22px; height: 22px; flex-basis: 22px; }
[data-function-layout="gastos-centro"] .cg-benefits p { margin: .3rem 0 0; color: var(--cg-ink); font-size: 1.125rem; font-weight: 600; line-height: 1.5; }

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

/* ---------- Responsive ---------- */
@media (min-width: 768px) {
    [data-function-layout="gastos-centro"] .cg-capabilities,
    [data-function-layout="gastos-centro"] .cg-benefits { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
    [data-function-layout="gastos-centro"] .rh-hero-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    [data-function-layout="gastos-centro"] .cg-split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    [data-function-layout="gastos-centro"] .cg-capabilities { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
    [data-function-layout="gastos-centro"] #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-centro"] #inicio .cv-hero-title { max-width: none; }
}
@media (max-width: 767px) {
    [data-function-layout="gastos-centro"] .cg-hero__actions > * { width: 100%; }
    [data-function-layout="gastos-centro"] .cg-fixes thead { display: none; }
    [data-function-layout="gastos-centro"] .cg-fixes,
    [data-function-layout="gastos-centro"] .cg-fixes tbody,
    [data-function-layout="gastos-centro"] .cg-fixes tr,
    [data-function-layout="gastos-centro"] .cg-fixes tbody th,
    [data-function-layout="gastos-centro"] .cg-fixes td { display: block; width: 100%; }
    [data-function-layout="gastos-centro"] .cg-fixes tr { padding: .75rem 0; border-bottom: 1px solid var(--cg-rule); }
    [data-function-layout="gastos-centro"] .cg-fixes tbody th,
    [data-function-layout="gastos-centro"] .cg-fixes td { padding: .65rem .85rem; border-bottom: 0; }
    [data-function-layout="gastos-centro"] .cg-fixes tbody th::before,
    [data-function-layout="gastos-centro"] .cg-fixes td::before { content: attr(data-label); display: block; margin-bottom: .35rem; color: var(--cg-muted); font-size: .82rem; font-weight: 700; }
    [data-function-layout="gastos-centro"] .cg-related__link { grid-template-columns: 3rem minmax(0, 1fr); }
    [data-function-layout="gastos-centro"] .cg-related__go { display: none; }
}

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

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

@media (max-width: 767px) {
    [data-function-layout="gastos-centro"] .cg-sheet__top { padding-right: .7rem; padding-left: .7rem; }
    [data-function-layout="gastos-centro"] .cg-sheet .cg-sheet__title { font-size: 1rem; }
    [data-function-layout="gastos-centro"] .cg-sheet__title span { font-size: .64rem; white-space: nowrap; }
    [data-function-layout="gastos-centro"] .cg-switch,
    [data-function-layout="gastos-centro"] .cg-panes,
    [data-function-layout="gastos-centro"] .cg-sheet .cg-export,
    [data-function-layout="gastos-centro"] .cg-sheet .cg-status { margin-right: .7rem; margin-left: .7rem; }
    [data-function-layout="gastos-centro"] .cg-switch__opt { padding: .4rem .25rem; font-size: .64rem; }
    [data-function-layout="gastos-centro"] .cg-panes { padding: .45rem .5rem; }
    [data-function-layout="gastos-centro"] .cg-row { grid-template-columns: minmax(0, 1.25fr) repeat(3, minmax(0, 1fr)); gap: .3rem; padding-right: .35rem; padding-left: .35rem; font-size: .7rem; }
    [data-function-layout="gastos-centro"] .cg-row--center { font-size: .72rem; }
    [data-function-layout="gastos-centro"] .cg-xrow { grid-template-columns: 3.9rem minmax(0, 1.4fr) minmax(0, 1fr); gap: .1rem .35rem; font-size: .72rem; }
    [data-function-layout="gastos-centro"] .cg-xrow .cg-ref { grid-column: 2 / -1; }
    [data-function-layout="gastos-centro"] .cg-xrow--head > span:nth-child(4) { display: none; }
    [data-function-layout="gastos-centro"] .cg-ghost { grid-template-columns: 3.9rem minmax(0, 1.4fr) minmax(0, 1fr); gap: .6rem; }
    [data-function-layout="gastos-centro"] .cg-drill,
    [data-function-layout="gastos-centro"] .cg-cancel,
    [data-function-layout="gastos-centro"] .cg-trace { padding: 1rem; }
    [data-function-layout="gastos-centro"] .cg-drill__level { margin-left: calc(var(--cg-i) * 1rem); }
    [data-function-layout="gastos-centro"] .cg-drill__level + .cg-drill__level::before { left: -.55rem; width: .55rem; }
    [data-function-layout="gastos-centro"] .cg-bar__fill { padding: 0 .55rem; }
    [data-function-layout="gastos-centro"] .cg-bar__fill b { font-size: .86rem; }
    [data-function-layout="gastos-centro"] .cg-bar__folio { font-size: .84rem; }
    [data-function-layout="gastos-centro"] .cg-table--data thead { display: none; }
    [data-function-layout="gastos-centro"] .cg-table--data,
    [data-function-layout="gastos-centro"] .cg-table--data tbody,
    [data-function-layout="gastos-centro"] .cg-table--data tr,
    [data-function-layout="gastos-centro"] .cg-table--data tbody th,
    [data-function-layout="gastos-centro"] .cg-table--data td { display: block; width: 100%; }
    [data-function-layout="gastos-centro"] .cg-table--data tr { padding: .75rem .25rem; border-bottom: 1px solid var(--cg-rule); }
    [data-function-layout="gastos-centro"] .cg-table--data tbody th,
    [data-function-layout="gastos-centro"] .cg-table--data td { padding: .3rem 0; border: 0; }
}

@keyframes cg-grow { from { transform: scaleX(0); } }
@keyframes cg-zoom { from { transform: scale(1.08); } }
@keyframes cg-tick { from { opacity: 0; transform: translateY(-.35rem); } }
@keyframes cg-flash { 0% { box-shadow: 0 0 0 6px var(--cg-gold); } }
@keyframes cg-pop { from { opacity: .2; transform: scale(.6); } }
@keyframes cg-rise { from { opacity: 0; transform: translateY(1rem); } }
@keyframes cg-down { from { opacity: 0; transform: translateY(-.8rem); } }
@keyframes cg-from-left { from { opacity: 0; transform: translateX(-1.5rem); } }
@keyframes cg-from-right { from { opacity: 0; transform: translateX(1.5rem); } }
