/* Trading Coordinator — Dark theme */

:root {
    --bg-primary: #0d1117;
    --bg-main: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-hover: #30363d;
    --border: #30363d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #484f58;
    --accent: #58a6ff;
    --accent-hover: #79c0ff;
    --green: #3fb950;
    --green-bg: rgba(63, 185, 80, 0.1);
    --red: #f85149;
    --red-bg: rgba(248, 81, 73, 0.1);
    /* direction chip (.side-chip): a SOLID red / green box with white text (operator 2026-10-02: "color those boxes
       red/green"), on the emphasis fills below -- the pairing white text needs (>= 4.59:1, tests/test_text_on_fills.py
       and tests/js/check_side_chip.js measure it). Until then a 0.14 tint with lighter text. One theme only: this
       stylesheet has no light theme (no prefers-color-scheme / data-theme anywhere), so the tokens live here. */
    --side-yes-fg: #ffffff;
    --side-yes-bg: var(--success-emphasis);
    --side-yes-border: var(--success-emphasis);
    --side-no-fg: #ffffff;
    --side-no-bg: var(--danger-emphasis);
    --side-no-border: var(--danger-emphasis);
    --yellow: #d29922;
    --yellow-bg: rgba(210, 153, 34, 0.1);
    /* Belief-source line colours on Portfolio -> Performance (operator 2026-10-03 22:00Z: quant + whitelist "a clearly
       different colour" from quant; they were two blues). Read by app.js _ppSrcColor, which appends a hex alpha, so
       each stays a #rrggbb value. */
    --src-quant: #3a8fd0;
    --src-quant-wl: #bc8cff;

    /* SEMANTIC TOKENS (2026-10-02): until then 21 custom properties were REFERENCED and defined nowhere, so every site
       rendered its fallback -- or, with no fallback, NOTHING (44 `background: var(--panel-bg)` were transparent, 28
       `font-family: var(--mono)` were not monospace, 11 `var(--border-soft)` borders were absent). One definition each;
       the per-site fallbacks are gone. tests/test_css_tokens_defined.py fails any var() of an undefined name. */
    --panel-bg: var(--bg-primary);       /* the two sites that wrote a fallback wrote #0d1117 */
    --border-soft: #21262d;              /* a subtle row rule (sites wrote #222 / #1a1a1a) */
    --mono: 'SF Mono', Menlo, monospace; /* this stylesheet's own mono stack */
    --positive: var(--green);            /* 5.99:1 or better on the three backgrounds */
    --negative: var(--red);              /* 4.54:1 or better */
    --danger: var(--red);
    --good: #1f9d8d;                     /* the model-health palette's teal: 4.54:1 or better */
    --success: var(--green);
    --warning: var(--yellow);            /* 6.03:1 or better */

    /* EMPHASIS FILLS (2026-10-02): --accent / --green / --red are FOREGROUND colours (Primer's *.fg). Used as SOLID FILLS
       under white text they measured 2.53 / 2.54 / 3.35:1 (13 selected-tab styles, the Switchboard ON buttons, the
       danger buttons). Primer dark's *.emphasis fills are the pairing for white text: >= 4.59:1, and >= 4.07:1 against
       the page so the fill still reads. ONE-LINE VETO, if the light-blue selected look is preferred: make .active text
       dark instead (#0d1117 on #58a6ff = 7.49:1) and point --accent-emphasis back at var(--accent).
       tests/test_text_on_fills.py fails light text on a fill under 4.5:1, static rules and runtime badge maps alike. */
    --accent-emphasis: #1f6feb;
    --success-emphasis: #238636;
    --danger-emphasis: #da3633;
    --attention-emphasis: #9e6a03;
    --severe-emphasis: #bd561d;
    --neutral-emphasis: #6e7681;

    /* The whole document is scaled by this below.  It is a variable because
     * `zoom` multiplies EVERY length in the subtree, viewport units included,
     * so any page that wants a box exactly one viewport tall has to divide by
     * the same number (see portal.html). */
    --app-zoom: 1.3;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    /* Prevent body-level scroll on every page.  Without this, `zoom: 1.3`
     * scales `.app-container { height: 100vh }` beyond the actual viewport,
     * which gives the browser body its own vertical scrollbar IN ADDITION
     * to the `.main-content` scrollbar — two scrollbars stacked side-by-side
     * on the right edge.  Constraining height + hiding overflow at the root
     * forces all vertical scrolling into the sidebar and main-content panes
     * where it belongs (one scrollbar per pane, max).
     */
    height: 100vh;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.5;
    zoom: var(--app-zoom);
}

/* ── Form elements (dark theme) ────────────────────── */

select, input[type="number"] {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 14px;
}

select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

select option:hover,
select option:checked {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ── Layout ───────────────────────────────────────── */

.app-container {
    display: flex;
    /* Compensate for `body { zoom: 1.3 }` — vh units are computed against the
     * unzoomed viewport, so plain `100vh` would render 1.3x taller than the
     * window and overflow body.  Dividing by the zoom factor keeps the
     * container exactly viewport-tall AFTER the body zoom is applied, so
     * neither body nor app-container needs its own scrollbar.  All vertical
     * scrolling is delegated to `.sidebar` and `.main-content` (one bar per
     * pane, max).  If the zoom factor on body changes, update both numbers.
     */
    height: calc(100vh / 1.3);
}

.sidebar {
    width: 190px;
    min-width: 190px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* ── Tab bar ───────────────────────────────────────── */

.tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 4px 8px 0 8px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    min-height: 32px;
    align-items: flex-end;
    /* Stick to the top of whatever container ends up scrolling (body
       or .content-area) so the tabs stay visible no matter how far
       down we scroll.  z-index above the sticky-header-clone (100) so
       table headers slide underneath rather than overlapping. */
    position: sticky;
    top: 0;
    z-index: 150;
}

.tab-bar:empty {
    display: none;
}

.tab-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 4px 5px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    font-size: 12px;
    color: var(--text-secondary);
    user-select: none;
    max-width: 240px;
    position: relative;
}

.tab-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.tab-item.active {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--accent);
    margin-bottom: -1px;
    padding-bottom: 6px;
}

.tab-item .tab-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    flex: 1;
}

.tab-item .tab-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    font-size: 14px;
    line-height: 1;
    color: var(--text-muted);
    border-radius: 3px;
    cursor: pointer;
    flex-shrink: 0;
}

.tab-item .tab-close:hover {
    background: var(--red-bg);
    color: var(--red);
}

/* ── Sidebar ──────────────────────────────────────── */

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h1 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.sidebar-header .subtitle {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Portal identity + exit (see /portal — the Client/Operator front door). */
/* Stacked, not side-by-side: the sidebar is 190px wide (158px inside the
   padding), which is not enough for the badge and the exit link on one line —
   side-by-side clipped the link mid-word. */
.portal-badge-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin-top: 9px;
}

.portal-badge {
    align-self: flex-start;
    font-size: 9.5px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 600;
    color: #a855f7;
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.35);
    border-radius: 4px;
    padding: 2px 7px;
    white-space: nowrap;
}

a.portal-exit {
    display: block;
    text-align: center;
    font-size: 10.5px;
    color: var(--text-secondary);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 4px 8px;
    white-space: nowrap;
}

a.portal-exit:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
    background: var(--bg-hover);
}

/* The destructive sibling.  "Back to portal" is plain navigation and keeps the
   session; "Sign out" drops it and forces a password to come back.  Recessed by
   default and only warm on hover, so the harmless link is the one the eye lands
   on first. */
a.portal-exit.portal-exit-signout {
    color: var(--text-muted);
    border-style: dashed;
}

a.portal-exit.portal-exit-signout:hover {
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.55);
    border-style: solid;
}

.sidebar-section {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.sidebar-section-title {
    padding: 4px 16px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-subsection-title {
    padding: 6px 16px 2px;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    opacity: 0.6;
}

.section-filter {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

.section-filter input[type="checkbox"] {
    width: 12px;
    height: 12px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ── Collapsible sidebar groups ─────────────────────
 * A section/subsection title flagged .sidebar-collapse-toggle hides its
 * .collapsible-item members (display:none via .collapse-hidden) and shows
 * a (visible/total) count + caret. Driven by toggleCollapse()/initCollapseGroups()
 * in app.js. Composes with toggleSection's inline display (filter wins when off). */
.sidebar-collapse-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}
.sidebar-collapse-toggle:hover { color: var(--text-primary); }
.sidebar-collapse-toggle .collapse-meta {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.sidebar-collapse-toggle .collapse-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0;
    text-transform: none;
}
.sidebar-collapse-toggle .collapse-caret {
    font-size: 13px;
    color: var(--text-primary);
    width: 14px;
    text-align: center;
    transition: transform 0.1s;
}
.collapse-hidden { display: none !important; }

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 6px 16px;
    cursor: pointer;
    color: #c9d1d9;
    text-decoration: none;
    font-size: 13px;
    transition: background 0.1s;
}

.sidebar-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-item.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-left: 2px solid var(--accent);
    padding-left: 14px;
}

.sidebar-item .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
}

/* Sidebar counts (operator 2026-10-02, app.js _navBadgeView): "(N)" in amber, an unknown "(?)" / "(unchecked)" muted. */
.sidebar-item .nav-badge { margin-left: 5px; font-size: 0.85em; font-weight: 600; color: #e0a93b; }
.sidebar-item .nav-badge.unknown { color: var(--text-secondary); font-weight: 500; }
.sidebar-item .nav-badge:empty { display: none; }

.sidebar-item .dot.quant { background: var(--accent); }
.sidebar-item .dot.fundamental { background: var(--green); }
.sidebar-item .dot.systematic { background: #d2a8ff; }  /* purple: not .quant's accent, not .fundamental's green, not .shared's yellow */
.sidebar-item .dot.shared { background: var(--yellow); }
.sidebar-item .dot.portfolio { background: #a371f7; }
.sidebar-item .dot.tools { background: #f0883e; }
.sidebar-item .dot.universe { background: #bc8cff; }
.sidebar-item .dot.manual { background: #3fb950; }
/* Signal-research pages (Reversion, Microstructure, …) — bright yellow
 * dot to signal that these pages are dedicated to building a specific
 * trading signal, not generic analytics. */
.sidebar-item .dot.signal {
    background: #fde047;
    box-shadow: 0 0 4px rgba(253, 224, 71, 0.55);
}
.sidebar-item.signal-page { color: #fef3c7; }
.sidebar-item.signal-page:hover { color: #fde68a; }

.sidebar-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Content panels ───────────────────────────────── */

.panel {
    display: none;
    padding: 20px;
}

.panel.active {
    display: block;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.panel-title {
    font-size: 18px;
    font-weight: 600;
}

.panel-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.panel-meta .timestamp {
    font-size: 11px;
    color: var(--text-secondary);
}

.panel-meta .badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.badge.cached {
    background: var(--yellow-bg);
    color: var(--yellow);
}

.badge.live {
    background: var(--green-bg);
    color: var(--green);
}

.badge.error {
    background: var(--red-bg);
    color: var(--red);
}

/* ── Account dropdown ─────────────────────────────── */

.account-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.account-selector label {
    font-size: 12px;
    color: var(--text-secondary);
}

.account-selector select {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 13px;
    cursor: pointer;
    outline: none;
}

.account-selector select:focus {
    border-color: var(--accent);
}

/* ── Summary cards ────────────────────────────────── */

.summary-cards {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.summary-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 11px;
    min-width: 96px;
}

.summary-card .label {
    font-size: 10px;
    color: var(--text-secondary);
    margin-bottom: 3px;
}

.summary-card .value {
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.summary-card .value-sub {
    font-size: 10px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    margin-top: 1px;
    opacity: 0.8;
}

/* ── Data table ───────────────────────────────────── */

.table-container {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    position: relative;
}

.sticky-header-clone {
    position: fixed;
    z-index: 100;
    background: var(--bg-tertiary);
    border-bottom: 2px solid var(--border);
    overflow: hidden;
    display: none;
}

.shc-cell {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 0;
    margin: 0;
    border: none;
    font: inherit;
    overflow: hidden;
}
/* Manual Rebalance's right-aligned names (its th class .mrb-num, copied onto the clone cell) keep the 5 px its own
   header gives them: flush on the column edge, "Target" ran into the next column's "Share of gap" (operator 2026-10-25) */
.shc-cell.mrb-num { padding-right: 5px; }

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

thead th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    text-align: left;
    padding: 8px 10px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    /* No position:sticky — the JS clone handles sticky headers
       across all tables without multi-table overlap conflicts */
}

th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 18px;
}

th.sortable:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

th.sortable::after {
    content: '\2195';
    position: absolute;
    right: 4px;
    opacity: 0.3;
    font-size: 10px;
}

th.sort-asc::after {
    content: '\25B2';
    opacity: 0.8;
    color: var(--accent);
}

th.sort-desc::after {
    content: '\25BC';
    opacity: 0.8;
    color: var(--accent);
}

th.sort-abs::after {
    content: '\2195';
    opacity: 0.8;
    color: var(--accent);
}

/* Trader table: compact columns, allow question text wrapping */
#tbl-trader th, #tbl-trader td {
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}
#tbl-trader th:nth-child(1) { max-width: 100px; }  /* Timestamp */
#tbl-trader th:nth-child(2), #tbl-trader td:nth-child(2) {
    white-space: normal;
    max-width: 220px;
    min-width: 140px;
}
#tbl-trader th {
    white-space: normal;  /* allow header text to wrap */
    line-height: 1.2;
}

tbody td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

/* Parameter Fitting tables: lots of narrow numeric columns plus one or two
   wide text columns (Side / Variant / Feature). The global `white-space:
   nowrap` above forces those text columns onto a single line, pushing the
   whole table past the viewport width. Shrink the font a touch, tighten
   padding, and let the text columns wrap (two lines is fine) so each table
   fits without a horizontal scrollbar. */
#tbl-side-proposals,
#tbl-variant-proposals,
#tbl-feature-filters {
    font-size: 11px;
}
#tbl-side-proposals tbody td,
#tbl-variant-proposals tbody td,
#tbl-feature-filters tbody td {
    padding: 5px 7px;
}
/* Side column (both proposal tables) — slug wraps under the label */
#tbl-side-proposals tbody td:nth-child(1),
#tbl-variant-proposals tbody td:nth-child(1) {
    white-space: normal;
    max-width: 110px;
    line-height: 1.25;
}
/* Variant column — the long one; allow it to split over two lines */
#tbl-variant-proposals tbody td:nth-child(2) {
    white-space: normal;
    max-width: 170px;
    line-height: 1.25;
}
/* Feature column — long sig_* names + inline descriptions */
#tbl-feature-filters tbody td:nth-child(1) {
    white-space: normal;
    max-width: 220px;
    line-height: 1.25;
}

/* Auto-numbering row index column via CSS counters */
tbody { counter-reset: rownum; }
tbody tr:not(.summary-row) { counter-increment: rownum; }
td.row-idx { color: var(--text-secondary); font-size: 10px; text-align: right; padding-right: 4px; min-width: 24px; }
td.row-idx::before { content: counter(rownum); }
th.row-idx-hdr { min-width: 24px; width: 24px; }
/* Expanded per-level rows under a Quote Sim multi-price quote: not numbered. */
tbody tr.qs-child-row { counter-increment: none; }
tr.qs-child-row td.row-idx::before { content: ''; }

tbody tr:hover {
    background: var(--bg-hover);
}

tbody tr:last-child td {
    border-bottom: none;
}

td.positive {
    color: var(--green);
}

td.negative {
    color: var(--red);
}

/* Δ C is the headline metric — bold font-weight regardless of sign. */
td.delta-composite {
    font-weight: 700;
}

/* Entry columns are historical reference; muted so they don't compete
   with live signal / delta columns for attention. */
td.entry-ref {
    color: var(--text-muted);
}

td.question {
    white-space: normal;
    max-width: 350px;
    word-wrap: break-word;
}

/* Quote Sim's quotes + holds tables: numeric columns shouldn't wrap
 * their content (it makes a single-row contract balloon vertically
 * just because a "$1.2K" value soft-broke).  Question column wraps
 * to 2 lines as needed — operator preference is fit-on-page over
 * single-line questions (no horizontal scrollbar).
 */
.compact-table td:not(.question) {
    white-space: nowrap;
}
.compact-table td.question {
    /* Keep table-cell semantics (display:-webkit-box on the td itself
     * collapses the row — the cell stops being a table cell, observed
     * 2026-05-11: question rendered on its own line above the data row).
     * The 2-line clamp lives on an inner .clamp2 span the JS wraps
     * every question in. */
    max-width: 280px;
    line-height: 1.25;
    vertical-align: top;
}

/* Compact-table headers wrap to 2 lines so wide labels like
 * "NEAR BID DPTH" can stack vertically while keeping the column
 * narrow.  Bottom-aligned so 1-line and 2-line headers align at
 * the data row's top edge.  Explicit <br> in the JS header text
 * controls the wrap point; without that the browser breaks on the
 * first space, which often isn't where we want it. */
.compact-table thead th {
    white-space: normal;
    vertical-align: bottom;
    line-height: 1.15;
}

/* Market / contract name cells in dense tables: slightly smaller text, and
   wrap to at most TWO lines (ellipsis beyond) instead of overflowing the
   column.  The clamp must live on an inner element so the <td> keeps
   display:table-cell — same pattern as .compact-table td.question. */
.mkt-name-cell {
    font-size: 0.9em;
}
.clamp2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

/* Global anchor color — the browser default (blue / purple-on-visited) is
   unreadable on the dark #0d1117 background.  Match the app's table-link
   convention: near-white by default, accent + underline on hover.  More
   specific link rules below still override where they intend to. */
a {
    color: var(--text-primary);
}

a:visited {
    color: var(--text-primary);   /* kill the purple visited state */
}

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

td.question a {
    color: var(--text-primary);
    text-decoration: none;
}

td.question a:hover {
    color: var(--accent);
    text-decoration: underline;
}

.data-table a {
    color: var(--text-primary);
    text-decoration: none;
}

.data-table a:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* Summary row */
tr.summary-row td {
    font-weight: 600;
    border-top: 2px solid var(--border);
    background: var(--bg-tertiary);
}
/* the Portfolio NAV check under TOTAL (2026-10-26): quieter than TOTAL, amber when over the tolerance */
tr.pf-navchk-row td {
    font-weight: 500;
    border-top: 1px dashed var(--border);
    color: var(--text-secondary);
}
tr.pf-navchk-row td.pf-navchk-flag {
    color: var(--yellow);
    font-weight: 650;
}

/* ── Sheet data table (raw from Google Sheets) ────── */

.sheet-table {
    font-size: 11px;
}

.sheet-table td,
.sheet-table th {
    padding: 4px 8px;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sheet-table td.has-link a {
    color: var(--accent);
    text-decoration: none;
}

.sheet-table td.has-link a:hover {
    text-decoration: underline;
}

.sheet-table .desc-row td {
    color: var(--text-secondary);
    font-style: italic;
    white-space: normal;
}

.sheet-table .header-row td,
.sheet-table .header-row th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 9px;
    letter-spacing: 0.3px;
    /* Wide tabs (SC/SM Signal Values: one column per variant) used to
     * overflow horizontally because thead th forces nowrap, so each
     * single-word variant label (staleinsensitive, vpin_flow, ...) held
     * its column at full single-line width.  Allow up to two lines:
     * overflow-wrap:anywhere lets long words break, which lowers the
     * column's min-content width so columns narrow and more fit.
     * vertical-align:bottom keeps 1-line headers aligned with 2-line
     * ones (mirrors .compact-table thead th). */
    white-space: normal;
    overflow-wrap: anywhere;
    vertical-align: bottom;
    line-height: 1.15;
}

/* ── Loading / empty states ───────────────────────── */

.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.loading .spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state .icon {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.error-message {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid rgba(248, 81, 73, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 13px;
}

/* Trading > Themes: a warning that is not an error, and a write's confirmation */
.th-warn { background: var(--yellow-bg); color: var(--yellow); border: 1px solid rgba(210, 153, 34, 0.3);
    border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.th-ok { background: var(--green-bg); color: var(--green); border: 1px solid rgba(63, 185, 80, 0.3);
    border-radius: 8px; padding: 8px 12px; font-size: 13px; }
/* a Themes cell that carries prose (an engine's reason, a store error, a question): wraps, where the global
   `tbody td` rule keeps every cell on one line and a long reason runs off the page (visual check 2026-10-01) */
.th-wrap { white-space: normal; overflow-wrap: anywhere; }

/* ── Refresh button ───────────────────────────────── */

.btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.1s;
}

.btn:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

.btn:active {
    background: var(--border);
}

/* ── Joint account placeholder ────────────────────── */

.placeholder-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: var(--text-muted);
}

.placeholder-panel .icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.placeholder-panel h3 {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.placeholder-panel p {
    font-size: 13px;
}

/* ── Status bar ───────────────────────────────────── */

/* ── Trader editable cells ─────────────────────────── */

.trader-table td.editable-cell {
    padding: 2px 4px;
    background: rgba(88, 166, 255, 0.05);
}

.trader-table .cell-input {
    width: 100%;
    min-width: 60px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 3px 6px;
    font-size: 11px;
    font-family: inherit;
    outline: none;
}

.trader-table .cell-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.trader-table .cell-input.needs-input {
    border-color: var(--yellow);
    border-style: dashed;
    background: var(--yellow-bg);
}

.trader-table .cell-input.saving {
    border-color: var(--yellow);
    opacity: 0.7;
}

.trader-table .cell-input.saved {
    border-color: var(--green);
    background: var(--green-bg);
    /* permanent — stays green until page reload */
}

.trader-table .cell-input.save-error {
    border-color: var(--red);
    background: var(--red-bg);
}

th.editable-header {
    background: rgba(88, 166, 255, 0.1) !important;
}

/* ── Status bar ───────────────────────────────────── */

.status-bar {
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

/* Each status item lays its dot + label out the same way so the dots
   line up vertically regardless of item (Local span vs Geo inline-flex). */
.status-bar > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.status-bar .dot-indicator {
    flex: none;
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-bar .dot-indicator.connected { background: var(--green); }

/* ── Universe / New Contracts ────────────────────── */

/* ── Constraints page (2026-09-20) ───────────────────────────────────── */
.cstr-banner { border-radius: 8px; padding: 14px 18px; margin: 4px 0 12px 0; border: 1px solid var(--border); background: var(--bg-tertiary); }
.cstr-banner.ok { background: var(--green-bg); border-color: var(--green); }
.cstr-banner.warn { background: var(--yellow-bg); border-color: var(--yellow); }
.cstr-banner.breach { background: var(--red-bg); border-color: var(--red); }
.cstr-banner.unknown { background: var(--bg-tertiary); border-color: #8b949e; }
.cstr-banner-head { font-size: 1.15em; font-weight: 650; }
.cstr-banner.breach .cstr-banner-head { color: var(--red); font-size: 1.35em; }
.cstr-banner.ok .cstr-banner-head { color: var(--green); }
.cstr-banner.warn .cstr-banner-head { color: var(--yellow); }
.cstr-banner-sub { margin-top: 4px; font-size: 12px; color: var(--text-secondary); }
/* Volatility Breaker page (operator 2026-09-25): tags for the breaker's verdict and the trader's standing. */
.vb-tag { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; font-weight: 600; border: 1px solid var(--border); white-space: nowrap; }
.vb-tag.vb-paused { color: var(--red); border-color: var(--red); background: var(--red-bg); }
.vb-tag.vb-ok { color: var(--green); border-color: var(--green); background: var(--green-bg); }
.vb-tag.vb-unknown { color: #8b949e; }
.vb-tag.vb-exempt { color: var(--yellow); border-color: var(--yellow); background: var(--yellow-bg); }
.vb-tag.vb-waived { color: var(--accent); border-color: var(--accent); }
.vb-tag.vb-respect { color: var(--text-secondary); }
/* A paused row is marked at its edge; only the range cells OVER their limit are filled
   (operator 2026-09-29: "not all boxes should be red, just the ones whose price movement was exceeded"). */
.vb-row-paused td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.vb-table td.vb-over { background: var(--red-bg); color: var(--red); font-weight: 650; }
.vb-move { font-size: 11px; font-weight: 600; white-space: nowrap; }
.vb-trip { color: var(--red); }
.vb-row-exempt td:nth-child(7) { background: var(--yellow-bg); }
.vb-q { font-weight: 600; max-width: 520px; }
.vb-sub { font-size: 11px; color: var(--text-secondary); }
.vb-controls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 11px; }
.vb-controls .btn-xs { padding: 1px 6px; font-size: 11px; line-height: 1.4; }
.vb-eng { display: inline-block; margin-right: 10px; }
.cstr-basis { font-size: 12px; color: var(--text-secondary); margin: 0 0 12px 0; }
.cstr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.cstr-card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.cstr-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.cstr-card-title { font-weight: 600; }
.cstr-card-count { font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cstr-card-limit { font-size: 12px; color: var(--text-secondary); margin: 2px 0 8px 0; }
.cstr-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--bg-tertiary); border: 1px solid var(--border); }
.cstr-bar.all-ok { box-shadow: 0 0 0 1px var(--green) inset; }
.cstr-seg { display: block; height: 100%; }
.cstr-card-foot { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 8px; font-size: 11px; }
.cstr-mech { color: var(--text-muted); margin-left: auto; }
.cstr-note { font-size: 12px; color: var(--text-secondary); margin: 10px 0 0 0; }
.cstr-pill { font-size: 11px; white-space: normal; }
.cstr-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.cstr-h3 { margin: 22px 0 8px 0; font-size: 1em; font-weight: 600; }
.cstr-h3-sub { font-weight: 400; font-size: 12px; color: var(--text-secondary); margin-left: 8px; }
.cstr-tag { display: inline-block; font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; padding: 1px 6px; border-radius: 4px; margin-right: 8px; vertical-align: middle; border: 1px solid var(--border); color: var(--text-secondary); }
.cstr-tag.holding { border-color: var(--accent); color: var(--accent); }
.cstr-tag.trading { border-color: var(--yellow); color: var(--yellow); }
.cstr-unavailable { font-size: 11px; color: var(--yellow); margin-top: 10px; }
/* Headroom (2026-09-20): one bar per measured check, fill = value / limit, right edge = the limit,
   tick = the alert line. The dollars sit in the caption; nothing here is a number of its own. */
.cstr-room-bar { position: relative; height: 6px; margin: 4px 0 2px 0; border-radius: 3px; overflow: hidden; background: var(--bg-tertiary); border: 1px solid var(--border); }
.cstr-room-bar.over { border-color: var(--red); }
.cstr-room-fill { display: block; height: 100%; }
.cstr-mark { position: absolute; top: -1px; bottom: -1px; width: 2px; margin-left: -1px; background: var(--yellow); }
.cstr-room { display: block; font-size: 10px; line-height: 1.3; color: var(--text-secondary); }
.cstr-card .cstr-room-bar { height: 12px; border-radius: 6px; margin: 0; }
.cstr-card-room { font-size: 11px; color: var(--text-secondary); margin-top: 6px; }
/* No horizontal scroll (operator 2026-09-20): the two tables FIT the panel. A fixed layout takes
   the colgroup widths, and headers, pills and captions wrap instead of holding a column open;
   both global rules they override (thead th nowrap, .cstr-pill nowrap) are what forced the bar. */
.cstr-table { table-layout: fixed; width: 100%; }
.cstr-table thead th, .cstr-table td { white-space: normal; overflow-wrap: break-word; vertical-align: top; }
.cstr-table td code { white-space: normal; overflow-wrap: anywhere; }

/* ── Direction chip: a contract's side, YES / NO (operator 2026-10-01: "the direction of the contract right now
   (no / yes) is inside grey boxes it should be color coded and a bit more prominent"). ONE definition for every page
   -- render it with sideChip(side) in app.js; manual_rebalance.js adopts the class for its outcome badge. The TEXT
   always carries the meaning (colour is the second carrier, never the only one); bold + a fixed min-width make it read
   at a glance without out-shouting the contract name beside it. Tokens: --side-* on :root. */
.side-chip {
    display: inline-block;
    min-width: 2.7em;
    text-align: center;
    font-size: 0.78em;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.35;
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    white-space: nowrap;
    vertical-align: middle;
}
.side-chip.side-yes { color: var(--side-yes-fg); background: var(--side-yes-bg); border-color: var(--side-yes-border); }
.side-chip.side-no { color: var(--side-no-fg); background: var(--side-no-bg); border-color: var(--side-no-border); }

.badge-inline {
    display: inline-block;
    font-size: 9px;
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 600;
    vertical-align: middle;
    margin-left: 6px;
}

.badge-inline.orphan {
    background: var(--red-bg);
    color: var(--red);
}

.closed-badge {
    display: inline-block;
    font-size: 9px;
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 600;
    vertical-align: middle;
    margin-left: 6px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

td.position-cell {
    font-size: 11px;
    white-space: nowrap;
}

/* ── Category filter ────────────────────────────── */

.category-filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    margin-bottom: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
}

.category-filter-bar .filter-label {
    color: var(--text-secondary);
}

.category-filter-bar .filter-clear {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 12px;
}

.category-filter-bar .filter-clear:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

td.category-cell {
    cursor: pointer;
    transition: color 0.15s;
}

td.category-cell:hover {
    color: var(--accent);
    text-decoration: underline;
}

.category-dropdown {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 13px;
    cursor: pointer;
    min-width: 140px;
}

.category-dropdown:focus {
    outline: 1px solid var(--accent);
    border-color: var(--accent);
}

/* ── Factor Exposure panel ────────────────────────────── */

.factor-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 8px;
}

.factor-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
}

.factor-card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.factor-card-header .factor-rank {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-right: 10px;
}

.factor-card-header .factor-var {
    font-size: 11px;
    color: var(--text-secondary);
}

.factor-beta {
    font-size: 16px;
    font-weight: 600;
    font-family: 'SF Mono', Menlo, monospace;
}

.factor-loadings {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.factor-loadings th,
.factor-loadings td {
    text-align: left;
    padding: 4px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.factor-loadings th {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.factor-loadings td.num,
.factor-loadings th.num {
    text-align: right;
    font-family: 'SF Mono', Menlo, monospace;
}

.factor-loadings td.question {
    max-width: 500px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.factor-trim-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-secondary);
}

.factor-trim-controls input[type="number"] {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 3px 6px;
    font-family: 'SF Mono', Menlo, monospace;
    border-radius: 3px;
}

/* ── Trim proposal panel ────────────────────────────── */

.factor-trim-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin: 12px 0;
}

.factor-trim-summary .muted {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 3px;
}

.factor-trim-summary .big {
    font-size: 16px;
    font-weight: 600;
    font-family: 'SF Mono', Menlo, monospace;
    color: var(--text-primary);
}

.factor-trim-summary .big .muted {
    display: inline;
    font-size: 11px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    margin-left: 4px;
}

.factor-trim-subhead {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 14px 0 6px 0;
    font-weight: 500;
}

.factor-trim-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.factor-trim-table th,
.factor-trim-table td {
    padding: 4px 8px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.factor-trim-table th {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.factor-trim-table td.num,
.factor-trim-table th.num {
    text-align: right;
    font-family: 'SF Mono', Menlo, monospace;
}

.factor-trim-table td.question {
    max-width: 500px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Geoblock banner & sidebar indicator ─────────────── */

/* data_validity caveats strip (queue53): fixed to the BOTTOM so it never enters the top banners' stacking
   enumeration below. Amber, not red: it says which days a page masked or should distrust, not that
   trading is halted. body.data-caveats-active pads the app so the strip covers nothing. */
.data-caveats-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #7a5a00;
    color: #fff;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.4);
    border-top: 2px solid #b58900;
}
.data-caveats-banner.data-caveats-unavailable { background: #7a1f1f; border-top-color: #b52a23; }
/* every range acknowledged (known and taken into account): same strip, muted -- a NEW taint turns it amber again */
.data-caveats-banner.data-caveats-known { background: #2f3640; border-top-color: #4b5563; color: #cbd5e1; box-shadow: none; }
.data-caveats-msg { font-weight: 700; white-space: nowrap; }
.data-caveats-detail { opacity: 0.92; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.data-caveats-active .app-container { padding-bottom: 32px; box-sizing: border-box; }
/* Memory-index fold reminder: the same bottom strip, one step above the caveats banner so both
   can show; slate rather than amber, it is housekeeping, not a data warning. */
.memory-index-banner { background: #2d3a4f; border-top-color: #58a6ff; z-index: 9998; }
body.data-caveats-active .memory-index-banner { bottom: 32px; }
body.memory-index-banner-active .app-container { padding-bottom: 32px; box-sizing: border-box; }
body.memory-index-banner-active.data-caveats-active .app-container { padding-bottom: 64px; }
/* "Restarted at frozen" strip (operator 2026-10-20): the bottom-most strip, variable height (one block per event),
   so the two single-line strips above it and the app padding move by --restart-banner-h, which pollRestartEvents
   sets from the rendered height. Red: a process froze and something restarted it while nobody was looking. */
.restart-banner {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 9997;
    background: var(--danger-emphasis); color: #fff; padding: 8px 44px 8px 16px; font-size: 12px;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.5); border-top: 2px solid var(--red);
    max-height: 40vh; overflow-y: auto;
}
.restart-banner-head { font-weight: 700; margin-bottom: 4px; }
.restart-banner-row { margin: 4px 0; line-height: 1.4; }
.restart-banner-row b { color: #ffd6d6; }
.restart-banner-age { opacity: 0.8; margin-left: 6px; }
.restart-banner-foot { opacity: 0.8; font-size: 0.92em; }
.restart-banner-x {
    position: absolute; top: 6px; right: 10px; background: transparent; border: 1px solid rgba(255, 255, 255, 0.5);
    color: #fff; font-size: 16px; line-height: 1; padding: 2px 7px; border-radius: 4px; cursor: pointer;
}
.restart-banner-x:hover { background: rgba(255, 255, 255, 0.15); }
body.restart-banner-active .data-caveats-banner { bottom: var(--restart-banner-h, 0px); }
body.restart-banner-active .memory-index-banner { bottom: var(--restart-banner-h, 0px); }
body.restart-banner-active.data-caveats-active .memory-index-banner { bottom: calc(var(--restart-banner-h, 0px) + 32px); }
body.restart-banner-active .app-container { padding-bottom: var(--restart-banner-h, 0px); box-sizing: border-box; }
body.restart-banner-active.data-caveats-active .app-container { padding-bottom: calc(var(--restart-banner-h, 0px) + 32px); }
body.restart-banner-active.memory-index-banner-active .app-container { padding-bottom: calc(var(--restart-banner-h, 0px) + 32px); }
body.restart-banner-active.memory-index-banner-active.data-caveats-active .app-container { padding-bottom: calc(var(--restart-banner-h, 0px) + 64px); }
/* the per-panel caveat line (rendered by _renderDataCaveatsBanner beside the cache banner) */
.data-caveats-panel { font-size: 11px; color: #e0b300; margin-right: 10px; white-space: nowrap; }
.data-caveats-panel.data-caveats-unavailable { color: #ff6b6b; }
.data-caveats-panel.data-caveats-known { color: #8b949e; }
/* armed but the page's loader did not apply the masks: the numbers INCLUDE the tainted days -- red, like unreadable */
.data-caveats-panel.data-caveats-unapplied { color: #ff6b6b; }

.geoblock-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: var(--danger-emphasis);
    color: #fff;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    border-bottom: 2px solid #b52a23;
}

/* When a banner is visible, offset the app so the red bar doesn't
   overlap the sidebar header. Applied via the .geoblock-active /
   .cb-banner-active / .disk-banner-active classes on <body> from app.js.
   Each bar is 44px; stacking order is geoblock → circuit-breaker → disk. */
body.geoblock-active .app-container,
body.cb-banner-active .app-container,
body.disk-banner-active .app-container {
    padding-top: 44px;
    height: 100vh;
    box-sizing: border-box;
}
/* Two banners up at once. */
body.geoblock-active.cb-banner-active .app-container,
body.geoblock-active.disk-banner-active .app-container,
body.cb-banner-active.disk-banner-active .app-container,
body.geoblock-active.deploy-banner-active .app-container,
body.cb-banner-active.deploy-banner-active .app-container,
body.disk-banner-active.deploy-banner-active .app-container {
    padding-top: 88px;
}
/* Three. */
body.geoblock-active.cb-banner-active.disk-banner-active .app-container,
body.geoblock-active.cb-banner-active.deploy-banner-active .app-container,
body.geoblock-active.disk-banner-active.deploy-banner-active .app-container,
body.cb-banner-active.disk-banner-active.deploy-banner-active .app-container {
    padding-top: 132px;
}
/* All four. */
body.geoblock-active.cb-banner-active.disk-banner-active.deploy-banner-active .app-container {
    padding-top: 176px;
}
body.geoblock-active #cb-banner {
    top: 44px;
}
body.geoblock-active #disk-banner,
body.cb-banner-active #disk-banner {
    top: 44px;
}
body.geoblock-active.cb-banner-active #disk-banner {
    top: 88px;
}
/* Deploy banner stacks LAST: below whichever of the three alert banners are up.
   Same enumeration pattern as #disk-banner above — each predecessor subset gets
   its offset (44px per active predecessor). */
body.geoblock-active #deploy-banner,
body.cb-banner-active #deploy-banner,
body.disk-banner-active #deploy-banner {
    top: 44px;
}
body.geoblock-active.cb-banner-active #deploy-banner,
body.geoblock-active.disk-banner-active #deploy-banner,
body.cb-banner-active.disk-banner-active #deploy-banner {
    top: 88px;
}
body.geoblock-active.cb-banner-active.disk-banner-active #deploy-banner {
    top: 132px;
}

/* Deploy banner: informational blue, not alarm red — a deploy is routine. */
#deploy-banner.deploy-banner {
    background: #1f4e8c;
    border-bottom-color: #163a69;
}
.deploy-banner-stages {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    font-size: 12px;
}
.deploy-stage {
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    opacity: 0.55;
}
.deploy-stage.done {
    opacity: 0.85;
    background: rgba(255, 255, 255, 0.22);
}
.deploy-stage.done::before {
    content: "✓ ";
}
.deploy-stage.current {
    opacity: 1;
    background: rgba(255, 255, 255, 0.3);
    animation: deploy-stage-pulse 1.2s ease-in-out infinite;
}
.deploy-stage-sep {
    opacity: 0.5;
}
/* The webapp's own restart (app.js _showServerRestarting): the deploy banner, amber, while /api/health cannot answer */
#deploy-banner.deploy-banner.server-restarting {
    background: #8a5a00;
    border-bottom-color: #6b4600;
}
/* "Updated -- Refresh to load it" (app.js _applyBuildSnapshot): a floating pill bottom-right, so it never joins the
   top banners' stacking offsets; it stays until the person refreshes (the page never reloads by itself) */
#refresh-bar.refresh-bar {
    top: auto;
    left: auto;
    right: 16px;
    bottom: 16px;
    max-width: min(560px, calc(100vw - 32px));
    border-radius: 8px;
    border-bottom: none;
    background: #1f4e8c;
    z-index: 10002;
}
.refresh-bar-btn {
    background: #fff;
    color: #1f4e8c;
    border: none;
    border-radius: 4px;
    padding: 4px 12px;
    font-weight: 700;
    cursor: pointer;
}
.refresh-bar-btn.wait {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}
@keyframes deploy-stage-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.35); }
    50% { box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12); }
}

/* Data volume past the critical threshold (default 80%): deepen the red so
   it reads as distinct from the 50% early warning at a glance. */
#disk-banner.disk-banner-crit {
    background: #8e1b16;
    border-bottom-color: #5e120f;
}

.geoblock-banner-icon {
    font-size: 18px;
    line-height: 1;
}

.geoblock-banner-msg {
    flex: 1;
    min-width: 0;
}

.geoblock-reset-btn {
    background: #fff;
    color: var(--red);
    border: none;
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.geoblock-reset-btn:hover { background: #f0f0f0; }
.geoblock-reset-btn:active { background: #e0e0e0; }
.geoblock-reset-btn:disabled { opacity: 0.6; cursor: wait; }

.geoblock-banner-status {
    font-weight: 500;
    font-size: 12px;
    opacity: 0.95;
}

.data-feed-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
}
.data-feed-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    box-shadow: 0 0 0 0 rgba(0,0,0,0);
}
.data-feed-badge.live .data-feed-dot {
    background: var(--green);
    box-shadow: 0 0 6px rgba(46, 160, 67, 0.6);
}
.data-feed-badge.error .data-feed-dot {
    background: var(--red);
    box-shadow: 0 0 6px rgba(248, 81, 73, 0.6);
}

.geoblock-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: default;
}

.geoblock-indicator .dot-indicator { background: var(--text-muted); }
.geoblock-indicator.clean .dot-indicator { background: var(--green); }
.geoblock-indicator.warn .dot-indicator { background: var(--yellow); }
.geoblock-indicator.halted .dot-indicator { background: var(--red); }

/* Aggregated alerts indicator (status bar). States are set by _renderAlertsIndicator() in app.js:
   unknown (muted) until the first poll, clean (green), amber (a source could not be read — never
   rendered as green), red (a source has a finding; pulses so it is noticed on a busy page). */
.alerts-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}
.alerts-indicator .dot-indicator { background: var(--text-muted); }
.alerts-indicator.clean .dot-indicator { background: var(--green); }
.alerts-indicator.amber .dot-indicator { background: var(--yellow); }
.alerts-indicator.red .dot-indicator {
    background: var(--red);
    animation: alerts-pulse 1.2s ease-in-out infinite;
}
.alerts-indicator.red #alerts-indicator-label { color: var(--red); font-weight: 600; }
@keyframes alerts-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

/* Sidebar display-timezone segmented toggle */
#tz-toggle .tz-opt.active {
    background: var(--accent-emphasis);
    color: #fff;
    font-weight: 600;
}

/* The section-filter label text is a flex item, so it must be allowed to
   shrink (min-width:0) or its min-content width wins and the sidebar grows a
   HORIZONTAL scrollbar.  Measured 2026-09-20 in headless Chrome at the 190px
   sidebar: "QUANT (MRPOMEGRANATETRADER)" uppercased + 0.5px letter-spacing is
   155px against 128px of room, so the parenthesised account name is rendered
   in its own case with no letter-spacing (120px -> fits on the second line).
   overflow-wrap:anywhere is the safety net for a longer name: it wraps
   mid-word rather than scrolling, which is the operator's stated preference
   (fit, vertical scroll only). */
.section-filter .section-filter-text {
    min-width: 0;
    overflow-wrap: anywhere;
}
.section-filter .section-filter-paren {
    text-transform: none;
    letter-spacing: 0;
}

/* Quote Sim (the only tab left on the shared sheet panel) is scaled down as a
   whole -- title, cards, banners, the 17-column holds table, the canvases --
   so it fits the pane (operator, 2026-09-20: "everything slightly smaller").
   `zoom` is the one property that scales EVERY length in the subtree, which
   is why it is used instead of a font-size (the tables pin their own px
   sizes).  Nested under body's 1.3 it nets to ~1.13.  Measured in headless
   Chrome at a 1600px window: at 1.0 the holds table is 1089px in a 988px
   container (horizontal scroll); at 0.9 it is 1102 in 1102 (exact); 0.87
   leaves margin.  The sticky-header clone measures its own scale from a probe
   element, so it stays aligned; the Quote Sim canvases have fixed intrinsic
   sizes and no mouse handlers, so nothing in the panel reads viewport px. */
#panel-sheet {
    zoom: 0.87;
}

/* Fundamental Views: 18 columns with inputs, selects and a sparkline.  Measured
   2026-09-24 at the stock 8px/10px cell padding the table's MIN width was 2007px,
   so at any window under ~2200px the right-hand columns (Decay / Exec / Wgt /
   m(t)) were clipped by .content-area's overflow:hidden with no scrollbar in
   reach.  Two fixes: the wrapper scrolls horizontally IN PLACE (a scrollbar
   directly under the table, not at the bottom of a 300-row page), and the
   per-cell horizontal padding drops to 6px (10px x 2 sides x 18 columns was
   144px of pure padding).  With the narrower inputs in _fvRow the min width
   is 1741px (measured in Chrome), which fits a 1920px window with the sidebar open. */
/* The 60 s silent refresh rewrites this panel's HTML. With scroll anchoring on, the browser moved the scroller to keep
   an anchor row in place whenever a strip above the table re-rendered taller or shorter, and the page's own late
   restore then put the old position back: the jump the operator saw (2026-10-04). The panel's one DOM write
   (_fvWritePanel in app.js) holds the scroller itself, so anchoring is off for this panel only. */
#panel-fundamental-views { overflow-anchor: none; }

#fv-table-wrap {
    overflow-x: auto;
}

#panel-fundamental-views .data-table th,
#panel-fundamental-views .data-table td {
    padding-left: 6px;
    padding-right: 6px;
}
/* Fundamental Views' LAPTOP LAYOUT (operator 2026-10-22: "slightly taller rows, slightly fewer columns so he can see this
   page on the laptop"; the default, "more columns" turns it off). The hidden columns are generated from _FV_COLS by label
   (app.js, _fvApplyColWidths). These let the kept ones fit 1366 px under the 1.3 zoom: the cells wrap (the side buttons
   over the shift box, the horizon box over its "res", Proposed on two lines), with a little more height per row and the
   form controls a size smaller. */
#fv-table-wrap.fv-fit > table > tbody > tr[data-cid] > td { white-space: normal !important; padding-top: 8px; padding-bottom: 8px; }
#fv-table-wrap.fv-fit > table > thead > tr > th { white-space: normal; }
#fv-table-wrap.fv-fit input[type="number"] { font-size: 12px; padding: 3px 6px; }
#fv-table-wrap.fv-fit select { font-size: 12px; padding: 3px 4px; width: 78px !important; }
/* the Overlay % column (2026-10-24): a four-character box with no spinner and tight cell padding, so the laptop layout
   stays inside its 791 CSS px with the column kept (tests/test_view_edit_keeps_place_and_fits.py measures it) */
/* the Overlay % slider (signed: + YES, − NO) and its × (operator 2026-10-25) */
.fvo-x { margin-left: 2px; padding: 0 4px; font-size: 0.95em; line-height: 1.2; border: 1px solid var(--border); border-radius: 3px; background: transparent; color: var(--text-secondary); cursor: pointer; vertical-align: middle; }
#fv-table-wrap.fv-fit .fvo-cell { padding-left: 4px; padding-right: 4px; }
/* ...RESTYLED 2026-10-26 (operator, via polybot-92): every slider is filled from its CENTRE (0) toward its value -- nothing
   at 0 -- green for + (YES) and red for − (NO), the house tokens; the budget slider from its left end. app.js (_fvoFill,
   _fvoFill0, _fvoFillCss) passes the fill as two fractions of the track (--fvo-a <= --fvo-b) and a colour (--fvo-c). The
   6px / 12px terms put both ends of the fill at the 12 px thumb's CENTRE, so a read-only .fvo-bar as wide as a slider (the
   normalized weight under each row's slider, the traded budget under the budget) lines up with the slider above it.
   Webkit and Gecko pseudo-elements stay in separate rules: one unknown selector drops a whole rule. */
.fvo-pct, #fvo-limit {
    -webkit-appearance: none; appearance: none; background: transparent; height: 16px; margin: 0; padding: 0;
    vertical-align: middle; cursor: pointer; --fvo-a: 0; --fvo-b: 0; --fvo-c: var(--border);
}
.fvo-pct::-webkit-slider-runnable-track, #fvo-limit::-webkit-slider-runnable-track {
    height: 6px; border-radius: 3px;
    background: linear-gradient(to right, var(--border) 0 calc(6px + (100% - 12px) * var(--fvo-a)),
        var(--fvo-c) calc(6px + (100% - 12px) * var(--fvo-a)) calc(6px + (100% - 12px) * var(--fvo-b)),
        var(--border) calc(6px + (100% - 12px) * var(--fvo-b)) 100%);
}
.fvo-pct::-moz-range-track, #fvo-limit::-moz-range-track {
    height: 6px; border-radius: 3px;
    background: linear-gradient(to right, var(--border) 0 calc(6px + (100% - 12px) * var(--fvo-a)),
        var(--fvo-c) calc(6px + (100% - 12px) * var(--fvo-a)) calc(6px + (100% - 12px) * var(--fvo-b)),
        var(--border) calc(6px + (100% - 12px) * var(--fvo-b)) 100%);
}
/* the thumb is RINGED in the fill's colour: a +5 of ±20 fills ~7 px from the centre and the thumb covers 6 of them, so
   without the ring a small weight's side showed only in the bar under it */
.fvo-pct::-webkit-slider-thumb, #fvo-limit::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; width: 12px; height: 12px; margin-top: -3px; box-sizing: border-box;
    border-radius: 50%; background: var(--text-primary); border: 2px solid var(--fvo-c);
}
.fvo-pct::-moz-range-thumb, #fvo-limit::-moz-range-thumb {
    width: 12px; height: 12px; box-sizing: border-box; border-radius: 50%; background: var(--text-primary); border: 2px solid var(--fvo-c);
}
.fvo-pct:focus-visible, #fvo-limit:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
.fvo-bar {
    display: block; height: 6px; border-radius: 3px; --fvo-a: 0; --fvo-b: 0; --fvo-c: var(--border);
    background: linear-gradient(to right, var(--border) 0 calc(6px + (100% - 12px) * var(--fvo-a)),
        var(--fvo-c) calc(6px + (100% - 12px) * var(--fvo-a)) calc(6px + (100% - 12px) * var(--fvo-b)),
        var(--border) calc(6px + (100% - 12px) * var(--fvo-b)) 100%);
}
/* the cell: a FIXED grid -- slider | ×, the normalized bar under the slider, the line under both on two reserved lines -- so
   nothing it shows (a longer value, an "eff", a staged "flip", the × coming or going) resizes the column or the row */
.fvo-cell { text-align: right; white-space: nowrap; font-size: 0.95em; }
/* FOUR columns since 2026-11-14 (operator: "two small buttons one either side to adjust it by 0.5%"): − | the box | + | ×.
   The max box, the normalized bar and the line under them span the first three (and the line the × column too), so the
   buttons widen nothing below them. Every width is set: a press, like a keystroke, moves nothing. */
.fvo-grid { display: inline-grid; grid-template-columns: 13px 54px 13px 18px; align-items: center; row-gap: 3px; text-align: right; vertical-align: middle; }
.fvo-grid > .fvo-pct { grid-row: 1; grid-column: 1 / span 3; width: 100%; }
.fvo-grid > .fvo-x, .fvo-grid > .fvo-gap { grid-row: 1; grid-column: 4; justify-self: end; }
/* the typed boxes (operator 2026-11-14): the share count where the slider was, the max price under it with its unit */
.fvo-grid > .fvo-dn { grid-row: 1; grid-column: 1; }
.fvo-grid > .fvo-sh { grid-row: 1; grid-column: 2; width: 100%; border-radius: 0; }
.fvo-grid > .fvo-up { grid-row: 1; grid-column: 3; }
/* the step buttons: as tall as the box they flank and joined to it (one border between a button and the box) */
.fvo-step { box-sizing: border-box; width: 13px; height: 18px; padding: 0; font: inherit; font-size: 0.95em; line-height: 16px; text-align: center; border: 1px solid var(--border); background: transparent; color: var(--text-secondary); cursor: pointer; }
.fvo-dn { border-right: 0; border-radius: 3px 0 0 3px; }
.fvo-up { border-left: 0; border-radius: 0 3px 3px 0; }
.fvo-step:hover { color: var(--text-primary); background: var(--bg-secondary); }
.fvo-step:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; }
.fvo-grid > .fvo-max { grid-row: 2; grid-column: 1 / span 3; width: 100%; }
.fvo-grid > .fvo-maxl { grid-row: 2; grid-column: 4; justify-self: start; padding-left: 3px; color: var(--text-secondary); font-size: 0.9em; }
.fvo-sh, .fvo-max { box-sizing: border-box; height: 18px; min-width: 0; padding: 0 3px; font: inherit; font-size: 0.95em; line-height: 16px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-primary); background: var(--bg-primary); border: 1px solid var(--border); border-radius: 3px; }
.fvo-sh:focus-visible, .fvo-max:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; }
.fvo-max { color: var(--text-secondary); }
.fvo-max-above { border-color: var(--red); color: var(--red); }
.fvo-grid > .fvo-norm { grid-row: 3; grid-column: 1 / span 3; width: 100%; }
/* the checkbox (operator 2026-11-14: does the engine place its own limit orders for the row) on the bar's line, in the
   grid's last column: no width is added to the cell, and NO HEIGHT either -- the 11 px box sits on the bar's 8 px line
   with -2 px margins above and below (it overhangs into the row gaps), so the line and the row stay as tall as they
   were. Measured in Edge: at margin 0 every row grew 4 px, the overlay cell became the tallest in every row, and
   tests/test_view_edit_keeps_place_and_fits.py's thumbnail instrument (it needs a thumbnail to change a row's height)
   went blind. */
.fvo-grid > .fvo-auto { grid-row: 3; grid-column: 4; justify-self: end; width: 11px; height: 11px; margin: -2px 0; padding: 0; accent-color: var(--accent); cursor: pointer; }
/* a FIXED two-line box, never min-height: a two-line line (its 1.05em side, a fallback glyph) is ~0.8 px taller than
   2.5em, so with min-height the cell's centred grid moved its slider 0.4 px under the pointer whenever the line went
   from two lines to one ("→ EXIT") -- measured in Edge by tests/test_fv_overlay_sliders_layout.py */
.fvo-grid > .fvo-sub { grid-row: 4; grid-column: 1 / span 4; white-space: normal; height: 2.5em; line-height: 1.25; color: var(--text-secondary); }
/* with the share lock on, a THIRD reserved line: "+5 YES eff" / "+3.33" / the share line. Measured in Edge 2026-11-14: in the
   two-line box the share line sat 5 px below the row whenever a budget was scaling the rows ("eff" shown) */
.fvo-grid-lock > .fvo-sub { height: 3.6em; }
.fvo-side { font-size: 1.05em; }
/* the share lock (operator 2026-11-14): the re-underwrite button beside the locked %, and under it the shares and what
   they are worth now. The share line is a right FLOAT: a line wider than the grid ("630.5k sh →5.12%" is
   86 px in a 74 px grid) runs out to the LEFT, into the cell's padding, never past the table's last column (to the
   right it widened the table wrap's scroll by 8 px); and it is one tight line, because under a budget that is scaling
   the rows ("eff" shown) it is a THIRD line below .fvo-sub's two reserved ones (measured in Edge, 2026-11-14) */
.fvo-relock { margin-left: 2px; padding: 0 3px; font-size: 0.9em; line-height: 1.15; border: 1px solid var(--border); border-radius: 3px; background: transparent; color: var(--text-secondary); cursor: pointer; }
.fvo-relock:hover { color: var(--text-primary); }
.fvo-relock-on { color: var(--yellow); border-color: var(--yellow); }
.fvo-lock { float: right; clear: both; font-size: 0.88em; line-height: 1.05; white-space: nowrap; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.fvo-now { color: var(--text-primary); }
/* THE DEFAULT (fit) LAYOUT HAS A SIDEWAYS-SCROLL BUDGET (tests/test_view_edit_keeps_place_and_fits.py: 100 CSS px at 1366,
   the operator's "keep all, allow scroll"), and the two-column cell (56px 18px = 74) already used 89 of it on the hosted
   runner. With the buttons at the wide layout's sizes the table scrolled 105 (CI run 43634493405). So here the cell is
   81: buttons 12, box 44, a 13 px × column with a tighter ×, and the boxes' side padding 2 instead of 3 -- 7 wider
   than before the buttons, ~96 of the 100. */
#fv-table-wrap.fv-fit .fvo-grid { grid-template-columns: 12px 44px 12px 13px; }
#fv-table-wrap.fv-fit .fvo-step { width: 12px; }
#fv-table-wrap.fv-fit .fvo-x { margin-left: 0; padding: 0 2px; }
#fv-table-wrap.fv-fit .fvo-sh, #fv-table-wrap.fv-fit .fvo-max { padding: 0 2px; }
#fv-table-wrap.fv-fit .fvo-grid > .fvo-maxl { padding-left: 2px; }
/* the budget strip under the header: every column a set width, the values tabular figures in a fixed box, the notes
   clipped (hover for the whole text) -- so dragging the budget moves nothing on the page (operator 2026-10-26: it
   "gitters everything because the % text gets smaller or bigger"). #fvo-limit-info is display:contents so its cells,
   redrawn while dragging, sit in this grid. */
.fvo-budget { display: grid; grid-template-columns: max-content 160px 3.6em 32em; column-gap: 8px; row-gap: 4px; align-items: center; width: max-content; margin: 0 0 8px; font-size: 0.85em; color: var(--text-secondary); }
.fvo-budget > #fvo-limit, .fvo-budget .fvo-used { width: 100%; }
#fvo-limit-info { display: contents; }
.fvo-bval { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text-primary); }
.fvo-note { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* the table a size larger (operator 2026-10-26: "most columns should have somewhat larger text"); headers keep theirs */
#fv-table-wrap > table { font-size: 13px; }
/* Omni / Omni Lite's laptop default (the same ask; the hidden columns come from _omniApplyFit): a drawn Proposed answer
   wraps instead of widening the grid past the panel -- "YES 0 + 1.00 pp → 1.00% (not targeted today)" is 245 CSS px on
   one line, and it took the grid to 803 viewport px against 769. */
table.omni-grid.omni-fit td.tpv-cell { white-space: normal !important; }
/* ...and the row editor's explanatory prose wraps too: the Buy whitelist section's note is 987 CSS px on one line, and
   opening it took the grid to 1,032 viewport px against 769 */
table.omni-grid.omni-fit tr.omni-detail .omni-mute { white-space: normal; }

/* The view-edit SAVE BAR, Fundamental Views and Omni / Omni Lite (operator 2026-10-22): ONE line whose height does not
   change with its state -- a bar that grew and shrank moved every row under it. What does not fit is ellipsised (the full
   text is its title); "what is Proposed?" opens a body that floats over the table instead of growing the bar. A save
   message may wrap: it is the one thing the reader must read whole. */
.tpv-bar, .omni-savebar { display: flex; align-items: center; gap: 8px; white-space: nowrap; min-width: 0; }
.tpv-bar { padding: 5px 10px; }
.tpv-bar > *, .omni-savebar > * { flex: 0 0 auto; }
.tpv-bar .btn, .omni-savebar .btn { padding: 3px 10px; }
.tpv-hint, .omni-staged { color: var(--text-secondary); font-size: 0.82em; flex: 0 1 auto !important; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.omni-staged { color: inherit; font-size: inherit; }
.tpv-ctl { display: flex; align-items: center; gap: 6px; flex: 1 1 auto !important; min-width: 0; }
.tpv-ctl > * { flex: 0 0 auto; }
.tpv-ctl > .tpv-note { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tpv-ctl > .tpv-line { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 0.82em; }
.tpv-msg { white-space: normal; flex: 1 1 12em !important; min-width: 8em; }
.tpv-what-body { position: absolute; right: 8px; top: calc(100% + 4px); width: min(560px, 90%); white-space: normal; z-index: 6;
                 background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px;
                 line-height: 1.45; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); }
/* ── Switchboard page (2026-09-21) ───────────────────────────────────── */
.sw-asof { font-size: 11px; color: var(--text-secondary); margin-right: 8px; }
.sw-btn-on { background: var(--success-emphasis); color: #fff; }
.sw-btn-off { background: #c94040; color: #fff; }
.sw-status { min-height: 18px; font-size: 12px; color: var(--text-secondary); margin: 4px 0 8px; }
.sw-status-ok { color: var(--green); }
.sw-status-err { color: #f85149; }
.sw-tiles { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.sw-tile { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; min-width: 150px; }
.sw-tile-k { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.sw-tile-v { font-size: 18px; font-weight: 600; margin-top: 2px; }
.sw-tile-s { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.sw-table th.sw-num, .sw-table td.sw-num { text-align: right; white-space: nowrap; }
.sw-table td { vertical-align: top; }
/* The live table's text cells WRAP to a preferred width (2026-09-29). Every cell computed nowrap, so the
   State cell put a whole "last switched by ..." sentence on one line: measured at a 1920 screen, the table
   was 2,345 px in a 1,606 px panel (State 702 px, Account 384 px) and the Active lever was already off the
   right edge. `width`, not `max-width`: a table cell ignores max-width. The Active-entry preview columns
   (next cycle / today's ceiling) are sentences too. */
.sw-table td.sw-acct-cell { white-space: normal; width: 15em; min-width: 23em; }
/* Switchboard: risk vs limits under each account (operator 2026-09-30). A colour only for an evaluated,
   current row; everything else is grey/dashed and says what it is. */
.sw-risk { display: flex; flex-wrap: nowrap; gap: 4px; margin-top: 5px; }
.sw-risk-b { border: 1px solid var(--border); border-left-width: 3px; border-radius: 4px; padding: 2px 5px; min-width: 5em; font-size: 11px; line-height: 1.25; }
.sw-risk-k { color: var(--text-secondary); font-size: 10px; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.sw-risk-v { font-weight: 600; font-size: 12px; white-space: nowrap; }
.sw-risk-t { color: var(--text-secondary); font-size: 10px; white-space: nowrap; }
.sw-risk-green { border-left-color: var(--green); }
.sw-risk-amber { border-left-color: var(--yellow); }
.sw-risk-red { border-left-color: var(--red); }
.sw-risk-red .sw-risk-v { color: var(--red); }
.sw-risk-none { border-left-style: dashed; border-left-color: var(--text-secondary); }
.sw-risk-none .sw-risk-v { color: var(--text-secondary); font-weight: 400; }
.sw-risk-chip { margin-top: 5px; padding: 3px 6px; border-radius: 4px; font-size: 11px; border: 1px dashed var(--yellow); color: var(--text-secondary); }
.sw-risk-chip.switched, .sw-risk-chip.stale { border-style: solid; color: var(--yellow); }
.sw-risk-chip.err { border: 1px solid var(--red); color: var(--red); }
.sw-risk-key { border-left-width: 3px; border-left-style: solid; padding-left: 3px; }   /* width/style only: the colour class sets the colour */
.sw-risk-legend { margin: 6px 0 2px; }
.sw-table td.sw-state-cell { white-space: normal; width: 22em; }
/* the "last cycle" note (switchboard_logic.last_cycle_note classifies; LAST_CYCLE_FRESH_S / _STALE_S in one place) */
.sw-cycle { display: inline-block; margin-top: 3px; padding: 0 5px; border: 1px solid transparent; border-radius: 4px; white-space: nowrap; }
.sw-cycle.sw-cycle-fresh { border-color: var(--success-emphasis); }
.sw-cycle.sw-cycle-bad { color: var(--danger); }
.sw-table td.sw-ae-preview { white-space: normal; width: 13em; min-width: 11em; }
.sw-row-off td { opacity: .72; }
.sw-name { font-weight: 600; }
.sw-sub { font-size: 11px; color: var(--text-secondary); }
.sw-muted { color: #8b949e; }
.sw-warn { color: var(--yellow); margin-left: 4px; }
.sw-pos { color: var(--green); }
.sw-neg { color: var(--red); }
.sw-pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 9px; border: 1px solid var(--border); }
.sw-pill-running { color: var(--green); border-color: var(--green); }
.sw-pill-halted { color: var(--yellow); border-color: var(--yellow); }
.sw-pill-stale { color: var(--yellow); border-color: var(--yellow); }
.sw-pill-off { color: #8b949e; }
.sw-pill-unknown { color: #8b949e; border-style: dashed; }
.sw-toggle { font-size: 12px; font-weight: 700; padding: 3px 12px; border-radius: 12px; border: 1px solid var(--border); cursor: pointer; min-width: 52px; }
.sw-toggle-on { background: var(--success-emphasis); color: #fff; border-color: var(--success-emphasis); }
.sw-toggle-off { background: transparent; color: #f85149; border-color: #f85149; }
.sw-notes { font-size: 11px; color: var(--text-secondary); margin-top: 10px; line-height: 1.5; }
/* wind down (2026-11-27): per live account, a liquidate-by date and a switch */
.sw-wd { margin: 18px 0 6px; }
.sw-wd-title { font-size: 14px; font-weight: 600; margin: 0 0 4px; }
.sw-wd-table td { vertical-align: top; padding-top: 8px; padding-bottom: 8px; }
.sw-wd-date { font-size: 13px; padding: 3px 6px; background: var(--bg-secondary); color: inherit; border: 1px solid var(--border); border-radius: 4px; }
.sw-wd-btn { font-size: 12px; padding: 2px 10px; margin: 4px 6px 0 0; }
.sw-wd-nums div { line-height: 1.5; }
.sw-wd-on { color: #e3893b; font-weight: 700; }
.sw-wd-preview { margin-top: 6px; padding: 6px 8px; border: 1px dashed var(--border); border-radius: 4px; max-width: 640px; }
.sw-wd-preview table { margin-top: 6px; font-size: 12px; }
.sw-wd-preview td, .sw-wd-preview th { padding: 2px 8px 2px 0; text-align: left; }
.sw-wd-preview td.sw-num, .sw-wd-preview th.sw-num { text-align: right; }

/* ── Cash by account (Portfolio page, 2026-09-23) ─────────────────────── */
.ac-block { margin: 4px 0 14px; }
.ac-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.ac-title { font-size: 13px; font-weight: 600; }
.ac-total { font-size: 16px; font-weight: 600; }
.ac-table th.ac-num, .ac-table td.ac-num { text-align: right; white-space: nowrap; }
.ac-table td { vertical-align: top; }
.ac-up { color: var(--green); }
.ac-down { color: var(--red); }
.ac-toggle { padding: 0 6px; min-width: 0; }
.ac-name { font-weight: 600; }
.ac-sub { font-size: 11px; color: var(--text-secondary); font-weight: 400; }
.ac-muted { color: #8b949e; }
.ac-stale { color: var(--yellow); }
.ac-note { font-size: 12px; margin: 6px 0; }
.ac-notes { font-size: 11px; color: var(--text-secondary); margin-top: 8px; line-height: 1.5; }
.sw-live { color: #f85149; font-weight: 700; letter-spacing: .04em; }
.sw-toggle-disabled { background: transparent; color: #8b949e; border-color: var(--border); border-style: dashed; cursor: not-allowed; }
/* live-only view (2026-09-22) */
.sw-howto { font-size: 12px; color: var(--text-secondary); margin: 0 0 10px; line-height: 1.5; }
.sw-state { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 10px; border: 1px solid var(--border); letter-spacing: .03em; }
.sw-state-trading { color: #fff; background: var(--success-emphasis); border-color: var(--success-emphasis); }
.sw-state-armed { color: var(--yellow); border-color: var(--yellow); }
.sw-state-idle { color: #8b949e; border-style: dashed; }
.sw-state-none { color: #8b949e; }
.sw-reason { margin-top: 3px; max-width: 420px; }
.sw-next { font-style: italic; max-width: 420px; }
.sw-toggle-go { background: var(--success-emphasis); color: #fff; border-color: var(--success-emphasis); min-width: 84px; }
.sw-toggle-stop { background: #c94040; color: #fff; border-color: #c94040; min-width: 84px; }
.sw-live-row td { padding-top: 8px; padding-bottom: 8px; }
.sw-gov { margin: 0 0 10px; font-size: 12px; }
.sw-gov summary { cursor: pointer; color: var(--text-secondary); }
.sw-gov-body { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 8px 4px 2px; align-items: center; }
.sw-gov-item { display: inline-flex; gap: 5px; align-items: center; cursor: pointer; }
.sw-gov-body > .sw-sub { flex-basis: 100%; }

/* the account chooser must LOOK like a control you can open (operator 2026-09-23) */
.sw-gov-summary { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 10px;
    border: 1px solid var(--border); border-radius: 6px; background: var(--bg-secondary); font-size: 12px;
    color: var(--text-primary); list-style: none; user-select: none; }
.sw-gov-summary::-webkit-details-marker { display: none; }
.sw-gov-summary:hover { border-color: var(--accent); }
.sw-gov-caret { display: inline-block; transition: transform .12s; color: var(--text-secondary); }
details[open] > .sw-gov-summary .sw-gov-caret { transform: rotate(90deg); }
.sw-gov-count { color: var(--text-secondary); font-size: 11px; }

/* a PHYSICAL vertical switch per live account: knob TOP = On, knob BOTTOM = Off (operator 2026-09-23).
   Position and label carry the state; colour only reinforces it, so it reads in greyscale too. */
.sw-lever-wrap { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.sw-lever { position: relative; display: inline-block; width: 58px; height: 60px; cursor: pointer; }
.sw-lever-track { position: absolute; right: 6px; top: 0; width: 26px; height: 60px; border-radius: 13px;
    border: 1px solid var(--border); background: var(--bg-tertiary); box-sizing: border-box; display: block; }
.sw-lever-knob { position: absolute; left: 3px; width: 18px; height: 18px; border-radius: 50%;
    background: #8b949e; transition: top .12s ease; box-shadow: 0 1px 2px rgba(0,0,0,.5); }
.sw-lever-knob[data-sw-knob-pos="top"] { top: 3px; }
.sw-lever-knob[data-sw-knob-pos="bottom"] { top: 37px; }
.sw-lever-label { position: absolute; left: 0; font-size: 10px; line-height: 1; letter-spacing: .04em;
    color: var(--text-secondary); text-transform: uppercase; }
.sw-lever-label-on { top: 3px; }
.sw-lever-label-off { bottom: 3px; }
.sw-lever-on .sw-lever-track { border-color: var(--green); background: rgba(38,194,129,.18); }
.sw-lever-on .sw-lever-knob { background: var(--green); }
.sw-lever-on .sw-lever-label-on { color: var(--green); font-weight: 700; }
.sw-lever-off .sw-lever-track { border-color: #c0504d; }
.sw-lever-off .sw-lever-knob { background: #c0504d; }
.sw-lever-off .sw-lever-label-off { color: #f85149; font-weight: 700; }
.sw-lever-disabled { cursor: not-allowed; opacity: .55; }
.sw-lever-disabled .sw-lever-track { border-style: dashed; }
.sw-lever-disabled .sw-lever-knob { background: #55595e; }
.sw-lever:focus { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sw-lever-why { text-align: center; max-width: 84px; line-height: 1.2; }

/* the two MASTER levers above the table (operator 2026-09-27): each is one sw-lever plus its name and
   the sentence saying what the fleet is doing now; a mixed fleet reads MIXED beside a lever at Off. */
.sw-masters { display: flex; flex-wrap: wrap; gap: 18px 36px; align-items: flex-start; margin: 8px 0 6px; }
.sw-master { display: flex; gap: 12px; align-items: center; }
.sw-master-text { max-width: 420px; }
.sw-master-name { font-size: 13px; color: var(--text-primary); font-weight: 600; }
.sw-master-state { font-size: 11px; color: var(--text-secondary); line-height: 1.4; }
.sw-master-mixed { color: var(--yellow); font-weight: 600; }
/* the Active/Passive lever's labels differ from On/Off; the lever itself is the same */
.sw-lever-active .sw-lever-label-on::after { content: ''; }
/* the collapsed explainer under the Switchboard table (docs/runbooks/active_entry.md) */
.sw-explainer { margin-top: 14px; }
.sw-explainer summary { cursor: pointer; color: var(--text-secondary); font-size: 12px; }
.sw-explainer-body { font-size: 12px; color: var(--text-secondary); line-height: 1.55; margin-top: 8px; max-width: 980px; }
.sw-explainer-body h4 { font-size: 12px; color: var(--text-primary); margin: 10px 0 4px; }
.sw-explainer-body ol, .sw-explainer-body ul { padding-left: 20px; margin: 4px 0; }
.sw-explainer-body li { margin: 2px 0; }
.sw-explainer-body table { border-collapse: collapse; margin: 6px 0; }
.sw-explainer-body td, .sw-explainer-body th { border: 1px solid var(--border); padding: 2px 8px; font-size: 11px; text-align: left; }

/* the auto-deploy row: sentences, one per line, not a join of internals */
.sw-deploy-lines > div { line-height: 1.5; font-size: 11px; color: var(--text-secondary); }
.sw-deploy-head { font-size: 12px; color: var(--text-primary); }

/* Operator risk limits block (Constraints page / Switchboard, 2026-09-21) */
.rl-table input.rl-input { width: 100%; box-sizing: border-box; font-size: 12px; padding: 3px 5px; background: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border); border-radius: 4px; }
.rl-table tr.rl-global td { background: var(--bg-tertiary); }
.rl-sub { font-size: 11px; color: var(--text-secondary); }
/* The effective cell is a NAMED three-column line per limit (2026-09-23): name, value, what binds
   it. A grid keeps the values aligned down the column so three limits read as a small table rather
   than as three wrapped sentences. */
.rl-eff { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.2fr); gap: 0 8px; align-items: baseline; line-height: 1.5; }
.rl-eff-name { font-size: 11px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rl-eff-val { font-weight: 600; text-align: right; white-space: nowrap; }
.rl-eff-binds { font-size: 11px; color: var(--text-secondary); }
.rl-eff-suspended { display: block; margin-top: 3px; font-size: 11px; font-weight: 600; color: var(--yellow); }
.rl-check { display: inline-block; font-size: 11px; white-space: nowrap; }
.rl-check-on { color: var(--red); font-weight: 600; }
.rl-check-off { color: var(--text-secondary); }
.rl-check-unknown { color: #8b949e; }
.rl-suspended { color: var(--yellow); font-size: 11px; }
.rl-ov { font-size: 11px; white-space: nowrap; cursor: pointer; }
.rl-ov-on { color: var(--yellow); font-weight: 600; }
.rl-ov-inherited { color: var(--yellow); }
/* ── Portfolio page tabs + live-engine banner (2026-09-21) ───────────── */
.pf-tabs { display:flex; gap:6px; margin:2px 0 12px; flex-wrap:wrap; }
.pf-tabs .pf-tab.active { background: var(--accent-emphasis); color: #fff; border-color: var(--accent-emphasis); }
.engine-banner { display:flex; align-items:center; gap:14px; flex-wrap:wrap; padding:8px 14px;
    border-radius:6px; margin:4px 0 10px; border:1px solid var(--border); background: var(--bg-secondary);
    border-left-width:4px; font-size:0.9em; }
.engine-banner.on { border-left-color:#4caf50; }
.engine-banner.halted { border-left-color:#ffc107; }
.engine-banner.stale { border-left-color:#e0a030; }
.engine-banner.off { border-left-color:#888; }
.engine-banner .eb-state { font-weight:700; letter-spacing:0.04em; text-transform:uppercase; }
.engine-banner.on .eb-state { color:#4caf50; }
.engine-banner.halted .eb-state { color:#ffc107; }
.engine-banner.stale .eb-state { color:#e0a030; }
.engine-banner.off .eb-state { color:#888; }
.engine-banner .eb-sub { color: var(--text-secondary); font-size:0.9em; }
.engine-banner .eb-actions { margin-left:auto; display:flex; gap:8px; }
.engine-banner .eb-msg { flex-basis:100%; font-size:0.88em; color: var(--text-secondary); }
.sw-deploy { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin: 2px 0 6px; }
.sw-deploy-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; cursor: pointer; }
.sw-deploy-label input:disabled + span { opacity: .6; }
.sw-deploy-label code { font-size: 12px; }

/* ── System Config editor (webapp/static/config_editor.js, 2026-09-27 redesign) ── */
/* Typed controls per parameter, group tabs, sub-sections, clamped help, staged resets.
   Every colour is a theme token; the page inherits body's zoom like every other panel. */

#panel-config-editor .ce-hidden { display: none !important; }

.ce-banner {
    margin: 0 0 12px;
    padding: 10px 14px;
    border-left: 3px solid var(--yellow);
    background: var(--bg-secondary);
    border-radius: 4px;
    font-size: 0.9em;
    line-height: 1.5;
    color: var(--text-primary);
}
.ce-banner code, .ce-issues code, .ce-diff code { font-size: 0.92em; }

.ce-issues {
    margin: 0 0 12px;
    padding: 10px 14px;
    border-left: 3px solid var(--red);
    background: var(--red-bg);
    border-radius: 4px;
    font-size: 0.88em;
    line-height: 1.5;
}
.ce-issues ul { margin: 4px 0 0 18px; }

.ce-toolbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 10px;
    padding: 8px 12px;
    margin: 0 0 8px;
    border-radius: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
}
.ce-search {
    flex: 1 1 200px;
    min-width: 160px;
    max-width: 320px;
    padding: 5px 9px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
}
.ce-search:focus { outline: none; border-color: var(--accent); }
.ce-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.ce-chip {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 11px;
    cursor: pointer;
}
.ce-chip:hover { background: var(--bg-hover); color: var(--text-primary); }
.ce-chip.active { background: var(--accent); border-color: var(--accent); color: #0d1117; font-weight: 600; }
.ce-chip-n { opacity: 0.75; font-variant-numeric: tabular-nums; }
.ce-helptoggle { font-size: 11px; color: var(--text-secondary); display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; cursor: pointer; }
.ce-spacer { flex: 1 1 auto; }
.ce-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; white-space: nowrap; }
.ce-count { font-weight: 600; font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.ce-count.has { color: var(--yellow); }
.btn.ce-primary { background: #2d7d46; color: #fff; border-color: #2d7d46; }
.btn.ce-primary:hover { background: #35914f; }
.btn.ce-primary:disabled, .ce-toolbar .btn:disabled { opacity: 0.45; cursor: not-allowed; }

.ce-tabs {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 2px;
    padding: 4px 8px 0;
    border-bottom: 1px solid var(--border);
    margin: 0 0 10px;
}
.ce-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    font-size: 12px;
    cursor: pointer;
    max-width: 320px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ce-tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.ce-tab.active { background: var(--bg-primary); color: var(--text-primary); font-weight: 600; border-color: var(--text-muted); }
.ce-tab.dim { opacity: 0.55; }
.ce-tab-n { font-size: 10px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ce-tab-ov {
    font-size: 9px; font-weight: 700; padding: 0 5px; border-radius: 8px;
    background: rgba(88, 166, 255, 0.18); color: var(--accent);
}
.ce-tabs-hint { margin-left: auto; padding: 0 6px 6px; font-size: 11px; color: var(--text-secondary); }

.ce-group-head { margin: 2px 0 10px; }
.ce-group-head h3 { font-size: 15px; font-weight: 600; margin: 0 0 2px; }
.ce-group.ce-searching .ce-group-head h3::before { content: "▸ "; color: var(--text-muted); }
.ce-group-help { font-size: 0.85em; color: var(--text-secondary); line-height: 1.45; max-width: 100ch; }

.ce-sub { margin: 0 0 14px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-secondary); }
.ce-sub-title {
    margin: 0;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    background: var(--bg-tertiary);
    border-radius: 6px 6px 0 0;
}
.ce-sub-n { font-weight: 400; color: var(--text-muted); font-size: 11px; margin-left: 4px; }

.ce-row {
    display: grid;
    grid-template-columns: 168px minmax(0, 1fr);
    gap: 4px 14px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    align-items: start;
}
.ce-row:last-child { border-bottom: none; }
.ce-row.ce-pending { background: var(--yellow-bg); box-shadow: inset 3px 0 0 var(--yellow); }
.ce-row.ce-reset { background: rgba(88, 166, 255, 0.08); box-shadow: inset 3px 0 0 var(--accent); }
.ce-row.ce-invalid .ce-num { border-color: var(--red); }
.ce-ctl { display: flex; align-items: center; gap: 8px; min-width: 0; padding-top: 2px; }
.ce-num, .ce-text, .ce-select {
    width: 100%;
    max-width: 168px;
    padding: 4px 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
}
.ce-num:focus, .ce-text:focus, .ce-select:focus { outline: none; border-color: var(--accent); }

/* Switch: a real checkbox drives it, so keyboard and the harness both see `checked`. */
.ce-switch { position: relative; display: inline-block; width: 38px; height: 20px; flex: 0 0 auto; }
.ce-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.ce-switch .ce-track {
    position: absolute; inset: 0; border-radius: 999px;
    background: var(--bg-hover); border: 1px solid var(--border);
    transition: background 0.12s;
}
.ce-switch .ce-track::after {
    content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
    background: var(--text-secondary); transition: transform 0.12s, background 0.12s;
}
.ce-switch input:checked + .ce-track { background: rgba(63, 185, 80, 0.35); border-color: var(--green); }
.ce-switch input:checked + .ce-track::after { transform: translateX(18px); background: var(--green); }
.ce-switch input:focus-visible + .ce-track { box-shadow: 0 0 0 2px var(--accent); }
.ce-switch.locked { opacity: 0.55; }
.ce-switch.locked input { cursor: not-allowed; }
.ce-onoff { font-size: 11px; font-weight: 700; color: var(--text-secondary); width: 28px; font-variant-numeric: tabular-nums; }
.ce-switch input:checked ~ .ce-track, .ce-row .ce-switch:has(input:checked) + .ce-onoff { color: var(--green); }

.ce-main { min-width: 0; }
.ce-label { font-weight: 600; font-size: 12.5px; line-height: 1.35; }
.ce-badge {
    display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 8px;
    font-size: 9.5px; font-weight: 600; vertical-align: middle; border: 1px solid transparent; line-height: 1.5;
}
.ce-badge.ov { color: var(--accent); border-color: var(--accent); }
.ce-badge.warn { color: var(--yellow); border-color: var(--yellow); }
.ce-badge.paper { color: #e0a800; border-color: #e0a800; }
.ce-badge.lock { color: var(--red); border-color: var(--red); }

.ce-help {
    margin-top: 2px;
    font-size: 0.85em;
    line-height: 1.45;
    color: var(--text-secondary);
    max-width: 110ch;
    overflow-wrap: anywhere;
}
.ce-help.clampable {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    cursor: pointer;
}
.ce-help.clampable:hover { color: var(--text-primary); }
.ce-row.open .ce-help.clampable, .ce-help-open .ce-help.clampable { display: block; -webkit-line-clamp: unset; overflow: visible; }

.ce-meta { margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 0.78em; color: var(--text-muted); }
.ce-key { font-size: 0.95em; color: var(--text-muted); }
.ce-range, .ce-restart, .ce-default { white-space: nowrap; }
.ce-default a { color: var(--accent); text-decoration: none; border-bottom: 1px dotted var(--accent); }
.ce-default a:hover { color: var(--accent-hover); }
.ce-resetbtn {
    background: transparent; color: var(--text-secondary); border: 1px solid var(--border);
    border-radius: 4px; padding: 0 7px; font-size: 10.5px; cursor: pointer; line-height: 1.6;
}
.ce-resetbtn:hover { color: var(--text-primary); border-color: var(--text-muted); }
.ce-resetbtn.active { color: var(--accent); border-color: var(--accent); }

.ce-empty { padding: 24px; text-align: center; color: var(--text-muted); }

.ce-history { margin-top: 22px; border-top: 1px solid var(--border); padding-top: 14px; }
.ce-history > summary { cursor: pointer; font-weight: 600; color: var(--text-secondary); }
.ce-muted { color: var(--text-secondary); }
.ce-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.ce-diff { width: 100%; border-collapse: collapse; font-size: 0.88em; margin: 6px 0; }
.ce-diff th { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--border); color: var(--text-secondary); font-weight: 600; }
.ce-diff td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.ce-diff .ce-arrow { color: var(--text-muted); text-align: center; }
.ce-diff .ce-new { color: var(--green); }
.ce-hist .ce-src { max-width: 42ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ce-note { margin-top: 10px; padding: 8px 12px; border-left: 3px solid var(--border); background: var(--bg-secondary); border-radius: 4px; font-size: 0.86em; line-height: 1.5; }
.ce-note.warn { border-left-color: var(--yellow); }
.ce-note.err { border-left-color: var(--red); color: var(--red); }

.ce-modal-overlay {
    position: fixed; inset: 0; z-index: 9999; background: rgba(0, 0, 0, 0.55);
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.ce-modal {
    background: var(--bg-primary); border: 1px solid var(--border); border-radius: 8px;
    max-width: 760px; width: 100%; max-height: 84vh; overflow: auto; box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}
.ce-modal-title { padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 1.05em; }
.ce-modal-body { padding: 16px 18px; }
.ce-modal-footer { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

@media (max-width: 900px) {
    .ce-row { grid-template-columns: 1fr; }
    .ce-toolbar { position: static; }
}

/* ── Active sides: per-side switches + weight arithmetic (config_editor.js, 2026-09-27) ── */
.ce-row.ce-wide { grid-template-columns: 1fr; }
.ce-row.ce-wide .ce-ctl { padding-top: 0; }
.ce-as-master-text { font-size: 12px; margin-left: 4px; }
.ce-as { margin-top: 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-primary); padding: 10px 12px; }
.ce-as-rule { font-size: 0.85em; line-height: 1.5; color: var(--text-secondary); max-width: 120ch; margin-bottom: 8px; }
.ce-as-rule code { font-size: 0.95em; color: var(--text-primary); }
.ce-as-table { width: 100%; border-collapse: collapse; font-size: 0.88em; margin: 6px 0 4px; }
.ce-as-table th { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--border); color: var(--text-secondary); font-weight: 600; white-space: nowrap; }
.ce-as-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.ce-as-table tr:last-child td { border-bottom: none; }
.ce-as-row.off td { color: var(--text-muted); }
.ce-as-row.off .ce-as-name { color: var(--text-secondary); }
.ce-as-row.on .ce-as-name { color: var(--text-primary); font-weight: 600; }
.ce-as-row.on .ce-as-eff { color: var(--green); }
.ce-as-w {
    display: inline-block; min-width: 84px; padding: 2px 8px; border-radius: 4px;
    background: var(--bg-tertiary); border: 1px solid var(--border); color: var(--text-secondary);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; text-align: right;
    cursor: not-allowed;
}
.ce-as-eff { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
.ce-as-foot { margin-top: 6px; font-size: 0.85em; color: var(--text-secondary); }
.ce-as-foot code { color: var(--text-primary); }

/* ── Trading -> Manual Rebalance (webapp/static/manual_rebalance.js) ── */
.mrb-apply { margin: 6px 0 10px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-secondary); }
.mrb-apply summary { cursor: pointer; }
.mrb-eng-group { margin-top: 6px; }
.mrb-eng-h { font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary); margin: 4px 0 2px; }
.mrb-eng { display: block; padding: 2px 0; }
.mrb-controls { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin: 8px 0; }
.mrb-controls label { font-size: 0.9em; color: var(--text-secondary); }
.mrb-segs { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.mrb-seg { background: var(--bg-secondary); color: var(--text-primary); border: 0; padding: 4px 12px; cursor: pointer; }
.mrb-seg + .mrb-seg { border-left: 1px solid var(--border); }
/* the search box in the controls strip (operator 2026-11-14): a set width, so the count that appears beside it while a
   term is typed is the only thing that grows */
.mrb-search { box-sizing: border-box; width: 15em; height: 26px; padding: 2px 8px; font: inherit; font-size: 0.95em; color: var(--text-primary); background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 6px; }
.mrb-search:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; }
.mrb-seg.active { background: var(--accent); color: #0d1117; font-weight: 600; }
/* the ONE top slider (operator 2026-10-02 17:40Z: "it should be easy to see") */
.mrb-top { margin: 8px 0 10px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-secondary); }
.mrb-top-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mrb-top-k { font-size: 1.1em; font-weight: 600; }
.mrb-top-range { width: min(520px, 70vw); height: 22px; accent-color: var(--accent); }
.mrb-top-v { font-size: 1.1em; }
.mrb-top-v b { font-size: 1.25em; font-variant-numeric: tabular-nums; }
.mrb-why { margin-top: 6px; font-size: 0.95em; color: #e0a030; }
.mrb-flow { margin-top: 3px; font-size: 0.95em; }
.mrb-alloc { margin-top: 5px; font-size: 0.88em; line-height: 1.55; }
.mrb-alloc-k { color: var(--text-secondary); text-transform: uppercase; font-size: 0.82em; letter-spacing: 0.03em; }
.mrb-alloc-sep { color: var(--text-secondary); margin: 0 4px; }
/* a row's own thumb: free within [0, its maximum]; the hatched track past it is dead; the golden ring is the target */
.mrb-share { min-width: 150px; }
.mrb-rs { position: relative; display: inline-block; width: 120px; height: 18px; vertical-align: middle; }
.mrb-rs input[type=range] { width: 100%; margin: 0; accent-color: var(--accent); }
/* BUY darker blue / SELL orange on the thumb (operator 2026-10-16: "the blue bar should be orange for selling and a darker
   blue for buying ... don't get confused for yes and no directions"): two existing tokens, never the YES/NO green/red; a
   row that trades both ways or nothing keeps the neutral --accent (manual_rebalance.js _mrbSideCls) */
.mrb-rs.mrb-side-buy input[type=range] { accent-color: var(--accent-emphasis); }
.mrb-rs.mrb-side-sell input[type=range] { accent-color: var(--severe-emphasis); }
.mrb-rs input[type=range]:disabled { opacity: 0.35; }
.mrb-rs-dead { position: absolute; top: 6px; right: 0; height: 6px; pointer-events: none; border-radius: 3px;
    background: repeating-linear-gradient(45deg, var(--border) 0 3px, transparent 3px 6px); border: 1px solid var(--border); }
.mrb-rs-ring { position: absolute; right: -7px; top: 2px; width: 14px; height: 14px; border: 2px solid var(--yellow); border-radius: 50%; box-sizing: border-box; pointer-events: none; }
.mrb-rs-v { display: block; min-width: 36px; font-variant-numeric: tabular-nums; font-size: 0.9em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* the row's own max t-cost (2026-10-03): one compact line under the share, inside the cell's fixed height */
.mrb-tcap { display: flex; gap: 3px; align-items: center; margin-top: 1px; white-space: nowrap; }
.mrb-tcap input { width: 66px; height: 1.4em; padding: 0 3px; font-size: 0.8em; box-sizing: border-box; }
.mrb-tcap select { height: 1.4em; padding: 0; font-size: 0.75em; box-sizing: border-box; }
/* current -> target as % of NAV: the fill is now, the golden ring the target, the blue tick where the plan lands */
.mrb-ct { min-width: 130px; }
/* 8px each side so a ring at 0% or 100% (it overhangs its position by 8px) stays inside the cell, and 2px above /
   3px below so the ring's 3px overhang below the bar sits inside the margin box: 1px of headroom at the cell's bottom
   where there was 0 (01's review of #1224; mrb_layout_check measures all four edges) */
.mrb-bar { position: relative; height: 10px; width: 120px; margin: 2px 8px 3px; background: var(--bg-tertiary); border-radius: 5px; }
.mrb-bar-cur { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(88,166,255,0.45); border-radius: 5px; }
.mrb-bar-tgt { position: absolute; top: -3px; width: 16px; height: 16px; margin-left: -8px; border: 2px solid var(--yellow); border-radius: 50%; box-sizing: border-box; }
.mrb-bar-land { position: absolute; top: -2px; width: 3px; height: 14px; margin-left: -1px; background: var(--accent); border-radius: 1px; }
/* the same two colours on the bar: the fill (what is held now) and the landing tick take the side the plan trades */
.mrb-bar.mrb-side-buy .mrb-bar-cur { background: rgba(31, 111, 235, 0.45); }
.mrb-bar.mrb-side-sell .mrb-bar-cur { background: rgba(189, 86, 29, 0.45); }
.mrb-bar.mrb-side-buy .mrb-bar-land { background: var(--accent-emphasis); }
.mrb-bar.mrb-side-sell .mrb-bar-land { background: var(--severe-emphasis); }
.mrb-view { text-align: left; }
.mrb-sig-cmp { font-size: 0.78em; }
.mrb-total-row td { border-top: 2px solid var(--border); font-weight: 500; }
.mrb-send-bar { display: flex; gap: 8px; align-items: center; margin: 6px 0 10px; }
/* the Send SUMMARY BAR (operator 2026-10-03 11:33Z): large, sticky at the top while the table scrolls, its left edge
   coloured by the plan's net direction; each figure a fixed-width box, so a slider move changes text, never layout */
#mrb-send-bar { position: sticky; top: 0; z-index: 6; background: var(--bg-secondary); border: 1px solid var(--border);
                border-radius: 6px; padding: 8px 12px 8px 18px; box-shadow: inset 6px 0 0 var(--border); }
/* the direction colour is an INSET shadow, not the border: a border whose one side changes colour is redrawn whole,
   and its anti-aliased corners shift by a unit just outside the box (mrb_layout_check caught it) */
#mrb-send-bar.mrb-net-buy { box-shadow: inset 6px 0 0 var(--positive); }
#mrb-send-bar.mrb-net-sell { box-shadow: inset 6px 0 0 var(--negative); }
.mrb-send-sum { display: flex; gap: 6px; align-items: baseline; }
.mrb-sum-box { display: inline-flex; flex-direction: column; width: 108px; font-variant-numeric: tabular-nums; }
.mrb-sum-box small { font-size: 0.68em; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary); }
.mrb-sum-box b { font-size: 1.25em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#mrb-sum-lines, #mrb-sum-engines { width: 64px; }
/* the per-row liquidity book (2026-10-03): the ladder the walk takes, the walked levels marked */
.mrb-book { display: flex; gap: 28px; flex-wrap: wrap; padding: 4px 0 8px 22px; }
.mrb-book-table { font-size: 0.8em; border-collapse: collapse; margin-top: 3px; }
.mrb-book-table th, .mrb-book-table td { padding: 2px 10px 2px 0; text-align: right; white-space: nowrap; }
.mrb-book-table th:last-child, .mrb-book-table td:last-child { text-align: left; }
.mrb-book-taken { background: rgba(63, 185, 80, 0.14); }
.mrb-book-over { color: var(--negative); }
.mrb-send { font-weight: 600; }
.mrb-send.mrb-armed { background: var(--danger-emphasis); border-color: var(--danger-emphasis); color: #fff; outline: 2px solid var(--red); outline-offset: 1px; }
/* a login not permissioned to send (manual_rebalance below edit; operator 2026-11-05): greyed, red border, and the note beside it */
.mrb-send.mrb-send-denied, .mrb-send.mrb-send-denied:disabled { opacity: 0.55; border: 2px solid var(--red); color: var(--text-secondary); cursor: not-allowed; }
.mrb-denied-note { color: var(--red); font-weight: 600; }
.mrb-table td, .mrb-table th { white-space: nowrap; padding-left: 5px; padding-right: 5px; }
.mrb-table .mrb-title { white-space: normal; min-width: 180px; max-width: 250px; }
.mrb-num { text-align: right; font-variant-numeric: tabular-nums; }
.mrb-sub { font-size: 0.78em; color: var(--text-secondary); }
.mrb-scroll { overflow-x: auto; max-width: 100%; }
/* ── A slider move changes VALUES, never the LAYOUT (operator 2026-10-02 21:17Z: "the page jitters ... no slider move
   changes any column width"). Column widths come from the tables' <colgroup> (manual_rebalance.js _MRB_COLS /
   _MRB_CASH_COLS) under table-layout: fixed; every cell a recompute rewrites sits in a .mrb-cell of fixed height whose
   lines never wrap, so a row's height cannot change either; and the lines above the table keep one line each, so the
   table never moves down. Numbers are tabular so a changing digit keeps its width. ── */
.mrb-table, .mrb-cash-table { table-layout: fixed; }
.mrb-table td, .mrb-table th, .mrb-cash-table td, .mrb-cash-table th { overflow: hidden; font-variant-numeric: tabular-nums; }
.mrb-table th, .mrb-cash-table th { white-space: normal; vertical-align: bottom; }
.mrb-row > td, .mrb-leg > td, .mrb-total-row > td, .mrb-cash-table tbody td { vertical-align: top; }
.mrb-cell { height: 4em; max-height: 4em; overflow: hidden; }
/* the Status cell's font is 0.8em, so its box is sized in ITS em: 5em = the other cells' 4em, and 3 whole lines fit the
   clamp (it showed 2.4 at 3.6em: polybot-01, review of #1219) */
.mrb-st .mrb-cell { height: 5em; max-height: 5em; }
/* the engine's answer after Send WRAPS: it is never cut, and the row may grow then (Send is not a slider move) */
.mrb-out, .mrb-out div { white-space: normal; overflow-wrap: anywhere; }
.mrb-cell, .mrb-cell div { white-space: nowrap; text-overflow: ellipsis; }
.mrb-cell > div { overflow: hidden; }
.mrb-cell.mrb-clamp { white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.mrb-cell .mrb-bar { overflow: visible; }
.mrb-why, .mrb-flow, .mrb-alloc-ln, .mrb-asked { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrb-send-bar { flex-wrap: nowrap; white-space: nowrap; overflow: hidden; }
.mrb-icon { width: 18px; height: 18px; border-radius: 3px; vertical-align: middle; margin-right: 6px; }
.mrb-badge { font-size: 0.72em; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border); color: var(--text-secondary); }
/* the Fire Trade FREEZE tag (design §10 C): the same chip on Positions, Manual Rebalance and Target Portfolio; a
   dashed "freeze ?" when the account's freeze row could not be read -- never no chip, which reads as "not frozen" */
.fire-frozen { font-size: 0.72em; padding: 1px 5px; border-radius: 4px; border: 1px solid #e0a030; color: #e0a030; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.fire-frozen-unknown { border-style: dashed; font-weight: 400; }
/* asked vs would-send, on one scale from current (left) to target (right) (operator 2026-10-02): a hollow yellow ring at
   the ASKED share of the gap, a solid blue mark at what would actually be SENT; equal = whole, short = partial, none = refused */
.mrb-asked { font-size: 0.9em; color: var(--text-primary); margin-bottom: 3px; }
/* the vol-breaker marks (operator 2026-10-02), shared by Target Portfolio and Manual Rebalance: an ORANGE outline on a
   contract the breaker pauses now, the same outline muted and dashed when a waiver is in force; the waiver dropdown */
.vb-mark-blocked { outline: 2px solid var(--yellow); outline-offset: -2px; }
.vb-mark-waived { outline: 1px dashed var(--yellow); outline-offset: -2px; }
.vb-mark-note { font-size: 0.78em; margin-top: 2px; white-space: normal; }
.vb-mark-note-blocked { color: var(--yellow); }
.vb-mark-note-waived { color: var(--text-secondary); }
.vb-marks-banner { font-size: 0.85em; color: var(--yellow); margin: 4px 0; }
.vb-wmenu { display: inline-block; font-size: 0.78em; margin-top: 2px; }
.vb-wmenu > summary { cursor: pointer; color: var(--text-secondary); }
.vb-wmenu.vb-wmenu-hot > summary { color: var(--yellow); }
.vb-wmenu-body { padding: 4px 0; white-space: normal; }
.vb-wmenu-body .btn { margin: 0 3px 3px 0; }
.vb-wmenu-h, .vb-wmenu-note { color: var(--text-secondary); margin-bottom: 3px; }
.vb-wmenu-err { color: var(--red); }
.mrb-cash { margin: 6px 0; }
.mrb-cash > summary { cursor: pointer; }
.mrb-cash-table td, .mrb-cash-table th { padding: 3px 8px; }
th.mrb-sortable { cursor: pointer; }
.mrb-badge.mrb-live { border-color: var(--red); color: var(--red); }
.mrb-exp { background: none; border: 0; color: var(--text-secondary); cursor: pointer; padding: 0 4px; }
.mrb-leg td { font-size: 0.85em; background: var(--bg-secondary); }
.mrb-pos { color: var(--green); }
.mrb-neg { color: var(--red); }
.mrb-on { color: var(--green); }
.mrb-off { color: var(--red); font-weight: 600; }
/* a row whose target includes a fundamental overlay (2026-11-14) */
.mrb-badge.mrb-ov { color: #b48cf2; border-color: #b48cf2; }
.mrb-warn { color: #e0a030; font-size: 0.85em; }
.mrb-floors { margin-top: 6px; font-size: 0.85em; color: var(--text-secondary); }
.mrb-err { color: var(--red); }
.mrb-muted { color: var(--text-secondary); }
.mrb-st { font-size: 0.8em; }
.mrb-status { margin: 6px 0; }
/* the Send banner (2026-10-20): waiting with a countdown / executing / answered with the percent and the refusals in words */
.mrb-banner { margin: 6px 0 10px; padding: 8px 12px; border-left: 3px solid #e0a030; background: var(--bg-secondary); line-height: 1.5; }
.mrb-banner-head { font-weight: 500; margin-bottom: 2px; }
.mrb-banner-list, .mrb-banner-list ul { margin: 2px 0 0 18px; padding: 0; }
.mrb-banner-list li { margin: 1px 0; }
.mrb-banner-list ul li { font-size: 0.92em; }
/* the Rebalance log fold (2026-11-10): every send on record, per engine per line, the hint under a refused line */
.mrb-log-wrap > summary { cursor: pointer; }
.mrb-log-kinds { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 8px; }
.mrb-log-kind { font-size: 0.82em; padding: 1px 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-tertiary); white-space: nowrap; cursor: help; }
.mrb-log-send { margin: 4px 0; padding: 2px 0 2px 8px; border-left: 2px solid var(--border); }
.mrb-log-send > summary { cursor: pointer; }
.mrb-log-badge { display: inline-block; font-size: 0.75em; text-transform: uppercase; letter-spacing: 0.04em; padding: 0 6px; border: 1px solid currentColor; border-radius: 8px; vertical-align: middle; }
.mrb-log-set { font-size: 0.82em; margin: 2px 0 4px; }
.mrb-log-eng { margin: 6px 0 2px; }
.mrb-log-line { font-size: 0.88em; padding-left: 16px; }
.mrb-log-line.mrb-warn { font-size: 0.88em; }
.mrb-log-hint { font-size: 0.76em; color: var(--text-secondary); padding-left: 32px; line-height: 1.4; max-width: 1000px; }
.mrb-log-h { font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary); margin: 6px 0 2px; }
.mrb-notes { margin: 6px 0; color: #e0a030; font-size: 0.85em; }
.mrb-explain { margin-top: 12px; font-size: 0.85em; color: var(--text-secondary); max-width: 1100px; line-height: 1.45; }


/* ── Signal Sources: Trading parameters + Books panels (operator 2026-09-29) ───────────────────────── */
.tp-section, .br-section { margin-bottom: 12px; padding: 10px 14px; background: var(--bg-secondary);
    border: 1px solid var(--border); border-radius: 8px; font-size: 0.9em; }
.tp-section { border-left: 3px solid var(--accent); }
.br-section { border-left: 3px solid var(--green); }
.tp-head, .br-head { cursor: pointer; font-weight: 600; font-size: 1.02em; }
.tp-head { color: var(--accent); }
.br-head { color: var(--green); }
.tp-note { font-size: 0.9em; color: var(--text-secondary); margin: 8px 0 10px; padding: 7px 10px;
    background: var(--bg-tertiary); border-radius: 6px; line-height: 1.45; }
.tp-rows { display: flex; flex-direction: column; gap: 2px; }
.tp-group { margin: 12px 0 4px; padding-bottom: 3px; font-size: 0.74em; font-weight: 700; letter-spacing: 0.07em;
    text-transform: uppercase; color: var(--text-secondary); border-bottom: 1px solid var(--border); }
.tp-row { display: grid; grid-template-columns: minmax(14em, 1.4fr) minmax(10em, 1fr) 6em; gap: 12px;
    align-items: start; padding: 7px 6px; border-radius: 6px; }
.tp-row:hover { background: var(--bg-tertiary); }
.tp-title { font-weight: 600; }
.tp-mark { color: var(--text-secondary); font-weight: 400; }
.tp-mark-dirty { color: var(--yellow); }
.tp-gate { font-size: 0.85em; margin-top: 2px; }
.tp-gate-on { color: var(--green); }
.tp-gate-off { color: var(--yellow); }
.tp-gate-unk { color: var(--red); }
.tp-issue { font-size: 0.85em; margin-top: 2px; color: var(--red); }
.tp-help { font-weight: 400; margin-top: 2px; }
.tp-help > summary { cursor: pointer; color: var(--text-secondary); font-size: 0.86em; }
.tp-help-body { margin: 6px 0 2px; padding: 7px 10px; background: var(--bg-tertiary); border-radius: 6px;
    display: flex; flex-direction: column; gap: 4px; line-height: 1.45; }
.tp-help-meta { color: var(--text-secondary); font-size: 0.9em; }
.tp-ctl { padding-top: 3px; }
.tp-slider { width: 100%; accent-color: var(--accent); cursor: pointer; }
.tp-range { display: flex; justify-content: space-between; font-size: 0.75em; color: var(--text-secondary);
    font-variant-numeric: tabular-nums; }
.tp-switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--text-secondary); }
.tp-switch input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
.tp-val { justify-self: end; min-width: 4.5em; text-align: center; font-variant-numeric: tabular-nums;
    padding: 2px 8px; border-radius: 10px; background: var(--bg-tertiary); border: 1px solid var(--border); }
.tp-val.tp-dirty { border-color: var(--yellow); color: var(--yellow); background: var(--yellow-bg); }
.tp-actions { margin-top: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tp-review { margin-top: 10px; padding: 9px 12px; border: 1px solid var(--yellow); background: var(--yellow-bg);
    border-radius: 8px; }
.tp-review ul { margin: 6px 0 2px 18px; }
.tp-muted { color: var(--text-secondary); font-size: 0.86em; }
.tp-result { margin-top: 8px; }
.tp-impact { margin: 2px 0 8px; padding: 8px 12px; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 6px; background: var(--bg-tertiary); }
.tp-impact-head { font-weight: 600; font-size: 0.9em; }
.tp-impact-big { font-size: 1.5em; font-weight: 700; line-height: 1.2; margin: 2px 0; font-variant-numeric: tabular-nums; }
.tp-impact-wait { color: var(--text-secondary); font-weight: 400; }
.tp-impact-sub { font-size: 0.8em; color: var(--text-secondary); }
.tp-impact-note { font-size: 0.8em; margin-top: 2px; }
.tp-ok { color: var(--green); }
.tp-bad { color: var(--red); }
.br-row { display: grid; grid-template-columns: 2.4em minmax(11em, 1fr) minmax(18em, 2fr) auto; gap: 12px;
    align-items: center; padding: 7px 6px; border-radius: 6px; }
.br-row:hover { background: var(--bg-tertiary); }
.br-avatar { width: 2.2em; height: 2.2em; border-radius: 50%; border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center; font-size: 1.15em; }
.btn.br-danger { background: var(--red-bg); border-color: var(--red); color: var(--red); }
.btn.br-danger:hover { background: rgba(248, 81, 73, 0.2); }
.tp-section .btn:disabled, .br-section .btn:disabled { opacity: 0.45; cursor: not-allowed; }
/* ── Omni (operator 2026-10-03): the fundamental trader's one page. app.js OMNI-JS renders every class below. ─────── */
.omni-mute { color: var(--text-secondary); font-size: 0.85em; }
.omni-note { color: var(--text-secondary); font-size: 0.85em; margin: 0 0 8px; line-height: 1.45; }
.omni-warn { color: var(--yellow); font-size: 0.85em; }
.omni-err { color: var(--red); font-size: 0.88em; }
.omni-ok { color: var(--green); font-size: 0.88em; }
.omni-pos { color: var(--positive); }
.omni-neg { color: var(--negative); }
.omni-edit { color: var(--yellow); font-weight: 600; }
.omni-zero { color: var(--text-secondary); }
.omni-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.omni-lbl { color: var(--text-secondary); font-size: 0.85em; margin: 0 4px 0 8px; }
.omni-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }

/* the books: one card each */
.omni-engines { margin: 0 0 12px; }
.omni-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; align-items: start; }
.omni-card { background: var(--bg-secondary); border: 1px solid var(--border); border-top: 3px solid var(--accent);
             border-radius: 6px; padding: 8px 10px; font-size: 0.9em; }
.omni-card-h { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 8px; row-gap: 2px; align-items: center; }
.omni-card-h .br-avatar { grid-column: 1; grid-row: 1 / span 2; }
.omni-card-name { grid-column: 2; min-width: 0; overflow-wrap: break-word; }
.omni-card-h .sw-state { grid-column: 2; justify-self: start; }
.omni-card-lever { grid-column: 3; grid-row: 1 / span 2; margin-left: 4px; }
.omni-card-k { margin-top: 4px; }
.omni-card-r { margin-top: 6px; }
.omni-bulk { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }

/* the collapsible sections */
.omni-sec { border: 1px solid var(--border); border-radius: 6px; margin: 0 0 10px; background: var(--bg-primary); }
.omni-sec > summary.omni-sec-h { cursor: pointer; padding: 8px 10px; font-weight: 600; background: var(--bg-secondary);
                                 border-radius: 6px; }
.omni-sec[open] > summary.omni-sec-h { border-bottom: 1px solid var(--border); border-radius: 6px 6px 0 0; }
.omni-sec-body { padding: 8px 10px; }
.omni-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0 0 8px; font-size: 0.88em; }
.omni-tools select, .omni-search, .omni-in, .omni-ed select { background: var(--bg-secondary); color: var(--text-primary);
             border: 1px solid var(--border); border-radius: 4px; padding: 3px 6px; }
.omni-search { min-width: 180px; }
.omni-chip { border: 1px solid var(--border); border-radius: 12px; padding: 2px 8px; white-space: nowrap; }

/* over time */
/* at most TWO charts per row at any width (operator 2026-10-04); one on a narrow window */
.omni-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 900px) { .omni-tiles { grid-template-columns: minmax(0, 1fr); } }
.omni-tile { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; }
.omni-tile-h { font-weight: 600; font-size: 0.88em; margin-bottom: 4px; }
.omni-tile-c { position: relative; height: 190px; }

/* the contracts */
.omni-savebar { position: sticky; top: 0; z-index: 3; background: var(--bg-tertiary); border: 1px solid var(--yellow);
                border-radius: 6px; padding: 6px 10px; margin: 0 0 8px; font-size: 0.9em; }
/* Omni round 13: the slim books bar and the Save bar share ONE sticky wrapper, so they stack with no computed offset */
.omni-stick { position: sticky; top: 0; z-index: 3; }
.omni-stick .omni-savebar { position: relative; }   /* in the wrapper's flow; "what is Proposed?" hangs under IT, as on FV */
.omni-booksbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: var(--bg-secondary);
                 border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; margin: 0 0 4px; font-size: 0.82em; }
.omni-booksbar:empty { display: none; }
.omni-bb-book { display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
.omni-bb-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
/* slim means ONE line at the page's 1.3 zoom: the card's state pill and the bulk button, scaled down inside the bar only */
.omni-booksbar .sw-state { font-size: 10px; padding: 0 6px; line-height: 1.5; }
.omni-booksbar .btn { padding: 1px 8px; font-size: 11px; line-height: 1.4; margin-left: auto; }
.omni-save { font-weight: 600; }
.omni-grid-wrap { overflow-x: auto; }
.omni-grid { width: 100%; font-size: 0.86em; }
.omni-grid td { vertical-align: top; }
.omni-col-exp { width: 22px; }
.omni-exp { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 1em; padding: 0 2px; }
.omni-name { min-width: 220px; max-width: 360px; white-space: normal; }
.omni-row-open > td { background: var(--bg-tertiary); }
.omni-book-h { border-bottom: 3px solid var(--border); }
.omni-bk { white-space: nowrap; }
.omni-buy { color: var(--positive); }
.omni-sell { color: var(--negative); }
.omni-flat { color: var(--text-primary); }
.omni-no { font-size: 0.8em; color: var(--text-secondary); }
.omni-vb { font-size: 0.78em; font-weight: 600; padding: 1px 5px; border-radius: 3px; }
.omni-vb-blocked { color: var(--yellow); background: var(--yellow-bg); }
.omni-vb-waived { color: var(--green); background: var(--green-bg); }
.omni-vbcell { min-width: 70px; }
.omni-liq { font-size: 0.78em; padding: 1px 5px; border-radius: 3px; border: 1px solid var(--border); white-space: nowrap; }
.omni-liq-liquid { color: var(--green); }
.omni-liq-fund { color: var(--accent); }
.omni-liq-below { color: var(--text-secondary); }
.omni-detail > td { background: var(--bg-secondary); padding: 8px 12px; }
.omni-subs { display: flex; flex-direction: column; gap: 6px; }
.omni-sub { border: 1px solid var(--border-soft); border-radius: 5px; }
.omni-sub > summary { cursor: pointer; padding: 4px 8px; font-weight: 600; font-size: 0.9em; }
.omni-sub-body { padding: 4px 10px 8px; }
.omni-ed { display: flex; flex-direction: column; gap: 6px; }
.omni-ed-line { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.omni-in { width: 72px; }
.omni-side.omni-side-yes { color: var(--positive); border-color: var(--positive); font-weight: 700; }
.omni-side.omni-side-no { color: var(--negative); border-color: var(--negative); font-weight: 700; }
.omni-implied { margin-left: 8px; }
.omni-mini { border-collapse: collapse; font-size: 0.9em; margin: 4px 0; }
.omni-mini td, .omni-mini th { padding: 2px 8px; border-bottom: 1px solid var(--border-soft); text-align: left; }
.omni-mini .omni-num { text-align: right; }
.omni-gap { display: inline-block; margin: 0 10px 4px 0; white-space: nowrap; }
.omni-flash > td { background: var(--yellow-bg) !important; transition: background 0.4s; }
/* Operator 2026-10-09: the BLOCK form, for #omni-vneed / #omni-vbsum when an attention row's "show"
   jumps to them. The rule above is scoped `> td` and styles table CELLS only, so it does nothing on
   a div -- reusing it would have looked like a fix and not been one. */
.omni-flash-block { box-shadow: 0 0 0 2px var(--yellow); border-radius: 6px; transition: box-shadow 0.4s; }
/* the Signal Sources strip mounted here carries its own Books restart panel; the book cards at the top are this
   page's restart, so the strip's copy is not drawn twice */
#panel-omni [id^="book-restart-omni"] { display: none; }
/* Omni round 2 (operator 2026-10-04): the books together, the buy whitelist, the vol-breaker list, the decay shape */
.omni-comp-h { border-bottom: 3px solid var(--text-primary); }
.omni-comp { min-width: 130px; }
.omni-set { color: var(--accent); cursor: pointer; font-size: 0.85em; white-space: nowrap; text-decoration: none; }
.omni-set:hover { color: var(--accent-hover); }
.omni-spark { margin-top: 2px; white-space: nowrap; }
/* Omni round 3 (the audit, 2026-10-04): what needs the trader, the books together, each card's details */
.omni-attn { border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; margin: 0 0 10px; font-size: 0.9em;
             background: var(--bg-secondary); }
.omni-attn-ok { color: var(--text-secondary); }
.omni-attn-i { padding: 2px 0 2px 10px; border-left: 3px solid var(--yellow); margin: 3px 0; }
.omni-attn-bad { border-left-color: var(--negative); font-weight: 600; }
.omni-badge-bad { font-size: 0.78em; font-weight: 700; padding: 1px 5px; border-radius: 3px; color: var(--yellow);
                  background: var(--yellow-bg); white-space: nowrap; }
.omni-card-all { border-top-color: var(--text-primary); }
.omni-card-more { margin-top: 6px; border-top: 1px solid var(--border-soft); padding-top: 4px; }
.omni-card-more > summary { cursor: pointer; color: var(--accent); font-size: 0.85em; }
.omni-card-entry { display: flex; align-items: center; gap: 8px; }
/* the Switchboard's Active / Passive lever, given room for its two words, with its notes beside it */
.omni-card-entry .sw-lever { width: 88px; }
.omni-card-entry .sw-lever-wrap { flex-direction: row; align-items: center; gap: 10px; }
.omni-card-entry .sw-lever-why { text-align: left; max-width: none; }
.omni-counts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0 0 8px; font-size: 0.86em; }
.omni-cnt { background: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border); border-radius: 12px;
            padding: 2px 9px; cursor: pointer; }
.omni-cnt:hover { border-color: var(--accent); }
.omni-cnt-on { border-color: var(--accent); color: var(--accent); }
.omni-cnt-warn { border-color: var(--yellow); color: var(--yellow); }
.omni-delta { color: var(--yellow); font-size: 0.85em; white-space: nowrap; }
/* Omni round 9: the table grouped by event -- the heading row, and a rule down the left of the event's rows */
.omni-ev-head td { background: var(--bg-secondary); border-top: 2px solid var(--border); }
.omni-ev-title { white-space: normal; }
.omni-ev-group > tr > td:first-child { border-left: 3px solid var(--accent); }
/* Omni round 3b: the contract's trading mode, the books' resting orders, the risk badges */
.omni-modec { margin-top: 2px; font-size: 0.85em; }
.omni-mode { font-size: 0.86em; font-weight: 700; padding: 1px 5px; border-radius: 3px; border: 1px solid var(--border); white-space: nowrap; }
.omni-mode-frozen { color: var(--accent); border-color: var(--accent); }
.omni-mode-sell_only { color: var(--yellow); border-color: var(--yellow); }
.omni-mode-buy_only { color: var(--green); border-color: var(--green); }
.omni-rest-t { margin-top: 8px; }
.omni-card-risk { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* Omni round 3c: recent activity (the Trade Log page's table, hosted) */
.omni-act-trades { max-height: 420px; overflow: auto; }
.omni-act-views { margin-top: 8px; }
.omni-wlb.omni-wlb-on { color: var(--accent); border-color: var(--accent); font-weight: 700; }
.omni-vbsum { border: 1px solid var(--border); border-radius: 6px; margin: 0 0 8px; font-size: 0.9em; }
.omni-vbsum > summary { cursor: pointer; padding: 5px 10px; }
.omni-vbsum.omni-vbsum-hot { border-color: var(--yellow); }
.omni-vbrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 2px 0; }
/* which views / which whitelist save each book's engine runs on (VIEWS-APPLIED-JS; Fundamental Views and Omni) */
.va-host { margin: 0 0 8px; }
.va-line { font-size: 0.86em; line-height: 1.6; padding: 5px 10px; border-left: 3px solid var(--accent); background: var(--panel-bg); margin: 0 0 6px; }
.va-book { white-space: nowrap; }
.va-ok { color: var(--green); }
.va-wait { color: var(--yellow); }
.va-bad { color: var(--red); }
.va-mute { color: var(--text-secondary); }

/* Omni round 11: the engines' "why" chip (audit item 10). One block, appended; a zero target's code in the warning colour. */
.omni-whyc { margin-top: 2px; font-size: 0.85em; }
.omni-why { font-size: 0.86em; font-weight: 700; padding: 1px 5px; border-radius: 3px; border: 1px solid var(--border); color: var(--text-secondary); white-space: nowrap; display: inline-block; }
.omni-why-zero { color: var(--yellow); border-color: var(--yellow); }
/* Omni round 12: the ordinary why-code (gp_sized) drawn muted, so zero codes and held_unwinding stand out */
.omni-why-norm { font-weight: 400; opacity: 0.7; }
/* Trader Contributions: the table FITS its panel. thead th / tbody td are nowrap globally; measured 2026-10-07, six nowrap
   headers and one long row label made it 1,113 CSS px in an ~806 px panel at a 1400 px window (#1370). */
.tc-table thead th { white-space: normal; vertical-align: bottom; }
.tc-table td.tc-wrap { white-space: normal; }
.tc-table .tc-mark { color: var(--text-secondary); font-size: 0.85em; white-space: nowrap; }

/* External > Perf Snap: the four charts sit 2x2 (operator 2026-10-28); one column on a narrow screen. The 2-column grid is inline on #ps-charts (index.html), this is only its fallback. */
@media (max-width: 1000px) {
    #ps-charts { grid-template-columns: 1fr !important; }
}

/* Traders & risk budget (operator 2026-11-04; since #2086 read-only on Fundamental Views, edited on the Trading Desk): the
   roster as a card -- each trader's share of the weights, what its live view set holds, the rule the weight follows. Every
   colour is a theme token. */
.fv-tr-card { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin: 8px 0; background: var(--bg-secondary); }
.fv-tr-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.fv-tr-sub { font-size: 0.78em; color: var(--text-secondary); margin-top: 2px; max-width: 78em; line-height: 1.35; }
.fv-tr-total { font-size: 0.8em; color: var(--text-secondary); white-space: nowrap; }
.fv-tr-table { width: 100%; border-collapse: collapse; font-size: 0.85em; }
.fv-tr-table th { text-align: left; font-size: 0.72em; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-secondary); padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.fv-tr-table td { padding: 7px 8px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.fv-tr-table tbody tr:hover { background: var(--bg-hover); }
.fv-tr-table th.num, .fv-tr-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.fv-tr-table input, .fv-tr-table select { background: var(--bg-primary); color: var(--text-primary); border: 1px solid var(--border); border-radius: 4px; padding: 3px 6px; font-size: 1em; }
.fv-tr-table input.fv-tr-name { width: 130px; }
.fv-tr-table input.fv-tr-wallet { width: 190px; font-family: var(--mono); font-size: 0.9em; }
.fv-tr-table input.fv-tr-weight { width: 68px; text-align: right; }
.fv-tr-table input.fv-tr-ovb { width: 68px; text-align: right; }
.fv-tr-id { font-size: 0.78em; color: var(--text-secondary); margin-top: 3px; font-family: var(--mono); }
.fv-tr-badge { display: inline-block; font-family: inherit; font-size: 0.9em; padding: 0 6px; border-radius: 9px; border: 1px solid var(--border); color: var(--text-secondary); margin-left: 4px; }
.fv-tr-off td { color: var(--text-muted); }
.fv-tr-share { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.fv-tr-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.fv-tr-bar-fill { height: 100%; background: var(--accent); }
.fv-tr-muted { color: var(--text-secondary); white-space: nowrap; }
.fv-tr-unknown { color: var(--warning); font-weight: 600; }
.fv-tr-actions { white-space: nowrap; text-align: right; }
.fv-tr-remove { border: 1px solid var(--danger); color: var(--danger); }
.fv-tr-add { margin-top: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 0.85em; }
/* the ACCESS sub-row under each trader (2026-11-04): one select per governed surface */
.fv-tr-access td { padding: 2px 8px 9px; border-bottom: 1px solid var(--border); background: var(--bg-primary); }
.fv-tr-acc-row { display: flex; gap: 6px 14px; align-items: center; flex-wrap: wrap; font-size: 0.82em; color: var(--text-secondary); }
.fv-tr-acc-label { font-size: 0.78em; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.fv-tr-acc-row label { display: inline-flex; gap: 5px; align-items: center; white-space: nowrap; }
.fv-tr-acc-row .fv-tr-evo-lab { margin-left: 10px; padding-left: 10px; border-left: 1px solid var(--border); }
.fv-tr-table select.fv-tr-acc { padding: 2px 4px; font-size: 0.95em; }
.fv-tr-off .fv-tr-acc-row { color: var(--text-muted); }

/* Trader Contributions: the payout explainer (operator 2026-11-04: "dropdowns / logic that explains to them how their pnl
   contribution is calculated, and how it is adjusted for sharpe"). Every colour is a theme token. */
.tc-explainer { margin: 14px 0 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-secondary); font-size: 0.88em; }
.tc-explainer > summary { padding: 8px 10px; cursor: pointer; font-weight: 600; }
.tc-explainer-body { padding: 0 12px 8px; }
.tc-explainer-body details { margin: 4px 0; }
.tc-explainer-body summary { cursor: pointer; color: var(--text-primary); }
.tc-explainer-body p { margin: 4px 0 8px 16px; color: var(--text-secondary); line-height: 1.45; max-width: 90em; }
/* the Trader Contributions charts (2026-11-05): a tile grid under the table; min-width 0 so a canvas never widens the
   panel (the Browser fit test measures the table against its panel) */
.tc-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 10px; margin: 12px 0 4px; }
.tc-chart { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; min-width: 0; }
.tc-chart-title { font-size: 0.95em; font-weight: 600; }
.tc-chart-sub { font-size: 0.78em; color: var(--text-secondary); margin: 2px 0 6px; line-height: 1.35; }
.tc-chart-box { position: relative; height: 240px; width: 100%; }
.tc-chart-formula { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.78em; color: var(--text-secondary); margin-top: 6px; line-height: 1.4; }
.fv-tr-add input, .fv-tr-add select { background: var(--bg-primary); color: var(--text-primary); border: 1px solid var(--border); border-radius: 4px; padding: 3px 6px; }
/* the card's two surfaces (2026-11-04): read-only on Fundamental Views, editable on the Trading Desk */
.fv-tr-total a.fv-tr-link { color: var(--accent); text-decoration: none; }
.fv-tr-total a.fv-tr-link:hover { text-decoration: underline; }
.fv-tr-name-ro { font-weight: 600; }
.fv-tr-wallet-ro { font-family: var(--mono); font-size: 0.9em; }
.fv-tr-readonly .fv-tr-acc-row b { font-weight: 600; color: var(--text-primary); }
.fv-tr-err { margin-top: 6px; padding: 6px 10px; border: 1px solid var(--danger); color: var(--danger); font-size: 0.85em; }

/* ── Omni 2.0 (2026-11-25): the portfolio management table. Compact and dark, one row per contract; every colour is a
   theme token. The toolbar sticks to the top of the panel and the summary to the bottom, so Save Views and Execute
   Trades stay in reach while the table scrolls. */
.o2-top { position: sticky; top: 0; z-index: 6; background: var(--bg-primary); padding: 6px 0 4px; border-bottom: 1px solid var(--border); }
.o2-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.o2-grow { flex: 1 1 auto; }
.o2-select, .o2-search { background: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; font-size: 0.86em; }
.o2-search { width: 220px; }
.o2-filters { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.o2-sep { width: 1px; height: 18px; background: var(--border); margin: 0 2px; }
.o2-chip { background: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border); border-radius: 6px; padding: 4px 10px; font-size: 0.82em; cursor: pointer; white-space: nowrap; }
.o2-chip:hover { background: var(--bg-hover); }
.o2-chip.o2-on { background: var(--green-bg); border-color: var(--green); color: var(--green); font-weight: 600; }
.o2-btn { background: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border); border-radius: 6px; padding: 5px 12px; font-size: 0.84em; cursor: pointer; white-space: nowrap; }
.o2-btn:hover:not(:disabled) { background: var(--bg-hover); }
.o2-btn:disabled { opacity: 0.45; cursor: default; }
.o2-btn-save { border-color: var(--green); color: var(--green); font-weight: 600; }
.o2-btn-exec { background: var(--green); border-color: var(--green); color: var(--bg-primary); font-weight: 700; padding: 8px 18px; }
.o2-btn-exec:hover:not(:disabled) { background: var(--green); filter: brightness(1.1); }
.o2-btn-ovr { font-size: 0.92em; padding: 1px 7px; margin-left: 6px; }
/* NO-80 (2026-11-29): the venue's markets that are not in our universe, listed UNDER the table (a block of its own: the
   table's fixed columns are not touched), each with Add; and the liquidity line under a contract's name */
.o2-btn-add { border-color: var(--green); color: var(--green); font-weight: 600; padding: 2px 12px; }
.o2-btn-mini { font-size: 0.9em; padding: 1px 7px; }
.o2-chip-cand { border-style: dashed; }
.o2-added { border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; font-size: 0.92em; }
.o2-liq { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.o2-cand { margin: 10px 0 4px; }
.o2-cand:empty { display: none; }
.o2-cand-head { font-size: 0.9em; margin-bottom: 6px; }
.o2-cand-offer { font-size: 0.86em; }
.o2-cand-table { width: 100%; border-collapse: collapse; font-size: 0.88em; }
.o2-cand-table th { text-align: right; font-weight: 600; color: var(--text-secondary); padding: 4px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.o2-cand-table th:first-child { text-align: left; }
.o2-cand-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); vertical-align: top; text-align: right; white-space: nowrap; }
.o2-cand-table td.o2-cand-name { text-align: left; white-space: normal; }
.o2-cand-table td.o2-cand-act { width: 1%; }
.o2-cand-foot { font-size: 0.84em; margin-top: 5px; }
/* one line is always kept for the message (2026-11-28): a save's answer or a warning coming and going moved the whole
   table by a line under the box being typed in (19 px, measured on the live page) */
.o2-msg { font-size: 0.8em; line-height: 1.45; margin-top: 4px; min-height: 1.45em; }
.o2-trader { font-size: 0.82em; }
#o2-save { min-width: 9.5em; }
.o2-wrap { overflow-x: auto; container-type: inline-size; }
/* FIXED COLUMNS (2026-11-28, a trader's complaint about the slider). The table was laid out by its contents, so the
   text under ONE slider set the width of the Share of Gap column and of EVERY slider in it: dragging from 5% to 25%
   on the live page took the sliders from 175 px to 277 px mid-drag ("Buy $2,980 of $10,277 · cut to the t-cost
   bound"), and the T-Cost and Target figures moved the columns the same way. Every column but the name now has a
   width of its own, by the width of the panel, and the name takes the rest: nothing a trader types or drags changes
   where a control is. */
.o2-table { width: 100%; min-width: 700px; table-layout: fixed; border-collapse: collapse; font-size: 0.86em; font-variant-numeric: tabular-nums; }
.o2-table th, .o2-table td { box-sizing: border-box; }
.o2-table th { text-align: left; font-weight: 600; font-size: 0.86em; color: var(--text-secondary); padding: 6px 6px; border-bottom: 1px solid var(--border); background: var(--bg-secondary); white-space: normal; line-height: 1.2; vertical-align: bottom; }
.o2-table th.o2-sort { cursor: pointer; user-select: none; }
.o2-table th.o2-sorted { color: var(--text-primary); }
.o2-arrow { font-size: 0.8em; color: var(--text-muted); white-space: nowrap; }
.o2-sorted .o2-arrow { color: var(--accent); }
/* cells wrap (the app's tables do not by default): a narrow panel shortens the name and stacks the target's lines
   instead of pushing the last columns off the edge */
.o2-table td { padding: 5px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: normal; }
.o2-row:hover td { background: var(--bg-hover); }
.o2-row-inel td { background: var(--bg-secondary); }
.o2-row-inel .o2-name, .o2-row-inel .o2-num, .o2-row-inel .o2-by { color: var(--text-muted); }
.o2-row-inel .o2-slide, .o2-row-inel .o2-view, .o2-row-inel .o2-toggle { opacity: 0.6; }
/* ... and its dead slider stays visible: 0.35 x the row's 0.6 left it at about a fifth */
.o2-row-inel .o2-slide input[type=range]:disabled { opacity: 0.6; }
.o2-c-cur, .o2-c-price, .o2-c-tcost { white-space: nowrap; }
/* the target's dollars and its difference each stay whole; on a narrow panel the difference takes its own line */
.o2-c-tgt span { white-space: nowrap; }
/* the columns' widths: a laptop's panel first (about 780 px of table at 1366), then wider panels */
.o2-c-cur { width: 70px; }
.o2-c-tgt { width: 100px; }
.o2-c-gap { width: 150px; }
.o2-c-view { width: 92px; }
.o2-c-price { width: 46px; }
.o2-c-tcost { width: 54px; }
.o2-c-by { width: 34px; text-align: center; }
@container (min-width: 1000px) {
    .o2-c-cur { width: 80px; }
    .o2-c-tgt { width: 130px; }
    .o2-c-gap { width: 200px; }
    .o2-c-view { width: 96px; }
    .o2-c-price { width: 52px; }
    .o2-c-tcost { width: 62px; }
    .o2-c-by { width: 38px; }
}
@container (min-width: 1400px) {
    .o2-c-cur { width: 104px; }
    .o2-c-tgt { width: 150px; }
    .o2-c-gap { width: 280px; }
    .o2-c-view { width: 104px; }
    .o2-c-price { width: 64px; }
    .o2-c-tcost { width: 76px; }
    .o2-c-by { width: 46px; }
}
.o2-namecell { display: flex; gap: 6px; align-items: center; justify-content: space-between; }
.o2-nametxt { min-width: 0; }
/* a thumbnail still being looked up keeps its square (the shared placeholder is display:none until it resolves, so
   each name jumped 23 px to the right as its picture arrived); one with no picture keeps the same square, empty */
.o2-nametxt img.c-icon { display: inline-block !important; margin-right: 6px !important; }
.o2-noicon { display: inline-block; width: 18px; height: 18px; margin-right: 6px; vertical-align: middle; }
/* the name in Manual Rebalance's weight, after its thumbnail and before its side chip (the traders, 2026-11-27) */
.o2-name { color: var(--text-primary); font-weight: 400; text-decoration: none; }
a.o2-name:hover { color: var(--accent); text-decoration: underline; }
.o2-toggle { display: inline-flex; flex: 0 0 auto; border: 1px solid var(--border); border-radius: 5px; overflow: hidden; }
.o2-side { background: transparent; color: var(--text-muted); border: 0; padding: 2px 7px; font-size: 0.74em; font-weight: 700; cursor: pointer; }
.o2-side-yes.o2-on { background: var(--green); color: var(--bg-primary); }
.o2-side-no.o2-on { background: var(--red); color: var(--bg-primary); }
.o2-sub { font-size: 0.82em; line-height: 1.3; min-height: 1.3em; }
.o2-c-gap .o2-sub span, .o2-c-view .o2-sub span { white-space: nowrap; }
/* the line under the slider has a height of its own: two lines kept on a laptop's and a mid panel, one on a wide one
   (where the column holds the longest text whole). What it says grows as the slider moves ("Buy $994" -> "Buy $2,980
   of $10,277 · cut to the t-cost bound"); the row and the slider above it no longer move with it. A text longer than
   the lines kept ends in "…" and its hover says the rest. */
.o2-c-gap .o2-sub { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; height: 2.6em; }
.o2-c-gap .o2-sub .o2-warn { white-space: normal; }
@container (min-width: 1400px) {
    .o2-c-gap .o2-sub { -webkit-line-clamp: 1; height: 1.3em; }
}
/* ... and the line under the view box is one line: "● fair 0.916" */
.o2-c-view .o2-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.o2-num { font-variant-numeric: tabular-nums; }
.o2-mute { color: var(--text-secondary); }
.o2-pos { color: var(--green); }
.o2-neg { color: var(--red); }
.o2-ok { color: var(--green); }
.o2-warn { color: var(--yellow); }
.o2-bad { color: var(--red); }
.o2-inel { color: var(--text-secondary); }
.o2-ovr-on { color: var(--green); }
.o2-prev { font-size: 0.78em; color: var(--yellow); border: 1px solid var(--yellow); border-radius: 4px; padding: 0 4px; }
.o2-slide { display: flex; gap: 6px; align-items: center; }
.o2-slide input[type=range] { flex: 1 1 auto; min-width: 70px; width: 70px; margin: 0; accent-color: var(--accent); }
.o2-slide.o2-slide-buy input[type=range] { accent-color: var(--green); }
.o2-slide.o2-slide-sell input[type=range] { accent-color: var(--red); }
.o2-slide input[type=range]:disabled { opacity: 0.35; }
.o2-pctv { width: 40px; text-align: right; color: var(--text-secondary); }
/* the share, TYPED (2026-11-28): on a laptop the slider's track is about 94 px, a pixel a point, so a low share took a
   steady hand. The box and its % take the label's place and its width, so the slider keeps its own. */
.o2-pct { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: flex-end; gap: 1px; width: 40px; }
.o2-pcti { box-sizing: border-box; width: 29px; text-align: right; background: var(--bg-primary); color: var(--text-primary); border: 1px solid var(--border); border-radius: 4px; padding: 1px 3px; font-size: 0.95em; font-variant-numeric: tabular-nums; }
.o2-pcti:disabled { opacity: 0.45; }
.o2-pctu { color: var(--text-secondary); }
.o2-view input { width: 70px; background: var(--bg-primary); color: var(--text-primary); border: 1px solid var(--border); border-radius: 5px; padding: 3px 6px; font-size: 0.95em; font-variant-numeric: tabular-nums; }
.o2-view input:disabled { opacity: 0.5; }
.o2-view-dirty input { border-color: var(--yellow); background: var(--yellow-bg); }
.o2-unsaved { color: var(--yellow); }
.o2-by { font-weight: 700; }
.o2-by-staged { color: var(--yellow); }
.o2-empty { text-align: center; color: var(--text-secondary); padding: 28px 8px; }
.o2-more { font-size: 0.8em; color: var(--text-secondary); padding: 6px 2px; }
/* the engines' answers stay with the summary bar, above the button that sent them (they were drawn after the last
   row: up to 400 rows below the click, under a line that said "below") */
.o2-bottom { position: sticky; bottom: 0; z-index: 6; margin-top: 8px; }
.o2-status { margin: 0 0 6px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-secondary); font-size: 0.86em; max-height: 32vh; overflow-y: auto; }
.o2-status-x { float: right; margin: 0 0 4px 10px; padding: 1px 8px; }
.o2-foot { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; }
.o2-sum { display: flex; flex-direction: column; min-width: 84px; }
.o2-sum small { font-size: 0.74em; color: var(--text-secondary); }
.o2-sum b { font-size: 1.1em; font-variant-numeric: tabular-nums; }
.o2-foot-note { flex: 1 1 120px; font-size: 0.8em; min-width: 0; }
.o2-foot .o2-btn-exec { margin-left: auto; flex: 0 0 auto; }
.o2-cf-table { width: 100%; border-collapse: collapse; font-size: 0.9em; }
.o2-cf-table th, .o2-cf-table td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.o2-cf-table th.o2-num, .o2-cf-table td.o2-num { text-align: right; white-space: nowrap; }
.o2-cf-name { font-weight: 600; max-width: 320px; }
.o2-cf-tot { display: flex; gap: 26px; flex-wrap: wrap; margin: 12px 0 8px; }
.o2-cf-tot div { display: flex; flex-direction: column; }
.o2-cf-tot small { font-size: 0.76em; color: var(--text-secondary); }
.o2-cf-tot b { font-size: 1.1em; font-variant-numeric: tabular-nums; }
.o2-cf-note { font-size: 0.82em; line-height: 1.45; margin: 8px 0 12px; }
.o2-cf-btns { display: flex; gap: 10px; justify-content: flex-end; }
