/* ============================================================================
   Momentum Pullback - design system (Fresh Mint, Inter, mobile-first cards).
   Tokens are derived 1:1 from ledger ui.styleGuide.tokens / specs/style-guide.md and
   the mockup design-system block. DARK is the default theme (A-026); light is the
   mockups exactly. Components use tokens only - never hard-coded colours.
   ========================================================================= */

/* ---------- 1. Tokens (light) ---------- */
:root {
    color-scheme: light;

    --primary: #10b981;
    --primary-dark: #059669;
    --primary-light: #a7f3d0;
    --primary-ink: #ffffff;
    /* qa-review (a11y): white on the brand mint #10b981 is only 2.5:1. Anything that puts WHITE TEXT on the brand colour, or brand-coloured TEXT on a light surface,
       uses the -strong pair (white 5.5:1 / 7.7:1 hover); the brand mint itself stays for borders, fills, progress and the dark theme. */
    --primary-strong: #047857;
    --primary-strong-hover: #065f46;
    --danger-strong: #dc2626;
    --danger-strong-hover: #b91c1c;
    --danger-ink: #b91c1c;
    --success-ink: #047857;
    --mint-tint: #f0fdfa;

    --neutral-900: #1e293b;
    --neutral-700: #475569;
    --neutral-500: #94a3b8;
    --neutral-200: #e2e8f0;
    --neutral-100: #f1f5f9;
    --neutral-50: #f8fafc;

    --success: #10b981;
    --warn: #f59e0b;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --info: #3b82f6;
    --accent: #3b82f6;
    --cream: #fef9c3;

    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-alt: #f1f5f9;
    --ink: #1e293b;
    --ink-soft: #475569;
    --ink-mute: #5b6b82;      /* was #94a3b8 (2.6:1 on white); 5.4:1 on white, 4.9:1 on the grey surface */
    --line: #e2e8f0;

    --badge-success-bg: #a7f3d0;
    --badge-success-ink: #065f46;
    --badge-warn-bg: #fef9c3;
    --badge-warn-ink: #92400e;
    --badge-danger-bg: #fee2e2;
    --badge-danger-ink: #991b1b;
    --badge-info-bg: #dbeafe;
    --badge-info-ink: #1e40af;
    --badge-neutral-bg: #f1f5f9;
    --badge-neutral-ink: #475569;

    --danger-surface: #fef2f2;
    --live-card-border: #fecaca;
    --input-disabled-border: #d1d5db;
    --input-disabled-bg: #e2e8f0;

    /* Mode identity (A-027): Paper = blue, Live = red. Never ambiguous. */
    --mode-paper-bg: #dbeafe;
    --mode-paper-ink: #1e40af;
    --mode-live-bg: #ef4444;
    --mode-live-ink: #ffffff;

    --banner-ok-bg: #a7f3d0;
    --banner-ok-line: #10b981;
    --banner-ok-ink: #065f46;
    --banner-warn-bg: #fef9c3;
    --banner-warn-line: #f59e0b;
    --banner-warn-ink: #92400e;
    --banner-danger-bg: #fef2f2;
    --banner-danger-line: #ef4444;
    --banner-danger-ink: #991b1b;

    --signin-bg: #0f172a;
    --signin-muted: #64748b;
    --overlay: rgba(30, 41, 59, 0.7);

    --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-code: "Courier New", Monaco, monospace;

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 1rem;
    --space-4: 1.5rem;
    --space-5: 2rem;
    --space-6: 3rem;
    --space-7: 4rem;

    --radius-none: 0;
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius: 0.75rem;
    --radius-lg: 1rem;
    --radius-full: 9999px;

    --elev-1: 0 1px 2px rgba(30, 41, 59, 0.05);
    --elev-2: 0 4px 6px rgba(30, 41, 59, 0.1);
    --elev-3: 0 10px 15px rgba(30, 41, 59, 0.15);
    --elev-4: 0 20px 25px rgba(30, 41, 59, 0.2);

    --focus-ring: #10b981;
    --touch-min: 44px;
    --topbar-h: 64px;
    --tabbar-h: 64px;
    --content-max: 720px;     /* single-column screens centre a ~720px column on desktop */
    --content-wide: 960px;    /* Reports / Journal / Watchlist */
    --card-max: 600px;
}

/* ---------- 1b. Tokens (dark, default) ---------- */
html[data-theme="dark"] {
    color-scheme: dark;

    --bg: #0f172a;
    --surface: #1e293b;
    --surface-alt: #334155;
    --ink: #f8fafc;
    --ink-soft: #cbd5e1;
    --ink-mute: #94a3b8;
    --line: #334155;
    --mint-tint: rgba(16, 185, 129, 0.14);

    --badge-success-bg: rgba(16, 185, 129, 0.22);
    --badge-success-ink: #a7f3d0;
    --badge-warn-bg: rgba(245, 158, 11, 0.22);
    --badge-warn-ink: #fde68a;
    --badge-danger-bg: rgba(239, 68, 68, 0.22);
    --badge-danger-ink: #fecaca;
    --badge-info-bg: rgba(59, 130, 246, 0.24);
    --badge-info-ink: #bfdbfe;
    --badge-neutral-bg: #334155;
    --badge-neutral-ink: #cbd5e1;

    --danger-surface: rgba(239, 68, 68, 0.12);
    --live-card-border: #7f1d1d;
    --input-disabled-border: #475569;
    --input-disabled-bg: #1e293b;

    --mode-paper-bg: #1e40af;
    --mode-paper-ink: #dbeafe;

    --banner-ok-bg: rgba(16, 185, 129, 0.16);
    --banner-ok-ink: #a7f3d0;
    --banner-warn-bg: rgba(245, 158, 11, 0.16);
    --banner-warn-ink: #fde68a;
    --banner-danger-bg: rgba(239, 68, 68, 0.16);
    --banner-danger-ink: #fecaca;

    --overlay: rgba(2, 6, 23, 0.75);
    --elev-1: 0 1px 2px rgba(0, 0, 0, 0.35);
    --elev-2: 0 4px 6px rgba(0, 0, 0, 0.4);
    --elev-3: 0 10px 15px rgba(0, 0, 0, 0.45);
    --elev-4: 0 20px 25px rgba(0, 0, 0, 0.5);
    --focus-ring: #a7f3d0;
    --danger-ink: #f87171;
    --success-ink: #10b981;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }

body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1, .h1 { font-family: var(--font-heading); font-size: 2rem; line-height: 1.2; font-weight: 700; margin: 0 0 var(--space-3); }
h2, .h2 { font-family: var(--font-heading); font-size: 1.5rem; line-height: 1.3; font-weight: 600; margin: 0 0 var(--space-2); }
h3, .h3 { font-family: var(--font-heading); font-size: 1.25rem; line-height: 1.4; font-weight: 600; margin: 0 0 var(--space-2); }
.body-lg { font-size: 1.0625rem; line-height: 1.5; font-weight: 400; }
p, .body { font-size: 1rem; line-height: 1.5; font-weight: 400; margin: 0 0 var(--space-2); }
.small, .body-sm { font-size: 0.875rem; line-height: 1.5; font-weight: 400; color: var(--ink-soft); }
.caption { font-size: 0.75rem; line-height: 1.4; font-weight: 500; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.02em; }
.caption-plain { font-size: 0.75rem; line-height: 1.4; font-weight: 500; color: var(--ink-mute); }
code, .code { font-family: var(--font-code); font-size: 0.8125rem; line-height: 1.4; font-weight: 500; }
.ticker { font-family: var(--font-code); font-weight: 700; font-size: 0.875rem; }
.muted { color: var(--ink-mute); }
.pos { color: var(--success-ink); }
.neg { color: var(--danger-ink); }
.flat { color: var(--ink-soft); }
.wrap-anywhere { overflow-wrap: anywhere; min-width: 0; }
.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

a { color: var(--primary-strong); }
a:hover { color: var(--primary-strong-hover); }
html[data-theme="dark"] a { color: var(--primary-light); }

:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

.icon { flex-shrink: 0; display: inline-block; vertical-align: middle; }

/* ---------- 3. Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1);
    font-family: var(--font-heading); font-weight: 600; font-size: 1rem; line-height: 1.25;
    padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm);
    border: 2px solid var(--line); background: transparent; color: var(--ink);
    cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s;
    min-height: var(--touch-min); text-decoration: none; text-align: center;
}
.btn:hover { border-color: var(--ink-soft); background: var(--bg); color: var(--ink); }
.btn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--input-disabled-bg); color: var(--ink-mute); border-color: var(--input-disabled-bg); cursor: not-allowed; box-shadow: none; }
.btn-primary { background: var(--primary-strong); color: var(--primary-ink); border: none; }
.btn-primary:hover { background: var(--primary-strong-hover); box-shadow: var(--elev-2); color: var(--primary-ink); }
.btn-secondary { background: transparent; color: var(--ink); border: 2px solid var(--line); }
.btn-secondary:hover { border-color: var(--ink-soft); background: var(--bg); }
.btn-ghost {
    background: none; border: none; color: var(--primary-strong); text-decoration: underline;
    padding: var(--space-2) var(--space-2); font-weight: 500; min-height: var(--touch-min);
}
.btn-ghost:hover { color: var(--primary-strong-hover); background: var(--mint-tint); }
html[data-theme="dark"] .btn-ghost { color: var(--primary-light); }
.btn-danger { background: var(--danger-strong); color: #fff; border: none; }
.btn-danger:hover { background: var(--danger-strong-hover); color: #fff; }
.btn-danger:focus-visible { outline-color: var(--danger); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 0.875rem; }
.btn-block { width: 100%; }
html[data-theme="dark"] a.btn-primary, html[data-theme="dark"] a.btn-danger { color: #fff; }
html[data-theme="dark"] a.btn-secondary { color: var(--ink); }
.btn-plain { border: none; color: var(--ink-mute); font-weight: 500; }

.icon-btn {
    width: 44px; height: 44px; border-radius: var(--radius-full); border: none; background: transparent;
    display: inline-flex; align-items: center; justify-content: center; color: var(--ink); cursor: pointer; flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface-alt); }

/* Toggle pair (Account Type Cash/Margin): pressed = primary */
.toggle-pair { display: flex; gap: var(--space-2); }
.toggle-pair .btn { flex: 1; }
.toggle-pair .btn[aria-pressed="true"] { background: var(--primary-strong); color: var(--primary-ink); border-color: var(--primary-strong); }

/* ---------- 4. Fields ---------- */
.field { display: flex; flex-direction: column; gap: var(--space-1); margin-bottom: var(--space-3); min-width: 0; }
.field label, .field .field__label { font-size: 0.875rem; font-weight: 500; color: var(--ink-soft); }
.input, .select {
    width: 100%; background: var(--surface-alt); border: 2px solid var(--line); border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-3); font: inherit; font-size: 1rem; color: var(--ink);
    min-height: var(--touch-min); transition: border-color .15s, background .15s;
}
.input:hover, .select:hover { border-color: var(--ink-mute); background: var(--bg); }
.input:focus, .select:focus { border-color: var(--primary); background: var(--surface); box-shadow: var(--elev-2); outline: none; }
.input:disabled, .select:disabled { background: var(--input-disabled-bg); color: var(--ink-mute); border-color: var(--input-disabled-border); cursor: not-allowed; }
.input--error, .input[aria-invalid="true"] { border-color: var(--danger); background: var(--danger-surface); }
.input--code { font-family: var(--font-code); letter-spacing: 0.08em; }
.field__error { color: var(--danger-ink); font-size: 0.8125rem; font-weight: 500; }
html[data-theme="dark"] .field__error { color: #fca5a5; }
.field--disabled { opacity: 0.55; }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 12px; top: 13px; color: var(--ink-mute); }
.input-icon .input { padding-left: 38px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-2); }

/* Toggle switch */
.switch { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) 0; cursor: pointer; min-height: var(--touch-min); }
.switch--disabled { cursor: not-allowed; opacity: 0.6; }
.switch__text { display: flex; flex-direction: column; min-width: 0; }
.switch__label { font-size: 0.875rem; color: var(--ink-soft); }
.switch--strong .switch__label { font-size: 1rem; font-weight: 600; color: var(--ink); }
.switch__control { position: relative; display: inline-flex; align-items: center; flex-shrink: 0; width: 44px; height: 24px; }
.switch__input { position: absolute; inset: 0; opacity: 0; width: 44px; height: 24px; margin: 0; cursor: inherit; z-index: 1; }
.switch__track { width: 44px; height: 24px; background: var(--line); border-radius: var(--radius-full); display: inline-block; position: relative; transition: background .15s; }
html[data-theme="dark"] .switch__track { background: #475569; }
.switch__knob { position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; background: #fff; border-radius: var(--radius-full); box-shadow: var(--elev-1); transition: left .15s; }
.switch__input:checked + .switch__track { background: var(--primary); }
.switch__input:checked + .switch__track .switch__knob { left: 22px; }
.switch__input:focus-visible + .switch__track { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* ---------- 5. Cards, badges, lists, tables ---------- */
.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: var(--space-3); box-shadow: var(--elev-1); min-width: 0;
}
a.card { display: block; color: inherit; text-decoration: none; }
a.card:hover, .card--interactive:hover { box-shadow: var(--elev-2); }
a.card:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.card--error { border-color: var(--danger); background: var(--danger-surface); }
.card--live { border-color: var(--live-card-border); }
.card--flat { box-shadow: none; background: var(--surface-alt); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-2); flex-wrap: wrap; }
.card__title { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.card__title h3, .card__title h2 { margin: 0; }
.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.stack--lg { gap: var(--space-4); }
.row { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.row--between { justify-content: space-between; }

.badge {
    display: inline-flex; align-items: center; gap: var(--space-1);
    font-size: 0.75rem; font-weight: 500; line-height: 1.4; padding: 2px var(--space-2);
    border-radius: var(--radius-full); background: var(--badge-neutral-bg); color: var(--badge-neutral-ink); white-space: nowrap;
}
.badge.success, .badge--success { background: var(--badge-success-bg); color: var(--badge-success-ink); }
.badge.warn, .badge--warn { background: var(--badge-warn-bg); color: var(--badge-warn-ink); }
.badge.danger, .badge--danger { background: var(--badge-danger-bg); color: var(--badge-danger-ink); }
.badge.info, .badge--info { background: var(--badge-info-bg); color: var(--badge-info-ink); }
.badge.neutral, .badge--neutral { background: var(--badge-neutral-bg); color: var(--badge-neutral-ink); }
.badge-row { display: flex; gap: var(--space-1); flex-wrap: wrap; margin-top: var(--space-2); }

.avatar {
    width: 36px; height: 36px; border-radius: var(--radius-full); background: var(--surface-alt);
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    font-weight: 600; font-size: 0.875rem; color: var(--ink-soft); overflow: hidden; text-decoration: none;
}
a.avatar:hover { box-shadow: 0 0 0 2px var(--primary); color: var(--ink); }
.avatar--loading { animation: pulse 1.4s ease-in-out infinite; }
.avatar--lg { width: 64px; height: 64px; font-size: 1.5rem; }

.list { display: flex; flex-direction: column; }
.list-item {
    display: flex; align-items: center; gap: var(--space-2);
    padding: var(--space-3); border-bottom: 1px solid var(--line); min-height: 48px;
    color: inherit; text-decoration: none;
}
a.list-item, button.list-item { width: 100%; background: none; border-left: none; border-right: none; border-top: none; font: inherit; text-align: left; cursor: pointer; color: var(--ink); }
.list-item:hover { background: var(--bg); color: var(--ink); }
.list-item:last-child { border-bottom: none; }
.list-item:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.list-item__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.list-item__title { font-weight: 600; }
.list-item--danger { color: var(--danger-ink); }
.list-card { padding: 0; overflow: hidden; }

.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th, .table td { text-align: left; padding: var(--space-2) var(--space-3); vertical-align: middle; }
.table th { background: var(--surface-alt); color: var(--ink-soft); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tbody tr:nth-child(even) { background: var(--bg); }
.table tbody tr:hover { background: var(--surface-alt); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

.dl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-2) var(--space-3); margin: 0; }
.dl-grid > div { min-width: 0; }
.dl-grid dt { font-size: 0.75rem; font-weight: 500; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.02em; }
.dl-grid dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }

.progress { height: 8px; border-radius: var(--radius-full); background: var(--surface-alt); overflow: hidden; }
.progress__bar { height: 100%; background: var(--primary); border-radius: var(--radius-full); transition: width .3s; }
.progress__bar--warn { background: var(--warn); }
.progress__bar--danger { background: var(--danger); }

/* ---------- 6. States ---------- */
.state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2); text-align: center; padding: var(--space-4) var(--space-3); color: var(--ink-soft); }
.state--loading { flex-direction: row; color: var(--ink-mute); font-size: 0.875rem; padding: var(--space-4) var(--space-3); }
.state--error { flex-direction: row; text-align: left; align-items: flex-start; flex-wrap: wrap; color: var(--ink); }
.state--error > .icon { color: var(--danger-ink); margin-top: 2px; }
.state__text { flex: 1; min-width: 200px; }
.state__text p { margin: 0; }
.state__title { font-weight: 600; color: var(--ink); margin: 0; }
.state--empty .icon { color: var(--ink-mute); }
.state--empty p { margin: 0; }
.inline-error { border: 1px solid var(--danger); background: var(--danger-surface); color: var(--ink); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); font-size: 0.875rem; display: flex; flex-direction: column; gap: var(--space-2); align-items: flex-start; }
.inline-error p { margin: 0; }
.inline-success { border: 1px solid var(--primary); background: var(--banner-ok-bg); color: var(--banner-ok-ink); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); font-size: 0.875rem; display: flex; gap: var(--space-2); align-items: center; }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--primary); animation: spin .8s linear infinite; display: inline-block; flex-shrink: 0; }
.spinner--sm { width: 14px; height: 14px; }
.spinner--light { border-color: rgba(255, 255, 255, 0.4); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

.chart-empty { border: 2px dashed var(--line); border-radius: var(--radius-sm); padding: var(--space-4) var(--space-3); text-align: center; color: var(--ink-mute); font-size: 0.875rem; }

/* ---------- 7. App shell (AppLayout) ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }

.skip-link {
    position: absolute; left: var(--space-2); top: -60px; z-index: 300;
    background: var(--danger-strong); color: #fff; border: none; border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-3); font: inherit; font-weight: 600; min-height: var(--touch-min); cursor: pointer;
}
.skip-link:focus { top: var(--space-2); }

.topbar {
    position: sticky; top: 0; z-index: 100;
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "brand right";
    align-items: center; gap: var(--space-2);
    height: var(--topbar-h); padding: 0 var(--space-3);
    background: var(--surface); border-bottom: 1px solid var(--line);
}
.app-shell--live .topbar { border-top: 3px solid var(--danger); }
.brand { grid-area: brand; display: inline-flex; align-items: center; gap: var(--space-2); min-width: 0; color: var(--ink); text-decoration: none; font-weight: 700; font-family: var(--font-heading); }
.brand:hover { color: var(--ink); }
html[data-theme="dark"] .brand { color: var(--ink); }
.brand__title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 1rem; }
.topbar__right { grid-area: right; display: flex; align-items: center; gap: var(--space-2); }

.logo-mark {
    width: var(--logo-size, 28px); height: var(--logo-size, 28px); border-radius: calc(var(--logo-size, 28px) / 4);
    background: linear-gradient(135deg, #10b981, #059669);
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.logo-mark--lg { box-shadow: var(--elev-3); }

/* Mode badge (A-027) */
.mode-badge-wrap { display: inline-flex; }
.mode-badge {
    display: inline-flex; align-items: center; gap: 8px; border-radius: var(--radius-full); padding: 4px 12px;
    font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.01em; border: none; font-family: var(--font-heading);
    min-height: 32px; white-space: nowrap; line-height: 1.2;
}
button.mode-badge { cursor: pointer; min-height: var(--touch-min); }
.mode-badge--paper { background: var(--mode-paper-bg); color: var(--mode-paper-ink); }
.mode-badge--live { background: var(--mode-live-bg); color: var(--mode-live-ink); box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.35); }
.mode-badge--unknown { background: var(--badge-neutral-bg); color: var(--badge-neutral-ink); font-weight: 600; }
button.mode-badge--paper:hover { box-shadow: 0 0 0 2px var(--info); }
button.mode-badge--live:hover { background: var(--danger-hover); }

/* Primary nav: ONE element. Mobile = fixed bottom tab bar; desktop = inline top nav. */
.app-nav {
    position: fixed; bottom: 0; left: 0; right: 0; height: var(--tabbar-h); z-index: 100;
    display: flex; justify-content: space-around; align-items: stretch;
    background: var(--surface); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.nav-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--ink-mute); font-size: 0.75rem; font-weight: 500; text-decoration: none;
    min-width: 44px; min-height: 44px; flex: 1; border-top: 3px solid transparent;
}
.nav-item:hover { color: var(--ink-soft); }
.nav-item.active { color: var(--primary-strong); background: var(--mint-tint); border-top-color: var(--primary); }
html[data-theme="dark"] .nav-item { color: var(--ink-mute); }
html[data-theme="dark"] .nav-item.active { color: var(--primary-light); }

.main-content { flex: 1; width: 100%; padding: var(--space-3) var(--space-3) calc(var(--tabbar-h) + var(--space-4)); min-width: 0; }

.page { max-width: var(--content-max); margin: 0 auto; display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.page--wide { max-width: var(--content-wide); }

@media (max-width: 420px) {
    .brand__title { display: none; }
}

@media (min-width: 768px) {
    .topbar {
        grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "brand nav right";
        padding: 0 var(--space-5); gap: var(--space-4);
    }
    .app-nav {
        grid-area: nav; position: static; height: var(--topbar-h); border-top: none; background: transparent;
        justify-content: flex-start; gap: var(--space-1); padding: 0;
    }
    .nav-item { flex: 0 0 auto; flex-direction: row; gap: var(--space-2); padding: 0 var(--space-3); font-size: 0.9375rem; border-top: none; border-bottom: 3px solid transparent; }
    .nav-item.active { border-bottom-color: var(--primary); }
    .main-content { padding: var(--space-4) var(--space-5) var(--space-6); }
}

/* Sub-screen header (Journal, Reports, Trade Detail, settings): back chevron + title (+ action). */
.subbar { display: flex; align-items: center; gap: var(--space-2); min-height: 48px; }
.subbar__title { font-family: var(--font-heading); font-weight: 700; font-size: 1.125rem; margin: 0; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.subbar__title--h3 { font-size: 1.25rem; font-weight: 600; }

.demo-banner {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2);
    background: var(--cream); color: #92400e; border: 1px solid var(--warn); border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-3); font-size: 0.875rem;
}
.demo-banner__pill { font-weight: 700; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }

/* Status banner */
.status-banner { display: flex; align-items: center; gap: 12px; padding: var(--space-3); border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-alt); color: var(--ink); }
.status-banner__text { flex: 1; min-width: 0; }
.status-banner__title { font-weight: 700; font-size: 1.0625rem; overflow-wrap: anywhere; }
.status-banner__body { font-size: 0.875rem; margin: 0; overflow-wrap: anywhere; }
.status-banner--ok { background: var(--banner-ok-bg); border-color: var(--banner-ok-line); color: var(--banner-ok-ink); }
.status-banner--warn { background: var(--banner-warn-bg); border-color: var(--banner-warn-line); color: var(--banner-warn-ink); }
.status-banner--danger { background: var(--banner-danger-bg); border-color: var(--banner-danger-line); color: var(--banner-danger-ink); }
.status-banner--neutral .status-banner__body { color: var(--ink-soft); }
.status-banner a { color: inherit; font-weight: 600; }

/* ---------- 8. Modal / bottom sheet ---------- */
.modal-backdrop { position: fixed; inset: 0; background: var(--overlay); z-index: 500; display: flex; align-items: center; justify-content: center; padding: 2vh 2vw; }
.modal {
    background: var(--surface); color: var(--ink); border-radius: var(--radius-lg); box-shadow: var(--elev-4);
    width: min(96vw, 760px); max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; outline: none;
}
.modal--lg { width: min(96vw, 1100px); }
.modal--full { width: 96vw; height: 92vh; }
.modal__header { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); background: var(--surface); }
.modal__title { font-size: 1.25rem; font-weight: 600; margin: 0; overflow-wrap: anywhere; }
.modal__close { margin-right: calc(-1 * var(--space-2)); }
.modal__body { padding: var(--space-4); overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: var(--space-3); }
.modal__body p { margin: 0; }
.modal__footer { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: var(--space-2); flex-wrap: wrap; padding: var(--space-3) var(--space-4); border-top: 1px solid var(--line); background: var(--surface); }
.modal--danger .modal__header { border-top: 4px solid var(--danger); }
.modal--live .modal__header { border-top: 4px solid var(--danger); }
.modal--paper .modal__header { border-top: 4px solid var(--info); }

@media (max-width: 767px) {
    .modal-backdrop { align-items: flex-end; padding: 0; }
    .modal, .modal--lg, .modal--full { width: 100vw; max-width: 100vw; max-height: 92vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
    .modal--full { height: 100vh; max-height: 100vh; border-radius: 0; }
    .modal__footer .btn { flex: 1; }
}

.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); font-size: 0.875rem; }
.checklist li { display: flex; align-items: flex-start; gap: var(--space-2); }
.checklist li.ok .icon { color: var(--success-ink); }
.checklist li.no .icon { color: var(--danger-ink); }
.advisory { background: var(--badge-warn-bg); color: var(--badge-warn-ink); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); font-size: 0.875rem; }
.live-warning { display: flex; gap: var(--space-2); align-items: flex-start; background: var(--banner-danger-bg); color: var(--banner-danger-ink); border: 1px solid var(--danger); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); font-size: 0.875rem; }
.live-warning p { margin: 0; }

/* ---------- 9. Dashboard ---------- */
.account-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; }
.account-bar__name { font-weight: 600; font-size: 1rem; color: var(--ink); overflow-wrap: anywhere; }
.pnl-card__value-row { display: flex; align-items: baseline; gap: 8px; margin: 6px 0 4px; flex-wrap: wrap; }
.pnl-card__value { font-family: var(--font-heading); font-size: 2rem; font-weight: 700; line-height: 1.2; }
.stat-row { display: flex; justify-content: space-between; gap: var(--space-3); margin-top: 10px; flex-wrap: wrap; }
.stat-row__value { font-size: 0.875rem; font-weight: 600; color: var(--ink); margin: 0; }
.watch-list { display: flex; flex-direction: column; gap: 6px; list-style: none; margin: 0; padding: 0; }
.watch-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.warn-card { display: flex; gap: 10px; align-items: flex-start; padding: var(--space-3); border-radius: var(--radius); background: var(--banner-warn-bg); border: 1px solid var(--warn); color: var(--banner-warn-ink); font-size: 0.875rem; }
.warn-card p { margin: 0; }
.engine-control { display: flex; flex-direction: column; gap: var(--space-2); }
.btn-kill { width: 100%; min-height: 56px; font-size: 1.0625rem; }
.kill-switch__caption { text-align: center; margin-top: 8px; }
.kill-switch__result { margin-top: var(--space-2); display: flex; gap: var(--space-2); align-items: flex-start; font-size: 0.875rem; background: var(--banner-danger-bg); color: var(--banner-danger-ink); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); }
.kill-switch__result p { margin: 0; }
.kill-switch__failures { margin: var(--space-1) 0 0; padding-left: var(--space-3); }
.kill-summary__list { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-1); font-size: 0.875rem; }
.kill-summary__list li { display: flex; gap: var(--space-2); justify-content: space-between; }

/* ---------- 10. Onboarding ---------- */
.onboarding-shell { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.onboarding-topbar { position: sticky; top: 0; z-index: 100; height: 56px; display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: 0 var(--space-3); background: var(--surface); border-bottom: 1px solid var(--line); }
.onboarding-main { flex: 1; width: 100%; max-width: var(--content-max); margin: 0 auto; display: flex; flex-direction: column; min-width: 0; }
.onb-content { padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-3); flex: 1; }
.onb-head { padding: var(--space-3) var(--space-3) 0; }
.onb-step { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); }
.onb-step .icon-btn { margin-left: -10px; }
.progress-segments { display: flex; gap: 6px; margin-bottom: var(--space-4); }
.progress-segments span { height: 4px; flex: 1; border-radius: 4px; background: var(--line); }
.progress-segments span.filled { background: var(--primary); }
.mr-head { display: flex; align-items: center; gap: 0.75rem; padding: 1rem 1rem 0.5rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.mr-head h2 { margin-bottom: 2px; }
.cta-bar { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 0.75rem var(--space-3); display: flex; flex-direction: column; gap: 0.5rem; z-index: 50; }
.cta-bar__hint { text-align: center; }
.connected-state { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; padding: var(--space-2) 0; }
.connected-state > .icon { color: var(--success-ink); }
.secure-note { display: flex; align-items: flex-start; gap: var(--space-2); padding: var(--space-2) var(--space-1); }
.secure-note .icon { color: var(--ink-mute); margin-top: 2px; }

/* Mode choice (Mode & Risk mockup) */
.mode-choice { display: flex; gap: 0.5rem; }
.mode-choice__btn {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.25rem; padding: 0.75rem;
    border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface); color: var(--ink-soft);
    font: inherit; font-weight: 600; cursor: pointer; min-height: var(--touch-min);
}
.mode-choice__btn[aria-pressed="true"].paper { border-color: var(--primary); background: var(--mint-tint); color: var(--primary-dark); }
html[data-theme="dark"] .mode-choice__btn[aria-pressed="true"].paper { color: var(--primary-light); }
.mode-choice__btn[aria-pressed="true"].paper .caption { color: inherit; }
.mode-choice__btn[aria-pressed="true"].live { border-color: var(--danger); background: var(--danger-surface); color: var(--danger-ink); }
.mode-choice__btn[aria-pressed="true"].live .caption { color: inherit; }
.mode-choice__btn:disabled { cursor: not-allowed; opacity: 0.55; }
.rules-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.rules-list li { display: flex; justify-content: space-between; gap: var(--space-2); padding: 0.5rem; background: var(--surface); border-radius: var(--radius-sm); border: 1px solid var(--line); }
.rules-card { background: var(--surface-alt); }
details.params summary { cursor: pointer; font-weight: 600; min-height: var(--touch-min); display: flex; align-items: center; gap: var(--space-2); }
details.params[open] summary { margin-bottom: var(--space-2); }

/* ---------- 11. Reports ---------- */
.seg-toggle { display: flex; background: var(--surface-alt); border-radius: var(--radius-full); padding: 4px; border: 1px solid var(--line); }
.seg-btn {
    flex: 1; text-align: center; padding: 8px 12px; border-radius: var(--radius-full); font-size: 0.875rem; min-height: 40px;
    font-weight: 600; cursor: pointer; border: none; background: transparent; color: var(--ink-soft); font-family: inherit;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
.seg-btn[aria-pressed="true"].paper { background: var(--badge-info-bg); color: var(--badge-info-ink); box-shadow: var(--elev-1); }
.seg-btn[aria-pressed="true"].live { background: var(--badge-danger-bg); color: var(--badge-danger-ink); box-shadow: var(--elev-1); }
.range-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.chip {
    flex: 0 0 auto; padding: 6px 14px; border-radius: var(--radius-full); font-size: 0.8125rem; min-height: 36px;
    font-weight: 600; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-soft);
    cursor: pointer; white-space: nowrap; font-family: inherit; display: inline-flex; align-items: center; gap: 4px;
}
.chip.active, .chip[aria-pressed="true"] { background: var(--primary-strong); color: #fff; border-color: var(--primary-strong); }
.chip--success[aria-pressed="true"] { background: var(--badge-success-bg); color: var(--badge-success-ink); border-color: var(--success); }
.chip--danger[aria-pressed="true"] { background: var(--badge-danger-bg); color: var(--badge-danger-ink); border-color: var(--danger); }
.chip--info[aria-pressed="true"] { background: var(--badge-info-bg); color: var(--badge-info-ink); border-color: var(--info); }
.chip-select { flex: 0 0 auto; min-height: 36px; padding: 4px 28px 4px 12px; border-radius: var(--radius-full); border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-soft); font: inherit; font-size: 0.8125rem; font-weight: 600; }
.equity-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; gap: var(--space-2); flex-wrap: wrap; }
.equity-value { font-size: 1.5rem; font-weight: 700; color: var(--ink); }
.equity-delta { font-size: 0.8125rem; font-weight: 600; display: flex; align-items: center; gap: 2px; }
.chart-wrap { margin-top: 8px; }
.chart-grid { stroke: var(--line); }
.chart-labels { display: flex; justify-content: space-between; font-size: 0.6875rem; color: var(--ink-mute); margin-top: 4px; }
.metrics-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 768px) { .metrics-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.metric-card { padding: 12px; }
.metric-label { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--ink-mute); font-weight: 600; margin-bottom: 4px; }
.metric-value { font-size: 1.25rem; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.metric-value.pos { color: var(--success-ink); }
.metric-value.neg { color: var(--danger-ink); }
.metric-sub { font-size: 0.75rem; color: var(--ink-mute); margin-top: 2px; }
.breakdown-bar { display: flex; height: 14px; border-radius: var(--radius-full); overflow: hidden; margin: 10px 0 8px; background: var(--surface-alt); }
.bar-win { background: var(--success); height: 100%; }
.bar-loss { background: var(--danger); height: 100%; }
.breakdown-legend { display: flex; justify-content: space-between; font-size: 0.8125rem; color: var(--ink-soft); flex-wrap: wrap; gap: var(--space-2); }
.legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.milestone-card { background: var(--banner-ok-bg); border: 1px solid var(--primary); display: flex; gap: 10px; align-items: flex-start; color: var(--banner-ok-ink); }
.milestone-card p { margin: 0; font-size: 0.8125rem; color: inherit; }
.export-btn { width: 100%; justify-content: center; }
.pnl-calendar { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.pnl-day { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 8px; display: flex; flex-direction: column; font-size: 0.75rem; background: var(--surface); min-width: 0; }
.pnl-day__date { color: var(--ink-mute); font-weight: 500; }
.pnl-day__value { font-weight: 700; font-size: 0.8125rem; overflow-wrap: anywhere; }
.pnl-day__trades { color: var(--ink-mute); }
.pnl-day--pos { border-color: var(--success); }
.pnl-day--pos .pnl-day__value { color: var(--success-ink); }
.pnl-day--neg { border-color: var(--danger); }
.pnl-day--neg .pnl-day__value { color: var(--danger-ink); }
.reports--live .equity-card { border-color: var(--live-card-border); }

/* ---------- 12. Journal ---------- */
.filter-row { display: flex; gap: var(--space-2); overflow-x: auto; padding-bottom: var(--space-2); align-items: center; flex-wrap: wrap; }
.journal-group { display: flex; flex-direction: column; gap: var(--space-2); }
.journal-group__head { margin: var(--space-2) 0 0; }
.journal-card { border-left: 4px solid var(--line); }
.journal-card--enter { border-left-color: var(--primary); }
.journal-card--reject { border-left-color: var(--danger); }
.journal-card--exit { border-left-color: var(--accent); }
.journal-card--halt { border-left-color: var(--warn); }
.journal-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-2); flex-wrap: wrap; }
.journal-card__id { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; min-width: 0; }
.journal-card__time { font-size: 0.875rem; color: var(--ink-mute); white-space: nowrap; }
.journal-card__notes { font-size: 0.875rem; color: var(--ink-soft); margin: var(--space-1) 0 0; overflow-wrap: anywhere; }
.zero-day { text-align: center; background: var(--surface-alt); box-shadow: none; }
.zero-day .icon { color: var(--ink-mute); margin-bottom: var(--space-1); }
.glossary { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--space-3); }
.glossary dl { margin: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.glossary dt { font-family: var(--font-code); font-weight: 700; font-size: 0.8125rem; }
.glossary dd { margin: 0 0 var(--space-2); font-size: 0.875rem; color: var(--ink-soft); }

/* ---------- 13. Activity / watchlist / trades ---------- */
.risk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-3); }
.risk-item { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.risk-item__value { font-weight: 600; overflow-wrap: anywhere; }
.position-card__head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.feed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-2); list-style: none; margin: 0; padding: 0; }
.feed-card__head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.feed-card__levels { display: flex; gap: var(--space-3); flex-wrap: wrap; font-size: 0.8125rem; color: var(--ink-soft); margin-top: var(--space-1); }
.row-toggle { background: none; border: none; padding: 0; font: inherit; color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: var(--space-1); min-height: var(--touch-min); }
.row-toggle:hover { color: var(--primary); }
.sort-btn { background: none; border: none; padding: 0; font: inherit; color: inherit; text-transform: inherit; font-weight: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 2px; min-height: 32px; }
.detail-row td { background: var(--surface-alt); }
.timeline { list-style: none; margin: 0; padding: 0 0 0 var(--space-3); border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: var(--space-3); }
.timeline li { position: relative; }
.timeline li::before { content: ""; position: absolute; left: calc(-1 * var(--space-3) - 6px); top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); }
.timeline__head { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.narrative { white-space: pre-line; }
.audit-detail pre { white-space: pre-wrap; word-break: break-word; font-family: var(--font-code); font-size: 0.75rem; background: var(--surface-alt); padding: var(--space-2); border-radius: var(--radius-sm); margin: var(--space-1) 0 0; }
.audit-detail summary { cursor: pointer; font-size: 0.8125rem; color: var(--ink-soft); }

/* Preferences matrix */
.pref-table td, .pref-table th { text-align: center; }
.pref-table th[scope="row"] { text-align: left; text-transform: none; font-size: 0.875rem; background: transparent; color: var(--ink); font-weight: 500; border-bottom: none; white-space: normal; }
.pref-check { width: 22px; height: 22px; accent-color: var(--primary); cursor: pointer; }
.pref-check:disabled { cursor: not-allowed; }

/* ---------- 14. Public pages (Sign In, Terms, Access restricted) ---------- */
.public-shell { min-height: 100vh; background: var(--bg); color: var(--ink); }
.signin { min-height: 100vh; background: var(--signin-bg); display: flex; flex-direction: column; color: #f8fafc; }
.signin__main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--space-5) var(--space-4); text-align: center; width: 100%; max-width: 440px; margin: 0 auto; }
.signin__title { color: #f8fafc; font-size: 1.5rem; margin: var(--space-4) 0 4px; }
.signin__tagline { color: #94a3b8; margin-bottom: var(--space-5); }
.signin__providers { width: 100%; display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-4); }
.signin-btn { width: 100%; background: #ffffff; color: #1e293b; border: 2px solid #e2e8f0; gap: 10px; }
.signin-btn:hover { background: #f8fafc; color: #1e293b; border-color: #cbd5e1; }
.signin-btn:focus-visible { outline-color: #a7f3d0; }
.signin-btn.is-opening { opacity: 0.8; pointer-events: none; }
.signin__mfa { display: flex; align-items: center; gap: 6px; color: var(--signin-muted); margin-bottom: var(--space-5); font-size: 0.75rem; font-weight: 500; }
.signin__footer { padding: var(--space-4); text-align: center; border-top: 1px solid #1e293b; }
.signin__footer p { color: var(--signin-muted); margin: 0; font-size: 0.875rem; }
.signin__footer a { color: #a7f3d0; }
.signin__broker { color: #a7f3d0; }
.signin__continue { color: #a7f3d0; font-weight: 600; }
.public-page { min-height: 100vh; display: flex; justify-content: center; padding: var(--space-5) var(--space-3); }
.public-card { width: 100%; max-width: var(--content-max); align-self: flex-start; display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); }
.public-card h1 { margin: 0; }
.public-card h2 { font-size: 1.125rem; margin: var(--space-2) 0 0; }
.public-card ul { margin: 0; padding-left: var(--space-4); display: flex; flex-direction: column; gap: var(--space-1); }

/* Blazor Server's unhandled-error banner. */
#blazor-error-ui {
    display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
    padding: var(--space-3) var(--space-4); background: var(--danger-surface); border-top: 2px solid var(--danger); color: var(--ink);
}
#blazor-error-ui .dismiss { cursor: pointer; float: right; }
#blazor-error-ui .reload { color: var(--danger); font-weight: 600; }

/* ---------- 15. Small utilities used across screens ---------- */
.flush { margin: 0; }
.flush-bottom { margin-bottom: 0; }
.tight { margin-bottom: var(--space-1); }
.spaced-top { margin-top: var(--space-2); }
.spaced-bottom { margin-bottom: var(--space-2); }
.center { text-align: center; }
.left { text-align: left !important; }
.strong { font-weight: 700; }
.info-ink { color: var(--badge-info-ink); }
.halt-icon { color: var(--warn); }
.ticker--lg { font-size: 1.25rem; }
.card__title--spaced { margin-bottom: var(--space-2); }
.badge--block { margin-top: 0.75rem; white-space: normal; }
.divider-bottom { border-bottom: 1px solid var(--line); margin-bottom: 0.75rem; }
.cta-bar--inline { position: static; border: none; padding: 0; background: transparent; }
.legend-dot--win { background: var(--success); }
.legend-dot--loss { background: var(--danger); }
.zero-day__title { margin: 0; font-weight: 600; color: var(--ink-soft); }
.zero-day__caption { margin: 4px 0 0; }
.trade-session { margin: 0 0 var(--space-3); }
.pr-topbar .subbar__title { text-align: center; }
.audit-item { align-items: flex-start; }

/* Sticky CTA bars inside the app shell sit above the fixed mobile tab bar, never under it. */
.app-shell .cta-bar:not(.cta-bar--inline) { bottom: var(--tabbar-h); margin: 0 calc(-1 * var(--space-3)); }
@media (min-width: 768px) {
    .app-shell .cta-bar:not(.cta-bar--inline) { bottom: 0; margin: 0; border-radius: var(--radius) var(--radius) 0 0; }
}
