/*
 * Modal para calcular el porcentaje de interés por periodo (elemento loans/rate_helper).
 * No depende de bootstrap: se usa dentro del sistema y en el simulador público.
 * El color se cambia con --lrh-accent
 */
.lrh {
  --lrh-accent: #1e40af;
  --lrh-ink: #0f172a;
  --lrh-muted: #64748b;
  --lrh-line: #e2e8f0;
  --lrh-soft: #f6f7fa;
  align-items: center; bottom: 0; color: var(--lrh-ink); display: flex; font-size: 14px; justify-content: center;
  left: 0; line-height: 1.45; padding: 16px; position: fixed; right: 0; text-align: left; top: 0; z-index: 2000;
}
.lrh[hidden], .lrh [hidden] { display: none !important; }
.lrh *, .lrh *::before, .lrh *::after { box-sizing: border-box; }
html.lrh-open { overflow: hidden; }
.lrh-backdrop { background: rgba(15, 23, 42, .55); bottom: 0; left: 0; position: absolute; right: 0; top: 0; }
.lrh-dialog:focus { outline: none; }
.lrh-dialog {
  animation: lrh-in .18s ease-out; background: #fff; border-radius: 22px; box-shadow: 0 40px 90px -30px rgba(15, 23, 42, .55);
  display: flex; flex-direction: column; max-height: 100%; max-width: 680px; overflow: hidden; position: relative; width: 100%;
}
@keyframes lrh-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

.lrh-head { align-items: flex-start; display: flex; gap: 16px; justify-content: space-between; padding: 24px 26px 6px; }
.lrh-title { font-size: 21px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.lrh-subtitle { color: var(--lrh-muted); font-size: 14px; margin: 6px 0 0; }
.lrh-close {
  align-items: center; background: var(--lrh-soft); border: 0; border-radius: 50%; color: var(--lrh-ink); cursor: pointer;
  display: flex; flex-shrink: 0; height: 36px; justify-content: center; padding: 0; width: 36px;
}
.lrh-close:hover { background: var(--lrh-line); }

.lrh-body { overflow-y: auto; padding: 8px 26px 22px; }
.lrh-step { color: var(--lrh-muted); font-size: 11.5px; font-weight: 700; letter-spacing: .06em; margin: 16px 0 10px; text-transform: uppercase; }

.lrh-note { color: var(--lrh-muted); font-size: 12px; line-height: 1.4; margin: 8px 0 0; }
.lrh-loan { border-bottom: 1px dashed var(--lrh-line); margin-bottom: 14px; padding-bottom: 14px; }
.lrh-item-body .lrh-loan .lrh-fields { grid-template-columns: 1.2fr .8fr 1.1fr; }

.lrh-accordion { display: grid; gap: 8px; }
.lrh-item { background: #fff; border: 1.5px solid var(--lrh-line); border-radius: 16px; overflow: hidden; transition: border-color .15s ease, box-shadow .15s ease; }
.lrh-item:hover { border-color: #94a3b8; }
.lrh-item.is-open { border-color: var(--lrh-ink); box-shadow: 0 14px 30px -22px rgba(15, 23, 42, .5); }
.lrh-item-head {
  align-items: center; background: transparent; border: 0; color: var(--lrh-ink); cursor: pointer; display: flex; font: inherit;
  gap: 12px; justify-content: space-between; padding: 12px 16px; text-align: left; width: 100%;
}
.lrh-item-head b { display: block; font-size: 14.5px; font-weight: 700; line-height: 1.3; }
.lrh-item-head small { color: var(--lrh-muted); display: block; font-size: 12.5px; font-weight: 400; line-height: 1.35; margin-top: 2px; }
.lrh-item-head svg { color: var(--lrh-muted); flex-shrink: 0; transition: transform .2s ease; }
.lrh-item.is-open .lrh-item-head svg { color: var(--lrh-ink); transform: rotate(180deg); }
.lrh-item-body { animation: lrh-in .18s ease-out; border-top: 1px solid var(--lrh-line); padding: 14px 16px 16px; }
.lrh-item-body .lrh-fields { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

.lrh-fields { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lrh-field label { color: var(--lrh-ink); display: block; font-size: 12.5px; font-weight: 700; margin: 0 0 6px; }
.lrh-field input, .lrh-field select {
  appearance: auto; background: #fff; border: 1.5px solid var(--lrh-line); border-radius: 12px; box-shadow: none; color: var(--lrh-ink);
  display: block; font: inherit; font-size: 16px; font-weight: 600; height: 46px; margin: 0; padding: 0 14px; width: 100%;
}
.lrh-input { display: flex; }
.lrh-input span {
  align-items: center; background: var(--lrh-soft); border: 1.5px solid var(--lrh-line); border-radius: 12px 0 0 12px; border-right: 0;
  color: var(--lrh-muted); display: flex; font-weight: 700; justify-content: center; min-width: 42px;
}
.lrh-input input { border-radius: 0 12px 12px 0; flex: 1; min-width: 0; }
.lrh-field input:focus, .lrh-field select:focus { border-color: var(--lrh-accent); box-shadow: 0 0 0 4px rgba(37, 99, 235, .14); outline: none; }
.lrh-item-head:focus-visible, .lrh-btn:focus-visible, .lrh-close:focus-visible { outline: 3px solid rgba(37, 99, 235, .45); outline-offset: 2px; }

.lrh-result { border-radius: 18px; margin-top: 14px; }
.lrh-result-empty, .lrh-result-error, .lrh-result-ok { display: none; margin: 0; }
.lrh-result[data-state="empty"] .lrh-result-empty { background: var(--lrh-soft); border-radius: 18px; color: var(--lrh-muted); display: block; padding: 18px 20px; text-align: center; }
.lrh-result[data-state="error"] .lrh-result-error { background: #fef2f2; border-radius: 18px; color: #b91c1c; display: block; font-weight: 600; padding: 18px 20px; }
.lrh-result[data-state="ok"] .lrh-result-ok { background: var(--lrh-ink); border-radius: 18px; color: #fff; display: block; padding: 20px 22px; }
.lrh-rate span { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; opacity: .7; text-transform: uppercase; }
.lrh-rate b { display: block; font-size: 38px; font-variant-numeric: tabular-nums; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; overflow-wrap: anywhere; }
.lrh-rows { border-top: 1px solid rgba(255, 255, 255, .16); display: grid; gap: 12px 18px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); margin-top: 14px; padding-top: 14px; }
.lrh-rows span { display: block; font-size: 12px; opacity: .7; }
.lrh-rows b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; font-weight: 700; }
.lrh-check { align-items: flex-start; color: #86efac; display: flex; font-size: 13.5px; font-weight: 600; gap: 8px; margin: 14px 0 0; }
.lrh-check::before { content: "\2713"; font-weight: 800; }
.lrh-check.is-warning { color: #fcd34d; }
.lrh-check.is-warning::before { content: "!"; }

.lrh-foot { align-items: center; border-top: 1px solid var(--lrh-line); display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; padding: 16px 26px; }
.lrh-btn {
  background: #fff; border: 1.5px solid var(--lrh-line); border-radius: 999px; color: var(--lrh-ink); cursor: pointer;
  font: inherit; font-size: 14.5px; font-weight: 700; height: 46px; padding: 0 22px; white-space: nowrap; transition: background .15s ease, border-color .15s ease, opacity .15s ease;
}
.lrh-btn:hover { border-color: #94a3b8; }
.lrh-btn-primary { background: var(--lrh-accent); border-color: var(--lrh-accent); color: #fff; }
.lrh-btn-primary:hover { border-color: var(--lrh-accent); filter: brightness(1.1); }
.lrh-btn-primary[disabled] { cursor: not-allowed; filter: none; opacity: .4; }

@media (max-width: 560px) {
  .lrh { align-items: flex-end; padding: 0; }
  .lrh-dialog { border-radius: 22px 22px 0 0; max-height: 94%; }
  .lrh-head { padding: 20px 18px 4px; }
  .lrh-body { padding: 6px 18px 18px; }
  .lrh-item-body .lrh-loan .lrh-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lrh-loan .lrh-field:first-child { grid-column: 1 / -1; }
  .lrh-rate b { font-size: 32px; }
  .lrh-foot { padding: 14px 18px; }
  .lrh-btn { flex: 1; padding: 0 12px; }
}
