/* App layout and components, on top of the shared brand tokens in brand.css. */

/* ---- app shell: a navy sidebar on desktop, a compact top bar on phones ---- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--navy); color: var(--navy-ink); display: flex; flex-direction: column; gap: 22px; padding: 22px 16px; align-self: start;
  position: sticky; top: 0; height: 100vh; }
.sidebar .brand { padding: 0 8px; }
.sidebar .brand-name { color: #fff; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav .grp { font: 600 .68rem var(--sans); text-transform: uppercase; letter-spacing: .1em; color: var(--navy-muted); padding: 14px 10px 6px; }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 12px; color: var(--navy-muted);
  text-decoration: none; font-weight: 500; font-size: .93rem; }
.side-nav a svg { width: 18px; height: 18px; flex: none; }
/* Icons read thin at small sizes: one notch heavier stroke on nav, tiles and buttons.
   (CSS beats the stroke-width="1.8" presentation attribute on the shared icon macro.) */
.side-nav a svg, .tile-ic svg, .side-btn svg, .iconbtn svg { stroke-width: 2; }
.side-nav a:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.side-nav a[aria-current="page"] { color: #fff; background: rgba(52, 211, 153, .14); box-shadow: inset 3px 0 0 #34d399; }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid rgba(255, 255, 255, .08); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #34d399; color: #04241a; display: grid; place-items: center; font-weight: 700; flex: none; }
.side-foot .who-name { flex: 1; min-width: 0; font-size: .86rem; line-height: 1.3; }
.side-foot .who-name strong { display: block; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who-name span { color: var(--navy-muted); font-size: .78rem; }
.side-foot form { margin: 0; }
.side-btn { border: 1px solid rgba(255, 255, 255, .12); background: transparent; color: var(--navy-muted); border-radius: 9px; width: 34px; height: 34px;
  cursor: pointer; display: grid; place-items: center; }
.side-btn:hover { color: #fff; border-color: rgba(255, 255, 255, .3); }
.side-btn svg { width: 16px; height: 16px; }
.content { display: flex; flex-direction: column; min-width: 0; }
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px; }
  .side-nav { order: 3; flex: 1 0 100%; min-width: 0; flex-direction: row; overflow-x: auto; scrollbar-width: none; gap: 4px; -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 32px), transparent 100%); mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 32px), transparent 100%); }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-nav .grp { display: none; }
  .side-nav a { flex: none; padding: 8px 14px; font-size: .88rem; min-height: 44px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .1); }
  .side-nav a[aria-current="page"] { box-shadow: none; background: rgba(52, 211, 153, .16); border-color: rgba(52, 211, 153, .35); }
  .side-foot { margin: 0 0 0 auto; padding: 0; border: 0; }
  .side-foot .avatar, .side-foot .who-name > span { display: none; }
}

/* signed-out pages: a slim public header */
.pubbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.pubbar-in { max-width: 1120px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 16px; }
.pubbar-in nav { display: flex; gap: 16px; margin-left: auto; font-size: .9rem; }
.pubbar-in nav a { color: var(--muted); text-decoration: none; } .pubbar-in nav a:hover { color: var(--ink); }
.iconbtn { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 9px; width: 34px; height: 34px; cursor: pointer; display: grid; place-items: center; }
.iconbtn:hover { color: var(--ink); border-color: var(--muted); }
.public { min-height: 100vh; display: flex; flex-direction: column; }

main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 40px 32px 72px; }
.narrow { max-width: 440px; margin: 7vh auto 0; }
.page-head { margin-bottom: 28px; }
.page-head h1 { margin-bottom: .2em; }
.page-head p { color: var(--muted); max-width: 64ch; margin: 0; }
footer { border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: .85rem; padding: 28px 32px 32px; }
footer a { color: inherit; }

/* ---- notices ---- */
.flash { max-width: 1080px; width: 100%; margin: 18px auto 0; padding: 0 32px; }
.flash > div { border-radius: 10px; padding: 10px 16px; font-size: .92rem; }
.flash .ok { background: var(--good-soft); color: var(--good); border: 1px solid color-mix(in srgb, var(--good) 25%, transparent); }
.flash .err { background: var(--bad-soft); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 25%, transparent); }

/* ---- forms ---- */
.field { margin-bottom: 16px; }
.field > label, .label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 5px; }
.field .opt { color: var(--muted); font-weight: 400; }
.help { font-size: .85rem; color: var(--muted); margin-top: 4px; }
.kb-feedback { margin-top: 18px; font-size: .86rem; color: var(--muted); }
input[type=text], input[type=password], input[type=url], input[type=email], select, textarea {
  width: 100%; padding: 11px 14px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px; font: inherit;
}
textarea { resize: vertical; min-height: 92px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }

/* ---- workbench ---- */
.wb { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
@media (max-width: 900px) { .wb { grid-template-columns: 1fr; } }
.step { margin-bottom: 26px; }
.step > h2 { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; }
.num { display: inline-flex; width: 26px; height: 26px; align-items: center; justify-content: center; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font: 700 .85rem var(--sans); }
.modes { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.mode { display: block; cursor: pointer; position: relative; }
.mode input { position: absolute; opacity: 0; }
.mode-body { display: flex; flex-direction: column; gap: 3px; height: 100%; padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .12s, background .12s; }
.mode:hover .mode-body { border-color: var(--muted); }
.mode input:checked + .mode-body { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.mode input:focus-visible + .mode-body { outline: 2px solid var(--brand); outline-offset: 2px; }
.mode-name { font-weight: 600; font-size: .95rem; }
.mode-blurb { font-size: .82rem; color: var(--muted); line-height: 1.4; }
.toggle { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.toggle input { margin-top: 5px; }
.connbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); font-size: .9rem; margin-bottom: 26px; }
.progress { padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-top: 22px; }
.progress-head { display: flex; align-items: center; gap: 10px; }
.stages { margin: 10px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 3px; font-size: .92rem; }
.stages .st-ok { color: var(--good); } .stages .st-running { color: var(--brand); font-weight: 600; }
.stages .st-blocked, .stages .st-failed { color: var(--warn); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.side h3 { font-size: 1rem; }
.runlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.runlist a { display: block; padding: 9px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; color: inherit; text-decoration: none; }
.runlist a:hover { border-color: var(--brand); }
.runlist .t { font-size: .84rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; }
.example { text-align: left; padding: 8px 12px; background: transparent; color: var(--ink); border: 1px dashed var(--line); border-radius: 9px; cursor: pointer; font: inherit; font-size: .9rem; }
.example:hover { border-color: var(--brand); }
.example small { display: block; color: var(--muted); font-family: var(--mono); font-size: .75rem; }

/* ---- connections ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 22px; }
.choice { display: block; cursor: pointer; position: relative; }
.choice input { position: absolute; opacity: 0; }
.choice-body { display: block; height: 100%; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .12s; }
.choice:hover .choice-body { border-color: var(--muted); }
.choice input:checked + .choice-body { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.choice input:focus-visible + .choice-body { outline: 2px solid var(--brand); outline-offset: 2px; }
.choice-body strong { display: block; font-size: .98rem; font-weight: 650; }
.choice-body span { font-size: .84rem; color: var(--muted); }
.panel[hidden] { display: none; }
.testout { margin-top: 12px; padding: 10px 14px; border-radius: 9px; font-size: .9rem; }
.testout.ok { background: var(--good-soft); color: var(--good); }
.testout.bad { background: var(--bad-soft); color: var(--bad); }

/* ---- run report ---- */
.rp { display: flex; flex-direction: column; gap: 18px; }
.rp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.rp-label { font: 700 .72rem var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 4px; }
.rp-quote { white-space: pre-wrap; padding: 10px 16px; border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; color: var(--muted); }
.rp-card h2 { font-size: 1.25rem; }
.rp-card h3 { font: 700 .8rem var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 20px 0 6px; }
.rp-verdict { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.rp-verdict .pill { font-size: .9rem; padding: 3px 14px; }
.rp-claim { font: 500 1.12rem/1.55 var(--sans); margin: 2px 0 14px; letter-spacing: -.005em; }
/* New answer format (AskAnswer): the short answer leads, then next steps, then the pro box. */
.rp-short { font: 600 1.12rem/1.55 var(--sans); margin: 2px 0 14px; letter-spacing: -.005em; }
.pro-box { border: 1px solid var(--line); border-left: 4px solid var(--accent); background: var(--surface); border-radius: 10px; padding: 12px 16px; margin: 12px 0; overflow-wrap: anywhere; }
.pro-box strong { display: block; font: 700 .8rem var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 2px; }
.rp-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 32px; }
.rp-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 5px; }
.rp-hl { background: var(--warn-soft); border-radius: 6px; padding: 2px 8px; list-style-position: inside; }
.rp-hl-box { background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); border-radius: var(--radius); padding: 10px 14px; margin: 10px 0; }
.rp-dl { display: grid; grid-template-columns: 190px 1fr; gap: 8px 18px; margin: 0; }
.rp-dl dt { color: var(--muted); font-size: .88rem; } .rp-dl dd { margin: 0; }
@media (max-width: 700px) { .rp-dl { grid-template-columns: 1fr; } }
.rp-risky td { background: var(--warn-soft); }
.rp-mono td { font-family: var(--mono); font-size: .8rem; }
.rp-finding { padding: 12px 0; border-bottom: 1px solid var(--line); } .rp-finding p { margin: 4px 0; }
details.more { margin-top: 12px; } details.more summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: .9rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { font: .78rem var(--mono); padding: 2px 9px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: var(--surface); }
.toc { display: flex; gap: 6px; flex-wrap: wrap; }
.toc a { font-size: .82rem; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); text-decoration: none; background: var(--surface); }
.toc a:hover { color: var(--brand); border-color: var(--brand); }
@media print { .sidebar, .pubbar, footer, .toc, .noprint { display: none !important; } .shell { display: block; } body { background: #fff; } }

/* ---- knowledge / admin ---- */
.kn { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 800px) { .kn { grid-template-columns: 1fr; } }
.kn-list { display: flex; flex-direction: column; gap: 2px; max-height: 70vh; overflow-y: auto; }
.kn-list .grp { font: 700 .72rem var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 12px 0 4px; }
.kn-list a { padding: 5px 10px; border-radius: 7px; color: var(--ink); text-decoration: none; font-size: .9rem; }
.kn-list a:hover { background: var(--surface-2); } .kn-list a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
.prose { max-width: 70ch; } .prose h1 { font-size: 1.5rem; } .prose h2 { font-size: 1.2rem; margin-top: 1.4em; }

/* ---- utilities ---- */
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--brand); color: var(--brand-ink); padding: 6px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }
.warn-text { color: var(--warn); }
.profile-switch { width: 100%; max-width: 150px; padding: 3px 6px; font: 600 .86rem var(--sans); color: #fff; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .14); border-radius: 7px; }
.profile-switch option { color: #0b1b33; }
footer p { margin: 0; }
.tablewrap { overflow-x: auto; }
@media (max-width: 640px) { main { padding: 26px 16px 56px; } .flash { padding: 0 16px; } footer { padding: 22px 16px; } .card { padding: 20px 18px; } h1 { font-size: 1.6rem; }
  .dash-hero { padding: 26px 20px; } .hero-actions .btn { width: 100%; } .tiles { grid-template-columns: 1fr; } }

/* ---- home tools section heading ---- */
.tools-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 8px 0 16px; }
.tools-head h2 { margin: 0; }
.tools-head p { margin: 0; color: var(--muted); font-size: .92rem; }

/* ---- hero / workbench additions ---- */
.hero { margin-bottom: 22px; }
.hero h1 { font-size: 2.2rem; margin-bottom: .25em; }
.hero p { color: var(--muted); max-width: 70ch; margin: 0; }
.mode-by { font: 600 .75rem var(--sans); color: var(--accent); text-transform: uppercase; letter-spacing: .05em; }
.playbooks { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.toollinks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.toollinks a { display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: inherit; text-decoration: none; }
.toollinks a:hover { border-color: var(--brand); }
.toollinks strong { display: block; } .toollinks span { font-size: .84rem; color: var(--muted); }
.result-actions { margin-bottom: 14px; }
.runlist.wide a { padding: 12px 14px; }
.rp-title { font-size: 1.6rem; margin-bottom: .1em; }
.rp-fold > summary { cursor: pointer; list-style: none; }
.rp-fold > summary::-webkit-details-marker { display: none; }
.rp-fold > summary h2 { display: inline; }
.rp-fold > summary::before { content: "\25B8"; color: var(--muted); margin-right: 8px; }
.rp-fold[open] > summary::before { content: "\25BE"; }
.persp { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.persp-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--surface-2); }
.persp-item p { margin: 4px 0 0; font-size: .93rem; }
.persp-school { font: 700 .78rem var(--sans); text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }
.chip { text-decoration: none; }

/* ---- settings ---- */
.settings-block { margin-bottom: 22px; }
.profiles { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.profile { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; }
.profile.on { border-color: var(--brand); background: var(--brand-soft); }
.profile .pill { margin-left: 8px; }

/* ---- tools ---- */
.tool { display: flex; flex-direction: column; gap: 20px; }
.tool form h2 { font-size: 1.1rem; margin-top: 6px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 4px 20px; }
.money, .pct { position: relative; }
.money input { padding-left: 24px; } .pct input { padding-right: 28px; }
.money::before { content: "$"; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.pct::after { content: "%"; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
input[type=number] { width: 100%; padding: 11px 14px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; font: inherit; }
.money input[type=number] { padding-left: 24px; } .pct input[type=number] { padding-right: 28px; }
.checks { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: .92rem; cursor: pointer; }
.check input { margin-top: 5px; }
.consensus { border-color: var(--accent); background: var(--accent-soft); }
.consensus strong { font-size: 1.1rem; }
.fws { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin: 16px 0; }
.fw-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.fw-name { font: 700 1rem var(--sans); }
.fw-step { font: 700 .8rem var(--sans); color: var(--brand); background: var(--brand-soft); padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.dots { display: flex; gap: 5px; margin: 12px 0 4px; }
.dot { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.dot.past { background: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.dot.now { background: var(--accent); }
.fw h3 { font-size: 1.05rem; margin: 12px 0 4px; }
table.debts td { padding: 6px 6px; } table.debts input { min-width: 90px; }
.strats { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin: 16px 0; }
.strat { border-top: 4px solid var(--chart-a); } .strat.b { border-top-color: var(--chart-b); }
.strat-name { font: 700 1.1rem var(--sans); }
.strat .rp-dl { grid-template-columns: 130px 1fr; margin: 12px 0; }
.chart { width: 100%; height: auto; display: block; margin-top: 8px; }
.chart .axis { fill: none; stroke: var(--line); stroke-width: 1; }
.chart text { fill: var(--muted); font: 11px var(--sans); }
.chart .line-a, .chart .line-b { fill: none; stroke-width: 2.5; stroke-linejoin: round; }
.chart .line-a { stroke: var(--chart-a); } .chart .line-b { stroke: var(--chart-b); stroke-dasharray: 6 4; }
.legend { display: flex; gap: 16px; }
.key::before { content: ""; display: inline-block; width: 18px; height: 3px; vertical-align: middle; margin-right: 6px; background: var(--chart-a); }
.key.b::before { background: var(--chart-b); }

/* ---- documents ---- */
.doc { max-width: 78ch; margin: 0 auto; }
.prose table { margin: 1em 0; }
.prose td, .prose th { font-size: .9rem; }
.kn-list { padding: 12px; }
@media print { .result-actions { display: none !important; } }
#result, #where-result, #debt-result, #question, #tools { scroll-margin-top: 90px; }
.iconbtn svg { display: block; margin: auto; }
.choice-row { margin-bottom: 8px; }
.choice-body a { color: var(--brand); }
.rp-sources .chips { margin-top: 6px; }
.foot-nav { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 6px; }
.foot-nav a { font-weight: 600; }
footer p { margin: 0; }
.side-btn svg, .iconbtn svg { display: block; }
.iconbtn svg { width: 16px; height: 16px; }

/* ---- dashboard header (Ask page) ---- */
.dash-hero { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: stretch; padding: 44px 44px 40px; border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #0a2540 0%, #0d3a34 58%, #0f5c46 100%); color: #e8eef8; margin-bottom: 28px; box-shadow: var(--shadow); }
.dash-hero h1 { font-family: var(--display); color: #fff; font-size: clamp(2.4rem, 6vw, 3.6rem); font-weight: 800; line-height: 1.05; letter-spacing: -.03em; margin: 6px 0 14px; }
.dash-hero p { color: #c3d2e4; margin: 0; max-width: 58ch; font-size: 1.06rem; line-height: 1.6; }
.hero-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 24px; }
.hero-actions .btn { background: #34d399; border-color: #34d399; color: #04241a; }
.hero-actions .btn:hover { filter: brightness(1.06); }
.hero-actions .hero-link { color: #a7f3d0; font-weight: 600; text-decoration: none; }
.hero-actions .hero-link:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.eyebrow { font: 700 .74rem var(--sans); text-transform: uppercase; letter-spacing: .12em; color: #6ee7b7; }
/* The model panel hugs its content and sits centred against the hero text, instead of
   stretching the full hero height with the "Change" link pinned to the bottom and a void
   in the middle. The label is a <strong> (not <code>), so the old code rule was dead. */
.dash-model { background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); border-radius: 18px; padding: 20px 22px;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start; justify-content: center; align-self: center; }
.dash-model strong { color: #fff; font-size: 1rem; line-height: 1.45; overflow-wrap: anywhere; }
.dash-model a { color: #6ee7b7; }
.dash-model .warn-text { color: #fcd34d; }
@media (max-width: 800px) { .dash-hero { grid-template-columns: 1fr; padding: 30px 24px; } }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 32px; }
.tile { display: flex; flex-direction: column; gap: 3px; padding: 20px 20px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  color: var(--ink); text-decoration: none; box-shadow: var(--shadow-soft); transition: border-color .15s, transform .15s, box-shadow .15s; }
.tile:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow); }
.tile-ic { width: 44px; height: 44px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; margin-bottom: 10px; }
.tile-ic svg { width: 22px; height: 22px; }
.tile-k { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.tile-v { font-family: var(--display); font-size: 1.18rem; font-weight: 700; letter-spacing: -.01em; }
.tile-s { font-size: .86rem; color: var(--brand); }
@media (prefers-reduced-motion: reduce) { .tile { transition: none; } .tile:hover { transform: none; } }

/* ---- follow-up chat ---- */
.chat { margin-top: 18px; display: flex; flex-direction: column; gap: 12px; }
.chat-head h2 { margin-bottom: 2px; }
.chat-head .help { margin: 0; }
.chat-log { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 82%; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); }
.bubble.me { align-self: flex-end; background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 30%, var(--line)); border-bottom-right-radius: 4px; }
.bubble.them { align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble-who { font: 600 .72rem var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 2px; }
.bubble-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.thinking .bubble-text { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.bubble-src { font-size: .8rem; color: var(--muted); margin-top: 6px; }
/* New answer format inside chat bubbles: short answer leads, then next steps, then the pro box. */
.bubble-short { font-weight: 600; margin: 0 0 8px; overflow-wrap: anywhere; }
.bubble-label { font: 700 .72rem var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 8px 0 2px; }
.bubble-steps { margin: 0 0 4px; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; overflow-wrap: anywhere; }
.bubble-steps li::marker { font-weight: 700; }
.bubble-pro { border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 8px 8px 0; padding: 8px 10px; margin: 8px 0 4px; font-size: .92rem; overflow-wrap: anywhere; }
.bubble-pro strong { display: block; font: 700 .72rem var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.chat-stage { font-size: .78rem; color: var(--muted); background: var(--surface-2); border-radius: 8px; padding: 6px 10px; margin: 0; }
.chat-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { font: 500 .85rem var(--sans); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.chip-btn:hover { border-color: var(--brand); color: var(--brand); }
.chat-form { display: flex; gap: 10px; align-items: flex-end; }
.chat-form textarea { min-height: 48px; flex: 1; }
@media (max-width: 640px) { .bubble { max-width: 95%; } }
@media print { .chat-form, .chat-chips { display: none !important; } }

.model-pick { margin-top: 6px; font-size: .88rem; }

/* ---- coast FIRE ---- */
.tile.static:hover { border-color: var(--line); transform: none; }
.progressbar { height: 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; margin: -4px 0 16px; }
.progressbar span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #34d399); border-radius: 999px; }
.explain { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 12px; }
.explain li::marker { color: var(--brand); font-weight: 700; }
.explain p { margin: 2px 0 0; color: var(--ink); }
.chart .line-c { fill: none; stroke: var(--muted); stroke-width: 2; stroke-dasharray: 3 4; }
.key.c::before { background: var(--muted); }
.ex-group { font: 600 .7rem var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 14px 0 6px; }
.ex-group:first-of-type { margin-top: 4px; }

.narrate textarea { width: 100%; }
.narrate h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.understood { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.understood h3 { font-size: 1rem; margin-bottom: 8px; }
.u-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 16px; }
.u-list li { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--line); padding: 4px 0; }
.u-k { color: var(--muted); font-size: .88rem; } .u-v { font-weight: 600; font-variant-numeric: tabular-nums; }
input.filled { border-color: var(--brand); background: var(--brand-soft); }
.u-list.wide { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
@media (max-width: 640px) { .u-list.wide { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); } }

/* ---- "What Stepwise does" intro (Ask page) ---- */
.intro { margin-bottom: 28px; }
.intro-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.intro-head h2 { margin: 0; }
.intro-lede { font-size: 1.05rem; color: var(--ink); margin: 10px 0 20px; max-width: 80ch; line-height: 1.6; }
.intro-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (min-width: 1100px) { .intro-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 700px) { .intro-grid { grid-template-columns: 1fr; } }
.intro-item { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding: 18px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 18px; }
.intro-item strong { font-family: var(--display); font-size: 1.02rem; display: block; margin-bottom: 2px; }
.intro-item p { margin: 0; font-size: .92rem; color: var(--muted); line-height: 1.55; }
.intro-num { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font: 700 .85rem var(--sans); }
.intro-start { margin-top: 18px; padding: 12px 16px; border: 1px dashed var(--line); border-radius: 12px; font-size: .94rem; }
.intro-note { margin: 12px 0 0; }

/* ---- voice input + AI explanations ---- */
.mic-wrap { position: relative; }
.mic-wrap textarea { padding-right: 46px; }
.mic-btn { position: absolute; right: 8px; bottom: 8px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.mic-btn:hover { color: var(--brand); border-color: var(--brand); }
.mic-btn.on { background: var(--bad); border-color: var(--bad); color: #fff; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--bad) 20%, transparent); } }
@media (prefers-reduced-motion: reduce) { .mic-btn.on { animation: none; } }
/* While recording for Whisper the ring follows the voice level (--lvl, 0..1, set by ai.js). */
.mic-btn.on[style*="--lvl"] { animation: none; box-shadow: 0 0 0 calc(2px + var(--lvl, 0) * 10px) color-mix(in srgb, var(--bad) 25%, transparent); transition: box-shadow .08s linear; }
.mic-btn.busy { color: var(--brand); border-color: var(--brand); cursor: progress; }
.mic-btn.busy svg { display: none; }
.mic-btn.busy::after { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
.mic-status { position: absolute; right: 50px; bottom: 13px; max-width: calc(100% - 64px); padding: 2px 8px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 18px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.chat-form .mic-wrap { flex: 1; } .chat-form .mic-wrap textarea { width: 100%; }
label.check.filled { color: var(--brand); font-weight: 600; }
.explainer-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.explainer-head h2 { margin: 0; }
.explain-body { margin-top: 12px; }
.explain-summary { font-size: 1.02rem; }
.explain-body h3 { font-size: .95rem; margin: 14px 0 6px; }
/* ---- picking stocks: evidence bars ---- */
.bars { display: grid; gap: 6px; margin: 12px 0 6px; }
.bar-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 70px; gap: 10px; align-items: center; font-size: .88rem; }
.bar-t { height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar { display: block; height: 100%; border-radius: 999px; background: var(--chart-b); }
.bar.a { background: var(--chart-a); }
.bar-v { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .bar-row { grid-template-columns: 110px minmax(0, 1fr) 58px; font-size: .8rem; } }
#stocks-result { scroll-margin-top: 80px; }

/* Coast FIRE charts */
.chart .goal { fill: none; stroke: var(--good, #16a34a); stroke-width: 1.5; stroke-dasharray: 2 4; }
.chart .goal-label { fill: var(--good, #16a34a); font-weight: 600; }
.chart .area-put { fill: color-mix(in srgb, var(--chart-a) 55%, transparent); }
.chart .area-growth { fill: color-mix(in srgb, var(--chart-b) 35%, transparent); }
.chart .bar-ok { fill: color-mix(in srgb, var(--good, #16a34a) 75%, transparent); }
.chart .bar-short { fill: color-mix(in srgb, var(--warn, #d97706) 75%, transparent); }
.key.put::before { height: 10px; background: color-mix(in srgb, var(--chart-a) 55%, transparent); }
.key.growth::before { height: 10px; background: color-mix(in srgb, var(--chart-b) 35%, transparent); }
.verdict p { font-size: 1.02rem; }
.explainer.auto .explain-body { margin-top: 6px; }
.explain-wait { display: flex; align-items: center; gap: 10px; color: var(--muted); margin-top: 8px; }

/* Wealth multiplier */
.chart .mult-bar { fill: color-mix(in srgb, var(--chart-b) 45%, transparent); }
.chart .mult-you { fill: var(--chart-b); }
.key.mult::before { height: 10px; background: color-mix(in srgb, var(--chart-b) 45%, transparent); }
tr.you td { font-weight: 700; }
#mult-result { scroll-margin-top: 80px; }

/* Fill your tax buckets */
.buckets { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.bucket { padding: 14px 0; border-bottom: 1px solid var(--line); }
.bucket:last-child { border-bottom: 0; }
.bucket p { margin: 6px 0 0; }
.bucket .progressbar { margin: 10px 0 6px; }
.bucket.not_eligible { opacity: .65; }
.bucket.next { border-left: 3px solid var(--accent); padding-left: 12px; }
.bucket-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bucket-head .pill { margin-left: auto; }
.bucket-n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font: 700 .8rem var(--sans); background: var(--brand-soft); color: var(--brand); flex: none; }
.bucket-nums { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); }
#tb-result, #hsa-result, #kids-result { scroll-margin-top: 80px; }

/* Resources */
.res-jump { display: flex; flex-wrap: wrap; gap: 8px; margin: -8px 0 26px; }
.res-jump .chip-btn { text-decoration: none; }
.res-section { margin-bottom: 34px; scroll-margin-top: 24px; }
@media (max-width: 900px) { .res-section { scroll-margin-top: 130px; } }
.res-section > h2 { margin: 0 0 14px; }
.res-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.res-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.res-card h3 { margin: 0; font-size: 1rem; }
.res-card p { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.res-links { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: auto; padding-top: 6px; font-size: .86rem; font-weight: 500; }
.res-list { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.res-list li { display: flex; align-items: center; gap: 12px; padding: 11px 18px; }
.res-list li + li { border-top: 1px solid var(--line); }
.res-list .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.res-list cite { font-style: normal; font-weight: 600; }
.res-list .by { color: var(--muted); font-size: .84rem; }
.res-list .pill { color: var(--brand); background: var(--brand-soft); }
@media (max-width: 640px) { .res-list li { padding: 10px 14px; } .res-list .pill { white-space: normal; text-align: center; } }

/* Floating "Ask Stepwise" assistant */
.fab { position: fixed; right: 20px; bottom: 20px; z-index: 40; display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px;
  border: 0; border-radius: 999px; background: var(--brand); color: var(--brand-ink, #fff); font: 600 .95rem var(--sans); cursor: pointer;
  box-shadow: 0 6px 24px rgba(11, 27, 51, .22); }
.fab:hover { filter: brightness(1.08); }
.fab svg { width: 20px; height: 20px; }
.fab[aria-expanded="true"] { display: none; }
.assist { position: fixed; right: 20px; bottom: 20px; z-index: 41; width: min(400px, calc(100vw - 32px)); height: min(600px, calc(100vh - 40px));
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(11, 27, 51, .25); overflow: hidden; }
.assist[hidden] { display: none; }
.assist-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.assist-head strong { flex: 1; }
.assist-head .iconbtn { width: 30px; height: 30px; }
.assist-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.assist-body .bubble { max-width: 92%; }
.assist-intro { color: var(--muted); font-size: .88rem; margin: 0; }
.assist-ctx { font-size: .78rem; color: var(--muted); background: var(--surface-2); border-radius: 8px; padding: 6px 10px; }
.assist-foot { border-top: 1px solid var(--line); padding: 10px 12px; display: grid; gap: 8px; }
.assist-foot .chat-form textarea { min-height: 42px; max-height: 120px; }
.assist-foot .help { margin: 0; font-size: .74rem; }
.assist .chat-chips .chip-btn { font-size: .8rem; padding: 5px 10px; }
@media (max-width: 640px) {
  .fab { right: 14px; bottom: 14px; padding: 12px; } .fab span { display: none; }
  .assist { right: 0; bottom: 0; width: 100vw; height: 85vh; border-radius: var(--radius) var(--radius) 0 0; }
}
@media print { .fab, .assist { display: none !important; } }

/* Text-heavy pages (HSA, Kids accounts, Picking stocks): use the full width on big screens. */
.tool > .card.prose, .info-grid > .card.prose, .card.prose.wide { max-width: none; }
.card.prose p, .card.prose li { max-width: 80ch; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; align-items: start; }
.info-grid.three { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.info-grid > .card { height: 100%; }
.card .info-grid { gap: 8px 32px; }
.card .info-grid h3 { margin-top: 1.2em; }
@media (max-width: 640px) { .info-grid, .info-grid.three { grid-template-columns: 1fr; } }

/* Guide pages: TLDR box, preset-question buttons, stage/topic lists. */
.tldr-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin: 0 0 1.2em; }
.tldr-box h2 { margin-top: 0; font-size: 1rem; }
.tldr-box ul { margin-bottom: 0; }
.guide-ask { border-top: 1px solid var(--line); margin-top: 1.6em; padding-top: 1em; }
.guide-ask .chat-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.page-head h1 { margin-bottom: 4px; }
