        :root {
            --bg: #09090b;
            --bg-elevated: #0f0f12;
            --surface: #18181b;
            --surface-hover: #27272a;
            --border: #27272a;
            --border-focus: #3f3f46;
            --text: #fafafa;
            --text-secondary: #a1a1aa;
            --text-muted: #71717a;
            --accent: #a78bfa;
            --accent-strong: #8b5cf6;
            --green: #4ade80;
            --green-dim: #22c55e;
            --red: #f87171;
            --red-dim: #ef4444;
            --radius: 14px;
            --radius-sm: 10px;
            --shadow: 0 2px 8px rgba(0,0,0,0.35);
            --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
            --body-bg-gradient: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(139,92,246,0.12), transparent 50%), radial-gradient(ellipse 60% 40% at 80% 60%, rgba(99,102,241,0.06), transparent 50%);
            --card-gradient: linear-gradient(135deg, var(--surface) 0%, var(--surface) 100%);
            --table-stripe: rgba(255,255,255,0.02);
            --agent-shadow: 0 2px 8px rgba(0,0,0,0.2);
            --modal-scrim: rgba(0,0,0,0.72);
        }
        [data-theme="light"] {
            --bg: #f8fafc;
            --bg-elevated: #ffffff;
            --surface: #ffffff;
            --surface-hover: #f1f5f9;
            --border: #e2e8f0;
            --border-focus: #cbd5e1;
            --text: #0f172a;
            --text-secondary: #475569;
            --text-muted: #64748b;
            --accent: #7c3aed;
            --accent-strong: #6d28d9;
            --green: #16a34a;
            --green-dim: #15803d;
            --red: #dc2626;
            --red-dim: #b91c1c;
            --shadow: 0 2px 8px rgba(0,0,0,0.08);
            --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
            --body-bg-gradient: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(124,58,237,0.08), transparent 50%), radial-gradient(ellipse 60% 40% at 80% 60%, rgba(99,102,241,0.05), transparent 50%);
            --card-gradient: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
            --table-stripe: rgba(0,0,0,0.02);
            --agent-shadow: 0 2px 8px rgba(0,0,0,0.06);
            --modal-scrim: rgba(15,23,42,0.32);
        }
        * { box-sizing: border-box; margin: 0; padding: 0; }
        body { font-family: 'Outfit', system-ui, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.5; -webkit-font-smoothing: antialiased; }
        body::before { content: ''; position: fixed; top: 0; left: 0; right: 0; height: 100%; background: var(--body-bg-gradient); pointer-events: none; z-index: 0; }
        body::after { content: ''; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E"); pointer-events: none; z-index: 0; }
        [data-theme="light"] body::after { opacity: 0.015; }
        .app { display: flex; min-height: 100vh; position: relative; z-index: 1; }
        .sidebar {
            width: 220px;
            background: var(--bg-elevated);
            border-right: 1px solid var(--border);
            padding: 0.85rem 0;
            flex-shrink: 0;
            transition: width 0.22s ease;
        }
        /* Full-viewport modals: portaled under body (sibling of .app). Disable hit-testing on the
           whole dashboard shell so <main> / sidebar cannot steal clicks (embedded browsers, stacking). */
        body.chbot-settings-modal-open .app,
        body.chbot-settings-modal-open .app *,
        body.chbot-mode-modal-open .app,
        body.chbot-mode-modal-open .app * {
            pointer-events: none !important;
        }
        body.chbot-settings-modal-open #botSettingsModal,
        body.chbot-settings-modal-open #botSettingsModal *,
        body.chbot-mode-modal-open #botModeModal,
        body.chbot-mode-modal-open #botModeModal * {
            pointer-events: auto !important;
        }
        /* Wide modal can overlap the fixed sidebar in x; hide sidebar so it cannot win hit-testing */
        body.chbot-settings-modal-open #chbotSidebar,
        body.chbot-mode-modal-open #chbotSidebar {
            visibility: hidden !important;
        }
        .sidebar.sidebar--collapsed { width: 56px; }
        .sidebar-head { padding: 0 0.45rem 0.35rem 0.55rem; margin-bottom: 0.2rem; }
        .sidebar-toggle {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.35rem;
            width: 100%;
            border: none;
            background: transparent;
            cursor: pointer;
            padding: 0.35rem 0.45rem;
            margin: 0;
            color: inherit;
            font: inherit;
            text-align: left;
            border-radius: 9px;
            transition: background 0.18s;
        }
        .sidebar-toggle:hover { background: color-mix(in srgb, var(--surface) 70%, transparent); }
        .sidebar-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
        .sidebar-brand { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: flex-start; }
        .sidebar-brand h1 {
            font-size: 1.35rem;
            font-weight: 700;
            letter-spacing: -0.04em;
            background: linear-gradient(135deg, #fff 30%, var(--accent) 70%, #c4b5fd 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            line-height: 1.15;
        }
        .sidebar-brand-mini {
            display: none;
            font-size: 1.15rem;
            line-height: 1;
            color: var(--accent);
            font-weight: 700;
        }
        .sidebar.sidebar--collapsed .sidebar-brand-full { display: none; }
        .sidebar.sidebar--collapsed .sidebar-brand-mini { display: block; text-align: center; width: 100%; }
        .sidebar-toggle-chevron {
            flex-shrink: 0;
            font-size: 0.85rem;
            color: var(--text-muted);
            opacity: 0.85;
            transition: transform 0.22s ease, color 0.18s;
            line-height: 1;
        }
        .sidebar-toggle:hover .sidebar-toggle-chevron { color: var(--text-secondary); }
        .sidebar.sidebar--collapsed .sidebar-toggle-chevron { transform: rotate(180deg); }
        .sidebar.sidebar--collapsed .sidebar-toggle { justify-content: center; padding: 0.35rem 0.25rem; }
        .sidebar.sidebar--collapsed .sidebar-toggle-chevron { display: none; }
        .sidebar-nav { padding: 0 0.55rem; }
        .sidebar-nav-group {
            margin: 0 0 0.45rem;
            padding: 0 0 0.18rem;
            border-bottom: 1px solid color-mix(in srgb, var(--border) 52%, transparent);
        }
        .sidebar-nav-group:last-child {
            margin-bottom: 0;
            border-bottom: none;
        }
        .sidebar-nav-heading {
            padding: 0.25rem 0.68rem 0.22rem;
            color: var(--text-muted);
            font-size: 0.56rem;
            font-weight: 800;
            letter-spacing: 0.105em;
            line-height: 1.1;
            text-transform: uppercase;
        }
        .sidebar.sidebar--collapsed .sidebar-nav-group {
            margin-bottom: 0.28rem;
            padding-bottom: 0.16rem;
        }
        .sidebar.sidebar--collapsed .sidebar-nav-heading {
            height: 1px;
            margin: 0.12rem 0;
            padding: 0;
            overflow: hidden;
            color: transparent;
            background: color-mix(in srgb, var(--border) 68%, transparent);
        }
        .sidebar-nav a {
            display: flex; align-items: center; gap: 0.48rem;
            padding: 0.42rem 0.68rem;
            color: var(--text-secondary); text-decoration: none;
            border-radius: 9px;
            font-size: 0.8125rem; font-weight: 500; letter-spacing: 0.01em;
            margin-bottom: 0.1rem;
            border: 1px solid color-mix(in srgb, var(--border) 45%, transparent);
            background: color-mix(in srgb, var(--surface) 35%, transparent);
            transition: color 0.18s, background 0.18s, border-color 0.18s, box-shadow 0.18s, justify-content 0.18s;
        }
        .sidebar.sidebar--collapsed .sidebar-nav a {
            justify-content: center;
            gap: 0;
            padding-left: 0.5rem;
            padding-right: 0.5rem;
        }
        .sidebar.sidebar--collapsed .sidebar-nav a .sidebar-nav-label {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            white-space: nowrap;
            border: 0;
        }
        .sidebar-nav a::before {
            content: attr(data-icon);
            font-size: 0.72rem;
            opacity: 0.72;
            line-height: 1;
            flex-shrink: 0;
        }
        .sidebar-nav a:hover {
            color: var(--text);
            background: color-mix(in srgb, var(--surface-hover) 88%, var(--accent) 4%);
            border-color: color-mix(in srgb, var(--border) 65%, var(--accent) 18%);
        }
        .sidebar-nav a:hover::before { opacity: 1; }
        .sidebar-nav a.active {
            color: var(--accent-strong);
            background: color-mix(in srgb, var(--accent) 13%, var(--surface));
            border-color: color-mix(in srgb, var(--accent) 38%, var(--border));
            box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent);
        }
        .sidebar-nav a.active::before { opacity: 1; color: var(--accent); }
        @media (min-width: 769px) {
            .sidebar-nav a {
                border-color: transparent;
                background: transparent;
            }
            .sidebar-nav a:hover {
                background: var(--surface);
                border-color: transparent;
                box-shadow: none;
            }
            .sidebar-nav a.active {
                color: var(--accent);
                background: color-mix(in srgb, var(--accent) 11%, transparent);
                border: none;
                border-left: 3px solid var(--accent);
                padding-left: calc(0.68rem - 3px);
                box-shadow: none;
            }
            .sidebar-nav a.active::before { color: inherit; }
        }
        .main { flex: 1; min-width: 0; overflow-y: auto; padding: clamp(0.75rem, 1.2vw, 1.25rem) clamp(0.7rem, 1.45vw, 1.5rem) 2rem; }
        .header {
            display: flex;
            flex-direction: column;
            align-items: stretch;
            margin-bottom: 1rem;
            gap: 0.35rem;
        }
        .header-primary {
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 0.5rem 0.65rem;
        }
        .header-toolbar-essential {
            display: flex;
            align-items: center;
            gap: 0.45rem;
            flex-wrap: wrap;
            flex-shrink: 0;
            justify-content: flex-end;
        }
        .header-tools-wrap { position: relative; flex-shrink: 0; }
        .header-tools-trigger {
            padding: 0.32rem 0.75rem;
            border-radius: 999px;
            border: 1px solid var(--border);
            background: color-mix(in srgb, var(--surface) 90%, transparent);
            color: var(--text);
            font-size: 0.72rem;
            font-weight: 600;
            cursor: pointer;
        }
        .header-tools-trigger:hover { border-color: var(--border-focus); color: var(--accent); }
        .header-tools-trigger[aria-expanded="true"] {
            border-color: var(--accent);
            box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
        }
        .header-tools-menu {
            position: absolute;
            right: 0;
            top: calc(100% + 0.28rem);
            min-width: min(16.5rem, 92vw);
            max-height: min(70vh, 22rem);
            overflow-y: auto;
            z-index: 60;
            padding: 0.35rem;
            border-radius: var(--radius-sm);
            border: 1px solid var(--border);
            background: var(--surface);
            box-shadow: var(--shadow-lg);
        }
        .header-tools-menu[hidden] { display: none !important; }
        .header-tools-menu-sep {
            height: 1px;
            margin: 0.28rem 0.2rem;
            background: color-mix(in srgb, var(--border) 85%, transparent);
        }
        .header-tools-menu-item {
            display: flex;
            align-items: center;
            gap: 0.45rem;
            width: 100%;
            text-align: left;
            border: none;
            border-radius: var(--radius-sm);
            background: transparent;
            color: var(--text);
            font-size: 0.74rem;
            font-weight: 500;
            padding: 0.42rem 0.5rem;
            cursor: pointer;
            box-sizing: border-box;
        }
        .header-tools-menu-item:hover { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
        .header-tools-menu-item:disabled { opacity: 0.55; cursor: not-allowed; }
        .header-tools-menu .header-toolbar-icon-btn {
            justify-content: flex-start;
            padding: 0.42rem 0.5rem;
            border-radius: var(--radius-sm);
            width: 100%;
            box-shadow: none;
        }
        .header-tools-menu .settings-header-btn svg { flex-shrink: 0; }
        .header-tools-menu .mode-bar-cmd-btn {
            width: 100%;
            min-width: 0;
            height: auto;
            padding: 0.42rem 0.5rem;
            justify-content: flex-start;
            gap: 0.45rem;
            border-radius: var(--radius-sm);
            border: 1px solid var(--border);
            background: color-mix(in srgb, var(--surface) 92%, transparent);
            font-size: 0.72rem;
            font-weight: 500;
        }
        .header-tools-menu .mode-bar-cmd-btn .mode-bar-cmd-icon { display: flex; }
        .mode-bar--compact { max-width: min(100%, 22rem); }
        .sidebar-nav a.sidebar-nav-external::after {
            content: ' ↗';
            font-size: 0.62rem;
            opacity: 0.65;
        }
        .links--compact {
            display: flex;
            flex-wrap: wrap;
            align-items: baseline;
            gap: 0.35rem 0.75rem;
            font-size: 0.72rem;
        }
        .links-compact-hint { color: var(--text-secondary); }
        .links-compact-more { white-space: nowrap; }
        .operator-pretrade-checklist {
            margin: 0.55rem 0 0.75rem;
            max-width: 28rem;
            padding: 0.55rem 0.72rem;
            border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
            border-radius: var(--radius-sm);
            background: color-mix(in srgb, var(--surface) 90%, transparent);
        }
        .operator-pretrade-checklist__title {
            font-size: 0.68rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: var(--text-muted);
            margin-bottom: 0.38rem;
        }
        .operator-pretrade-checklist__list {
            margin: 0;
            padding: 0;
            list-style: none;
            font-size: 0.78rem;
            line-height: 1.42;
            color: var(--text-secondary);
        }
        .operator-pretrade-checklist__item {
            display: flex;
            align-items: flex-start;
            gap: 0.42rem;
            margin-bottom: 0.22rem;
        }
        .operator-pretrade-checklist__item:last-child { margin-bottom: 0; }
        .operator-pretrade-checklist__item[data-state="ok"] .operator-pretrade-checklist__mark { color: var(--green); }
        .operator-pretrade-checklist__item[data-state="warn"] .operator-pretrade-checklist__mark { color: #f59e0b; }
        .operator-pretrade-checklist__item[data-state="danger"] .operator-pretrade-checklist__mark { color: var(--red); }
        .operator-pretrade-checklist__mark { flex-shrink: 0; font-size: 0.72rem; line-height: 1.35; }
        .section-status-strip {
            display: inline-flex;
            align-items: center;
            flex: 1 1 auto;
            justify-content: flex-end;
            min-width: 0;
            margin-left: 0.35rem;
            padding: 0.18rem 0.55rem;
            border-radius: 999px;
            border: 1px solid var(--border);
            font-size: 0.65rem;
            font-weight: 600;
            color: var(--text-secondary);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: min(100%, 20rem);
        }
        .section-status-strip[data-state="ok"] { border-color: var(--green-dim); color: var(--green); background: rgba(34,197,94,0.08); }
        .section-status-strip[data-state="warn"] { border-color: rgba(245,158,11,0.45); color: #f59e0b; background: rgba(245,158,11,0.08); }
        .section-status-strip[data-state="danger"] { border-color: var(--red-dim); color: var(--red); background: rgba(248,113,113,0.08); }
        .section-status-strip[data-state="muted"] { opacity: 0.85; }
        .section-status-strip--row {
            flex: 1 1 100%;
            max-width: 100%;
            margin-left: 0;
            margin-top: 0.12rem;
            justify-content: flex-start;
        }
        .section-header:has(.section-status-strip) {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 0.35rem 0.5rem;
        }
        .chbot-cmd-palette {
            position: fixed;
            inset: 0;
            z-index: 2000;
            display: flex;
            align-items: flex-start;
            justify-content: center;
            padding: 12vh 1rem 2rem;
            box-sizing: border-box;
        }
        .chbot-cmd-palette[hidden] { display: none !important; }
        .chbot-cmd-palette__backdrop {
            position: absolute;
            inset: 0;
            background: var(--modal-scrim);
            backdrop-filter: blur(2px);
        }
        .chbot-cmd-palette__dialog {
            position: relative;
            width: min(26rem, 96vw);
            max-height: min(70vh, 28rem);
            display: flex;
            flex-direction: column;
            border-radius: var(--radius);
            border: 1px solid var(--border);
            background: var(--surface);
            box-shadow: var(--shadow-lg);
            overflow: hidden;
        }
        .chbot-cmd-palette__label {
            padding: 0.65rem 0.85rem 0.25rem;
            font-size: 0.72rem;
            font-weight: 700;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }
        .chbot-cmd-palette__input {
            margin: 0 0.65rem 0.5rem;
            padding: 0.5rem 0.65rem;
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            background: var(--bg-elevated);
            color: var(--text);
            font-size: 0.88rem;
            width: calc(100% - 1.3rem);
            box-sizing: border-box;
        }
        .chbot-cmd-palette__list {
            margin: 0;
            padding: 0.25rem;
            overflow-y: auto;
            list-style: none;
            flex: 1;
            min-height: 0;
        }
        .chbot-cmd-palette__item {
            margin: 0;
            padding: 0.42rem 0.55rem;
            border-radius: var(--radius-sm);
            cursor: pointer;
            font-size: 0.82rem;
            color: var(--text);
            display: flex;
            justify-content: space-between;
            gap: 0.5rem;
            align-items: center;
        }
        .chbot-cmd-palette__item:hover,
        .chbot-cmd-palette__item[aria-selected="true"] {
            background: color-mix(in srgb, var(--accent) 12%, var(--surface));
        }
        .chbot-cmd-palette__item-kbd { font-size: 0.65rem; color: var(--text-muted); font-family: inherit; }
        .chbot-cmd-palette__hint {
            margin: 0;
            padding: 0.45rem 0.85rem 0.65rem;
            font-size: 0.65rem;
            color: var(--text-muted);
            border-top: 1px solid var(--border);
        }
        .chbot-cmd-palette__hint kbd {
            display: inline-block;
            padding: 0.08rem 0.28rem;
            border-radius: 4px;
            border: 1px solid var(--border);
            font-size: 0.62rem;
            margin-right: 0.12rem;
        }
        .header-left { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; min-width: 0; }
        /* TF + strategy — between mode bar and lang/tools; narrow viewports use compact trigger + panel */
        .header-runtime-wrap {
            display: flex;
            align-items: center;
            justify-content: center;
            flex: 1 1 auto;
            min-width: 0;
            max-width: min(100%, 46rem);
            position: relative;
        }
        .header-runtime-panel {
            display: contents;
        }
        .header-runtime-compact-trigger {
            display: none;
            flex-direction: column;
            align-items: flex-start;
            gap: 0.06rem;
            max-width: 100%;
            padding: 0.28rem 0.72rem 0.32rem;
            border-radius: 999px;
            border: 1px solid var(--border);
            background: color-mix(in srgb, var(--surface) 88%, transparent);
            color: var(--text);
            cursor: pointer;
            text-align: left;
            box-sizing: border-box;
        }
        .header-runtime-compact-trigger:hover {
            border-color: var(--border-focus);
            color: var(--accent);
        }
        .header-runtime-compact-trigger:focus-visible {
            outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
            outline-offset: 2px;
        }
        .header-runtime-compact-trigger[aria-expanded="true"] {
            border-color: var(--accent);
            box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
        }
        .header-runtime-compact-eyebrow {
            font-size: 0.58rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: var(--text-muted);
            line-height: 1.2;
        }
        .header-runtime-compact-summary {
            font-size: 0.72rem;
            font-weight: 600;
            line-height: 1.25;
            max-width: 16rem;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .header-runtime-bar {
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 0.35rem 0.5rem;
            min-width: 0;
            flex: 1 1 auto;
            justify-content: center;
            max-width: min(100%, 46rem);
            padding: 0.22rem 0.55rem 0.22rem 0.6rem;
            background: color-mix(in srgb, var(--surface) 88%, transparent);
            border: 1px solid var(--border);
            border-radius: 999px;
            box-sizing: border-box;
        }
        .header-runtime-pill {
            display: inline-flex;
            align-items: center;
            gap: 0.32rem;
            margin: 0;
            cursor: default;
            min-width: 0;
        }
        .header-runtime-pill--strategy { flex: 1 1 auto; min-width: 0; max-width: min(100%, 24rem); }
        .header-runtime-label {
            font-size: 0.64rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.055em;
            color: var(--text-muted);
            flex-shrink: 0;
        }
        .header-runtime-select-tf {
            max-width: 5.2rem;
            min-width: 3.15rem;
            padding: 0.2rem 0.42rem;
            font-size: 0.72rem;
            font-weight: 600;
            border-radius: 999px;
        }
        .header-runtime-bar .runtime-tf-select.strategy-select-dropdown {
            min-width: 7.5rem;
            max-width: 100%;
            flex: 1 1 auto;
            padding: 0.2rem 0.48rem;
            font-size: 0.7rem;
            font-weight: 500;
            border-radius: 999px;
        }
        .header-runtime-hint {
            max-width: min(15rem, 34vw);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            padding: 0.2rem 0.55rem;
            font-size: 0.62rem;
            margin: 0;
            flex-shrink: 1;
        }
        .header-toolbar {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            flex-shrink: 0;
            flex-wrap: wrap;
            justify-content: flex-end;
        }
        @media (max-width: 768px) {
            .header-runtime-wrap {
                order: 4;
                flex: 1 1 100%;
                max-width: 100%;
                justify-content: flex-start;
            }
            .header-runtime-compact-trigger {
                display: inline-flex;
            }
            .header-runtime-panel {
                display: none;
                position: absolute;
                top: calc(100% + 0.32rem);
                left: 0;
                min-width: min(18.5rem, calc(100vw - 2.5rem));
                max-width: min(22rem, 94vw);
                z-index: 55;
                padding: 0.65rem 0.7rem;
                background: var(--surface);
                border: 1px solid var(--border);
                border-radius: var(--radius-sm);
                box-shadow: var(--shadow-lg);
                box-sizing: border-box;
            }
            .header-runtime-wrap.is-runtime-open .header-runtime-panel {
                display: block;
            }
            .header-runtime-panel .header-runtime-bar {
                flex-direction: column;
                align-items: stretch;
                justify-content: flex-start;
                max-width: 100%;
                border-radius: var(--radius-sm);
                margin: 0;
            }
            .header-runtime-panel .header-runtime-pill--strategy {
                max-width: 100%;
            }
            .header-runtime-panel .header-runtime-hint {
                max-width: 100%;
                white-space: normal;
            }
        }
        .runtime-tf-bar { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; color: var(--text-secondary); }
        .runtime-strategy-status { font-size: 0.72rem; color: var(--text-secondary); opacity: 0.92; max-width: 14rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .runtime-tf-label { font-weight: 600; color: var(--text-muted); }
        .runtime-tf-select { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 0.25rem 0.45rem; font-size: 0.8rem; cursor: pointer; max-width: 5.5rem; }
        .strategy-selector { display: inline-flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; max-width: min(100%, 36rem); }
        .strategy-selector .runtime-strategy-bar { flex: 1 1 auto; min-width: 0; }
        .strategy-selector .runtime-tf-select.strategy-select-dropdown { max-width: min(28rem, 88vw); min-width: 12rem; transition: transform 0.18s ease; }
        .strategy-selector .runtime-tf-select.strategy-select-dropdown:hover { border-color: var(--border-focus); }
        .strategy-tf-hint {
            font-size: 0.72rem;
            padding: 0.25rem 0.5rem;
            border-radius: 6px;
            font-weight: 600;
            text-transform: none;
            letter-spacing: normal;
            white-space: nowrap;
            background: color-mix(in srgb, var(--accent) 20%, transparent);
            color: var(--accent);
            border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
        }
        .status-pill { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.9rem; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; font-size: 0.75rem; font-weight: 500; color: var(--text-secondary); box-shadow: var(--shadow); backdrop-filter: blur(8px); }
        .status-pill.header-toolbar-icon-btn {
            cursor: pointer;
            border: none;
            padding: 0.38rem;
            justify-content: center;
            gap: 0;
            color: var(--text-secondary);
            font-weight: 500;
        }
        .status-pill.header-toolbar-icon-btn:hover {
            border-color: var(--border-focus);
            color: var(--text);
            box-shadow: 0 0 0 2px color-mix(in srgb, var(--border-focus) 30%, transparent);
        }
        .status-pill.header-toolbar-icon-btn svg {
            display: block;
            width: 20px;
            height: 20px;
        }
        .status-pill.header-toolbar-icon-btn .header-toolbar-spinner {
            transform-origin: center;
            animation: headerToolbarSpin 0.65s linear infinite;
        }
        @keyframes headerToolbarSpin { to { transform: rotate(360deg); } }
        .status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
        .status-dot.live { background: var(--green); box-shadow: 0 0 8px var(--green), 0 0 16px rgba(74,222,128,0.3); animation: pulse 2s infinite; }
        @keyframes pulse { 50% { opacity: 0.8; } }
        .badges { display: flex; gap: 0.5rem; flex-wrap: wrap; }
        .badge { font-size: 0.7rem; padding: 0.35rem 0.8rem; border-radius: 8px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; border: 1px solid transparent; }
        .badge-testnet { background: rgba(139,92,246,0.18); color: var(--accent); border-color: rgba(139,92,246,0.3); }
        .badge-paused { background: rgba(248,113,113,0.18); color: var(--red); border-color: rgba(248,113,113,0.3); }
        .pnl-mismatch-cell { background: rgba(248,113,113,0.1); }
        tr.position-row-pnl-mismatch { box-shadow: inset 0 0 0 1px rgba(248,113,113,0.35); }
        .badge.bg-warning { background: rgba(251,191,36,0.25); color: #d97706; border-color: rgba(251,191,36,0.4); font-size: 0.65rem; padding: 0.2rem 0.5rem; margin-left: 0.25rem; }
        .badge-ai { background: rgba(99,102,241,0.18); color: #818cf8; border-color: rgba(99,102,241,0.3); }
        .badge-runtime { background: rgba(167,139,250,0.2); color: var(--accent); border-color: rgba(167,139,250,0.45); cursor: pointer; }
        .badge-runtime:hover { filter: brightness(1.08); }
        .mode-bar {
            display: inline-flex; align-items: center; gap: 0.45rem; flex-wrap: wrap;
            max-width: min(100%, 28rem);
            padding: 0.3rem 0.65rem 0.3rem 0.75rem;
            background: color-mix(in srgb, var(--surface) 88%, transparent);
            border: 1px solid var(--border); border-radius: 999px;
            font-size: 0.72rem; font-weight: 500; color: var(--text-secondary);
        }
        .mode-bar-summary { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.7rem; color: var(--text); word-break: break-word; }
        .mode-bar-btn {
            flex-shrink: 0;
            padding: 0.22rem 0.65rem; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
            background: rgba(139,92,246,0.12); color: var(--accent); font-size: 0.68rem; font-weight: 600; cursor: pointer;
        }
        .mode-bar-btn:hover { background: rgba(139,92,246,0.2); color: var(--accent-strong); }
        .mode-bar-cmd-btn {
            flex-shrink: 0;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 2.35rem;
            height: 2.35rem;
            min-width: 2.35rem;
            padding: 0;
            border-radius: 999px;
            cursor: pointer;
            line-height: 0;
            font-size: 0;
            vertical-align: middle;
        }
        .mode-bar-cmd-btn:focus-visible {
            outline: 2px solid var(--accent);
            outline-offset: 2px;
        }
        /* Icon row always flex; spinner must stay display:none when [hidden] — two-class rule was beating the hidden attribute. */
        .mode-bar-cmd-btn .mode-bar-cmd-icon {
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .mode-bar-cmd-btn .mode-bar-cmd-spinner {
            display: none;
            align-items: center;
            justify-content: center;
        }
        .mode-bar-cmd-btn .mode-bar-cmd-spinner:not([hidden]) {
            display: flex;
        }
        .mode-bar-cmd-btn .mode-bar-cmd-icon svg,
        .mode-bar-cmd-btn .mode-bar-cmd-spinner svg {
            display: block;
            width: 20px;
            height: 20px;
        }
        .mode-bar-cmd-btn .mode-bar-cmd-spinner:not([hidden]) svg {
            transform-origin: center;
            animation: headerToolbarSpin 0.65s linear infinite;
        }
        .mode-restart-btn {
            flex-shrink: 0;
            border: 1px solid rgba(74,222,128,0.42);
            background: rgba(34,197,94,0.1);
            color: var(--green-dim);
        }
        .mode-restart-btn:disabled { opacity: 0.42; cursor: not-allowed; border-color: var(--border); color: var(--text-muted); background: transparent; }
        .mode-restart-btn:not(:disabled):hover { background: rgba(34,197,94,0.2); border-color: rgba(74,222,128,0.55); }
        .mode-bot-stop-btn {
            flex-shrink: 0;
            border: 1px solid rgba(248,113,113,0.45);
            background: rgba(239,68,68,0.12);
            color: var(--red-dim);
        }
        .mode-bot-stop-btn:disabled { opacity: 0.42; cursor: not-allowed; border-color: var(--border); color: var(--text-muted); background: transparent; }
        .mode-bot-stop-btn:not(:disabled):hover { background: rgba(239,68,68,0.22); border-color: rgba(248,113,113,0.65); }
        #botModeModal.modal-overlay {
            position: fixed !important;
            inset: 0 !important;
            z-index: 10055 !important;
            align-items: center !important;
            justify-content: center !important;
            flex-direction: row !important;
            padding: 0.75rem !important;
            box-sizing: border-box !important;
            background: rgba(0,0,0,0.82) !important;
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
        }
        #botModeModal.modal-overlay.open { display: flex !important; }
        .bot-mode-dialog {
            width: min(100% - 2rem, 32rem);
            max-height: min(90vh, 640px);
            overflow: auto;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            box-shadow: var(--shadow-lg);
            padding: 1.1rem 1.25rem 1rem;
        }
        .bot-mode-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.5rem; }
        .bot-mode-head h2 { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--text); }
        .bot-mode-blurb { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.45; margin: 0 0 0.85rem; }
        .bot-mode-grid { display: grid; grid-template-columns: 1fr; gap: 0.45rem; }
        @media (min-width: 520px) { .bot-mode-grid { grid-template-columns: 1fr 1fr; } }
        .bot-mode-grid button {
            text-align: left;
            padding: 0.55rem 0.7rem;
            border-radius: var(--radius-sm);
            border: 1px solid var(--border);
            background: var(--bg-elevated);
            color: var(--text);
            font-size: 0.78rem; font-weight: 600; cursor: pointer;
        }
        .bot-mode-grid button:hover { border-color: var(--accent); background: color-mix(in srgb, var(--surface) 90%, var(--accent)); }
        .bot-mode-grid button[data-preset="testnet_live"] { border-color: rgba(234,179,8,0.55); color: color-mix(in srgb, var(--text) 85%, #ca8a04); }
        .bot-mode-grid button[data-preset="full_live"] { border-color: rgba(248,113,113,0.45); color: var(--red); }
        .bot-mode-msg { font-size: 0.76rem; min-height: 1.2em; margin: 0.65rem 0 0; color: var(--green); }
        .bot-mode-msg.err { color: var(--red); }
        .bot-mode-foot { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: flex-end; margin-top: 0.85rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
        .bot-mode-foot button { padding: 0.45rem 0.85rem; border-radius: var(--radius-sm); font-size: 0.78rem; cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
        .bot-mode-foot button.primary { background: var(--accent); color: #fff; border-color: transparent; }
        .settings-header-btn {
            display: inline-flex; align-items: center; justify-content: center;
            padding: 0.38rem;
            background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 92%, #000) 0%, color-mix(in srgb, var(--bg-elevated) 88%, #000) 100%);
            border: 1px solid var(--border); border-radius: 999px;
            color: var(--text-secondary);
            cursor: pointer; transition: border-color 0.2s, box-shadow 0.2s, color 0.2s, background 0.2s;
        }
        .settings-header-btn:hover {
            border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
            box-shadow: 0 0 0 3px rgba(139,92,246,0.14);
            color: var(--accent);
            background: linear-gradient(180deg, color-mix(in srgb, var(--surface-hover) 85%, var(--accent) 6%) 0%, color-mix(in srgb, var(--surface) 80%, var(--accent) 5%) 100%);
        }
        .settings-header-btn svg {
            flex-shrink: 0;
            display: block;
            width: 20px;
            height: 20px;
            opacity: 0.92;
        }
        [data-theme="light"] .settings-header-btn {
            background: linear-gradient(135deg, rgba(139,92,246,0.14), rgba(99,102,241,0.08));
            border: 1px solid rgba(139,92,246,0.35);
            color: var(--accent);
        }
        [data-theme="light"] .settings-header-btn:hover {
            border-color: var(--accent);
            box-shadow: 0 0 0 3px rgba(139,92,246,0.12);
            color: var(--accent-strong);
            background: linear-gradient(135deg, rgba(139,92,246,0.18), rgba(99,102,241,0.12));
        }
        /* Bot settings: portal node under body; above .app (z-index 1) and boot overlay (10000) */
        #botSettingsModal.modal-overlay {
            position: fixed !important;
            inset: 0 !important;
            z-index: 10060 !important;
            align-items: center !important;
            justify-content: center !important;
            flex-direction: row !important;
            padding: 0.75rem !important;
            box-sizing: border-box !important;
            background: rgba(0,0,0,0.82) !important;
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
        }
        #botSettingsModal.modal-overlay.open {
            display: flex !important;
        }
        #botSettingsModal .bot-settings-dialog {
            width: min(920px, 96vw);
            max-height: min(92vh, 880px);
            display: flex;
            flex-direction: column;
            margin: 0;
            flex-shrink: 0;
            background: linear-gradient(165deg, rgba(24,24,32,0.98) 0%, rgba(14,14,20,0.99) 100%);
            border: 1px solid rgba(139,92,246,0.28);
            border-radius: var(--radius);
            box-shadow: 0 24px 48px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04) inset;
            overflow: hidden;
        }
        [data-theme="light"] #botSettingsModal .bot-settings-dialog {
            background: linear-gradient(165deg, #ffffff 0%, #f4f4f8 100%);
            border-color: var(--border);
        }
        .bot-settings-head {
            display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
            padding: 1.1rem 1.25rem;
            border-bottom: 1px solid var(--border);
            background: rgba(139,92,246,0.06);
            flex-shrink: 0;
        }
        .bot-settings-head h2 { margin: 0; font-size: 1.1rem; font-weight: 700; letter-spacing: -0.03em; color: var(--text); }
        .bot-settings-head p { margin: 0.4rem 0 0; font-size: 0.8rem; color: var(--text-secondary); line-height: 1.45; max-width: 42rem; }
        .bot-settings-security {
            margin: 0;
            padding: 0.65rem 1.25rem;
            border-bottom: 1px solid var(--border);
            background: rgba(248, 113, 113, 0.08);
            flex-shrink: 0;
        }
        [data-theme="light"] .bot-settings-security { background: rgba(220, 38, 38, 0.06); }
        .bot-settings-security strong {
            display: block;
            font-size: 0.72rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: var(--red);
            margin-bottom: 0.35rem;
        }
        .bot-settings-security p {
            margin: 0;
            font-size: 0.78rem;
            line-height: 1.5;
            color: var(--text-secondary);
            max-width: 44rem;
        }
        .bot-settings-filter-bar {
            display: flex;
            align-items: center;
            gap: 0.65rem;
            padding: 0.55rem 1.15rem;
            border-bottom: 1px solid var(--border);
            background: rgba(0,0,0,0.12);
            flex-shrink: 0;
        }
        [data-theme="light"] .bot-settings-filter-bar { background: rgba(0,0,0,0.03); }
        .bot-settings-filter-label {
            font-size: 0.72rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: var(--text-muted);
            flex-shrink: 0;
        }
        .bot-settings-filter-input {
            flex: 1;
            min-width: 0;
            padding: 0.45rem 0.65rem;
            border-radius: var(--radius-sm);
            border: 1px solid var(--border);
            background: var(--bg);
            color: var(--text);
            font-size: 0.82rem;
        }
        .bot-settings-filter-input:focus {
            outline: none;
            border-color: var(--border-focus);
            box-shadow: 0 0 0 2px rgba(139,92,246,0.15);
        }
        .bot-settings-main-col {
            display: flex;
            flex-direction: column;
            min-height: 0;
            overflow: hidden;
            min-width: 0;
            position: relative;
            z-index: 1;
        }
        .bot-settings-filter-empty {
            margin: 0;
            padding: 1.25rem 1rem;
            text-align: center;
            font-size: 0.85rem;
            color: var(--text-muted);
            flex-shrink: 0;
        }
        .bot-settings-filter-empty[hidden] { display: none !important; }
        .bot-settings-close {
            flex-shrink: 0; width: 2.25rem; height: 2.25rem; border: none; border-radius: var(--radius-sm);
            background: rgba(0,0,0,0.22); color: var(--text-secondary); cursor: pointer; font-size: 1.4rem; line-height: 1;
            display: flex; align-items: center; justify-content: center;
        }
        .bot-settings-close:hover { background: rgba(248,113,113,0.2); color: var(--red); }
        .bot-settings-layout {
            display: grid;
            grid-template-columns: minmax(0, 11rem) 1fr;
            gap: 0;
            min-height: 0;
            flex: 1;
            overflow: hidden;
        }
        @media (max-width: 720px) {
            .bot-settings-layout { grid-template-columns: 1fr; }
        }
        .bot-settings-nav {
            border-right: 1px solid var(--border);
            padding: 0.65rem 0.5rem;
            display: flex; flex-direction: column; gap: 0.25rem;
            background: rgba(0,0,0,0.14);
            overflow-y: auto;
            position: relative;
            z-index: 2;
            isolation: isolate;
        }
        [data-theme="light"] .bot-settings-nav { background: rgba(0,0,0,0.03); }
        .bot-settings-nav button {
            text-align: left; padding: 0.55rem 0.75rem; border-radius: var(--radius-sm);
            border: 1px solid transparent; background: transparent; color: var(--text-secondary);
            font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: background 0.15s, color 0.15s;
            position: relative;
            z-index: 1;
            pointer-events: auto;
        }
        .bot-settings-nav button:hover { color: var(--text); background: var(--surface-hover); }
        .bot-settings-nav button.active { color: #fff; background: var(--accent); border-color: var(--accent); }
        [data-theme="light"] .bot-settings-nav button.active { color: #fff; }
        .bot-settings-panes {
            flex: 1;
            overflow-y: auto;
            padding: 1rem 1.15rem 1.1rem;
            min-height: 0;
        }
        .bot-settings-pane { display: none; animation: fadeIn 0.25s ease; }
        .bot-settings-pane.active { display: block; }
        .bot-settings-pane-head {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 0.65rem;
            margin: 0 0 0.85rem;
            flex-wrap: wrap;
        }
        .bot-settings-pane-head h3 {
            margin: 0;
            font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted);
            flex: 1;
            min-width: 0;
        }
        .bot-settings-section-reset {
            font-size: 0.72rem !important;
            padding: 0.35rem 0.6rem !important;
            flex-shrink: 0;
            white-space: nowrap;
        }
        .bot-settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.65rem 1rem; }
        .bot-settings-field { display: flex; flex-direction: column; gap: 0.28rem; }
        .bot-settings-field label { font-size: 0.72rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
        .bot-settings-field input[type="text"], .bot-settings-field input[type="number"], .bot-settings-field select {
            padding: 0.45rem 0.6rem; border-radius: var(--radius-sm); border: 1px solid var(--border);
            background: var(--bg); color: var(--text); font-family: 'JetBrains Mono', monospace; font-size: 0.8rem;
        }
        .bot-settings-field input:focus, .bot-settings-field select:focus {
            outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 2px rgba(139,92,246,0.15);
        }
        .bot-settings-field--bool {
            flex-direction: row; align-items: center; justify-content: space-between; gap: 0.75rem;
            padding: 0.4rem 0.55rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: rgba(0,0,0,0.12);
        }
        [data-theme="light"] .bot-settings-field--bool { background: rgba(0,0,0,0.02); }
        .bot-settings-field--bool label { text-transform: none; letter-spacing: 0; font-size: 0.82rem; font-weight: 500; color: var(--text); }
        .bot-settings-field--bool input { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); cursor: pointer; }
        .bot-settings-field--error {
            border-radius: var(--radius-sm);
            box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.55);
        }
        .bot-settings-field--error:not(.bot-settings-field--bool) {
            padding: 0.35rem 0.45rem;
            margin: -0.35rem -0.45rem;
        }
        .bot-settings-field--error label { color: var(--red); }
        .bot-settings-foot {
            display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.5rem; justify-content: space-between;
            padding: 0.85rem 1.15rem; border-top: 1px solid var(--border); background: rgba(0,0,0,0.2);
            flex-shrink: 0;
        }
        [data-theme="light"] .bot-settings-foot { background: rgba(0,0,0,0.03); }
        .bot-settings-path { font-size: 0.68rem; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; word-break: break-all; }
        .bot-settings-msg { font-size: 0.78rem; margin: 0; min-height: 1.2em; color: var(--green); }
        .bot-settings-msg.err { color: var(--red); }
        .bot-settings-restart-banner {
            display: flex;
            align-items: flex-start;
            gap: 0.65rem;
            padding: 0.65rem 1.15rem;
            border-top: 1px solid var(--border);
            background: linear-gradient(90deg, rgba(245, 158, 11, 0.14), rgba(245, 158, 11, 0.06));
            border-left: 3px solid rgba(245, 158, 11, 0.85);
            flex-shrink: 0;
        }
        [data-theme="light"] .bot-settings-restart-banner {
            background: linear-gradient(90deg, rgba(217, 119, 6, 0.12), rgba(253, 230, 138, 0.2));
        }
        .bot-settings-restart-banner[hidden] { display: none !important; }
        .bot-settings-restart-banner__text { flex: 1; min-width: 0; }
        .bot-settings-restart-banner__text strong {
            display: block;
            font-size: 0.78rem;
            font-weight: 700;
            color: var(--text);
            margin-bottom: 0.35rem;
            letter-spacing: -0.02em;
        }
        .bot-settings-restart-banner__text p {
            margin: 0;
            font-size: 0.74rem;
            line-height: 1.45;
            color: var(--text-secondary);
        }
        .bot-settings-restart-banner__dismiss {
            flex-shrink: 0;
            width: 1.85rem;
            height: 1.85rem;
            border: none;
            border-radius: var(--radius-sm);
            background: rgba(0,0,0,0.18);
            color: var(--text-secondary);
            font-size: 1.2rem;
            line-height: 1;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .bot-settings-restart-banner__dismiss:hover { background: rgba(0,0,0,0.28); color: var(--text); }
        [data-theme="light"] .bot-settings-restart-banner__dismiss { background: rgba(0,0,0,0.06); }
        .bot-settings-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; }
        .bot-settings-actions button {
            padding: 0.45rem 0.95rem; font-size: 0.78rem; font-weight: 600; border-radius: var(--radius-sm); cursor: pointer; border: 1px solid var(--border);
            background: var(--surface); color: var(--text); transition: background 0.15s, border-color 0.15s;
        }
        .bot-settings-actions button:hover { border-color: var(--border-focus); }
        .bot-settings-actions button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
        .bot-settings-actions button.primary:hover { filter: brightness(1.05); }
        .bot-settings-actions button.danger { border-color: rgba(248,113,113,0.45); color: var(--red); background: rgba(248,113,113,0.08); }
        .bot-settings-io { width: 100%; padding: 0.65rem 1.15rem; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; background: rgba(0,0,0,0.12); flex-shrink: 0; }
        [data-theme="light"] .bot-settings-io { background: rgba(0,0,0,0.03); }
        .bot-settings-io .bot-settings-io-hint { font-size: 0.72rem; color: var(--text-muted); flex: 1 1 100%; margin: 0; line-height: 1.4; }
        .bot-settings-io button.ghost { background: var(--surface); border: 1px solid var(--border); color: var(--text); font-size: 0.78rem; font-weight: 600; padding: 0.4rem 0.85rem; border-radius: var(--radius-sm); cursor: pointer; }
        .bot-settings-io button.ghost:hover { border-color: var(--accent); color: var(--accent); }
        .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.6rem; }
        .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
        @media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
        .card { background: var(--card-gradient); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 0.9rem; transition: all 0.25s ease; box-shadow: var(--shadow); position: relative; overflow: hidden; }
        .card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(167,139,250,0.15), transparent); opacity: 0; transition: opacity 0.25s; }
        .card:hover { border-color: var(--border-focus); box-shadow: var(--shadow-lg); transform: translateY(-2px); }
        .card:hover::before { opacity: 1; }
        .card-label { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.2rem; font-weight: 600; }
        .section-readable-hint {
            margin: 0.15rem 0 0.55rem;
            color: var(--text-secondary);
            font-size: 0.78rem;
            line-height: 1.45;
            max-width: 62rem;
        }
        .card-value { font-family: 'JetBrains Mono', monospace; font-size: 1.1rem; font-weight: 600; color: var(--text); letter-spacing: -0.02em; }
        .card-value.green { color: var(--green); }
        .card-value.red { color: var(--red); }
        .card-value.muted { color: var(--text-muted); }
        .section { margin-bottom: 1.25rem; animation: fadeIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
        .section:nth-child(2) { animation-delay: 0.05s; } .section:nth-child(3) { animation-delay: 0.1s; } .section:nth-child(4) { animation-delay: 0.15s; } .section:nth-child(5) { animation-delay: 0.2s; } .section:nth-child(6) { animation-delay: 0.25s; }
        @keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
        .section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
        .section-title { font-size: 0.95rem; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
        #overviewRecentDecisionsCard,
        #ai #overviewWatchlist,
        #flowLadder,
        #positions {
            width: 100%;
            max-width: none;
        }
        #flowLadder .flow-ladder-subtitle {
            max-width: none !important;
        }
        .chart-wrap { background: var(--card-gradient); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.9rem; min-height: 280px; display: flex; align-items: center; justify-content: center; overflow: hidden; box-shadow: var(--shadow); }
        .chart-wrap.chart-wrap--interactive { align-items: stretch; justify-content: flex-start; padding: 0.5rem 0.6rem; min-height: 420px; }
        [data-theme="light"] .chart-wrap.chart-wrap--interactive { background: #ffffff; border-color: var(--border); }
        .chart-wrap img { max-width: 100%; width: 100%; height: auto; border-radius: var(--radius-sm); display: block; }
        #elliottPlotDiv { width: 100%; min-height: 400px; }
        #elliottLightweight { width: 100%; min-height: 420px; position: relative; }
        /* LWC attribution chip (TradingView); layout.attributionLogo is also false in JS */
        #elliottLightweight a[href*="utm_campaign=lwc-chart"] {
            display: none !important;
        }
        .chart-placeholder { color: var(--text-muted); font-size: 0.9rem; }
        .chart-wrap .chart-placeholder.panel-load { color: var(--text-secondary); }
        .table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card-gradient); box-shadow: var(--shadow); }
        table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
        th, td { padding: 0.5rem 0.8rem; text-align: left; border-bottom: 1px solid var(--border); }
        th { background: var(--bg-elevated); color: var(--text-muted); font-weight: 600; text-transform: uppercase; font-size: 0.65rem; letter-spacing: 0.08em; }
        tr:nth-child(even) td { background: var(--table-stripe); }
        tr:last-child td { border-bottom: none; }
        tr:hover td { background: var(--surface-hover); }
        .side-buy { color: var(--green); font-weight: 500; }
        .side-sell { color: var(--red); font-weight: 500; }
        .trade-leg-open { color: var(--green); font-weight: 500; }
        .trade-leg-closed { color: var(--text-muted); font-weight: 400; }
        /* Elliott sidebar: single dense card, label + value per row (#agentPanel) */
        .chart-sidebar-col .agent-panel {
            width: fit-content;
            max-width: 100%;
        }
        .agent-panel { display: block; }
        .agent-status-shell {
            background: var(--card-gradient);
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            padding: 0.26rem 0.38rem 0.28rem;
            box-shadow: var(--shadow);
            transition: border-color 0.2s, box-shadow 0.2s;
            width: fit-content;
            max-width: 100%;
            box-sizing: border-box;
        }
        .agent-status-shell:hover {
            border-color: var(--border-focus);
        }
        .agent-stat-line {
            display: grid;
            grid-template-columns: max-content max-content;
            align-items: center;
            justify-content: start;
            column-gap: 0.42rem;
            row-gap: 0;
            padding: 0.1rem 0;
            border-bottom: 1px solid rgba(148, 163, 184, 0.12);
            min-height: 0;
        }
        [data-theme="light"] .agent-stat-line {
            border-bottom-color: rgba(15, 23, 42, 0.08);
        }
        .agent-stat-line:last-child {
            border-bottom: none;
            padding-bottom: 0.04rem;
        }
        .agent-stat-line--cb-first {
            margin-top: 0.16rem;
            padding-top: 0.2rem;
            border-top: 1px solid var(--border);
        }
        .agent-stat-label {
            font-size: 0.54rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: var(--text-muted);
            line-height: 1.2;
            min-width: 0;
            padding-right: 0;
        }
        .agent-stat-val {
            font-family: 'JetBrains Mono', monospace;
            font-size: 0.7rem;
            font-weight: 600;
            color: var(--text);
            text-align: left;
            letter-spacing: -0.02em;
            line-height: 1.2;
            word-break: break-word;
            min-width: 0;
        }
        .agent-stat-val--warn {
            color: var(--red);
        }
        .agent-stat-val.muted {
            color: var(--text-muted);
            font-weight: 500;
        }
        .agent-stat-val--posture {
            display: inline-flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 0.28rem 0.35rem;
        }
        .agent-stat-badge {
            display: inline-block;
            line-height: 1.2;
        }
        .agent-stat-badge--posture {
            padding: 0.08rem 0.4rem 0.1rem;
            border-radius: 999px;
            font-size: 0.62rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            background: var(--bg-elevated);
            color: var(--text-secondary);
            border: 1px solid var(--border);
        }
        .agent-stat-inline-meta {
            font-size: 0.64rem;
            font-weight: 500;
            color: var(--text-muted);
            font-family: 'Outfit', system-ui, sans-serif;
        }
        .agent-stat-inline-sep {
            color: var(--text-muted);
            padding: 0 0.12rem;
            font-weight: 600;
        }
        .agent-stat-val--pill {
            padding: 0.08rem 0.36rem 0.1rem;
            border-radius: 999px;
            font-size: 0.62rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            max-width: none;
        }
        .agent-stat-val--cb-closed {
            background: rgba(34, 197, 94, 0.14);
            color: var(--green);
            border: 1px solid rgba(34, 197, 94, 0.28);
        }
        .agent-stat-val--cb-open {
            background: rgba(239, 68, 68, 0.14);
            color: var(--red);
            border: 1px solid rgba(239, 68, 68, 0.32);
        }
        .agent-stat-val--cb-neutral {
            background: var(--bg-elevated);
            color: var(--text-secondary);
            border: 1px solid var(--border);
        }
        [data-theme="light"] .agent-stat-val--cb-closed {
            background: rgba(22, 163, 74, 0.1);
            border-color: rgba(22, 163, 74, 0.22);
        }
        [data-theme="light"] .agent-stat-val--cb-open {
            background: rgba(220, 38, 38, 0.08);
            border-color: rgba(220, 38, 38, 0.22);
        }
        /* Multi-Agent Status: dense strip shrink-wrapped (no full-bleed stretch) */
        #agents .section-header {
            margin-bottom: 0.32rem;
        }
        #agents .agents-status-strip {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            background: var(--card-gradient);
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            padding: 0.22rem 0.38rem 0.26rem;
            box-shadow: var(--shadow);
            width: max-content;
            max-width: 100%;
            box-sizing: border-box;
        }
        #agents .agents-status-flow {
            display: flex;
            flex-direction: column;
            align-items: stretch;
            gap: 0.14rem;
            min-width: 0;
            max-width: 100%;
            box-sizing: border-box;
        }
        #agents .agents-status-strip:hover {
            border-color: var(--border-focus);
        }
        #agents .agents-status-top {
            display: flex;
            flex-wrap: wrap;
            align-items: flex-end;
            justify-content: space-between;
            gap: 0.35rem 0.85rem;
            width: 100%;
            min-width: 0;
            box-sizing: border-box;
        }
        #agents .agents-meta-skills {
            flex: 1 1 auto;
            min-width: 0;
        }
        #agents .agents-meta-label {
            display: block;
            font-size: 0.52rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.07em;
            color: var(--text-muted);
            margin-bottom: 0.1rem;
            line-height: 1.15;
        }
        #agents .agents-skills-cell {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 0.2rem;
            min-height: 1.15rem;
            font-family: 'JetBrains Mono', monospace;
            font-size: 0.68rem;
            font-weight: 500;
            color: var(--text-secondary);
            line-height: 1.2;
        }
        #agents .agents-chip {
            display: inline-flex;
            align-items: center;
            padding: 0.06rem 0.32rem;
            border-radius: 999px;
            background: rgba(139, 92, 246, 0.12);
            border: 1px solid rgba(139, 92, 246, 0.22);
            color: var(--text);
            font-size: 0.64rem;
            font-weight: 600;
            letter-spacing: -0.01em;
        }
        [data-theme="light"] #agents .agents-chip {
            background: rgba(139, 92, 246, 0.08);
            border-color: rgba(139, 92, 246, 0.18);
        }
        #agents .agents-meta-cycle {
            flex: 0 0 auto;
            text-align: right;
        }
        #agents .agents-meta-cycle .agents-cycle-val {
            font-family: 'JetBrains Mono', monospace;
            font-size: 0.78rem;
            font-weight: 700;
            color: var(--text);
            letter-spacing: -0.02em;
            line-height: 1.15;
        }
        #agents .agents-skill-row {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            justify-content: flex-start;
            gap: 0.2rem;
            padding-top: 0.14rem;
            border-top: 1px solid var(--border);
            width: 100%;
            min-width: 0;
            box-sizing: border-box;
        }
        #agents .agents-pill {
            display: inline-flex;
            flex-direction: row;
            align-items: center;
            justify-content: center;
            gap: 0.32rem;
            padding: 0.14rem 0.38rem 0.16rem;
            border-radius: 999px;
            background: var(--bg-elevated);
            border: 1px solid var(--border);
            text-align: left;
            min-height: 0;
            flex: 0 0 auto;
            max-width: 100%;
        }
        #agents .agents-pill:hover {
            border-color: var(--border-focus);
        }
        #agents .agents-pill-label {
            font-size: 0.56rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: var(--text-muted);
            line-height: 1.15;
            white-space: nowrap;
        }
        #agents .agents-pill-value {
            font-family: 'JetBrains Mono', monospace;
            font-size: 0.82rem;
            font-weight: 700;
            line-height: 1;
            letter-spacing: 0;
            flex-shrink: 0;
        }
        #agents .agents-pill-value.muted { color: var(--text-muted); font-weight: 600; font-size: 0.78rem; }
        #agents .agents-pill-value.green { color: var(--green); }
        #agents .agents-pill-value.red { color: var(--red); }
        .chart-sidebar-col .section-header.chart-sidebar-agents-head {
            margin-bottom: 0.3rem;
        }
        /* Agent Status + Bot Mode + Multi-Agent: responsive row (stacks on narrow viewports) */
        .chart-sidebar-status-row {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
            gap: 0.5rem 0.65rem;
            width: 100%;
            align-items: start;
        }
        .chart-sidebar-agent-block,
        .chart-sidebar-bot-mode-block,
        .chart-sidebar-multi-block {
            min-width: 0;
        }
        .chart-sidebar-col .section-header.chart-sidebar-bot-mode-head {
            margin-bottom: 0.2rem;
        }
        .bot-mode-posture-hint {
            margin: 0 0 0.35rem 0;
            font-size: 0.68rem;
            line-height: 1.35;
            color: var(--text-muted);
        }
        .bot-mode-posture-card {
            background: var(--card-gradient);
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            padding: 0.35rem 0.4rem 0.4rem;
            box-shadow: var(--shadow);
            font-size: 0.72rem;
        }
        .bot-mode-posture-muted {
            color: var(--text-muted);
            font-size: 0.7rem;
            line-height: 1.35;
        }
        .bot-mode-posture-main {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 0.35rem 0.45rem;
            margin-bottom: 0.25rem;
        }
        .bot-mode-posture-badge {
            display: inline-block;
            padding: 0.1rem 0.45rem 0.12rem;
            border-radius: 999px;
            font-size: 0.62rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            border: 1px solid transparent;
        }
        .bot-mode-posture-badge--bull {
            background: rgba(34, 197, 94, 0.16);
            color: var(--green);
            border-color: rgba(34, 197, 94, 0.35);
        }
        .bot-mode-posture-badge--caution {
            background: rgba(234, 179, 8, 0.18);
            color: #ca8a04;
            border-color: rgba(234, 179, 8, 0.4);
        }
        [data-theme="light"] .bot-mode-posture-badge--caution {
            color: #a16207;
        }
        .bot-mode-posture-badge--range {
            background: var(--bg-elevated);
            color: var(--text-secondary);
            border-color: var(--border);
        }
        .bot-mode-posture-badge--bear {
            background: rgba(239, 68, 68, 0.14);
            color: var(--red);
            border-color: rgba(239, 68, 68, 0.35);
        }
        .bot-mode-posture-badge--transition {
            background: rgba(168, 85, 247, 0.14);
            color: #c084fc;
            border-color: rgba(168, 85, 247, 0.35);
        }
        .bot-mode-posture-badge--neutral {
            background: var(--bg-elevated);
            color: var(--text-muted);
            border-color: var(--border);
        }
        .bot-mode-posture-meta {
            font-size: 0.64rem;
            color: var(--text-muted);
            font-weight: 500;
        }
        .bot-mode-posture-pending {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 0.25rem 0.35rem;
            margin: 0.15rem 0 0.3rem;
            padding: 0.22rem 0.32rem;
            border-radius: var(--radius-sm);
            background: rgba(148, 163, 184, 0.08);
            border: 1px dashed var(--border);
            font-size: 0.65rem;
        }
        .bot-mode-posture-pending-label {
            color: var(--text-muted);
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            font-size: 0.55rem;
        }
        .bot-mode-posture-intended {
            color: var(--text-muted);
            font-size: 0.6rem;
            margin-left: 0.15rem;
        }
        .bot-mode-posture-row {
            display: grid;
            grid-template-columns: max-content 1fr;
            gap: 0.35rem 0.5rem;
            align-items: baseline;
            padding: 0.08rem 0;
            border-bottom: 1px solid rgba(148, 163, 184, 0.1);
        }
        .bot-mode-posture-row:last-of-type {
            border-bottom: none;
        }
        .bot-mode-posture-k {
            font-size: 0.54rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: var(--text-muted);
        }
        .bot-mode-posture-v {
            font-family: 'JetBrains Mono', monospace;
            font-weight: 600;
            font-size: 0.7rem;
            color: var(--text);
        }
        .bot-mode-posture-chips {
            display: flex;
            flex-wrap: wrap;
            gap: 0.28rem;
            margin-top: 0.28rem;
        }
        .bot-mode-chip {
            font-size: 0.58rem;
            font-weight: 600;
            padding: 0.06rem 0.38rem;
            border-radius: 999px;
            border: 1px solid var(--border);
        }
        .bot-mode-chip--muted {
            background: var(--bg-elevated);
            color: var(--text-muted);
        }
        .bot-mode-chip--accent {
            background: rgba(34, 197, 94, 0.12);
            color: var(--green);
            border-color: rgba(34, 197, 94, 0.3);
        }
        .bot-mode-posture-note {
            margin-top: 0.35rem;
            font-size: 0.63rem;
            line-height: 1.35;
            color: var(--text-secondary);
            word-break: break-word;
            cursor: default;
        }
        .chart-sidebar-col .section-header.chart-sidebar-multi-head {
            margin-bottom: 0.3rem;
        }
        .chart-sidebar-multi-block .section-title {
            font-size: 0.82rem;
            line-height: 1.25;
        }
        .chart-sidebar-agent-block .agent-panel {
            width: 100%;
            max-width: 100%;
        }
        .chart-sidebar-agent-block .agent-status-shell {
            width: 100%;
            max-width: 100%;
            box-sizing: border-box;
        }
        .chart-sidebar-multi-block#agents .agents-status-strip {
            width: 100%;
            max-width: 100%;
            box-sizing: border-box;
        }
        .chart-sidebar-multi-block#agents .agents-status-flow {
            width: 100%;
            max-width: 100%;
            box-sizing: border-box;
        }
        .chart-sidebar-multi-block#agents #agentsLoading.panel-load--bar {
            margin-bottom: 0.35rem;
        }
        .card-target { font-size: 0.6rem; margin-top: 0.15rem; }
        .card-target.ok { color: var(--green); }
        .card-target.warn { color: var(--red); }

        .operator-command-center {
            margin: 0 0 0.7rem;
            padding: 0.72rem;
            border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
            border-radius: var(--radius);
            background:
                radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 34%),
                color-mix(in srgb, var(--surface) 92%, transparent);
            box-shadow: var(--shadow);
        }
        .operator-command-center__head {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 0.75rem;
            margin-bottom: 0.55rem;
        }
        .operator-command-center__eyebrow {
            color: var(--text-muted);
            font-size: 0.58rem;
            font-weight: 800;
            letter-spacing: 0.11em;
            line-height: 1.1;
            text-transform: uppercase;
        }
        .operator-command-center__title {
            margin: 0.1rem 0 0;
            font-size: clamp(1rem, 1.6vw, 1.28rem);
            line-height: 1.15;
            letter-spacing: -0.035em;
        }
        .operator-command-center__overall {
            flex: 0 0 auto;
            display: inline-flex;
            align-items: center;
            gap: 0.38rem;
            max-width: min(100%, 17rem);
            padding: 0.34rem 0.58rem;
            border: 1px solid var(--border);
            border-radius: 999px;
            background: var(--bg-elevated);
            color: var(--text-secondary);
            font-size: 0.72rem;
            font-weight: 800;
            text-align: right;
        }
        .operator-command-center__overall::before {
            content: "";
            width: 0.48rem;
            height: 0.48rem;
            border-radius: 999px;
            background: currentColor;
            box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 12%, transparent);
        }
        .operator-command-center__grid {
            display: grid;
            grid-template-columns: repeat(6, minmax(8.5rem, 1fr));
            gap: 0.45rem;
        }
        .operator-tile {
            min-width: 0;
            padding: 0.58rem 0.62rem;
            border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
            border-radius: calc(var(--radius-sm) + 2px);
            background: color-mix(in srgb, var(--bg-elevated) 84%, transparent);
        }
        .operator-tile__label {
            color: var(--text-muted);
            font-size: 0.56rem;
            font-weight: 800;
            letter-spacing: 0.085em;
            line-height: 1.1;
            text-transform: uppercase;
        }
        .operator-tile__value {
            margin-top: 0.18rem;
            color: var(--text);
            font-size: 0.96rem;
            font-weight: 800;
            letter-spacing: -0.025em;
            line-height: 1.16;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .operator-tile__detail {
            margin-top: 0.14rem;
            color: var(--text-secondary);
            font-size: 0.68rem;
            line-height: 1.22;
            min-height: 1.55em;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .operator-tile[data-state="ok"],
        .operator-command-center__overall[data-state="ok"] {
            border-color: color-mix(in srgb, var(--green) 38%, var(--border));
            color: var(--green);
        }
        .operator-tile[data-state="info"],
        .operator-command-center__overall[data-state="info"] {
            border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
            color: var(--accent);
        }
        .operator-tile[data-state="warn"],
        .operator-command-center__overall[data-state="warn"] {
            border-color: color-mix(in srgb, #f59e0b 52%, var(--border));
            color: #f59e0b;
        }
        .operator-tile[data-state="danger"],
        .operator-command-center__overall[data-state="danger"] {
            border-color: color-mix(in srgb, var(--red) 56%, var(--border));
            color: var(--red);
        }
        .operator-tile[data-state="muted"],
        .operator-command-center__overall[data-state="muted"] {
            color: var(--text-muted);
        }
        .operator-tile[data-state="ok"],
        .operator-tile[data-state="info"],
        .operator-tile[data-state="warn"],
        .operator-tile[data-state="danger"] {
            background:
                linear-gradient(180deg, color-mix(in srgb, currentColor 9%, transparent), transparent 72%),
                color-mix(in srgb, var(--bg-elevated) 88%, transparent);
        }
        @media (max-width: 1280px) {
            .operator-command-center__grid {
                grid-template-columns: repeat(3, minmax(9rem, 1fr));
            }
            .operator-tile--wide { grid-column: span 2; }
        }
        @media (max-width: 760px) {
            .operator-command-center__head {
                flex-direction: column;
                align-items: stretch;
            }
            .operator-command-center__overall {
                justify-content: flex-start;
                text-align: left;
            }
            .operator-command-center__grid {
                grid-template-columns: 1fr;
            }
            .operator-tile--wide { grid-column: auto; }
        }

        /* Overview: compact strip — label / value never share one line (avoids overlap) */
        #overview .overview-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(118px, max-content));
            gap: 0.28rem;
            justify-content: start;
            align-items: start;
        }
        #overview .overview-closed-runtime-row {
            display: flex;
            flex-wrap: wrap;
            align-items: flex-start;
            gap: 0.5rem 1rem;
            margin-top: 0.28rem;
            width: 100%;
            max-width: 100%;
            box-sizing: border-box;
        }
        #overview .overview-closed-runtime-row__card {
            flex: 0 0 auto;
        }
        #overview .overview-closed-runtime-row__status {
            flex: 1 1 min(100%, 22rem);
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 0.45rem 0.65rem;
            justify-content: flex-end;
            margin-left: auto;
            min-width: 0;
        }
        #overview .overview-closed-runtime-row__status .runtime-strategy-status { max-width: min(100%, 18rem); }
        @media (max-width: 720px) {
            #overview .overview-closed-runtime-row__status {
                justify-content: flex-start;
                margin-left: 0;
                width: 100%;
            }
        }
        #overview .overview-card {
            display: flex;
            flex-direction: column;
            gap: 0.06rem;
            min-width: 0;
            max-width: min(100%, 22rem);
            padding: 0.2rem 0.34rem 0.22rem;
            border-radius: calc(var(--radius-sm) - 2px);
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
        }
        [data-theme="light"] #overview .overview-card {
            box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
        }
        #overview .overview-card:hover {
            transform: translateY(-1px);
        }
        #overview .overview-card .card-label {
            margin-bottom: 0;
            font-size: 0.52rem;
            letter-spacing: 0.055em;
            line-height: 1.12;
            white-space: normal;
            word-break: break-word;
        }
        #overview .overview-card__main {
            display: flex;
            flex-wrap: wrap;
            align-items: baseline;
            justify-content: flex-start;
            gap: 0.1rem 0.28rem;
            min-width: 0;
        }
        #overview .overview-card__main > .card-value {
            font-size: 0.76rem;
            line-height: 1.18;
            min-width: 0;
            flex: 0 1 auto;
            word-break: break-word;
        }
        #overview .overview-card__main > .card-value:only-child {
            flex: 1 1 100%;
            width: 100%;
        }
        #overview .overview-card__main.overview-card__balance {
            flex-direction: column;
            align-items: flex-start;
            gap: 0.12rem;
        }
        #overview .balance-source {
            font-size: 0.62rem;
            line-height: 1.25;
            color: var(--text-muted);
            font-weight: 500;
            max-width: 100%;
            word-break: break-word;
        }
        #overview .balance-source[data-source="live_exchange"] { color: var(--red-dim); }
        #overview .balance-source[data-source="classic_paper"] { color: #60a5fa; }
        #overview .balance-source[data-source="ai_paper"] { color: #c084fc; }
        #overview .balance-source[data-source="dashboard_paper_fallback"] { color: #38bdf8; }
        #overview .balance-source[data-source="mock_demo"] { color: var(--text-secondary); }
        #overview .overview-diagnostics-row {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
            gap: 0.55rem;
            margin-top: 0.65rem;
            width: 100%;
        }
        #overview .overview-diagnostics-card .overview-diagnostics-body {
            font-size: 0.78rem;
            line-height: 1.38;
            word-break: break-word;
            color: var(--text-secondary);
            max-height: 5.5rem;
            overflow-y: auto;
        }
        #overview .overview-recent-decisions-card {
            margin-top: 0.65rem;
            width: 100%;
            max-width: 100%;
            box-sizing: border-box;
        }
        #overview .overview-recent-decisions-controls {
            display: flex;
            flex-wrap: wrap;
            gap: 0.4rem;
            margin: 0.35rem 0 0.5rem;
        }
        #overview .overview-recent-decisions-controls select,
        #overview .overview-recent-decisions-controls input,
        #overview .overview-recent-decisions-controls button {
            font-size: 0.74rem;
            line-height: 1.2;
            padding: 0.28rem 0.4rem;
            border-radius: 6px;
            border: 1px solid var(--border);
            background: var(--surface, transparent);
            color: var(--text);
        }
        #overview .overview-recent-decisions-controls button {
            cursor: pointer;
        }
        #overview .overview-recent-decisions-rejects {
            font-size: 0.75rem;
            color: var(--text-secondary);
            margin-bottom: 0.45rem;
            word-break: break-word;
        }
        #overview .recent-reject-trend-badge {
            margin-left: 0.45rem;
            padding: 0.08rem 0.35rem;
            border-radius: 999px;
            border: 1px solid var(--border);
            font-size: 0.68rem;
            color: var(--text-secondary);
            background: var(--surface, transparent);
            white-space: nowrap;
        }
        #overview .recent-reject-trend-badge.up {
            color: #ef4444;
            border-color: rgba(239, 68, 68, 0.45);
            background: rgba(239, 68, 68, 0.12);
        }
        #overview .recent-reject-trend-badge.down {
            color: #22c55e;
            border-color: rgba(34, 197, 94, 0.45);
            background: rgba(34, 197, 94, 0.12);
        }
        #overview .recent-reject-trend-badge.flat {
            color: var(--text-secondary);
        }
        #overview .overview-recent-decisions-wrap {
            max-height: 24rem;
            overflow: auto;
        }
        #overview .overview-recent-decisions-footer {
            margin-top: 0.45rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
            justify-content: flex-end;
        }
        #overview .recent-decisions-loaded-count {
            font-size: 0.72rem;
            color: var(--text-secondary);
        }
        #overview #recentDecisionsNewBadgeBtn {
            font-size: 0.71rem;
            padding: 0.24rem 0.52rem;
            border-radius: 999px;
            border: 1px solid rgba(56, 189, 248, 0.45);
            background: rgba(56, 189, 248, 0.16);
            color: #38bdf8;
            cursor: pointer;
        }
        #overview #recentDecisionsMoreBtn {
            font-size: 0.73rem;
            padding: 0.28rem 0.55rem;
            border-radius: 6px;
            border: 1px solid var(--border);
            background: var(--surface, transparent);
            color: var(--text);
            cursor: pointer;
        }
        #overview #recentDecisionsMoreBtn:disabled {
            opacity: 0.6;
            cursor: default;
        }
        #overview .overview-recent-decisions-table {
            width: 100%;
            min-width: 860px;
            border-collapse: collapse;
            font-size: 0.82rem;
        }
        #overview .overview-recent-decisions-table th,
        #overview .overview-recent-decisions-table td {
            border-bottom: 1px solid var(--border);
            padding: 0.48rem 0.56rem;
            text-align: left;
            vertical-align: middle;
        }
        #overview .overview-recent-decisions-table th {
            color: var(--text-secondary);
            font-weight: 600;
            position: sticky;
            top: 0;
            background: var(--surface, transparent);
            z-index: 1;
        }
        #overview .overview-recent-decisions-table td.col-reason {
            color: var(--text-secondary);
            word-break: break-word;
            line-height: 1.4;
            min-width: 10rem;
        }
        #overview .overview-recent-decisions-table td.col-note {
            color: var(--text-secondary);
            word-break: break-word;
            line-height: 1.35;
            min-width: 12rem;
            font-size: 0.78rem;
        }
        /* Recent decisions — wide readable layout once card is unconstrained */
        #overview .overview-recent-decisions-table th:nth-child(5),
        #overview .overview-recent-decisions-table td:nth-child(5) {
            width: auto;
            min-width: min(28vw, 18rem);
        }
        #overview .overview-recent-decisions-table th:nth-child(6),
        #overview .overview-recent-decisions-table td:nth-child(6) {
            width: auto;
            min-width: min(36vw, 22rem);
        }
        .recent-decision-time,
        .recent-decision-symbol {
            font-family: 'JetBrains Mono', ui-monospace, monospace;
            white-space: nowrap;
        }
        .recent-decision-symbol {
            font-weight: 700;
            color: var(--text);
        }
        .recent-decision-mode,
        .recent-decision-pill,
        .position-mode-pill,
        .position-side-pill,
        .watchlist-signal-pill,
        .watchlist-conf-pill {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 999px;
            border: 1px solid var(--border);
            padding: 0.16rem 0.46rem;
            font-size: 0.72rem;
            font-weight: 700;
            line-height: 1.2;
            white-space: nowrap;
            background: color-mix(in srgb, var(--surface) 84%, transparent);
        }
        .recent-decision-pill--buy { color: var(--green); border-color: var(--green-dim); background: rgba(34,197,94,0.12); }
        .recent-decision-pill--sell { color: var(--red); border-color: var(--red-dim); background: rgba(248,113,113,0.12); }
        .recent-decision-pill--reject { color: #f59e0b; border-color: rgba(245,158,11,0.45); background: rgba(245,158,11,0.12); }
        .recent-decision-pill--hold { color: #38bdf8; border-color: rgba(56,189,248,0.45); background: rgba(56,189,248,0.12); }
        .recent-decision-pill--neutral { color: var(--text-secondary); }
        /* Binance API control: same overview metric card shell as Total PnL / Closed Trades (not header pill) */
        #overview .overview-grid .overview-binance-card.ai-connection-btn {
            display: flex;
            flex-direction: column;
            align-items: stretch;
            justify-content: flex-start;
            gap: 0.06rem;
            text-align: left;
            font: inherit;
            color: inherit;
            appearance: none;
            -webkit-appearance: none;
            border-radius: calc(var(--radius-sm) - 2px);
            padding: 0.2rem 0.34rem 0.22rem;
            cursor: pointer;
        }
        #overview .overview-grid .overview-binance-card.ai-connection-btn:focus-visible {
            outline: 2px solid var(--border-focus, var(--accent));
            outline-offset: 2px;
        }
        #overview .overview-binance-card__main {
            align-items: center;
            flex-wrap: nowrap;
            gap: 0.35rem;
        }
        #overview .overview-target-pill {
            margin-top: 0;
            line-height: 1.15;
            flex: 0 1 auto;
            max-width: 100%;
            text-align: right;
            white-space: normal;
            word-break: break-word;
            font-weight: 600;
            font-size: 0.52rem;
            padding: 0.06rem 0.28rem;
            border-radius: 999px;
            border: 1px solid transparent;
        }
        #overview .card-target.overview-target-pill.ok {
            color: var(--green);
            background: rgba(74, 222, 128, 0.1);
            border-color: rgba(74, 222, 128, 0.22);
        }
        [data-theme="light"] #overview .card-target.overview-target-pill.ok {
            background: rgba(22, 163, 74, 0.1);
            border-color: rgba(22, 163, 74, 0.2);
        }
        #overview .card-target.overview-target-pill.warn {
            color: var(--red);
            background: rgba(248, 113, 113, 0.12);
            border-color: rgba(248, 113, 113, 0.25);
        }
        [data-theme="light"] #overview .card-target.overview-target-pill.warn {
            background: rgba(220, 38, 38, 0.08);
            border-color: rgba(220, 38, 38, 0.22);
        }
        #overview .overview-metrics-note {
            margin-top: 0.25rem;
            font-size: 0.62rem;
            color: var(--text-muted);
            line-height: 1.3;
        }
        #overview .section-header {
            margin-bottom: 0.28rem;
        }
        /* Bot watchlist: same surface as AI status cards (#ai #overviewWatchlist.card) */
        #ai #overviewWatchlist .overview-watchlist-main {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 0.22rem 0.28rem;
            min-width: 0;
            line-height: 1.2;
        }
        #ai #overviewWatchlist .overview-watchlist-main .overview-watchlist-empty {
            color: var(--text-muted);
            font-weight: 500;
            font-size: 0.82rem;
        }
        .overview-watchlist-sym {
            display: inline-flex;
            padding: 0.05rem 0.3rem;
            border-radius: 5px;
            background: rgba(139, 92, 246, 0.12);
            border: 1px solid rgba(139, 92, 246, 0.22);
            font-family: 'JetBrains Mono', monospace;
            font-weight: 600;
            font-size: 0.66rem;
            color: var(--text);
            line-height: 1.2;
        }
        [data-theme="light"] .overview-watchlist-sym {
            background: rgba(139, 92, 246, 0.08);
        }
        .overview-watchlist-tf {
            font-family: 'JetBrains Mono', monospace;
            font-weight: 600;
            color: var(--text);
            font-size: 0.7rem;
            line-height: 1.2;
        }
        .overview-watchlist-mtf {
            font-family: 'JetBrains Mono', monospace;
            font-size: 0.64rem;
            color: var(--text-secondary);
            line-height: 1.28;
            word-break: break-word;
        }
        /* AI Mode: status cards row; Bot watchlist is full-width below */
        #ai .ai-status-watchlist-row {
            display: block;
            margin-bottom: 0.55rem;
        }
        #ai .ai-operator-controls {
            display: flex;
            align-items: center;
            gap: 0.4rem;
            margin: 0.22rem 0 0.45rem;
            flex-wrap: wrap;
        }
        #ai .ai-operator-controls .chart-refresh-btn {
            min-width: 5.3rem;
            height: 1.8rem;
            padding: 0 0.55rem;
            font-size: 0.72rem;
        }
        #ai .ai-operator-select {
            height: 1.8rem;
            min-width: 4.2rem;
            padding: 0 0.45rem;
            border-radius: 6px;
            border: 1px solid var(--border, rgba(128, 128, 128, 0.25));
            background: var(--surface, rgba(255, 255, 255, 0.04));
            color: var(--text, inherit);
            font-size: 0.72rem;
        }
        #ai .ai-operator-quick {
            display: inline-flex;
            align-items: center;
            gap: 0.22rem;
        }
        #ai .ai-operator-chip.chart-refresh-btn {
            min-width: 2.6rem;
            padding: 0 0.4rem;
            opacity: 0.92;
        }
        #ai .ai-operator-status {
            font-size: 0.68rem;
            color: var(--text-muted);
            line-height: 1.25;
        }
        #ai .ai-operator-feedback {
            font-size: 0.68rem;
            color: var(--text-muted);
            line-height: 1.25;
            max-width: min(42rem, 100%);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        #ai .ai-operator-feedback.ai-operator-feedback--ok {
            color: var(--accent-ok, #2fa36b);
        }
        #ai .ai-operator-feedback.ai-operator-feedback--error {
            color: var(--accent-danger, #d85a5a);
        }
        #ai .ai-operator-feedback.ai-operator-feedback--info {
            color: var(--accent, #4f8bff);
        }
        #ai .ai-operator-status.ai-operator-status--paused {
            color: var(--accent-warn, #c9a227);
        }
        #ai .ai-pipeline-strip {
            padding: 0.45rem 0.55rem 0.5rem;
            margin-bottom: 0.45rem;
            border-radius: var(--radius-sm);
            border: 1px solid var(--border, rgba(128, 128, 128, 0.22));
            background: var(--surface-alt, rgba(0, 0, 0, 0.12));
        }
        #ai .ai-pipeline-head {
            display: flex;
            align-items: baseline;
            justify-content: space-between;
            gap: 0.5rem;
            margin-bottom: 0.35rem;
        }
        #ai .ai-pipeline-title {
            font-size: 0.62rem;
            letter-spacing: 0.07em;
            text-transform: uppercase;
            color: var(--text-muted);
            font-weight: 600;
        }
        #ai .ai-pipeline-meta {
            font-size: 0.62rem;
            color: var(--text-muted);
            font-family: 'JetBrains Mono', ui-monospace, monospace;
        }
        #ai .ai-pipeline-meta.ai-pipeline-stale {
            color: var(--accent-warn, #c9a227);
        }
        #ai .ai-pipeline-steps {
            display: flex;
            flex-wrap: wrap;
            align-items: stretch;
            gap: 0.28rem 0.35rem;
        }
        #ai .ai-pipeline-step {
            font-size: 0.65rem;
            line-height: 1.2;
            padding: 0.2rem 0.38rem;
            border-radius: 4px;
            border: 1px solid var(--border, rgba(128, 128, 128, 0.25));
            background: var(--surface, rgba(255, 255, 255, 0.03));
            color: var(--text-secondary);
            white-space: nowrap;
            max-width: 100%;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        #ai .ai-pipeline-step--done {
            opacity: 0.55;
            border-style: dashed;
        }
        #ai .ai-pipeline-step--active {
            border-color: var(--accent, #3d8bfd);
            box-shadow: 0 0 0 1px rgba(61, 139, 253, 0.25);
            color: var(--text, inherit);
            font-weight: 600;
        }
        #ai .ai-pipeline-step--pending {
            opacity: 0.42;
        }
        #ai .ai-pipeline-detail {
            margin-top: 0.3rem;
            font-size: 0.66rem;
            color: var(--text-muted);
            line-height: 1.35;
            word-break: break-word;
        }
        #ai .ai-pipeline-unavailable {
            font-size: 0.68rem;
            color: var(--text-muted);
            padding: 0.15rem 0;
        }
        #ai .ai-status-panels-wrap {
            min-width: 0;
        }
        /* AI Mode: dense status strip — same content/IDs, tighter padding & type */
        #ai .ai-status-panels {
            gap: 0.42rem;
            grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
        }
        #ai .ai-status-panels .card,
        #ai #overviewWatchlist.card.watchlist-signals-card {
            padding: 0.38rem 0.5rem;
            border-radius: var(--radius-sm);
            min-width: 0;
        }
        #ai #overviewWatchlist.card.watchlist-signals-card {
            width: fit-content;
            max-width: 100%;
            padding: 0.48rem 0.58rem 0.58rem;
            margin-top: 0.35rem;
        }
        #ai .ai-status-panels .card:hover,
        #ai #overviewWatchlist.card.watchlist-signals-card:hover {
            transform: translateY(-1px);
        }
        #ai .ai-error-card {
            cursor: pointer;
        }
        #ai .ai-error-card.ai-error-card--active {
            box-shadow: 0 0 0 1px rgba(79, 139, 255, 0.45);
            border-color: rgba(79, 139, 255, 0.55);
        }
        #ai .ai-status-panels .card-label,
        #ai #overviewWatchlist .card-label {
            font-size: 0.58rem;
            margin-bottom: 0.08rem;
            letter-spacing: 0.06em;
            line-height: 1.15;
        }
        #ai .ai-status-panels .card-value,
        #ai #overviewWatchlist .card-value {
            font-size: 0.82rem;
            line-height: 1.2;
            word-break: break-word;
        }
        #ai .ai-panel-detail,
        #ai #overviewWatchlist .ai-panel-detail {
            font-size: 0.68rem;
            color: var(--text-muted);
            margin-top: 0.12rem;
            line-height: 1.28;
        }
        .ai-alerts-filter-hint {
            margin-left: 0.45rem;
            font-size: 0.72rem;
            color: var(--text-muted);
        }
        #aiAlertsBody .ai-alert-row { cursor: pointer; }
        #aiAlertsBody .ai-alert-row:hover { background: var(--surface-alt, rgba(255,255,255,0.03)); }
        #aiAlertsBody .ai-alert-row:focus { outline: 1px solid var(--border-focus, #4f8bff); outline-offset: -1px; }
        .ai-alert-detail-kv {
            margin: 0 0 0.7rem;
            display: grid;
            grid-template-columns: minmax(6rem, 20%) 1fr;
            gap: 0.35rem 0.75rem;
            font-size: 0.8rem;
        }
        .ai-alert-detail-kv dt {
            margin: 0;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.04em;
            font-size: 0.68rem;
            font-weight: 600;
        }
        .ai-alert-detail-kv dd { margin: 0; color: var(--text); word-break: break-word; }
        .ai-alert-detail-pre {
            margin: 0.35rem 0 0;
            max-height: 48vh;
            overflow: auto;
            padding: 0.62rem 0.7rem;
            border-radius: var(--radius-sm);
            border: 1px solid var(--border);
            background: var(--bg-soft, rgba(0,0,0,0.22));
            font-size: 0.74rem;
            line-height: 1.38;
            color: var(--text);
            white-space: pre-wrap;
        }
        .ai-alert-remediation {
            margin: 0.2rem 0 0.45rem;
            padding: 0.55rem 0.65rem;
            border-radius: var(--radius-sm);
            border: 1px solid var(--border-focus, rgba(79, 139, 255, 0.45));
            background: rgba(79, 139, 255, 0.08);
            color: var(--text);
            font-size: 0.78rem;
            line-height: 1.4;
        }
        .ai-alert-remediation strong {
            display: block;
            font-size: 0.7rem;
            color: var(--text-secondary);
            letter-spacing: 0.04em;
            text-transform: uppercase;
            margin-bottom: 0.2rem;
        }
        .ai-alert-remediation-actions {
            margin-top: 0.45rem;
            display: flex;
            flex-wrap: wrap;
            gap: 0.36rem;
        }
        .ai-alert-remediation-btn {
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            background: var(--surface);
            color: var(--text);
            font-size: 0.72rem;
            padding: 0.24rem 0.46rem;
            cursor: pointer;
        }
        .ai-alert-remediation-btn:hover {
            border-color: var(--border-focus);
            color: var(--accent);
        }
        #ai #overviewWatchlist .ai-panel-detail + .ai-panel-detail {
            margin-top: 0.2rem;
        }
        .watchlist-signals-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.45rem;
            flex-wrap: wrap;
            margin-bottom: 0.28rem;
        }
        .watchlist-update-hint {
            font-size: 0.68rem;
            color: var(--text-muted);
            font-family: 'JetBrains Mono', ui-monospace, monospace;
        }
        .watchlist-meta {
            font-size: 0.68rem;
            color: var(--text-secondary);
            margin-bottom: 0.32rem;
            line-height: 1.32;
            max-width: min(40rem, 100%);
        }
        .watchlist-table-wrap {
            max-height: min(380px, 48vh);
            overflow: auto;
            border-radius: var(--radius-sm);
            border: 1px solid var(--border);
            background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
            width: max-content;
            max-width: 100%;
        }
        .watchlist-signals-table {
            width: max-content;
            max-width: 100%;
            min-width: 0;
            border-collapse: collapse;
            font-size: 0.76rem;
        }
        .watchlist-signals-table th {
            text-align: left;
            padding: 0.28rem 0.38rem;
            position: sticky;
            top: 0;
            background: color-mix(in srgb, var(--surface) 92%, var(--accent) 4%);
            border-bottom: 1px solid var(--border);
            font-weight: 600;
            color: var(--text-secondary);
            white-space: nowrap;
            z-index: 1;
            font-size: 0.65rem;
            letter-spacing: 0.02em;
        }
        .watchlist-signals-table td {
            padding: 0.32rem 0.4rem;
            border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
            vertical-align: middle;
        }
        .watchlist-signals-table tbody tr {
            cursor: pointer;
            transition: background 0.15s;
        }
        .watchlist-signals-table tbody tr:nth-child(even) {
            background: var(--table-stripe);
        }
        .watchlist-signals-table tbody tr:hover {
            background: color-mix(in srgb, var(--accent) 8%, var(--surface));
        }
        .watchlist-cell-main {
            min-width: 5.75rem;
            max-width: 9rem;
        }
        .watchlist-cell-sym {
            display: block;
            font-family: 'JetBrains Mono', ui-monospace, monospace;
            font-weight: 800;
            font-size: 0.76rem;
            color: var(--text);
        }
        .watchlist-cell-sub {
            display: block;
            margin-top: 0.08rem;
            color: var(--text-muted);
            font-size: 0.66rem;
        }
        .watchlist-cell-reason {
            max-width: 14rem;
            word-break: break-word;
            color: var(--text-secondary);
            line-height: 1.35;
        }
        .watchlist-cell-levels {
            font-family: 'JetBrains Mono', ui-monospace, monospace;
            font-size: 0.68rem;
            color: var(--text-muted);
            white-space: nowrap;
        }
        .watchlist-cell-time {
            font-size: 0.66rem;
            color: var(--text-muted);
            white-space: nowrap;
        }
        .watchlist-status-pill {
            display: inline-flex;
            align-items: center;
            border-radius: 999px;
            border: 1px solid var(--border);
            padding: 0.1rem 0.36rem;
            font-size: 0.66rem;
            font-weight: 600;
            white-space: nowrap;
        }
        .watchlist-status-pill--open { color: var(--green); border-color: var(--green-dim); background: rgba(34,197,94,0.12); }
        .watchlist-status-pill--generated { color: #f59e0b; border-color: rgba(245,158,11,0.45); background: rgba(245,158,11,0.12); }
        .watchlist-status-pill--rejected { color: var(--red); border-color: var(--red-dim); background: rgba(248,113,113,0.12); }
        .watchlist-status-pill--missed,
        .watchlist-status-pill--closed,
        .watchlist-status-pill--neutral { color: var(--text-secondary); }
        /* Compact Bot watchlist: symbol subline already carries Signal & Conf%. */
        #ai #overviewWatchlist .watchlist-signal-pill,
        #ai #overviewWatchlist .watchlist-conf-pill {
            padding: 0.08rem 0.32rem;
            font-size: 0.65rem;
        }
        #ai #overviewWatchlist .section-readable-hint {
            font-size: 0.74rem;
            line-height: 1.4;
            margin: 0.12rem 0 0.35rem;
            max-width: min(38rem, 100%);
        }
        #ai #overviewWatchlist #dayTradingMetricsPanel {
            margin-top: 0.3rem !important;
            padding: 0.38rem 0.48rem !important;
            font-size: 0.72rem !important;
            line-height: 1.38 !important;
        }
        #ai #overviewWatchlist .watchlist-signals-table thead th:nth-child(2),
        #ai #overviewWatchlist .watchlist-signals-table thead th:nth-child(3),
        #ai #overviewWatchlist .watchlist-signals-table tbody td:nth-child(2),
        #ai #overviewWatchlist .watchlist-signals-table tbody td:nth-child(3) {
            display: none;
        }
        @media (max-width: 900px) {
            #ai #overviewWatchlist .watchlist-table-wrap {
                max-height: min(320px, 50vh);
                overflow: auto;
                border: 1px solid var(--border);
                background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
                width: max-content;
                max-width: 100%;
            }
            #ai #overviewWatchlist .watchlist-signals-table {
                display: table;
                width: max-content;
                max-width: 100%;
                min-width: 0;
            }
            #ai #overviewWatchlist .watchlist-signals-table thead {
                display: table-header-group;
            }
            #ai #overviewWatchlist .watchlist-signals-table tbody {
                display: table-row-group;
            }
            #ai #overviewWatchlist .watchlist-signals-table tr {
                display: table-row;
                width: auto;
                margin-bottom: 0;
                border: 0;
                border-radius: 0;
                background: transparent;
                overflow: visible;
            }
            #ai #overviewWatchlist .watchlist-signals-table td {
                display: table-cell;
                width: auto;
                padding: 0.28rem 0.36rem;
                vertical-align: middle;
                border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
            }
            #ai #overviewWatchlist .watchlist-signals-table td::before {
                content: none;
            }
            #ai #overviewWatchlist .watchlist-cell-main {
                min-width: 5.5rem;
                max-width: 8rem;
            }
            #ai #overviewWatchlist .watchlist-cell-reason {
                max-width: 10rem;
            }
        }
        #watchlistSignalModal .watchlist-modal-pre {
            font-family: 'JetBrains Mono', ui-monospace, monospace;
            font-size: 0.68rem;
            line-height: 1.35;
            background: var(--bg-elevated);
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            padding: 0.55rem 0.65rem;
            overflow: auto;
            max-height: 200px;
            margin: 0.35rem 0 0.65rem;
            color: var(--text-secondary);
        }
        #watchlistSignalModal .watchlist-modal-chart {
            width: 100%;
            max-height: 320px;
            object-fit: contain;
            border-radius: var(--radius-sm);
            border: 1px solid var(--border);
            background: var(--bg);
            margin-top: 0.35rem;
        }
        .links { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); font-size: 0.75rem; color: var(--text-muted); }
        .links a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
        .links a:hover { color: var(--accent-strong); text-decoration: underline; }
        .empty-state { padding: 1.5rem; text-align: center; color: var(--text-muted); font-size: 0.85rem; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
        .empty-state.is-warning,
        .empty-state.is-error {
            text-align: left;
            color: var(--text-secondary);
            background:
                linear-gradient(180deg, color-mix(in srgb, currentColor 7%, transparent), transparent 78%),
                var(--surface);
        }
        .empty-state.is-warning {
            color: #f59e0b;
            border-color: color-mix(in srgb, #f59e0b 58%, var(--border));
        }
        .empty-state.is-error {
            color: var(--red);
            border-color: color-mix(in srgb, var(--red) 58%, var(--border));
        }
        .empty-state__title {
            display: block;
            color: var(--text);
            font-weight: 800;
            line-height: 1.25;
        }
        .empty-state__detail {
            display: block;
            margin-top: 0.25rem;
            color: var(--text-secondary);
            line-height: 1.35;
        }

        /* Compact panel loaders (match boot overlay aesthetic) */
        .panel-load {
            display: inline-flex;
            align-items: center;
            gap: 0.55rem;
            color: var(--text-secondary);
            font-size: 0.78rem;
            font-weight: 500;
        }
        .panel-load--center {
            flex-direction: column;
            justify-content: center;
            text-align: center;
            gap: 0.5rem;
            width: 100%;
        }
        .panel-load--row {
            flex-direction: row;
            justify-content: center;
        }
        .panel-load--bar {
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 0.65rem 1rem;
            margin-bottom: 0.5rem;
            background: color-mix(in srgb, var(--surface) 92%, transparent);
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
        }
        .panel-load--ribbon {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.38rem 0.75rem;
            margin-bottom: 0.55rem;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            font-size: 0.78rem;
        }
        .panel-load--veil {
            position: absolute;
            inset: 0;
            z-index: 4;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            gap: 0.45rem;
            min-height: 140px;
            margin: 0;
            padding: 1rem;
            background: color-mix(in srgb, var(--bg) 78%, transparent);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            border-radius: var(--radius);
            border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
        }
        .section-deferred-wrap { position: relative; }
        .panel-load__graphic {
            position: relative;
            width: 22px;
            height: 22px;
            flex-shrink: 0;
        }
        .panel-load__orbit {
            position: absolute;
            inset: 0;
            border-radius: 50%;
            border: 2px solid transparent;
            border-top-color: var(--accent);
            border-right-color: color-mix(in srgb, var(--accent) 40%, transparent);
            animation: panelLoadSpin 0.95s linear infinite;
        }
        .panel-load__bars {
            position: absolute;
            left: 50%;
            bottom: 2px;
            transform: translateX(-50%);
            display: flex;
            align-items: flex-end;
            gap: 2px;
            height: 10px;
        }
        .panel-load__bars span {
            display: block;
            width: 2px;
            border-radius: 1px;
            background: linear-gradient(180deg, var(--accent), var(--accent-strong));
            transform-origin: bottom center;
            animation: panelLoadBar 0.75s ease-in-out infinite;
        }
        .panel-load__bars span:nth-child(1) { height: 40%; animation-delay: 0s; }
        .panel-load__bars span:nth-child(2) { height: 70%; animation-delay: 0.1s; }
        .panel-load__bars span:nth-child(3) { height: 100%; animation-delay: 0.2s; }
        .panel-load__bars span:nth-child(4) { height: 55%; animation-delay: 0.3s; }
        .panel-load__label { line-height: 1.35; }
        .panel-load--veil .panel-load__graphic { width: 28px; height: 28px; }
        .panel-load--veil .panel-load__bars { height: 12px; }
        .panel-load--veil .panel-load__bars span { width: 3px; }
        .inline-load {
            display: inline-flex;
            align-items: center;
            gap: 0.22rem;
            vertical-align: middle;
            color: var(--text-muted);
        }
        .inline-load__dot {
            width: 0.34rem;
            height: 0.34rem;
            border-radius: 999px;
            background: linear-gradient(135deg, var(--accent), var(--accent-strong));
            box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 30%, transparent);
            animation: inlineLoadPulse 0.9s ease-in-out infinite;
        }
        .inline-load__dot:nth-child(2) { animation-delay: 0.12s; }
        .inline-load__dot:nth-child(3) { animation-delay: 0.24s; }
        .inline-load__sr {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            white-space: nowrap;
            border: 0;
        }
        .panel-load--table {
            margin: 0.55rem 0;
        }
        .table-load-cell {
            padding: 1rem 0.75rem !important;
            text-align: center !important;
            color: var(--text-secondary);
        }
        @keyframes panelLoadSpin { to { transform: rotate(360deg); } }
        @keyframes panelLoadBar {
            0%, 100% { transform: scaleY(0.5); opacity: 0.65; }
            50% { transform: scaleY(1); opacity: 1; }
        }
        @keyframes inlineLoadPulse {
            0%, 100% { transform: translateY(0) scale(0.78); opacity: 0.55; }
            50% { transform: translateY(-1px) scale(1); opacity: 1; }
        }
        @media (prefers-reduced-motion: reduce) {
            .panel-load__orbit, .panel-load__bars span, .inline-load__dot { animation: none !important; }
            .panel-load__bars span:nth-child(1) { height: 45%; }
            .panel-load__bars span:nth-child(2) { height: 65%; }
            .panel-load__bars span:nth-child(3) { height: 85%; }
            .panel-load__bars span:nth-child(4) { height: 55%; }
        }
        .whale-heatmap-panel {
            margin-top: 0.55rem;
            padding: 0.4rem 0.5rem 0.28rem;
            background: var(--bg-elevated);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset;
        }
        .whale-heatmap-head {
            display: flex;
            align-items: baseline;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 0.18rem 0.5rem;
            margin-bottom: 0.2rem;
        }
        .whale-heatmap-title { font-size: 0.72rem; font-weight: 600; color: var(--text-secondary); letter-spacing: 0.02em; }
        .whale-heatmap-meta { font-size: 0.6rem; color: var(--text-muted); font-weight: 500; }
        .whale-heatmap-plot { height: 168px; min-height: 152px; max-width: 100%; width: 100%; }
        [data-theme="light"] #whaleHeatmap .modebar {
            background: rgba(248, 250, 252, 0.96) !important;
            border: 1px solid var(--border) !important;
            border-radius: 6px;
        }
        [data-theme="light"] #whaleHeatmap .modebar-btn svg path,
        [data-theme="light"] #whaleHeatmap .modebar-btn svg rect {
            fill: #52525b !important;
        }
        .mtf-bar-panel, .portfolio-corr-panel {
            margin-top: 0.5rem;
            padding: 0.4rem 0.5rem 0.28rem;
            background: var(--bg-elevated);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset;
        }
        .portfolio-corr-panel { margin-top: 0.4rem; }
        /* Correlation + exposure side-by-side (~50% each); avoids full-width stretch */
        .portfolio-charts-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 0.4rem;
            align-items: stretch;
            margin-top: 0.35rem;
        }
        .portfolio-charts-row .portfolio-corr-panel,
        .portfolio-charts-row .portfolio-exposure-panel {
            margin-top: 0;
            min-width: 0;
            padding: 0.28rem 0.38rem 0.16rem;
            border-radius: calc(var(--radius) - 2px);
        }
        .portfolio-charts-row .portfolio-corr-head,
        .portfolio-charts-row .portfolio-exposure-head {
            flex-direction: row;
            align-items: baseline;
            flex-wrap: wrap;
            gap: 0.18rem 0.42rem;
            margin-bottom: 0.08rem;
        }
        .portfolio-charts-row .portfolio-corr-title,
        .portfolio-charts-row .portfolio-exposure-title {
            font-size: 0.68rem;
            flex-shrink: 0;
        }
        .portfolio-charts-row .portfolio-corr-meta,
        .portfolio-charts-row .portfolio-exposure-meta {
            font-size: 0.56rem;
            line-height: 1.22;
            opacity: 0.9;
            flex: 1 1 8rem;
            min-width: 0;
            max-width: none;
            text-align: left;
        }
        .portfolio-charts-row .portfolio-corr-plot {
            min-height: 168px;
            height: clamp(168px, 28vw, 268px);
            width: 100%;
        }
        .portfolio-charts-row .portfolio-exposure-plot {
            min-height: 160px;
            height: clamp(160px, 27vw, 258px);
            width: 100%;
        }
        @media (max-width: 900px) {
            .portfolio-charts-row {
                grid-template-columns: 1fr;
            }
        }
        .mtf-bar-head, .portfolio-corr-head {
            display: flex;
            align-items: baseline;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 0.18rem 0.5rem;
            margin-bottom: 0.18rem;
        }
        .mtf-bar-title, .portfolio-corr-title { font-size: 0.72rem; font-weight: 600; color: var(--text-secondary); letter-spacing: 0.02em; }
        .mtf-bar-meta, .portfolio-corr-meta { font-size: 0.6rem; color: var(--text-muted); font-weight: 500; }
        .mtf-bar-plot { height: 172px; min-height: 158px; width: 100%; }
        /* MTF: matrix table + bar chart side-by-side (~50/50), less horizontal stretch */
        .mtf-detail-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 0.55rem;
            align-items: stretch;
            margin-top: 0.45rem;
        }
        .mtf-detail-row .table-wrap,
        .mtf-detail-row .mtf-bar-panel {
            margin-top: 0;
            min-width: 0;
        }
        .mtf-detail-row .mtf-bar-panel {
            align-self: stretch;
        }
        .mtf-detail-row .mtf-bar-head {
            flex-direction: column;
            align-items: flex-start;
            gap: 0.12rem;
        }
        .mtf-detail-row .mtf-bar-plot {
            height: clamp(165px, 30vw, 280px);
            min-height: 155px;
        }
        .mtf-detail-row .table-wrap table {
            font-size: 0.74rem;
            width: 100%;
        }
        .mtf-detail-row .table-wrap th,
        .mtf-detail-row .table-wrap td {
            padding: 0.32rem 0.42rem;
            white-space: nowrap;
        }
        #elliotMtf .mtf-summary-grid {
            grid-template-columns: repeat(4, minmax(0, 1fr));
            gap: 0.3rem;
        }
        #elliotMtf .mtf-summary-grid .card {
            padding: 0.26rem 0.4rem 0.3rem;
            border-radius: calc(var(--radius-sm) - 2px);
            display: flex;
            flex-direction: column;
            gap: 0.06rem;
            min-height: 0;
        }
        #elliotMtf .mtf-summary-grid .card:hover {
            transform: translateY(-1px);
        }
        #elliotMtf .mtf-summary-grid .card-label {
            font-size: 0.58rem;
            margin-bottom: 0;
            line-height: 1.15;
            letter-spacing: 0.06em;
            word-break: break-word;
        }
        #elliotMtf .mtf-summary-grid .card-value {
            font-size: 0.78rem;
            font-weight: 600;
            line-height: 1.2;
            word-break: break-word;
        }
        @media (max-width: 900px) {
            .mtf-detail-row { grid-template-columns: 1fr; }
        }
        @media (max-width: 520px) {
            #elliotMtf .mtf-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
        }
        .portfolio-corr-plot { min-height: 200px; height: clamp(200px, 42vw, 340px); width: 100%; }
        .portfolio-exposure-panel {
            margin-top: 0.4rem;
            padding: 0.4rem 0.5rem 0.28rem;
            background: var(--bg-elevated);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset;
        }
        .portfolio-exposure-head {
            display: flex;
            align-items: baseline;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 0.18rem 0.5rem;
            margin-bottom: 0.18rem;
        }
        .portfolio-exposure-title { font-size: 0.72rem; font-weight: 600; color: var(--text-secondary); letter-spacing: 0.02em; }
        .portfolio-exposure-meta { font-size: 0.6rem; color: var(--text-muted); font-weight: 500; max-width: 20rem; text-align: right; }
        .portfolio-exposure-plot { height: 184px; min-height: 160px; max-width: 100%; width: 100%; }
        .two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; }
        .model-chooser { position: relative; display: inline-block; }
        .model-chooser .model-btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.45rem 1rem; background: rgba(99,102,241,0.18); color: #818cf8; border: 1px solid rgba(99,102,241,0.3); border-radius: 999px; font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: all 0.2s; }
        .model-chooser .model-btn:hover { background: rgba(99,102,241,0.28); border-color: rgba(99,102,241,0.5); }
        .model-chooser .model-btn.state-ok { background: rgba(74,222,128,0.15); color: var(--green); border-color: rgba(74,222,128,0.35); }
        .model-chooser .model-btn.state-warn { background: rgba(245,158,11,0.16); color: #f59e0b; border-color: rgba(245,158,11,0.45); }
        .model-chooser .model-btn.state-danger { background: rgba(248,113,113,0.18); color: var(--red); border-color: rgba(248,113,113,0.45); }
        .model-chooser .model-btn::after { content: '▾'; font-size: 0.7em; opacity: 0.8; }
        .model-chooser .model-dropdown { display: none; position: absolute; top: 100%; left: 0; margin-top: 0.4rem; min-width: 320px; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); z-index: 100; overflow: hidden; }
        .model-chooser.open .model-dropdown { display: block; }
        .model-chooser .model-search { width: 100%; padding: 0.6rem 1rem; font-size: 0.85rem; background: var(--bg-elevated); border: none; border-bottom: 1px solid var(--border); color: var(--text); outline: none; }
        .model-chooser .model-search::placeholder { color: var(--text-muted); }
        .model-chooser .model-list { max-height: 240px; overflow-y: auto; }
        .model-chooser .model-item { padding: 0.5rem 1rem; font-size: 0.8rem; cursor: pointer; transition: background 0.15s; display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
        .model-chooser .model-item:hover { background: var(--surface-hover); }
        .model-chooser .model-item.active { background: rgba(99,102,241,0.15); color: var(--accent); }
        .model-chooser .model-item .id { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; color: var(--text-secondary); }
        .model-chooser .model-item .free-badge { font-size: 0.6rem; padding: 0.15rem 0.4rem; border-radius: 4px; background: rgba(74,222,128,0.2); color: var(--green); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
        .model-control-hint { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0.65rem; border-radius: 999px; border: 1px solid var(--border); font-size: 0.72rem; line-height: 1.2; max-width: min(52vw, 560px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .model-control-hint.ok { color: var(--green); border-color: rgba(74,222,128,0.35); background: rgba(74,222,128,0.12); }
        .model-control-hint.warn { color: #f59e0b; border-color: rgba(245,158,11,0.4); background: rgba(245,158,11,0.12); }
        .model-control-hint.danger { color: var(--red); border-color: rgba(248,113,113,0.4); background: rgba(248,113,113,0.12); }
        #btnAutoRefresh.active { background: rgba(167,139,250,0.2); color: var(--accent); border-color: var(--accent); }
        .ai-connection-btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.9rem; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; font-size: 0.75rem; font-weight: 500; color: var(--text-secondary); cursor: pointer; transition: all 0.2s; }
        .ai-connection-btn:hover { border-color: var(--border-focus); color: var(--text); }
        .ai-connection-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); }
        .btn-clear-alerts { padding: 0.35rem 0.75rem; font-size: 0.75rem; font-weight: 500; color: var(--text-secondary); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s; }
        .btn-clear-alerts:hover { border-color: var(--red); color: var(--red); }
        /* Recent Alerts + Bot Activity: fixed 50/50 columns, matched scroll viewport height */
        .ai-alerts-activity-row {
            --alerts-activity-pane-h: 240px;
            display: flex;
            flex-direction: row;
            align-items: stretch;
            gap: 0.65rem;
            margin-top: 0;
            width: 100%;
        }
        .ai-alerts-activity-row .ai-alerts-panel,
        .ai-alerts-activity-row #activity.activity-panel {
            flex: 1 1 0;
            min-width: 0;
            display: flex;
            flex-direction: column;
            min-height: 0;
        }
        .ai-alerts-activity-row .ai-alerts-panel .section-header,
        .ai-alerts-activity-row #activity.activity-panel > .section-header {
            margin-bottom: 0.35rem;
        }
        .ai-alerts-activity-row .ai-alerts-panel .table-wrap.ai-alerts-table-wrap {
            flex: 1 1 auto;
            min-height: 0;
            height: var(--alerts-activity-pane-h);
            max-height: var(--alerts-activity-pane-h);
            overflow-x: auto;
            overflow-y: auto;
        }
        .ai-alerts-activity-row .ai-alerts-panel .table-wrap.ai-alerts-table-wrap table {
            width: 100%;
            border-collapse: collapse;
            font-family: 'JetBrains Mono', monospace;
            font-size: 0.7rem;
        }
        .ai-alerts-activity-row .ai-alerts-panel .table-wrap.ai-alerts-table-wrap th,
        .ai-alerts-activity-row .ai-alerts-panel .table-wrap.ai-alerts-table-wrap td {
            padding: 0.24rem 0.38rem;
            vertical-align: top;
            line-height: 1.3;
            border-bottom: 1px solid var(--border);
        }
        .ai-alerts-activity-row .ai-alerts-panel .table-wrap.ai-alerts-table-wrap th {
            background: var(--bg-elevated);
            color: var(--text-muted);
            font-weight: 600;
            text-transform: uppercase;
            font-size: 0.58rem;
            letter-spacing: 0.06em;
            white-space: nowrap;
        }
        .ai-alerts-activity-row .ai-alerts-panel .table-wrap.ai-alerts-table-wrap td:last-child {
            word-break: break-word;
        }
        .ai-alerts-activity-row .ai-alerts-panel .table-wrap.ai-alerts-table-wrap tr:nth-child(even) td {
            background: var(--table-stripe);
        }
        .ai-alerts-activity-row #activity .activity-feed {
            flex: 1 1 auto;
            min-height: 0;
            height: var(--alerts-activity-pane-h);
            max-height: var(--alerts-activity-pane-h);
        }
        .ai-alerts-activity-row #activity .activity-feed.collapsed {
            flex: 0 0 0;
            height: 0 !important;
            min-height: 0 !important;
            max-height: 0 !important;
        }
        .ai-alerts-activity-row #activity .activity-timeline {
            flex: 1 1 auto;
            min-height: 0;
            height: var(--alerts-activity-pane-h);
            max-height: var(--alerts-activity-pane-h);
            overflow-x: auto;
            overflow-y: auto;
        }
        .ai-alerts-activity-row #activity .activity-compact-table th,
        .ai-alerts-activity-row #activity .activity-compact-table td {
            padding: 0.22rem 0.32rem;
            font-size: 0.68rem;
        }
        .ai-alerts-activity-row #activity .activity-compact-table th {
            font-size: 0.56rem;
        }
        .ai-alerts-activity-row #activity .activity-msg,
        .ai-alerts-activity-row #activity .activity-kind {
            font-size: 0.65rem;
        }
        .ai-alerts-activity-row #activity .activity-subbar {
            display: flex;
            align-items: center;
            gap: 0.6rem;
            flex-wrap: wrap;
            width: 100%;
            flex-shrink: 0;
            margin-top: 0.45rem;
        }
        .ai-alerts-activity-row #activity #activityEmpty {
            margin-top: 0.35rem;
        }
        @media (max-width: 960px) {
            .ai-alerts-activity-row {
                flex-direction: column;
            }
            .ai-alerts-activity-row .ai-alerts-panel,
            .ai-alerts-activity-row #activity.activity-panel {
                flex: 1 1 auto;
            }
        }
        .ai-connection-btn.online .ai-connection-dot { background: var(--green); box-shadow: 0 0 6px var(--green); }
        .ai-connection-btn.offline .ai-connection-dot { background: var(--red); box-shadow: 0 0 6px var(--red); }
        .ai-connection-btn.checking .ai-connection-dot { background: var(--accent); animation: pulse 1s infinite; }
        .position-tab { padding: 0.4rem 0.9rem; font-size: 0.8rem; font-weight: 500; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-secondary); cursor: pointer; transition: all 0.2s; }
        .position-tab:hover { color: var(--text); border-color: var(--border-focus); }
        .position-tab.active { background: rgba(167,139,250,0.12); color: var(--accent); border-color: var(--accent); }
        .position-tab-badge { font-size: 0.72em; opacity: 0.88; font-weight: 600; margin-left: 0.2rem; }
        .positions-readable-summary {
            display: grid;
            grid-template-columns: repeat(4, minmax(0, 1fr));
            gap: 0.5rem;
            margin: 0 0 0.7rem;
        }
        .positions-summary-card {
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            background: color-mix(in srgb, var(--surface) 86%, transparent);
            padding: 0.52rem 0.65rem;
            min-width: 0;
        }
        .positions-summary-card span,
        .positions-summary-card em {
            display: block;
            color: var(--text-muted);
            font-size: 0.68rem;
            font-style: normal;
            line-height: 1.25;
        }
        .positions-summary-card strong {
            display: block;
            margin: 0.12rem 0;
            font-size: 0.92rem;
            line-height: 1.2;
            color: var(--text);
        }
        #positions .table-wrap {
            max-height: min(520px, 60vh);
            overflow: auto;
            border-radius: var(--radius-sm);
        }
        #positions table {
            min-width: 980px;
            font-size: 0.82rem;
        }
        #positions th,
        #positions td {
            padding: 0.52rem 0.6rem;
            vertical-align: middle;
        }
        .position-cell-main {
            min-width: 9rem;
        }
        .position-symbol {
            display: block;
            font-family: 'JetBrains Mono', ui-monospace, monospace;
            font-weight: 800;
            color: var(--text);
        }
        .position-sub {
            display: block;
            margin-top: 0.12rem;
            color: var(--text-muted);
            font-size: 0.72rem;
        }
        .position-cell-id,
        .position-cell-exchange,
        .position-cell-time {
            color: var(--text-muted);
            font-size: 0.72rem;
        }
        .position-cell-exchange {
            max-width: 10rem;
            word-break: break-all;
        }
        .position-pnl-cell {
            font-size: 0.92rem;
            white-space: nowrap;
        }
        .position-side-pill.side-buy { border-color: var(--green-dim); background: rgba(34,197,94,0.12); }
        .position-side-pill.side-sell { border-color: var(--red-dim); background: rgba(248,113,113,0.12); }
        #positions .table-wrap,
        #positions #positionsEmpty {
            transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1), filter 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        }
        #positionsLoading.panel-load--bar {
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            transition: opacity 0.24s ease, max-height 0.32s cubic-bezier(0.4, 0, 0.2, 1), margin-bottom 0.32s cubic-bezier(0.4, 0, 0.2, 1), padding-top 0.32s cubic-bezier(0.4, 0, 0.2, 1), padding-bottom 0.32s cubic-bezier(0.4, 0, 0.2, 1), border-width 0.32s cubic-bezier(0.4, 0, 0.2, 1);
            max-height: 5rem;
            opacity: 1;
        }
        #positionsLoading.panel-load--bar.positions-loading-panel--collapsed {
            max-height: 0;
            opacity: 0;
            margin-bottom: 0 !important;
            padding-top: 0 !important;
            padding-bottom: 0 !important;
            border-width: 0 !important;
            min-height: 0 !important;
            pointer-events: none;
        }
        #positions.positions-section--tab-loading .table-wrap,
        #positions.positions-section--tab-loading #positionsEmpty {
            opacity: 0.42;
            filter: grayscale(0.06);
            pointer-events: none;
            transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1), filter 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        }
        @media (prefers-reduced-motion: reduce) {
            #positionsLoading.panel-load--bar,
            #positions .table-wrap,
            #positions #positionsEmpty,
            #positions.positions-section--tab-loading .table-wrap,
            #positions.positions-section--tab-loading #positionsEmpty {
                transition: none !important;
            }
        }
        @media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } }
        @media (max-width: 768px) {
            .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); padding: 0.65rem 0 0.75rem; }
            .app { flex-direction: column; }
            .main {
                padding: 0.75rem 0.55rem 1.5rem;
            }
            .sidebar-logo { padding: 0 0.85rem 0.5rem; margin-bottom: 0.25rem; }
            .sidebar-nav {
                display: grid;
                grid-template-columns: 1fr;
                align-items: stretch;
                gap: 0.4rem;
                padding: 0 0.65rem;
            }
            .sidebar-nav-group {
                display: flex;
                flex-wrap: wrap;
                align-items: stretch;
                gap: 0.32rem 0.38rem;
                margin: 0;
                padding: 0 0 0.45rem;
            }
            .sidebar-nav-heading {
                flex: 1 0 100%;
                padding: 0 0.1rem 0.05rem;
                font-size: 0.58rem;
            }
            .sidebar-nav a {
                flex: 1 1 auto;
                justify-content: center;
                min-width: calc(25% - 0.38rem);
                margin-bottom: 0;
                padding: 0.34rem 0.46rem;
                font-size: 0.78rem;
                gap: 0.38rem;
                border-radius: 8px;
            }
            .sidebar-nav a::before { font-size: 0.68rem; }
        }
        @media (max-width: 520px) {
            .sidebar .sidebar-nav a { min-width: calc(50% - 0.25rem); }
        }
        [data-theme="light"] .sidebar-brand h1 { background: linear-gradient(135deg, #0f172a 30%, var(--accent) 70%, #6d28d9 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
        @media (max-width: 768px) {
            .sidebar.sidebar--collapsed { width: 100%; }
            .sidebar.sidebar--collapsed .sidebar-nav-heading {
                height: auto;
                margin: 0;
                padding: 0 0.1rem 0.05rem;
                overflow: visible;
                color: var(--text-muted);
                background: transparent;
            }
            .sidebar.sidebar--collapsed .sidebar-nav-label {
                position: static;
                width: auto;
                height: auto;
                margin: 0;
                overflow: visible;
                clip: auto;
                white-space: normal;
            }
            .sidebar.sidebar--collapsed .sidebar-nav a { justify-content: center; gap: 0.38rem; }
            .sidebar-toggle-chevron { display: none; }
        }
        .theme-toggle {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0.38rem;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 999px;
            color: var(--text-secondary);
            cursor: pointer;
            transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
        }
        .theme-toggle:hover { border-color: var(--border-focus); color: var(--text); box-shadow: 0 0 0 2px color-mix(in srgb, var(--border-focus) 35%, transparent); }
        .theme-toggle svg {
            display: block;
            width: 20px;
            height: 20px;
            flex-shrink: 0;
        }
        .lang-toggle { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0.75rem; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); cursor: pointer; transition: all 0.2s; }
        .lang-toggle:hover { border-color: var(--border-focus); color: var(--text); }
        .lang-toggle span { opacity: 0.6; }
        .lang-toggle span.active { opacity: 1; color: var(--accent); }
        .chart-section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.35rem; }
        .chart-section-head .section-title { margin: 0; }
        .chart-head-controls { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
        .chart-refresh-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-width: 1.75rem;
            height: 1.75rem;
            padding: 0 0.4rem;
            font-size: 0.9rem;
            line-height: 1;
            cursor: pointer;
            color: var(--text-secondary);
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
        }
        .chart-refresh-btn:hover { color: var(--text); border-color: var(--accent); }
        .chart-meta-bar {
            margin: 0 0 0.4rem;
            font-size: 0.72rem;
            color: var(--text-muted);
            line-height: 1.4;
            font-variant-numeric: tabular-nums;
        }
        .elliott-png-aux { margin-top: 0.45rem; }
        .elliott-png-toggle {
            font-size: 0.72rem;
            padding: 0.25rem 0.5rem;
            cursor: pointer;
            color: var(--accent);
            background: transparent;
            border: 1px dashed var(--border);
            border-radius: var(--radius-sm);
        }
        .elliott-png-toggle:hover { border-style: solid; color: var(--text); }
        .elliott-png-panel { margin-top: 0.4rem; max-width: 100%; overflow: auto; }
        .elliott-png-panel img { max-width: 100%; height: auto; display: block; border-radius: var(--radius-sm); border: 1px solid var(--border); }
        .chart-head-title-row { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; }
        .chart-strategy-context {
            font-size: 0.72rem;
            line-height: 1.45;
            color: var(--text-muted);
            margin: 0 0 0.45rem 0;
            max-width: 56rem;
        }
        .chart-strategy-context__line { display: block; }
        .chart-strategy-context__line + .chart-strategy-context__line { margin-top: 0.2rem; }
        .chart-strategy-context__trading { color: var(--text-secondary); }
        .elliott-tf-select { font-size: 0.78rem; padding: 0.3rem 1.75rem 0.3rem 0.5rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; min-width: 4.2rem; font-weight: 600; }
        .elliott-tf-select:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15); }
        .chart-engine-toggle { display: inline-flex; gap: 0.25rem; flex-wrap: wrap; }
        .chart-engine-toggle button { padding: 0.28rem 0.55rem; font-size: 0.68rem; font-weight: 600; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-secondary); cursor: pointer; }
        .chart-engine-toggle button:hover { border-color: var(--border-focus); color: var(--text); }
        .chart-engine-toggle button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
        .modal-overlay { display: none !important; }
        .modal-overlay.open { display: flex !important; }
        .position-row-clickable, .risk-row-clickable { cursor: pointer; }
        .position-row-clickable:hover, .risk-row-clickable:hover { background: rgba(167,139,250,0.08); }
        #positionDetailModal.modal-overlay {
            align-items: center;
            justify-content: center;
            padding: 0.75rem;
            box-sizing: border-box;
            background: var(--modal-scrim);
        }
        #positionDetailModal .modal-dialog {
            max-width: min(1100px, 96vw);
            width: 100%;
            max-height: min(92vh, 900px);
            display: flex;
            flex-direction: column;
            background: var(--card-gradient);
            border: 1px solid var(--border);
            overflow: hidden;
        }
        #positionDetailModal .modal-body { overflow-y: auto; flex: 1; }
        #positionDetailModal .pmodal-tabs { display: flex; gap: 0.4rem; margin-bottom: 0.75rem; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
        #positionDetailModal .pmodal-tab {
            padding: 0.45rem 0.85rem;
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            background: var(--bg-elevated);
            cursor: pointer;
            font-size: 0.78rem;
            color: var(--text-secondary);
            transition: background 0.15s, color 0.15s, border-color 0.15s;
        }
        #positionDetailModal .pmodal-tab:hover { border-color: var(--border-focus); color: var(--text); }
        #positionDetailModal .pmodal-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
        #positionDetailModal .pmodal-pane { display: none; }
        #positionDetailModal .pmodal-pane.active { display: block; }
        #positionDetailModal .modal-dialog { cursor: default; }
        #positionDetailModal #positionDetailContent { background: transparent; color: var(--text); padding: 0; border-radius: 0; max-width: none; max-height: none; overflow: visible; flex: 1; min-height: 0; }
        #positionDetailModal #positionModalChart { width: 100%; height: min(360px, 42vh); min-height: 220px; border-radius: var(--radius-sm); overflow: hidden; background: color-mix(in srgb, var(--bg) 72%, var(--surface)); border: 1px solid var(--border); }
        #positionDetailModal .position-chart-empty { display: flex; align-items: center; justify-content: center; height: 200px; color: var(--text-muted); font-size: 0.85rem; }
        #positionDetailModal .pmodal-meta { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.75rem; line-height: 1.5; }
        #positionDetailModal .pmodal-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
        #positionDetailModal .pmodal-actions button {
            padding: 0.5rem 1rem;
            font-size: 0.8rem;
            border-radius: var(--radius-sm);
            border: 1px solid var(--border);
            background: var(--bg-elevated);
            color: var(--text);
            cursor: pointer;
        }
        #positionDetailModal .pmodal-actions button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
        #positionDetailModal .pmodal-actions button.danger { border-color: rgba(248,113,113,0.5); color: #f87171; }
        #positionDetailModal .audit-list { list-style: none; margin: 0; padding: 0; font-size: 0.8rem; }
        #positionDetailModal .audit-list li { padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
        #positionDetailModal .audit-list li:last-child { border-bottom: none; }
        #positionDetailModal .audit-list .audit-kind { display: inline-block; min-width: 5.5rem; color: var(--accent); font-weight: 600; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; }
        @media (max-width: 640px) {
            #positionDetailModal .modal-dialog { max-height: 94vh; padding: 1rem !important; }
            #positionDetailModal #positionModalChart { height: 240px; min-height: 180px; }
            #positionDetailModal .pmodal-tab { flex: 1 1 auto; text-align: center; }
        }
        #positionDetailModal .position-loading-panel {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 1rem;
            min-height: min(280px, 42vh);
            padding: 2rem 1.5rem;
            margin: 0.25rem 0;
            border-radius: var(--radius-sm);
            border: 1px dashed color-mix(in srgb, var(--border) 85%, var(--accent) 15%);
            background: color-mix(in srgb, var(--surface) 88%, var(--accent) 4%);
            color: var(--text-secondary);
        }
        #positionDetailModal .position-loading-spinner {
            width: 2.5rem;
            height: 2.5rem;
            border: 3px solid var(--border);
            border-top-color: var(--accent);
            border-radius: 50%;
            animation: spin 0.7s linear infinite;
            flex-shrink: 0;
        }
        #positionDetailModal .position-loading-text { margin: 0; font-size: 0.9rem; font-weight: 500; color: var(--text-secondary); text-align: center; max-width: 22rem; line-height: 1.45; }
        #positionDetailModal .position-skel-preview { opacity: 0.92; }
        #positionDetailModal .position-skel-tabs { display: flex; gap: 0.45rem; margin: 0.65rem 0 0.75rem; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 0.45rem; }
        #positionDetailModal .position-skel-pill {
            height: 1.85rem;
            min-width: 4.2rem;
            flex: 1 1 auto;
            border-radius: var(--radius-sm);
            background: linear-gradient(90deg, color-mix(in srgb, var(--border) 55%, var(--surface)) 0%, color-mix(in srgb, var(--accent) 18%, var(--surface)) 50%, color-mix(in srgb, var(--border) 55%, var(--surface)) 100%);
            background-size: 200% 100%;
            animation: positionSkelShimmer 1.1s ease-in-out infinite;
        }
        #positionDetailModal .position-skel-chart-wrap { min-height: min(240px, 36vh); border-style: solid; }
        @keyframes positionSkelShimmer {
            0% { background-position: 200% 0; }
            100% { background-position: -200% 0; }
        }
        #positionDetailModal.open .modal-dialog {
            animation: positionModalIn 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
        }
        @keyframes positionModalIn {
            from { opacity: 0; transform: translateY(12px) scale(0.985); }
            to { opacity: 1; transform: translateY(0) scale(1); }
        }
        #positionDetailModal .position-error { text-align: center; padding: 2rem; color: var(--red); }
        @keyframes spin { to { transform: rotate(360deg); } }
        button.dashboard-refresh-btn--busy {
            cursor: wait;
            opacity: 0.94;
        }
        button.dashboard-refresh-btn--busy svg:first-of-type {
            display: block;
            flex-shrink: 0;
            animation: spin 0.65s linear infinite;
            transform-origin: 50% 50%;
        }
        @media (prefers-reduced-motion: reduce) {
            button.dashboard-refresh-btn--busy svg:first-of-type { animation: none; }
        }
        #positionDetailModal .position-info pre { white-space: pre-wrap; background: var(--bg); padding: 1rem; border-radius: var(--radius-sm); margin: 1rem 0; font-size: 0.85rem; }
        #positionDetailModal .position-modal-close {
            background: color-mix(in srgb, var(--text) 7%, transparent);
        }
        #positionDetailModal .position-modal-close:hover {
            background: color-mix(in srgb, var(--text) 12%, transparent);
            color: var(--text);
        }
        #tradeDetailModal.modal-overlay {
            align-items: center;
            justify-content: center;
            padding: 0.75rem;
            box-sizing: border-box;
            z-index: 1002;
            background: var(--modal-scrim);
        }
        #tradeDetailModal .trade-detail-dialog {
            max-width: min(720px, 96vw);
            width: 100%;
            max-height: min(88vh, 800px);
            display: flex;
            flex-direction: column;
            background: var(--card-gradient);
            color: var(--text);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            padding: 1.25rem 1.35rem;
            position: relative;
            overflow: hidden;
        }
        #tradeDetailClose {
            position: absolute;
            top: 0.65rem;
            right: 0.65rem;
            border: none;
            border-radius: var(--radius-sm);
            cursor: pointer;
            font-size: 1.35rem;
            color: var(--text-secondary);
            line-height: 1;
            width: 2rem;
            height: 2rem;
            display: flex;
            align-items: center;
            justify-content: center;
            background: color-mix(in srgb, var(--text) 7%, transparent);
        }
        #tradeDetailClose:hover {
            background: color-mix(in srgb, var(--text) 12%, transparent);
            color: var(--text);
        }
        #tradeDetailModal #tradeDetailContent { overflow-y: auto; flex: 1; min-height: 0; margin-top: 0.5rem; }
        .trade-detail-hint { font-size: 0.78rem; color: var(--text-secondary); margin: 0 0 0.5rem; line-height: 1.45; }
        .trade-row-clickable { cursor: pointer; }
        .trade-row-clickable:hover { background: rgba(167,139,250,0.08); }
        .trade-detail-dl { display: grid; grid-template-columns: minmax(6.5rem, 30%) 1fr; gap: 0.4rem 0.85rem; font-size: 0.82rem; margin: 0; align-items: start; }
        .trade-detail-dl dt { color: var(--text-muted); font-weight: 600; margin: 0; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
        .trade-detail-dl dd { margin: 0; word-break: break-word; color: var(--text); }
        .trade-detail-nested {
            margin: 0;
            padding: 0.5rem 0.65rem;
            background: var(--bg);
            color: var(--text);
            border-radius: var(--radius-sm);
            font-size: 0.75rem;
            max-height: min(40vh, 320px);
            overflow: auto;
            white-space: pre-wrap;
            border: 1px solid var(--border);
            font-family: 'JetBrains Mono', ui-monospace, monospace;
        }
        .trade-detail-summary-wrap { margin-bottom: 0.75rem; }
        .trade-detail-summary-card {
            padding: 0.75rem 0.85rem;
            border-radius: var(--radius-sm);
            border: 1px solid var(--border);
            background: color-mix(in srgb, var(--surface) 88%, var(--bg));
        }
        .trade-detail-summary-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.55rem; }
        .trade-detail-pill {
            display: inline-block;
            padding: 0.18rem 0.55rem;
            border-radius: 999px;
            font-size: 0.72rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            background: var(--bg-elevated);
            border: 1px solid var(--border);
        }
        .trade-detail-pill.side-buy {
            color: var(--green-dim);
            border-color: color-mix(in srgb, var(--green-dim) 42%, transparent);
        }
        .trade-detail-pill.side-sell {
            color: var(--red-dim);
            border-color: color-mix(in srgb, var(--red-dim) 42%, transparent);
        }
        .trade-detail-sym { font-size: 0.95rem; font-weight: 700; color: var(--text); }
        .trade-detail-summary-dl {
            display: grid;
            grid-template-columns: minmax(5rem, 28%) 1fr;
            gap: 0.35rem 0.65rem;
            font-size: 0.8rem;
            margin: 0;
        }
        .trade-detail-summary-dl dt { color: var(--text-muted); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; margin: 0; font-weight: 600; }
        .trade-detail-summary-dl dd { margin: 0; font-variant-numeric: tabular-nums; color: var(--text); }
        .trade-detail-fee-inline { margin-top: 0.5rem; font-size: 0.78rem; color: var(--text-secondary); }
        .trade-detail-fee-label { color: var(--text-muted); font-weight: 600; margin-right: 0.35rem; }
        .trade-detail-section-title {
            font-size: 0.72rem;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: var(--text-muted);
            margin: 0.5rem 0 0.35rem;
            font-weight: 700;
        }
        .trade-detail-mini-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; margin: 0.15rem 0; }
        .trade-detail-mini-table th, .trade-detail-mini-table td { padding: 0.28rem 0.4rem; text-align: left; border-bottom: 1px solid var(--border); }
        .trade-detail-mini-table th { color: var(--text-muted); font-weight: 600; font-size: 0.65rem; text-transform: uppercase; }
        .trade-detail-mini-table td { color: var(--text); }
        .trade-detail-mini-table .td-num { text-align: right; font-variant-numeric: tabular-nums; }
        .trade-detail-mini-table tbody tr:last-child td { border-bottom: none; }
        .trade-detail-footer { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border); flex-shrink: 0; }
        .trade-detail-actions-hint { font-size: 0.72rem; color: var(--text-secondary); margin: 0 0 0.5rem; line-height: 1.45; }
        .trade-detail-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }
        .trade-detail-btn {
            padding: 0.42rem 0.75rem;
            font-size: 0.78rem;
            border-radius: var(--radius-sm);
            border: 1px solid var(--border);
            background: var(--bg-elevated);
            color: var(--text);
            cursor: pointer;
            text-decoration: none;
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
        }
        .trade-detail-btn:hover:not(:disabled) { border-color: var(--border-focus); color: var(--accent); }
        .trade-detail-btn:disabled { opacity: 0.45; cursor: not-allowed; }
        .trade-detail-btn.danger {
            border-color: color-mix(in srgb, var(--red-dim) 45%, transparent);
            color: var(--red-dim);
        }
        .trade-detail-btn.danger:hover:not(:disabled) {
            border-color: var(--red-dim);
            color: var(--red);
        }
        .trade-detail-link.trade-detail-btn { box-sizing: border-box; }
        .trade-detail-copy-chip {
            margin-left: 0.35rem;
            padding: 0.12rem 0.4rem;
            font-size: 0.65rem;
            border-radius: var(--radius-sm);
            border: 1px solid var(--border);
            background: var(--bg);
            color: var(--text-secondary);
            cursor: pointer;
            vertical-align: middle;
        }
        .trade-detail-copy-chip:hover { border-color: var(--accent); color: var(--accent); }
        .trade-detail-loading { padding: 1rem; color: var(--text-secondary); font-size: 0.85rem; }
        /* Risk Management: compact table, wrapped ladder chips, 2×2 actions */
        #risk .risk-mgmt-table th,
        #risk .risk-mgmt-table td {
            padding: 0.3rem 0.42rem;
            vertical-align: middle;
            font-size: 0.73rem;
            line-height: 1.25;
        }
        #risk .risk-mgmt-table th {
            font-size: 0.56rem;
            padding: 0.26rem 0.42rem;
            letter-spacing: 0.07em;
        }
        #risk .risk-mgmt-table .risk-td-num {
            font-family: 'JetBrains Mono', ui-monospace, monospace;
            font-variant-numeric: tabular-nums;
            font-size: 0.7rem;
            white-space: nowrap;
        }
        #risk .risk-mgmt-table .risk-td-mode {
            font-size: 0.68rem;
            max-width: 7rem;
            line-height: 1.2;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        #risk .risk-mgmt-table .risk-td-pnl .card-value {
            font-size: 0.78rem;
        }
        #risk .risk-mgmt-table td.risk-levels {
            max-width: min(28rem, 52vw);
        }
        #risk .risk-ladder-cell {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 0.2rem 0.26rem;
            line-height: 1.2;
        }
        #risk .risk-level {
            display: inline-flex;
            align-items: center;
            flex-wrap: nowrap;
            gap: 0.2rem;
            margin: 0;
            padding: 0.12rem 0.36rem 0.12rem 0.3rem;
            border-radius: 999px;
            background: color-mix(in srgb, var(--surface) 90%, var(--bg));
            border: 1px solid var(--border);
            border-left-width: 3px;
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07);
            white-space: nowrap;
            font-size: 0.66rem;
        }
        #risk .risk-level.stop_loss {
            border-left-color: rgba(248, 113, 113, 0.72);
        }
        #risk .risk-level.tp1,
        #risk .risk-level.tp2,
        #risk .risk-level.tp3 {
            border-left-color: rgba(52, 211, 153, 0.62);
        }
        #risk .risk-level-type {
            font-weight: 700;
            font-size: 0.6rem;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            color: var(--text-secondary);
        }
        #risk .risk-level.stop_loss .risk-level-type { color: var(--red); }
        #risk .risk-level.tp1 .risk-level-type,
        #risk .risk-level.tp2 .risk-level-type,
        #risk .risk-level.tp3 .risk-level-type { color: var(--green); }
        #risk .risk-level-sep {
            opacity: 0.38;
            font-weight: 400;
            user-select: none;
        }
        #risk .risk-level-price {
            font-family: 'JetBrains Mono', ui-monospace, monospace;
            font-weight: 600;
            font-variant-numeric: tabular-nums;
            color: var(--text);
        }
        #risk .risk-level-pct {
            font-family: 'JetBrains Mono', ui-monospace, monospace;
            font-size: 0.62rem;
            font-variant-numeric: tabular-nums;
        }
        #risk .risk-level.stop_loss .risk-level-pct { color: var(--red); }
        #risk .risk-level.tp1 .risk-level-pct,
        #risk .risk-level.tp2 .risk-level-pct,
        #risk .risk-level.tp3 .risk-level-pct { color: var(--green); }
        #risk .risk-actions {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 0.2rem 0.28rem;
            width: max-content;
            max-width: 12rem;
        }
        #risk .risk-btn {
            padding: 0.2rem 0.34rem;
            font-size: 0.63rem;
            font-weight: 600;
            line-height: 1.2;
            background: var(--bg-elevated);
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            cursor: pointer;
            color: var(--text-secondary);
            text-align: center;
            white-space: nowrap;
            transition: border-color 0.15s, color 0.15s, background 0.15s;
        }
        #risk .risk-btn:hover:not(:disabled) {
            border-color: var(--border-focus);
            color: var(--text);
            background: var(--surface-hover);
        }
        #risk .risk-btn--close {
            border-color: rgba(248, 113, 113, 0.38);
            color: #fca5a5;
            background: rgba(248, 113, 113, 0.07);
        }
        #risk .risk-btn--close:hover:not(:disabled) {
            border-color: rgba(248, 113, 113, 0.55);
            color: #fecaca;
        }
        #risk .risk-btn--accent {
            border-color: rgba(167, 139, 250, 0.42);
            color: var(--accent);
        }
        #risk .risk-btn--accent:hover:not(:disabled) {
            border-color: var(--accent);
            color: #e9d5ff;
        }
        [data-theme="light"] #risk .risk-btn--accent:hover:not(:disabled) {
            color: var(--accent);
        }
        .activity-feed { overflow-x: auto; overflow-y: auto; font-family: 'JetBrains Mono', monospace; transition: max-height 0.2s ease; max-height: 260px; }
        .activity-feed.collapsed { max-height: 0 !important; overflow: hidden; padding: 0; border: none; }
        .activity-collapse-btn.collapsed { transform: rotate(-90deg); }
        .activity-feed table.activity-compact-table { width: 100%; border-collapse: collapse; font-size: 0.72rem; }
        .activity-feed table.activity-compact-table th,
        .activity-feed table.activity-compact-table td { padding: 0.28rem 0.45rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; line-height: 1.35; }
        .activity-feed table.activity-compact-table th { background: var(--bg-elevated); color: var(--text-muted); font-weight: 600; text-transform: uppercase; font-size: 0.6rem; letter-spacing: 0.06em; white-space: nowrap; }
        .activity-feed table.activity-compact-table tr:nth-child(even) td { background: var(--table-stripe); }
        .activity-feed table.activity-compact-table tr:last-child td { border-bottom: none; }
        .activity-feed table.activity-compact-table tr:hover td { background: var(--surface-hover); }
        .activity-feed .activity-time { white-space: nowrap; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
        .activity-feed .activity-icon-cell { text-align: center; width: 2rem; font-size: 0.95rem; line-height: 1.2; padding-left: 0.25rem; padding-right: 0.25rem; }
        .activity-feed .activity-sym { white-space: nowrap; color: var(--text-muted); font-size: 0.68rem; max-width: 5.5rem; overflow: hidden; text-overflow: ellipsis; }
        .activity-feed .activity-msg { word-break: break-word; color: var(--text); font-size: 0.72rem; }
        .activity-feed .activity-kind { font-weight: 600; text-transform: lowercase; font-size: 0.68rem; white-space: nowrap; color: var(--text-secondary); }
        .activity-feed .activity-kind.k-signal, .activity-feed .activity-kind.k-buy, .activity-feed .activity-kind.k-sell, .activity-feed .activity-kind.k-trade { color: var(--green); }
        .activity-feed .activity-kind.k-reject, .activity-feed .activity-kind.k-error, .activity-feed .activity-kind.k-warning { color: var(--red); }
        .activity-feed .activity-kind.k-ai { color: #c084fc; }
        .activity-feed .activity-kind.k-wave { color: #38bdf8; }
        .activity-feed .activity-kind.k-fib { color: #fbbf24; }
        .activity-feed .activity-kind.k-pretrade { color: #4ade80; }
        .activity-feed .activity-kind.k-analysis, .activity-feed .activity-kind.k-info { color: #eab308; }
        .activity-feed .activity-kind.k-metrics, .activity-feed .activity-kind.k-cycle, .activity-feed .activity-kind.k-portfolio { color: #818cf8; }
        .activity-feed .activity-kind.k-debug, .activity-feed .activity-kind.k-next { color: var(--text-muted); }
        @keyframes activity-row-enter {
            from { opacity: 0; transform: translateY(-5px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .activity-feed tr.activity-row-new td {
            animation: activity-row-enter 0.38s cubic-bezier(0.22, 1, 0.36, 1) forwards;
        }
        @media (prefers-reduced-motion: reduce) {
            .activity-feed tr.activity-row-new td { animation: none; }
        }
        .activity-filter { padding: 0.35rem 0.6rem; font-size: 0.8rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); }
        .activity-view-tabs { display: flex; gap: 0.25rem; margin-bottom: 0; }
        .activity-view-tab { padding: 0.3rem 0.6rem; font-size: 0.75rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; color: var(--text-secondary); }
        .activity-view-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
        .activity-view-tab:hover:not(.active) { border-color: var(--border-focus); color: var(--text); }
        .activity-view-tabs { align-items: center; }
        .activity-timeline-refresh-btn {
            display: none;
            align-items: center;
            justify-content: center;
            min-width: 1.75rem;
            height: 1.6rem;
            padding: 0 0.4rem;
            margin-left: 0.15rem;
            font-size: 0.85rem;
            line-height: 1;
            cursor: pointer;
            color: var(--text-secondary);
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
        }
        .activity-timeline-refresh-btn:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }
        .activity-timeline-refresh-btn:disabled { opacity: 0.5; cursor: not-allowed; }
        .activity-timeline--loading { opacity: 0.55; pointer-events: none; transition: opacity 0.15s ease; }
        .activity-timeline { max-height: 480px; overflow-y: auto; }
        .activity-timeline-day { margin-bottom: 1.25rem; }
        .activity-timeline-day-header { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.5rem; padding-left: 0.5rem; border-left: 3px solid var(--accent); }
        .activity-timeline-day-items { margin-top: 0.35rem; }
        .activity-timeline-day .activity-feed { max-height: 220px; margin-top: 0.25rem; }

        /* Initial dashboard boot overlay */
        .dashboard-boot-overlay {
            position: fixed;
            inset: 0;
            z-index: 10000;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 1.5rem;
            transition: opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.55s;
        }
        .dashboard-boot-overlay.dashboard-boot-overlay--done {
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
        }
        /* Backdrop/card default to pointer-events:auto; without this, clicks still hit children during fade-out. */
        .dashboard-boot-overlay.dashboard-boot-overlay--done,
        .dashboard-boot-overlay.dashboard-boot-overlay--done * {
            pointer-events: none !important;
        }
        .dashboard-boot-overlay__backdrop {
            position: absolute;
            inset: 0;
            background: color-mix(in srgb, var(--bg) 82%, transparent);
            backdrop-filter: blur(14px) saturate(1.15);
            -webkit-backdrop-filter: blur(14px) saturate(1.15);
        }
        .dashboard-boot-overlay__backdrop::after {
            content: '';
            position: absolute;
            inset: 0;
            background: var(--body-bg-gradient);
            opacity: 0.9;
            pointer-events: none;
        }
        .dashboard-boot-overlay__card {
            position: relative;
            text-align: center;
            max-width: 22rem;
            padding: 2rem 2.25rem 1.85rem;
            border-radius: calc(var(--radius) + 6px);
            background: color-mix(in srgb, var(--surface) 88%, transparent);
            border: 1px solid color-mix(in srgb, var(--border) 70%, var(--accent) 18%);
            box-shadow: var(--shadow-lg), 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent), 0 24px 64px rgba(0, 0, 0, 0.35);
        }
        [data-theme="light"] .dashboard-boot-overlay__card {
            background: color-mix(in srgb, var(--surface) 94%, transparent);
            box-shadow: var(--shadow-lg), 0 0 0 1px color-mix(in srgb, var(--accent) 8%, transparent);
        }
        .dashboard-boot-emblem {
            width: 92px;
            height: 92px;
            margin: 0 auto 1.15rem;
            position: relative;
        }
        .dashboard-boot-ring {
            position: absolute;
            inset: 0;
            border-radius: 50%;
            border: 2px solid transparent;
            border-top-color: var(--accent);
            border-right-color: color-mix(in srgb, var(--accent) 45%, transparent);
            animation: dashboardBootSpin 1.15s linear infinite;
        }
        .dashboard-boot-ring--inner {
            inset: 14px;
            border-top-color: var(--accent-strong);
            border-left-color: color-mix(in srgb, var(--accent-strong) 50%, transparent);
            border-right-color: transparent;
            animation: dashboardBootSpin 0.78s linear infinite reverse;
        }
        .dashboard-boot-bars {
            position: absolute;
            left: 50%;
            top: 50%;
            width: 52px;
            height: 28px;
            margin: -14px 0 0 -26px;
            display: flex;
            align-items: flex-end;
            justify-content: center;
            gap: 5px;
            opacity: 0.88;
        }
        .dashboard-boot-bars span {
            display: block;
            width: 5px;
            border-radius: 2px;
            background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
            transform-origin: bottom center;
            animation: dashboardBootBar 0.9s ease-in-out infinite;
        }
        .dashboard-boot-bars span:nth-child(1) { height: 38%; animation-delay: 0s; }
        .dashboard-boot-bars span:nth-child(2) { height: 72%; animation-delay: 0.12s; }
        .dashboard-boot-bars span:nth-child(3) { height: 100%; animation-delay: 0.24s; }
        .dashboard-boot-bars span:nth-child(4) { height: 58%; animation-delay: 0.36s; }
        .dashboard-boot-bars span:nth-child(5) { height: 44%; animation-delay: 0.48s; }
        @keyframes dashboardBootSpin { to { transform: rotate(360deg); } }
        @keyframes dashboardBootBar {
            0%, 100% { transform: scaleY(0.55); opacity: 0.65; }
            50% { transform: scaleY(1); opacity: 1; }
        }
        .dashboard-boot-title {
            font-size: 1.65rem;
            font-weight: 700;
            letter-spacing: -0.05em;
            margin-bottom: 0.35rem;
            background: linear-gradient(135deg, var(--text) 20%, var(--accent) 55%, color-mix(in srgb, var(--accent) 70%, #c4b5fd) 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        .dashboard-boot-sub {
            font-size: 0.88rem;
            color: var(--text-secondary);
            font-weight: 500;
            letter-spacing: 0.02em;
        }
        @media (prefers-reduced-motion: reduce) {
            .dashboard-boot-ring,
            .dashboard-boot-ring--inner,
            .dashboard-boot-bars span {
                animation: none !important;
            }
            .dashboard-boot-bars span:nth-child(1) { height: 40%; }
            .dashboard-boot-bars span:nth-child(2) { height: 65%; }
            .dashboard-boot-bars span:nth-child(3) { height: 85%; }
            .dashboard-boot-bars span:nth-child(4) { height: 55%; }
            .dashboard-boot-bars span:nth-child(5) { height: 45%; }
            .dashboard-boot-overlay { transition-duration: 0.2s; }
        }

        /* Whale history: sortable column headers */
        #whaleHistoryThead th.whale-history-th-sort {
            cursor: pointer;
            user-select: none;
        }
        #whaleHistoryThead th.whale-history-th-sort:hover {
            color: var(--accent);
        }
        #whaleHistoryThead th.whale-history-th--sort-asc::after,
        #whaleHistoryThead th.whale-history-th--sort-desc::after {
            display: inline-block;
            margin-left: 0.25rem;
            font-size: 0.55rem;
            opacity: 0.85;
            vertical-align: middle;
        }
        #whaleHistoryThead th.whale-history-th--sort-asc::after {
            content: '▲';
        }
        #whaleHistoryThead th.whale-history-th--sort-desc::after {
            content: '▼';
        }

        /* Solo-trader: collapsible dashboard sections */
        .section-collapse-toggle {
            flex-shrink: 0;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 2rem;
            height: 2rem;
            margin-right: 0.15rem;
            padding: 0;
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            background: color-mix(in srgb, var(--surface) 90%, transparent);
            color: var(--text-secondary);
            cursor: pointer;
            line-height: 1;
            font-size: 0.65rem;
        }
        .section-collapse-toggle:hover {
            color: var(--text);
            border-color: var(--accent);
            background: var(--surface);
        }
        .section-collapse-toggle:focus-visible {
            outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
            outline-offset: 2px;
        }
        .section-header--chart-master,
        .section-header--alerts-master {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            flex-wrap: wrap;
            margin-bottom: 0.35rem;
        }
        .section-header--chart-master .section-title,
        .section-header--alerts-master .section-title {
            margin: 0;
        }
        .section-header--alerts-master .section-status-strip {
            flex: 1 1 10rem;
            min-width: min(100%, 12rem);
            margin-left: auto;
        }
        #chart.section.two-col {
            display: block;
        }
        #chart.section.two-col > .section-collapsible-body {
            display: grid;
            grid-template-columns: 2fr 1fr;
            gap: 1rem;
        }
        @media (max-width: 1100px) {
            #chart.section.two-col > .section-collapsible-body {
                grid-template-columns: 1fr;
            }
        }

        /* Command center — short narrative for solo traders */
        .operator-trading-narrative {
            margin: 0.65rem 0 0.85rem;
            padding: 0.65rem 0.85rem;
            border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
            border-radius: var(--radius-sm);
            background: color-mix(in srgb, var(--surface) 88%, transparent);
            max-width: 42rem;
        }
        .operator-trading-narrative__eyebrow {
            font-size: 0.68rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: var(--text-muted);
            margin-bottom: 0.35rem;
        }
        .operator-trading-narrative__list {
            margin: 0;
            padding: 0 0 0 1.15rem;
            font-size: 0.82rem;
            line-height: 1.45;
            color: var(--text-secondary);
        }
        .operator-trading-narrative__item {
            margin-bottom: 0.2rem;
        }
        .operator-trading-narrative__item:last-child {
            margin-bottom: 0;
        }

        /* Flow ladder: Binance spot depth + agg trade tape */
        .flow-ladder-panel {
            margin-top: 0.5rem;
            /* Keep bids / tape / asks grouped; avoid full-width stretch */
            --flow-ladder-book-col: minmax(10.75rem, 12.75rem);
            --flow-ladder-tape-col: minmax(9.5rem, 11.25rem);
            width: fit-content;
            max-width: 100%;
        }
        .flow-ladder-meta {
            font-family: 'JetBrains Mono', ui-monospace, monospace;
            font-size: 0.72rem;
            color: var(--text-muted);
            margin-bottom: 0.45rem;
            max-width: 38rem;
        }
        .flow-ladder-summary {
            display: grid;
            grid-template-columns: var(--flow-ladder-book-col) var(--flow-ladder-tape-col) var(--flow-ladder-book-col);
            gap: 0.55rem;
            margin-bottom: 0.65rem;
            box-sizing: border-box;
        }
        .flow-ladder-summary span {
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            background: color-mix(in srgb, var(--surface) 86%, transparent);
            padding: 0.5rem 0.65rem;
            color: var(--text-secondary);
            font-size: 0.76rem;
            line-height: 1.3;
            min-width: 0;
            overflow-wrap: anywhere;
        }
        .flow-ladder-summary strong {
            display: block;
            color: var(--text);
            font-size: 0.68rem;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            margin-bottom: 0.12rem;
        }
        .flow-ladder-summary em {
            color: var(--text-muted);
            font-style: normal;
            margin-left: 0.15rem;
        }
        .flow-ladder-grid {
            display: grid;
            grid-template-columns: var(--flow-ladder-book-col) var(--flow-ladder-tape-col) var(--flow-ladder-book-col);
            gap: 0.55rem;
            align-items: start;
            box-sizing: border-box;
        }
        @media (max-width: 900px) {
            .flow-ladder-grid {
                grid-template-columns: 1fr;
            }
            .flow-ladder-panel {
                width: 100%;
            }
        }
        .flow-ladder-col-head {
            display: flex;
            justify-content: space-between;
            gap: 0.5rem;
            font-size: 0.68rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: var(--text-muted);
            margin-bottom: 0.28rem;
        }
        .flow-ladder-col-head span + span {
            color: var(--text-muted);
            font-weight: 500;
            text-transform: none;
            letter-spacing: 0;
        }
        .flow-ladder-col--bids .flow-ladder-col-head { color: var(--green-dim); }
        .flow-ladder-col--asks .flow-ladder-col-head { color: var(--red-dim); }
        .flow-ladder-rows {
            font-family: 'JetBrains Mono', ui-monospace, monospace;
            font-size: 0.82rem;
            line-height: 1.35;
            max-height: 22rem;
            overflow-y: auto;
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            background: var(--surface);
            padding: 0.35rem 0.45rem;
            min-width: 0;
        }
        .flow-ladder-row {
            position: relative;
            display: flex;
            justify-content: space-between;
            gap: 0.5rem;
            padding: 0.16rem 0.24rem;
            border-radius: 5px;
            overflow: hidden;
        }
        .flow-ladder-row::before {
            content: '';
            position: absolute;
            inset: 0;
            width: var(--depth, 0%);
            opacity: 0.22;
            pointer-events: none;
        }
        .flow-ladder-row > span {
            position: relative;
            z-index: 1;
        }
        .flow-ladder-row--bid::before { background: var(--green); right: 0; left: auto; }
        .flow-ladder-row--ask::before { background: var(--red); }
        .flow-ladder-row--bid .flow-ladder-price { color: var(--green); }
        .flow-ladder-row--ask .flow-ladder-price { color: var(--red); }
        .flow-ladder-qty { color: var(--text-secondary); font-size: 0.76rem; }
        .flow-ladder-col--spread {
            display: flex;
            flex-direction: column;
            align-items: stretch;
            gap: 0.35rem;
        }
        .flow-ladder-spread {
            font-family: 'JetBrains Mono', ui-monospace, monospace;
            font-size: 0.78rem;
            font-weight: 600;
            text-align: center;
            padding: 0.4rem 0.35rem;
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            background: var(--bg-elevated);
            color: var(--text-secondary);
        }
        .flow-ladder-tape-head {
            margin-top: 0.15rem;
            text-align: center;
        }
        .flow-ladder-tape {
            font-family: 'JetBrains Mono', ui-monospace, monospace;
            font-size: 0.76rem;
            line-height: 1.4;
            max-height: 16rem;
            overflow-y: auto;
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            background: var(--surface);
            padding: 0.3rem 0.4rem;
            text-align: center;
            min-width: 0;
        }
        .flow-ladder-tape-row {
            display: flex;
            justify-content: space-between;
            gap: 0.35rem;
            align-items: center;
            padding: 0.14rem 0.22rem;
            border-radius: 5px;
        }
        .flow-ladder-tape-row span {
            min-width: 2.7rem;
            font-weight: 800;
            text-align: left;
        }
        .flow-ladder-tape-row strong { color: var(--text); }
        .flow-ladder-tape-row em {
            color: var(--text-muted);
            font-style: normal;
            white-space: nowrap;
        }
        .flow-ladder-tape-row:nth-child(even) { background: var(--table-stripe); }
        .flow-ladder-tape--buy { color: var(--green); }
        .flow-ladder-tape--sell { color: var(--red); }
        #flowLadderConnPill.live { background: rgba(74, 222, 128, 0.15); color: var(--green); border-color: var(--green-dim); }

        @media (max-width: 900px) {
            .positions-readable-summary,
            .flow-ladder-summary {
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }
            .flow-ladder-panel .flow-ladder-summary {
                width: 100%;
            }
            #overview .overview-recent-decisions-wrap,
            .watchlist-table-wrap,
            #positions .table-wrap {
                max-height: none;
                overflow: visible;
                border: 0;
                background: transparent;
            }
            #overview .overview-recent-decisions-table,
            #overview .overview-recent-decisions-table tbody,
            #overview .overview-recent-decisions-table tr,
            #overview .overview-recent-decisions-table td,
            .watchlist-signals-table,
            .watchlist-signals-table tbody,
            .watchlist-signals-table tr,
            .watchlist-signals-table td,
            #positions table,
            #positions table tbody,
            #positions table tr,
            #positions table td {
                display: block;
                width: 100%;
                min-width: 0;
            }
            #overview .overview-recent-decisions-table thead,
            .watchlist-signals-table thead,
            #positions table thead {
                display: none;
            }
            #overview .overview-recent-decisions-table tr,
            .watchlist-signals-table tr,
            #positions table tr {
                margin-bottom: 0.65rem;
                border: 1px solid var(--border);
                border-radius: var(--radius-sm);
                background: color-mix(in srgb, var(--surface) 88%, transparent);
                overflow: hidden;
            }
            #overview .overview-recent-decisions-table td,
            .watchlist-signals-table td,
            #positions table td {
                display: grid;
                grid-template-columns: minmax(5.8rem, 34%) minmax(0, 1fr);
                gap: 0.55rem;
                align-items: center;
                border-bottom: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
                padding: 0.55rem 0.7rem;
            }
            #overview .overview-recent-decisions-table td:last-child,
            .watchlist-signals-table td:last-child,
            #positions table td:last-child {
                border-bottom: 0;
            }
            #overview .overview-recent-decisions-table td::before,
            .watchlist-signals-table td::before,
            #positions table td::before {
                content: attr(data-label);
                color: var(--text-muted);
                font-size: 0.68rem;
                font-weight: 700;
                text-transform: uppercase;
                letter-spacing: 0.06em;
            }
            #overview .overview-recent-decisions-table td.col-reason,
            #overview .overview-recent-decisions-table td.col-note,
            .watchlist-signals-table td.watchlist-cell-reason,
            #positions table td.position-cell-main {
                align-items: start;
            }
            .watchlist-cell-reason,
            .position-cell-exchange {
                max-width: none;
            }
        }
        @media (max-width: 560px) {
            .main {
                padding-left: 0.42rem;
                padding-right: 0.42rem;
            }
            .card,
            .chart-wrap {
                padding-left: 0.68rem;
                padding-right: 0.68rem;
            }
            .positions-readable-summary,
            .flow-ladder-summary {
                grid-template-columns: 1fr;
            }
            #overview .overview-recent-decisions-controls select,
            #overview .overview-recent-decisions-controls input,
            #overview .overview-recent-decisions-controls button {
                flex: 1 1 100%;
                min-height: 2.1rem;
            }
            #overview .overview-recent-decisions-table td,
            .watchlist-signals-table td,
            #positions table td {
                grid-template-columns: 1fr;
                gap: 0.22rem;
            }
        }

        /* —— Account center (performance + ledger) —— */
        .account-center-lead {
            font-size: 0.82rem;
            color: var(--text-secondary);
            margin: 0 0 0.85rem;
            max-width: 52rem;
            line-height: 1.45;
        }
        .account-center-lead code {
            font-family: 'JetBrains Mono', ui-monospace, monospace;
            font-size: 0.78rem;
            background: color-mix(in srgb, var(--surface) 80%, transparent);
            padding: 0.08rem 0.28rem;
            border-radius: 6px;
        }
        .account-center-overview-bar {
            position: sticky;
            top: 0;
            z-index: 6;
            margin-bottom: 0.85rem;
            padding: 0.65rem 0.85rem;
            border: 1px solid var(--border);
            border-radius: var(--radius);
            background: color-mix(in srgb, var(--bg-elevated) 92%, var(--accent) 4%);
            backdrop-filter: blur(8px);
            box-shadow: var(--shadow);
        }
        .account-center-overview-bar__inner {
            display: flex;
            flex-wrap: wrap;
            gap: 0.65rem 1.25rem;
            align-items: baseline;
            justify-content: flex-start;
        }
        .account-center-stat {
            display: flex;
            flex-direction: column;
            gap: 0.12rem;
            min-width: 6.5rem;
        }
        .account-center-stat__label {
            font-size: 0.68rem;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: var(--text-muted);
            font-weight: 600;
        }
        .account-center-stat__value {
            font-family: 'JetBrains Mono', ui-monospace, monospace;
            font-size: 0.95rem;
            font-weight: 600;
            color: var(--text);
        }
        .account-center-stat__value.pnl-pos { color: var(--green-dim); }
        .account-center-stat__value.pnl-neg { color: var(--red-dim); }
        .account-center-stat__value--sm {
            font-size: 0.8rem;
            font-weight: 600;
            line-height: 1.25;
            word-break: break-word;
        }
        @media (max-width: 768px) {
            .account-center-overview-bar {
                position: relative;
                top: auto;
                z-index: 1;
            }
            #performance .account-center-chart-card,
            #performance .account-center-allocation-card {
                scroll-margin-top: 0.35rem;
            }
        }
        .account-center-performance-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 0.85rem;
        }
        @media (min-width: 1100px) {
            .account-center-performance-grid {
                grid-template-columns: 1.4fr 1fr;
                align-items: stretch;
            }
        }
        .account-center-chart-card {
            min-width: 0;
        }
        .account-center-chart-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 0.5rem;
            margin-bottom: 0.5rem;
        }
        .account-center-chart-controls {
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        .account-center-sr-only {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            border: 0;
        }
        .account-center-chart-mount {
            min-height: 320px;
            width: 100%;
        }
        .account-center-meta-strip {
            margin-top: 0.5rem;
            font-size: 0.72rem;
            color: var(--text-secondary);
            line-height: 1.4;
        }
        .account-center-empty,
        .account-center-err {
            padding: 1.5rem;
            text-align: center;
            color: var(--text-secondary);
            font-size: 0.88rem;
        }
        .account-center-err { color: var(--red-dim); }
        .account-center-pnl-card {
            min-width: 0;
        }
        .account-center-pnl-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 0.75rem;
            margin-top: 0.35rem;
        }
        @media (min-width: 520px) {
            .account-center-pnl-grid {
                grid-template-columns: 1fr 1fr;
            }
        }
        .account-center-pnl-status {
            font-size: 0.72rem;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            color: var(--text-muted);
            margin-bottom: 0.25rem;
        }
        .account-center-pnl-status--ok { color: var(--green-dim); }
        .account-center-pnl-status--warn { color: #f59e0b; }
        .account-center-pnl-big {
            font-family: 'JetBrains Mono', ui-monospace, monospace;
            font-size: 1.45rem;
            font-weight: 700;
            letter-spacing: -0.02em;
        }
        .account-center-pnl-big.pnl-pos { color: var(--green-dim); }
        .account-center-pnl-big.pnl-neg { color: var(--red-dim); }
        .account-center-pnl-baseline {
            font-size: 0.78rem;
            color: var(--text-secondary);
            margin-top: 0.35rem;
        }
        .account-center-pnl-note {
            font-size: 0.75rem;
            color: var(--text-muted);
            margin-top: 0.5rem;
        }
        .account-center-pnl-disclaimers {
            margin-top: 0.65rem;
            padding-top: 0.55rem;
            border-top: 1px solid var(--border);
        }
        .account-center-pnl-disc-row {
            margin-bottom: 0.45rem;
        }
        .account-center-pnl-disc-label {
            display: block;
            font-size: 0.65rem;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--text-muted);
            font-weight: 600;
            margin-bottom: 0.15rem;
        }
        .account-center-pnl-disc-text {
            font-size: 0.76rem;
            color: var(--text-secondary);
            margin: 0;
            line-height: 1.45;
            word-break: break-word;
        }
        .account-center-pnl-disc-text.is-collapsed {
            display: -webkit-box;
            -webkit-line-clamp: 3;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }
        .account-center-pnl-disc-toggle {
            margin-top: 0.25rem;
            padding: 0;
            border: none;
            background: none;
            color: var(--accent);
            font: inherit;
            font-size: 0.78rem;
            font-weight: 600;
            cursor: pointer;
            text-decoration: underline;
        }
        .account-center-pnl-disc-toggle:hover { color: var(--accent-strong); }
        .account-center-allocation-card {
            margin-top: 0.85rem;
            min-width: 0;
        }
        .account-center-allocation-meta {
            font-size: 0.72rem;
            color: var(--text-muted);
            margin: 0 0 0.45rem;
            line-height: 1.35;
        }
        .account-center-allocation-mount {
            min-height: 200px;
            width: 100%;
        }
        .account-center-pnl-breakdown {
            display: flex;
            flex-direction: column;
            gap: 0.45rem;
            font-size: 0.82rem;
        }
        .account-center-pnl-breakdown strong {
            display: block;
            font-family: 'JetBrains Mono', ui-monospace, monospace;
            margin-top: 0.15rem;
        }
        .account-center-pnl-bar {
            display: flex;
            height: 6px;
            border-radius: 4px;
            overflow: hidden;
            margin-top: 0.35rem;
            background: var(--border);
        }
        .account-center-pnl-bar span:first-child {
            background: var(--green-dim);
        }
        .account-center-pnl-bar span:last-child {
            background: #f59e0b;
        }
        .account-activity-toolbar {
            display: flex;
            flex-wrap: wrap;
            align-items: flex-end;
            gap: 0.65rem;
            padding: 0.65rem 0.75rem;
            margin-bottom: 0.65rem;
        }
        .account-activity-field {
            display: flex;
            flex-direction: column;
            gap: 0.2rem;
            font-size: 0.78rem;
            color: var(--text-secondary);
        }
        .account-activity-field input,
        .account-activity-field select {
            min-width: 10rem;
            padding: 0.35rem 0.5rem;
            border-radius: var(--radius-sm);
            border: 1px solid var(--border);
            background: var(--bg);
            color: var(--text);
            font: inherit;
        }
        .account-activity-table-wrap {
            border-radius: var(--radius);
            border: 1px solid var(--border);
        }
        .account-activity-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.8rem;
        }
        .account-activity-table th {
            text-align: left;
            padding: 0.45rem 0.55rem;
            background: color-mix(in srgb, var(--surface) 90%, transparent);
            color: var(--text-muted);
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            font-size: 0.68rem;
        }
        .account-activity-table td {
            padding: 0.42rem 0.55rem;
            border-top: 1px solid var(--border);
            vertical-align: top;
        }
        .account-activity-table tbody tr.account-activity-row {
            cursor: pointer;
            transition: background 0.12s ease;
        }
        .account-activity-table tbody tr.account-activity-row:hover {
            background: var(--table-stripe);
        }
        .account-activity-table tbody tr.account-activity-row--open {
            background: color-mix(in srgb, var(--accent) 8%, var(--surface));
        }
        .account-activity-detail td {
            background: var(--bg-elevated);
            padding: 0.5rem 0.65rem;
        }
        .account-activity-pre {
            font-family: 'JetBrains Mono', ui-monospace, monospace;
            font-size: 0.72rem;
            white-space: pre-wrap;
            word-break: break-word;
            margin: 0;
            max-height: 12rem;
            overflow: auto;
        }
        .acct-type-pill {
            display: inline-block;
            padding: 0.12rem 0.38rem;
            border-radius: 6px;
            background: color-mix(in srgb, var(--accent) 12%, transparent);
            font-size: 0.72rem;
            font-weight: 600;
        }
        .acct-src {
            color: var(--text-secondary);
            font-size: 0.76rem;
        }
        .account-activity-foot {
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
            margin-top: 0.65rem;
        }
        .account-activity-legend {
            font-size: 0.72rem;
            color: var(--text-muted);
            line-height: 1.45;
            max-width: 56rem;
        }
        .account-activity-table .mono {
            font-family: 'JetBrains Mono', ui-monospace, monospace;
            font-size: 0.78rem;
        }
        .account-center-reconcile {
            margin-bottom: 0.75rem;
            padding: 0.55rem 0.75rem;
            font-size: 0.8rem;
            line-height: 1.45;
            color: var(--text-secondary);
            border: 1px solid color-mix(in srgb, var(--border) 80%, var(--accent) 15%);
        }
        .account-center-reconcile--warn {
            border-color: color-mix(in srgb, var(--border) 70%, #f59e0b 35%);
            background: color-mix(in srgb, var(--surface) 92%, #f59e0b 6%);
        }
        .account-center-reconcile__link {
            margin-left: 0.35rem;
            padding: 0;
            border: none;
            background: none;
            color: var(--accent);
            font: inherit;
            font-weight: 600;
            cursor: pointer;
            text-decoration: underline;
        }
        .account-center-reconcile__link:hover { color: var(--accent-strong); }
        .account-center-range-presets {
            display: inline-flex;
            flex-wrap: wrap;
            gap: 0.28rem;
            align-items: center;
        }
        .account-center-range-btn {
            text-transform: none;
            letter-spacing: 0.02em;
            font-weight: 600;
            opacity: 0.85;
        }
        .account-center-range-btn--active {
            opacity: 1;
            outline: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
            background: color-mix(in srgb, var(--accent) 18%, var(--surface));
        }
        .account-center-state-msg {
            font-size: 0.8rem;
            padding: 0.4rem 0.5rem;
            margin-bottom: 0.35rem;
            border-radius: var(--radius-sm);
            color: var(--text-secondary);
        }
        .account-center-state-msg--loading {
            color: var(--text-muted);
        }
        .account-center-state-msg--err {
            color: var(--red-dim);
        }
        .account-center-state-msg--ok {
            color: var(--text-secondary);
        }
        .acct-side-buy { color: var(--green-dim); font-weight: 600; }
        .acct-side-sell { color: var(--red-dim); font-weight: 600; }
        .acct-side-mid { color: var(--text-muted); font-size: 0.78rem; }
        .account-center-bench-label {
            display: inline-flex;
            align-items: center;
            gap: 0.28rem;
            margin-left: 0.25rem;
            font-size: 0.76rem;
            color: var(--text-secondary);
            cursor: pointer;
            user-select: none;
        }
        .account-center-bench-label input { accent-color: var(--accent); }
        .account-center-poll-hint {
            font-size: 0.72rem;
            color: var(--text-muted);
            margin: 0 0 0.35rem 0;
            line-height: 1.35;
        }
        .account-activity-row--alert-audit {
            box-shadow: inset 3px 0 0 0 color-mix(in srgb, #f59e0b 75%, var(--border));
            background: color-mix(in srgb, var(--surface) 94%, #f59e0b 5%);
        }
        .account-activity-row--alert-fee {
            box-shadow: inset 3px 0 0 0 color-mix(in srgb, #ef4444 70%, var(--border));
            background: color-mix(in srgb, var(--surface) 94%, #ef4444 4%);
        }
        .account-activity-row--alert-live {
            box-shadow: inset 3px 0 0 0 color-mix(in srgb, var(--accent) 65%, var(--border));
            background: color-mix(in srgb, var(--surface) 92%, var(--accent) 7%);
            animation: account-activity-alert-live-pulse 1.4s ease-in-out 2;
        }
        @keyframes account-activity-alert-live-pulse {
            0%, 100% { background: color-mix(in srgb, var(--surface) 92%, var(--accent) 7%); }
            50% { background: color-mix(in srgb, var(--surface) 88%, var(--accent) 12%); }
        }

        /* Skip link, connectivity banner, toasts, skeletons, compact density */
        .chbot-skip-link {
            position: absolute;
            top: 0.5rem;
            left: 0.5rem;
            z-index: 10000;
            padding: 0.45rem 0.75rem;
            font-size: 0.8125rem;
            font-weight: 600;
            color: var(--bg);
            background: var(--accent-strong);
            border-radius: var(--radius-sm);
            text-decoration: none;
            transform: translateY(-160%);
            transition: transform 0.2s ease, box-shadow 0.2s ease;
            box-shadow: var(--shadow);
        }
        .chbot-skip-link:focus {
            outline: 2px solid var(--accent);
            outline-offset: 3px;
            transform: translateY(0);
        }
        #main-content:focus {
            outline: none;
        }
        #main-content:focus-visible {
            box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent);
            border-radius: 4px;
        }
        .chbot-offline-banner {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            z-index: 9998;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.75rem;
            flex-wrap: wrap;
            padding: 0.55rem 1rem;
            font-size: 0.875rem;
            font-weight: 600;
            color: #fff;
            background: linear-gradient(90deg, var(--red-dim), #b91c1c);
            box-shadow: 0 -4px 20px rgba(0,0,0,0.25);
        }
        .chbot-offline-banner[hidden] {
            display: none !important;
        }
        [data-theme="light"] .chbot-offline-banner {
            color: #fff;
        }
        .chbot-offline-banner__retry {
            padding: 0.35rem 0.85rem;
            font: inherit;
            font-weight: 700;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            color: var(--red-dim);
            background: #fff;
        }
        .chbot-offline-banner__retry:focus-visible {
            outline: 2px solid #fff;
            outline-offset: 2px;
        }
        .chbot-toast-host {
            position: fixed;
            bottom: 1.1rem;
            right: 1rem;
            z-index: 9999;
            display: flex;
            flex-direction: column;
            gap: 0.45rem;
            align-items: flex-end;
            pointer-events: none;
            max-width: min(22rem, calc(100vw - 2rem));
        }
        .chbot-toast {
            pointer-events: none;
            padding: 0.55rem 0.85rem;
            border-radius: var(--radius-sm);
            font-size: 0.8125rem;
            font-weight: 600;
            color: var(--text);
            background: var(--surface);
            border: 1px solid var(--border);
            box-shadow: var(--shadow-lg);
            opacity: 0;
            transform: translateY(6px);
            transition: opacity 0.22s ease, transform 0.22s ease;
        }
        .chbot-toast--visible {
            opacity: 1;
            transform: translateY(0);
        }
        .chbot-toast--success {
            border-color: color-mix(in srgb, var(--green-dim) 45%, var(--border));
            background: color-mix(in srgb, var(--green-dim) 12%, var(--surface));
        }
        .chbot-toast--error {
            border-color: color-mix(in srgb, var(--red-dim) 50%, var(--border));
            background: color-mix(in srgb, var(--red-dim) 12%, var(--surface));
        }
        .chart-placeholder--skeleton {
            display: flex;
            flex-direction: column;
            align-items: stretch;
            justify-content: center;
            min-height: 12rem;
            width: 100%;
            gap: 0.85rem;
            padding: 1rem;
        }
        .chart-skeleton__grid {
            height: 7.5rem;
            border-radius: var(--radius-sm);
            background: linear-gradient(
                90deg,
                color-mix(in srgb, var(--border) 55%, transparent) 0%,
                color-mix(in srgb, var(--accent) 18%, var(--surface)) 50%,
                color-mix(in srgb, var(--border) 55%, transparent) 100%
            );
            background-size: 200% 100%;
            animation: chbot-shimmer 1.35s ease-in-out infinite;
        }
        .chart-skeleton__line {
            height: 0.65rem;
            border-radius: 6px;
            width: 88%;
            margin: 0 auto;
            background: color-mix(in srgb, var(--border) 70%, transparent);
            animation: chbot-shimmer 1.35s ease-in-out infinite;
            background-size: 200% 100%;
            background-image: linear-gradient(
                90deg,
                color-mix(in srgb, var(--border) 50%, transparent),
                color-mix(in srgb, var(--text-muted) 35%, transparent),
                color-mix(in srgb, var(--border) 50%, transparent)
            );
        }
        .chart-skeleton__line--short { width: 52%; }
        .chart-skeleton__label {
            display: flex;
            align-items: center;
            justify-content: center;
        }
        @keyframes chbot-shimmer {
            0% { background-position: 100% 0; }
            100% { background-position: -100% 0; }
        }
        .chbot-skeleton-cell {
            display: block;
            height: 0.72rem;
            border-radius: 6px;
            background: color-mix(in srgb, var(--border) 75%, transparent);
            animation: chbot-shimmer 1.2s ease-in-out infinite;
            background-size: 200% 100%;
            background-image: linear-gradient(
                90deg,
                color-mix(in srgb, var(--border) 40%, transparent),
                color-mix(in srgb, var(--accent) 15%, var(--surface)),
                color-mix(in srgb, var(--border) 40%, transparent)
            );
        }
        .chbot-skeleton-cell--sm { max-width: 3.5rem; }
        .chbot-skeleton-cell--md { max-width: 5.5rem; }
        .chbot-data-age {
            font-variant-numeric: tabular-nums;
            letter-spacing: 0.02em;
        }
        body.chbot-compact-ui .table-wrap th,
        body.chbot-compact-ui .table-wrap td {
            padding: 0.32rem 0.45rem;
            font-size: 0.78rem;
        }
        body.chbot-compact-ui .section {
            margin-bottom: 1rem;
        }
        body.chbot-compact-ui .section-header {
            margin-bottom: 0.45rem;
        }
        body.chbot-compact-ui .badge {
            font-size: 0.62rem;
            padding: 0.22rem 0.4rem;
        }
        body.chbot-compact-ui .positions-summary-card {
            padding: 0.35rem 0.45rem;
        }
        .header-tools-compact-icon {
            font-size: 0.85rem;
            opacity: 0.9;
            margin-right: 0.15rem;
        }
        #btnCompactUi.active {
            outline: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
            background: color-mix(in srgb, var(--accent) 14%, var(--surface));
        }
        @media (max-width: 768px) {
            .header-tools-menu-item,
            .section-collapse-toggle,
            .position-tab {
                min-height: 44px;
            }
            .sidebar-nav a {
                min-height: 40px;
            }
            .chbot-toast-host {
                left: 0.65rem;
                right: 0.65rem;
                align-items: stretch;
            }
            .chbot-toast {
                text-align: center;
            }
        }
        @media (prefers-reduced-motion: reduce) {
            .chart-skeleton__grid,
            .chart-skeleton__line,
            .chbot-skeleton-cell {
                animation: none;
                background: color-mix(in srgb, var(--border) 65%, transparent);
            }
        }

/* Overview: Binance Spot test-network indicator */
.badge-testnet-overview {
    display: inline-block;
    margin-top: 0.35rem;
    padding: 0.12rem 0.45rem;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    border-radius: 6px;
    background: color-mix(in srgb, #fbbf24 22%, transparent);
    color: #fde68a;
    border: 1px solid color-mix(in srgb, #fbbf24 45%, transparent);
}
[data-theme="light"] .badge-testnet-overview {
    background: rgba(251, 191, 36, 0.35);
    color: #92400e;
    border-color: rgba(251, 146, 60, 0.55);
}
