:root {
  color-scheme: dark;
  --bg: #0b0d12;
  --panel: #0f1219;
  --panel-soft: #121722;
  --line: #202632;
  --line-soft: #171c25;
  --text: #eef2f7;
  --muted: #8b9099;
  --muted-dim: #5f6672;
  --green: #27d66f;
  --lime: #b5f22d;
  --red: #eb474f;
  --orange: #ff6f0f;
  --blue: #83a9ff;
  --coin-line: #5f3f19;
  --coin-bg: #23190e;
  --coin-text: #f5a623;
  --environment-line: #314362;
  --surface-control: #111824;
  --control-hover-line: #46536a;
  --surface-popover: #10151f;
  --surface-active: #15233a;
  --active-line: #34517d;
  --surface-stat: #0d1016;
  --surface-chart: #0b0e14;
  --chart-grid: rgb(255 255 255 / 6%);
  --chart-separator: rgb(255 255 255 / 12%);
  --chart-label: rgb(169 178 194 / 72%);
  --chart-target: rgb(132 204 22 / 84%);
  --chart-target-label-bg: #263718;
  --chart-target-label-line: #83b94a;
  --chart-target-label-text: #d0efa6;
  --chart-price: #83a9ff;
  --chart-up: #27d66f;
  --chart-down: #eb474f;
  --chart-badge-up: #32dc78;
  --chart-badge-down: #f0525a;
  --legend-line: rgb(255 255 255 / 8%);
  --surface-legend: rgb(11 14 20 / 78%);
  --chart-empty-text: #c8cfda;
  --surface-tab-active: #1b2638;
  --primary-line: #315385;
  --primary-bg: #172b49;
  --primary-text: #dbe8ff;
  --surface-rail: #0c0f15;
  --rail-text: #c6ccd5;
  --surface-rail-active: #141e2c;
  --surface-chip: #202634;
  --surface-summary: #0c1017;
  --surface-summary-card: #111722;
  --surface-input: #0b0e14;
  --dialog-line: #2b3443;
  --surface-dialog: #111621;
  --dialog-backdrop: rgb(3 5 8 / 72%);
  --surface-table-head: #111621;
  --table-head-text: #aeb6c2;
  --wallet-address-text: #cbd5e4;
  --surface-mode-switch: #0a0d12;
  --surface-mode-active: #192131;
  --surface-floating: #172235;
  --panel-shadow: 0 14px 38px rgb(0 0 0 / 20%);
  --popover-shadow: 0 16px 40px rgb(0 0 0 / 45%);
  --dialog-shadow: 0 24px 80px rgb(0 0 0 / 60%);
  --sidebar-width: 244px;
  --manual-width: 1040px;
  --top-row-height: 680px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #edf1f6;
  --panel: #ffffff;
  --panel-soft: #f5f7fa;
  --line: #d4dce7;
  --line-soft: #e6ebf2;
  --text: #182230;
  --muted: #667085;
  --muted-dim: #8a94a5;
  --green: #128a46;
  --lime: #5f8d00;
  --red: #c9323b;
  --orange: #d95700;
  --blue: #356ed4;
  --coin-line: #e5bc7e;
  --coin-bg: #fff3df;
  --coin-text: #ad6500;
  --environment-line: #a9c2e9;
  --surface-control: #f3f6fa;
  --control-hover-line: #9ba9bc;
  --surface-popover: #ffffff;
  --surface-active: #e8f1ff;
  --active-line: #8eb4ed;
  --surface-stat: #f8fafc;
  --surface-chart: #fbfcfe;
  --chart-grid: rgb(38 54 75 / 9%);
  --chart-separator: rgb(38 54 75 / 16%);
  --chart-label: rgb(65 78 98 / 82%);
  --chart-target: rgb(91 145 14 / 82%);
  --chart-target-label-bg: #eff8df;
  --chart-target-label-line: #a6ce6f;
  --chart-target-label-text: #557523;
  --chart-price: #356ed4;
  --chart-up: #128a46;
  --chart-down: #c9323b;
  --chart-badge-up: #21b861;
  --chart-badge-down: #e3454f;
  --legend-line: rgb(38 54 75 / 14%);
  --surface-legend: rgb(255 255 255 / 90%);
  --chart-empty-text: #475467;
  --surface-tab-active: #e7edf5;
  --primary-line: #8cb2ec;
  --primary-bg: #e8f1ff;
  --primary-text: #254f93;
  --surface-rail: #f7f9fc;
  --rail-text: #3d4756;
  --surface-rail-active: #e8f1ff;
  --surface-chip: #e7ecf3;
  --surface-summary: #f7f9fc;
  --surface-summary-card: #ffffff;
  --surface-input: #ffffff;
  --dialog-line: #cbd4e1;
  --surface-dialog: #ffffff;
  --dialog-backdrop: rgb(20 30 43 / 32%);
  --surface-table-head: #f0f3f8;
  --table-head-text: #4c596a;
  --wallet-address-text: #344054;
  --surface-mode-switch: #edf1f6;
  --surface-mode-active: #ffffff;
  --surface-floating: #e8f1ff;
  --panel-shadow: 0 12px 30px rgb(17 24 39 / 9%);
  --popover-shadow: 0 16px 38px rgb(17 24 39 / 16%);
  --dialog-shadow: 0 24px 70px rgb(17 24 39 / 22%);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.login-screen {
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
  background:
    radial-gradient(circle at 50% 10%, color-mix(in srgb, var(--blue) 13%, transparent), transparent 38%),
    var(--bg);
}

.login-card {
  width: min(100%, 420px);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--dialog-shadow);
}

.login-brand {
  display: grid;
  width: 54px;
  height: 54px;
  margin-bottom: 24px;
  place-items: center;
  border: 1px solid var(--coin-line);
  border-radius: 50%;
  background: var(--coin-bg);
  color: var(--coin-text);
  font-size: 29px;
  font-weight: 800;
}

.login-heading > span {
  color: var(--blue);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.12em;
}

.login-heading h1 {
  margin: 7px 0 8px;
  font-size: 28px;
  letter-spacing: -0.03em;
}

.login-heading p {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.login-form {
  display: grid;
  gap: 9px;
}

.login-form label {
  margin-top: 4px;
  color: var(--table-head-text);
  font-size: 11px;
  font-weight: 700;
}

.login-form input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 1px solid var(--dialog-line);
  border-radius: 9px;
  background: var(--surface-input);
  color: var(--text);
}

.login-form input:hover {
  border-color: var(--control-hover-line);
}

.login-error {
  min-height: 18px;
  margin: 2px 0 0;
  color: var(--red);
  font-size: 11px;
}

.login-submit {
  height: 46px;
  border: 1px solid var(--primary-line);
  border-radius: 9px;
  background: var(--primary-bg);
  color: var(--primary-text);
  font-weight: 750;
}

.login-submit:hover:not(:disabled) {
  filter: brightness(1.08);
}

.login-submit:disabled {
  cursor: wait;
  opacity: 0.65;
}

.login-security {
  display: block;
  margin-top: 20px;
  color: var(--muted-dim);
  font-size: 10px;
  text-align: center;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:not(:disabled) {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(340px, 1fr) var(--manual-width);
  grid-template-rows: var(--top-row-height) 10px auto;
  grid-template-areas:
    "market wallet"
    "split split"
    "bottom bottom";
  gap: 8px;
  min-height: 100vh;
  padding: 8px 10px 14px;
}

.app-shell.wallet-hidden {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "market"
    "split"
    "bottom";
}

.app-shell.wallet-expanded {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "wallet"
    "split"
    "bottom";
}

.app-shell.wallet-expanded .market-screen,
.app-shell.wallet-hidden .manual-resizer,
.app-shell.wallet-expanded .manual-resizer {
  display: none;
}

.market-screen,
.manual-panel,
.bottom-zone {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--panel-shadow);
}

.market-screen {
  grid-area: market;
  display: flex;
  flex-direction: column;
}

.market-header {
  padding: 16px;
  border-bottom: 1px solid var(--line-soft);
}

.topbar,
.brand,
.title-row,
.price-row,
.wallet-manager-top,
.wallet-content-head,
.wallet-toolbar,
.wallet-chips,
.panel-head,
.trade-panel-title-group,
.panel-tools {
  display: flex;
  align-items: center;
}

.topbar-actions,
.theme-picker {
  display: flex;
  align-items: center;
}

.topbar-actions {
  gap: 8px;
}

.theme-picker {
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-control);
}

.theme-option {
  min-height: 34px;
  padding: 6px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.theme-option:hover {
  color: var(--text);
}

.theme-option.active {
  background: var(--surface-mode-active);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
}

.logout-button {
  min-height: 40px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-control);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.logout-button:hover {
  border-color: var(--control-hover-line);
  color: var(--text);
}

.topbar,
.wallet-manager-top,
.wallet-content-head,
.panel-head {
  justify-content: space-between;
}

.coin {
  display: grid;
  width: 42px;
  height: 42px;
  margin-right: 12px;
  place-items: center;
  border: 1px solid var(--coin-line);
  border-radius: 50%;
  background: var(--coin-bg);
  color: var(--coin-text);
  font-size: 23px;
  font-weight: 800;
}

.brand-copy {
  min-width: 0;
}

.title {
  margin: 0;
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.subtitle,
.stat-sub,
.rail-empty,
.placeholder-view span,
#walletManagerSubtitle {
  color: var(--muted);
  font-size: 11px;
}

.environment-badge {
  margin-left: 8px;
  padding: 2px 6px;
  border: 1px solid var(--environment-line);
  border-radius: 999px;
  color: var(--blue);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.market-picker {
  position: relative;
}

.market-picker-button,
.market-option,
.icon-button,
.wallet-pill,
.trade-mode-button,
.rail-item {
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.market-picker-button {
  display: grid;
  min-width: 112px;
  padding: 8px 28px 8px 10px;
  border-radius: 8px;
  text-align: left;
}

.rail-group-row {
  display: flex;
  align-items: stretch;
  gap: 4px;
}

.rail-group-row .rail-item {
  flex: 1 1 auto;
  min-width: 0;
}

.rail-group-action,
.rail-order-action {
  width: 25px;
  height: 31px;
  flex: 0 0 25px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-control);
  color: var(--muted);
}

.rail-group-action:hover,
.rail-order-action:hover {
  border-color: var(--control-hover-line);
  color: var(--text);
}

.rail-order-action:disabled {
  cursor: default;
  opacity: 0.28;
}

.rail-group-row[draggable="true"] {
  cursor: grab;
}

.rail-group-row.wallet-order-dragging {
  opacity: 0.45;
}

.rail-group-row.wallet-order-drag-before {
  box-shadow: inset 0 2px 0 var(--blue);
}

.rail-group-row.wallet-order-drag-after {
  box-shadow: inset 0 -2px 0 var(--blue);
}

.market-picker-eyebrow {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.market-picker-label {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 700;
}

.market-picker-caret {
  position: absolute;
  right: 10px;
  top: 17px;
  color: var(--muted);
  font-size: 9px;
}

.market-picker-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  right: 0;
  width: 190px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-popover);
  box-shadow: var(--popover-shadow);
}

.market-option {
  display: grid;
  grid-template-columns: 28px 1fr;
  width: 100%;
  padding: 8px;
  border-radius: 7px;
  text-align: left;
}

.market-option small {
  grid-column: 2;
  color: var(--muted);
}

.market-option.active {
  border-color: var(--active-line);
  background: var(--surface-active);
}

.price-row {
  align-items: stretch;
  gap: 8px;
  margin-top: 16px;
}

.stat {
  min-width: 0;
  flex: 1;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-stat);
}

.stat-label,
.stat-sub,
.stat-value {
  display: block;
}

.stat-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-value {
  margin: 5px 0 3px;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.quote-stat {
  flex: 1.25;
}

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

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

.btc30-metric.btc30-bounded {
  cursor: help;
  text-decoration-line: underline;
  text-decoration-style: dotted;
  text-decoration-color: color-mix(in srgb, currentColor 44%, transparent);
  text-underline-offset: 3px;
}

.btc30-metric.btc30-positive {
  color: var(--green);
}

.btc30-metric.btc30-negative {
  color: var(--red);
}

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

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

.chart-shell {
  position: relative;
  min-height: 320px;
  flex: 1;
  background:
    linear-gradient(var(--chart-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--chart-grid) 1px, transparent 1px),
    var(--surface-chart);
  background-size: 48px 48px;
}

#chart {
  width: 100%;
  height: 100%;
}

.chart-legend {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
  border: 1px solid var(--legend-line);
  border-radius: 6px;
  background: var(--surface-legend);
  color: var(--muted);
  font-size: 10px;
  pointer-events: none;
}

.chart-legend[hidden] {
  display: none;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.chart-empty[hidden] {
  display: none;
}

.chart-empty strong {
  color: var(--chart-empty-text);
  font-size: 13px;
}

.chart-empty span {
  margin-top: 6px;
  font-size: 11px;
}

.manual-resizer {
  position: absolute;
  z-index: 8;
  top: 8px;
  right: calc(var(--manual-width) + 10px);
  width: 8px;
  height: var(--top-row-height);
  cursor: col-resize;
}

.manual-panel {
  grid-area: wallet;
  display: flex;
  flex-direction: column;
}

.wallet-manager-top {
  min-height: 46px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
}

.wallet-mode-tabs,
.wallet-top-icons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wallet-mode-tab {
  padding: 7px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.wallet-mode-tab.active {
  background: var(--surface-tab-active);
  color: var(--text);
}

.wallet-top-icons {
  color: var(--muted);
  font-size: 10px;
}

.icon-button,
.wallet-pill,
.trade-mode-button {
  padding: 6px 9px;
  border-radius: 7px;
  font-size: 10px;
}

.wallet-pill.primary {
  border-color: var(--primary-line);
  background: var(--primary-bg);
  color: var(--primary-text);
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.wallet-body {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 0;
  flex: 1;
}

.wallet-radar-panel.registry-mode .wallet-body {
  grid-template-columns: minmax(0, 1fr);
}

.wallet-radar-panel.registry-mode .wallet-rail {
  display: none;
}

.wallet-rail {
  overflow: auto;
  padding: 10px 8px;
  border-right: 1px solid var(--line);
  background: var(--surface-rail);
}

.rail-title {
  margin: 5px 5px 7px;
  color: var(--muted-dim);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.rail-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 5px;
  padding: 8px;
  border-radius: 7px;
  color: var(--rail-text);
  font-size: 10px;
  text-align: left;
}

.rail-item.observe {
  border-left: 2px solid var(--orange);
}

.rail-item.active {
  border-left: 2px solid var(--blue);
  background: var(--surface-rail-active);
}

.rail-item.hidden-wallet {
  border-left: 2px solid var(--red);
}

.count,
.chip,
.panel-count {
  border-radius: 999px;
  background: var(--surface-chip);
  font-variant-numeric: tabular-nums;
}

.live-panel-status {
  max-width: 360px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.count {
  padding: 1px 5px;
  color: var(--muted);
  font-size: 9px;
}

.rail-divider {
  height: 1px;
  margin: 10px 3px;
  background: var(--line);
}

.rail-empty {
  padding: 4px 5px 9px;
}

.wallet-rail .wallet-pill {
  width: 100%;
  margin-top: 5px;
}

.wallet-content {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
}

.wallet-content-head {
  padding: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.wallet-content-head strong,
.wallet-content-head span {
  display: block;
}

.wallet-chips {
  gap: 5px;
}

.wallet-registry-summary {
  display: grid;
  grid-template-columns: repeat(8, minmax(82px, 1fr)) minmax(150px, 1.5fr);
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface-summary);
}

.wallet-summary-card {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-summary-card);
}

.wallet-summary-card span {
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.wallet-summary-card strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wallet-summary-card.source strong {
  color: var(--blue);
  font-size: 9px;
}

.chip,
.panel-count {
  padding: 3px 7px;
  color: var(--muted);
  font-size: 9px;
}

.chip.blue {
  color: var(--blue);
}

.chip.green {
  color: var(--green);
}

.wallet-toolbar {
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid var(--line-soft);
}

.wallet-toolbar input {
  min-width: 180px;
  flex: 1;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-input);
  color: var(--text);
  font-size: 10px;
}

.table-view-control {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.table-view-control select {
  height: 28px;
  max-width: 150px;
  padding: 3px 22px 3px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-control);
  color: var(--text);
  font: inherit;
}

.table-view-control.compact select {
  height: 26px;
}

.sort-direction {
  min-width: 30px;
  padding-inline: 7px;
  font-size: 13px;
}

.wallet-mutation-status {
  min-width: 180px;
  overflow: hidden;
  color: var(--green);
  font-size: 9px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wallet-mutation-status.error {
  color: var(--orange);
}

.wallet-table-wrap,
.table-scroll {
  overflow: auto;
  min-height: 0;
  flex: 1;
}

.wallet-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-height: 40px;
  padding: 7px 10px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 10px;
}

.wallet-pagination span {
  margin-right: auto;
}

.wallet-table [data-column-key="wallet"] {
  min-width: 210px;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wallet-table [data-column-key="actions"] {
  min-width: 300px;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wallet-row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.wallet-row-action,
.wallet-group-select {
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-control);
  color: var(--muted);
  font-size: 9px;
}

.wallet-row-action {
  min-width: 25px;
  padding: 2px 6px;
}

.wallet-row-action.active[data-wallet-action="favorite"] {
  border-color: #315385;
  color: var(--blue);
}

.wallet-row-action.active[data-wallet-action="observed"] {
  border-color: #835328;
  color: var(--orange);
}

.wallet-row-action.active[data-wallet-action="blacklisted"] {
  border-color: #743545;
  color: var(--red);
}

.wallet-group-select {
  max-width: 120px;
  padding: 2px 4px;
}

.wallet-dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--dialog-line);
  border-radius: 10px;
  background: var(--surface-dialog);
  color: var(--text);
  box-shadow: var(--dialog-shadow);
}

.wallet-dialog::backdrop {
  background: var(--dialog-backdrop);
}

.wallet-dialog form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.table-columns-dialog {
  width: min(720px, calc(100vw - 24px));
}

.wallet-dialog.table-columns-dialog > section {
  display: grid;
  max-height: min(88vh, 820px);
  gap: 0;
  padding: 0;
}

.wallet-dialog.table-columns-dialog header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.table-columns-dialog header span {
  color: var(--muted);
  font-size: 10px;
}

.table-columns-heading {
  display: grid;
  gap: 4px;
}

.table-columns-heading > strong {
  font-size: 14px;
}

.table-columns-note {
  margin: 0;
  padding: 12px 18px 8px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

#tableColumnsSubtitle.error {
  color: var(--orange);
}

.table-columns-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
  max-height: min(66vh, 650px);
  padding: 10px 18px 16px;
  overflow: auto;
}

.wallet-dialog.table-columns-dialog .table-column-setting {
  min-height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-control);
}

.table-column-setting[hidden] {
  display: none;
}

.wallet-dialog.table-columns-dialog .table-column-setting label {
  display: flex;
  height: 40px;
  min-height: 40px;
  min-width: 0;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  cursor: pointer;
}

.wallet-dialog.table-columns-dialog .table-column-setting input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  flex: 0 0 16px;
  margin: 0;
  padding: 0;
  accent-color: #2583e8;
}

.wallet-dialog.table-columns-dialog .table-column-setting label span {
  overflow: hidden;
  color: var(--text);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-column-setting.locked {
  opacity: 0.58;
}

.wallet-dialog.table-columns-dialog footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
}

.table-columns-dialog footer > strong {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.table-columns-footer-actions {
  display: flex;
  gap: 7px;
}

@media (max-width: 620px) {
  .table-columns-list {
    grid-template-columns: 1fr;
  }
}

.table-filters-dialog {
  width: min(620px, calc(100vw - 32px));
}

.table-filters-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  max-height: min(68vh, 620px);
  padding-right: 3px;
  overflow-y: auto;
}

.table-filter-section {
  grid-column: 1 / -1;
  position: sticky;
  z-index: 1;
  top: 0;
  padding: 6px 7px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-dialog);
  color: var(--text);
  font-size: 10px;
}

.table-filter-error {
  padding: 7px 8px;
  border: 1px solid rgb(239 68 68 / 45%);
  border-radius: 6px;
  background: rgb(239 68 68 / 10%);
  color: var(--red) !important;
}

.wallet-pill.active {
  border-color: rgb(59 130 246 / 70%);
  background: rgb(37 99 235 / 18%);
  color: #a8c7ff;
}

.wallet-dialog header,
.wallet-dialog label {
  display: grid;
  gap: 5px;
}

.wallet-dialog header span,
.wallet-dialog label span,
.wallet-dialog p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.wallet-dialog input,
.wallet-dialog textarea,
.wallet-dialog select {
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-input);
  color: var(--text);
}

.wallet-dialog textarea {
  resize: vertical;
  font: inherit;
}

.wallet-dialog .wallet-alert-toggle {
  display: flex;
  grid-template-columns: none;
  flex-direction: row;
  align-items: center;
}

.wallet-dialog .wallet-alert-toggle input {
  width: auto;
}

.wallet-dialog footer {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.wallet-pill.destructive {
  margin-right: auto;
  border-color: #743545;
  color: var(--red);
}

.data-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
  height: 32px;
  padding: 6px 9px;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  text-align: right;
  white-space: nowrap;
}

.data-table th {
  position: sticky;
  z-index: 2;
  top: 0;
  background: var(--surface-table-head);
  color: var(--table-head-text);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.table-sort-button {
  display: inline-flex;
  width: 100%;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.data-table [data-column-key="wallet"] .table-sort-button {
  justify-content: flex-start;
}

.table-sort-button:hover,
.table-sort-button.active {
  color: var(--blue);
}

.table-sort-arrow {
  min-width: 9px;
}

.data-table [data-column-key="wallet"] {
  text-align: left;
}

.table-column-hidden {
  display: none;
}

.table-column-resizer {
  position: absolute;
  z-index: 4;
  top: 0;
  right: -4px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
}

.table-column-resizer:hover {
  background: rgb(131 169 255 / 25%);
}

.empty-cell {
  height: 92px !important;
  color: var(--muted);
  text-align: center !important;
}

.wallet-address {
  color: var(--wallet-address-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 9px;
}

.wallet-profile-link {
  color: inherit;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.wallet-profile-link:hover,
.wallet-profile-link:focus-visible {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.deposit-evidence-link,
.deposit-history-links a {
  color: var(--blue);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 9px;
  text-decoration: none;
}

.deposit-evidence-link:hover,
.deposit-evidence-link:focus-visible,
.deposit-history-links a:hover,
.deposit-history-links a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.deposit-more-button {
  max-width: 100%;
  padding: 2px 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-control);
  color: var(--text);
  font: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.deposit-more-button:hover,
.deposit-more-button:focus-visible {
  border-color: var(--blue);
  color: var(--blue);
}

.deposit-history-dialog {
  width: min(620px, calc(100vw - 32px));
}

.deposit-history-dialog > section {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.deposit-history-dialog header {
  display: grid;
  gap: 4px;
}

.deposit-history-dialog header span,
.deposit-history-dialog > section > p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.deposit-history-list {
  display: grid;
  max-height: min(60vh, 560px);
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.deposit-history-empty {
  margin: 0;
  padding: 20px 12px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.deposit-history-entry {
  display: grid;
  grid-template-columns: 34px 86px 132px minmax(120px, 1fr) auto;
  align-items: center;
  min-height: 34px;
  padding: 4px 7px;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 10px;
}

.deposit-history-entry:last-child {
  border-bottom: 0;
}

.deposit-history-index,
.deposit-history-entry time,
.deposit-history-entry > span:nth-child(4) {
  color: var(--muted);
}

.deposit-history-links {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.deposit-history-dialog footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

@media (max-width: 620px) {
  .deposit-history-entry {
    grid-template-columns: 30px 76px minmax(0, 1fr);
  }

  .deposit-history-entry time,
  .deposit-history-entry > span:nth-child(4) {
    grid-column: 2 / -1;
  }

  .deposit-history-links {
    grid-column: 2 / -1;
    justify-content: flex-start;
  }
}

.data-table td.data-status {
  font-size: 9px;
  font-weight: 700;
}

.data-table td.data-status.incomplete {
  color: var(--orange);
}

.data-table td.data-status.complete {
  color: var(--green);
}

.data-table td.data-status.live {
  color: #38bdf8;
}

.data-table td.metric-freshness {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.data-table td.metric-freshness.partial {
  color: var(--orange);
}

.lag-cell.stale {
  color: var(--orange);
}

.transaction-link {
  color: var(--blue);
  text-decoration: none;
}

.transaction-link:hover {
  text-decoration: underline;
}

.placeholder-view {
  display: grid;
  flex: 1;
  align-content: center;
  justify-items: center;
  gap: 7px;
  padding: 24px;
  text-align: center;
}

.horizontal-resizer {
  grid-area: split;
  cursor: row-resize;
}

.bottom-zone {
  grid-area: bottom;
  display: flex;
  flex-direction: column;
  min-height: 270px;
}

.live-pagination {
  min-height: 36px;
}

.panel-head {
  min-height: 44px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
}

.trade-panel-title-group,
.panel-tools {
  gap: 6px;
}

.trade-mode-switch {
  display: flex;
  padding: 2px;
  border-radius: 8px;
  background: var(--surface-mode-switch);
}

.trade-mode-button {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.trade-mode-button.active {
  border-color: var(--line);
  background: var(--surface-mode-active);
  color: var(--text);
}

.quick-filter {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 9px;
}

.quick-filter.favorite {
  color: var(--blue);
}

.trade-table [data-column-key="wallet"],
.position-table [data-column-key="wallet"] {
  min-width: 230px;
}

.wallet-panel-show {
  position: fixed;
  z-index: 30;
  top: 14px;
  right: 14px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-floating);
  color: var(--text);
}

@media (max-width: 1180px) {
  :root {
    --manual-width: min(720px, 58vw);
    --sidebar-width: 190px;
  }

  .price-row {
    flex-wrap: wrap;
  }

  .stat {
    min-width: 120px;
  }
}

@media (max-width: 820px) {
  .login-screen {
    padding: 14px;
  }

  .login-card {
    padding: 26px 22px;
  }

  .app-shell {
    display: flex;
    flex-direction: column;
    padding: 6px;
  }

  .market-screen,
  .manual-panel {
    min-height: 620px;
  }

  .manual-resizer,
  .horizontal-resizer {
    display: none;
  }

  .wallet-body {
    grid-template-columns: 150px minmax(0, 1fr);
  }

  .wallet-manager-top,
  .topbar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .wallet-top-icons,
  .panel-tools {
    width: 100%;
    justify-content: flex-end;
  }
}

/* V2 read-only operations center */
.admin-ops-layout {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  overflow: auto;
  background: var(--bg);
}

.admin-ops-head {
  position: sticky;
  z-index: 4;
  top: 0;
  display: flex;
  min-height: 50px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.admin-ops-head > div:first-child {
  display: grid;
  gap: 2px;
}

.admin-ops-head strong {
  font-size: 13px;
  font-weight: 850;
}

.admin-ops-head span,
.admin-resource-card small,
.admin-ops-panel > header span {
  color: var(--muted);
  font-size: 9px;
}

.admin-ops-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-live-stamp {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.admin-live-stamp::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  content: "";
}

.admin-live-stamp.live::before {
  background: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 15%, transparent);
}

.admin-live-stamp.error::before {
  background: var(--red);
}

.admin-resource-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 6px;
  padding: 7px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-summary);
}

.admin-resource-card {
  display: grid;
  min-width: 0;
  gap: 3px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-summary-card);
}

.admin-resource-card > span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.admin-resource-card > strong {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-resource-card.good > strong {
  color: var(--green);
}

.admin-resource-card.warning > strong {
  color: var(--orange);
}

.admin-resource-card.danger > strong {
  color: var(--red);
}

.admin-resource-card > i,
.admin-calc-meter {
  position: relative;
  display: block;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.admin-resource-card > i > b,
.admin-calc-meter > b {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 180ms ease;
}

.admin-resource-card.warning > i > b,
.admin-calc-card.warning .admin-calc-meter > b {
  background: var(--orange);
}

.admin-resource-card.danger > i > b,
.admin-calc-card.danger .admin-calc-meter > b {
  background: var(--red);
}

.admin-ops-grid {
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(620px, 1fr) minmax(240px, 300px);
  gap: 7px;
  padding: 7px;
}

.admin-ops-main,
.admin-ops-side {
  display: grid;
  align-content: start;
  gap: 7px;
}

.admin-ops-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.admin-ops-panel > header {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
}

.admin-ops-panel > header strong {
  font-size: 11px;
  font-weight: 850;
}

.admin-calculation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 6px;
  padding: 7px;
}

.admin-calc-card {
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--panel-soft);
}

.admin-calc-head,
.admin-calc-meta,
.admin-cursor-item,
.admin-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.admin-calc-head > div {
  display: grid;
  gap: 2px;
}

.admin-calc-head strong {
  font-size: 11px;
  font-weight: 850;
}

.admin-calc-head span,
.admin-calc-meta span {
  color: var(--muted);
  font-size: 8.5px;
}

.admin-calc-value {
  color: var(--text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.admin-calc-meta {
  justify-content: flex-start;
}

.admin-calc-meta span {
  padding: 3px 5px;
  border-radius: 4px;
  background: var(--panel);
}

.admin-calc-meta .running {
  color: var(--green);
}

.admin-calc-meta .failed {
  color: var(--red);
}

.admin-worker-table-wrap {
  overflow: auto;
  max-height: 260px;
}

.admin-worker-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.admin-worker-table th,
.admin-worker-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  white-space: nowrap;
}

.admin-worker-table th {
  position: sticky;
  z-index: 1;
  top: 0;
  background: var(--surface-table-head);
  color: var(--table-head-text);
  font-size: 8px;
  text-transform: uppercase;
}

.admin-service-state,
.admin-cursor-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}

.admin-service-state::before,
.admin-cursor-state::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  content: "";
}

.admin-service-state.active,
.admin-cursor-state.active {
  color: var(--green);
}

.admin-service-state.active::before,
.admin-cursor-state.active::before {
  background: var(--green);
}

.admin-service-state.failed,
.admin-cursor-state.stale {
  color: var(--red);
}

.admin-service-state.failed::before,
.admin-cursor-state.stale::before {
  background: var(--red);
}

.admin-cursor-list,
.admin-alert-list {
  display: grid;
}

.admin-cursor-item,
.admin-alert {
  align-items: flex-start;
  padding: 8px 9px;
  border-bottom: 1px solid var(--line-soft);
}

.admin-cursor-item:last-child,
.admin-alert:last-child {
  border-bottom: 0;
}

.admin-cursor-item > div,
.admin-alert > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.admin-cursor-item strong,
.admin-alert strong {
  overflow: hidden;
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-cursor-item small,
.admin-alert small,
.admin-empty-state {
  color: var(--muted);
  font-size: 8.5px;
  line-height: 1.35;
}

.admin-alert {
  border-left: 3px solid var(--orange);
}

.admin-alert.danger {
  border-left-color: var(--red);
}

.admin-alert.info {
  border-left-color: var(--blue);
}

.admin-empty-state {
  padding: 12px;
  text-align: center;
}

@media (max-width: 1180px) {
  .admin-resource-strip {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

  .admin-ops-grid {
    grid-template-columns: minmax(0, 1fr);
  }

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

@media (max-width: 720px) {
  .admin-resource-strip,
  .admin-calculation-grid,
  .admin-ops-side {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-ops-head {
    align-items: flex-start;
  }
}

/*
 * V1 visual parity layer.
 * Reference: audited production INDEX_HTML CSS, especially the dense market
 * shell and "Variant E: compact light screener".  V2 keeps its own data flow
 * and DOM, but its visual measurements and component states follow V1.
 */
:root {
  --v1-table-row-height: 34px;
  --v1-table-head-height: 29px;
  --v1-filter-height: 28px;
  --v1-field-height: 28px;
  --v1-panel-radius: 8px;
  --v1-screener-radius: 9px;
  --v1-positive: #047857;
  --v1-negative: #dc2626;
  --panel-shadow: none;
}

/* V1 compact shell: dark market header, light chart and light screeners. */
:root[data-theme="light"] {
  color-scheme: dark;
  --bg: #0b0d12;
  --panel: #0f1219;
  --panel-soft: #121722;
  --line: #202632;
  --line-soft: #171c25;
  --text: #eef2f7;
  --muted: #8b9099;
  --muted-dim: #5f6672;
  --green: #27d66f;
  --lime: #b5f22d;
  --red: #eb474f;
  --orange: #ff6f0f;
  --blue: #83a9ff;
  --surface-control: #121722;
  --surface-popover: #10151f;
  --surface-active: #171d27;
  --surface-stat: transparent;
  --surface-chart: #ffffff;
  --surface-legend: rgb(255 255 255 / 92%);
  --surface-mode-switch: #080d14;
  --surface-mode-active: #1b2636;
  --surface-floating: #121722;
  --chart-grid: rgb(38 54 75 / 9%);
  --chart-separator: rgb(38 54 75 / 16%);
  --chart-label: rgb(65 78 98 / 82%);
  --chart-target: rgb(91 145 14 / 82%);
  --chart-target-label-bg: #eff8df;
  --chart-target-label-line: #a6ce6f;
  --chart-target-label-text: #557523;
  --chart-price: #356ed4;
  --chart-up: #128a46;
  --chart-down: #c9323b;
  --chart-badge-up: #21b861;
  --chart-badge-down: #e3454f;
  --legend-line: rgb(38 54 75 / 14%);
  --chart-empty-text: #475467;
  --panel-shadow: none;
  --popover-shadow: 0 16px 34px rgb(0 0 0 / 36%);
  --dialog-shadow: 0 24px 70px rgb(0 0 0 / 48%);
}

body {
  min-width: 320px;
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 12px;
  line-height: 1.25;
  text-rendering: optimizeLegibility;
}

body.resizing {
  user-select: none;
}

body.resizing-col {
  cursor: col-resize;
}

.app-shell {
  grid-template-columns: minmax(220px, 1fr) var(--manual-width);
  grid-template-rows: var(--top-row-height) 10px auto;
  gap: 8px;
  padding: 8px 10px 14px;
}

.market-screen,
.manual-panel,
.bottom-zone {
  border: 1px solid var(--line);
  border-radius: var(--v1-panel-radius);
  box-shadow: none;
}

.market-screen {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: visible;
  background: linear-gradient(180deg, #0c0f15 0%, #0b0d12 100%);
  container-name: market-panel;
  container-type: inline-size;
}

.market-header {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(410px, 0.85fr) minmax(0, 1.15fr);
  grid-template-areas: "identity stats";
  column-gap: 16px;
  align-items: center;
  min-width: 0;
  min-height: 64px;
  padding: 8px 12px 7px;
  border-bottom: 1px solid #202938;
  background: linear-gradient(180deg, rgb(18 23 33 / 98%) 0%, rgb(13 17 25 / 98%) 100%);
  box-shadow: inset 0 -1px 0 rgb(255 255 255 / 1.8%);
}

.topbar {
  grid-area: identity;
  justify-content: flex-start;
  gap: 9px;
  min-width: 0;
  padding: 0;
}

.brand {
  min-width: 0;
  flex: 1 1 auto;
  gap: 9px;
}

.coin {
  width: 36px;
  height: 36px;
  margin-right: 0;
  flex: 0 0 36px;
  border: 0;
  border-radius: 9px;
  background: #ff9416;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  transform: rotate(8deg);
  box-shadow: 0 8px 18px rgb(255 111 15 / 11%);
}

.brand-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.title-row {
  min-width: 0;
  gap: 7px;
}

.title {
  overflow: hidden;
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.08;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subtitle {
  overflow: hidden;
  color: #a2a6af;
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.environment-badge {
  margin-left: 0;
  padding: 1px 5px;
  border-color: #293143;
  border-radius: 6px;
  color: #9caeff;
  font-size: 8px;
  letter-spacing: 0;
}

.topbar-actions {
  min-width: 0;
  flex: 0 1 auto;
  gap: 5px;
}

.theme-picker {
  gap: 2px;
  padding: 2px;
  border: 1px solid #273246;
  border-radius: 7px;
  background: #080d14;
}

.theme-option {
  min-height: 26px;
  padding: 4px 6px;
  border-radius: 5px;
  color: #9aa6b8;
  font-size: 9px;
  font-weight: 820;
}

.theme-option:hover {
  color: #fff;
}

.theme-option.active {
  background: #1b2636;
  color: #fff;
  box-shadow: 0 1px 4px rgb(0 0 0 / 22%);
}

.logout-button {
  min-height: 30px;
  padding: 5px 7px;
  border-color: #253044;
  border-radius: 7px;
  background: #121722;
  color: #aeb6c6;
  font-size: 9px;
  font-weight: 780;
}

.market-picker-button {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  min-height: 30px;
  gap: 5px;
  padding: 5px 7px;
  border-color: #253044;
  border-radius: 7px;
  background: #121722;
  color: #d8dde6;
  font-size: 10px;
  font-weight: 760;
  white-space: nowrap;
}

.market-picker-button:hover,
.market-picker-button[aria-expanded="true"] {
  border-color: #334159;
  background: #171d27;
  color: #fff;
}

.market-picker-eyebrow {
  font-size: 9px;
  font-weight: 720;
  letter-spacing: 0;
  text-transform: none;
}

.market-picker-label {
  margin: 0;
  color: #f3f6fb;
  font-size: 11px;
  font-weight: 820;
}

.market-picker-caret {
  position: static;
  color: #7e8794;
  font-size: 9px;
}

.market-picker-panel {
  top: calc(100% + 9px);
  right: 0;
  width: min(360px, calc(100vw - 28px));
  padding: 9px;
  border-color: #253044;
  border-radius: 9px;
  background: #0b1018;
  box-shadow: 0 22px 48px rgb(0 0 0 / 48%);
}

.market-option {
  border-color: #1e2736;
  background: #0f141d;
}

.market-option:hover,
.market-option.active {
  border-color: #2d3a50;
  background: #171d27;
}

.market-picker-panel {
  max-height: min(650px, calc(100vh - 110px));
  overflow: auto;
  overscroll-behavior: contain;
}

.market-history-empty,
.market-history-group-title {
  padding: 7px 8px;
  color: #7e8794;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.market-history-group-title.live {
  color: #29d981;
}

.market-history-day {
  margin-top: 4px;
  border-top: 1px solid #1e2736;
}

.market-history-day summary {
  display: flex;
  min-height: 31px;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  color: #aeb6c6;
  cursor: pointer;
  font-size: 10px;
  font-weight: 760;
  list-style: none;
}

.market-history-day summary::-webkit-details-marker {
  display: none;
}

.market-history-count {
  min-width: 24px;
  padding: 2px 5px;
  border-radius: 999px;
  background: #171d27;
  color: #7e8794;
  text-align: center;
  font-size: 9px;
}

.market-history-rows {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 0 2px 7px;
}

.market-history-option {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 31px;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding: 5px 7px;
  border: 1px solid #1e2736;
  border-radius: 7px;
  background: #0f141d;
  color: #c9d0dc;
  font-size: 9px;
  font-weight: 730;
  text-align: left;
}

.market-history-option:hover,
.market-history-option.active {
  border-color: #334159;
  background: #171d27;
  color: #fff;
}

.market-history-option.active {
  box-shadow: inset 2px 0 0 #4a8dff;
}

.market-history-option:disabled {
  cursor: wait;
  opacity: 0.66;
}

.market-history-time {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-history-status {
  flex: 0 0 auto;
  color: #7e8794;
  font-size: 8px;
}

.market-history-status.live,
.market-history-status.ready {
  color: #29d981;
}

.market-history-status.pending {
  color: #f0aa45;
}

.price-row {
  grid-area: stats;
  display: grid;
  grid-template-columns: repeat(5, minmax(58px, 1fr));
  align-items: center;
  min-width: 0;
  gap: 8px;
  margin: 0;
  overflow: hidden;
}

.stat {
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.stat-label,
.stat.compact .stat-label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.stat-value,
.stat.compact .stat-value {
  overflow: hidden;
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-sub {
  overflow: hidden;
  min-height: 14px;
  margin-top: 4px;
  color: var(--muted-dim);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-shell {
  min-height: 0;
  height: 100%;
  background: var(--surface-chart);
  background-size: auto;
  cursor: crosshair;
}

.chart-y-axis-control {
  position: absolute;
  z-index: 5;
  right: 0;
  width: 104px;
  border: 0;
  outline: none;
  background: transparent;
  cursor: ns-resize;
  touch-action: none;
}

.chart-y-axis-control::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 1px;
  background: transparent;
  transition: background-color 120ms ease, box-shadow 120ms ease;
}

.chart-y-axis-control:hover::after,
.chart-y-axis-control:focus-visible::after,
body.resizing-y-axis .chart-y-axis-control::after {
  background: color-mix(in srgb, var(--blue) 58%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--blue) 12%, transparent);
}

.chart-y-axis-control[hidden] {
  display: none;
}

body.resizing-y-axis,
body.resizing-y-axis * {
  cursor: ns-resize !important;
  user-select: none;
}

.chart-pane-resizer {
  position: absolute;
  z-index: 6;
  top: var(--chart-pane-split, 64%);
  right: 104px;
  left: 16px;
  height: 14px;
  transform: translateY(-50%);
  border: 0;
  outline: none;
  cursor: row-resize;
  touch-action: none;
}

.chart-pane-resizer::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 0;
  left: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--chart-separator);
  transition: background-color 120ms ease, box-shadow 120ms ease;
}

.chart-pane-resizer:hover::after,
.chart-pane-resizer:focus-visible::after,
body.resizing-row .chart-pane-resizer::after {
  background: var(--blue);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--blue) 24%, transparent);
}

.chart-pane-resizer[hidden] {
  display: none;
}

.chart-legend {
  top: 9px;
  left: 10px;
  gap: 8px;
  padding: 4px 7px;
  border-color: var(--legend-line);
  border-radius: 6px;
  background: var(--surface-legend);
  font-size: 9px;
}

.chart-empty strong {
  color: var(--chart-empty-text);
  font-size: 12px;
}

.manual-resizer {
  top: 8px;
  right: calc(var(--manual-width) + 10px);
  width: 10px;
}

.manual-resizer::after,
.horizontal-resizer::after {
  content: "";
  position: absolute;
  border-radius: 2px;
  background: rgb(68 78 93 / 32%);
}

.manual-resizer::after {
  top: 8px;
  bottom: 8px;
  left: 4px;
  width: 2px;
}

.horizontal-resizer {
  position: relative;
}

.horizontal-resizer::after {
  top: 4px;
  right: 8px;
  left: 8px;
  height: 2px;
}

.manual-resizer:hover::after,
.horizontal-resizer:hover::after,
body.resizing .manual-resizer::after,
body.resizing .horizontal-resizer::after {
  background: rgb(131 169 255 / 45%);
}

.manual-panel {
  overflow: hidden;
  background: #080b11;
}

.wallet-manager-top {
  min-height: 40px;
  gap: 10px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  background: #090c12;
}

.wallet-mode-tabs,
.wallet-top-icons {
  gap: 5px;
}

.wallet-mode-tab {
  min-height: 28px;
  padding: 4px 7px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
}

.wallet-mode-tab:hover {
  color: var(--text);
}

.wallet-mode-tab.active {
  border-color: #293143;
  background: #171b25;
  color: #fff;
}

.wallet-top-icons {
  color: #7f8797;
  font-size: 10px;
}

.icon-button,
.wallet-pill,
.trade-mode-button {
  min-height: 28px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #121722;
  color: #c6ccd6;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.icon-button:hover,
.wallet-pill:hover,
.trade-mode-button:hover {
  border-color: #2c394b;
  background: #151b27;
}

.wallet-pill.primary {
  border-color: #5b78ff;
  background: #5b78ff;
  color: #06101f;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.wallet-body {
  grid-template-columns: 196px minmax(0, 1fr);
  background: #090c12;
}

.wallet-rail {
  padding: 7px;
  border-right: 1px solid var(--line);
  background: #080b11;
}

.rail-title {
  margin: 0;
  padding: 6px 7px 2px;
  color: var(--muted-dim);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0;
}

.rail-group-row {
  min-width: 0;
  min-height: 31px;
  gap: 3px;
}

.rail-item {
  min-height: 28px;
  margin: 0;
  padding: 4px 7px;
  border-color: transparent;
  border-radius: 7px;
  background: transparent;
  color: #aeb6c6;
  font-size: 11px;
  font-weight: 760;
}

.rail-item.observe {
  border-left: 0;
}

.rail-item.active {
  border: 1px solid #293143;
  background: #151a24;
  color: #fff;
}

.rail-item.hidden-wallet {
  border-left: 0;
  color: #ff8390;
}

.rail-group-action,
.rail-order-action {
  width: 24px;
  height: 28px;
  flex-basis: 24px;
  border-radius: 6px;
  background: transparent;
}

.count {
  padding: 1px 5px;
  border-radius: 6px;
  background: #111723;
  color: var(--muted);
  font-size: 9px;
  font-weight: 760;
}

.rail-divider {
  margin: 5px 2px 3px;
}

.wallet-rail .wallet-pill {
  margin-top: 4px;
}

.wallet-content {
  overflow: hidden;
  background: #090c12;
}

.wallet-content-head {
  min-height: 42px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  background: #0b0f16;
}

.wallet-content-head strong {
  color: #eef2f7;
  font-size: 12px;
  font-weight: 790;
  line-height: 1.15;
}

#walletManagerSubtitle {
  margin-top: 2px;
  font-size: 10.5px;
  line-height: 1.15;
}

.wallet-chips {
  gap: 4px;
}

.chip,
.panel-count {
  min-height: 20px;
  padding: 2px 7px;
  border: 1px solid #273144;
  border-radius: 6px;
  background: #111723;
  color: #aeb6c7;
  font-size: 10px;
  font-weight: 760;
}

.wallet-registry-summary {
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: #0b0f16;
}

.wallet-summary-card {
  padding: 6px 7px;
  border-color: #273144;
  border-radius: 7px;
  background: #111723;
}

.wallet-toolbar {
  min-height: 40px;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  background: #0b0f16;
}

.wallet-toolbar input,
.table-view-control select {
  min-height: var(--v1-field-height);
  height: var(--v1-field-height);
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #080d14;
  color: var(--text);
  font-size: 10px;
  font-weight: 680;
}

.table-view-control {
  gap: 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 760;
}

.wallet-mutation-status {
  min-width: 120px;
  font-size: 9px;
}

.wallet-pagination {
  min-height: 36px;
  padding: 6px 8px;
  border-top: 1px solid var(--line);
  background: #0b0f16;
  font-size: 10px;
  font-weight: 760;
}

.bottom-zone {
  min-height: 270px;
  overflow: hidden;
  background: #080b11;
}

.panel-head {
  min-height: 46px;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: #090c12;
}

.trade-panel-title-group,
.panel-tools {
  gap: 6px;
}

.trade-mode-switch {
  gap: 4px;
  padding: 3px;
  border: 1px solid #273246;
  border-radius: 7px;
  background: #080d14;
}

.trade-mode-button {
  min-height: 27px;
  border-color: transparent;
  border-radius: 5px;
  background: transparent;
  color: #9aa6b8;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 820;
}

.trade-mode-button.active {
  border-color: transparent;
  background: #1b2636;
  color: #fff;
  box-shadow: 0 1px 4px rgb(0 0 0 / 22%);
}

.quick-filter {
  min-height: 28px;
  gap: 5px;
  padding: 4px 7px;
  border: 1px solid #273246;
  border-radius: 7px;
  background: #080d14;
  color: #9ca5b5;
  font-size: 10px;
  font-weight: 760;
}

.quick-filter.favorite {
  color: #c5ff19;
}

.live-panel-status {
  font-size: 9px;
}

.position-counter-strip {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.position-counter {
  display: inline-flex;
  min-height: 22px;
  gap: 4px;
  align-items: center;
  padding: 3px 6px;
  border: 1px solid #273246;
  border-radius: 6px;
  background: #111723;
  color: #8f9baa;
  font-size: 9px;
  font-weight: 740;
  white-space: nowrap;
}

.position-counter strong {
  color: #dce4ef;
  font-size: 10px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

:root[data-theme="light"] .position-counter {
  border-color: #ccd7e2;
  background: #f5f8fb;
  color: #667480;
}

:root[data-theme="light"] .position-counter strong {
  color: #25333d;
}

.data-table {
  table-layout: fixed;
  border-collapse: collapse;
  border-spacing: 0;
  background: #080b11;
  color: var(--text);
  font-size: 11px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
  height: var(--v1-table-row-height);
  padding: 5px 7px;
  border-right: 0;
  border-bottom: 1px solid #17202c;
  background: #0b1118;
  color: #dbe3ef;
  text-align: center;
  vertical-align: middle;
}

.data-table th {
  height: var(--v1-table-head-height);
  background: #111722;
  color: #f2f5fa;
  font-size: 10.5px;
  font-weight: 820;
  letter-spacing: 0;
}

.data-table tbody tr:nth-child(even) td {
  background: #0c1118;
}

.data-table tbody tr:hover td {
  background: #101621;
}

.data-table [data-column-key="wallet"],
.data-table [data-column-key="wallet"] .table-sort-button {
  text-align: center;
  justify-content: center;
}

.wallet-address {
  color: #8fb1ff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 11px;
  font-weight: 740;
}

.table-sort-button {
  justify-content: center;
  font-weight: 820;
}

.table-sort-button:hover,
.table-sort-button.active {
  color: #83a9ff;
}

.table-column-hidden {
  display: none !important;
}

.data-table th[data-column-key] {
  overflow: visible;
}

.table-column-resizer {
  top: 0;
  right: -5px;
  width: 10px;
  height: 100%;
  background: transparent;
}

.table-column-resizer::after {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 4px;
  width: 2px;
  border-radius: 2px;
  background: rgb(68 78 93 / 42%);
}

.table-column-resizer:hover::after,
.table-column-resizer.active::after,
.table-column-resizer:focus-visible::after {
  background: rgb(131 169 255 / 55%);
}

.table-column-resizer:focus-visible {
  outline: 1px solid rgb(131 169 255 / 75%);
  outline-offset: -2px;
}

@media (max-width: 560px) {
  .table-filters-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .table-filters-grid label:first-child {
    grid-column: auto;
  }
}

.wallet-row-actions {
  justify-content: center;
  gap: 3px;
}

.wallet-row-action,
.wallet-group-select {
  height: 22px;
  min-width: 22px;
  padding: 2px 4px;
  border-color: #293143;
  border-radius: 5px;
  background: #101722;
  color: #9ca5b5;
  font-size: 9.5px;
  font-weight: 760;
  line-height: 1;
}

.wallet-group-select {
  width: 30px;
  max-width: 30px;
  color: transparent;
}

.wallet-group-select option {
  color: var(--text);
}

.wallet-row-action.active[data-wallet-action="favorite"] {
  border-color: rgb(34 197 94 / 70%);
  background: rgb(22 163 74 / 22%);
  color: #fff;
}

.wallet-row-action.active[data-wallet-action="observed"] {
  border-color: rgb(159 122 234 / 64%);
  background: rgb(159 122 234 / 20%);
  color: #fff;
}

.wallet-row-action.active[data-wallet-action="blacklisted"] {
  border-color: rgb(255 58 133 / 52%);
  background: rgb(255 58 133 / 16%);
  color: #fff;
}

.data-table td.data-status,
.lag-cell {
  font-size: 9.5px;
  font-weight: 760;
}

.positive,
.pnl-positive,
.profit {
  color: var(--v1-positive) !important;
  font-weight: 850;
}

.negative,
.pnl-negative,
.loss {
  color: var(--v1-negative) !important;
  font-weight: 850;
}

:root:not([data-theme="light"]) .positive,
:root:not([data-theme="light"]) .pnl-positive,
:root:not([data-theme="light"]) .profit {
  color: #31e07a !important;
}

:root:not([data-theme="light"]) .negative,
:root:not([data-theme="light"]) .pnl-negative,
:root:not([data-theme="light"]) .loss {
  color: #ff5964 !important;
}

.wallet-dialog {
  border-radius: 8px;
  background: #111720;
}

.wallet-dialog form,
.table-columns-dialog > section {
  gap: 10px;
  padding: 12px;
}

.wallet-dialog input,
.wallet-dialog textarea,
.wallet-dialog select {
  min-height: 30px;
  padding: 5px 7px;
  border-radius: 6px;
}

.table-columns-list {
  border-radius: 7px;
}

.table-column-setting {
  min-height: 34px;
  padding: 4px 6px;
  font-size: 11px;
}

.table-column-move {
  height: 24px;
  border-radius: 5px;
}

/* Production V1 compact light screener. */
:root[data-theme="light"] .manual-panel,
:root[data-theme="light"] .bottom-zone,
:root[data-theme="light"] .wallet-dialog {
  color-scheme: light;
  color: #24313b;
}

:root[data-theme="light"] .manual-panel,
:root[data-theme="light"] .bottom-zone {
  border-color: #cfd8e1;
  border-radius: var(--v1-screener-radius);
  background: #f8fafc;
  box-shadow: 0 10px 28px rgb(31 45 61 / 10%);
}

:root[data-theme="light"] .wallet-manager-top,
:root[data-theme="light"] .wallet-toolbar,
:root[data-theme="light"] .wallet-content-head,
:root[data-theme="light"] .panel-head,
:root[data-theme="light"] .wallet-pagination {
  border-color: #dce4eb;
  background: #fff;
  color: #25333d;
}

:root[data-theme="light"] .wallet-mode-tab {
  color: #6c7985;
}

:root[data-theme="light"] .wallet-mode-tab.active,
:root[data-theme="light"] .trade-mode-button.active {
  border-color: #20303a;
  background: #20303a;
  color: #fff;
}

:root[data-theme="light"] .wallet-top-icons {
  color: #6c7985;
}

:root[data-theme="light"] .icon-button,
:root[data-theme="light"] .wallet-pill,
:root[data-theme="light"] .trade-mode-button,
:root[data-theme="light"] .rail-group-action,
:root[data-theme="light"] .rail-order-action {
  border-color: #cbd6df;
  background: #fff;
  color: #25333d;
}

:root[data-theme="light"] .icon-button:hover,
:root[data-theme="light"] .wallet-pill:hover,
:root[data-theme="light"] .trade-mode-button:hover,
:root[data-theme="light"] .rail-group-action:hover,
:root[data-theme="light"] .rail-order-action:hover {
  border-color: #9db1c4;
  background: #f3f7fb;
}

:root[data-theme="light"] .wallet-pill.primary {
  border-color: #1d4ed8;
  background: #1d4ed8;
  color: #fff;
}

:root[data-theme="light"] .wallet-body,
:root[data-theme="light"] .wallet-content,
:root[data-theme="light"] .wallet-rail {
  background: #fff;
}

:root[data-theme="light"] .wallet-rail {
  border-right-color: #dce4eb;
  scrollbar-color: #b8c1ca #eef2f5;
}

:root[data-theme="light"] .rail-title {
  color: #7b8792;
}

:root[data-theme="light"] .rail-divider {
  background: #e2e8ef;
}

:root[data-theme="light"] .rail-item {
  color: #3d4c57;
}

:root[data-theme="light"] .rail-item.active {
  border-color: #20303a;
  background: #20303a;
  color: #fff;
}

:root[data-theme="light"] .rail-item.hidden-wallet {
  color: #dc2626;
}

:root[data-theme="light"] .count {
  border-color: #d2dce5;
  background: #fff;
  color: #7b8792;
}

:root[data-theme="light"] .wallet-content-head strong {
  color: #25333d;
}

:root[data-theme="light"] #walletManagerSubtitle,
:root[data-theme="light"] .wallet-mutation-status,
:root[data-theme="light"] .wallet-pagination {
  color: #73818d;
}

:root[data-theme="light"] .chip,
:root[data-theme="light"] .panel-count {
  border-color: #d2dce5;
  background: #fff;
  color: #60707c;
}

:root[data-theme="light"] .chip.blue {
  border-color: #b7caee;
  background: #eaf2ff;
  color: #1d4ed8;
}

:root[data-theme="light"] .chip.green {
  border-color: #9fd3bb;
  background: #edf9f3;
  color: #047857;
}

:root[data-theme="light"] .wallet-registry-summary {
  border-color: #dce4eb;
  background: #f3f6f9;
}

:root[data-theme="light"] .wallet-summary-card {
  border-color: #dce5ed;
  background: #fff;
}

:root[data-theme="light"] .wallet-summary-card span {
  color: #6d7c89;
}

:root[data-theme="light"] .wallet-summary-card strong {
  color: #25333d;
}

:root[data-theme="light"] .wallet-toolbar input,
:root[data-theme="light"] .table-view-control select {
  border-color: #cbd6df;
  background: #fff;
  color: #24313b;
}

:root[data-theme="light"] .table-view-control {
  color: #667480;
}

:root[data-theme="light"] .trade-mode-switch,
:root[data-theme="light"] .quick-filter {
  border-color: #cbd6df;
  background: #f3f6f9;
  color: #53626e;
}

:root[data-theme="light"] .quick-filter.favorite {
  border-color: #b7caee;
  background: #eaf2ff;
  color: #1d4ed8;
}

:root[data-theme="light"] .live-panel-status {
  color: #667480;
}

:root[data-theme="light"] .data-table {
  background: #fff;
  color: #26333e;
  font-size: 11px;
  line-height: 1.15;
}

:root[data-theme="light"] .data-table th,
:root[data-theme="light"] .data-table td {
  border-bottom-color: #e3e8ed;
  background: #fff;
  color: #26333e;
}

:root[data-theme="light"] .data-table th {
  border-bottom-color: #d9e1e8;
  background: #f1f4f7;
  color: #44515d;
  font-size: 10.5px;
}

:root[data-theme="light"] .data-table tbody tr:nth-child(even) td {
  background: #fafbfc;
}

:root[data-theme="light"] .data-table tbody tr:hover td {
  background: #f3f8ff;
}

:root[data-theme="light"] .wallet-address,
:root[data-theme="light"] .transaction-link,
:root[data-theme="light"] .table-sort-button:hover,
:root[data-theme="light"] .table-sort-button.active {
  color: #0b63ce;
}

:root[data-theme="light"] .table-column-resizer::after {
  background: rgb(148 163 184 / 54%);
}

:root[data-theme="light"] .table-column-resizer:hover::after,
:root[data-theme="light"] body.resizing .table-column-resizer::after {
  background: rgb(37 99 235 / 72%);
}

:root[data-theme="light"] .wallet-row-action,
:root[data-theme="light"] .wallet-group-select {
  border-color: #cbd6df;
  background: #fff;
  color: #53626e;
}

:root[data-theme="light"] .wallet-group-select {
  color: transparent;
}

:root[data-theme="light"] .wallet-group-select option {
  color: #24313b;
}

:root[data-theme="light"] .wallet-row-action.active[data-wallet-action="favorite"] {
  border-color: #059669;
  background: #059669;
  color: #fff;
}

:root[data-theme="light"] .wallet-row-action.active[data-wallet-action="observed"] {
  border-color: #7c3aed;
  background: #7c3aed;
  color: #fff;
}

:root[data-theme="light"] .wallet-row-action.active[data-wallet-action="blacklisted"] {
  border-color: #dc2626;
  background: #dc2626;
  color: #fff;
}

:root[data-theme="light"] .data-table td.data-status.incomplete,
:root[data-theme="light"] .lag-cell.stale {
  color: #d97706;
}

:root[data-theme="light"] .data-table td.data-status.complete {
  color: #047857;
}

:root[data-theme="light"] .data-table td.data-status.live {
  color: #0369a1;
}

:root[data-theme="light"] .data-table td.green {
  color: #047857;
}

:root[data-theme="light"] .data-table td.red {
  color: #dc2626;
}

:root[data-theme="light"] .wallet-dialog {
  border-color: #cbd6df;
  background: #f8fafc;
  box-shadow: 0 18px 42px rgb(17 28 41 / 22%);
}

:root[data-theme="light"] .wallet-dialog input,
:root[data-theme="light"] .wallet-dialog textarea,
:root[data-theme="light"] .wallet-dialog select,
:root[data-theme="light"] .table-columns-list {
  border-color: #cbd6df;
  background: #fff;
  color: #24313b;
}

:root[data-theme="light"] .table-column-setting {
  border-color: #dbe5ef;
  background: #fff;
}

:root[data-theme="light"] .wallet-dialog.table-columns-dialog .table-column-setting label span {
  color: #24313b;
}

:root[data-theme="light"] .wallet-dialog.table-columns-dialog .table-column-setting.locked {
  background: #f5f7fa;
  opacity: 1;
}

:root[data-theme="light"] .wallet-dialog.table-columns-dialog .table-column-setting.locked label span {
  color: #667085;
}

:root[data-theme="light"] .table-column-move {
  border-color: #cbd6df;
  background: #fff;
  color: #53626e;
}

:root[data-theme="light"] .wallet-pill.active {
  border-color: #8fb4f5;
  background: #e8f1ff;
  color: #1759b4;
}

/* Login is new in V2, so it uses the same dense V1 tokens rather than a new visual language. */
.login-screen {
  padding: 16px;
  background: #0b0d12;
}

.login-card {
  width: min(100%, 360px);
  padding: 22px;
  border-color: #202632;
  border-radius: 8px;
  background: #0f1219;
  box-shadow: 0 18px 48px rgb(0 0 0 / 34%);
}

.login-brand {
  width: 42px;
  height: 42px;
  margin-bottom: 16px;
  border: 0;
  border-radius: 9px;
  background: #ff9416;
  color: #fff;
  font-size: 24px;
  transform: rotate(8deg);
}

.login-heading > span {
  color: #83a9ff;
  font-size: 9px;
  letter-spacing: 0.08em;
}

.login-heading h1 {
  margin: 5px 0 6px;
  font-size: 20px;
  font-weight: 720;
  letter-spacing: 0;
}

.login-heading p {
  margin-bottom: 18px;
  font-size: 11px;
  line-height: 1.35;
}

.login-form {
  gap: 7px;
}

.login-form input {
  height: 36px;
  padding: 0 9px;
  border-color: #293143;
  border-radius: 7px;
  background: #080d14;
  font-size: 12px;
}

.login-submit {
  height: 34px;
  border-color: #5b78ff;
  border-radius: 7px;
  background: #5b78ff;
  color: #06101f;
  font-size: 11px;
  font-weight: 800;
}

.login-security {
  margin-top: 14px;
  font-size: 9px;
}

@media (max-width: 1180px) {
  .market-header {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "identity"
      "stats";
    row-gap: 7px;
  }

  .topbar {
    justify-content: space-between;
  }

  .price-row {
    grid-template-columns: repeat(5, minmax(90px, 1fr));
  }
}

@media (max-width: 820px) {
  .market-screen,
  .manual-panel {
    min-height: 620px;
  }

  .market-header {
    padding: 10px 12px;
  }

  .topbar,
  .wallet-manager-top,
  .panel-head {
    align-items: flex-start;
  }

  .price-row {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .price-row .stat:nth-child(5) {
    grid-column: 1 / -1;
  }
}

/*
 * V1 live-table contract.
 * These selectors are deliberately limited to "Все трейды" and "Все позиции":
 * the V2 read models and the wallet registry keep their own behaviour while the
 * two market tables inherit the compact V1 terminal presentation.
 */
:root {
  --terminal-table-head-bg: #111722;
  --terminal-table-head-text: #dce4ef;
  --terminal-table-row-bg: #0b1118;
  --terminal-table-row-alt-bg: #0c121a;
  --terminal-table-row-hover-bg: #121b27;
  --terminal-table-up-bg: #0c1d17;
  --terminal-table-up-hover-bg: #10271e;
  --terminal-table-down-bg: #211316;
  --terminal-table-down-hover-bg: #2a171b;
  --terminal-table-grid: #202a37;
  --terminal-table-major-grid: #6d5c18;
  --terminal-table-text: #d7e0eb;
  --terminal-table-muted: #8f9baa;
  --terminal-table-wallet: #8fb1ff;
  --terminal-table-up: #31df79;
  --terminal-table-down: #ff5964;
  --terminal-table-action-bg: #101722;
  --terminal-table-action-line: #334052;
}

:root[data-theme="light"] {
  --terminal-table-head-bg: #eef2f6;
  --terminal-table-head-text: #465563;
  --terminal-table-row-bg: #ffffff;
  --terminal-table-row-alt-bg: #fafcfd;
  --terminal-table-row-hover-bg: #f1f6fb;
  --terminal-table-up-bg: #edf9f3;
  --terminal-table-up-hover-bg: #e4f5ec;
  --terminal-table-down-bg: #fff0f1;
  --terminal-table-down-hover-bg: #fee7e9;
  --terminal-table-grid: #dbe3ea;
  --terminal-table-major-grid: #e4bd12;
  --terminal-table-text: #34424d;
  --terminal-table-muted: #82909c;
  --terminal-table-wallet: #0b63ce;
  --terminal-table-up: #0a9b50;
  --terminal-table-down: #e12c36;
  --terminal-table-action-bg: #ffffff;
  --terminal-table-action-line: #cbd7e1;
}

:is(#tradeTable, #positionTable).terminal-table {
  font-size: 11px;
  line-height: 1.1;
}

:is(#tradeTable, #positionTable).terminal-table th,
:is(#tradeTable, #positionTable).terminal-table td {
  height: var(--v1-table-row-height);
  padding: 4px 7px;
  overflow: hidden;
  border-right: 1px solid var(--terminal-table-grid);
  border-bottom: 1px solid var(--terminal-table-grid);
  background: var(--terminal-table-row-bg);
  color: var(--terminal-table-text);
  font-weight: 650;
  text-align: center;
  text-overflow: ellipsis;
  vertical-align: middle;
}

:is(#tradeTable, #positionTable).terminal-table th {
  height: var(--v1-table-head-height);
  padding-block: 3px;
  background: var(--terminal-table-head-bg);
  color: var(--terminal-table-head-text);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0;
}

:is(#tradeTable, #positionTable).terminal-table tbody tr:nth-child(even) > td {
  background: var(--terminal-table-row-alt-bg);
}

:is(#tradeTable, #positionTable).terminal-table tbody tr.terminal-row-up > td,
:is(#tradeTable, #positionTable).terminal-table tbody tr.terminal-row-up:nth-child(even) > td {
  background: var(--terminal-table-up-bg);
}

:is(#tradeTable, #positionTable).terminal-table tbody tr.terminal-row-down > td,
:is(#tradeTable, #positionTable).terminal-table tbody tr.terminal-row-down:nth-child(even) > td {
  background: var(--terminal-table-down-bg);
}

:is(#tradeTable, #positionTable).terminal-table tbody tr:hover > td {
  background: var(--terminal-table-row-hover-bg);
}

:is(#tradeTable, #positionTable).terminal-table tbody tr.terminal-row-up:hover > td {
  background: var(--terminal-table-up-hover-bg);
}

:is(#tradeTable, #positionTable).terminal-table tbody tr.terminal-row-down:hover > td {
  background: var(--terminal-table-down-hover-bg);
}

:is(#tradeTable, #positionTable).terminal-table [data-column-key="wallet"] {
  color: var(--terminal-table-wallet);
  font-weight: 780;
  text-align: left;
}

:is(#tradeTable, #positionTable).terminal-table [data-column-key="wallet"] .table-sort-button {
  justify-content: center;
}

:is(#tradeTable, #positionTable).terminal-table .wallet-address {
  color: var(--terminal-table-wallet);
  font-size: 11px;
  font-weight: 780;
}

:is(#tradeTable, #positionTable).terminal-table .terminal-outcome,
:is(#tradeTable, #positionTable).terminal-table .terminal-side,
:is(#tradeTable, #positionTable).terminal-table .green,
:is(#tradeTable, #positionTable).terminal-table .red,
:is(#tradeTable, #positionTable).terminal-table .btc30-positive,
:is(#tradeTable, #positionTable).terminal-table .btc30-negative {
  font-weight: 820;
}

:is(#tradeTable, #positionTable).terminal-table .terminal-outcome::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 1px rgb(255 255 255 / 42%);
  vertical-align: -1px;
}

:is(#tradeTable, #positionTable).terminal-table .terminal-outcome-up,
:is(#tradeTable, #positionTable).terminal-table .terminal-side-buy,
:is(#tradeTable, #positionTable).terminal-table .green {
  color: var(--terminal-table-up) !important;
}

:is(#tradeTable, #positionTable).terminal-table .terminal-outcome-down,
:is(#tradeTable, #positionTable).terminal-table .terminal-side-sell,
:is(#tradeTable, #positionTable).terminal-table .red {
  color: var(--terminal-table-down) !important;
}

:is(#tradeTable, #positionTable).terminal-table [data-column-key="wallet"],
:is(#tradeTable, #positionTable).terminal-table [data-column-key="side"],
:is(#tradeTable, #positionTable).terminal-table [data-column-key="outcome"],
:is(#tradeTable, #positionTable).terminal-table [data-column-key="actions"] {
  border-left: 2px solid var(--terminal-table-major-grid);
}

:is(#tradeTable, #positionTable).terminal-table .transaction-link {
  display: inline-flex;
  min-height: 21px;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border: 1px solid var(--terminal-table-action-line);
  border-radius: 5px;
  background: var(--terminal-table-action-bg);
  color: var(--terminal-table-wallet);
  font-size: 10px;
  font-weight: 780;
  line-height: 1;
  text-decoration: none;
}

:is(#tradeTable, #positionTable).terminal-table .transaction-link:hover {
  border-color: var(--terminal-table-wallet);
  text-decoration: none;
}

:is(#tradeTable, #positionTable).terminal-table td.data-status,
:is(#tradeTable, #positionTable).terminal-table .lag-cell {
  color: var(--terminal-table-muted);
  font-size: 9.5px;
  font-weight: 740;
}

:is(#tradeTable, #positionTable).terminal-table .empty-cell {
  background: var(--terminal-table-row-bg) !important;
  color: var(--terminal-table-muted);
}

/* The graph header follows its resizable panel, not only the browser viewport. */
@container market-panel (max-width: 980px) {
  .market-header {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "identity"
      "stats";
    row-gap: 7px;
    padding: 8px 10px;
  }

  .topbar {
    justify-content: space-between;
  }

  .price-row {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    overflow: visible;
  }

  .stat-label,
  .stat.compact .stat-label {
    margin-bottom: 3px;
    font-size: 10px;
  }

  .stat-value,
  .stat.compact .stat-value {
    font-size: 14px;
  }
}

@container market-panel (max-width: 480px) {
  .market-header {
    row-gap: 6px;
    padding: 7px 8px;
  }

  .topbar,
  .brand {
    gap: 6px;
  }

  .coin {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
    border-radius: 7px;
    font-size: 18px;
  }

  .title {
    font-size: 14px;
  }

  .environment-badge,
  .market-picker-eyebrow {
    display: none;
  }

  .topbar-actions {
    gap: 3px;
  }

  .theme-option {
    width: 24px;
    min-height: 26px;
    padding: 3px;
    font-size: 0;
  }

  .theme-option > span {
    font-size: 10px;
  }

  .logout-button,
  .market-picker-button {
    min-height: 28px;
    padding: 4px 5px;
    font-size: 8px;
  }

  .market-picker-label {
    font-size: 9px;
  }

  .price-row {
    gap: 4px;
  }

  .stat-label,
  .stat.compact .stat-label {
    font-size: 9px;
  }

  .stat-value,
  .stat.compact .stat-value {
    font-size: 13px;
  }
}

@container market-panel (max-width: 340px) {
  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    row-gap: 5px;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

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

  .price-row .stat:nth-child(5) {
    grid-column: 1 / -1;
  }
}

/* V1 splitter contract: every visible handle changes a real panel dimension. */
body.resizing-row {
  cursor: row-resize;
}

.manual-resizer {
  position: relative;
  grid-area: wallet;
  align-self: stretch;
  justify-self: start;
  z-index: 12;
  top: auto;
  right: auto;
  width: 10px;
  height: auto;
  margin-left: -9px;
  touch-action: none;
}

.horizontal-resizer,
.position-pane-resizer,
.position-diagram-resize-handle,
.btc1d-market-resizer {
  touch-action: none;
}

.position-workspace {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  align-items: stretch;
  overflow: hidden;
  background: #080b11;
}

.position-table-pane {
  display: flex;
  flex: 1 1 var(--position-table-pane-width, 72%);
  width: var(--position-table-pane-width, 72%);
  min-width: 380px;
  max-width: calc(100% - 230px);
  min-height: 0;
  overflow: hidden;
}

.position-table-pane .position-scroll {
  width: 100%;
}

.position-pane-resizer {
  position: relative;
  flex: 0 0 10px;
  z-index: 7;
  border-right: 1px solid #17202c;
  border-left: 1px solid #17202c;
  background: #090c12;
  cursor: col-resize;
}

.position-pane-resizer::after {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 3px;
  width: 2px;
  border-radius: 2px;
  background: rgb(68 78 93 / 42%);
}

.position-pane-resizer:hover::after,
body.resizing .position-pane-resizer::after {
  background: rgb(131 169 255 / 58%);
}

.position-diagram-pane {
  --position-up: #45ad79;
  --position-down: #d4636a;
  --position-card: #111722;
  --position-soft: #171e29;
  --position-border: #303b4d;
  position: relative;
  flex: 0 0 var(--position-diagram-pane-width, 260px);
  width: var(--position-diagram-pane-width, 260px);
  min-width: 220px;
  max-width: min(640px, calc(100% - 390px));
  min-height: 0;
  overflow: auto;
  background: #080b11;
  container-name: position-diagram;
  container-type: inline-size;
}

.position-diagram-panel {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  padding: 5px;
}

.position-donut-grid {
  display: grid;
  gap: 5px;
}

.position-summary-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--position-border);
  border-radius: 8px;
  background: var(--position-card);
}

.position-summary-head {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.position-summary-head strong {
  color: #dbe3ef;
  font-size: 13px;
  font-weight: 850;
}

.position-summary-head span {
  overflow: hidden;
  color: #8b96a8;
  font-size: 10.5px;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.position-summary-main {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.position-donut {
  display: grid;
  width: 76px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(
    var(--position-up) 0 var(--position-donut-up, 0deg),
    var(--position-down) var(--position-donut-up, 0deg) 360deg
  );
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 6%);
}

.position-donut.empty {
  background: #26303d;
}

:root[data-theme="light"] .position-donut.empty {
  background: #dce4eb;
}

.position-donut::after {
  content: "";
  grid-area: 1 / 1;
  width: 62%;
  aspect-ratio: 1;
  border: 1px solid var(--position-border);
  border-radius: 50%;
  background: var(--position-card);
}

.position-donut-center {
  display: grid;
  grid-area: 1 / 1;
  z-index: 1;
  justify-items: center;
  line-height: 1.05;
}

.position-donut-center strong {
  color: #dbe3ef;
  font-size: 18px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.position-donut-center small {
  color: #8b96a8;
  font-size: 9px;
  font-weight: 780;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.position-side-summary {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.position-side-line {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-width: 0;
  color: #8b96a8;
  font-size: 10.5px;
}

.position-side-line > span {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  font-weight: 820;
}

.position-side-line > span:first-child {
  font-size: 11.5px;
}

.position-side-line.up > span:first-child {
  color: var(--position-up);
}

.position-side-line.down > span:first-child {
  color: var(--position-down);
}

.position-side-line i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.position-side-line.up i {
  background: var(--position-up);
}

.position-side-line.down i {
  background: var(--position-down);
}

.position-side-values {
  display: grid !important;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: 5px !important;
  align-items: baseline !important;
  min-width: 0;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.position-side-values strong {
  overflow: hidden;
  color: #dbe3ef;
  font-size: 11.5px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.position-side-values small {
  overflow: hidden;
  color: #78859a;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.position-scenario-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid rgb(74 89 111 / 42%);
}

.position-scenario-grid > div {
  display: flex;
  gap: 6px;
  align-items: baseline;
  justify-content: space-between;
  min-width: 0;
  padding: 6px 7px;
  border-radius: 6px;
  background: var(--position-soft);
}

.position-scenario-grid span {
  overflow: hidden;
  font-size: 10px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.position-scenario-grid > .up span,
.position-scenario-grid > .down span {
  color: var(--text);
}

.position-scenario-grid strong {
  color: #dbe3ef;
  font-size: 12px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.position-scenario-grid strong.green {
  color: var(--position-up);
}

.position-scenario-grid strong.red {
  color: var(--position-down);
}

.position-diagram-pane.wide .position-summary-main {
  grid-template-columns: 84px minmax(0, 1fr);
}

.position-diagram-pane.wide .position-donut {
  width: 80px;
}

.position-diagram-pane.large .position-donut {
  width: 84px;
}

.position-diagram-pane.large .position-summary-main {
  grid-template-columns: 88px minmax(0, 1fr);
}

.position-workspace.diagrams-hidden .position-table-pane {
  flex: 1 1 100% !important;
  width: 100% !important;
  max-width: none;
}

.position-workspace.diagrams-hidden .position-pane-resizer,
.position-workspace.diagrams-hidden .position-diagram-pane {
  display: none !important;
}

@container position-diagram (max-width: 280px) {
  .position-summary-main {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
  }

  .position-donut {
    width: 70px;
    margin-inline: auto;
  }

  .position-side-line {
    grid-template-columns: 54px minmax(0, 1fr);
  }
}

.position-diagram-resize-handle {
  position: absolute;
  right: 5px;
  bottom: 5px;
  z-index: 8;
  width: 18px;
  height: 18px;
  border: 1px solid rgb(131 169 255 / 36%);
  border-radius: 5px;
  background:
    linear-gradient(135deg, transparent 0 45%, rgb(131 169 255 / 72%) 46% 54%, transparent 55%),
    linear-gradient(135deg, transparent 0 62%, rgb(131 169 255 / 52%) 63% 70%, transparent 71%),
    rgb(16 23 34 / 88%);
  cursor: nesw-resize;
  opacity: 0.82;
}

.position-diagram-resize-handle:hover,
body.resizing .position-diagram-resize-handle {
  border-color: rgb(131 169 255 / 72%);
  opacity: 1;
}

.btc1d-daily-layout {
  display: grid;
  flex: 1;
  min-width: 0;
  min-height: 0;
  grid-template-columns: var(--btc1d-market-width, 440px) minmax(0, 1fr);
  overflow: hidden;
  background: #080b11;
}

.btc1d-market-panel {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  padding: 8px 10px;
  border-right: 1px solid var(--line);
  background: #090c12;
}

.btc1d-market-heading {
  display: flex;
  min-height: 30px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line-soft);
}

.btc1d-market-heading strong {
  font-size: 11px;
  font-weight: 850;
}

.btc1d-market-heading span {
  color: var(--muted);
  font-size: 9px;
}

.btc1d-market-list {
  display: grid;
  flex: 1;
  align-content: start;
  gap: 5px;
  padding-top: 8px;
  overflow: auto;
}

.btc1d-range-presets {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
  padding: 7px 0 5px;
}

.btc1d-range-presets button,
.btc1d-date-range button,
.btc1d-market-foot button {
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-control);
  color: var(--muted);
  font: inherit;
  font-size: 9px;
  font-weight: 760;
  cursor: pointer;
}

.btc1d-range-presets button:hover,
.btc1d-range-presets button.active,
.btc1d-date-range button:hover,
.btc1d-market-foot button:hover {
  border-color: #5478ad;
  color: var(--text);
  background: #172335;
}

.btc1d-date-range {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 4px;
  align-items: end;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line-soft);
}

.btc1d-date-range label {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 720;
}

.btc1d-date-range input,
.btc1d-detail-tools input,
.btc1d-detail-tools select {
  min-width: 0;
  height: 26px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  outline: none;
  background: var(--surface-control);
  color: var(--text);
  font: inherit;
  font-size: 9px;
  font-weight: 650;
}

.btc1d-date-range input:focus,
.btc1d-detail-tools input:focus,
.btc1d-detail-tools select:focus {
  border-color: #5c83bb;
  box-shadow: 0 0 0 1px rgb(92 131 187 / 22%);
}

.btc1d-market-day {
  display: grid;
  gap: 3px;
}

.btc1d-market-day-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 28px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101620;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.btc1d-market-day-head.active {
  border-color: #587db4;
  background: #18263a;
}

.btc1d-market-day-head strong {
  font-size: 10px;
}

.btc1d-market-day-head span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
}

.btc1d-market-chip {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 72px;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  width: 100%;
  padding: 3px 7px 3px 10px;
  border: 0;
  border-left: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.btc1d-market-chip:hover,
.btc1d-market-chip.active {
  border-left-color: #6d97d4;
  background: rgb(49 74 109 / 28%);
  color: var(--text);
}

.btc1d-market-chip .time {
  font-size: 9px;
  font-weight: 790;
}

.btc1d-market-chip .wallets {
  overflow: hidden;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btc1d-market-chip .value {
  font-size: 9px;
  font-weight: 760;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.btc1d-market-chip .value.positive { color: var(--up); }
.btc1d-market-chip .value.negative { color: var(--down); }
.btc1d-market-chip.pending { opacity: 0.58; }

.btc1d-market-foot {
  display: flex;
  min-height: 30px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--line-soft);
}

.btc1d-market-foot span {
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btc1d-market-empty {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-control);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.btc1d-market-detail {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  background: #080b11;
}

.btc1d-detail-head {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  background: #0d121b;
}

.btc1d-detail-head > div:first-child {
  display: grid;
  min-width: 150px;
  gap: 2px;
}

.btc1d-detail-head strong { font-size: 11px; }
.btc1d-detail-head span { color: var(--muted); font-size: 8px; }

.btc1d-detail-tools {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.btc1d-detail-tools #btc1dSearch { width: 150px; }
.btc1d-detail-tools input[type="number"] { width: 76px; }
.btc1d-detail-tools select { width: 104px; }

.btc1d-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, 1fr));
  gap: 1px;
  border-bottom: 1px solid var(--line);
  background: var(--line-soft);
}

.btc1d-summary-strip > div {
  display: flex;
  min-height: 31px;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 9px;
  background: #0d121b;
}

.btc1d-summary-strip span { color: var(--muted); font-size: 8px; font-weight: 720; }
.btc1d-summary-strip strong { font-size: 10px; font-variant-numeric: tabular-nums; }

.btc1d-table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.btc1d-table {
  min-width: 1118px;
  table-layout: fixed;
}

.btc1d-table tbody tr {
  cursor: default;
}

.btc1d-table tbody tr.btc1d-positive { background: rgb(22 113 76 / 13%); }
.btc1d-table tbody tr.btc1d-negative { background: rgb(160 46 57 / 13%); }
.btc1d-table .positive { color: var(--up); }
.btc1d-table .negative { color: var(--down); }
.btc1d-table .wallet-profile-link {
  color: #7dacff;
  font-weight: 780;
}

.btc1d-data-status {
  display: inline-flex;
  padding: 2px 5px;
  border: 1px solid #6a5532;
  border-radius: 5px;
  color: #d8ae65;
  font-size: 8px;
  font-weight: 730;
}

.btc1d-wallet-drilldown {
  max-height: 180px;
  padding: 7px 9px;
  border-top: 1px solid var(--line);
  overflow: auto;
  background: #0d121b;
}

.btc1d-drill-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
  font-size: 9px;
}

.btc1d-drill-head button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.btc1d-drill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 4px;
}

.btc1d-drill-item {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 5px;
  padding: 4px 6px;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  color: var(--muted);
  font-size: 8px;
}

.btc1d-drill-item strong { color: var(--text); }
.btc1d-drill-item .positive { color: var(--up); }
.btc1d-drill-item .negative { color: var(--down); }

.btc1d-pagination {
  border-top: 1px solid var(--line);
}

.btc1d-market-resizer {
  position: absolute;
  z-index: 9;
  top: 0;
  right: -5px;
  bottom: 0;
  width: 10px;
  cursor: col-resize;
}

.btc1d-market-resizer::after {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 4px;
  width: 2px;
  border-radius: 999px;
  background: transparent;
}

.btc1d-market-resizer:hover::after,
body.resizing-col .btc1d-market-resizer::after {
  background: rgb(131 169 255 / 58%);
}

:root[data-theme="light"] .position-workspace,
:root[data-theme="light"] .position-diagram-pane,
:root[data-theme="light"] .position-diagram-panel,
:root[data-theme="light"] .btc1d-daily-layout {
  background: #fff;
}

:root[data-theme="light"] .position-diagram-pane {
  --position-up: #33845c;
  --position-down: #b9565d;
  --position-card: #fff;
  --position-soft: #f1f4f7;
  --position-border: #d5dde6;
}

:root[data-theme="light"] .btc1d-market-detail,
:root[data-theme="light"] .btc1d-detail-head,
:root[data-theme="light"] .btc1d-summary-strip > div,
:root[data-theme="light"] .btc1d-wallet-drilldown {
  background: #fff;
}

:root[data-theme="light"] .btc1d-market-day-head {
  background: #f3f6f9;
}

:root[data-theme="light"] .btc1d-market-day-head.active,
:root[data-theme="light"] .btc1d-range-presets button.active {
  background: #e6eef8;
}

:root[data-theme="light"] .position-pane-resizer,
:root[data-theme="light"] .btc1d-market-panel {
  border-color: #dce4eb;
  background: #f8fafc;
}

:root[data-theme="light"] .position-summary-card,
:root[data-theme="light"] .position-donut::after {
  border-color: #cfd8e1;
  background: #fff;
}

:root[data-theme="light"] .position-donut-center strong,
:root[data-theme="light"] .position-summary-head strong,
:root[data-theme="light"] .position-side-values strong,
:root[data-theme="light"] .position-scenario-grid strong {
  color: #25333d;
}

:root[data-theme="light"] .position-donut-center small,
:root[data-theme="light"] .position-summary-head span,
:root[data-theme="light"] .position-side-line,
:root[data-theme="light"] .position-side-values small {
  color: #667480;
}

:root[data-theme="light"] .position-scenario-grid > div {
  background: var(--position-soft);
}

:root[data-theme="light"] .position-scenario-grid > .up span,
:root[data-theme="light"] .position-scenario-grid > .down span {
  color: #25333d;
}

:root[data-theme="light"] .position-scenario-grid strong.green {
  color: var(--position-up);
}

:root[data-theme="light"] .position-scenario-grid strong.red {
  color: var(--position-down);
}

@media (max-width: 1180px) {
  .btc1d-daily-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(240px, 1fr);
  }

  .btc1d-market-panel {
    max-height: 190px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .btc1d-market-resizer {
    display: none;
  }
}

@media (max-width: 820px) {
  .position-workspace {
    flex-direction: column;
    overflow: visible;
  }

  .position-table-pane,
  .position-diagram-pane {
    width: 100% !important;
    min-width: 0;
    max-width: none;
    flex-basis: auto !important;
  }

  .position-table-pane {
    min-height: 300px;
  }

  .position-diagram-pane {
    min-height: 220px;
  }

  .position-pane-resizer,
  .position-diagram-resize-handle {
    display: none;
  }
}
