:root {
    /* OHMS palette -- navy shield, electric blue, gold lightning */
    --bg: #0a1d3a;
    --bg-tint: #0e2a4f;
    --surface: #142f56;
    --surface-2: #1d3d6d;
    --border: #2a4d7f;
    --border-strong: #3a679f;
    --text: #f0f6fb;
    --text-dim: #a3bbd6;
    --accent: #5fa9f0;
    --accent-bright: #8fc8ff;
    --brand-blue: #2b78d8;
    --brand-blue-deep: #1d4ed8;
    --brand-gold: #f5c518;
    --brand-gold-soft: #ffe27a;
    --green: #4ade80;
    --amber: #fbbf24;
    --red: #f87171;
    --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 6px 18px rgba(5, 14, 32, 0.45);
}

* {
    box-sizing: border-box;
}

html, body {
    max-width: 100vw;
    overflow-x: hidden;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    background:
        radial-gradient(1200px 600px at 80% -10%, rgba(95, 169, 240, 0.15), transparent 60%),
        radial-gradient(900px 500px at -10% 20%, rgba(245, 197, 24, 0.08), transparent 65%),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--brand-gold-soft);
    text-decoration: none;
}

a:hover {
    color: var(--brand-gold);
    text-decoration: underline;
}

a:visited {
    color: var(--brand-gold-soft);
}

/* =====================================================================
   App shell -- sidebar (desktop) + sliding drawer (mobile)
   ===================================================================== */

.app-shell {
    display: flex;
    min-height: 100vh;
    align-items: stretch;
    position: relative;
}

.side-bar {
    flex: 0 0 14rem;
    background:
        linear-gradient(180deg, #0e2a4f 0%, #0a1d3a 60%, #081a36 100%);
    border-right: 1px solid var(--border);
    padding: 1.25rem 0.75rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 1px 0 0 rgba(143, 200, 255, 0.06);
}

.side-bar::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand-gold) 0%, var(--accent) 50%, var(--brand-blue-deep) 100%);
    opacity: 0.85;
}

.side-bar-head {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.25rem 0.4rem 0.6rem;
    border-bottom: 1px solid rgba(143, 200, 255, 0.1);
}

.brand-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.brand-logo {
    width: 2.6rem;
    height: 2.6rem;
    flex: 0 0 auto;
    filter: drop-shadow(0 2px 6px rgba(245, 197, 24, 0.18));
}

.brand-name {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text);
    line-height: 1.1;
}

.brand-name .accent { color: var(--brand-gold); }

.brand-sub {
    color: var(--text-dim);
    font-size: 0.76rem;
    line-height: 1.35;
    padding-top: 0.1rem;
}

.brand-link {
    text-decoration: none;
    color: inherit;
}
.brand-link:hover .brand-name .accent { color: var(--brand-gold-soft); }

.side-nav {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.side-nav a {
    color: var(--text-dim);
    text-decoration: none;
    padding: 0.45rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    line-height: 1.2;
    border-left: 2px solid transparent;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.side-nav a:hover {
    color: var(--text);
    background: rgba(143, 200, 255, 0.07);
}

.side-nav a.active {
    color: var(--text);
    background: linear-gradient(90deg, rgba(95, 169, 240, 0.18), rgba(95, 169, 240, 0.02));
    border-left-color: var(--brand-gold);
    font-weight: 600;
}

/* Mobile-only top bar (hidden on desktop) */
.mobile-bar { display: none; }

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 2.4rem;
    height: 2.4rem;
    padding: 0.5rem;
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    cursor: pointer;
}

.nav-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.nav-toggle-bar {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

.nav-backdrop { display: none; }

.content {
    flex: 1;
    min-width: 0;
    max-width: 1100px;
    margin: 2rem auto;
    padding: 0 2rem;
}

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

    .mobile-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        padding: 0.6rem 0.9rem;
        background: linear-gradient(180deg, #0e2a4f, #0a1d3a);
        border-bottom: 1px solid var(--border);
        position: sticky;
        top: 0;
        z-index: 30;
        box-shadow: 0 2px 8px rgba(5, 14, 32, 0.5);
    }
    .mobile-bar::before {
        content: "";
        position: absolute;
        inset: auto 0 0 0;
        height: 2px;
        background: linear-gradient(90deg, var(--brand-gold), var(--accent), var(--brand-blue-deep));
    }
    .mobile-bar-brand {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        min-width: 0;
    }
    .mobile-bar .brand-logo { width: 2.1rem; height: 2.1rem; }
    .mobile-bar .brand-name { font-size: 0.95rem; }
    .mobile-bar .nav-toggle { display: flex; }

    .side-bar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 16rem;
        max-width: 84vw;
        flex: none;
        z-index: 50;
        transform: translateX(-105%);
        transition: transform 0.22s ease;
        border-right: 1px solid var(--border);
        box-shadow: 8px 0 24px rgba(0, 0, 0, 0.4);
    }
    .app-shell.nav-open .side-bar { transform: translateX(0); }

    .nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(5, 14, 32, 0.55);
        backdrop-filter: blur(2px);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.22s ease;
        z-index: 40;
    }
    .app-shell.nav-open .nav-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .side-nav a {
        padding: 0.7rem 0.85rem;
        font-size: 1rem;
    }

    .app-shell.nav-open .nav-toggle-bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
    .app-shell.nav-open .nav-toggle-bar:nth-child(2) { opacity: 0; }
    .app-shell.nav-open .nav-toggle-bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

    .content {
        max-width: 100%;
        padding: 0 1.25rem;
    }
}

@media (max-width: 700px) {
    .content {
        margin: 1rem auto;
        padding: 0 0.85rem;
    }
}

/* =====================================================================
   Cards
   ===================================================================== */

.card,
.placeholder-card {
    background: linear-gradient(160deg, var(--surface), #102746 80%);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-card);
}

.card h3,
.placeholder-card h3 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card p,
.placeholder-card p {
    margin: 0 0 0.4rem 0;
}

.card-head {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}
.card-head h3 { margin: 0; }

.warning-card { border-color: var(--amber); }
.warning-card h3 { color: var(--amber); }

.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 1rem;
}
.dash-grid .card { margin: 0; }

/* =====================================================================
   Hero strip + coach-line
   ===================================================================== */

.hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    background:
        radial-gradient(600px 300px at 100% 0%, rgba(245, 197, 24, 0.18), transparent 60%),
        linear-gradient(135deg, #1d3d6d 0%, #142f56 55%, #0a1d3a 100%);
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    padding: 2rem 2.5rem;
    margin-bottom: 1.25rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(5, 14, 32, 0.55);
}
.hero::before {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand-gold), var(--accent), var(--brand-blue-deep));
}
.hero-eyebrow {
    margin: 0 0 0.4rem 0;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--brand-gold-soft);
}
.hero-num {
    font-size: 4rem;
    font-weight: 800;
    background: linear-gradient(180deg, #ffffff 0%, var(--accent-bright) 70%, var(--accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: -0.02em;
}
.hero-label {
    font-size: 1.1rem;
    color: var(--text-dim);
    margin-left: 0.4rem;
}

@media (max-width: 700px) {
    .hero {
        grid-template-columns: 1fr;
        padding: 1.25rem 1.5rem;
    }
    .hero-num { font-size: 3rem; }
}

.coach-line {
    margin: 0 0 1.25rem 0;
    padding: 0.9rem 1.25rem;
    border-left: 3px solid var(--brand-gold);
    background: linear-gradient(90deg, rgba(245, 197, 24, 0.08), rgba(95, 169, 240, 0.05) 50%, transparent);
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: var(--text);
    box-shadow: var(--shadow-card);
}

/* =====================================================================
   Typography utilities
   ===================================================================== */

.big-number {
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.1;
}

.unit-label,
.unit {
    font-size: 0.9rem;
    color: var(--text-dim);
    font-weight: 400;
    margin-left: 0.3rem;
}

.dim { color: var(--text-dim); }
.small { font-size: 0.82rem; }

.band-green   { color: var(--green); font-weight: 600; }
.band-amber   { color: var(--amber); font-weight: 600; }
.band-red     { color: var(--red);   font-weight: 600; }
.band-unknown { color: var(--text-dim); }

dl.kv {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.4rem 1rem;
    margin: 0;
}
dl.kv dt { color: var(--text-dim); font-size: 0.9rem; }
dl.kv dd { margin: 0; font-variant-numeric: tabular-nums; }

/* =====================================================================
   Tables
   ===================================================================== */

table.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

table.data-table th,
table.data-table td {
    padding: 0.6rem 0.9rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

table.data-table th {
    color: var(--text-dim);
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg);
}

table.data-table tr:last-child td { border-bottom: none; }

table.data-table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

table.data-table.compact th,
table.data-table.compact td {
    padding: 0.35rem 0.7rem;
    font-size: 0.85rem;
}

table.data-table tr.clickable {
    cursor: pointer;
    transition: background 0.12s ease;
}
table.data-table tr.clickable:hover td {
    background: rgba(95, 169, 240, 0.09);
}

tr.row-primary td {
    background: rgba(245, 197, 24, 0.10);
    box-shadow: inset 3px 0 0 var(--brand-gold);
}

/* =====================================================================
   Forms + buttons
   ===================================================================== */

.event-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.event-form .form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.event-form label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    color: var(--text-dim);
    font-size: 0.85rem;
    flex: 1;
    min-width: 12rem;
}
.event-form label.full { flex-basis: 100%; }
.event-form label.checkbox {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}
.event-form input[type="text"],
.event-form input[type="number"],
.event-form input[type="date"],
.event-form input[type="search"],
.event-form input[type="datetime-local"],
.event-form input:not([type]),
.event-form textarea,
.event-form select {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
    font-size: 0.95rem;
    font-family: inherit;
}
.event-form .form-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}
.event-form .form-error {
    color: var(--red);
    margin: 0;
}

button.btn-primary {
    background: linear-gradient(180deg, var(--accent-bright), var(--brand-blue));
    color: #0a1d3a;
    border: 1px solid var(--accent);
    padding: 0.45rem 1.1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(43, 120, 216, 0.35);
    transition: transform 0.12s ease, box-shadow 0.15s ease;
}
button.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(43, 120, 216, 0.45);
}
button.btn-primary:disabled {
    opacity: 0.5;
    cursor: wait;
}

button.btn-link {
    background: none;
    color: var(--accent);
    border: none;
    padding: 0.2rem 0.4rem;
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: underline;
}

button.btn-danger {
    background: var(--red);
    color: white;
    border: none;
    padding: 0.3rem 0.7rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}
button.btn-danger:disabled {
    opacity: 0.5;
    cursor: wait;
}

button.btn-link-danger {
    background: none;
    color: var(--red);
    border: none;
    padding: 0.2rem 0.4rem;
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: underline;
}
button.btn-link-danger:disabled {
    opacity: 0.5;
    cursor: wait;
}

/* Segmented toggle (e.g. window picker) */
.window-toggle {
    display: inline-flex;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(143, 200, 255, 0.04);
}
.window-toggle button {
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 0.4rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    border-right: 1px solid var(--border);
}
.window-toggle button:last-child { border-right: none; }
.window-toggle button:hover:not(:disabled):not(.active) {
    color: var(--text);
    background: rgba(143, 200, 255, 0.08);
}
.window-toggle button.active {
    color: var(--text);
    background: linear-gradient(180deg, var(--brand-blue), var(--brand-blue-deep));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.window-toggle button:disabled {
    cursor: wait;
    opacity: 0.6;
}

/* Range pills (e.g. 30d / 90d / 1y / all) */
.range-picker {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}
.range-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-dim);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.78rem;
    padding: 0.3rem 0.7rem;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    min-height: 44px;
    min-width: 60px;
}
.range-btn:hover {
    border-color: var(--accent);
    color: var(--text);
}
.range-btn.active,
.range-btn-active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
    font-weight: 600;
}

/* =====================================================================
   AI / narrative styling
   ===================================================================== */

.ai-meta {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin: 0 0 0.6rem 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.8rem;
    align-items: baseline;
}
.ai-meta .badge {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--accent);
    border-radius: 999px;
    padding: 0.05rem 0.55rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ai-markdown p {
    margin: 0 0 0.7rem 0;
    line-height: 1.5;
}
.ai-markdown p:last-child { margin-bottom: 0; }
.ai-markdown strong { color: var(--text); }
.ai-markdown em { color: var(--text-dim); font-style: italic; }

/* =====================================================================
   Generic SVG charts
   ===================================================================== */

svg.chart,
svg.heatmap,
svg.scatter,
svg.donut {
    display: block;
    height: auto;
    margin-top: 0.5rem;
    max-width: 100%;
    width: 100%;
}

.chart-grid       { stroke: var(--border); stroke-width: 1; }
.chart-grid-faint { stroke: var(--border); stroke-width: 1; opacity: 0.5; }

.chart-label {
    fill: var(--text-dim);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    font-size: 10px;
    text-anchor: middle;
}
.chart-label-r { text-anchor: end; }

/* Multi-series legend colours */
.legend-stroke-0 { stroke: #5fa9f0; }
.legend-stroke-1 { stroke: #f5c518; }
.legend-stroke-2 { stroke: #4ade80; }
.legend-stroke-3 { stroke: #f87171; }
.legend-fill-0   { fill: #5fa9f0; }
.legend-fill-1   { fill: #f5c518; }
.legend-fill-2   { fill: #4ade80; }
.legend-fill-3   { fill: #f87171; }

.legend-row {
    color: var(--text-dim);
    display: flex;
    flex-wrap: wrap;
    font-size: 0.8rem;
    gap: 1rem;
    margin-top: 0.5rem;
}
.legend-key {
    align-items: center;
    display: inline-flex;
    gap: 0.35rem;
}
.legend-key .dot {
    border-radius: 50%;
    height: 9px;
    width: 9px;
}
.legend-key .dot.legend-color-0 { background: #5fa9f0; }
.legend-key .dot.legend-color-1 { background: #f5c518; }
.legend-key .dot.legend-color-2 { background: #4ade80; }
.legend-key .dot.legend-color-3 { background: #f87171; }

/* =====================================================================
   Page head with back link
   ===================================================================== */

.page-head {
    align-items: baseline;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-top: 0;
}
.page-head h2 { margin-bottom: 0; }

.back-link {
    color: var(--text-dim);
    font-size: 0.85rem;
    text-decoration: none;
    white-space: nowrap;
}
.back-link:hover { color: var(--accent); }

/* =====================================================================
   Blazor error surface
   ===================================================================== */

#blazor-error-ui {
    background: var(--red);
    color: white;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* =====================================================================
   Bourse-specific extensions
   Anything below this point is Bourse-only and may diverge per app.
   ===================================================================== */

/* Headings + paragraphs inside .content default to the OHMS palette. */
.content h1,
.content h2,
.content h3,
.content h4 {
    color: var(--text);
}
.content h1 {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    margin: 0 0 0.75rem 0;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.content h2 {
    font-size: clamp(1.2rem, 3vw, 1.6rem);
    margin: 1.25rem 0 0.5rem 0;
}

.content p { line-height: 1.5; }

/* Profile-switcher embedded in MainLayout. Keeps the testids the E2E
   tests look for: profile-switcher-toggle / -menu / -item-{guid}. */
.profile-switcher-strip {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}
.profile-switcher { position: relative; }
.profile-switcher .switcher-toggle {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font: inherit;
    font-weight: 600;
    background: rgba(143, 200, 255, 0.07);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    padding: 0 1rem;
    height: 44px;
    min-width: 44px;
    cursor: pointer;
    user-select: none;
}
.profile-switcher .switcher-toggle::-webkit-details-marker { display: none; }
.profile-switcher .switcher-toggle:hover { background: rgba(143, 200, 255, 0.14); }
.profile-switcher .switcher-toggle .caret { color: var(--brand-gold); }
.profile-switcher .switcher-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    list-style: none;
    margin: 0;
    padding: 0.5rem 0;
    min-width: 200px;
    z-index: 10;
}
.profile-switcher .switcher-menu li a {
    display: block;
    padding: 0.75rem 1rem;
    min-height: 44px;
    color: var(--text);
    text-decoration: none;
}
.profile-switcher .switcher-menu li a:hover {
    background: rgba(143, 200, 255, 0.1);
    color: var(--brand-gold-soft);
}

/* Profile picker tiles (Index.razor). */
.profile-picker {
    padding: 0.5rem 0 1rem;
}
.tile-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 1024px) {
    .tile-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    min-height: 240px;
    background: linear-gradient(160deg, var(--surface), #102746 80%);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    cursor: pointer;
    transition: transform 80ms ease-out, box-shadow 80ms ease-out, border-color 80ms ease-out;
    box-shadow: var(--shadow-card);
}
.tile:hover {
    transform: translateY(-2px);
    border-color: var(--brand-gold);
    box-shadow: 0 12px 28px rgba(5, 14, 32, 0.6);
    text-decoration: none;
    color: var(--text);
}
.tile .avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    font-size: 1.75rem;
    font-weight: 700;
    color: #0a1d3a;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.tile .name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
}
.tile .value {
    font-size: 1.125rem;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}
.tile .changes {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-dim);
}
.pct-up   { color: var(--green); font-weight: 600; }
.pct-down { color: var(--red);   font-weight: 600; }
.pct-flat { color: var(--text-dim); }

/* Status pills + side colour helpers reused across order pages. */
.status-badge {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    background: rgba(251, 191, 36, 0.18);
    color: var(--amber);
    border: 1px solid rgba(251, 191, 36, 0.4);
}
.status-badge.filled {
    background: rgba(74, 222, 128, 0.15);
    color: var(--green);
    border-color: rgba(74, 222, 128, 0.4);
}
.side-buy  { color: var(--green); font-weight: 600; }
.side-sell { color: var(--red);   font-weight: 600; }

/* Action button row reused on TradeTicket / ManualEntry. */
.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Inline messages */
.inline-error {
    background: rgba(248, 113, 113, 0.12);
    border-left: 3px solid var(--red);
    padding: 0.6rem 0.9rem;
    border-radius: 0 6px 6px 0;
    color: var(--red);
    margin: 0.75rem 0;
}
.inline-success {
    background: rgba(74, 222, 128, 0.10);
    border-left: 3px solid var(--green);
    padding: 0.6rem 0.9rem;
    border-radius: 0 6px 6px 0;
    color: var(--green);
    margin: 0.75rem 0;
}

/* Banners (Watching, PostMortem, Trade-in-Progress) share a base. */
.bourse-banner {
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
    padding: 0.75rem 1rem;
    margin: 0 0 1rem 0;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: linear-gradient(135deg, var(--surface), #0e2444 70%);
    color: var(--text);
    box-shadow: var(--shadow-card);
}
.bourse-banner .banner-badge {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(143, 200, 255, 0.12);
    font-size: 1.1rem;
}
.bourse-banner .copy { flex: 1; min-width: 0; }
.bourse-banner .copy p { margin: 0 0 0.4rem; }
.bourse-banner a { color: var(--brand-gold-soft); }
.bourse-banner a.btn-primary { display: inline-flex; align-items: center; min-height: 44px; color: #0a1d3a; }

.banner-watching {
    border-color: var(--accent);
    background: linear-gradient(135deg, #18356c, #0e2444 80%);
}
.banner-watching .banner-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 10px rgba(95, 169, 240, 0.7);
    margin-top: 0.4rem;
    flex: 0 0 auto;
}
.banner-watching.scope-apprentice { border-color: #b07aa1; }
.banner-watching.scope-admin       { border-color: var(--red); }
.banner-watching .readonly-pill {
    background: rgba(255, 255, 255, 0.12);
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text);
}
.banner-watching .scope { color: var(--text-dim); font-size: 0.8rem; }

.banner-postmortem { border-color: var(--brand-gold); }
.banner-postmortem .banner-badge { background: rgba(245, 197, 24, 0.18); color: var(--brand-gold); }
.banner-trade      { border-color: var(--accent); }
.banner-trade .banner-badge { background: rgba(95, 169, 240, 0.18); color: var(--accent); }

.banner-apprentice-notice {
    background: rgba(245, 197, 24, 0.08);
    border-left: 3px solid var(--brand-gold);
    padding: 0.55rem 0.9rem;
    margin: 0 0 1rem 0;
    border-radius: 0 6px 6px 0;
    color: var(--brand-gold-soft);
    font-size: 0.85rem;
}

/* PnL helpers used across Holdings + Journal. */
.pnl-up   { color: var(--green); font-weight: 600; }
.pnl-down { color: var(--red);   font-weight: 600; }
.pnl-flat { color: var(--text-dim); }

/* Sort buttons inside .data-table headers. */
table.data-table th button {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    text-transform: inherit;
    letter-spacing: inherit;
}
table.data-table th button.sort-asc::after  { content: " \25B2"; font-size: 0.75em; }
table.data-table th button.sort-desc::after { content: " \25BC"; font-size: 0.75em; }

/* Hide low-priority columns on iPad portrait. */
@media (max-width: 1023px) {
    .hide-portrait { display: none; }
}

/* Compact leaderboard ranking used inside the Dashboard "Where you stand"
   tile. The full leaderboard table lives on /leaderboard. */
.leaderboard-mini {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.3rem;
}
.leaderboard-mini li {
    display: grid;
    grid-template-columns: 2rem 1fr auto;
    align-items: baseline;
    gap: 0.6rem;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    font-variant-numeric: tabular-nums;
}
.leaderboard-mini li.is-self {
    background: rgba(245, 197, 24, 0.10);
    box-shadow: inset 3px 0 0 var(--brand-gold);
}
.leaderboard-mini .rank { color: var(--text-dim); font-weight: 600; }
.leaderboard-mini .name { color: var(--text); }

/* Dashboard card head — title on the left, "See more →" link on the right. */
.card-head a.muted-link { white-space: nowrap; }

/* BOURSE-035 — alerts banner shown above the Dashboard hero when the
   alert evaluator has emitted unread Notification rows for the viewing
   user. Severity drives the left-border colour. */
.alerts-banner {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.9rem 1.1rem;
    margin: 0 0 1.1rem;
    box-shadow: var(--shadow-card);
}
.alerts-banner-title {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.alerts-banner-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.6rem;
}
.alerts-banner-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.55rem 0.7rem;
    border-radius: 6px;
    background: rgba(95, 169, 240, 0.06);
    border-left: 3px solid var(--accent);
}
.alerts-banner-item.severity-important {
    background: rgba(251, 191, 36, 0.10);
    border-left-color: var(--amber);
}
.alerts-banner-item.severity-critical {
    background: rgba(248, 113, 113, 0.10);
    border-left-color: var(--red);
}
.alerts-banner-item-body { flex: 1; }
.alerts-banner-item-body strong { display: block; color: var(--text); }
.alerts-banner-item-body p { margin: 0.2rem 0 0; line-height: 1.4; }
.alerts-banner-item button {
    background: none; border: 0; padding: 0; cursor: pointer;
}

/* Journal entry list. */
.journal-entries { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.75rem; }
.journal-entries li.card { border-left: 3px solid var(--border-strong); }
.journal-entries li.card.is-open  { border-left-color: var(--brand-gold); }
.journal-entries li.card.is-closed{ border-left-color: var(--accent); }
.journal-entries .entry-header {
    display: flex; gap: 0.5rem; align-items: baseline;
    flex-wrap: wrap; margin-bottom: 0.4rem;
}
.journal-entries .ticker { font-weight: 700; font-size: 1.05rem; color: var(--text); }
.journal-entries .action { padding: 0 0.4rem; border-radius: 4px; font-size: 0.78rem; font-weight: 600; }
.journal-entries .action.buy  { background: rgba(74, 222, 128, 0.18); color: var(--green); }
.journal-entries .action.sell { background: rgba(248, 113, 113, 0.18); color: var(--red); }
.journal-entries .status { font-size: 0.85rem; color: var(--text-dim); }
.journal-entries time { margin-left: auto; font-size: 0.85rem; color: var(--text-dim); }
.journal-entries .summary { margin: 0 0 0.4rem; line-height: 1.45; }
.journal-entries .ai-marker { font-size: 0.85rem; color: var(--text-dim); margin: 0 0 0.4rem; }
.journal-entries .outcome {
    font-size: 0.92rem;
    padding: 0.5rem 0.7rem;
    border-radius: 4px;
    margin-bottom: 0.4rem;
    border: 1px solid var(--border);
}
.journal-entries .outcome.win     { background: rgba(74, 222, 128, 0.10); border-color: rgba(74, 222, 128, 0.35); }
.journal-entries .outcome.loss    { background: rgba(248, 113, 113, 0.10); border-color: rgba(248, 113, 113, 0.35); }
.journal-entries .outcome.unknown { background: rgba(143, 200, 255, 0.05); }
.journal-entries .lesson { color: var(--text-dim); }
.journal-entries .tags { list-style: none; padding: 0; margin: 0; display: flex; gap: 0.4rem; flex-wrap: wrap; }
.journal-entries .tags li {
    font-size: 0.78rem;
    color: var(--accent);
    background: rgba(95, 169, 240, 0.10);
    border: 1px solid rgba(95, 169, 240, 0.25);
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
}

.pagination {
    display: flex; gap: 1rem; align-items: center;
    justify-content: center; margin-top: 1.5rem;
}
.pagination a {
    text-decoration: none;
    padding: 0.55rem 0.9rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: rgba(143, 200, 255, 0.04);
    color: var(--text);
    min-height: 44px;
    display: inline-flex; align-items: center;
}
.pagination a:hover { border-color: var(--accent); color: var(--brand-gold-soft); }
.pagination a.disabled { color: var(--text-dim); pointer-events: none; border-color: var(--border); opacity: 0.5; }

/* Pass1 review panel. */
.pass1-panel {
    background: linear-gradient(160deg, var(--surface), #102746 80%);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    color: var(--text);
    box-shadow: var(--shadow-card);
}
.pass1-panel.persona-apprentice {
    background:
        radial-gradient(500px 200px at 100% 0%, rgba(245, 197, 24, 0.15), transparent 60%),
        linear-gradient(160deg, var(--surface), #102746 80%);
    border-color: var(--brand-gold);
}
.pass1-empty {
    color: var(--text-dim);
    text-align: center;
    padding: 2rem;
}
.pass1-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}
.pass1-title { font-size: 1.1rem; margin: 0; font-weight: 700; color: var(--text); }
.pass1-confidence { display: flex; gap: 4px; align-items: center; }
.pass1-confidence .dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--border-strong);
}
.pass1-confidence .dot.filled { background: var(--accent); }
.pass1-section { margin: 0.75rem 0; }
.pass1-section h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    margin: 0 0 0.5rem 0;
}
.pass1-section ul { margin: 0; padding-left: 1.25rem; line-height: 1.45; }
.pass1-section li { margin-bottom: 0.35rem; }
.bias-badges { display: flex; flex-direction: column; gap: 0.5rem; }
.bias-row { display: flex; flex-direction: column; gap: 0.25rem; }
.bias-badge {
    align-self: flex-start;
    min-height: 44px;
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--accent);
    border-radius: 999px;
    background: rgba(95, 169, 240, 0.15);
    color: var(--text);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
}
.bias-badge.bias-fomo,
.bias-badge.bias-recency,
.bias-badge.bias-overconfidence {
    background: rgba(248, 113, 113, 0.18);
    border-color: var(--red);
    color: var(--text);
}
.bias-badge.bias-anchoring,
.bias-badge.bias-endowment {
    background: rgba(245, 197, 24, 0.18);
    border-color: var(--brand-gold);
    color: var(--text);
}
.bias-badge.bias-sunkcost,
.bias-badge.bias-lossaversion,
.bias-badge.bias-confirmation {
    background: rgba(176, 122, 161, 0.18);
    border-color: #b07aa1;
    color: var(--text);
}
.bias-explanation {
    margin: 0.25rem 0 0 0;
    padding: 0.6rem 0.9rem;
    background: rgba(143, 200, 255, 0.07);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--text);
}
.pass1-footer {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}
.pass2-button {
    min-height: 44px;
    padding: 0.5rem 1.25rem;
    background: rgba(143, 200, 255, 0.07);
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: not-allowed;
    font-weight: 600;
}
.pass2-hint {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-dim);
}
.pass1-meta {
    margin-top: 0.75rem;
    color: var(--text-dim);
    font-size: 0.75rem;
}
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
}

/* Argue-both-sides panel. */
.abs-empty {
    padding: 1.25rem;
    color: var(--text-dim);
    text-align: center;
    font-style: italic;
}
.abs-panel {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    background: linear-gradient(160deg, var(--surface), #102746 80%);
    color: var(--text);
    box-shadow: var(--shadow-card);
}
.abs-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 768px) {
    .abs-grid { grid-template-columns: 1fr 1fr; }
}
.abs-case { padding: 0.75rem 1rem; border-radius: 8px; border: 1px solid var(--border); }
.abs-bull { background: rgba(74, 222, 128, 0.08); border-left: 3px solid var(--green); }
.abs-bear { background: rgba(248, 113, 113, 0.08); border-left: 3px solid var(--red); }
.abs-case h4 { margin: 0 0 0.5rem 0; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); }
.abs-case p  { margin: 0 0 0.5rem 0; line-height: 1.5; color: var(--text); }
.abs-case details summary {
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
    display: flex;
    align-items: center;
    color: var(--accent);
}
.abs-case details ul { color: var(--text); padding-left: 1.25rem; }
.abs-meta { margin-top: 0.5rem; color: var(--text-dim); font-size: 0.8rem; }

/* Glossary tooltip. */
.glossary-term {
    text-decoration: underline dotted;
    text-decoration-color: var(--brand-gold);
    text-underline-offset: 3px;
    cursor: help;
    position: relative;
    color: inherit;
}
.glossary-tooltip {
    position: absolute;
    bottom: 100%;
    left: 0;
    min-width: 220px;
    max-width: 320px;
    background: #081a36;
    color: var(--text);
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-strong);
    font-size: 0.85rem;
    line-height: 1.4;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55);
}
.glossary-tooltip strong { font-size: 0.9rem; color: var(--brand-gold-soft); }
.glossary-defn { display: block; }
.glossary-tell-more {
    align-self: flex-start;
    min-height: 32px;
    padding: 0.25rem 0.6rem;
    background: rgba(95, 169, 240, 0.18);
    color: var(--text);
    border: 1px solid var(--accent);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

/* Price-chart wrapper (Lightweight Charts inserts canvas into the
   container; we override its inherited dark text colour so axes read
   on the navy backdrop). */
.price-chart-wrapper {
    margin-bottom: 1.5rem;
    background: rgba(143, 200, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.5rem;
}
.price-chart-empty {
    margin-top: -2rem;
    text-align: center;
    color: var(--text-dim);
    font-style: italic;
}

/* Donut empty state. */
.donut-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--border);
    border-radius: 50%;
    color: var(--text-dim);
    font-size: 0.85rem;
}

/* Misc helpers. */
.muted-link {
    color: var(--text-dim);
    font-size: 0.85rem;
    text-decoration: none;
}
.muted-link:hover { color: var(--brand-gold-soft); text-decoration: underline; }

.reconnect-modal-dialog {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
}
.reconnect-modal-dialog::backdrop {
    background: rgba(5, 14, 32, 0.7);
    backdrop-filter: blur(2px);
}

/* BOURSE-039 — top-bar system-health badge. Admin-only (the underlying
   client returns Forbidden for non-admin callers, which yields no render).
   Green/amber/red dots map to the per-subsystem severity rollup. */
.health-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    line-height: 1.1;
}
.health-badge:hover { border-color: var(--border-strong); }
.health-badge .health-dot {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 50%;
    background: #16a34a;
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.18);
}
.health-badge.severity-green .health-dot {
    background: #16a34a;
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.18);
}
.health-badge.severity-amber .health-dot {
    background: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.22);
}
.health-badge.severity-red .health-dot {
    background: #dc2626;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.24);
}
.health-badge .health-label {
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Side-bar copy of the badge sits below the brand block. */
.side-bar-head .health-badge {
    align-self: flex-start;
    margin-top: 0.6rem;
}
@media (max-width: 800px) {
    /* On the mobile bar the badge sits to the right of the brand, before
       the hamburger toggle. Hide the text label and keep only the dot to
       avoid crowding on narrow phones. */
    .mobile-bar .health-badge {
        margin-left: auto;
        padding: 0.15rem 0.4rem;
    }
    .mobile-bar .health-badge .health-label {
        display: none;
    }
}
