/* ===========================================================================
   MapfreNext — estilos comunes de los cotizadores
   (misma línea visual que el cotizador de Vida)
   =========================================================================== */

@font-face {
  font-family: 'Mapfre Text';
  src: url('../font/MapfreText-400-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root{
  --rojo:        #df0027;
  --rojo-oscuro: #b8001f;
  --rojo-suave:  #fdeef1;
  --texto:       #1a1a1a;
  --suave:       #6b7280;
  --borde:       #e2e5e9;
  --bg:          #f4f5f7;
  --panel:       #fff;
  --ok:          #0f7b52;
  --ok-suave:    #eaf6f0;
  --info-suave:  #f3f4f6;
  --radio:       10px;
  --fuente: 'Mapfre Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

*{ box-sizing: border-box }
[hidden]{ display: none !important }

body{
  margin: 0;
  background: var(--bg);
  color: var(--texto);
  font: 15px/1.5 var(--fuente);
}

/* --- encabezado y navegación --------------------------------------------- */
.app-header{ background: var(--rojo); color: #fff }
.app-header__inner{
  max-width: 1400px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 24px;
}
.marca{ margin-right: auto }
.marca__nombre{ font-size: 19px; font-weight: 700; line-height: 1.2; letter-spacing: .01em }
.marca__sub{ font-size: 12.5px; opacity: .92; margin-top: 1px }
.marca__logo{ height: 28px; width: auto; display: block; flex: none }

.app-nav{ background: var(--panel); border-bottom: 1px solid var(--borde) }
.app-nav__inner{ max-width: 1400px; margin: 0 auto; padding: 0 24px; display: flex; gap: 4px }
.app-nav a{
  display: block; padding: 12px 14px; font-size: 14px; text-decoration: none;
  color: var(--suave); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.app-nav a:hover{ color: var(--texto) }
.app-nav a.actual{ color: var(--rojo); font-weight: 700; border-bottom-color: var(--rojo) }

/* --- contenedores -------------------------------------------------------- */
.contenedor{ max-width: 1400px; margin: 0 auto; padding: 24px }

/* Dos columnas: formulario a la izquierda, documento a la derecha. */
.contenedor.dos-columnas{
  display: grid; grid-template-columns: 440px minmax(0, 1fr); gap: 24px; align-items: start;
}
.dos-columnas > .columna-resultado{ position: sticky; top: 16px }
@media (max-width: 1100px){
  .contenedor.dos-columnas{ grid-template-columns: 1fr }
  .dos-columnas > .columna-resultado{ position: static }
}

.panel{
  background: var(--panel); border: 1px solid var(--borde);
  border-radius: var(--radio); padding: 20px;
}
.panel h2{
  margin: 0 0 14px; font-size: 13px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--suave);
}
.panel h2.sep{ margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--borde) }

/* --- formularios --------------------------------------------------------- */
.campo{ display: block; margin-bottom: 13px; font-size: 13px; color: var(--suave) }
.campo > span{ display: block; margin-bottom: 5px; color: var(--texto) }
.campo > span .opcional{ color: var(--suave); font-size: 12px }
.campo > .opciones{ display: inline-flex; margin: 0 }
.campo > .opciones label{ padding: 10px 18px; font-size: 14px }
.campo input, .campo select, .campo textarea{
  width: 100%; padding: 9px 10px; border: 1px solid var(--borde);
  border-radius: 7px; font: inherit; font-size: 14px; background: #fff; color: var(--texto);
}
.campo textarea{ resize: vertical; min-height: 110px }
.campo input:focus, .campo select:focus, .campo textarea:focus{
  outline: 2px solid var(--rojo); outline-offset: -1px; border-color: var(--rojo);
}
.campo.invalido input, .campo.invalido select, .campo.invalido textarea{ border-color: var(--rojo); background: var(--rojo-suave) }
.campo .ayuda{ display: block; margin-top: 4px; font-size: 12px; color: var(--suave) }
.fila{ display: grid; grid-template-columns: 1fr 1fr; gap: 12px }
.fila > .campo{ min-width: 0 }

/* Sí / No como botones pegados */
.si-no{ display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 11px; font-size: 14px }
.si-no > span{ color: var(--texto) }
.opciones{ display: inline-flex; border: 1px solid var(--borde); border-radius: 7px; overflow: hidden; flex: none }
.opciones input{ position: absolute; opacity: 0; pointer-events: none }
.opciones label{ padding: 6px 16px; font-size: 13px; cursor: pointer; color: var(--suave); background: #fff; user-select: none }
.opciones label + input + label{ border-left: 1px solid var(--borde) }
.opciones input:checked + label{ background: var(--rojo); color: #fff; font-weight: 700 }
.opciones input:focus-visible + label{ outline: 2px solid var(--rojo); outline-offset: -2px }
.desplegable{ margin: -3px 0 14px; padding: 12px 12px 1px; background: var(--info-suave); border-radius: 8px }

.nota{
  padding: 10px 12px; border-radius: 7px; background: var(--info-suave);
  font-size: 12px; line-height: 1.45; color: #374151; margin-bottom: 14px;
}
.nota p{ margin: 0 0 4px }
.nota p:last-child{ margin: 0 }

/* --- botones ------------------------------------------------------------- */
button, .boton{
  padding: 14px 22px; border: 0; border-radius: 50px; background: var(--rojo);
  color: #fff; font: inherit; font-weight: 700; line-height: 1; cursor: pointer;
  text-decoration: none; display: inline-block; text-align: center;
}
button:hover, .boton:hover{ background: var(--rojo-oscuro) }
button:disabled{ opacity: .5; cursor: not-allowed }
button:disabled:hover{ background: var(--rojo) }
button.secundario, .boton.secundario{
  background: #fff; color: var(--texto); border: 1px solid var(--borde); font-weight: 400;
}
button.secundario:hover, .boton.secundario:hover{ border-color: var(--rojo); color: var(--rojo); background: #fff }
.acciones{ display: flex; flex-direction: column; gap: 10px; margin-top: 18px }
.acciones button{ width: 100% }

/* --- avisos: sólo se ven cuando tienen texto ----------------------------- */
.aviso{
  padding: 11px 13px; border-radius: 7px; font-size: 13px; margin: 14px 0 0;
  border: 1px solid transparent;
}
.aviso:empty{ display: none }
.aviso.error{ background: var(--rojo-suave); color: var(--rojo); border-color: #f6c9d1 }
.aviso.ok{ background: var(--ok-suave); color: var(--ok); border-color: #bfe3d1 }
.aviso ul{ margin: 4px 0 0; padding-left: 18px }

/* --- documento ----------------------------------------------------------- */
.doc-barra{ display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap }
.doc-barra .titulo{ font-size: 13px; color: var(--suave); margin-right: auto }
.doc-barra .titulo b{ color: var(--texto) }
.doc-barra button, .doc-barra .boton{ padding: 10px 20px; font-size: 13px }
.marco{ border: 1px solid var(--borde); border-radius: var(--radio); overflow: auto; background: #fff; position: relative }
/* En dos columnas el documento se desplaza dentro de su marco, así la barra
   con Imprimir / Guardar queda siempre a la vista. */
.dos-columnas .marco{ max-height: calc(100vh - 110px) }
@media (max-width: 1100px){ .dos-columnas .marco{ max-height: none } }
.marco iframe{ display: block; border: 0; width: 100%; min-width: 760px; min-height: 420px; background: #fff }
.desactualizado .marco iframe{ opacity: .35; filter: grayscale(1) }
.vacio{ color: var(--suave); text-align: center; padding: 70px 20px }

/* --- cargando ------------------------------------------------------------ */
.con-carga{ position: relative }
.carga{
  position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px;
  background: rgba(255,255,255,.78); border-radius: var(--radio);
  font-size: 13px; color: var(--suave);
}
.carga img{ width: 32px; height: 32px }
/* Cuando el panel es alto, el cartel queda arriba y no en la mitad de la página. */
.carga.arriba{ justify-content: flex-start; padding-top: 120px }

/* --- tablas -------------------------------------------------------------- */
table.listado{ width: 100%; border-collapse: collapse; font-size: 13px }
.listado th, .listado td{ padding: 9px 10px; border-bottom: 1px solid var(--borde); text-align: left; font-variant-numeric: tabular-nums }
.listado th{ font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--suave); font-weight: 700; background: #fafbfc; white-space: nowrap }
.listado th a{ color: inherit; text-decoration: none }
.listado th a:hover{ color: var(--rojo) }
.listado td.num, .listado th.num{ text-align: right }
.listado tbody tr:hover{ background: #fafbfc }
.listado a.accion{ color: var(--rojo); font-weight: 700; text-decoration: none }
.listado a.accion:hover{ text-decoration: underline }
.estado-ok{ color: var(--ok); font-weight: 700 }
.scroll{ overflow-x: auto; border: 1px solid var(--borde); border-radius: var(--radio); background: #fff }

/* --- barra de búsqueda --------------------------------------------------- */
.barra{ display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap }
.barra input[type="search"]{
  flex: 1; min-width: 240px; padding: 10px 12px; border: 1px solid var(--borde);
  border-radius: 7px; font: inherit; font-size: 14px; background: #fff;
}
.barra input[type="search"]:focus{ outline: 2px solid var(--rojo); outline-offset: -1px; border-color: var(--rojo) }
.barra button, .barra .boton{ padding: 11px 24px; font-size: 14px }
.barra .derecha{ margin-left: auto; font-size: 13px; color: var(--suave) }

/* --- visor de documentos ------------------------------------------------- */
dialog.visor{
  border: 0; border-radius: var(--radio); padding: 0; width: min(960px, 94vw);
  box-shadow: 0 12px 48px rgba(0,0,0,.28);
}
dialog.visor::backdrop{ background: rgba(0,0,0,.45) }
.visor-barra{ display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--borde) }
.visor-barra .titulo{ font-weight: 700; margin-right: auto; font-size: 14px }
.visor-barra button{ padding: 9px 18px; font-size: 13px }
dialog.visor .aviso{ margin: 12px 16px 0 }
.visor-cuerpo{ position: relative; min-height: 300px }
.visor-cuerpo iframe{ display: block; border: 0; width: 100%; height: 78vh; background: #fff }
.listado td.acciones-doc{ white-space: nowrap }
.listado td.acciones-doc a{ margin-right: 12px }
