/**
 * Vonk Calculator Suite — public styles
 * Design tokens derived from the approved mockup.
 * Every colour ships an sRGB hex fallback first, then an oklch override
 * behind @supports, so older Safari / Android webviews degrade cleanly.
 */

/* ---------- Fonts (self-hosted, subsetted) ---------- */
@font-face {
  font-family: 'VCS DM Sans';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('../fonts/dmsans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'VCS DM Sans';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('../fonts/dmsans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'VCS Instrument Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/instrumentserif-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'VCS Instrument Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/instrumentserif-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens ---------- */
.vcs-root {
  /* Page background. Transparent by default so the widget sits on whatever
     the page behind it uses; set a colour in the settings to override. */
  --vcs-bg: transparent;
  /* Text on the dark ink panels. Kept separate from --vcs-bg, which it used
     to share: once the background went transparent, so did that text. */
  --vcs-on-ink: #f8f5f0;
  --vcs-ink: #231e19;
  --vcs-label: #4c4641;
  --vcs-muted: #6e6862;
  --vcs-muted-2: #8b857f;
  --vcs-muted-3: #aaa39d;
  --vcs-hairline: #cac3bc;
  --vcs-accent: #0e6549;
  --vcs-accent-dark: #004a32;
  --vcs-accent-soft: #768c82;
  --vcs-accent-pale: #94aba0;
  --vcs-accent-tint: #f3fbf7;
  --vcs-eyebrow: #588671;
  --vcs-border: #e4e1da;
  --vcs-border-input: #dbd7cf;
  --vcs-border-strong: #d1cdc5;
  --vcs-surface: #fdfcf9;
  --vcs-surface-2: #f3f0ea;
  --vcs-card: #ffffff;
  --vcs-gold: #b8912a;
  --vcs-slate: #6b93b8;
  --vcs-rose: #b5645c;
  --vcs-chart-rent: #b3ada6;

  --vcs-radius-card: 18px;
  --vcs-radius-field: 12px;
  --vcs-radius-chip: 9px;
  --vcs-radius-pill: 999px;

  /* Inherit the theme's typefaces by default. Choosing the bundled faces in
     the settings swaps these for DM Sans and Instrument Serif; until then the
     woff2 files are never requested, because nothing references the family. */
  --vcs-font-body: inherit;
  --vcs-font-display: inherit;

  --vcs-pad-card: 30px 32px 34px;
  --vcs-gap: 20px;
  --vcs-rail: 456px;
}

@supports (color: oklch(0.5 0.1 165)) {
  .vcs-root {
    --vcs-on-ink: oklch(0.972 0.008 85);
    --vcs-ink: oklch(0.24 0.012 65);
    --vcs-label: oklch(0.4 0.012 65);
    --vcs-muted: oklch(0.52 0.012 65);
    --vcs-muted-2: oklch(0.62 0.012 65);
    --vcs-muted-3: oklch(0.72 0.012 65);
    --vcs-hairline: oklch(0.82 0.012 65);
    --vcs-accent: oklch(0.45 0.09 165);
    --vcs-accent-dark: oklch(0.36 0.08 165);
    --vcs-accent-soft: oklch(0.62 0.03 165);
    --vcs-accent-pale: oklch(0.72 0.03 165);
    --vcs-accent-tint: oklch(0.98 0.01 165);
    --vcs-eyebrow: oklch(0.58 0.06 165);
    --vcs-border: oklch(0.91 0.01 85);
    --vcs-border-input: oklch(0.88 0.012 85);
    --vcs-border-strong: oklch(0.85 0.012 85);
    --vcs-surface: oklch(0.99 0.004 85);
    --vcs-surface-2: oklch(0.955 0.008 85);
    --vcs-chart-rent: oklch(0.75 0.012 65);
  }
}

/* ---------- Reset / theme isolation ----------
   Client themes bleed aggressively (WPBakery especially), so everything
   inside the widget is reset rather than inherited. */
.vcs-root,
.vcs-root *,
.vcs-root *::before,
.vcs-root *::after {
  box-sizing: border-box;
}
.vcs-root {
  font-family: var(--vcs-font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--vcs-ink);
  background: var(--vcs-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: left;
  padding: 0 0 80px;
}
.vcs-root h1,
.vcs-root h2,
.vcs-root h3,
.vcs-root p,
.vcs-root ul,
.vcs-root ol,
.vcs-root li,
.vcs-root figure,
.vcs-root table {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-family: inherit;
}
.vcs-root ul,
.vcs-root ol {
  list-style: none;
}
.vcs-root table {
  border-collapse: collapse;
  width: 100%;
}
.vcs-root button,
.vcs-root input,
.vcs-root select {
  font: inherit;
  color: inherit;
  margin: 0;
}
.vcs-root img,
.vcs-root svg {
  max-width: 100%;
  display: block;
}
.vcs-root a {
  color: var(--vcs-accent);
  text-decoration: none;
}
.vcs-root a:hover {
  color: var(--vcs-accent-dark);
}

/* ---------- Shell ---------- */
.vcs-shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 56px 56px 0;
}

.vcs-eyebrow {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--vcs-eyebrow);
  margin-bottom: 14px;
}
.vcs-headline {
  font-family: var(--vcs-font-display);
  font-weight: 400;
  font-size: 54px;
  line-height: 1.04;
  letter-spacing: -0.015em;
  margin: 0 0 14px;
  text-wrap: balance;
}
.vcs-subhead {
  font-size: 16px;
  line-height: 1.6;
  color: var(--vcs-muted);
  max-width: 62ch;
  text-wrap: pretty;
}
.vcs-masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  flex-wrap: wrap;
}
.vcs-masthead__copy {
  max-width: 660px;
}
.vcs-ratebadge {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  color: var(--vcs-muted);
  padding-bottom: 6px;
}
.vcs-ratebadge__dot {
  width: 7px;
  height: 7px;
  border-radius: var(--vcs-radius-pill);
  background: var(--vcs-accent);
  flex: none;
}

/* ---------- Tabs ---------- */
.vcs-tabsbar {
  margin: 40px 0 0;
}
.vcs-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 2px;
}
/* Scroll affordances are mobile-only; on desktop the tabs simply wrap. */
.vcs-tabrail,
.vcs-tabs__hint {
  display: none;
}
.vcs-tab {
  padding: 10px 18px;
  border-radius: var(--vcs-radius-pill);
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--vcs-border);
  color: var(--vcs-label);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.vcs-tab:hover {
  border-color: var(--vcs-border-strong);
  color: var(--vcs-ink);
}
.vcs-tab[aria-selected='true'] {
  font-weight: 500;
  background: var(--vcs-ink);
  border-color: var(--vcs-ink);
  color: var(--vcs-on-ink);
}

/* ---------- Layout ---------- */
.vcs-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--vcs-rail);
  gap: 28px;
  margin-top: 28px;
  align-items: start;
}
.vcs-column {
  display: flex;
  flex-direction: column;
  gap: var(--vcs-gap);
  min-width: 0;
}
.vcs-panel[hidden] {
  display: none;
}

/* ---------- Cards ---------- */
.vcs-card {
  background: var(--vcs-card);
  border: 1px solid var(--vcs-border);
  border-radius: var(--vcs-radius-card);
  padding: var(--vcs-pad-card);
}
.vcs-card__head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 26px;
}
.vcs-card__index {
  font-family: var(--vcs-font-display);
  font-size: 15px;
  color: var(--vcs-accent-soft);
}
.vcs-card__title {
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.vcs-card__meta {
  margin-left: auto;
  font-size: 13px;
  color: var(--vcs-muted-2);
}

/* ---------- Fields ---------- */
.vcs-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 24px;
}
.vcs-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.vcs-field--wide {
  grid-column: span 2;
}
.vcs-field__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.vcs-field__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--vcs-label);
}
.vcs-field__hint {
  font-size: 12px;
  color: var(--vcs-muted-2);
  text-align: right;
}
/* A hint explaining that a field currently has no effect is dimmed, so it
   reads as a status rather than as a value. */
.vcs-field__hint[data-muted] {
  color: var(--vcs-muted-3);
  font-style: italic;
}
.vcs-input {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--vcs-border-input);
  border-radius: var(--vcs-radius-field);
  padding: 0 14px;
  background: var(--vcs-surface);
  height: 46px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.vcs-input:focus-within {
  border-color: var(--vcs-accent);
  box-shadow: 0 0 0 3px var(--vcs-accent-tint);
}
.vcs-input__affix {
  font-size: 15px;
  color: var(--vcs-muted-2);
  flex: none;
  user-select: none;
}
.vcs-input input {
  border: 0;
  outline: 0;
  background: none;
  width: 100%;
  min-width: 0;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  color: var(--vcs-ink);
  padding: 0;
}
.vcs-input input::-webkit-outer-spin-button,
.vcs-input input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.vcs-input input[type='number'] {
  -moz-appearance: textfield;
  appearance: textfield;
}
.vcs-input select {
  border: 0;
  outline: 0;
  background: none;
  width: 100%;
  font-size: 17px;
  color: var(--vcs-ink);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--vcs-muted-2) 50%),
    linear-gradient(135deg, var(--vcs-muted-2) 50%, transparent 50%);
  background-position: right 4px center, right 0px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 20px;
}

/* Segmented control (radio groups) */
.vcs-segmented {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.vcs-segmented__opt {
  flex: 1 1 auto;
  position: relative;
  min-width: 0;
}
.vcs-segmented__opt input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.vcs-segmented__opt span {
  display: block;
  text-align: center;
  padding: 11px 14px;
  border: 1px solid var(--vcs-border-input);
  border-radius: var(--vcs-radius-chip);
  font-size: 14px;
  color: var(--vcs-label);
  background: var(--vcs-surface);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.15s ease;
}
.vcs-segmented__opt input:checked + span {
  background: var(--vcs-accent);
  border-color: var(--vcs-accent);
  color: #fff;
  font-weight: 500;
}
.vcs-segmented__opt input:focus-visible + span {
  outline: 2px solid var(--vcs-accent);
  outline-offset: 2px;
}

/* Sliders */
.vcs-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: var(--vcs-radius-pill);
  background: var(--vcs-border-input);
  outline: none;
  margin: 4px 0 0;
  cursor: pointer;
}
.vcs-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: var(--vcs-radius-pill);
  background: var(--vcs-accent);
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  cursor: grab;
}
.vcs-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
}
.vcs-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: var(--vcs-radius-pill);
  background: var(--vcs-accent);
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  cursor: grab;
}
.vcs-slider:focus-visible {
  outline: 2px solid var(--vcs-accent);
  outline-offset: 4px;
}
.vcs-slider__scale {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--vcs-muted-2);
  margin-top: 2px;
}

/* Help text */
.vcs-help {
  font-size: 12px;
  line-height: 1.5;
  color: var(--vcs-muted-2);
}

/* ---------- Results rail ---------- */
.vcs-rail {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: var(--vcs-gap);
}
.vcs-summary {
  background: var(--vcs-ink);
  color: var(--vcs-on-ink);
  border-radius: var(--vcs-radius-card);
  padding: 32px 34px 30px;
}
.vcs-summary__label {
  font-size: 13px;
  color: var(--vcs-accent-pale);
  letter-spacing: 0.02em;
  margin-bottom: 10px;
}
.vcs-summary__figure {
  font-family: var(--vcs-font-display);
  font-size: 68px;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
}
.vcs-summary__caption {
  font-size: 13px;
  color: var(--vcs-muted-3);
}
.vcs-summary__note {
  font-size: 13px;
  color: var(--vcs-accent-pale);
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

/* Stacked composition bar */
.vcs-stack {
  display: flex;
  gap: 3px;
  height: 12px;
  margin: 22px 0 14px;
}
.vcs-stack__seg {
  border-radius: var(--vcs-radius-pill);
  min-width: 3px;
  transition: flex-grow 0.25s ease;
}
.vcs-legend {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.vcs-legend__row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.vcs-legend__dot {
  width: 8px;
  height: 8px;
  border-radius: var(--vcs-radius-pill);
  flex: none;
}
.vcs-legend__name {
  color: var(--vcs-muted-3);
}
.vcs-legend__val {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

/* Result rows (light card) */
.vcs-rows {
  display: flex;
  flex-direction: column;
}
.vcs-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--vcs-border);
  font-size: 14px;
}
.vcs-row:last-child {
  border-bottom: 0;
}
.vcs-row__label {
  color: var(--vcs-muted);
}
.vcs-row__value {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  text-align: right;
}
.vcs-row--total {
  border-top: 1px solid var(--vcs-hairline);
  border-bottom: 0;
  margin-top: 4px;
  padding-top: 16px;
  font-size: 17px;
}
.vcs-row--total .vcs-row__label {
  color: var(--vcs-ink);
  font-weight: 500;
}

/* Verdict callout */
.vcs-verdict {
  border-radius: var(--vcs-radius-card);
  padding: 22px 26px;
  border: 1px solid var(--vcs-border);
  background: var(--vcs-accent-tint);
}
.vcs-verdict__head {
  font-family: var(--vcs-font-display);
  font-size: 30px;
  line-height: 1.1;
  margin-bottom: 8px;
}
.vcs-verdict__body {
  font-size: 14px;
  line-height: 1.55;
  color: var(--vcs-muted);
}
.vcs-verdict[data-tone='warn'] {
  background: #fdf6e8;
  border-color: #ecdcb4;
}
.vcs-verdict[data-tone='bad'] {
  background: #fbf0ef;
  border-color: #ebcfcc;
}

/* ---------- Charts (CSS-only) ---------- */
.vcs-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 150px;
  margin-top: 4px;
}
.vcs-chart__bar {
  flex: 1;
  min-width: 0;
  border-radius: 2px;
  height: 100%;
}
.vcs-chart__pair {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 100%;
}
.vcs-chart__axis {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--vcs-muted-2);
  margin-top: 10px;
}

/* ---------- Amortization table ---------- */
.vcs-amort {
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--vcs-border);
  border-radius: var(--vcs-radius-field);
}
.vcs-amort table {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.vcs-amort th {
  position: sticky;
  top: 0;
  background: var(--vcs-surface-2);
  font-weight: 500;
  color: var(--vcs-muted);
  text-align: right;
  padding: 11px 14px;
  border-bottom: 1px solid var(--vcs-border);
  white-space: nowrap;
}
.vcs-amort th:first-child,
.vcs-amort td:first-child {
  text-align: left;
}
.vcs-amort td {
  padding: 10px 14px;
  text-align: right;
  border-bottom: 1px solid var(--vcs-border);
  white-space: nowrap;
}
.vcs-amort tr:last-child td {
  border-bottom: 0;
}
.vcs-amort tbody tr[data-year-row='1'] td {
  background: var(--vcs-surface);
  font-weight: 500;
}

/* ---------- Mobile summary bar (hidden on desktop) ---------- */
.vcs-dock {
  display: none;
}

/* ---------- Print / disclaimer ---------- */
.vcs-disclaimer {
  font-size: 12px;
  line-height: 1.6;
  color: var(--vcs-muted-2);
  margin-top: 28px;
  max-width: 78ch;
}
.vcs-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.vcs-btn {
  border: 1px solid var(--vcs-border-strong);
  background: transparent;
  border-radius: var(--vcs-radius-pill);
  padding: 11px 20px;
  font-size: 14px;
  cursor: pointer;
  color: var(--vcs-ink);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.vcs-btn:hover {
  background: rgba(255, 255, 255, 0.7);
  border-color: var(--vcs-hairline);
}
.vcs-root :focus-visible {
  outline: 2px solid var(--vcs-accent);
  outline-offset: 2px;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

/* --- Tablet: rail narrows, padding tightens --- */
@media (max-width: 1180px) {
  .vcs-root {
    --vcs-rail: 380px;
  }
  .vcs-shell {
    padding: 44px 32px 0;
  }
  .vcs-headline {
    font-size: 46px;
  }
  .vcs-summary__figure {
    font-size: 58px;
  }
}

/* --- Below 1024px: single column, results dock to bottom --- */
@media (max-width: 1023px) {
  .vcs-root {
    padding-bottom: 0;
  }
  .vcs-shell {
    padding: 32px 20px 0;
  }
  .vcs-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    margin-top: 22px;
  }
  .vcs-card {
    padding: 24px 20px 26px;
    border-radius: 16px;
  }
  .vcs-card__head {
    margin-bottom: 20px;
  }
  .vcs-headline {
    font-size: 34px;
    line-height: 1.08;
  }
  .vcs-subhead {
    font-size: 15px;
  }
  .vcs-masthead {
    align-items: flex-start;
    gap: 16px;
  }
  .vcs-ratebadge {
    padding-bottom: 0;
  }

  /* Tabs become a swipeable rail rather than 4 wrapped rows */
  .vcs-tabsbar {
    margin: 26px 0 0;
  }
  .vcs-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    margin: 0 -20px;
    padding: 0 20px 4px;
    scroll-snap-type: x proximity;
  }

  /* The fade only appears on a side that actually has more tabs. Fading both
     ends unconditionally made the first tab look clipped when there was
     nothing to its left, which reads as a rendering fault rather than a hint. */
  .vcs-tabsbar[data-overflow='end'] .vcs-tabs,
  .vcs-tabsbar[data-overflow='both'] .vcs-tabs {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 34px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 34px), transparent);
  }
  .vcs-tabsbar[data-overflow='start'] .vcs-tabs {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 34px);
    mask-image: linear-gradient(to right, transparent, #000 34px);
  }
  .vcs-tabsbar[data-overflow='both'] .vcs-tabs {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 34px, #000 calc(100% - 34px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 34px, #000 calc(100% - 34px), transparent);
  }

  /* A short track showing how much of the strip is in view and where you are
     in it. Sized and positioned from real scroll metrics, so it doubles as a
     progress indicator rather than a decorative dot row. */
  /* Full width rather than a short centred pill. A track that spans the strip
     reads unmistakably as a scrollbar; a small pill reads as decoration. */
  .vcs-tabrail {
    position: relative;
    display: block;
    height: 6px;
    margin: 12px 0 0;
    width: 100%;
    border-radius: var(--vcs-radius-pill);
    background: var(--vcs-border-input);
    overflow: hidden;
  }
  .vcs-tabrail[hidden] {
    display: none;
  }
  /* Positioned with left, not translateX. A translate percentage resolves
     against the thumb's own width, which made it stall part-way along the
     track; left resolves against the track, which is what we mean. */
  .vcs-tabrail__thumb {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    /* Width is set from JS as a percentage of the track. Deliberately no
       min-width here: a CSS floor could override that percentage and push the
       thumb past the end of the track. The floor lives in one place, in JS. */
    width: 40%;
    border-radius: var(--vcs-radius-pill);
    background: var(--vcs-accent);
    transition: left 0.12s linear;
  }
  .vcs-tabs__hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 500;
    color: var(--vcs-accent);
    margin: 9px 0 0;
  }
  /* A pair of chevrons pointing the way the strip moves. */
  .vcs-tabs__hint::after {
    content: '››';
    font-size: 15px;
    line-height: 1;
    letter-spacing: -0.04em;
    animation: vcs-nudge 1.6s ease-in-out 3;
  }
  @keyframes vcs-nudge {
    0%, 100% { transform: translateX(0); opacity: 0.65; }
    50% { transform: translateX(4px); opacity: 1; }
  }
  .vcs-tabs__hint[hidden] {
    display: none;
  }
  /* Once they have scrolled, the wording has done its job. */
  .vcs-tabsbar[data-scrolled='1'] .vcs-tabs__hint {
    display: none;
  }
  .vcs-tabs::-webkit-scrollbar {
    display: none;
  }
  .vcs-tab {
    scroll-snap-align: start;
    flex: none;
  }

  /* The rail stops being sticky and just flows after the inputs.
     The running total moves into the dock instead. */
  .vcs-rail {
    position: static;
  }
  .vcs-summary {
    padding: 26px 24px 24px;
  }
  .vcs-summary__figure {
    font-size: 44px;
  }

  /* Leave room for the fixed dock */
  .vcs-layout {
    padding-bottom: 96px;
  }

  /* --- Docked summary bar --- */
  .vcs-dock[hidden] {
    display: none;
  }
  .vcs-dock {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    background: var(--vcs-ink);
    color: var(--vcs-on-ink);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.18);
    padding-bottom: env(safe-area-inset-bottom, 0);
    transform: translateY(0);
    transition: transform 0.25s ease;
  }
  .vcs-dock__bar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    width: 100%;
    background: none;
    border: 0;
    cursor: pointer;
    text-align: left;
    color: inherit;
  }
  .vcs-dock__label {
    font-size: 12px;
    color: var(--vcs-accent-pale);
    margin-bottom: 2px;
  }
  .vcs-dock__figure {
    font-family: var(--vcs-font-display);
    font-size: 26px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
  }
  .vcs-dock__chevron {
    margin-left: auto;
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: var(--vcs-radius-pill);
    border: 1px solid rgba(255, 255, 255, 0.24);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease;
  }
  .vcs-dock[data-open='1'] .vcs-dock__chevron {
    transform: rotate(180deg);
  }
  .vcs-dock__sheet {
    display: none;
    max-height: 62vh;
    overflow-y: auto;
    padding: 4px 20px 22px;
    -webkit-overflow-scrolling: touch;
  }
  .vcs-dock[data-open='1'] .vcs-dock__sheet {
    display: block;
  }
  .vcs-dock .vcs-row {
    border-bottom-color: rgba(255, 255, 255, 0.12);
  }
  .vcs-dock .vcs-row__label {
    color: var(--vcs-accent-pale);
  }
  .vcs-dock .vcs-row--total {
    border-top-color: rgba(255, 255, 255, 0.24);
  }
  .vcs-dock .vcs-row--total .vcs-row__label {
    color: var(--vcs-on-ink);
  }
}

/* --- Phone: fields stack, type steps down --- */
@media (max-width: 640px) {
  .vcs-shell {
    padding: 24px 16px 0;
  }
  .vcs-fields {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }
  .vcs-field--wide {
    grid-column: span 1;
  }
  .vcs-card {
    padding: 22px 16px 24px;
  }
  .vcs-headline {
    font-size: 28px;
  }
  .vcs-eyebrow {
    font-size: 11px;
    margin-bottom: 10px;
  }
  .vcs-summary__figure {
    font-size: 40px;
  }
  .vcs-verdict__head {
    font-size: 24px;
  }
  /* Hints move under the label instead of fighting it for width */
  .vcs-field__top {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
  }
  .vcs-field__hint {
    text-align: left;
  }
  /* 16px minimum stops iOS zooming the viewport on focus */
  .vcs-input input,
  .vcs-input select {
    font-size: 16px;
  }
  .vcs-input {
    height: 48px;
  }
  .vcs-segmented {
    gap: 5px;
  }
  .vcs-segmented__opt {
    flex: 1 1 calc(50% - 3px);
  }
  .vcs-segmented__opt span {
    padding: 12px 8px;
    font-size: 13px;
  }
  .vcs-amort {
    max-height: 340px;
  }
  .vcs-amort th,
  .vcs-amort td {
    padding: 9px 10px;
    font-size: 12px;
  }
  /* Hide the least important amortization column on narrow screens */
  .vcs-amort [data-col='balance-start'] {
    display: none;
  }
  .vcs-chart {
    height: 120px;
  }
}

/* ---------- Accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
  .vcs-root *,
  .vcs-root *::before,
  .vcs-root *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
.vcs-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Print ---------- */
@media print {
  .vcs-tabs,
  .vcs-dock,
  .vcs-actions {
    display: none !important;
  }
  .vcs-root {
    background: #fff;
    padding: 0;
  }
  .vcs-layout {
    grid-template-columns: 1fr;
    padding-bottom: 0;
  }
  .vcs-card,
  .vcs-summary {
    break-inside: avoid;
    border: 1px solid #ddd;
  }
  .vcs-summary {
    background: #fff;
    color: #000;
  }
}
