

:root {
  --bg: #090e0b;
  --surface: #0f1611;
  --surface-2: #171e18;
  --surface-3: #1f271f;
  --line: #2b362b;
  --line-soft: #212a21;
  --text: #edf0ee;
  --muted: #a1b1a2;
  --muted-2: #748b75;
  --blue: #78b08a;
  --blue-hover: #aab8aa;
  --blue-soft: rgba(143,191,160,0.15);
  --green: #39c6a0;
  --green-soft: rgba(57,198,160,0.13);
  --red: #ff5d73;
  --red-soft: rgba(255,93,115,0.13);
  --amber: #f0a85b;
  --font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; background: var(--bg); }
body { margin: 0; overflow: hidden; color: var(--text); font-family: var(--font); font-size: 13px; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, input, select { color: inherit; font: inherit; }
button { border: 0; background: transparent; cursor: pointer; }
input, select { min-width: 0; border: 0; outline: 0; background: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
button:disabled { cursor: not-allowed; opacity: .5; }
strong { font-weight: 650; }
.gain { color: var(--green) !important; }
.loss { color: var(--red) !important; }

.consumer-app { width: 100vw; height: 100dvh; overflow: hidden; background: var(--bg); }

.app-header {
  position: relative;
  z-index: 60;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 40px;
  border-bottom: 1px solid var(--line);
  padding: 0 9px;
  background: rgba(9,14,11,.98);
}
.header-brand, .header-brand nav, .header-account, .brand, .balance-pill, .account-button { display: flex; align-items: center; }
.header-brand { gap: 18px; }
.brand { gap: 9px; padding: 0; }
.brand strong { font-size: 16px; letter-spacing: .055em; }
.brand-symbol { position: relative; display: block; width: 22px; height: 22px; border: 2px solid var(--text); border-radius: 5px; transform: rotate(45deg); }
.brand-symbol::before, .brand-symbol span { content: ""; position: absolute; background: var(--text); }
.brand-symbol::before { top: 4px; bottom: 4px; left: 8px; width: 2px; }
.brand-symbol span { top: 8px; right: 4px; left: 4px; height: 2px; }
.header-brand nav { height: 100%; gap: 2px; }
.header-brand nav button { display: flex; height: 100%; align-items: center; gap: 5px; border-bottom: 2px solid transparent; padding: 0 8px; color: var(--muted); font-size: 12px; }
.header-brand nav button:hover { color: var(--text); }
.header-brand nav button.active { border-bottom-color: var(--blue); color: var(--text); }
.header-status { justify-self: center; color: var(--muted); font-size: 11px; }
.header-status span { display: flex; align-items: center; gap: 7px; }
.header-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.header-status .paused i { background: var(--amber); box-shadow: 0 0 0 3px rgba(240,168,91,.13); }
.header-status span { white-space: nowrap; }
/* The sample-data label where the header has no room for it (phones and tablets). */
.preview-banner { display: none; align-items: center; justify-content: center; gap: 7px; margin: 0; border-bottom: 1px solid var(--line); padding: 6px 10px; background: var(--surface); color: var(--muted); font-size: 12px; }
.preview-banner i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.header-account { justify-content: flex-end; gap: 7px; }
.balance-pill { height: 29px; gap: 6px; border-left: 1px solid var(--line); padding-left: 8px; }
.balance-pill > span { color: var(--muted); font-size: 11px; }
.balance-pill strong { font-size: 12px; font-variant-numeric: tabular-nums; }
.balance-pill button { display: grid; width: 27px; height: 27px; place-items: center; color: var(--muted); }
.layout-trigger, .notification-button { position: relative; display: grid; width: 29px; height: 29px; place-items: center; border-radius: 2px; color: var(--muted); }
.layout-trigger:hover, .layout-trigger.active, .notification-button:hover { background: var(--surface-2); color: var(--text); }
.notification-button i { position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border: 2px solid var(--bg); border-radius: 50%; background: var(--red); }
.account-button { justify-content: center; min-width: 106px; height: 29px; gap: 6px; border-radius: 3px; padding: 0 9px; background: var(--blue); color: #ffffff; font-size: 12px; font-weight: 650; }
.account-button:hover { background: var(--blue-hover); }
.account-button.connected { border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.account-button.connected > span { display: grid; width: 23px; height: 23px; place-items: center; border-radius: 50%; background: var(--blue); color: #ffffff; font-size: 12px; }
.mobile-menu { display: none; }

.layout-menu-scrim { position: fixed; inset: 0; z-index: 90; width: 100%; height: 100%; cursor: default; }
.layout-menu { position: fixed; top: 40px; right: 118px; z-index: 100; width: 276px; border: 1px solid #3f4c40; border-top: 0; padding: 8px; background: #151a15; box-shadow: 0 16px 44px rgba(0,0,0,.48); }
.layout-menu-heading { display: flex; height: 32px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 0 3px 7px; }
.layout-menu-heading > div { display: flex; flex-direction: column; gap: 1px; }
.layout-menu-heading strong, .layout-menu-heading h2 { margin: 0; font-size: 13px; font-weight: 650; }
.layout-menu-heading span { color: var(--muted); font-size: 10px; }
.layout-menu-heading > button { height: 23px; border-radius: 2px; padding: 0 6px; color: #97c4a7; font-size: 10px; }
.layout-menu-heading > button:hover { background: var(--surface-3); }
.layout-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 7px 0; }
.layout-presets button { height: 27px; border: 1px solid var(--line); border-radius: 2px; color: var(--muted); font-size: 10px; }
.layout-presets button:hover { border-color: #596b5a; background: var(--surface-2); color: var(--text); }
.layout-panel-list { border-top: 1px solid var(--line); padding-top: 4px; }
.layout-panel-list button { display: grid; width: 100%; height: 30px; grid-template-columns: 17px 1fr auto; align-items: center; gap: 6px; border-radius: 2px; padding: 0 5px; color: var(--muted); font-size: 11px; text-align: left; }
.layout-panel-list button:hover { background: var(--surface-2); color: var(--text); }
.layout-panel-list button > i { display: grid; width: 15px; height: 15px; place-items: center; border: 1px solid #586958; border-radius: 2px; }
.layout-panel-list button.active > i { border-color: var(--blue); background: var(--blue); color: #ffffff; }
.layout-panel-list button small { color: var(--muted-2); font-size: 10px; font-variant-numeric: tabular-nums; }

.app-layout {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  grid-auto-flow: row dense;
  grid-auto-rows: max(20px, calc((100dvh - 75px) / 36));
  height: calc(100dvh - 40px);
  align-content: start;
  gap: 1px;
  overflow: auto;
  background: var(--line);
  scrollbar-width: thin;
  scrollbar-color: #374637 transparent;
}
.pane-tile { position: relative; min-width: 0; min-height: 0; grid-column: span var(--pane-columns); grid-row: span var(--pane-rows); overflow: hidden; background: var(--surface); isolation: isolate; }
.pane-chart { display: grid; grid-template-rows: 46px minmax(0, 1fr); container-type: inline-size; }
.pane-tile > .markets-panel, .pane-tile > .orderbook-panel, .pane-tile > .trade-ticket, .pane-tile > .positions-section { width: 100%; height: 100%; min-width: 0; min-height: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.pane-resizing { user-select: none; }
.pane-resizing canvas { pointer-events: none; }
.resizing-corner { cursor: nwse-resize !important; }
.resizing-horizontal { cursor: ew-resize !important; }
.resizing-vertical { cursor: ns-resize !important; }

.markets-panel { position: relative; display: flex; flex-direction: column; overflow: hidden; }
.markets-heading { display: flex; height: 34px; flex: 0 0 34px; align-items: center; justify-content: space-between; padding: 0 8px; }
.markets-heading h2 { margin: 0; font-size: 13px; letter-spacing: -.01em; }
.markets-heading > button { display: grid; width: 29px; height: 29px; place-items: center; border-radius: 3px; color: var(--muted); }
.markets-heading > button:hover { background: var(--surface-2); color: var(--text); }
.market-search { display: flex; height: 30px; flex: 0 0 30px; align-items: center; gap: 6px; margin: 0 7px; border: 1px solid var(--line); border-radius: 3px; padding: 0 7px; background: var(--bg); color: var(--muted); }
.market-search:focus-within { border-color: #586a59; }
.market-search input { flex: 1; font-size: 11px; }
.market-tabs { display: grid; height: 32px; flex: 0 0 32px; grid-template-columns: repeat(2, 1fr); margin: 3px 7px 0; border-bottom: 1px solid var(--line); }
.market-tabs button { border-bottom: 2px solid transparent; color: var(--muted); font-size: 11px; font-weight: 600; }
.market-tabs button.active { border-bottom-color: var(--blue); color: var(--text); }
.market-list-head { display: flex; height: 22px; flex: 0 0 22px; align-items: center; justify-content: space-between; padding: 0 8px; color: var(--muted-2); font-size: 10px; }
.market-list-head label { position: relative; display: flex; min-width: 0; align-items: center; }
.market-list-head select { max-width: 120px; appearance: none; cursor: pointer; padding-right: 15px; color: var(--muted-2); font-size: 10px; }
.market-list-head select:focus { color: var(--text); }
.market-list-head select option { background: var(--surface); color: var(--text); }
.market-list-head label svg { position: absolute; right: 0; pointer-events: none; }
.market-list { min-height: 0; flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #374637 transparent; }
.market-row { display: grid; width: 100%; min-height: 44px; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; padding: 3px 8px; text-align: left; }
.market-row:hover { background: var(--surface-2); }
.market-row.selected { background: var(--blue-soft); box-shadow: inset 2px 0 var(--blue); }
.asset-icon { display: inline-grid; width: 32px; height: 32px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: #2b372c; color: #ffffff; font-size: 14px; font-weight: 750; }
.asset-icon.small { width: 26px; height: 26px; font-size: 12px; }
.asset-icon.large { width: 46px; height: 46px; font-size: 18px; }
.asset-icon[data-token="NEAR"] { background: #20d6a2; color: #071c15; }
.asset-icon[data-token="BTC"] { background: #f59e0b; }
.asset-icon[data-token="ETH"] { background: #8ebe9f; }
.asset-icon[data-token="SOL"] { background: #168d74; }
.market-identity, .market-values { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.market-identity strong, .market-values strong { font-size: 11px; font-variant-numeric: tabular-nums; }
.market-identity strong small { margin-left: 5px; color: var(--muted-2); font-size: 11px; font-weight: 650; }
.market-identity > small, .market-values small { color: var(--muted); font-size: 10px; }
.market-identity > small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.market-values { align-items: flex-end; }
.no-markets { display: flex; min-height: 120px; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 13px; }
.market-rail-footer { display: flex; height: 28px; flex: 0 0 28px; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding: 0 8px; color: var(--muted); font-size: 10px; }
.market-rail-footer span { display: flex; align-items: center; gap: 5px; }
.market-rail-footer i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.market-rail-footer .paused i { background: var(--amber); }
.market-rail-footer strong { color: var(--text); font-size: 10px; }

.asset-header { position: relative; z-index: 14; display: flex; width: 100%; min-width: 0; align-items: stretch; border-bottom: 1px solid var(--line); padding: 0 6px; overflow: hidden; background: var(--surface); }
.market-rail-control { display: grid; width: 30px; height: 30px; flex: 0 0 30px; place-items: center; align-self: center; margin-right: 6px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); }
.market-rail-control:hover { background: var(--surface-2); color: var(--text); }
.asset-title { display: flex; min-width: 152px; align-items: center; gap: 6px; }
.asset-name-line { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.asset-name-line h2 { margin: 0; font-size: 12px; letter-spacing: -.005em; }
.asset-name-line span { border-radius: 2px; padding: 2px 4px; background: var(--surface-3); color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .03em; }
.asset-name-line svg { color: var(--blue); }
.hero-price { display: flex; min-width: 116px; align-items: center; gap: 6px; padding-right: 7px; }
.hero-price > strong { font-size: 18px; line-height: 1; letter-spacing: -.015em; font-variant-numeric: tabular-nums; }
.gain-badge, .loss-badge { font-size: 11px; font-weight: 650; white-space: nowrap; }
.gain-badge { color: var(--green); }
.loss-badge { color: var(--red); }
/* Stats that do not fit wrap onto a hidden second line, so a narrow chart drops the last ones whole and never clips a
   price. The markup lists them by priority: Mark, Index, Funding / Countdown, 24h Volume, Open Interest, 24h High, 24h Low. */
.header-market-data { display: flex; height: 45px; min-width: 0; flex: 1; flex-wrap: wrap; align-content: flex-start; overflow: hidden; }
.market-stat { display: flex; height: 45px; min-width: 64px; flex: 1 0 auto; flex-direction: column; justify-content: center; gap: 1px; border-left: 1px solid var(--line-soft); padding: 0 5px; }
/* Wide enough for a six-digit price. */
.market-stat.mark { min-width: 72px; }
.market-stat span, .market-stat strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.market-stat span { color: var(--muted); font-size: 10px; }
.market-stat strong { font-size: 11px; font-variant-numeric: tabular-nums; }
.asset-header-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 3px; margin-left: 4px; }
.asset-header-actions button { display: grid; width: 29px; height: 29px; place-items: center; border-radius: 3px; color: var(--muted); }
.asset-header-actions button:hover { background: var(--surface-2); color: var(--text); }
.asset-header-actions button.favorite.active { color: #f3c74f; }

.chart-panel { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: var(--surface); }
.candle-chart { display: flex; width: 100%; height: 100%; min-height: 240px; flex-direction: column; background: var(--surface); }
.chart-toolbar { display: flex; height: 30px; flex: 0 0 30px; align-items: center; gap: 10px; border-bottom: 1px solid var(--line-soft); padding: 0 6px; overflow: hidden; white-space: nowrap; }
.chart-intervals { display: flex; flex: 0 0 auto; gap: 2px; }
.chart-intervals button { height: 22px; border-radius: 3px; padding: 0 7px; color: var(--muted); font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums; }
.chart-intervals button:hover { background: var(--surface-2); color: var(--text); }
.chart-intervals button.active { background: var(--blue-soft); color: #97c4a7; }
/* Items that do not fit wrap onto a hidden second line, so a narrow chart drops Vol, then the change, never half an item. */
.chart-legend { display: flex; height: 16px; min-width: 0; flex-wrap: wrap; gap: 16px 8px; overflow: hidden; color: var(--muted-2); font-size: 11px; line-height: 16px; font-variant-numeric: tabular-nums; }
.chart-legend > span { flex: none; }
.chart-legend strong { font-weight: 600; }
.chart-attribution { margin: 0; flex: none; padding: 2px 8px 3px; color: var(--muted-2); font-size: 10px; line-height: 14px; text-align: right; }
.chart-attribution a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.chart-attribution a:hover { color: var(--muted); }
.chart-canvas { position: relative; min-height: 0; flex: 1; overflow: hidden; }
.chart-canvas canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
.chart-canvas canvas:focus-visible { outline: 1px solid var(--blue); outline-offset: -1px; }
.chart-status { position: absolute; inset: 0 66px 22px 0; display: grid; place-items: center; color: var(--muted); font-size: 12px; pointer-events: none; }
.pane-resize-handle { position: absolute; right: 1px; bottom: 1px; z-index: 60; width: 18px; height: 18px; padding: 0; cursor: nwse-resize; touch-action: none; }
.pane-resize-handle i { position: absolute; right: 3px; bottom: 3px; width: 8px; height: 8px; border-right: 2px solid #829682; border-bottom: 2px solid #829682; pointer-events: none; transition: border-color .12s, opacity .12s; opacity: .72; }
.pane-resize-handle:hover i, .pane-resize-handle:focus-visible i, .pane-resizing .pane-resize-handle i { border-color: var(--blue); opacity: 1; }
.pane-resize-handle:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }

.positions-section { min-width: 0; overflow: auto; background: var(--surface); scrollbar-width: thin; scrollbar-color: #374637 transparent; }
.position-tabs { display: flex; height: 34px; align-items: stretch; border-bottom: 1px solid var(--line); padding: 0 6px; overflow-x: auto; scrollbar-width: none; }
.position-tabs > button { display: flex; flex: 0 0 auto; align-items: center; gap: 5px; border-bottom: 2px solid transparent; padding: 0 8px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.position-tabs > button:hover { color: var(--text); }
.position-tabs > button.active { border-bottom-color: var(--blue); color: var(--text); }
.position-tabs > button span { display: grid; min-width: 17px; height: 17px; place-items: center; border-radius: 2px; background: var(--surface-3); color: var(--text); font-size: 10px; }
.position-tabs .position-activity { margin-left: auto; color: #97c4a7; }
.positions-table { min-width: 710px; }
.position-table-head, .position-table-row { display: grid; grid-template-columns: minmax(116px, 1.2fr) minmax(80px, .85fr) repeat(4, minmax(62px, .65fr)) minmax(82px, .8fr) auto; align-items: center; column-gap: 6px; padding: 0 8px; }
.position-table-head { height: 24px; color: var(--muted-2); font-size: 10px; }
.position-table-row { min-height: 50px; border-top: 1px solid var(--line-soft); font-size: 11px; font-variant-numeric: tabular-nums; }
.position-table-row > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.position-contract { display: flex; min-width: 0; align-items: stretch; gap: 8px; }
.position-side { width: 3px; flex: 0 0 3px; border-radius: 1px; }
.position-side.long { background: var(--green); }
.position-side.short { background: var(--red); }
.position-contract > div, .position-row-pnl { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.position-contract small, .position-row-pnl small { color: var(--muted); font-size: 10px; }
.liquidation-value { color: var(--amber); }
.position-row-actions { display: flex; gap: 5px; }
.position-row-actions button { height: 25px; border: 1px solid var(--line); border-radius: 3px; padding: 0 5px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.position-row-actions button:hover { background: var(--surface-2); color: var(--text); }
.position-row-actions button:last-child:hover { border-color: var(--red); color: var(--red); }
.positions-empty { display: flex; height: 82px; align-items: center; justify-content: center; gap: 7px; color: var(--text); font-size: 11px; }

.orderbook-panel { position: relative; z-index: 1; display: flex; flex-direction: column; overflow: hidden; }
.book-panel-heading { display: flex; height: 34px; flex: 0 0 34px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 0 5px 0 7px; }
.book-feed-toggles, .book-orientation { display: flex; align-items: center; gap: 3px; }
.book-feed-toggles button { display: flex; height: 25px; align-items: center; gap: 5px; border-radius: 2px; padding: 0 6px; color: var(--muted); font-size: 11px; font-weight: 650; }
.book-feed-toggles button:hover, .book-feed-toggles button.active { background: var(--surface-2); color: var(--text); }
.book-feed-toggles button > i { display: grid; width: 13px; height: 13px; place-items: center; border: 1px solid #586958; border-radius: 2px; }
.book-feed-toggles button.active > i { border-color: var(--blue); background: var(--blue); color: #ffffff; }
.book-feed-toggles button:disabled { opacity: 1; }
.book-orientation { margin-left: auto; }
.book-orientation button { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 2px; color: var(--muted-2); }
.book-orientation button:hover, .book-orientation button.active { background: var(--surface-2); color: var(--text); }
.book-workspace { --book-split: 65%; display: flex; min-width: 0; min-height: 0; flex: 1; overflow: hidden; }
.book-workspace.vertical { flex-direction: column; }
.book-workspace.horizontal { flex-direction: row; }
.book-subpane { position: relative; display: flex; min-width: 0; min-height: 0; flex: 1; flex-direction: column; overflow: hidden; background: var(--surface); }
.book-workspace.both.vertical .orderbook-subpane { min-height: 144px; flex: 0 1 var(--book-split); border-bottom: 1px solid var(--line); }
.book-workspace.both.vertical .trades-subpane { min-height: 72px; }
.book-workspace.both.horizontal .orderbook-subpane { min-width: 220px; flex: 0 1 var(--book-split); border-right: 1px solid var(--line); }
.book-workspace.both.horizontal .trades-subpane { min-width: 180px; }
.book-split-handle { position: absolute; z-index: 44; width: 18px; height: 18px; padding: 0; touch-action: none; }
.book-split-handle i { position: absolute; right: 3px; bottom: 3px; width: 8px; height: 8px; border-right: 2px solid #829682; border-bottom: 2px solid #829682; opacity: .72; transition: border-color .12s, opacity .12s; }
.book-split-handle:hover i, .book-split-handle:focus-visible i, .pane-resizing .book-split-handle i { border-color: var(--blue); opacity: 1; }
.book-split-handle.vertical { right: 0; bottom: -9px; cursor: ns-resize; }
.book-split-handle.horizontal { right: -9px; bottom: 0; cursor: ew-resize; }
.book-controls { display: flex; height: 30px; flex: 0 0 30px; align-items: center; justify-content: space-between; padding: 0 6px; }
.book-view-toggle { display: flex; gap: 2px; }
.book-view-toggle button { height: 23px; border-radius: 2px; padding: 0 5px; color: var(--muted); font-size: 10px; }
.book-view-toggle button:hover, .book-view-toggle button.active { background: var(--surface-2); color: var(--text); }
.book-controls > label { position: relative; display: flex; height: 23px; align-items: center; color: var(--muted); }
.book-controls select { height: 23px; appearance: none; cursor: pointer; padding: 0 20px 0 5px; font-size: 10px; font-variant-numeric: tabular-nums; }
.book-controls label svg { position: absolute; right: 5px; pointer-events: none; }
.book-columns, .book-rows button, .trade-columns, .recent-trades > div { display: grid; grid-template-columns: 1fr .85fr 1fr; align-items: center; }
.book-columns { height: 22px; flex: 0 0 22px; padding: 0 6px; color: var(--muted-2); font-size: 10px; }
.book-columns span:not(:first-child), .book-rows span:not(:first-of-type), .trade-columns span:not(:first-child), .recent-trades > div span:not(:first-child) { text-align: right; }
.book-ladder { display: flex; min-height: 0; flex: 1; flex-direction: column; overflow: hidden; }
.book-rows { display: flex; min-height: 0; flex: 1; flex-direction: column; overflow: hidden; }
.book-rows button { position: relative; width: 100%; min-height: 15px; flex: 1; padding: 0 6px; overflow: hidden; font-size: 11px; font-variant-numeric: tabular-nums; text-align: left; }
.book-rows button:hover { background: rgba(255,255,255,.035); }
.book-rows button i { position: absolute; top: 1px; right: 0; bottom: 1px; opacity: .85; }
.book-rows.asks button i { background: var(--red-soft); }
.book-rows.bids button i { background: var(--green-soft); }
.book-rows button span { position: relative; z-index: 1; }
.book-rows.asks button span:first-of-type { color: var(--red); }
.book-rows.bids button span:first-of-type { color: var(--green); }
.book-mid { display: flex; height: 34px; flex: 0 0 34px; align-items: center; justify-content: space-between; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); padding: 0 6px; }
.book-mid > div { display: flex; align-items: center; gap: 6px; }
.book-mid strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.book-mid svg { color: var(--green); }
.book-mid span { color: var(--muted); font-size: 10px; }
.book-ratio { display: flex; height: 24px; flex: 0 0 24px; align-items: center; gap: 6px; border-top: 1px solid var(--line-soft); padding: 0 6px; font-size: 10px; }
.book-ratio i { display: block; height: 5px; flex: 1; border-radius: 1px; background: var(--red); overflow: hidden; }
.book-ratio i b { display: block; width: 52.1%; height: 100%; background: var(--green); }
.recent-trades { min-height: 0; flex: 1; overflow-y: auto; }
.trade-columns { position: sticky; top: 0; z-index: 1; height: 26px; padding: 0 6px; background: var(--surface); color: var(--muted-2); font-size: 10px; }
.recent-trades > div { height: 23px; padding: 0 6px; font-size: 10px; font-variant-numeric: tabular-nums; }
.recent-trades > div:hover { background: var(--surface-2); }
.book-workspace.horizontal .book-columns,
.book-workspace.horizontal .book-rows button { grid-template-columns: 1fr .85fr; }
.book-workspace.horizontal .book-columns > :nth-child(3),
.book-workspace.horizontal .book-rows button > :nth-of-type(3) { display: none; }

.trade-ticket { overflow-y: auto; padding: 0 9px 8px; scrollbar-width: thin; scrollbar-color: #374637 transparent; }
.ticket-heading { display: flex; height: 38px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.ticket-heading > div { display: flex; align-items: baseline; gap: 8px; }
.ticket-heading h2 { margin: 0; font-size: 14px; letter-spacing: -.01em; }
.ticket-heading span { color: var(--muted); font-size: 10px; }
.ticket-heading > button { display: grid; width: 29px; height: 29px; place-items: center; border-radius: 3px; color: var(--muted); }
.ticket-heading > button:hover { background: var(--surface-2); color: var(--text); }
.account-mode-row { display: flex; height: 30px; align-items: center; gap: 2px; border-bottom: 1px solid var(--line-soft); }
.account-mode-row button { display: flex; height: 23px; align-items: center; gap: 2px; border-radius: 2px; padding: 0 4px; color: var(--muted); font-size: 10px; }
.account-mode-row button:hover { background: var(--surface-2); color: var(--text); }
.account-mode-row > span { margin-left: auto; color: var(--muted-2); font-size: 10px; }
.order-tabs { display: grid; height: 34px; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; border-bottom: 1px solid var(--line); }
.order-tabs button { display: flex; align-items: center; justify-content: center; gap: 2px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 11px; font-weight: 650; }
.order-tabs button:hover { color: var(--text); }
.order-tabs button.active { border-bottom-color: var(--blue); color: var(--text); }
.algo-order-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 3px; border-bottom: 1px solid var(--line-soft); padding: 4px 0; }
.algo-order-row button { height: 25px; overflow: hidden; border-radius: 2px; padding: 0 2px; background: var(--surface-2); color: var(--muted); font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
.algo-order-row button.active { background: var(--blue-soft); color: #97c4a7; }
.side-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 5px; }
.side-selector button { display: flex; height: 36px; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); }
.side-selector button strong { color: var(--text); font-size: 12px; }
.side-selector button.long.active { border-color: rgba(57,198,160,.65); background: var(--green-soft); color: var(--green); }
.side-selector button.short.active { border-color: rgba(255,93,115,.65); background: var(--red-soft); color: var(--red); }
.ticket-section { border-bottom: 1px solid var(--line); padding: 6px 0; }
.order-price-section { border-top: 0; }
.ticket-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.ticket-label button { color: #97c4a7; font-size: 10px; }
.ticket-input { display: flex; height: 40px; align-items: center; border: 1px solid var(--line); border-radius: 3px; padding: 0 8px; background: var(--bg); }
.ticket-input.compact { height: 36px; }
.ticket-input:focus-within { border-color: var(--blue); }
.ticket-input > span { margin-right: 4px; color: var(--muted); font-size: 16px; }
.ticket-input input { min-width: 0; flex: 1; font-size: 18px; font-weight: 650; letter-spacing: -.015em; font-variant-numeric: tabular-nums; }
.ticket-input.compact input { font-size: 16px; }
.ticket-input strong { color: var(--muted); font-size: 11px; }
.quick-amounts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; margin-top: 4px; }
.quick-amounts.percentage-presets { grid-template-columns: repeat(5, 1fr); }
.quick-amounts button { height: 25px; border-radius: 2px; background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 600; }
.quick-amounts button:hover, .quick-amounts button.active { background: var(--blue-soft); color: #97c4a7; }
.allocation-row, .leverage-slider-row { display: flex; height: 25px; align-items: center; gap: 7px; margin-top: 3px; }
.allocation-row > input, .leverage-slider-row > input { height: 4px; flex: 1; appearance: none; border-radius: 2px; background: var(--line); accent-color: var(--blue); cursor: pointer; }
.allocation-row > input::-webkit-slider-thumb, .leverage-slider-row > input::-webkit-slider-thumb { width: 12px; height: 12px; appearance: none; border: 2px solid var(--surface); border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.allocation-row > input::-moz-range-thumb, .leverage-slider-row > input::-moz-range-thumb { width: 10px; height: 10px; border: 2px solid var(--surface); border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.percentage-input, .leverage-input { display: flex; width: 52px; height: 24px; flex: 0 0 52px; align-items: center; border: 1px solid var(--line); border-radius: 2px; background: var(--bg); color: var(--muted); }
.percentage-input:focus-within, .leverage-input:focus-within { border-color: var(--blue); }
.percentage-input input, .leverage-input input { width: 34px; padding-left: 4px; color: var(--text); font-size: 11px; font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.percentage-input input::-webkit-inner-spin-button, .percentage-input input::-webkit-outer-spin-button, .leverage-input input::-webkit-inner-spin-button, .leverage-input input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.percentage-input span, .leverage-input span { padding-left: 2px; font-size: 10px; }
.risk-label { display: flex; align-items: center; gap: 3px; border-radius: 2px; padding: 2px 4px; font-size: 10px; font-weight: 650; }
.risk-label.low { background: var(--green-soft); color: var(--green); }
.risk-label.moderate { background: rgba(240,168,91,.13); color: var(--amber); }
.risk-label.high { background: var(--red-soft); color: var(--red); }
.leverage-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 3px; }
.leverage-options button { height: 27px; border: 1px solid var(--line); border-radius: 2px; color: var(--muted); font-size: 11px; font-weight: 650; }
.leverage-options button:hover { color: var(--text); }
.leverage-options button.active { border-color: var(--blue); background: var(--blue-soft); color: #97c4a7; }
.order-options { display: grid; grid-template-columns: 1fr 1fr; min-height: 36px; align-items: center; border-bottom: 1px solid var(--line); }
.order-options button { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; text-align: left; }
.order-options button i { display: grid; width: 17px; height: 17px; place-items: center; border: 1px solid #586958; border-radius: 3px; }
.order-options button.checked { color: var(--text); }
.order-options button.checked i { border-color: var(--blue); background: var(--blue); color: #ffffff; }
.order-options button:disabled { cursor: default; opacity: .75; }
.tpsl-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.tpsl-inputs .ticket-input > span { font-size: 11px; font-weight: 650; }
.ticket-problem { display: flex; min-height: 24px; align-items: center; color: var(--amber); font-size: 11px; }
.tpsl-fields { display: grid; gap: 10px; margin: 12px 0; }
.tpsl-field .ticket-label { font-size: 12px; }
.tpsl-modal .ticket-problem { margin-bottom: 8px; }
.trade-preview { border-bottom: 1px solid var(--line); padding: 5px 0; }
.trade-preview > div { display: flex; min-height: 21px; align-items: center; justify-content: space-between; }
.trade-preview span { display: flex; align-items: center; gap: 3px; color: var(--muted); font-size: 10px; }
.trade-preview strong { font-size: 11px; font-variant-numeric: tabular-nums; }
.trade-preview .help-tip { display: inline-flex; cursor: help; }
.review-button { display: flex; width: 100%; height: 38px; align-items: center; justify-content: center; gap: 5px; margin-top: 7px; border-radius: 3px; color: #ffffff; font-size: 12px; font-weight: 750; }
.review-button.long { background: var(--green); }
.review-button.short { background: var(--red); }
.review-button:hover { filter: brightness(1.06); }
.ticket-assurance { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 24px; color: var(--muted-2); font-size: 10px; }
.ticket-account-summary { margin-top: 6px; border-top: 1px solid var(--line); padding-top: 6px; }
.ticket-account-summary > div { display: flex; min-height: 21px; align-items: center; justify-content: space-between; color: var(--muted); font-size: 10px; }
.ticket-account-summary > div strong { color: var(--text); font-size: 11px; font-variant-numeric: tabular-nums; }
.account-summary-heading { margin-bottom: 2px; }
.account-summary-heading > strong { font-size: 12px !important; }
.account-summary-heading span { display: flex; align-items: center; gap: 5px; color: var(--green); }
.account-summary-heading span i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.margin-ratio-bar { display: block; height: 4px; margin-top: 5px; border-radius: 1px; background: var(--line); overflow: hidden; }
.margin-ratio-bar b { display: block; width: 0; height: 100%; background: var(--green); }

.modal-layer { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 18px; background: rgba(86,149,108,.74); backdrop-filter: blur(6px); }
.onboarding-modal, .review-modal { position: relative; width: min(450px, calc(100vw - 28px)); border: 1px solid #3b473c; border-radius: 9px; padding: 27px; background: var(--surface); box-shadow: 0 28px 90px rgba(0,0,0,.62); }
.modal-close { position: absolute; top: 12px; right: 12px; display: grid; width: 34px; height: 34px; place-items: center; border-radius: 4px; color: var(--muted); }
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.onboarding-icon { display: grid; width: 50px; height: 50px; margin-bottom: 16px; place-items: center; border-radius: 7px; background: var(--blue); color: #ffffff; }
.eyebrow { color: #97c4a7; font-size: 12px; font-weight: 700; letter-spacing: .025em; text-transform: uppercase; }
.onboarding-modal h2, .review-modal h2 { margin: 7px 0 9px; font-size: 25px; letter-spacing: -.025em; }
.onboarding-modal > p { margin: 0 0 17px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.login-options { display: flex; flex-direction: column; gap: 7px; }
.login-options button { display: flex; height: 47px; align-items: center; justify-content: center; gap: 9px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); font-size: 14px; font-weight: 650; }
.login-options button:hover { border-color: #506051; background: var(--surface-3); }
.onboarding-benefits { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 17px 0 11px; color: var(--muted); font-size: 12px; }
.onboarding-benefits span { display: flex; align-items: center; gap: 4px; }
.onboarding-benefits svg { color: var(--green); }
.onboarding-modal > small { display: block; color: var(--muted-2); font-size: 12px; text-align: center; }
.review-market { display: flex; align-items: center; gap: 11px; margin-bottom: 16px; }
.review-market span { color: var(--muted); font-size: 12px; }
.review-market h2 { margin: 3px 0 0; }
.review-summary { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 10px 0; }
.review-summary > div { display: flex; min-height: 32px; align-items: center; justify-content: space-between; }
.review-summary span { color: var(--muted); font-size: 13px; }
.review-summary strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.review-warning { display: flex; gap: 8px; margin: 14px 0; border-radius: 4px; padding: 10px; background: rgba(240,168,91,.11); color: #e8bd78; font-size: 12px; line-height: 1.45; }
.review-warning svg { flex: 0 0 auto; }
.confirm-button { width: 100%; height: 47px; border-radius: 4px; color: #ffffff; font-weight: 700; }
.confirm-button.long { background: var(--green); }
.confirm-button.short { background: var(--red); }
.app-toast { position: fixed; top: 47px; left: 50%; z-index: 300; display: flex; min-height: 36px; align-items: center; gap: 7px; transform: translateX(-50%); border: 1px solid #404c40; border-radius: 4px; padding: 0 11px; background: var(--surface-2); box-shadow: 0 14px 40px rgba(0,0,0,.42); font-size: 11px; }
.app-toast svg { flex: none; color: var(--green); }
.app-toast.error { border-color: rgba(255,93,115,.55); }
.app-toast.error svg { color: var(--red); }
.layout-menu:focus, .onboarding-modal:focus, .review-modal:focus { outline: none; }
.mobile-nav { display: none; }

@media (max-width: 1560px) {
  .app-layout:not(.markets-collapsed) .position-table-head,
  .app-layout:not(.markets-collapsed) .position-table-row { grid-template-columns: minmax(112px, 1.1fr) minmax(82px, .8fr) minmax(64px, .65fr) minmax(88px, .8fr) auto; }
  .app-layout:not(.markets-collapsed) .positions-table { min-width: 0; }
  .app-layout:not(.markets-collapsed) .position-table-head > :nth-child(4),
  .app-layout:not(.markets-collapsed) .position-table-row > :nth-child(4),
  .app-layout:not(.markets-collapsed) .position-table-head > :nth-child(5),
  .app-layout:not(.markets-collapsed) .position-table-row > :nth-child(5),
  .app-layout:not(.markets-collapsed) .position-table-head > :nth-child(6),
  .app-layout:not(.markets-collapsed) .position-table-row > :nth-child(6) { display: none; }
  .app-layout:not(.markets-collapsed) .position-activity { display: none; }
}

@media (max-width: 1280px) {
  .balance-pill { display: none; }
  .app-header { grid-template-columns: auto 1fr auto; gap: 12px; }
  .position-table-head, .position-table-row { grid-template-columns: minmax(125px, 1.2fr) minmax(90px, .9fr) repeat(2, minmax(70px, .65fr)) minmax(95px, .8fr) auto; }
  .position-table-head > :nth-child(5), .position-table-row > :nth-child(5), .position-table-head > :nth-child(6), .position-table-row > :nth-child(6) { display: none; }
}

@container (max-width: 760px) {
  .asset-header-actions { display: none; }
}

/* A default-width chart keeps Funding / Countdown and 24h Volume beside Mark: Index gives way first, and the title
   drops its shield. */
@container (max-width: 640px) {
  .market-stat.index, .asset-name-line svg { display: none; }
  .asset-header { padding: 0 4px; }
  .asset-title { min-width: 0; }
}

@container (max-width: 560px) {
  .hero-price { min-width: 104px; }
}

@media (max-width: 980px) {
  body { overflow: auto; }
  .consumer-app { height: auto; min-height: 100dvh; overflow: visible; padding-bottom: 66px; }
  .app-header { position: sticky; top: 0; height: 52px; grid-template-columns: 1fr auto; padding: 0 10px; }
  .header-status { display: none; }
  .preview-banner { display: flex; }
  .header-brand nav, .layout-trigger, .notification-button, .layout-menu, .layout-menu-scrim { display: none; }
  .account-button { min-width: auto; height: 34px; }
  .mobile-menu { display: grid; width: 34px; height: 34px; place-items: center; color: var(--muted); }
  .app-layout, .app-layout.markets-collapsed { display: flex; height: auto; flex-direction: column; gap: 6px; padding: 6px; overflow: visible; background: var(--bg); }
  .pane-tile { width: 100%; flex: 0 0 auto; overflow: hidden; }
  .pane-resize-handle, .book-split-handle { display: none; }
  .pane-markets { display: none !important; }
  .pane-chart { order: 1; display: grid; height: 606px; min-height: 606px; grid-template-rows: auto 500px; border: 1px solid var(--line); }
  .pane-positions { order: 2; height: 174px; min-height: 174px; border: 1px solid var(--line); }
  .pane-book { order: 3; height: 610px; min-height: 610px; border: 1px solid var(--line); }
  .pane-ticket { order: 4; height: auto; overflow: visible; border: 1px solid var(--line); }
  .asset-header { display: grid; width: auto; grid-template-columns: 1fr auto; min-height: 106px; gap: 5px; padding: 6px; }
  .market-rail-control { display: none; }
  .asset-title { min-width: 0; }
  .hero-price { min-width: auto; justify-self: end; }
  .asset-name-line svg { display: inline; }
  .header-market-data { display: grid; height: auto; align-content: normal; grid-column: 1 / -1; grid-template-columns: repeat(4, 1fr); min-height: 47px; border-top: 1px solid var(--line-soft); }
  .market-stat { display: flex !important; height: auto; min-width: 0; border-left: 0; }
  .market-stat.index, .market-stat.high, .market-stat.low { display: none !important; }
  .asset-header-actions { display: none; }
  .chart-panel { min-height: 0; }
  .positions-section { min-height: 0; }
  .orderbook-panel { height: 100%; }
  .trade-ticket { height: auto; overflow: visible; }
  .position-tabs .position-activity { display: none; }
  .mobile-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 100; display: grid; height: 66px; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); background: rgba(9,14,11,.97); backdrop-filter: blur(12px); }
  .mobile-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); font-size: 12px; }
  .mobile-nav button.active { color: #97c4a7; }
}

@media (pointer: coarse) and (min-width: 981px) {
  .pane-resize-handle, .book-split-handle { width: 28px; height: 28px; }
  .book-split-handle.vertical { bottom: -14px; }
  .book-split-handle.horizontal { right: -14px; }
}

@media (max-width: 620px) {
  .brand strong { font-size: 17px; }
  .pane-chart { height: 576px; min-height: 576px; grid-template-rows: auto 470px; }
  .header-market-data { grid-template-columns: repeat(3, 1fr); }
  .market-stat.oi { display: none !important; }
  .position-tabs > button:nth-child(n+4) { display: none; }
  .positions-table { min-width: 590px; overflow-x: auto; }
  .trade-ticket { padding: 0 10px 10px; }
  .onboarding-modal, .review-modal { padding: 23px 18px; }
}
.account-mode-row button.active { background: var(--surface-2); color: var(--text); }
.account-mode-row button:disabled { opacity: .45; cursor: not-allowed; }
.tpsl-modal .order-tabs { margin-bottom: 12px; }
.account-mode-row .mode-group { display: flex; gap: 2px; }
.account-mode-row .mode-group + .mode-group { margin-left: 4px; padding-left: 4px; border-left: 1px solid var(--line-soft); }
.account-mode-row button { white-space: nowrap; padding: 0 3px; }
.account-mode-row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
