/* AskActuary — site styles
   Layout concept: a field guide. A sticky left contents rail (like a plan document's
   table of contents) beside one ~68ch reading column; numbers set in mono. */

:root {
  /* color */
  --paper: #f4f7f8;          /* page ground, cool with a slight blue-teal bias */
  --surface: #ffffff;        /* cards, chart, tables */
  --ink: #0f2230;            /* primary text, from the logo navy */
  --ink-2: #43535d;          /* secondary text */
  --muted: #687881;          /* captions, labels */
  --rule: #dbe3e7;           /* hairlines */
  --rule-strong: #c2cdd3;
  --accent: #156f79;         /* logo teal, darkened for text contrast: links, buttons */
  --accent-ink: #ffffff;
  --accent-soft: #e1eff1;    /* tints */
  --highlight: #fff4d6;      /* "short version" ground */
  --highlight-rule: #e9d49a;
  --series-1: #008b9e;       /* chart: maximum lump sum */
  --series-2: #eb6834;       /* chart: projected balance */
  --series-1-wash: rgba(0, 139, 158, 0.10);
  --target-wash: #fbefd3;     /* chart: target-year band, warm gold */
  --target-rule: #e6cf94;
  --warn: #9a5b00;

  /* type */
  --font-display: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: 2.15rem;
  --step-4: clamp(2.3rem, 1.6rem + 2.6vw, 3.4rem);

  --radius: 6px;
  --gutter: clamp(16px, 4vw, 40px);
  --measure: 68ch;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e1619;
    --surface: #152025;
    --ink: #e4edf0;
    --ink-2: #b3c1c7;
    --muted: #8a989e;
    --rule: #24323a;
    --rule-strong: #33434b;
    --accent: #5cc4cb;
    --accent-ink: #0b171a;
    --accent-soft: #163238;
    --highlight: #2a2615;
    --highlight-rule: #5a4d22;
    --series-1: #2aa7b0;
    --series-2: #d95926;
    --series-1-wash: rgba(42, 167, 176, 0.12);
    --target-wash: rgba(232, 181, 84, 0.14);
    --target-rule: #6b5a2c;
    --warn: #e0a54a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0e1619;
  --surface: #152025;
  --ink: #e4edf0;
  --ink-2: #b3c1c7;
  --muted: #8a989e;
  --rule: #24323a;
  --rule-strong: #33434b;
  --accent: #5cc4cb;
  --accent-ink: #0b171a;
  --accent-soft: #163238;
  --highlight: #2a2615;
  --highlight-rule: #5a4d22;
  --series-1: #2aa7b0;
  --series-2: #d95926;
  --series-1-wash: rgba(42, 167, 176, 0.12);
  --target-wash: rgba(232, 181, 84, 0.14);
  --target-rule: #6b5a2c;
  --warn: #e0a54a;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
}
.site { min-height: 100vh; display: flex; flex-direction: column; }
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p { margin: 0; }
.num, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink);
  font: 600 var(--step--1)/1 var(--font-body);
  padding: 12px 18px; border-radius: var(--radius); border: 1px solid var(--accent);
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-small { padding: 8px 12px; }

.draft-bar {
  background: var(--highlight); color: var(--ink-2);
  border-bottom: 1px solid var(--highlight-rule);
  font: 500 0.78rem/1.4 var(--font-mono); letter-spacing: 0.04em; text-transform: uppercase;
  text-align: center; padding: 6px var(--gutter);
}

/* ---------- masthead ---------- */
.masthead {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.masthead-inner {
  max-width: 1200px; margin: 0 auto; padding: 12px var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none;
  border: 1.5px solid var(--accent); border-radius: 50%;
  font: italic 600 1.25rem/1 var(--font-display); color: var(--accent);
  padding-bottom: 2px;
}
.brand-name { font: 500 1.15rem/1 var(--font-body); letter-spacing: -0.01em; }
.brand-name b { font-weight: 600; color: var(--accent); }
.topnav { display: flex; align-items: center; gap: 4px 18px; flex-wrap: wrap; }
.topnav a:not(.btn) { color: var(--ink-2); text-decoration: none; font-size: var(--step--1); font-weight: 500; padding: 6px 0; border-bottom: 2px solid transparent; }
.topnav a:not(.btn):hover { color: var(--ink); }
.topnav a[aria-current] { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- guide layout ---------- */
.guide {
  flex: 1;
  width: 100%; max-width: 1200px; margin: 0 auto;
  padding: 40px var(--gutter) 72px;
  display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 56px;
}
.guide-side { min-width: 0; }
.toc-desktop { position: sticky; top: 92px; max-height: calc(100vh - 110px); overflow-y: auto; padding-right: 8px; }
.toc-title { font: 600 0.75rem/1 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 16px; }
.toc, .toc ol { list-style: none; margin: 0; padding: 0; }
.toc { display: grid; gap: 18px; }
.toc-group-label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.toc ol { display: grid; gap: 1px; border-left: 1px solid var(--rule); }
.toc a {
  display: flex; gap: 10px; align-items: baseline;
  padding: 5px 10px; margin-left: -1px; border-left: 2px solid transparent;
  color: var(--ink-2); text-decoration: none; font-size: 0.9rem; line-height: 1.35;
}
.toc a:hover { color: var(--ink); background: var(--accent-soft); }
.toc a[aria-current="page"] { color: var(--ink); border-left-color: var(--accent); font-weight: 600; background: var(--accent-soft); }
.toc-num { font: 0.75rem/1 var(--font-mono); color: var(--muted); min-width: 1.4em; }
.toc-mobile { display: none; }

.article { min-width: 0; max-width: var(--measure); }
.article-head { display: grid; gap: 14px; margin-bottom: 28px; }
.eyebrow { font: 500 0.78rem/1 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.lede { font-size: var(--step-1); line-height: 1.5; color: var(--ink-2); }

.short-version {
  background: var(--highlight); border: 1px solid var(--highlight-rule); border-radius: var(--radius);
  padding: 18px 22px; margin-bottom: 36px;
}
.short-version .label, .label {
  font: 600 0.72rem/1 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2);
}
.short-version ul { margin: 12px 0 0; padding-left: 1.1em; display: grid; gap: 6px; }

/* prose */
.prose { display: flex; flex-direction: column; gap: 1.05em; }
.prose h2 { margin-top: 1.3em; padding-top: 1.1em; border-top: 1px solid var(--rule); }
.prose h3 { margin-top: 0.6em; }
.prose ul, .prose ol { margin: 0; padding-left: 1.3em; display: grid; gap: 0.4em; }
.prose strong { font-weight: 600; }
.prose code { font-family: var(--font-mono); font-size: 0.9em; }
.prose blockquote { margin: 0; padding-left: 18px; border-left: 3px solid var(--accent); color: var(--ink-2); }

.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
.prose table, .data-table { border-collapse: collapse; width: 100%; font-size: var(--step--1); }
.prose th, .prose td, .data-table th, .data-table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.prose th, .data-table th { font-weight: 600; color: var(--ink-2); background: var(--paper); font-size: 0.8rem; }
.prose tr:last-child td, .data-table tr:last-child td { border-bottom: 0; }
.data-table th, .data-table td { padding: 10px 12px; white-space: nowrap; }
.prose td.n, .data-table td.n, .data-table th.n { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }

.callout {
  border: 1px solid var(--rule); border-left: 3px solid var(--accent); background: var(--surface);
  border-radius: var(--radius); padding: 16px 20px; display: grid; gap: 8px;
}
.callout.warn { border-left-color: var(--warn); }
.callout .label { color: var(--accent); }
.callout.warn .label { color: var(--warn); }

.example { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.example-head { padding: 12px 18px; border-bottom: 1px solid var(--rule); background: var(--paper); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.example-body { padding: 16px 18px; display: grid; gap: 10px; }
.ledger { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; font-size: var(--step--1); }
.ledger dt { color: var(--ink-2); }
.ledger dd { margin: 0; text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.ledger .total { border-top: 1px solid var(--rule-strong); padding-top: 6px; font-weight: 600; color: var(--ink); }

.cta-band {
  margin-top: 48px; padding: 22px 24px; border-radius: var(--radius);
  background: var(--accent-soft); display: flex; gap: 16px 24px; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.cta-band > div { min-width: 0; flex: 1 1 260px; display: grid; gap: 4px; }
.cta-title { font: 600 var(--step-1)/1.2 var(--font-display); }
.cta-band p:not(.cta-title) { color: var(--ink-2); font-size: var(--step--1); }

.pager { margin-top: 40px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pager a { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--rule); border-radius: var(--radius); text-decoration: none; color: var(--ink); background: var(--surface); font-weight: 500; line-height: 1.3; }
.pager a:hover { border-color: var(--accent); }
.pager span { font: 0.72rem/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.pager-next { text-align: right; grid-column: 2; }

/* ---------- home ---------- */
.home { flex: 1; }
.wrap { max-width: 1200px; margin: 0 auto; padding-inline: var(--gutter); }
.hero { padding-block: 64px 48px; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 48px; align-items: center; }
.hero-copy { display: grid; gap: 22px; min-width: 0; }
.hero h1 { font-size: var(--step-4); max-width: 16ch; }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero .lede { max-width: 52ch; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.compare { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 22px; display: grid; gap: 18px; min-width: 0; }
.compare-row { display: grid; gap: 8px; }
.compare-row header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.compare-row h3 { font: 600 var(--step--1)/1.3 var(--font-body); }
.compare-row .num { font-size: var(--step--1); color: var(--ink-2); }
.bar-track { height: 14px; background: var(--paper); border-radius: 0 4px 4px 0; overflow: hidden; }
.bar-fill { height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; }
.bar-fill.alt { background: var(--muted); }
.compare-note { font-size: 0.8rem; color: var(--muted); line-height: 1.45; }

.section { padding-block: 56px; border-top: 1px solid var(--rule); }
.section-head { display: grid; gap: 10px; margin-bottom: 28px; max-width: 60ch; }
.fit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.fit { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px; display: grid; gap: 6px; align-content: start; }
.fit h3 { font: 600 1rem/1.3 var(--font-body); }
.fit p { color: var(--ink-2); font-size: var(--step--1); }
.fit .num { color: var(--accent); font-size: 0.8rem; }

.path { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 32px; counter-reset: path; list-style: none; padding: 0; margin: 0; }
.path li { border-top: 1px solid var(--rule); }
.path a { display: grid; grid-template-columns: 2.2em minmax(0, 1fr); gap: 2px 8px; padding: 14px 0; text-decoration: none; color: var(--ink); }
.path a:hover .path-title { color: var(--accent); }
.path .toc-num { grid-row: span 2; padding-top: 3px; }
.path-title { font-weight: 600; }
.path-desc { color: var(--ink-2); font-size: var(--step--1); line-height: 1.45; }

.author { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: start; max-width: 70ch; }
.author .brand-mark { width: 56px; height: 56px; font-size: 2rem; }
.author-body { display: grid; gap: 10px; }

/* ---------- calculator ---------- */
.tool { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 36px var(--gutter) 72px; display: grid; gap: 28px; }
.tool-head { display: grid; gap: 12px; max-width: 70ch; }
.tool-grid { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 28px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; min-width: 0; }
.inputs { padding: 20px; display: grid; gap: 16px; position: sticky; top: 84px; }
.inputs h2 { font: 600 1rem/1.2 var(--font-body); }
.field { display: grid; gap: 6px; }
.field label { font-size: 0.85rem; font-weight: 600; }
.field .hint { font-size: 0.78rem; color: var(--muted); line-height: 1.4; }
.field input, .field select {
  width: 100%; font: 400 1rem/1.2 var(--font-mono); color: var(--ink);
  background: var(--paper); border: 1px solid var(--rule-strong); border-radius: var(--radius);
  padding: 10px 12px; min-height: 44px; min-width: 0; max-width: 100%;
  -webkit-appearance: none; appearance: none;
}
.field select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.field input[aria-invalid="true"] { border-color: var(--warn); }
.money { position: relative; }
.money span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-family: var(--font-mono); pointer-events: none; }
.money input { padding-left: 26px; }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.inputs > *, .field { min-width: 0; }
.assumptions-inputs { border-top: 1px solid var(--rule); padding-top: 14px; display: grid; gap: 12px; }
.form-error { color: var(--warn); font-size: 0.85rem; min-height: 1.2em; }
.example-tag { font: 500 0.7rem/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.inputs-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }

.results { display: grid; gap: 20px; min-width: 0; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 16px 18px; display: grid; gap: 6px; align-content: start; min-width: 0; }
.tile-label { font-size: 0.8rem; color: var(--ink-2); line-height: 1.35; }
.tile-value { font: 600 1.75rem/1.1 var(--font-body); letter-spacing: -0.01em; }
.tile-sub { font-size: 0.78rem; color: var(--muted); }

.chart-panel { padding: 18px 18px 10px; display: grid; gap: 10px; }
.chart-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.chart-top h2 { font: 600 1rem/1.3 var(--font-body); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.8rem; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.key-bar { width: 12px; height: 12px; border-radius: 3px 3px 0 0; background: var(--series-1); }
.key-line { width: 18px; height: 2px; background: var(--series-2); position: relative; }
.key-line::after { content: ""; position: absolute; left: 5px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--series-2); }
.key-band { width: 12px; height: 12px; background: var(--target-wash); border: 1px solid var(--target-rule); }
.chart-box { position: relative; width: 100%; }
.chart-box svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-box text { font-family: var(--font-mono); font-size: 11px; fill: var(--muted); }
.chart-box .grid { stroke: var(--rule); stroke-width: 1; }
.chart-box .axis { stroke: var(--rule-strong); stroke-width: 1; }
.chart-box .bar { fill: var(--series-1); }
.chart-box .bar.dim { opacity: 0.35; }
.chart-box .line { fill: none; stroke: var(--series-2); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-box .dot { fill: var(--series-2); stroke: var(--surface); stroke-width: 2; }
.chart-box .term-band { fill: var(--target-wash); }
.chart-box .term-label { fill: var(--ink-2); font-weight: 500; }
.chart-box .hit { fill: transparent; cursor: crosshair; }
.chart-box .hover-col { fill: var(--ink); opacity: 0.05; }
.chart-box .value-label { fill: var(--ink); font-weight: 500; }
.tooltip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 190px;
  background: var(--surface); border: 1px solid var(--rule-strong); border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12); padding: 10px 12px; font-size: 0.8rem; display: grid; gap: 4px;
}
.tooltip .tt-head { font-weight: 600; margin-bottom: 2px; }
.tooltip .tt-row { display: flex; justify-content: space-between; gap: 14px; color: var(--ink-2); }
.tooltip .tt-row b { font-family: var(--font-mono); font-weight: 500; color: var(--ink); }
.tooltip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

.insight { font-size: var(--step--1); color: var(--ink-2); padding: 12px 16px; border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; }
.insight:empty { display: none; }
.table-panel { overflow: hidden; }
.table-panel .table-wrap { border: 0; border-radius: 0; }
.data-table td.binding { font-size: 0.78rem; color: var(--ink-2); }
.data-table tr.is-term td { background: var(--target-wash); }
.seg { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: var(--radius); overflow: hidden; }
.seg button { font: 500 0.78rem/1 var(--font-body); padding: 7px 10px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.assumptions { padding: 0; }
.assumptions summary { padding: 14px 18px; cursor: pointer; font-weight: 600; font-size: 0.95rem; }
.assumptions .prose { padding: 0 18px 18px; font-size: var(--step--1); }
.disclaimer { font-size: 0.8rem; color: var(--muted); max-width: 80ch; }

/* ---------- forms (get started) ---------- */
.intake { display: grid; gap: 14px; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 20px; }
.intake textarea { width: 100%; min-height: 110px; font: 400 1rem/1.4 var(--font-body); color: var(--ink); background: var(--paper); border: 1px solid var(--rule-strong); border-radius: var(--radius); padding: 10px 12px; }
.intake .field input { font-family: var(--font-body); }
.form-note { font-size: 0.8rem; color: var(--muted); }

/* ---------- FAQ ---------- */
.faq { display: grid; gap: 0; border-top: 1px solid var(--rule); }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary { cursor: pointer; padding: 16px 28px 16px 0; font-weight: 600; position: relative; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 14px; font: 400 1.3rem/1 var(--font-mono); color: var(--accent); }
.faq details[open] summary::after { content: "–"; }
.faq .faq-a { padding: 0 0 18px; color: var(--ink-2); display: grid; gap: 0.8em; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--rule); background: var(--surface); margin-top: auto; }
.footer-inner { max-width: 1200px; margin: 0 auto; padding: 36px var(--gutter) 40px; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px 48px; }
.footer-brand { display: flex; gap: 14px; align-items: flex-start; }
.footer-name { font-weight: 600; }
.footer-tag { color: var(--ink-2); font-size: var(--step--1); }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 20px; align-content: start; justify-content: flex-end; }
.footer-links a { color: var(--ink-2); text-decoration: none; font-size: var(--step--1); }
.footer-links a:hover { color: var(--accent); }
.footer-legal { grid-column: 1 / -1; font-size: 0.78rem; color: var(--muted); border-top: 1px solid var(--rule); padding-top: 18px; max-width: 100ch; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .tool-grid { grid-template-columns: minmax(0, 1fr); }
  .inputs { position: static; }
  .hero { grid-template-columns: minmax(0, 1fr); padding-block: 40px 36px; }
}
@media (max-width: 860px) {
  .guide { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 20px; }
  .toc-desktop { display: none; }
  .toc-mobile { display: block; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
  .toc-mobile summary { padding: 12px 16px; cursor: pointer; font-weight: 600; font-size: 0.9rem; display: flex; justify-content: space-between; gap: 8px; }
  .toc-mobile .toc { padding: 4px 16px 16px; }
  .toc-pos { font: 0.78rem/1.6 var(--font-mono); color: var(--muted); }
  .footer-inner { grid-template-columns: minmax(0, 1fr); }
  .footer-links { justify-content: flex-start; }
}
@media (max-width: 640px) {
  .tiles { grid-template-columns: minmax(0, 1fr); }
  .tile-value { font-size: 1.5rem; }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager-next { grid-column: 1; }
  .topnav { gap: 4px 14px; }
  .topnav a:not(.btn) { font-size: 0.82rem; }
  .author { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* ---------- plan designs (custom-designs page) ---------- */
.designs { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.fit-grid.three { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.design { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px; display: grid; gap: 14px; align-content: start; min-width: 0; }
.design header { display: grid; gap: 4px; }
.design h3 { font-size: var(--step-1); }
.design .num { color: var(--accent); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; }
.pattern { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; height: 120px; padding-bottom: 18px; border-bottom: 1px solid var(--rule-strong); position: relative; }
.pattern-col { position: relative; height: 100%; }
.pattern-bar { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: min(20px, 70%); height: var(--h); background: var(--series-1); border-radius: 4px 4px 0 0; }
.pattern-min { position: absolute; left: 12%; right: 12%; bottom: var(--m); height: 2px; background: var(--series-2); }
.pattern-yr { position: absolute; left: 0; right: 0; bottom: -18px; text-align: center; font: 0.68rem/1 var(--font-mono); color: var(--muted); }
.design-facts { display: grid; gap: 4px; margin: 0; font-size: var(--step--1); }
.design-facts dt { font: 600 0.7rem/1.2 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.design-facts dd { margin: 0; color: var(--ink-2); line-height: 1.45; }
.pattern-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 0.8rem; color: var(--muted); }
.pattern-legend span { display: inline-flex; align-items: center; gap: 6px; }
.key-min { width: 16px; height: 2px; background: var(--series-2); }

/* ---------- logo ---------- */
.logo { display: block; height: auto; }
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none; }
  :root:not([data-theme="light"]) .logo-dark { display: block; }
}
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
.brand .logo { height: 34px; width: auto; }
.footer-brand .logo { height: 30px; width: auto; }
.footer-brand > div { display: grid; gap: 12px; }
.author-mark .logo { width: 120px; height: auto; }
@media (max-width: 640px) { .brand .logo { height: 28px; } }

/* ---------- 3D chart style ---------- */
.chart-box .bar3d-side { fill: color-mix(in srgb, var(--series-1) 58%, black); }
.chart-box .bar3d-top { fill: color-mix(in srgb, var(--series-1) 60%, white); }
.chart-box .dot-halo { fill: var(--series-2); opacity: 0.18; }
.chart-box .bar3d.grow { transform-box: fill-box; transform-origin: 50% 100%; animation: bar-grow 700ms cubic-bezier(.2, .8, .2, 1) both; }
.chart-box .line-in { animation: fade-in 500ms ease-out 650ms both; }
@keyframes bar-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.hint b u, .hint u b { text-underline-offset: 0.15em; }

.draft-bar a { color: var(--accent); font-weight: 600; }

/* Trademark marks on plan names (™ now, ® once registered) */
sup.tm { font-size: 0.95em; line-height: 0; vertical-align: 0.3em; margin-left: 0.05em; font-weight: 400; }

/* Callout with a lead line, reasons list and bottom line (e.g. Actuary's note) */
.callout.note-rich { gap: 10px; padding: 18px 22px; }
.callout .note-lead { font-size: var(--step-0); font-weight: 500; color: var(--ink); }
.callout .note-sub { font: 600 0.78rem/1.2 var(--font-body); letter-spacing: 0.02em; color: var(--ink-2); margin-top: 4px; }
.callout .note-reasons { margin: 0; padding-left: 1.15em; display: grid; gap: 8px; color: var(--ink-2); }
.callout .note-reasons li::marker { color: var(--accent); }
.callout .note-reasons strong { color: var(--ink); font-weight: 600; }
.callout .note-bottom { margin-top: 4px; padding: 10px 14px; border-radius: var(--radius); background: var(--accent-soft); color: var(--ink); }

/* Bright red emphasis: wrap text in <span class="red">...</span> */
.red { color: #e0201b; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .red { color: #ff5b52; }
}
:root[data-theme="dark"] .red { color: #ff5b52; }

/* Example proposal table (Adding employees page) */
.callout .table-wrap { margin-top: 2px; }
.prose table.proposal th, .prose table.proposal td { white-space: nowrap; }
.prose table.proposal thead th.n { text-align: right; }
.prose table.proposal tbody th { font-weight: 600; color: var(--ink); background: transparent; font-size: inherit; }
.prose table.proposal tfoot th, .prose table.proposal tfoot td { background: var(--paper); border-bottom: 0; border-top: 1px solid var(--rule); font-weight: 600; color: var(--ink); font-size: inherit; }
.prose table.proposal tfoot th { text-align: right; }
.prose table.proposal tfoot tr.hl td.n { color: var(--accent); font-size: 1.05em; }
.prose table.proposal tbody tr:last-child td, .prose table.proposal tbody tr:last-child th { border-bottom: 0; }
.callout .table-note { font-size: var(--step--1); color: var(--ink-2); }
@media (max-width: 600px) {
  .prose table.proposal { font-size: 0.78rem; }
  .prose table.proposal th, .prose table.proposal td { padding: 8px 8px; }
  .prose table.proposal thead th { white-space: normal; vertical-align: bottom; }
  .callout:has(table.proposal) { padding: 14px 12px; }
}

/* ---------- Forms: Ask Mike box, spam trap, sent message ---------- */
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-note.is-error { color: var(--warn); font-weight: 500; }
.form-note a { color: inherit; }
.ts-slot:empty { display: none; }
.ask-mike { margin-top: 48px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
.ask-mike + .cta-band { margin-top: 20px; }
.ask-mike > summary {
  list-style: none; cursor: pointer; padding: 18px 22px;
  display: flex; gap: 12px 20px; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.ask-mike > summary::-webkit-details-marker { display: none; }
.ask-text { display: grid; gap: 3px; min-width: 0; flex: 1 1 260px; }
.ask-title { font-weight: 600; color: var(--ink); }
.ask-sub { font-size: var(--step--1); color: var(--ink-2); }
.ask-open { border: 1px solid var(--accent); pointer-events: none; }
.ask-mike[open] .ask-open { display: none; }
.ask-mike[open] > summary { padding-bottom: 6px; cursor: default; }
.ask-form { display: grid; gap: 14px; padding: 8px 22px 22px; }
.ask-form textarea, .intake textarea { width: 100%; min-height: 110px; font: 400 1rem/1.4 var(--font-body); color: var(--ink); background: var(--paper); border: 1px solid var(--rule-strong); border-radius: var(--radius); padding: 10px 12px; }
.ask-form textarea:focus, .intake textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.ask-form textarea[aria-invalid="true"], .intake textarea[aria-invalid="true"] { border-color: var(--warn); }
.ask-form .field input { font-family: var(--font-body); }
.tool .ask-mike { margin-top: 8px; }
.form-done { border: 1px solid var(--rule); border-left: 3px solid var(--accent); background: var(--surface); border-radius: var(--radius); padding: 18px 22px; display: grid; gap: 6px; }
.ask-mike .form-done { border: 0; border-top: 1px solid var(--rule); border-radius: 0; margin: 0 22px 22px; padding: 16px 0 0; }
.form-done-title { font-weight: 600; color: var(--accent); }
@media (max-width: 600px) {
  .ask-mike > summary { padding: 16px; }
  .ask-form { padding: 6px 16px 16px; }
  .ask-mike .row2 { grid-template-columns: minmax(0, 1fr); }
}
.author .ask-mike { margin-top: 10px; }

/* ---------- Max, the chat assistant ---------- */
.max-bubble {
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  display: flex; align-items: center; gap: 10px; padding: 4px 16px 4px 4px;
  border: 1px solid var(--rule); border-radius: 999px; background: var(--surface); color: var(--ink);
  box-shadow: 0 6px 20px rgba(15, 34, 48, 0.18); cursor: pointer; font: 600 0.95rem/1 var(--font-body);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.max-bubble:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(15, 34, 48, 0.24); }
.max-bubble:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.max-bubble img { width: 52px; height: 52px; border-radius: 50%; border: 2px solid #156f79; background: #eef2f4; }
.max-open .max-bubble { display: none; }

.max-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 61;
  width: min(400px, calc(100vw - 32px)); height: min(620px, calc(100vh - 40px));
  display: flex; flex-direction: column; background: var(--surface); color: var(--ink);
  border: 1px solid var(--rule); border-radius: 14px; overflow: hidden;
  box-shadow: 0 18px 48px rgba(15, 34, 48, 0.28); font-family: var(--font-body);
}
.max-panel[hidden] { display: none; }
.max-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #156f79; color: #fff; }
.max-head img { width: 40px; height: 40px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.8); background: #eef2f4; }
.max-head > div { flex: 1; min-width: 0; }
.max-name { font-weight: 600; font-size: 1.02rem; line-height: 1.2; }
.max-sub { font-size: 0.78rem; opacity: 0.88; }
.max-close { background: transparent; border: 0; color: inherit; padding: 6px; border-radius: 6px; cursor: pointer; display: grid; }
.max-close:hover { background: rgba(255, 255, 255, 0.16); }

.max-log { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; background: var(--paper); overscroll-behavior: contain; }
.max-msg { display: flex; }
.max-msg.from-me { justify-content: flex-end; }
.max-text { max-width: 88%; padding: 10px 13px; border-radius: 14px; font-size: 0.93rem; line-height: 1.5; overflow-wrap: anywhere; }
.from-max .max-text { background: var(--surface); border: 1px solid var(--rule); border-bottom-left-radius: 4px; }
.from-me .max-text { background: #156f79; color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.max-text p + p, .max-text p + ul, .max-text p + ol, .max-text ul + p, .max-text ol + p { margin-top: 0.6em; }
.max-text ul, .max-text ol { margin: 0.3em 0 0; padding-left: 1.25em; display: grid; gap: 0.25em; }
.max-text a { color: var(--accent); }
.max-text strong { font-weight: 600; }
.max-status { font-size: 0.78rem; color: var(--muted); margin: 4px 0 0 4px; }
.max-msg.from-max { flex-direction: column; align-items: flex-start; }
.max-note { font-size: 0.85rem; color: var(--ink-2); text-align: center; padding: 2px 8px; }
.max-note.is-error { color: var(--warn); }
.max-note a { color: inherit; }
.max-typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.max-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: max-dot 1.2s infinite ease-in-out; }
.max-typing i:nth-child(2) { animation-delay: 0.15s; } .max-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes max-dot { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .max-typing i { animation: none; opacity: 0.6; } .max-bubble { transition: none; } }

.max-chips { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.max-chip { text-align: left; font: 500 0.85rem/1.3 var(--font-body); color: var(--accent); background: var(--surface); border: 1px solid var(--accent); border-radius: 999px; padding: 7px 12px; cursor: pointer; }
.max-chip:hover { background: var(--accent-soft); }

.max-contact { background: var(--surface); border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: 10px; padding: 14px; display: grid; gap: 10px; font-size: 0.88rem; }
.max-contact label { display: grid; gap: 4px; font-weight: 600; font-size: 0.82rem; }
.max-contact .opt { font-weight: 400; color: var(--muted); }
.max-contact .btn { background: #156f79; color: #fff; }
.max-contact input, .max-contact select { font: 400 0.95rem var(--font-body); color: var(--ink); background: var(--paper); border: 1px solid var(--rule-strong); border-radius: var(--radius); padding: 8px 10px; min-width: 0; }
.max-contact input:focus, .max-contact select:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.max-contact .btn { justify-self: start; }
.max-card-error { color: var(--warn); font-weight: 500; }
.max-card-fine { font-size: 0.78rem; color: var(--muted); }
.max-card-fine a { color: inherit; }

.max-input { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--rule); background: var(--surface); }
.max-input textarea { flex: 1; min-width: 0; resize: none; max-height: 140px; font: 400 0.95rem/1.4 var(--font-body); color: var(--ink); background: var(--paper); border: 1px solid var(--rule-strong); border-radius: 10px; padding: 9px 12px; }
.max-input textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.max-send { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; background: #156f79; color: #fff; display: grid; place-items: center; cursor: pointer; }
.max-send:disabled { opacity: 0.45; cursor: default; }
.max-ts:empty { display: none; }
.max-ts { padding: 0 12px 6px; background: var(--surface); }
.max-foot { font-size: 0.72rem; color: var(--muted); padding: 0 14px 10px; background: var(--surface); line-height: 1.4; }
.max-foot a { color: inherit; }
.max-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 600px) {
  .max-bubble { right: 14px; bottom: 14px; padding: 3px; }
  .max-bubble img { width: 54px; height: 54px; }
  .max-bubble-label { display: none; }
  .max-panel { inset: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; border: 0; }
  .max-open body { overflow: hidden; }
}
@media print { .max-bubble, .max-panel { display: none !important; } }

/* ---------- Ask Mike or Max page ---------- */
.ask-hub { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; align-items: start; margin-bottom: 8px; }
.hub-card { background: var(--surface); border: 1px solid var(--rule); border-top: 3px solid #156f79; border-radius: 10px; padding: 20px; display: grid; gap: 12px; min-width: 0; }
.prose .hub-card h2 { margin: 0; padding: 0; border: 0; font-size: var(--step-2); }
.hub-top { display: flex; align-items: center; gap: 14px; }
.hub-avatar { width: 64px; height: 64px; border-radius: 50%; border: 2px solid #156f79; background: #eef2f4; flex: none; }
.hub-initials { display: grid; place-items: center; font: 600 1.25rem/1 var(--font-body); color: #fff; background: #156f79; letter-spacing: 0.03em; }
.hub-kicker { font: 500 0.75rem/1.2 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.hub-card p { font-size: var(--step--1); color: var(--ink-2); }
.hub-card .hub-best { color: var(--ink); }
.hub-max-form { display: grid; gap: 10px; }
.hub-max-form input { font: 400 1rem var(--font-body); color: var(--ink); background: var(--paper); border: 1px solid var(--rule-strong); border-radius: var(--radius); padding: 10px 12px; min-height: 44px; min-width: 0; }
.hub-max-form input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.hub-max-form .btn, .hub-mike-form .btn { justify-self: start; }
.hub-fine { font-size: 0.78rem !important; color: var(--muted) !important; }
.hub-mike-form { padding: 0; }
