:root {
  --bg: #f5f6f4;
  --surface: #ffffff;
  --ink: #1d2a33;
  --ink-2: #4a5963;
  --muted: #66737b;
  --line: #dfe3e1;
  --brand: #1f4e5f;
  --brand-2: #2f6f80;
  --brand-soft: #e6eff1;
  --red: #a6192e;
  --ok: #2e7d4f;
  --ok-soft: #e5f2ea;
  --warn: #8a5300;
  --warn-soft: #fbf0dc;
  --danger: #a33a32;
  --danger-soft: #f8e7e5;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 35, 45, .05), 0 4px 16px rgba(20, 35, 45, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.55; font-size: 16px; }
/* Page column: the content area grows so the footer sits at the bottom of the window on short pages. */
body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
body > * { flex: none; }
body > .wrap { width: 100%; flex: 1 0 auto; }
a { color: var(--brand-2); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.1rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

.wrap { max-width: 920px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.narrow { max-width: 560px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }

/* ---------------------------------------------------------------- header / footer */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand img { height: 40px; width: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; white-space: nowrap; }
.brand-text small { color: var(--muted); font-size: .8rem; }
.account { display: flex; align-items: center; gap: 10px; font-size: .875rem; color: var(--ink-2); min-width: 0; }
.account .btn { white-space: nowrap; }
.account .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
main { padding-top: 28px; padding-bottom: 48px; }
/* Record note under the header on signed-in pages. */
/* Highlighted in amber so it stands out from the teal page (Mindi, November 2026). */
.record-bar { background: #fff3cd; border-top: 4px solid #e0a106; border-bottom: 1px solid #ecd28b; color: #4a3500; }
body.signed-in .record-bar .wrap { max-width: 1140px; }
.record-bar-inner { display: flex; align-items: center; gap: 12px 16px; padding-top: 14px; padding-bottom: 14px; }
.record-bar p { margin: 0; flex: 1 1 auto; font-size: 1rem; font-weight: 650; }
.record-icon { flex: none; color: #b87900; }
.record-bar .btn { flex: none; white-space: nowrap; }
@media (max-width: 720px) {
  .record-bar-inner { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 10px 12px; }
  .record-bar p { font-size: .9rem; }
  .record-bar .btn { grid-column: 2; justify-self: start; }
}
main:focus, h1:focus { outline: none; }
.footer { border-top: 1px solid var(--line); padding: 20px 0 32px; font-size: .8rem; color: var(--muted); }

/* ---------------------------------------------------------------- building blocks */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 700; color: var(--brand-2); margin-bottom: .35rem; }
.lead { font-size: 1.075rem; color: var(--ink-2); }
.callout { background: var(--brand-soft); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 24px; color: var(--ink); }
.callout p:last-child { margin-bottom: 0; }
.section-title { margin: 28px 0 12px; }
.pending { display: inline-block; background: var(--warn-soft); color: var(--warn); font-size: .8rem; font-weight: 600; letter-spacing: 0; padding: 2px 8px; border-radius: 6px; vertical-align: middle; }


.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; font-size: .95rem;
  border-radius: 8px; border: 1px solid var(--brand); background: var(--brand); color: #fff; padding: 9px 16px; cursor: pointer; text-decoration: none; min-height: 40px; }
.btn:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.secondary { background: var(--surface); color: var(--brand); }
.btn.secondary:hover { background: var(--brand-soft); }
.btn.danger { background: var(--surface); color: var(--danger); border-color: #e2b8b3; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger.solid:hover { background: #8a2f28; border-color: #8a2f28; }
.btn.small { font-size: .85rem; padding: 5px 12px; min-height: 34px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--brand-2); text-decoration: underline; cursor: pointer; }

/* Status: a dot (or check mark) and plain text, so it can't be mistaken for a button. */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.badge.not_started { color: var(--muted); }
.badge.not_started::before { border: 2px solid currentColor; }
.badge.in_progress { color: var(--warn); }
.badge.in_progress::before { background: currentColor; }
.badge.complete { color: var(--ok); gap: 4px; }
.badge.complete::before { display: none; }
.check-icon { width: 14px; height: 14px; flex: none; }
.big-check { width: 22px; height: 22px; color: var(--ok); flex: none; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; transition: all .2s; max-width: calc(100% - 32px); z-index: 20; }
.toast.show { opacity: 1; transform: translateX(-50%); }

/* ---------------------------------------------------------------- forms */
.field { margin-bottom: 16px; }
.field > label, .field .label { display: block; font-weight: 600; margin-bottom: 4px; }
.req { font-weight: 400; color: var(--muted); font-size: .85rem; }
.help { color: var(--muted); font-size: .875rem; margin: 0 0 6px; }
input[type=text], input[type=email], input[type=date], input[type=time], textarea, select {
  font: inherit; width: 100%; padding: 9px 11px; border: 1px solid #c9cfcd; border-radius: 8px; background: #fff; color: var(--ink); }
select { max-width: 360px; min-height: 42px; }
input[type=date], input[type=time] { max-width: 220px; }
textarea { min-height: 88px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--brand-2); }
::placeholder { color: #a2abb0; opacity: 1; }
.money { position: relative; max-width: 240px; }
.money span { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.money input { padding-left: 24px; }
.number { position: relative; max-width: 200px; }
.number .pre, .number .suf { position: absolute; top: 50%; transform: translateY(-50%); color: var(--muted); }
.number .pre { left: 11px; }
.number .suf { right: 11px; }
.number.has-prefix input { padding-left: 24px; }
.number.has-suffix input { padding-right: 30px; }
.err { color: var(--danger); font-size: .875rem; margin: 6px 0 0; }
.field.invalid input, .field.invalid textarea, .field.invalid select { border-color: var(--danger); }
/* Checklist items: box on the left, wrapped text lined up beside it, the whole row clickable. */
.check-field { margin-bottom: 2px; }
.check-field .err:empty { margin: 0; }
.field > label.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 400; margin: 0 -10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.check:hover { background: var(--bg); }
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--ok); cursor: pointer; }
.form-section:has(.check-field) { margin-bottom: 14px; }
fieldset { border: 0; padding: 0; margin: 0 0 8px; min-width: 0; }
legend { float: left; width: 100%; font-weight: 700; font-size: 1.05rem; padding: 0; margin-bottom: 10px; }
legend + * { clear: both; }
.form-section + .form-section { border-top: 1px solid var(--line); padding-top: 18px; }

/* Table fields: a grid of rows the client adds to. Scrolls sideways on narrow screens. */
.table-field .label { margin-bottom: 4px; }
.grid-wrap { position: relative; overflow-x: auto; margin: 4px 0 10px; border: 1px solid var(--line); border-radius: 8px; }
.grid { border-collapse: collapse; width: 100%; min-width: 520px; }
.grid th { text-align: left; font-size: .8rem; font-weight: 600; color: var(--ink-2); background: var(--bg); padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid td { padding: 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid tr:last-child td { border-bottom: 0; }
.grid input, .grid select { padding: 7px 8px; min-height: 38px; max-width: none; }
.grid .money, .grid .number { max-width: none; }
.grid td.col-date { width: 160px; }
.grid td.col-number, .grid td.col-money { width: 130px; }
.grid .row-remove { width: 44px; text-align: center; }
.icon-btn.small { width: 32px; height: 32px; display: inline-grid; place-items: center; font-size: 1rem; }
.icon-btn.small:hover { background: var(--danger-soft); color: var(--danger); }
.totals-box:empty { display: none; }
.totals { margin: 8px 0 0; padding: 12px 14px; background: var(--brand-soft); border-radius: 8px; display: grid; gap: 4px; }
.totals div { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.totals dt { color: var(--ink-2); }
.totals dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- sign in */
.signin { display: grid; gap: 24px; grid-template-columns: 1.1fr 1fr; align-items: start; }
.signin .card { margin: 0; }
.ts-box { min-height: 70px; margin: 4px 0 14px; }
.code-input { font-size: 1.6rem !important; letter-spacing: .3em; max-width: 220px; text-align: center; font-variant-numeric: tabular-nums; }
.dev-code { background: var(--warn-soft); color: var(--warn); padding: 8px 12px; border-radius: 8px; font-size: .9rem; }
.notice { padding: 10px 12px; border-radius: 8px; background: var(--danger-soft); color: var(--danger); margin-bottom: 12px; }
.notice.info { background: var(--brand-soft); color: var(--ink); }

/* ---------------------------------------------------------------- layout: sidebar + page */
#main { min-width: 0; }
body.signed-in .wrap { max-width: 1140px; }
body.signed-in .shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: 32px; align-items: start; }
.sidebar { position: sticky; top: 16px; margin: 28px 0; max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 10px; }
.side-title { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 2px 10px 8px; }
.side-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 2px; }
.side-list li { position: relative; }
.side-link { display: block; padding: 9px 40px 9px 10px; border-radius: 8px; border-left: 3px solid transparent; text-decoration: none; color: var(--ink); }
.side-list li:hover .side-link:not([aria-current]) { background: var(--bg); }
/* Trash button: hidden until the row is hovered or the button has keyboard focus. */
.side-remove { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 30px; height: 30px;
  padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--ink-2); cursor: pointer; opacity: 0; transition: opacity .12s; }
.side-list li:hover .side-remove, .side-remove:focus-visible { opacity: 1; }
.side-remove:hover { background: var(--danger-soft); color: var(--danger); }
/* Touch screens have no hover: show it on the open strategy. */
@media (hover: none) { .side-list li.current .side-remove { opacity: 1; } }
.side-link[aria-current=page] { background: var(--brand-soft); border-left-color: var(--brand); }
.side-name { display: block; font-weight: 600; line-height: 1.3; }
.side-status { display: flex; align-items: center; gap: 4px; font-size: .8rem; color: var(--muted); margin-top: 1px; }
.side-status.done { color: var(--ok); font-weight: 600; }
.side-empty { color: var(--muted); font-size: .875rem; margin: 0 10px 12px; }
.side-add { width: 100%; }
.side-summary { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 9px 10px; border-radius: 8px; border-left: 3px solid transparent;
  font-weight: 600; color: var(--ink); text-decoration: none; border-top: 1px solid var(--line); }
.side-summary:hover { background: var(--bg); }
.side-summary[aria-current=page] { background: var(--brand-soft); border-left-color: var(--brand); }
.side-faq { display: block; margin: 10px 10px 2px; font-size: .85rem; }

/* ---------------------------------------------------------------- adding a strategy */
.choices { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 10px; }
.choice { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; text-align: left; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; }
.choice:hover { border-color: var(--brand-2); background: #f7fbfc; }
.choice strong { display: block; }
.choice .summary { display: block; font-size: .875rem; color: var(--ink-2); margin-top: 2px; }
.choice-add { flex: none; font-weight: 600; font-size: .85rem; color: var(--brand); border: 1px solid var(--brand); border-radius: 8px; padding: 5px 12px; white-space: nowrap; }
.choice:hover .choice-add { background: var(--brand); color: #fff; }
.dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(640px, calc(100% - 32px)); max-height: calc(100vh - 48px);
  color: var(--ink); background: var(--bg); box-shadow: 0 20px 60px rgba(20, 35, 45, .3); }
.dialog::backdrop { background: rgba(20, 35, 45, .45); }
.dialog-body { padding: 20px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 4px; }
.dialog-head h2 { margin: 0; }
.dialog .choices { margin: 12px 0 0; }
.icon-btn { background: none; border: 0; font: inherit; font-size: 1.6rem; line-height: 1; width: 36px; height: 36px; border-radius: 8px; cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { background: var(--line); }
.dialog.confirm { width: min(440px, calc(100% - 32px)); background: var(--surface); }
.dialog.confirm h2 { margin-bottom: 8px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* ---------------------------------------------------------------- strategy page */
.strat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.strat-head h1 { margin: 0; display: flex; align-items: center; gap: 10px; }
.strat-head .big-check { width: 28px; height: 28px; }
/* Reading material: its own warm panel with the documents as buttons, so it stands out. */
.reading { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; background: #fbf6ec; border: 1px solid #ecdcb6;
  border-radius: var(--radius); padding: 12px 14px; margin: 6px 0 14px; }
.reading-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: #6b4f1d; }
.reading-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.doc-link { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid #dfcb9c; border-radius: 999px;
  padding: 5px 12px; color: var(--ink); font-weight: 600; font-size: .9rem; text-decoration: none; white-space: nowrap; }
.doc-link svg { color: #8a6420; flex: none; }
.doc-link:hover { border-color: #b5893b; background: #fffaf0; }
.doc-link .fmt { font-size: .68rem; font-weight: 700; letter-spacing: .03em; background: #f3e7cc; color: #6b4f1d; border-radius: 4px; padding: 1px 5px; }
.related { font-size: .875rem; color: var(--ink-2); margin-bottom: 12px; }
.form-card { margin-top: 16px; }
.form-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.form-card-head h2 { margin: 0; font-size: 1.1rem; }
.doc-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; }
.doc-row + .doc-row { border-top: 1px dashed var(--line); }
.doc-row .name { flex: 1 1 200px; min-width: 0; }
.doc-row .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-left: 6px; }
.row-delete { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer; }
.row-delete:hover { background: var(--danger-soft); color: var(--danger); border-color: #e2b8b3; }
.empty { color: var(--muted); font-size: .9rem; padding: 4px 0; }
.template-link { margin: 8px 0 0; color: var(--ink-2); }

/* ---------------------------------------------------------------- worksheet */
.back { display: inline-block; margin-bottom: 14px; }
.doc-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.doc-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 16px; }
.save-state { font-size: .875rem; color: var(--muted); }
.save-state.error { color: var(--danger); }
.done-banner { display: flex; gap: 10px; align-items: center; background: var(--ok-soft); color: var(--ok); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; font-weight: 600; }
.done-banner span { font-weight: 400; color: var(--ink-2); }
.doc-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.doc-actions .hint { font-size: .875rem; color: var(--muted); }
.prose h2 { margin-top: 1.4rem; }

/* ---------------------------------------------------------------- year-end summary, new year, FAQ */
.summary-row { margin-bottom: 12px; }
.summary-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.summary-head h2 { font-size: 1.1rem; margin: 0; }
.summary-head h2 a { color: var(--ink); text-decoration: none; }
.summary-head h2 a:hover { text-decoration: underline; }
.summary-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.summary-fields .field { margin-bottom: 4px; }
.year-banner { border: 2px solid var(--brand-2); }
.year-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.faq-item { padding: 0; }
.faq-item summary { cursor: pointer; padding: 16px 20px; list-style-position: outside; }
.faq-item summary h2 { display: inline; font-size: 1.05rem; margin: 0; }
.faq-item > p { padding: 0 20px; }
.faq-item > p:last-child { padding-bottom: 16px; margin-bottom: 0; }

/* Narrow screens: the sidebar becomes a row of tabs above the page. */
@media (max-width: 860px) {
  body.signed-in .shell { display: block; }
  .sidebar { position: static; margin: 12px 0 0; max-height: none; padding: 8px; display: flex; align-items: center; gap: 8px; overflow: visible; }
  .side-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .side-list { display: flex; gap: 6px; margin: 0; flex: 1 1 auto; min-width: 0; overflow-x: auto; padding: 3px; scrollbar-width: none; }
  .side-list::-webkit-scrollbar { display: none; }
  .side-list li { flex: none; }
  .side-link { display: flex; align-items: center; gap: 6px; white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; }
  .side-link[aria-current=page] { border-color: var(--brand); }
  .side-remove { display: none; }
  .side-list li.current .side-remove { display: grid; opacity: 1; right: 5px; width: 26px; height: 26px; }
  .side-list li.current .side-link { padding-right: 34px; }
  .side-name { font-size: .9rem; }
  .side-status { display: none; }
  .side-status.done { display: flex; font-size: 0; margin: 0; }
  .side-add { width: auto; flex: none; white-space: nowrap; border-radius: 999px; min-height: 36px; padding: 5px 14px; }
  .side-add-more { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .side-empty { margin: 0 auto 0 6px; white-space: nowrap; }
  .side-summary { flex: none; margin: 0; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; white-space: nowrap; font-size: .9rem; }
  .side-summary[aria-current=page] { border-color: var(--brand); }
  .side-faq { display: none; }
  #main { padding-top: 20px; }
}
/* Phones: the strategy tabs get a full row, with Add and Year-end summary below, so the
   two buttons can't squeeze the strategy names out of view. */
@media (max-width: 600px) {
  .sidebar { flex-wrap: wrap; }
  .side-list { flex: 1 1 100%; }
}

@media (max-width: 720px) {
  .signin { grid-template-columns: 1fr; }
  /* Grids become a stack of small cards, one per row, each cell with its own label. */
  .grid { min-width: 0; }
  .grid thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .grid, .grid tbody, .grid tr, .grid td { display: block; width: auto !important; }
  .grid tr { position: relative; padding: 8px 44px 8px 8px; border-bottom: 1px solid var(--line); }
  .grid tr:last-child { border-bottom: 0; }
  .grid td { border: 0; padding: 3px 0; }
  .grid td[data-label]::before { content: attr(data-label); display: block; font-size: .8rem; font-weight: 600; color: var(--ink-2); margin-bottom: 2px; }
  .grid td.row-remove { position: absolute; top: 8px; right: 6px; padding: 0; }
  .grid-wrap { overflow-x: visible; }
  .summary-fields { grid-template-columns: 1fr; }
  .brand-text small { display: none; }
  .account .who { display: none; }
  .card { padding: 16px; }
}
