/* Impresión: se carga con media="print", todo lo de aquí solo vale en papel */
@page { size: A4; margin: 14mm 12mm 16mm; }
@page { @bottom-right { content: 'Página ' counter(page) ' de ' counter(pages); font: 8pt Inter, sans-serif; color: #666; } }

/* Papel: siempre colores claros, aunque la app esté en oscuro */
:root, :root[data-theme] {
  color-scheme: light;
  --bg: #fff; --surface: #fff; --surface-2: #fff; --surface-3: #ececf2; --input-bg: #fff;
  --line: #d4d4dc; --text: #111; --muted: #555; --pos: #0A6B45; --neg: #B3123A;
  --amber: #9A6200; --red: #B3123A;
  --shadow: none; --glass: #fff;
}
html, body { background: #fff !important; color: #111; }
body::before, body::after { display: none !important; }
body { font-size: 10pt; line-height: 1.4; min-height: 0; }

/* Fuera lo que es de pantalla */
.sidebar, .topbar, .tabbar, .fab, .toasts, .backdrop, .page-head, .rp-toolbar, .rp-actions,
.nw-controls, .nw-head .link, .offline-banner, .scroll-arrows, .modal, button { display: none !important; }
.shell, .content, .content-inner { display: block !important; margin: 0 !important; padding: 0 !important; max-width: none !important; }
.page { gap: 5mm; }
.rp-print-head { display: block !important; padding-bottom: 3mm; border-bottom: 0.6pt solid #999; }
.rp-print-brand { font-family: var(--font-display); font-weight: 700; font-size: 11pt; letter-spacing: -0.02em; color: #555; }
.rp-print-title { margin-top: 1mm; font-size: 20pt; }
.rp-print-line { margin-top: 1.5mm; font-size: 9pt; color: #555; }

/* Tarjetas planas */
.panel, .stat { background: #fff !important; box-shadow: none !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
  border: 0.6pt solid #d4d4dc !important; border-radius: 3mm !important; padding: 4mm !important; }
.panel, .stat, .rp-cat, .rp-top-item, .rp-bd, .rp-goal, .rp-fact, .rp-table tr, .nw-panel, .rp-chart, .empty, .rp-kpi, .rp-tile { break-inside: avoid; }
h2, h3, .panel-title, .rp-sub, .rp-subtitle { break-after: avoid; }
.panel-title { font-size: 12pt; margin-bottom: 3mm !important; }
.rp-body { gap: 5mm; }
.rp-summary { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 3mm; }
.rp-summary .stat { display: block !important; padding: 3mm !important; }
.rp-summary .stat b { font-size: 13pt !important; text-align: left !important; }
.rp-summary .stat small { font-size: 8.5pt; }
.rp-delta { font-size: 8pt !important; }
.rp-grid { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) !important; gap: 5mm; }
.rp-duo { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.rp-table-wrap { overflow: visible !important; }
.rp-table { font-size: 9pt !important; }
.rp-table th, .rp-table td { padding: 1.6mm 2mm !important; }
.rp-table thead { display: table-header-group; }
.rp-table tfoot { display: table-row-group; }
.rp-top-item { grid-template-columns: 6mm auto minmax(0, 1fr) auto !important; }
.rp-rank { display: block !important; }
.rp-cats { gap: 2.5mm; }
.rp-cats-panel { break-inside: auto; }
.rp-cat { grid-template-columns: auto minmax(0, 1fr) auto auto !important; grid-template-areas: 'ico name var amt' 'ico bar bar bar' !important; row-gap: 1mm !important; }
.rp-cat-var { justify-self: end; }
.rp-cat-ico, .rp-top-item .tx-ico, .rp-goal-ico { width: 8mm !important; height: 8mm !important; border-radius: 2.5mm !important; }
.rp-cat-ico .icon, .rp-top-item .tx-ico .icon, .rp-goal-ico .icon { width: 4.5mm !important; height: 4.5mm !important; }
.rp-goal-ico { border-radius: 50% !important; }
.rp-fact-ico { width: 8mm; height: 8mm; border-radius: 2.5mm; }
.rp-fact-ico .icon { width: 4.5mm; height: 4.5mm; }
.rp-top-item, .rp-fact { padding: 2mm 0 !important; }
.rp-top-item:first-child, .rp-fact:first-child { padding-top: 0 !important; }
.rp-foot { font-size: 8pt; color: #555; }

/* Cuentas, deudas, contratos, recurrentes e históricos: las secciones largas pueden partirse entre tarjetas */
.rp-accounts, .rp-debts, .rp-contracts, .rp-recurring { break-inside: auto; }
.rp-sub { margin: -1.5mm 0 3mm; font-size: 8.5pt; }
.rp-subtitle { margin: 4mm 0 2.5mm; font-size: 10pt; }
.rp-kpis { grid-template-columns: repeat(auto-fit, minmax(38mm, 1fr)) !important; gap: 3mm; margin-bottom: 0; }
.rp-kpi, .rp-tile { background: #fff !important; border: 0.6pt solid #d4d4dc; border-radius: 2.5mm; padding: 2.5mm 3mm; }
.rp-kpi small, .rp-kpi-hint { font-size: 8pt; }
.rp-kpi b { font-size: 12pt; }
.rp-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 3mm; margin-top: 3mm; }
.rp-subtitle + .rp-tiles { margin-top: 0; }
.rp-tile { gap: 1.8mm; }
.rp-tile-head { gap: 2.5mm; }
.rp-tile-title, .rp-tile-sub { white-space: normal; overflow-wrap: anywhere; }
.rp-tile-sub, .rp-tile-line { font-size: 8pt; }
.rp-big { font-size: 11pt; }
.rp-mid { font-size: 10pt; }
.rp-tile .meter { height: 1.8mm; }
.rp-fact-ico { flex: none; }
.empty { padding: 10mm 0; }

/* Colores de barras e iconos también en papel */
.meter, .meter > i, .tx-ico, .rp-bd-ico, .rp-goal-ico, .rp-fact-ico, .pill, .rp-chart, .nw-chart, .legend-row i, .chart-key i,
.nw-legend i, .lines-box svg { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

/* Sin animaciones a medias */
*, *::before, *::after { animation: none !important; transition: none !important; }
.line-path { stroke-dashoffset: 0 !important; }
.line-area, .line-dots circle { opacity: 1 !important; }
.lines-box svg { max-height: 70mm; }
.rp-chart .lines text { font-size: var(--rp-chart-text, 14px); }
.rp-goal-ico { box-shadow: none !important; }

/* Importes ocultos: barra gris en lugar de desenfoque */
.hide-amounts .amt { filter: none !important; color: transparent !important; background: #cfcfd6 !important;
  border-radius: 2px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.hide-amounts .axis-amt, .hide-amounts .rp-chart text[text-anchor='end'] { visibility: hidden; }

/* El bloque del saldo del Resumen sale legible en papel */
.hero { background: #fff !important; color: #111 !important; border: 1px solid #d4d4dc; box-shadow: none !important; }
.hero *, .hero .hero-label, .hero .hero-amount { color: #111 !important; opacity: 1 !important; }
.hero::before, .hero::after { display: none !important; }
