/* Invest (/invest), docs/invest-plan.md phase 2, layout docs/web-layout-spec.md frame 3k.
   Loaded after shell.css and pages.css. Every selector sits under body.iv or an .iv- class
   (test/invest-css-scope.test.js); no shell token is redefined, the page's own colours are the
   --iv-* tokens. Dark by default (the site's default), light from the OS or Settings, as in
   shell.css. Reading text follows the site's size (18 / 20 px); labels, axis text, pills, tags
   and table heads 14 px or more; KPI labels, sub-lines, notes and folds 16 px. */

/* ---------- tokens (dark) ---------- */
body.iv {
  --iv-pos: #6ecf9d;
  --iv-neg: #ff7b6b;
  --iv-current: #5fbfa3;
  --iv-target: #9a8f78;
  --iv-band: rgba(110, 207, 157, 0.14);
  --iv-gold: #d9a66b;
  --iv-rust: #e08a5c;
  --iv-blue: #7fb0e6;
  --iv-slate: #a4acb8;
  --iv-grid: #343a45;
  --iv-bar: #272c35;
  --iv-zone-starter: #24453a;
  --iv-zone-full: #2f5a4a;
  --iv-zone-full-edge: #b5ecd0;
  --iv-area-op: 0.2;

  --iv-role-core-compounder-fg: #8fd6bd; --iv-role-core-compounder-bd: #3d6b5d; --iv-role-core-compounder-bg: #1c302a;
  --iv-role-compounder-fg: #9cc3ef; --iv-role-compounder-bd: #3c5675; --iv-role-compounder-bg: #1c2736;
  --iv-role-value-with-traps-fg: #e3b88a; --iv-role-value-with-traps-bd: #6b5236; --iv-role-value-with-traps-bg: #2e2519;
  --iv-role-option-fg: #cfa6ea; --iv-role-option-bd: #5c4370; --iv-role-option-bg: #2a2133;
  --iv-role-bond-fg: #a9c3d8; --iv-role-bond-bd: #46596a; --iv-role-bond-bg: #1f2730;
  --iv-role-watchlist-fg: #8fd3e6; --iv-role-watchlist-bd: #3a6370; --iv-role-watchlist-bg: #1b2b31;
  --iv-role-needs-thesis-fg: #ff9d8f; --iv-role-needs-thesis-bd: #74392f; --iv-role-needs-thesis-bg: #33201d;

  --iv-st-intact-fg: #7fd6a2; --iv-st-intact-bd: #33594a; --iv-st-intact-bg: #1b2f25;
  --iv-st-strengthening-fg: #8fd6bd; --iv-st-strengthening-bd: #3d6b5d; --iv-st-strengthening-bg: #1c302a;
  --iv-st-weakening-fg: #f2c879; --iv-st-weakening-bd: #6b5527; --iv-st-weakening-bg: #2f2814;
  --iv-st-broken-fg: #ff9d8f; --iv-st-broken-bd: #74392f; --iv-st-broken-bg: #33201d;
  --iv-st-under-review-fg: #c0c6cf; --iv-st-under-review-bd: #4a5261; --iv-st-under-review-bg: #272c35;
}

/* ---------- tokens (light: the OS, unless Settings says dark; or Settings says light) ---------- */
@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) body.iv {
    --iv-pos: #2d7a55;
    --iv-neg: #b8382b;
    --iv-current: #2f5d50;
    --iv-target: #a08c66;
    --iv-band: rgba(45, 122, 85, 0.10);
    --iv-gold: #8f6236;
    --iv-rust: #88451f;
    --iv-blue: #3a6ea5;
    --iv-slate: #5d6572;
    --iv-grid: #e3dfd5;
    --iv-bar: #f3efe6;
    --iv-zone-starter: #dcebe2;
    --iv-zone-full: #c3dfcd;
    --iv-zone-full-edge: #1f5c39;
    --iv-area-op: 0.12;

    --iv-role-core-compounder-fg: #2f5d50; --iv-role-core-compounder-bd: #bcd4cb; --iv-role-core-compounder-bg: #eef5f1;
    --iv-role-compounder-fg: #3a6ea5; --iv-role-compounder-bd: #c3d6ea; --iv-role-compounder-bg: #eef3f9;
    --iv-role-value-with-traps-fg: #8a5c33; --iv-role-value-with-traps-bd: #e3d2bd; --iv-role-value-with-traps-bg: #f7efe3;
    --iv-role-option-fg: #7a3fa0; --iv-role-option-bd: #dcc8e8; --iv-role-option-bg: #f5eef9;
    --iv-role-bond-fg: #41607a; --iv-role-bond-bd: #c2d2de; --iv-role-bond-bg: #eef3f7;
    --iv-role-watchlist-fg: #2d6b80; --iv-role-watchlist-bd: #bfdbe4; --iv-role-watchlist-bg: #ecf5f8;
    --iv-role-needs-thesis-fg: #b4361f; --iv-role-needs-thesis-bd: #e6c3bc; --iv-role-needs-thesis-bg: #f9efee;

    --iv-st-intact-fg: #2f7a4f; --iv-st-intact-bd: #bcd9c6; --iv-st-intact-bg: #eef6f0;
    --iv-st-strengthening-fg: #2f5d50; --iv-st-strengthening-bd: #bcd4cb; --iv-st-strengthening-bg: #eef5f1;
    --iv-st-weakening-fg: #8a5d0c; --iv-st-weakening-bd: #e6d6a8; --iv-st-weakening-bg: #f9f3e2;
    --iv-st-broken-fg: #b4361f; --iv-st-broken-bd: #e6c3bc; --iv-st-broken-bg: #f9efee;
    --iv-st-under-review-fg: #575c63; --iv-st-under-review-bd: #d6d6d6; --iv-st-under-review-bg: #f1f1f1;
  }
}
html[data-theme="light"] body.iv {
  --iv-pos: #2d7a55;
  --iv-neg: #b8382b;
  --iv-current: #2f5d50;
  --iv-target: #a08c66;
  --iv-band: rgba(45, 122, 85, 0.10);
  --iv-gold: #8f6236;
  --iv-rust: #88451f;
  --iv-blue: #3a6ea5;
  --iv-slate: #5d6572;
  --iv-grid: #e3dfd5;
  --iv-bar: #f3efe6;
  --iv-zone-starter: #dcebe2;
  --iv-zone-full: #c3dfcd;
  --iv-zone-full-edge: #1f5c39;
  --iv-area-op: 0.12;

  --iv-role-core-compounder-fg: #2f5d50; --iv-role-core-compounder-bd: #bcd4cb; --iv-role-core-compounder-bg: #eef5f1;
  --iv-role-compounder-fg: #3a6ea5; --iv-role-compounder-bd: #c3d6ea; --iv-role-compounder-bg: #eef3f9;
  --iv-role-value-with-traps-fg: #8a5c33; --iv-role-value-with-traps-bd: #e3d2bd; --iv-role-value-with-traps-bg: #f7efe3;
  --iv-role-option-fg: #7a3fa0; --iv-role-option-bd: #dcc8e8; --iv-role-option-bg: #f5eef9;
  --iv-role-bond-fg: #41607a; --iv-role-bond-bd: #c2d2de; --iv-role-bond-bg: #eef3f7;
  --iv-role-watchlist-fg: #2d6b80; --iv-role-watchlist-bd: #bfdbe4; --iv-role-watchlist-bg: #ecf5f8;
  --iv-role-needs-thesis-fg: #b4361f; --iv-role-needs-thesis-bd: #e6c3bc; --iv-role-needs-thesis-bg: #f9efee;

  --iv-st-intact-fg: #2f7a4f; --iv-st-intact-bd: #bcd9c6; --iv-st-intact-bg: #eef6f0;
  --iv-st-strengthening-fg: #2f5d50; --iv-st-strengthening-bd: #bcd4cb; --iv-st-strengthening-bg: #eef5f1;
  --iv-st-weakening-fg: #8a5d0c; --iv-st-weakening-bd: #e6d6a8; --iv-st-weakening-bg: #f9f3e2;
  --iv-st-broken-fg: #b4361f; --iv-st-broken-bd: #e6c3bc; --iv-st-broken-bg: #f9efee;
  --iv-st-under-review-fg: #575c63; --iv-st-under-review-bd: #d6d6d6; --iv-st-under-review-bg: #f1f1f1;
}

/* ---------- the shell's small type, at least 14 px on this page ---------- */
body.iv .source { font-size: 14px; }
body.iv .pill, body.iv .badge { font-size: 14px; }
body.iv .table th { font-size: 14px; }
body.iv .seg button { min-height: var(--tap); font-size: 16px; padding: var(--s1) var(--s4); }
body.iv .page-footer { font-size: 16px; margin-top: var(--s4); max-width: var(--measure); }
body.iv .page-footer + .page-footer { margin-top: var(--s2); }

/* ---------- header ---------- */
body.iv .iv-head { align-items: flex-start; }
body.iv .iv-head .page-sub { font-size: 1em; }
body.iv .iv-back { margin: 0 0 var(--s1); }
body.iv .iv-back-link { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--muted); text-decoration: none; font-size: 16px; }
body.iv .iv-back-link:hover { color: var(--text); }
body.iv .iv-pills { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin: var(--s2) 0 0; }
body.iv .iv-note { color: var(--muted); font-size: 16px; margin: var(--s1) 0 0; }
body.iv .iv-head-right { display: none; flex-direction: column; align-items: flex-end; gap: var(--s1); margin-left: auto; text-align: right; }
body.iv .iv-head-right .page-user { margin-left: 0; }
body.iv .iv-note-wide { max-width: 22rem; }
@media (min-width: 900px) {
  body.iv .iv-head-right { display: flex; }
  body.iv .iv-note-phone { display: none; }
}

/* ---------- view tabs: whole labels, never a sideways strip ----------
   Seven tabs: 2 and 3 columns with Upload across the last row; 4 columns from 900 px
   (Upload across two); one row of seven from 1400 px, where every label fits. */
body.iv .iv-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
body.iv .iv-tabs button { width: 100%; justify-content: center; font-size: 1em; }
body.iv .iv-tabs button[data-tab="upload"] { grid-column: 1 / -1; }
@media (min-width: 600px) {
  body.iv .iv-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  body.iv .iv-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  body.iv .iv-tabs button[data-tab="upload"] { grid-column: span 2; }
}
@media (min-width: 1400px) {
  body.iv .iv-tabs { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  body.iv .iv-tabs button[data-tab="upload"] { grid-column: auto; }
}

/* ---------- banners ---------- */
body.iv .iv-banner {
  background: var(--accent-soft); border: 1px solid var(--accent); color: var(--text);
  border-radius: var(--radius-sm); padding: var(--s3) var(--s4); margin-bottom: var(--s4);
  font-size: 1em; line-height: 1.5; max-width: var(--measure);
}
body.iv .iv-notice-warn { background: transparent; border-color: var(--warn); }
body.iv .iv-notice-link { color: var(--text); font-weight: 600; white-space: nowrap; }
body.iv .iv-notice-bad { background: var(--danger-soft); border-color: var(--danger); }
body.iv .banner-error ul { margin: 0 0 var(--s2); }
body.iv .banner-error p:last-child { margin-bottom: 0; }

/* ---------- colours of numbers ---------- */
body.iv .iv-pos { color: var(--iv-pos); }
body.iv .iv-neg { color: var(--iv-neg); }
body.iv .iv-warn { color: var(--warn); }
body.iv .iv-muted { color: var(--muted); }
body.iv .iv-strong { font-weight: 600; }
body.iv .iv-num { text-align: right; font-variant-numeric: tabular-nums; }
body.iv .iv-view { font-variant-numeric: tabular-nums; }

/* ---------- rows of cards ---------- */
body.iv .iv-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); align-items: stretch; margin-bottom: var(--s4); }
body.iv .iv-row > .card { margin-bottom: 0; }
@media (max-width: 899px) {
  body.iv .iv-r-act .iv-attn { order: -1; }
}
@media (min-width: 900px) {
  body.iv .iv-r-act, body.iv .iv-r-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.iv .iv-r-alloc { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.iv .iv-r-alloc > .iv-sectors { grid-column: 1 / -1; }
}
@media (min-width: 1100px) {
  body.iv .iv-r-act { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
  body.iv .iv-r-alloc { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 1fr); }
  body.iv .iv-r-alloc > .iv-sectors { grid-column: auto; }
}

/* ---------- KPI tiles ---------- */
body.iv .iv-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); margin-bottom: var(--s4); }
@media (min-width: 900px) {
  body.iv .iv-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
body.iv .iv-kpi { display: flex; flex-direction: column; gap: var(--s1); }
body.iv .iv-kpi-label { color: var(--muted); font-size: 16px; line-height: 1.4; }
body.iv .iv-kpi-value { font-size: 28px; line-height: 1.2; color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
body.iv .iv-kpi-sub { color: var(--muted); font-size: 16px; line-height: 1.4; overflow-wrap: anywhere; }
body.iv .iv-line { display: block; }
/* pages.css sets .tile span to 0.8em: a span in a tile keeps the tile's own size here. */
body.iv .iv-kpi span { font-size: inherit; }

/* ---------- tables, lists, folds ---------- */
body.iv .iv-only-narrow { display: none; }
@media (max-width: 899px) {
  body.iv .iv-only-wide { display: none; }
  body.iv .iv-only-narrow { display: block; }
  /* The narrow tables that stay tables on a phone: heads may wrap. */
  body.iv .table th { white-space: normal; }
}
body.iv .card .table-scroll { margin: 0 0 var(--s2); }
body.iv .table td { font-variant-numeric: tabular-nums; }
body.iv .card .table th, body.iv .card .table td { padding: var(--s2) 6px; }
body.iv .card .table th:first-child, body.iv .card .table td:first-child { padding-left: 0; }
body.iv .table td.iv-wrap, body.iv .table th.iv-wrap { white-space: normal; overflow-wrap: break-word; min-width: 5em; }
body.iv .table tr.iv-total td { border-top: 2px solid var(--line); }
body.iv .table tr.iv-sep td { padding-top: var(--s3); }
body.iv .iv-sub { display: block; color: var(--muted); font-size: 16px; }
body.iv .iv-sort {
  background: none; border: 0; padding: 0; margin: 0; color: inherit; font: inherit; font-size: 14px;
  min-height: 36px; cursor: pointer; text-align: inherit; white-space: nowrap;
}
body.iv .iv-sort:hover { color: var(--text); }
body.iv .table th[aria-sort] { color: var(--text); }
body.iv .iv-rowlink { cursor: pointer; }
body.iv tr.iv-rowlink td { min-height: var(--tap); padding-top: var(--s3); padding-bottom: var(--s3); }
body.iv tr.iv-rowlink:hover td { background: var(--surface-2); }
body.iv .iv-list { list-style: none; padding: 0; margin: 0 0 var(--s2); }
body.iv .iv-li { border-top: 1px solid var(--line-soft); padding: var(--s2) 0; min-width: 0; overflow-wrap: anywhere; }
body.iv .iv-li:first-child { border-top: 0; }
body.iv .iv-li-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); }
body.iv .iv-li-main { min-width: 0; flex: 1; }
body.iv .iv-li-sub { color: var(--muted); font-size: 16px; }
body.iv a.iv-li-main { color: var(--text); text-decoration: none; }
body.iv .iv-fold { margin: var(--s2) 0; }
body.iv .iv-fold > summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; font-size: 16px; color: var(--accent); }
body.iv .iv-fold .table-scroll { margin-top: var(--s2); }
body.iv .iv-more { margin: var(--s2) 0; }
body.iv .iv-foot, body.iv .iv-note-line { color: var(--muted); font-size: 16px; margin: var(--s2) 0 0; max-width: var(--measure); }
body.iv .iv-note-line.iv-strong { color: var(--text); }
body.iv .iv-bullets { margin: var(--s2) 0; padding-left: 1.3em; max-width: var(--measure); }
body.iv .iv-okline { margin: 0; }

/* ---------- toolbars, chips, filters ---------- */
body.iv .iv-toolbar { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-bottom: var(--s3); }
body.iv .iv-search { width: 240px; max-width: 100%; font-size: max(16px, 1em); }
/* Companies and Ledger: room for their longer placeholders (the phone rule below still wins). */
body.iv .iv-search-lg { width: 20rem; }
body.iv .iv-sortsel { width: auto; font-size: max(16px, 1em); }
body.iv .iv-chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s3); }
body.iv .iv-chip {
  min-height: var(--tap); padding: var(--s1) var(--s3); border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 16px; cursor: pointer;
}
body.iv .iv-chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
body.iv .iv-seg { margin-bottom: var(--s3); flex-wrap: wrap; align-self: flex-start; }
body.iv .iv-filters > summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; font-size: 16px; color: var(--accent); }
body.iv .iv-field { display: flex; flex-direction: column; gap: var(--s1); margin-bottom: var(--s3); max-width: 24rem; }
body.iv .iv-field > span { color: var(--muted); font-size: 16px; }
body.iv .iv-field .select { font-size: max(16px, 1em); }
@media (min-width: 900px) {
  body.iv .iv-sortsel { display: none; }
  body.iv .iv-filters > summary { display: none; }
}
@media (max-width: 899px) {
  body.iv .iv-search { width: 100%; flex: 1 1 100%; }
  body.iv .iv-sortsel { flex: 1 1 100%; }
}

/* ---------- pills and tags ---------- */
body.iv .iv-role, body.iv .iv-st {
  display: inline-block; font-size: 14px; font-weight: 600; line-height: 1.4; border: 1px solid; border-radius: var(--radius-sm);
  padding: 2px 10px; white-space: nowrap; vertical-align: middle;
}
body.iv .iv-pill { font-size: 14px; }
body.iv .iv-role-core-compounder { color: var(--iv-role-core-compounder-fg); border-color: var(--iv-role-core-compounder-bd); background: var(--iv-role-core-compounder-bg); }
body.iv .iv-role-compounder { color: var(--iv-role-compounder-fg); border-color: var(--iv-role-compounder-bd); background: var(--iv-role-compounder-bg); }
body.iv .iv-role-value-with-traps { color: var(--iv-role-value-with-traps-fg); border-color: var(--iv-role-value-with-traps-bd); background: var(--iv-role-value-with-traps-bg); }
body.iv .iv-role-option { color: var(--iv-role-option-fg); border-color: var(--iv-role-option-bd); background: var(--iv-role-option-bg); }
body.iv .iv-role-bond { color: var(--iv-role-bond-fg); border-color: var(--iv-role-bond-bd); background: var(--iv-role-bond-bg); }
body.iv .iv-role-watchlist { color: var(--iv-role-watchlist-fg); border-color: var(--iv-role-watchlist-bd); background: var(--iv-role-watchlist-bg); }
body.iv .iv-role-needs-thesis { color: var(--iv-role-needs-thesis-fg); border-color: var(--iv-role-needs-thesis-bd); background: var(--iv-role-needs-thesis-bg); }
body.iv .iv-role-other { color: var(--iv-st-under-review-fg); border-color: var(--iv-st-under-review-bd); background: var(--iv-st-under-review-bg); }
body.iv .iv-st-intact { color: var(--iv-st-intact-fg); border-color: var(--iv-st-intact-bd); background: var(--iv-st-intact-bg); }
body.iv .iv-st-strengthening { color: var(--iv-st-strengthening-fg); border-color: var(--iv-st-strengthening-bd); background: var(--iv-st-strengthening-bg); }
body.iv .iv-st-weakening { color: var(--iv-st-weakening-fg); border-color: var(--iv-st-weakening-bd); background: var(--iv-st-weakening-bg); }
body.iv .iv-st-broken { color: var(--iv-st-broken-fg); border-color: var(--iv-st-broken-bd); background: var(--iv-st-broken-bg); }
body.iv .iv-st-under-review { color: var(--iv-st-under-review-fg); border-color: var(--iv-st-under-review-bd); background: var(--iv-st-under-review-bg); }
/* An active chip is its pill: the chip keeps its 44 px target. */
body.iv .iv-chip.iv-role, body.iv .iv-chip.iv-st { font-size: 16px; padding: var(--s1) var(--s3); }
body.iv .iv-tag {
  display: inline-block; font-size: 14px; font-weight: 600; line-height: 1.4; border: 1px solid; border-radius: var(--radius-sm);
  padding: 1px 8px; white-space: nowrap; vertical-align: middle;
}
body.iv .iv-tag-buy { color: var(--iv-st-intact-fg); border-color: var(--iv-st-intact-bd); background: var(--iv-st-intact-bg); }
body.iv .iv-tag-sell { color: var(--iv-st-broken-fg); border-color: var(--iv-st-broken-bd); background: var(--iv-st-broken-bg); }
body.iv .iv-tag-div { color: var(--iv-role-compounder-fg); border-color: var(--iv-role-compounder-bd); background: var(--iv-role-compounder-bg); }
body.iv .iv-tag-cash { color: var(--iv-role-value-with-traps-fg); border-color: var(--iv-role-value-with-traps-bd); background: var(--iv-role-value-with-traps-bg); }
body.iv .iv-tag-other { color: var(--iv-st-under-review-fg); border-color: var(--iv-st-under-review-bd); background: var(--iv-st-under-review-bg); }

/* ---------- Needs attention ---------- */
body.iv .iv-flags { list-style: none; padding: 0; margin: 0; }
body.iv .iv-flag { border-top: 1px solid var(--line-soft); padding: var(--s2) 0; max-width: var(--measure); overflow-wrap: anywhere; }
body.iv .iv-flag:first-child { border-top: 0; }
body.iv .iv-flag-head { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
body.iv .iv-flag-ev { font-size: 1em; }
body.iv .iv-flag-fix { color: var(--muted); font-size: 16px; }

/* ---------- Market move ---------- */
body.iv .iv-headline { font-size: 20px; margin: 0 0 var(--s3); }
body.iv .iv-move-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
@media (min-width: 900px) {
  body.iv .iv-move-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
}
body.iv .iv-axis-title { color: var(--muted); font-size: 14px; margin: var(--s1) 0 0; }
body.iv .iv-tie { margin: var(--s2) 0 0; font-weight: 600; }

/* ---------- charts ---------- */
body.iv .iv-chart { width: 100%; min-width: 0; }
body.iv .iv-svg { display: block; max-width: none; overflow: visible; font-family: var(--font); }
body.iv .iv-svg text { font-size: 14px; fill: var(--muted); }
body.iv .iv-svg .iv-t { fill: var(--text); }
body.iv .iv-svg .iv-t-axis { fill: var(--muted); }
/* Value labels on the allocation bars: a halo in the card's colour, so a band edge or a grid
   line behind a label never cuts a glyph. */
body.iv .iv-svg .iv-val { paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
body.iv .iv-svg .iv-t-muted { fill: var(--muted); }
body.iv .iv-svg .iv-t-name { fill: var(--text); font-size: 16px; }
body.iv .iv-svg .iv-t-warn { fill: var(--warn); }
body.iv .iv-svg .iv-t-neg { fill: var(--iv-neg); }
body.iv .iv-svg .iv-t-big { fill: var(--text); font-size: 28px; }
body.iv .iv-svg .iv-t-sub { fill: var(--muted); font-size: 16px; }
body.iv .iv-svg .iv-grid { stroke: var(--iv-grid); stroke-width: 1; }
body.iv .iv-svg .iv-zero { stroke: var(--line); stroke-width: 1; }
body.iv .iv-svg .iv-limit { stroke: var(--iv-neg); stroke-width: 1; stroke-dasharray: 4 3; }
body.iv .iv-svg .iv-band-edge { stroke: var(--iv-target); stroke-width: 1; stroke-dasharray: 4 3; }
body.iv .iv-svg .iv-tick { stroke: var(--text); stroke-width: 2; }
body.iv .iv-svg .iv-line-gold { fill: none; stroke: var(--iv-gold); stroke-width: 2; }
body.iv .iv-svg .iv-line-current { fill: none; stroke: var(--iv-current); stroke-width: 2; }
body.iv .iv-svg .iv-area { fill: var(--iv-current); fill-opacity: var(--iv-area-op); }
body.iv .iv-svg .iv-arc { stroke: var(--surface); stroke-width: 2; }
body.iv .iv-svg a { cursor: pointer; }
body.iv .iv-f-pos { fill: var(--iv-pos); background: var(--iv-pos); }
body.iv .iv-f-neg { fill: var(--iv-neg); background: var(--iv-neg); }
body.iv .iv-f-zero { fill: var(--line); background: var(--line); }
body.iv .iv-f-current { fill: var(--iv-current); background: var(--iv-current); }
body.iv .iv-f-target { fill: var(--iv-target); background: var(--iv-target); }
body.iv .iv-f-band { fill: var(--iv-band); background: var(--iv-band); }
body.iv .iv-f-gold { fill: var(--iv-gold); background: var(--iv-gold); }
body.iv .iv-f-rust { fill: var(--iv-rust); background: var(--iv-rust); }
body.iv .iv-f-blue { fill: var(--iv-blue); background: var(--iv-blue); }
body.iv .iv-f-slate { fill: var(--iv-slate); background: var(--iv-slate); }
body.iv .iv-bub { fill-opacity: 0.8; stroke-width: 1.5; }
body.iv .iv-b-intact { fill: var(--iv-st-intact-fg); stroke: var(--iv-st-intact-fg); background: var(--iv-st-intact-fg); }
body.iv .iv-b-strengthening { fill: var(--iv-st-strengthening-fg); stroke: var(--iv-st-strengthening-fg); background: var(--iv-st-strengthening-fg); }
body.iv .iv-b-weakening { fill: var(--iv-st-weakening-fg); stroke: var(--iv-st-weakening-fg); background: var(--iv-st-weakening-fg); }
body.iv .iv-b-broken { fill: var(--iv-st-broken-fg); stroke: var(--iv-st-broken-fg); background: var(--iv-st-broken-fg); }
body.iv .iv-b-under-review { fill: var(--iv-st-under-review-fg); stroke: var(--iv-st-under-review-fg); background: var(--iv-st-under-review-fg); }
body.iv .iv-legend { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); font-size: 14px; color: var(--muted); margin: var(--s2) 0 0; max-width: none; }
body.iv .iv-legend-item { display: inline-flex; align-items: center; gap: var(--s1); }
body.iv .iv-sw { display: inline-block; width: 12px; height: 12px; border-radius: 2px; flex: none; }
body.iv .iv-sw-band { border: 1px dashed var(--iv-target); }
body.iv .iv-sw-dot { border-radius: 50%; }
body.iv .iv-sw-line { width: 3px; height: 14px; border-radius: 0; }
body.iv .iv-sw-now { background: var(--iv-neg); }
body.iv .iv-sw-gate { background: none; border-left: 2px dashed var(--iv-gold); }
body.iv .iv-sw-zone-starter { background: var(--iv-zone-starter); border-right: 2px solid var(--iv-pos); }
body.iv .iv-sw-zone-full { background: var(--iv-zone-full); border-right: 2px solid var(--iv-zone-full-edge); }
body.iv .iv-ccy-legend { list-style: none; padding: 0; margin: var(--s2) 0 0; }
body.iv .iv-ccy-legend li { display: flex; align-items: center; gap: var(--s2); font-size: 16px; }

/* ---------- Thesis status ---------- */
body.iv .iv-th-list { list-style: none; padding: 0; margin: 0 0 var(--s3); }
body.iv .iv-th-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s1) 0; }
body.iv .iv-th-status { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
body.iv .iv-th-label { color: var(--muted); font-size: 16px; }

/* ---------- Performance ---------- */
body.iv .iv-xirr-big { margin: 0 0 var(--s3); }
body.iv .iv-xirr-rate { font-size: 40px; line-height: 1.1; font-weight: 600; }
body.iv .iv-totals { font-size: 16px; margin: 0 0 var(--s2); }

/* ---------- thesis block ---------- */
body.iv .iv-thesis {
  border-left: 4px solid var(--accent); background: var(--surface-2); border-radius: 0;
  padding: 8px 16px; margin: 0 0 var(--s3); max-width: var(--measure); overflow-wrap: anywhere;
}
body.iv .iv-thesis-lg { font-size: max(20px, 1.1em); margin-bottom: 0; }

/* ---------- company page ---------- */
body.iv .iv-co { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
body.iv .iv-co-col { display: contents; }
body.iv .iv-co .card { margin-bottom: 0; }
body.iv .iv-o1 { order: 1; }
body.iv .iv-o2 { order: 2; }
body.iv .iv-o3 { order: 3; }
body.iv .iv-o4 { order: 4; }
body.iv .iv-o5 { order: 5; }
body.iv .iv-o6 { order: 6; }
@media (min-width: 1100px) {
  body.iv .iv-co { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
  body.iv .iv-co-col { display: flex; flex-direction: column; gap: var(--s4); min-width: 0; }
  /* The narrower right column: a little more room for the trades table. */
  body.iv .iv-co-right .card { padding-left: var(--s4); padding-right: var(--s4); }
}
body.iv .iv-sec-h { font-size: 1em; font-weight: 600; color: var(--text); margin: var(--s4) 0 var(--s2); }
body.iv .iv-md { max-width: var(--measure); overflow-wrap: anywhere; overflow-x: auto; }
body.iv .iv-md p, body.iv .iv-md ul, body.iv .iv-md ol { margin: 0 0 var(--s2); }
body.iv .iv-md ul, body.iv .iv-md ol { padding-left: 1.3em; }
body.iv .iv-md h1, body.iv .iv-md h2, body.iv .iv-md h3, body.iv .iv-md h4 { font-size: 1em; font-weight: 600; color: var(--text); margin: var(--s3) 0 var(--s2); }
/* A table in an analysis or note scrolls inside its card instead of breaking words. */
body.iv .iv-md table { border-collapse: collapse; margin: 0 0 var(--s3); display: block; max-width: 100%; overflow-x: auto; }
body.iv .iv-md th, body.iv .iv-md td { overflow-wrap: normal; min-width: 7em; }
/* The view title takes the focus on a view change (for screen readers); no ring for that. */
body.iv .iv-title:focus { outline: none; }
body.iv .iv-md th, body.iv .iv-md td { border-bottom: 1px solid var(--line-soft); padding: var(--s1) var(--s2); text-align: left; vertical-align: top; }
body.iv .iv-md th { color: var(--muted); font-weight: 400; font-size: 16px; }
body.iv .iv-md code { font-size: 16px; }
body.iv .iv-md-inline { display: inline; }
body.iv .iv-md-inline p { display: inline; }
body.iv .iv-sources { margin-top: var(--s4); color: var(--muted); }
body.iv .iv-kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s1) var(--s4); margin: 0 0 var(--s3); }
body.iv .iv-kv dt { color: var(--muted); font-size: 16px; }
body.iv .iv-kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
body.iv .iv-trig { border-left: 4px solid var(--line); background: var(--surface-2); border-radius: 0; padding: var(--s2) var(--s4); margin: var(--s2) 0; }
body.iv .iv-trig-buy { border-left-color: var(--iv-pos); }
body.iv .iv-trig-sell { border-left-color: var(--iv-neg); }
body.iv .iv-trig-h { font-weight: 600; margin: 0; }
body.iv .iv-trig-buy .iv-trig-h { color: var(--iv-pos); }
body.iv .iv-trig-sell .iv-trig-h { color: var(--iv-neg); }
body.iv .iv-trig-label { color: var(--muted); font-size: 16px; margin: 0 0 var(--s1); }
body.iv .iv-trig-line { margin: var(--s1) 0; max-width: var(--measure); }
body.iv .iv-trig-k { font-weight: 600; }
body.iv .iv-timeline { list-style: none; margin: 0; padding: 0 0 0 var(--s4); border-left: 2px solid var(--line); margin-left: 6px; }
body.iv .iv-tl-item { position: relative; padding: 0 0 var(--s3); }
body.iv .iv-tl-item::before {
  content: ""; position: absolute; left: calc(-1 * var(--s4) - 7px); top: 0.45em;
  width: 12px; height: 12px; border-radius: 50%; background: var(--accent);
}
body.iv .iv-tl-date { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin: 0; }
body.iv .iv-tl-head { font-size: 1em; font-weight: 600; margin: var(--s1) 0; }

/* ---------- Watchlist ---------- */
body.iv .iv-watch-legend { margin: 0 0 var(--s3); font-size: 16px; }
body.iv .iv-watch-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
body.iv .iv-watch-grid .card { margin-bottom: 0; }
@media (min-width: 900px) {
  body.iv .iv-watch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
body.iv .iv-w-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s2) var(--s3); margin-bottom: var(--s3); }
body.iv .iv-w-title h2 { margin: 0; }
body.iv .iv-w-ids { margin: 0; font-size: 16px; }
body.iv .iv-w-pills { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: flex-start; }
body.iv .iv-w-price { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s2); margin: var(--s2) 0; }
body.iv .iv-wbar-wrap { margin: var(--s5) 0 var(--s2); }
body.iv .iv-wbar { position: relative; height: 32px; border-radius: var(--radius-sm); background: var(--iv-bar); border: 1px solid var(--line); }
body.iv .iv-wzone { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 2px 0 0 2px; }
body.iv .iv-wzone-starter { background: var(--iv-zone-starter); border-right: 2px solid var(--iv-pos); }
body.iv .iv-wzone-full { background: var(--iv-zone-full); border-right: 2px solid var(--iv-zone-full-edge); }
body.iv .iv-wgate { position: absolute; top: -2px; bottom: -2px; width: 0; border-left: 2px dashed var(--iv-gold); }
body.iv .iv-wprice { position: absolute; top: -6px; bottom: -6px; width: 2px; margin-left: -1px; background: var(--iv-neg); }
body.iv .iv-wnow {
  position: absolute; top: -30px; transform: translateX(-50%); font-size: 14px; font-weight: 700;
  color: var(--iv-neg); background: var(--surface); padding: 0 4px; line-height: 1.4; white-space: nowrap;
}
body.iv .iv-wlabels { display: flex; justify-content: space-between; gap: var(--s2); font-size: 14px; color: var(--muted); margin-top: var(--s1); }
body.iv .iv-w-dist { font-size: 16px; margin: var(--s2) 0; }
body.iv .iv-w-gate { font-size: 16px; color: var(--iv-gold); margin: var(--s2) 0; }
body.iv .iv-w-next { font-size: 16px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: var(--s2); margin: var(--s3) 0 var(--s2); }
body.iv .iv-w-next.iv-warn { color: var(--warn); }
body.iv .iv-w-link { margin: 0; }
body.iv .iv-w-link a { display: inline-flex; align-items: center; min-height: var(--tap); }

/* ---------- Ledger ---------- */
@media (min-width: 1100px) {
  /* The table scrolls inside its card, never past it (no sideways page scroll), at most the
     window's height; its head sticks to the top of that box while the rows scroll. */
  body.iv .iv-ledger-scroll { overflow: auto; max-height: calc(100vh - 48px); }
  body.iv .iv-ledger-table thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); }
}

/* ---------- Notes ---------- */
body.iv .iv-note-list { list-style: none; padding: 0; margin: 0; }
body.iv .iv-note-row { padding: var(--s2) 0; border-top: 1px solid var(--line-soft); }
body.iv .iv-note-link { padding: var(--s2) 0; min-height: var(--tap); align-items: center; }
/* The open note's row: the accent bar (pages.css) with room before the text. */
body.iv .iv-note-link[aria-current="true"] { padding-left: var(--s3); }
body.iv .iv-note-list li:first-child .iv-note-link, body.iv .iv-note-list li:first-child.iv-note-row { border-top: 0; }
body.iv .iv-back-notes { display: none; margin: 0 0 var(--s2); }
@media (max-width: 899px) {
  body.iv .iv-notes.iv-has-note .iv-notes-lists { display: none; }
  body.iv .iv-notes:not(.iv-has-note) .iv-notes-note { display: none; }
  body.iv .iv-back-notes { display: block; }
}

/* ---------- upload (#upload) and the Overview's inbox card (phase 3) ---------- */
body.iv .iv-r-up { margin-bottom: 0; }
body.iv .iv-up-col { display: flex; flex-direction: column; min-width: 0; }
@media (min-width: 1100px) {
  body.iv .iv-r-up { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}
body.iv .iv-up-banner { margin-bottom: var(--s4); }
body.iv .iv-note-line.iv-warn { color: var(--warn); }
body.iv .iv-steps { margin: 0 0 var(--s2); padding-left: 1.4em; max-width: var(--measure); line-height: 1.5; }
body.iv .iv-steps > li { margin-bottom: var(--s2); }
body.iv .iv-steps .iv-bullets { margin: var(--s1) 0 0; }
body.iv .iv-drop {
  border: 2px dashed var(--line); border-radius: var(--radius-sm); padding: var(--s4); margin: 0 0 var(--s3);
  text-align: center; color: var(--muted);
}
body.iv .iv-drop p { margin: 0 0 var(--s2); }
body.iv .iv-drop p:last-child { margin-bottom: 0; }
body.iv .iv-drop.iv-drop-on { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
body.iv .iv-up-pick { margin: 0 0 var(--s3); }
body.iv .iv-up-pick .btn { width: 100%; justify-content: center; }
/* Files dragged over the page: it shows it takes them (the Upload view uploads them in on mode). */
body.iv.iv-dragging .iv-root-drop { outline: 3px dashed var(--accent); outline-offset: -6px; }
/* The file input itself is hidden; its labels are the buttons (keyboard: the focus ring on them). */
body.iv .iv-up-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
body.iv .iv-up-card:focus-within label.btn { outline: 2px solid var(--accent); outline-offset: 2px; }
body.iv .iv-up-files { margin: var(--s2) 0; }
body.iv .iv-up-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s3) 0 0; }
body.iv .iv-up-actions .btn { min-height: var(--tap); }
body.iv .iv-up-wait { margin: var(--s3) 0 0; font-weight: 600; max-width: var(--measure); line-height: 1.5; }
body.iv .iv-up-err { color: var(--danger); margin: var(--s2) 0 0; max-width: var(--measure); line-height: 1.5; }
body.iv .iv-up-done { color: var(--text); margin: var(--s2) 0 0; max-width: var(--measure); line-height: 1.5; }
body.iv .iv-up-errors { border-left: 4px solid var(--danger); padding: var(--s1) 0 var(--s1) var(--s3); margin: var(--s3) 0 0; }
body.iv .iv-up-errors p { margin: 0; }
body.iv .iv-up-errors .iv-bullets { overflow-wrap: anywhere; }

/* ---------- Claude sessions (phase 4): Session writes, Accept edit, Start review ---------- */
body.iv .iv-lint-where { font-size: 16px; color: var(--muted); overflow-wrap: anywhere; }
body.iv .iv-lint-act { margin: var(--s2) 0 0; }
/* A missing quarter: its name, then Start review (wraps under it on a phone). */
body.iv .iv-note-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); }
body.iv .iv-note-row .iv-up-done, body.iv .iv-note-row .iv-up-err { flex-basis: 100%; }
body.iv .iv-flag .iv-review-start { margin-top: var(--s2); }

/* ---------- the quarter review on the site (#review/<Q>, phase 5; invest/review.js) ----------
   Reading text at the site's size (18 / 20 px), line height 1.5, lines of at most ~75
   characters; the card's question 20 px bold (22 px with the larger setting); chips are 44 px
   buttons at the reading size with a dot and the word (never colour alone). Wide (≥ 1100 px): the
   steps rail left, the card right (1 : 3); under 1100 the steps fold above the card. */
body.iv .iv-rv { min-width: 0; }
body.iv .iv-r-rv { margin-bottom: 0; }
body.iv .iv-rv-rail { display: none; }
body.iv .iv-rv-main { min-width: 0; display: flex; flex-direction: column; gap: var(--s4); }
body.iv .iv-rv-main > .card { margin-bottom: 0; }
body.iv .iv-rv-main > .iv-more { margin: 0; }
@media (min-width: 1100px) {
  body.iv .iv-r-rv { grid-template-columns: minmax(0, 1fr) minmax(0, 3fr); align-items: start; }
  body.iv .iv-rv-rail { display: flex; margin-bottom: 0; }
  body.iv .iv-rv-fold, body.iv .iv-rv-stepline { display: none; }
}
body.iv .iv-rv-stepline { font-size: 1em; line-height: 1.5; font-weight: 600; margin: 0 0 var(--s1); max-width: var(--measure); }
body.iv .iv-rv-fold { margin: 0 0 var(--s3); }
body.iv .iv-rv-note { font-size: 1em; line-height: 1.5; margin: 0 0 var(--s3); max-width: var(--measure); }
body.iv .iv-rv-noteline { margin: 0 0 var(--s3); }

/* The steps: one 44 px button per step and per card; the card shown has the accent bar. */
body.iv .iv-rv-steps, body.iv .iv-rv-sub, body.iv .iv-rv-own { list-style: none; padding: 0; margin: 0; }
body.iv .iv-rv-sub { padding-left: var(--s4); }
body.iv .iv-rv-steplabel { display: flex; align-items: center; gap: var(--s1); min-height: var(--tap); font-size: 1em; font-weight: 600; }
body.iv .iv-rv-go {
  display: flex; align-items: center; gap: var(--s1); width: 100%; min-height: var(--tap); padding: var(--s1) var(--s2);
  background: none; border: 0; border-left: 3px solid transparent; color: var(--text); font: inherit; font-size: 1em;
  line-height: 1.4; text-align: left; cursor: pointer; overflow-wrap: anywhere;
}
body.iv .iv-rv-go:hover { background: var(--surface-2); }
body.iv .iv-rv-go[aria-current="step"] { border-left-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
body.iv .iv-rv-mark { flex: none; width: 1.2em; text-align: center; color: var(--muted); }
body.iv .iv-rv-go[aria-current="step"] .iv-rv-mark { color: var(--accent); }
body.iv .iv-rv-skipped { color: var(--muted); font-size: 16px; font-weight: 400; }

/* A card: the question first, then the facts and the chips. */
body.iv .iv-rv-card { line-height: 1.5; }
body.iv .iv-rv-title:focus, body.iv .iv-rv-line:focus { outline: none; }
body.iv .iv-rv-q { font-size: max(20px, 1.1em); font-weight: 700; line-height: 1.4; margin: 0 0 var(--s3); max-width: var(--measure); }
body.iv .iv-rv-facts { font-size: 1em; line-height: 1.5; margin: 0 0 var(--s2); max-width: var(--measure); }
body.iv .iv-rv-lines { font-size: 1em; line-height: 1.5; }
body.iv .iv-rv-saved { color: var(--muted); font-size: 16px; margin: 0 0 var(--s2); }
body.iv .iv-rv-why ul, body.iv .iv-rv-nowfold ul { margin-top: 0; }
/* The Now fold holds the lines decisions are taken on: reading size, never the label's. */
body.iv .iv-rv-nowfold { font-size: 1em; line-height: 1.5; }
body.iv .iv-rv-group { margin: var(--s4) 0 0; max-width: var(--measure); }
body.iv .iv-rv-glabel { display: block; font-size: 16px; font-weight: 600; color: var(--muted); margin: 0 0 var(--s1); }
body.iv .iv-rv-chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin: 0 0 var(--s2); }
body.iv .iv-rv-chip {
  display: inline-flex; align-items: center; gap: var(--s1); min-height: var(--tap); min-width: var(--tap);
  padding: var(--s1) var(--s3); border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font: inherit; font-size: 1em; line-height: 1.3; cursor: pointer;
}
body.iv .iv-rv-chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); font-weight: 600; }
body.iv .iv-rv-chip:disabled { cursor: default; opacity: 0.75; }
body.iv .iv-rv-dot { color: var(--accent); }
body.iv .iv-rv-chip .iv-rv-now { color: var(--muted); font-size: 16px; font-weight: 400; }
body.iv .iv-rv-field { display: flex; flex-direction: column; gap: var(--s1); margin: var(--s2) 0; max-width: var(--measure); }
body.iv .iv-rv-field > span { color: var(--muted); font-size: 16px; }
body.iv .iv-rv-input { font-size: max(16px, 1em); }
body.iv .iv-rv-words, body.iv .iv-rv-entry, body.iv .iv-rv-tail { font-size: max(16px, 1em); line-height: 1.5; width: 100%; max-width: var(--measure); }
body.iv .iv-rv-tail { max-height: 60vh; }
body.iv .iv-rv-wordsbox { margin-top: var(--s4); }
body.iv .iv-rv-intent { margin: 0 0 var(--s2); }
body.iv .iv-rv-help { color: var(--muted); font-size: 16px; line-height: 1.5; margin: 0; max-width: var(--measure); }
body.iv .iv-rv-items, body.iv .iv-rv-rows, body.iv .iv-rv-writes { list-style: none; padding: 0; margin: var(--s3) 0 0; max-width: var(--measure); }
body.iv .iv-rv-item, body.iv .iv-rv-row, body.iv .iv-rv-wi { border-top: 1px solid var(--line-soft); padding: var(--s3) 0; overflow-wrap: anywhere; }
body.iv .iv-rv-item:first-child, body.iv .iv-rv-row:first-child, body.iv .iv-rv-wi:first-child { border-top: 0; }
body.iv .iv-rv-item-label, body.iv .iv-rv-rowname { font-size: 1em; margin: 0 0 var(--s1); }
body.iv .iv-rv-item-lines { color: var(--muted); font-size: 16px; margin: 0 0 var(--s2); padding-left: 1.3em; }
body.iv .iv-rv-celltext { font-size: 1em; margin: var(--s1) 0; }
body.iv .iv-rv-hint { font-size: 16px; color: var(--muted); margin: 0 0 var(--s2); }
body.iv .iv-rv-busy { color: var(--muted); margin: 0 0 var(--s2); max-width: var(--measure); line-height: 1.5; }
body.iv .iv-rv-card .iv-up-done, body.iv .iv-rv-card .iv-up-err { margin: 0 0 var(--s3); }
body.iv .iv-rv-errors { color: var(--danger); }
/* Another window saved the card: both answers, and Ward's pick. */
body.iv .iv-rv-conflict { border-top: 1px solid var(--line-soft); margin: var(--s3) 0 0; padding-top: var(--s3); max-width: var(--measure); }
body.iv .iv-rv-conflict-head { font-size: 1em; font-weight: 600; margin: var(--s2) 0 var(--s1); }
body.iv .iv-rv-quote { border-left: 3px solid var(--line); margin: 0 0 var(--s2); padding: 0 0 0 var(--s3); font-size: 1em; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
/* Ward's edit of an older draft's part, and his pick. */
body.iv .iv-rv-stale { margin: var(--s2) 0; max-width: var(--measure); }

/* The actions under the card: sticky at the bottom while the card is in view (above the
   phone's tab bar). */
body.iv .iv-rv-bar {
  position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center;
  background: var(--surface); border-top: 1px solid var(--line-soft); padding: var(--s3) 0; margin-top: var(--s3);
}
body.iv .iv-rv-bar .btn { min-height: var(--tap); }
@media (max-width: 899px) {
  body.iv .iv-rv-bar { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }
}

/* Decisions: the DEGIRO actions large and numbered; the Writes card with its tick boxes. */
body.iv .iv-rv-actions { font-size: max(20px, 1.1em); line-height: 1.5; margin: 0 0 var(--s3); padding-left: 1.6em; max-width: var(--measure); }
body.iv .iv-rv-actions > li { margin-bottom: var(--s3); overflow-wrap: anywhere; }
body.iv .iv-rv-actwarn { display: block; font-size: 16px; }
body.iv .iv-rv-safe { font-size: 1em; font-weight: 600; margin: 0; max-width: var(--measure); }
body.iv .iv-rv-tickrow { display: flex; align-items: flex-start; gap: var(--s2); min-height: var(--tap); font-size: 1em; cursor: pointer; }
body.iv .iv-rv-tick { flex: none; width: 24px; height: 24px; margin: 0.15em 0 0; }
body.iv .iv-rv-why-line, body.iv .iv-rv-state { font-size: 16px; color: var(--muted); margin: var(--s1) 0 0; }
body.iv .iv-rv-state.iv-warn { color: var(--warn); }
/* D4 amended by Ward (2026-10-15): the answered companies' review date as one line near the top
   of the Writes card, "Mark 14 companies as reviewed today", one tick box for all, the fold
   "Which companies" with a box per name. Reading size, calm: no colour but the states'. */
body.iv .iv-rv-reviewed { margin: var(--s3) 0 0; padding: var(--s2) 0 var(--s3); border-bottom: 1px solid var(--line-soft); max-width: var(--measure);
  font-size: 1em; line-height: 1.5; overflow-wrap: anywhere; }
body.iv .iv-rv-revrow { font-size: 1em; font-weight: 600; line-height: 1.5; margin: 0; }
body.iv .iv-rv-revfold { margin: var(--s2) 0 0; font-size: 1em; line-height: 1.5; }
body.iv .iv-rv-revfold > summary { font-size: 1em; }
body.iv .iv-rv-revlist { list-style: none; padding: 0; margin: var(--s1) 0 0; }
body.iv .iv-rv-revname { padding: var(--s1) 0; }
body.iv .iv-rv-entryhead { font-size: 16px; font-weight: 600; margin: 0 0 var(--s1); overflow-wrap: anywhere; }
body.iv .iv-rv-pre { white-space: pre-wrap; font-size: 16px; margin: 0; overflow-wrap: anywhere; }
body.iv .iv-rv-ovline { font-size: 1em; margin: 0 0 var(--s2); }

/* Phase P2 (research and slots): Get ready in full, the preparing's progress, the evidence on a
   card, Ward's own Look it up, his sources and notes, Claude's lines for FACTS. Reading text at
   the site's size, labels 16 px, states as words (opened ✓, seen in search, not opened in
   amber), never colour alone; busy is a calm muted line. */
body.iv .iv-rv-ready, body.iv .iv-rv-queue { margin: var(--s3) 0 0; max-width: var(--measure); }
body.iv .iv-rv-names { list-style: none; padding: 0; margin: 0 0 var(--s3); max-width: var(--measure); }
body.iv .iv-rv-name { border-top: 1px solid var(--line-soft); overflow-wrap: anywhere; }
body.iv .iv-rv-name:first-child { border-top: 0; }
body.iv .iv-rv-reasons { color: var(--muted); font-size: 16px; font-weight: 400; }
body.iv .iv-rv-est { font-size: 1em; line-height: 1.5; font-weight: 600; margin: var(--s2) 0; max-width: var(--measure); }
body.iv .iv-rv-leaves, body.iv .iv-rv-more, body.iv .iv-rv-srcfold, body.iv .iv-rv-lookfold, body.iv .iv-rv-evfold,
body.iv .iv-rv-leftfold, body.iv .iv-rv-editfold { margin: var(--s2) 0; max-width: var(--measure); font-size: 1em; line-height: 1.5; }
body.iv .iv-rv-leftmore { color: var(--muted); }
body.iv .iv-rv-progress { list-style: none; padding: 0; margin: var(--s2) 0; font-size: 1em; line-height: 1.5; max-width: var(--measure); }
body.iv .iv-rv-pi { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); min-height: var(--tap); overflow-wrap: anywhere; }
body.iv .iv-rv-pi .btn { min-height: var(--tap); }
body.iv .iv-rv-pi-running .iv-rv-mark { color: var(--accent); }
body.iv .iv-rv-pi-error .iv-rv-mark, body.iv .iv-rv-pi-limit .iv-rv-mark { color: var(--warn); }
body.iv .iv-rv-railq { font-size: 16px; color: var(--muted); margin: var(--s2) 0 0; }
/* Evidence: each fact a bullet, its date, publisher and state under it. */
body.iv .iv-rv-evidence { border-top: 1px solid var(--line-soft); margin: var(--s4) 0 0; padding-top: var(--s3); max-width: var(--measure); }
body.iv .iv-rv-evhead { font-size: 16px; color: var(--muted); line-height: 1.5; margin: 0 0 var(--s2); }
body.iv .iv-rv-evlist { list-style: disc; padding-left: 1.3em; margin: 0 0 var(--s2); font-size: 1em; line-height: 1.5; }
body.iv .iv-rv-ev { margin-bottom: var(--s2); overflow-wrap: anywhere; }
body.iv .iv-rv-evtext { display: block; }
body.iv .iv-rv-evsrc, body.iv .iv-rv-evask, body.iv .iv-rv-srcline { display: block; font-size: 16px; color: var(--muted); line-height: 1.5; }
body.iv .iv-rv-srcline { margin: var(--s1) 0 0 calc(24px + var(--s2)); }
body.iv .iv-rv-src { overflow-wrap: anywhere; }
body.iv .iv-rv-st { font-size: 16px; color: var(--muted); }
body.iv .iv-rv-st.iv-warn { color: var(--warn); }
/* Look it up: the button carries the full outbound text, wrapping, never cut. */
body.iv .iv-rv-askbox { margin: var(--s4) 0 0; max-width: var(--measure); }
body.iv .iv-rv-askbtn { min-height: var(--tap); white-space: normal; text-align: left; overflow-wrap: anywhere; height: auto; }
body.iv .iv-rv-sources { margin: var(--s3) 0 0; max-width: var(--measure); }
body.iv .iv-rv-srclist { padding-left: 1.3em; margin: 0; font-size: 1em; line-height: 1.5; overflow-wrap: anywhere; }
/* Search my notes: the excerpts, each with its note and heading. */
body.iv .iv-rv-exhead { font-size: 1em; font-weight: 600; margin: var(--s2) 0; }
body.iv .iv-rv-excerpt { border-left: 3px solid var(--line); padding-left: var(--s3); margin: 0 0 var(--s3); }
body.iv .iv-rv-exsrc { font-size: 16px; color: var(--muted); margin: 0 0 var(--s1); overflow-wrap: anywhere; }
body.iv .iv-rv-extext { font-size: 1em; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
/* Check the facts: Claude's lines per company. */
body.iv .iv-rv-srow { margin: var(--s3) 0 0; max-width: var(--measure); }
body.iv .iv-rv-actfix { display: block; margin: var(--s1) 0 0; }
body.iv .iv-rv-actfix .btn { min-height: var(--tap); }

/* Phase P3 (Claude in the talk): Claude's read box on a card, Talk it through as a fold under
   the card, the Overview card's line about Claude. Reading text at the site's size (18 px,
   20 px larger), labels and small lines 16 px, 44 px targets; a source's state as words
   (Reuters ✓, seen in search, not opened in amber), never colour alone; busy and thinking are
   calm muted lines. */
body.iv .iv-rv-read { border-left: 3px solid var(--accent); padding: var(--s1) 0 var(--s1) var(--s3); margin: var(--s3) 0 0; max-width: var(--measure); }
body.iv .iv-rv-readlead { font-size: 1em; line-height: 1.5; font-weight: 600; margin: 0 0 var(--s2); }
body.iv .iv-rv-readlist { list-style: none; padding: 0; margin: 0 0 var(--s2); font-size: 1em; line-height: 1.5; }
body.iv .iv-rv-rd { display: flex; align-items: flex-start; gap: var(--s2); margin: 0 0 var(--s2); overflow-wrap: anywhere; }
body.iv .iv-rv-rdmark { flex: none; width: 1.2em; text-align: center; font-weight: 700; }
body.iv .iv-rv-rdfor .iv-rv-rdmark { color: var(--accent); }
body.iv .iv-rv-rdagainst .iv-rv-rdmark { color: var(--warn); }
body.iv .iv-rv-rdbody { min-width: 0; flex: 1; }
body.iv .iv-rv-rdsrc { font-size: 16px; color: var(--muted); line-height: 1.5; margin: 0; overflow-wrap: anywhere; }
/* Claude's text (P.chatText: paragraphs, bold, lists), at the reading size. */
body.iv .iv-rv-chat { font-size: 1em; line-height: 1.5; overflow-wrap: anywhere; }
body.iv .iv-rv-chat p, body.iv .iv-rv-chat ul, body.iv .iv-rv-chat ol { margin: 0 0 var(--s1); }
body.iv .iv-rv-chat ul, body.iv .iv-rv-chat ol { padding-left: 1.3em; }
/* Talk it through: the messages oldest first, the box under them. */
body.iv .iv-rv-talkfold { margin: var(--s3) 0; max-width: var(--measure); font-size: 1em; line-height: 1.5; }
body.iv .iv-rv-talk { list-style: none; padding: 0; margin: var(--s2) 0; }
body.iv .iv-rv-msg { border-top: 1px solid var(--line-soft); padding: var(--s2) 0; overflow-wrap: anywhere; }
body.iv .iv-rv-msg:first-child { border-top: 0; }
body.iv .iv-rv-msgward { padding-left: var(--s3); border-left: 3px solid var(--line); }
body.iv .iv-rv-msgclaude { padding-left: var(--s3); border-left: 3px solid var(--accent); }
body.iv .iv-rv-msgsite { padding-left: var(--s3); }
body.iv .iv-rv-who { font-size: 16px; font-weight: 600; color: var(--muted); margin: 0 0 var(--s1); }
body.iv .iv-rv-said { font-size: 1em; line-height: 1.5; margin: 0; white-space: pre-wrap; }
/* The site's lines in a talk and a message's state (Interrupted, Not answered): Ward reads and acts on
   them, so they read at the reading size (18 px, 20 px larger); muted, amber when a turn failed. */
body.iv .iv-rv-siteline { font-size: 1em; color: var(--muted); line-height: 1.5; margin: 0 0 var(--s1); white-space: pre-wrap; }
body.iv .iv-rv-siteline.iv-warn { color: var(--warn); }
body.iv .iv-rv-turnstate { font-size: 1em; color: var(--muted); line-height: 1.5; margin: var(--s1) 0 0; }
body.iv .iv-rv-turnstate.iv-warn { color: var(--warn); }
body.iv .iv-rv-thinking { font-size: 1em; color: var(--muted); line-height: 1.5; margin: var(--s2) 0; }
body.iv .iv-rv-thinking:focus { outline: none; }
body.iv .iv-rv-talkbox { margin-top: var(--s2); }
body.iv .iv-rv-ovnote { font-size: 1em; color: var(--muted); margin: 0 0 var(--s2); }
/* P4, Claude's decisions draft: Draft with Claude and Use the plain list above the Writes card,
   each part's line with Redo this part, the gap card ("Before Claude writes") first, the §10 and
   entry: items' before → after, the source domains, Finish's todo. Reading text at the site's
   size (18 px, 20 px larger), small lines 16 px muted; drafting is a calm muted line (as busy). */
body.iv .iv-rv-gaps { border-left: 3px solid var(--accent); }
body.iv .iv-rv-merge { margin: var(--s3) 0 0; max-width: var(--measure); font-size: 1em; line-height: 1.5; }
body.iv .iv-rv-merge [data-rv-mergestate]:focus { outline: none; }
body.iv .iv-rv-mergebtns .btn { min-height: var(--tap); }
body.iv .iv-rv-parts { list-style: none; padding: 0; margin: var(--s3) 0 0; max-width: var(--measure); }
body.iv .iv-rv-part { border-top: 1px solid var(--line-soft); padding: var(--s2) 0; overflow-wrap: anywhere; }
body.iv .iv-rv-part:first-child { border-top: 0; }
body.iv .iv-rv-partline { font-size: 1em; line-height: 1.5; margin: 0; }
body.iv .iv-rv-gaplist { list-style: none; padding: 0; margin: var(--s3) 0 0; max-width: var(--measure); }
body.iv .iv-rv-gap { border-top: 1px solid var(--line-soft); padding: var(--s3) 0; overflow-wrap: anywhere; }
body.iv .iv-rv-gap:first-child { border-top: 0; }
body.iv .iv-rv-gapcard { font-size: 1em; font-weight: 600; line-height: 1.5; margin: 0 0 var(--s1); }
body.iv .iv-rv-gapq { font-size: 1em; line-height: 1.5; margin: 0 0 var(--s2); }
body.iv .iv-rv-gapin { width: 100%; min-height: calc(3 * 1.5em + var(--s2)); font-size: 1em; line-height: 1.5; }
body.iv .iv-rv-domains { font-size: 16px; color: var(--muted); line-height: 1.5; margin: var(--s1) 0 0; overflow-wrap: anywhere; }
body.iv .iv-rv-editfold { margin: var(--s2) 0 0; font-size: 1em; line-height: 1.5; max-width: var(--measure); }
body.iv .iv-rv-editfold .iv-rv-pre { font-size: 1em; line-height: 1.5; }
body.iv .iv-rv-todo { margin: var(--s2) 0; max-width: var(--measure); line-height: 1.5; }
/* P4, the gate on the Finish card: Use Claude's REFLECTION / DECISIONS, the line that says what
   Finish writes (reading size), the text the tick writes with Claude's lines marked (a left rule
   and the word "Claude" in a gutter of its own, so the text keeps one wrap; on a phone the word
   above the block, so the text keeps the card's width; "Earlier" and an amber rule for a line
   of an earlier draft of his), the plain part in a fold. */
body.iv .iv-rv-use { margin: var(--s3) 0; max-width: var(--measure); line-height: 1.5; overflow-wrap: anywhere; }
body.iv .iv-rv-useline { font-size: 1em; line-height: 1.5; color: var(--text); }
body.iv .iv-rv-useline.iv-warn { color: var(--warn); }
body.iv .iv-rv-usefold { margin: var(--s2) 0 0; font-size: 1em; line-height: 1.5; }
body.iv .iv-rv-usefold .iv-rv-pre { font-size: 1em; line-height: 1.5; }
body.iv .iv-rv-preview { margin: var(--s2) 0 0; font-size: 1em; line-height: 1.5; }
body.iv .iv-rv-pl { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: var(--s2); align-items: baseline;
  border-left: 4px solid transparent; padding: 0 0 0 var(--s2); }
body.iv .iv-rv-plmark:empty { display: none; }
@media (min-width: 600px) {
  /* Wide enough: the word in a gutter of its own, the text in one column next to it. */
  body.iv .iv-rv-pl { grid-template-columns: 4.5em minmax(0, 1fr); }
  body.iv .iv-rv-plmark:empty { display: block; }
}
body.iv .iv-rv-pl-claude { border-left-color: var(--accent); background: var(--surface-2); }
body.iv .iv-rv-pl-old { border-left-color: var(--warn); background: var(--surface-2); }
body.iv .iv-rv-plmark { font-size: 14px; font-weight: 600; color: var(--muted); }
body.iv .iv-rv-pltext { font-size: 1em; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
