/* Chart page — workbench layout + uPlot theming + controls + picker modal */

.workbench {
    display: grid;
    grid-template-columns: 296px 1fr;
    gap: 12px;
    align-items: start;
}
@media (max-width: 960px) {
    .workbench { grid-template-columns: 1fr; }
}

/* ----- Sidebar ----- */
.sidebar {
    position: sticky;
    top: calc(var(--nav-h) + 8px);
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 12px;
    background: var(--bg-1);
    border: 1px solid var(--border-0);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-1);
}
.sidebar-section        { display: flex; flex-direction: column; gap: 8px; }
.sidebar-section .eyebrow { margin-bottom: 2px; }
.sidebar-section-muted small { font-size: 11.5px; line-height: 1.5; color: var(--fg-2); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.fund-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    padding: 0 4px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--fg-2);
    background: var(--bg-2);
    border-radius: 999px;
    letter-spacing: 0;
    text-transform: none;
    margin-left: 6px;
}
.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--fg-2);
    font-size: 11px;
    height: 22px;
    padding: 0 8px;
}
.btn-ghost:hover { background: var(--bg-2); color: var(--fg-0); border-color: var(--border-1); }
#clear-funds {
    height: 24px;
    padding: 0 14px;
    border-radius: 4px;
    border-color: var(--border-1);
}
.btn-ghost.save-custom-selection {
    justify-content: center;
    height: 30px;
    margin-top: 6px;
    border-color: var(--border-1);
    border-radius: 4px;
}
.btn-ghost.save-custom-selection:disabled {
    cursor: default;
    opacity: 0.55;
}

/* ----- Segmented control ----- */
.segmented {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    background: var(--bg-2);
    border: 1px solid var(--border-0);
    border-radius: var(--radius-md);
    padding: 2px;
    gap: 2px;
}
.segmented.three { grid-template-columns: repeat(3, 1fr); }
.segmented.four  { grid-template-columns: repeat(4, 1fr); }
/* Chart type: two rows of tiles inside one pill. A 6-column track lets row 1
 * hold 2 tiles (span 3) and row 2 hold 3 tiles (span 2), each row's tiles
 * equal width. Add a chart type by giving it a span that keeps its row at 6. */
.segmented.chart-type-grid { grid-template-columns: repeat(6, 1fr); }
.segmented.chart-type-grid .seg[data-span="2"] { grid-column: span 2; }
.segmented.chart-type-grid .seg[data-span="3"] { grid-column: span 3; }
.seg {
    all: unset;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 26px;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 500;
    color: var(--fg-2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
    white-space: nowrap;
}
.seg:hover  { color: var(--fg-0); }
.seg.active {
    background: var(--bg-1);
    color: var(--fg-0);
    box-shadow: var(--shadow-1);
}

/* ----- Workbench control feedback -----
 * Inline per-control spinners are disabled — the user wants the window-level
 * loader (chart-container overlay) to be the only loading affordance. Any
 * change that needs feedback flows through the renderAll loader path; here
 * we just neutralise the legacy ::after spinners. */
.sidebar-section.control-feedback-busy::after,
.sidebar-field.control-feedback-busy::after,
.switch.control-feedback-busy::after,
.slider-wrap.control-feedback-busy::after,
.attribution-field.workbench-action-feedback-busy::after,
.attribution-residual-toggle.workbench-action-feedback-busy::after,
.holdings-date-cap.workbench-action-feedback-busy::after,
.summary-snapshot-cell.workbench-action-feedback-busy::after,
[data-attr-collapse].workbench-action-feedback-busy::after,
.snapshot-close.workbench-action-feedback-busy::after,
.attribution-coverage-summary.workbench-action-feedback-busy::after {
    content: none !important;
    display: none !important;
    animation: none !important;
}
.slider-wrap.control-feedback-busy .slider-fill,
.snapshot-close.workbench-action-feedback-busy {
    /* Drop the highlight/fade-out side effects that paired with the spinners. */
    box-shadow: none !important;
    color: inherit !important;
}

/* ----- Native select (time window) ----- */
.select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 30px;
    padding: 0 28px 0 10px;
    font-family: var(--font-sans);
    font-size: 12.5px;
    color: var(--fg-0);
    background: var(--bg-1) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6' fill='none' stroke='%236b717a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M1 1L5 5L9 1'/></svg>") no-repeat right 10px center / 10px;
    border: 1px solid var(--border-1);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.select:hover         { border-color: var(--border-hi); }
.select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.select option:disabled { color: var(--fg-3); }

.sidebar-field {
    display: grid;
    gap: 5px;
    font-size: 11.5px;
    color: var(--fg-2);
}
.sidebar-field > span {
    line-height: 1.2;
}
.sidebar-input {
    width: 100%;
    height: 30px;
    padding: 0 10px;
    color: var(--fg-0);
    background: var(--bg-1);
    border: 1px solid var(--border-1);
    border-radius: var(--radius);
}
.sidebar-input:hover { border-color: var(--border-hi); }
.sidebar-input:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

.liquidity-fum-source {
    color: var(--fg-3);
    font-size: 11px;
    line-height: 1.2;
}

.liquidity-band-editor {
    display: grid;
    gap: 10px;
    padding-top: 4px;
}
.liquidity-band-title {
    font-size: 11.5px;
    color: var(--fg-2);
}
.liquidity-band-reset {
    height: 24px;
    padding: 0 8px;
}
.liquidity-band-grid {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
    align-items: stretch;
}
.liquidity-band-timeline {
    position: relative;
    min-height: 272px;
    padding: 8px 0;
}
.liquidity-band-timeline::before {
    content: "";
    position: absolute;
    top: 14px;
    bottom: 14px;
    left: 16px;
    width: 2px;
    background: var(--border-1);
    border-radius: 999px;
}
.liquidity-band-handle {
    all: unset;
    position: absolute;
    left: 8px;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    border-radius: 999px;
    background: var(--bg-1);
    border: 2px solid var(--accent);
    box-shadow: var(--shadow-1);
    cursor: ns-resize;
}
.liquidity-band-handle:hover,
.liquidity-band-handle:focus-visible {
    background: var(--accent-bg);
    outline: none;
}
.liquidity-band-zero,
.liquidity-band-infinity {
    position: absolute;
    left: 0;
    width: 32px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--fg-2);
}
.liquidity-band-zero { top: 0; }
.liquidity-band-infinity { bottom: 0; }
.liquidity-band-list {
    display: grid;
    gap: 6px;
}
.liquidity-band-row {
    display: grid;
    grid-template-columns: 44px 42px minmax(54px, 1fr) 48px;
    gap: 6px;
    align-items: center;
    min-height: 34px;
}
.liquidity-band-row-final {
    color: var(--fg-2);
}
.liquidity-band-label,
.liquidity-band-start,
.liquidity-band-end-label {
    font-family: var(--font-mono);
    font-size: 11px;
}
.liquidity-band-label {
    color: var(--fg-2);
}
.liquidity-band-start {
    color: var(--fg-1);
    text-align: right;
}
.liquidity-band-end {
    width: 100%;
    height: 28px;
    padding: 0 7px;
    font-family: var(--font-mono);
    font-size: 11.5px;
    text-align: right;
    color: var(--fg-0);
    background: var(--bg-1);
    border: 1px solid var(--border-1);
    border-radius: var(--radius-sm);
}
.liquidity-band-end:hover {
    border-color: var(--border-hi);
}
.liquidity-band-end:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}
.liquidity-band-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}
.liquidity-band-icon {
    all: unset;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: var(--radius-sm);
    color: var(--fg-2);
    background: var(--bg-2);
    border: 1px solid var(--border-0);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 12px;
}
.liquidity-band-icon:hover,
.liquidity-band-icon:focus-visible {
    color: var(--fg-0);
    border-color: var(--border-hi);
    outline: none;
}

.custom-range {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 0 0;
}
.custom-range input[type="date"] {
    flex: 1; height: 28px; font-family: var(--font-mono); font-size: 11.5px;
}
.performance-asof-wrap {
    display: flex;
    padding: 8px 0 0;
}
.performance-asof-wrap[hidden] {
    display: none !important;
}
.performance-asof-wrap input[type="date"] {
    width: 100%;
    height: 28px;
    font-family: var(--font-mono);
    font-size: 11.5px;
}

/* ----- Switch (rebase toggle) ----- */
.switch {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    padding: 2px 0;
}
.switch[hidden] {
    display: none !important;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
    width: 30px; height: 18px;
    background: var(--bg-3);
    border: 1px solid var(--border-1);
    border-radius: 999px;
    position: relative;
    transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
    flex-shrink: 0;
}
.switch-thumb {
    position: absolute;
    top: 2px; left: 2px;
    width: 12px; height: 12px;
    background: var(--fg-1);
    border-radius: 999px;
    transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
}
.switch input:checked + .switch-track {
    background: var(--accent);
    border-color: var(--accent);
}
.switch input:checked + .switch-track .switch-thumb {
    background: #fff;
    transform: translateX(12px);
}
.switch input:focus-visible + .switch-track {
    box-shadow: 0 0 0 3px var(--accent-bg);
}
.switch-label { font-size: 12.5px; color: var(--fg-0); }

/* ----- Fund rows (sidebar list of selected funds) ----- */
.fund-rows { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.fund-row-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.fund-row-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2px;
    font-size: 10px;
    font-weight: 600;
    color: var(--fg-3);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.fund-row-group-head .mono {
    color: var(--fg-2);
    letter-spacing: 0;
}
.fund-row {
    display: grid;
    grid-template-columns: 16px 1fr 22px;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    background: var(--bg-2);
    border: 1px solid var(--border-1);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.fund-row:hover { background: var(--bg-3); border-color: var(--border-hi); }
.fund-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.fund-row-swatch {
    all: unset;
    width: 12px; height: 12px;
    border-radius: 3px;
    border: 1px solid color-mix(in oklab, var(--fg-0) 12%, transparent);
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}
.fund-row-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}
.fund-row-apir { font-size: 11.5px; color: var(--fg-0); font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.fund-row-apir .type-pill { padding: 0 4px; font-size: 9px; line-height: 1.4; letter-spacing: 0; }
.fund-row-name {
    font-size: 11.5px;
    color: var(--fg-2);
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.3;
}
.fund-row-rm {
    all: unset;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px; height: 18px;
    border-radius: 999px;
    color: var(--fg-2);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.fund-row-rm:hover { background: var(--danger); color: white; }

/* Backwards-compat aliases retained for proxy admin / portfolios chip area */
.chips { display: flex; flex-wrap: wrap; gap: 4px; min-height: 4px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 6px 3px 8px;
    background: var(--bg-2);
    border: 1px solid var(--border-1);
    border-radius: 999px;
    font-size: 11.5px;
    color: var(--fg-0);
    font-family: var(--font-mono);
    font-weight: 500;
    max-width: 100%;
}
.chip .swatch { width: 7px; height: 7px; border-radius: 2px; flex-shrink: 0; }
.chip .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }

/* ----- Time window slider ----- */
.slider-wrap {
    --slider-track-height: 4px;
    --slider-thumb-size: 14px;
    position: relative;
    height: 26px;
    margin: 4px 4px 0;
}
.slider-track {
    position: absolute;
    left: 0; right: 0; top: 50%;
    height: var(--slider-track-height);
    transform: translateY(-50%);
    background: var(--bg-3);
    border-radius: 999px;
}
.slider-fill {
    position: absolute;
    top: 0; bottom: 0;
    background: var(--accent);
    border-radius: 999px;
    pointer-events: none;
    transition: left var(--dur) var(--ease), right var(--dur) var(--ease);
}
.slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    pointer-events: none;
}
.slider-thumb::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: var(--slider-thumb-size); height: var(--slider-thumb-size);
    border-radius: 999px;
    background: var(--bg-1);
    border: 2px solid var(--accent);
    box-shadow: 0 1px 3px rgba(0,0,0,0.18);
    cursor: pointer;
    pointer-events: auto;
    margin-top: calc((var(--slider-track-height) - var(--slider-thumb-size)) / 2);
}
.slider-thumb::-moz-range-thumb {
    width: var(--slider-thumb-size); height: var(--slider-thumb-size);
    border-radius: 999px;
    background: var(--bg-1);
    border: 2px solid var(--accent);
    cursor: pointer;
    pointer-events: auto;
}
.slider-thumb::-webkit-slider-runnable-track,
.slider-thumb::-moz-range-track {
    height: var(--slider-track-height);
    background: transparent;
    border: 0;
}
.slider-disabled .slider-fill { background: var(--border-1); }
.slider-disabled .slider-thumb::-webkit-slider-thumb { border-color: var(--border-1); }

/* Drag hint: shown while the user is actively dragging a slider thumb. The
 * commit (and chart render) only fires on `change` / release, so this tells
 * the user that nothing has been recomputed yet. Pointer-events:none so it
 * never interferes with the thumb hit area. */
.slider-wrap::after {
    content: "Release to apply";
    position: absolute;
    left: 50%;
    bottom: calc(100% + 4px);
    transform: translateX(-50%) translateY(4px);
    padding: 3px 8px;
    background: var(--fg-0);
    color: var(--bg-1);
    border-radius: var(--radius-sm, 4px);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.04em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s ease, transform 0.12s ease;
    z-index: 5;
}
.slider-wrap.slider-dragging::after {
    opacity: 0.92;
    transform: translateX(-50%) translateY(0);
}

.window-summary {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    margin-top: 4px;
    color: var(--fg-1);
    flex-wrap: wrap;
}
.window-summary .window-label {
    font-family: var(--font-sans);
    font-weight: 500;
    color: var(--fg-2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 10px;
}

/* ----- Fund settings popover ----- */
.fund-settings-pop {
    position: absolute;
    z-index: 60;
    width: min(380px, calc(100vw - 16px));
    background: var(--bg-surface, var(--bg-1));
    border: 1px solid var(--glass-border, var(--border-hi));
    border-radius: 4px;
    box-shadow: var(--shadow-lg, var(--shadow-2));
    padding: 18px;
    color: var(--fg-0);
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
}
.fund-settings-pop .fs-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    border-bottom: 1px solid var(--glass-border, var(--border-0));
    margin-bottom: 14px;
    padding-bottom: 12px;
}
.fund-settings-pop .fs-apir {
    min-width: 0;
    color: var(--fg-heading, var(--fg-0));
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.fund-settings-pop .fs-close {
    all: unset;
    cursor: pointer;
    color: var(--fg-secondary, var(--fg-2));
    width: 28px; height: 28px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 4px;
    font-size: 16px;
    flex: 0 0 auto;
}
.fund-settings-pop .fs-close:hover { background: var(--bg-subtle, var(--bg-2)); color: var(--fg-heading, var(--fg-0)); }
.fund-settings-pop .fs-row {
    display: flex;
    flex-direction: column;
    gap: 9px;
}
.fund-settings-pop .fs-row[hidden] {
    display: none !important;
}
.fund-settings-pop .fs-row + .fs-row,
.fund-settings-pop .fs-row + .fs-foot {
    margin-top: 24px;
}
.fund-settings-pop .fs-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 400;
    color: var(--fg-secondary, var(--fg-2));
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.fund-settings-pop .fs-label::before {
    content: "-";
    color: var(--brand-teal, var(--accent));
    letter-spacing: 0;
}
.fund-settings-pop .fs-swatches {
    display: grid;
    grid-template-columns: repeat(auto-fill, 22px);
    gap: 7px;
    justify-content: start;
    max-width: 100%;
    overflow: hidden;
    padding: 1px;
}
.fund-settings-pop .fs-swatch {
    all: unset;
    width: 22px; height: 22px;
    box-sizing: border-box;
    border-radius: 4px;
    border: 1px solid color-mix(in oklab, var(--fg-0) 14%, transparent);
    cursor: pointer;
    transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.fund-settings-pop .fs-swatch:hover { border-color: var(--fg-heading, var(--fg-1)); }
.fund-settings-pop .fs-swatch.selected {
    box-shadow: 0 0 0 2px var(--bg-surface, var(--bg-1)), 0 0 0 4px var(--brand-dark-teal, var(--accent));
}
.fund-settings-pop .fs-hex {
    font-family: var(--font-mono);
    height: 32px;
    text-transform: uppercase;
    width: 100%;
    border-radius: 4px;
    border: 1px solid var(--border-hair, var(--border-1));
    background: var(--bg-surface, var(--bg-1));
    color: var(--fg-primary, var(--fg-0));
    font-size: 12px;
}
.fund-settings-pop .fs-benchmark {
    width: 100%;
    min-width: 0;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--border-hair, var(--border-1));
    border-radius: 4px;
    background: var(--bg-surface, var(--bg-1));
    color: var(--fg-primary, var(--fg-0));
    font: 12.5px var(--font-sans);
}
.fund-settings-pop .fs-width { width: 100%; }
.fund-settings-pop .fs-width-val { color: var(--fg-secondary, var(--fg-2)); font-size: 11px; justify-self: end; }
.fund-settings-pop .fs-row:has(.fs-width) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 12px;
    row-gap: 9px;
    align-items: center;
}
.fund-settings-pop .fs-row:has(.fs-width) .fs-label {
    grid-column: 1 / -1;
}
.fund-settings-pop .fs-dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    padding: 2px;
    background: var(--glass-bg, var(--bg-2));
    border: 1px solid var(--glass-border, var(--border-0));
    border-radius: 4px;
}
.fund-settings-pop .fs-weight-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    padding: 2px;
    background: var(--glass-bg, var(--bg-2));
    border: 1px solid var(--glass-border, var(--border-0));
    border-radius: 4px;
}
.fund-settings-pop .fs-weight {
    all: unset;
    cursor: pointer;
    text-align: center;
    height: 28px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 400;
    color: var(--fg-secondary, var(--fg-1));
    background: transparent;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.fund-settings-pop .fs-weight:hover { color: var(--fg-heading, var(--fg-0)); }
.fund-settings-pop .fs-weight.active {
    background: var(--brand-dark-teal, var(--accent));
    color: #ffffff;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 6px 18px -8px rgba(38, 71, 79, 0.4);
}
.fund-settings-pop .fs-dash {
    all: unset;
    cursor: pointer;
    text-align: center;
    height: 28px;
    border-radius: 3px;
    font-size: 11.5px;
    font-family: var(--font-mono);
    color: var(--fg-secondary, var(--fg-1));
    background: transparent;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.fund-settings-pop .fs-dash:hover { color: var(--fg-heading, var(--fg-0)); }
.fund-settings-pop .fs-dash.active {
    background: var(--brand-dark-teal, var(--accent));
    color: #ffffff;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 6px 18px -8px rgba(38, 71, 79, 0.4);
}
.fund-settings-pop .fs-foot {
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid var(--glass-border, var(--border-0));
    padding-top: 14px;
}

:root[data-canvas="dark"] .fund-settings-pop .fs-weight.active,
:root[data-canvas="dark"] .fund-settings-pop .fs-dash.active {
    background: var(--brand-teal);
    color: var(--brand-dark-teal);
}

/* ----- Custom chart legend (sibling of the canvas, above) ----- */
.legend-chip {
    all: unset;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--bg-2);
    border: 1px solid var(--border-1);
    cursor: pointer;
    font-size: 11.5px;
    transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.legend-chip:hover { background: var(--bg-3); border-color: var(--border-hi); }
.legend-line { display: inline-block; width: 18px; flex-shrink: 0; border-radius: 1px; }
.legend-apir { font-size: 11px; color: var(--fg-0); font-weight: 500; }
.legend-name {
    color: var(--fg-2);
    max-width: 240px;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.3;
}
.legend-val { color: var(--fg-0); min-width: 48px; text-align: right; }

/* No-data summary row (fund selected but no points in window) */
.summary-wrap tr.no-data-row td { color: var(--fg-2); font-style: italic; }

.add-fund {
    width: 100%;
    height: 32px;
    justify-content: flex-start;
    font-size: 12px;
    color: var(--fg-1);
    border-style: dashed;
}
.add-fund:hover { color: var(--fg-0); border-style: solid; }

/* ----- Canvas ----- */
.canvas {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.canvas-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    padding: 0 4px;
    flex-wrap: wrap;
}
.canvas-head h2 { margin: 2px 0; }

.chart-container {
    position: relative;
    background: var(--bg-1);
    border: 1px solid var(--border-0);
    border-radius: var(--radius-md);
    padding: 10px;
    min-height: 520px;
    box-shadow: var(--shadow-1);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.chart-legend {
    flex: 0 0 auto;
    min-height: 0;
    display: none;        /* shown by JS only when an active line chart populates it */
    flex-wrap: wrap;
    gap: 6px;
    padding-bottom: 4px;
    border-bottom: 1px dashed var(--border-0);
}
.chart-legend.chart-legend-active:not(:empty) { display: flex; }
.workbench-coverage-wrap {
    flex: 0 0 auto;
    margin: 0 0 8px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.workbench-coverage-wrap .attribution-coverage-panel {
    margin: 0;
}
.risk-return-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 30px;
    margin: 0 0 8px;
}
.risk-return-header[hidden] {
    display: none !important;
}
.risk-return-title {
    margin: 0;
    min-width: 0;
    color: var(--fg-0);
    font-size: 14px;
    line-height: 1.35;
    font-weight: 600;
}
.risk-return-toolbar {
    display: flex;
    justify-content: flex-end;
    margin: 0;
    flex: 0 0 auto;
}
.risk-return-toolbar[hidden] {
    display: none !important;
}
.risk-return-font-size-group {
    flex: 0 0 auto;
}
@media (max-width: 720px) {
    .risk-return-header {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* ----- Periodic chart header (as-at label + period picker) ----- */
.periodic-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 30px;
    margin: 0 0 8px;
}
.periodic-header[hidden] {
    display: none !important;
}
.periodic-asof {
    min-width: 0;
    font-size: 11.5px;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.periodic-toolbar {
    position: relative;
    display: flex;
    justify-content: flex-end;
    flex: 0 0 auto;
}
.periodic-settings-btn {
    border: 1px solid var(--border-0);
    color: var(--fg-2);
}
.periodic-settings-btn[aria-expanded="true"] {
    background: var(--bg-1);
    color: var(--fg-0);
    box-shadow: var(--shadow-1);
}
.periodic-settings-popover {
    position: absolute;
    z-index: 40;
    top: calc(100% + 6px);
    right: 0;
    min-width: 168px;
    padding: 8px;
    background: var(--bg-1);
    border: 1px solid var(--border-1);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-2, var(--shadow-1));
}
.periodic-settings-popover[hidden] {
    display: none !important;
}
.periodic-settings-title {
    margin: 0 0 6px;
    padding: 0 4px;
    color: var(--fg-2);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.periodic-settings-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.periodic-period-option {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 26px;
    padding: 0 4px;
    border-radius: var(--radius-sm);
    color: var(--fg-1);
    font-size: 12px;
    cursor: pointer;
}
.periodic-period-option:hover {
    background: var(--bg-2);
    color: var(--fg-0);
}
.periodic-period-option input {
    accent-color: var(--accent);
    margin: 0;
    cursor: pointer;
}
.periodic-period-option input:disabled {
    cursor: default;
}
.periodic-period-option:has(input:disabled) {
    cursor: default;
    opacity: 0.55;
}
.chart-root {
    width: 100%;
    flex: 1 1 auto;
    min-height: 460px;
    height: 460px;
    position: relative;
    /* iOS Safari: suppress the long-press callout / share sheet so the
       contextmenu event reaches our handler instead. */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}
.chart-root canvas { -webkit-user-drag: none; }

.chart-cursor-label {
    position: absolute;
    z-index: 26;
    pointer-events: none;
    min-width: 108px;
    max-width: min(220px, calc(100vw - 32px));
    padding: 6px 8px;
    border: 1px solid var(--border-1);
    border-radius: 4px;
    background: color-mix(in srgb, var(--bg-0) 94%, transparent);
    color: var(--fg-0);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.14);
    font-family: var(--font-sans);
    line-height: 1.15;
    user-select: none;
}
.chart-cursor-label[hidden] {
    display: none !important;
}
.chart-cursor-label-date {
    display: block;
    color: var(--fg-2);
    font-size: 10.5px;
    white-space: nowrap;
}
.chart-cursor-label-value {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 3px;
    font-family: var(--font-mono);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.chart-cursor-label-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex: 0 0 auto;
}
.chart-cursor-label-code {
    color: var(--fg-2);
}

.chart-range-label {
    position: absolute;
    z-index: 27;
    pointer-events: none;
    min-width: 144px;
    max-width: min(240px, calc(100vw - 32px));
    padding: 7px 9px;
    border: 1px solid var(--border-1);
    border-radius: 4px;
    background: color-mix(in srgb, var(--bg-0) 95%, transparent);
    color: var(--fg-0);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
    font-family: var(--font-sans);
    line-height: 1.15;
    user-select: none;
}
.chart-range-label[hidden] {
    display: none !important;
}
.chart-range-label-head {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 5px;
    color: var(--fg-2);
    font-family: var(--font-mono);
    font-size: 10.5px;
    white-space: nowrap;
}
.chart-range-label-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex: 0 0 auto;
}
.chart-range-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    color: var(--fg-2);
    font-size: 10.5px;
    white-space: nowrap;
}
.chart-range-label-row + .chart-range-label-row {
    margin-top: 4px;
}
.chart-range-label-value {
    color: var(--fg-0);
    font-family: var(--font-mono);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}
.chart-range-label.is-positive .chart-range-label-value {
    color: var(--ok);
}
.chart-range-label.is-negative .chart-range-label-value {
    color: var(--danger);
}

/* Chart annotations. Auto return labels and user-created notes share this
   layer so generated labels can be selected and edited like manual text. */
.chart-annotations {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 20;
}
.chart-annotation {
    position: absolute;
    pointer-events: auto;
    cursor: move;
    border-radius: 2px;
    line-height: 1.2;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-variant-numeric: tabular-nums;
    user-select: none;
    max-width: 320px;
    box-sizing: border-box;
}
.chart-annotation-auto {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    padding: 0 2px;
}
.chart-annotation-return {
    transform: translateY(-50%);
    max-width: min(320px, calc(100vw - 32px));
}
.chart-annotation-selection {
    transform: none;
    padding: 2px 4px;
    max-width: min(220px, calc(100vw - 32px));
    white-space: normal;
}
.chart-annotation-auto.chart-annotation-free {
    transform: none;
    white-space: pre-wrap;
    padding: 3px 5px;
}
.chart-annotation-manual {
    padding: 3px 5px;
}
.chart-annotation.has-box {
    max-width: none;
}
.chart-annotation.has-box .chart-annotation-text {
    height: 100%;
    overflow: hidden;
}
.chart-annotation-text {
    display: block;
    width: 100%;
    min-width: 1ch;
    min-height: 1em;
    overflow-wrap: anywhere;
    pointer-events: none;
}
.chart-annotation.is-empty {
    opacity: 0.5;
}
.chart-annotation.selected {
    background-clip: padding-box;
}
.anno-resize-handle {
    position: absolute;
    z-index: 1;
    width: 7px;
    height: 7px;
    background: var(--bg-1);
    border: 1px solid var(--accent);
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.12);
}
.anno-resize-nw { top: -5px; left: -5px; cursor: nwse-resize; }
.anno-resize-n  { top: -5px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.anno-resize-ne { top: -5px; right: -5px; cursor: nesw-resize; }
.anno-resize-e  { top: 50%; right: -5px; transform: translateY(-50%); cursor: ew-resize; }
.anno-resize-se { right: -5px; bottom: -5px; cursor: nwse-resize; }
.anno-resize-s  { bottom: -5px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.anno-resize-sw { bottom: -5px; left: -5px; cursor: nesw-resize; }
.anno-resize-w  { top: 50%; left: -5px; transform: translateY(-50%); cursor: ew-resize; }
.chart-annotation-dot {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0.85;
}
.chart-annotation-placing {
    cursor: crosshair;
}
.chart-annotation-editor {
    position: absolute;
    z-index: 7;
    min-height: 34px;
    max-width: 360px;
    padding: 4px 6px;
    resize: both;
    color: var(--fg-0);
    background: var(--bg-1);
    border: 1px solid var(--accent);
    border-radius: 3px;
    box-shadow: var(--shadow-2);
    line-height: 1.25;
}
.chart-annotation-editor:focus {
    outline: none;
}
.chart-annotation-popover {
    position: fixed;
    z-index: 10000;
    width: 292px;
    padding: 10px;
    background: var(--bg-1);
    border: 1px solid var(--border-1);
    border-radius: var(--radius-sm, 4px);
    box-shadow: var(--shadow-2, 0 10px 30px -15px rgba(0,0,0,0.25));
    color: var(--fg-0);
    font: 12px/1.2 var(--font-sans, system-ui);
}
.anno-grid {
    display: grid;
    grid-template-columns: 1fr 72px 58px;
    gap: 8px;
    margin-top: 8px;
}
.anno-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.anno-field-full {
    margin-bottom: 8px;
}
.anno-field span {
    color: var(--fg-2);
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.anno-field textarea,
.anno-field select,
.anno-field input[type="number"] {
    width: 100%;
    min-width: 0;
    color: var(--fg-0);
    background: var(--bg-0);
    border: 1px solid var(--border-1);
    border-radius: 3px;
    font: 12px/1.25 var(--font-sans, system-ui);
}
.anno-field textarea {
    min-height: 44px;
    padding: 6px;
    resize: vertical;
}
.anno-field select,
.anno-field input[type="number"] {
    height: 28px;
    padding: 0 6px;
}
.anno-field input[type="color"] {
    width: 100%;
    height: 28px;
    padding: 1px;
    border: 1px solid var(--border-1);
    border-radius: 3px;
    background: var(--bg-0);
}
.anno-toolbar,
.anno-swatches,
.anno-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}
.anno-actions {
    justify-content: flex-end;
}
.anno-icon-btn,
.anno-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-1);
    background: var(--bg-0);
    color: var(--fg-0);
    border-radius: 3px;
    cursor: pointer;
}
.anno-icon-btn {
    width: 28px;
    height: 26px;
    font: 700 12px/1 var(--font-sans, system-ui);
}
.anno-icon-btn svg {
    width: 16px;
    height: 16px;
    display: block;
}
.anno-icon-btn.italic {
    font-style: italic;
}
.anno-icon-btn[aria-pressed="true"] {
    background: var(--accent-bg);
    border-color: var(--accent);
    color: var(--accent-hi);
}
.anno-swatch {
    width: 18px;
    height: 18px;
}
.anno-swatch.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}
.anno-delete {
    height: 26px;
}

/* Right-click chart context menu (cumulative / annualised label toggles). */
.chart-ctx-menu {
    position: fixed;
    z-index: 9999;
    min-width: 240px;
    background: var(--bg-1);
    border: 1px solid var(--border-1);
    border-radius: var(--radius-sm, 4px);
    box-shadow: var(--shadow-2, 0 10px 30px -15px rgba(0,0,0,0.25));
    padding: 4px;
    user-select: none;
}
.chart-ctx-menu.chart-ctx-menu-opening::after {
    content: "";
    position: absolute;
    top: 10px;
    right: 10px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid color-mix(in oklab, var(--fg-2) 25%, transparent);
    border-top-color: var(--accent);
    pointer-events: none;
    animation: pa-spin 0.7s linear infinite;
}
.chart-ctx-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 10px;
    background: transparent;
    border: 0;
    text-align: left;
    cursor: pointer;
    color: var(--fg-0);
    font: 13px/1.2 var(--font-sans, system-ui);
    border-radius: 3px;
}
.chart-ctx-item:hover,
.chart-ctx-item:focus-visible {
    background: var(--bg-0);
    outline: none;
}
.chart-ctx-item[data-action="copy-image"] {
    margin-top: 6px;
    padding-top: 11px;
    border-top: 1px solid var(--border-0);
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}
.chart-ctx-item[data-action="save-image"] {
    padding-top: 9px;
}
.chart-ctx-check {
    width: 14px;
    flex: 0 0 14px;
    text-align: center;
    color: var(--fg-1);
    font-size: 12px;
}
.chart-empty {
    position: absolute;
    inset: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-1);
    border: 1px dashed transparent;
    border-radius: 8px;
    cursor: pointer;
    margin: 0;
    transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.chart-empty:hover,
.chart-empty:focus-visible {
    background: var(--bg-0);
    border-color: var(--border-hi);
    box-shadow: 0 0 0 3px var(--accent-bg);
    outline: none;
}

.workbench-has-initial-selection .chart-empty {
    display: none;
}

/* ---------- Bootstrap loading state ----------
 * The workbench fans out three DB-backed fetches on first paint
 * (directory, holidays, sub-assets). Until they resolve, the sidebar
 * dropdowns are empty and the chart can't render — show a clear loading
 * affordance so the page doesn't look broken. The class is set in
 * main.js bootstrap() and removed once initControls + picker are wired.
 */
@keyframes pa-spin { to { transform: rotate(360deg); } }
@keyframes pa-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.loader-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 14px;
    background: var(--bg-1);
    z-index: 30;
    pointer-events: none;
}
.loader-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-0, rgba(0,0,0,0.08));
    border-top-color: var(--positive, #2c5f6f);
    border-radius: 50%;
    animation: pa-spin 0.9s linear infinite;
}
.picker-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.picker-loading .loader-spinner {
    width: 18px;
    height: 18px;
    border-width: 2px;
}
.loader-overlay .loader-text {
    color: var(--fg-secondary, #6b7480);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

body.app-loading .loader-overlay { display: flex; }
body.app-loading .chart-empty { display: none !important; }
.chart-container.chart-loading .loader-overlay { display: flex; }
.chart-container.chart-loading .chart-empty { display: none !important; }
/* Translucent variant: the overlay still shows the spinner, but the existing
 * tab content remains visible underneath so the user can see what's being
 * recomputed. Used for in-tab updates (slider release, settings toggle); the
 * default opaque variant is used for tab switches where the previous tab's
 * content is no longer relevant. */
.chart-container.chart-loading.chart-loading-translucent .loader-overlay {
    background: color-mix(in oklab, var(--bg-1) 65%, transparent);
}

/* Full-canvas loader: when an opaque chart loader is active (tab switch,
 * initial load, liquidity fetch), hide the panels around chart-container so
 * the user sees ONE buffering symbol covering the entire content area —
 * everything below the view-tabs and right of the sidebar. Don't apply this
 * to translucent loads (slider release, settings toggle) — those keep the
 * surrounding context visible underneath the overlay.
 *
 * chart-container grows to fill the freed space so the loader overlay
 * doesn't leave an empty gap below itself. */
body.workbench-loading:not(.workbench-loading-translucent) .workbench .canvas > .workbench-coverage-wrap,
body.workbench-loading:not(.workbench-loading-translucent) .workbench .canvas > #summary-wrap,
body.workbench-loading:not(.workbench-loading-translucent) .workbench .canvas > #risk-return-header,
body.workbench-loading:not(.workbench-loading-translucent) .workbench .canvas > #periodic-header,
body.workbench-loading:not(.workbench-loading-translucent) .workbench .canvas > .canvas-head {
    visibility: hidden;
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}
body.workbench-loading:not(.workbench-loading-translucent) .workbench .canvas > .chart-container {
    /* Cap the chart-container at viewport height during loading. Without
     * this, hidden tab-pane content (visibility:hidden retains layout)
     * grows the container to several thousand pixels, pushing the centred
     * spinner far down the page — the user has to scroll to find the
     * loader on tabs they've visited before. Locking the container height
     * keeps the spinner at the same Y position on every tab. */
    flex: 0 0 auto;
    height: 60vh;
    min-height: 60vh;
    max-height: 60vh;
    overflow: hidden;
}
/* Hide every direct child of chart-container EXCEPT the loader-overlay during
 * opaque loads. Without this the tab-pane's sticky toolbars and table headers
 * (which use sticky positioning + their own z-index) can peek through the
 * loader's z-index: 30. Result: the loader is the only visible thing inside
 * the canvas — exactly the "loading" state, no skeleton. */
body.workbench-loading:not(.workbench-loading-translucent) .chart-container > #chart-root,
body.workbench-loading:not(.workbench-loading-translucent) .chart-container > #tab-pane,
body.workbench-loading:not(.workbench-loading-translucent) .chart-container > #chart-empty,
body.workbench-loading:not(.workbench-loading-translucent) .chart-container > .chart-legend {
    visibility: hidden !important;
}

/* Sidebar: dim + shimmer while controls are unpopulated. */
body.controls-loading .sidebar {
    pointer-events: none;
}
body.controls-loading .sidebar .segmented,
body.controls-loading .sidebar .select,
body.controls-loading .sidebar .slider-wrap,
body.controls-loading .sidebar .switch,
body.controls-loading .sidebar .add-fund,
body.controls-loading .sidebar .fund-rows,
body.controls-loading .sidebar #window-summary {
    background: linear-gradient(
        90deg,
        var(--bg-2, rgba(0,0,0,0.04)) 0%,
        rgba(255,255,255,0.18) 50%,
        var(--bg-2, rgba(0,0,0,0.04)) 100%
    );
    background-size: 200% 100%;
    animation: pa-shimmer 1.6s ease-in-out infinite;
    color: transparent !important;
    border-color: transparent !important;
    border-radius: var(--radius-sm, 6px);
    min-height: 28px;
}
body.controls-loading .sidebar .segmented * ,
body.controls-loading .sidebar .select option,
body.controls-loading .sidebar .switch * ,
body.controls-loading .sidebar .add-fund * {
    color: transparent !important;
    background: transparent !important;
    border-color: transparent !important;
}
body.controls-loading .sidebar .eyebrow { opacity: 0.55; }

/* Search button in the topnav */
body.controls-loading .search-btn {
    pointer-events: none;
    opacity: 0.55;
}
.tab-pane {
    flex: 1 1 auto;
    min-height: 460px;
    overflow-y: auto;
}

/* ----- Top-of-canvas view tabs ----- */
.view-tabs {
    display: flex;
    gap: 2px;
    padding: 2px;
    background: var(--bg-2);
    border: 1px solid var(--border-0);
    border-radius: var(--radius-md);
    margin-bottom: 4px;
    overflow-x: auto;
    overflow-y: hidden;
}
.view-tab {
    all: unset;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1 0 auto;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    color: var(--fg-2);
    text-align: center;
    cursor: pointer;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
    white-space: nowrap;
}
.view-tab:hover { color: var(--fg-0); }
.view-tab.active {
    background: var(--bg-1);
    color: var(--fg-0);
    box-shadow: var(--shadow-1);
}
.view-tab.disabled { opacity: 0.55; cursor: pointer; }
.view-tab-badge {
    display: none;
    padding: 1px 5px;
    border: 1px solid var(--border-1);
    border-radius: 999px;
    color: var(--fg-3);
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.02em;
    line-height: 1.3;
    text-transform: uppercase;
}
.view-tab.disabled .view-tab-badge {
    display: inline-flex;
}

.workbench .canvas > .view-tabs {
    position: sticky;
    top: var(--nav-h, 60px);
    z-index: 44;
    background: var(--bg-0);
    box-shadow: 0 -1px 0 var(--bg-0), 0 1px 0 var(--bg-0);
}

.summary-wrap {
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    background: #fefefe;
}
.summary-wrap > .summary-table-panel.table-wrap {
    width: 100%;
    background: var(--bg-1);
    border: 1px solid var(--border-0);
    border-radius: var(--radius);
    box-shadow: none;
    overflow: auto;
}
.summary-wrap .summary-info-table { margin-top: 0; }
.summary-wrap td.delta-pos { color: var(--ok); }
.summary-wrap td.delta-neg { color: var(--danger); }
.summary-wrap .data-table.summary-table {
    width: 100%;
    min-width: 0;
    background: var(--bg-1);
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
}
.summary-wrap .data-table.summary-table thead th {
    text-align: center;
    background: var(--bg-2);
    color: var(--fg-2);
    border-bottom: 1px solid var(--border-0);
    font-size: 10.5px;
    font-weight: 500;
}
.summary-wrap .data-table.summary-table thead th,
.summary-wrap .data-table.summary-table tbody td {
    padding: 8px 10px;
}
.summary-wrap .data-table.summary-table tbody td {
    background: var(--bg-1);
}
.data-table.summary-table th.col-metric,
.data-table.summary-table td.col-metric { text-align: center; }
.data-table.summary-table td.summary-latest-holdings { text-align: center; }
.data-table.summary-table td.summary-snapshot-cell {
    cursor: pointer;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.data-table.summary-table td.summary-snapshot-cell:hover {
    background: var(--bg-2);
    color: var(--fg-0);
}
.data-table.summary-table th,
.data-table.summary-table td { vertical-align: middle; }
.data-table.summary-table tbody td {
    height: auto;
    padding-top: 10px;
    padding-bottom: 10px;
}
.data-table.summary-table th.col-fund,
.data-table.summary-table td.col-fund {
    max-width: 180px;
    white-space: normal;
    overflow-wrap: anywhere;
}
.data-table.summary-table td.col-fund {
    font-weight: 300;
}
.summary-settings-cell {
    cursor: pointer;
}
.summary-settings-cell:hover {
    color: var(--fg-0);
}
.summary-settings-cell:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}
.summary-cell-content {
    color: inherit;
    font: inherit;
}
.summary-code-content {
    display: inline-flex;
    align-items: center;
    gap: 0;
}
.summary-name-content {
    display: inline;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
}
.summary-remove-btn {
    all: unset;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: var(--fg-2);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
}
.summary-remove-btn:hover {
    color: var(--danger);
}
.summary-remove-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}
.summary-wrap .fund-swatch {
    display: inline-block;
    width: 8px; height: 8px; border-radius: 2px;
    margin-right: 6px;
    vertical-align: middle;
}

/* ----- uPlot theme overrides ----- */
.u-wrap         { font-family: var(--font-sans); }
.u-legend       {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    padding: 6px 0 6px;
    border-bottom: 1px dashed var(--border-0);
    margin-bottom: 8px;
    font-family: var(--font-mono);
    font-size: 11.5px;
}
.u-legend .u-series {
    color: var(--fg-1);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    padding: 0;
    cursor: pointer;
}
.u-legend .u-series > * { padding: 0 !important; }
.u-legend .u-marker { width: 10px; height: 2px; border-radius: 999px; }
.u-legend .u-label  { font-weight: 500; }
.u-legend .u-value  { color: var(--fg-0); font-variant-numeric: tabular-nums; }
.u-legend .u-off    { opacity: 0.4; text-decoration: line-through; }

.u-cursor-x, .u-cursor-y { background: var(--fg-3); opacity: 0.6; }
.u-cursor-pt            { border-width: 1px !important; }
.u-axis                 { color: var(--fg-2); }
/* An empty selection must have no border footprint at the plot origin. */
.u-select               { background: var(--accent-bg); box-shadow: inset 0 0 0 1px var(--accent); }

/* ----- Attribution tab controls ----- */
.attribution-toolbar {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    padding: 12px 16px 0;
    flex-wrap: wrap;
}
body.workbench-attribution-active #tab-pane,
.tab-pane[data-view-tab="attribution"] {
    --attr-sticky-top: var(--nav-h, 60px);
    --attr-sticky-left: 0px;
    --attr-sticky-right: 0px;
    --attr-view-tabs-sticky-height: 39px;
    --attr-toolbar-sticky-height: 44px;
    --attr-title-sticky-height: 43px;
    --attr-super-header-height: 28px;
    --attr-header-sticky-height: 80px;
    overflow-y: visible;
}
body.workbench-attribution-active .topnav,
body:has(#tab-pane[data-view-tab="attribution"]) .topnav {
    z-index: 1000;
}
body.workbench-attribution-active .chart-container {
    overflow: visible;
}
body.workbench-attribution-active.workbench-attribution-pinned #tab-pane::before {
    content: "";
    position: fixed;
    top: var(--attr-sticky-top);
    left: var(--attr-sticky-left);
    right: var(--attr-sticky-right);
    height: calc(var(--attr-view-tabs-sticky-height) + var(--attr-toolbar-sticky-height) + var(--attr-title-sticky-height) + var(--attr-header-sticky-height) + 4px);
    z-index: 40;
    pointer-events: none;
    background: var(--bg-0);
    box-shadow: 0 1px 0 var(--bg-0), 0 6px 10px -10px rgba(38, 71, 79, 0.35);
}
body.workbench-attribution-active #tab-pane .attribution-toolbar,
.tab-pane[data-view-tab="attribution"] .attribution-toolbar {
    position: sticky;
    top: calc(var(--attr-sticky-top) + var(--attr-view-tabs-sticky-height));
    z-index: 43;
    padding-bottom: 8px;
    background: var(--bg-0);
    border-bottom: 1px solid color-mix(in oklab, var(--border-0) 58%, transparent);
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
}
.attribution-field {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.attribution-field .eyebrow {
    margin: 0;
    white-space: nowrap;
    color: var(--fg-2);
    font-size: 10px;
    letter-spacing: 0.06em;
}
.attribution-grouping {
    min-width: 168px;
    height: 32px;
    border-color: var(--border-1);
    background-color: var(--bg-1);
    box-shadow: 0 1px 0 rgba(255,255,255,0.35) inset;
}
.attribution-action-group {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 2px;
    gap: 2px;
    background: var(--bg-2);
    border: 1px solid var(--border-1);
    border-radius: var(--radius);
    box-shadow: var(--shadow-1);
}
.attribution-action-divider {
    width: 1px;
    height: 18px;
    margin: 0 2px;
    background: var(--border-1);
}
.attribution-row-height-label {
    padding: 0 7px 0 8px;
    color: var(--fg-2);
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}
.attribution-tool-btn {
    all: unset;
    box-sizing: border-box;
    min-width: 86px;
    height: 26px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--fg-1);
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.attribution-row-height-group .attribution-tool-btn {
    min-width: 28px;
}
.attribution-tool-icon-btn {
    min-width: 28px;
    width: 28px;
    padding: 0;
    font-size: 14px;
}
.attribution-tool-btn:hover:not(:disabled) {
    background: var(--bg-1);
    color: var(--fg-0);
    box-shadow: var(--shadow-1);
}
.attribution-tool-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}
.attribution-tool-btn:disabled {
    opacity: 0.45;
    cursor: default;
}
.attribution-residual-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 32px;
    padding: 0 8px;
    color: var(--fg-2);
    font-size: 11.5px;
    font-weight: 500;
    white-space: nowrap;
}
.attribution-residual-toggle .switch {
    padding: 0;
}
.tab-pane[data-attr-row-height="-2"] { --attr-row-pad-y: 3px; }
.tab-pane[data-attr-row-height="-1"] { --attr-row-pad-y: 6px; }
.tab-pane[data-attr-row-height="0"] { --attr-row-pad-y: 10px; }
.tab-pane[data-attr-row-height="1"] { --attr-row-pad-y: 13px; }
.tab-pane[data-attr-row-height="2"] { --attr-row-pad-y: 16px; }
.attribution-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-height: 480px;
    margin: 10px 16px 16px;
    padding: 40px 32px;
    background: var(--bg-1);
    border: 1px dashed var(--border-0);
    border-radius: 8px;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}
.attribution-empty:hover,
.attribution-empty:focus-visible {
    background: var(--bg-0);
    border-color: var(--border-hi);
    box-shadow: 0 0 0 3px var(--accent-bg);
    outline: none;
}
.attribution-empty-add {
    height: 34px;
    padding: 0 14px;
    border-style: dashed;
    color: var(--fg-1);
    background: var(--bg-1);
}
.attribution-empty-add:hover {
    color: var(--fg-0);
    border-style: solid;
}
.selection-prompt {
    text-align: center;
}
.attribution-section {
    padding: 0 16px 16px;
}
.attribution-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 8px;
}
body.workbench-attribution-active #tab-pane .attribution-title-row,
.tab-pane[data-view-tab="attribution"] .attribution-title-row {
    position: sticky;
    top: calc(var(--attr-sticky-top) + var(--attr-view-tabs-sticky-height) + var(--attr-toolbar-sticky-height));
    z-index: 42;
    margin: 0;
    padding: 8px 0;
    background: var(--bg-0);
    border-bottom: 1px solid color-mix(in oklab, var(--border-0) 45%, transparent);
    box-shadow: 0 -1px 0 var(--bg-0);
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
}
.attribution-title-row .section-title {
    margin: 0;
    min-width: 0;
    font-weight: 400;
}
.attribution-date-range {
    flex: 0 0 220px;
    text-align: right;
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--fg-2);
    white-space: nowrap;
}
.liquidity-participation-label {
    flex-basis: auto;
    min-width: 150px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--fg-0);
}
.attribution-coverage-panel {
    margin: 0 0 10px;
    padding: 8px 10px;
    background: var(--bg-1);
    border: 1px solid var(--border-0);
    border-radius: var(--radius);
}
.tab-pane > .attribution-coverage-panel {
    margin-bottom: 12px;
}
.attribution-coverage-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    cursor: pointer;
}
.attribution-coverage-summary::-webkit-details-marker {
    display: none;
}
.attribution-coverage-panel-has-body[open] > .attribution-coverage-summary {
    margin-bottom: 7px;
}
.attribution-coverage-caret {
    width: 0;
    height: 0;
    flex: 0 0 auto;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 5px solid var(--fg-2);
    transform: rotate(90deg);
    transition: transform var(--dur) var(--ease);
}
.attribution-coverage-panel:not([open]) > .attribution-coverage-summary .attribution-coverage-caret {
    transform: rotate(0deg);
}
.attribution-coverage-panel-ok {
    background: color-mix(in oklab, var(--ok) 7%, var(--bg-1));
    border-color: color-mix(in oklab, var(--ok) 26%, var(--border-0));
}
.attribution-coverage-panel-danger {
    background: color-mix(in oklab, var(--danger) 8%, var(--bg-1));
    border-color: color-mix(in oklab, var(--danger) 34%, var(--border-0));
}
.attribution-coverage-panel-warning {
    background: color-mix(in oklab, var(--warn) 9%, var(--bg-1));
    border-color: color-mix(in oklab, var(--warn) 34%, var(--border-0));
}
.attribution-coverage-panel-neutral {
    background: var(--bg-1);
    border-color: var(--border-0);
}
.attribution-coverage-panel-danger .attribution-coverage-head,
.attribution-coverage-panel-danger .attribution-coverage-ok-status,
.attribution-coverage-panel-danger .attribution-coverage-subtle {
    color: var(--danger);
}
.attribution-coverage-panel-warning .attribution-coverage-head,
.attribution-coverage-panel-warning .attribution-coverage-ok-status,
.attribution-coverage-panel-warning .attribution-coverage-subtle {
    color: var(--warn);
}
.attribution-coverage-panel-danger .attribution-coverage-ok-icon {
    background: var(--danger);
}
.attribution-coverage-ok-status,
.attribution-coverage-neutral-status,
.attribution-coverage-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.attribution-coverage-ok-status {
    justify-content: flex-start;
    font-size: 12.5px;
    color: var(--fg-0);
}
.attribution-coverage-neutral-status {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--fg-0);
    font-size: 12.5px;
    font-weight: 500;
}
.attribution-coverage-ok-icon {
    position: relative;
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    border-radius: 999px;
    background: var(--ok);
}
.attribution-coverage-ok-icon::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 7px;
    height: 4px;
    border: solid #fff;
    border-width: 0 0 2px 2px;
    transform: translate(-50%, -58%) rotate(-45deg);
    transform-origin: center;
}
.attribution-coverage-ok-status .loader-spinner {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    border: 2px solid var(--border-0);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: pa-spin 0.9s linear infinite;
}
.attribution-coverage-head {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--fg-0);
    font-size: 12.5px;
    font-weight: 500;
}
.attribution-coverage-subtle {
    margin-left: auto;
    color: var(--fg-2);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 400;
    white-space: nowrap;
}
.attribution-coverage-scroll {
    max-height: 220px;
    overflow: auto;
}
.data-table.attribution-coverage-table {
    width: 100%;
    min-width: 0;
    font-size: 12px;
}
.data-table.attribution-coverage-table th,
.data-table.attribution-coverage-table td {
    padding: 5px 8px;
    vertical-align: middle;
}
.data-table.attribution-coverage-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: var(--fg-2);
    font-size: 10.5px;
    font-weight: 500;
    background: var(--bg-2);
}
.data-table.attribution-coverage-table .num {
    text-align: center;
    white-space: nowrap;
}
.data-table.attribution-coverage-table .attribution-coverage-code,
.data-table.attribution-coverage-table .attribution-coverage-distribution,
.data-table.attribution-coverage-table .coverage-partial {
    font-family: var(--font-mono);
}
.data-table.attribution-coverage-table .coverage-partial {
    color: var(--danger);
}
.data-table.attribution-coverage-table .attribution-coverage-warning {
    color: var(--warn);
}
.data-table.attribution-coverage-table .attribution-coverage-distribution {
    color: var(--warn);
    text-align: center;
    white-space: nowrap;
}
.data-table.workbench-validation-table .workbench-validation-status {
    white-space: nowrap;
}
.data-table.workbench-validation-table .workbench-validation-note {
    color: var(--fg-2);
    font-size: 11px;
}
.data-table.workbench-validation-table .workbench-validation-muted td {
    color: var(--fg-2);
}
.data-table.workbench-validation-table .workbench-validation-warning td {
    background: color-mix(in oklab, var(--warn) 10%, var(--bg-1));
    color: var(--warn);
}
.data-table.workbench-validation-table .workbench-validation-warning:hover td {
    background: color-mix(in oklab, var(--warn) 13%, var(--bg-1));
}
.attribution-coverage-panel-danger .data-table.attribution-coverage-table:not(.workbench-validation-table) tbody td,
.data-table.workbench-validation-table .workbench-validation-fail td {
    background: color-mix(in oklab, var(--danger) 10%, var(--bg-1));
    color: var(--danger);
}
.attribution-coverage-panel-danger .data-table.attribution-coverage-table:not(.workbench-validation-table) tbody tr:hover td,
.data-table.workbench-validation-table .workbench-validation-fail:hover td {
    background: color-mix(in oklab, var(--danger) 13%, var(--bg-1));
}
.attribution-table-scroll {
    overflow: auto;
    border-top: 1px solid var(--border-0);
}
.attribution-table-scroll:has(.attribution-table[data-fit-container="1"]) {
    overflow-x: hidden;
}
body.workbench-attribution-active #tab-pane .attribution-table-scroll,
.tab-pane[data-view-tab="attribution"] .attribution-table-scroll {
    overflow: visible;
}
.data-table.attribution-table {
    min-width: 100%;
}
.data-table.attribution-table.resizable-ready {
    min-width: 100%;
}
.data-table.attribution-table th,
.data-table.attribution-table td {
    vertical-align: middle;
}
.tab-pane[data-attr-row-height] .data-table.attribution-table.resizable-columns.resizable-ready tbody td {
    padding-top: var(--attr-row-pad-y, 10px);
    padding-bottom: var(--attr-row-pad-y, 10px);
}
.data-table.attribution-table th + th,
.data-table.attribution-table td + td {
    border-left: 1px solid color-mix(in oklab, var(--border-0) 38%, transparent);
}
.data-table.attribution-comparison-table .attr-column-header-row th:nth-child(3),
.data-table.attribution-comparison-table .attr-column-header-row th:nth-child(6),
.data-table.attribution-comparison-table .attr-column-header-row th:nth-child(9),
.data-table.attribution-comparison-table tbody td:nth-child(3),
.data-table.attribution-comparison-table tbody td:nth-child(6),
.data-table.attribution-comparison-table tbody td:nth-child(9) {
    border-left-color: color-mix(in oklab, var(--border-hi) 72%, transparent);
}
.data-table.attribution-comparison-table tbody .attribution-group-row td:nth-child(2),
.data-table.attribution-comparison-table tbody .attribution-group-row td:nth-child(5),
.data-table.attribution-comparison-table tbody .attribution-group-row td:nth-child(8) {
    border-left-color: color-mix(in oklab, var(--border-hi) 72%, transparent);
}
.data-table.attribution-comparison-table .attr-super-header-row .attr-group-boundary {
    border-left: 1px solid color-mix(in oklab, var(--border-hi) 72%, transparent);
}
.data-table.performance-table .attr-super-header-row .attr-group-boundary,
.data-table.performance-table .attr-column-header-row .attr-group-boundary,
.data-table.performance-table tbody td.attr-group-boundary {
    border-left-color: color-mix(in oklab, var(--border-hi) 72%, transparent);
}
.data-table.performance-table .attr-super-header-row .attr-group-boundary {
    border-left-style: solid;
}
.data-table.performance-table .attr-sort-button {
    padding-left: 5px;
    padding-right: 5px;
    gap: 3px;
}
.attribution-table-scroll:has(.performance-table) {
    overflow-x: auto;
}
body.workbench-attribution-active #tab-pane .attribution-table-scroll:has(.performance-table) {
    overflow: visible;
}
.data-table.performance-table,
.data-table.performance-table.resizable-ready {
    min-width: max-content;
}
.data-table.performance-table.resizable-columns.resizable-ready thead th,
.data-table.performance-table.resizable-columns.resizable-ready tbody td,
.data-table.performance-table .attr-sort-button,
.data-table.performance-table .attr-sort-label {
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
}
.data-table.performance-table thead th.num,
.data-table.performance-table tbody td.num {
    overflow: hidden;
}
.liquidity-section + .liquidity-section {
    margin-top: 16px;
}
.liquidity-kpis {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 10px;
}
.liquidity-kpi {
    display: grid;
    gap: 2px;
    min-width: 128px;
    padding: 8px 10px;
    border: 1px solid var(--border-0);
    border-radius: var(--radius);
    background: var(--bg-1);
}
.liquidity-kpi .lab {
    font-size: 10.5px;
    color: var(--fg-2);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.liquidity-kpi .val {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--fg-0);
}
.data-table.liquidity-table,
.data-table.liquidity-table.resizable-ready {
    min-width: max-content;
}
.data-table.liquidity-table th,
.data-table.liquidity-table td {
    white-space: nowrap;
}
.data-table.liquidity-table .attr-name {
    min-width: 220px;
    max-width: 360px;
    white-space: normal;
}
.liquidity-cell {
    display: grid;
    gap: 1px;
    min-height: 26px;
    align-content: center;
}
.liquidity-cell-main {
    font-family: var(--font-mono);
    color: var(--fg-0);
}
.liquidity-cell-sub {
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--fg-2);
}
.liquidity-band-hit {
    background: color-mix(in oklab, var(--accent-bg) 72%, var(--bg-1));
    color: var(--fg-0);
    font-weight: 500;
}
.liquidity-missing td {
    color: color-mix(in oklab, var(--danger) 76%, var(--fg-0));
    background: color-mix(in oklab, var(--danger) 8%, transparent);
}
.liquidity-warning td {
    color: color-mix(in oklab, var(--warn) 78%, var(--fg-0));
    background: color-mix(in oklab, var(--warn) 10%, transparent);
}
.liquidity-missing .muted,
.liquidity-proxy-label {
    color: color-mix(in oklab, var(--danger) 82%, var(--fg-0));
}
.liquidity-warning .muted,
.liquidity-warning .liquidity-proxy-label {
    color: color-mix(in oklab, var(--warn) 86%, var(--fg-0));
}
.liquidity-underlying-table th,
.liquidity-underlying-table td,
.liquidity-underlying-table .mono,
.liquidity-underlying-table .attr-identifier,
.liquidity-underlying-table .attr-name {
    white-space: normal;
    overflow-wrap: anywhere;
}
.liquidity-group-row {
    cursor: pointer;
    user-select: none;
}
.liquidity-group-row:hover .attr-row-name {
    color: var(--accent);
}
.liquidity-group-child td:first-child,
.liquidity-group-child td.attr-identifier {
    padding-left: 20px;
}
.data-table.performance-table tbody td.num {
    position: relative;
    z-index: 1;
}
.data-table.performance-table .attr-super-header-row th:first-child,
.data-table.performance-table .attr-column-header-row th:nth-child(1),
.data-table.performance-table tbody td.attr-identifier,
.data-table.performance-table tbody td.attr-group-label-cell {
    position: sticky;
    left: 0;
}
.data-table.performance-table .attr-super-header-row th:nth-child(2),
.data-table.performance-table .attr-column-header-row th:nth-child(2),
.data-table.performance-table tbody td.attr-name {
    position: sticky;
    left: 96px;
}
.data-table.performance-table .attr-super-header-row th:first-child,
.data-table.performance-table .attr-super-header-row th:nth-child(2) {
    z-index: 8;
}
.data-table.performance-table .attr-column-header-row th:nth-child(1),
.data-table.performance-table .attr-column-header-row th:nth-child(2) {
    z-index: 7;
}
.data-table.performance-table .performance-single-header-row th {
    top: 0;
}
.data-table.performance-table .attr-super-header-row th:nth-child(2),
.data-table.performance-table .attr-column-header-row th:nth-child(2) {
    overflow: visible;
}
.data-table.performance-table tbody td.attr-identifier,
.data-table.performance-table tbody td.attr-name,
.data-table.performance-table tbody td.attr-group-label-cell {
    z-index: 5;
    background: var(--bg-1);
}
.data-table.performance-table tbody td.attr-name,
.data-table.performance-table tbody td.attr-group-label-cell {
    overflow: visible;
}
.data-table.performance-table tbody td.attr-group-label-cell {
    z-index: 10;
    overflow: hidden;
    background-clip: border-box;
}
.data-table.performance-table .attr-super-header-row th:nth-child(2)::after,
.data-table.performance-table .attr-column-header-row th:nth-child(2)::after,
.data-table.performance-table tbody td.attr-name::after,
.data-table.performance-table tbody td.attr-group-label-cell::after {
    content: "";
    position: absolute;
    top: 0;
    right: -1px;
    bottom: 0;
    width: 2px;
    pointer-events: none;
    z-index: 3;
}
.data-table.performance-table .attr-super-header-row th:nth-child(2)::after,
.data-table.performance-table .attr-column-header-row th:nth-child(2)::after {
    background: color-mix(in oklab, var(--border-0) 48%, transparent);
}
.data-table.performance-table tbody td.attr-name::after,
.data-table.performance-table tbody td.attr-group-label-cell::after {
    background: color-mix(in oklab, var(--border-0) 48%, transparent);
}
.data-table.performance-table .attribution-total-row td.attr-identifier,
.data-table.performance-table .attribution-total-row td.attr-name {
    background: color-mix(in oklab, var(--bg-3) 90%, var(--fg-0) 10%);
}
.data-table.performance-table .attribution-residual-row td.attr-identifier,
.data-table.performance-table .attribution-residual-row td.attr-name {
    background: color-mix(in oklab, var(--danger) 8%, var(--bg-1));
}
.data-table.performance-table .attribution-group-row td.attr-group-label-cell {
    background: #f4f5f6;
}
.data-table.performance-table .attribution-subgroup-row td.attr-identifier,
.data-table.performance-table .attribution-subgroup-row td.attr-name {
    background: color-mix(in oklab, var(--bg-2) 62%, var(--bg-1));
}
.holdings-toolbar {
    gap: 9px;
}
.holdings-date-cap {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-left: auto;
    white-space: nowrap;
}
.holdings-date-stepper {
    display: inline-grid;
    grid-template-columns: 28px 48px 28px;
    align-items: stretch;
    gap: 4px;
}
.holdings-date-stepper .attribution-tool-icon-btn {
    min-width: 28px;
    height: 28px;
    padding: 0;
    justify-content: center;
}
.holdings-date-cap-input {
    width: 48px;
    height: 28px;
    box-sizing: border-box;
    border: 1px solid var(--border-0);
    border-radius: 4px;
    background: var(--bg-1);
    color: var(--fg-0);
    font-size: 12px;
    text-align: center;
    outline: none;
}
.holdings-date-cap-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px color-mix(in oklab, var(--accent) 18%, transparent);
}
.holdings-date-cap-input::-webkit-outer-spin-button,
.holdings-date-cap-input::-webkit-inner-spin-button {
    margin: 0;
    appearance: none;
}
.holdings-date-cap-summary {
    color: var(--fg-2);
    font-size: 11px;
    white-space: nowrap;
}
.data-table.holdings-table th.num,
.data-table.holdings-table td.num {
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.data-table.holdings-table .attr-super-header-row th {
    height: 46px;
    padding: 4px 5px;
}
.data-table.holdings-table .attr-column-header-row th {
    top: 46px;
}
.data-table.holdings-table .performance-single-header-row th,
.data-table.holdings-table .holdings-single-header-row th {
    top: 0;
}
.data-table.holdings-table .attr-super-header-row th:first-child,
.data-table.holdings-table .attr-column-header-row th:nth-child(1),
.data-table.holdings-table tbody td.attr-identifier {
    width: 128px;
    min-width: 128px;
    max-width: 128px;
}
.data-table.holdings-table .attr-super-header-row th:nth-child(2),
.data-table.holdings-table .attr-column-header-row th:nth-child(2),
.data-table.holdings-table tbody td.attr-name {
    left: 128px;
    width: 360px;
    min-width: 360px;
    max-width: 360px;
}
.data-table.holdings-table tbody td.attr-identifier,
.data-table.holdings-table tbody td.attr-name,
.data-table.holdings-table tbody td.attr-group-label-cell {
    background-clip: border-box;
}
.data-table.holdings-table tbody td.attr-identifier {
    overflow: hidden;
    text-overflow: ellipsis;
}
.data-table.holdings-table tbody td.attr-name,
.data-table.holdings-table tbody td.attr-group-label-cell {
    box-shadow: 2px 0 0 color-mix(in oklab, var(--border-0) 48%, transparent);
}
.data-table.holdings-table.resizable-columns.resizable-ready tbody td.attr-name {
    white-space: normal;
    overflow-wrap: anywhere;
}
.data-table.holdings-table.resizable-columns.resizable-ready thead th,
.data-table.holdings-table.resizable-columns.resizable-ready tbody td {
    padding-left: 7px;
    padding-right: 7px;
}
.data-table.holdings-table.resizable-columns.resizable-ready thead th.num,
.data-table.holdings-table.resizable-columns.resizable-ready tbody td.num {
    padding-left: 5px;
    padding-right: 5px;
}
.data-table.holdings-table .attr-sort-button {
    justify-content: center;
    padding-left: 4px;
    padding-right: 4px;
}
.data-table.holdings-table .holdings-date-label {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    line-height: 1.02;
    font-size: 10px;
    letter-spacing: 0;
}
.data-table.holdings-table .holdings-date-label span {
    display: block;
}
.data-table.attribution-table th.num,
.data-table.attribution-table td.num {
    text-align: center;
}
.data-table.attribution-table .attr-identifier {
    white-space: nowrap;
    overflow-wrap: normal;
}
.data-table.attribution-table.resizable-ready tbody td.attr-identifier {
    white-space: nowrap;
    overflow-wrap: normal;
}
.data-table.attribution-table .attr-name {
    overflow-wrap: anywhere;
}
.data-table.attribution-table .attr-row-ident {
    display: inline;
    min-width: 0;
    white-space: nowrap;
    overflow-wrap: normal;
}
.data-table.attribution-table .attr-row-code {
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    font-style: inherit;
    font-weight: inherit;
    line-height: inherit;
    white-space: nowrap;
}
.data-table.attribution-table .attr-row-name {
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    font-style: inherit;
    font-weight: inherit;
    line-height: inherit;
}
.data-table.attribution-table .attr-group-label-cell {
    color: var(--fg-0);
    overflow-wrap: anywhere;
}
.data-table.attribution-table .attr-sort-head {
    padding: 0;
}
.data-table.attribution-table .attr-super-header-row th {
    top: 0;
    z-index: 4;
    pointer-events: none;
    padding: 6px 10px;
    background: color-mix(in oklab, #26474f 84%, #ffffff 16%);
    color: #fff;
    font-size: 10.5px;
    font-weight: 400;
    text-align: center;
    letter-spacing: 0.08em;
}
.data-table.attribution-table .attr-super-header-row th:first-child {
    background: color-mix(in oklab, #26474f 84%, #ffffff 16%);
}
.data-table.attribution-table .attr-column-header-row th {
    top: 27px;
    z-index: 3;
    background: color-mix(in oklab, #26474f 84%, #ffffff 16%);
    color: #fff;
}
body.workbench-attribution-active #tab-pane .data-table.attribution-table .attr-super-header-row th,
.tab-pane[data-view-tab="attribution"] .data-table.attribution-table .attr-super-header-row th {
    z-index: 2;
}
body.workbench-attribution-active #tab-pane .data-table.attribution-comparison-table .attr-column-header-row th,
.tab-pane[data-view-tab="attribution"] .data-table.attribution-comparison-table .attr-column-header-row th {
    z-index: 2;
}
body.workbench-attribution-active #tab-pane .data-table.attribution-single-table .attr-column-header-row th,
.tab-pane[data-view-tab="attribution"] .data-table.attribution-single-table .attr-column-header-row th {
    z-index: 2;
}
body.workbench-attribution-active #tab-pane .data-table.attribution-table thead,
.tab-pane[data-view-tab="attribution"] .data-table.attribution-table thead {
    position: sticky;
    top: calc(var(--attr-sticky-top) + var(--attr-view-tabs-sticky-height) + var(--attr-toolbar-sticky-height) + var(--attr-title-sticky-height));
    z-index: 41;
    background: color-mix(in oklab, #26474f 84%, #ffffff 16%);
    box-shadow: 0 -2px 0 var(--bg-0), 0 2px 0 color-mix(in oklab, #26474f 84%, #ffffff 16%);
}
body.workbench-attribution-active #tab-pane .data-table.attribution-table .attr-super-header-row,
body.workbench-attribution-active #tab-pane .data-table.attribution-table .attr-column-header-row,
.tab-pane[data-view-tab="attribution"] .data-table.attribution-table .attr-super-header-row,
.tab-pane[data-view-tab="attribution"] .data-table.attribution-table .attr-column-header-row {
    background: color-mix(in oklab, #26474f 84%, #ffffff 16%);
}
body.workbench-attribution-active #tab-pane .data-table.attribution-table .attr-super-header-row th,
body.workbench-attribution-active #tab-pane .data-table.attribution-table .attr-column-header-row th,
.tab-pane[data-view-tab="attribution"] .data-table.attribution-table .attr-super-header-row th,
.tab-pane[data-view-tab="attribution"] .data-table.attribution-table .attr-column-header-row th {
    border-top: 0;
    border-bottom: 0;
}
.data-table.attribution-table .attr-header-spacer-row td {
    background: #ffffff;
    padding: 0;
    border: 0;
    height: 1px;
    line-height: 1px;
    font-size: 0;
}
body.workbench-attribution-active #tab-pane .data-table.attribution-table thead th,
.tab-pane[data-view-tab="attribution"] .data-table.attribution-table thead th {
    position: relative;
    top: auto;
    left: auto;
}
.data-table.attribution-table.performance-table .performance-single-header-row th {
    top: 0;
}
.data-table.attribution-table thead th {
    background: color-mix(in oklab, #26474f 84%, #ffffff 16%);
    color: #fff;
}
.data-table.attribution-table .attr-sort-button {
    all: unset;
    box-sizing: border-box;
    width: 100%;
    min-height: 100%;
    padding: 9px 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    white-space: normal;
    overflow-wrap: anywhere;
}
.data-table.attribution-table .attr-sort-label {
    min-width: 0;
    line-height: 1.15;
}
.data-table.attribution-table th.num .attr-sort-button {
    justify-content: center;
    text-align: center;
}
.data-table.attribution-table .attr-sort-button:hover {
    color: #fff;
}
.data-table.attribution-table .attr-sort-mark {
    color: rgba(255,255,255,0.78);
    font-size: 9px;
    line-height: 1;
}
.data-table.attribution-table .attribution-total-row td {
    font-weight: 500;
    background: color-mix(in oklab, var(--bg-3) 90%, var(--fg-0) 10%);
    border-bottom-color: color-mix(in oklab, var(--border-hi) 78%, var(--fg-0) 22%);
}
.data-table.attribution-table .attribution-fee-row td {
    background: color-mix(in oklab, var(--bg-2) 46%, var(--bg-1));
}
.data-table.attribution-table .attribution-residual-row td {
    color: var(--danger);
    background: color-mix(in oklab, var(--danger) 8%, var(--bg-1));
}
.data-table.attribution-table .attribution-group-row td {
    background: #f4f5f6;
    font-weight: 500;
    border-top: 1px solid var(--border-0);
}
.data-table.attribution-table .attribution-group-row,
.data-table.attribution-table .attribution-subgroup-row {
    cursor: pointer;
}
.data-table.attribution-table .attribution-subgroup-row td {
    background: color-mix(in oklab, var(--bg-2) 62%, var(--bg-1));
    font-weight: 300;
    border-top: 1px solid var(--border-0);
}
.data-table.attribution-table .attribution-subgroup-row .attr-row-name { font-weight: inherit; }
.data-table.attribution-table .attribution-sourced-row .attr-name,
.data-table.attribution-table .attribution-fee-row .attr-name,
.data-table.attribution-table .attribution-residual-row .attr-name { padding-left: 14px; }
.data-table.attribution-table .attribution-subgroup-row .attr-name { padding-left: 10px; }
.data-table.attribution-table .attribution-item-row .attr-name { padding-left: 10px; }
.data-table.attribution-table .attribution-subgroup-child-row .attr-name { padding-left: 24px; }
/* ----- Fund picker modal ----- */
.picker-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 10vh 16px;
    background: rgba(0, 0, 0, 0.36);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: picker-fade var(--dur) var(--ease);
}
.picker-overlay.open { display: flex; }
@keyframes picker-fade { from { opacity: 0; } to { opacity: 1; } }

.picker {
    width: min(640px, 92vw);
    max-height: 60vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-1);
    border: 1px solid var(--border-hi);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2);
    overflow: hidden;
    animation: picker-pop var(--dur) var(--ease);
}
@keyframes picker-pop {
    from { transform: translateY(-8px) scale(0.98); opacity: 0; }
    to   { transform: translateY(0)    scale(1);    opacity: 1; }
}
.picker-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-0);
    color: var(--fg-2);
}
.picker-header input {
    flex: 1;
    height: 28px;
    border: none;
    background: transparent;
    font-size: 14px;
    color: var(--fg-0);
}

/* "Clear all" sits where the decorative Esc badge used to. flex-shrink: 0
   because .picker-header input is flex: 1 and would otherwise squeeze the label
   onto two lines on a narrow lightbox. Bordered rather than a bare ghost so it
   reads as a real control in the header (the sidebar's Clear has the section
   chrome around it to do that job; here there is none). */
.picker-header .picker-clear-all {
    flex: 0 0 auto;
    height: 24px;
    padding: 0 10px;
    border-color: var(--border-1);
    color: var(--fg-2);
    white-space: nowrap;
}
.picker-header .picker-clear-all:hover {
    /* Destructive-ish, so the hover leans on the negative colour rather than
       the neutral --bg-2 the generic .btn-ghost:hover uses. */
    border-color: var(--negative, #b3261e);
    color: var(--negative, #b3261e);
    background: transparent;
}
.picker-header input:focus-visible { outline: none; box-shadow: none; }
.picker-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 10px 6px;
    border-bottom: 1px solid var(--border-0);
}
.picker-tab {
    all: unset;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 26px;
    min-width: 0;
    padding: 0 10px;
    border-radius: var(--radius);
    color: var(--fg-2);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.picker-tab:hover {
    color: var(--fg-0);
    background: var(--bg-2);
}
.picker-tab.active {
    color: var(--fg-0);
    background: var(--bg-2);
    box-shadow: inset 0 0 0 1px var(--border-1);
}
.picker-group-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-0);
    background: var(--bg-1);
}
.picker-group-controls[data-picker-group-mode="economic"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.picker-group-controls[hidden] {
    display: none;
}
.picker-portfolio-source-switch {
    grid-column: span 2;
}
.picker-portfolio-source-switch[hidden] {
    display: none;
}
.picker-group-tile {
    all: unset;
    box-sizing: border-box;
    min-width: 0;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 6px 10px;
    border: 1px solid var(--border-0);
    border-radius: var(--radius);
    color: var(--fg-2);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
    transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.picker-group-tile[hidden] {
    display: none !important;
}
.picker-group-tile:hover {
    color: var(--fg-0);
    background: var(--bg-2);
    border-color: var(--border-1);
}
.picker-group-tile.active {
    color: var(--fg-0);
    background: var(--bg-2);
    border-color: var(--border-hi);
}
/* Portfolio source is a binary setting, not an additive grouping choice.
   Restore the Workbench Value-basis segmented-control treatment after the
   generic picker tile rules above, which otherwise override `.seg`. */
.picker-portfolio-source-switch .picker-group-tile {
    all: unset;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 26px;
    border-radius: var(--radius-sm);
    color: var(--fg-2);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 500;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
    white-space: nowrap;
}
.picker-portfolio-source-switch .picker-group-tile:hover { color: var(--fg-0); }
.picker-portfolio-source-switch .picker-group-tile.active {
    background: var(--brand-dark-teal, #26474f);
    box-shadow: var(--shadow-1);
    color: #fff;
}
:root[data-canvas="dark"] .picker-portfolio-source-switch .picker-group-tile.active {
    background: var(--brand-dark-teal, #26474f);
    color: #fff;
}
.picker-group-tile[data-order] {
    padding-right: 34px;
}
.picker-group-tile[data-order]::after {
    content: attr(data-order);
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--bg-0);
    font: 600 10px/1 var(--font-mono);
}
.picker-results {
    flex: 1;
    overflow-y: auto;
    padding: 0 4px 4px;
}
/* Column-based picker rows. The grid shape on .picker-table-head:where(:not(.sp-header)) and
   .picker-row:where(:not(.sp-row)) must match — change one, change the other. */
.picker { width: min(960px, 96vw); max-height: 70vh; }
.picker-table-head:where(:not(.sp-header)),
.picker-row:where(:not(.sp-row)) {
    display: grid;
    grid-template-columns: minmax(0, 80px) minmax(0, 110px) minmax(0, 2fr) minmax(0, 1.4fr) minmax(0, 96px) minmax(0, 96px) minmax(0, 70px) minmax(0, 96px);
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
}
.picker-table-head:where(:not(.sp-header)).funds,
.picker-row:where(:not(.sp-row)).funds {
    grid-template-columns: minmax(0, 110px) minmax(0, 2fr) minmax(0, 94px) minmax(0, 78px) minmax(0, 94px) minmax(0, 70px) minmax(0, 60px);
}
.picker-table-head:where(:not(.sp-header)) > * {
    text-align: center;
    justify-self: center;
}
.picker-table-head:where(:not(.sp-header)).portfolios,
.picker-row:where(:not(.sp-row)).portfolios {
    grid-template-columns: minmax(0, 110px) minmax(0, 2fr) minmax(0, 96px) minmax(0, 116px) minmax(0, 116px);
}
.picker-table-head:where(:not(.sp-header)).indexes,
.picker-row:where(:not(.sp-row)).indexes {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 92px) minmax(0, 1.4fr);
}
.picker-table-head:where(:not(.sp-header)).benchmarks,
.picker-row:where(:not(.sp-row)).benchmarks {
    grid-template-columns: minmax(0, 120px) minmax(0, 2fr) minmax(0, 90px) minmax(0, 90px) minmax(0, 70px);
}
.picker-table-head:where(:not(.sp-header)).objectives,
.picker-row:where(:not(.sp-row)).objectives {
    grid-template-columns: minmax(0, 100px) minmax(0, 2fr) minmax(0, 130px) minmax(0, 80px) minmax(0, 96px) minmax(0, 70px);
}
.picker-table-head:where(:not(.sp-header)).economics,
.picker-row:where(:not(.sp-row)).economics {
    grid-template-columns: minmax(0, 145px) minmax(0, 2fr) minmax(0, 115px) minmax(0, 95px) minmax(0, 120px) minmax(0, 70px) minmax(0, 96px) minmax(0, 70px);
}
.picker-table-head:where(:not(.sp-header)).bonds,
.picker-row:where(:not(.sp-row)).bonds {
    grid-template-columns: minmax(0, 105px) minmax(0, 2fr) minmax(0, 130px) minmax(0, 70px) minmax(0, 78px) minmax(0, 96px) minmax(0, 70px);
}
.picker-table-head:where(:not(.sp-header)).stocks,
.picker-row:where(:not(.sp-row)).stocks {
    grid-template-columns: minmax(0, 120px) minmax(0, 2fr) minmax(0, 120px) minmax(0, 1.2fr) minmax(0, 96px) minmax(0, 70px) minmax(0, 60px);
}
.picker-table-head:where(:not(.sp-header)).global-search,
.picker-row:where(:not(.sp-row)).global-search {
    grid-template-columns: minmax(130px, 0.8fr) minmax(120px, 1fr) minmax(0, 2.4fr);
}
.picker-table-head:where(:not(.sp-header)).global-search > *,
.picker-row:where(:not(.sp-row)).global-search > * {
    min-width: 0;
    justify-self: stretch;
    text-align: left;
}
.picker-row:where(:not(.sp-row)).global-search .asset-type {
    color: var(--fg-2);
    font-size: 11.5px;
}
.picker-row:where(:not(.sp-row)).global-search .code,
.picker-row:where(:not(.sp-row)).global-search .name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.picker-table-head:where(:not(.sp-header)).custom-selection,
.picker-row:where(:not(.sp-row)).custom-selection {
    grid-template-columns: minmax(180px, 1.8fr) minmax(86px, 0.5fr) minmax(150px, 1fr) minmax(150px, 1fr) minmax(74px, 0.4fr) minmax(70px, 0.4fr);
    min-width: 820px;
}
.picker-table-head:where(:not(.sp-header)).custom-selection > :nth-child(2),
.picker-row:where(:not(.sp-row)).custom-selection > :nth-child(2) {
    justify-self: center;
    text-align: center;
}
.picker-results.custom-results {
    overflow: auto;
}
.picker-search-section {
    padding: 0 0 10px;
}
.picker-search-section + .picker-search-section {
    border-top: 1px solid var(--border-0);
}
.picker-search-section-title {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 30px;
    padding: 7px 10px;
    color: var(--fg-1);
    background: color-mix(in oklab, var(--bg-1) 92%, transparent);
    border-bottom: 1px solid var(--border-0);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0;
}
.picker-table-head:where(:not(.sp-header)) > *,
.picker-row:where(:not(.sp-row)) > * {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.picker-accordion-line:where(:not(.sp-group)) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 6px;
}
.picker-accordion-line:where(:not(.sp-group)).level-1 {
    margin-top: 4px;
}
.picker-accordion-line:where(:not(.sp-group)).level-1 .picker-accordion-head:where(:not(.sp-group-toggle)).level-1 {
    margin-top: 0;
}
.picker-accordion-head:where(:not(.sp-group-toggle)) {
    all: unset;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 7px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--fg-1);
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.picker-accordion-head:where(:not(.sp-group-toggle)):hover {
    background: var(--bg-2);
    color: var(--fg-0);
}
.picker-accordion-head:where(:not(.sp-group-toggle)).level-1 {
    margin-top: 4px;
    background: var(--bg-2);
    color: var(--fg-0);
    font-weight: 500;
}
.picker-accordion-head:where(:not(.sp-group-toggle)).level-2 {
    padding-left: 28px;
    color: var(--fg-0);
    font-size: 12px;
    font-weight: 500;
}
.picker-accordion-head:where(:not(.sp-group-toggle)) .chevron {
    color: var(--fg-2);
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1;
}
.picker-accordion-head:where(:not(.sp-group-toggle)) .label {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.picker-accordion-head:where(:not(.sp-group-toggle)) .count {
    color: var(--fg-2);
    font-size: 10.5px;
}
.picker-select-group {
    border: 0;
    background: transparent;
    color: var(--fg-1);
    border-radius: 0;
    padding: 3px 8px;
    font: 400 11px/1.2 var(--font-sans);
    white-space: nowrap;
    cursor: pointer;
}
.picker-select-group:hover {
    background: transparent;
    color: var(--fg-0);
}
.picker-select-group.active {
    background: transparent;
    color: var(--accent-hi);
}
.picker-select-group:disabled {
    color: var(--fg-1);
    cursor: default;
    opacity: 1;
}
.picker-select-cell {
    display: flex;
    align-self: stretch;
    align-items: stretch;
    border: 0;
    border-radius: 0;
    overflow: hidden;
}
.picker-accordion-line:where(:not(.sp-group)) + .picker-accordion-line:where(:not(.sp-group)) .picker-select-cell {
    margin-top: 0;
}
.picker-select-cell:hover {
    color: var(--fg-0);
}
.picker-select-cell .picker-select-group {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 24px;
    border: 0;
    border-radius: 0;
    padding: 0 10px;
}
.picker-accordion-line:where(:not(.sp-group)).added {
    background: var(--accent-bg);
}
.picker-accordion-line:where(:not(.sp-group)).added .picker-accordion-head:where(:not(.sp-group-toggle)) {
    background: transparent;
}
.picker-row:where(:not(.sp-row)).funds,
.picker-row:where(:not(.sp-row)).portfolios,
.picker-row:where(:not(.sp-row)).bonds,
.picker-row:where(:not(.sp-row)).stocks {
    margin-left: 28px;
}
.picker-portfolio-code {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.picker-row-expander {
    all: unset;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    color: var(--fg-2);
    font: 11px/1 var(--font-mono);
    cursor: pointer;
    flex: 0 0 16px;
}
.picker-row-expander:hover {
    background: var(--bg-2);
    color: var(--fg-0);
}
.picker-row-expander-spacer {
    width: 16px;
    flex: 0 0 16px;
}
.picker-carveout-row:where(:not(.sp-row)) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(190px, 250px);
    align-items: stretch;
    gap: 10px;
    margin-left: 56px;
    padding: 0 10px;
    color: var(--fg-1);
    font-size: 12.5px;
    line-height: 1.2;
    border-left: 1px solid var(--border-0);
}
.picker-carveout-row:where(:not(.sp-row)) > .name {
    display: flex;
    align-items: center;
    padding: 5px 0;
}
.picker-carveout-row:where(:not(.sp-row)).added {
    background: var(--accent-bg);
}
.picker-carveout-actions {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    min-width: 0;
    border: 0;
    border-radius: 0;
    overflow: hidden;
}
.picker-carveout-actions-single {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.picker-carveout-actions-single .picker-select-group {
    grid-column: 2;
}
.picker-carveout-row:where(:not(.sp-row)) + .picker-carveout-row:where(:not(.sp-row)) .picker-carveout-actions {
    margin-top: 0;
}
.picker-carveout-actions .picker-select-group {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 24px;
    border: 0;
    border-radius: 0;
    padding: 0 8px;
    text-align: center;
}
.picker-carveout-benchmark {
    position: absolute;
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--fg-2);
    font-size: 9px;
}
.type-pill {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.type-pill.type-fund      { background: var(--accent-bg); color: var(--accent-hi); }
.type-pill.type-portfolio { background: color-mix(in oklab, var(--info) 12%, transparent); color: var(--info); }
.type-pill.type-carveout  { background: color-mix(in oklab, var(--accent) 12%, transparent); color: var(--accent-hi); }
.type-pill.type-benchmark { background: color-mix(in oklab, var(--ok) 12%, transparent); color: var(--ok); }
.type-pill.type-index     { background: color-mix(in oklab, #111827 10%, transparent); color: #111827; }
.type-pill.type-stock     { background: color-mix(in oklab, var(--fg-2) 12%, transparent); color: var(--fg-1); }
.type-pill.type-bond      { background: color-mix(in oklab, var(--info) 14%, transparent); color: var(--info); }
.type-pill.type-objective { background: color-mix(in oklab, var(--warn) 14%, transparent); color: var(--warn); }
[data-theme="dark"] .type-pill.type-index {
    background: color-mix(in oklab, #ffffff 12%, transparent);
    color: #ffffff;
}
.picker-table-head:where(:not(.sp-header)) {
    position: sticky;
    top: 0;
    background: var(--bg-1);
    color: var(--fg-2);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
    border-bottom: 1px solid var(--border-0);
    z-index: 5;
    box-shadow: 0 -8px 0 8px var(--bg-1);
}
.picker-row:where(:not(.sp-row)) {
    cursor: pointer;
    border-radius: var(--radius);
    color: var(--fg-2);
    font-size: 12.5px;
    transition: background var(--dur) var(--ease);
}
.picker-row:where(:not(.sp-row)):hover,
.picker-results.keyboard-nav .picker-row:where(:not(.sp-row)).active {
    background: var(--bg-2);
    color: var(--fg-0);
}
.picker-row:where(:not(.sp-row)) .apir    { color: var(--fg-1); font-weight: 400; }
.picker-row:where(:not(.sp-row)) .name,
.picker-row:where(:not(.sp-row)) .company { white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
.picker-row:where(:not(.sp-row)) .company { color: var(--fg-2); }
.picker-row:where(:not(.sp-row)) .index-name { color: var(--fg-1); white-space: normal; overflow-wrap: anywhere; }
.picker-row:where(:not(.sp-row)) .dist-good { color: var(--ok); font-size: 11px; font-family: var(--font-mono); font-weight: 600; }
.picker-row:where(:not(.sp-row)) .dist-bad  { color: var(--danger); font-size: 11px; font-family: var(--font-mono); font-weight: 600; }
.picker-row:where(:not(.sp-row)).added,
.picker-row:where(:not(.sp-row)).added:hover,
.picker-row:where(:not(.sp-row)).added.active {
    background: var(--accent-bg);
    opacity: 1;
}
.picker-row:where(:not(.sp-row)).added::after { content: none; display: none; }
.picker-row:where(:not(.sp-row)) mark {
    background: var(--accent-bg);
    color: var(--accent-hi);
    border-radius: 2px;
    padding: 0 1px;
}
.picker-empty {
    padding: 36px 16px;
    text-align: center;
    color: var(--fg-2);
    font-size: 13px;
}

.picker-footer {
    display: flex;
    gap: 14px;
    padding: 8px 14px;
    border-top: 1px solid var(--border-0);
    font-size: 11px;
    color: var(--fg-2);
    align-items: center;
}
.picker-footer .spacer { flex: 1; }

.snapshot-overlay .snapshot-modal {
    width: min(720px, 94vw);
    max-height: 72vh;
}
.snapshot-header {
    color: var(--fg-0);
}
.snapshot-header .spacer {
    flex: 1;
}
.snapshot-title {
    color: var(--fg-0);
    font-size: 14px;
    font-weight: 500;
}
.snapshot-subtitle {
    margin-top: 2px;
    color: var(--fg-2);
    font-size: 12px;
}
.snapshot-close {
    all: unset;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius);
    color: var(--fg-2);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}
.snapshot-close:hover {
    background: var(--bg-2);
    color: var(--fg-0);
}
.snapshot-results {
    padding: 0;
    overflow-x: hidden;
}
.snapshot-results .data-table.snapshot-table {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    table-layout: fixed !important;
}
.snapshot-results .data-table.snapshot-table thead th,
.snapshot-results .data-table.snapshot-table tbody td {
    padding: 8px 10px !important;
    text-align: center;
    white-space: normal !important;
    overflow-wrap: anywhere;
}
.snapshot-results .data-table.snapshot-table th:nth-child(1),
.snapshot-results .data-table.snapshot-table td:nth-child(1) {
    width: 34%;
}
.snapshot-results .data-table.snapshot-table th:nth-child(2),
.snapshot-results .data-table.snapshot-table td:nth-child(2),
.snapshot-results .data-table.snapshot-table th:nth-child(3),
.snapshot-results .data-table.snapshot-table td:nth-child(3) {
    width: 33%;
}
.snapshot-results .data-table.snapshot-table th:first-child,
.snapshot-results .data-table.snapshot-table td:first-child {
    text-align: left;
}
#snapshot-count {
    color: var(--fg-0);
    font-size: 13px;
    font-weight: 500;
}

/* ----- Save custom selection modal ----- */
.custom-selection-save-overlay {
    z-index: 60;
}
.custom-selection-save-modal {
    width: min(620px, 94vw);
    max-height: 72vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-1);
    border: 1px solid var(--border-hi);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2);
    overflow: hidden;
}
.custom-selection-save-head,
.custom-selection-save-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-0);
}
.custom-selection-save-foot {
    justify-content: flex-end;
    border-top: 1px solid var(--border-0);
    border-bottom: 0;
}
.custom-selection-save-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--fg-0);
}
.custom-selection-save-subtitle {
    margin-top: 2px;
    font-size: 11.5px;
    color: var(--fg-2);
}
.custom-selection-close {
    margin-left: auto;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--fg-2);
    cursor: pointer;
    font-size: 18px;
}
.custom-selection-close:hover {
    background: var(--bg-2);
    color: var(--fg-0);
}
.custom-selection-save-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    padding: 14px;
    overflow: auto;
}
.custom-selection-name-field {
    display: grid;
    gap: 6px;
    color: var(--fg-1);
    font-size: 12px;
    font-weight: 500;
}
.custom-selection-name-field input {
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--border-1);
    border-radius: var(--radius);
    background: var(--bg-0);
    color: var(--fg-0);
    font: 13px var(--font-sans);
}
.custom-selection-existing-wrap {
    display: grid;
    gap: 6px;
    min-height: 0;
}
.custom-selection-existing-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--fg-2);
    font-size: 11.5px;
}
.custom-selection-existing-table-wrap {
    max-height: 210px;
    overflow: auto;
    border: 1px solid var(--border-0);
    border-radius: var(--radius);
}
.custom-selection-existing-table {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
    font-size: 12px;
}
.custom-selection-existing-table th,
.custom-selection-existing-table td {
    padding: 7px 8px;
    border-bottom: 1px solid var(--border-0);
    text-align: left;
    vertical-align: top;
    white-space: normal;
    overflow-wrap: anywhere;
}
.custom-selection-existing-table th {
    color: var(--fg-2);
    font-weight: 500;
    background: var(--bg-2);
}
.custom-selection-existing-table tr:last-child td {
    border-bottom: 0;
}
.custom-selection-existing-pick {
    border: 0;
    background: transparent;
    color: var(--fg-1);
    padding: 0;
    text-align: left;
    font: 500 12px/1.25 var(--font-sans);
    cursor: pointer;
}
.custom-selection-existing-pick:hover,
.custom-selection-existing-pick.active {
    color: var(--accent-hi);
}
.custom-selection-empty {
    color: var(--fg-2);
    text-align: center;
}
.custom-selection-save-status {
    min-height: 16px;
    color: var(--fg-2);
    font-size: 11.5px;
}
.custom-selection-save-status.error {
    color: var(--danger);
}

/* ----- Debug panel ----- */
.debug-panel {
    position: fixed;
    right: 16px; bottom: 16px;
    z-index: 40;
    width: 320px;
    background: var(--bg-1);
    border: 1px solid var(--border-hi);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-2);
    padding: 12px 14px;
    font-size: 11.5px;
    color: var(--fg-1);
}
.debug-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.debug-panel .kv { display: flex; justify-content: space-between; gap: 16px; padding: 2px 0; }
.debug-panel .kv > span:first-child { color: var(--fg-2); }
.debug-panel hr { border: none; border-top: 1px dashed var(--border-0); margin: 6px 0; }
