:root {
  color-scheme: dark;
  --bg: #101010;
  --panel: #161616;
  --chart-bg: #161616;
  --border: #262626;
  --text: #d1d4dc;
  --muted: #787b86;
  --accent: #525866;
  --green: #2e8b57;
  --red: #b84040;
  --amber: #c9972b;
  --font-sans: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

::selection {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  user-select: none;
}

body {
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 36px;
  flex: 0 0 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.topbar::-webkit-scrollbar { display: none; }

.terminal-topbar {
  display: flex;
  flex: 0 0 36px;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding-right: 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.terminal-controls {
  flex: 1 1 0;
  height: 100%;
  min-width: 0;
  padding-right: 0;
  border-bottom: 0;
}

.tb-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.tb-label {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.brand-logo {
  display: block;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-status-slot {
  display: inline-grid;
  align-items: center;
  flex: none;
}
.brand-status-slot > .terminal-brand,
.brand-status-slot > .connection-status {
  grid-area: 1 / 1;
}
.terminal-brand {
  flex: none;
  opacity: .85;
  transition: opacity 160ms ease-out;
}
.brand-status-slot.active > .terminal-brand {
  opacity: .08;
}
@media (max-width: 600px) {
  .terminal-brand .brand-logo { width: 22px; height: 22px; }
}

.ws-dot {
  position: relative;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  color: var(--amber);
  background: currentColor;
}
.connection-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  max-width: 126px;
  padding: 0;
  border-radius: 3px;
  border: 1px solid transparent;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition:
    max-width 180ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 150ms ease-out,
    padding 180ms cubic-bezier(0.22, 1, 0.36, 1),
    background-color 150ms ease-out,
    border-color 150ms ease-out,
    color 150ms ease-out;
}
.connection-status[data-state="connecting"] {
  max-width: 126px;
  padding: 0 8px;
  opacity: 1;
  background: #2d261a;
  color: #e2b866;
  border-color: #4d3f24;
}
.connection-status[data-state="offline"] {
  max-width: 220px;
  padding: 0 8px;
  opacity: 1;
  background: #3a1e22;
  color: #db8288;
  border-color: #572d32;
}
.ws-dot.open { color: var(--green); }
.ws-dot.offline { color: var(--red); }
.ws-dot:is(.open, .connecting)::after {
  content: "";
  position: absolute;
  inset: -2px;
  border: 1px solid currentColor;
  border-radius: inherit;
  pointer-events: none;
  animation: ws-dot-pulse 2.8s ease-out infinite;
}
.ws-dot.connecting::after { animation-duration: 1.8s; }
@keyframes ws-dot-pulse {
  from { opacity: .4; transform: scale(.8); }
  75%, to { opacity: 0; transform: scale(1.5); }
}
@media (prefers-reduced-motion: reduce) {
  .ws-dot:is(.open, .connecting)::after { animation: none; opacity: 0; }
}

button, select, input {
  font-family: inherit;
  font-size: 11px;
  color: var(--text);
  background: #1e1e1e;
  border: 1px solid var(--border);
  border-radius: 3px;
  height: 24px;
  padding: 0 7px;
  cursor: pointer;
}

:is(button, select, input, textarea, a):focus,
:is(button, select, input, textarea, a):focus-visible {
  outline: none;
}

:is(input, select, textarea):focus,
:is(input, select, textarea):focus-visible {
  border-color: #525866;
}

:is(button, a):focus-visible {
  border-color: #484d56;
}

button:hover, select:hover, .account-secondary:not(:disabled):hover {
  border-color: #3a3a3a;
  background: #272727;
}

#freeze-btn.active {
  background: #30261a;
  border-color: #655032;
  color: #e2bd83;
}
#freeze-btn.active:hover { background: #382b1d; }

.tb-input {
  width: 150px;
  cursor: text;
  font-family: var(--font-mono);
}

.search-wrap { position: relative; }

.search-dropdown {
  position: fixed;
  z-index: 60;
  width: min(280px, calc(100vw - 16px));
  max-height: min(340px, calc(100dvh - 46px));
  overscroll-behavior: contain;
  overflow-y: auto;
  background: #181818;
  border: 1px solid #333333;
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
}

.search-item {
  display: flex;
  width: 100%;
  height: auto;
  min-height: 30px;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: left;
  padding: 6px 10px;
  cursor: pointer;
  border-bottom: 1px solid #222222;
  font-family: var(--font-mono);
}
.search-item:hover,
.search-item:focus-visible {
  background: #242424;
  border-color: #222222;
}
.search-listing { cursor: default; }
.search-item > :first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-item .muted { color: var(--muted); font-size: 10px; flex-shrink: 0; }
.search-status { padding: 8px 10px; }

.ex-filter { position: relative; }

.ex-filter-btn {
  min-width: 96px;
  text-align: left;
  font-family: var(--font-mono);
}

.ex-menu {
  /* Fixed, like .search-dropdown: the topbar scrolls horizontally and clips
     absolutely positioned children. The button rect sets the left edge. */
  position: fixed;
  top: 38px;
  left: 0;
  z-index: 60;
  width: 208px;
  padding: 4px;
  background: #181818;
  border: 1px solid #333333;
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
}

.ex-option {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 22px;
  padding: 0 6px;
  border-radius: 3px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
}
.ex-option:hover { background: #242424; }
.ex-option input {
  margin: 0;
  width: 12px;
  height: 12px;
  padding: 0;
  accent-color: #6b7280;
  cursor: pointer;
}
.ex-option.locked { opacity: 0.45; cursor: default; }
.ex-option.locked input { cursor: default; }
.ex-option .ex-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 10px;
}

.ex-actions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  padding: 4px 6px 2px;
  border-top: 1px solid #222222;
}
.ex-actions button {
  flex: 1 1 auto;
  height: 20px;
  font-size: 10px;
  padding: 0 4px;
}
.ex-actions button:disabled {
  opacity: 0.4;
  cursor: default;
  background: #1e1e1e;
  border-color: var(--border);
}

.tb-stats {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.tb-account-link {
  flex: none;
  max-width: min(32vw, 168px);
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #1e1e1e;
  color: var(--text);
  font: 11px/22px var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}
.tb-account-link:hover { border-color: #3a3a3a; background: #272727; }

.tb-gpu-warn {
  height: 22px;
  padding: 0 7px;
  border-radius: 3px;
  border: 1px solid rgba(245, 158, 11, 0.55);
  background: rgba(120, 53, 15, 0.35);
  color: #fbbf24;
  font: 600 10px/20px var(--font-mono);
  white-space: nowrap;
  flex-shrink: 0;
  cursor: help;
}
.tb-gpu-warn:hover {
  background: rgba(146, 64, 14, 0.52);
  border-color: rgba(251, 191, 36, 0.8);
}

.custom-select-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  cursor: pointer;
}
.custom-select-btn[aria-expanded="true"] {
  background: #282a2e;
  border-color: #484d56;
}
.custom-select-btn .caret {
  width: 5px;
  height: 5px;
  margin: -2px 1px 0;
  border: solid currentColor;
  border-width: 0 1px 1px 0;
  transform: rotate(45deg);
  opacity: 0.72;
  transition: transform 90ms ease-out, margin-top 90ms ease-out;
}
.custom-select-btn[aria-expanded="true"] .caret {
  margin-top: 2px;
  transform: rotate(225deg);
}
@keyframes custom-select-drop {
  from {
    opacity: 0;
    transform: translateY(-4px) scaleY(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scaleY(1);
  }
}
.custom-select-menu {
  position: fixed;
  z-index: 95;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 2px;
  border: 1px solid #333333;
  border-radius: 3px;
  background: #181818;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.65);
  transform-origin: top center;
  animation: custom-select-drop 90ms cubic-bezier(0.16, 1, 0.3, 1);
}
.custom-select-opt {
  height: 20px;
  padding: 0 7px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: #c8cdd5;
  font: 11px/20px var(--font-mono);
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}
.custom-select-opt:hover {
  background: #262930;
  color: #f3f4f6;
}
.custom-select-opt.active {
  background: #282a2e;
  color: #f8fafc;
  font-weight: 600;
  box-shadow: inset 2px 0 #78869c;
}

.badge {
  display: inline-block;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--amber);
  color: #111111;
  font-weight: 700;
  font-size: 10px;
}

.workspace {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
  display: flex;
}

.empty-state {
  margin: auto;
  padding: 0 16px;
  text-align: center;
}

.empty-sub {
  margin-top: 8px;
  font-size: 11px;
  color: #969aa5;
}

.empty-sub kbd {
  display: inline-block;
  margin-left: 3px;
  padding: 0 4px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #1e1e1e;
  color: var(--text);
  font-family: var(--font-mono);
}

.empty-conn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}

.conn-line {
  position: relative;
  width: 128px;
  height: 1px;
  background: #22252b;
  overflow: hidden;
  border-radius: 1px;
  display: none;
}
.empty-state:is(.connecting, .ready) .conn-line { display: block; }
.conn-line > i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 44px;
  background: linear-gradient(90deg, transparent, #8b94a3, transparent);
  transform: translateX(-44px);
  animation: conn-sweep 1.25s ease-in-out 400ms infinite;
}
.empty-state.ready .conn-line > i {
  background: linear-gradient(90deg, transparent, #657184, transparent);
  animation-duration: 2.6s;
}
@keyframes conn-sweep {
  to { transform: translateX(128px); }
}
@media (prefers-reduced-motion: reduce) {
  .conn-line > i { animation: none; transform: translateX(42px); }
}

.grid {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  display: grid;
  gap: 3px;
  padding: 3px;
  background: transparent;
  min-height: 0;
  will-change: transform;
}

.workspace-gl-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  pointer-events: none;
}

.grid-scrollbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 7px;
  z-index: 20;
  background: rgba(17, 18, 22, 0.85);
}

.grid-scrollbar-thumb {
  position: absolute;
  top: 1px;
  bottom: 1px;
  left: 0;
  min-width: 28px;
  background: #3a3f4b;
  border-radius: 3px;
  cursor: pointer;
}

.grid-scrollbar-thumb:hover {
  background: #525866;
}

.cell {
  display: flex;
  flex-direction: column;
  background: transparent;
  border: 1px solid #383b44;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  contain: layout style;
}

.cell:focus, .chart-pane:focus { outline: none; }
@media (any-hover: hover) {
  .cell:hover { border-color: #515864; }
  .cell:hover .cell-head { background-color: #292d35; }
}
@media (any-hover: hover) and (prefers-reduced-motion: no-preference) {
  .cell { transition: border-color 140ms ease-out; }
  .cell-head { transition: background-color 140ms ease-out; }
}
[data-keyboard-focus] .cell:focus-visible,
[data-keyboard-focus] .chart-pane:focus-visible {
  outline: 1px solid #78869c;
  outline-offset: -1px;
}
.cell-head.signal-arrived { box-shadow: inset 3px 0 #e5b56b; }

.cell-head {
  height: 22px;
  flex: 0 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0 6px;
  background: #212329;
  border-bottom: 1px solid #343740;
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
}

.cell-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.cell-symbol {
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: #e5e7eb;
  font: inherit;
  font-weight: 700;
  text-align: left;
}
.cell-symbol:hover { background: transparent; color: #fff; }

.cell-tag {
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 2px;
  font-weight: 700;
}
.cell-tag.buy { background: #1d3628; color: #7ec49b; border: 1px solid #2b4f3b; }
.cell-tag.sell { background: #3a1e22; color: #db8288; border: 1px solid #572d32; }
.cell-tag.two-sided { background: #2d261a; color: #e2b866; border: 1px solid #4d3f24; }

.cell-meta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta-item, .stat-item {
  cursor: default;
}
.meta-item:hover, .stat-item:hover {
  color: #b8bec9;
}

.stat-sep {
  color: #3f424b;
}

.cell-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.cell-btn {
  height: 17px;
  padding: 0 5px;
  font-size: 10px;
  line-height: 15px;
  background: #242424;
}

.cell-btn.accent,
.cell-lev-btn {
  background: #282e38;
  border-color: #4f5868;
  color: #e2e8f0;
}
.cell-btn.accent:hover,
.cell-lev-btn:hover {
  background: #323946;
  border-color: #697488;
  color: #f8fafc;
}
.cell-btn.danger { background: #5c2222; border-color: #8f3535; }

.cell-canvas-wrap, .focus-chart-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

.chart-hit-pane {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 2;
}

.chart-live-btn {
  position: absolute;
  right: 78px;
  bottom: 22px;
  z-index: 5;
  height: 20px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(34, 34, 38, 0.92);
  border-color: #4b5563;
  color: #e5e7eb;
}

.coin-overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: grid;
  gap: 2px;
  padding: 2px;
  background: #0d0d0d;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #2f2f35 #0d0d0d;
}

.coin-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  min-height: 0;
  padding: 2px 4px;
  background: var(--chart-bg);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  cursor: pointer;
  overflow: hidden;
  text-align: center;
}

.coin-tile.primary {
  border-color: #3f4450;
  background: #1a1b1f;
}

.coin-tile:hover {
  border-color: #525866;
  background: #202228;
}

.coin-tile.copied {
  border-color: #2e8b57;
  background: #1a2d22;
}

.coin-tile-ex {
  font-size: 9px;
  line-height: 1.1;
  color: var(--muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coin-tile-sym {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  color: #d1d4dc;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coin-tile:hover .coin-tile-sym { color: #ffffff; }
.coin-tile.copied .coin-tile-sym { color: #a7f3d0; }

.ui-tooltip {
  position: fixed;
  z-index: 95;
  pointer-events: none;
  max-width: 280px;
  white-space: pre-line;
  padding: 4px 8px;
  background: #181a1f;
  border: 1px solid #2e3138;
  border-radius: 3px;
  font-family: var(--font-sans);
  font-size: 10px;
  line-height: 1.3;
  color: #aeb4c0;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.copy-badge {
  position: fixed;
  z-index: 90;
  pointer-events: none;
  padding: 2px 6px;
  background: rgba(24, 24, 28, 0.92);
  border: 1px solid #3c3e46;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: #c5cbd6;
  letter-spacing: 0.02em;
}

.focus-modal {
  position: fixed;
  inset: 36px 0 0 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: var(--chart-bg);
  border-top: 1px solid #2b2b2b;
}

.focus-header {
  height: 30px;
  flex: 0 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  background: #212329;
  border-bottom: 1px solid #343740;
  font-size: 12px;
  cursor: pointer;
}

.focus-title, .focus-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.focus-header { gap: 8px; }
.focus-title, .focus-actions { min-width: 0; }
.focus-title { flex: 1 1 auto; }
.focus-title > .cell-tag { flex: 0 0 auto; }
.focus-title > .cell-symbol {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.focus-actions > button { flex: 0 0 auto; }

.hint {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
}
@media (max-width: 700px) {
  .focus-actions > .hint { display: none; }
}
@media (max-width: 480px) {
  .focus-header {
    height: auto;
    flex-basis: auto;
    min-height: 38px;
  }
  .focus-title {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 2px 6px;
    padding-block: 4px;
  }
  .focus-title > .cell-meta, #focus-tag.hidden + #focus-symbol {
    grid-column: 1 / -1;
  }
  .focus-title > .cell-meta { white-space: nowrap; }
  .focus-actions > .cell-btn {
    min-width: 26px;
    height: 26px;
  }
}

.toast {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 80;
  padding: 7px 12px;
  background: #1a1a1a;
  border: 1px solid #333333;
  border-radius: 4px;
  font-size: 11px;
  color: #e5e7eb;
}

.hidden { display: none !important; }

.scale-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.scale-menu-btn .caret {
  width: 6px;
  height: 6px;
  margin: -3px 1px 0;
  border: solid currentColor;
  border-width: 0 1px 1px 0;
  transform: rotate(45deg);
  opacity: .75;
}
.scale-menu-btn:has(+ .scale-menu:popover-open) .caret {
  margin-top: 3px;
  transform: rotate(225deg);
}
.scale-menu {
  --scale-menu-width: 304px;
  position: fixed;
  inset: var(--scale-anchor-y, 42px) auto auto
    clamp(8px, var(--scale-anchor-x, 8px), max(8px, calc(100% - var(--scale-menu-width) - 8px)));
  width: min(var(--scale-menu-width), calc(100% - 16px));
  max-height: max(0px, calc(100dvh - var(--scale-anchor-y, 42px) - 8px));
  margin: 0;
  padding: 4px 10px;
  overflow: auto;
  overscroll-behavior: contain;
  background: #191b20;
  color: var(--text);
  border: 1px solid #343841;
  border-radius: 6px;
  box-shadow: 0 10px 28px #0009;
}
.scale-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 28px;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}
.scale-row + .scale-row { border-top: 1px solid #2a2d34; }
.scale-row-name { font-size: 11px; }
.panel-order-row {
  grid-template-columns: auto minmax(0, 1fr) 28px;
}
.panel-order-track {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
}
.panel-order-chip {
  flex: 1 1 0;
  min-width: 0;
  height: 24px;
  padding: 0 5px;
  border: 1px solid #383d46;
  border-radius: 3px;
  background: #23262d;
  color: var(--text);
  font: 600 10px/1 var(--font-mono, ui-monospace, monospace);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: grab;
  user-select: none;
  transition: border-color 110ms ease, background-color 110ms ease, opacity 110ms ease;
}
.panel-order-chip:hover { border-color: #5c6370; background: #2c303a; color: #fff; }
.panel-order-chip:active { cursor: grabbing; }
.panel-order-chip.dragging { opacity: 0.45; }
.panel-order-chip.drop-over { border-color: #f59e0b; background: #332916; color: #fbbf24; }
.panel-order-chip.locked {
  flex: 0 0 auto;
  cursor: default;
  opacity: 0.55;
  background: #17191d;
  border-style: dashed;
}
.panel-order-chip.locked:hover { border-color: #383d46; background: #17191d; color: var(--text); }
.scale-ctrl {
  display: grid;
  grid-template-columns: 28px 52px 28px;
  border: 1px solid #383d46;
  border-radius: 4px;
}
.scale-menu :is(.scale-btn, .scale-input) {
  width: 100%;
  height: 26px;
  padding: 0;
}
.scale-ctrl > :is(.scale-btn, .scale-input) {
  border: 0;
  border-radius: 0;
}
.scale-ctrl > :first-child { border-radius: 3px 0 0 3px; }
.scale-ctrl > :last-child { border-radius: 0 3px 3px 0; }
.scale-btn {
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 600;
  background: #24272e;
}
.scale-btn:not(:disabled):hover { background: #353a44; }
.scale-ctrl > .scale-input {
  border-inline: 1px solid #383d46;
  background: #15171a;
  color: #f3f4f6;
  font-family: var(--font-mono);
  text-align: center;
  cursor: text;
}
.scale-ctrl > .scale-input:focus,
.scale-ctrl > .scale-input:focus-visible {
  border-inline-color: #383d46;
}
.scale-reset-btn { border-color: #383d46; }
.scale-reset-btn:disabled {
  opacity: .44;
  cursor: default;
  background: transparent;
}
@media (pointer: coarse) {
  .scale-menu :is(.scale-btn, .scale-input) { height: 34px; }
}

.dom-pane {
  position: absolute;
  z-index: 3;
  pointer-events: none;
}

.account-page {
  height: 100dvh;
  width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
  user-select: text;
}
.account-bar { gap: 9px; padding-inline: 16px; overflow: visible; justify-content: space-between; }
.account-brand-link { display: inline-flex; align-items: center; text-decoration: none; }
.account-bar-nav { display: inline-flex; align-items: center; gap: 6px; }
.account-login-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}
.account-login-links a {
  color: #aeb4c0;
  text-decoration: none;
}
.account-login-links a:hover { color: #e2f6e9; }
.account-stage {
  display: grid;
  place-items: start center;
  flex: 1 0 auto;
  padding: clamp(40px, 15vh, 152px) 16px 48px;
  background-image: linear-gradient(#ffffff06 1px, transparent 1px),
    linear-gradient(90deg, #ffffff06 1px, transparent 1px);
  background-size: 32px 32px;
}
.account-panel {
  position: relative;
  width: min(100%, 430px);
  padding: clamp(18px, 4vw, 28px);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  font-size: 14px;
  line-height: 1.45;
  transition: width 380ms cubic-bezier(.2, .8, .2, 1);
}
.account-panel[data-view="profile"] { width: min(100%, 720px); }
.account-panel [hidden] { display: none !important; }
.account-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.account-heading-text { min-width: 0; }
.account-login-name {
  margin: 5px 0 0;
  color: #aeb4c0;
  font: 12px/1.5 var(--font-mono);
  overflow-wrap: anywhere;
}
.account-heading h1 {
  margin: 0;
  color: #f3f4f6;
  font-size: 24px;
  font-weight: 650;
  line-height: 1.2;
}
.account-heading h1:focus { outline: none; }
.account-feedback { margin: 14px 0 0; color: #aeb4c0; overflow-wrap: anywhere; }
.account-feedback:empty { margin: 0; }
.account-feedback[data-error="true"] { color: #f09393; }
.account-login { display: grid; gap: 9px; margin-top: 20px; }
.account-field-label { display: flex; justify-content: space-between; gap: 8px; }
.account-field-label span {
  color: #aeb4c0;
  font: 12px/1.7 var(--font-mono);
}
.account-login input {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0 12px;
  border: 1px solid #484d57;
  border-radius: 6px;
  background: var(--bg);
  font: 17px/1 var(--font-mono);
  letter-spacing: .12em;
}
.account-login input[aria-invalid="true"] { border-color: var(--red); }
.account-hint { margin: 0 0 8px; color: #aeb4c0; font-size: 12px; }
.account-primary, .account-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  height: auto;
  min-height: 42px;
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #1e1e1e;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.topbar :is(
  .pill.active,
  .tool-btn.active,
  .ex-filter-btn[aria-expanded="true"],
  .scale-menu-btn:has(+ .scale-menu:popover-open)
) {
  background: #282a2e;
  border-color: #484d56;
}
.topbar :is(.pill.active, .tool-btn.active):hover { background: #2d3034; }
.account-primary { border-color: #3a8662; background: #254a37; color: #e2f6e9; }
.account-primary:not(:disabled):hover { background: #315b45; }
.account-panel button:disabled { opacity: .58; cursor: wait; }
.account-retry, .account-more { margin-top: 12px; }
.account-profile { margin-top: 20px; animation: account-reveal 380ms ease-out both; }
.account-access {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}
.account-access h2, .account-history-title { margin: 0; color: #f3f4f6; font-size: 15px; }
.account-access-state { display: flex; align-items: center; gap: 7px; margin: 3px 0 0; color: #aeb4c0; }
.account-access-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.account-access-state[data-active="true"]::before { background: var(--green); }
.account-history-title { margin-top: 24px; }
.account-empty { margin: 12px 0 0; color: #aeb4c0; }
.account-grants { margin: 10px 0 0; padding: 0; list-style: none; }
.account-grants li {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 7px 12px;
  align-items: baseline;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  overflow-wrap: anywhere;
}
.account-grants li span { color: #aeb4c0; font-size: 12px; }
.account-grants li span:last-child { text-align: right; }
.account-grants li[data-revoked="true"] span:last-child { color: #e9a0a0; }
@keyframes account-reveal {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 540px) {
  .account-stage { padding-top: 48px; }
  .account-grants li { grid-template-columns: minmax(0, 1fr) auto; }
  .account-grants li span:first-of-type { grid-column: 1 / -1; grid-row: 2; }
}
@media (prefers-reduced-motion: reduce) {
  .account-panel { transition: none; }
  .account-profile { animation: none; }
}

/* === Trading Terminal Presets, TAB Mode, Account API Keys, & Desktop-Only Gate === */
.view-mode-btn {
  font-family: var(--font-mono);
  color: var(--text);
}
.view-mode-btn.working {
  background: #282a2e;
  border-color: #484d56;
  color: #e5e7eb;
}
.view-mode-btn.working:hover {
  background: #2d3034;
}

.preset-bar-wrap {
  position: relative;
}
.preset-bar {
  display: inline-flex;
  align-items: stretch;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #1a1a1a;
  overflow: hidden;
}
.preset-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 7px;
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font: 11px/22px var(--font-mono);
  cursor: pointer;
}
.preset-btn:last-child {
  border-right: 0;
}
.preset-btn:hover,
.preset-btn:focus,
.preset-btn:focus-visible {
  color: var(--text);
  background: #242424;
  border-color: var(--border);
}
.preset-btn.active {
  background: #282a2e;
  color: #e5e7eb;
  font-weight: 700;
  border-color: var(--border);
}
.preset-btn.active:hover {
  background: #2d3034;
  border-color: var(--border);
}
.preset-key {
  opacity: 0.65;
  font-size: 10px;
}

.preset-popup {
  position: fixed;
  top: 38px;
  left: 8px;
  z-index: 75;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: #181818;
  border: 1px solid #383b44;
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.75);
}
.preset-popup-label {
  font-size: 11px;
  color: #aeb4c0;
  white-space: nowrap;
}
#preset-popup-input {
  width: 84px;
  height: 24px;
  padding: 0 6px;
  border: 1px solid #383b44;
  border-radius: 3px;
  background: var(--bg);
  color: #f3f4f6;
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: text;
}
.preset-popup-save {
  height: 24px;
  padding: 0 10px;
  border: 1px solid #484d56;
  border-radius: 3px;
  background: #282a2e;
  color: #e5e7eb;
  font-size: 11px;
  font-weight: 600;
}
.preset-popup-save:hover {
  background: #2d3034;
  border-color: #525866;
}

.cell.pinned-working {
  border-color: #484d56;
}
.cell.pinned-working .cell-head {
  background: #24272d;
  border-bottom-color: #383c45;
}

.account-trading {
  display: grid;
  grid-template-rows: 1fr;
  opacity: 1;
  margin: 0;
  overflow: hidden;
  transition:
    grid-template-rows 240ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 180ms ease-out;
}
.account-trading[data-collapsed="true"] {
  grid-template-rows: 0fr;
  opacity: 0;
  pointer-events: none;
}
.account-trading-inner {
  min-height: 0;
  overflow: hidden;
  padding-top: 12px;
  padding-bottom: 6px;
  transition:
    padding-top 240ms cubic-bezier(0.22, 1, 0.36, 1),
    padding-bottom 240ms cubic-bezier(0.22, 1, 0.36, 1);
}
.account-trading[data-collapsed="true"] .account-trading-inner {
  padding-top: 0;
  padding-bottom: 0;
}
@media (prefers-reduced-motion: reduce) {
  .account-trading,
  .account-trading-inner {
    transition: none;
  }
}
.trading-exchanges-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.trading-exchange-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #1a1a1a;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.trading-exchange-chip:hover {
  border-color: #3a3a3a;
  background: #222222;
}
.trading-exchange-chip .chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #525866;
  flex-shrink: 0;
}
.trading-exchange-chip.connected .chip-dot {
  background: var(--green);
}
.trading-exchange-chip small {
  padding: 1px 5px;
  border-radius: 3px;
  background: #24262b;
  border: 1px solid #383b44;
  color: #aeb4c0;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
}
.trading-exchange-chip.selected {
  border-color: #484d56;
  background: #282a2e;
  color: #f3f4f6;
}
.trading-key-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}
.trading-form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.trading-form-head strong {
  color: #f3f4f6;
  font-size: 15px;
}
.trading-market-tabs {
  display: inline-flex;
  gap: 6px;
}
.trading-market-tab {
  height: 28px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #1a1a1a;
  color: #aeb4c0;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.trading-market-tab.active {
  border-color: #484d56;
  background: #282a2e;
  color: #f3f4f6;
}
.trading-market-tab:disabled {
  opacity: 0.4;
  cursor: default;
}
.trading-key-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 12px;
  color: #aeb4c0;
}
.trading-key-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  flex-shrink: 0;
}
.trading-key-status[data-state="connected"] {
  color: #7ec49b;
}
.trading-key-status[data-state="connected"]::before {
  background: var(--green);
}
.trading-key-status[data-state="error"] {
  color: #f09393;
}
.trading-key-status[data-state="error"]::before {
  background: var(--red);
}
.trading-field {
  display: grid;
  gap: 5px;
}
.trading-field label {
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 500;
}
.trading-key-form input,
.trading-key-form select {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid #383b44;
  border-radius: 6px;
  background: var(--panel);
  color: #f3f4f6;
  font-family: var(--font-mono);
  font-size: 13px;
}
.trading-key-form input {
  cursor: text;
}
.trading-key-form input:not(:focus) {
  color: var(--muted);
}
.trading-key-form input:focus {
  color: #f3f4f6;
  border-color: #525866;
}
.trading-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.trading-input-wrap input {
  padding-right: 38px;
}
.trading-eye-btn {
  position: absolute;
  right: 6px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.trading-eye-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}
.trading-key-form select {
  font-family: var(--font-sans);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23aeb4c0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 12px;
}
.trading-form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.desktop-only-gate {
  display: none;
}
@media (max-width: 960px), (hover: none) and (pointer: coarse) and (max-width: 1180px) {
  .desktop-only-gate {
    display: grid;
    place-items: center;
    position: fixed;
    inset: 0;
    z-index: 9999;
    padding: 20px;
    background-color: var(--bg);
    background-image: linear-gradient(#ffffff06 1px, transparent 1px),
      linear-gradient(90deg, #ffffff06 1px, transparent 1px);
    background-size: 32px 32px;
  }
  .desktop-only-card {
    width: min(100%, 400px);
    padding: 26px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.75);
  }
  .desktop-only-badge {
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #4d3f24;
    background: #2d261a;
    color: #e2b866;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
  }
  .desktop-only-card h1 {
    margin: 0;
    color: #f3f4f6;
    font-size: 19px;
    font-weight: 650;
    line-height: 1.25;
  }
  .desktop-only-card p {
    margin: 0;
    color: #aeb4c0;
    font-size: 13px;
    line-height: 1.5;
  }
}

/* === Configurable Trading Hotkeys Popover === */
.hotkeys-menu {
  --scale-menu-width: 484px;
  padding: 8px 12px 10px;
}
.hk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid #2a2d34;
  font-size: 12px;
  font-weight: 600;
  color: #f3f4f6;
}
.hk-reset-btn {
  height: 22px;
  padding: 0 8px;
  font-size: 11px;
  border-color: #383d46;
  background: #24272e;
  color: #cbd5e1;
}
.hk-list {
  display: grid;
  gap: 6px;
}
.hk-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 152px 22px;
  align-items: center;
  gap: 8px;
}
.hk-label-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}
.hk-label {
  font-size: 11px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hk-val-wrap {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
}
.hk-auto-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid #353840;
  border-radius: 2px;
  background: #1d1f24;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
}
.hk-auto-box[data-disabled="true"] {
  opacity: 0.45;
}
.hk-auto-box .hk-val-input {
  width: 64px;
  height: 18px;
  border: 0;
  background: transparent;
  color: #f3f4f6;
}
.hk-box {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  padding: 0 22px 0 8px;
  border: 1px solid #353840;
  border-radius: 2px;
  background: #2b2d33;
  color: #f3f4f6;
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
}
.hk-box:hover:not([data-disabled="true"]) {
  border-color: #525866;
  background: #33363e;
}
.hk-box[data-empty="true"] {
  color: #8b909c;
}
.hk-box[data-disabled="true"] {
  opacity: 0.45;
  cursor: default;
}
.hk-box[data-recording="true"] {
  border-color: #525866;
  background: #282a2e;
  color: #f3f4f6;
}
.hk-clear {
  position: absolute;
  right: 2px;
  top: 2px;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: #8b909c;
  font-size: 13px;
  line-height: 18px;
  display: grid;
  place-items: center;
}
.hk-clear:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f3f4f6;
}
.hk-check {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin: 0;
  padding: 0;
  border: 1px solid #6b7280;
  border-radius: 2px;
  background: #141518;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.hk-check:checked {
  border-color: #6b7280;
  background: #23252a;
}
.hk-check:checked::after {
  content: "";
  width: 10px;
  height: 5px;
  border-left: 2px solid #f3f4f6;
  border-bottom: 2px solid #f3f4f6;
  transform: rotate(-45deg) translate(1px, -1px);
}

/* === Account Terminal Mode Switch === */
.account-trading-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}
.account-trading-toggle .account-history-title {
  margin-top: 0;
}
.account-trading-desc {
  margin: 4px 0 0;
  color: #aeb4c0;
  font-size: 12px;
}
.account-switch {
  position: relative;
  flex: 0 0 auto;
  width: 46px;
  height: 26px;
  padding: 0;
  border: 1px solid #3c404a;
  border-radius: 999px;
  background: #23252b;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}
.account-switch[aria-checked="true"] {
  background: #254a37;
  border-color: #3a8662;
}
.account-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: transform 150ms ease, background-color 150ms ease;
}
.account-switch[aria-checked="true"] .account-switch-thumb {
  transform: translateX(20px);
  background: #e2f6e9;
}

body[data-trading-mode="off"] :is(#view-mode-group, #preset-bar-group, #hotkeys-menu-group, #preset-popup, #hotkeys-menu, .cell-unpin-btn, .cell-lev-btn, .cell-bal-badge, #focus-leverage-btn, #focus-balance-badge, #leverage-menu, #trading-counters-badge) {
  display: none !important;
}

.empty-state.working-empty .conn-line {
  display: none;
}

.trading-mode-row.is-locked {
  opacity: 0.55;
}
#trading-mode-switch:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: saturate(0.2);
}

.cell-bal-badge {
  display: inline-flex;
  align-items: center;
  height: 17px;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #1d1f24;
  color: #aeb4c0;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 15px;
  white-space: nowrap;
  cursor: default;
}

.tb-trading-badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #1a1a1a;
  color: #aeb4c0;
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
  cursor: default;
}
.tb-dust-wrap {
  display: inline-flex;
  align-items: center;
}
.tb-dust-btn {
  height: 24px;
  padding: 0 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #cbd5e1;
  background: #1a1a1a;
  border: 1px solid var(--border);
  border-radius: 3px;
  white-space: nowrap;
}
.spot-dust-menu {
  --scale-menu-width: 344px;
  padding: 8px 10px 8px;
}
.dust-total {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: #9ca3af;
  font-variant-numeric: tabular-nums;
}
.dust-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 2px 0 6px;
  margin-bottom: 4px;
  border-bottom: 1px solid #2a2d34;
}
.dust-tab {
  height: 20px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: #9ca3af;
  font-family: var(--font-mono);
  font-size: 10.5px;
  cursor: pointer;
}
.dust-tab:hover {
  color: #e5e7eb;
  background: #23262d;
}
.dust-tab.active {
  color: #f3f4f6;
  background: #2a2e37;
  border-color: #464c59;
}
.dust-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 280px;
  overflow-y: auto;
}
.dust-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 5px 6px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: left;
  cursor: pointer;
}
.dust-row:hover {
  background: #24272f;
}
.dust-row-left {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.dust-ex-tag {
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px solid #30343e;
  background: #14161a;
  color: #9ca3af;
  font-size: 9.5px;
  letter-spacing: 0.02em;
}
.dust-base {
  font-weight: 600;
  color: #f3f4f6;
}
.dust-qty {
  color: #9ca3af;
  font-variant-numeric: tabular-nums;
}
.dust-row-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.dust-min {
  color: #6b7280;
  font-size: 10px;
}
.dust-usd {
  font-weight: 600;
  color: #e5e7eb;
}
.dust-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #2a2d34;
  font-size: 10.5px;
  color: #7c8290;
  font-family: var(--font-mono);
}

.cell-lev-btn {
  font-family: var(--font-mono);
}

.leverage-menu {
  position: fixed;
  z-index: 80;
  width: 196px;
  padding: 8px;
  background: #191b20;
  border: 1px solid #343841;
  border-radius: 6px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.72);
}
.lev-title {
  font-size: 11px;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 6px;
}
.lev-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}
.lev-input {
  width: 100%;
  height: 24px;
  padding: 0 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: center;
  background: #141519;
  border: 1px solid #383d46;
  border-radius: 3px;
  color: #f3f4f6;
  cursor: text;
}
.lev-opt {
  height: 24px;
  padding: 0 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  background: #23262d;
  border: 1px solid #383d46;
  border-radius: 3px;
  color: #d1d4dc;
}
.lev-opt:hover {
  background: #2d313b;
  border-color: #525866;
}
.lev-opt.active {
  background: #282a2e;
  border-color: #6b7280;
  color: #ffffff;
  font-weight: 700;
}

.cell-error-banner[data-kind="info"] {
  background: rgba(24, 27, 34, 0.94);
  border-color: #3f4654;
  color: #d1d5db;
}

.cell-error-banner[data-kind="hint"] {
  background: rgba(34, 28, 16, 0.95);
  border-color: #926c22;
  color: #fcd34d;
  font-weight: 500;
}

.view-mode-drawer {
  display: inline-flex;
  align-items: center;
  gap: 0;
}
#view-mode-btn {
  position: relative;
  z-index: 2;
}
.view-mode-drawer:is(:hover, :focus-within):has(.clear-working-btn[data-available="true"]) #view-mode-btn {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
#trading-counters-badge {
  margin-left: 6px;
}

.clear-working-btn {
  position: relative;
  z-index: 1;
  max-width: 0;
  opacity: 0;
  padding-inline: 0;
  border-width: 0;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  margin-left: 0;
  overflow: hidden;
  white-space: nowrap;
  pointer-events: none;
  transform: translateX(-100%);
  transition:
    max-width 180ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 140ms ease,
    padding-inline 180ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}
.view-mode-drawer:is(:hover, :focus-within) .clear-working-btn[data-available="true"] {
  max-width: 112px;
  opacity: 1;
  padding-inline: 8px;
  border-width: 1px 1px 1px 0;
  pointer-events: auto;
  transform: translateX(0);
}

.cell-error-banner {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 22px;
  z-index: 15;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 8px;
  background: rgba(44, 18, 22, 0.96);
  border-top: 1px solid #6b2d33;
  color: #f2a6ac;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tb-recorder {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  margin-right: 6px;
}
.rec-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 26px;
  justify-content: center;
}
.rec-folder-btn,
.rec-blur-btn,
.rec-shot-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  padding: 0 6px;
}
.rec-shot-btn[data-busy="true"] {
  opacity: 0.6;
  pointer-events: none;
}
.rec-folder-btn[data-bound="true"],
.rec-blur-btn[data-active="true"] {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.45);
}
.rec-folder-btn[data-hint="true"] {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.75);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.25);
}
body[data-rec-blur="true"] :is(
  .cell-symbol,
  #focus-symbol,
  .coin-tile-ex,
  .coin-tile-sym,
  #exchange-filter-btn,
  #exchange-filter-menu,
  #search-results,
  #symbol-search:not(:placeholder-shown),
  #ui-tooltip
) {
  filter: blur(4.5px);
  user-select: none;
}
body[data-shot-blur="true"] :is(
  #tf-select,
  #cluster-tf,
  #focus-tf-select,
  #focus-cluster-tf,
  #tf-select + .custom-select-btn,
  #cluster-tf + .custom-select-btn,
  #focus-tf-select + .custom-select-btn,
  #focus-cluster-tf + .custom-select-btn,
  .custom-select-menu[data-for-select="tf-select"],
  .custom-select-menu[data-for-select="cluster-tf"],
  .custom-select-menu[data-for-select="focus-tf-select"],
  .custom-select-menu[data-for-select="focus-cluster-tf"],
  .cell-meta,
  #focus-meta,
  .cell-bal-badge,
  #focus-balance-badge,
  .preset-val,
  #spot-dust-total,
  .dust-base,
  .dust-qty,
  .dust-usd
) {
  filter: blur(4.5px);
  user-select: none;
}
.tb-recorder[data-recording="false"] .rec-indicator,
.tb-recorder[data-recording="true"] .rec-cam-icon {
  display: none;
}
.rec-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: #ef4444;
}
.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  flex: 0 0 auto;
}
.tb-recorder[data-paused="false"] .rec-dot {
  animation: rec-pulse 1.2s ease-in-out infinite;
}
.rec-stop-label {
  display: none;
}
.rec-toggle-btn:hover .rec-dot {
  border-radius: 1px;
}
.rec-toggle-btn:hover .rec-label {
  display: none;
}
.rec-toggle-btn:hover .rec-stop-label {
  display: inline;
}
.rec-pause-btn {
  min-width: 24px;
  padding: 0 6px;
}
.rec-saved-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #e5e7eb;
  white-space: nowrap;
}
.rec-saved-badge svg {
  color: #22c55e;
}
@keyframes rec-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.account-errors-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}
.account-errors-header .account-history-title {
  margin-top: 0;
}
.account-errors-clear {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.account-errors {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
}
.account-error-row {
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.account-error-row[data-severity="fatal"] {
  border-color: rgba(239, 68, 68, 0.45);
}
.account-error-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  margin-bottom: 4px;
}
.account-error-source {
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(239, 68, 68, 0.16);
  color: #fca5a5;
  font-family: var(--font-mono);
}
.account-error-code {
  font-family: var(--font-mono);
  color: #e5e7eb;
  font-weight: 600;
}
.account-error-time {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--font-mono);
}
.account-error-msg {
  font-size: 12px;
  color: #d1d5db;
  word-break: break-word;
}

.focus-scale-wrap {
  position: relative;
  flex: 0 0 auto;
}
