/* TEI calculator parts (V2 refresh, REF-Calculator: Cost of Waiting, Oct 2026).
   Shared by every calculator page. Load order: /style.css, mobile-nav.css,
   compliance.css, article.css, content.css, motion.css, then this file.
   Colours are the theme tokens from content.css (--c-*, --tc-*), so light and
   dark both work. Nothing here defines tokens.

   Parts
     .tl-inputs     the input grid: .tl-field number boxes, .tl-row steppers
     .tl-choice     a row of option buttons (e.g. growth rates), aria-pressed
     .tl-box        the one blue card that holds the whole tool
     .tl-head       the headline: the figure and .tl-bars
     .tl-gate       results behind the lead gate (/assets/lead-gate.js):
                    the chart, .tl-pills and the lump sum
     .tl-go         "Show me the cost of waiting"; figure[data-stage] is
                    inputs, gate or full (set by the page's script)
     .tl-risk       the short risk line that sits under the results
     .tl-advice     the not-advice line after "What this does not say"
     .tl-next       the "Next steps" cards that end every tool page
   Type: labels, hints and buttons in a calculator use Geist, not Geist Mono
   (mono stays for chart axes only). Hick's law: one figure leads in each
   block, the rest support it at a smaller size. The chart reuses line-draw
   from /assets/motion.css. */

/* ---------- A tool page (body.tl-page) ----------
   The tool is the page: a short title area, then one blue card. Desktop is one
   page (results blurred under the inputs until "Show me"); phones step through
   it in place. Sized to one screen (Paddy, 30 Oct: 890px of a 1440x900
   desktop; an iPhone 14 in Safari, with the bottom menu at 630px). */
body.tc-page.tl-page .ar-hero-in { padding: 10px 32px 18px; }
body.tc-page.tl-page .ar-back { min-height: 24px; }
body.tc-page.tl-page .ar-hero h1 { margin-top: 6px; font-size: 34px; line-height: 1.1; }
body.tc-page.tl-page .ar-dek { max-width: none; margin-top: 6px; font-size: 15px; line-height: 1.5; }
body.tc-page.tl-page .article-body { padding-top: 16px; }
body.tl-page figure.tl-tool.visual-block { margin: 0 0 32px; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
body.tl-page figure.tl-tool > .visual-caption { margin-top: 10px; }

/* ---------- The card ----------
   The same deep blue in both themes, so everything inside it takes dark-theme
   colours: the boxes, buttons, chart and the lead gate (Paddy, 30 Oct: one
   colour through the whole flow). */
.tl-box {
  position: relative; overflow: hidden; padding: 16px 22px; border-radius: 20px; background: var(--c-key); box-shadow: var(--c-key-shadow); color: var(--c-key-text);
  --c-tile: var(--c-key); --c-tile-2: #0F2B57; --c-ink: #F7F4ED; --c-muted: #B8C6DC;
  --c-line: rgba(232, 214, 168, 0.20); --c-line-soft: rgba(232, 214, 168, 0.10);
  --c-gold: #E8D6A8; --c-btn: #E8D6A8; --c-btn-ink: #0F1E36; --c-s1: #E8D6A8; --c-warn: #FF8F7F; --c-powder: #1C2B45;
  --tl-pill: #1A4382;
}
.tl-box > * { position: relative; }
.tl-box > .tl-ring { position: absolute; width: 360px; height: 360px; right: -150px; top: -170px; border-radius: 50%; border: 1px dashed rgba(232, 214, 168, 0.22); pointer-events: none; }
.tl-ring::after { content: ""; position: absolute; inset: 70px; border-radius: 50%; border: 1px solid rgba(232, 214, 168, 0.12); }
.tl-box p { font-weight: 400; }
.tl-link { padding: 0; border: 0; background: none; color: var(--c-gold); font: 500 13px var(--tc-font); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.tl-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.tl-recap, .tl-amounts, .tl-tease { display: none; }
/* Segmented buttons inside the card (Start in, the gate's contact choice) */
:root .tl-box .ar-seg { margin-top: 0; padding: 2px; border-color: var(--c-line); background: var(--c-tile-2); }
:root .tl-box .ar-seg button { min-width: 0; color: var(--c-muted); font-family: var(--tc-font); font-size: 13px; }
:root .tl-box .ar-seg button[aria-pressed="true"] { background: var(--c-btn); color: var(--c-btn-ink); }
.tl-box .ar-seg button:disabled { opacity: .35; cursor: not-allowed; }

/* ---------- Inputs ----------
   The question with the monthly amount as the lead input, then age, retire
   and "Start in", then the growth rates. */
.tl-inputs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px 14px; margin: 0; }
.tl-top { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; }
.tl-box .tl-ask { margin: 0; font-size: 22px; line-height: 1.25; font-weight: 300; letter-spacing: -0.02em; color: #F7F4ED; }
.tl-ask small { display: block; margin-top: 2px; font-size: 13px; letter-spacing: 0; color: var(--c-muted); }
.tl-lead { display: flex; align-items: center; gap: 10px; }
.tl-lead .tl-num { width: 190px; min-height: 52px; padding: 0 14px; border-radius: 14px; }
.tl-lead .tl-num span { font-size: 24px; font-weight: 300; color: var(--c-gold); }
.tl-lead .tl-num input { font-size: 32px; font-weight: 300; letter-spacing: -0.02em; color: var(--c-gold); }
.tl-per { font-size: 15px; color: var(--c-key-text); }
.tl-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tl-field > label, .tl-row-label { font-family: var(--tc-font); font-size: 13px; font-weight: 500; line-height: 1.3; color: var(--c-key-text); white-space: nowrap; }
.tl-num { display: flex; align-items: center; box-sizing: border-box; min-height: 35px; padding: 0 11px; border-radius: 10px; border: 1px solid var(--c-line); background: var(--c-tile-2); transition: border-color .2s ease; }
.tl-num:focus-within { border-color: var(--c-gold); }
.tl-num span { flex: none; margin-right: 4px; font-size: 13px; color: var(--c-muted); }
.tl-num input, .tl-num select {
  flex: 1 1 auto; min-width: 0; width: 100%; padding: 0; border: 0; background: transparent; outline: none;
  font-family: var(--tc-font); font-size: 13px; font-weight: 500; color: var(--c-ink); font-variant-numeric: tabular-nums;
  -moz-appearance: textfield; appearance: textfield;
}
.tl-num select option { color: #13213A; }
.tl-num input::-webkit-outer-spin-button, .tl-num input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.tl-num input::placeholder { color: var(--c-muted); opacity: .6; }
.tl-field small { font-family: var(--tc-font); font-size: 12px; line-height: 1.4; color: var(--c-muted); }
.tl-row { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; }
.tl-wait .ar-seg { align-self: flex-start; }
.tl-wait .ar-seg button { min-height: 29px; padding: 0 10px; }
.tl-select { display: none; position: relative; }
.tl-select select { -webkit-appearance: none; appearance: none; padding-right: 16px; cursor: pointer; }
.tl-select::after { content: ''; position: absolute; right: 10px; top: 50%; width: 6px; height: 6px; margin-top: -5px; border-right: 1.5px solid var(--c-muted); border-bottom: 1.5px solid var(--c-muted); transform: rotate(45deg); pointer-events: none; }
.tl-rate-name { display: none; font-weight: 400; color: var(--c-muted); }

/* Option buttons: value first, name beside it, one pressed at a time */
.tl-choice { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tl-choice button {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 33px; padding: 0 10px;
  border-radius: 999px; border: 1px solid var(--c-line); background: var(--c-tile-2); color: var(--c-ink);
  font-family: var(--tc-font); cursor: pointer; transition: background-color .2s ease, border-color .2s ease;
}
.tl-choice button span { order: 2; font-size: 12px; color: var(--c-muted); }
.tl-choice button b { font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }
.tl-choice button:hover { border-color: var(--c-gold); }
.tl-choice button[aria-pressed="true"] { background: var(--c-btn); border-color: var(--c-btn); color: var(--c-btn-ink); }
.tl-choice button[aria-pressed="true"] span { color: var(--c-btn-ink); opacity: .8; }

/* A label above the start of the "wait" line on a line-draw chart */
.tl-mark { position: absolute; top: 0; left: var(--x); transform: translate(6px, -2px); padding: 1px 7px; border-radius: 999px; background: var(--c-tile); border: 1px solid var(--c-line); font-family: var(--tc-mono); font-size: 10.5px; line-height: 1.4; color: var(--c-muted); white-space: nowrap; }
.tl-mark.is-flip { transform: translate(calc(-100% - 6px), -2px); }
.m-chart .m-start { stroke: var(--c-warn); opacity: .55; transition: transform .65s var(--tc-ease); }
.tl-mark { transition: left .65s var(--tc-ease); }
.m-armed .m-chart .m-start, .m-armed .tl-mark { opacity: 0; }
.m-armed.m-on .m-chart .m-start { opacity: .55; transition: opacity .4s ease 1.1s, transform .65s var(--tc-ease); }
.m-armed.m-on .tl-mark { opacity: 1; transition: opacity .4s ease 1.2s, left .65s var(--tc-ease); }

/* ---------- The result ---------- */
.tl-out { position: relative; margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(232, 214, 168, 0.22); }
.tl-head { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "k bars" "v bars" "sub bars"; column-gap: 36px; align-items: center; }
.tl-head p { margin: 0 !important; }
.tl-head .tl-head-k { grid-area: k; font-size: 14px !important; line-height: 1.3 !important; color: var(--c-key-text) !important; }
.tl-head .tl-head-v { grid-area: v; display: block; margin: 2px 0; font-size: 48px; line-height: 1; font-weight: 300; letter-spacing: -0.04em; color: var(--c-key-num); font-variant-numeric: tabular-nums; }
.tl-head .tl-head-sub { grid-area: sub; font-size: 13px !important; line-height: 1.3 !important; color: var(--c-muted) !important; }
.tl-bars { grid-area: bars; display: grid; gap: 10px; }
.tl-bar { display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: center; gap: 10px; }
.tl-bar-k { font-size: 12px; line-height: 1.3; color: var(--c-muted); white-space: nowrap; }
.tl-bar-t { display: block; height: 8px; border-radius: 999px; background: rgba(232, 214, 168, 0.12); overflow: hidden; }
.tl-bar.is-wait .tl-bar-t { background: repeating-linear-gradient(135deg, rgba(255, 143, 127, 0.55) 0 2px, transparent 2px 6px); }
.tl-bar-t i { display: block; width: var(--w); height: 100%; border-radius: 999px; background: var(--c-key-num); transition: width .6s var(--tc-ease); }
.tl-bar.is-wait .tl-bar-t i { background: var(--c-warn); }   /* the same coral as its chart line */
.m-armed .tl-bar-t i { width: 0; }
.m-armed.m-on .tl-bar-t i { width: var(--w); transition: width 1.2s var(--tc-ease) .3s; }
.tl-gated > .tc-key { margin: 14px 0 4px; font-size: 12px; color: var(--c-muted); }
.tl-tool .m-chart.is-bold, body.tc-page .tl-tool .m-chart.is-bold { height: 112px; margin: 8px 0 26px 44px; }
/* The figures as pills: the catch-up leads in champagne. */
.tl-pills { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tl-pill { min-width: 0; padding: 10px 14px; border-radius: 16px; background: var(--tl-pill); border: 1px solid var(--c-line); }
.tl-pill small { display: block; overflow: hidden; font-size: 11px; line-height: 1.3; color: var(--c-muted); white-space: nowrap; text-overflow: ellipsis; }
.tl-pill b { display: block; margin-top: 2px; font-size: 20px; line-height: 1.2; font-weight: 400; letter-spacing: -0.01em; color: #F7F4ED; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl-pill.is-lead { background: var(--c-key-num); border-color: var(--c-key-num); }
.tl-pill.is-lead small { color: #0F1E36; opacity: .75; }
.tl-pill.is-lead b { color: #0F1E36; }
.tl-tag { display: inline-flex; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--c-line); font-size: 10.5px; line-height: 1.4; color: var(--c-muted); white-space: nowrap; }
.tl-tag.is-today { background: var(--c-powder); border-color: transparent; color: var(--c-ink); }

/* Optional extra input, folded away until asked for (e.g. a lump sum), beside Print */
.tl-after { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; margin-top: 10px; }
.tl-after .tc-btn { min-height: 34px; padding: 0 14px; font-size: 13px; }
.tl-extra { flex: 1 1 auto; }
.tl-extra summary { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--c-gold); list-style: none; }
.tl-extra summary::-webkit-details-marker { display: none; }
.tl-extra summary::before { content: '+'; display: inline-block; width: 1em; font-size: 16px; line-height: 1; }
.tl-extra[open] summary::before { content: '\2212'; }
.tl-extra-in { display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr); gap: 8px 16px; align-items: end; padding: 6px 0 4px; }
.tl-extra-in label { font-size: 12px; font-weight: 500; color: var(--c-ink); }
.tl-extra-in p { margin: 0 0 10px !important; font-size: 13px !important; line-height: 1.5 !important; color: var(--c-ink) !important; }

/* ---------- Lead gate ----------
   <div class="tl-gate" data-gate="locked">
     <div class="tl-gated">results</div> <div class="tl-lock">contact form</div> <div class="tl-later">
   </div>
   They share one grid cell. lead-gate.js sets data-gate="open" (lead sent,
   or a member) and makes the results inert while locked. "Not now" adds
   .is-later: the form folds into one button. */
.tl-gate { position: relative; display: grid; margin-top: 2px; }
.tl-gated, .tl-lock, .tl-later { grid-area: 1 / 1; min-width: 0; }
.tl-gate[data-gate="locked"] .tl-gated { filter: blur(8px); opacity: .6; pointer-events: none; user-select: none; }
.tl-gated { transition: filter .6s ease, opacity .6s ease; }
.tl-gate[data-gate="locked"] .tl-after { visibility: hidden; }
.tl-gate[data-gate="open"] .tl-lock, .tl-gate[data-gate="open"] .tl-later, .tl-gate:not(.is-later) .tl-later, .tl-gate.is-later .tl-lock { display: none; }
.tl-lock, .tl-later { position: relative; z-index: 1; align-self: center; justify-self: center; }
.tl-lock { width: min(100%, 330px); box-sizing: border-box; padding: 12px 14px 8px; border-radius: 14px; background: var(--c-tile-2); border: 1px solid var(--c-line); color: var(--c-ink); text-align: center; box-shadow: 0 16px 40px rgba(6, 14, 28, 0.35); }
.tl-lock h3 { margin: 0 0 8px; font-size: 16px; line-height: 1.3; font-weight: 400; color: #F7F4ED; }
.tl-lock .tl-lock-d { display: none; margin: -4px 0 8px !important; font-size: 12px !important; line-height: 1.4 !important; color: var(--c-muted) !important; }
.tl-lock .ar-seg { margin: 0 auto 8px; }
.tl-lock .ar-seg button { min-height: 26px; padding: 0 10px; font-size: 12px; }
.tl-lock-row { display: flex; gap: 6px; }
.tl-lock input {
  box-sizing: border-box; flex: 1; min-width: 0; min-height: 34px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--c-line); background: var(--c-key); color: var(--c-ink); font-family: var(--tc-font); font-size: 13px; outline: none;
}
.tl-lock input:focus { border-color: var(--c-gold); }
.tl-lock input[aria-invalid="true"] { border-color: var(--c-warn); }
.tl-lock input::placeholder { color: var(--c-muted); opacity: .8; }
.tl-lock .tc-btn { flex: none; min-height: 34px; padding: 0 16px; border: 0; font-family: var(--tc-font); font-size: 13px; cursor: pointer; }
.tl-lock-err { margin: 6px 0 0 !important; font-size: 12px !important; color: var(--c-warn) !important; }
.tl-lock-err:empty { display: none; }
.tl-lock small { display: block; margin-top: 6px; font-size: 11px; line-height: 1.5; color: var(--c-muted); white-space: nowrap; }
.tl-lock small a, .tl-lock small .tl-link { color: var(--c-gold); font-size: 11px; font-weight: 400; }
.tl-later .tc-btn { min-height: 34px; padding: 0 14px; font-size: 13px; }
.tl-open-note { display: none; margin: 0 0 4px !important; font-size: 11px !important; color: var(--c-key-num) !important; }
.tl-gate[data-gate="open"][data-via="member"] .tl-open-note,
.tl-gate[data-gate="open"][data-via="coach"] .tl-open-note { display: block; }

/* "Show me the cost of waiting" */
.tl-go { display: none; }
.tl-go .tc-btn { min-height: 42px; padding: 0 24px; font-size: 15px; box-shadow: 0 8px 22px rgba(6, 14, 28, 0.30); }
.tl-tool[data-stage="inputs"] .tl-go { display: flex; justify-content: center; }
.tl-box .tl-risk { margin: 10px 0 0 !important; font-size: 12px !important; line-height: 1.4 !important; color: var(--c-muted) !important; }

/* ---------- Desktop: one page ---------- */
@media (min-width: 861px) {
  .tl-tool[data-stage="inputs"] .tl-go { position: absolute; inset: 0; z-index: 2; align-items: flex-start; padding-top: 34px; }
  .tl-tool[data-stage="inputs"] .tl-head, .tl-tool[data-stage="inputs"] .tl-gated { filter: blur(8px); opacity: .6; pointer-events: none; user-select: none; }
  .tl-tool[data-stage="inputs"] .tl-lock, .tl-tool[data-stage="inputs"] .tl-later { display: none; }
  .tl-head { transition: filter .6s ease, opacity .6s ease; }
}

/* ---------- Lines around the result ---------- */
.tl-risk { margin: 14px 0 0 !important; font-size: 13px !important; line-height: 1.5 !important; font-weight: 400 !important; color: var(--c-muted) !important; }
.tl-advice { margin: 0 0 24px !important; padding: 0 2px; font-size: 14px !important; line-height: 1.6 !important; font-weight: 400 !important; color: var(--c-muted) !important; }

/* ---------- Next steps (the ending of every tool page) ---------- */
.tl-next { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
.tl-card { display: flex; flex-direction: column; gap: 10px; box-sizing: border-box; min-width: 0; padding: 24px; border-radius: 22px; background: var(--c-tile); border: 1px solid var(--c-line); color: var(--c-ink); }
.tl-card > small { font-family: var(--tc-mono); font-size: 11px; color: var(--c-gold); }
.tl-card h3 { margin: 0; font-size: 20px; line-height: 1.3; font-weight: 400; color: var(--c-ink); }
.tl-card p { margin: 0; font-size: 15px; line-height: 1.55; font-weight: 300; color: var(--c-muted); }
.tl-card .tl-card-go { display: flex; flex-direction: column; gap: 8px; margin-top: auto; padding-top: 6px; }
.tl-card .tc-btn { min-height: 46px; font-size: 14px; text-decoration: none; }
.tl-card .tc-btn.is-line { color: var(--c-ink); }
.tl-card-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-top: auto; font-size: 15px; font-weight: 500; color: var(--c-gold); text-decoration: none; }
.tl-card-link svg { width: 18px; height: 18px; }
a.tl-card { text-decoration: none; transition: transform .25s ease, box-shadow .25s ease; }
a.tl-card:hover { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.10); }
a.tl-card .tl-card-time { margin-top: auto; font-family: var(--tc-mono); font-size: 11px; color: var(--c-muted); }
.tl-card-img { display: block; width: calc(100% + 48px); height: auto; aspect-ratio: 16 / 9; margin: -24px -24px 6px; border-radius: 22px 22px 0 0; border-bottom: 1px solid var(--c-line); object-fit: cover; object-position: left top; background: var(--c-tile-2); }
/* Two cards (the coming soon holding pages): a row of two, never a half-empty row of three. */
.tl-next.is-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (max-width: 960px) {
  .tl-next, .tl-next.is-two { grid-template-columns: minmax(0, 1fr); }
  /* On phones .ar-more is a two-column grid (Keep reading 2x2); Next steps spans it. */
  body.tc-page .ar-more > .tl-next { grid-column: 1 / -1; }
  .tl-card-img { aspect-ratio: 2 / 1; }
}
@media (max-width: 860px) {
  /* ---------- Phones: three steps in the same card ----------
     Fits the part of an iPhone 14 that Safari leaves visible. Boxes keep
     16px text, or iOS zooms in when one is tapped. */
  body.tc-page.tl-page .ar-back { display: none; }
  body.tc-page.tl-page .ar-hero-in { padding: 12px 16px 14px; }
  body.tc-page.tl-page .ar-hero h1 { margin-top: 0; font-size: 20px; }
  body.tc-page.tl-page .ar-dek { margin-top: 4px; font-size: 12px; }
  body.tc-page.tl-page .article-body { padding-top: 12px; }
  .tl-box { padding: 14px 12px; border-radius: 16px; }
  .tl-box > .tl-ring { width: 240px; height: 240px; right: -110px; top: -120px; }
  .tl-ring::after { inset: 50px; }
  .tl-top { display: block; }
  .tl-box .tl-ask { margin-bottom: 10px; font-size: 18px; }
  .tl-ask small { font-size: 12px; }
  .tl-lead .tl-num { width: 170px; min-height: 52px; }
  .tl-lead .tl-num input { font-size: 28px; }
  .tl-inputs { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.15fr); gap: 10px 6px; }
  .tl-field { gap: 4px; }
  .tl-field > label, .tl-row-label { font-size: 11px; }
  .tl-row { gap: 4px; }
  .tl-num { min-height: 40px; padding: 0 9px; }
  .tl-num span { font-size: 15px; margin-right: 2px; }
  .tl-num input, .tl-num select { font-size: 16px; font-weight: 400; }
  .tl-wait .ar-seg { display: none; }
  .tl-select { display: flex; }
  .tl-choice { gap: 6px; }
  .tl-choice button { min-height: 38px; padding: 0 4px; }
  .tl-choice button span { display: none; }
  .tl-rate-name { display: inline; }
  .tl-out { margin-top: 0; padding-top: 0; border-top: 0; }
  .tl-box .tl-risk { font-size: 11px !important; }

  /* Step 1: the inputs and the button only */
  .tl-tool[data-stage="inputs"] .tl-out > :not(.tl-go) { display: none; }
  .tl-tool[data-stage="inputs"] .tl-go { margin-top: 14px; }
  .tl-tool[data-stage="inputs"] .tl-go .tc-btn { width: 100%; }

  /* Step 2: what was entered, the headline centred, one blurred line, the gate */
  .tl-tool[data-stage="gate"] .tl-inputs { display: none; }
  .tl-tool[data-stage="gate"] .tl-recap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; font-size: 13px; color: var(--c-muted); }
  .tl-tool[data-stage="gate"] .tl-head { display: block; padding-top: 10px; text-align: center; }
  .tl-tool[data-stage="gate"] .tl-head .tl-head-k { font-size: 13px !important; }
  .tl-tool[data-stage="gate"] .tl-head .tl-head-v { margin: 4px 0; font-size: 46px; }
  .tl-tool[data-stage="gate"] .tl-head .tl-head-sub { font-size: 12px !important; }
  .tl-tool[data-stage="gate"] .tl-bars { gap: 6px; margin-top: 12px; text-align: left; }
  .tl-tool[data-stage="gate"] .tl-bar { grid-template-columns: 70px minmax(0, 1fr); }
  .tl-tool[data-stage="gate"] .tl-bar-k { font-size: 11px; }
  .tl-tool[data-stage="gate"] .tl-tease { display: block; margin: 14px 0 10px !important; padding-top: 12px; border-top: 1px solid rgba(232, 214, 168, 0.22); font-size: 13px; text-align: center; color: var(--c-key-text); }
  .tl-tease .tl-blur { display: inline-block; filter: blur(7px); font-size: 22px; color: var(--c-key-num); vertical-align: -2px; user-select: none; }
  .tl-tool[data-stage="gate"] .tl-gated { display: none; }
  .tl-tool[data-stage="gate"] .tl-lock { width: 100%; padding: 12px 10px 10px; box-shadow: none; }
  .tl-lock h3 { margin-bottom: 4px; font-size: 15px; }
  .tl-lock .tl-lock-d { display: block; }
  .tl-lock input, .tl-lock .tc-btn { min-height: 40px; }
  .tl-lock input { font-size: 16px; }
  .tl-lock .ar-seg button { min-height: 30px; }

  /* Step 3: compact controls, then the full result */
  .tl-tool[data-stage="full"] .tl-box { padding-block: 10px; }
  .tl-tool[data-stage="full"] .tl-inputs { grid-template-columns: 92px minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
  .tl-tool[data-stage="full"] .tl-amounts { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--c-muted); }
  .tl-tool[data-stage="full"] .tl-amounts b { font-weight: 500; color: var(--c-key-text); }
  .tl-tool[data-stage="full"] .tl-amounts .tl-link { font-size: 12px; }
  .tl-tool[data-stage="full"]:not(.is-editing) :is(.tl-top, .tl-age, .tl-ret) { display: none; }
  .tl-tool[data-stage="full"] .tl-top { grid-column: auto; }
  .tl-tool[data-stage="full"] .tl-ask, .tl-tool[data-stage="full"] .tl-per { display: none; }
  .tl-tool[data-stage="full"] .tl-lead .tl-num { width: auto; min-height: 34px; padding: 0 9px; border-radius: 10px; }
  .tl-tool[data-stage="full"] .tl-lead .tl-num span { font-size: 15px; color: var(--c-muted); }
  .tl-tool[data-stage="full"] .tl-lead .tl-num input { font-size: 16px; font-weight: 400; color: var(--c-ink); }
  .tl-tool[data-stage="full"] .tl-num { min-height: 34px; }
  .tl-tool[data-stage="full"] .tl-age > label, .tl-tool[data-stage="full"] .tl-ret > label { display: none; }
  .tl-tool[data-stage="full"] .tl-wait > label, .tl-tool[data-stage="full"] .tl-rates .tl-row-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tl-tool[data-stage="full"] .tl-amounts { grid-row: 1; }
  .tl-tool[data-stage="full"] .tl-top { grid-area: 2 / 1; }
  .tl-tool[data-stage="full"] .tl-age { grid-area: 2 / 2; }
  .tl-tool[data-stage="full"] .tl-ret { grid-area: 2 / 3; }
  .tl-tool[data-stage="full"] .tl-wait { grid-area: 3 / 1; }
  .tl-tool[data-stage="full"] .tl-rates { grid-area: 3 / 2 / auto / -1; }
  .tl-tool[data-stage="full"]:not(.is-editing) .tl-wait { grid-row: 2; }
  .tl-tool[data-stage="full"]:not(.is-editing) .tl-rates { grid-row: 2; }
  .tl-tool[data-stage="full"] .tl-choice button { min-height: 34px; }
  .tl-tool[data-stage="full"] .tl-out { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(232, 214, 168, 0.22); }
  .tl-tool[data-stage="full"] .tl-head { grid-template-areas: "k k" "v bars" "sub sub"; column-gap: 14px; row-gap: 2px; }
  .tl-tool[data-stage="full"] .tl-head .tl-head-k, .tl-tool[data-stage="full"] .tl-head .tl-head-sub { font-size: 11.5px !important; }
  .tl-tool[data-stage="full"] .tl-head .tl-head-v { font-size: 30px; }
  .tl-tool[data-stage="full"] .tl-bars { gap: 6px; }
  .tl-tool[data-stage="full"] .tl-bar { grid-template-columns: 62px minmax(0, 1fr); gap: 6px; }
  .tl-tool[data-stage="full"] .tl-bar-k { font-size: 10.5px; }
  .tl-tool[data-stage="full"] .tl-gated > .tc-key { display: none; }   /* the bars, coloured to match, are the key */
  .tl-tool .m-chart.is-bold, body.tc-page .tl-tool .m-chart.is-bold { height: 108px; margin: 12px 0 30px 30px; }
  .tl-pills { grid-template-columns: 1fr 1fr; gap: 5px; }
  .tl-pill { padding: 4px 9px; border-radius: 10px; }
  .tl-pill small { font-size: 9.5px; }
  .tl-pill b { margin-top: 0; font-size: 13px; }
  .tl-after { margin-top: 4px; flex-wrap: nowrap; }
  .tl-extra summary { min-height: 30px; font-size: 12px; }
  .tl-after .tc-btn { min-height: 30px; padding: 0 10px; font-size: 12px; white-space: nowrap; }
  .tl-extra-in { grid-template-columns: minmax(0, 1fr); }
  .tl-tool[data-stage="full"] .tl-box .tl-risk { margin-top: 2px !important; font-size: 10px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* How the numbers work: one column on phones, not two narrow ones. */
  body.tc-page .tei-article:has(.tl-tool) .principle-list { grid-template-columns: minmax(0, 1fr); }
  .tl-card { padding: 20px; }
  .tl-card-img { width: calc(100% + 40px); margin: -20px -20px 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .tl-num, .tl-choice button, a.tl-card, .tl-gated, .tl-head, [data-gated], .tl-mark, .m-chart .m-start, .tl-bar-t i { transition: none !important; }
  .m-armed .tl-bar-t i { width: var(--w) !important; }
  .m-armed .m-chart .m-start { opacity: .55 !important; }
  .m-armed .tl-mark { opacity: 1 !important; transform: none !important; }
  a.tl-card:hover { transform: none; }
}

/* ---------- Print summary (GLOBAL print rules for calculators) ----------
   A tool page holds <div class="tl-print"> as a direct child of <body>. Its
   script fills it when the results are open, adds body.tl-printing and calls
   print(): only the sheet prints, on white, in the brand colours. Print is
   always light, so the sheet uses the light palette's values directly rather
   than the theme tokens (which follow dark mode).
     .tl-print-head     TEI mark, name and date
     .tl-print-inputs   dl of the inputs
     .tl-print-chart    a vector chart (inline SVG)
     .tl-print-results  result tiles, each with a .tl-tag money label
     .tl-print-notes    assumptions, then the not-advice line */
.tl-print { display: none; }
@media print {
  @page { size: A4; margin: 14mm 14mm 12mm; }
  body.tl-printing { background: #FFFFFF !important; }
  body.tl-printing > :not(.tl-print) { display: none !important; }
  body.tl-printing .tl-print {
    display: block; color: #13213A; font-family: 'Geist', system-ui, sans-serif; font-size: 11pt; line-height: 1.45;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .tl-print-head { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid #DEDAD0; }
  .tl-print-head b { font-size: 11pt; font-weight: 500; color: #0F1E36; }
  .tl-print-head span { margin-left: auto; font-family: 'Geist Mono', monospace; font-size: 8.5pt; color: #4E5B70; }
  .tl-print h1 { margin: 14px 0 2px; font-size: 21pt; line-height: 1.15; font-weight: 300; letter-spacing: -0.02em; color: #0F1E36; }
  .tl-print-sub { margin: 0 0 12px; font-size: 10pt; color: #4E5B70; }
  .tl-print-inputs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 0 0 12px; padding: 0; }
  .tl-print-inputs div { padding: 7px 9px; border-radius: 8px; background: #0F1E36; }
  .tl-print-inputs dt { font-family: 'Geist Mono', monospace; font-size: 7.5pt; color: #AAB6C8; }
  .tl-print-inputs dd { margin: 2px 0 0; font-size: 11pt; color: #E8D6A8; }
  .tl-print-chart { margin: 0 0 10px; padding: 10px 12px 4px; border: 1px solid #DEDAD0; border-radius: 10px; }
  .tl-print-chart svg { display: block; width: 100%; height: auto; }
  .tl-print-key { display: flex; gap: 16px; margin: 0 0 4px; font-size: 8.5pt; color: #4E5B70; }
  .tl-print-key i { display: inline-block; width: 14px; height: 3px; margin-right: 6px; vertical-align: middle; border-radius: 2px; }
  .tl-print-results { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0 0 10px; }
  .tl-print-results div { padding: 8px 10px; border-radius: 8px; background: #F7F4ED; break-inside: avoid; }
  .tl-print-results div.is-head { background: #F0E7D0; }
  .tl-print-results small { display: block; font-family: 'Geist Mono', monospace; font-size: 7.5pt; color: #4E5B70; }
  .tl-print-results b { display: block; margin: 2px 0 3px; font-size: 15pt; line-height: 1.15; font-weight: 300; color: #13213A; }
  .tl-print-results p { margin: 0 0 4px; font-size: 8pt; line-height: 1.35; color: #4E5B70; }
  .tl-print .tl-tag { margin: 0; padding: 1px 6px; font-size: 7pt; border: 1px solid #DEDAD0; color: #4E5B70; background: transparent; }
  .tl-print .tl-tag.is-today { background: #DFE6F2; border-color: #DFE6F2; color: #13213A; }
  .tl-print-notes { margin: 0 0 6px; font-size: 8pt; line-height: 1.45; color: #4E5B70; }
  .tl-print-notes.is-advice { padding-top: 6px; border-top: 1px solid #DEDAD0; color: #13213A; }
}
