/* ============================================================
   Simulador de Créditos FEBDB — v2.0
   Estilos aislados bajo .febdb-sim (no tocan el resto del sitio)
   ============================================================ */

.febdb-sim {
  --fs-azul:        #002c76;
  --fs-azul-claro:  #0047a5;
  --fs-amarillo:    #f5b041;
  --fs-amarillo-os: #d9932a;
  --fs-texto:       #1f2937;
  --fs-suave:       #6b7280;
  --fs-borde:       #e2e8f0;
  --fs-fondo:       #f6f8fb;
  --fs-radio:       14px;
  --fs-sombra:      0 1px 2px rgba(16,24,40,.05), 0 8px 24px -12px rgba(0,44,118,.22);

  max-width: 1080px;
  margin: 2rem auto;
  color: var(--fs-texto);
  font-family: inherit;
  line-height: 1.5;
  box-sizing: border-box;
}
.febdb-sim *, .febdb-sim *::before, .febdb-sim *::after { box-sizing: border-box; }

.febdb-sim .fs-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Layout ---------- */
.febdb-sim .fs-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 900px) {
  .febdb-sim .fs-layout { grid-template-columns: 5fr 6fr; align-items: start; }
}

.febdb-sim .fs-card {
  background: #fff;
  border: 1px solid var(--fs-borde);
  border-radius: var(--fs-radio);
  box-shadow: var(--fs-sombra);
  padding: 1.5rem;
}
@media (min-width: 600px) { .febdb-sim .fs-card { padding: 1.75rem; } }

.febdb-sim .fs-results { background: var(--fs-fondo); }

.febdb-sim .fs-title {
  margin: 0 0 1.25rem;
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--fs-azul);
  letter-spacing: -.01em;
}
.febdb-sim .fs-title::after {
  content: ""; display: block; width: 2.5rem; height: 3px;
  margin-top: .5rem; border-radius: 2px; background: var(--fs-amarillo);
}

/* ---------- Campos ---------- */
.febdb-sim .fs-field { margin-bottom: 1.25rem; }
.febdb-sim .fs-field--grow { flex: 1 1 auto; margin-bottom: 0; }
.febdb-sim .fs-field--sm   { flex: 0 0 5.5rem; margin-bottom: 0; }

.febdb-sim label {
  display: block;
  margin-bottom: .375rem;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--fs-suave);
  text-transform: none;
  letter-spacing: 0;
}

.febdb-sim .fs-label-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: .5rem;
}
.febdb-sim .fs-label-row label { margin-bottom: .375rem; }

.febdb-sim .fs-badge {
  font-size: .8125rem; font-weight: 700; color: var(--fs-azul);
  background: rgba(0,44,118,.07); border-radius: 999px; padding: .125rem .625rem;
}

.febdb-sim select,
.febdb-sim input[type="text"],
.febdb-sim input[type="number"] {
  width: 100%;
  padding: .75rem .875rem;
  font-family: inherit;
  font-size: 1rem;
  color: var(--fs-texto);
  background: #fff;
  border: 1px solid var(--fs-borde);
  border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}
.febdb-sim select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath d='M5.5 7.5L10 12l4.5-4.5' stroke='%236b7280' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  background-size: 1.25rem;
  padding-right: 2.5rem;
}
.febdb-sim .fs-num { font-size: 1.25rem; font-weight: 700; letter-spacing: -.01em; }

.febdb-sim select:focus-visible,
.febdb-sim input:focus-visible,
.febdb-sim button:focus-visible,
.febdb-sim summary:focus-visible,
.febdb-sim a:focus-visible {
  outline: none;
  border-color: var(--fs-azul);
  box-shadow: 0 0 0 3px rgba(0,44,118,.18);
}

.febdb-sim .fs-hint {
  margin: .375rem 0 0;
  font-size: .75rem;
  color: var(--fs-suave);
}

/* ---------- Sliders ---------- */
.febdb-sim .fs-range {
  width: 100%;
  margin-top: .75rem;
  height: 6px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(to right, var(--fs-azul) var(--fs-pct, 0%), #dbe2ea var(--fs-pct, 0%));
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.febdb-sim .fs-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 3px solid var(--fs-azul);
  box-shadow: 0 1px 4px rgba(16,24,40,.25);
  cursor: grab;
}
.febdb-sim .fs-range::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 3px solid var(--fs-azul);
  box-shadow: 0 1px 4px rgba(16,24,40,.25);
  cursor: grab;
}
.febdb-sim .fs-range::-moz-range-track { height: 6px; border-radius: 999px; background: transparent; }

/* ---------- Cuotas extraordinarias ---------- */
.febdb-sim .fs-extras {
  border-top: 1px solid var(--fs-borde);
  padding-top: 1rem;
  margin-top: .25rem;
}
.febdb-sim summary {
  display: flex; align-items: center; gap: .5rem;
  cursor: pointer;
  font-size: .9375rem; font-weight: 700; color: var(--fs-azul);
  list-style: none;
  padding: .25rem 0;
  border-radius: 8px;
}
.febdb-sim summary::-webkit-details-marker { display: none; }
.febdb-sim summary::before {
  content: ""; flex: 0 0 auto;
  width: .5rem; height: .5rem;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform .2s;
  margin-right: .125rem;
}
.febdb-sim details[open] > summary::before { transform: rotate(45deg); }

.febdb-sim .fs-chip {
  font-size: .6875rem; font-weight: 700;
  background: var(--fs-amarillo); color: #3b2600;
  border-radius: 999px; padding: .0625rem .5rem;
}

.febdb-sim .fs-extra-row {
  display: flex; flex-wrap: wrap; gap: .625rem; align-items: flex-end;
  margin: .75rem 0;
}
.febdb-sim .fs-extra-list { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; gap: .5rem; }
.febdb-sim .fs-extra-list li {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  background: #eef4ff; border: 1px solid #d8e4fb;
  border-radius: 10px; padding: .5rem .75rem;
  font-size: .875rem;
}
.febdb-sim .fs-extra-list strong { color: var(--fs-azul); }
.febdb-sim .fs-del {
  flex: 0 0 auto;
  background: none; border: 0; cursor: pointer;
  color: #b42318; font-size: .8125rem; font-weight: 600;
  padding: .25rem .5rem; border-radius: 6px;
}
.febdb-sim .fs-del:hover { background: #fee4e2; }

/* ---------- Botones ---------- */
.febdb-sim .fs-btn {
  font-family: inherit; font-size: .9375rem; font-weight: 700;
  border-radius: 10px; border: 1px solid transparent;
  padding: .75rem 1.125rem; cursor: pointer;
  transition: background-color .15s, transform .05s;
}
.febdb-sim .fs-btn:active { transform: translateY(1px); }
.febdb-sim .fs-btn--add { background: var(--fs-amarillo); color: #3b2600; }
.febdb-sim .fs-btn--add:hover { background: var(--fs-amarillo-os); }
.febdb-sim .fs-btn--ghost {
  background: #fff; border-color: var(--fs-borde); color: var(--fs-azul);
  font-size: .8125rem; padding: .5rem .875rem;
}
.febdb-sim .fs-btn--ghost:hover { background: var(--fs-fondo); }

/* ---------- Resultados ---------- */
.febdb-sim .fs-headline {
  background: linear-gradient(135deg, var(--fs-azul), var(--fs-azul-claro));
  color: #fff;
  border-radius: 12px;
  padding: 1.25rem;
  text-align: center;
  margin-bottom: 1rem;
}
.febdb-sim .fs-headline__label {
  display: block; font-size: .8125rem; font-weight: 600;
  color: rgba(255,255,255,.8); margin-bottom: .25rem;
}
.febdb-sim .fs-headline__value {
  display: block;
  font-size: clamp(1.875rem, 6vw, 2.5rem);
  font-weight: 800; line-height: 1.1;
  color: var(--fs-amarillo);
  letter-spacing: -.02em;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.febdb-sim .fs-headline__note {
  display: block; margin-top: .5rem;
  font-size: .6875rem; color: rgba(255,255,255,.7);
}

.febdb-sim .fs-stats {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .625rem; margin: 0 0 1rem;
}
@media (max-width: 380px) { .febdb-sim .fs-stats { grid-template-columns: 1fr; } }

.febdb-sim .fs-stat {
  background: #fff; border: 1px solid var(--fs-borde);
  border-radius: 10px; padding: .75rem .875rem;
}
.febdb-sim .fs-stat dt {
  font-size: .75rem; font-weight: 600; color: var(--fs-suave); margin: 0 0 .25rem;
}
.febdb-sim .fs-stat dd {
  margin: 0; font-size: 1.0625rem; font-weight: 800; color: var(--fs-texto);
  overflow-wrap: anywhere; font-variant-numeric: tabular-nums;
}
.febdb-sim .fs-stat__note { display: block; margin-top: .1875rem; font-size: .6875rem; color: #9aa4b2; }
.febdb-sim .fs-stat--strong { border-color: rgba(0,44,118,.25); background: rgba(0,44,118,.04); }
.febdb-sim .fs-stat--strong dd { color: var(--fs-azul); }

.febdb-sim .fs-cta {
  display: block; text-align: center; text-decoration: none;
  background: var(--fs-amarillo); color: #3b2600;
  font-weight: 800; font-size: 1rem;
  padding: .875rem 1rem; border-radius: 10px;
  margin-bottom: .875rem;
  transition: background-color .15s;
}
.febdb-sim .fs-cta:hover { background: var(--fs-amarillo-os); color: #3b2600; }

.febdb-sim .fs-legal {
  margin: 0; font-size: .6875rem; line-height: 1.5; color: #8892a4;
}

.febdb-sim .fs-error {
  margin: 0; padding: .625rem .75rem;
  background: #fef3f2; border: 1px solid #fecdca; border-radius: 8px;
  color: #b42318; font-size: .8125rem; font-weight: 600;
}

/* Estado de dato inválido: atenúa resultados sin ocultarlos */
.febdb-sim .fs-results.is-stale { opacity: .45; transition: opacity .15s; }

/* ---------- Tabla ---------- */
.febdb-sim .fs-table-wrap {
  margin-top: 1.25rem;
  background: #fff;
  border: 1px solid var(--fs-borde);
  border-radius: var(--fs-radio);
  padding: 1rem 1.25rem;
  box-shadow: var(--fs-sombra);
}
.febdb-sim .fs-table-tools { display: flex; gap: .5rem; flex-wrap: wrap; margin: .875rem 0; }
.febdb-sim .fs-table-scroll { overflow-x: auto; border: 1px solid var(--fs-borde); border-radius: 10px; max-height: 26rem; overflow-y: auto; }
.febdb-sim .fs-table { width: 100%; border-collapse: collapse; font-size: .8125rem; }
.febdb-sim .fs-table th, .febdb-sim .fs-table td { padding: .5rem .75rem; white-space: nowrap; text-align: right; }
.febdb-sim .fs-table th:first-child, .febdb-sim .fs-table td:first-child { text-align: left; }
.febdb-sim .fs-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--fs-fondo); color: var(--fs-azul);
  font-weight: 700; font-size: .75rem;
  border-bottom: 1px solid var(--fs-borde);
}
.febdb-sim .fs-table tbody tr:nth-child(even) { background: #fafbfc; }
.febdb-sim .fs-table tbody tr:hover { background: #eef4ff; }
.febdb-sim .fs-table td { font-variant-numeric: tabular-nums; border-bottom: 1px solid #f1f3f6; }
.febdb-sim .fs-t-extra { color: var(--fs-amarillo-os); font-weight: 700; }
.febdb-sim .fs-t-total { font-weight: 700; }

/* ---------- Impresión ---------- */
@media print {
  .febdb-sim .fs-range, .febdb-sim .fs-table-tools, .febdb-sim .fs-cta, .febdb-sim .fs-extra-row { display: none !important; }
  .febdb-sim .fs-card, .febdb-sim .fs-table-wrap { box-shadow: none; border-color: #ccc; }
  .febdb-sim .fs-table-scroll { max-height: none; overflow: visible; }
  .febdb-sim details { display: block; }
  .febdb-sim .fs-headline { background: #fff !important; color: #000 !important; border: 2px solid #002c76; }
  .febdb-sim .fs-headline__value { color: #002c76 !important; }
  .febdb-sim .fs-headline__label, .febdb-sim .fs-headline__note { color: #444 !important; }
}

@media (prefers-reduced-motion: reduce) {
  .febdb-sim * { transition: none !important; animation: none !important; }
}

/* ---------- Desglose de la cuota (capital+interés / seguro) ---------- */
.febdb-sim .fs-desglose {
  margin: .5rem 0 0;
  font-size: .8125rem;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.febdb-sim .fs-desglose span {
  font-weight: 500;
  font-size: .6875rem;
  color: rgba(255,255,255,.72);
}
.febdb-sim .fs-desglose:empty { display: none; }

/* Costo total ocupa la fila completa */
.febdb-sim .fs-stat--wide { grid-column: 1 / -1; }

/* ---------- Fila de totales de la tabla ---------- */
.febdb-sim .fs-table tfoot th,
.febdb-sim .fs-table tfoot td {
  position: sticky; bottom: 0; z-index: 1;
  background: var(--fs-fondo);
  border-top: 2px solid var(--fs-azul);
  font-weight: 800;
  color: var(--fs-azul);
  font-variant-numeric: tabular-nums;
}
.febdb-sim .fs-table tfoot th { text-align: left; }

/* ---------- Condiciones de la modalidad ---------- */
.febdb-sim [hidden] { display: none !important; }

.febdb-sim .fs-condiciones {
  display: flex; flex-wrap: wrap; gap: .375rem;
  margin: -.5rem 0 1.25rem;
}
.febdb-sim .fs-condiciones span {
  font-size: .75rem; font-weight: 700;
  color: var(--fs-azul); background: rgba(0,44,118,.07);
  border-radius: 6px; padding: .1875rem .5rem;
  font-variant-numeric: tabular-nums;
}
.febdb-sim .fs-condiciones span:first-child {
  background: var(--fs-azul); color: #fff;
}

/* ---------- Generador de primas semestrales ---------- */
.febdb-sim .fs-primas {
  background: #f7f9fc;
  border: 1px solid var(--fs-borde);
  border-radius: 10px;
  padding: .75rem .875rem .5rem;
  margin-top: .75rem;
}
.febdb-sim .fs-primas .fs-extra-row { margin-top: 0; }
.febdb-sim .fs-primas .fs-hint { margin-bottom: .25rem; }

.febdb-sim .fs-sep {
  display: flex; align-items: center; gap: .625rem;
  margin: .875rem 0 .25rem;
  font-size: .6875rem; text-transform: uppercase; letter-spacing: .06em;
  color: #9aa4b2;
}
.febdb-sim .fs-sep::before, .febdb-sim .fs-sep::after {
  content: ""; flex: 1 1 auto; height: 1px; background: var(--fs-borde);
}
