/* Shared by every page: theme tokens, base layout, inputs panel, result tiles and the site menu */
:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --fg: #17202a;
  --muted: #5b6672;
  --line: #d6dce3;
  --invest: #0f7b6c;
  --car: #c2410c;
  --car-fill: rgba(194, 65, 12, 0.10);
  --stay: #6d4fc2;
  --focus: #2563eb;
  --btn-bg: #0f7b6c; --btn-fg: #ffffff; --btn-hover: #0c6a5d;
  /* The app frame: the tinted canvas behind the page's sheet, and the teal accent with its pale tints, for the
     selected menu item and the Ask AI button. */
  --canvas: #eef3f2; --sheet: #ffffff;
  --accent: #0f7b6c; --accent-container: #cfeee8; --on-accent-container: #08453c; --accent-selected: #c6e6df;
  /* Accent-coloured text (outlined buttons, the chosen tab), form fields' fill and outline, and text on --car */
  --accent-text: #0b6658; --field-bg: #ffffff; --field-border: #7d8994; --on-car: #ffffff;
  --font-display: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-body: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1418; --surface: #172026; --fg: #e6ebef; --muted: #93a0ac; --line: #2a353e;
    --invest: #3fcfb4; --car: #fb8a52; --car-fill: rgba(251, 138, 82, 0.12); --stay: #b29cf5; --focus: #7aa7ff;
    --btn-bg: #3fcfb4; --btn-fg: #0f1418; --btn-hover: #6be0c9;
    --canvas: #0b1014; --sheet: #121a1f;
    --accent: #3fcfb4; --accent-container: #17463f; --on-accent-container: #c4f2e8; --accent-selected: #1f5249;
    --accent-text: #5fdcc3; --field-bg: #0f1418; --field-border: #6b7883; --on-car: #0f1418;
    color-scheme: dark;
  }
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  --bg: #0f1418; --surface: #172026; --fg: #e6ebef; --muted: #93a0ac; --line: #2a353e;
  --invest: #3fcfb4; --car: #fb8a52; --car-fill: rgba(251, 138, 82, 0.12); --stay: #b29cf5; --focus: #7aa7ff;
  --btn-bg: #3fcfb4; --btn-fg: #0f1418; --btn-hover: #6be0c9;
  --canvas: #0b1014; --sheet: #121a1f;
  --accent: #3fcfb4; --accent-container: #17463f; --on-accent-container: #c4f2e8; --accent-selected: #1f5249;
  --accent-text: #5fdcc3; --field-bg: #0f1418; --field-border: #6b7883; --on-car: #0f1418;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* classes like .btn set display, which would otherwise show hidden elements */
/* The app frame (nav.js): a bar across the top, the menu in a drawer on the left, and the page on a rounded sheet.
   From 900px wide the drawer is docked, open or as a rail of icons (theme.js applies the member's choice before
   anything is drawn, so the page doesn't move). Narrower, ☰ slides it over the page. */
:root { --bar-height: 64px; --drawer: 256px; }
html { scroll-padding-top: calc(var(--bar-height) + 12px); }  /* Anchors stop below the top bar. */
:root[data-nav="rail"] { --drawer: 80px; }
body {
  background: var(--canvas); color: var(--fg);
  font: 15px/1.55 var(--font-body);
  padding: var(--bar-height) 0 0;
  margin: 0;
}
/* The page's sheet. Its own width decides the page's layouts (container queries), whatever the drawer takes. */
main {
  max-width: 1240px; margin: 0 auto; display: grid; gap: 24px; align-content: start; container-type: inline-size;
  min-height: calc(100dvh - var(--bar-height));
  padding: 20px max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px));
  background: var(--sheet); border-radius: 16px 16px 0 0;
}
/* The wide page width (theme.js, FiaidWidth): the sheet may grow to 1680px, so it only differs on big screens. The
   layouts that use the room are container queries on widths a regular sheet never reaches (main from 1360px, a plan
   page's results from 1100px). */
:root[data-width="wide"] main { max-width: 1680px; }
/* The public home page (Pricing) is always the regular width, and so is every public page for a visitor: Wide is a
   member's choice for this device, and a visitor has no switch to undo one left from before. */
:root[data-width="wide"] main.pricing,
:root[data-width="wide"] body[data-public]:not([data-signed-in]) main { max-width: 1240px; }
@media (min-width: 700px) {
  body { padding: var(--bar-height) 16px 16px; }
  main { padding: 28px 32px 48px; border-radius: 16px; min-height: calc(100dvh - var(--bar-height) - 16px); }
}
@media (min-width: 900px) {
  body { padding-left: var(--drawer); transition: padding-left 160ms ease; }
}

/* The top bar: ☰, the brand, and the member's initial (their account menu) or Sign in. It stays above the drawer
   and its shade, so ☰ always closes the menu again. */
.app-bar {
  position: fixed; inset: 0 0 auto 0; z-index: 45; height: var(--bar-height);
  display: flex; align-items: center; gap: 8px;
  padding: 0 max(12px, env(safe-area-inset-right, 0px)) 0 max(8px, env(safe-area-inset-left, 0px));
  background: var(--canvas);
}
.icon-button {
  -webkit-appearance: none; appearance: none; flex: none; display: grid; place-items: center;
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--fg); cursor: pointer;
}
.icon-button svg { width: 22px; height: 22px; }
.icon-button:hover { background: color-mix(in srgb, var(--fg) 8%, transparent); }
.icon-button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.site-brand {
  display: flex; align-items: center; gap: 12px; min-width: 0; padding: 4px 8px 4px 4px; border-radius: 8px;
  font-family: var(--font-display); font-size: 22px; line-height: 1; color: var(--fg); text-decoration: none;
}
.site-brand:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* The logo's square: public/brand/mark.svg, or mark-dark.svg in the dark theme (as the tokens above choose it). */
.brand-mark { flex: none; display: block; width: 32px; height: 32px; }
.brand-mark img { display: block; width: 32px; height: 32px; }
.brand-mark .brand-mark-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-mark .brand-mark-light { display: none; }
  :root:not([data-theme="light"]) .brand-mark .brand-mark-dark { display: block; }
}
:root[data-theme="dark"] .brand-mark .brand-mark-light { display: none; }
:root[data-theme="dark"] .brand-mark .brand-mark-dark { display: block; }
.brand-name em { font-style: italic; color: var(--accent-text); }
.brand-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.brand-tagline { font: 500 11px var(--font-body); letter-spacing: 0.02em; color: var(--muted); white-space: nowrap; }
@media (max-width: 479px) { .brand-tagline { display: none; } }
.app-bar-end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
/* A visitor's frame: on public pages (<body data-public>) until nav.js marks the body data-signed-in, there's no drawer
   and no ☰, the page takes the full width, and from 900px the home page's sections are links in the top bar. */
.visitor-links { display: none; }
body[data-public]:not([data-signed-in]) .site-nav,
body[data-public]:not([data-signed-in]) .nav-scrim,
body[data-public]:not([data-signed-in]) .app-bar > .icon-button { display: none; }
body[data-public]:not([data-signed-in]) .app-bar { padding-left: max(16px, env(safe-area-inset-left, 0px)); }
@media (min-width: 900px) {
  body[data-public]:not([data-signed-in]) { padding-left: 16px; }
  body[data-public]:not([data-signed-in]) .visitor-links { display: flex; gap: 4px; margin-left: 28px; min-width: 0; }
}
.visitor-links a {
  padding: 8px 12px; border-radius: 999px; font: 500 14px var(--font-body); color: var(--muted); text-decoration: none; white-space: nowrap;
}
.visitor-links a:hover { color: var(--fg); background: color-mix(in srgb, var(--fg) 6%, transparent); }
.visitor-links a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.account-button {
  -webkit-appearance: none; appearance: none; flex: none; display: grid; place-items: center;
  width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--stay); color: var(--surface); font: 600 16px var(--font-body);
}
.account-button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* The account menu, under the member's initial (a popover, so a click outside or Esc closes it) */
.account-menu {
  position: fixed; inset: calc(var(--bar-height) - 4px) max(12px, env(safe-area-inset-right, 0px)) auto auto; margin: 0;
  width: 280px; max-width: calc(100vw - 24px); padding: 8px; display: none; gap: 2px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--fg);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}
.account-menu:popover-open { display: grid; }  /* Shut, and in browsers without popovers, it stays hidden. */
.account-email { margin: 0 0 6px; padding: 8px 12px 12px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.account-menu a, .account-menu button {
  -webkit-appearance: none; appearance: none; display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border: 0; border-radius: 8px; background: none; cursor: pointer; text-align: left;
  font: 500 14px var(--font-body); color: var(--fg); text-decoration: none;
}
.account-menu a:hover, .account-menu button:hover { background: var(--bg); }
.account-menu a:focus-visible, .account-menu button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
/* The account menu's Wide layout switch (nav.js): a label with "On this device" under it, and a track on the right. */
.width-switch-text { display: grid; gap: 1px; flex: 1; }
.width-switch-text small { font: 400 12px var(--font-body); color: var(--muted); }
.switch-track {
  flex: none; position: relative; width: 36px; height: 20px; border-radius: 10px; background: var(--field-border);
  transition: background 120ms ease;
}
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); transition: transform 120ms ease;
}
.width-switch[aria-checked="true"] .switch-track { background: var(--accent); }
.width-switch[aria-checked="true"] .switch-track::after { transform: translateX(16px); }

/* The menu drawer. Its items are pills, rounded on the right, the current page's in the accent tint. */
.site-nav {
  position: fixed; z-index: 40; top: var(--bar-height); bottom: 0; left: 0;
  width: 280px; max-width: calc(100vw - 56px);
  display: flex; flex-direction: column; gap: 4px; padding: 8px 12px 12px 0;
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  background: var(--canvas);
  transform: translateX(-100%); visibility: hidden;
  transition: transform 200ms ease, visibility 0s linear 200ms;
}
:root[data-menu="open"] .site-nav {
  transform: none; visibility: visible; transition: transform 200ms ease;
  box-shadow: 8px 0 24px rgba(0, 0, 0, 0.18);
}
.nav-scrim {
  position: fixed; inset: var(--bar-height) 0 0 0; z-index: 35; background: rgba(10, 15, 20, 0.45);
  opacity: 0; visibility: hidden; transition: opacity 200ms ease, visibility 0s linear 200ms;
}
:root[data-menu="open"] .nav-scrim { opacity: 1; visibility: visible; transition: opacity 200ms ease; }
.nav-icon { display: grid; place-items: center; flex: none; width: 20px; height: 20px; }
.nav-icon svg { width: 20px; height: 20px; }
.nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* Ask AI, at the top of the drawer */
.nav-ask {
  display: inline-flex; align-items: center; gap: 12px; align-self: flex-start; flex: none;
  height: 56px; margin: 4px 0 10px 12px; padding: 0 22px 0 18px; border-radius: 16px;
  background: var(--accent-container); color: var(--on-accent-container);
  font: 600 14px var(--font-body); text-decoration: none; white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); transition: box-shadow 120ms;
}
.nav-ask:hover { box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18); }
.nav-ask:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.site-sections { flex: 1 0 auto; display: flex; flex-direction: column; gap: 6px; }
.nav-section { display: flex; flex-direction: column; }
.nav-heading { margin: 10px 0 2px; padding: 0 0 0 26px; font: 500 12px var(--font-body); color: var(--muted); white-space: nowrap; }
.site-menu { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.site-menu a {
  display: flex; align-items: center; gap: 16px; min-height: 36px; padding: 0 16px 0 26px; border-radius: 0 999px 999px 0;
  font: 500 14px var(--font-body); color: var(--fg); text-decoration: none; white-space: nowrap;
}
.site-menu a:hover { background: color-mix(in srgb, var(--fg) 7%, transparent); }
.site-menu a[aria-current="page"] { background: var(--accent-selected); color: var(--on-accent-container); font-weight: 600; }
.site-menu a:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

/* The Admin section (.nav-admin) is set apart, tinted in the admin colour, so admin tools never pass for members'
   pages. */
.nav-admin {
  --admin: var(--stay);
  margin-top: 6px; padding: 2px 0 6px; border-radius: 0 16px 16px 0;
  background: color-mix(in srgb, var(--admin) 9%, transparent);
}
.nav-admin .nav-heading { color: var(--admin); }
.nav-admin .site-menu a { color: var(--admin); }
.nav-admin .site-menu a:hover { background: color-mix(in srgb, var(--admin) 14%, transparent); }
.nav-admin .site-menu a[aria-current="page"] { background: var(--admin); color: var(--bg); }
/* The admin console (nav.js, ADMIN_MENU on pages marked data-area="admin"): the whole drawer takes the admin tint,
   so it's always clear which area you're in. */
.site-nav.admin-console, .app-bar.admin-console { --admin: var(--stay); background: color-mix(in srgb, var(--admin) 7%, var(--canvas)); }
.app-bar.admin-console .brand-name, .site-nav.admin-console .nav-heading { color: var(--admin); }
.site-nav.admin-console .site-menu a { color: var(--admin); }
.site-nav.admin-console .site-menu a:hover { background: color-mix(in srgb, var(--admin) 14%, transparent); }
.site-nav.admin-console .site-menu a[aria-current="page"] { background: var(--admin); color: var(--bg); }
.site-nav.admin-console .nav-section-site .nav-heading { display: none; } /* The item says it already. */
/* The privacy notice and terms, at the foot of the drawer */
.nav-legal { margin: auto 0 0; padding: 4px 0 4px 26px; font-size: 12px; white-space: nowrap; }

/* Docked, from 900px wide: the drawer sits beside the page. As a rail it keeps only the icons; the labels stay for
   screen readers, and each item's title names it. */
@media (min-width: 900px) {
  .site-nav, :root[data-menu="open"] .site-nav {
    z-index: 20; width: var(--drawer); max-width: none; transform: none; visibility: visible; box-shadow: none;
    transition: width 160ms ease;
  }
  .nav-scrim { display: none; }
  :root[data-nav="rail"] .site-nav { padding-right: 0; }
  :root[data-nav="rail"] .nav-ask { width: 56px; padding: 0; justify-content: center; }
  :root[data-nav="rail"] .site-nav .nav-label {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  :root[data-nav="rail"] .nav-heading, :root[data-nav="rail"] .nav-legal { display: none; }
  :root[data-nav="rail"] .nav-section + .nav-section { border-top: 1px solid var(--line); padding-top: 6px; margin-left: 12px; }
  :root[data-nav="rail"] .nav-section + .nav-section .site-menu a { margin-left: 0; }
  :root[data-nav="rail"] .site-menu a { width: 56px; min-height: 40px; margin-left: 12px; padding: 0; justify-content: center; border-radius: 16px; }
  :root[data-nav="rail"] .nav-admin { padding: 4px; width: 64px; border-radius: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  body, .site-nav, :root[data-menu="open"] .site-nav, .nav-scrim, :root[data-menu="open"] .nav-scrim, .nav-ask { transition: none; }
}
/* A page's sections as tabs (FiaidPageTabs). A tab-group holds several sections as one tab without changing their
   layout. On a narrow screen the bar scrolls sideways by itself, never the page. */
.tab-group { display: contents; }
.page-tabs {
  display: flex; gap: 2px 4px; margin: 0 0 18px; border-bottom: 1px solid var(--line);
  position: relative; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; max-width: 100%;
}
.page-tabs::-webkit-scrollbar { display: none; }
.page-tabs a {
  flex: none; white-space: nowrap; padding: 11px 16px 9px; margin-bottom: -1px; border-bottom: 3px solid transparent;
  border-radius: 4px 4px 0 0; font: 500 14px var(--font-body); color: var(--muted); text-decoration: none;
}
.page-tabs a:hover { color: var(--fg); background: color-mix(in srgb, var(--fg) 5%, transparent); }
.page-tabs a[aria-selected="true"] { color: var(--accent-text); border-bottom-color: var(--accent); }
[data-area="admin"] .page-tabs a[aria-selected="true"] { color: var(--stay); border-bottom-color: var(--stay); }
.page-tabs a:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
@media (max-width: 480px) { .page-tabs { gap: 0; } .page-tabs a { padding: 11px 9px 9px; } }

header h1 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(34px, 6vw, 52px); line-height: 1.05; margin: 0;
  letter-spacing: -0.01em; text-wrap: balance;
}
header p { margin: 8px 0 0; color: var(--muted); max-width: 60ch; }

/* Plan pages (<main class="plan">): the situation and the page's own settings on the left (.plan-side), the result
   beside them (.plan-results). One column on a narrow sheet, and until there's a result to show. The results column
   is a container, so its headline and tables fit its own width. */
.plan { gap: 20px; }
/* Each column is a minmax(0, 1fr) track, so a wide table scrolls in its own box instead of widening the page. */
.plan-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
.plan-side, .plan-results { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-content: start; min-width: 0; }
.plan-results { container-type: inline-size; }
@container (min-width: 880px) {
  .plan-layout:has(> .plan-results > :not([hidden])) { grid-template-columns: 340px minmax(0, 1fr); }
}
/* Wide: a little more room for the situation, and taller charts for the wider results. */
@container (min-width: 1360px) {
  .plan-layout:has(> .plan-results > :not([hidden])) { grid-template-columns: 380px minmax(0, 1fr); }
  .plan-results .chart-wrap { height: 440px; }
}
/* The saved situation as rows, with Edit beside its heading. While the form is open it shows all of this, so the
   summary steps aside; on a narrow sheet the rows pair up, two to a line. */
.strip { display: grid; gap: 10px; }
.strip-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.strip-head h2 { margin: 0; font: 600 16px var(--font-body); }
.strip .hint a { color: inherit; text-underline-offset: 2px; }
.strip:has(#editSituation[aria-expanded="true"]) { display: none; }
.situation-rows { margin: 0; display: grid; }
.situation-rows div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); }
.situation-rows dt { font-size: 14px; color: var(--muted); }
.situation-rows dd { margin: 0; text-align: right; overflow-wrap: anywhere; font: 500 14px var(--font-data); font-variant-numeric: tabular-nums; }
.situation-rows dd.words { font-family: var(--font-body); }
@container (max-width: 560px) {
  .situation-rows { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
  .situation-rows div { flex-direction: column; align-items: flex-start; gap: 0; }
  .situation-rows dd { text-align: left; }
}
/* The rest every plan page shares: the situation form, the headline, the ways to close a gap and the year table */
.situation { display: grid; gap: 18px; }
.situation h2, .outcome h2 { margin: 0; }
.situation > h2 { font-family: var(--font-display); font-weight: 400; font-size: 28px; line-height: 1.1; }
.situation-form { display: grid; gap: 18px; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 16px; }
/* Each field takes three lines of its grid (label, box, help) as a subgrid, so a label that wraps or carries a "?"
   doesn't push its box down: every box in a row starts on one line, with its label just above it. */
.field-grid > .field { grid-row: span 3; grid-template-rows: subgrid; row-gap: 6px; align-content: start; }
.field-grid > .field > :first-child { align-self: end; }
.situation details { border-top: 1px solid var(--line); padding-top: 12px; }
.situation summary { cursor: pointer; font-size: 14px; overflow-wrap: anywhere; }
.situation summary strong { font-weight: 600; }
.situation details > .field-grid { margin-top: 14px; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.form-status { font-size: 13px; color: var(--muted); margin: 0; }
.outcome { display: grid; gap: 18px; min-width: 0; }
.kicker { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.kicker.preview { color: var(--car); }
.headline { font-family: var(--font-display); font-weight: 400; font-size: clamp(28px, 5.5cqi, 44px); line-height: 1.1; text-wrap: balance; }
.headline.short { color: var(--car); }
.subline { margin: -8px 0 0; font-size: 15px; max-width: 70ch; }
/* When the money runs out: the two ways to close the gap, side by side (stacked on phones) */
.gap-ways { display: grid; gap: 10px; }
.gap-ways h3 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.gap-ways ul { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.gap-ways li { display: grid; gap: 4px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.gap-ways li[hidden] { display: none; }
.gap-ways strong { font: 600 22px var(--font-data); font-variant-numeric: tabular-nums; }
.outcome details { border-top: 1px solid var(--line); padding-top: 12px; }
.outcome summary { cursor: pointer; font-size: 14px; font-weight: 500; }
.table-scroll { overflow-x: auto; margin-top: 12px; }
.year-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.year-table th, .year-table td { text-align: right; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.year-table th:first-child, .year-table td:first-child { text-align: left; }
.year-table td { font-family: var(--font-data); font-variant-numeric: tabular-nums; }
.year-table th { font-weight: 500; color: var(--muted); }
.how { margin: 12px 0 0; font-size: 13.5px; line-height: 1.6; color: var(--muted); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.inputs { display: grid; gap: 16px; }
.group-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); padding-top: 4px; border-top: 1px solid var(--line);
}
.group-label:first-child { border-top: 0; padding-top: 0; }
.field { display: grid; gap: 6px; }
.field-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
label { font-size: 14px; font-weight: 500; }
output { font-family: var(--font-data); font-weight: 600; font-size: 14px; }
/* "(€)" after the label of a money input, added by currency.js */
.currency-tag { font-family: var(--font-data); font-size: 12.5px; font-weight: 500; color: var(--muted); }
/* Form fields are outlined; the outline takes the accent while you type in one. Pages' own text fields use the same
   --field-bg and --field-border. */
input[type=number], select, textarea {
  width: 100%; padding: 9px 12px; border-radius: 8px;
  font: 500 16px var(--font-data); color: var(--fg);
  background: var(--field-bg); border: 1px solid var(--field-border);
}
select { font-family: var(--font-body); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input[type=range] { width: 100%; accent-color: var(--accent); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.hint { font-size: 12.5px; color: var(--muted); margin: 0; }
/* The situation form's shared part: the note above it, and the "Already stopped working" tick box, which sits level
   with the inputs beside it under a label-sized heading. */
.shared-note { margin: 0 0 12px; }
.field-label { font-size: 14px; font-weight: 500; }
.check-choice { display: flex; align-items: center; gap: 8px; min-height: 40px; font-size: 14px; cursor: pointer; }
.check-choice input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.check-choice input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* "?" beside a label: shows and hides the help under the field (Your plan) */
.help-toggle {
  -webkit-appearance: none; appearance: none; flex: none; width: 24px; height: 24px; padding: 0; border-radius: 50%;
  border: 1px solid var(--field-border); background: transparent; color: var(--muted); font: 600 12px var(--font-body); cursor: pointer;
}
.help-toggle[aria-expanded="true"] { background: var(--accent-selected); border-color: var(--accent-selected); color: var(--on-accent-container); }
.help-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.saved-note a { color: inherit; text-underline-offset: 2px; }
.warn { font-size: 13px; color: var(--car); margin: 0; }
.warn:empty { display: none; }

.results { display: grid; gap: 18px; min-width: 0; }
.futures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@container (max-width: 560px) { .futures { grid-template-columns: minmax(0, 1fr); } }
.future { display: grid; gap: 2px; padding-left: 12px; border-left: 3px solid var(--line); }
.future.invest { border-left-color: var(--invest); }
.future.car { border-left-color: var(--car); }
.future .k { font-size: 12.5px; color: var(--muted); }
.future .v { font-family: var(--font-data); font-size: clamp(17px, 3.2cqi, 24px); font-weight: 600; font-variant-numeric: tabular-nums; }
.future.invest .v { color: var(--invest); }
.future.car .v { color: var(--car); }

.chart-wrap { position: relative; height: 380px; }
@media (max-width: 560px) { .chart-wrap { height: 300px; } }
.verdict { margin: 0; font-size: 15px; max-width: 65ch; }
.verdict strong { font-family: var(--font-data); font-weight: 600; }
.assumptions { margin: 0; font-size: 12.5px; color: var(--muted); max-width: 70ch; }

/* Ask AI panel */
.advisor { display: grid; gap: 12px; }
.advisor-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.advisor h2 { font-family: var(--font-display); font-weight: 400; font-size: 28px; margin: 0; line-height: 1.1; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
/* Buttons are pills: filled in the accent for the main action, outlined (.secondary) for the others, and red
   (.danger) for one that can't be undone. */
.btn {
  -webkit-appearance: none; appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 10px 24px; border-radius: 999px; cursor: pointer;
  font: 600 14.5px var(--font-body); line-height: 1.2;
  border: 1px solid var(--btn-bg); background: var(--btn-bg); color: var(--btn-fg);
  transition: background-color 120ms, border-color 120ms, box-shadow 120ms;
}
a.btn { text-decoration: none; }  /* Links styled as buttons, such as Join */
.btn:hover:not(:disabled) { background: var(--btn-hover); border-color: var(--btn-hover); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); }
.btn.secondary { background: transparent; color: var(--accent-text); border-color: var(--field-border); }
.btn.secondary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 8%, transparent); box-shadow: none; }
.btn.danger { background: var(--car); border-color: var(--car); color: var(--on-car); }
.btn.danger:hover:not(:disabled) { background: color-mix(in srgb, var(--car) 88%, var(--fg)); border-color: transparent; }
/* Disabled means unavailable as often as busy (Move up on the first scenario), so no loading cursor: the faded
   button says it, and a busy one says what it's doing in its label or status. */
.btn:disabled { cursor: default; opacity: 0.6; box-shadow: none; }
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn-icon { font-size: 16px; line-height: 1; }
.status { font-size: 13px; color: var(--muted); margin: 0; }
.advisor .hint a { color: inherit; text-underline-offset: 2px; }
.advisor .hint a:hover { color: var(--fg); }
.answer {
  margin: 0; white-space: pre-wrap; max-width: 68ch; font-size: 15px; line-height: 1.6;
  border-left: 3px solid var(--line); padding-left: 14px;
}
.answer:empty { display: none; }
.answer.stale { opacity: 0.55; }
/* Feedback under an Ask AI answer (ask-ai.js): 👍/👎, then reason chips and an optional comment */
.feedback { display: grid; gap: 10px; max-width: 68ch; padding-top: 12px; border-top: 1px solid var(--line); }
.feedback[hidden], .feedback-details[hidden] { display: none; }
.feedback-question, .feedback-reasons { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.feedback-label { font-size: 14px; font-weight: 500; margin-right: 4px; }
.feedback-details { display: grid; gap: 10px; }
/* Chips: outlined, and the chosen one in the accent tint */
.feedback-rating, .chip {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  min-height: 32px; padding: 6px 12px; border-radius: 8px;
  border: 1px solid var(--field-border); background: transparent; color: var(--fg);
  font: 500 13px var(--font-body); line-height: 1.2;
}
.feedback-rating:hover:not(:disabled), .chip:hover:not(:disabled) { background: color-mix(in srgb, var(--fg) 6%, transparent); }
.feedback-rating[aria-pressed="true"], .chip[aria-pressed="true"] {
  background: var(--accent-selected); border-color: var(--accent-selected); color: var(--on-accent-container);
}
.feedback-rating:focus-visible, .chip:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.feedback-rating:disabled { cursor: default; }
.feedback textarea {
  width: 100%; padding: 9px 12px; border-radius: 8px; resize: vertical;
  font: 400 14px var(--font-body); color: var(--fg); background: var(--field-bg); border: 1px solid var(--field-border);
}
/* Consent choices (nav.js, FiaidConsent): in the one-time question and on the Account page */
.consent-choices { display: grid; gap: 10px; }
.consent-choice {
  display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; row-gap: 2px; align-items: start;
  padding: 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer;
}
.consent-choice input { margin: 3px 0 0; width: 18px; height: 18px; grid-row: span 2; accent-color: var(--accent); }
.consent-choice input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.consent-choice strong { font-weight: 600; }
.consent-choice > strong, .consent-choice > span { grid-column: 2; }
.consent-description { color: var(--muted); font-size: 14px; line-height: 1.5; }
.consent-general { color: var(--muted); font-size: 13.5px; line-height: 1.5; }
/* Dialogs: a rounded sheet over a shaded page. Each kind below sets only its width and what's inside. */
dialog {
  padding: 24px; border: 1px solid var(--line); border-radius: 24px;
  background: var(--surface); color: var(--fg); box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
}
dialog::backdrop { background: rgba(10, 15, 20, 0.55); }
dialog.consent-dialog { max-width: min(520px, calc(100vw - 32px)); }
dialog.consent-dialog h2 { margin: 0 0 8px; font-family: var(--font-display); font-weight: 400; font-size: 26px; line-height: 1.15; }
dialog.consent-dialog > p { margin: 0 0 14px; line-height: 1.5; }
dialog.consent-dialog .consent-choices { margin-bottom: 14px; }
dialog.consent-dialog .actions { display: flex; flex-wrap: wrap; gap: 10px; }
dialog.consent-dialog .form-error { margin: 0 0 12px; font-size: 13px; color: var(--car); }
dialog.consent-dialog .form-error:empty { display: none; }
dialog.consent-dialog .actions .btn { flex: 1 1 160px; }
/* Inactivity warning (nav.js): "Are you still there?" with a countdown */
dialog.session-timeout { max-width: min(440px, calc(100vw - 32px)); }
dialog.session-timeout h2 { margin: 0 0 8px; font-family: var(--font-display); font-weight: 400; font-size: 26px; line-height: 1.15; }
dialog.session-timeout p { margin: 0 0 18px; line-height: 1.5; }
.session-countdown { font-family: var(--font-data); font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: no-preference) {
  .thinking::after { content: ""; animation: dots 1.2s steps(4) infinite; }
  @keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
}

/* AI log entries (AI history page and Admin page), drawn by ai-log-view.js */
.ai-log { display: grid; border-top: 1px solid var(--line); }
.log-entry { border-bottom: 1px solid var(--line); }
.log-summary {
  display: grid; grid-template-columns: 150px minmax(0, 1fr) auto 80px; gap: 12px; align-items: center;
  padding: 11px 4px; cursor: pointer; font-size: 14px; list-style: none;
}
.log-summary.with-model { grid-template-columns: 150px 90px minmax(0, 1fr) auto 80px; }
.log-summary::-webkit-details-marker { display: none; }
.log-summary:hover { background: var(--bg); }
.log-summary:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
@media (max-width: 640px) {
  .log-summary, .log-summary.with-model { grid-template-columns: minmax(0, 1fr) auto; }
  .log-summary .log-page, .log-summary .log-model { display: none; }
}
.log-when { color: var(--muted); font-size: 13px; white-space: nowrap; }
.log-model { font-family: var(--font-data); font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-cost { font-family: var(--font-data); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.log-status { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; justify-self: start; }
.log-status.completed { color: var(--invest); }
.log-status.cut_short, .log-status.stopped, .log-status.running { color: var(--muted); }
.log-status.refused, .log-status.error { color: var(--car); }
.log-body { display: grid; gap: 16px; padding: 4px 4px 18px; }
.log-section h3 { margin: 0 0 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.log-answer, .log-context { margin: 0; white-space: pre-wrap; line-height: 1.6; max-width: 72ch; font-size: 14.5px; }
.log-context { color: var(--muted); }
.log-empty { margin: 0; color: var(--muted); font-style: italic; font-size: 13.5px; }
.log-error { margin: 0 0 6px; color: var(--car); font-size: 13.5px; }
.log-meta { margin: 0; color: var(--muted); font-size: 12px; font-family: var(--font-data); }
.log-inputs { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 16px; margin: 0; font-size: 13.5px; }
.log-inputs dt { color: var(--muted); }
.log-inputs dd { margin: 0; font-family: var(--font-data); font-size: 13px; }
.log-inputs dd .log-inputs { font-size: 12.5px; padding: 4px 0 6px; }
.log-inputs ul { margin: 0; padding-left: 16px; }
/* An article's text on Learn (article.html) and in the admin editor's preview (admin-articles.html): the HTML
   articles.render makes on the server, sized for a three-minute read */
.article-body { font-size: clamp(17px, 2.2vw, 18.5px); line-height: 1.72; overflow-wrap: anywhere; }
.article-body > :first-child { margin-top: 0; }
.article-body p, .article-body ul, .article-body ol { margin: 0 0 1.15em; }
.article-body h2 { margin: 1.7em 0 0.45em; font-family: var(--font-display); font-weight: 400; font-size: clamp(26px, 4vw, 32px); line-height: 1.15; }
.article-body h3 { margin: 1.5em 0 0.35em; font-size: 1.08em; font-weight: 600; line-height: 1.35; }
.article-body ul, .article-body ol { padding-left: 1.3em; }
.article-body li { margin: 0.35em 0; padding-left: 0.2em; }
.article-body li::marker { color: var(--muted); }
.article-body strong { font-weight: 600; }
.article-body a { color: inherit; text-decoration-color: var(--invest); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.article-body a:hover { color: var(--invest); }
.article-body a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.article-body code { font: 0.88em var(--font-data); padding: 1px 5px; border-radius: 4px; background: var(--surface); border: 1px solid var(--line); }
.article-body blockquote { margin: 1.6em 0; padding: 2px 0 2px 20px; border-left: 3px solid var(--invest);
                           font-family: var(--font-display); font-size: clamp(22px, 3.4vw, 26px); line-height: 1.35; }
.article-body blockquote p { margin: 0 0 0.6em; }
.article-body blockquote p:last-child { margin-bottom: 0; }
.article-body hr { margin: 2em auto; width: 80px; border: 0; border-top: 1px solid var(--line); }
/* The privacy notice and terms links at the end of the drawer (nav.js), and the terms dialog (FiaidTerms) */
.nav-legal a { color: var(--muted); text-decoration: none; }
.nav-legal a:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 2px; }
.nav-legal a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
dialog.terms-dialog .terms-points { margin: 0 0 14px; padding-left: 1.2em; display: grid; gap: 6px; line-height: 1.5; }
dialog.terms-dialog a { color: inherit; text-underline-offset: 2px; }

/* The free trial's banner and the soft lock after it (nav.js, FiaidAccess) */
.access-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 16px; border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  background: color-mix(in srgb, var(--accent-container) 55%, var(--surface)); font-size: 14px; line-height: 1.5;
}
.access-banner p { margin: 0; flex: 1 1 320px; min-width: 0; }
.access-banner strong { font-weight: 600; }
.access-banner .access-answers { display: block; font-size: 13px; color: var(--muted); }
.access-banner .access-link { color: var(--accent-text); text-underline-offset: 2px; white-space: nowrap; }
.access-banner.expired { border-color: color-mix(in srgb, var(--car) 40%, transparent); background: var(--car-fill); }
.btn.small { min-height: 34px; padding: 7px 16px; font-size: 13.5px; }
body.locked main input:disabled, body.locked main select:disabled, body.locked main textarea:disabled { opacity: 0.75; cursor: not-allowed; }
body.locked main button:disabled { cursor: not-allowed; }

/* Postcards (postcard.js): the button in the corner of the pages members work on, and its panel, at the corner on
   wide windows and a sheet from the bottom on phones. */
.postcard-button {
  position: fixed; z-index: 30; right: max(20px, env(safe-area-inset-right, 0px)); bottom: max(20px, env(safe-area-inset-bottom, 0px));
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px 0 14px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 999px;
  background: var(--surface); color: var(--accent-text); font: 600 14px var(--font-body);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
}
/* Room under the page's end, so the button never covers its last line. */
body[data-postcard] main { padding-bottom: 96px; }
.postcard-button:hover { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.postcard-button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.postcard-icon svg { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.postcard-icon.large svg { width: 52px; height: 52px; stroke-width: 1.4; }
dialog.postcard-dialog {
  width: min(420px, calc(100vw - 32px)); max-height: calc(100vh - 120px); box-sizing: border-box; padding: 20px;
  margin: auto max(20px, env(safe-area-inset-right, 0px)) 84px auto; border-radius: 16px; overflow: auto;
}
dialog.postcard-dialog::backdrop { background: rgba(10, 15, 20, 0.2); }
.postcard-writing, .postcard-sent { display: flex; flex-direction: column; gap: 14px; }
.postcard-writing[hidden], .postcard-sent[hidden], .postcard-included[hidden] { display: none; }
.postcard-head { display: flex; align-items: center; gap: 10px; color: var(--accent-text); }
.postcard-head h2, .postcard-sent h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 26px; line-height: 1.1; color: var(--fg); }
.postcard-close {
  margin-left: auto; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--muted);
}
.postcard-close:hover { background: color-mix(in srgb, var(--fg) 6%, transparent); color: var(--fg); }
.postcard-close:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.postcard-intro { margin: 0; font-size: 14px; color: var(--muted); }
.postcard-kinds { margin: 0; padding: 0; border: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.postcard-kinds legend { padding: 0 0 8px; font-size: 14px; font-weight: 600; }
.postcard-message { display: flex; flex-direction: column; gap: 6px; }
.postcard-message label { font-size: 14px; font-weight: 600; }
.postcard-message textarea {
  min-height: 96px; padding: 10px 12px; resize: vertical; border: 1px solid var(--field-border); border-radius: 8px;
  background: var(--field-bg); color: var(--fg); font: 14px/1.5 var(--font-body);
}
.postcard-message textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.postcard-count { align-self: flex-end; font-size: 12px; color: var(--muted); }
.postcard-numbers {
  display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 10px;
  background: color-mix(in srgb, var(--accent-container) 35%, var(--surface));
}
.postcard-numbers > label { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.postcard-numbers input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.postcard-note { display: block; margin: 0; font-size: 13px; color: var(--muted); }
.postcard-included { font-size: 13px; }
.postcard-included summary { cursor: pointer; color: var(--accent-text); font-weight: 500; }
.postcard-included summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
.postcard-rows { margin: 8px 0; display: grid; gap: 3px; }
.postcard-rows div { display: flex; justify-content: space-between; gap: 12px; }
.postcard-rows dt { color: var(--muted); }
.postcard-rows dd { margin: 0; font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.postcard-writing .form-error { margin: 0; font-size: 13.5px; color: var(--car); }
.postcard-writing .form-error:empty { display: none; }
.postcard-sent { align-items: center; padding: 16px 4px; text-align: center; color: var(--accent-text); }
.postcard-sent p { margin: 0; font-size: 14px; color: var(--muted); }
@media (max-width: 640px) {
  .postcard-button { min-height: 44px; padding: 0 12px; }
  dialog.postcard-dialog {
    width: 100vw; max-width: 100vw; max-height: 88vh; margin: auto 0 0; padding: 16px 16px max(20px, env(safe-area-inset-bottom, 0px));
    border-radius: 20px 20px 0 0; border-bottom: 0;
  }
}
@media print { .postcard-button { display: none; } }
