:root {
    --sidebar-width: 220px;
    --sidebar-fill: #1e2329;
    --sidebar-text: #f4f4f5;
    --sidebar-muted: #a0a8b3;
    --orange-fill: #ff8500;
    --orange-hover: #eb7700;
    --orange-bright: var(--orange-fill);
    --text-on-orange: #0d0f12;
    --brand-success: #22c55e;
    --brand-danger: #ef4444;
    --surface-page: #f1f2f4;
    --surface-panel: #fff;
    --surface-soft: #f7f8fa;
    --ink: #1b232b;
    --ink-muted: #536272;
    --line: #d9dee4;
    --brand-text: #a43c00;
}
[data-bs-theme="dark"] {
    --surface-page: #0d0f12;
    --surface-panel: #1e2329;
    --surface-soft: #252b32;
    --ink: #f4f4f5;
    --ink-muted: #a0a8b3;
    --line: #2f3741;
    --brand-text: var(--orange-bright);
}
body { background: var(--surface-page); color: var(--ink); font: 0.875rem/1.5 system-ui, "Segoe UI", sans-serif; }
a { color: var(--brand-text); }
a:hover { color: var(--brand-text); }
:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 3px; }
.muted { color: var(--ink-muted); }
.skip-link { position: fixed; inset: 8px auto auto 8px; padding: 8px; background: var(--surface-panel); z-index: 1090; }
.surface { background: var(--surface-panel); border: 1px solid var(--line); border-radius: 6px; padding: 22px 24px; }
.surface h2, .toolbar-popover h2 { font-size: 0.94rem; font-weight: 650; margin: 0 0 8px; }
.workspace-main { padding: 26px; }
.page-heading { font-size: 1.48rem; letter-spacing: -.025em; margin: 0 0 4px; font-weight: 720; }
.page-intro { margin-bottom: 20px; }
.btn-brand { --bs-btn-color: var(--text-on-orange); --bs-btn-bg: var(--orange-fill); --bs-btn-border-color: var(--orange-fill); --bs-btn-hover-color: var(--text-on-orange); --bs-btn-hover-bg: var(--orange-hover); --bs-btn-hover-border-color: var(--orange-hover); --bs-btn-active-color: var(--text-on-orange); --bs-btn-active-bg: var(--orange-hover); --bs-btn-active-border-color: var(--orange-hover); --bs-btn-focus-shadow-rgb: 255, 133, 0; }
.trader-sidebar {
    --bs-offcanvas-width: min(86vw, var(--sidebar-width));
    background: var(--sidebar-fill) !important;
    color: var(--sidebar-text);
    overflow-y: auto;
}
.sidebar-header { position: relative; display: flex; align-items: center; justify-content: center; min-height: 68px; padding: 10px 44px 14px; }
.wordmark { display: inline-flex; align-items: center; min-width: 0; width: var(--wordmark-width, 200px); max-width: 100%; }
.wordmark-logo { display: block; width: 100%; aspect-ratio: 3.2; overflow: hidden; }
.wordmark-wide { display: block; width: 125%; height: auto; }
.wordmark-light, .wordmark-icon { display: none; }
[data-bs-theme="light"] .auth-card .wordmark-dark { display: none; }
[data-bs-theme="light"] .auth-card .wordmark-light { display: block; }
.wordmark-icon { width: 30px; height: 30px; object-fit: contain; }
.sidebar-header .wordmark { --wordmark-width: 154px; }
.sidebar-logo { display: block; width: 100%; height: auto; }

.sidebar-close { position: absolute; inset: 10px 10px auto auto; color: #fff; border-color: var(--sidebar-muted); }
.sidebar-nav { display: grid; align-content: start; gap: 3px; padding: 14px 10px; }
.side-link { display: flex; align-items: center; gap: 11px; min-height: 39px; padding: 8px 11px; width: 100%; min-width: 0; border: 0; border-radius: 5px; background: transparent; text-align: left; text-decoration: none; color: var(--sidebar-text); font: inherit; font-size: .82rem; white-space: nowrap; }
.side-link > :is(i, svg) { width: 1.2em; flex: 0 0 1.2em; text-align: center; }
.side-link:hover:not(.is-planned) { color: white; background: #30363c; }
.side-link.is-active, .side-link.is-active:hover { color: var(--text-on-orange); background: var(--orange-fill); }
.side-link.is-planned { color: var(--sidebar-muted); }
.side-link > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.side-link small { flex: none; font-size: .58rem; color: var(--sidebar-muted); }
.sidebar-nav :focus-visible { outline-color: var(--orange-bright); }
.topbar { position: relative; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 53px; padding: 8px 26px; background: var(--surface-panel); border-bottom: 1px solid var(--line); }
.toolbar-start, .toolbar-end, .breadcrumbs { display: flex; align-items: center; gap: 9px; }
.breadcrumbs { font-size: .8rem; white-space: nowrap; }
.breadcrumbs span { color: var(--ink-muted); }
.tool-button { min-height: 30px; min-width: 32px; padding: 4px 8px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); border-radius: 4px; background: transparent; color: var(--ink); font: inherit; font-size: .78rem; cursor: pointer; }
.tool-button:hover { background: var(--surface-soft); }
.tool-button::-webkit-details-marker { display: none; }
.tool-button.sidebar-collapse { display: none; }
.mode-label { font-size: .68rem; font-weight: 750; letter-spacing: .07em; border: 1px solid var(--line); border-radius: 3px; padding: 3px 6px; color: var(--brand-text); }
.toolbar-menu { position: relative; }
.toolbar-popover { position: absolute; z-index: 6; right: 0; top: calc(100% + 8px); padding: 12px; min-width: 174px; max-width: calc(100vw - 24px); background: var(--surface-panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 10px 24px #0002; }
.toolbar-popover a, .clear-button { display: block; padding: 6px 8px; text-decoration: none; color: var(--ink); white-space: nowrap; }
.clear-button { border: 0; background: transparent; text-align: left; width: 100%; font: inherit; }
.toolbar-popover a:hover, .clear-button:hover { background: var(--surface-soft); }
.health-dot { width: 8px; height: 8px; border-radius: 50%; background: #87939e; flex: 0 0 8px; display: inline-block; vertical-align: .06em; }
.health-dot[data-state="healthy"] { background: var(--brand-success); }
.health-dot[data-state="pending"], .health-dot[data-state="stale"], .health-dot[data-state="degraded"], .health-dot[data-state="action-required"] { background: #b97805; }
.health-dot[data-state="unhealthy"], .health-dot[data-state="unavailable"] { background: #d64a51; }
.health-row { display: grid; gap: 2px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.health-row:last-child { border-bottom: 0; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(165px, 100%), 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { margin: 0; padding: 14px 17px; min-height: 98px; }
.kpi dt { margin-bottom: 6px; font-size: .78rem; color: var(--ink-muted); font-weight: 550; }
.kpi dd { font-size: 1.48rem; line-height: 1.2; margin: 0 0 5px; font-weight: 680; }
.kpi .kpi-detail { margin: 0; color: var(--ink-muted); font-size: .78rem; font-weight: 500; line-height: 1.5; }
.btn > :is(i, svg) { margin-inline-end: .22em; }
[data-bs-theme="dark"] .tool-button .theme-dark-icon,
[data-bs-theme="light"] .tool-button .theme-light-icon { display: none; }
.icon-heading { display: flex; align-items: center; gap: .45em; }
.provider-icon { flex: 0 0 1em; width: 1em; height: 1em; object-fit: contain; text-align: center; }
[data-bs-theme="dark"] img.provider-icon { filter: invert(1); }
.exchange-provider-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 315px), 1fr)); gap: 14px; }
.exchange-provider-card { min-width: 0; padding: 16px; }
.exchange-provider-accounts { padding: 0; margin: 10px 0; list-style: none; }
.exchange-provider-accounts li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; padding: 7px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.research-card { min-width: 0; overflow-wrap: anywhere; }
.connection-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 12px; }
.auth-page { min-height: 100vh; }
.auth-controls { position: absolute; inset: 16px 17px auto auto; }
.auth-wrap { min-height: 100vh; padding: 68px 18px 36px; display: grid; place-items: center; }
.auth-card { width: min(100%, 420px); padding: 29px 30px; }
.auth-card .wordmark { margin-bottom: 22px; }
.auth-card h1 { margin: 0 0 6px; font-size: 1.4rem; font-weight: 720; letter-spacing: -.025em; }
.auth-card .form-control, .account-card .form-control { margin-bottom: 14px; background: var(--surface-panel); color: var(--ink); border-color: var(--line); }
.auth-card .form-control:focus, .account-card .form-control:focus {
    border-color: var(--brand-text);
    box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--brand-text) 28%, transparent);
}
.auth-card .btn-outline-secondary, .account-card .btn-outline-secondary {
    --bs-btn-color: var(--ink-muted);
    --bs-btn-border-color: var(--line);
    --bs-btn-hover-color: var(--ink);
    --bs-btn-hover-bg: var(--surface-soft);
    --bs-btn-hover-border-color: var(--ink-muted);
}
.auth-card .input-group .form-control { margin-bottom: 0; }
.auth-card .input-group { margin-bottom: 15px; }
.account-card { max-width: 640px; margin-bottom: 14px; }
.account-card img { max-width: 100%; height: auto; }
.recovery-codes { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 8px; list-style: none; padding: 0; }
@media (min-width: 992px) {
    .trader-sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width); height: 100vh; border: 0; }
    .workspace { margin-left: var(--sidebar-width); }
    .sidebar-header { padding-inline: 14px; }
    .sidebar-close, .tool-button.mobile-menu { display: none; }
    .tool-button.sidebar-collapse { display: inline-flex; }
    [data-sidebar="compact"] { --sidebar-width: 59px; }
    [data-sidebar="compact"] .sidebar-header { padding: 6px 0; min-height: 68px; }
    [data-sidebar="compact"] .sidebar-header .wordmark { width: 30px; }
    [data-sidebar="compact"] .sidebar-logo,
    [data-sidebar="compact"] .side-link span, [data-sidebar="compact"] .side-link small { display: none; }
    [data-sidebar="compact"] .sidebar-header .wordmark-icon { display: block; }
    [data-sidebar="compact"] .sidebar-nav { padding-inline: 6px; }
    [data-sidebar="compact"] .side-link { justify-content: center; padding: 8px; }
}
@media (max-width: 1150px) {
    .topbar { flex-wrap: wrap; }
}
@media (max-width: 575px) {
    .workspace-main, .topbar { padding-inline: 14px; }
    .surface { padding: 16px; }
    .toolbar-start, .toolbar-end { gap: 5px; }
    .breadcrumbs > span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
