/* Estilos que comparten todos los formatos del Portal LIA.
   Los colores y las tipografías vienen de ../estilos.css */

/* Tamaño de letra impresa: cada formato elige uno en su <body> */
.letra-9 {
  --letra: 9pt;
  --letra-titulo: 12.5pt;
  --letra-seccion: 9.5pt;
  --letra-fundamento: 7.5pt;
  --relleno-celda: 1.5px;
  --alto-firma: 10.5mm;
}

.letra-11 {
  --letra: 11pt;
  --letra-titulo: 20pt;
  --letra-seccion: 12.5pt;
  --letra-fundamento: 8pt;
  --relleno-celda: 2px;
  --alto-firma: 12mm;
}

.letra-10 {
  --letra: 10pt;
  --letra-titulo: 13pt;
  --letra-seccion: 10.5pt;
  --letra-fundamento: 8pt;
  --relleno-celda: 2px;
  --alto-firma: 12mm;
}

[hidden] {
  display: none !important;
}

.pagina-formato {
  overflow-x: clip;
}

.volver {
  color: inherit;
  text-decoration: none;
}

.volver:hover {
  text-decoration: underline;
}

/* ------------------------------------------------------------
   Panel para llenar
   ------------------------------------------------------------ */
.formato {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 32px 0;
}

.formato__encabezado {
  margin-bottom: 32px;
  color: var(--purpura-profundo);
  text-align: center;
}

.formato__encabezado h1 {
  margin: 0;
  font-family: var(--titulos);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 600;
  line-height: 1.15;
}

.formato__subtitulo {
  margin: 8px 0 0;
  font-family: var(--titulos);
  font-size: 1.2rem;
  font-style: italic;
}

.formato__privacidad {
  margin: 16px 0 0;
  color: var(--onix-carbon);
  font-size: 0.9rem;
}

.panel {
  display: grid;
  gap: 20px;
}

.panel fieldset {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
  min-width: 0;
  margin: 0;
  padding: 20px 24px 24px;
  background: var(--blanco);
  border: 1px solid var(--lila-suave);
  border-radius: 12px;
}

.panel legend {
  padding: 0 8px;
  color: var(--purpura-profundo);
  font-family: var(--titulos);
  font-size: 1.15rem;
  font-style: italic;
}

.panel label,
.calculado {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  color: var(--onix-carbon);
  font-size: 0.85rem;
  font-weight: 500;
}

.ancho-doble {
  grid-column: 1 / -1;
}

.panel input,
.panel select,
.calculado output {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  background: var(--blanco);
  border: 1px solid var(--lavanda);
  border-radius: 8px;
  color: var(--onix-carbon);
  font-family: var(--textos);
  font-size: 1rem;
}

.panel input:focus-visible,
.panel select:focus-visible,
.boton:focus-visible,
.volver:focus-visible {
  outline: 2px solid var(--purpura-profundo);
  outline-offset: 2px;
}

.calculado output {
  display: flex;
  align-items: center;
  background: var(--papel);
  border-color: var(--piedra-calida);
}

.aviso {
  margin: 20px 0 0;
  padding: 14px 18px;
  background: var(--blanco);
  border: 2px solid var(--purpura-profundo);
  border-radius: 8px;
  color: var(--purpura-profundo);
  font-weight: 600;
}

.aviso--suave {
  border-width: 1px;
  font-weight: 500;
}

.acciones {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 36px;
}

.acciones h2 {
  margin: 0;
  color: var(--purpura-profundo);
  font-family: var(--titulos);
  font-size: 1.6rem;
  font-weight: 600;
}

.boton {
  min-height: 46px;
  padding: 10px 32px;
  background: var(--purpura-profundo);
  border: none;
  border-radius: 999px;
  color: var(--blanco);
  font-family: var(--textos);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.boton:hover {
  background: var(--lavanda);
}

.boton:disabled {
  background: var(--piedra-calida);
  color: var(--onix-carbon);
  cursor: not-allowed;
}

.documento-bloqueado {
  max-width: 836px;
  margin: 20px auto 64px;
  padding: 56px 32px;
  background: var(--blanco);
  border: 1px dashed var(--lavanda);
  border-radius: 8px;
  color: var(--purpura-profundo);
  text-align: center;
}

/* ------------------------------------------------------------
   Consentimiento (hoja)
   ------------------------------------------------------------ */
.hoja {
  width: calc(100% - 64px);
  max-width: 8.5in;
  margin: 20px auto 64px;
  padding: 0.6in;
  background: var(--blanco);
  border: 1px solid var(--piedra-calida);
  color: var(--onix-carbon);
  font-size: 10pt;
  line-height: 1.42;
}

.hoja__encabezado {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 12px;
}

/* En pantalla, 32 mm equivale a unos 120 px, el mínimo digital del manual */
.hoja__logo {
  flex: none;
  width: 32mm;
}

.hoja__logo img {
  display: block;
  width: 100%;
  height: auto;
}

.hoja__titulos {
  min-width: 0;
}

.hoja h1 {
  margin: 0 0 8px;
  font-family: var(--titulos);
  font-size: 14pt;
  font-weight: 600;
  line-height: 1.25;
}

.hoja .tabla-datos th:first-child,
.hoja .tabla-datos td:first-child {
  width: 37%;
}

.hoja .tabla-riesgos th:last-child,
.hoja .tabla-riesgos td:last-child {
  width: 27%;
}

.hoja h3 {
  margin: 13px 0 4px;
  font-family: var(--textos);
  font-size: 10.5pt;
  font-weight: 600;
}

.hoja p {
  margin: 0 0 7px;
}

.hoja strong {
  font-weight: 600;
}

.hoja ol,
.hoja ul {
  margin: 0 0 7px;
  padding-left: 20px;
}

.hoja li {
  margin-bottom: 3px;
}

.hoja table {
  width: 100%;
  margin: 4px 0 8px;
  border-collapse: collapse;
}

.hoja th,
.hoja td {
  padding: 4px 7px;
  border: 1px solid var(--onix-carbon);
  overflow-wrap: anywhere;
  text-align: left;
  vertical-align: top;
}

.hoja th {
  font-weight: 600;
}

.firmas {
  margin-top: 14px;
}

.firmas td {
  height: 13mm;
  vertical-align: middle;
}

.firmas th:first-child,
.firmas td:first-child {
  width: 33%;
}

.firmas th:nth-child(2),
.firmas td:nth-child(2) {
  width: 37%;
}

.fundamento {
  margin-top: 10px;
  font-size: 8.5pt;
}

/* ------------------------------------------------------------
   Celular
   ------------------------------------------------------------ */
@media (max-width: 640px) {
  .formato {
    padding: 28px 16px 0;
  }

  .panel fieldset {
    grid-template-columns: 1fr;
    padding: 16px 16px 20px;
  }

  .hoja {
    width: calc(100% - 32px);
    padding: 20px 16px;
    font-size: 0.85rem;
  }

  .hoja__encabezado {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .documento-bloqueado {
    margin: 20px 16px 48px;
  }
}

/* Casilla: dibujada con líneas para que se vea igual en cualquier impresora */
.casilla {
  position: relative;
  display: inline-block;
  width: 0.95em;
  height: 0.95em;
  border: 1px solid currentColor;
  vertical-align: -0.12em;
}

.conformidad {
  margin-top: 8px;
}

/* Casillas del panel */
.panel .opcion {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-height: 24px;
}

.panel .opcion input {
  flex: none;
  width: 20px;
  height: 20px;
  min-height: 0;
  padding: 0;
  accent-color: var(--purpura-profundo);
}

.panel input:disabled,
.panel select:disabled {
  background: var(--papel);
  opacity: 0.6;
}

.aviso--lista {
  white-space: pre-line;
}

/* Presupuesto: resumen y comparación de plazos en el panel */
.resumen {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 20px;
  margin: 20px 0 0;
  padding: 14px 18px;
  background: var(--purpura-profundo);
  border-radius: 8px;
  color: var(--blanco);
  font-weight: 500;
}

.resumen strong {
  font-weight: 600;
}

.comparacion {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  grid-column: 1 / -1;
}

.comparacion .opcion {
  padding: 12px 14px;
  border: 1px solid var(--lavanda);
  border-radius: 8px;
}

.comparacion .opcion:has(input:checked) {
  background: var(--lila-suave);
  border-color: var(--purpura-profundo);
}

/* Presupuesto: partes del documento */
.hoja h2 {
  margin: 12px 0 6px;
  font-family: var(--titulos);
  font-size: 13pt;
  font-weight: 600;
}

.hoja .lema-paquete {
  margin-bottom: 3px;
  font-style: italic;
}

.hoja .tabla-presupuesto th:first-child,
.hoja .tabla-presupuesto td:first-child {
  width: 24%;
}

.hoja .tabla-presupuesto th:last-child,
.hoja .tabla-presupuesto td:last-child {
  width: 18%;
  text-align: right;
}

.hoja .tabla-plan th:first-child,
.hoja .tabla-plan td:first-child {
  width: 33%;
}

.firma-final {
  margin-top: 28px;
}

/* Aviso dentro del panel */
.panel .aviso {
  grid-column: 1 / -1;
  margin: 0;
}

/* Texto que no debe partirse en dos renglones */
.sin-corte {
  white-space: nowrap;
}

/* Mensaje que solo existe en papel */
.solo-impresion {
  display: none;
}

/* ------------------------------------------------------------
   Hojas de impresión: tamaño carta, blanco y negro
   En pantalla están ocultas; ahí se miden para repartir el texto.
   ------------------------------------------------------------ */
@page {
  size: letter;
  margin: 11mm 14mm;
}

.impresion {
  position: absolute;
  top: 0;
  left: -10000px;
  width: 187.9mm;
  visibility: hidden;
  pointer-events: none;
}

.pagina {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 250mm;
}

/* ORIGINAL o COPIA, arriba a la derecha */
.pagina__copia {
  position: absolute;
  top: 0;
  right: 2pt;
  font-size: 8.5pt;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.pagina__contenido {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.pagina__pie {
  flex: none;
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px solid #000000;
  font-size: 8.5pt;
  text-align: center;
}

.impresion .hoja {
  width: auto;
  max-width: none;
  margin: 0;
  padding: 0 2pt 0 0; /* evita que se corte el borde derecho de las tablas */
  background: #ffffff;
  border: none;
  color: #000000;
  font-size: var(--letra);
  line-height: 1.27;
}

.impresion .hoja * {
  color: #000000;
}

.impresion .hoja__encabezado {
  flex-direction: row;
  align-items: center;
  gap: 6mm;
  margin-bottom: 6px;
}

/* El manual marca 25 mm como tamaño mínimo impreso */
.impresion .hoja__logo {
  width: 26mm;
}

.impresion .hoja h1 {
  margin-bottom: 4px;
  font-size: var(--letra-titulo);
}

.impresion .hoja p {
  margin-bottom: 4px;
}

.impresion .hoja ol,
.impresion .hoja ul {
  margin-bottom: 4px;
  padding-left: 16px;
}

.impresion .hoja li {
  margin-bottom: 1px;
}

.impresion .hoja h3 {
  margin: 7px 0 2px;
  font-size: var(--letra-seccion);
}

.impresion .hoja table {
  margin: 2px 0 5px;
}

.impresion .hoja th,
.impresion .hoja td {
  padding: var(--relleno-celda) 5px;
  border-color: #000000;
}

.impresion .firmas {
  margin-top: 7px;
}

.impresion .firmas td {
  height: var(--alto-firma);
}

.impresion .hoja h2 {
  margin: 8px 0 3px;
  font-size: var(--letra-titulo);
}

/* La firma va al final de la hoja, no a la mitad */
.pagina__contenido:has(> .firma-final) {
  display: flex;
  flex-direction: column;
}

.pagina__contenido:has(> .firma-final) > * {
  flex: none;
}

.impresion .firma-final {
  margin-top: auto;
  padding-top: 14px;
}

.impresion .fundamento {
  margin-top: 6px;
  font-size: var(--letra-fundamento);
}

/* ------------------------------------------------------------
   Hojas de cuidados: cálidas y fáciles de leer
   ------------------------------------------------------------ */
.iconos-definicion {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icono {
  flex: none;
  width: 1.2em;
  height: 1.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hoja__lema {
  font-family: var(--titulos);
  font-style: italic;
}

.cuidados__elige {
  padding: 40px 16px;
  color: var(--purpura-profundo);
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
}

.panel .campo-faltante {
  border: 3px solid var(--purpura-profundo);
  background: var(--lila-suave);
}

.cuidados h2 {
  margin: 14px 0 6px;
  font-size: 18pt;
}

.cuidados h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 5px;
  font-size: 12.5pt;
}

.cuidados__alerta {
  margin: 14px 0;
  padding: 2px 14px 8px;
  border: 3px solid currentColor;
  border-radius: 8px;
}

.cuidados__alerta h3 {
  margin-top: 8px;
}

.cuidados__alerta p {
  margin: 4px 0 0;
  font-weight: 600;
}

.letra-11 .impresion .hoja {
  line-height: 1.34;
}

.letra-11 .impresion .hoja h1 {
  margin-bottom: 2px;
  font-size: 13pt;
}

.letra-11 .impresion .hoja__lema {
  margin-bottom: 0;
  font-size: 12pt;
}

.letra-11 .impresion .hoja h2 {
  margin: 8px 0 3px;
  font-size: 18pt;
}

.letra-11 .impresion .hoja h3 {
  margin: 8px 0 3px;
}

.letra-11 .impresion .cuidados__saludo {
  margin-bottom: 6px;
}

.letra-11 .impresion .cuidados__alerta {
  margin: 9px 0;
  padding: 2px 11px 6px;
}

.letra-11 .impresion .cuidados__alerta h3 {
  margin-top: 5px;
}

.letra-11 .pagina__pie {
  text-align: center;
}

@media print {
  .barra,
  .formato,
  #documento {
    display: none !important;
  }

  html,
  body,
  .pagina-formato {
    min-height: 0;
    background: #ffffff;
    overflow: visible;
  }

  .impresion {
    position: static;
    visibility: visible;
  }

  .pagina__contenido {
    overflow: visible;
  }

  .pagina {
    break-after: page;
    page-break-after: always;
  }

  .pagina:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  /* Si el formato no se puede imprimir, en papel sale solo el motivo */
  .documento-bloqueado,
  .solo-impresion {
    display: block;
    margin: 40mm 0 0;
    padding: 0;
    border: none;
    color: #000000;
  }
}
