:root {
  color-scheme: dark;
  --bg: #07100e;
  --surface: #0d1916;
  --surface-2: #12211d;
  --line: rgba(215, 255, 239, .11);
  --text: #eef9f4;
  --muted: #89a69a;
  --lime: #baf57a;
  --green: #4fe0aa;
  --red: #ff6f7d;
  --amber: #ffc96b;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 15% -15%, #15362c 0, transparent 32rem), var(--bg); color: var(--text); }
button, input, select { font: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(2rem, 4vw, 3.5rem); letter-spacing: -.055em; line-height: 1; }
h2 { margin-bottom: 16px; font-size: 1.25rem; letter-spacing: -.025em; }
h3 { margin-bottom: 4px; font-size: 1rem; }
.muted { color: var(--muted); }
.eyebrow { margin-bottom: 8px; color: var(--green); font-size: .72rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.security-note { margin: 18px 0 0; color: var(--muted); font-size: .76rem; text-align: center; }

.topbar { position: sticky; z-index: 20; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 68px; padding: 0 clamp(20px, 4vw, 56px); border-bottom: 1px solid var(--line); background: rgba(7, 16, 14, .82); backdrop-filter: blur(18px); }
.brand, .topbar-actions, .control-group { display: flex; align-items: center; gap: 12px; }
.brand { font-weight: 750; letter-spacing: -.02em; }
.brand-mark { display: grid; width: 64px; height: 64px; place-items: center; border-radius: 18px; background: var(--lime); color: #102015; font-size: 1.45rem; font-weight: 950; letter-spacing: -.08em; box-shadow: 0 18px 60px rgba(186, 245, 122, .15); }
.brand-mark.small { width: 38px; height: 38px; border-radius: 11px; font-size: .9rem; }
.environment { padding: 7px 10px; border: 1px solid var(--line); border-radius: 99px; color: var(--amber); font-size: .66rem; font-weight: 850; letter-spacing: .1em; }
.environment.sandbox { border-color: rgba(79, 224, 170, .35); background: rgba(79, 224, 170, .1); color: var(--green); }
.language-toggle { display: inline-flex; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; }
.language-toggle form { display: flex; }
.language-toggle button { min-width: 38px; min-height: 32px; padding: 0 9px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: .7rem; font-weight: 850; }
.language-toggle button.active { background: var(--lime); color: #102015; }
.login-language { align-self: flex-end; margin-bottom: 32px; }

.page-shell { width: min(1500px, calc(100% - 40px)); margin: 0 auto; padding: 42px 0 80px; }
.hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.launch-guide-button { display: inline-flex; align-items: center; gap: 14px; max-width: 100%; margin: 0 0 8px; padding: 10px 16px; border: 1px solid rgba(79, 224, 170, .28); border-radius: 16px; background: rgba(79, 224, 170, .07); color: var(--text); cursor: pointer; font-size: clamp(1.85rem, 3.2vw, 3rem); font-weight: 900; letter-spacing: -.055em; line-height: 1.05; text-align: left; text-wrap: balance; transition: border-color .2s, background .2s, color .2s, transform .15s; }
.launch-guide-button span { display: inline-grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border: 1px solid rgba(79, 224, 170, .4); border-radius: 50%; color: var(--green); font-size: 1rem; font-weight: 900; letter-spacing: 0; }
.launch-guide-button:hover, .launch-guide-button:focus-visible { border-color: var(--green); outline: none; background: rgba(79, 224, 170, .13); color: var(--lime); transform: translateY(-1px); }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.metric-card, .panel { border: 1px solid var(--line); background: linear-gradient(145deg, rgba(18, 33, 29, .92), rgba(10, 22, 19, .96)); box-shadow: 0 22px 60px rgba(0, 0, 0, .14); }
.metric-card { min-height: 144px; padding: 22px; border-radius: var(--radius); }
.metric-card span, .metric-card small { display: block; color: var(--muted); }
.metric-card span { margin-bottom: 16px; font-size: .78rem; font-weight: 700; }
.metric-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 16px; }
.metric-card .metric-title span { flex: 1; margin-bottom: 0; }
.metric-card strong { display: block; margin-bottom: 6px; font-size: 1.45rem; letter-spacing: -.035em; }
.metric-card small { font-size: .72rem; }
.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }
.warning { color: var(--amber) !important; }

.layout-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; gap: 16px; }
.main-column, .side-column { display: grid; min-width: 0; gap: 16px; }
.side-column {
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 100px);
  align-content: start;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 5px;
  scrollbar-color: rgba(137, 166, 154, .62) rgba(4, 12, 9, .35);
  scrollbar-width: thin;
}
.side-column::-webkit-scrollbar { width: 8px; }
.side-column::-webkit-scrollbar-track { border-radius: 99px; background: rgba(4, 12, 9, .35); }
.side-column::-webkit-scrollbar-thumb { border: 2px solid rgba(4, 12, 9, .35); border-radius: 99px; background: rgba(137, 166, 154, .62); }
.side-column::-webkit-scrollbar-thumb:hover { background: var(--green); }
.panel { min-width: 0; padding: clamp(20px, 3vw, 32px); border-radius: var(--radius); }
.panel.compact { padding: 22px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.panel-heading h2 { margin-bottom: 0; }
.panel-actions { display: flex; align-items: center; gap: 8px; }
.collapsible-panel { position: relative; }
.panel-collapse-button { display: inline-flex; min-height: 34px; align-items: center; justify-content: center; gap: 7px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: rgba(4, 12, 9, .38); cursor: pointer; font: inherit; font-size: .68rem; font-weight: 800; white-space: nowrap; }
.panel-collapse-button:hover { border-color: rgba(79, 224, 170, .38); color: var(--green); }
.panel-collapse-button:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
.panel-collapse-button b { width: 13px; color: inherit; font-size: .95rem; line-height: .7; }
.panel-collapse-button-floating { position: absolute; z-index: 2; top: 18px; right: 18px; }
.collapsible-panel.panel-collapsed > :not(.panel-heading):not(.panel-collapse-button):not(.eyebrow):not(h2) { display: none !important; }
.collapsible-panel.panel-collapsed > .panel-heading { margin-bottom: 0; }
.collapsible-panel.panel-collapsed > h2 { margin-bottom: 0; padding-right: 115px; }
.collapsible-panel.panel-collapsed > .eyebrow { padding-right: 115px; }
.badge { display: inline-flex; padding: 6px 9px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-size: .68rem; white-space: nowrap; }
.strategy-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.strategy-item { display: flex; align-items: stretch; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: rgba(4, 12, 9, .35); }
.strategy-item.enabled { border-color: rgba(79, 224, 170, .85); background: rgba(79, 224, 170, .16); box-shadow: inset 0 0 0 1px rgba(79, 224, 170, .28), 0 0 18px rgba(79, 224, 170, .12); }
.strategy-item.active { border-color: rgba(79, 224, 170, .48); box-shadow: inset 0 0 0 1px rgba(79, 224, 170, .12); }
.strategy-item.enabled.active { border-color: #7dffc4; box-shadow: inset 0 0 0 1px rgba(125, 255, 196, .45), 0 0 22px rgba(79, 224, 170, .2); }
.strategy-item.enabled .badge { border-color: rgba(125, 255, 196, .9); background: rgba(79, 224, 170, .28); color: #e9fff4; }
.strategy-item.enabled > form .btn { border-color: #7dffc4; background: #3dbe86; color: #042117; }
.strategy-item.enabled > form .btn:hover { border-color: #d8ffe8; background: #7dffc4; color: #042117; }
.strategy-item > a { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto auto; flex: 1; align-items: center; gap: 10px; min-width: 0; padding: 13px; }
.strategy-item > form { display: flex; align-items: center; padding-right: 9px; }
.strategy-item b, .strategy-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strategy-item b { margin-bottom: 3px; font-size: .78rem; }
.strategy-item small { color: var(--muted); font-size: .68rem; }
.strategy-state { width: 7px; height: 7px; border-radius: 50%; background: #54645e; }
.strategy-state.enabled { background: var(--green); box-shadow: 0 0 12px rgba(79, 224, 170, .65); }
.position-count-indicator { display: inline-grid; min-width: 26px; height: 26px; place-items: center; padding: 0 6px; border: 1px solid var(--line); border-radius: 99px; background: rgba(5, 14, 11, .55); color: #60776e; font-size: .65rem; font-weight: 900; font-variant-numeric: tabular-nums; transition: color .2s, border-color .2s, background .2s, box-shadow .2s; }
.position-count-indicator.has-position { border-color: rgba(79, 224, 170, .72); background: rgba(79, 224, 170, .16); color: var(--green); box-shadow: 0 0 15px rgba(79, 224, 170, .38), inset 0 0 8px rgba(79, 224, 170, .12); }

.strategy-chart-panel { overflow: hidden; }
.strategy-chart-toolbar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px; margin: -6px 0 16px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: rgba(4, 12, 9, .35); }
.strategy-chart-toolbar label { display: grid; min-width: 130px; gap: 5px; color: var(--muted); font-size: .66rem; }
.strategy-chart-toolbar select { min-height: 34px; padding: 0 10px; font-size: .72rem; }
.strategy-chart-hint { flex: 1 1 180px; align-self: center; color: var(--muted); font-size: .66rem; text-align: right; }
.strategy-chart-view-controls { display: flex; gap: 6px; margin-left: auto; align-self: center; }
.chart-view-button { display: inline-grid; width: 36px; height: 34px; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: rgba(4, 12, 9, .45); cursor: pointer; }
.chart-view-button svg { width: 18px; height: 18px; }
.chart-view-button[aria-pressed="true"], #strategy_chart_measure[aria-pressed="true"] { border-color: rgba(186, 245, 122, .7); color: var(--lime); background: rgba(186, 245, 122, .12); }
body.chart-theater .layout-grid { grid-template-columns: minmax(0, 1fr); }
body.chart-theater .side-column,
body.chart-theater .hero-row,
body.chart-theater .metric-grid,
body.chart-theater #strategies { display: none; }
.strategy-chart-panel:fullscreen { box-sizing: border-box; width: 100%; height: 100%; overflow: auto; padding: 18px 22px 12px; background: var(--bg); color: var(--text); }
.strategy-chart-toolbar .btn[hidden], .strategy-replay-toolbar[hidden] { display: none; }
.strategy-replay-toolbar { display: grid; grid-template-columns: auto repeat(3, minmax(145px, 1fr)); align-items: end; gap: 10px; margin: 0 0 16px; padding: 12px; border: 1px solid rgba(95, 168, 255, .24); border-radius: 13px; background: rgba(14, 26, 38, .38); }
.strategy-replay-toolbar > strong { align-self: center; color: #8fc0ff; font-size: .73rem; white-space: nowrap; }
.strategy-replay-toolbar label { display: grid; gap: 5px; color: var(--muted); font-size: .66rem; }
.strategy-replay-toolbar input, .strategy-replay-toolbar select { min-height: 34px; padding: 0 10px; font-size: .72rem; }
.strategy-replay-actions { display: flex; grid-column: 1 / -1; flex-wrap: wrap; gap: 8px; }
.strategy-replay-progress { display: flex; grid-column: 1 / -1; align-items: center; gap: 10px; }
.strategy-replay-progress input { min-height: 18px; padding: 0; }
.strategy-replay-progress span { min-width: 88px; color: var(--muted); font-size: .68rem; font-variant-numeric: tabular-nums; text-align: right; }
.strategy-chart-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: -6px 0 16px; }
.strategy-chart-legend > span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .68rem; }
.strategy-chart-legend > span[hidden] { display: none; }
.strategy-chart-legend i { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; }
.strategy-chart-legend b { color: #bad0c7; font-weight: 750; }
.strategy-chart-legend em { color: var(--text); font-style: normal; font-variant-numeric: tabular-nums; }
.chart-color-current { background: #f4f7f5; }
.chart-color-bid { background: #36d6a1; }
.chart-color-ask { background: #ff7587; }
.chart-color-open { background: #5fa8ff; }
.chart-color-stop { background: #ff9b55; }
.chart-color-take { background: #baf57a; }
.strategy-chart-wrap { position: relative; min-height: 380px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(180deg, rgba(11, 28, 23, .78), rgba(4, 12, 9, .62)); }
.strategy-chart-wrap canvas { display: block; width: 100%; height: 380px; cursor: grab; touch-action: none; user-select: none; }
.strategy-chart-wrap canvas:active { cursor: grabbing; }
.strategy-chart-wrap > p { position: absolute; inset: 0; display: grid; margin: 0; place-items: center; color: var(--muted); font-size: .78rem; pointer-events: none; }
.strategy-chart-wrap > p[hidden] { display: none; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.lot-limit-note { margin: 0; padding: 12px 14px; border: 1px solid rgba(255, 201, 107, .6); border-radius: 12px; background: rgba(255, 201, 107, .16); color: var(--amber); font-size: .88rem; font-weight: 800; line-height: 1.4; }
.form-stack { display: grid; gap: 14px; }
.span-2 { grid-column: span 2; }
label { display: grid; gap: 8px; color: #b8cec5; font-size: .78rem; font-weight: 700; }
label small { color: var(--muted); font-weight: 500; }
.field-label, .heading-with-help, .market-label, .signal-heading { display: flex; align-items: center; gap: 7px; }
.field-label { min-height: 24px; justify-content: space-between; }
.heading-with-help { justify-content: flex-start; }
.signal-heading { align-self: center; justify-content: space-between; min-width: 0; }
.signal-heading .switch { min-width: 0; }
.info-button { display: inline-grid; width: 22px; height: 22px; flex: 0 0 auto; padding: 0; place-items: center; border: 1px solid rgba(79, 224, 170, .34); border-radius: 50%; background: rgba(79, 224, 170, .08); color: var(--green); cursor: pointer; font-family: Georgia, serif; font-size: .76rem; font-style: italic; font-weight: 800; line-height: 1; transition: background .2s, border-color .2s, transform .15s; }
.info-button:hover, .info-button:focus-visible { border-color: var(--green); outline: none; background: rgba(79, 224, 170, .18); transform: translateY(-1px); }
input, select { width: 100%; min-height: 44px; padding: 0 13px; border: 1px solid var(--line); border-radius: 11px; outline: none; background: #08130f; color: var(--text); transition: border .2s, box-shadow .2s; }
input:focus, select:focus { border-color: rgba(79, 224, 170, .58); box-shadow: 0 0 0 3px rgba(79, 224, 170, .1); }
input[type="checkbox"] { width: auto; min-height: 0; }
.section-title { margin-top: 12px; padding-top: 22px; border-top: 1px solid var(--line); }
.section-title p { margin-bottom: 0; color: var(--muted); font-size: .76rem; }
.signal-card { display: grid; grid-template-columns: minmax(210px, 1.4fr) 1fr 1fr; align-items: end; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(4, 12, 9, .35); }
.candle-steps-card .signal-heading:first-child { grid-column: 1 / -1; }
.scalping-settings { display: grid; gap: 16px; padding: 20px; border: 1px solid rgba(255, 201, 107, .28); border-radius: 16px; background: linear-gradient(145deg, rgba(45, 36, 15, .28), rgba(4, 12, 9, .35)); }
.scalping-settings[hidden] { display: none; }
.scalping-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.scalping-heading h3, .scalping-settings > p { margin-bottom: 0; }
.scalp-switch-field { display: grid; align-content: start; gap: 12px; color: #b8cec5; font-size: .78rem; font-weight: 700; }
.risk-distance-field { display: grid; align-content: start; gap: 8px; }
.risk-distance-field > label { color: #bed1ca; font-size: .73rem; font-weight: 700; }
.risk-distance-input-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(125px, .62fr); gap: 8px; }
.risk-distance-input-row input, .risk-distance-input-row select { min-width: 0; }
.risk-distance-field > small { min-height: 2.4em; color: var(--muted); font-size: .66rem; line-height: 1.45; }
.switch { display: flex; align-items: center; align-self: center; gap: 10px; color: var(--text); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { position: relative; width: 38px; height: 22px; flex: 0 0 auto; border-radius: 99px; background: #263730; transition: background .2s; }
.switch span::after { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #81948d; content: ""; transition: transform .2s, background .2s; }
.switch input:checked + span { background: rgba(79, 224, 170, .3); }
.switch input:checked + span::after { transform: translateX(16px); background: var(--green); }

.btn { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; padding: 0 16px; border: 1px solid var(--line); border-radius: 11px; background: #15241f; color: var(--text); cursor: pointer; font-size: .78rem; font-weight: 800; transition: transform .15s, border .2s, background .2s; }
.btn:hover { transform: translateY(-1px); border-color: rgba(215, 255, 239, .24); background: #1a2b25; }
.btn-primary { border-color: var(--lime); background: var(--lime); color: #102015; }
.btn-primary:hover { background: #cdfb9c; }
.btn-danger { border-color: rgba(255, 111, 125, .3); background: rgba(255, 111, 125, .12); color: #ff9ba5; }
.btn-ghost { background: transparent; }
.btn-compact { min-height: 32px; padding: 0 10px; font-size: .68rem; }
.btn-full { width: 100%; }
.btn:disabled { opacity: .42; cursor: not-allowed; transform: none; }

.instrument-search { position: relative; }
.search-results { position: absolute; z-index: 30; top: 69px; right: 0; left: 0; max-height: 320px; overflow-y: auto; padding: 8px; border: 1px solid var(--line); border-radius: 13px; background: #0b1713; box-shadow: 0 25px 70px rgba(0, 0, 0, .45); }
.search-result { display: grid; grid-template-columns: 70px 1fr auto; width: 100%; align-items: center; gap: 10px; padding: 11px; border: 0; border-radius: 9px; background: transparent; color: var(--text); cursor: pointer; text-align: left; }
.search-result:hover { background: var(--surface-2); }
.search-result b { color: var(--green); }
.search-result small, .search-empty { color: var(--muted); }
.search-empty { padding: 12px; font-size: .78rem; }

.table-wrap { max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .78rem; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: .68rem; letter-spacing: .04em; text-transform: uppercase; }
.empty { padding: 30px; color: var(--muted); text-align: center; }
.align-right { text-align: right; }
.position-pnl { font-weight: 850; font-variant-numeric: tabular-nums; }
.realized-pnl { white-space: nowrap; font-weight: 850; font-variant-numeric: tabular-nums; }
.order-type-cell { display: flex; align-items: center; gap: 7px; }
.order-status-warning { border-color: rgba(255, 201, 107, .32); color: var(--amber); font-size: .59rem; }
#recent-orders th, #recent-orders td { padding-right: 9px; padding-left: 9px; }
.position-close-button { min-width: 118px; white-space: nowrap; }
.live-update-badge { border-color: rgba(79, 224, 170, .3); color: var(--green); }
.activity-updated { margin-top: 12px; text-align: left; }
.market-metrics { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px; overflow: hidden; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--line); }
.market-metrics > div { padding: 15px; background: #0a1612; }
.market-metrics span, .market-metrics strong { display: block; }
.market-metrics span { margin-bottom: 8px; color: var(--muted); font-size: .68rem; }
.market-metrics .market-label { display: flex; justify-content: space-between; gap: 5px; }
.market-label .info-button { width: 18px; height: 18px; font-size: .65rem; }
.market-metrics strong { font-size: .95rem; letter-spacing: -.02em; }
.depth-chart-card { overflow: hidden; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(180deg, rgba(17, 36, 48, .82), rgba(6, 17, 13, .55)); }
.depth-chart-heading { display: flex; justify-content: space-between; padding: 14px 16px 0; }
.depth-chart-heading h3 { margin: 0; color: var(--muted); font-size: .72rem; letter-spacing: .02em; }
.depth-chart-summary { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 12px; padding: 10px 16px 0; font-variant-numeric: tabular-nums; }
.depth-chart-summary > strong:last-child { text-align: right; }
.depth-chart-summary > span { display: grid; text-align: center; }
.depth-chart-summary b { font-size: .95rem; }
.depth-chart-summary small { color: var(--muted); font-size: .65rem; }
.depth-chart-imbalance { display: flex; justify-content: center; gap: 8px; margin: 5px 0 2px; font-size: .78rem; font-variant-numeric: tabular-nums; }
.depth-chart-imbalance strong { font-size: .78rem; }
.market-depth-chart { display: block; width: 100%; height: clamp(170px, 22vw, 260px); margin-top: 4px; }
.depth-chart-grid { stroke: rgba(148, 179, 168, .22); stroke-width: 1; vector-effect: non-scaling-stroke; }
.depth-chart-baseline { stroke: rgba(148, 179, 168, .16); stroke-width: 1; vector-effect: non-scaling-stroke; }
.depth-chart-line { fill: none; stroke-width: 3; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.depth-chart-line.bid-line { stroke: #31dba4; }
.depth-chart-line.ask-line { stroke: #ff7184; }
.depth-chart-axis { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; padding: 0 16px 12px; color: var(--muted); font-size: .65rem; font-variant-numeric: tabular-nums; }
.depth-chart-axis span:nth-child(2) { text-align: center; }
.depth-chart-axis span:last-child { text-align: right; }
.depth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.depth-grid > div { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: rgba(4, 12, 9, .35); }
.depth-title { display: flex; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: .7rem; font-weight: 800; }
.depth-table td { width: 50%; padding: 8px 14px; font-variant-numeric: tabular-nums; }
.depth-table td:last-child { text-align: right; }
.danger-zone { border-color: rgba(255, 111, 125, .18); }
.mode-panel { border-color: rgba(79, 224, 170, .25); }
.mode-live .mode-panel { border-color: rgba(255, 111, 125, .35); }
.warning-text { color: var(--amber); }
.mode-badge.mode-sandbox { border-color: rgba(79, 224, 170, .3); color: var(--green); }
.mode-badge.mode-live { border-color: rgba(255, 111, 125, .3); color: var(--red); }
.sandbox-balance { display: grid; gap: 5px; margin-top: 16px; padding: 14px; border: 1px solid rgba(79, 224, 170, .2); border-radius: 12px; background: rgba(79, 224, 170, .06); }
.sandbox-balance span { color: var(--muted); font-size: .68rem; }
.sandbox-balance strong { color: var(--green); font-size: 1.25rem; }
.sandbox-fund { margin-top: 14px; }
.sandbox-account-list { display: grid; gap: 10px; margin-top: 14px; }
.sandbox-account-item { display: grid; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: rgba(4, 12, 9, .35); }
.sandbox-account-item.selected { border-color: rgba(79, 224, 170, .38); background: rgba(79, 224, 170, .06); }
.sandbox-account-summary { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.sandbox-account-summary b, .sandbox-account-summary small { display: block; }
.sandbox-account-summary b { margin-bottom: 3px; font-size: .78rem; }
.sandbox-account-summary small { color: var(--muted); font-size: .66rem; }
.sandbox-account-balance { color: var(--green); font-size: 1rem; }
.account-tools, .create-sandbox { border-top: 1px solid var(--line); }
.account-tools summary, .create-sandbox summary { padding: 11px 0 0; color: var(--muted); cursor: pointer; font-size: .72rem; font-weight: 750; }
.account-tools[open] summary, .create-sandbox[open] summary { margin-bottom: 12px; color: var(--green); }
.account-tools form + form { margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255, 111, 125, .16); }
.create-sandbox { margin-top: 16px; }
.compact-empty { padding: 14px; font-size: .72rem; }
.log-list { display: grid; gap: 14px; max-height: 400px; overflow-y: auto; }
.log-item { display: grid; grid-template-columns: 8px 1fr; gap: 10px; }
.log-item b { font-size: .7rem; }
.log-item p { margin: 3px 0; color: #afc4bc; font-size: .72rem; line-height: 1.35; }
.log-item small { color: var(--muted); font-size: .65rem; }
.log-dot { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: var(--green); }
.log-error { background: var(--red); }
.log-warning { background: var(--amber); }

.flash { margin-bottom: 20px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); font-size: .82rem; }
.flash-error { border-color: rgba(255, 111, 125, .35); color: #ffabb3; }
.flash-success { border-color: rgba(79, 224, 170, .35); color: #8df1ca; }

.schedule-panel { border-color: rgba(79, 224, 170, .22); }
.schedule-form { display: grid; gap: 20px; }
.schedule-enable-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(4, 12, 9, .35); }
.schedule-enable-row b { font-size: .82rem; }
.schedule-enable-row p { margin: 5px 0 0; font-size: .72rem; }
.schedule-weekdays { margin: 0; padding: 0; border: 0; }
.schedule-weekdays legend { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: #bed1ca; font-size: .73rem; font-weight: 800; }
.weekday-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; align-items: start; }
.weekday-card { display: grid; gap: 6px; min-width: 0; }
.weekday-grid label { cursor: pointer; }
.weekday-grid input[type="checkbox"] { position: absolute; opacity: 0; pointer-events: none; }
.weekday-grid label > span { display: grid; min-height: 42px; place-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: rgba(4, 12, 9, .35); font-size: .68rem; font-weight: 800; text-align: center; }
.weekday-grid input:checked + span { border-color: rgba(79, 224, 170, .48); color: var(--green); background: rgba(79, 224, 170, .09); }
.weekday-grid input:focus-visible + span { outline: 2px solid var(--lime); outline-offset: 2px; }
.weekday-time { display: grid; gap: 3px; cursor: default; }
.weekday-time span { display: block; min-height: 0; padding: 0; border: 0; border-radius: 0; background: none; color: var(--muted); font-size: .62rem; font-weight: 700; text-align: left; }
.weekday-time input { width: 100%; min-width: 0; padding: 6px 4px; }
.schedule-offset-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.schedule-offset-grid label { display: grid; gap: 8px; color: #bed1ca; font-size: .73rem; font-weight: 700; }
.schedule-live { display: grid; gap: 14px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.schedule-live-copy { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.schedule-live-copy b { font-size: .78rem; }
.schedule-live-copy span { color: var(--muted); font-size: .7rem; }
.schedule-table { min-width: 620px; }
.schedule-table td, .schedule-table th { padding: 10px 12px; }

.modal-open { overflow: hidden; }
.help-modal { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 20px; }
.help-modal[hidden] { display: none; }
.help-backdrop { position: absolute; inset: 0; background: rgba(1, 7, 5, .78); backdrop-filter: blur(8px); }
.help-dialog { position: relative; width: min(520px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; padding: 30px; border: 1px solid rgba(79, 224, 170, .3); border-radius: 20px; outline: none; background: linear-gradient(145deg, #13251f, #091510); box-shadow: 0 35px 100px rgba(0, 0, 0, .55); }
.help-dialog h2 { padding-right: 32px; font-size: 1.5rem; }
.help-dialog > p:not(.eyebrow) { margin-bottom: 24px; color: #bad0c7; font-size: .92rem; line-height: 1.65; white-space: pre-line; }
.help-close { position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; font-size: 1.4rem; line-height: 1; }
.help-close:hover { color: var(--text); }

.login-page { display: grid; min-height: 100vh; place-items: center; padding: 30px; }
.login-shell { display: grid; grid-template-columns: 1.15fr .85fr; width: min(980px, 100%); overflow: hidden; border: 1px solid var(--line); border-radius: 26px; background: rgba(9, 21, 17, .94); box-shadow: 0 50px 120px rgba(0, 0, 0, .35); }
.login-brand, .login-card { padding: clamp(34px, 6vw, 70px); }
.login-brand { display: flex; min-height: 590px; flex-direction: column; align-items: flex-start; justify-content: flex-end; background: radial-gradient(circle at 20% 0, rgba(186, 245, 122, .16), transparent 55%), linear-gradient(145deg, #12291f, #091510); }
.login-brand .brand-mark { margin-bottom: auto; }
.login-brand h1 { font-size: clamp(2.2rem, 5vw, 4.2rem); }
.login-card { display: flex; flex-direction: column; justify-content: center; }
.login-card h2 { font-size: 2rem; }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .layout-grid { grid-template-columns: 1fr; }
  .side-column { position: static; max-height: none; grid-template-columns: repeat(2, 1fr); overflow: visible; padding-right: 0; }
}

@media (max-width: 720px) {
  .page-shell { width: min(100% - 24px, 1500px); padding-top: 26px; }
  .topbar { padding: 0 12px; }
  .brand > span:last-child, .environment { display: none; }
  .hero-row, .control-group { align-items: stretch; flex-direction: column; }
  .metric-grid, .side-column, .form-grid, .strategy-list { grid-template-columns: 1fr; }
  .risk-distance-input-row { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .signal-card { grid-template-columns: 1fr; }
  .candle-steps-card .signal-heading:first-child { grid-column: auto; }
  .strategy-chart-wrap { min-height: 300px; }
  .strategy-chart-wrap canvas { height: 300px; }
  .strategy-chart-toolbar { align-items: stretch; }
  .strategy-chart-toolbar label { flex: 1 1 120px; }
  .strategy-chart-hint { flex-basis: 100%; text-align: left; }
  .strategy-replay-toolbar { grid-template-columns: 1fr; }
  .strategy-replay-toolbar > strong, .strategy-replay-actions, .strategy-replay-progress { grid-column: 1; }
  .schedule-enable-row, .schedule-live-copy { align-items: stretch; flex-direction: column; }
  .schedule-offset-grid { grid-template-columns: 1fr; }
  .weekday-grid { grid-template-columns: repeat(2, 1fr); }
  .signal-heading { align-self: auto; }
  .market-metrics { grid-template-columns: repeat(2, 1fr); }
  .market-depth-chart { height: 180px; }
  .depth-grid { grid-template-columns: 1fr; }
  .login-page { padding: 12px; }
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: 290px; }
  .login-card { padding: 34px 24px; }
  .help-dialog { padding: 26px 22px; }
}
