/* Emergency Fund Calculator (/emergency-fund-calculator/, generated by scripts/build-emergency-fund.mjs).
   Builds on site.css tokens, the shared tool components (.bm-section, .bvr-calc, .bvr-grid, .bvr-field, .bvr-result,
   .bvr-headline, .bvr-reset, .bm-stats, .bvr-cards, .col-note, .col-disclaimer, .card, .hc-related) and the layout
   helpers of css/jet-lag-calculator.css (.jl-intro, .jl-actions, .jl-tips, .jl-next).
   No inline styles anywhere (CSP): js/emergency-fund-calculator.js sizes the progress bar through the CSSOM. */

/* ---------- Form ---------- */
.ef-set { min-width: 0; margin: 0; padding: 0; border: 0; }
.ef-set + .ef-set { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
.ef-set legend { padding: 0; margin-bottom: 14px; font-size: 19px; font-weight: 800; }
.ef-set [hidden] { display: none; }

.ef-pills { display: flex; flex-wrap: wrap; gap: 8px 10px; }
.ef-pills span { position: relative; display: inline-flex; }
.ef-pills input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.ef-pills label {
  display: inline-flex; align-items: center; min-height: 46px; padding: 10px 20px; font-size: 15.5px; font-weight: 800;
  color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 999px;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.ef-pills input:hover + label { border-color: rgba(198, 239, 60, 0.65); }
.ef-pills input:checked + label { color: var(--on-lime); background: var(--lime); border-color: var(--lime); }
.ef-pills input:focus-visible + label { outline: 2px solid var(--lime); outline-offset: 2px; }
.ef-hint { margin: 12px 0 0; font-size: 13.5px; }

/* A "$" in front of every amount. The page is always left-to-right inside the field, like the number itself. */
.ef-money { position: relative; direction: ltr; }
.ef-money span { position: absolute; top: 0; bottom: 0; left: 14px; display: flex; align-items: center; color: var(--muted); font-size: 16px; font-weight: 700; pointer-events: none; }
.ef-page .bvr-field .ef-money input[type="number"] { padding-left: 30px; }
.ef-total { max-width: 340px; margin-top: 18px; }
.ef-sum { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; margin: 18px 0 0; padding: 14px 18px; font-size: 15.5px; font-weight: 700; background: rgba(198, 239, 60, 0.07); border: 1px solid rgba(198, 239, 60, 0.28); border-radius: 16px; }
.ef-sum output { color: var(--lime); font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; }
.ef-page .jl-actions .ef-reset { margin-top: 0; min-height: 46px; padding-inline: 22px; }

/* ---------- Result ---------- */
.ef-result[data-tone="going"], .ef-result[data-tone="done"] { border-inline-start-color: var(--lime); }
.ef-result[data-tone="going"] .bvr-headline, .ef-result[data-tone="done"] .bvr-headline { color: var(--lime); }
.ef-result[data-tone="stalled"] { border-inline-start-color: var(--amber); }
.ef-result[data-tone="stalled"] .bvr-headline { color: var(--amber); }

/* Savings against the target: the lime part is saved, the striped rest is the gap. Always left-to-right. */
.ef-bar {
  position: relative; height: 22px; margin-top: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 999px; direction: ltr;
  background: repeating-linear-gradient(135deg, rgba(221, 164, 60, 0.30) 0 6px, rgba(221, 164, 60, 0.14) 6px 12px);
}
.ef-bar[data-empty="true"] { background: rgba(234, 242, 230, 0.06); }
.ef-bar i { position: absolute; top: 0; bottom: 0; left: 0; width: 0; background: var(--lime); transition: width .25s ease; }
.ef-legend { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 18px; margin-top: 10px; font-size: 14.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ef-key { display: inline-flex; align-items: center; gap: 8px; }
.ef-key::before { content: ""; flex: none; width: 12px; height: 12px; border-radius: 4px; background: var(--lime); }
.ef-key--gap::before { background: repeating-linear-gradient(135deg, rgba(221, 164, 60, 0.9) 0 3px, rgba(221, 164, 60, 0.45) 3px 6px); }
.ef-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---------- Compare coverage lengths ---------- */
.ef-compare { margin-top: 26px; }
.ef-compare h3 { margin: 0 0 10px; font-size: 20px; font-weight: 800; }
.ef-table { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 18px; }
.ef-table table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.ef-table th, .ef-table td { padding: 12px 16px; text-align: start; white-space: nowrap; border-bottom: 1px solid var(--line); }
.ef-table thead th { color: var(--muted); font-size: 12.5px; font-weight: 800; letter-spacing: .9px; text-transform: uppercase; }
.ef-table tbody th { font-weight: 800; }
.ef-table tbody tr:last-child th, .ef-table tbody tr:last-child td { border-bottom: 0; }
.ef-table tr[data-selected="true"] { background: rgba(198, 239, 60, 0.08); }
.ef-table tr[data-selected="true"] th { color: var(--lime); }
.ef-compare .col-note { margin: 10px 0 0; font-size: 13.5px; }

/* ---------- Traveller callout ---------- */
.ef-callout { margin: 34px 0 0; padding: 22px 24px; background: rgba(198, 239, 60, 0.07); border: 1px solid rgba(198, 239, 60, 0.28); border-radius: var(--radius); }
.ef-callout h2 { margin: 0 0 8px; font-size: 20px; font-weight: 800; color: var(--lime); }
.ef-callout p { max-width: 760px; margin: 0; font-size: 16px; line-height: 1.65; }

@media (max-width: 900px) {
  .ef-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .ef-total { max-width: none; }
  .ef-pills label { padding-inline: 16px; }
  .ef-table th, .ef-table td { padding: 10px 8px; font-size: 13.5px; }
  .ef-table th:first-child { padding-inline-start: 14px; }
  .ef-table thead th { white-space: normal; font-size: 11px; letter-spacing: .5px; vertical-align: bottom; }
  .ef-callout { padding: 18px; }
  .ef-page .jl-actions .ef-reset { width: 100%; }
}
@media (max-width: 420px) {
  .ef-cards { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .ef-bar i, .ef-pills label { transition: none; }
}
