/* TPApp v3.0 - modules.css: cotizadores (vida/sepelio) y administración */

/* Selector de suma asegurada (slider que engancha en los valores de la tabla) */
.suma-picker { display: flex; flex-direction: column; gap: .85rem; }
.suma-display {
  text-align: center;
  font-family: 'Sora', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: .3px;
  min-height: 32px;
}
.suma-controls { display: flex; align-items: center; gap: .75rem; }
.suma-step {
  flex: 0 0 auto;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 22px; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.suma-step:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.suma-step:disabled { opacity: .35; cursor: not-allowed; }
.suma-range {
  flex: 1 1 auto;
  -webkit-appearance: none; appearance: none;
  height: 6px; border-radius: 999px;
  background: var(--border);
  cursor: pointer;
}
.suma-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary);
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
  cursor: pointer;
}
.suma-range::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary);
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
  cursor: pointer;
}
.suma-range:disabled { opacity: .5; cursor: not-allowed; }
.suma-bounds {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--muted, #6b7280);
  padding: 0 2px;
}

/* Botones de opción (edad, sexo) */
.opt-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.opt-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; }
@media (max-width: 320px) { .opt-grid-4 { grid-template-columns: repeat(3, 1fr); } }

.opt-btn {
  border: 1.5px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  border-radius: 10px;
  padding: .6rem .4rem;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  font-family: 'DM Sans', sans-serif;
  text-align: center;
  width: 100%;
  min-height: 44px;
}
.opt-btn.sel { border-color: var(--primary); background: var(--primary); color: #fff; }
.opt-btn:hover:not(.sel) { border-color: var(--primary-light); color: var(--primary); }

/* Botón calcular/continuar */
.btn-continuar {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: .95rem;
  font-size: 16px;
  font-weight: 600;
  font-family: 'Sora', sans-serif;
  cursor: pointer;
  transition: background .2s;
  margin-top: .25rem;
  min-height: 48px;
}
.btn-continuar:hover:not(:disabled) { background: var(--primary-light); }
.btn-continuar:disabled { background: #9ca3af; cursor: not-allowed; }

/* Adicionales con toggle switch */
.adicional-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 0;
  border-bottom: 0.5px solid var(--border);
}
.adicional-item:last-child { border-bottom: none; }
.adic-info { flex: 1; padding-right: .75rem; }
.adic-info h4 { font-size: 14px; font-weight: 500; margin-bottom: 2px; }
.adic-info p { font-size: 12px; color: var(--muted); }

/* Acumulación de suma asegurada: cuánto suma cada cobertura a la exposición
   total del asegurado (no es lo mismo que su suma asegurada). */
.adic-acum { font-size: 11px; opacity: .75; margin-top: 1px; }
.detalle-row.acum-excede { color: #dc2626; font-weight: 600; }

.toggle { position: relative; width: 44px; height: 24px; cursor: pointer; flex-shrink: 0; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track { position: absolute; inset: 0; background: #d1d5db; border-radius: 24px; transition: .2s; cursor: pointer; }
.toggle input:checked + .toggle-track { background: var(--primary); }
.toggle-thumb {
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .2s;
  pointer-events: none;
}
.toggle input:checked ~ .toggle-thumb { transform: translateX(20px); }

/* Detalle del premio */
.detalle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .55rem 0;
  border-bottom: 0.5px solid var(--border);
  font-size: 13px;
  gap: .5rem;
}
.detalle-row:last-child { border-bottom: none; font-size: 14px; }
.detalle-row span:last-child { text-align: right; font-weight: 500; white-space: nowrap; }
.detalle-row.total {
  border-top: 1.5px solid var(--border);
  padding-top: .6rem;
  margin-top: .25rem;
  border-bottom: none;
}

/* Box de resultado: azul marino con precio dorado */
.resultado-box {
  background: var(--primary);
  border-radius: 16px;
  padding: 1.75rem 1.25rem;
  color: #fff;
  text-align: center;
}
.resultado-box .label { font-size: 13px; opacity: .8; margin-bottom: .3rem; }
.resultado-box .valor {
  font-size: 40px;
  font-weight: 700;
  font-family: 'Sora', sans-serif;
  color: var(--accent);
  line-height: 1;
}
.resultado-box .sub { font-size: 12px; opacity: .65; margin-top: .5rem; }

/* Placeholder "en desarrollo" (Sepelio) */
.coming-soon { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.coming-soon .cs-icon { font-size: 52px; margin-bottom: 1rem; }
.coming-soon h3 { font-size: 18px; color: var(--text); margin-bottom: .5rem; }
.coming-soon p { font-size: 14px; margin-top: .5rem; }

/* Input numérico (edad titular / edad integrante) */
.tp-num-input {
  width: 100%;
  border: 1.5px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  border-radius: 10px;
  padding: .7rem .8rem;
  font-size: 16px;
  font-family: 'DM Sans', sans-serif;
  min-height: 44px;
}
.tp-num-input:focus { outline: none; border-color: var(--primary); }

/* iOS no respeta la altura del input date y lo colapsa si no se le fija el
   display; sin esto el campo queda más bajo que el resto de los inputs. */
.tp-num-input[type="date"] { display: block; -webkit-appearance: none; appearance: none; }

/* Edad calculada a partir de la fecha de nacimiento (cotizador de Vida) */
.edad-calc { font-size: 13px; color: var(--muted); margin-top: .55rem; }
.edad-calc.ok { color: var(--text); font-weight: 600; }
.edad-calc.err { color: var(--danger); }

/* Botones de opción con subtítulo (tarifa de sepelio) */
.opt-btn small { font-size: 11px; opacity: .7; font-weight: 400; }
.opt-btn.sel small { opacity: .85; }

/* Alta de integrantes (sepelio) */
.sep-add-row { display: flex; gap: .5rem; align-items: stretch; }
.sep-add-row .tp-num-input { flex: 1; }
.sep-add-btn { width: auto; margin-top: 0; padding: .7rem 1.1rem; white-space: nowrap; }
.hint-text { font-size: 13px; color: var(--muted); padding: .5rem 0; text-align: center; }

/* Exportar cotización: acciones y ayudas del modal */
.export-actions { display: flex; flex-direction: column; gap: .5rem; margin-top: 1rem; }
.btn-sec {
  width: 100%;
  background: var(--input-bg);
  color: var(--primary);
  border: 1.5px solid var(--primary);
  border-radius: 12px;
  padding: .85rem;
  font-size: 15px;
  font-weight: 600;
  font-family: 'Sora', sans-serif;
  cursor: pointer;
  transition: all .15s;
  min-height: 46px;
}
.btn-sec:hover:not(:disabled) { background: var(--primary); color: #fff; }
.btn-sec:disabled { opacity: .5; cursor: not-allowed; }
/* Estado "bloqueado": el envío por email requiere el email de la persona.
   Se marca en rojo para que se entienda por qué no se puede tocar todavía. */
.btn-sec.blocked {
  color: var(--danger);
  border-color: var(--danger);
  background: #fef2f2;
  opacity: 1;
  cursor: not-allowed;
}
.btn-sec.blocked:hover { background: #fef2f2; color: var(--danger); }
#exp-enviar-help.blocked { color: var(--danger); }
.field-help { font-size: 12px; color: var(--muted); margin: .1rem 0 .4rem; line-height: 1.4; }
.opt-tag { color: var(--muted); font-weight: 400; font-size: .85em; }

/* Botón Exportar en el pie del resultado */
.btn-continuar.outline-gold {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-continuar.outline-gold:hover:not(:disabled) { background: var(--primary); color: #fff; }

/* Escenario donde se arma el PDF antes de capturarlo con html2canvas.
   En reposo queda con display:none (no ocupa layout, no se pinta).
   Solo durante la generación (clase .rendering, agregada desde
   cotizacion.js justo antes de capturar) se muestra DENTRO del viewport
   real (fixed, top:0/left:0), tapado por #pdf-stage-cover encima.

   Antes se sacaba de pantalla con left:-10000px (position:absolute) para
   evitar que html2canvas desplazara la captura por scroll residual. Ese
   bug no vuelve (acá no se toca el scroll para nada), pero apareció uno
   nuevo y más grave en iPhone 13 (no en iPhone 16 Pro Max ni en Chrome
   desktop responsive): Safari no llega a pintar por completo un elemento
   ubicado tan lejos del viewport visible — rasteriza por tiles y en
   equipos con menos memoria no completa el pintado de contenido lejano
   antes de que html2canvas lo capture. El PDF salía con el tramo final
   del template (total, asesor, pie) y faltaba todo lo de arriba.
   Manteniéndolo dentro del viewport real (aunque tapado visualmente),
   Safari lo trata como contenido visible normal y lo pinta entero. */
#pdf-stage-cover {
  display: none;
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 99998;
}
#pdf-stage {
  display: none;
  background: #fff;
}
#pdf-stage-cover.rendering { display: block; }
#pdf-stage.rendering {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  width: 794px;      /* ~A4 a 96dpi */
  z-index: 99999;
}

/* Fila de integrante con botón quitar */
.sep-row-right { display: inline-flex; align-items: center; gap: .5rem; }
.sep-del {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: .25rem .4rem;
  border-radius: 6px;
}
.sep-del:hover { color: #dc2626; background: rgba(220, 38, 38, .1); }

/* ADMINISTRACIÓN: buscador */
.admin-search { margin-bottom: .75rem; }
.admin-search input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .7rem .9rem;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
}
.admin-search input:focus { outline: none; border-color: var(--primary); }

/* ADMINISTRACIÓN: contadores que funcionan como filtros */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .5rem;
  margin-bottom: 1rem;
}
.stat-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .6rem .7rem;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  font-family: 'DM Sans', sans-serif;
  text-align: left;
}
.stat-chip:hover { border-color: var(--primary-light); }
.stat-chip.active { border-color: var(--primary); background: var(--primary); }
.stat-chip.active .stat-num,
.stat-chip.active .stat-lbl { color: #fff; }
.stat-num { font-size: 20px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-lbl { font-size: 11px; color: var(--muted); }
@media (max-width: 420px) {
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
}

/* Badges de estado de la cuenta */
.b-pend { background: #fef3c7; color: #92400e; }
.b-aprob { background: #d1fae5; color: #065f46; }
.b-rech { background: #fee2e2; color: #991b1b; }

/* ADMINISTRACIÓN: cards de usuario */
.user-card {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .75rem;
  padding: .875rem;
  background: var(--bg);
  border-radius: 10px;
  margin-bottom: .5rem;
}
.user-card:last-child { margin-bottom: 0; }
.user-avatar {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Sora', sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-info h4 { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info p { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.b-admin { background: #dbeafe; color: #1d4ed8; }
.b-promo { background: #d1fae5; color: #065f46; }
.b-user  { background: #f3f4f6; color: #374151; }
/* Cuenta todavía sin rol asignado (perfil 0) */
.b-sin   { background: transparent; color: var(--muted); border: 1px dashed var(--border); }

.key-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  font-size: 12px;
  cursor: pointer;
  color: var(--muted);
  flex-shrink: 0;
  white-space: nowrap;
  min-height: 44px;
}
.key-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== PRESTADORES: verificación de cobertura ===== */

/* Toggle segmentado DNI / Póliza */
.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .4rem;
  background: var(--bg);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 1rem;
}
.seg-btn {
  border: none;
  background: transparent;
  border-radius: 8px;
  padding: .6rem;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  color: var(--muted);
  transition: all .15s;
  min-height: 44px;
}
.seg-btn.sel { background: var(--primary); color: #fff; font-weight: 500; }

/* Ícono grande decorativo arriba de la card de búsqueda */
.pr-search-icon {
  width: 64px;
  height: 64px;
  margin: .25rem auto 0;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 6px 16px rgba(27, 58, 107, 0.25);
}

.card-subtitle { font-size: 13px; color: var(--muted); line-height: 1.4; margin: -.5rem 0 1rem; }

/* Input grande de búsqueda, con ícono a la izquierda */
.search-input-wrap { position: relative; }
.search-input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  opacity: .55;
  pointer-events: none;
}
.search-input {
  width: 100%;
  background: var(--input-bg, #f9fafb);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1rem 1rem 2.75rem;
  font-size: 22px;
  font-family: 'Sora', sans-serif;
  letter-spacing: .08em;
  text-align: center;
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.search-input::placeholder { letter-spacing: normal; font-family: 'DM Sans', sans-serif; font-size: 16px; opacity: .55; }
.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27, 58, 107, 0.12);
}
.search-helper { font-size: 12px; color: var(--muted); text-align: center; margin-top: .85rem; }

/* Banner de estado (VIGENTE / NO VIGENTE) con trama de grilla */
.status-banner {
  position: relative;
  border-radius: 14px;
  padding: 2.25rem 1rem;
  text-align: center;
  color: #fff;
  overflow: hidden;
}
.status-banner.ok { background: #0e9f6e; }
.status-banner.no { background: #d92626; }
.status-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.10) 1px, transparent 1px);
  background-size: 28px 28px;
}
.status-banner > * { position: relative; }
.status-banner h1 {
  font-size: clamp(26px, 8vw, 38px);
  letter-spacing: .3em;
  margin-right: -.3em; /* compensa el tracking del último caracter */
  font-weight: 700;
  font-family: 'Sora', sans-serif;
}
.status-banner p { font-size: 13px; opacity: .85; margin-top: .35rem; }
.status-banner .st-alert {
  width: 44px; height: 44px;
  margin: 0 auto .6rem;
  background: #fff;
  color: #d92626;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  font-family: 'Sora', sans-serif;
}

/* Cards de detalle estilo mockup */
.card-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-family: 'Sora', sans-serif;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: .9rem;
}
.lbl {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}
.val { font-size: 15px; font-weight: 600; }
.dato { margin-bottom: .8rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

/* Estado de cuenta */
.estado-cuenta { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.ec-item { display: flex; align-items: center; gap: .6rem; }
.ec-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.ec-icon.ok  { background: #d1fae5; color: #047857; }
.ec-icon.cal { background: #dbeafe; color: #1d4ed8; }

/* Cobertura detallada (checklist) */
.cob-item {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .55rem 0;
  border-bottom: 0.5px solid var(--border);
}
.cob-item:last-child { border-bottom: none; }
.cob-check { color: #0e9f6e; font-weight: 700; flex-shrink: 0; }
.cob-item h4 { font-size: 14px; font-weight: 600; margin-bottom: 1px; }
.cob-item p { font-size: 12px; color: var(--primary-light); }

/* Filas etiqueta/valor (datos encontrados en NO VIGENTE) */
.fila { display: flex; justify-content: space-between; align-items: center; padding: .55rem 0; border-bottom: 0.5px solid var(--border); gap: .5rem; }
.fila:last-child { border-bottom: none; }
.fila .f-lbl { font-size: 13px; color: var(--muted); }
.fila .f-val { font-size: 14px; font-weight: 600; text-align: right; }
.fila .f-val.rojo { color: var(--danger); }

/* Nota de ayuda */
.help-note {
  display: flex;
  gap: .6rem;
  align-items: flex-start;
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  padding: .9rem 1rem;
  font-size: 13px;
  color: var(--muted);
}
.help-note b { color: var(--text); display: block; margin-bottom: 1px; }

/* No encontrado */
.nf { text-align: center; padding: 1.5rem .5rem .5rem; }
.nf-icon {
  width: 72px; height: 72px;
  margin: 0 auto 1rem;
  background: var(--input-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}
.nf h3 { font-size: 19px; font-family: 'Sora', sans-serif; margin-bottom: .5rem; }
.nf p { font-size: 14px; color: var(--muted); line-height: 1.5; max-width: 320px; margin: 0 auto; }

/* Tiles de ayuda de formato */
.info-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.tile {
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  padding: 1rem .75rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.tile .lbl { margin-bottom: 4px; }
.tile-val { font-size: 13px; color: var(--primary-light); font-weight: 500; }

/* Botones-link (tel:/mailto:) con aspecto de btn-continuar */
a.btn-continuar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  text-decoration: none;
  box-sizing: border-box;
}

/* Contenedor de resultado: separación entre bloques */
#pr-resultado-cont { display: flex; flex-direction: column; gap: 1rem; }

/* ===== Tarjetas de póliza (una por ramo: Vida / Sepelio) ===== */
/* Grilla: apiladas en mobile; en desktop se acomodan de a dos (o más filas). */
.pol-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
}

.pol-card { border-top: 4px solid var(--border); }
.pol-card.vigente { border-top-color: #0e9f6e; }
.pol-card.vencida { border-top-color: var(--danger); }

.pol-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: 1rem;
}
.pol-ramo {
  font-family: 'Sora', sans-serif;
  font-weight: 600;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.pol-chip {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  padding: 4px 11px;
  border-radius: 20px;
  white-space: nowrap;
}
.pol-chip.ok { background: #d1fae5; color: #065f46; }
.pol-chip.no { background: #fee2e2; color: #991b1b; }

/* Fila superior con las columnas del Excel (Póliza, Certificado, Plan,
   Servicios/Adicionales, Último pago). Se acomoda en una línea si hay
   lugar y envuelve en mobile. Separada del detalle por una línea. */
.pol-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: .75rem 1rem;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 0.5px solid var(--border);
}
.pol-meta .val { white-space: nowrap; }

/* Último pago: mes y año del período cubierto (pagado) */
.pol-periodo { font-family: 'Sora', sans-serif; }
.pol-card.vencida .pol-periodo { color: var(--danger); }

.pol-cob > .lbl { margin-bottom: .5rem; }

/* Código abreviado de cada servicio/adicional (PAR, SEP, MU...) */
.cob-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 22px;
  padding: 0 7px;
  border-radius: 6px;
  background: rgba(14, 159, 110, .14);
  color: #0e9f6e;
  font-family: 'Courier New', monospace;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .03em;
  flex-shrink: 0;
}
.pol-card.vencida .cob-code { background: rgba(220, 38, 38, .12); color: var(--danger); }
.cob-vacio { font-size: 13px; color: var(--muted); padding: .3rem 0; }

/* Acciones al pie: apiladas en mobile, en fila en desktop */
.res-actions { display: flex; flex-direction: column; gap: .6rem; }

/* Botón secundario (outline) */
.btn-continuar.outline {
  background: var(--card);
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-continuar.outline:hover { background: var(--input-bg); }

/* Historial de consultas */
.hist-card {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .875rem;
  background: var(--bg);
  border-radius: 10px;
  margin-bottom: .5rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: border-color .15s, transform .1s;
}
.hist-card:last-child { margin-bottom: 0; }
.hist-card:hover { border-color: var(--primary); }
.hist-card:active { transform: scale(.99); }
.hist-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.hist-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.hist-icon.ok { background: #d1fae5; }
.hist-icon.no { background: #fee2e2; }
.hist-info { flex: 1; min-width: 0; }
.hist-info h4 { font-size: 14px; font-weight: 500; }
.hist-info p { font-size: 12px; color: var(--muted); }

/* Badges de estado y de rol prestador */
.b-ok    { background: #d1fae5; color: #065f46; }
.b-no    { background: #f3f4f6; color: #374151; }
.b-prest { background: #fef3c7; color: #92400e; }

/* Filtros del historial (día / mes / año) */
.hist-filtros { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.hist-filtros select {
  flex: 1 1 90px;
  min-width: 90px;
  padding: .6rem .7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  min-height: 44px;
  cursor: pointer;
}
.btn-hf-clear {
  flex: 0 0 auto;
  padding: .6rem 1.1rem;
  border: 1.5px solid var(--primary);
  background: transparent;
  color: var(--primary);
  border-radius: 10px;
  font-family: 'Sora', sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  min-height: 44px;
}
.btn-hf-clear:hover { background: rgba(43, 91, 168, .08); }

.hist-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; gap: .5rem; }
.hist-count { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* RESPONSIVE: más columnas en desktop */
@media (min-width: 768px) {
  .opt-grid-4 { grid-template-columns: repeat(7, 1fr); }

  /* Historial en dos columnas para aprovechar el ancho */
  #pr-hist-list { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
  #pr-hist-list .hist-card { margin-bottom: 0; }

  /* La pantalla de resultado aprovecha más ancho para no quedar en una columna angosta */
  #screen-prestador-resultado .content { max-width: 960px; }

  /* Pólizas de a dos por fila (y filas siguientes si hay más) */
  .pol-grid { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

  /* Botones lado a lado */
  .res-actions { flex-direction: row; }
  .res-actions > * { flex: 1; margin: 0; }
}

/* ============================================================
   Historial de cotizaciones (tabla)
   ============================================================ */

/* Campo de búsqueda dentro de la barra de filtros */
.ch-search {
  flex: 1 1 160px;
  min-width: 140px;
  padding: .6rem .7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  min-height: 44px;
}
.ch-search:focus { outline: none; border-color: var(--primary); }

/* Contenedor con scroll horizontal para no romper en pantallas chicas */
.ch-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.ch-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 720px; /* fuerza el scroll horizontal en mobile */
}
.ch-table thead th {
  text-align: left;
  padding: .55rem .7rem;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.ch-table tbody td {
  padding: .6rem .7rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
  white-space: nowrap;
}
.ch-table tbody tr:last-child td { border-bottom: 0; }
.ch-table tbody tr:hover { background: var(--input-bg); }

.ch-table .ch-fecha  { color: var(--muted); font-size: 12px; }
.ch-table .ch-nombre { font-weight: 600; }
.ch-table .ch-email  { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.ch-table .ch-suma   { font-weight: 600; }
/* Fecha de nacimiento bajo la edad: no justifica una columna propia, pero sin
   ella no se puede saber si "45 años" era la edad de entonces o la de hoy. */
.ch-table .ch-fnac   { display: block; color: var(--muted); font-size: 11px; }
.ch-table .ch-acc    { text-align: right; }

/* Chip de ramo */
.ch-ramo {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.ch-ramo i { font-size: 11px; opacity: .9; }
.ch-ramo-vida    { background: rgba(43, 91, 168, .12); color: var(--primary); }
.ch-ramo-sepelio { background: rgba(232, 160, 32, .16); color: #9a6a10; }
[data-theme="dark"] .ch-ramo-sepelio { color: var(--accent); }

/* Botón compartir por fila */
.ch-share-btn {
  padding: .4rem .8rem;
  border: 1.5px solid var(--primary);
  background: transparent;
  color: var(--primary);
  border-radius: 8px;
  font-family: 'Sora', sans-serif;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.ch-share-btn:hover { background: var(--primary); color: #fff; }
.ch-share-na { color: var(--muted); }

/* MOBILE: la tabla se transforma en tarjetas (etiqueta + valor), sin scroll lateral */
@media (max-width: 640px) {
  .ch-table-wrap { overflow-x: visible; }
  .ch-table { min-width: 0; }
  .ch-table thead { display: none; }
  .ch-table, .ch-table tbody, .ch-table tr, .ch-table td { display: block; width: 100%; }
  .ch-table tbody tr {
    border: 0.5px solid var(--border);
    border-radius: 12px;
    background: var(--card);
    padding: .35rem .9rem;
    margin-bottom: .7rem;
  }
  .ch-table tbody tr:hover { background: var(--card); }
  .ch-table tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .5rem 0;
    border-bottom: 0.5px solid var(--border);
    white-space: normal;
    text-align: right;
  }
  .ch-table tbody td:last-child { border-bottom: none; }
  .ch-table tbody td::before {
    content: attr(data-label);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--muted);
    font-weight: 600;
    flex-shrink: 0;
    text-align: left;
  }
  /* Nombre = encabezado de la tarjeta (sin etiqueta, más grande) */
  .ch-table .ch-nombre { font-size: 15px; }
  .ch-table .ch-nombre::before { content: 'Cliente'; }
  .ch-table .ch-email { max-width: none; overflow: visible; word-break: break-all; }
  /* Celda de acción: botón a lo ancho, sin etiqueta */
  .ch-table .ch-acc { display: block; text-align: center; }
  .ch-table .ch-acc::before { content: ''; }
  .ch-table .ch-acc .ch-share-btn { width: 100%; margin-top: .3rem; }
}

/* ===========================================================================
   Ajustes de densidad en mobile (agosto 2026)
   Dos pantallas quedaban incómodas en 414px: el selector de tarifa y el modal
   de exportar. En ambos casos el problema no era el tamaño sino la cantidad
   de cosas compitiendo por la misma pantalla.
   =========================================================================== */

/* --- Selector de tarifa: plegar el resto una vez elegida --- */
.sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.link-cambiar {
  background: none;
  border: 0;
  padding: .15rem .35rem;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  color: var(--primary-light);
  cursor: pointer;
}
.link-cambiar:hover { text-decoration: underline; }
.link-cambiar[hidden] { display: none; }

/* Con una tarifa elegida queda una sola tarjeta, a lo ancho */
#sep-tarifa-cont.picked { grid-template-columns: 1fr; }
#sep-tarifa-cont.picked .opt-btn:not(.sel) { display: none; }

/* --- Modal de exportar: datos del vendedor plegables --- */
.exp-vendedor { margin: .35rem 0 .9rem; }
.exp-vendedor > summary {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  cursor: pointer;
  padding: .5rem 0;
  list-style: none;
}
.exp-vendedor > summary::-webkit-details-marker { display: none; }
.exp-vendedor > summary::after {
  content: '▸';
  margin-left: auto;
  font-size: 12px;
  opacity: .6;
  transition: transform .15s ease;
}
.exp-vendedor[open] > summary::after { transform: rotate(90deg); }
.exp-vendedor > summary .section-title { margin: 0; }
.exp-vendedor > summary small {
  font-size: 12px;
  opacity: .65;
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.exp-vendedor[open] > summary small { display: none; }

/* Compartir y Enviar comparten fila: el primario queda claramente arriba */
.export-sec-row { display: flex; gap: .5rem; }
.export-sec-row .btn-sec { flex: 1; margin: 0; }
.export-sec-row .btn-sec[hidden] { display: none; }
