/* =====================================================================
   Swift calculator kit  (calc.css, v1)
   Loaded after /assets/css/main.css on every calculator page.
   Hallmark . component: calculator kit . genre: modern-minimal utility . theme: Swift (navy/teal tokens from main.css)
   states: default . hover . focus . active . disabled . loading . error . success
           (form controls, buttons, seg, switch, range, drop zone; links and disclosures: hover/focus/active)
   Forced-state classes for the kitchen-sink demo: .is-hover .is-focus .is-active
   State hooks: :disabled / [aria-disabled=true], [data-state=loading|error|success] (button, drop, field, switch,
   seg), [aria-invalid=true] (inputs), [aria-busy=true] (seg, switch).
   pre-emit critique: P4 H4 E4 S4 R5 V3 (Variety is low on purpose: a utility kit should look like the site around it)
   contrast: pass. Checked ratios (WCAG, on white / on --gray-50):
     --calc-muted #5a6778 5.76 / 5.37 . --calc-accent #17706e 5.87 / 5.47 (white text on it 5.87)
     --calc-field-line #8a95a5 3.03 (UI component border) . --calc-focus (--teal-dark) 3.90
     --calc-error #b42318 6.57 . --calc-warn-ink on warn-bg 6.95 . --calc-ok #1b7a4b 5.34
   Everything is scoped under .calc-page or a calc- prefixed class. main.css globals that leak in
   (section padding, h1-h4 sizes, p colour, ul reset, button reset) are neutralised below.
   ===================================================================== */

/* ---- 1. Tokens ------------------------------------------------------ */
.calc-page {
  --calc-ink: var(--navy);
  --calc-text: var(--gray-700);
  --calc-strong: var(--gray-900);
  --calc-muted: #5a6778;
  --calc-accent: #17706e;
  --calc-accent-hover: #125c5a;
  --calc-accent-active: #0e4a48;
  --calc-on-accent: var(--white);
  --calc-focus: var(--teal-dark);
  --calc-line: var(--gray-200);
  --calc-line-soft: var(--gray-100);
  --calc-field-line: #8a95a5;
  --calc-field-line-strong: #6b7788;
  --calc-surface: var(--white);
  --calc-surface-2: var(--gray-50);
  --calc-surface-3: var(--gray-100);
  --calc-error: #b42318;
  --calc-error-bg: #fef3f2;
  --calc-error-line: #f1b3ad;
  --calc-warn-ink: #7a4b00;
  --calc-warn-bg: #fff7e6;
  --calc-warn-line: #e6c27a;
  --calc-info-bg: #eef7f7;
  --calc-info-line: #b4dad9;
  --calc-ok: #1b7a4b;
  --calc-ok-bg: #eaf6ef;
  --calc-ok-line: #a9d6bd;
  --calc-shade: rgba(15, 42, 68, .28);
  --calc-h: 44px;
  --calc-r: var(--radius-sm);
  --calc-r-lg: 8px;
  --calc-gutter: 16px;
}

/* ---- 2. Page shell and neutralising main.css globals ------------------ */
.calc-page {
  display: block;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 20px var(--calc-gutter) 64px;
  color: var(--calc-text);
  font-size: 16px;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}
@media (min-width: 768px) { .calc-page { --calc-gutter: 24px; padding-top: 24px; padding-bottom: 80px; } }

:where(.calc-page) section { padding: 0; }
.calc-page [hidden] { display: none !important; }
:where(.calc-page) :is(h1, h2, h3, h4) {
  color: var(--calc-ink);
  font-style: normal;
  letter-spacing: normal;
  text-wrap: balance;
  overflow-wrap: break-word;
  min-width: 0;
}
:where(.calc-page) h2 { font-size: clamp(20px, 1rem + .8vw, 24px); line-height: 1.25; font-weight: 700; letter-spacing: -.01em; margin: 0 0 12px; }
:where(.calc-page) h3 { font-size: 16px; line-height: 1.35; font-weight: 600; margin: 0 0 6px; }
:where(.calc-page) p { color: var(--calc-text); line-height: 1.6; margin: 0; }
:where(.calc-page) strong { color: var(--calc-strong); font-weight: 600; }
:where(.calc-page) table { border-collapse: collapse; border-spacing: 0; }
:where(.calc-page) :is(input, select, textarea, button) { font-family: inherit; }
:where(.calc-page) fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
:where(.calc-page) legend { padding: 0; }
:where(.calc-page) summary { list-style: none; }
:where(.calc-page) summary::-webkit-details-marker { display: none; }

/* in-copy links only; component anchors carry a class */
:is(.calc-lede, .calc-how, .calc-faq, .calc-note, .calc-help, .calc-callout, .calc-cta p) a:not([class]) {
  color: var(--calc-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  border-radius: 2px;
}
@media (hover: hover) {
  :is(.calc-lede, .calc-how, .calc-faq, .calc-note, .calc-help, .calc-callout, .calc-cta p) a:not([class]):hover { color: var(--calc-accent-hover); text-decoration-thickness: 2px; }
}
:is(.calc-lede, .calc-how, .calc-faq, .calc-note, .calc-help, .calc-callout, .calc-cta p) a:not([class]):focus-visible { outline: 2px solid var(--calc-focus); outline-offset: 2px; }

/* block rhythm */
.calc-crumbs { margin: 0 0 16px; }
.calc-head { margin: 0 0 24px; }
.calc-card { margin: 0 0 48px; }
.calc-how, .calc-faq, .calc-related, .calc-section { margin: 0 0 48px; }
.calc-how > *, .calc-faq > *, .calc-related > *, .calc-section > * { max-width: 100%; }
/* .calc-section: a neutral block with the same 48px rhythm, for an h2 over one tool or a list of steps (pages with more than one tool).
   A card that closes the section hands its 48px to the section so the two never stack. */
.calc-section > .calc-card:last-child { margin-bottom: 0; }
.calc-cta { margin: 0; }

/* ---- 3. Breadcrumb and header ----------------------------------------- */
/* Inline flow, not flex: a long last crumb wraps inside the line like text. Each separator is glued (no-break space) to the first
   word of the crumb after it, so a wrapped line never starts with a separator on its own. */
.calc-crumbs ol { display: block; list-style: none; margin: 0; padding: 0; font-size: 13px; line-height: 1.4; color: var(--calc-muted); }
.calc-crumbs li { display: inline; }
.calc-crumbs li + li::before { content: "\203A\00A0"; margin: 0 1px 0 4px; color: var(--calc-field-line); }
.calc-crumbs a { position: relative; color: var(--calc-muted); text-decoration: none; white-space: nowrap; border-radius: 2px; }
.calc-crumbs a::after { content: ""; position: absolute; inset: -10px -6px; }
@media (hover: hover) { .calc-crumbs a:hover { color: var(--calc-ink); text-decoration: underline; text-underline-offset: 2px; } }
.calc-crumbs a:focus-visible { outline: 2px solid var(--calc-focus); outline-offset: 2px; }
.calc-crumbs a:active { color: var(--calc-ink); }
.calc-crumbs [aria-current] { color: var(--calc-ink); font-weight: 600; }

.calc-head h1 {
  font-size: clamp(28px, 1.2rem + 2.2vw, 40px);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -.02em;
  margin: 0 0 12px;
}
.calc-lede { font-size: 17px; line-height: 1.55; color: var(--calc-text); max-width: 68ch; margin: 0; }

/* ---- 4. Calculator card ------------------------------------------------ */
.calc-page .calc-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding: 14px;
  background: var(--calc-surface);
  border: 1px solid var(--calc-line);
  border-radius: var(--calc-r-lg);
  box-shadow: var(--shadow-xs);
}
@media (min-width: 480px) { .calc-page .calc-card { padding: 20px; } }
@media (min-width: 880px) {
  .calc-page .calc-card { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 28px; padding: 24px; }
}
.calc-inputs { display: grid; gap: 16px; align-content: start; min-width: 0; margin: 0; }
.calc-results {
  display: grid;
  gap: 16px;
  align-content: start;
  min-width: 0;
  padding: 14px;
  background: var(--calc-surface-2);
  border: 1px solid var(--calc-line);
  border-radius: var(--calc-r);
}
@media (min-width: 480px) { .calc-results { padding: 20px; } }
.calc-results > * { min-width: 0; }

.calc-results[data-state="empty"] > :not(.calc-empty):not(.calc-note) { display: none; }
.calc-results:not([data-state="empty"]) > .calc-empty { display: none; }
.calc-results[data-state="error"] > :is(.calc-result, .calc-breakdown, .calc-compare, .calc-chart, .calc-schedule) { opacity: .35; filter: grayscale(1); }
.calc-empty { font-size: 15px; color: var(--calc-muted); }

/* ---- 5. Fields ------------------------------------------------------------ */
.calc-field { display: grid; gap: 6px; align-content: start; min-width: 0; position: relative; }
.calc-field-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 420px) { .calc-field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.calc-label { display: block; font-size: 14px; font-weight: 600; line-height: 1.3; color: var(--calc-ink); }
.calc-label small, .calc-label .calc-opt { font-size: 13px; font-weight: 400; color: var(--calc-muted); }
.calc-help { font-size: 13px; line-height: 1.45; color: var(--calc-muted); margin: 0; }
.calc-field-error { font-size: 13px; line-height: 1.45; color: var(--calc-error); font-weight: 500; margin: 0; }
.calc-field[data-state="error"] > .calc-help { display: none; }

.calc-input, .calc-select, .calc-textarea {
  display: block;
  width: 100%;
  min-width: 0;
  height: var(--calc-h);
  padding: 0 12px;
  font: inherit;
  font-size: 16px;
  line-height: 1.25;
  color: var(--calc-strong);
  background-color: var(--calc-surface);
  border: 1px solid var(--calc-field-line);
  border-radius: var(--calc-r);
  outline: 2px solid transparent;
  outline-offset: 1px;
  font-variant-numeric: tabular-nums;
  transition: background-color .12s ease, border-color .12s ease;
}
.calc-textarea { height: auto; min-height: 6rem; padding: 10px 12px; line-height: 1.5; resize: vertical; }
/* date: Chrome and Safari size and pad the native control their own way, so reset it to the same box as the other inputs */
.calc-input[type="date"] { -webkit-appearance: none; appearance: none; min-height: var(--calc-h); padding: 0 12px; font-size: 16px; line-height: 1.25; }
.calc-input[type="date"]::-webkit-datetime-edit { padding: 0; }
.calc-input[type="date"]::-webkit-date-and-time-value { min-height: 1.25em; margin: 0; text-align: left; }
.calc-input[type="date"]::-webkit-calendar-picker-indicator { margin: 0 0 0 4px; padding: 0; cursor: pointer; opacity: .75; }
.calc-select { padding-right: 36px; text-overflow: ellipsis; cursor: pointer; }
.calc-input::placeholder, .calc-textarea::placeholder { color: var(--calc-muted); opacity: 1; }
.calc-input[readonly] { background-color: var(--calc-surface-2); }

@media (hover: hover) {
  .calc-input:hover:not(:focus):not(:disabled):not([readonly]),
  .calc-select:hover:not(:focus):not(:disabled),
  .calc-textarea:hover:not(:focus):not(:disabled) { background-color: var(--calc-surface-2); }
}
.calc-input.is-hover, .calc-select.is-hover, .calc-textarea.is-hover { background-color: var(--calc-surface-2); }
.calc-input:focus, .calc-select:focus, .calc-textarea:focus,
.calc-input.is-focus, .calc-select.is-focus, .calc-textarea.is-focus { border-color: var(--calc-ink); outline-color: var(--calc-focus); background-color: var(--calc-surface); }
.calc-input.is-active, .calc-select.is-active, .calc-textarea.is-active { border-color: var(--calc-ink); outline-color: var(--calc-focus); }
.calc-input:disabled, .calc-select:disabled, .calc-textarea:disabled,
.calc-input[aria-disabled="true"] { opacity: .55; cursor: not-allowed; background-color: var(--calc-surface-3); }
.calc-input[aria-invalid="true"], .calc-select[aria-invalid="true"], .calc-textarea[aria-invalid="true"],
.calc-field[data-state="error"] :is(.calc-input, .calc-select, .calc-textarea) { border-color: var(--calc-error); }
.calc-input[aria-invalid="true"]:focus, .calc-select[aria-invalid="true"]:focus, .calc-textarea[aria-invalid="true"]:focus { outline-color: var(--calc-error); }
.calc-field[data-state="success"] :is(.calc-input, .calc-select, .calc-textarea) { border-color: var(--calc-ok); }
.calc-field[data-state="loading"] :is(.calc-input, .calc-select, .calc-textarea) { border-color: var(--calc-field-line-strong); }

/* affix wrapper (added by SwiftUI.decorate): $ prefix, % suffix, select chevron, state icon slot */
.calc-affix { position: relative; display: block; min-width: 0; }
.calc-affix__pre, .calc-affix__suf {
  position: absolute; top: 0; height: var(--calc-h);
  display: flex; align-items: center;
  font-size: 16px; color: var(--calc-muted); pointer-events: none;
}
.calc-affix__pre { left: 12px; }
.calc-affix__suf { right: 12px; }
.calc-affix--pre > .calc-input { padding-left: 26px; }
.calc-affix--suf > .calc-input { padding-right: 30px; }
.calc-affix::after { content: ""; display: none; position: absolute; right: 12px; top: calc(var(--calc-h) / 2 - 9px); width: 18px; height: 18px; pointer-events: none; }
.calc-affix--suf::after { right: 32px; }
.calc-affix--select > .calc-select { -webkit-appearance: none; appearance: none; background-image: none; }
.calc-affix--select::after {
  display: block; width: 8px; height: 8px; right: 16px; top: calc(var(--calc-h) / 2 - 6px);
  border: solid var(--calc-ink); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.calc-field[data-state] .calc-affix:not(.calc-affix--select) > .calc-input { padding-right: 38px; }
.calc-field[data-state] .calc-affix--suf:not(.calc-affix--select) > .calc-input { padding-right: 58px; }
.calc-field[data-state="error"] .calc-affix:not(.calc-affix--select)::after {
  display: block; width: 18px; height: 18px; border-radius: 50%;
  background: var(--calc-error); color: var(--calc-on-accent);
  content: "!"; font-size: 12px; font-weight: 700; line-height: 18px; text-align: center;
}
.calc-field[data-state="success"] .calc-affix:not(.calc-affix--select)::after {
  display: block; width: 6px; height: 11px; top: calc(var(--calc-h) / 2 - 8px); margin-right: 3px;
  border: solid var(--calc-ok); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.calc-field[data-state="loading"] .calc-affix:not(.calc-affix--select)::after {
  display: block; border: 2px solid var(--calc-line); border-top-color: var(--calc-accent); border-radius: 50%;
  animation: calc-spin .7s linear infinite;
}
@keyframes calc-spin { to { transform: rotate(360deg); } }

/* ---- 6. Buttons: one primary, one ghost, same height --------------------- */
.calc-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.calc-btn {
  --_bg: var(--calc-surface);
  --_fg: var(--calc-ink);
  --_bd: var(--calc-field-line);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--calc-h); min-width: var(--calc-h);
  padding: 0 20px;
  font: inherit; font-size: 15px; font-weight: 600; line-height: 1; white-space: nowrap;
  color: var(--_fg); background: var(--_bg);
  border: 1px solid var(--_bd); border-radius: var(--calc-r);
  text-decoration: none; text-align: center; cursor: pointer;
  outline: 2px solid transparent; outline-offset: 2px;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease, transform .06s ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.calc-btn--primary { --_bg: var(--calc-accent); --_fg: var(--calc-on-accent); --_bd: var(--calc-accent); }
.calc-btn--ghost { --_bg: var(--calc-surface); --_fg: var(--calc-ink); --_bd: var(--calc-field-line); }

@media (hover: hover) {
  .calc-btn--primary:hover:not(:disabled):not([aria-disabled="true"]):not([data-state]) { --_bg: var(--calc-accent-hover); --_bd: var(--calc-accent-hover); }
  .calc-btn--ghost:hover:not(:disabled):not([aria-disabled="true"]):not([data-state]) { --_bg: var(--calc-surface-2); --_bd: var(--calc-ink); }
}
.calc-btn--primary.is-hover { --_bg: var(--calc-accent-hover); --_bd: var(--calc-accent-hover); }
.calc-btn--ghost.is-hover { --_bg: var(--calc-surface-2); --_bd: var(--calc-ink); }
.calc-btn:focus-visible, .calc-btn.is-focus { outline-color: var(--calc-focus); }
.calc-btn:active:not(:disabled):not([aria-disabled="true"]):not([data-state]), .calc-btn.is-active { transform: translateY(1px); }
.calc-btn--primary:active:not(:disabled):not([aria-disabled="true"]):not([data-state]), .calc-btn--primary.is-active { --_bg: var(--calc-accent-active); --_bd: var(--calc-accent-active); }
.calc-btn--ghost:active:not(:disabled):not([aria-disabled="true"]):not([data-state]), .calc-btn--ghost.is-active { --_bg: var(--calc-surface-3); --_bd: var(--calc-ink); }
.calc-btn:disabled, .calc-btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.calc-btn[data-state="loading"] { cursor: progress; pointer-events: none; }
.calc-btn[data-state="loading"]::before {
  content: ""; flex: none; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: calc-spin .7s linear infinite;
}
.calc-btn[data-state="error"] { --_bg: var(--calc-error-bg); --_fg: var(--calc-error); --_bd: var(--calc-error); }
.calc-btn[data-state="success"] { --_bg: var(--calc-ok-bg); --_fg: var(--calc-ok); --_bd: var(--calc-ok); }
.calc-btn[data-state="success"]::before {
  content: ""; flex: none; width: 5px; height: 10px; margin: -2px 2px 0 0;
  border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* ---- 7. Segmented control ----------------------------------------------- */
.calc-seg {
  display: flex; gap: 2px; min-width: 0;
  height: var(--calc-h); padding: 3px;
  background: var(--calc-surface-3);
  border: 1px solid var(--calc-field-line); border-radius: var(--calc-r);
}
.calc-seg > [role="radio"] {
  flex: 1 1 0; min-width: 0; padding: 0 10px;
  font: inherit; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--calc-ink); background: transparent;
  border: 0; border-radius: calc(var(--calc-r) - 2px);
  cursor: pointer; outline: 2px solid transparent; outline-offset: 1px;
  transition: background-color .12s ease, color .12s ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.calc-seg--wrap { height: auto; flex-wrap: wrap; }
.calc-seg--wrap > [role="radio"] { flex: 1 1 auto; min-height: 36px; padding: 6px 10px; line-height: 1.25; white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
/* narrow screens: one option per row, full width, the whole label visible */
@media (max-width: 479.98px) {
  .calc-seg--wrap { flex-direction: column; }
  .calc-seg--wrap > [role="radio"] { flex: 0 0 auto; width: 100%; min-height: 40px; }
}
.calc-seg > [role="radio"][aria-checked="true"] { background: var(--calc-ink); color: var(--calc-on-accent); }
@media (hover: hover) {
  .calc-seg > [role="radio"][aria-checked="false"]:hover:not(:disabled):not([aria-disabled="true"]) { background: var(--calc-surface); }
}
.calc-seg > [role="radio"][aria-checked="false"].is-hover { background: var(--calc-surface); }
.calc-seg > [role="radio"]:focus-visible, .calc-seg > [role="radio"].is-focus { outline-color: var(--calc-focus); }
.calc-seg > [role="radio"]:active:not(:disabled), .calc-seg > [role="radio"].is-active { box-shadow: inset 0 1px 3px var(--calc-shade); }
.calc-seg > [role="radio"][aria-checked="false"]:active:not(:disabled), .calc-seg > [role="radio"][aria-checked="false"].is-active { background: var(--calc-surface-2); }
.calc-seg > [role="radio"]:disabled, .calc-seg > [role="radio"][aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.calc-seg[aria-busy="true"], .calc-seg[data-state="loading"] { opacity: .7; cursor: progress; pointer-events: none; }
.calc-seg[aria-invalid="true"], .calc-seg[data-state="error"] { border-color: var(--calc-error); }
.calc-seg[data-state="success"] { border-color: var(--calc-ok); }
.calc-seg[aria-disabled="true"] { opacity: .55; }

/* ---- 8. Switch ------------------------------------------------------------ */
.calc-switch {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: var(--calc-h); font-size: 15px; line-height: 1.35; color: var(--calc-text); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.calc-switch > input {
  -webkit-appearance: none; appearance: none;
  position: relative; flex: none; width: 44px; height: 26px; margin: 0;
  background: var(--calc-field-line); border: 0; border-radius: 13px;
  cursor: pointer; outline: 2px solid transparent; outline-offset: 2px;
  transition: background-color .15s ease;
}
.calc-switch > input::before {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--calc-surface); box-shadow: var(--shadow-xs);
  transition: transform .15s ease, width .1s ease;
}
.calc-switch > input:checked { background: var(--calc-accent); }
.calc-switch > input:checked::before { transform: translateX(18px); }
@media (hover: hover) {
  .calc-switch:hover > input:not(:disabled):not(:checked) { background: var(--calc-field-line-strong); }
  .calc-switch:hover > input:not(:disabled):checked { background: var(--calc-accent-hover); }
}
.calc-switch > input.is-hover:not(:checked) { background: var(--calc-field-line-strong); }
.calc-switch > input.is-hover:checked { background: var(--calc-accent-hover); }
.calc-switch > input:focus-visible, .calc-switch > input.is-focus { outline-color: var(--calc-focus); }
.calc-switch > input:active:not(:disabled)::before, .calc-switch > input.is-active::before { width: 24px; }
.calc-switch > input:active:not(:disabled):checked::before, .calc-switch > input.is-active:checked::before { transform: translateX(14px); }
.calc-switch > input:disabled { opacity: .55; cursor: not-allowed; }
.calc-switch:has(> input:disabled) { cursor: not-allowed; color: var(--calc-muted); }
.calc-switch[aria-busy="true"] > input, .calc-switch[data-state="loading"] > input { cursor: progress; }
.calc-switch[aria-busy="true"] > input::before, .calc-switch[data-state="loading"] > input::before {
  background: transparent; box-shadow: none; border: 2px solid var(--calc-surface); border-top-color: transparent;
  animation: calc-spin .7s linear infinite;
}
.calc-switch > input[aria-invalid="true"], .calc-switch[data-state="error"] > input { box-shadow: 0 0 0 2px var(--calc-error); }
.calc-switch[data-state="success"] > input:checked { background: var(--calc-ok); }

/* ---- 9. Range ------------------------------------------------------------- */
.calc-range-row { display: flex; align-items: center; gap: 12px; }
.calc-range-row .calc-range { flex: 1 1 auto; min-width: 0; }
.calc-range-out { flex: none; min-width: 56px; text-align: right; font-size: 15px; font-weight: 600; color: var(--calc-ink); }
.calc-range {
  -webkit-appearance: none; appearance: none;
  display: block; width: 100%; height: var(--calc-h); margin: 0; padding: 0;
  background: transparent; cursor: pointer; outline: none;
}
.calc-range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--calc-field-line); }
.calc-range::-moz-range-track { height: 4px; border-radius: 2px; background: var(--calc-field-line); }
.calc-range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%;
  background: var(--calc-accent); border: 2px solid var(--calc-surface); box-shadow: 0 0 0 1px var(--calc-accent);
  transition: background-color .12s ease, box-shadow .12s ease, transform .08s ease;
}
.calc-range::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--calc-accent); border: 2px solid var(--calc-surface); box-shadow: 0 0 0 1px var(--calc-accent);
}
@media (hover: hover) {
  .calc-range:hover:not(:disabled)::-webkit-slider-thumb { background: var(--calc-accent-hover); box-shadow: 0 0 0 1px var(--calc-accent-hover); }
  .calc-range:hover:not(:disabled)::-moz-range-thumb { background: var(--calc-accent-hover); box-shadow: 0 0 0 1px var(--calc-accent-hover); }
}
.calc-range.is-hover::-webkit-slider-thumb { background: var(--calc-accent-hover); box-shadow: 0 0 0 1px var(--calc-accent-hover); }
.calc-range:focus-visible::-webkit-slider-thumb, .calc-range.is-focus::-webkit-slider-thumb { box-shadow: 0 0 0 1px var(--calc-accent), 0 0 0 4px var(--calc-focus); }
.calc-range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 1px var(--calc-accent), 0 0 0 4px var(--calc-focus); }
.calc-range:active:not(:disabled)::-webkit-slider-thumb, .calc-range.is-active::-webkit-slider-thumb { transform: scale(1.12); background: var(--calc-accent-active); }
.calc-range:disabled { opacity: .55; cursor: not-allowed; }
.calc-range[aria-busy="true"] { opacity: .7; cursor: progress; }
.calc-range[aria-invalid="true"]::-webkit-slider-thumb { background: var(--calc-error); box-shadow: 0 0 0 1px var(--calc-error); }
.calc-range[aria-invalid="true"]::-moz-range-thumb { background: var(--calc-error); box-shadow: 0 0 0 1px var(--calc-error); }
.calc-range[data-state="success"]::-webkit-slider-thumb { background: var(--calc-ok); box-shadow: 0 0 0 1px var(--calc-ok); }
.calc-range[data-state="success"]::-moz-range-thumb { background: var(--calc-ok); box-shadow: 0 0 0 1px var(--calc-ok); }

/* ---- 10. File drop zone ----------------------------------------------------- */
.calc-drop {
  position: relative; display: grid; justify-items: center; gap: 4px; text-align: center;
  min-height: 112px; align-content: center; padding: 20px 16px;
  color: var(--calc-ink); background: var(--calc-surface);
  border: 2px dashed var(--calc-field-line); border-radius: var(--calc-r-lg);
  outline: 2px solid transparent; outline-offset: 2px;
  cursor: pointer; transition: background-color .12s ease, border-color .12s ease;
}
.calc-drop__input { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); border: 0; white-space: nowrap; }
.calc-drop__title { font-size: 15px; font-weight: 600; color: var(--calc-ink); overflow-wrap: anywhere; }
.calc-drop__hint { font-size: 13px; color: var(--calc-muted); }
@media (hover: hover) { .calc-drop:hover:not([aria-disabled="true"]):not([data-state]) { background: var(--calc-surface-2); border-color: var(--calc-ink); } }
.calc-drop.is-hover { background: var(--calc-surface-2); border-color: var(--calc-ink); }
.calc-drop.is-dragover { background: var(--calc-info-bg); border-color: var(--calc-accent); }
.calc-drop:focus-within, .calc-drop.is-focus { outline-color: var(--calc-focus); border-color: var(--calc-ink); }
.calc-drop:active:not([aria-disabled="true"]), .calc-drop.is-active { background: var(--calc-surface-3); }
.calc-drop[aria-disabled="true"] { opacity: .55; cursor: not-allowed; background: var(--calc-surface-3); }
.calc-drop[data-state="loading"] { cursor: progress; background: var(--calc-surface-2); }
.calc-drop[data-state="loading"]::before {
  content: ""; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--calc-line); border-top-color: var(--calc-accent); animation: calc-spin .7s linear infinite;
}
.calc-drop[data-state="error"] { border-color: var(--calc-error); background: var(--calc-error-bg); }
.calc-drop[data-state="error"] .calc-drop__title { color: var(--calc-error); }
.calc-drop[data-state="success"] { border-color: var(--calc-ok); background: var(--calc-ok-bg); }
.calc-drop[data-state="success"] .calc-drop__title { color: var(--calc-ok); }

/* ---- 11. Disclosures: more options, FAQ, steps ------------------------------------ */
.calc-more, .calc-steps > details, .calc-steps > li > details {
  background: var(--calc-surface); border: 1px solid var(--calc-line); border-radius: var(--calc-r);
}
.calc-more > summary, .calc-faq__item > summary, .calc-steps summary {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: var(--calc-h); padding: 0 12px;
  font-size: 15px; font-weight: 600; line-height: 1.35; color: var(--calc-ink);
  cursor: pointer; border-radius: var(--calc-r);
  outline: 2px solid transparent; outline-offset: 2px;
  -webkit-tap-highlight-color: transparent;
}
.calc-more > summary::after, .calc-faq__item > summary::after, .calc-steps summary::after {
  content: ""; flex: none; width: 8px; height: 8px; margin: -3px 2px 0 0;
  border: solid var(--calc-muted); border-width: 0 2px 2px 0; transform: rotate(45deg);
  transition: transform .15s ease;
}
.calc-more[open] > summary::after, .calc-faq__item[open] > summary::after, .calc-steps details[open] > summary::after { transform: rotate(-135deg); margin-top: 3px; }
@media (hover: hover) {
  .calc-more > summary:hover, .calc-faq__item > summary:hover, .calc-steps summary:hover { background: var(--calc-surface-2); }
}
.calc-more > summary.is-hover, .calc-faq__item > summary.is-hover { background: var(--calc-surface-2); }
.calc-more > summary:focus-visible, .calc-faq__item > summary:focus-visible, .calc-steps summary:focus-visible,
.calc-more > summary.is-focus, .calc-faq__item > summary.is-focus { outline-color: var(--calc-focus); }
.calc-more > summary:active, .calc-faq__item > summary:active, .calc-steps summary:active,
.calc-more > summary.is-active, .calc-faq__item > summary.is-active { background: var(--calc-surface-3); }
.calc-more > :not(summary) { margin: 4px 12px 0; }
.calc-more > :not(summary) + :not(summary) { margin-top: 16px; }
.calc-more > :last-child:not(summary) { margin-bottom: 14px; }

.calc-steps { display: grid; gap: 8px; list-style: none; margin: 0; padding: 0; counter-reset: calc-step; }
.calc-steps > details, .calc-steps > li { counter-increment: calc-step; }
.calc-steps > li { list-style: none; }
.calc-steps summary { justify-content: flex-start; padding: 8px 12px; }
.calc-steps summary::before {
  content: counter(calc-step); flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%; font-size: 13px; font-weight: 700;
  color: var(--calc-on-accent); background: var(--calc-ink);
}
.calc-steps summary::after { margin-left: auto; }
.calc-steps details > :not(summary) { margin: 0 12px 12px 48px; font-size: 15px; }

/* ---- 12. Result block ---------------------------------------------------------------- */
.calc-result { display: grid; gap: 2px; min-width: 0; }
.calc-result__label { font-size: 14px; font-weight: 600; line-height: 1.3; color: var(--calc-muted); }
.calc-result__value {
  font-size: clamp(30px, 9vw, 48px); font-weight: 700; line-height: 1.08; letter-spacing: -.02em;
  color: var(--calc-ink); overflow-wrap: anywhere; font-variant-numeric: tabular-nums;
}
.calc-result__sub { font-size: 14px; line-height: 1.45; color: var(--calc-muted); }
.calc-result__value:empty::before { content: "n/a"; color: var(--calc-field-line-strong); font-weight: 600; }

.calc-breakdown { width: 100%; font-size: 14px; line-height: 1.4; }
.calc-breakdown caption { caption-side: top; text-align: left; padding: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--calc-muted); }
.calc-breakdown :is(th, td) { padding: 8px 0; border-top: 1px solid var(--calc-line); vertical-align: baseline; text-align: left; }
.calc-breakdown thead :is(th, td) { border-top: 0; border-bottom: 1px solid var(--calc-line); font-size: 12px; font-weight: 600; color: var(--calc-muted); }
.calc-breakdown tbody th, .calc-breakdown tfoot th { font-weight: 400; color: var(--calc-text); padding-right: 12px; overflow-wrap: anywhere; }
.calc-breakdown td { text-align: right; white-space: nowrap; font-weight: 500; color: var(--calc-strong); padding-left: 8px; }
.calc-breakdown :is(thead, tbody, tfoot) :is(th, td):not(:first-child) { text-align: right; }
.calc-breakdown .is-total :is(th, td) { font-weight: 700; color: var(--calc-ink); border-top: 1px solid var(--calc-ink); }
.calc-breakdown .is-sub th { padding-left: 14px; color: var(--calc-muted); }
.calc-breakdown .is-sub td { color: var(--calc-text); font-weight: 400; }
.calc-breakdown .is-muted :is(th, td) { color: var(--calc-muted); }
/* text table: values are sentences, not numbers, so they wrap and read left to right */
.calc-breakdown--wrap td,
.calc-breakdown--wrap :is(thead, tbody, tfoot) :is(th, td):not(:first-child) { white-space: normal; text-align: left; overflow-wrap: anywhere; }

.calc-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.calc-compare__col {
  display: grid; gap: 8px; align-content: start; min-width: 0; padding: 12px;
  background: var(--calc-surface); border: 1px solid var(--calc-line); border-radius: var(--calc-r);
}
.calc-compare__col.is-best { border-color: var(--calc-accent); box-shadow: inset 0 0 0 1px var(--calc-accent); }
/* the two columns share their rows (title, value, rows), so when one title wraps the two values still line up */
@supports (grid-template-rows: subgrid) {
  .calc-compare__col { grid-row: span 3; grid-template-rows: subgrid; }
}
@supports not (grid-template-rows: subgrid) {
  .calc-compare__title { min-height: 3.9em; }
}
.calc-compare__title { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 8px; margin: 0; font-size: 13px; font-weight: 600; line-height: 1.3; color: var(--calc-muted); }
.calc-compare__flag { font-size: 12px; font-weight: 700; color: var(--calc-accent); }
.calc-compare__value { margin: 0; font-size: clamp(20px, 5.6vw, 28px); font-weight: 700; line-height: 1.15; letter-spacing: -.01em; color: var(--calc-ink); overflow-wrap: anywhere; }
.calc-compare__rows { display: grid; gap: 6px; margin: 0; padding: 0; font-size: 13px; line-height: 1.35; }
.calc-compare__rows > div { display: grid; gap: 0; min-width: 0; }
.calc-compare__rows dt { color: var(--calc-muted); }
.calc-compare__rows dd { margin: 0; font-weight: 600; color: var(--calc-strong); overflow-wrap: anywhere; }

.calc-schedule {
  max-height: 360px; overflow: auto; -webkit-overflow-scrolling: touch;
  background: var(--calc-surface); border: 1px solid var(--calc-line); border-radius: var(--calc-r);
  outline: 2px solid transparent; outline-offset: 2px;
}
.calc-schedule:focus-visible { outline-color: var(--calc-focus); }
.calc-schedule table { width: 100%; min-width: 440px; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.calc-schedule :is(th, td) { padding: 8px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--calc-line-soft); font-weight: 400; color: var(--calc-text); }
.calc-schedule :is(th, td):first-child { text-align: left; }
.calc-schedule thead th { position: sticky; top: 0; z-index: 1; font-size: 12px; font-weight: 600; color: var(--calc-muted); background: var(--calc-surface-3); border-bottom: 1px solid var(--calc-line); }
.calc-schedule tbody th { font-weight: 500; color: var(--calc-ink); }
.calc-schedule tbody tr:last-child :is(th, td) { border-bottom: 0; }
.calc-schedule tbody tr.is-total :is(th, td) { font-weight: 700; color: var(--calc-ink); background: var(--calc-surface-2); border-top: 1px solid var(--calc-ink); }
/* 3 or 4 numeric columns (instalment methods side by side): no minimum width, tighter cells, smaller numbers, headers may wrap */
.calc-schedule--compact table { min-width: 0; font-size: 12px; }
.calc-schedule--compact :is(th, td) { padding: 8px 6px; line-height: 1.3; }
.calc-schedule--compact :is(th, td):first-child { padding-left: 10px; white-space: normal; }
.calc-schedule--compact :is(th, td):last-child { padding-right: 10px; }
.calc-schedule--compact thead th { font-size: 11px; line-height: 1.25; white-space: normal; vertical-align: bottom; }

.calc-chart { position: relative; height: 240px; min-width: 0; }
@media (min-width: 880px) { .calc-chart { height: 280px; } }
.calc-chart canvas { display: block; max-width: 100%; }

/* ---- 13. Callouts, errors, notes -------------------------------------------------------- */
.calc-callout, .calc-callout--warn, .calc-callout--info {
  position: relative; padding: 11px 14px 11px 44px;
  font-size: 14px; line-height: 1.5; color: var(--calc-ink);
  background: var(--calc-info-bg); border: 1px solid var(--calc-info-line); border-radius: var(--calc-r);
}
.calc-callout > *, .calc-callout--warn > *, .calc-callout--info > * { font-size: inherit; color: inherit; }
.calc-callout > * + *, .calc-callout--warn > * + *, .calc-callout--info > * + * { margin-top: 6px; }
.calc-callout::before, .calc-callout--warn::before, .calc-callout--info::before {
  content: "i"; position: absolute; left: 14px; top: 12px;
  display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%;
  font-size: 13px; font-weight: 700; line-height: 1; color: var(--calc-on-accent); background: var(--calc-accent);
}
.calc-callout--warn { color: var(--calc-warn-ink); background: var(--calc-warn-bg); border-color: var(--calc-warn-line); }
.calc-callout--warn::before { content: "!"; background: var(--calc-warn-ink); }
.calc-error {
  margin: 0; padding: 10px 12px; font-size: 14px; line-height: 1.45; font-weight: 500;
  color: var(--calc-error); background: var(--calc-error-bg); border: 1px solid var(--calc-error-line); border-radius: var(--calc-r);
}
.calc-note { font-size: 13px; line-height: 1.5; color: var(--calc-muted); margin: 0; }

/* ---- 14. How it is calculated, rates block ----------------------------------------------- */
.calc-how ul { list-style: disc; display: grid; gap: 8px; max-width: 72ch; margin: 0 0 20px; padding: 0 0 0 1.25em; }
.calc-how li { color: var(--calc-text); line-height: 1.55; }
.calc-how li::marker { color: var(--calc-muted); }
.calc-rates { display: grid; gap: 20px; margin: 4px 0 0; }
.calc-rates:empty { display: none; }
.calc-rates__title { font-size: 16px; font-weight: 600; margin: 0; color: var(--calc-ink); }
.calc-rates__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px 32px; }
@media (min-width: 720px) { .calc-rates__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.calc-rates__block { min-width: 0; }
.calc-rates .calc-breakdown { max-width: 560px; }
.calc-rates .calc-breakdown td { white-space: normal; }
.calc-rates .calc-note { margin-top: 8px; }

/* ---- 15. FAQ ------------------------------------------------------------------------------- */
.calc-faq { max-width: 820px; }
.calc-faq__item { border-top: 1px solid var(--calc-line); }
.calc-faq__item:last-of-type { border-bottom: 1px solid var(--calc-line); }
.calc-faq__item > summary { padding: 8px 4px 8px 0; border-radius: 0; font-size: 16px; }
.calc-faq__item > summary:focus-visible { outline-offset: -2px; }
.calc-faq__item > p { padding: 0 4px 16px 0; max-width: 68ch; }

/* ---- 16. Related, CTA ------------------------------------------------------------------------ */
.calc-related { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.calc-related > h2 { margin: 0; }
@media (min-width: 720px) {
  .calc-related { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .calc-related > h2 { grid-column: 1 / -1; }
}
.calc-related__card {
  display: grid; align-content: start; gap: 4px; min-width: 0; padding: 16px;
  color: var(--calc-ink); background: var(--calc-surface);
  border: 1px solid var(--calc-line); border-radius: var(--calc-r-lg); text-decoration: none;
  outline: 2px solid transparent; outline-offset: 2px;
  transition: border-color .12s ease, background-color .12s ease;
}
.calc-related__name { font-size: 16px; font-weight: 600; line-height: 1.3; color: var(--calc-ink); }
.calc-related__desc { font-size: 14px; line-height: 1.5; color: var(--calc-muted); }
@media (hover: hover) {
  .calc-related__card:hover { border-color: var(--calc-ink); }
  .calc-related__card:hover .calc-related__name { text-decoration: underline; text-underline-offset: 3px; }
}
.calc-related__card.is-hover { border-color: var(--calc-ink); }
.calc-related__card:focus-visible, .calc-related__card.is-focus { outline-color: var(--calc-focus); border-color: var(--calc-ink); }
.calc-related__card:active, .calc-related__card.is-active { background: var(--calc-surface-2); }

.calc-page .calc-cta {
  display: grid; gap: 16px; align-items: center; padding: 20px;
  background: var(--calc-surface-2); border: 1px solid var(--calc-line); border-radius: var(--calc-r-lg);
}
.calc-cta h2 { margin: 0 0 4px; }
.calc-cta p { max-width: 60ch; }
@media (min-width: 640px) {
  .calc-page .calc-cta { grid-template-columns: minmax(0, 1fr) auto; gap: 24px; padding: 24px 28px; }
}

/* ---- 17. Print head (screen: hidden) ---------------------------------------------------------- */
.calc-print-head { display: none; }

/* ---- 18. Motion and contrast preferences ---------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .calc-page * , .calc-page *::before, .calc-page *::after { transition: none !important; }
  .calc-btn[data-state="loading"]::before, .calc-drop[data-state="loading"]::before,
  .calc-field[data-state="loading"] .calc-affix::after, .calc-switch[aria-busy="true"] > input::before { animation: none; }
}
@media (forced-colors: active) {
  .calc-btn, .calc-input, .calc-select, .calc-textarea, .calc-seg, .calc-drop, .calc-more, .calc-results, .calc-card { border-color: CanvasText; }
  .calc-seg > [role="radio"][aria-checked="true"] { outline: 2px solid Highlight; }
  .calc-switch > input:checked { background: Highlight; }
}

/* ---- 19. Print: inputs summary and results only ------------------------------------------------------ */
@media print {
  @page { margin: 14mm 12mm; }
  #nav-placeholder, #footer-placeholder, .skip-to-content, .topbar, .site-header, .calc-crumbs, .calc-actions,
  .calc-btn, .calc-faq, .calc-related, .calc-cta, .calc-drop, .calc-how > ul, .calc-more > summary::after,
  .calc-seg > [role="radio"][aria-checked="false"], .calc-help, .calc-error[hidden] { display: none !important; }
  body.page-body, body { padding-top: 0 !important; background: var(--white) !important; }
  .calc-page { max-width: none; padding: 0; color: var(--gray-900); font-size: 11pt; }
  .calc-print-head {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    margin: 0 0 14pt; padding: 0 0 8pt; border-bottom: 1px solid var(--gray-900);
  }
  .calc-print-head img { display: block; height: 34px; width: auto; }
  .calc-print-head p { margin: 0; font-size: 9pt; line-height: 1.4; text-align: right; color: var(--gray-900); }
  .calc-head { margin-bottom: 10pt; }
  .calc-head h1 { font-size: 20pt; }
  .calc-page .calc-card { display: block; padding: 0; border: 0; box-shadow: none; margin-bottom: 12pt; }
  .calc-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8pt 16pt; margin-bottom: 12pt; }
  .calc-input, .calc-select, .calc-textarea { height: auto; padding: 2pt 0; border: 0; border-bottom: 1px solid var(--gray-900); border-radius: 0; background: none; color: var(--gray-900); outline: 0; }
  .calc-affix::after, .calc-affix--select::after { display: none !important; }
  .calc-affix__pre, .calc-affix__suf { top: 0; height: 100%; color: var(--gray-900); }
  .calc-seg { height: auto; padding: 0; background: none; border: 0; gap: 12pt; }
  .calc-seg > [role="radio"][aria-checked="true"] { flex: 0 0 auto; padding: 0; background: none; color: var(--gray-900); font-weight: 700; }
  .calc-results { padding: 10pt; background: none; border: 1px solid var(--gray-900); break-inside: avoid; }
  .calc-result__value { font-size: 26pt; color: var(--gray-900); }
  .calc-breakdown tr, .calc-compare__col { break-inside: avoid; }
  .calc-schedule { max-height: none; overflow: visible; border: 0; }
  .calc-schedule thead th { position: static; }
  .calc-how, .calc-card, .calc-section { margin-bottom: 10pt; }
  .calc-how h2, .calc-how .calc-rates { display: none; }
  .calc-section > h2 { break-after: avoid; }
  .calc-section > .calc-card:last-child { margin-bottom: 0; }
  .calc-schedule--compact :is(th, td) { padding: 3pt 4pt; }
  .calc-note { color: var(--gray-900); }
}
