/* =========================================================
   GAP Broker — modules.css
   Modal + las 3 herramientas (cotizador, guía de siniestros,
   comparador) revestidas con la paleta nueva: todo en tonos claros,
   sin overlays oscuros. La única excepción de rojo fuerte es el
   bloque de emergencia del 911 (información de seguridad real).
   La lógica no cambia: estas reglas visten las mismas clases que ya
   emiten cotizador.js / siniestros.js / comparador.js.
   ========================================================= */

/* ===================== MODAL ===================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 20px;
  overflow-y: auto;
  background: rgba(28, 60, 110, .32);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.modal.open { display: flex; }

.modal__panel {
  width: 100%;
  max-width: 640px;
  margin: auto;
  background: #fff;
  border-radius: var(--r-lg);
  box-shadow: 0 40px 90px rgba(13, 47, 94, .32);
  overflow: hidden;
}
@media (min-width: 601px) {
  /* El comparador necesita más ancho: la tabla es cobertura x plan */
  .modal__panel.modal__panel--wide { max-width: 860px; }
}

.modal__bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 26px;
  border-bottom: 1px solid var(--line-soft);
  background: #f7fafd;
}
.modal__title {
  flex: 1;
  font-size: 19px;
  font-weight: 700;
  color: var(--deep);
}
/* 44px es el mínimo táctil recomendado, y estos dos son los únicos
   controles para salir de una herramienta en celular: a 36px se erraba. */
.modal__back, .modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 1px solid #dbe4ef;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.modal__back { color: var(--deep); }
.modal__close { color: var(--muted); }
.modal__back svg, .modal__close svg { width: 18px; height: 18px; }
.modal__back:hover { background: var(--tint); border-color: var(--blue); }
.modal__close:hover { background: var(--tint); color: var(--deep); }
.modal__back[hidden] { display: none; }

.progress {
  height: 7px;
  margin: 20px 26px 0;
  background: #e9eff6;
  border-radius: 99px;
  overflow: hidden;
}
.progress[hidden] { display: none; }
.progress__fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--gold), var(--gold-soft));
  border-radius: 99px;
}

.modal__body {
  padding: 26px;
  max-height: 68vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal__foot { padding: 0 26px 26px; display: flex; flex-direction: column; gap: 10px; }
.modal__foot[hidden] { display: none; }

@media (max-width: 600px) {
  .modal { padding: 0; }
  .modal__panel { max-width: none; min-height: 100%; border-radius: 0; }
  .modal__body { max-height: none; padding: 22px; }
  .modal__foot { padding: 0 22px 22px; }
  .progress { margin-inline: 22px; }
}

/* ===================== UI compartida de herramientas ===================== */
.t-steplabel {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--blue);
}
.t-q {
  font-size: 21px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--deep);
  margin: 10px 0 6px;
  text-wrap: balance;
}
.t-q--lg { font-size: 22px; }
.t-q .help { margin-left: 8px; }
.t-hint { color: var(--muted); font-size: 15px; line-height: 1.55; margin: 0 0 22px; }
/* Cuando la pregunta no lleva párrafo de ayuda, el control necesita aire */
.t-q + .t-input,
.t-q + .choice-grid,
.t-q + .opt-list,
.t-q + .t-fields { margin-top: 18px; }

/* Opciones tipo tarjeta (ramo, tipo de siniestro) */
.opt-list { display: flex; flex-direction: column; gap: 12px; }
.opt {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  text-align: left;
  padding: 18px 20px;
  border: 1.5px solid var(--line-card);
  border-radius: 14px;
  background: var(--card-soft);
  font-family: inherit;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
}
.opt:hover { border-color: var(--blue); background: var(--tint); }
.opt__num {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: rgba(28, 90, 166, .10);
  color: var(--deep);
  font-size: 13px;
  font-weight: 700;
}
.opt__body { flex: 1; }
.opt__body b { display: block; font-size: 17px; font-weight: 700; color: var(--deep); }
.opt__body small { font-size: 14px; color: var(--muted); }
.opt__arrow { color: var(--blue); font-size: 18px; flex-shrink: 0; }

/* Opciones binarias */
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice-btn {
  padding: 17px 20px;
  border: 1.5px solid var(--line-card);
  border-radius: 13px;
  background: var(--card-soft);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--deep);
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
}
.choice-btn:hover { border-color: var(--blue); background: var(--tint); }
.choice-btn--danger { border-color: #f3c9c5; background: #fdf3f2; color: var(--red); font-weight: 700; }
.choice-btn--danger:hover { border-color: var(--red); background: #fdeceb; }

/* Inputs */
.t-input {
  width: 100%;
  padding: 15px 18px;
  font-family: inherit;
  font-size: 17px;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid #d7e0ec;
  border-radius: 12px;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.t-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(28, 90, 166, .12); }
.t-error { color: var(--red); font-size: 14px; font-weight: 600; margin-top: 10px; }

.t-fields { display: flex; flex-direction: column; gap: 14px; }
.t-field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.t-field .t-input { font-size: 16px; padding: 14px 16px; border-radius: 11px; }

/* Botones del pie del modal */
.t-next {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 12px;
  background: var(--deep);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s ease;
}
.t-next:hover { background: var(--blue); }

.t-wa {
  display: block;
  width: 100%;
  padding: 15px;
  border-radius: 12px;
  background: var(--wa);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  transition: background .2s ease;
}
.t-wa:hover { background: var(--wa-h); }

.t-footlink {
  width: 100%;
  background: none;
  border: none;
  padding: 6px 0 0;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--blue);
  cursor: pointer;
}
.t-footlink:hover { color: var(--deep); }

/* Botones dentro del comparador */
.btn--primary {
  background: var(--deep);
  color: #fff;
  padding: 13px 18px;
  font-size: 15px;
  border-radius: 11px;
}
.btn--primary:hover { background: var(--blue); }
.btn--block { width: 100%; }

/* ===================== COTIZADOR: pantalla final ===================== */
.cz-final { text-align: center; }
.cz-check {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(37, 163, 90, .12);
  color: var(--wa);
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
}
.cz-check svg { width: 34px; height: 34px; }
.cz-final__title { font-size: 22px; font-weight: 700; color: var(--deep); margin: 0 0 6px; }
.cz-final__p { color: var(--muted); font-size: 15px; line-height: 1.6; margin: 0 0 22px; }

.cz-summary {
  background: #f7fafd;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 20px;
  text-align: left;
}
.cz-sumrow {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.cz-sumrow:last-child { border-bottom: none; }
.cz-sumrow span { color: var(--muted); }
.cz-sumrow b { color: var(--ink); text-align: right; }

/* ===================== GUÍA DE SINIESTROS ===================== */
.sn-intro { text-align: center; padding: 6px 0; }
.sn-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--deep);
  color: #fff;
  display: grid;
  place-items: center;
  margin: 0 auto 20px;
}
.sn-icon svg { width: 30px; height: 30px; }
.sn-intro__title { font-size: 22px; font-weight: 700; color: var(--deep); margin: 0 0 8px; }
.sn-intro__p { color: var(--muted); font-size: 16px; line-height: 1.6; margin: 0 0 16px; }

/* Chips con glosas del intro ("¿Qué es un siniestro?" / "¿Qué es denunciar?") */
.sn-chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 0 0 24px; }
.sn-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--tint);
  border: 1px solid var(--line-card);
  border-radius: 99px;
  padding: 7px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--deep);
}

.sn-emergency {
  background: #fdeceb;
  border: 1.5px solid #f0b6b1;
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 22px;
}
.sn-emergency b { color: #c62828; font-size: 15px; display: inline-flex; align-items: center; gap: 8px; }
.sn-emergency p { color: #8a3b36; font-size: 14px; line-height: 1.55; margin: 6px 0 14px; }
.sn-emergency a {
  display: inline-block;
  background: #d32f2f;
  color: #fff;
  font-weight: 800;
  font-size: 17px;
  padding: 13px 24px;
  border-radius: 10px;
  text-decoration: none;
}
.sn-emergency a:hover { background: #b71c1c; }

.sn-steps { display: flex; flex-direction: column; gap: 16px; }
.sn-step { display: flex; gap: 14px; }
.sn-step__num {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--deep);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
}
.sn-step__body b { font-size: 15.5px; color: var(--ink); }
.sn-step__body p { font-size: 14px; line-height: 1.6; color: var(--muted); margin: 5px 0 0; }
.sn-docs {
  background: #f7fafd;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 24px;
  margin-top: 24px;
}
.sn-docs b {
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--deep);
}
.sn-docs ul { list-style: none; display: flex; flex-direction: column; gap: 9px; margin: 12px 0 0; padding: 0; }
.sn-docs li { font-size: 15px; color: var(--ink); }
.sn-docs li::before { content: '✓ '; color: var(--blue); font-weight: 700; }

.sn-calls { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.sn-calls a {
  text-align: center;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 14px;
  border-radius: 12px;
  text-decoration: none;
}
.sn-calls a:only-child { grid-column: 1 / -1; }
.sn-calls .is-broker { background: var(--deep); }
.sn-calls .is-broker:hover { background: var(--blue); }
.sn-calls .is-wa { background: var(--wa); }
.sn-calls .is-wa:hover { background: var(--wa-h); }
.sn-note { text-align: center; color: var(--muted); font-size: 13px; margin-top: 14px; }

/* ===================== COMPARADOR ===================== */
.cmp-intro { color: var(--muted); font-size: 15px; line-height: 1.6; margin: 0 0 20px; }
.cmp-needs {
  background: #f7fafd;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 22px;
  margin-bottom: 20px;
}
.cmp-needs > b { font-size: 15px; font-weight: 700; color: var(--deep); }
.cmp-checks { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.cmp-check {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 4px;
  cursor: pointer;
  font-size: 15px;
  color: var(--ink);
}
.cmp-check input { width: 18px; height: 18px; accent-color: var(--blue); cursor: pointer; flex: 0 0 auto; }

.cmp-status {
  font-size: 14px;
  font-weight: 600;
  color: var(--blue);
  background: #f0f6fd;
  border-radius: 10px;
  padding: 13px 18px;
  margin-bottom: 20px;
  line-height: 1.5;
}

.cmp-badge {
  display: inline-block;
  background: var(--gold);
  color: #1a2233;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 3px 9px;
  border-radius: 99px;
  margin-bottom: 8px;
}
.cmp-badge--ghost { visibility: hidden; }

/* Glosas "?" */
.help {
  display: inline-grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  border: 1.5px solid #c4d2e4;
  background: #fff;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  cursor: help;
  flex: 0 0 auto;
  position: relative;
  vertical-align: middle;
}
.cmp-check .help { margin-left: auto; }
.cmp-table .cov .help { margin-left: 6px; }
.help:hover .tip, .help:focus .tip, .help:focus-visible .tip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.tip {
  position: absolute;
  bottom: calc(100% + 10px);
  right: -6px;
  width: min(250px, 68vw);
  background: var(--deep);
  color: #eaf2fc;
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.45;
  text-align: left;
  padding: 11px 13px;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(13, 47, 94, .3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
  z-index: 20;
  cursor: auto;
}
.tip::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 12px;
  border: 6px solid transparent;
  border-top-color: var(--deep);
}
.cmp-table .cov .help .tip { left: 0; right: auto; }
.cmp-table .cov .help .tip::after { left: 12px; right: auto; }

/* Tabla cobertura x plan */
/* El sangrado negativo tiene que coincidir con el padding del
   .modal__body, que en celular baja de 26px a 22px. Con -26px fijo la
   tabla se pasaba 4px de cada lado y .modal__panel se los comía. */
.cmp-table-wrap {
  --cmp-sangria: 26px;
  position: relative;
  overflow-x: auto;
  margin-inline: calc(var(--cmp-sangria) * -1);
  padding-inline: var(--cmp-sangria);
  -webkit-overflow-scrolling: touch;
  /* Sombra al borde derecho mientras quede tabla por ver: sin esto, en
     celular se ven 1 de los 3 planes y nada indica que se puede deslizar. */
  background:
    linear-gradient(to right, #fff 30%, rgba(255,255,255,0)) left center / 40px 100% no-repeat,
    linear-gradient(to left,  #fff 30%, rgba(255,255,255,0)) right center / 40px 100% no-repeat,
    radial-gradient(farthest-side at 0 50%, rgba(13,47,94,.14), transparent) left center / 14px 100% no-repeat,
    radial-gradient(farthest-side at 100% 50%, rgba(13,47,94,.14), transparent) right center / 14px 100% no-repeat;
  background-attachment: local, local, scroll, scroll;
}
.cmp-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 560px; }
.cmp-table th, .cmp-table td {
  padding: 12px;
  text-align: center;
  border-bottom: 1px solid var(--line-card);
}
/* Sticky solo donde el .modal__body realmente limita el alto (>600px):
   en celular pasa a max-height:none y el encabezado no tenía a qué pegarse. */
.cmp-table thead th { background: #fff; }
@media (min-width: 601px) {
  .cmp-table thead th { position: sticky; top: 0; }
}
.cmp-table th.cov, .cmp-table td.cov {
  text-align: left;
  font-weight: 500;
  color: var(--ink);
  white-space: normal;
}
.cmp-table .plan-head { padding-bottom: 16px; }
.cmp-table .plan-head .pname { display: block; font-size: 16px; font-weight: 700; color: var(--deep); }
.cmp-table .plan-head .ptag { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.cmp-table tbody tr.row-active td { background: #f0f6fd; }
.cmp-yes { color: var(--blue); }
.cmp-no { color: #cfd9e6; }
.cmp-yes svg, .cmp-no svg { width: 18px; height: 18px; margin: 0 auto; }
.cmp-table [data-col].col-dim { opacity: .35; }
.cmp-table thead th.col-match { box-shadow: inset 0 0 0 2px var(--blue); border-radius: 10px 10px 0 0; }
.cmp-table td.col-match { box-shadow: inset 2px 0 0 var(--blue), inset -2px 0 0 var(--blue); }
.cmp-table tr.last-row td.col-match {
  box-shadow: inset 2px 0 0 var(--blue), inset -2px 0 0 var(--blue), inset 0 -2px 0 var(--blue);
}
.cmp-table .cmp-foot-row td { border-bottom: none; padding-top: 16px; }

/* El sangrado del comparador tiene que ir al final del archivo: la regla
   base de .cmp-table-wrap está más abajo que el @media del modal, así que
   un override puesto allá arriba perdía por orden de cascada (misma
   especificidad, gana el último). En celular el .modal__body baja de 26px
   a 22px de padding y la tabla tiene que acompañar, o se pasa 4px de cada
   lado y .modal__panel se los come. */
@media (max-width: 600px) {
  .cmp-table-wrap { --cmp-sangria: 22px; }
}
