:root {
    --fg: #1a1a1a;
    --muted: #666;
    --bg: #fafafa;
    --line: #ddd;
    --ok: #1a7f37;
    --bad: #cf222e;
    --warn: #bf8700;
    --accent: #0969da;
    --row-hover: #f0f6fc;
    --header-h: 49px;
    --title-h: 50px;
    --company-title-h: 46px;
    /* Heights of the sticky strips below the portfolio title (landing page) —
     * change these together with any padding/border changes to .qtab-strip
     * / .fx-strip. Used to stack sticky elements without overlap. */
    --qtab-h: 48px;
    --fx-h:   58px;
    --fundtab-h: 44px;   /* fund-filter strip below FX */
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font: 14px/1.45 system-ui, -apple-system, sans-serif;
    color: var(--fg);
    background: var(--bg);
}

header {
    background: white;
    border-bottom: 1px solid var(--line);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 30;
    height: var(--header-h);
}
header h1 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}
header h1 a { color: var(--fg); text-decoration: none; }
header .user { font-size: 13px; color: var(--muted); max-width: 70%; text-align: right; }
header .user a { color: var(--accent); text-decoration: none; }
header .user a:hover { text-decoration: underline; }
header .user .access-list { color: var(--muted); }
header .user .access-list strong { color: var(--fg); font-weight: 600; }
header .user .user-self { color: var(--fg); font-weight: 600; }

main {
    padding: 24px;
    max-width: 100%;
}

h2 { font-size: 22px; margin: 0 0 16px; }
h3 { font-size: 16px; margin: 28px 0 8px; }

a { color: var(--accent); }

.warn { color: var(--warn); font-weight: 700; margin-left: 4px; }

/* summary header */
.summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
    background: white;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 6px;
}
.summary .label {
    display: block;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.summary .value {
    display: block;
    font-size: 18px;
    font-weight: 600;
    margin-top: 2px;
}

/* tables */
table.rollup, table.grid, table.kv {
    border-collapse: collapse;
    background: white;
    border: 1px solid var(--line);
}

table.rollup, table.grid { width: 100%; }
/* Grid tables use auto layout so cells size to content (numbers like
 * ¥1,506,335,200 or $10,656,775.38 don't get clipped). `white-space: nowrap`
 * inherited from the base td rule keeps content on one line; the wrapping
 * `<div class="scroll">` handles the resulting horizontal overflow. */
table.grid { table-layout: auto; }
table.kv { min-width: 480px; }

th, td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}
th {
    background: #f5f5f5;
    font-weight: 600;
    font-size: 12px;
    color: var(--muted);
}
table.rollup tr:hover, table.grid tr:hover { background: var(--row-hover); }

td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.meta { color: var(--muted); font-size: 12px; }

/* horizontal scroll for wide grids */
.scroll {
    overflow-x: auto;
    border-radius: 6px;
    margin-bottom: 8px;
}

/* editable fields */
.field-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.field-wrap .unit { color: var(--muted); font-size: 12px; margin-left: -2px; }
.field-wrap .readonly { color: var(--muted); font-style: italic; padding: 3px 5px; }
.field-wrap input[type=text],
.field-wrap input[type=date] {
    border: 1px solid transparent;
    background: transparent;
    padding: 3px 5px;
    font: inherit;
    width: 100%;
    min-width: 0;       /* let the cell width win, esp. in fixed-layout grids */
    border-radius: 3px;
}

/* In auto-layout grid tables (company-page transaction history, KPI panels,
 * cap table, etc.) let the inputs grow to fit their content so big numbers
 * like ¥1,506,335,200 / $10,656,775.38 aren't clipped. `field-sizing: content`
 * is the modern way to do this (Chrome 123+, Safari 17.4+, Firefox 123+);
 * the explicit min-width is the fallback for older browsers. */
table.grid .field-wrap input[type=text],
table.grid .field-wrap input[type=date] {
    width: auto;
    min-width: 14ch;     /* fits ~$10,000,000.00 */
    field-sizing: content;
}
.field-wrap input[type=text]:hover,
.field-wrap input[type=date]:hover {
    background: #fafafa;
    border-color: var(--line);
}
.field-wrap input[type=text]:focus,
.field-wrap input[type=date]:focus {
    background: white;
    border-color: var(--accent);
    outline: none;
}

.status {
    font-size: 11px;
    color: var(--ok);
    min-width: 60px;
    transition: opacity 1.5s;
}
.status:has(*) { animation: fade 2s 1s forwards; }
@keyframes fade { to { opacity: 0; } }

.note {
    color: var(--muted);
    font-size: 12px;
    margin-top: 16px;
}

code {
    background: #eee;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 12px;
}

/* auth forms */
form.auth {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: white;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 6px;
    max-width: 360px;
}
form.auth label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
form.auth input {
    font: 14px/1.4 system-ui, sans-serif;
    color: var(--fg);
    text-transform: none;
    letter-spacing: 0;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 4px;
}
form.auth input:focus {
    border-color: var(--accent);
    outline: none;
}
form.auth button {
    background: var(--accent);
    color: white;
    border: 0;
    padding: 9px 16px;
    border-radius: 4px;
    font: 600 14px/1 system-ui, sans-serif;
    cursor: pointer;
    align-self: flex-start;
}
form.auth button:hover { filter: brightness(0.95); }

p.error {
    background: #ffebe9;
    border: 1px solid #ffcecb;
    color: var(--bad);
    padding: 8px 12px;
    border-radius: 4px;
    max-width: 360px;
}
p.ok {
    background: #dafbe1;
    border: 1px solid #aceebb;
    color: var(--ok);
    padding: 8px 12px;
    border-radius: 4px;
    max-width: 360px;
}

/* admin actions */
table.rollup button {
    background: white;
    border: 1px solid var(--line);
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    margin-right: 4px;
}
table.rollup button:hover { background: var(--row-hover); border-color: var(--accent); color: var(--accent); }

/* Constrain page so wide grids scroll within their .scroll wrappers and don't
 * push the body horizontally. Use `clip` (not `hidden`) — `hidden` establishes
 * a scroll container which would break `position: sticky` on the H2/summary.
 * Exception: the landing page (body.landing) opts out of the clip so the wide
 * portfolio table can scroll at the document root, keeping the thead and
 * company-column sticky pinned to viewport rather than to a sub-container. */
html:not(:has(body.landing)),
body:not(.landing) { overflow-x: clip; }
.scroll { max-width: 100%; }

/* Sticky company-name H2 on individual company pages. Stays visible below
 * the page header as the user scrolls down through Cap table / KPIs /
 * WiL transactions. Inner tables overflow into .scroll, not the page. */
h2.company-title {
    position: sticky;
    top: var(--header-h);
    background: var(--bg);
    margin: 0 -24px 0;
    padding: 10px 24px;
    border-bottom: 1px solid var(--line);
    z-index: 20;
    height: var(--company-title-h);
    display: flex;
    align-items: center;
}

/* Summary cards (Shares held, Cost, Ownership, etc.) — stays stuck just below
 * the sticky company title so the at-a-glance header stays visible while you
 * scroll through the Cap table / KPI / WiL transactions below. */
main > section.summary {
    position: sticky;
    top: calc(var(--header-h) + var(--company-title-h));
    z-index: 19;
    margin-top: 16px;
    margin-bottom: 16px;
}

/* Sticky portfolio title (landing page only — class="portfolio-title") */
h2.portfolio-title {
    position: sticky;
    top: var(--header-h);
    background: var(--bg);
    margin: 0 -24px 16px;
    padding: 12px 24px 10px;
    border-bottom: 1px solid var(--line);
    z-index: 20;
    height: var(--title-h);
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}
h2.portfolio-title .title-action {
    font-size: 12px;
    font-weight: 400;
    color: var(--accent);
    text-decoration: none;
    cursor: pointer;
}
h2.portfolio-title .title-action:hover { text-decoration: underline; }

/* Fund-of-Funds section header — visually distinct from the portfolio block. */
table.rollup.portfolio tr.fof-section td {
    background: #fbf4e6;
    color: var(--fg);
    font-weight: 600;
    border-top: 1px dashed var(--line);
    padding-top: 10px;
    padding-bottom: 10px;
    font-style: italic;
}
table.rollup.portfolio tr.fof-row td:first-child {
    background: #fffaf0;
    font-style: italic;
}
table.rollup.portfolio tr.fof-row:hover td:first-child { background: var(--row-hover); }

/* Quarter tabs at the top of the landing page. Each tab links to the same
 * page with a different ?period= query param. Sticky beneath the portfolio
 * title so you can switch quarters without scrolling back up. */
.qtab-strip {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin: 0 -24px;
    padding: 10px 24px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: calc(var(--header-h) + var(--title-h));
    z-index: 19;
    min-height: var(--qtab-h);
}
.qtab {
    padding: 4px 12px;
    border: 1px solid var(--line);
    border-radius: 3px;
    text-decoration: none;
    color: var(--fg);
    background: white;
    font-size: 13px;
}
.qtab:hover { border-color: var(--accent); color: var(--accent); }
.qtab.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    font-weight: 600;
}
.qtab-new {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
}
.qtab-new input[type=text] {
    width: 70px;
    padding: 3px 6px;
    border: 1px solid var(--line);
    border-radius: 3px;
    font: inherit;
}
.qtab-new button {
    padding: 4px 10px;
    border: 1px solid var(--accent);
    background: white;
    color: var(--accent);
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
}
.qtab-new button:hover { background: var(--accent); color: white; }

.qtab-download {
    margin-left: auto;
    padding: 4px 12px;
    border: 1px solid var(--ok);
    background: white;
    color: var(--ok);
    border-radius: 3px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.qtab-download:hover { background: var(--ok); color: white; }
/* "Save as PDF" button — same look but different accent so it's distinct
 * from the XLSX download. Sits next to it in the quarter-tabs strip. */
.qtab-print {
    margin-left: 8px;
    border-color: var(--accent);
    color: var(--accent);
}
.qtab-print:hover { background: var(--accent); color: white; }

/* FX strip — editable Q-end FX rates per currency, sits below the quarter
 * tabs. Sticky too so the FX context stays visible while scrolling the
 * portfolio table. Edits broadcast to every fund_valuations row of that
 * currency. */
.fx-strip {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin: 0 -24px 16px;
    padding: 10px 24px;
    background: white;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    position: sticky;
    top: calc(var(--header-h) + var(--title-h) + var(--qtab-h));
    z-index: 18;
    min-height: var(--fx-h);
}
.fx-strip strong { color: var(--muted); font-weight: 600; }
.fx-input {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.fx-input input[type=text] {
    width: 80px;
    padding: 3px 6px;
    border: 1px solid var(--line);
    border-radius: 3px;
    font: inherit;
    text-align: right;
}
.fx-sim-toggle { font-size: 11px; color: var(--muted); }
.fx-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}
.fx-badge.actual { background: #dafbe1; color: var(--ok); }
.fx-badge.sim    { background: #fff8c5; color: var(--warn); }

/* Drag handle on column headers (right edge of each <th>). */
table.rollup.portfolio thead th { position: sticky; }   /* re-assert */
.col-resizer {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    cursor: col-resize;
    user-select: none;
    z-index: 11;       /* above sticky thead background */
}
.col-resizer:hover { background: rgba(9, 105, 218, 0.4); }
.col-resizer:active { background: var(--accent); }

/* Landing page lets the wide portfolio table scroll horizontally at the
 * document root (see body.landing exception above on overflow-x: clip).
 * The .portfolio-scroll wrapper is a no-op — kept only so we can swap to
 * a real scroll container if browser sticky behavior changes. */
.portfolio-scroll { display: contents; }

/* Single portfolio table that holds every fund section: column widths fixed
 * so all funds align, thead sticky below the page title.
 * Layout (17 cols total) fits in 100% viewport — long header labels wrap
 * to multiple lines (see thead th rule below). Company column is sticky-left
 * so it stays visible while horizontal scroll bar is dragged. */
table.rollup.portfolio { table-layout: fixed; width: 100%; font-size: 12px; }
table.rollup.portfolio col.c-company  { width: 9%; }      /* tighter — frees space for numeric cols */
table.rollup.portfolio col.c-status   { width: 6%; }
table.rollup.portfolio col.c-currency { width: 3%; }      /* squeezed per user — only holds "USD"/"JPY"/"EUR" */
table.rollup.portfolio col.c-year     { width: 4.5%; }
table.rollup.portfolio col.c-date     { width: 4.5%; }    /* "Apr 26" — same shape as year */
table.rollup.portfolio col.c-num      { width: 5.214%; }  /* x14 = 72.996 → 9+6+3+4.5+4.5+72.996 = 100.0% (fits viewport exactly) */

/* Tight padding for landing page to fit 17 columns. */
table.rollup.portfolio td,
table.rollup.portfolio th { padding: 5px 4px; }

/* Allow long column-header labels (e.g. "WiL assessed value (M, local)",
 * "ARR mult vs WiL value") to wrap to multiple lines so we don't need
 * wider columns. Body cells keep single-line + ellipsis. */
table.rollup.portfolio thead th {
    white-space: normal;
    line-height: 1.2;
    vertical-align: bottom;
    font-size: 11px;
}

/* Trim main-content padding on the landing page so the wide portfolio
 * table has more horizontal room. Other pages keep the default 24px. */
body.landing main { padding: 12px; }
table.rollup.portfolio thead th {
    position: sticky;
    top: calc(var(--header-h) + var(--title-h) + var(--qtab-h) + var(--fx-h) + var(--fundtab-h));
    z-index: 10;
    background: #f5f5f5;
}

/* Fund-filter tab strip — sits below the FX bar so the user can scope the
 * landing to one fund. Reuses the .qtab look from the quarter strip. */
.fundtab-strip {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin: 0 -24px 16px;
    padding: 8px 24px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: calc(var(--header-h) + var(--title-h) + var(--qtab-h) + var(--fx-h));
    z-index: 17;
    min-height: var(--fundtab-h);
}
table.rollup.portfolio td {
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Section header row introducing each fund block. */
table.rollup.portfolio tr.fund-section td {
    background: #eef3f9;
    color: var(--fg);
    font-weight: 600;
    border-top: 1px solid var(--line);
    padding-top: 10px;
    padding-bottom: 10px;
}
table.rollup.portfolio tr.fund-section small {
    color: var(--muted);
    font-weight: 400;
}
table.rollup.portfolio tr.fund-section:hover td { background: #eef3f9; }

/* Category color-coding for the 19-column landing-page table header.
 * Three professional-finance hues let advisors jump to the section they need:
 *   cat-profile  (navy)  — company fundamentals (Ccy → Δ% vs round)
 *   cat-position (green) — WiL fund's holding (Shares → Realized G/L)
 *   cat-reference (amber) — valuation reference (Financials as-of → vs Q4 25)
 * Body cells stay black so existing G/L positive/negative cues remain readable. */
table.rollup.portfolio thead th.cat-profile {
    color: #1e3a8a;
    background: #eaf2fc;
    border-top: 2px solid #1e3a8a;
}
table.rollup.portfolio thead th.cat-position {
    color: #15803d;
    background: #e6f5ec;
    border-top: 2px solid #15803d;
}
table.rollup.portfolio thead th.cat-reference {
    color: #92400e;
    background: #fbf2dc;
    border-top: 2px solid #92400e;
}

/* Frozen Company column. Each first-child needs its own background so the
 * sticky cell doesn't go transparent when content scrolls beneath it. */
table.rollup.portfolio th:first-child,
table.rollup.portfolio td:first-child {
    position: sticky;
    left: 0;
    z-index: 5;
}
table.rollup.portfolio thead th:first-child {
    background: #f5f5f5;
    z-index: 15;                /* above sticky thead bg (z=10) */
}
table.rollup.portfolio tbody td:first-child            { background: white; }
table.rollup.portfolio tr.fund-section td:first-child  { background: #eef3f9; }
table.rollup.portfolio tr.ccy-subtotal td:first-child  { background: #f7f7f7; }
table.rollup.portfolio tr.fund-total  td:first-child   { background: #e8f0f5; }
table.rollup.portfolio tbody tr:hover td:first-child   { background: var(--row-hover); }
table.rollup.portfolio tr.fund-section:hover td:first-child { background: #eef3f9; }
table.rollup.portfolio tr.ccy-subtotal:hover td:first-child { background: #f7f7f7; }
table.rollup.portfolio tr.fund-total:hover  td:first-child  { background: #e8f0f5; }

/* Currency subtotal & fund-total rows under each fund section. */
table.rollup.portfolio tr.ccy-subtotal td {
    background: #f7f7f7;
    color: var(--muted);
    font-style: italic;
    border-top: 1px dashed var(--line);
}
table.rollup.portfolio tr.ccy-subtotal td.num strong { color: var(--fg); }
table.rollup.portfolio tr.fund-total td {
    background: #e8f0f5;
    border-top: 2px solid #c3d3df;
    border-bottom: 2px solid #c3d3df;
    font-weight: 600;
}
table.rollup.portfolio tr.ccy-subtotal:hover td,
table.rollup.portfolio tr.fund-total:hover td { background: inherit; }

/* New-transaction form (collapsible) */
details.add-txn { margin-top: 1.5em; border: 1px solid var(--line);
                  border-radius: 4px; padding: 0.75em 1em; background: white; }
details.add-txn > summary { cursor: pointer; font-weight: 600;
                            color: var(--accent); }
form.add-txn-form { display: grid; grid-template-columns: repeat(3, 1fr);
                    gap: 0.6em 1em; margin-top: 1em; }
form.add-txn-form label { display: flex; flex-direction: column;
                          font-size: 12px; color: var(--muted); gap: 2px; }
form.add-txn-form label.wide { grid-column: span 3; }
form.add-txn-form input, form.add-txn-form select {
    padding: 4px 6px; border: 1px solid var(--line); border-radius: 3px;
    font: inherit; color: var(--fg);
}
form.add-txn-form button { grid-column: 1 / -1; justify-self: start;
                           padding: 6px 14px; background: var(--accent);
                           color: white; border: 0; border-radius: 3px;
                           cursor: pointer; }
form.add-txn-form .note { grid-column: 1 / -1; }

/* ==============================================================
   D SPV Fund-of-Funds Series section (companies 316-319)
   Rendered below the direct portfolio table on the WiL D SPV tab.
   ============================================================== */
.dspv-fof-series {
    margin: 2em 0 1em;
    display: flex;
    flex-direction: column;
    gap: 1em;
}
.dspv-fof-series h3.section-heading,
h3.section-heading {
    margin: 0 0 0.5em;
    font-size: 15px;
    font-weight: 600;
}
.section-heading .meta {
    font-weight: 400;
    color: var(--muted);
    font-size: 12px;
    margin-left: 0.5em;
}
.fof-series-card {
    background: white;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0.9em 1.1em;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.fof-series-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1em;
    margin-bottom: 0.7em;
    flex-wrap: wrap;
}
.fof-series-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.fof-series-title .series-tag {
    font-weight: 700;
    font-size: 14px;
    color: var(--fg);
    letter-spacing: 0.02em;
}
.fof-series-title .series-under {
    font-size: 12px;
    color: var(--muted);
}
.fof-series-stats {
    display: flex;
    gap: 1.4em;
    flex-wrap: wrap;
}
.fof-series-stats > div {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}
.fof-series-stats .lbl {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.fof-series-stats .val {
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--fg);
}
.fof-series-progress {
    height: 4px;
    background: var(--line);
    border-radius: 2px;
    overflow: hidden;
    margin: 0.4em 0 0.8em;
}
.fof-series-progress-fill {
    height: 100%;
    background: var(--accent);
    transition: width 200ms ease;
}
table.fof-lp-alloc {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
table.fof-lp-alloc th {
    text-align: left;
    padding: 4px 8px;
    color: var(--muted);
    font-weight: 500;
    font-size: 11px;
    border-bottom: 1px solid var(--line);
}
table.fof-lp-alloc th.num,
table.fof-lp-alloc td.num {
    text-align: right;
}
table.fof-lp-alloc td {
    padding: 5px 8px;
    border-bottom: 1px solid #f5f5f5;
    font-variant-numeric: tabular-nums;
}
table.fof-lp-alloc td.lp-name {
    font-weight: 500;
    color: var(--fg);
}
.fof-series-summary {
    background: #fafafa;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0.7em 1.1em;
    display: flex;
    gap: 1.8em;
    flex-wrap: wrap;
    margin-top: 0.4em;
}
.fof-series-summary > div {
    display: flex;
    flex-direction: column;
}
.fof-series-summary .lbl {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.fof-series-summary .val {
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--fg);
}

/* ==============================================================
   D SPV Fund-of-Funds Series — table layout aligned with the
   direct-portfolio $M USD columns above.
   ============================================================== */
.dspv-fof-table-wrap {
    margin: 1.5em 0;
    background: white;
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow-x: auto;
}
table.dspv-fof-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}
table.dspv-fof-table thead th {
    text-align: left;
    padding: 8px 12px;
    background: #fafafa;
    border-bottom: 1px solid var(--line);
    font-weight: 600;
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 0.02em;
}
table.dspv-fof-table thead th.num { text-align: right; }
table.dspv-fof-table thead th small {
    font-weight: 400;
    color: var(--muted);
    font-size: 10px;
    display: block;
    margin-top: 1px;
}
table.dspv-fof-table td {
    padding: 6px 12px;
    border-bottom: 1px solid #f0f0f0;
    color: var(--fg);
}
table.dspv-fof-table td.num { text-align: right; }
/* Series-level row: bolder */
tr.fof-series-row td {
    background: #fbfbfb;
    border-top: 1px solid #e8e8e8;
    padding-top: 8px;
    padding-bottom: 8px;
}
tr.fof-series-row .series-under {
    font-weight: 400;
    color: var(--muted);
    margin-left: 0.5em;
    font-size: 11px;
}
/* LP sub-row: indented + muted */
tr.fof-lp-row td {
    background: white;
    color: var(--muted);
    font-size: 12px;
}
tr.fof-lp-row td.indent {
    padding-left: 32px;
    color: var(--fg);
}
tr.fof-lp-row .lp-name { font-weight: 500; }
tr.fof-lp-row .meta {
    margin-left: 0.4em;
    font-size: 11px;
    color: var(--muted);
}
/* Footer subtotal + grand-total rows */
tr.fof-subtotal-row td {
    background: #f5f5f5;
    border-top: 2px solid var(--line);
    padding-top: 8px;
    padding-bottom: 8px;
    font-weight: 600;
}
tr.fof-grand-total-row td {
    background: #eef4fa;
    border-top: 2px solid var(--accent);
    padding: 10px 12px;
    font-weight: 700;
    color: var(--fg);
    font-size: 14px;
}

/* ==============================================================
   D SPV FoF rows inside the shared 19-col portfolio table.
   Columns align via the parent <colgroup>.
   ============================================================== */
tr.fof-section-header td {
    background: #f5f5f5;
    padding: 10px 12px;
    border-top: 2px solid var(--line);
    border-bottom: 1px solid var(--line);
    font-size: 14px;
    color: var(--fg);
}
tr.fof-section-header .meta {
    font-weight: 400;
    color: var(--muted);
    font-size: 12px;
    margin-left: 0.4em;
}
tr.fof-series-row td {
    background: #fbfbfb;
    border-top: 1px solid #eee;
    padding-top: 7px;
    padding-bottom: 7px;
}
tr.fof-series-row .series-under {
    font-weight: 400;
    color: var(--muted);
    margin-left: 0.4em;
    font-size: 11px;
}
tr.fof-lp-row td {
    background: white;
    color: var(--muted);
    font-size: 12px;
}
tr.fof-lp-row td.num {
    color: var(--fg);
}
tr.fof-lp-row .lp-indent {
    color: var(--muted);
    margin-right: 0.3em;
}
tr.fof-lp-row .lp-name {
    color: var(--fg);
    font-weight: 500;
}
tr.fof-subtotal-row td {
    background: #f5f5f5;
    border-top: 2px solid var(--line);
    padding-top: 8px;
    padding-bottom: 8px;
    font-weight: 600;
}
tr.fof-grand-total-row td {
    background: #eef4fa;
    border-top: 2px solid var(--accent);
    padding: 10px 12px;
    font-weight: 700;
    color: var(--fg);
    font-size: 14px;
}

/* ---------- Print / Save-as-PDF layout ----------
 *
 * When the user clicks "Save as PDF" (or hits Cmd/Ctrl-P), the browser's
 * print dialog opens and renders the landing under these rules:
 *
 *   - Wide landscape paper (A3 landscape default) so the 19-column
 *     portfolio table fits without shrinking. Users can also pick A2 or
 *     Tabloid in the print dialog for even wider layouts.
 *   - Nav, forms, sticky resizers, edit widgets, and the fund/quarter tab
 *     strips are hidden — the PDF should contain the portfolio table plus
 *     its title only.
 *   - Colors preserved (write-down amber, category chips): print-color-
 *     adjust: exact prevents Chrome/Safari from stripping backgrounds.
 *   - Users typically filter to one fund (SGV, Fund I, etc.) BEFORE
 *     printing so each PDF is a single fund's positions. When "All" is
 *     selected, all funds land in one PDF.
 */
@page {
    size: A3 landscape;
    margin: 0.4in;
}

@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    header,
    .qtab-strip,
    .fundtab-strip,
    .fx-strip,
    .title-action,
    .qtab-new,
    .qtab-download,
    .qtab-print,
    .add-txn-form,
    .status,
    .field-wrap .unit,
    #reset-col-widths,
    button {
        display: none !important;
    }
    input, select, textarea {
        border: none !important;
        background: transparent !important;
        padding: 0 !important;
        color: var(--fg) !important;
        appearance: none !important;
        -webkit-appearance: none !important;
        font-family: inherit !important;
        font-size: inherit !important;
        pointer-events: none !important;
        width: auto !important;
        min-width: 0 !important;
    }
    input[type="text"], input[type="number"] {
        text-align: right;
    }
    body.landing {
        font-size: 9pt;
    }
    body.landing table.portfolio-table th,
    body.landing table.portfolio-table td {
        padding: 3px 4px !important;
    }
    body.landing table.portfolio-table {
        page-break-inside: auto;
    }
    body.landing table.portfolio-table thead {
        display: table-header-group;
    }
    body.landing table.portfolio-table tfoot {
        display: table-footer-group;
    }
    .portfolio-scroll {
        overflow: visible !important;
    }
    thead th, .fx-strip {
        position: static !important;
    }
    h2.portfolio-title {
        margin: 0 0 6pt 0;
        font-size: 13pt;
    }
    a { color: var(--fg) !important; text-decoration: none !important; }
}
