/* ==========================================================================
   Small Business Pricing Calculator
   Mobile-first, no framework, no web fonts.
   ========================================================================== */

:root {
  /* ---- palette: the only place a colour is written down ------------------ */
  --primary: #003B6F;
  --primary-blue: #356FA3;
  --medium-blue: #346594;
  --light-blue: #B8C9DA;
  --very-light-blue: #EAF1F7;
  --background: #FFFFFF;
  --surface: #F7F9FB;
  --text: #111111;
  --text-secondary: #555555;
  --border: #AEBBC7;
  --hover: #2D628F;
  --active: #214F7A;
  /* Brand accent. Only ever used on the navy bar, where it reads at 9.9:1;
     on white surfaces the wordmark keeps its blue half instead. */
  --accent-green: #CCFF99;

  /* ---- roles: what the rules below actually reference -------------------- */
  --bg: var(--background);
  --bg-alt: var(--surface);
  --ink: var(--text);
  --ink-soft: var(--text-secondary);
  --ink-mute: #5A6675;            /* muted captions, 5.8:1 on white */
  --placeholder: #8894A3;         /* placeholder text inside fields */
  --line: #DCE3EA;                /* hairlines inside a card */
  --line-strong: var(--border);
  --brand: var(--primary-blue);
  --brand-dark: var(--primary);
  --brand-soft: var(--very-light-blue);
  --on-dark: var(--background);

  /* Breakdown bar. Costs sit in the blue family; fees and profit keep their
     own hues because the chart is unreadable if all three segments are blue. */
  --cost: var(--primary);
  --fee: #B45309;
  --profit: #046C4E;

  /* Status colours. Errors stay red: an error that reads as decoration is a
     usability bug, and red/green carry meaning no blue can replace here. */
  --danger: #B42318;
  --danger-soft: #FDF3F2;
  --danger-line: #E7B9B4;
  --danger-ink: #7A271A;
  --warn-soft: #FFF8E8;
  --warn-line: #EAD08A;
  --warn-ink: #6B4406;

  /* Traditional-calculator geometry: present, but not pill-shaped. */
  --radius: 10px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 59, 111, .06);
  --shadow: 0 1px 2px rgba(0, 59, 111, .05), 0 6px 18px -10px rgba(0, 59, 111, .16);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* This site is light-only: there is no dark palette below and the surfaces
     are all written down explicitly. Saying so keeps the browser from dressing
     the parts we do not paint - select popups, scrollbars, the caret, autofill
     - in its dark theme for a visitor whose OS is set that way. */
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.015em; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.45rem; color: var(--primary); }
h3 { font-size: 1.1rem; }
.qa h3, .formula-list h3 { color: var(--primary); }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--primary-blue); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--hover); }

/* ==========================================================================
   Interaction: tap highlight, press feedback, focus
   --------------------------------------------------------------------------
   Mobile WebKit/Blink paints its own translucent box over whatever you tap,
   and every browser draws a focus ring on click as well as on Tab. Both are
   replaced here with press states of our own. Keyboard focus is untouched:
   :focus-visible still gets a full ring everywhere.
   ========================================================================== */

/* Inherited, so the root covers every element on the page. Android Chrome,
   Android WebView, iOS Safari and iOS WebView all read this. */
html {
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  -webkit-tap-highlight-color: transparent;
}

/* Repeated on the controls themselves, in case anything resets the root. */
a, button, summary, label, select, input, textarea,
.btn, .menu-link, .menu-toggle, .hint-toggle, .linkish, .skip-link,
[role="button"], [role="tab"], [role="link"], [tabindex] {
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  -webkit-tap-highlight-color: transparent;
}

/*
 * Controls only: no text selection to flash blue on a double tap, no iOS
 * long-press callout, and no 300ms tap delay or double-tap zoom.
 * Body copy, results and table figures stay selectable and copyable.
 */
button, summary, .btn, .menu-link, .menu-sub-link, .menu-toggle, .hint-toggle, .linkish,
[role="button"], [role="tab"] {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

/* Firefox draws an extra dotted ring inside buttons. The real one stays. */
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner { border: 0; padding: 0; }

/* Keyboard focus: clearly visible, on every browser. */
:focus-visible {
  outline: 3px solid var(--primary-blue);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Inside the navy header a blue ring would vanish, so it goes white there. */
.site-header :focus-visible { outline-color: var(--on-dark); }

/* A mouse click or a tap should not leave a ring behind. Text fields are
   exempt: they keep the focus ring from their own rule however they are
   focused, because a cursor sitting in a field needs to be visible. */
:focus:not(:focus-visible) { outline: none; }

/* Selected text picks up the palette instead of the browser's blue. */
::selection { background: var(--light-blue); color: var(--text); }
::-moz-selection { background: var(--light-blue); color: var(--text); }

/* Disabled controls: clearly inert, and no press feedback. */
[disabled], [aria-disabled="true"] {
  opacity: .55;
  cursor: not-allowed;
  filter: grayscale(.25);
}
[disabled]:active, [aria-disabled="true"]:active { transform: none !important; }

/* The press states that replace the browser highlight live at the end of this
   file, after the component rules they have to win against. */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 30;
  background: var(--primary); color: var(--on-dark); padding: .7rem 1rem; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; color: var(--on-dark); }

.wrap { width: 100%; max-width: 940px; margin: 0 auto; padding: 0 18px; }
.wrap.narrow { max-width: 760px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------------------------------- header -------------------------------- */

.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--primary);
  border-bottom: 1px solid var(--primary);
  color: var(--on-dark);
}
.site-header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: .35rem 1rem; min-height: 58px; flex-wrap: wrap;
}
.brand {
  display: inline-flex; align-items: center; gap: .5rem; font-weight: 700;
  text-decoration: none;
}
a.brand:hover .brand-name-a { text-decoration: underline; }
.brand-mark { display: block; width: 30px; height: 30px; flex: 0 0 auto; }
.brand-mark svg { display: block; width: 100%; height: 100%; }
.brand-name { font-size: 1.02rem; letter-spacing: -.02em; white-space: nowrap; }
.brand-name-a { color: var(--on-dark); }
.brand-name-b { color: var(--accent-green); }

/* Menu bar: every section is its own item, at every screen size. */
.site-nav { max-width: 100%; }
.menu {
  display: flex; align-items: center; gap: .2rem;
  list-style: none; margin: 0; padding: 0;
}
.menu-link {
  display: block; white-space: nowrap;
  padding: .45rem .7rem; border-radius: var(--radius-sm);
  font-size: .92rem; font-weight: 500; color: var(--on-dark); text-decoration: none;
}
.menu-link:hover { background: var(--hover); color: var(--on-dark); }
/* Selected section. On the navy bar the readable "active tab" is the inverse
   of the one used on a white surface: light plate, navy label. */
.menu-link[aria-current="true"] {
  background: var(--very-light-blue); color: var(--primary); font-weight: 600;
}

/* Resources: one menu item that opens a submenu. On the wide bar it drops as
   a white plate under its button; inside the hamburger panel it opens in
   place, indented, because a plate inside a plate reads as a mistake. The
   button is a real <button> carrying aria-expanded, so a screen reader
   announces the state and Escape closes it. */
.menu-item-has-sub { position: relative; }
.menu-sub-toggle {
  display: inline-flex; align-items: center; gap: .4rem;
  border: 0; background: transparent; cursor: pointer;
  /* Family only. This button also carries .menu-link, and the `font`
     shorthand resets size and weight along with it - which left Resources
     a point larger, a weight lighter and 2px taller than every other item
     on the bar. .menu-link supplies the size and weight; this supplies the
     family and line-height the UA button rule would otherwise override -
     Chrome sets line-height: normal on buttons, which left the item 4px
     shorter than its neighbours once the shorthand was gone. */
  font-family: inherit;
  line-height: inherit;
}
.menu-caret {
  width: 7px; height: 7px; flex: 0 0 auto;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .12s ease;
}
.menu-sub-toggle[aria-expanded="true"] .menu-caret {
  transform: translateY(1px) rotate(-135deg);
}
.menu-sub {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 30;
  min-width: 254px; padding: .45rem;
  background: var(--background); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: 0 14px 28px -18px rgba(0, 59, 111, .45);
}
.menu-sub[hidden] { display: none; }
.menu-sub-title {
  margin: .375rem .6rem .25rem; font-size: .75rem; line-height: 1rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--ink-mute);
}
.menu-sub ul { list-style: none; margin: 0 0 .3rem; padding: 0; }
.menu-sub ul:last-child { margin-bottom: 0; }
.menu-sub-link {
  display: block; padding: .5rem .6rem; border-radius: var(--radius-sm);
  font-size: .875rem; line-height: 1.5rem; font-weight: 500; color: var(--text); text-decoration: none;
}
.menu-sub-link:hover { background: var(--very-light-blue); color: var(--primary); }
.menu-sub-link[aria-current="page"] {
  background: var(--very-light-blue); color: var(--primary); font-weight: 600;
}

/* The hamburger button: only ever shown on small screens, and only when the
   script that drives it is running. */
.menu-toggle {
  display: none;
  align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0;
  background: transparent; border: 1px solid var(--light-blue); border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;   /* the label inside is sr-only, but keep it off the UA font */
  transition: border-color .12s ease, background-color .12s ease;
}
.menu-toggle:hover { background: var(--hover); border-color: var(--on-dark); }
.menu-toggle[aria-expanded="true"] { background: var(--on-dark); border-color: var(--on-dark); }
.menu-bars { display: block; width: 20px; }
.menu-bars span {
  display: block; height: 2px; border-radius: 2px; background: var(--on-dark);
}
.menu-toggle[aria-expanded="true"] .menu-bars span { background: var(--primary); }
.menu-bars span + span { margin-top: 4px; }

@media (max-width: 700px) {
  .site-header-inner { padding-bottom: .3rem; }
  .brand { padding-top: .45rem; }

  /* Without the script: a plain scrollable row, so the menu is never lost. */
  .site-nav {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-top: 1px solid var(--hover);
    padding-top: .3rem;
  }
  .site-nav::-webkit-scrollbar { display: none; }
  .menu { gap: .15rem; }
  .menu-link { font-size: .88rem; padding: .4rem .55rem; }

  /* With the script: collapse the menu behind the hamburger button. */
  .has-js-menu .menu-toggle { display: inline-flex; }
  .has-js-menu .site-header-inner { padding-bottom: 0; flex-wrap: nowrap; }
  .has-js-menu .brand { padding-top: 0; }
  .has-js-menu .site-nav {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0; width: auto;
    overflow: visible; padding: .35rem;
    background: var(--background);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 14px 28px -18px rgba(0, 59, 111, .45);
  }
  .has-js-menu .site-nav.is-open { display: block; }
  .has-js-menu .menu { flex-direction: column; align-items: stretch; gap: .1rem; }
  /* The dropdown is a white plate, so its items are dark on light. */
  .has-js-menu .menu-link { font-size: .95rem; padding: .75rem .7rem; color: var(--text); }
  .has-js-menu .menu-link:hover { background: var(--very-light-blue); color: var(--primary); }
  .has-js-menu .menu-link[aria-current="true"] {
    background: var(--very-light-blue); color: var(--primary);
    box-shadow: inset 3px 0 0 var(--primary-blue);
  }

  /* Inside the hamburger the submenu is part of the same list: no second
     plate, no absolute positioning, just an indent under its button. */
  .has-js-menu .menu-sub-toggle { width: 100%; justify-content: space-between; }
  .has-js-menu .menu-sub {
    position: static; min-width: 0; padding: 0 0 .2rem .85rem;
    background: transparent; border: 0; box-shadow: none;
  }
  .has-js-menu .menu-sub-title { margin: .45rem .7rem .15rem; }
  .has-js-menu .menu-sub-link { padding: .625rem .7rem; font-size: .9375rem; }
}

/* Keep sticky-bar-sized breathing room above anything we jump to. */
#calculator, #example, #guide, #how-we-calculate { scroll-margin-top: 72px; }

/* ----------------------------------- hero --------------------------------- */

.hero { padding: 2.625rem 0 1.625rem; text-align: center; }
.hero h1 { margin-bottom: .375rem; }
.lede {
  font-size: 1.0625rem; line-height: 1.625rem; color: var(--ink-soft); max-width: 44rem;
  margin: 0 auto .875rem;
}
.hero-meta { font-size: .875rem; line-height: 1.375rem; color: var(--ink-mute); margin: 0; }

@media (min-width: 700px) {
  h1 { font-size: 2.4rem; }
  h2 { font-size: 1.7rem; }
  .hero { padding: 3.375rem 0 2rem; }
  .lede { font-size: 1.125rem; line-height: 1.75rem; }
}

/* --------------------------------- sections ------------------------------- */

.section { padding: 1.5rem 0 2.75rem; }
.section-alt { background: var(--bg-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-calculator { padding-top: .5rem; }

.card {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.125rem;
}
@media (min-width: 700px) { .card { padding: 1.75rem; } }

.callout { border-radius: var(--radius-sm); padding: .85rem 1rem; margin: 0 0 1rem; }
.callout-warn { background: var(--warn-soft); border: 1px solid var(--warn-line); }

/* --------------------------------- the form ------------------------------- */

.calc-card { padding-top: 1rem; }

.calc-top {
  display: grid; gap: .875rem; grid-template-columns: 1fr;
  padding-bottom: 1rem; margin-bottom: .25rem; border-bottom: 1px solid var(--line);
}
@media (min-width: 560px) { .calc-top { grid-template-columns: 1.4fr 1fr; } }

.preset-note {
  background: var(--very-light-blue); border: 1px solid var(--light-blue); color: var(--primary);
  border-radius: var(--radius-sm); padding: .6rem .8rem; font-size: .88rem; margin: .8rem 0 0;
}

.field { margin: 0 0 1rem; }
.field:last-child { margin-bottom: 0; }
.field-narrow { max-width: 220px; }
.field-inline { margin: 0; }

label {
  display: block; font-weight: 600; font-size: .9375rem; line-height: 1.5rem;
  margin-bottom: .375rem; color: var(--ink);
}
.optional { font-weight: 400; color: var(--ink-mute); font-size: .85em; }

.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .affix {
  position: absolute; left: 12px; color: var(--ink-mute); font-size: .95rem; pointer-events: none;
}
.input-wrap .affix-end { left: auto; right: 12px; }
.input-wrap.money input { padding-left: 28px; }
.input-wrap.suffix input { padding-right: 46px; }

input[type="text"], select {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  line-height: 1.5;
  padding: .75rem;
  min-height: 44px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input[type="text"]::placeholder { color: var(--placeholder); }
input[type="text"]:hover, select:hover { border-color: var(--primary-blue); }
input[type="text"]:focus, select:focus {
  outline: none; border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(53, 111, 163, .28);
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23356FA3' d='M1.4.6 6 5.2 10.6.6 12 2 6 8 0 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
input[aria-invalid="true"] { border-color: var(--danger); background: var(--danger-soft); }
input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(180, 35, 24, .22); }

.hint-toggle {
  appearance: none; border: 1px solid var(--border); background: var(--background); color: var(--primary-blue);
  width: 19px; height: 19px; border-radius: 50%; font-size: .72rem; font-weight: 700;
  line-height: 1; padding: 0; cursor: pointer; vertical-align: 1px; margin-left: .3rem;
  /* Without this the "?" is drawn in the UA button font (Arial on Windows)
     while the label beside it is in the site stack. */
  font-family: inherit;
  position: relative;
}
/* The circle stays 19px - it sits inline with a label and a bigger disc would
   crowd it - but the tappable area is grown to the 24px WCAG 2.5.8 minimum
   with a transparent overlay that changes nothing visually. */
.hint-toggle::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 24px; height: 24px;
  transform: translate(-50%, -50%);
}
.hint-toggle:hover { border-color: var(--brand); color: var(--brand); }
.hint-toggle[aria-expanded="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-dark); }

.hint {
  font-size: .875rem; line-height: 1.375rem; color: var(--ink-soft); background: var(--very-light-blue);
  border-left: 3px solid var(--primary-blue); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: .5rem .75rem; margin: 0 0 .5rem;
}
.field-note { font-size: .8125rem; line-height: 1.25rem; color: var(--ink-mute); margin: .375rem 0 0; }
.field-error { font-size: .875rem; line-height: 1.25rem; color: var(--danger); font-weight: 600; margin: .375rem 0 0; }

.step { border: 0; padding: 0; margin: 1.5rem 0 0; }

/* --------------------------- section heading -----------------------------
   One component for every numbered section: circle, title, divider. The three
   rows are structurally identical - same 44px height, same 40px circle, same
   1px divider - so nothing about a heading depends on how long its title is.

   It is a <legend> because each section is a <fieldset> and the legend is what
   names that group for a screen reader. A legend is normally laid out inside
   the fieldset's border, where the border would be notched around it; the
   float puts it back into normal flow so the flex row behaves like any other.

   Whole pixels throughout: a 1px divider only paints as 1px when it lands on
   one. Centring a bare 1px item in an even 44px row would put it on x.5 and
   smear it over two rows, so the divider carries 1px of top margin - flex
   centres the margin box, which lands the line itself on a whole pixel.
   -------------------------------------------------------------------------- */
.section-heading {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  gap: 14px;
  float: left;          /* legend-specific, see above */
  padding: 0;
  margin: 0 0 .75rem;
}
.section-heading + * { clear: both; }

.section-number {
  width: 40px;
  height: 40px;
  min-width: 40px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: var(--on-dark);
  font-size: .875rem;
  font-weight: 700;
  line-height: 1;
}

.section-title {
  margin: 0;
  min-width: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5rem;   /* 24px: whole pixels, so a wrapped title still stacks in whole rows */
  color: var(--primary);
  white-space: nowrap;
}

.section-divider {
  flex: 1;
  height: 1px;
  min-width: 20px;
  margin-top: 1px;      /* keeps the centred line on a whole pixel, see above */
  background: var(--line);
}

/* One point larger on desktop; the row itself is the same at every width. */
@media (min-width: 700px) {
  .section-title { font-size: 1.0625rem; }
}

/* Narrow phones: a long title wraps rather than pushing the divider out of the
   card. Two 20px lines still fit the 44px row, so a wrapped heading takes up no
   more space than a short one and every row stays the same height. */
@media (max-width: 479px) {
  .section-title { white-space: normal; line-height: 1.25rem; }
}

/* One column on phones, so the row gap has to match the spacing a standalone
   .field carries: without it the second field in a pair sat tight against
   whatever followed, while the first kept its margin. */
.grid-2 { display: grid; gap: 1rem; grid-template-columns: 1fr; margin: 0 0 1rem; }
.grid-2 > .field { margin-bottom: 0; }
.grid-2:last-child { margin-bottom: 0; }
@media (min-width: 560px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* ------------------------------ advanced panel ---------------------------- */

.advanced {
  margin-top: 1.1rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg-alt);
}
.advanced summary {
  cursor: pointer; padding: .8rem 1rem; font-weight: 600; font-size: .94rem;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .6rem;
  list-style: none;
}
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before {
  content: "+"; display: inline-grid; place-items: center; width: 18px; height: 18px;
  border-radius: 4px; background: var(--background); border: 1px solid var(--primary-blue);
  font-size: .85rem; line-height: 1; color: var(--primary-blue);
}
.advanced[open] summary::before { content: "\2212"; }
.advanced-summary { font-weight: 400; font-size: .84rem; color: var(--ink-mute); }
.advanced[open] .advanced-summary { display: none; }
.advanced-body { padding: 0 1rem 1rem; border-top: 1px solid var(--line); padding-top: 1rem; }

/* --------------------------------- buttons -------------------------------- */

/* stretch, not center: .btn-lg sets a larger type size than the quiet button
   beside it, so centring left the two of them 1.3px apart in the same row.
   Stretch settles that while they share a line; the shared floor settles it
   again once the row wraps and each button sizes on a line of its own. */
.actions { display: flex; flex-wrap: wrap; gap: .7rem; align-items: stretch; margin-top: 1.4rem; }
.actions .btn { min-height: 52px; }

.btn {
  appearance: none; font: inherit; font-weight: 600; cursor: pointer;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  padding: .7rem 1.1rem; min-height: 46px;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}
/* The committing action, this form's equivalent of an equals key. */
.btn-primary { background: var(--primary-blue); color: var(--on-dark); border-color: var(--primary-blue); }
.btn-primary:hover { background: var(--hover); border-color: var(--hover); }
.btn-lg { flex: 1 1 220px; font-size: 1.05rem; min-height: 52px; }

/* Supporting actions: white plate, blue border, dark label. */
.btn-secondary { background: var(--background); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--very-light-blue); border-color: var(--primary-blue); color: var(--primary); }

/* Reset, the clear key: quiet until touched, then light blue-grey. */
.btn-quiet { background: transparent; color: var(--ink-soft); border-color: transparent; }
.btn-quiet:hover { background: var(--very-light-blue); color: var(--primary); border-color: var(--light-blue); }

.linkish {
  appearance: none; background: none; border: 0; padding: 0; font: inherit;
  color: var(--primary-blue); text-decoration: underline; cursor: pointer;
}

.live-note { font-size: .84rem; color: var(--ink-mute); margin: .7rem 0 0; }

.form-errors {
  margin-top: 1.2rem; background: var(--danger-soft); border: 1px solid var(--danger-line);
  border-radius: var(--radius-sm); padding: .85rem 1rem; color: var(--danger-ink); font-size: .92rem;
}
.form-errors strong { display: block; margin-bottom: .25rem; color: var(--danger); }
.form-errors ul { margin: 0; padding-left: 1.1rem; }
.form-errors a { color: var(--danger-ink); }

/* --------------------------------- results -------------------------------- */

.results-card { margin-top: 1.25rem; scroll-margin-top: 76px; }
.results-card.is-stale .results-head,
.results-card.is-stale .headline-grid,
.results-card.is-stale .breakdown-visual,
.results-card.is-stale .table-scroll,
.results-card.is-stale .stat-row { opacity: .4; }

.results-stale {
  background: var(--warn-soft); border: 1px solid var(--warn-line); color: var(--warn-ink);
  border-radius: var(--radius-sm); padding: .7rem .9rem; font-size: .9rem;
  font-weight: 600; margin-bottom: 1rem;
}

/* The display: the one panel that reads like a calculator readout. Medium
   blue plate, white figures, same size and position as before. */
.results-head {
  text-align: center;
  background: var(--medium-blue);
  color: var(--on-dark);
  border-radius: var(--radius-sm);
  padding: 1rem .9rem 1.1rem;
}
.results-head h2 {
  font-size: .92rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--on-dark); margin-bottom: .25rem;
}
.results-for { font-size: .95rem; font-weight: 600; color: var(--on-dark); margin: 0 0 .3rem; }
.price {
  /* The floor has to leave room for the widest figure this can print, not just
     a comfortable one. At the old 2.6rem the clamp never shrank below 41.6px,
     so on a 320px screen any six-figure price ran past the navy plate and a
     seven-figure one pushed the page into horizontal scroll. A 2rem floor lets
     11vw do its job on small phones; break-word is the last resort so nothing
     can escape the card whatever the number turns out to be. */
  font-size: clamp(2rem, 11vw, 4rem); font-weight: 800; letter-spacing: -.03em;
  line-height: 1.05; margin: 0; color: var(--on-dark); font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
}
.price-sub { font-size: .92rem; color: var(--on-dark); margin: .3rem 0 0; }

.headline-grid {
  display: grid; gap: .6rem; grid-template-columns: 1fr;
  margin: 1.3rem 0 1.5rem;
}
@media (min-width: 560px) { .headline-grid { grid-template-columns: repeat(3, 1fr); } }
.headline-cell {
  background: var(--very-light-blue); border: 1px solid var(--light-blue); border-radius: var(--radius-sm);
  padding: .75rem .85rem; display: flex; flex-direction: column; gap: .1rem;
}
.headline-value { color: var(--primary); }
.headline-label { font-size: .82rem; color: var(--ink-mute); }
.headline-value { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.headline-note { font-size: .78rem; color: var(--ink-mute); }

.visual-title { font-size: .95rem; margin-bottom: .5rem; }
.breakdown-visual { margin-bottom: 1.5rem; }
.bar {
  display: flex; width: 100%; height: 30px; border-radius: var(--radius-sm); overflow: hidden;
  background: var(--very-light-blue); border: 1px solid var(--border);
}
.bar-seg { height: 100%; transition: width .15s ease; }
.seg-cost { background: var(--cost); }
.seg-fee { background: var(--fee); }
.seg-profit { background: var(--profit); }

.legend {
  list-style: none; display: flex; flex-wrap: wrap; gap: .4rem 1.2rem;
  margin: .6rem 0 0; padding: 0; font-size: .88rem; color: var(--ink-soft);
}
.legend b { font-variant-numeric: tabular-nums; color: var(--ink); }
.legend span[id$="-pct"] { color: var(--ink-mute); }
.swatch { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: .2rem; }
.sw-cost { background: var(--cost); }
.sw-fee { background: var(--fee); }
.sw-profit { background: var(--profit); }

/* The tax estimate splits three ways rather than the pricing bar's three, and
   the segments reuse the same three hues so the two calculators read as one
   family: navy for the biggest, deliberate share, amber for the fee-like one,
   green for what is left. */
.seg-tax-federal { background: var(--cost); }
.seg-tax-se { background: var(--fee); }
.seg-tax-state { background: var(--profit); }
.sw-tax-federal { background: var(--cost); }
.sw-tax-se { background: var(--fee); }
.sw-tax-state { background: var(--profit); }

/* A figure we will not print, because we do not have the rule for it. Sits in
   the same slot a number would, so nothing jumps when a state is picked. */
.result-unsupported {
  font-size: .85rem; font-weight: 600; color: var(--ink-mute);
  font-variant-numeric: normal;
}

/* ------------------------- 1099 tax calculator ---------------------------- *
   Only the pieces the pricing calculator had no equivalent for. Everything
   else on that page - cards, fields, hints, the advanced panel, the results
   table, the bar, the stat row - is the same component. */

/* A line of explanation under a step heading, before its first field. */
.step-note { margin: 0 0 .85rem; }

/* Gross - deductions = profit, worked out live under the expense fields, so
   the effect of an expense is visible before anyone presses a button. */
.profit-preview {
  list-style: none; margin: .25rem 0 0; padding: .7rem .9rem;
  background: var(--bg-alt); border: 1px solid var(--line);
  border-radius: var(--radius-sm); font-size: .92rem; color: var(--ink-soft);
}
.profit-preview li {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; padding: .18rem 0;
}
.profit-preview b { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.profit-preview .row-sum {
  margin-top: .3rem; padding-top: .45rem; border-top: 1px solid var(--line);
  color: var(--primary); font-weight: 600;
}
.profit-preview .row-sum b { color: var(--primary); }

/* The same numbered heading as the form steps, used once inside the results
   card. It is a plain block there rather than a floated <legend>. */
.results-section-heading { float: none; margin-bottom: 1rem; }

/* Quarterly block: the same plate as the disclaimer, with the two figures
   side by side on anything wider than a phone. */
.quarterly-note {
  background: var(--bg-alt); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: .9rem 1rem; margin-top: 1.2rem;
}
.quarterly-note h3 { font-size: 1rem; color: var(--primary); margin: 0 0 .5rem; }
.quarterly-note p { font-size: .9rem; color: var(--ink-soft); margin: 0 0 .6rem; }
.quarterly-note p:last-child { margin-bottom: 0; }
.quarterly-figures { display: flex; flex-wrap: wrap; gap: .4rem 1.6rem; }
.quarterly-figures span { display: inline-flex; align-items: baseline; gap: .4rem; }
.quarterly-figures b {
  font-size: 1.1rem; color: var(--primary); font-variant-numeric: tabular-nums;
}

/* Related reading at the foot of a page. */
.related-list { margin: 0; padding-left: 1.1rem; color: var(--ink-soft); }
.related-list li { margin-bottom: .5rem; }
.related-list li:last-child { margin-bottom: 0; }
.related-list a { font-weight: 600; }

.table-scroll { overflow-x: auto; }
.breakdown { width: 100%; border-collapse: collapse; font-size: .94rem; }
.breakdown th, .breakdown td { text-align: left; padding: .55rem .4rem; border-bottom: 1px solid var(--line); }
.breakdown thead th {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--on-dark); background: var(--primary);
  border-bottom: 1px solid var(--primary); font-weight: 600;
  padding-top: .45rem; padding-bottom: .45rem;
}
.breakdown thead th:first-child { border-radius: var(--radius-sm) 0 0 0; padding-left: .7rem; }
.breakdown thead th:last-child { border-radius: 0 var(--radius-sm) 0 0; padding-right: .7rem; }
.breakdown th { font-weight: 500; color: var(--ink-soft); }
.breakdown td.num, .breakdown th.num { text-align: right; font-variant-numeric: tabular-nums; }
.breakdown .row-sum th, .breakdown .row-sum td { font-weight: 700; color: var(--primary); background: var(--very-light-blue); }
.breakdown .row-strong th, .breakdown .row-strong td { font-weight: 700; color: var(--ink); }
.row-note { font-size: .8em; color: var(--ink-mute); font-weight: 400; }
.qty-one .col-order { display: none; }

.stat-row {
  list-style: none; margin: 1.3rem 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: .55rem;
}
@media (min-width: 620px) { .stat-row { grid-template-columns: repeat(4, 1fr); } }
.stat-row li {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .55rem .7rem;
  display: flex; flex-direction: column;
}
.stat-row span { font-size: .8rem; color: var(--ink-mute); }
.stat-row b { font-size: 1.05rem; font-variant-numeric: tabular-nums; color: var(--primary); }

.results-notes {
  margin-top: 1.1rem; background: var(--warn-soft); border: 1px solid var(--warn-line);
  border-radius: var(--radius-sm); padding: .7rem .9rem; font-size: .88rem; color: var(--warn-ink);
}
.results-notes p { margin: 0 0 .4rem; }
.results-notes p:last-child { margin: 0; }

.math { margin-top: 1.2rem; border-top: 1px solid var(--line); padding-top: .9rem; }
.math summary { cursor: pointer; font-weight: 600; font-size: .94rem; color: var(--primary-blue); }
.math-body { margin-top: .8rem; font-size: .9rem; color: var(--ink-soft); }
.math-body .eq { margin: 0 0 .5rem; }

.eq {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .5rem .7rem; overflow-x: auto;
}
.eq-result {
  background: var(--very-light-blue); border-color: var(--primary-blue);
  color: var(--primary); font-weight: 600;
}

.assumptions { font-size: .84rem; color: var(--ink-mute); margin: 1rem 0 0; }

.results-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.2rem; }
.results-actions .btn { flex: 1 1 auto; font-size: .92rem; min-height: 44px; }
.action-status { font-size: .85rem; color: var(--profit); font-weight: 600; margin: .5rem 0 0; min-height: 1.2em; }

.disclaimer { font-size: .82rem; color: var(--ink-mute); margin-top: 1.1rem; }
.disclaimer-block {
  background: var(--bg-alt); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .8rem .9rem; margin-top: 1.2rem;
}

/* --------------------------------- example -------------------------------- */

.example-card > * + * { margin-top: 1.1rem; }
.example-table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.example-table th, .example-table td { padding: .45rem .3rem; border-bottom: 1px solid var(--line); text-align: left; }
.example-table th { font-weight: 500; color: var(--ink-soft); }
.example-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.example-table .row-sum th, .example-table .row-sum td { font-weight: 700; color: var(--ink); }
.example-math > .eq + .eq { margin-top: .4rem; }
.example-math .eq { margin-bottom: 0; }
.example-note { font-size: .9rem; color: var(--ink-soft); }

/* ---------------------------------- guide --------------------------------- */

.qa { margin-bottom: 1.8rem; }
.qa:last-child { margin-bottom: 0; }
.qa h3 { font-size: 1.15rem; margin-bottom: .5rem; }
.qa p { color: var(--ink-soft); }
.qa .eq { color: var(--ink); background: var(--background); }

.formula-card { padding-bottom: 1.4rem; }
.formula-list { margin: 0 0 1.5rem; padding-left: 1.3rem; }
.formula-list > li { margin-bottom: 1.1rem; }
.formula-list h3 { font-size: 1rem; margin-bottom: .35rem; }
.formula-list p { font-size: .92rem; color: var(--ink-soft); }
.formula-list .eq { color: var(--ink); }

/* --------------------------------- footer --------------------------------- */

.site-footer {
  border-top: 1px solid var(--border); background: var(--bg-alt);
  padding: 1.8rem 0; margin-top: 1rem; font-size: .9rem; color: var(--ink-soft);
}
.footer-small { font-size: .82rem; color: var(--ink-mute); margin: 0; }

.footer-nav {
  display: flex; flex-wrap: wrap; gap: .4rem 1.4rem;
  padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border);
}
.footer-nav a {
  color: var(--primary); text-decoration: none; font-weight: 600; font-size: .92rem;
  padding: .2rem 0;
}
.footer-nav a:hover { color: var(--hover); text-decoration: underline; }
.footer-nav a[aria-current="page"] { color: var(--ink-soft); font-weight: 500; }

/* ------------------------------ content pages ----------------------------- */

.page-head { padding: 2rem 0 .5rem; }
.page-head h1 { font-size: 1.8rem; margin-bottom: .3rem; }
/* the hero lede is centred; here it runs flush with the heading */
.page-head .lede { margin-left: 0; margin-right: 0; }
@media (min-width: 700px) { .page-head h1 { font-size: 2.2rem; } }

.breadcrumb { font-size: .84rem; color: var(--ink-mute); margin-bottom: .6rem; }
.breadcrumb a { color: var(--primary-blue); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { color: var(--ink-mute); }

.prose > * + * { margin-top: 1rem; }
.prose h2 { font-size: 1.2rem; margin: 1.8rem 0 .4rem; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 1rem; margin: 1.2rem 0 .3rem; color: var(--primary); }
.prose p, .prose li { color: var(--ink-soft); }
.prose ul, .prose ol { margin: 0 0 0; padding-left: 1.3rem; }
.prose li { margin-bottom: .4rem; }
.prose li:last-child { margin-bottom: 0; }
.prose strong { color: var(--ink); }
.prose .note {
  background: var(--very-light-blue); border: 1px solid var(--light-blue);
  border-radius: var(--radius-sm); padding: .8rem .9rem; color: var(--primary);
}
.prose dl { margin: 0; }
.prose dt { font-weight: 700; color: var(--ink); margin-top: .8rem; }
.prose dd { margin: .1rem 0 0; color: var(--ink-soft); }
.updated { font-size: .84rem; color: var(--ink-mute); }

.contact-list { list-style: none; padding: 0; margin: 0; }
.contact-list li { margin-bottom: .9rem; }
.contact-list a { font-weight: 600; }

/* ==========================================================================
   Press states
   --------------------------------------------------------------------------
   Deliberately last: on a touchscreen a tap fires :hover as well as :active,
   so these have to come after the component :hover rules to win.
   ========================================================================== */

.btn, .menu-link, .menu-toggle, .hint-toggle, .linkish, .skip-link, summary {
  transition: background-color .14s ease, border-color .14s ease, color .14s ease,
              box-shadow .14s ease, opacity .14s ease, transform .08s ease;
}

.btn:active { transform: scale(.975); }
.btn-primary:active {
  background: var(--active);
  border-color: var(--active);
  box-shadow: inset 0 2px 5px rgba(0, 24, 45, .35);
}
.btn-secondary:active {
  background: var(--light-blue);
  border-color: var(--active);
  color: var(--primary);
}
.btn-quiet:active { background: var(--light-blue); color: var(--primary); border-color: var(--active); }

.menu-toggle:active {
  transform: scale(.94);
  background: var(--active);
  border-color: var(--on-dark);
}
.hint-toggle:active {
  transform: scale(.9);
  background: var(--active);
  border-color: var(--active);
  color: var(--on-dark);
}
.menu-link:active { background: var(--active); color: var(--on-dark); }
.has-js-menu .menu-link:active { background: var(--light-blue); color: var(--primary); }
.linkish:active { opacity: .6; }
.advanced summary:active, .math summary:active { color: var(--active); }
main a:active, .site-footer a:active { opacity: .65; }

/* A press that shrinks is still motion: honour the reduced-motion setting. */
@media (prefers-reduced-motion: reduce) {
  .btn:active, .menu-toggle:active, .hint-toggle:active { transform: none; }
}

/* ---------------------------------- print --------------------------------- */

@media print {
  @page { margin: 1.5cm; }
  body { font-size: 11pt; }
  .hero, .site-nav, .menu-toggle, .skip-link, .section-alt, #example, #how-we-calculate,
  .site-footer, .actions, .results-actions, .live-note, .advanced, .hint, .hint-toggle,
  .form-errors, .action-status, .preset-note { display: none !important; }
  /* the brand stays: a printed quote should say who produced it */
  .site-header { position: static; border-bottom: 1px solid #999; margin-bottom: .6rem; }
  .site-header-inner { min-height: 0; padding: 0 0 .4rem; }
  .card { box-shadow: none; border: 1px solid #999; break-inside: avoid; }
  .results-card { margin-top: 1rem; }
  .price { font-size: 28pt; }
  .math[open] .math-body { display: block; }
  a { text-decoration: none; color: inherit; }
  .bar { border: 1px solid #999; }
  /* the navy plates have to survive the printer's colour stripping */
  .site-header, .results-head, .breakdown thead th, .bar-seg {
    print-color-adjust: exact; -webkit-print-color-adjust: exact;
  }
  .seg-cost { background: #003B6F !important; }
  .seg-fee { background: #B45309 !important; }
  .seg-profit { background: #046C4E !important; }
}
