:root {
  color-scheme: dark;
  --bg: #07101d;
  --panel: #0d1929;
  --panel-2: #122238;
  --sidebar: #08131f;
  --text: #edf3fb;
  --muted: #8fa1b8;
  --line: #203550;
  --brand: #2bd7a3;
  --brand-2: #13ba84;
  --danger: #ff6b7d;
  --warning: #f4c45c;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); }
button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.eyebrow { color: var(--brand); letter-spacing: .15em; font-size: 11px; font-weight: 800; }

html.auth-booting body { overflow: hidden; }
html.auth-booting #login-page,
html.auth-booting #app-shell { display: none !important; }
.auth-boot { min-height: 100vh; min-height: 100svh; display: none; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 42%, rgba(43, 215, 163, .1), transparent 32%), var(--bg); }
html.auth-booting .auth-boot { display: grid; }
.auth-boot-card { width: min(100%, 390px); display: grid; grid-template-columns: 52px minmax(0, 1fr) 22px; align-items: center; gap: 16px; padding: 20px; border: 1px solid rgba(43, 215, 163, .18); border-radius: 16px; background: rgba(13, 25, 41, .88); box-shadow: 0 24px 70px rgba(0, 0, 0, .28); }
.auth-boot-logo { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px; color: #041b15; background: var(--brand); font-size: 23px; font-weight: 900; }
.auth-boot-card > div { min-width: 0; display: grid; gap: 5px; }
.auth-boot-card strong { font-size: 15px; }
.auth-boot-card small { color: var(--muted); font-size: 12px; }
.auth-boot-spinner { width: 20px; height: 20px; border: 2px solid rgba(43, 215, 163, .22); border-top-color: var(--brand); border-radius: 50%; animation: auth-boot-spin .8s linear infinite; }
@keyframes auth-boot-spin { to { transform: rotate(360deg); } }

.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(420px, .75fr); background: #091421; }
.login-visual { min-height: 100vh; padding: 44px clamp(40px, 6vw, 96px); display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; background: radial-gradient(circle at 68% 26%, rgba(31, 111, 112, .32), transparent 28%), linear-gradient(145deg, #0a1928, #07101c 66%); }
.login-visual::after { content: ""; position: absolute; width: 520px; height: 520px; right: -170px; bottom: -210px; border: 1px solid rgba(43, 215, 163, .16); border-radius: 50%; box-shadow: 0 0 0 70px rgba(43, 215, 163, .025), 0 0 0 140px rgba(43, 215, 163, .018); }
.brand-mark, .mobile-brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 20px; position: relative; z-index: 1; }
.brand-mark span, .mobile-brand span, .sidebar-brand > span { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #041b15; background: var(--brand); font-weight: 900; }
.login-copy { position: relative; z-index: 1; max-width: 760px; }
.login-copy h1 { font-size: clamp(42px, 5.2vw, 76px); line-height: 1.06; letter-spacing: -.045em; margin: 18px 0 26px; }
.login-copy p { max-width: 650px; margin: 0; color: #9eb0c5; font-size: 18px; line-height: 1.75; }
.trust-row { display: flex; flex-wrap: wrap; gap: 28px; color: #b9c8d9; font-size: 13px; position: relative; z-index: 1; }
.trust-row span { display: flex; align-items: center; gap: 9px; }
.trust-row i { width: 7px; height: 7px; background: var(--brand); border-radius: 50%; box-shadow: 0 0 0 4px rgba(43, 215, 163, .1); }
.login-panel { min-height: 100vh; display: grid; place-items: center; padding: 36px clamp(28px, 4vw, 72px); background: #0b1624; border-left: 1px solid rgba(255, 255, 255, .06); }
.auth-card { width: min(100%, 430px); }
.mobile-brand { display: none; margin-bottom: 48px; }
.auth-heading h2 { margin: 10px 0 6px; font-size: 30px; letter-spacing: -.03em; }
.auth-heading p { color: var(--muted); margin: 0 0 28px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 12px; background: #07111d; border: 1px solid #182a40; margin-bottom: 24px; }
.tabs button { border: 0; padding: 11px; border-radius: 9px; background: transparent; color: var(--muted); }
.tabs button.active { background: var(--panel-2); color: var(--text); box-shadow: 0 3px 12px rgba(0, 0, 0, .2); }
form { display: grid; gap: 17px; }
label { display: grid; gap: 8px; color: #a8b7ca; font-size: 13px; }
input { width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 11px; background: #07121f; color: var(--text); padding: 13px 14px; outline: none; font-size: 16px; }
input::placeholder { color: #586d85; }
input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(43, 215, 163, .11); }
button { min-height: 42px; border-radius: 10px; padding: 10px 16px; border: 1px solid transparent; }
.primary { background: var(--brand); color: #032018; font-weight: 800; }
.primary:hover { background: var(--brand-2); }
.wide { width: 100%; margin-top: 4px; }
.secondary { background: rgba(43, 215, 163, .1); border-color: rgba(43, 215, 163, .35); color: var(--brand); font-weight: 700; }
.danger { background: transparent; color: var(--danger); border-color: rgba(255, 107, 125, .45); }
.message { min-height: 22px; margin: 14px 0 0; color: var(--muted); }
.message.error { color: var(--danger); }
.message.success { color: var(--brand); }
.security-note { padding-top: 18px; border-top: 1px solid var(--line); color: #64768d; font-size: 12px; line-height: 1.6; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); background: radial-gradient(circle at 80% -10%, rgba(32, 102, 112, .14), transparent 28%), var(--bg); }
.sidebar { height: 100vh; position: sticky; top: 0; z-index: 30; display: flex; flex-direction: column; padding: 24px 16px 18px; background: rgba(7, 18, 30, .96); border-right: 1px solid rgba(255, 255, 255, .07); }
.sidebar-brand { min-height: 48px; display: flex; align-items: center; gap: 11px; padding: 0 10px 20px; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.sidebar-brand > span { width: 34px; height: 34px; border-radius: 9px; }
.sidebar-brand div { display: grid; gap: 2px; }
.sidebar-brand strong { font-size: 17px; }
.sidebar-brand small { color: #668097; font-size: 9px; letter-spacing: .16em; }
.side-nav { flex: 1; padding: 18px 0; overflow-y: auto; }
.side-nav p { padding: 0 12px; margin: 18px 0 8px; color: #536b82; font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.side-nav p:first-child { margin-top: 0; }
.nav-item { width: 100%; min-height: 46px; display: flex; align-items: center; gap: 12px; padding: 8px 10px; margin: 3px 0; border: 0; border-radius: 10px; background: transparent; color: #8ea2b8; text-align: left; text-decoration: none; cursor: pointer; }
.nav-item > span { flex: 0 0 28px; width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid #263b51; border-radius: 8px; color: #7590a8; font-size: 12px; }
.nav-item > i { margin-left: auto; color: #587087; font-size: 9px; font-style: normal; }
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, .035); }
.nav-item.active { color: var(--text); background: linear-gradient(90deg, rgba(43, 215, 163, .14), rgba(43, 215, 163, .035)); }
.nav-item.active > span { color: #042019; border-color: var(--brand); background: var(--brand); }
.sidebar-account { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px; padding: 15px 8px 0; border-top: 1px solid rgba(255, 255, 255, .07); }
.avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: #163149; color: var(--brand); font-weight: 800; text-transform: uppercase; }
.sidebar-account div:nth-child(2) { min-width: 0; display: grid; gap: 2px; }
.sidebar-account strong { overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.sidebar-account small { color: #62788f; font-size: 10px; }
.sidebar-account button { min-height: 32px; padding: 5px 7px; border: 0; background: transparent; color: #71859a; font-size: 11px; }
.workspace { min-width: 0; }
.mobile-bar { display: none; }
.workspace-content { width: min(1240px, calc(100% - 64px)); margin: 0 auto; padding: 54px 0 72px; }
.workspace-content.monitor-mode { width: calc(100% - 24px); padding: 12px 0 24px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.page-heading h1 { margin: 8px 0 5px; font-size: clamp(30px, 3vw, 42px); letter-spacing: -.035em; }
.page-heading p { margin: 0; color: var(--muted); }
.live-lock { display: flex; align-items: center; gap: 9px; padding: 9px 13px; border: 1px solid rgba(244, 196, 92, .25); border-radius: 999px; color: var(--warning); background: rgba(244, 196, 92, .055); font-size: 12px; }
.live-lock i, .status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warning); }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.metric-card, .card { border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(155deg, rgba(17, 34, 55, .93), rgba(10, 24, 40, .93)); box-shadow: 0 16px 42px rgba(0, 0, 0, .14); }
.metric-card { display: grid; gap: 9px; min-height: 142px; padding: 22px; }
.metric-card span { color: var(--muted); font-size: 12px; }
.metric-card strong { overflow: hidden; text-overflow: ellipsis; font-size: 23px; }
.metric-card small { color: #5f768e; font-size: 11px; }
.account-metric-card { position: relative; grid-template-rows: auto auto 1fr; align-content: start; transition: border-color .18s ease, background .18s ease; }
.metric-card-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.metric-card-label > span:first-child { color: var(--muted); }
.account-state { flex: 0 0 auto; padding: 4px 7px; border: 1px solid #2a4057; border-radius: 999px; color: #7890a8 !important; background: rgba(120, 144, 168, .07); font-size: 9px !important; font-weight: 800; }
.account-metric-card.connected { border-color: rgba(43, 215, 163, .28); }
.account-metric-card.connected .account-state { border-color: rgba(43, 215, 163, .35); color: var(--brand) !important; background: rgba(43, 215, 163, .08); }
.account-metric-card.trade-enabled { border-color: rgba(43, 215, 163, .28); }
.account-metric-card.trade-enabled .account-state { border-color: rgba(43, 215, 163, .35); color: var(--brand) !important; background: rgba(43, 215, 163, .08); }
.account-metric-card.read-only .account-state { border-color: rgba(244, 196, 92, .32); color: var(--warning) !important; background: rgba(244, 196, 92, .07); }
.account-metric-card.connection-error { border-color: rgba(255, 107, 125, .25); }
.account-metric-card.connection-error .account-state { border-color: rgba(255, 107, 125, .34); color: var(--danger) !important; background: rgba(255, 107, 125, .07); }
.account-metric-card.unconfigured { border-style: dashed; }
.account-metric-card.unconfigured, .account-metric-card.connection-error { padding-bottom: 52px; }
.account-metric-card.loading .account-state { animation: account-pulse 1.25s ease-in-out infinite; }
.account-metric-card small { min-width: 0; overflow-wrap: anywhere; line-height: 1.5; }
.account-card-action { min-height: 28px; position: absolute; right: 16px; bottom: 14px; padding: 4px 8px; border: 1px solid rgba(43, 215, 163, .3); border-radius: 7px; color: var(--brand); background: rgba(43, 215, 163, .07); font-size: 9px; font-weight: 700; }
.account-card-action:hover { border-color: var(--brand); background: rgba(43, 215, 163, .12); }
@keyframes account-pulse { 50% { opacity: .45; } }
.performance-dashboard { display: grid; gap: 16px; }
.performance-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; margin-top: 34px; }
.performance-heading h2 { margin: 7px 0 5px; font-size: 25px; letter-spacing: -.025em; }
.performance-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.performance-heading-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.performance-heading-actions > span { padding: 6px 9px; border: 1px solid rgba(43, 215, 163, .22); border-radius: 999px; color: var(--brand); background: rgba(43, 215, 163, .06); font-size: 9px; font-weight: 800; }
.performance-heading-actions button, .calendar-controls button { min-height: 32px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px; color: #93a7bb; background: rgba(9, 22, 36, .85); font-size: 10px; }
.performance-heading-actions button:hover:not(:disabled), .calendar-controls button:hover:not(:disabled) { border-color: #36536d; color: var(--text); }
.performance-heading-actions button:disabled, .calendar-controls button:disabled { opacity: .42; cursor: not-allowed; }
.performance-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.performance-side { min-width: 0; display: grid; gap: 12px; padding: 14px; border: 1px solid rgba(132, 158, 183, .15); border-radius: 18px; background: linear-gradient(160deg, rgba(12, 27, 44, .72), rgba(7, 18, 30, .72)); }
.performance-side.virtual-performance { border-color: rgba(43, 215, 163, .17); }
.performance-side.binance-performance { border-color: rgba(77, 141, 247, .2); }
.performance-side-heading { min-height: 68px; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 3px 3px 0; }
.performance-side-heading > div { min-width: 0; }
.performance-side-heading h3 { margin: 4px 0; font-size: 17px; }
.performance-side-heading p { margin: 0; color: #667d93; font-size: 9px; line-height: 1.5; }
.side-kicker { color: var(--brand); font-size: 8px; font-weight: 800; letter-spacing: .13em; }
.side-kicker.live { color: #78a7f8; }
.performance-source { flex: 0 0 auto; max-width: 46%; overflow: hidden; padding: 5px 7px; border: 1px solid rgba(132, 158, 183, .18); border-radius: 999px; color: #8ba0b6; background: rgba(132, 158, 183, .055); font-size: 8px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.performance-source.paper { color: var(--brand); border-color: rgba(43, 215, 163, .22); background: rgba(43, 215, 163, .055); }
.performance-source.live { color: #8bb6ff; border-color: rgba(77, 141, 247, .26); background: rgba(77, 141, 247, .075); }
.performance-side-tools { flex: 0 1 auto; min-width: 0; display: grid; justify-items: end; gap: 6px; }
.performance-side-tools .performance-source { max-width: 100%; }
.performance-asset-picker { display: flex; align-items: center; gap: 6px; color: #677d93; font-size: 8px; }
.performance-asset-picker > span { white-space: nowrap; }
.performance-asset-picker select { min-width: 72px; min-height: 28px; padding: 4px 22px 4px 8px; border: 1px solid rgba(77, 141, 247, .25); border-radius: 7px; outline: none; color: #a9c7f7; background: #0a1829; font: inherit; font-size: 9px; }
.performance-asset-picker select:focus-visible { border-color: #4d8df7; box-shadow: 0 0 0 3px rgba(77, 141, 247, .12); }
.performance-asset-picker select:disabled { opacity: .72; }
.performance-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.performance-side .performance-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.performance-side .performance-metric { min-height: 108px; padding: 14px; }
.performance-side .performance-metric > strong { font-size: 21px; }
.performance-metric { min-width: 0; min-height: 116px; display: grid; align-content: start; gap: 8px; padding: 17px 18px; overflow: hidden; position: relative; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(145deg, rgba(17, 35, 55, .94), rgba(9, 23, 38, .94)); box-shadow: 0 12px 30px rgba(0, 0, 0, .12); }
.performance-metric::after { content: ""; width: 82px; height: 82px; position: absolute; right: -34px; bottom: -44px; border: 1px solid rgba(43, 215, 163, .08); border-radius: 50%; }
.performance-metric.primary-performance { border-color: rgba(43, 215, 163, .3); background: radial-gradient(circle at 90% 10%, rgba(77, 141, 247, .16), transparent 44%), linear-gradient(135deg, rgba(18, 58, 68, .96), rgba(12, 31, 51, .96)); }
.performance-metric.primary-performance::before { content: ""; width: 3px; position: absolute; inset: 14px auto 14px 0; border-radius: 0 4px 4px 0; background: linear-gradient(var(--brand), #4d8df7); }
.performance-metric.live-primary { border-color: rgba(77, 141, 247, .32); background: radial-gradient(circle at 90% 10%, rgba(244, 196, 92, .12), transparent 44%), linear-gradient(135deg, rgba(20, 44, 74, .96), rgba(11, 29, 50, .96)); }
.performance-metric.live-primary::before { content: ""; width: 3px; position: absolute; inset: 14px auto 14px 0; border-radius: 0 4px 4px 0; background: linear-gradient(#4d8df7, var(--warning)); }
.performance-metric > span { color: var(--muted); font-size: 11px; }
.performance-metric > strong { overflow: hidden; color: #d8e3ed; font-size: 25px; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.performance-metric > strong.profit { color: var(--brand); }
.performance-metric > strong.loss { color: var(--danger); }
.performance-metric > strong.flat { color: #c4d0dc; }
.performance-metric > small { overflow: hidden; color: #627991; font-size: 9px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.performance-metric.loading > strong { width: 58%; color: transparent; border-radius: 5px; background: linear-gradient(100deg, #172b3f 25%, #203a51 42%, #172b3f 60%); background-size: 220% 100%; animation: performance-shimmer 1.4s ease-in-out infinite; }
@keyframes performance-shimmer { to { background-position-x: -220%; } }
.returns-calendar-card { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(155deg, rgba(14, 30, 48, .94), rgba(8, 21, 35, .94)); box-shadow: 0 16px 42px rgba(0, 0, 0, .14); }
.calendar-heading { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 18px; border-bottom: 1px solid rgba(132, 158, 183, .12); }
.calendar-heading h3 { margin: 0 0 5px; font-size: 15px; }
.calendar-heading p { margin: 0; color: #647b91; font-size: 9px; }
.calendar-controls { display: flex; align-items: center; gap: 6px; }
.calendar-controls > strong { min-width: 92px; color: #c9d6e2; font-size: 11px; text-align: center; }
.calendar-controls > button:not(.today-button) { width: 32px; padding-inline: 5px; font-size: 18px; line-height: 1; }
.calendar-controls .today-button { color: var(--brand); border-color: rgba(43, 215, 163, .25); }
.performance-status { margin: 12px 14px 0; padding: 10px 12px; border: 1px solid rgba(77, 141, 247, .22); border-radius: 9px; color: #89aeea; background: rgba(77, 141, 247, .06); font-size: 10px; text-align: center; }
.performance-status.loading::before { content: ""; width: 6px; height: 6px; display: inline-block; margin-right: 7px; border-radius: 50%; background: currentColor; animation: account-pulse 1s ease-in-out infinite; }
.performance-status.empty { color: #73889c; border-color: rgba(132, 158, 183, .13); background: rgba(132, 158, 183, .035); }
.performance-status.failed { color: #ff92a1; border-color: rgba(255, 107, 125, .28); background: rgba(255, 107, 125, .065); }
.binance-performance-callout { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 13px; border: 1px solid rgba(244, 196, 92, .22); border-radius: 11px; background: rgba(244, 196, 92, .055); }
.binance-performance-callout > div { min-width: 0; }
.binance-performance-callout strong { color: var(--warning); font-size: 11px; }
.binance-performance-callout p { margin: 4px 0 0; color: #7f8fa0; font-size: 9px; line-height: 1.5; }
.binance-performance-callout button { flex: 0 0 auto; min-height: 34px; padding: 6px 10px; border-color: rgba(244, 196, 92, .3); color: var(--warning); background: rgba(244, 196, 92, .075); font-size: 9px; font-weight: 800; }
.binance-performance-callout.error { border-color: rgba(255, 107, 125, .25); background: rgba(255, 107, 125, .055); }
.binance-performance-callout.error strong { color: #ff92a1; }
.binance-performance-callout.error button { border-color: rgba(255, 107, 125, .3); color: #ff92a1; background: rgba(255, 107, 125, .07); }
.binance-performance-callout.info { border-color: rgba(77, 141, 247, .24); background: rgba(77, 141, 247, .055); }
.binance-performance-callout.info strong { color: #8bb6ff; }
.returns-calendar { padding: 10px 14px 14px; }
.calendar-weekdays, .calendar-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.calendar-weekdays { margin-bottom: 6px; }
.calendar-weekdays span { padding: 5px; color: #647a90; font-size: 9px; font-weight: 700; text-align: center; }
.calendar-day { min-width: 0; min-height: 82px; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 1fr auto; align-items: start; gap: 4px; padding: 8px; border: 1px solid rgba(132, 158, 183, .1); border-radius: 9px; background: rgba(7, 18, 30, .64); }
.calendar-day.blank { border-color: transparent; background: transparent; }
.calendar-day.profit { border-color: rgba(43, 215, 163, .22); background: linear-gradient(145deg, rgba(43, 215, 163, .12), rgba(8, 27, 34, .68)); }
.calendar-day.loss { border-color: rgba(255, 107, 125, .22); background: linear-gradient(145deg, rgba(255, 107, 125, .12), rgba(31, 17, 29, .68)); }
.calendar-day.flat { border-color: rgba(132, 158, 183, .14); background: rgba(17, 31, 46, .58); }
.calendar-day.today { outline: 1px solid #4d8df7; outline-offset: 1px; }
.calendar-day-number { color: #8ea1b4; font-size: 9px; font-weight: 700; }
.calendar-day em { padding: 2px 4px; border-radius: 4px; color: #8bb6ff; background: rgba(77, 141, 247, .13); font-size: 7px; font-style: normal; }
.calendar-day strong { grid-column: 1 / -1; align-self: center; overflow: hidden; color: #8295a8; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.calendar-day.profit strong { color: var(--brand); }
.calendar-day.loss strong { color: var(--danger); }
.calendar-day small { grid-column: 1 / -1; overflow: hidden; color: #587086; font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
.calendar-footer { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 18px; border-top: 1px solid rgba(132, 158, 183, .12); }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 14px; }
.calendar-legend span { display: flex; align-items: center; gap: 6px; color: #6b8196; font-size: 9px; }
.calendar-legend span::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: #42566a; }
.calendar-legend .profit::before { background: var(--brand); }
.calendar-legend .loss::before { background: var(--danger); }
.month-summary { display: grid; grid-template-columns: auto auto; gap: 2px 9px; align-items: baseline; text-align: right; }
.month-summary > span { color: #71869a; font-size: 9px; }
.month-summary > strong { font-size: 16px; }
.month-summary > strong.profit { color: var(--brand); }
.month-summary > strong.loss { color: var(--danger); }
.month-summary > small { grid-column: 1 / -1; color: #597086; font-size: 8px; }
.card { padding: 26px; }
.card h2 { margin: 8px 0 12px; font-size: 22px; }
.card p { color: var(--muted); line-height: 1.7; }
.settings-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 22px; align-items: start; }
.settings-subnav { position: sticky; top: 24px; display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 15px; background: linear-gradient(160deg, rgba(14, 29, 47, .94), rgba(8, 20, 34, .94)); }
.settings-subnav-label { padding: 6px 8px 2px; color: #60778e; font-size: 9px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.settings-subnav-item { width: 100%; min-height: 62px; display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 10px; padding: 9px; border: 1px solid transparent; color: #8da2b7; background: transparent; text-align: left; }
.settings-subnav-item > span:first-child { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid #2a4056; border-radius: 9px; color: #7790a8; font-size: 12px; }
.settings-subnav-item > span:last-child { min-width: 0; display: grid; gap: 3px; }
.settings-subnav-item strong { color: inherit; font-size: 13px; }
.settings-subnav-item small { color: #5d748a; font-size: 9px; }
.settings-subnav-item.active { border-color: rgba(43, 215, 163, .18); color: var(--text); background: linear-gradient(100deg, rgba(43, 215, 163, .13), rgba(43, 215, 163, .025)); }
.settings-subnav-item.active > span:first-child { border-color: var(--brand); color: #032018; background: var(--brand); }
.settings-content, .settings-section { min-width: 0; }
.settings-section { display: grid; gap: 18px; }
.settings-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 3px 2px 1px; }
.settings-section-head h2 { margin: 7px 0 4px; font-size: 25px; letter-spacing: -.025em; }
.settings-section-head p { margin: 0; color: var(--muted); font-size: 12px; }
.settings-security-badge { flex: 0 0 auto; display: flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid rgba(43, 215, 163, .22); border-radius: 999px; color: var(--brand); background: rgba(43, 215, 163, .055); font-size: 9px; font-weight: 800; }
.settings-security-badge i { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px rgba(43, 215, 163, .08); }
.credentials-card { display: grid; grid-template-columns: minmax(0, .9fr) minmax(360px, 1.1fr); gap: clamp(34px, 6vw, 90px); align-items: start; padding: clamp(26px, 4vw, 48px); }
.section-number { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(43, 215, 163, .32); border-radius: 50%; color: var(--brand); font-size: 12px; }
.credential-copy h2 { margin-top: 24px; }
.credential-state { display: grid; gap: 7px; margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.credential-state span { color: var(--muted); font-size: 11px; }
.credential-state strong { color: var(--brand); }
.permission-box { display: grid; grid-template-columns: 1fr auto; gap: 5px 14px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: rgba(0, 0, 0, .13); }
.permission-box span { color: var(--muted); font-size: 11px; }
.permission-box strong { color: var(--brand); font-size: 12px; }
.permission-box small { grid-column: 1 / -1; color: #60758c; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 3px; }
.settings-inline-message { margin: -8px 2px 0; }
.ai-model-settings-card { display: grid; gap: 20px; padding: clamp(24px, 3vw, 34px); }
.ai-model-settings-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.ai-model-title { min-width: 0; display: flex; align-items: flex-start; gap: 16px; }
.ai-model-title .section-number { flex: 0 0 42px; }
.ai-model-title h2 { margin: 5px 0 4px; }
.ai-model-title p { margin: 0; font-size: 11px; }
.ai-model-settings-head > button { flex: 0 0 auto; display: flex; align-items: center; gap: 5px; }
.ai-provider-strip { display: flex; flex-wrap: wrap; gap: 7px; padding: 11px 12px; border: 1px solid rgba(132, 158, 183, .12); border-radius: 11px; background: rgba(4, 14, 25, .32); }
.ai-provider-strip span { padding: 5px 9px; border: 1px solid #294158; border-radius: 999px; color: #8ca4bb; background: rgba(18, 37, 58, .72); font-size: 9px; font-weight: 700; }
.ai-model-data-notice { display: grid; grid-template-columns: 24px minmax(0, 1fr); align-items: start; gap: 9px; padding: 11px 12px; border: 1px solid rgba(244, 196, 92, .19); border-radius: 10px; background: rgba(244, 196, 92, .045); }
.ai-model-data-notice > span { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; color: var(--warning); background: rgba(244, 196, 92, .1); font-size: 10px; font-weight: 900; }
.ai-model-data-notice p { margin: 1px 0 0; color: #7f8d9d; font-size: 9px; line-height: 1.55; }
.ai-model-data-notice strong { color: #c9ad6a; }
.ai-model-list-status { padding: 13px; border: 1px dashed rgba(132, 158, 183, .2); border-radius: 11px; color: #7890a7; background: rgba(6, 16, 28, .3); font-size: 11px; text-align: center; }
.ai-model-list-status.loading::before { content: ""; width: 7px; height: 7px; display: inline-block; margin-right: 8px; border-radius: 50%; background: var(--brand); animation: account-pulse 1s ease-in-out infinite; }
.ai-model-list-status.error { color: #ff92a1; border-color: rgba(255, 107, 125, .28); background: rgba(255, 107, 125, .055); }
.ai-model-list-status.success { color: var(--brand); border-style: solid; border-color: rgba(43, 215, 163, .24); background: rgba(43, 215, 163, .055); }
.ai-model-config-list { display: grid; gap: 10px; }
.ai-model-config-card { min-width: 0; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 15px; border: 1px solid rgba(132, 158, 183, .16); border-radius: 13px; background: linear-gradient(145deg, rgba(12, 27, 44, .9), rgba(7, 19, 32, .88)); }
.ai-model-config-card.is-default { border-color: rgba(43, 215, 163, .3); box-shadow: inset 3px 0 0 rgba(43, 215, 163, .65); }
.ai-model-config-card.is-disabled { opacity: .68; }
.ai-model-provider-mark { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid rgba(77, 141, 247, .26); border-radius: 12px; color: #9abdf9; background: linear-gradient(145deg, rgba(77, 141, 247, .16), rgba(43, 215, 163, .08)); font-size: 12px; font-weight: 900; text-transform: uppercase; }
.ai-model-config-main { min-width: 0; display: grid; gap: 5px; }
.ai-model-config-title { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.ai-model-config-title strong { max-width: 100%; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.ai-model-badge { padding: 3px 6px; border: 1px solid rgba(132, 158, 183, .2); border-radius: 999px; color: #8198ae; background: rgba(132, 158, 183, .055); font-size: 8px; font-weight: 800; }
.ai-model-badge.default { color: var(--brand); border-color: rgba(43, 215, 163, .25); background: rgba(43, 215, 163, .07); }
.ai-model-badge.enabled { color: #8bb6ff; border-color: rgba(77, 141, 247, .25); background: rgba(77, 141, 247, .07); }
.ai-model-badge.disabled { color: #7b8da0; }
.ai-model-config-main > span { overflow: hidden; color: #9cb0c3; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.ai-model-config-main > small { overflow: hidden; color: #60778e; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.ai-model-config-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.ai-model-config-actions button { min-height: 31px; padding: 5px 8px; border-color: #294057; color: #90a5ba; background: rgba(11, 26, 43, .88); font-size: 9px; }
.ai-model-config-actions button:hover { border-color: #45627d; color: var(--text); }
.ai-model-config-actions button[data-ai-action="default"] { color: var(--brand); border-color: rgba(43, 215, 163, .25); }
.ai-model-config-actions button[data-ai-action="delete"] { color: var(--danger); border-color: rgba(255, 107, 125, .25); }
.ai-model-dialog { width: min(680px, calc(100% - 32px)); max-height: min(880px, calc(100svh - 32px)); margin: auto; padding: 0; overflow: auto; border: 1px solid #29445f; border-radius: 18px; color: var(--text); background: #0b1929; box-shadow: 0 30px 100px rgba(0, 0, 0, .55); }
.ai-model-dialog::backdrop { background: rgba(1, 7, 13, .76); backdrop-filter: blur(5px); }
.ai-model-form { gap: 18px; padding: 26px; }
.ai-model-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.ai-model-dialog-head h2 { margin: 6px 0 4px; font-size: 24px; }
.ai-model-dialog-head p { margin: 0; color: var(--muted); font-size: 11px; }
.ai-model-dialog-close { flex: 0 0 38px; width: 38px; min-height: 38px; padding: 0; border-color: var(--line); color: #8196aa; background: transparent; font-size: 22px; }
.ai-model-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ai-model-form select { width: 100%; min-height: 48px; padding: 12px 38px 12px 14px; border: 1px solid var(--line); border-radius: 11px; outline: none; color: var(--text); background: #07121f; font: inherit; font-size: 14px; }
.ai-model-form select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(43, 215, 163, .11); }
.ai-model-form label > small { color: #62798f; font-size: 9px; line-height: 1.5; }
.ai-provider-endpoint { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; padding: 12px 14px; border: 1px solid rgba(77, 141, 247, .2); border-radius: 10px; background: rgba(77, 141, 247, .055); }
.ai-provider-endpoint span { color: #718ba3; font-size: 9px; }
.ai-provider-endpoint strong { overflow: hidden; color: #9bbaf0; font-size: 10px; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.ai-provider-endpoint small { grid-column: 1 / -1; color: #5f7489; font-size: 8px; }
.ai-model-switches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ai-model-switches > label { min-width: 0; display: grid; grid-template-columns: 20px minmax(0, 1fr); align-items: start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: rgba(4, 14, 25, .3); cursor: pointer; }
.ai-model-switches input { width: 18px; height: 18px; min-height: 0; margin: 1px 0 0; accent-color: var(--brand); }
.ai-model-switches span { min-width: 0; display: grid; gap: 3px; }
.ai-model-switches strong { color: #b8c7d6; font-size: 11px; }
.ai-model-switches small { color: #61778d; font-size: 8px; line-height: 1.45; }
.ai-model-dialog-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 4px; }
.ai-model-dialog-actions button { min-width: 108px; }
.empty-state { min-height: 430px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-state > span { width: 64px; height: 64px; display: grid; place-items: center; border: 1px solid rgba(43, 215, 163, .3); border-radius: 18px; color: var(--brand); background: rgba(43, 215, 163, .07); font-size: 22px; }
.empty-state h2 { margin-top: 24px; }
.empty-state p { max-width: 560px; margin: 0; }
.orders-heading-actions { display: flex; align-items: center; gap: 10px; }
.orders-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 14px; }
.orders-summary .metric-card { min-height: 120px; }
.orders-message { min-height: 38px; display: flex; align-items: center; margin: 0 0 14px; padding: 9px 12px; border: 1px solid rgba(77, 141, 247, .22); border-radius: 10px; color: #8bb6ff; background: rgba(77, 141, 247, .06); font-size: 11px; }
.orders-message.loading::before { content: ""; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: currentColor; animation: account-pulse 1s ease-in-out infinite; }
.orders-message.success { color: var(--brand); border-color: rgba(43, 215, 163, .22); background: rgba(43, 215, 163, .055); }
.orders-message.error { color: #ff92a1; border-color: rgba(255, 107, 125, .26); background: rgba(255, 107, 125, .06); }
.orders-data-grid { display: grid; gap: 16px; }
.orders-table-card { min-width: 0; padding: 0; overflow: hidden; }
.orders-table-card > header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 22px; border-bottom: 1px solid rgba(132, 158, 183, .13); }
.orders-table-card h2 { margin: 5px 0 0; font-size: 18px; }
.orders-count-badge { flex: 0 0 auto; padding: 5px 8px; border: 1px solid rgba(43, 215, 163, .25); border-radius: 999px; color: var(--brand); background: rgba(43, 215, 163, .06); font-size: 9px; font-weight: 800; }
.orders-table-wrap { min-height: 120px; overflow-x: auto; }
.orders-table { width: 100%; min-width: 900px; border-collapse: collapse; }
.orders-table th, .orders-table td { padding: 13px 16px; border-bottom: 1px solid rgba(132, 158, 183, .09); text-align: right; white-space: nowrap; }
.orders-table th:first-child, .orders-table td:first-child { text-align: left; }
.orders-table th { color: #647b91; background: rgba(5, 15, 26, .36); font-size: 9px; font-weight: 800; letter-spacing: .04em; }
.orders-table td { color: #a8b8c8; font-size: 11px; }
.orders-table tbody tr:last-child td { border-bottom: 0; }
.orders-table tbody tr:hover { background: rgba(255, 255, 255, .02); }
.orders-table .symbol { color: #e2ebf3; font-weight: 800; }
.orders-table .long, .orders-table .buy, .orders-table .profit { color: var(--brand); }
.orders-table .short, .orders-table .sell, .orders-table .loss { color: var(--danger); }
.orders-table-empty { min-height: 120px; display: grid; place-items: center; padding: 24px; color: #61788f; font-size: 12px; text-align: center; }
.sidebar-backdrop { display: none; }

@media (max-width: 1080px) {
  .performance-columns { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .login-page { grid-template-columns: 1fr minmax(390px, .9fr); }
  .login-visual { padding: 38px; }
  .trust-row { gap: 15px; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .summary-grid .metric-card:last-child { grid-column: 1 / -1; }
  .orders-summary { grid-template-columns: 1fr 1fr; }
  .orders-summary .metric-card:last-child { grid-column: 1 / -1; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-subnav { position: static; }
  .settings-subnav-label { display: none; }
  .settings-subnav-item { min-height: 54px; }
  .credentials-card { grid-template-columns: 1fr; }
  .ai-model-config-card { grid-template-columns: 44px minmax(0, 1fr); }
  .ai-model-config-actions { grid-column: 1 / -1; justify-content: flex-start; padding-left: 58px; }
  .performance-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 780px) {
  .login-page { display: block; background: radial-gradient(circle at 15% 0, rgba(30, 112, 112, .2), transparent 32%), #091421; }
  .login-visual { display: none; }
  .login-panel { min-height: 100svh; place-items: start center; padding: max(28px, env(safe-area-inset-top)) 22px max(28px, env(safe-area-inset-bottom)); border: 0; background: transparent; }
  .mobile-brand { display: flex; }
  .auth-card { padding-top: 3vh; }
  .app-shell { display: block; }
  .sidebar { width: min(84vw, 300px); position: fixed; left: 0; top: 0; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 24px 0 60px rgba(0, 0, 0, .4); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(1, 8, 14, .68); backdrop-filter: blur(3px); }
  .sidebar-backdrop.open { display: block; }
  .mobile-bar { min-height: 58px; position: sticky; top: 0; z-index: 15; display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; padding: max(6px, env(safe-area-inset-top)) 12px 6px; border-bottom: 1px solid rgba(255, 255, 255, .07); background: rgba(7, 16, 29, .9); backdrop-filter: blur(14px); }
  .mobile-bar strong { text-align: center; font-size: 14px; }
  .menu-toggle { min-height: 38px; padding: 5px 8px; border-color: var(--line); background: transparent; color: var(--text); font-size: 12px; }
  .mobile-bar .status-dot { justify-self: end; margin-right: 16px; background: var(--brand); box-shadow: 0 0 0 5px rgba(43, 215, 163, .08); }
  .workspace-content { width: min(100% - 24px, 680px); padding: 28px 0 calc(38px + env(safe-area-inset-bottom)); }
  .page-heading { margin-bottom: 22px; }
  .page-heading h1 { font-size: 30px; }
  .page-heading p { font-size: 13px; line-height: 1.5; }
  .orders-heading { display: grid; }
  .orders-heading-actions { justify-content: flex-start; }
  .orders-heading-actions .live-lock { display: flex; }
  .live-lock { display: none; }
  .summary-grid { grid-template-columns: 1fr; gap: 12px; }
  .summary-grid .metric-card:last-child { grid-column: auto; }
  .orders-summary { grid-template-columns: 1fr; gap: 10px; }
  .orders-summary .metric-card:last-child { grid-column: auto; }
  .orders-summary .metric-card { min-height: 104px; }
  .metric-card { min-height: 124px; }
  .account-card-action { min-height: 40px; padding: 8px 11px; font-size: 11px; }
  .card { padding: 21px; border-radius: 14px; }
  .settings-section-head { align-items: flex-start; flex-direction: column; gap: 12px; }
  .settings-security-badge { align-self: flex-start; }
  .credentials-card { gap: 30px; }
  .ai-model-settings-head { align-items: stretch; flex-direction: column; }
  .ai-model-settings-head > button { width: 100%; justify-content: center; min-height: 46px; }
  .ai-model-config-card { grid-template-columns: 38px minmax(0, 1fr); gap: 11px; padding: 13px; }
  .ai-model-provider-mark { width: 38px; height: 38px; border-radius: 10px; }
  .ai-model-config-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding-left: 49px; }
  .ai-model-config-actions button { min-height: 40px; }
  .ai-model-form { padding: 20px; }
  .ai-model-field-grid, .ai-model-switches { grid-template-columns: 1fr; }
  .ai-model-dialog-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .ai-model-dialog-actions button { min-width: 0; min-height: 46px; }
  .button-row button { flex: 1 1 140px; min-height: 46px; }
  .empty-state { min-height: 360px; }
  .performance-heading { margin-top: 28px; }
  .calendar-day { min-height: 72px; padding: 6px; }
}

@media (max-width: 520px) {
  .performance-heading { display: grid; align-items: flex-start; gap: 14px; }
  .performance-heading h2 { font-size: 22px; }
  .performance-heading p { font-size: 10px; }
  .performance-heading-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; justify-content: stretch; }
  .performance-heading-actions .calendar-controls { min-width: 0; }
  .performance-heading-actions #performance-refresh { min-height: 42px; }
  .performance-side { padding: 10px; border-radius: 14px; }
  .performance-side-heading { min-height: 0; display: grid; gap: 9px; }
  .performance-side-tools { justify-items: start; }
  .performance-source { max-width: 100%; justify-self: start; }
  .performance-metrics { gap: 8px; }
  .performance-metric { min-height: 104px; padding: 14px; }
  .performance-metric > strong { font-size: 21px; }
  .binance-performance-callout { align-items: stretch; flex-direction: column; }
  .binance-performance-callout button { width: 100%; min-height: 42px; }
  .calendar-heading { display: grid; gap: 12px; padding: 13px 12px; }
  .calendar-controls { width: 100%; justify-content: space-between; }
  .calendar-controls > strong { flex: 1; }
  .returns-calendar { padding: 7px 7px 10px; }
  .calendar-weekdays, .calendar-days { gap: 3px; }
  .calendar-day { min-height: 58px; gap: 2px; padding: 5px 4px; border-radius: 6px; }
  .calendar-day strong { font-size: 9px; }
  .calendar-day small { display: none; }
  .calendar-day em { font-size: 6px; }
  .calendar-footer { display: grid; padding: 11px 12px; }
  .month-summary { justify-self: end; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
