/* ── Calculators — page & tool styles ──────────────────────────────
   Builds on css/shared.css design tokens (:root). Same lkforge visual
   family (Space Grotesk + JetBrains Mono) with an emerald accent
   (#059669). 100% client-side — no network calls. */

main { max-width: 860px; margin: 0 auto; padding: 20px; }

/* ── Tool hero (icon + title + subtitle) ───────────────────────── */
.tool-hero { max-width: 860px; margin: 0 auto; padding: 40px 20px 8px; }
.tool-hero .hero-head { display: flex; align-items: center; gap: 18px; }
.tool-hero .hero-icon {
  flex-shrink: 0; width: 60px; height: 60px; border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(5, 150, 105, .15);
}
.tool-hero .hero-icon svg { width: 32px; height: 32px; stroke: #fff; stroke-width: 1.8; }
.tool-hero h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 800; letter-spacing: -.6px; line-height: 1.1; color: var(--text); }
.tool-hero .subtitle { color: var(--muted); font-size: 1.05rem; margin-top: 14px; max-width: 680px; line-height: 1.6; }

/* ── Tool card ─────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 28px; margin-top: 28px; transition: border-color .2s, box-shadow .2s; }
.card + .card { margin-top: 18px; }
.card h2.card-title { font-size: 1.2rem; font-weight: 800; margin-bottom: 6px; color: var(--text); }
.card .card-note { font-size: .88rem; color: var(--muted); margin-bottom: 18px; }

/* ── Labels / inputs ───────────────────────────────────────────── */
.field-label { display: block; font-size: .85rem; font-weight: 700; color: var(--text); margin-bottom: 8px; letter-spacing: .02em; }
.field-label .hint { font-weight: 500; color: var(--muted); }

.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }

.calc-input, .calc-select {
  width: 100%;
  font-family: 'JetBrains Mono', monospace; font-size: 1rem;
  padding: 14px 16px; border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.calc-select { font-family: 'Outfit', system-ui, sans-serif; cursor: pointer; }
.calc-input:hover { border-color: #d0ccc8; }
.calc-input:focus, .calc-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(5,150,105,.12); }
.calc-input::placeholder { color: var(--muted); }

/* input with a leading symbol ($ / %) */
.input-affix { position: relative; display: flex; align-items: center; }
.input-affix .affix { position: absolute; left: 14px; color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: .95rem; pointer-events: none; }
.input-affix .affix-r { left: auto; right: 14px; }
.input-affix input.affix-l { padding-left: 30px; }
.input-affix input.affix-rp { padding-right: 34px; }

/* segmented selector (modes / quick options) */
.seg-tabs { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 22px; }
.seg-tab {
  font-family: inherit; font-size: .9rem; font-weight: 600; cursor: pointer;
  padding: 10px 18px; min-height: 42px;
  color: var(--text); background: var(--surface2);
  border: 1.5px solid var(--border); border-radius: 999px;
  transition: background .18s, border-color .18s, color .18s, transform .12s;
}
.seg-tab:hover { border-color: var(--accent); background: var(--accent-bg); transform: translateY(-1px); }
.seg-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* mode toggle (native <fieldset>/<legend> radio group, e.g. sales-tax forward/reverse) */
.st-modes { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.st-modes legend { flex-basis: 100%; padding: 0; margin-bottom: 8px; font-size: .85rem; font-weight: 700; color: var(--text); letter-spacing: .02em; }
.st-modes label {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: .9rem; font-weight: 600; color: var(--text); background: var(--surface2);
  padding: 10px 18px; min-height: 42px;
  border: 1.5px solid var(--border); border-radius: 999px;
  transition: background .18s, border-color .18s, color .18s, transform .12s;
}
.st-modes label:hover { border-color: var(--accent); background: var(--accent-bg); transform: translateY(-1px); }
.st-modes label:has(input:checked) { background: var(--accent); border-color: var(--accent); color: #fff; }
.st-modes input[type="radio"] { accent-color: var(--accent); }

/* quick chips (tip %, presets) */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px; min-width: 56px;
  font-family: 'JetBrains Mono', monospace; font-size: .9rem; font-weight: 700; color: var(--text);
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 8px 14px; cursor: pointer;
  transition: border-color .15s, background .15s, color .15s, transform .1s;
}
.chip:hover { border-color: var(--accent); background: var(--accent-bg); transform: translateY(-1px); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 11px 22px;
  font-family: inherit; font-size: .98rem; font-weight: 700;
  border: none; border-radius: var(--radius); cursor: pointer;
  background: var(--accent); color: #fff;
  transition: background .15s, transform .1s, opacity .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--accent-h); }
.btn:active { transform: scale(.98); }
.btn svg { width: 16px; height: 16px; }
.btn-ghost { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--surface2); border-color: var(--muted); }
.action-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

/* ── Result panel ──────────────────────────────────────────────── */
.result-panel { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.result-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.result-box {
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 6px;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.result-box:hover { border-color: #ddd; }
.result-box.primary {
  background: var(--accent-bg); border: 1.5px solid var(--accent);
  box-shadow: 0 2px 8px rgba(5, 150, 105, .08);
  padding: 22px 24px;
  order: -1;
}
.result-grid > :not(.primary) { grid-column: auto; }
@media (min-width: 640px) {
  .result-grid { grid-template-columns: repeat(3, 1fr); }
  .result-box.primary { grid-column: 1 / -1; }
}
.result-box .r-label { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.result-box.primary .r-label { color: var(--accent-fg); }
.result-box .r-val { font-family: 'JetBrains Mono', monospace; font-size: 1.6rem; font-weight: 800; color: var(--text); line-height: 1.2; word-break: break-word; }
.result-box.primary .r-val { color: var(--accent-fg); font-size: 1.8rem; }
.result-box .r-sub { font-size: .82rem; color: var(--muted); font-weight: 500; }

.result-line { font-size: .98rem; color: var(--muted); text-align: center; margin-top: 6px; }
.result-line strong { font-family: 'JetBrains Mono', monospace; color: var(--text); font-weight: 700; }

/* ── Data table (timecard / amortization / salary) ─────────────── */
.table-wrap { overflow-x: auto; margin-top: 16px; }
table.calc-table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 480px; }
table.calc-table th, table.calc-table td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.calc-table th:first-child, table.calc-table td:first-child { text-align: left; }
table.calc-table thead th { font-size: .76rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
table.calc-table tbody td { font-family: 'JetBrains Mono', monospace; }
table.calc-table tbody td:first-child { font-family: 'Outfit', system-ui, sans-serif; font-weight: 600; }
table.calc-table tfoot td { font-weight: 800; border-top: 2px solid var(--border); border-bottom: none; font-family: 'JetBrains Mono', monospace; }
table.calc-table tfoot td:first-child { font-family: 'Outfit', system-ui, sans-serif; }
/* editable timecard cells use inputs */
table.calc-table td input.cell-input {
  width: 100%; min-width: 92px; font-family: 'JetBrains Mono', monospace; font-size: .88rem;
  padding: 8px 9px; border: 1.5px solid var(--border); border-radius: 7px; background: var(--surface);
  color: var(--text); outline: none; text-align: right;
}
table.calc-table td input.cell-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(5,150,105,.14); }

/* ── Salary breakdown table — model-style card (scoped to .pay-card only,
      so the shared .calc-table used by timecard/mortgage is untouched) ── */
.pay-card { overflow: hidden; margin-top: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.pay-card table.calc-table { min-width: 0; font-size: .95rem; }
.pay-card table.calc-table th, .pay-card table.calc-table td { padding: 15px 22px; }
.pay-card table.calc-table thead th { text-transform: none; letter-spacing: 0; font-size: .92rem; font-weight: 800; color: var(--text); }
.pay-card table.calc-table tbody td:first-child { color: var(--text); }
.pay-card table.calc-table tbody tr:last-child td { border-bottom: none; }
.pay-card table.calc-table tbody tr.is-active td { background: var(--surface2); font-weight: 800; }
.pay-card table.calc-table tbody tr.is-active td:first-child { color: var(--text); }
/* Vertical column divider — first column ~68% wide so the line aligns with the
   Tax-rate field's left edge above (desktop). With the take-home column shown,
   shrink col 1 to 50% and add a second divider after Gross. */
.pay-card table.calc-table th:first-child, .pay-card table.calc-table td:first-child { width: 68%; border-right: 1px solid var(--border); }
.pay-card table.calc-table.show-net th:first-child, .pay-card table.calc-table.show-net td:first-child { width: 50%; }
.pay-card table.calc-table.show-net th:nth-child(2), .pay-card table.calc-table.show-net td:nth-child(2) { border-right: 1px solid var(--border); }
@media (max-width: 480px) { .pay-card table.calc-table th, .pay-card table.calc-table td { padding: 13px 14px; } }
.amort-toggle { margin-top: 16px; }

/* ── Status / error line ───────────────────────────────────────── */
.status-line { min-height: 22px; margin-top: 14px; font-size: .9rem; font-weight: 600; color: var(--accent-fg); }
.status-line.error { color: #b42318; font-weight: 700; }

/* ── Tool hub grid (index) ─────────────────────────────────────── */
.hub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(264px, 1fr)); gap: 20px; margin-top: 12px; }
.hub-card {
  display: block; text-decoration: none; position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 28px 26px; box-shadow: var(--shadow);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.hub-card:hover { transform: translateY(-5px); border-color: var(--accent); box-shadow: var(--shadow-lg); text-decoration: none; }
.hub-card .hub-tag { position: absolute; top: 18px; right: 18px; font-size: .75rem; font-weight: 700; color: var(--accent-fg); background: var(--accent-bg); padding: 4px 10px; border-radius: 999px; }
.hub-card .hub-icon { width: 56px; height: 56px; border-radius: 12px; background: linear-gradient(135deg, var(--accent), var(--accent-light)); display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.hub-card .hub-icon svg { width: 28px; height: 28px; stroke: #fff; stroke-width: 1.8; }
.hub-card h3 { font-size: 1.25rem; font-weight: 800; color: var(--text); margin-bottom: 8px; }
.hub-cat { grid-column: 1 / -1; font-size: 1.4rem; font-weight: 800; color: var(--text); letter-spacing: -.02em; margin: 14px 0 -6px; }
.hub-cat:first-child { margin-top: 0; }
.hub-card p { font-size: .92rem; color: var(--muted); line-height: 1.65; margin-bottom: 16px; }
.hub-card .hub-open { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; font-weight: 700; color: var(--accent); }

/* ── Content sections (how-it-works / faq) ─────────────────────── */
.section { max-width: 860px; margin: 20px auto; padding: 32px 20px; }
.section > h2 { font-size: 1.65rem; font-weight: 800; margin-bottom: 10px; color: var(--text); letter-spacing: -.02em; }
.section > .section-sub { color: var(--muted); margin-bottom: 24px; font-size: 1.05rem; }
.steps { display: grid; gap: 16px; }
.step { display: flex; gap: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow); transition: border-color .2s, box-shadow .2s; }
.step:hover { border-color: #d0ccc8; box-shadow: 0 2px 6px rgba(0,0,0,.06); }
.step-num { flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%; background: var(--accent-bg); color: var(--accent-fg); font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.step-body h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.step-body p { font-size: .95rem; color: var(--muted); line-height: 1.65; }

.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; transition: border-color .2s; }
.faq details:hover { border-color: #d0ccc8; }
.faq summary { cursor: pointer; padding: 18px 20px; font-weight: 700; font-size: 1rem; list-style: none; color: var(--text); transition: background .15s; }
.faq details[open] > summary { background: var(--surface2); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; float: right; color: var(--accent); font-weight: 700; font-size: 1.2rem; }
.faq details[open] summary::after { content: '\2013'; }
.faq .faq-body { padding: 0 20px 18px; font-size: .95rem; color: var(--muted); line-height: 1.7; }
.faq .faq-body a { color: var(--accent); text-decoration: underline; }

/* ── Footer ────────────────────────────────────────────────────── */
footer.page-footer { border-top: 1px solid var(--border); padding: 28px 20px; text-align: center; font-size: .84rem; color: var(--muted); margin-top: 32px; }
footer.page-footer nav { margin-bottom: 8px; line-height: 2; }
footer.page-footer nav a { color: var(--muted); transition: color .18s; }
footer.page-footer nav a:hover { color: var(--text); text-decoration: none; }

/* ── Toast ─────────────────────────────────────────────────────── */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--text); color: #fff; padding: 11px 20px; border-radius: var(--radius); font-size: .88rem; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 200; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 560px) {
  .result-box .r-val { font-size: 1.3rem; }
}

/* ── Amortization chart ───────────────────────────────────────── */
.amort-chart { margin-top: 22px; }
.amort-chart .chart-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; margin-bottom: 12px; }
.chart-title { font-size: .95rem; font-weight: 700; color: var(--text); margin: 0; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.ch-leg { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; color: var(--muted); }
.ch-leg .sw { width: 13px; height: 13px; border-radius: 3px; display: inline-block; flex: none; }
.sw-principal { background: var(--c-principal); }
.sw-interest { background: var(--c-interest); }
.sw-taxins { background: var(--c-taxins); }
.sw-balance { border-radius: 0; background: linear-gradient(var(--c-balance), var(--c-balance)) left center / 100% 2.5px no-repeat; }
.chart-svg-wrap svg { width: 100%; height: auto; display: block; }
.ch-grid { stroke: var(--border); stroke-width: 1; }
.ch-axis { fill: var(--muted); font-family: var(--mono); font-size: 14px; }
.ch-axis-l { text-anchor: end; }
.ch-axis-r { text-anchor: start; }
.ch-axis-x { text-anchor: middle; }
.ch-cap { fill: var(--muted); font-size: 13px; font-weight: 600; text-anchor: middle; }
.ch-principal { fill: var(--c-principal); }
.ch-interest { fill: var(--c-interest); }
.ch-taxins { fill: var(--c-taxins); }
.ch-bar rect { transition: opacity .12s ease; }
.ch-bar:hover rect { opacity: .76; }
.ch-balance { fill: none; stroke: var(--c-balance); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.ch-bal-dot { fill: var(--c-balance); }

/* ── Related-tool cross-link callout ──────────────────────────── */
.related-tool {
  display: flex; align-items: center; gap: 18px;
  max-width: 760px; margin: 28px auto 0;
  padding: 20px 24px;
  background: var(--accent-bg); border: 1.5px solid var(--accent);
  border-radius: var(--radius-lg); box-shadow: 0 2px 8px rgba(5, 150, 105, .08);
}
.related-tool .rt-icon {
  flex: none; width: 50px; height: 50px;
  display: grid; place-items: center;
  background: var(--surface); border-radius: 12px;
}
.related-tool .rt-icon svg {
  width: 26px; height: 26px; fill: none; stroke: var(--accent);
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.related-tool .rt-body { flex: 1 1 auto; min-width: 0; }
.related-tool .rt-title { font-size: 1.05rem; font-weight: 700; color: var(--accent-fg); margin: 0 0 4px; }
.related-tool .rt-sub { font-size: .9rem; color: var(--text); margin: 0; line-height: 1.5; }
.related-tool .rt-link {
  flex: none; display: inline-flex; align-items: center; gap: 7px;
  min-height: 44px; padding: 11px 20px;
  background: var(--accent); color: #fff; text-decoration: none;
  border-radius: 999px; font-weight: 700; font-size: .92rem;
  transition: background .18s ease, transform .15s ease, box-shadow .18s ease;
}
.related-tool .rt-link:hover { background: var(--accent-h); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(5, 150, 105, .2); }
@media (max-width: 560px) {
  .related-tool { flex-wrap: wrap; }
  .related-tool .rt-link { width: 100%; justify-content: center; }
}

/* ── Loan donut (principal vs interest) ───────────────────────── */
.loan-chart {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 14px 32px; margin-top: 22px;
}
.loan-chart .dn-svg { width: 230px; height: 230px; flex: none; }
.loan-chart .dn-svg svg { width: 100%; height: 100%; display: block; }
.dn-ring { transform-box: view-box; transform-origin: 100px 100px; transform: rotate(-90deg); }
.dn-principal { fill: none; stroke: var(--c-principal); stroke-width: 26; }
.dn-interest { fill: none; stroke: var(--c-interest); stroke-width: 26; }
.dn-center-val { fill: var(--text); font-family: var(--mono); font-size: 18px; font-weight: 700; text-anchor: middle; }
.dn-center-lbl { fill: var(--muted); font-size: 11px; text-anchor: middle; letter-spacing: .06em; text-transform: uppercase; }
.loan-chart .dn-legend { display: flex; flex-direction: column; gap: 14px; }
.dn-leg { display: flex; align-items: center; gap: 10px; }
.dn-sw { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.dn-sw-principal { background: var(--c-principal); }
.dn-sw-interest { background: var(--c-interest); }
.dn-leg-txt { display: flex; flex-direction: column; line-height: 1.25; }
.dn-leg-name { font-size: .82rem; color: var(--muted); font-weight: 600; }
.dn-leg-val { font-size: .98rem; color: var(--text); font-weight: 700; font-family: var(--mono); }

/* ── Chart entrance animations (first render only; JS-gated) ──── */
/* Mortgage bars grow up from the baseline (viewBox bottom = y 306). */
@keyframes ch-bar-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.ch-bar.ch-anim {
  transform-box: view-box; transform-origin: 0 306px;
  animation: ch-bar-grow .55s cubic-bezier(.2,.75,.3,1) backwards;
}
/* Balance line draws on (polyline carries pathLength="1"). */
@keyframes ch-line-draw { to { stroke-dashoffset: 0; } }
.ch-balance.ch-anim {
  stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: ch-line-draw 1s ease .35s forwards;
}
@keyframes ch-fade { from { opacity: 0; } to { opacity: 1; } }
.ch-dots.ch-anim { animation: ch-fade .5s ease 1s backwards; }
/* Loan donut spins + scales into place; center text fades in. */
@keyframes dn-ring-in {
  from { transform: rotate(-170deg) scale(.7); opacity: 0; }
  to   { transform: rotate(-90deg) scale(1); opacity: 1; }
}
.dn-ring.dn-anim { animation: dn-ring-in .8s cubic-bezier(.2,.75,.3,1) backwards; }
@keyframes dn-fade { from { opacity: 0; } to { opacity: 1; } }
.dn-center.dn-anim { animation: dn-fade .5s ease .5s backwards; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .ch-bar, .ch-balance, .ch-dots, .dn-ring, .dn-center { animation: none !important; }
  .ch-balance { stroke-dashoffset: 0 !important; }
}

/* ── Tips page — "The Receipt" palette (scoped: .calc-tips only) ───
   Color-codes each result by meaning. Amber = the tip you add,
   blue = the full check, emerald (the family signature) = the answer.
   Emerald stays the brand anchor; amber + blue add the palette. */
.calc-tips {
  --tip-amber: #b45309;   /* amber-700 text — 5.9:1 on #fffbeb */
  --tip-amber-bg: #fffbeb;
  --tip-amber-bd: #fcd34d;
  --tip-amber-cta: #d97706;
  --tip-blue: #1d4ed8;    /* blue-700 text — 6.5:1 on #eff6ff */
  --tip-blue-bg: #eff6ff;
  --tip-blue-bd: #bfdbfe;
}

/* Hero mark: warm → emerald gradient signals the new palette */
.calc-tips .tool-hero .hero-icon {
  background: linear-gradient(135deg, #f59e0b, var(--accent));
  box-shadow: 0 2px 8px rgba(245, 158, 11, .15);
}

/* Tip-% controls go amber — the control that drives the amber result */
.calc-tips #tipChips .chip:hover {
  border-color: var(--tip-amber-cta);
  background: var(--tip-amber-bg);
}
.calc-tips #tipChips .chip.active {
  background: var(--tip-amber-cta); border-color: var(--tip-amber-cta); color: #fff;
}
.calc-tips #tipPct:focus {
  border-color: var(--tip-amber-cta);
  box-shadow: 0 0 0 3px rgba(217,119,6,.15);
}

/* Result layout: emerald answer is a full-width hero; tip + total below */
.calc-tips .result-grid { grid-template-columns: 1fr 1fr; }
.calc-tips .result-box.primary {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border-width: 1.5px;
}
.calc-tips .result-box.primary .r-val { font-size: 2.3rem; }

/* Tip amount → amber */
.calc-tips .result-box.box-tip {
  background: var(--tip-amber-bg); border-color: var(--tip-amber-bd);
}
.calc-tips .box-tip .r-label,
.calc-tips .box-tip .r-val { color: var(--tip-amber); }

/* Total with tip → blue */
.calc-tips .result-box.box-total {
  background: var(--tip-blue-bg); border-color: var(--tip-blue-bd);
}
.calc-tips .box-total .r-label,
.calc-tips .box-total .r-val { color: var(--tip-blue); }

@media (max-width: 560px) {
  .calc-tips .result-grid { grid-template-columns: 1fr; }
  .calc-tips .result-box.primary .r-val { font-size: 2rem; }
}

/* ── Scientific calculator keypad (scientific/) ─────────────────── */
.sci-display { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem; text-align: right; margin-bottom: 1rem; overflow-x: auto; }
.sci-expr { font-family: var(--mono); font-size: 1rem; color: var(--muted); min-height: 1.4em; word-break: break-all; }
.sci-result { font-family: var(--mono); font-size: 1.9rem; font-weight: 600; color: var(--text); word-break: break-all; line-height: 1.2; }
.sci-toolbar { display: flex; gap: .5rem; align-items: center; margin-bottom: .75rem; flex-wrap: wrap; }
.sci-toggle { font: 600 .9rem/1 'Outfit', sans-serif; padding: .45rem .85rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); cursor: pointer; }
.sci-toggle.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.sci-memflag { margin-left: auto; font: 600 .8rem/1 var(--mono); color: var(--muted); }
.sci-keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
.sci-key { font: 600 1.05rem/1 var(--mono); padding: .9rem .25rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); cursor: pointer; transition: background .12s ease, transform .04s ease; }
.sci-key:hover { background: var(--surface2); }
.sci-key:active { transform: translateY(1px); }
.sci-key.fn { color: var(--accent-fg); background: var(--accent-bg); border-color: var(--accent-bg); font-size: .82rem; }
.sci-key.op { color: var(--accent); font-size: 1.15rem; }
.sci-key.eq { background: var(--accent); border-color: var(--accent); color: #fff; }
.sci-key.eq:hover { background: var(--accent-h); }
.sci-key.span2 { grid-column: span 2; }
@media (max-width: 520px) { .sci-key { padding: .75rem .15rem; font-size: .95rem; } .sci-key.fn { font-size: .72rem; } }

/* ── Heat Index Calculator ── */
.hi-none            { background:#eef2f0; color:var(--text); }
.hi-caution         { background:#fde68a; color:#713f12; }
.hi-extreme-caution { background:#fdba74; color:#7c2d12; }
.hi-danger          { background:#f87171; color:#450a0a; }
.hi-extreme-danger  { background:#b91c1c; color:#fff; }
.hi-band { display:inline-block; margin-top:8px; padding:3px 12px; border-radius:999px; font-weight:700; font-size:.9rem; }
.hi-band:empty { display:none; }
.hi-effect { margin:12px 0 0; font-size:.95rem; color:var(--text); }
.hi-scroll { overflow-x:auto; }
table.hi-table td { text-align:center; font-weight:600; }
table.hi-table th { text-align:center; background:var(--surface2); }
.hi-table tbody th { font-weight:700; }

/* ── GPA Calculator ── */
.gpa-rows { display:flex; flex-direction:column; gap:10px; }
.gpa-head, .gpa-row {
  display:grid;
  grid-template-columns: 1.5fr 1fr .8fr 1.1fr 40px;
  gap:10px; align-items:center;
}
.gpa-head { font-size:.72rem; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--muted); }
.gpa-head span:last-child { text-align:center; }
.gpa-row .calc-input, .gpa-row .calc-select { padding:11px 12px; font-size:.95rem; }
.gpa-del {
  display:inline-flex; align-items:center; justify-content:center;
  width:40px; height:44px; padding:0; cursor:pointer;
  background:var(--surface); color:var(--muted);
  border:1.5px solid var(--border); border-radius:var(--radius);
  font-size:1.3rem; line-height:1; transition:border-color .15s, color .15s, background .15s;
}
.gpa-del:hover { border-color:#f87171; color:#b91c1c; background:#fef2f2; }
.gpa-actions { margin-top:14px; }
.gpa-note { margin:14px 0 0; font-size:.85rem; color:var(--muted); }
@media (max-width:640px) {
  .gpa-head { display:none; }
  .gpa-row { grid-template-columns: 1fr 1fr; }
  .gpa-row .gpa-course { grid-column: 1 / -1; }
  .gpa-row .gpa-del { grid-column: 2 / 3; justify-self:end; }
}

/* ── BMI Calculator ── */
.bmi-band { display:inline-block; margin-top:8px; padding:3px 12px; border-radius:999px; font-weight:700; font-size:.9rem; }
.bmi-band:empty { display:none; }
.bmi-under  { background:#bfdbfe; color:#1e3a8a; }
.bmi-normal { background:#bbf7d0; color:#14532d; }
.bmi-over   { background:#fde68a; color:#713f12; }
.bmi-ob1    { background:#fdba74; color:#7c2d12; }
.bmi-ob2    { background:#f87171; color:#450a0a; }
.bmi-ob3    { background:#b91c1c; color:#fff; }
.bmi-note { margin:14px 0 0; font-size:.85rem; color:var(--muted); }
/* [hidden] alone loses to .field-grid { display:grid }; force it for the unit groups. */
.bmi-metric[hidden], .bmi-imperial[hidden] { display:none; }
.bmi-hin { display:flex; gap:10px; }
.bmi-hin .input-affix { flex:1; }
.bmi-scale-wrap { margin-top:20px; }
.bmi-scale { position:relative; display:flex; height:14px; border-radius:999px; overflow:hidden; }
.bmi-scale span { display:block; height:100%; }
.bmi-marker {
  position:absolute; top:-5px; width:4px; height:24px; border-radius:2px;
  background:var(--text); box-shadow:0 0 0 2px var(--surface);
  transform:translateX(-50%); transition:left .2s;
}
.bmi-ticks { display:flex; justify-content:space-between; margin-top:6px; font-size:.7rem; color:var(--muted); }
