 :root {
  color-scheme: dark;
  --bg-primary: #0a0e14;
  --bg-panel: #111722;
  --bg-card: #161d29;
  --glass-1: rgba(17, 23, 34, 0.72);
  --glass-2: rgba(12, 16, 24, 0.72);
  --bg-hover: #1d2633;
  --border-soft: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text-primary: #e6edf3;
  --text-secondary: #9fb0c0;
  --text-muted: #6b7c8f;
  --text-dim: #4d5c6b;
  --long: #22c55e;
  --short: #ef4444;
  --long-bg: rgba(34, 197, 94, 0.12);
  --short-bg: rgba(239, 68, 68, 0.12);
  --long-glow: 0 0 10px rgba(34, 197, 94, 0.4);
  --short-glow: 0 0 10px rgba(239, 68, 68, 0.4);
  --accent: #ffb800;
  --accent-2: #ffd166;
  --accent-glow: 0 0 10px rgba(255, 184, 0, 0.5);
  --bg: var(--bg-primary);
  --panel: var(--bg-panel);
  --card: var(--bg-card);
  --surface-2: var(--bg-card);
  --border: var(--border-soft);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --danger: var(--short);
  --success: var(--long);
  --positive: var(--long);
  --negative: var(--short);
  --market-panel-h: 540px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --sh-sm: 0 12px 28px rgba(0, 0, 0, 0.35);
  --sh-md: 0 20px 50px rgba(0, 0, 0, 0.5);
  --focus: rgba(255, 177, 26, 0.3);
  --grid: rgba(255, 255, 255, 0.06);
  --font-sans: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text-primary);
  font-family: var(--font-sans);
  background:
    radial-gradient(600px 360px at 10% 10%, rgba(255, 184, 0, 0.06), transparent 60%),
    radial-gradient(760px 420px at 90% 0%, rgba(255, 208, 77, 0.04), transparent 65%),
    var(--bg-primary);
  letter-spacing: 0.01em;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 0.28;
  pointer-events: none;
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  gap: 7px;
}

h1 {
  margin: 6px 0 8px;
  font-size: 32px;
  font-weight: 600;
}

h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
}

.kicker {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-secondary);
}

.subtle {
  color: var(--text-secondary);
  font-size: 13px;
}

.label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-secondary);
}

.meta {
  font-size: 11px;
  color: var(--text-muted);
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--muted);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(0, 2.6fr);
  gap: 6px;
  align-items: start;
}

.brand {
  display: flex;
  gap: 16px;
  align-items: center;
}

.hero-header {
  align-items: flex-start;
  gap: 12px;
  padding: 4px 0;
  max-width: 360px;
}

.hero-header .brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
}

.hero-header h1 {
  margin: 2px 0 4px;
  font-size: 28px;
}

.hero-header .kicker {
  margin-bottom: 2px;
}

.download-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.download-pill {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-header .subtle {
  line-height: 1.3;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: grid;
  place-items: center;
  background: rgba(255, 177, 26, 0.08);
  box-shadow: 0 0 18px rgba(255, 177, 26, 0.18);
}

.pulse {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(255, 177, 26, 0.8);
  position: relative;
}

.pulse::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px solid rgba(255, 177, 26, 0.4);
  animation: pulse 2.8s ease-out infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.6);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

.topbar-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.4fr) minmax(0, 0.8fr);
  gap: 6px;
  align-items: stretch;
}

.topbar-card {
  background: linear-gradient(160deg, var(--glass-1), var(--glass-2));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  box-shadow: var(--sh-sm);
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  display: grid;
  gap: 10px;
  min-width: 0;
  height: 100%;
}

.card--connections,
.card--overview,
.card--status {
  padding: 12px 14px;
}

.connections-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
}

.connections-grid .span-2 {
  grid-column: 1 / -1;
}

.card--connections .topbar-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.card--connections .field-label {
  font-size: 11px;
  color: var(--muted);
}

.card--status .topbar-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.card--status .field-label {
  font-size: 11px;
  color: var(--muted);
}

.status-grid {
  display: grid;
  gap: 10px;
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.card--overview .account-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 20px;
}

.card--overview .label {
  font-size: 11px;
  color: var(--muted);
}

.card--overview .stat-value {
  font-size: 16px;
}

.topbar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.instrument-card .topbar-head {
  flex-wrap: nowrap;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
}

.instrument-card .topbar-head .label {
  flex: 0 0 auto;
  white-space: nowrap;
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.instrument-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  min-width: 0;
  overflow: hidden;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.stat-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.pill {
  border: 1px solid var(--border-soft);
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pill.small {
  padding: 4px 10px;
  font-size: 11px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px rgba(25, 195, 125, 0.8);
}

.mode-control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 0;
}

.mode-select {
  display: inline-flex;
  min-width: 120px;
}

.mode-tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 160ms ease;
  white-space: nowrap;
}

.instrument-row .field {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.instrument-row .pill {
  flex: 0 0 auto;
  white-space: nowrap;
}

.mode-tab.active {
  background: rgba(255, 177, 26, 0.18);
  color: var(--text);
  border-color: rgba(255, 177, 26, 0.4);
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.618fr) minmax(0, 1fr);
  gap: 7px;
}

.left-col,
.right-col {
  display: grid;
  gap: 7px;
}

.right-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  align-items: stretch;
}

.right-grid > .card {
  height: 100%;
  align-self: stretch;
}

.card {
  background: linear-gradient(160deg, var(--glass-1), var(--glass-2));
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.02), 0 8px 24px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ob-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ob-controls .field-label {
  font-size: 10px;
  letter-spacing: 0.1em;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.field {
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  background: rgba(10, 14, 20, 0.9);
  color: var(--text-primary);
  font-family: var(--font-sans);
  padding: 8px 10px;
}

.field.sm {
  font-size: 12px;
  padding: 6px 8px;
}

.field.md {
  font-size: 13px;
}

.field-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.field:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.btn {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  transition: all 160ms ease;
}

.btn:hover {
  border-color: rgba(255, 255, 255, 0.24);
}

.btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.btn.primary {
  background: rgba(255, 177, 26, 0.16);
  border-color: rgba(255, 177, 26, 0.6);
  color: var(--text);
}

.btn.danger {
  background: rgba(239, 90, 90, 0.12);
  border-color: rgba(239, 90, 90, 0.6);
}

.btn.action-long {
  background: linear-gradient(180deg, #1ed760, #0fa958);
  border-color: rgba(34, 197, 94, 0.7);
  color: #f3fff7;
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.35);
  font-weight: 600;
}

.btn.action-short {
  background: linear-gradient(180deg, #ff4d4f, #c53030);
  border-color: rgba(239, 68, 68, 0.7);
  color: #fff5f5;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
  font-weight: 600;
}

.btn.ghost {
  background: transparent;
}

.btn.sm {
  padding: 6px 10px;
  font-size: 11px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.switch input {
  display: none;
}

.switch .slider {
  width: 36px;
  height: 20px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  position: relative;
  border: 1px solid var(--border);
  transition: all 160ms ease;
}

.switch .slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 160ms ease, background 160ms ease;
}

.switch input:checked + .slider {
  background: rgba(255, 177, 26, 0.2);
  border-color: rgba(255, 177, 26, 0.6);
}

.switch input:checked + .slider::after {
  transform: translateX(16px);
  background: var(--accent);
}

.chart-head {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: var(--bg-panel);
  margin-bottom: 10px;
  overflow: visible;
  position: relative;
  z-index: 150;
}

.embed-symbol,
.embed-feed {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.embed-feed {
  font-size: 11px;
  color: var(--muted);
}

.embed-feed .live-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

.embed-feed.offline .live-dot {
  background: var(--danger);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.embed-feed.offline .live-text {
  color: var(--danger);
}

.chart-head-row {
  display: grid;
  gap: 12px;
}

.chart-symbol {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.chart-symbol .field.md {
  min-width: 130px;
  max-width: 185px;
}

.instrument-select {
  position: relative;
  min-width: 170px;
  max-width: 220px;
  z-index: 200;
  overflow: visible;
}

.instrument-btn {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 10px;
  align-items: center;
  padding: 6px 10px;
  border-radius: var(--r-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 12, 18, 0.7);
  color: var(--text);
  cursor: pointer;
}

.instrument-btn:hover {
  border-color: rgba(255, 177, 26, 0.35);
  box-shadow: 0 0 0 2px rgba(255, 177, 26, 0.1);
}

.instrument-main {
  font-weight: 650;
  font-size: 15px;
  line-height: 1.15;
  grid-column: 1 / 2;
  min-width: 0;
}

.instrument-sub {
  font-size: 11px;
  color: var(--muted);
  grid-column: 1 / 2;
  line-height: 1.2;
  min-width: 0;
}

.instrument-caret {
  grid-column: 2 / 3;
  grid-row: 1 / 3;
  color: var(--muted);
}

.instrument-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 240px;
  width: max(100%, 240px);
  background: rgba(12, 16, 22, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-md);
  box-shadow: var(--sh-md);
  padding: 10px;
  z-index: 9999;
}

.instrument-popover.hidden {
  display: none;
}

.instrument-search-wrap {
  margin-bottom: 8px;
}

.instrument-search {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 12, 18, 0.8);
  color: var(--text);
  font-size: 12px;
}

.instrument-header {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 0.9fr) 36px;
  align-items: center;
  gap: 6px;
  padding: 6px 4px;
  margin-bottom: 6px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(12, 16, 22, 0.98);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.instrument-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 2px 4px;
}

.instrument-sort.active {
  color: var(--text);
}

.instrument-sort .sort-ind {
  font-size: 10px;
  opacity: 0.8;
}

.instrument-sort-spacer {
  width: 36px;
}

.instrument-favs.hidden {
  display: none;
}

.instrument-favs .instrument-section {
  margin-bottom: 6px;
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.instrument-list {
  max-height: 260px;
  overflow-y: auto;
  display: grid;
  gap: 4px;
}

.instrument-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 36px;
  gap: 6px;
  align-items: center;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  cursor: pointer;
}

.instrument-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.instrument-row.active {
  background: rgba(255, 177, 26, 0.15);
  box-shadow: inset 0 0 0 1px rgba(255, 177, 26, 0.35);
}

.instrument-row.disabled {
  color: var(--muted);
  cursor: not-allowed;
}

.instrument-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.instrument-symbol {
  font-size: 15px;
  font-weight: 650;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.instrument-label {
  font-size: 11px;
  line-height: 1.2;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.instrument-quote {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-end;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}

.instrument-price {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.15;
  white-space: nowrap;
}

.instrument-change {
  font-size: 11px;
  line-height: 1.2;
  color: var(--muted);
  white-space: nowrap;
}

.instrument-change.positive {
  color: var(--long);
}

.instrument-change.negative {
  color: var(--short);
}

.instrument-star-wrap {
  width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.instrument-star {
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}

.instrument-star.active {
  color: var(--accent);
}

.strategy-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 0 4px;
  max-height: 180px;
}

.embed-mode .topbar,
.embed-mode .right-col,
.embed-mode .bottom-pane,
.embed-mode .chart-topbar,
.embed-mode .chart-note,
.embed-mode .chart-tabs,
.embed-mode .chart-controls,
.embed-mode .strategy-strip,
.embed-mode .options-chart-card,
.embed-mode .dom-actions,
.embed-mode .chart-only {
  display: none !important;
}

.embed-mode .instrument-select,
.embed-mode #productSegment,
.embed-mode #productSelect {
  display: none !important;
}

.embed-mode .embed-symbol,
.embed-mode .embed-feed {
  display: inline-flex;
}

.embed-mode .chart-head {
  grid-template-columns: 1fr;
}

.embed-mode .chart-head__stats {
  grid-template-columns: repeat(5, minmax(70px, 1fr));
  gap: 10px;
}

.embed-mode .main-grid {
  grid-template-columns: 1fr;
  gap: 0;
}

.embed-mode .market-viewport {
  min-height: 360px;
  max-height: 420px;
  height: 380px;
}

.embed-mode .dom-view {
  height: 380px;
  min-height: 360px;
}

.embed-mode .dom-body {
  overflow: hidden;
}


.strategy-card {
  flex: 1 1 0;
  min-width: 220px;
  max-width: 300px;
  background: rgba(14, 19, 28, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-md);
  padding: 12px;
  display: grid;
  gap: 8px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.strategy-modal-body .btn.primary {
  width: 100%;
  justify-content: center;
}

.strategy-title {
  font-size: 15px;
  font-weight: 650;
}

.strategy-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}

.strategy-modal-body {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.strategy-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metric-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-value {
  font-size: 13px;
  font-weight: 600;
}

.masked-metric {
  filter: blur(6px);
  opacity: 0.75;
  user-select: none;
}

.strategy-gauges {
  display: grid;
  gap: 6px;
}

.gauge {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}

.gauge-label {
  grid-column: 1 / 2;
}

.gauge-track {
  grid-column: 1 / 2;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  position: relative;
}

.gauge-fill {
  height: 100%;
  width: 100%;
  transform: scaleX(var(--gauge, 0.6));
  transform-origin: left center;
  background: linear-gradient(90deg, rgba(255, 177, 26, 0.85), rgba(255, 177, 26, 0.35));
  box-shadow: 0 0 10px rgba(255, 177, 26, 0.25);
}

.gauge-value {
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-size: 12px;
}

.product-select {
  display: none;
}

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 12, 18, 0.65);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.seg-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 6px 10px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.seg-btn:hover {
  color: var(--text);
}

.seg-btn.active {
  color: var(--accent);
  background: rgba(255, 177, 26, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 177, 26, 0.4);
}

.seg-btn[data-disabled="1"] {
  opacity: 0.4;
  cursor: not-allowed;
}

.chart-price {
  display: grid;
  grid-template-columns: repeat(2, minmax(110px, 1fr));
  gap: 10px;
  align-items: center;
}

.price-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  align-content: center;
  min-width: 0;
}

.price-value {
  font-size: 20px;
  font-weight: 600;
}

.price-change {
  font-size: 13px;
  color: var(--muted);
}

.chart-head .price-value,
.chart-head .price-change,
.chart-head .stat-value {
  display: inline-block;
  text-align: left;
  min-width: 0;
}

.price-change.positive {
  color: var(--long);
  text-shadow: var(--long-glow);
}

.price-change.negative {
  color: var(--short);
  text-shadow: var(--short-glow);
}

.chart-head__stats {
  display: grid;
  grid-template-columns: 118px 90px 90px 90px 78px 82px 90px 90px 100px 112px;
  gap: 12px;
  align-items: stretch;
  min-width: 0;
}

.chart-stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  min-width: 0;
  text-align: left;
}

.chart-stat__label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1;
  margin: 0;
  opacity: 0.7;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 12px;
}

.chart-stat__value {
  font-size: 15px;
  line-height: 1.1;
  margin: 0;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  min-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.chart-note {
  font-size: 12px;
  margin-bottom: 8px;
}

.chart-tabs {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 8px 0 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.chart-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  padding: 8px 2px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  position: relative;
}

.chart-tab.active {
  color: var(--text);
}

.chart-tab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
}

.chart-tab.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chart-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  margin-bottom: 4px;
}

.chart-topbar .chart-tabs {
  margin: 0;
}

.chart-topbar .chart-controls {
  margin-left: auto;
}

.chart-topbar .chart-controls .field-label {
  font-size: 10px;
  letter-spacing: 0.1em;
}

.chart-topbar .options-chart-source,
.chart-topbar .options-chart-asof {
  font-size: 12px;
  color: var(--muted);
}

.overlay-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  font-size: 11px;
  cursor: pointer;
  transition: all 140ms ease;
}

.overlay-pill input {
  display: none;
}

.overlay-pill input:checked + span {
  color: var(--accent);
}

.overlay-pill.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hidden {
  display: none !important;
}

.market-viewport {
  display: grid;
  gap: 12px;
  height: 100%;
  min-height: var(--market-panel-h);
  max-height: var(--market-panel-h);
}

.chart-view,
.dom-view {
  min-height: var(--market-panel-h);
  height: 100%;
}

.dom-view {
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: var(--bg-panel);
  padding: 12px;
  display: grid;
  gap: 12px;
  height: 100%;
  overflow: hidden;
}

.dom-grid {
  display: grid;
  gap: 12px;
  height: 100%;
}


.dom-section {
  display: grid;
  gap: 6px;
  height: 100%;
  grid-template-rows: auto 1fr auto;
  min-height: 0;
}

.dom-quick {
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: var(--bg-card);
  padding: 12px;
  display: grid;
  gap: 10px;
  min-height: 0;
  height: auto;
  align-content: start;
}

.dom-quick__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.dom-quick__body {
  display: grid;
  gap: 8px;
}

.dom-quick__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dom-quick__label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dom-quick__toggle .field {
  max-width: 90px;
}

.dom-quick__hint {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.4;
}

.dom-quick__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.dom-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  align-self: end;
}

.dom-actions .btn {
  flex: 1 1 0;
}

.dom-title {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.dom-table {
  display: grid;
  gap: 4px;
  height: 100%;
  grid-template-rows: auto 1fr;
  min-height: 0;
}

.dom-body {
  display: grid;
  gap: 4px;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  min-height: 0;
  align-content: start;
  max-height: 100%;
}

.dom-row {
  display: grid;
  align-items: center;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 11px;
  min-height: 22px;
}

.dom-row.header {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
}

.dom-row.dom-ladder {
  grid-template-columns: 1.1fr 0.95fr 0.75fr 1.1fr 0.75fr 0.95fr 1.1fr;
}

.dom-row.dom-exec {
  grid-template-columns: 72px 1fr 1fr 70px;
}

.dom-row.bid {
  background: linear-gradient(90deg, var(--long-bg), transparent 65%);
}

.dom-row.ask {
  background: linear-gradient(270deg, var(--short-bg), transparent 65%);
}

.dom-row.buy {
  border-left: 2px solid rgba(34, 197, 94, 0.8);
  background: rgba(34, 197, 94, 0.08);
}

.dom-row.sell {
  border-left: 2px solid rgba(239, 68, 68, 0.8);
  background: rgba(239, 68, 68, 0.08);
}

.exec-qty {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}

.dom-row.empty {
  color: var(--muted);
}

.dom-row.empty span:nth-child(4) {
  text-align: center;
}

.dom-row > span {
  white-space: nowrap;
}

.dom-row.dom-ladder > span {
  display: block;
  padding: 2px 4px;
  border-radius: 4px;
  text-align: center;
}

.dom-row.header.dom-ladder > span {
  padding: 0;
  border-radius: 0;
  text-align: center;
}

.dom-row.dom-ladder .price {
  text-align: center;
  font-weight: 600;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.dom-row.dom-ladder .price.dom-price--mid {
  color: var(--accent);
  text-shadow: 0 0 6px rgba(255, 184, 0, 0.4);
}

.dom-row.dom-ladder .price {
  position: relative;
}

.dom-row.dom-tp {
  box-shadow: inset 0 0 0 1px rgba(25, 195, 125, 0.5);
}

.dom-row.dom-sl {
  box-shadow: inset 0 0 0 1px rgba(239, 90, 90, 0.5);
}

.dom-row.dom-be {
  box-shadow: inset 0 0 0 1px rgba(255, 204, 77, 0.45);
}

.dom-row.dom-tp .price::after,
.dom-row.dom-sl .price::after,
.dom-row.dom-be .price::after {
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 4px;
  border-radius: 6px;
  background: rgba(8, 12, 18, 0.8);
}

.dom-row.dom-tp .price::before,
.dom-row.dom-sl .price::before {
  content: attr(data-pnl);
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  opacity: 0.85;
}

.dom-row.dom-tp .price::before {
  color: rgba(25, 195, 125, 0.9);
}

.dom-row.dom-sl .price::before {
  color: rgba(239, 90, 90, 0.9);
}

.dom-row.dom-tp .price::after {
  content: "TP";
  color: rgba(25, 195, 125, 0.95);
}

.dom-row.dom-sl .price::after {
  content: "SL";
  color: rgba(239, 90, 90, 0.95);
}

.dom-row.dom-be .price::after {
  content: "BE";
  color: rgba(255, 204, 77, 0.95);
}

.dom-row.dom-ladder .bid-size,
.dom-row.dom-ladder .bid-cum,
.dom-row.dom-ladder .exec-bid {
  text-align: right;
}

.dom-row.dom-ladder .ask-size,
.dom-row.dom-ladder .ask-cum,
.dom-row.dom-ladder .exec-ask {
  text-align: left;
}

.dom-row.dom-ladder .bid-size {
  background: var(--long-bg);
  color: var(--long);
}

.dom-row.dom-ladder .ask-size {
  background: var(--short-bg);
  color: var(--short);
}

.dom-row.dom-ladder .bid-cum,
.dom-row.dom-ladder .ask-cum {
  color: var(--muted);
}

.dom-row.dom-ladder .exec-bid,
.dom-row.dom-ladder .exec-ask {
  color: var(--text);
  opacity: 0.85;
}

.dom-row.dom-ladder .exec-bid:not(:empty) {
  background: rgba(34, 197, 94, 0.2);
  color: var(--long);
  font-weight: 600;
}

.dom-row.dom-ladder .exec-ask:not(:empty) {
  background: rgba(239, 68, 68, 0.2);
  color: var(--short);
  font-weight: 600;
}


.subtabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.chart-controls .chart-only,
.chart-controls .dom-only {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.chart-controls .chart-only.hidden,
.chart-controls .dom-only.hidden {
  display: none;
}

.options-panel {
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: linear-gradient(160deg, var(--glass-1), var(--glass-2));
  padding: 12px;
  display: grid;
  gap: 12px;
  height: 100%;
  min-height: var(--market-panel-h);
  overflow: hidden;
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
}

.options-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.options-toolbar__left {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.options-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.options-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.opt-chip {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
}

.opt-chip.active {
  border-color: rgba(255, 177, 26, 0.4);
  color: var(--accent);
  background: rgba(255, 177, 26, 0.16);
}

.opt-chip--ghost {
  background: rgba(255, 255, 255, 0.02);
  letter-spacing: 0.04em;
}

.opt-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
}

.opt-toggle input {
  accent-color: var(--accent);
}

.options-toolbar__meta {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

.options-chart-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-md);
  background: rgba(10, 14, 20, 0.7);
  padding: 12px;
  display: grid;
  gap: 10px;
}

#optionsChartCard {
  height: 100%;
  grid-template-rows: auto 1fr;
}

.options-chart-controls {
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.options-chart-source {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(12, 18, 28, 0.7);
  color: var(--text);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.options-chart-overlays {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.options-chart-surface {
  height: 240px;
}

#optionsChartCard .options-chart-surface {
  height: 100%;
  min-height: 0;
}

.options-chart-surface .chart-container {
  width: 100%;
  height: 100%;
}

.options-chain {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}

.options-chain__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.options-chain__header {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.opt-side {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.opt-strike {
  text-align: center;
  font-weight: 600;
  color: var(--text);
  padding: 4px 0;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.options-chain__hint {
  font-size: 11px;
  color: var(--muted);
}

.options-chain__rows {
  display: grid;
  gap: 4px;
  overflow-y: auto;
  min-height: 0;
}

.options-empty {
  font-size: 12px;
  color: var(--muted);
  padding: 16px;
  text-align: center;
}

.options-chain__row.data {
  background: rgba(12, 16, 22, 0.6);
  border-radius: 8px;
  padding: 6px 8px;
}

.opt-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.opt-side--calls .opt-cell {
  align-items: flex-end;
  text-align: right;
}

.opt-side--puts .opt-cell {
  align-items: flex-start;
  text-align: left;
}

.opt-cell .opt-sub {
  font-size: 10px;
  color: var(--muted);
}

.opt-cell.bid {
  color: var(--long);
  border-color: rgba(34, 197, 94, 0.25);
}

.opt-cell.ask {
  color: var(--short);
  border-color: rgba(239, 68, 68, 0.25);
}

.opt-cell.selected {
  box-shadow: 0 0 0 1px rgba(255, 184, 0, 0.55);
  border-color: rgba(255, 184, 0, 0.4);
}

@media (max-width: 1200px) {
  .opt-col--delta {
    display: none;
  }
  .opt-side {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .opt-col--iv {
    display: none;
  }
  .opt-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.ladder-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 0;
}

.ladder-btn {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 10px;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.ladder-btn.active {
  border-color: rgba(255, 177, 26, 0.4);
  color: var(--text);
  background: rgba(255, 177, 26, 0.16);
}

.ob-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

.ob-meta .field-label {
  font-size: 10px;
  letter-spacing: 0.1em;
}

.ob-ladder {
  display: grid;
  gap: 4px;
  height: auto;
  overflow: hidden;
  padding-right: 4px;
  padding-bottom: 10px;
}

.ob-row {
  position: relative;
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  gap: 10px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.ob-row::before {
  content: "";
  position: absolute;
  inset: 0;
  width: var(--ob-depth, 0%);
  border-radius: 6px;
  opacity: 0.35;
  z-index: 0;
}

.ob-row.ask::before {
  right: 0;
  left: auto;
  background: linear-gradient(270deg, rgba(239, 68, 68, 0.4), transparent 70%);
}

.ob-row.bid::before {
  left: 0;
  right: auto;
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.4), transparent 70%);
}

.ob-row > span {
  position: relative;
  z-index: 1;
  text-align: center;
}

.ob-row .mid-price,
.ob-row .mid-mark {
  text-align: center;
}

.ob-row.ask {
  color: var(--short);
}

.ob-row.bid {
  color: var(--long);
}

.ob-row.empty {
  color: var(--muted);
}

.ob-mid {
  grid-template-columns: 1fr auto 1fr;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  text-align: center;
  font-size: 14px;
}

.ob-mid .mid-price {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.ob-mid .mid-mark {
  font-size: 11px;
  color: var(--muted);
}

.ob-imbalance {
  margin-top: auto;
  padding-bottom: 4px;
  flex: 0 0 auto;
  position: static;
}

.ob-imbalance-bar {
  display: grid;
  grid-template-columns: var(--buy-pct, 50%) var(--sell-pct, 50%);
  gap: 0;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
}

.ob-imbalance-buy,
.ob-imbalance-sell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.ob-imbalance-buy {
  background: var(--long-bg);
  color: var(--long);
}

.ob-imbalance-sell {
  background: var(--short-bg);
  color: var(--short);
}

.subtab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.subtab.active {
  background: rgba(255, 177, 26, 0.18);
  border-color: rgba(255, 177, 26, 0.4);
  color: var(--text);
}

.subtab-panels {
  display: grid;
  height: var(--market-panel-h);
  min-height: var(--market-panel-h);
  overflow: hidden;
  min-height: 0;
}

.subtab-panel {
  display: none;
  height: 100%;
  min-height: 0;
}

.subtab-panel.active {
  display: block;
}

.subtab-panel[data-panel="orderbook"].active {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 8px;
}

.ob-ladder {
  flex: 1 1 auto;
  min-height: 0;
  padding-bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.card--orderbook {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.card--orderbook .subtab-panel.active {
  height: 100%;
}

.subtab-panel .trades {
  height: 100%;
  max-height: none;
  overflow-y: auto;
  padding-right: 4px;
}

.liq-body {
  display: grid;
  gap: 10px;
  height: 100%;
  min-height: 0;
}

.liq-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.liq-summary .mono {
  font-size: 12px;
  color: var(--text);
  letter-spacing: 0.02em;
}

.liq-note {
  font-size: 11px;
  color: var(--muted);
  padding: 6px 4px;
}

.liq-tape,
.liq-agg {
  display: grid;
  gap: 6px;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding-right: 4px;
}

.liq-row {
  display: grid;
  grid-template-columns: 70px 1fr 1fr 1fr;
  gap: 12px;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.02);
}

.liq-row.buy {
  border-left: 2px solid var(--success);
}

.liq-row.sell {
  border-left: 2px solid var(--danger);
}

.liq-agg-row {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.02);
}

.liq-agg-row.buy {
  color: var(--success);
}

.liq-agg-row.sell {
  color: var(--danger);
}

.liq-tape,
.liq-agg {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.liq-tape::-webkit-scrollbar,
.liq-agg::-webkit-scrollbar {
  width: 6px;
}

.liq-tape::-webkit-scrollbar-thumb,
.liq-agg::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}

.liq-tape::-webkit-scrollbar-track,
.liq-agg::-webkit-scrollbar-track {
  background: transparent;
}

.chart-surface {
  position: relative;
  border-radius: var(--r-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 12, 18, 0.7);
  height: 420px;
  overflow: hidden;
}

.chart-meta {
  position: absolute;
  right: 12px;
  bottom: 10px;
  display: inline-flex;
  gap: 10px;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  background: rgba(8, 12, 18, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 4px 10px;
  pointer-events: none;
  z-index: 2;
}

.chart-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.chart-legend {
  position: absolute;
  top: 12px;
  left: 12px;
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
}

.badge {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  border: 1px solid var(--border);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.badge.stale {
  opacity: 0;
  transition: opacity 180ms ease;
}

.badge.stale.show {
  opacity: 1;
}

.trades {
  display: grid;
  gap: 6px;
  max-height: none;
  overflow: visible;
}

.trade-row {
  display: grid;
  grid-template-columns: 70px 1fr 1fr;
  gap: 12px;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.03);
}

.trade-row.buy {
  border-left: 2px solid var(--long);
  color: var(--long);
}

.trade-row.sell {
  border-left: 2px solid var(--short);
  color: var(--short);
}

.orderbook {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  height: 100%;
  min-height: 0;
}

#orderbookGrid.view-bids {
  grid-template-columns: minmax(0, 1fr);
}

#orderbookGrid.view-asks {
  grid-template-columns: minmax(0, 1fr);
}

#orderbookGrid.view-bids #rtt_orderbook_asks,
#orderbookGrid.view-bids .orderbook-mid {
  display: none;
}

#orderbookGrid.view-asks #rtt_orderbook_bids,
#orderbookGrid.view-asks .orderbook-mid {
  display: none;
}

.orderbook-col {
  display: grid;
  gap: 6px;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
}

.orderbook-col,
.trades {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.orderbook-col::-webkit-scrollbar,
.trades::-webkit-scrollbar {
  width: 6px;
}

.orderbook-col::-webkit-scrollbar-thumb,
.trades::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}

.orderbook-col::-webkit-scrollbar-track,
.trades::-webkit-scrollbar-track {
  background: transparent;
}

.orderbook-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
}

.orderbook-row.buy {
  background: linear-gradient(90deg, var(--long-bg), transparent 70%);
}

.orderbook-row.sell {
  background: linear-gradient(270deg, var(--short-bg), transparent 70%);
}

.orderbook-mid {
  display: grid;
  place-items: center;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: var(--bg-card);
  padding: 12px;
  height: 100%;
}

.mid-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.mid-price {
  font-size: 18px;
  font-weight: 600;
}

.order-entry {
  display: grid;
  gap: 12px;
}

.order-entry__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.order-entry__selects {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px 12px;
  align-items: center;
}

.order-entry__tabs {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.order-tab {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 6px 4px;
  cursor: pointer;
}

.order-tab.active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
}

.order-entry__available {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.order-entry.quick-on .order-entry__head,
.order-entry.quick-on .order-entry__tabs,
.order-entry.quick-on .order-entry__available,
.order-entry.quick-on .order-row,
.order-entry.quick-on #orderType {
  display: none;
}

.order-entry.quick-on .order-row--post {
  display: flex;
  gap: 12px;
}

.order-entry.quick-on .order-row--post .reduce-only {
  display: none;
}

.order-entry.dom-trade #orderTypeTabs,
.order-entry.dom-trade #orderType,
.order-entry.dom-trade #orderTriggerRow,
.order-entry.dom-trade #orderExecRow,
.order-entry.dom-trade #orderPriceRow,
.order-entry.dom-trade #orderQtyRow,
.order-entry.dom-trade #orderPercentRow,
.order-entry.dom-trade #orderTpSlRow,
.order-entry.dom-trade #orderActionRow {
  display: none;
}

.order-available {
  font-size: 14px;
  color: var(--text);
}

.order-row {
  display: grid;
  gap: 8px;
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.split-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.order-status {
  font-size: 12px;
  color: var(--muted);
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.bottom-pane {
  display: grid;
  gap: 12px;
}

.tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  background: var(--bg-panel);
}

.tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 11px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.tab.active {
  background: rgba(255, 177, 26, 0.18);
  border-color: rgba(255, 177, 26, 0.4);
  color: var(--text);
  box-shadow: var(--accent-glow);
}

.tab-panels {
  display: grid;
}

.panel {
  display: none;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: 12px;
  background: linear-gradient(160deg, var(--glass-1), var(--glass-2));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.02), 0 8px 24px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
}

.panel.active {
  display: block;
}

.table {
  display: grid;
  gap: 6px;
  font-size: 12px;
}

.table.table-grid .trow {
  grid-template-columns: var(--table-cols);
}

.table.table-grid .cell {
  min-width: 0;
}

.cell.left {
  text-align: left;
}

.cell.center {
  text-align: center;
}

.cell.right {
  text-align: right;
}

.positions-table {
  overflow-x: auto;
}

.positions-table .trow {
  grid-template-columns: var(--positions-cols);
  box-sizing: border-box;
  min-width: 980px;
}

.positions-table .cell {
  min-width: 0;
}

.positions-table .cell.right {
  text-align: right;
}

.positions-table .cell.left {
  text-align: left;
}

.positions-table .cell.center {
  text-align: center;
}

.pos-contract {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pos-symbol {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.pos-side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}

.pos-tpsl {
  font-size: 11px;
  color: var(--muted);
  display: inline-flex;
  gap: 4px;
}

.pos-tpsl .tp {
  color: var(--positive);
  font-weight: 600;
}

.pos-tpsl .sl {
  color: var(--negative);
  font-weight: 600;
}

.pos-side.positive {
  color: var(--positive);
}

.pos-side.negative {
  color: var(--negative);
}

.pos-meta {
  font-size: 10px;
  color: var(--muted);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pos-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 10px;
  padding: 0;
  cursor: pointer;
}

.pos-size .pos-main,
.pos-pnl .pos-main {
  font-weight: 600;
}

.pos-sub {
  font-size: 10px;
  color: var(--muted);
}

.pos-pnl.positive .pos-main,
.pos-pnl.positive .pos-sub {
  color: var(--long);
  text-shadow: var(--long-glow);
}

.pos-pnl.negative .pos-main,
.pos-pnl.negative .pos-sub {
  color: var(--short);
  text-shadow: var(--short-glow);
}

.pos-liq {
  color: rgba(214, 225, 240, 0.75);
}

.pos-margin.warn {
  color: rgba(255, 196, 87, 0.95);
}

.pos-margin.danger {
  color: rgba(255, 96, 96, 0.95);
}

.adl-bars {
  display: flex;
  justify-content: flex-end;
  gap: 3px;
  margin-top: 4px;
}

.adl-bars span {
  width: 8px;
  height: 4px;
  border-radius: 4px;
  background: rgba(120, 140, 170, 0.3);
}

.adl-bars span.active {
  background: rgba(255, 174, 64, 0.9);
}

.pos-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.btn.pos-action {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 8px;
}

.btn.pos-action:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.trow {
  display: grid;
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--r-sm);
}

.trow.header {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  border-bottom: 1px solid var(--border-strong);
}

.trow.data {
  background: transparent;
}

.table .trow.data:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.trow.data:hover {
  background: var(--bg-hover);
}

.cell.num {
  text-align: right;
}

.cell.actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.pnl-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 12, 0.7);
  backdrop-filter: blur(6px);
  z-index: 10;
}

.modal.show {
  display: flex;
}

.modal-card {
  width: min(480px, 90vw);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  display: grid;
  gap: 12px;
  box-shadow: var(--sh-md);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-body {
  display: grid;
  gap: 8px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
}

.close-modal {
  width: min(520px, 94vw);
}

.close-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 4px;
}

.close-tab {
  background: rgba(12, 16, 22, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-md);
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

.close-tab.active {
  background: rgba(255, 177, 26, 0.2);
  border-color: rgba(255, 177, 26, 0.5);
  color: var(--accent);
}

.close-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.close-tags .tag {
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.close-tags .tag.positive {
  color: var(--positive);
  border-color: rgba(25, 195, 125, 0.4);
}

.close-tags .tag.negative {
  color: var(--negative);
  border-color: rgba(239, 90, 90, 0.4);
}

.close-info {
  display: grid;
  gap: 6px;
  margin-bottom: 4px;
}

.close-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.close-label {
  color: var(--muted);
  font-size: 12px;
}

.close-value {
  font-size: 13px;
}

.close-value .tp {
  color: var(--positive);
  font-weight: 600;
}

.close-value .sl {
  color: var(--negative);
  font-weight: 600;
}

.close-value.positive {
  color: var(--positive);
}

.close-value.negative {
  color: var(--negative);
}

.close-qty-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.close-available {
  color: var(--muted);
  font-size: 11px;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: grid;
  gap: 8px;
  z-index: 20;
}

.toast .message {
  background: rgba(14, 18, 26, 0.95);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-size: 12px;
  box-shadow: var(--sh-sm);
}

.toast .message.toast-success {
  border-color: rgba(46, 209, 120, 0.5);
  color: #dff7ea;
}

.toast .message.toast-warn {
  border-color: rgba(255, 177, 26, 0.6);
  color: #ffe9b3;
}

.toast .message.toast-error {
  border-color: rgba(239, 90, 90, 0.6);
  color: #ffd4d4;
}

.toast .message.toast-top-left {
  position: fixed;
  top: 20px;
  left: 20px;
  right: auto;
  bottom: auto;
}

.toast .message.toast-top-right {
  position: fixed;
  top: 20px;
  right: 20px;
  left: auto;
  bottom: auto;
}

.toast .message.toast-bottom-left {
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: auto;
  top: auto;
}

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

  .topbar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1280px) {
  .stat--turnover {
    display: none;
  }
  .chart-head__stats {
    grid-template-columns: 120px 95px 95px 95px 85px 90px 95px 95px 120px;
  }
}

@media (max-width: 1120px) {
  .stat--vol {
    display: none;
  }
  .chart-head__stats {
    grid-template-columns: 120px 95px 95px 95px 85px 90px 95px 95px;
  }
}

@media (max-width: 980px) {
  .stat--high,
  .stat--low {
    display: none;
  }
  .chart-head__stats {
    grid-template-columns: 120px 95px 95px 95px 85px 90px;
  }
}

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

  .chart-head {
    grid-template-columns: 1fr;
  }
  .chart-head__stats {
    grid-auto-flow: row;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .right-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1320px) {
  .chart-head {
    grid-template-columns: minmax(260px, 1fr) minmax(0, 2.6fr);
    padding: 10px 16px;
  }
}

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

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .orderbook {
    grid-template-columns: 1fr;
  }

  .orderbook-mid {
    order: -1;
  }

  .pnl-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  :root {
    --market-panel-h: clamp(260px, 55vh, 360px);
  }

  .page {
    padding: 16px;
  }

  .card {
    padding: 10px 12px;
  }

  .chart-head {
    padding: 10px 12px;
  }

  .chart-head__stats {
    gap: 10px;
  }

  .chart-topbar {
    flex-wrap: wrap;
  }

  .chart-topbar .chart-controls {
    width: 100%;
    justify-content: flex-start;
  }

  .subtabs {
    gap: 6px;
  }

  .ob-meta {
    width: 100%;
    justify-content: flex-start;
  }

  .orderbook-mid {
    padding: 8px;
  }

  .mid-price {
    font-size: 16px;
  }

  .dom-view {
    height: clamp(260px, 55vh, 360px);
  }
}
