/* Borrador de un modelo fiscal (modelos-aeat-preview.js): en pantalla, con los colores del tema;
   al imprimir, en una página aparte que carga solo esta hoja, en papel blanco. */
.aeat-pv-documento { margin-top: 18px; padding: 24px; border: 1px solid var(--border, #d3dae5); border-radius: 16px; background: var(--bg-card, #fff); color: var(--text-primary, #202a3a); font-variant-numeric: tabular-nums; }
.aeat-pv-cabecera { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 16px; border-bottom: 2px solid #202a3a; }
.aeat-pv-cabecera h2 { margin: 0 0 4px; font-size: 24px; }
.aeat-pv-cabecera p { margin: 0; }
.aeat-pv-borrador { font-size: 12px; color: #73501c; background: #fcf3e4; padding: 6px 10px; border-radius: 6px; max-width: 200px; }
.aeat-pv-identidad { display: grid; grid-template-columns: 2fr 1fr; gap: 16px 24px; margin: 8px 0 0; }
.aeat-pv-identidad dt { color: var(--text-secondary, #596679); font-size: 12px; }
.aeat-pv-identidad dd { margin: 3px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.aeat-pv-nota, .aeat-pv-pie { font-size: 12px; color: var(--text-secondary, #596679); }
.aeat-pv-pendiente { margin: 0 0 14px; padding: 12px 14px; border-radius: 10px; background: var(--warning-bg, #fcf3e4); color: var(--warning, #73501c); font-size: 13px; }
.aeat-pv-resultado { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 14px 16px; border-radius: 12px; background: var(--bg-secondary, #f4f6f9); }
.aeat-pv-resultado span { font-size: 13px; color: var(--text-secondary, #596679); }
.aeat-pv-resultado strong { font-size: 22px; font-weight: 600; white-space: nowrap; }
.aeat-pv-seccion h3 { margin: 0; padding: 0 0 12px; font-size: 16px; font-weight: 600; border-bottom: 1px solid var(--border, #d3dae5); }
.aeat-pv-fila { display: grid; grid-template-columns: minmax(0, 1fr) 40px 140px; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border, #e0e4eb); font-size: 14px; break-inside: avoid; }
.aeat-pv-fila > span:first-child { overflow-wrap: anywhere; }
.aeat-pv-casilla { font-size: 12px; border: 1px solid var(--border, #aab6c9); text-align: center; padding: 1px 2px; color: var(--text-secondary, #3e526e); border-radius: 4px; }
.aeat-pv-fila strong { text-align: right; font-weight: 600; white-space: nowrap; }
.aeat-pv-fila.aeat-pv-fila-texto { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); }
.aeat-pv-fila strong.aeat-pv-texto { white-space: normal; font-weight: 500; }
.aeat-pv-tercero { padding-top: 16px; }
.aeat-pv-tercero h4 { font-size: 14px; margin: 0; }
.aeat-pv-tercero p { margin: 4px 0 8px; color: var(--text-secondary, #596679); font-size: 12px; }
.aeat-pv-avisos { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: var(--warning-bg, #fcf3e4); color: var(--warning, #73501c); overflow-wrap: anywhere; font-size: 13px; }
.aeat-pv-errores { background: var(--danger-bg, #fcf0f0); color: var(--danger, #982c2c); }
.aeat-pv-avisos summary { cursor: pointer; font-weight: 600; }
.aeat-pv-avisos ul { padding-left: 20px; margin: 10px 0 0; }
.aeat-pv-avisos li + li { margin-top: 6px; }
.aeat-pv-pie { border-top: 1px solid var(--border, #d3dae5); margin-top: 24px; padding-top: 12px; }
.aeat-pv-print-frame { position: fixed; width: 0; height: 0; border: 0; }
.aeat-pv-solo-papel { display: none; }
/* Lista de secciones a la izquierda, la elegida a la derecha */
.aeat-pv-cuerpo { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 28px; margin-top: 20px; align-items: start; }
.aeat-pv-cuerpo > * { min-width: 0; }
.aeat-pv-nav { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 16px; }
.aeat-pv-buscar label { display: block; font-size: 12px; color: var(--text-secondary, #596679); margin-bottom: 6px; }
.aeat-pv-buscar > div { display: flex; gap: 6px; }
.aeat-pv-buscar input { flex: 1; min-width: 0; height: 36px; padding: 0 12px; border: 1px solid var(--border, #c6cfdc); border-radius: 10px; font: inherit; background: var(--bg-input, #fff); color: var(--text-primary, #202a3a); }
.aeat-pv-buscar-msg { margin: 6px 0 0; font-size: 12px; color: var(--danger, #982c2c); }
.aeat-pv-buscar-msg:empty { display: none; }
.aeat-pv-secciones { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.aeat-pv-secciones button { width: 100%; display: grid; grid-template-columns: 22px minmax(0, 1fr) 16px; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--text-secondary, #3e4a5c); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; }
.aeat-pv-secciones button:hover { background: var(--bg-secondary, #f1f4f9); }
.aeat-pv-secciones button[aria-selected="true"] { background: var(--bg-secondary, #e8edf6); color: var(--text-primary, #202a3a); font-weight: 600; }
.aeat-pv-num { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border, #c6cfdc); background: var(--bg-card, #fff); font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.aeat-pv-secciones button[aria-selected="true"] .aeat-pv-num, .aeat-pv-paneles .aeat-pv-seccion h3 .aeat-pv-num { background: var(--text-primary, #202a3a); border-color: var(--text-primary, #202a3a); color: var(--bg-card, #fff); }
.aeat-pv-tit { overflow-wrap: anywhere; line-height: 1.3; }
.aeat-pv-visto { color: var(--success, #2f7d4f); }
.aeat-pv-paneles .aeat-pv-seccion h3 { display: flex; align-items: center; gap: 10px; }
.aeat-pv-pasos { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; }
.aeat-pv-pasos .btn:disabled { visibility: hidden; }
.aeat-pv-fila.aeat-pv-encontrada { animation: aeat-pv-brillo 1.6s ease-out; }
@keyframes aeat-pv-brillo { 0%, 35% { background: #fff4d6; } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .aeat-pv-fila.aeat-pv-encontrada { animation: none; } }
@media (max-width: 760px) {
  .aeat-pv-cuerpo { grid-template-columns: 1fr; gap: 14px; }
  .aeat-pv-nav { position: static; }
  .aeat-pv-secciones { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .aeat-pv-secciones li { flex: 0 0 auto; }
  .aeat-pv-secciones button { grid-template-columns: 22px auto 16px; white-space: nowrap; border: 1px solid var(--border, #d3dae5); }
}
@media (max-width: 600px) {
  .aeat-pv-documento { padding: 14px; }
  .aeat-pv-identidad { grid-template-columns: 1fr; gap: 12px; }
  .aeat-pv-fila { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 8px; }
  .aeat-pv-fila > span:first-child { grid-column: 1 / -1; }
  .aeat-pv-casilla { width: 36px; justify-self: start; }
  .aeat-pv-resultado { align-items: flex-start; flex-direction: column; gap: 4px; }
}

/* Copia para imprimir: papel blanco, todas las secciones, una por página, con marca de agua */
.aeat-pv-print { margin: 0; background: #fff; color: #202a3a; font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.aeat-pv-print .aeat-pv-documento { border: 0; padding: 0; background: #fff; color: #202a3a; }
.aeat-pv-print .aeat-pv-solo-papel { display: revert; }
.aeat-pv-print .aeat-pv-cabecera.aeat-pv-solo-papel { display: flex; }
.aeat-pv-print .aeat-pv-documento::before { content: 'BORRADOR'; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(-52deg); font: 700 118px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; letter-spacing: .04em; color: rgba(214, 70, 70, .14); pointer-events: none; z-index: 0; white-space: nowrap; }
.aeat-pv-print .aeat-pv-documento > * { position: relative; z-index: 1; }
.aeat-pv-print .aeat-pv-resultado { margin: 16px 0; }
@media print {
  @page { size: A4; margin: 14mm; }
  .aeat-pv-documento { font-size: 10pt; }
  .aeat-pv-identidad { grid-template-columns: 2fr 1fr; }
  .aeat-pv-fila { grid-template-columns: minmax(0, 1fr) 34px 105px; padding: 6px 0; }
  .aeat-pv-fila > span:first-child { grid-column: auto; }
  .aeat-pv-resultado { flex-direction: row; }
  .aeat-pv-seccion h3, .aeat-pv-tercero h4 { break-after: avoid; }
  .aeat-pv-cuerpo { display: block; margin-top: 0; }
  .aeat-pv-seccion { margin-top: 18px; }
  .aeat-pv-seccion + .aeat-pv-seccion { break-before: page; }
}

/* ===== Borrador con la forma del formulario de Hacienda (aeat-formulario.js): 111 y 115, una hoja A4 ===== */
.af-print { margin: 0; background: #fff; }
.af-hoja { --af-linea: #7d7fa8; --af-franja: #d9d8ea; --af-tinta: #1f2333; width: 190mm; margin: 0 auto; color: var(--af-tinta); font: 8.6pt/1.3 Arial, Helvetica, sans-serif; }
.af-titulo { margin: 0 0 3mm; padding-bottom: 1.5mm; border-bottom: 1.4pt solid var(--af-tinta); font-size: 12.5pt; font-weight: 700; }
.af-cabecera { display: grid; grid-template-columns: 52mm 1fr 24mm; gap: 2mm; margin-bottom: 2.5mm; }
.af-agencia, .af-impuesto, .af-modelo { border: .8pt solid var(--af-linea); padding: 1.6mm 2.2mm; }
.af-agencia { display: flex; flex-direction: column; justify-content: center; background: #eeeef6; }
.af-agencia strong { font-size: 11pt; }
.af-agencia span { font-size: 7pt; color: #4a4e63; }
.af-impuesto { background: #3d4f8c; color: #fff; }
.af-impuesto strong { display: block; font-size: 8.6pt; }
.af-impuesto span { display: block; font-size: 7pt; line-height: 1.25; margin-top: .6mm; color: #e4e8f7; }
.af-modelo { display: flex; flex-direction: column; align-items: center; justify-content: center; background: #e6e2ef; }
.af-modelo span { font-size: 8pt; font-weight: 700; }
.af-modelo strong { font-size: 20pt; line-height: 1; }
.af-seccion { display: grid; grid-template-columns: 6.5mm 1fr; border: .9pt solid var(--af-linea); margin-bottom: 2mm; break-inside: avoid; }
.af-lateral { background: var(--af-franja); border-right: .9pt solid var(--af-linea); display: flex; align-items: center; justify-content: center; }
.af-lateral span { writing-mode: vertical-rl; transform: rotate(180deg); font-weight: 700; font-size: 7.6pt; white-space: nowrap; }
.af-cuerpo { padding: 1.6mm 2.2mm; min-width: 0; }
.af-devengo { display: flex; justify-content: flex-end; align-items: center; gap: 5mm; padding-bottom: 1.4mm; margin-bottom: 1.4mm; border-bottom: .6pt solid var(--af-linea); font-weight: 700; }
.af-devengo-lbl { margin-right: auto; color: #4a4e63; font-size: 7.6pt; }
.af-letras { display: inline-flex; margin-left: 1.5mm; vertical-align: middle; }
.af-letras span { width: 4.2mm; height: 4.8mm; border: .6pt solid var(--af-linea); border-left-width: 0; display: inline-flex; align-items: center; justify-content: center; font: 8.6pt "Courier New", Courier, monospace; font-weight: 700; background: #fff; }
.af-letras span:first-child { border-left-width: .6pt; }
.af-datos { display: grid; grid-template-columns: 30mm 1fr 1fr; gap: 1.2mm 2mm; }
.af-dato { display: flex; flex-direction: column; gap: .4mm; }
.af-dato small { font-size: 6.8pt; color: #4a4e63; }
.af-dato span { border: .6pt solid var(--af-linea); min-height: 4.6mm; padding: .5mm 1.4mm; font: 8.4pt "Courier New", Courier, monospace; background: #fff; }
.af-datos .af-grande { grid-column: span 2; }
.af-bloque { border: .6pt solid var(--af-linea); padding: 1.2mm 1.8mm; margin-bottom: 1.4mm; background: #fbfbfe; }
.af-bloque:last-child { margin-bottom: 0; }
.af-bloque h4 { margin: 0 0 .8mm; font-size: 8.4pt; }
.af-cab3, .af-fila3 { display: grid; grid-template-columns: 30mm 1fr 1fr 1fr; gap: 1.6mm; align-items: center; }
.af-cab3 { font-size: 6.8pt; color: #4a4e63; text-align: center; margin-top: .4mm; }
.af-fila3 { margin-bottom: .6mm; }
.af-etq { font-weight: 700; font-size: 7.8pt; text-align: right; }
.af-campo { display: inline-flex; align-items: stretch; border: .6pt solid var(--af-linea); background: #fff; min-height: 4.8mm; }
.af-campo .af-num { flex: 0 0 auto; min-width: 5.4mm; display: flex; align-items: center; justify-content: center; border-right: .6pt solid var(--af-linea); background: #ecebf5; font-weight: 700; font-size: 7.4pt; }
.af-campo .af-val { flex: 1; text-align: right; padding: .4mm 1.4mm; font: 8.6pt "Courier New", Courier, monospace; font-weight: 700; }
.af-campo.af-ancho { width: 46mm; flex: 0 0 auto; }
.af-total { display: flex; align-items: center; justify-content: space-between; gap: 3mm; margin: .7mm 0; }
.af-total > span:first-child { flex: 1; }
.af-res > span:first-child { font-weight: 700; }
.af-pie2 { display: grid; grid-template-columns: 1.15fr 1fr; gap: 2mm; }
.af-pie2 .af-seccion { margin-bottom: 0; }
.af-derecha { display: flex; flex-direction: column; gap: 2mm; }
.af-mini { margin: 0 0 1mm; font-size: 6.9pt; color: #3a3e52; }
.af-pago { display: flex; align-items: center; gap: 1.6mm; margin: 1.2mm 0; font-size: 7.6pt; }
.af-check { width: 4mm; height: 4mm; border: .7pt solid var(--af-linea); display: inline-flex; align-items: center; justify-content: center; font: 700 8pt "Courier New", monospace; background: #fff; }
.af-iban { display: flex; align-items: center; gap: 1.4mm; }
.af-iban small { font-weight: 700; font-size: 7.6pt; }
.af-iban .af-letras span { width: 3.3mm; height: 4.4mm; font-size: 7.6pt; }
.af-centro { display: flex; align-items: center; gap: 2mm; margin: 1mm 0; }
.af-firma { margin-top: 2mm; }
.af-firma p { margin: .8mm 0; }
.af-nota { margin: 2mm 0 0; font-size: 6.8pt; color: #5a5e72; text-align: center; }
@media print { .af-hoja { width: auto; } }
/* Una sola hoja: el 111 tiene seis secciones de liquidación; se compacta un poco el formulario */
.af-print .af-hoja { zoom: .86; }
.af-iban .af-letras span { width: 2.9mm; }
.af-hoja .af-fila3 { margin-bottom: .3mm; }
.af-hoja .af-bloque { padding: 1mm 1.6mm; margin-bottom: 1.1mm; }
