/* Documento de revisión: hereda el marco fiscal; el papel también sirve para imprimir. */
#aeat-dialog { width: min(980px, calc(100vw - 32px)); }
.aeat-pv-opciones { margin-top: 16px; }
.aeat-pv-opciones > summary { cursor: pointer; color: var(--text-secondary, #596679); font-size: 13px; }
.aeat-pv-opciones[open] > summary { margin-bottom: 16px; }
.aeat-pv-opciones #aeat-criterio { margin-top: 12px; }
.aeat-pv-documento .aeat-pv-seccion, .aeat-pv-documento .aeat-pv-tercero { background: #fff; }
.aeat-pv-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 24px 0 12px; }
.aeat-pv-toolbar h3 { margin: 0; font-size: 18px; }
.aeat-pv-documento { background: #fff; color: #202a3a; border: 1px solid #d3dae5; padding: 28px; border-radius: 8px; font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-variant-numeric: tabular-nums; }
.aeat-pv-documento ::selection { color: #202a3a; background: #e5ebf5; }
.aeat-pv-cabecera { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 20px; border-bottom: 2px solid #4e6dab; }
.aeat-pv-cabecera h2 { margin: 0 0 4px; font-size: 26px; letter-spacing: -.02em; color: #202a3a; }
.aeat-pv-cabecera p { margin: 0; }
.aeat-pv-borrador { font-size: 12px; color: #73501c; background: #fcf3e4; padding: 6px 10px; border-radius: 4px; max-width: 200px; }
.aeat-pv-identidad { display: grid; grid-template-columns: 2fr 1fr; gap: 16px 24px; margin: 20px 0; }
.aeat-pv-identidad dt { color: #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: #596679; }
.aeat-pv-pendiente { background: #fcf3e4; color: #73501c; padding: 12px; border-radius: 4px; }
.aeat-pv-resultado { display: flex; justify-content: space-between; gap: 16px; align-items: center; background: #f0f3fa; padding: 14px 16px; margin: 18px 0; }
.aeat-pv-resultado strong { font-size: 22px; white-space: nowrap; }
.aeat-pv-seccion { margin-top: 28px; }
.aeat-pv-seccion h3 { color: #202a3a; font-size: 16px; font-weight: 600; padding: 9px 0; margin: 0; border-bottom: 1px solid #aab6c9; }
.aeat-pv-fila { display: grid; grid-template-columns: minmax(0, 1fr) 38px 124px; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #e0e4eb; break-inside: avoid; }
.aeat-pv-fila > span:first-child { overflow-wrap: anywhere; }
.aeat-pv-casilla { font-size: 12px; border: 1px solid #aab6c9; text-align: center; padding: 2px; color: #3e526e; border-radius: 3px; }
.aeat-pv-fila strong { text-align: right; font-weight: 600; white-space: nowrap; }
.aeat-pv-tercero { padding-top: 18px; }
.aeat-pv-tercero h4 { font-size: 14px; margin: 0; }
.aeat-pv-tercero p { margin: 4px 0 8px; color: #596679; font-size: 12px; }
.aeat-pv-avisos { margin-top: 20px; color: #73501c; background: #fcf3e4; padding: 12px; border-radius: 4px; overflow-wrap: anywhere; }
.aeat-pv-errores { color: #982c2c; background: #fcf0f0; }
.aeat-pv-avisos summary { cursor: pointer; font-weight: 600; }
.aeat-pv-avisos ul { padding-left: 20px; margin: 12px 0 0; }
.aeat-pv-avisos li + li { margin-top: 8px; }
.aeat-pv-avisos summary:focus-visible { outline: 2px solid #4e6dab; outline-offset: 4px; }
.aeat-pv-pie { border-top: 1px solid #d3dae5; margin-top: 28px; padding-top: 14px; }
.aeat-pv-conexion { color: var(--text-secondary, #596679); font-size: 13px; margin-top: 18px; }
.aeat-pv-print-frame { position: fixed; width: 0; height: 0; border: 0; }
.aeat-pv-print { margin: 0; background: #fff; }
.aeat-pv-print .aeat-pv-documento { border: 0; }
/* Cabecera única del modelo, como en Holded: chapa con el número, título, periodo, estado y acciones */
#aeat-dialog .aeat-dh { align-items: center; padding: 18px 22px; }
.aeat-dh-titulo { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1; }
.aeat-dh-chip { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; min-width: 52px; height: 36px; padding: 0 10px; border-radius: 8px; background: #e6eef6; color: #23405f; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
#aeat-dialog .aeat-dh h2 { margin: 0; font-size: 21px; line-height: 1.2; }
#aeat-dialog .aeat-dh h2:focus, #aeat-dialog .aeat-dh h2:focus-visible { outline: none !important; box-shadow: none !important; border: 0 !important; }
#aeat-dialog .aeat-dh p#aeat-dialog-meta { margin: 3px 0 0; font-size: 13px; color: var(--text-secondary, #596679); }
.aeat-dh-titulo .aeat-dialog-estado { flex: 0 0 auto; }
.aeat-dh-acciones { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.aeat-solo-lector { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* En pantalla no se repite lo que ya dice la cabecera; en papel sí */
.aeat-pv-solo-papel { display: none; }
.aeat-pv-print .aeat-pv-solo-papel { display: revert; }
.aeat-pv-print .aeat-pv-cabecera.aeat-pv-solo-papel { display: flex; }
#aeat-resultado > .aeat-pv-documento { margin-top: 18px; }
@media (max-width: 600px) {
  #aeat-dialog .aeat-dh { flex-wrap: wrap; gap: 12px; }
  .aeat-dh-titulo { flex-wrap: wrap; gap: 10px; }
  .aeat-dh-acciones { margin-left: auto; }
}
/* Secciones al estilo del formulario oficial: lista a la izquierda, la elegida a la derecha */
.aeat-pv-cuerpo { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 28px; margin-top: 22px; align-items: start; }
.aeat-pv-nav { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 18px; }
.aeat-pv-cuerpo > * { min-width: 0; }
.aeat-pv-buscar label { display: block; font-size: 12px; color: #596679; margin-bottom: 6px; }
.aeat-pv-buscar > div { display: flex; gap: 6px; }
.aeat-pv-buscar input { flex: 1; min-width: 0; height: 34px; border: 1px solid #c6cfdc; border-radius: 6px; padding: 0 10px; font: inherit; font-variant-numeric: tabular-nums; color: #202a3a; background: #fff; }
.aeat-pv-buscar input:focus-visible { outline: 2px solid #4e6dab; outline-offset: 1px; }
.aeat-pv-buscar-msg { margin: 6px 0 0; font-size: 12px; color: #982c2c; min-height: 0; }
.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: 6px; background: transparent; color: #3e4a5c; font: inherit; text-align: left; cursor: pointer; transition: background-color 150ms ease, color 150ms ease; }
.aeat-pv-secciones button:hover { background: #f1f4f9; }
.aeat-pv-secciones button[aria-selected="true"] { background: #e8edf6; color: #202a3a; font-weight: 600; }
.aeat-pv-secciones button:focus-visible { outline: 2px solid #4e6dab; outline-offset: 1px; }
.aeat-pv-secciones button:active { transform: scale(.98); }
.aeat-pv-num { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 1px solid #c6cfdc; font-size: 11.5px; font-weight: 600; color: #3e526e; font-variant-numeric: tabular-nums; }
.aeat-pv-secciones button[aria-selected="true"] .aeat-pv-num { background: #202a3a; border-color: #202a3a; color: #fff; }
.aeat-pv-tit { overflow-wrap: anywhere; line-height: 1.3; }
.aeat-pv-visto { color: #2f7d4f; }
.aeat-pv-paneles .aeat-pv-seccion { margin-top: 0; }
.aeat-pv-paneles .aeat-pv-seccion h3 { display: flex; align-items: center; gap: 10px; font-size: 17px; padding: 0 0 12px; }
.aeat-pv-paneles .aeat-pv-seccion h3 .aeat-pv-num { background: #202a3a; border-color: #202a3a; color: #fff; }
.aeat-pv-paneles .aeat-pv-avisos:first-of-type { margin-top: 14px; }
.aeat-pv-pasos { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; }
.aeat-pv-pasos .btn:disabled { visibility: hidden; }
.aeat-pv-cuerpo + .aeat-pv-nota { margin-top: 28px; }
.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; background: #fff4d6; } .aeat-pv-secciones button { transition: none; } }
@media (max-width: 760px) {
  .aeat-pv-cuerpo { grid-template-columns: 1fr; gap: 16px; }
  .aeat-pv-nav { position: static; }
  .aeat-pv-secciones { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; scrollbar-width: thin; }
  .aeat-pv-secciones li { flex: 0 0 auto; }
  .aeat-pv-secciones button { grid-template-columns: 22px auto 16px; white-space: nowrap; border: 1px solid #d3dae5; }
}
@media (max-width: 600px) {
  #aeat-dialog { width: calc(100vw - 16px); }
  .aeat-pv-toolbar { flex-wrap: wrap; gap: 10px; }
  .aeat-pv-documento { padding: 16px; }
  .aeat-pv-cabecera { flex-direction: column; gap: 12px; }
  .aeat-pv-identidad { grid-template-columns: 1fr; gap: 12px; }
  .aeat-pv-fila { grid-template-columns: minmax(0, 1fr) 100px; gap: 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; }
}
@media print {
  @page { size: A4; margin: 14mm; }
  .aeat-pv-documento { padding: 0; border: 0; font-size: 10pt; }
  .aeat-pv-identidad { grid-template-columns: 2fr 1fr; }
  .aeat-pv-cabecera { flex-direction: row; }
  .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-pie, .aeat-pv-cabecera { break-inside: avoid; }
  .aeat-pv-avisos li { break-inside: avoid; }
  .aeat-pv-cuerpo { display: block; margin-top: 0; }
  .aeat-pv-seccion { margin-top: 18px; }
  .aeat-pv-seccion + .aeat-pv-seccion { break-before: page; }
}
/* Copia para imprimir: todas las secciones, una por página, con marca de agua de borrador */
.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-seccion, .aeat-pv-print .aeat-pv-tercero { background: transparent; }
.aeat-pv-print .aeat-pv-seccion h3 { display: flex; align-items: center; gap: 8px; }
/* Cierre del modelo: estado del fichero, cuotas a compensar y registro de la presentación */
#aeat-dialog .aeat-final { margin: 18px 0 14px; border: 1px solid var(--border, #d3dae5); border-radius: 14px; background: var(--bg-card, #fff); overflow: hidden; }
#aeat-dialog .aeat-final > * + * { border-top: 1px solid var(--border, #e0e4eb); }
#aeat-dialog .aeat-final-estado { display: flex; align-items: center; gap: 14px; padding: 16px 18px; margin: 0; color: var(--text-primary, #202a3a); font-weight: 400; }
#aeat-dialog .aeat-final-estado strong { display: block; font-size: 15px; font-weight: 600; }
#aeat-dialog .aeat-final-estado span:not(.aeat-final-ico) { display: block; margin-top: 2px; font-size: 13px; color: var(--text-secondary, #596679); }
#aeat-dialog .aeat-final-ico { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--success-bg, #e6f4ea); color: var(--success, #2f7d4f); }
#aeat-dialog .aeat-final-fila { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; margin: 0; font-size: 14px; color: var(--text-primary, #202a3a); }
#aeat-dialog .aeat-final-fila small { display: block; margin-top: 2px; font-size: 12px; color: var(--text-secondary, #596679); }
#aeat-dialog .aeat-final-fila strong { font-size: 17px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
#aeat-dialog .aeat-final-casilla { display: inline-block; margin-left: 6px; padding: 0 5px; border: 1px solid var(--border, #c6cfdc); border-radius: 4px; font-size: 11px; line-height: 17px; color: var(--text-secondary, #3e526e); font-variant-numeric: tabular-nums; vertical-align: 1px; }
#aeat-dialog .aeat-final-registro { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 14px 18px; margin: 0; border-radius: 0; background: var(--bg-secondary, #f6f7f9); }
#aeat-dialog .aeat-final-registro label { display: flex; flex-direction: column; gap: 2px; font-size: 14px; font-weight: 500; color: var(--text-primary, #202a3a); }
#aeat-dialog .aeat-final-registro label small { font-size: 12px; font-weight: 400; color: var(--text-secondary, #596679); }
#aeat-dialog .aeat-final-campos { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#aeat-dialog .aeat-final-campos input { box-sizing: border-box; width: 190px; height: 40px; margin: 0; padding: 0 14px; border: 1px solid var(--border, #c6cfdc) !important; border-radius: 999px !important; background: var(--bg-card, #fff) !important; color: var(--text-primary, #202a3a); font: inherit; font-size: 14px; font-variant-numeric: tabular-nums; letter-spacing: .04em; box-shadow: none !important; }
#aeat-dialog .aeat-final-campos input:focus-visible { outline: 2px solid var(--accent, #4e6dab); outline-offset: 1px; }
#aeat-dialog .aeat-final-campos .btn { height: 40px; }
@media (max-width: 600px) {
  #aeat-dialog .aeat-final-campos, #aeat-dialog .aeat-final-campos input { width: 100%; }
  #aeat-dialog .aeat-final-campos .btn { width: 100%; }
}
/* Plazos de presentación (aeat-plazos.js): en la lista, el próximo periodo y «antes del …»; en la cabecera, el del periodo elegido */
.aeat-modelo-estado { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.aeat-modelo-estado small { font-size: 11px; color: var(--text-secondary, #596679); font-weight: 400; }
.aeat-modelo-estado.proxima { color: var(--text-primary, #202a3a); font-weight: 500; }
.aeat-modelo-estado.urgente { color: var(--warning, #a15c07); font-weight: 600; }
.aeat-modelo-estado.urgente small { color: var(--warning, #a15c07); }
.aeat-dh-plazo { display: inline-flex; flex-direction: column; justify-content: center; padding: 5px 10px; border-radius: 8px; background: var(--bg-secondary, #f1f4f9); color: var(--text-primary, #202a3a); font-size: 12px; line-height: 1.3; }
.aeat-dh-plazo strong { font-weight: 600; }
.aeat-dh-plazo span { color: var(--text-secondary, #596679); }
.aeat-dh-plazo.urgente { background: var(--warning-bg, #fdf3e1); color: var(--warning, #8a4b06); }
.aeat-dh-plazo.urgente span { color: inherit; }
.aeat-dh-plazo.vencido { background: var(--danger-bg, #fcecec); color: var(--danger, #a12a2a); }
.aeat-dh-plazo[hidden] { display: none; }
/* Datos fiscales: el título sin marco de foco y la fila del criterio alineada con las demás */
#aeat-config-dialog .aeat-dialog-head h2:focus, #aeat-config-dialog .aeat-dialog-head h2:focus-visible { outline: none !important; box-shadow: none !important; border: 0 !important; }
.aeat-retenciones-criterio { align-items: center; gap: 6px 18px; margin-top: 14px; }
.aeat-retenciones-criterio > span { min-width: 150px; font-size: 13px; font-weight: 600; }
.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; text-align: right; font-weight: 500; }
/* ===== 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; }

/* Presentación directa a Hacienda (29-oct-2026): bloque dentro del pie del modelo y ventana de conformidad */
#aeat-dialog .aeat-final-hacienda { display: grid; gap: 14px; padding: 16px 18px; }
#aeat-dialog .aeat-fh-cab { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
#aeat-dialog .aeat-fh-cab strong { display: block; font-size: 15px; font-weight: 600; color: var(--text-primary, #202a3a); }
#aeat-dialog .aeat-fh-cab span { display: block; margin-top: 2px; font-size: 13px; color: var(--text-secondary, #596679); max-width: 520px; }
#aeat-dialog .aeat-fh-entorno { display: inline-flex; padding: 3px; border: 1px solid var(--border, #d3dae5); border-radius: 12px; background: var(--bg-secondary, #f6f7f9); }
#aeat-dialog .aeat-fh-entorno label { position: relative; margin: 0; cursor: pointer; }
#aeat-dialog .aeat-fh-entorno input { position: absolute; opacity: 0; pointer-events: none; }
#aeat-dialog .aeat-fh-entorno span { display: inline-flex; align-items: center; height: 32px; padding: 0 16px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--text-secondary, #596679); transition: background-color 160ms ease, color 160ms ease; }
#aeat-dialog .aeat-fh-entorno input:checked + span { background: var(--bg-card, #fff); color: var(--text-primary, #202a3a); box-shadow: 0 1px 2px rgba(21, 32, 52, .12); }
#aeat-dialog .aeat-fh-entorno input[value="real"]:checked + span { color: var(--accent, #4e6dab); }
#aeat-dialog .aeat-fh-entorno input:focus-visible + span { outline: 2px solid var(--accent, #4e6dab); outline-offset: 1px; }
#aeat-dialog .aeat-fh-nrc { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
#aeat-dialog .aeat-fh-nrc label { display: flex; flex-direction: column; gap: 2px; margin: 0; font-size: 14px; font-weight: 500; color: var(--text-primary, #202a3a); }
#aeat-dialog .aeat-fh-nrc label small { font-size: 12px; font-weight: 400; color: var(--text-secondary, #596679); }
#aeat-dialog .aeat-fh-nrc input { box-sizing: border-box; width: 260px; height: 40px; margin: 0; padding: 0 14px; border: 1px solid var(--border, #c6cfdc) !important; border-radius: 12px !important; background: var(--bg-card, #fff) !important; font: inherit; font-size: 14px; font-variant-numeric: tabular-nums; letter-spacing: .04em; text-transform: uppercase; box-shadow: none !important; }
#aeat-dialog .aeat-fh-acciones { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
#aeat-dialog .aeat-fh-acciones .btn { height: 40px; }
#aeat-dialog #aeat-fh-respuesta:empty { display: none; }
#aeat-dialog .aeat-fh-res { display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px; border: 1px solid var(--border, #e0e4eb); border-radius: 12px; background: var(--bg-secondary, #f6f7f9); }
#aeat-dialog .aeat-fh-res > div { min-width: 0; flex: 1; display: grid; gap: 6px; justify-items: start; }
#aeat-dialog .aeat-fh-res strong { font-size: 14px; font-weight: 600; color: var(--text-primary, #202a3a); }
#aeat-dialog .aeat-fh-res span:not(.aeat-final-ico) { font-size: 13px; color: var(--text-secondary, #596679); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
#aeat-dialog .aeat-fh-res .aeat-lista { width: 100%; margin: 4px 0 0; }
#aeat-dialog .aeat-fh-res.ok { border-color: color-mix(in srgb, var(--success, #2f7d4f) 30%, transparent); background: var(--success-bg, #eef7f1); }
#aeat-dialog .aeat-fh-res.ko { border-color: color-mix(in srgb, var(--danger, #c0392b) 30%, transparent); background: var(--danger-bg, #fcf1ef); }
#aeat-dialog .aeat-fh-res.ko .aeat-final-ico { background: var(--danger-bg, #f8dcd7); color: var(--danger, #c0392b); }
#aeat-dialog .aeat-fh-res.aviso { border-color: color-mix(in srgb, var(--warning, #b7791f) 35%, transparent); background: var(--warning-bg, #fdf6e8); }
#aeat-dialog .aeat-fh-res.aviso .aeat-final-ico, #aeat-dialog .aeat-fh-res:not(.ok):not(.ko):not(.aviso) .aeat-final-ico { background: var(--warning-bg, #f8ecd2); color: var(--warning, #b7791f); }
#aeat-dialog .aeat-envios-titulo { margin: 18px 0 8px; font-size: 14px; font-weight: 600; }
#aeat-dialog .aeat-envio-estado { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
#aeat-dialog .aeat-envio-estado::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--text-secondary, #8a96a8); }
#aeat-dialog .aeat-envio-estado.aceptada::before { background: var(--success, #2f7d4f); }
#aeat-dialog .aeat-envio-estado.rechazada::before, #aeat-dialog .aeat-envio-estado.error::before { background: var(--danger, #c0392b); }
#aeat-dialog .aeat-envio-estado.indeterminada::before, #aeat-dialog .aeat-envio-estado.comprobar::before { background: var(--warning, #b7791f); }

.aeat-conf-dialog { width: min(560px, calc(100vw - 32px)); }
.aeat-conf-aviso { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--border, #e0e4eb); border-radius: 12px; background: var(--bg-secondary, #f6f7f9); font-size: 13px; line-height: 1.45; color: var(--text-secondary, #596679); }
.aeat-conf-aviso svg { flex: none; margin-top: 1px; color: var(--success, #2f7d4f); }
.aeat-conf-aviso strong { color: var(--text-primary, #202a3a); font-weight: 600; }
.aeat-conf-aviso.real { border-color: color-mix(in srgb, var(--warning, #b7791f) 35%, transparent); background: var(--warning-bg, #fdf6e8); }
.aeat-conf-aviso.real svg { color: var(--warning, #b7791f); }
.aeat-conf-tabla { border: 1px solid var(--border, #e0e4eb); border-radius: 12px; overflow: hidden; }
.aeat-conf-fila { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 11px 14px; font-size: 13px; }
.aeat-conf-fila + .aeat-conf-fila { border-top: 1px solid var(--border, #e0e4eb); }
.aeat-conf-fila span { color: var(--text-secondary, #596679); }
.aeat-conf-fila b { font-weight: 500; text-align: right; overflow-wrap: anywhere; color: var(--text-primary, #202a3a); font-variant-numeric: tabular-nums; }
.aeat-conf-fila strong { font-size: 20px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text-primary, #202a3a); }
.aeat-conf-acepto { display: flex; align-items: flex-start; gap: 10px; margin: 16px 0 0; font-size: 13px; line-height: 1.45; color: var(--text-primary, #202a3a); cursor: pointer; }
.aeat-conf-acepto input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent, #4e6dab); }
.aeat-conf-error { min-height: 0; margin: 10px 0 0; font-size: 13px; color: var(--danger, #c0392b); }
.aeat-conf-error:empty { display: none; }
.aeat-conf-botones { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.aeat-conf-botones .btn { height: 40px; }
@media (max-width: 720px) {
  #aeat-dialog .aeat-fh-nrc input { width: 100%; }
  #aeat-dialog .aeat-fh-acciones .btn, .aeat-conf-botones .btn { flex: 1 1 100%; }
  .aeat-conf-dialog { width: calc(100vw - 16px); }
}
/* Traer de Hacienda: campos para revisar las casillas leídas del PDF */
#aeat-dialog .aeat-arrastre [data-traer-hacienda] { margin-top: 8px; }
.aeat-imp-campo label { font-size: 13px; color: var(--text-secondary, #596679); }
.aeat-imp-campo input { box-sizing: border-box; width: 150px; height: 36px; margin: 0; padding: 0 10px; border: 1px solid var(--border, #c6cfdc); border-radius: 10px; background: var(--bg-card, #fff); font: inherit; font-size: 14px; text-align: right; font-variant-numeric: tabular-nums; }
.aeat-imp-tipos { display: inline-flex; flex-wrap: wrap; padding: 3px; border: 1px solid var(--border, #d3dae5); border-radius: 12px; background: var(--bg-secondary, #f6f7f9); }
.aeat-imp-tipos label { position: relative; margin: 0; cursor: pointer; }
.aeat-imp-tipos input { position: absolute; opacity: 0; pointer-events: none; }
.aeat-imp-tipos span { display: inline-flex; align-items: center; height: 30px; padding: 0 10px; border-radius: 9px; font-size: 12px; font-weight: 500; color: var(--text-secondary, #596679); }
.aeat-imp-tipos input:checked + span { background: var(--bg-card, #fff); color: var(--text-primary, #202a3a); box-shadow: 0 1px 2px rgba(21, 32, 52, .12); }
.aeat-imp-tipos input:focus-visible + span { outline: 2px solid var(--accent, #4e6dab); outline-offset: 1px; }
.aeat-conf-tabla a { font-size: 13px; font-weight: 500; color: var(--accent, #4e6dab); }
/* Lo presentado en Hacienda del ejercicio */
.aeat-hej-dialog { width: min(760px, calc(100vw - 32px)); }
.aeat-hej-lista { border: 1px solid var(--border, #e0e4eb); border-radius: 12px; overflow: hidden; }
.aeat-hej-fila { padding: 12px 14px; }
.aeat-hej-fila + .aeat-hej-fila { border-top: 1px solid var(--border, #e0e4eb); }
.aeat-hej-fila.hecha { background: var(--bg-secondary, #f6f7f9); }
.aeat-hej-cab { display: flex; align-items: center; gap: 12px; }
.aeat-hej-cab input[type="checkbox"] { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--accent, #4e6dab); }
.aeat-hej-que { flex: 1; min-width: 0; display: grid; gap: 2px; }
.aeat-hej-que strong { font-size: 14px; font-weight: 600; color: var(--text-primary, #202a3a); }
.aeat-hej-que span { font-size: 12px; color: var(--text-secondary, #596679); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.aeat-hej-cab a { flex: none; font-size: 13px; font-weight: 500; color: var(--accent, #4e6dab); }
.aeat-hej-campos { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin: 10px 0 0 30px; }
.aeat-hej-campos label { display: grid; gap: 4px; margin: 0; font-size: 12px; color: var(--text-secondary, #596679); }
.aeat-hej-campos input[type="number"] { box-sizing: border-box; width: 130px; height: 36px; margin: 0; padding: 0 10px; border: 1px solid var(--border, #c6cfdc); border-radius: 10px; background: var(--bg-card, #fff); font: inherit; font-size: 14px; color: var(--text-primary, #202a3a); text-align: right; font-variant-numeric: tabular-nums; }
.aeat-hej-campos small { flex-basis: 100%; font-size: 12px; color: var(--warning, #b7791f); }
.aeat-hej-tipo { display: inline-flex; flex-wrap: wrap; padding: 3px; border: 1px solid var(--border, #d3dae5); border-radius: 11px; background: var(--bg-secondary, #f6f7f9); }
.aeat-hej-tipo label { position: relative; display: block; margin: 0; cursor: pointer; }
.aeat-hej-tipo input { position: absolute; opacity: 0; pointer-events: none; }
.aeat-hej-tipo span { display: inline-flex; align-items: center; height: 28px; padding: 0 9px; border-radius: 8px; font-size: 12px; font-weight: 500; color: var(--text-secondary, #596679); }
.aeat-hej-tipo input:checked + span { background: var(--bg-card, #fff); color: var(--text-primary, #202a3a); box-shadow: 0 1px 2px rgba(21, 32, 52, .12); }
.aeat-hej-tipo input:focus-visible + span { outline: 2px solid var(--accent, #4e6dab); outline-offset: 1px; }
.aeat-hej-dialog .aeat-envio-estado { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; color: var(--success, #2f7d4f); }
.aeat-hej-dialog .aeat-envio-estado::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--success, #2f7d4f); }
@media (max-width: 720px) { .aeat-hej-dialog { width: calc(100vw - 16px); } .aeat-hej-campos { margin-left: 0; } }
