/* ===================================================================
   EduMarkets — Bank ALM Simulation
   CSS Variables, Layout, and Component Styles
   =================================================================== */

/* ── CSS Variables ────────────────────────────────────────────────── */

:root {
    /* Dark theme (default) — EduMarkets charcoal-blue palette */
    --bg: #0D1117;
    --bg-surface: #161B22;
    --bg-header: #1A1F26;
    --bg-elevated: #1C232C;
    --bg-input: #20262F;
    --bg-hover: #262C36;
    /* The bar a card's name used to sit in. The card header no longer
       reads it (direction 1b: the fill went, the hairline stayed), and
       the token is kept defined rather than deleted. It has to differ
       from the card AND from the page behind it, and the two themes need
       opposite directions to manage that: here the card is dark and the
       page is darker still, so the bar goes lighter than the card. */
    --bg-card-header: #212630;
    --border: #252830;
    --border-subtle: #1a1c22;
    --text: #e8eaf0;
    --text-secondary: #c8ccdc;
    --text-muted: #9da3b8;
    --color-accent: #4f8cff;
    --color-accent-light: #6da0ff;
    --color-accent-bg: rgba(79, 140, 255, 0.15);
    --formula-numeric: #7ec8f0;
    --teal: #14b8a6;
    --teal-dim: rgba(20, 184, 166, 0.45);
    --teal-bg: rgba(20, 184, 166, 0.15);
    --positive: #34d399;
    --positive-bg: rgba(52, 211, 153, 0.15);
    --warning: #fbbf24;
    --warning-bg: rgba(251, 191, 36, 0.15);
    --negative: #f87171;
    --negative-bg: rgba(248, 113, 113, 0.15);
    --font-base: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    /* Font-size scale (owner, 2026-08-23). Four steps, and every rule in
       this file goes through them. The nine steps this replaced were
       referenced twice and bypassed by 244 hardcoded sizes across
       eighteen values, four of them half-pixel, which is what made the
       console read as untidy. A size that is not one of these four is a
       bug, not a nuance. The display numerals on the portfolio reveal and
       score screens (24px and up) are the one exception: there the size
       is the design rather than a step in the type scale. */
    --fs-xs:   11px;  /* table headers, badges, the smallest button */
    --fs-sm:   13px;  /* the default: nav, cards, tables, forms, buttons */
    --fs-md:   15px;  /* emphasis: large buttons, the key tables */
    --fs-lg:   22px;  /* the page title, one per screen */
    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 12px;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
    --transition: 150ms ease;
    /* Shared height for sidebar-footer and Decisions sticky footer so their
       top dividers align when both are visible. */
    --footer-h: 64px;
    /* Native form controls (date/time pickers, scrollbars) follow the theme. */
    color-scheme: dark;
}

[data-theme="light"] { color-scheme: light; }
/* The sidebar width as a token, because .header-logo in components.css
   sizes its column as calc(gutter + var(--sidebar-width)) and the shells
   have to agree on it. Left unset, this file fell back to base.css's
   340px while the sidebar below it is 260px, so the logo column ran 80px
   past its own sidebar and the tab nav beside it started somewhere the
   participant desk's never does (owner, 2026-08-26). */
:root { --sidebar-width: 260px; }

[data-theme="light"] {
    --bg: #f5f5f7;
    --bg-elevated: #ffffff;
    --bg-surface: #ffffff;
    --bg-header: #ffffff;
    --bg-hover: #f0f0f2;
    --bg-input: #f8f8fa;
    /* Here the card is white and the page is a light grey, so the bar
       goes DARKER than the card, and darker than the page as well: a
       value between the two read as a gap in the card rather than as its
       header (owner, 2026-08-24, "grey on grey"). */
    --bg-card-header: #e7e7ec;
    --border: #e0e0e4;
    --border-subtle: #eaeaee;
    --text: #1a1a1e;
    --text-secondary: #404048;
    --text-muted: #5a5a64;
    --color-accent: #2563eb;
    --color-accent-light: #1d4ed8;
    --color-accent-bg: rgba(37, 99, 235, 0.1);
    --formula-numeric: #1a6faa;
    --teal: #0d9488;
    --teal-dim: rgba(13, 148, 136, 0.50);
    --teal-bg: rgba(13, 148, 136, 0.12);
    /* Semantic colours re-tuned for contrast on white. The dark-theme 400-level
       shades (#34d399 / #f87171 / #fbbf24) wash out on a light background, so
       light mode uses 600/700-level shades and tints based on them. */
    --positive: #047857;
    --positive-bg: rgba(4, 120, 87, 0.12);
    --negative: #dc2626;
    --negative-bg: rgba(220, 38, 38, 0.10);
    --warning: #b45309;
    --warning-bg: rgba(180, 83, 9, 0.12);
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

/* ── Reset & Base ─────────────────────────────────────────────────── */

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

/* Form controls don't inherit font-family by default in any browser. */
button, input, select, textarea { font-family: inherit; }

/* Keyboard focus — a visible accent ring in both themes. :focus-visible only
   fires for keyboard navigation, so mouse clicks stay ring-free. Text inputs
   keep their own border+glow focus treatment (higher specificity below). */
:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

html, body {
    height: 100%;
    font-family: var(--font-base);
    background: var(--bg);
    color: var(--text);
    /* The root size. Every rem and every unstyled string reads off it, so
       it is not a step in the type scale. Chrome size, outside the scale;
       see .nav-item. */
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ── App Shell ────────────────────────────────────────────────────── */

.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    min-height: 64px;
    background: var(--bg-header);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

/* Light mode: white-on-white border is invisible — swap for a soft shadow
   (matches EduMarkets' light-mode header treatment exactly). */
[data-theme="light"] .app-header {
    border-bottom: 0;
    box-shadow: 0 1px 3px rgba(27,58,92,0.08);
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    /* Chrome size, outside the scale. See .nav-item. */
    font-size: 15px;
    color: var(--text);
    letter-spacing: -0.3px;
}

/* The header bar is shell too. Chrome sizes, outside the scale; see
   .nav-item. */
.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;   /* chrome, outside the scale */
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-dot.online { background: var(--positive); }
.status-dot.active { background: var(--color-accent); }
.status-dot.warning { background: var(--warning); }
.status-dot.offline { background: var(--negative); }
.status-dot.reconnecting { background: var(--warning); animation: pulse-dot 1s ease-in-out infinite; }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.theme-toggle {
    background: transparent;
    border: 1px solid transparent;     /* invisible by default, shows on hover (EduMarkets pattern) */
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;   /* the glyph size; chrome, outside the scale */
    transition: var(--transition);
    /* Desaturate the colour emoji glyphs (🌙 yellow → grey) for visual consistency,
       matching EduMarkets's exact treatment. */
    filter: grayscale(1);
}

.theme-toggle:hover {
    background: var(--bg-elevated);
    border-color: var(--border);
    color: var(--text);
}

/* ── Main Content ─────────────────────────────────────────────────── */

.app-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    /* The participant desk's gutter (--workspace-gutter), so the two
       shells start their sidebar on the same line (owner, 2026-08-26). */
    padding-left: 28px;
}

.sidebar {
    /* The participant desk's sidebar width (--sidebar-width) and the
       same air under its footer, which there comes from the sidebar
       content's own bottom padding (owner, 2026-08-26). */
    width: 260px;
    padding-bottom: 20px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--text);
    cursor: pointer;
    font-family: var(--font-base);
    /* The shell chrome — the sidebar, its footer and the lockup suffix —
       sits OUTSIDE the four-step scale (owner, 2026-08-23). Every sim
       carries the same shell, so these sizes are shared across consoles
       and a change here makes this one look unlike its siblings. Leave
       them in px; a type-scale sweep must skip this block. */
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

/* The pages of one sidebar entry, listed under it. Shell chrome like
   .nav-item above, so the size is in px and outside the four-step scale.
   The parent keeps its own filled active state and the open page is named
   in accent ink without a second fill, so the sidebar shows one section
   and one page rather than two highlighted rows. Only the MM Session
   Control writes into the host; on every other view it is empty and
   collapses, which is why the gap and the padding live on the host. */
.nav-subnav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 2px 0 4px;
}
.nav-subnav:empty { display: none; }

.nav-subitem {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 7px 12px 7px 26px;
    border: none;
    background: none;
    text-align: left;
    font-family: var(--font-base);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}
.nav-subitem:hover { background: var(--bg-hover); color: var(--text); }
.nav-subitem.active { color: var(--color-accent); font-weight: 600; }

.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--color-accent-bg); color: var(--color-accent); }
.nav-item.nav-disabled { opacity: 0.35; cursor: default; }
.nav-item.nav-disabled:hover { background: transparent; color: var(--text-muted); }

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

/* Cap every view's content width and pin it to the left — same pattern Financials uses,
   now applied globally so wide monitors don't stretch UI to the edges. */
.main-content > * {
    max-width: 1400px;
    margin-left: 0;
    margin-right: auto;
}

/* ── View Container ───────────────────────────────────────────────── */

.view { display: none; }
.view.active { display: block; }

/* ── Cards ────────────────────────────────────────────────────────── */

/* The board treatment (owner, direction 1b). A card is not a bordered box
   any more: it is a tonal block on the page ground, headed by an uppercase
   eyebrow over a hairline. The border goes because --bg-surface already
   stands off --bg in both themes, and a border around a filled block on a
   page of filled blocks draws twice. Padding and margins are unchanged.
   The padding is written as a variable because three other rules are
   measured off it: the header's negative margins, which bleed the
   hairline out to the block's edge, and the header's own inset, which
   has to land on the card's content edge. They were the same number
   typed four times, and the New Session cards, which pad 14px, had to
   restate every one of them. */
.card {
    --card-pad: 20px;
    background: var(--bg-surface);
    border: 0;
    border-radius: 0;
    padding: var(--card-pad);
    margin-bottom: 16px;
}

/* Trainer documentation view. Reuses the reference page's Simulation Logic layout
   (.ref-mech-layout / .ref-toc / .ref-mechanics / .ref-section); the classes below
   style the parameter rows and the part/feature headings within that content column. */
.doc-param { padding: 14px 0; border-top: 1px solid var(--border); }
.doc-param-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.doc-param-name { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.doc-param-meta { font-size: var(--fs-sm); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.doc-param-body { margin-top: 6px; }
.doc-param-body p { margin: 0 0 8px; color: var(--text-secondary); font-size: var(--fs-sm); line-height: 1.55; }
.doc-param-body p:last-child { margin-bottom: 0; }
.doc-list { margin: 6px 0 0; padding-left: 20px; }
.doc-list li { color: var(--text-secondary); font-size: var(--fs-sm); line-height: 1.5; margin-bottom: 5px; }
.doc-part { font-size: var(--fs-lg); font-weight: 700; margin: 32px 0 2px; color: var(--text); }
.doc-part-intro { margin: 0 0 14px; color: var(--text-secondary); font-size: var(--fs-sm); line-height: 1.5; }

/* The card header is an eyebrow over a hairline, not a filled caption bar
   (owner, direction 1b). The fill goes; the rule under it is what closes
   the heading. The negative margins bleed it across the card's own 20px
   padding to the card's edge, so the hairline spans the whole block; the
   margin and the inset are both the card's own padding, so the rule runs
   the full width of the block while the name sits on the card's content
   edge — the line the form labels and the table's first column start on
   (owner, 2026-09-10).
   Cards without a .card-header (the empty states) are untouched.
   The vertical padding is a single value: an uneven pair sat the name
   below the middle of its own band by half the difference, on every
   card at once (owner, 2026-09-10). */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: calc(-1 * var(--card-pad)) calc(-1 * var(--card-pad)) 16px;
    padding: 12px var(--card-pad);
    background: transparent;
    border-bottom: 1px solid var(--border);
}

/* The eyebrow itself: small, uppercase, letter-spaced, and at full
   strength in both themes (owner ruling after seeing 11px muted). */
.card-title {
    font-size: var(--fs-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text);
}

/* A card header's status group sets one gap, which holds the connection
   dot against the words that name it. An action standing in front of that
   pair is a separate thing and needs more room than the pair's own gap
   (owner, 2026-09-10: Export to Excel against Connected). The margin is
   on the dot and only where a button runs into it, so a header carrying
   buttons alone keeps its own spacing. */
.card-header .header-status > .btn + .status-dot { margin-left: 10px; }

/* A switch that sits in a card header belongs to that header, so it reads
   at the card title's size rather than the body's 16px. Weight and colour
   keep it subordinate to the title beside it. */
.card-header .toggle-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: var(--fs-sm);
    font-weight: 400;
}
/* A note beside the title (the Scenario card's scenario name) reads at the
   title's size too, not at the body's 16px (owner, 2026-10-14). */
.card-header > .muted { font-size: var(--fs-sm); }

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

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── Metric Cards ─────────────────────────────────────────────────── */

.metric {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 0;
    padding: 16px;
}

/* ── Tables ───────────────────────────────────────────────────────── */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-sm);
}

/* Every row and every column stays; the density comes out of the cell.
   The header reads as the eyebrow the card headers read as, one step
   further back in colour. */
.data-table th {
    text-align: left;
    padding: 8px 12px;
    font-weight: 700;
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.data-table tr:hover td { background: var(--bg-hover); }
.data-table td.right, .data-table th.right { text-align: right; }
.data-table td.positive { color: var(--positive); }
/* A red cell, or red words inside a cell (Sales & Trading's mark on a
   conversation): plain words in red, never a badge (owner, 2026-11-16,
   ruling 28). */
.data-table td.negative, .data-table td span.negative { color: var(--negative); }
.data-table td.mono { font-family: var(--font-mono); font-size: var(--fs-sm); }

/* My Sessions table: larger, more readable text than the dense default.
   Its rows tighten with the rest, but only to 10px: they carry
   full-height primary buttons and cannot follow the dense tables down. */
.data-table.sessions-table { font-size: var(--fs-md); }
.data-table.sessions-table th { font-size: var(--fs-sm); }
.data-table.sessions-table td { padding: 10px 12px; }
.data-table.sessions-table td.mono { font-size: var(--fs-sm); }
.data-table.sessions-table .badge { font-size: var(--fs-sm); }

/* EXCEPTION, and only for My Classes' accounts table (owner, 2026-09-05).
   A class runs to about thirty accounts and its roster is read as a list
   of names rather than as a grid of readings, so the rows carry the
   tightest vertical padding on the console. Below this the row no longer
   shrinks: its height is the Rename button's from here on. Nothing else
   takes this class. */
.data-table.roster-table td { padding: 4px 12px; }

/* The outer columns lose their outer inset, so a table spans exactly the
   card's content box: the first column starts on the same line as the
   card's own name above it and as the form labels on the cards beside
   it, and the last column ends where the header's own controls end
   (owner, 2026-09-10). Every per-table padding rule above sets both
   values, so this comes after all of them, and the admin console's own
   size is named because it outranks the bare selector. */
.data-table th:first-child,
.data-table td:first-child,
.admin-app .data-table.sessions-table th:first-child,
.admin-app .data-table.sessions-table td:first-child { padding-left: 0; }
.data-table th:last-child,
.data-table td:last-child,
.admin-app .data-table.sessions-table th:last-child,
.admin-app .data-table.sessions-table td:last-child { padding-right: 0; }

/* The hover band reaches 12px past the first and last cell, into the
   card's padding, so it no longer ends on the row's own text (owner,
   2026-10-13). A shadow paints outside the cell without moving it, so
   the alignment above holds and a scrolling wrapper gains no width. */
.data-table tr:hover td:first-child { box-shadow: -12px 0 0 var(--bg-hover); }
.data-table tr:hover td:last-child { box-shadow: 12px 0 0 var(--bg-hover); }
.data-table tr:hover td:first-child:last-child {
    box-shadow: -12px 0 0 var(--bg-hover), 12px 0 0 var(--bg-hover);
}

/* ── Forms ────────────────────────────────────────────────────────── */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-label {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text-secondary);
}

/* One height for a text field and a drop-down, so side by side they line
   up top and bottom: the browser draws a select 2px taller than a text
   input at the same padding (measured 2026-10-30, 36px against 34px). */
.form-input, .form-select {
    min-height: 36px;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: var(--fs-sm);
    font-family: var(--font-base);
    transition: var(--transition);
}

/* A text area fills its field's width and drags taller only. Dragged wider,
   the Report a problem message box ran past the dialog's right edge (owner,
   2026-11-17). */
textarea.form-input { width: 100%; resize: vertical; }

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px var(--color-accent-bg);
}

.form-input.mono { font-family: var(--font-mono); font-size: var(--fs-sm); }

/* A checkbox beside its label, inside a form group. The console carried no
   such row until the trainer form needed one per sim: `.toggle-row` is
   declared only scoped to card headers and lever rows, so it styles
   nothing here, and `.toggle` is the participant app's sliding switch. */
.form-group .check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: var(--fs-sm);
    color: var(--text);
    cursor: pointer;
}
/* A multi-select (am_limit_fields.js pickerHtml): a dropdown and Add, then
   the chosen items as chips with a cross, in the look of the participant
   chart's compare chips (portfolio-sim.css .pm-ch-chip), never a wall of
   checkboxes (owner, 2026-11-15). */
.pick-row { display: flex; align-items: center; gap: 8px; }
.pick-row .form-select { flex: 1; min-width: 0; }
.pick-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pick-chips:empty { display: none; }
.pick-chip {
    height: 28px;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 4px 0 7px;
    border: 1px solid var(--border);
    border-radius: 3px;
    white-space: nowrap;
    font-size: var(--fs-sm);
}
.pick-chip-x {
    padding: 0 3px;
    border: 0;
    background: none;
    color: var(--text-muted);
    font-size: var(--fs-sm);
    line-height: 1;
    cursor: pointer;
}
.pick-chip-x:hover { color: var(--text); }
.form-group .check-row input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: var(--color-accent);
    cursor: pointer;
}

/* Hide spinner arrows on all number inputs */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
}

.slider-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.slider-group input[type="range"] {
    flex: 1;
    height: 4px;
    appearance: none;
    background: var(--border);
    border-radius: 2px;
    outline: none;
}

.slider-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-accent);
    cursor: pointer;
    transition: background-color 0.15s ease;
}
.slider-group input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-accent);
    cursor: pointer;
    border: none;
    transition: background-color 0.15s ease;
}

/* ── Buttons ──────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    font-weight: 600;
    font-family: var(--font-base);
    cursor: pointer;
    transition: var(--transition);
    border: none;
}
/* Honour the browser's hidden attribute (owner report, 2026-09-08:
   two buttons marked hidden still rendered because the display
   above overrides the browser's default [hidden]{display:none}).
   Every element that sets its own display value has to guard
   [hidden] this way, so a template can just say hidden. */
.btn[hidden] { display: none; }

.btn-primary {
    background: var(--color-accent);
    color: #fff;
}
.btn-primary:hover { background: var(--color-accent-light); }

/* A button that stands beside a field has the field's height: since
   2026-10-30 every field and drop-down is 36px high (.form-input,
   .form-select min-height), and a button with its 1px border measured 34px
   beside one (owner's screenshot of Market Making's Advanced settings,
   2026-11-17). The transparent border keeps a primary button's label where
   a secondary button's bordered label sits. */
.btn-field { border: 1px solid transparent; min-height: 36px; }

/* A secondary button used to be transparent, outlined in --border and
   labelled in --text-secondary (owner, 2026-08-24: "they almost don't
   look like buttons"). On a card header those three are all but
   invisible: --bg-elevated is #1C232C and --border is #252830, nine units
   apart. It now carries the surface the form inputs use, which already
   reads as interactive on the same screen, and an outline pulled toward
   the muted text the way .lever-divider is. */
.btn-secondary {
    background: var(--bg-input);
    border: 1px solid color-mix(in srgb, var(--border) 55%, var(--text-muted));
    color: var(--text);
}
.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--color-accent);
    color: var(--text);
}
/* No hover highlight on a disabled secondary button, which .btn:disabled
   below greys out: the stage deadline's buttons looked live on a stage
   that cannot take them (owner, 2026-11-08). */
.btn-secondary:disabled:hover {
    background: var(--bg-input);
    border-color: color-mix(in srgb, var(--border) 55%, var(--text-muted));
}
.deadline-input:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-success {
    background: var(--positive);
    color: #fff;
}
.btn-success:hover { opacity: 0.9; }

.btn-danger {
    background: var(--negative);
    color: #fff;
}
.btn-danger:hover { opacity: 0.9; }

.btn-sm { padding: 5px 10px; font-size: var(--fs-sm); }
.btn-lg { padding: 12px 24px; font-size: var(--fs-md); }
/* The lifecycle buttons in Session Control. They read as chrome rather
   than as fields, so they go square with the surfaces around them; the
   class stays so the markup that names it is untouched. */
.btn-round { border-radius: 0; }

/* ── iOS-style toggle switch ───────────────────────────────────────── */
/* The admin console's switch. Every trainer console uses the blue switch
   in chrome.css (.toggle), its words on the left (owner, 2026-11-15). */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}
.switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.switch-slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    background: var(--border);
    border-radius: 999px;
    transition: var(--transition);
}
.switch-slider::before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: var(--transition);
}
.switch input:checked + .switch-slider { background: var(--positive); }
.switch input:checked + .switch-slider::before { transform: translateX(18px); }
.switch input:disabled + .switch-slider { cursor: default; opacity: 0.85; }

/* Round-deadline date/time inputs: match the app inputs and follow the theme,
   at the 36px of every other field (.form-input; owner, 2026-11-17,
   ruling 58). The de-risking window's day count uses the class as well. */
.deadline-input {
    min-height: 36px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-base);
    font-size: var(--fs-sm);
    padding: 6px 10px;
    transition: border-color var(--transition);
}
.deadline-input:hover { border-color: var(--text-muted); }
.deadline-input:focus { outline: none; border-color: var(--color-accent); }

/* Mid-session feature toggle rows: text on the left, switch on the right. */
.feat-toggle-list { display: flex; flex-direction: column; }
.feat-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    font-size: var(--fs-md);
    border-bottom: 1px solid var(--border);
}
.feat-toggle-row:last-child { border-bottom: none; }

/* Group heading inside the Optional Add-ons lists (setup form + live card).
   Same text size as the toggle rows (15px), bold, full-strength text colour. */
.feat-group-title {
    font-size: var(--fs-md);
    font-weight: 700;
    color: var(--text);
    padding: 14px 0 6px;
}
.feat-toggle-list > .feat-group-title:first-child { padding-top: 2px; }

/* ── Badges ───────────────────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-xs);
    font-weight: 600;
}

.badge-success { background: var(--positive-bg); color: var(--positive); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--negative-bg); color: var(--negative); }
.badge-info { background: var(--color-accent-bg); color: var(--color-accent); }

/* ── Regulatory Gauges ────────────────────────────────────────────── */

.gauge {
    text-align: center;
    padding: 16px;
    border-radius: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
}

/* ── Reference / Mechanics ─────────────────────────────────────────── */

.ref-mechanics {
    font-size: var(--fs-md);
    line-height: 1.6;
    color: var(--text-secondary);
}
.ref-mechanics .ref-section {
    margin: 28px 0 8px;
    font-size: var(--fs-md);
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}
.ref-mechanics .ref-section .formula-btn { margin-left: 4px; }
/* Sub-heading inside a chapter. Not indexed by the TOC, which keeps the
   chapter list short while every heading stays on the page. */
.ref-mechanics .ref-subsection {
    margin: 20px 0 6px;
    font-size: var(--fs-md);
    font-weight: 600;
    color: var(--text);
}
.ref-mechanics p { margin: 0 0 12px; }

/* Simulation Logic: two-column layout with a sticky table of contents on the
   left. Widen past the default 760px reading column to fit the TOC. */
.ref-panel-content > .ref-mech-layout { max-width: 1040px; }
.ref-mech-layout {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}
.ref-toc {
    position: sticky;
    top: 8px;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 8px;
    /* The list scrolls on its own when it is taller than the panel. Its
       limit is the panel's visible height (100cqh: .ref-panel-content is a
       size container) less the 8px sticky offset above and 8px below, so
       its last entry can always be scrolled into view. A limit taken from
       the viewport, 100vh less a guess at the chrome above the panel, left
       the last entries below the fold until the text reached its end. */
    max-height: calc(100cqh - 16px);
    overflow-y: auto;
    /* Section numbering by CSS counter, so adding or removing a section
       renumbers the index without touching the markup. */
    counter-reset: ref-section;
}
/* A number column and a title column, so a title that wraps hangs under
   itself rather than under its own number. */
.ref-toc-link {
    display: grid;
    grid-template-columns: 2.2em 1fr;
    align-items: baseline;
    gap: 6px;
    font-size: 0.92rem;
    line-height: 1.45;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    padding: 7px 10px 7px 6px;
    border-radius: 4px;
    transition: background 0.15s ease, color 0.15s ease;
    counter-increment: ref-section;
}
.ref-toc-link::before {
    content: counter(ref-section) ".";
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    text-align: right;
    padding-right: 4px;
}
.ref-toc-link:hover {
    color: var(--text-secondary);
    background: color-mix(in srgb, var(--text) 4%, transparent);
}
.ref-toc-link:hover::before { color: var(--text-secondary); }
.ref-toc-link.active { color: var(--text); font-weight: 600; background: transparent; }
/* The number is the only ink marker on the active row. */
.ref-toc-link.active::before { color: var(--color-accent); font-weight: 600; }
/* A quiet group label per chapter, on the platform handbook's `.learn-nav`
   model. Not a target: only the sections are clickable and highlighted. */
.ref-toc-group {
    font-size: 0.96rem;
    font-weight: 700;
    color: var(--text-secondary);
    padding: 6px 10px 4px 6px;
    margin-top: 14px;
}
.ref-toc-group:first-child { margin-top: 0; padding-top: 2px; }
.ref-mech-layout .ref-mechanics .ref-section,
.ref-mech-layout .ref-mechanics .doc-part { scroll-margin-top: 16px; }

@media (max-width: 900px) {
    .ref-mech-layout { grid-template-columns: 1fr; }
    .ref-toc { display: none; }
}

/* Engine Constants table on the Mechanics tab. */
.ref-engine-constants {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    margin: 8px 0 16px;
    font-size: var(--fs-sm);
    line-height: 1.5;
}
.ref-engine-constants thead th {
    text-align: left;
    padding: 8px 12px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-weight: 600;
    font-size: var(--fs-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}
.ref-engine-constants tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.05));
    vertical-align: top;
    overflow-wrap: break-word;
}
.ref-engine-constants tbody td:nth-child(2) {
    color: var(--text);
    font-weight: 500;
}
.ref-engine-constants tbody tr:last-child td { border-bottom: none; }

/* ── Footer ──────────────────────────────────────────────────────────
   .sidebar-footer — always visible, lives inside the sidebar. Holds the
   copyright; its top border runs across the sidebar only. */

/* Placement only. Everything the footer looks like is one definition
   in chrome.css, shared with the participant desks. */
.sidebar-footer {
    flex-shrink: 0;
    box-sizing: border-box;
    background: var(--bg-surface);
}

/* The sidebar's own entry, held at the foot of the nav rather than in the
   list, because it opens a dialog instead of a page. It IS a .nav-item,
   so it reads as one and nothing here restates that; the 8px inset is the
   nav's own, so it lines up with the entries above it. It carries no
   data-view, which is what every nav query keys on, so routing and the
   active mark pass it by. */
.sidebar-action {
    flex-shrink: 0;
    padding: 0 8px 14px;
}


@media (max-width: 768px) {
    /* Both go with the sidebar, which is a scrolling row of nav entries
       at this width and no place for either. */
    .sidebar-footer,
    .sidebar-action { display: none; }
}

/* ── Countdown / Timer ────────────────────────────────────────────── */

.countdown {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    font-weight: 600;
}

.countdown.urgent {
    border-color: var(--negative);
    color: var(--negative);
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ── Toast / Notifications ────────────────────────────────────────── */

.toast-container {
    position: fixed;
    top: 60px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: var(--fs-sm);
    animation: slideIn 300ms ease;
    max-width: 360px;
}

.toast.success { border-color: var(--positive); }
.toast.error { border-color: var(--negative); }
.toast.info { border-color: var(--color-accent); }
.toast.warning { border-color: var(--warning); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ── Loading ──────────────────────────────────────────────────────── */

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 40px auto;
}

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

/* A note or an empty state reads left-aligned and grey on every console
   (owner, 2026-11-15); some were centred, some left. */
.loading-text {
    text-align: left;
    color: var(--text-muted);
    font-size: var(--fs-sm);
    margin-top: 12px;
}

/* ── Responsive ───────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .sidebar { display: none; }
    .grid-3 { grid-template-columns: 1fr 1fr; }
}

/* ── Reference / Guide Sections ──────────────────────────────────── */

.ref-section {
    margin-bottom: 16px;
}

/* ── Tooltip System ──────────────────────────────────────────────── */

/* The question-mark cursor over anything that has a tooltip, on every
   trainer console (owner, 2026-11-15), as on the participant pages
   (participant-shell.css). :where() gives the rule no specificity, so an
   element that sets its own cursor keeps it, and buttons, links and form
   fields keep the cursor of a control. */
:where([data-tip]:not([data-tip=""]):not(button, a, input, select, textarea)) {
    cursor: help;
}

/* The one tooltip (shared/tooltip.js), in the same look as the
   participant pages (components.css .edu-tooltip), so every sims page and
   the platform show one tooltip (owner, 2026-10-03). It is one element on
   the body, above every pop-up. */
.edu-tooltip {
    position: fixed;
    z-index: 10001;
    max-width: 280px;
    padding: 8px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25), 0 1px 3px rgba(0,0,0,0.1);
    color: var(--text);
    font-size: 0.78rem;
    line-height: 1.45;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}
[data-theme="light"] .edu-tooltip {
    box-shadow: 0 4px 12px rgba(27, 58, 92, 0.1), 0 1px 3px rgba(27, 58, 92, 0.06);
}
.edu-tooltip--visible {
    opacity: 1;
    transform: translateY(0);
}

/* ── Formula icon button ── */
.formula-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-muted);
    cursor: pointer;
    margin-left: 4px;
    vertical-align: middle;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    line-height: 1;
    padding: 0;
    font-size: 0;
}
.formula-btn::before {
    content: 'ƒ';
    font-family: Georgia, 'Times New Roman', serif;
    font-style: italic;
    font-weight: normal;
    font-size: 0.72rem;
    display: inline-block;
    line-height: 1;
    transform: translateY(-1.5px);
}
.formula-btn:hover {
    color: var(--color-accent);
    border-color: var(--color-accent);
    background: var(--color-accent-bg);
}
.formula-btn--active {
    color: var(--color-accent);
    border-color: var(--color-accent);
    background: var(--color-accent-bg);
}

/* ── Formula panel (sliding from right) ── */
.formula-panel {
    position: fixed;
    top: 80px;
    right: -580px;
    width: 560px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 100px);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
    z-index: 500;
    display: flex;
    flex-direction: column;
    transition: right 0.25s ease;
    overflow: hidden;
}
.formula-panel--visible { right: 16px; }

.formula-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    cursor: grab;
    user-select: none;
    flex-shrink: 0;
}
.formula-panel-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}
.formula-panel-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}
.formula-panel-close:hover { color: var(--text); }

.formula-panel-body {
    padding: 18px 20px;
    overflow-y: auto;
    flex: 1;
}
.formula-section {
    margin-bottom: 18px;
}
.formula-section:last-child { margin-bottom: 0; }

/* Flex so the copy-LaTeX button the panel appends sits at the right end of
   the label rather than running on after the words. */
.formula-section-label {
    font-size: 0.85rem;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* De-carded — equations sit in flowing white space, flex-centred. */
.formula-symbolic,
.formula-numeric,
.formula-extra-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    padding: 10px 0;
    overflow-x: auto;
    font-size: 1rem;
}
.formula-symbolic .katex-display,
.formula-numeric .katex-display,
.formula-extra-content .katex-display { margin: 0; }
.formula-numeric {
    font-size: 0.95rem;
    color: var(--formula-numeric);
}
.formula-extra-content {
    font-size: 0.95rem;
}

.formula-var-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    font-family: var(--font-base);
}
.formula-var-table th {
    text-align: left;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.9rem;
    color: var(--text);
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}
.formula-var-table td {
    padding: 8px 10px;
    border-bottom: 0;
    color: var(--text);
    vertical-align: middle;
}
.formula-var-table tbody tr + tr td {
    border-top: 1px solid var(--border-subtle);
}
.formula-var-sym {
    color: var(--text);
    font-weight: 500;
    min-width: 48px;
    font-family: 'KaTeX_Main', 'STIX Two Text', Georgia, serif;
    font-style: italic;
}
.formula-var-val {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums lining-nums;
    color: var(--formula-numeric);
    text-align: right;
    white-space: nowrap;
}
.formula-var-unit {
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

.formula-intuition {
    font-size: 0.95rem;
    color: var(--formula-numeric);
    line-height: 1.6;
    padding: 14px 16px;
    background: color-mix(in srgb, var(--formula-numeric) 8%, transparent);
    border-radius: var(--radius);
    margin-top: 8px;
}

/* The rest of the panel's own behaviours, carried over from the participant
   app's components.css so one primitive looks the same in both apps: hovering
   a symbol highlights its row and every other place it appears, the copy
   button on each equation, the handbook link slot, and the flash on a value
   the poll has just changed. */
.is-formula-symbol {
    cursor: help;
    transition: background 0.1s, color 0.1s;
    border-radius: 2px;
}
[data-formula-sym].is-highlighted {
    background: color-mix(in srgb, var(--formula-numeric) 28%, transparent);
    color: var(--formula-numeric);
}
.formula-var-table tbody tr.is-highlighted td {
    background: color-mix(in srgb, var(--formula-numeric) 10%, transparent);
}

.formula-copy-btn {
    background: transparent;
    border: 0;
    color: var(--text-muted);
    padding: 3px 5px;
    cursor: pointer;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    transition: color 0.15s, background 0.15s;
}
.formula-copy-btn:hover {
    color: var(--text);
    background: var(--bg-elevated);
}
.formula-copy-btn:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 1px;
}
.formula-copy-btn.is-copied { color: var(--positive); }

.formula-cross-ref {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.85rem;
}
.formula-cross-ref-link {
    color: var(--text);
    text-decoration: underline;
    text-decoration-color: var(--text-muted);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}
.formula-cross-ref-link:hover { text-decoration-color: var(--text); }
.formula-cross-ref-link::after { content: ' \2192'; }

.formula-var-val.num-flash {
    animation: formula-num-flash 700ms ease-out;
}
@keyframes formula-num-flash {
    0%   { background: color-mix(in srgb, var(--formula-numeric) 28%, transparent); }
    100% { background: transparent; }
}

.formula-panel button:focus-visible,
.formula-panel a:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 1px;
}

/* A table whose rows pick what another surface reads. The standings use it:
   the selected team is the one every formula panel substitutes. Same accent
   treatment the participant market grid gives its own selected row. */
.data-table tbody tr.row-pick { cursor: pointer; }
.data-table tbody tr.row-pick:hover td { background: var(--bg-hover); }
.data-table tbody tr.row-selected td {
    --row-selected-bg: color-mix(in srgb, var(--color-accent) 12%, transparent);
    background: var(--row-selected-bg);
}
.data-table tbody tr.row-selected td:first-child { color: var(--color-accent); }
/* The selected band reaches past the outer cells the way the hover band
   does, and in its own colour when the pointer is on it. */
.data-table tbody tr.row-selected td:first-child { box-shadow: -12px 0 0 var(--row-selected-bg); }
.data-table tbody tr.row-selected td:last-child { box-shadow: 12px 0 0 var(--row-selected-bg); }
/* A row of the trainer's scenario card that has already happened: a rate
   decision announced or a story headline published. */
.data-table tbody tr.row-past td { color: var(--text-muted); }

/* ── My Sessions and My Classes, MM console (owner, 2026-10-09) ─────────
   The button hierarchy handoff: one primary action at a time on each
   page. My Sessions splits by moment (an unfinished-sessions card, then
   Ended today, then Earlier sessions); My Classes is a list with a panel
   holding every action for the selected class. */

/* A card whose body starts right under the header's hairline: the Live
   session rows pad their own top, and a table with no head row takes
   the hairline as its top rule. */
.card-header.card-header-flush { margin-bottom: 0; }

/* A button that reads as a link: Debrief on an ended session. */
.btn-text {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--color-accent);
    font-family: var(--font-base);
    font-size: var(--fs-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.btn-text:hover { background: var(--bg-surface); border-color: var(--border); }
.btn-text:disabled { opacity: 0.5; cursor: default; }

.btn-block { width: 100%; }

/* The ⋯ overflow button and its menu. The glyph is an icon rather than
   text, so its size sits outside the type scale. */
.more-wrap { position: relative; display: inline-flex; }
.btn-more {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--text-secondary);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.btn-more:hover,
.btn-more[aria-expanded="true"] { background: var(--bg-hover); border-color: var(--border); }
/* On a table row, which already turns --bg-hover under the pointer. */
.data-table tr .btn-more:hover,
.data-table tr .btn-more[aria-expanded="true"] { background: var(--bg-surface); }
.more-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 50;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    padding: 4px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}
.more-menu-item {
    padding: 7px 12px;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    text-align: left;
    white-space: nowrap;
    font-family: var(--font-base);
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
}
.more-menu-item:hover,
.more-menu-item:focus-visible { background: var(--bg-hover); outline: none; }
.more-menu-item.more-menu-danger { color: var(--negative); }
.more-menu-item.more-menu-danger:hover,
.more-menu-item.more-menu-danger:focus-visible { background: var(--negative-bg); }
.more-menu-divider { height: 1px; margin: 4px 0; background: var(--border); }

/* The Live session card: one row per unfinished session. */
.live-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px auto 30px;
    gap: 20px;
    align-items: center;
    padding-top: 16px;
}
.live-row + .live-row { margin-top: 16px; border-top: 1px solid var(--border); }
.live-row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.live-row-scenario { font-size: var(--fs-md); font-weight: 600; color: var(--text); }
.live-row-meta { font-size: var(--fs-sm); color: var(--text-muted); }
.live-row-state { font-size: var(--fs-md); font-weight: 600; }
.live-row .btn-lg { min-width: 120px; }
.live-empty { padding: 20px 0 4px; font-size: var(--fs-md); color: var(--text-muted); }

/* Ended today and Earlier sessions. */
.data-table.ended-table td.ended-when { width: 56px; color: var(--text-muted); }
.data-table.ended-table td.ended-when-date { width: 150px; white-space: nowrap; }
.data-table.ended-table td.ended-scenario { font-weight: 500; }
.data-table.ended-table td.ended-name { color: var(--text-secondary); }
.data-table.ended-table td.ended-actions { padding: 8px 0 8px 12px; white-space: nowrap; }
.ended-actions-row { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }

/* My Classes: the table and the panel side by side, the panel under the
   table once the content is narrower than about 1000px. */
.classes-layout { container-type: inline-size; }
.classes-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 16px;
    align-items: start;
}
@container (max-width: 1000px) {
    .classes-split { grid-template-columns: minmax(0, 1fr); }
}
.data-table.classes-table td { padding-top: 12px; padding-bottom: 12px; }
.data-table.classes-table td.class-name,
.data-table.classes-table td.class-status { font-weight: 600; }
.class-panel { display: flex; flex-direction: column; gap: 20px; }
.class-panel-group { display: flex; flex-direction: column; gap: 8px; }
.class-panel-label {
    font-size: var(--fs-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}
.class-password-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.class-password { display: flex; align-items: baseline; gap: 8px; font-size: var(--fs-md); }
.class-password-label { color: var(--text-muted); }
.class-password-value { color: var(--text); font-weight: 600; }
.class-release {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
}

/* ── Admin & Trainer Session Management ──────────────────────────── */

/* The admin's logo: the main EduMarkets PNG, copied with its sizes from
   the platform (owner, 2026-11-21). Header: platform dashboard.css
   .admin-topbar .dash-topbar-logo img. Sign-in: platform auth.css
   .auth-logo img. White text on the dark theme, black text on the light
   one, swapped as platform dashboard.css does. */
.admin-logo {
    height: 24px;
    width: auto;
    opacity: 0.9;
    display: block;
}
.admin-signin-logo {
    max-width: 280px;
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}
[data-theme="light"] .admin-logo,
[data-theme="light"] .admin-signin-logo {
    content: url('/assets/EduMarkets_black_text.png');
}

.admin-stat-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.trainer-form-grid {
    display: grid;
    /* minmax(0, 1fr), not 1fr: a bare 1fr floors each column at its own
       min-content width, so one long field note widened whichever column
       happened to hold it and the fields landed in a different place on
       every mandate. A zero floor keeps the two columns equal, so a field
       sits where it sat on the mandate before. */
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

/* A field that always opens a row. The mandates carry different numbers of
   limits, so the session settings that follow them landed in the left
   column on one mandate and the right on the next. Starting them on their
   own row puts them in the same place whichever mandate is chosen. */
.trainer-form-grid .form-group.row-start { grid-column: 1; }
/* A grid in a narrow card, where a long label wraps onto a second line:
   the fields of a row stay level, each label sitting directly above its
   own field (owner, 2026-10-30, the Sales & Trading option cards). */
.trainer-form-grid.form-grid-end { align-items: end; }

/* The New Session form (owner, 2026-08-23). Every field on it is short —
   a length, a difficulty, a number — so two columns stretched to the
   window left a dropdown three times the width of what it holds. Three
   fixed columns, and the grid stops rather than following the window. */
.trainer-form-grid.form-grid-dense {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: 960px;
}
/* Four across, for the Session card's four fields (owner, 2026-08-24).
   The wider cap is deliberate: 1280/4 is the same 320px column that
   960/3 gives the card below it, so a field is the same width on both
   rather than narrowing because its card holds one more. */
.trainer-form-grid.form-grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-width: 1280px;
}
/* Session News table: what has printed recedes, what is still ahead
   carries the trainer's attention (owner, 2026-08-24; sharpened
   2026-09-08). Printed rows fade with opacity so the Move colour is
   still visible at a reduced strength, and upcoming rows read at full
   strength with the row text darkened to --text so the contrast with
   the muted printed rows is clear on both themes. */
.mm-news-table .mm-news-printed td {
    color: var(--text-muted);
    opacity: 0.6;
}
.mm-news-table .mm-news-upcoming td {
    color: var(--text);
}
/* Move-column tones override the row's own text colour above. The
   generic .data-table .positive rule was being fought by that per-row
   colour rule at equal specificity in some browsers, so this pins the
   tones for the news table specifically (owner report, 2026-09-08). */
.mm-news-table .positive { color: var(--positive); }
.mm-news-table .negative { color: var(--negative); }

/* Column headers pin to the top of the scroller so a trainer scrolling
   through the schedule still sees which column is which (owner report,
   2026-09-08). The header sits above the rows with its own background,
   so nothing shows through. */
.mm-news-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bg-surface);
}
/* The Headline column wraps onto multiple lines for long headlines,
   so the Move column ("No effect" and the coloured percentages) is
   never forced onto a second row for lack of horizontal space (owner
   report, 2026-09-08). .data-table tbody td sets nowrap globally, so
   this overrides it just for the headline cell. */
.mm-news-table tbody td.mm-news-headline {
    white-space: normal;
}
/* A switch with its words beside it on a New Session form (the Prime
   Brokerage clients, the Sales & Trading tenors). The Markets page's
   switch it was made for takes the Hedge Fund card header form now
   (.card-header .toggle-row, owner, 2026-11-16, ruling 29). */
.mm-future-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}
/* A number a trainer types reads in the same face as the numbers they
   read back in the tables (owner, 2026-08-24). Text fields keep the
   proportional face: a session name is not a number. A text field that
   takes a number (a shock, a limit, a weight: inputmode decimal or
   numeric) reads in mono too, on every console (owner, 2026-11-15). */
.form-input[type="number"],
.form-input[inputmode="decimal"],
.form-input[inputmode="numeric"],
.deadline-input[type="number"] {
    font-family: var(--font-mono);
}
/* A button sharing a row with the form's fields. The grid cell has no
   label above it, so the button aligns to the bottom of the cell and
   sits on the same line as the inputs beside it rather than floating
   against their labels. */
.trainer-form-grid .form-group.cs-inline-action {
    justify-content: flex-end;
}
.trainer-form-grid .form-group.cs-inline-action .btn {
    width: 100%;
}
/* The scenario preview's headline schedule: every mover with the move
   it makes, scheduled releases marked among them. One table rather than
   a calendar beside it, since a scheduled release is also a mover and
   two tables printed it twice (owner, 2026-08-24). */
.cs-preview-schedule {
    margin-top: 12px;
    max-height: 280px;
    overflow-y: auto;
}
/* The scoring weights, short numbers that belong on one row. auto-fit
   rather than a count, so a component added to the engine widens the row
   instead of dropping one field onto a line of its own. The 100px floor
   keeps three on one row in the Sales & Trading scorecard card, a third of
   the page wide (owner, 2026-10-30); a label that wraps there keeps its
   field level with the others. */
.trainer-form-grid.form-grid-weights {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    align-items: end;
    max-width: 960px;
}
/* The weights are a split of one scorecard, so their sum reads under them
   rather than as a fifth field. It turns red away from 100. */
.weights-total {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px;
    font-size: var(--fs-sm);
}
/* Away from 100 the total and the line beside it turn red. `.negative` is
   only ever declared scoped in this file, so it is declared here too. */
.weights-total .negative { color: var(--negative); }

/* The line under a lever's dial, saying what the choice above it does.
   Plain muted text, not a panel (owner, 2026-08-25): .cr-note's fill and
   border made a one-line explanation read as a thing in its own right. */
.lever-blurb {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: var(--fs-sm);
    line-height: 1.5;
}
.lever-blurb:empty { display: none; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-xs);
    font-weight: 600;
    /* A badge is a pill. Broken across two lines it reads as two badges,
       which is what a narrow admin column did to "Market Making" and
       "Temporary password". It stays on one line and the column gives way
       instead. */
    white-space: nowrap;
}
.badge-info { background: var(--color-accent-bg); color: var(--color-accent); }
.badge-success { background: var(--positive-bg); color: var(--positive); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--negative-bg); color: var(--negative); }
.badge-secondary { background: var(--bg-hover); color: var(--text-muted); }

/* State in the trainer's three lists — My Sessions, My Classes and the
   Scenario Lab — is the word alone in the colour the badge class already
   carries. No capsule, no dot, no caps (owner, 2026-09-10): the fill was
   what made it a chip, and a dot in front of a word that already reads in
   its own colour states the same thing twice. It reads at the size of
   the rows around it, inherited rather than set, because it is a value in
   a column and not a chip any more (owner, 2026-09-10). Scoped away from
   body.admin-app: the admin tables carry eight columns and four row
   actions, and they keep the capsule. .badge itself is untouched, here
   and everywhere else it is used. */
body:not(.admin-app) .sessions-table .badge {
    background: none;
    padding: 0;
    font-size: inherit;
}

/* ── The admin console only (owner, 2026-09-05) ──────────────────────────
   Scoped to body.admin-app, so the trainer console keeps its own sizes.
   An admin table carries eight columns and four row actions where the
   trainer's two lists carry five and one, and at the trainer console's
   size the buttons stopped fitting on the row. Everything in these tables
   therefore reads one step down the four-step scale. */
.admin-app .data-table.sessions-table { font-size: var(--fs-sm); }
.admin-app .data-table.sessions-table th { font-size: var(--fs-xs); }
.admin-app .data-table.sessions-table td { padding: 8px 10px; }
.admin-app .data-table.sessions-table td.mono { font-size: var(--fs-xs); }
.admin-app .data-table.sessions-table .badge { font-size: var(--fs-xs); }
/* A sortable heading (the trainer list): the Capital Markets allocation
   book's rules (cm-sim.css .cm-fb-table th[data-sort] and th.is-sorted),
   with the direction mark in its .cm-sort-mark span. */
.admin-app .data-table th[data-sort] { cursor: pointer; }
.admin-app .data-table th.is-sorted { color: var(--text); }
/* The row actions come down with the text around them. Every button in an
   admin table, whatever size class it carries, reads at the smallest step. */
.admin-app .data-table .btn {
    font-size: var(--fs-xs);
    padding: 4px 9px;
}

/* Who is signed in, in the header's right-hand group. The participant app
   carries the same thing at the same size (mm-sim.css, .mm-header-name),
   so the two read alike; the console had only a small suffix beside the
   lockup, which the owner replaced with this (2026-09-05). */
.app-header-role {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.btn-xs {
    padding: 3px 8px;
    font-size: var(--fs-xs);
    border-radius: var(--radius-sm);
}
.btn-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent);
}
.btn-warning:hover { background: color-mix(in srgb, var(--warning) 22%, transparent); }
.btn-danger {
    background: var(--negative-bg);
    color: var(--negative);
    border: 1px solid color-mix(in srgb, var(--negative) 35%, transparent);
}
.btn-danger:hover { background: color-mix(in srgb, var(--negative) 22%, transparent); }
.btn-success {
    background: var(--positive-bg);
    color: var(--positive);
    border: 1px solid color-mix(in srgb, var(--positive) 35%, transparent);
}
.btn-success:hover { background: color-mix(in srgb, var(--positive) 22%, transparent); }

/* A disabled button reads as disabled whatever its colour, as on the
   Bank ALM console (owner, 2026-10-14). Only primary, secondary and link
   buttons greyed out before, so a green, amber or red button kept its
   colour and its pointer (trainer console consistency audit, fault, ruled
   2026-11-15). After every colour rule, so the hover rules above do not
   lift it back. */
.btn:disabled,
.btn:disabled:hover { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 768px) {
    .admin-stat-row { grid-template-columns: repeat(2, 1fr); }
    /* The two modifiers are named as well: they carry a second class, so
       they outrank the bare selector and would hold their columns here. */
    .trainer-form-grid,
    .trainer-form-grid.form-grid-dense,
    .trainer-form-grid.form-grid-4,
    .trainer-form-grid.form-grid-weights { grid-template-columns: 1fr; }
}

/* ── Mobile / Tablet Responsive ──────────────────────────────────── */

@media (max-width: 1024px) {
    .main-content { padding: 16px; }
}

@media (max-width: 768px) {
    .app-header { padding: 0 12px; height: 48px; }
    .app-logo { font-size: 13px; }   /* chrome, outside the scale */
    .sidebar { display: none; }
    .main-content { padding: 12px; }

    .grid-2 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr 1fr; }

    .card { --card-pad: 14px; }
    .card-header { flex-wrap: wrap; gap: 8px; }

    /* Table scroll */
    .data-table { font-size: var(--fs-sm); }
    .data-table th, .data-table td { padding: 8px 6px; }

    .toast { max-width: 280px; font-size: var(--fs-sm); }

    .btn-lg { padding: 10px 16px; font-size: var(--fs-sm); }

    /* Mobile nav — bottom bar */
    .app-body { flex-direction: column; }
}

@media (max-width: 480px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    /* Phone-size lockup, copied from the platform's 768px block. */
    .header-logo-mount { min-width: 0; }
    .header-logo-mount .lockup-led {
        max-width: 100%;
        --led-wm-size: 10px;
        --led-name-size: 16px;
    }
    .header-controls { gap: 6px; }
}

/* ── Theme Toggle Sun/Moon ─────────────────────────────────────── */

.icon-sun, .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: inline; }
[data-theme="light"] .icon-moon { display: inline; }

/* ── Header logo ───────────────────────────────────────────────────
   The brand mark is the platform HTML lockup system, loaded from
   /css/edumarkets-lockups.css. The ALM PNG swap rules (.dark-only and
   .light-only) went with the images: the lockup flips its ink from the
   [data-theme="dark"] rule in the lockup stylesheet, and the bar colour
   stays the same in both themes. */

/* Copied verbatim from the platform's components.css (.header-logo-mount
   .lockup-led, lines 209-233). Comments included so the reasoning travels
   with the rule. The name size is now 19px on every console (see below). */

/* In-module header lockup. The JS renderer deliberately omits a size
   preset (.xl/.lg/.md/.sm) for this surface so these custom sizes win
   the cascade — the preset rules in edumarkets-lockups.css load after
   components.css and would otherwise override variable-based sizing.
   Header is locked at 64px (see .app-header above); the 12 + 2 + 16*2*1.1
   = 49.2px lockup content fits inside the 52px logo-trigger area, so
   long module names wrap to 2 balanced lines without growing the bar. */
.header-logo-mount .lockup-led {
  --led-wm-size: 16px;
  --led-name-size: 19px;
}
/* 19px, not the platform's 22px. The Market Making name broke over three
   rows at 22px in a lockup column as wide as the gutter plus the sidebar,
   and the participant desk sizes it down to 19px for that reason (owner,
   2026-08-26). The other sims' names are as long, and the Hedge Fund
   console takes the same size, so every console's logo has one size
   (owner, 2026-11-15); the bank ALM console follows in its own copy. */
.header-logo-mount .lockup-led .name {
  /* line-height 1.15 gives descenders (g / y / p) room inside the
     line-box. No text-box trim on the name: its line clamp needs
     overflow:hidden, which clips the dots of the i's and the ascenders
     a cap trim leaves outside the box (see edumarkets-lockups.css).
     With single-line names in the in-module header, the extra 3-4px
     never threatens the 64px locked header height.
     At 1.15 the line box ends about 0.21em under the baseline, and the
     overflow:hidden of the clamp cut the foot of the g in "Brokerage"
     (owner, 2026-11-08): the bottom padding widens the clip box by the
     descender's last 0.06em without moving the line. */
  line-height: 1.15;
  padding-bottom: 0.06em;
  font-weight: 700;
  text-transform: none;
}

/* ── Reference Tab (EduMarkets Platform style) ─────────────────── */

.ref-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ref-sub-tabs-wrap {
    flex-shrink: 0;
    padding: 4px 0 16px;
}

.ref-sub-tabs {
    display: flex;
    gap: 4px;
    width: fit-content;
}

/* The Debrief's one row of buttons above its cards, on every console: the
   report buttons small and grey, Release Debrief large and blue at the
   right end, 32px above the first card (owner, 2026-11-15). */
.debrief-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 32px;
}
.debrief-actions[hidden] { display: none; }
/* A Debrief with pages (Hedge Fund, Asset Management) has its page buttons
   on the row's left, the buttons at its right (the Bank ALM Debrief's row,
   alm.css). */
.debrief-actions .ref-sub-tabs { margin-right: auto; }

.ref-sub-tab {
    padding: 7px 20px;
    border-radius: 0;
    border: 1px solid var(--border);
    background: transparent;
    cursor: pointer;
    font-family: var(--font-base);
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--transition);
}

.ref-sub-tab:hover {
    color: var(--text-secondary);
    border-color: var(--color-accent);
}

.ref-sub-tab.active {
    background: var(--color-accent-bg);
    border-color: var(--color-accent);
    color: var(--color-accent);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.ref-panel-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    /* A size container, so the sticky contents list inside (.ref-toc) takes
       its height limit from this panel's visible height in cqh units. Safe
       because the panel's height comes from the flex column around it
       (.ref-wrap at 100% of .main-content, under the 100vh .app-shell) at
       every width, never from its content, and because every fixed element
       (tooltip, formula panel, toasts, modals) is appended to document.body,
       outside the containing block this containment makes of the panel. */
    container-type: size;
}
/* One readable content width for EVERY Reference subtab. The panel scrolls full
   width; its content (Mechanics, Glossary, anything added later) is capped here,
   so the subtabs always match instead of each setting its own width. */
.ref-panel-content > * { max-width: 760px; }

/* ── Confirm Modal ──────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: modalFadeIn 150ms ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-12px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* The shared confirm, prompt and choice dialog (showConfirm, showPrompt,
   showChoice in shared/utils.js). Square with the surfaces. */
.modal-dialog {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 0;
    padding: 28px 32px 24px;
    min-width: 380px;
    max-width: 460px;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 200ms ease;
}
/* The feedback dialogs have a message box and are wider than a confirm dialog (owner, 2026-11-17). */
.modal-dialog.modal-dialog-wide { width: min(600px, 92vw); min-width: 0; max-width: none; }

.modal-title {
    font-size: var(--fs-md);
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
}

.modal-message {
    font-size: var(--fs-md);
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* A confirmation with its title alone (no message row) fits its content
   and starts its buttons at the title's left edge. At the 380px minimum
   the buttons sat to the right of the title's left edge (owner,
   2026-10-29). */
.modal-dialog:has(> .modal-title + .modal-actions) { min-width: 0; }
.modal-title + .modal-actions { justify-content: flex-start; }

.modal-btn {
    min-width: 100px;
    padding: 10px 20px;
    font-size: var(--fs-sm);
    font-weight: 600;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}

.modal-btn:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* ── Smooth Tab Transitions (5.5) ────────────────────────────────── */

.main-content {
    animation: fadeIn 200ms ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Mobile-Responsive (5.3) ─────────────────────────────────────── */

@media (max-width: 768px) {
    .app-body {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .sidebar-nav {
        display: flex;
        flex-direction: row;
        gap: 0;
        padding: 4px;
        width: 100%;
    }

    .nav-item {
        flex: 0 0 auto;
        padding: 8px 12px;
        font-size: var(--fs-sm);
        white-space: nowrap;
    }

    .main-content {
        padding: 12px;
        overflow-y: auto;
    }

    .grid-2 {
        grid-template-columns: 1fr !important;
    }

    .app-header {
        padding: 8px 12px;
    }

    /* The platform stops shrinking the lockup below its 768px size, so the
       phone-size rule above is the last word. */
}

@media (max-width: 480px) {
    .app-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .header-controls {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ── Decisions (new): balance-sheet table ─────────────────────────── */
/* Slider-guide modal (reuses .modal-overlay; see slider_guide.js) */
.sg-modal {
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: 0; box-shadow: var(--shadow-lg);
    width: min(720px, 92vw); max-height: 88vh; display: flex; flex-direction: column;
    animation: modalIn 200ms ease;
}
.sg-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 22px 28px 16px; border-bottom: 1px solid var(--border); }
.sg-title { font-size: var(--fs-md); font-weight: 700; color: var(--text); }
.sg-close { background: none; border: none; font-size: var(--fs-lg); color: var(--text-muted); cursor: pointer; padding: 0 4px; line-height: 1; }
.sg-close:hover { color: var(--text); }
.sg-body { padding: 16px 28px 24px; overflow-y: auto; }
.sg-section { margin-bottom: 18px; }
.sg-row { margin-bottom: 12px; }
.sg-row-name { font-size: var(--fs-sm); font-weight: 600; color: var(--text); margin-bottom: 2px; }
.sg-row-body { font-size: var(--fs-sm); color: var(--text-secondary); line-height: 1.55; }

/* ── Room control: the teams grid ─────────────────────────────────────────
   Quiet by default, which is the whole point of the restyle. A desk that is
   inside every limit, connected and trading carries no colour at all, so the
   colour that does appear is worth walking over to look at. Threshold colour
   lands on the one cell that earned it rather than on the row. */
.data-table td.warn { color: var(--warning); }

/* The desk grid separates its body rows on the subtle rule, so the
   header's own rule still reads as the stronger line above them. The
   Debrief rankings keep the normal row lines (owner, 2026-11-16, ruling 8). */
.teams-table tbody td { border-bottom-color: var(--border-subtle); }

/* A desk in breach, in any console table: the Teams tables sort it to the
   top, and Sales & Trading's Positions and P&L table sorts it there too
   (owner, 2026-11-16, ruling 14); the tint and the bolder name are what
   make that visible. No coloured left-edge bar, no badge. */
.data-table tbody tr.is-breach td { background: rgba(248,113,113,0.10); }
[data-theme="light"] .data-table tbody tr.is-breach td { background: rgba(220,38,38,0.07); }
.data-table tbody tr.is-breach td:first-child { font-weight: 600; }

/* Connection and last trade read as words rather than figures, so they keep
   the body font and sit a step back from the numbers beside them. */
.teams-table td.team-state { color: var(--text-secondary); white-space: nowrap; }
/* Grey text in a table cell, the one class for it on every console (owner,
   2026-11-17, ruling 41). Scoped to the table, so it greys a cell whose td
   has the class as well (.data-table td sets the full ink) and takes none
   of the sizes .muted has in a header, a lever row or a card header. */
.data-table .quiet { color: var(--text-muted); }

/* The connection dot in front of a name in a table cell, and the whole
   name beside it, so a name that wraps starts its second line under its
   first word and never under the dot (owner, 2026-11-17, ruling 51; the
   Bank ALM Teams table has the same rule). .status-dot carries no display
   of its own; as a grid item it is blockified and keeps its 8px. */
.data-table .dot-name {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 6px;
    align-items: baseline;
}

/* The step of the drawdown ladder a desk stands on, under its name. The
   wording matches the desk's own sidebar so the trainer and the team read
   the same phrase for the same state. */
.teams-table .team-ladder {
    /* Inside the name's own column (console_common.js dotName), so it lines
       up under the name rather than under the dot. */
    display: block;
    font-size: var(--fs-xs);
    color: var(--warning);
}

/* Room control: what an armed lever is about to do, restated under the
   controls that set it. Inline rather than in a dialog because these are
   fired mid-sentence in front of a room, and the trainer should not have to
   look away from the screen they are presenting to read it. */
.lever-note {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: var(--warning-bg);
    color: var(--text);
    font-size: var(--fs-sm);
    line-height: 1.5;
}

/* A muted note under a field or a card heading, in the form's own type
   scale: it explains what is above it rather than competing with it. The
   Create Session form's field notes became modals (owner, 2026-10-14). */
.cr-note {
  margin: 8px 0 0;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

/* ── The scenario screens (owner, 2026-10-06) ──────────────────────────
   The New Session preview and Session Control's Scenario card. What a
   trainer needs to know is always open; the rest opens on demand. One
   type scale: 13px for every sentence, label and cell, 11px uppercase for
   a table's column headers, and a section title in the card title's
   style. A bare <p> here read at the root's 16px beside 13px tables,
   which is what made the card look like several sizes at once. */
.sc-text {
  margin: 0 0 8px;
  font-size: var(--fs-sm);
  line-height: 1.55;
  color: var(--text);
}
.sc-note {
  margin: 0 0 8px;
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: var(--text-muted);
}
.sc-title { display: block; margin: 16px 0 8px; }
/* A section that opens on demand: a native <details> whose summary reads
   as a section title, with a triangle before it. The count beside the
   title says how much is inside before it is opened. */
.sc-fold { border-top: 1px solid var(--border); }
.sc-fold > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.sc-fold > summary::-webkit-details-marker { display: none; }
.sc-fold > summary::before {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  margin: 0 1px;
  border-style: solid;
  border-width: 3.5px 0 3.5px 6px;
  border-color: transparent transparent transparent var(--text-secondary);
  transition: transform 0.15s ease;
}
.sc-fold > summary:hover::before,
.sc-fold[open] > summary::before { border-left-color: var(--color-accent); }
.sc-fold[open] > summary::before { transform: rotate(90deg); }
.sc-fold-count {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.sc-fold-body { padding: 0 0 16px; }
/* The glance area above the sections. */
.sc-glance { margin-bottom: 8px; }
/* The Create session button at both ends of the New Session form, as the
   market making sim's form has it. */
.cr-create-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}
.cr-create-bar:last-child { margin: 16px 0 0; }
/* A wrapper whose fields are cells of the grid around it (the session's
   length and path, the heavy data day fields), so a rebuilt group of
   fields lands in the grid's own columns. */
.cr-cells { display: contents; }
/* The Advanced settings grid and a field group stay hidden when the
   attribute says so: their display rules would otherwise override the
   browser's [hidden]. */
.trainer-form-grid[hidden],
.trainer-form-grid .form-group[hidden] { display: none; }
/* The preview card's header: the line that says a scenario is on its way
   (a rates session takes a few seconds to price), then the button. */
.cr-preview-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cr-preview-status {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.cr-preview-status[hidden] { display: none; }
/* A card that is one section opening on demand (the limits). */
.card > .sc-fold { border-top: none; }
.card > .sc-fold > summary { padding: 0; }
.card > .sc-fold[open] > summary { padding-bottom: 12px; }

/* ── Trainer control view ─────────────────────────────────────────────
   The live session screen. Vertical rhythm and the header layout live
   here so the template carries structure, not inline styles. */
.control-view > * + * { margin-top: 16px; }

/* One row (owner, 2026-08-23): the session it is on at the left, the
   controls that act on it at the right. This was two rows because laying
   them side by side and letting them wrap moved the buttons from one row
   to the other with the length of the session name. The bar itself now
   never wraps and the controls never shrink, so a long name wraps inside
   the title group and grows the bar's height instead of taking a row of
   its own away from the buttons. */
.control-header-bar {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 16px;
}

/* A label and the value it names, held closer together than one item is to
   the next, so the row reads as items rather than as loose words. */
.control-header-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* The running mandate, at the size of the "Mandate:" label it sits behind,
   so the two read as one item. The weight carries the value instead. */
.control-mandate {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.control-title-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  /* Takes the room the controls leave, and wraps within itself. min-width
     lets it shrink past its content instead of pushing the buttons out. */
  flex: 1 1 auto;
  min-width: 0;
}
.control-title-group h2 {
  font-size: var(--fs-lg);
  font-weight: 600;
  margin: 0;
}
/* The room code and status read as clearly as the ALM console's: a large
   tinted code badge next to the session name, not the default small chip. */
.control-title-group .badge {
  font-size: var(--fs-md);
  padding: 5px 14px;
  letter-spacing: 0.3px;
}
/* Everything in the header reads at one size (owner, 2026-08-31), the
   emphasis step the class password uses. It came in at three: the
   labels and the scenario at 13, the countdown inheriting the body and
   the code badge already at 15. The session name keeps its own step
   above them, and the buttons beside it keep the sizes their own
   component sets. */
.control-title-group,
.control-title-group .muted,
.control-title-group .control-mandate { font-size: var(--fs-md); }

.control-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  /* Wraps only if the buttons alone outgrow the window; the title group
     beside it is what gives way first. */
  flex-wrap: wrap;
  /* Never give up width to the session name: the buttons keep their size
     and the title group wraps instead. */
  flex: 0 0 auto;
  /* Hold the row height steady across states: a large primary button sets it,
     so a state without one (ended) does not shrink the bar. */
  min-height: 48px;
}

.control-pace {
  display: flex;
  align-items: center;
  gap: 8px;
}
.control-pace .muted { font-size: var(--fs-sm); }
/* The pace sits between its own label and its unit, so the figure is
   centred in the field rather than pinned to the left of it. */
.control-pace .deadline-input { width: 80px; text-align: center; }

/* A thin vertical rule between control clusters, and the horizontal
   rule between the blocks inside the injections and limits card.
   The rule sits between the border colour, which was too faint to separate
   anything, and the muted text colour, which read as a line of its own. The
   muted colour carried at under half strength lands between the two and holds
   that place in either theme. */
.control-sep {
  align-self: stretch;
  width: 1px;
  min-height: 24px;
  background: var(--text-muted);
  opacity: 0.45;
  margin: 0 4px;
}
/* Any span the JS marks class="mono" renders in the monospace
   font, with tabular numerics so digits share a width. The
   header countdown carries the class and had nothing else
   styling it (the .data-table td.mono and .form-input.mono
   rules do not reach it), so its width changed every second
   and the separator next to it shifted with it (owner report,
   2026-09-08). */
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
/* Quiet text outside a table: a placeholder, a label or a status read
   second (in a table cell, .data-table .quiet). The class had sizes only
   and no colour, so the deadline status and the header labels read in
   full ink (trainer console consistency audit, fault, ruled 2026-11-15). */
.muted { color: var(--text-muted); }
.lever-divider {
  /* The plain border colour reads too faint for a rule between features
     (owner, 2026-08-14), so it is pulled toward the muted text colour. */
  border-top: 1px solid color-mix(in srgb, var(--border) 55%, var(--text-muted));
  margin: 16px 0 12px;
}

/* ── Create session form ──────────────────────────────────────────────
   Field help shown on demand: an info toggle beside the label opens a note,
   so the mandate and scenario descriptions no longer push the two columns
   out of alignment. */
.field-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.field-label-row .form-label { margin-bottom: 0; }

/* A button whose label toggles, held to one width across both states.

   A row of right-aligned actions is laid out from the right, so a button
   that changes width moves every button to its left. The Scenario Lab's
   share toggle did exactly that: "Share with admin" is wider than "Stop
   sharing", so Open and Duplicate sat further left on an unshared row
   than on a shared one (owner, 2026-09-11).

   Both labels are rendered, stacked in one grid cell, and the one that
   does not apply is hidden. The button is then as wide as the longer of
   the two whichever it is showing, with no width written down anywhere
   to go stale when a label is reworded. */
.btn.btn-steady {
    display: inline-grid;
    grid-template-areas: "label";
    align-items: center;
    justify-items: center;
}
.btn.btn-steady > * { grid-area: label; }
.btn-steady-ghost { visibility: hidden; }

/* A form row whose controls all stand the same height, stated rather
   than left to each control's own line box.

   Matching padding does not do it. At one font size a text input, a
   select and a button build three different inner boxes: a select's is
   whatever the browser gives it, a button's is the inherited 1.5 line
   height. So the Scenario Lab's Add headline button stood taller than
   the select beside it however its padding was set (owner, 2026-09-11).

   The number is the field's own box written out: 13px of text on a 1.5
   line, .form-input's 8px of padding top and bottom, and its 1px border.
   Every control in the row is held to it, so none of them depends on
   what its line box happens to come to. A button in such a row also
   needs an empty label above it, so its top starts where the fields'
   tops start. */
.form-row-level .form-input,
.form-row-level .form-select,
.form-row-level .btn {
    height: calc(var(--fs-sm) * 1.5 + 18px);
}
.form-row-level .btn { width: 100%; }

/* A bare button wrapping a round info glyph, so it reads as a recognisable
   icon rather than a boxed letter. Every console's info button, opening the
   settings guide (owner, 2026-11-15). */
.field-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 0;
  transition: color .15s ease;
}
.field-help:hover,
.field-help[aria-expanded="true"] { color: var(--color-accent); }
.field-help svg { display: block; }

.cr-hint {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 6px;
}
/* Inside a field, the form-group's own gap owns the spacing above a note,
   and the note wraps rather than running past the card the way a .unit
   would. */
.form-group .cr-hint { margin: 0; }

.input-with-unit {
  display: flex;
  align-items: center;
  gap: 8px;
}
.input-with-unit .unit {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  white-space: nowrap;
}
/* The value in one of these fields is a short number: a limit percentage, a
   risk-band edge, a count of sim-days. The field is a flex child of a
   .form-group column, so it stretched to the full column width, which
   pushed the unit naming it far to the right and ran the risk band's second
   field off the card. Sizing the field to what it holds keeps the number
   and its unit together, and the figure is centred in the field it sits in,
   the same way the pace field on Session Control reads. */
.input-with-unit .form-input {
  flex: 0 0 auto;
  width: 90px;
  text-align: center;
}

/* ── Injections and limits card (lever forms) ─────────────────────────
   Layout lives here so the template carries structure, not inline styles. */
.lever-row {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}
.lever-row.center { align-items: center; }
.lever-row .form-group { margin: 0; }
.lever-row .toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
}
.lever-row .muted { font-size: var(--fs-sm); }
/* The class password row read at three sizes: the label at 13, the
   password inheriting the card's 15 and the button at the 11 of the
   smallest button (owner, 2026-08-31). The label and the password now
   take the emphasis step together, which is what a trainer reads out
   across the room, and the button keeps the ordinary button size beside
   them. The `.muted` selector is named inside the item because the row
   already sets that class to the default and would otherwise hold the
   label back. The header items in the page title bar are outside this
   and keep theirs. */
.lever-row .control-header-item,
.lever-row .control-header-item .muted { font-size: var(--fs-md); }
/* Its inset, not its size: at 5px of vertical padding the button was a
   28px box against the line beside it. */
#btn-class-password { padding: 3px 10px; }

/* The session code on the Hedge Fund Teams card heading (owner,
   2026-10-14). It is read out to the room with each team's join code, so
   label and code take the emphasis step, as the class password does above. */
.ctrl-session-code,
.ctrl-session-code .muted { font-size: var(--fs-md); }
.ctrl-session-code .badge { font-size: var(--fs-md); padding: 3px 10px; }

/* The New Session grid (owner, 2026-10-06): a label with an info toggle
   and one without take one height and one gap, so every field in a row
   starts on the same line. */
.cr-session-grid .form-label,
.cr-session-grid .field-label-row {
  display: flex;
  align-items: center;
  min-height: 20px;
  margin-bottom: 0;
}
.cr-session-grid .field-label-row .form-label { min-height: 0; }

/* ── Collapsible cards + capped scroll regions (MM session control) ────────
   The chevron rides the card title as a ::before, so no markup
   restructuring: the whole header is the click target, .card-collapsed
   hides everything but the header. The scroll cap keeps a long tape or a
   thirty-row participant table from stretching the page; the region
   scrolls inside itself instead. */
.card-collapsible > .card-header { cursor: pointer; user-select: none; }
.card-collapsible .card-title { display: flex; align-items: center; gap: 9px; }
.card-collapsible .card-title::before {
    content: ''; flex-shrink: 0; width: 0; height: 0;
    border-style: solid; border-width: 4px 0 4px 7px;
    border-color: transparent transparent transparent var(--text-secondary);
    transition: transform 0.15s ease;
    transform: rotate(90deg);
}
.card-collapsible.card-collapsed .card-title::before { transform: none; }
.card-collapsible > .card-header:hover .card-title::before {
    border-left-color: var(--color-accent);
}
.card-collapsible.card-collapsed > :not(.card-header) { display: none; }
/* Hiding the body is not enough to close the card: the header's own 16px
   bottom margin and the card's 20px bottom padding both survive it, so a
   collapsed card kept an empty band under its name (owner, 2026-08-24).
   Drop the card's padding and the header's margins instead of cancelling
   one with the other. Cancelling looks equivalent and is not: it asks the
   card for a content box of headerHeight - 40px, which clamps at zero for
   any header shorter than 40px, and the card then stands 42px tall behind
   a shorter header. That is why the Participants card closed cleanly (its
   header carries a button, so it clears 40px) and the shared market card
   did not. Zeroing both is height-independent. The header's bottom border
   goes too, or it would sit a pixel above the card's own. */
.card-collapsible.card-collapsed { padding: 0; }
.card-collapsible.card-collapsed > .card-header {
    margin: 0;
    border-bottom: none;
}

.control-scroll {
    max-height: 320px;
    overflow-y: auto;
}

/* A table's last column gives up its right inset so the table ends on the
   card's content edge. Inside a scroller that edge is where the scrollbar
   runs, and a right-aligned value against it reads as the two touching
   (owner, 2026-09-10, the News page). Only in here, and only on the side
   the scrollbar is on. */
.control-scroll .data-table th:last-child,
.control-scroll .data-table td:last-child { padding-right: 12px; }

/* The MM debrief ranking explains every score it prints, so its header
   names have to be read rather than scanned: the names take the default
   table size and each score column's weight reads under its name at the
   size the names used to be (owner, 2026-09-11). */
#mm-dbf-standings .data-table th {
    font-size: var(--fs-sm);
    /* Every name starts at the top of the row, so a column carrying a
       weight under its name does not push the names beside it down. */
    vertical-align: top;
}
#mm-dbf-standings .mkm-th-weight {
    display: block;
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.1em;
}

/* The MM debrief chart pair (price against position, price against P&L):
   fixed slots so the card never jumps as Plotly draws into them. */
.mm-dbf-chart {
    height: 260px;
    margin-top: 8px;
}

/* ── New Session: the condensed form (owner, 2026-08-31) ──────────────
   The page carried its space three times over. Every card padded 20px
   and then the grid inside it padded another 12, so a field sat 32px
   from the card's edge. Every field then carried a 16px bottom margin
   inside a grid that already had a 12px row gap, so two rows of fields
   stood 28px apart. Four cards of that ran the form well past the fold.

   Scoped to this page rather than to .card, because console.css is the
   only stylesheet the trainer and admin consoles load and the portfolio
   console reads the same rules. The header's negative margins track the
   padding exactly: they are what pulls the header out to the card's
   edge, and the two are one measurement written twice. */
.cs-new-session .card {
    --card-pad: 14px;
    margin-bottom: 12px;
}
.cs-new-session .card-header {
    margin-bottom: 12px;
}
/* The grid's own row gap is the spacing between fields. The margin was
   a second one on top of it. */
.cs-new-session .trainer-form-grid {
    gap: 10px;
}
.cs-new-session .trainer-form-grid .form-group {
    margin-bottom: 0;
}
/* A block that follows a field grid inside the same card: the advanced
   settings, the weights total, the notes under it. Each carried an
   inline `padding: 0 12px 12px`, which indented it past the fields above
   and left nothing between the two (owner, 2026-08-31). It takes the
   grid's own row gap above it instead, so the rows read as one grid, and
   no inset, so every label on the card starts on the same line. */
.cs-new-session .cs-under-grid {
    margin-top: 10px;
    padding: 0;
}
/* The password is the thing a trainer reads out, so it carries the
   weight and the label beside it stays quiet (owner, 2026-08-31). */
.ctrl-password { font-weight: 600; }
/* The session code, under the sign-in details a trainer reads out
   (owner, 2026-08-31). It was behind an information icon in the header,
   which showed four things to make one of them reachable. It is only
   wanted when someone is helping a trainer from outside the room, so it
   sits quietly at the foot of the card that already holds the sign-in
   details rather than on the bar above every screen. */
.ctrl-code {
    /* The far end of the row the password sits on (owner, 2026-08-31).
       It is reference, not something read out, so it takes the end and
       the quietest step. */
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--fs-xs);
    color: var(--text-muted);
}
.ctrl-code span { color: var(--text-secondary); }

/* ── Combined ranking (My Classes) ──────────────────────────────────── */

/* The foot of the sessions card: how many sessions a participant must
   have played to be ranked, and the weights total. The total reads
   through `.weights-total` above, which the create form's score weights
   already use for the same job, rather than a second rule for it. */
.mm-cmb-foot {
    display: flex;
    align-items: baseline;
    gap: 24px;
    flex-wrap: wrap;
    padding: 12px 16px;
}
.mm-cmb-foot label {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: var(--fs-sm);
    color: var(--text-secondary);
}
.mm-cmb-foot .form-input { width: 84px; }
/* A session's weight, in the column of a table rather than on a form, so
   it takes the width of the number it carries. */
.mm-cmb-weight { width: 76px; text-align: right; }
/* Where a participant finished in that one session, beside their score
   there. The score is what the total is built from, so it reads first
   and at full weight. */
.mm-cmb-rank,
.mm-cmb-played {
    color: var(--text-muted);
    font-size: var(--fs-xs);
    margin-left: 6px;
}
/* The weights' sum under the weight column: the weight box's own size and
   padding with no box drawn, so the number sits under the numbers above
   it. Red away from 100. */
.mm-cmb-sum {
    display: inline-block;
    border-color: transparent;
    background: transparent;
    font-family: var(--font-mono);
    font-weight: 600;
}
.mm-cmb-sum.negative { color: var(--negative); }
.mm-cmb-sum-row td { border-bottom: none; }
/* A session column's date, under its instrument. Sessions of a class are
   named after the class, so the instrument and the day are what tell two
   columns apart (owner, 2026-09-21). */
.mm-cmb-date {
    display: block;
    color: var(--text-muted);
    font-size: var(--fs-xs);
    font-weight: 400;
}
/* The line between the ranked participants and those who played fewer
   sessions than the minimum. */
.mm-cmb-divider td {
    color: var(--text-muted);
    font-size: var(--fs-xs);
    padding-top: 16px;
}

/* ── Hedge Fund Debrief: the Measures page (views/debrief.js) ──────────
   A result in the top or the bottom quartile of the teams is shaded with
   the theme's own positive and negative grounds and carries its marker,
   so the placement reads in greyscale too. A group's table can be wider
   than the page, so it scrolls inside its card. */
.dbf-scroll { overflow-x: auto; }
/* The Capital Markets console's Debrief (cmcontrol.js): each part a
   data-table whose header row names it, stacked in two columns with the
   grid's own gap between the parts; a number never wraps; the allocation
   record scrolls inside its column (owner, 2026-10-23: one size of text,
   even spacing, nothing wrapping onto a second line). */
.cm-dbf-col { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.cm-dbf-col .cr-hint { margin: 0; }
.cm-dbf-col .cr-hint + .cr-hint { margin-top: 6px; }
.data-table td.cm-dbf-num { white-space: nowrap; }
.cm-dbf-scroll { max-height: 320px; overflow: auto; }
/* The Debrief's scoreboard (the bond design 24.5): the ranking and the
   scorecards as sections of one table as wide as its columns, so they
   share their column edges; a gap row between the sections; the points in
   their own column, close to the value, and a note under a team's name in
   the muted small type (owner, 2026-10-30). */
.data-table.cm-dbf-grid { width: auto; }
.data-table.cm-dbf-grid th { vertical-align: bottom; }
.data-table.cm-dbf-grid tr.cm-dbf-gap td { height: 20px; padding: 0; border-bottom: 0; }
.data-table.cm-dbf-grid tr.cm-dbf-gap:hover td { background: none; }
.data-table.cm-dbf-grid td.cm-dbf-ptcell { padding-left: 4px; }
.cm-dbf-pts { color: var(--text-muted); font-size: var(--fs-xs); }
.dbf-measures td.dbf-q-top, .dbf-legend .dbf-q-top { background: var(--positive-bg); }
.dbf-measures td.dbf-q-bottom, .dbf-legend .dbf-q-bottom { background: var(--negative-bg); }
.dbf-measures .dbf-q-mark { margin-right: 4px; color: var(--text-muted); }
.dbf-measures .dbf-range { display: block; font-size: var(--fs-xs); color: var(--text-muted); }
.dbf-measures .dbf-team { cursor: pointer; color: var(--color-accent); }
.dbf-measures .dbf-team:hover { text-decoration: underline; }
.dbf-measures tr.dbf-median-row td { border-top: 1px solid var(--border); color: var(--text-muted); }
.dbf-measures tr.dbf-group td { font-weight: 600; color: var(--text-muted); padding-top: 14px; }
.dbf-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    font-size: var(--fs-sm);
    color: var(--text-muted);
    margin-bottom: 8px;
}
.dbf-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.dbf-swatch {
    display: inline-block;
    width: 16px;
    height: 12px;
    line-height: 12px;
    text-align: center;
    font-style: normal;
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

/* ── Capital markets Reference: the glossary (its trainer reference
   design 4). The bank ALM sim's Glossary as its trainer Reference renders
   it (owner, 2026-10-25: a verbatim copy): alm.css .glossary-* with the
   sizes the trainer's .ref-wrap type scale gives them (terms 15px at 600,
   definitions 15px, the count 13px), and this file's .form-input, the
   ALM's own, at the 15px that scale gives a field. The classes are
   cm-glossary-*, since this file's .glossary-* are the platform
   handbook's. */
.cm-glossary { line-height: 1.5; }
.cm-glossary > * { max-width: 760px; }
.cm-glossary-controls { margin-bottom: 16px; }
.cm-glossary-search-row { display: flex; align-items: center; gap: 12px; }
.cm-glossary-search { flex: 1; max-width: 400px; font-size: 15px; }
.cm-glossary-count { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.cm-glossary-cards { display: flex; flex-direction: column; gap: 6px; }
.cm-glossary-card { padding: 14px 0; border-bottom: 1px solid var(--border-subtle); }
.cm-glossary-card:first-child { padding-top: 0; }
.cm-glossary-card-term {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 3px;
    text-transform: none;
    letter-spacing: 0;
}
.cm-glossary-card-def { font-size: 15px; color: var(--text-secondary); line-height: 1.6; }

/* ── Capital markets Trainer Guide and Reference (.cm-alm-doc) ──────────
   The bank ALM sim's Trainer Guide as it renders (owner, 2026-10-25: only
   tried and tested layouts). Every value is alm.css's, resolved for its
   trainer page, which carries body.trainer-app, main.ts-scale and
   .ref-wrap (--ts-title 22px, --ts-card 17px, --ts-body and --ts-head
   15px): .control-title-group h2; .ref-toc and .ref-toc-link, plain and
   unnumbered (this file's numbered contents list is the hedge fund
   guide's); .ref-mechanics, its p and .ref-section; .doc-part;
   .doc-param-name and .doc-param-body p; .doc-list; and the trainer
   page's .data-table. */
.cm-alm-doc .control-title-group h2 { font-size: 22px; font-weight: 600; }
.cm-alm-doc .ref-toc {
    gap: 1px;
    padding: 0;
    counter-reset: none;
}
.cm-alm-doc .ref-toc-link {
    display: block;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.35;
    color: var(--text-secondary);
    padding: 6px 10px;
    border-radius: 6px;
    counter-increment: none;
}
.cm-alm-doc .ref-toc-link::before { content: none; }
.cm-alm-doc .ref-toc-link:hover { background: var(--bg-elevated); color: var(--text); }
.cm-alm-doc .ref-toc-link.active { background: var(--bg-elevated); color: var(--color-accent); font-weight: 600; }
.cm-alm-doc .ref-mechanics { font-size: 15px; line-height: 1.6; color: var(--text-secondary); }
.cm-alm-doc .ref-mechanics p { font-size: 15px; margin: 0 0 12px; }
.cm-alm-doc .ref-mechanics .ref-section { font-size: 17px; font-weight: 600; text-transform: none; letter-spacing: 0; }
.cm-alm-doc .doc-part { font-size: 22px; font-weight: 600; }
.cm-alm-doc .doc-param-name { font-size: 15px; font-weight: 600; text-transform: none; letter-spacing: 0; }
.cm-alm-doc .doc-param-body p { font-size: 15px; }
/* The bank ALM sim's Trainer Guide as its .ts-scale type scale renders it
   (alm.css, owner 2026-10-29: the Capital Markets guide copies it): a
   sub-heading and the part introduction at 15px; the contents list's
   part labels as the console has them, which the ALM copied. */
.cm-alm-doc .ref-mechanics .ref-subsection { font-size: 15px; font-weight: 600; text-transform: none; letter-spacing: 0; }
.cm-alm-doc .doc-part-intro { font-size: 15px; }
.cm-alm-doc .doc-list { margin: 6px 0 0; padding-left: 20px; }
.cm-alm-doc .doc-list li { color: var(--text-secondary); font-size: 15px; line-height: 1.5; margin-bottom: 5px; }
/* Every table on the page in one style, the scale's: the cells at 15px,
   the column headings at 15px semibold in the secondary colour with no
   capitals, a rule under the headings and under each row, the first
   column's text at the paragraphs' left edge (owner, 2026-10-29). */
.cm-alm-doc :is(table.data-table, table.ref-engine-constants) { font-size: 15px; margin: 8px 0 16px; }
.cm-alm-doc :is(table.data-table, table.ref-engine-constants) th {
    padding: 8px 12px;
    background: transparent;
    font-size: 15px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}
.cm-alm-doc :is(table.data-table, table.ref-engine-constants) td {
    padding: 8px 12px;
    font-size: 15px;
    font-weight: 400;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}
.cm-alm-doc :is(table.data-table, table.ref-engine-constants) tr:last-child td { border-bottom: none; }
.cm-alm-doc :is(table.data-table, table.ref-engine-constants) :is(th, td):first-child { padding-left: 0; }
.cm-alm-doc :is(table.data-table, table.ref-engine-constants) :is(th, td):last-child { padding-right: 0; }
.cm-alm-doc table.data-table tr:hover td { background: transparent; }
/* The deal switch under the page title (owner, 2026-10-29): the console's
   sub-tabs, in place of a dropdown at the far right. */
.cm-alm-doc .cm-deal-tabs { padding: 0 0 16px; }

/* The Prime Brokerage console's Debrief (pbcontrol.js, js/pb/pb_debrief.js),
   on the Capital Markets Debrief's classes above: a text column from its left
   edge, a value that mixes words and numbers may wrap, the team picked in bold,
   and a panel's name over its table where the table's header row has columns of
   its own. */
.data-table :is(th, td).cm-dbf-text { text-align: left; white-space: normal; vertical-align: top; }
.data-table td.cm-dbf-val { white-space: normal; vertical-align: top; }
.cm-dbf-own td { font-weight: 600; }
.cm-dbf-caption { padding-bottom: 6px; font-weight: 600; }
.cm-dbf-chart { height: 280px; }
