:root {
  color-scheme: dark;
  --ink: #f3f4f6;
  --ink-soft: #d1d5db;
  --muted: #9ca3af;
  --faint: #6b7280;
  --line: rgb(255 255 255 / 6%);
  --line-strong: rgb(255 255 255 / 12%);
  --surface: #101720;
  --surface-alt: #0d131b;
  --canvas: #070a0f;
  --rail: #0a0e14;
  --rail-hover: rgb(255 255 255 / 6%);
  --green: #00e096;
  --green-soft: rgb(0 224 150 / 10%);
  --red: #ff4d6d;
  --red-soft: rgb(255 77 109 / 10%);
  --amber: #f5b942;
  --amber-soft: rgb(245 185 66 / 10%);
  --blue: #00d9ff;
  --blue-soft: rgb(0 217 255 / 10%);
  --violet: #8b7cff;
  --cyan: #00d9ff;
  --radius: 7px;
  --rail-width: 176px;
  --command-height: 68px;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--canvas);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  margin: 0;
  min-width: 320px;
}

button,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  font-weight: 720;
  line-height: 1.2;
}

h2 {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.25;
}

.app-rail {
  align-items: stretch;
  background: var(--rail);
  bottom: 0;
  color: #fff;
  display: flex;
  flex-direction: column;
  left: 0;
  padding: 18px 10px;
  position: fixed;
  top: 0;
  width: var(--rail-width);
  z-index: 30;
}

.logo {
  align-items: center;
  color: #fff;
  display: flex;
  flex-direction: row;
  gap: 7px;
  text-decoration: none;
}

.logo-mark {
  align-items: center;
  background: var(--cyan);
  border-radius: 5px;
  color: var(--rail);
  display: flex;
  font-size: 16px;
  font-weight: 800;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.logo-type {
  color: #f3f4f6;
  font-size: 14px;
  font-weight: 720;
}

.rail-nav {
  display: grid;
  gap: 5px;
  margin-top: 38px;
  width: 100%;
}

.rail-link {
  align-items: center;
  border-radius: 6px;
  color: #858c96;
  display: flex;
  flex-direction: row;
  font-size: 11px;
  gap: 11px;
  justify-content: flex-start;
  min-height: 44px;
  padding: 0 12px;
  position: relative;
  text-decoration: none;
  transition:
    background-color 120ms ease,
    color 120ms ease;
}

.rail-link svg {
  height: 19px;
  width: 19px;
}

.rail-link:hover,
.rail-link.active {
  background: var(--rail-hover);
  color: #fff;
}

.rail-link.active::before {
  background: #52cbaa;
  border-radius: 0 2px 2px 0;
  content: "";
  height: 24px;
  left: -10px;
  position: absolute;
  width: 3px;
}

.rail-link::after {
  background: #2d3035;
  border-radius: 4px;
  color: #fff;
  content: attr(data-tooltip);
  font-size: 11px;
  left: 69px;
  opacity: 0;
  padding: 6px 8px;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translate(-4px, -50%);
  transition:
    opacity 120ms ease,
    transform 120ms ease;
  white-space: nowrap;
}

.rail-link:hover::after {
  opacity: 1;
  transform: translate(0, -50%);
}

.rail-health {
  align-items: center;
  color: #a9afb7;
  display: flex;
  flex-direction: row;
  font-size: 10px;
  gap: 7px;
  margin-top: auto;
  padding: 10px 12px;
  text-align: left;
}

.rail-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 5px;
  color: #777f8a;
  cursor: pointer;
  display: flex;
  height: 36px;
  justify-content: center;
  margin: auto 0 6px;
  width: 100%;
}

.rail-toggle:hover {
  background: var(--rail-hover);
  color: #fff;
}

.rail-toggle svg {
  height: 17px;
  width: 17px;
}

body.rail-collapsed {
  --rail-width: 76px;
}

body.rail-collapsed .logo {
  justify-content: center;
}

body.rail-collapsed .logo-type,
body.rail-collapsed .rail-link span,
body.rail-collapsed .rail-health span:last-child {
  display: none;
}

body.rail-collapsed .rail-link {
  justify-content: center;
  padding: 0;
}

.live-dot {
  background: var(--amber);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgb(169 105 15 / 13%);
  display: inline-block;
  flex: 0 0 auto;
  height: 7px;
  width: 7px;
}

.live-dot.ok {
  background: var(--green);
  box-shadow: 0 0 0 3px rgb(7 139 108 / 13%);
}

.live-dot.error {
  background: var(--red);
  box-shadow: 0 0 0 3px rgb(201 65 75 / 13%);
}

.workspace {
  margin-left: var(--rail-width);
  min-height: 100vh;
}

.command-bar {
  align-items: center;
  background: rgb(255 255 255 / 94%);
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(210px, 0.7fr) minmax(0, 1.8fr) minmax(180px, 0.6fr);
  height: var(--command-height);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.product-id,
.command-actions,
.market-tape,
.control-item,
.account-identity,
.table-title,
.trade-summary,
.status-badge,
.legend-item {
  align-items: center;
  display: flex;
}

.product-id {
  gap: 12px;
}

.product-id > div {
  display: grid;
  gap: 1px;
}

.product-kicker {
  color: var(--faint);
  font-size: 8px;
  font-weight: 760;
}

.product-id strong {
  font-size: 15px;
  font-weight: 740;
}

.env-badge {
  background: var(--amber-soft);
  border-radius: 3px;
  color: var(--amber);
  font-size: 9px;
  font-weight: 800;
  padding: 4px 6px;
}

.market-tape {
  gap: 0;
  height: 100%;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
}

.ticker-item {
  border-left: 1px solid var(--line);
  display: grid;
  flex: 0 1 160px;
  gap: 2px;
  min-width: 108px;
  padding: 0 18px;
}

.ticker-item:last-child {
  border-right: 1px solid var(--line);
}

.ticker-item span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.ticker-item strong {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 650;
}

.command-actions {
  gap: 12px;
  justify-content: flex-end;
  white-space: nowrap;
}

.sync-copy {
  display: grid;
  gap: 2px;
  justify-items: end;
}

.sync-copy span {
  color: var(--faint);
  font-size: 9px;
}

.sync-copy strong {
  font-size: 11px;
  font-weight: 650;
}

.icon-button {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink-soft);
  cursor: pointer;
  display: inline-flex;
  height: 34px;
  justify-content: center;
  padding: 0;
  transition:
    border-color 120ms ease,
    background-color 120ms ease;
  width: 34px;
}

.icon-button:hover {
  background: var(--surface-alt);
  border-color: #adb3bb;
}

.icon-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.icon-button svg {
  height: 16px;
  width: 16px;
}

.icon-button.loading svg {
  animation: rotate 800ms linear infinite;
}

@keyframes rotate {
  to {
    transform: rotate(360deg);
  }
}

main {
  margin: 0 auto;
  max-width: 1680px;
  padding: 18px 28px 48px;
}

.control-strip {
  align-items: stretch;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-height: 42px;
}

.control-item {
  gap: 8px;
  min-width: 0;
  padding: 9px 14px;
}

.control-item + .control-item {
  border-left: 1px solid var(--line);
}

.control-item svg {
  color: var(--muted);
  height: 14px;
  width: 14px;
}

.control-item strong {
  font-size: 11px;
  white-space: nowrap;
}

.control-item span:last-child {
  color: var(--muted);
  font-size: 11px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.control-item.warning {
  background: var(--amber-soft);
}

.control-item.error {
  background: var(--red-soft);
}

.section {
  scroll-margin-top: 84px;
  padding-top: 28px;
}

.page-heading,
.section-heading,
.performance-head,
.chart-toolbar,
.progress-heading {
  display: flex;
  justify-content: space-between;
}

.page-heading {
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 16px;
}

.page-heading > div:first-child {
  flex: 1 0 230px;
  min-width: 0;
}

.section-heading {
  align-items: flex-end;
  margin-bottom: 13px;
}

.eyebrow {
  color: var(--faint);
  font-size: 9px;
  font-weight: 780;
  margin-bottom: 5px;
}

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

.heading-meta {
  margin-top: 6px;
}

.strategy-switcher {
  align-items: center;
  background: #e7e9ec;
  border-radius: 6px;
  display: flex;
  flex: 0 1 820px;
  gap: 2px;
  max-width: min(64vw, 820px);
  min-width: 0;
  overflow-x: auto;
  padding: 3px;
}

.strategy-chip,
.segment,
.range-switch button {
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 620;
  height: 30px;
  padding: 0 11px;
  transition:
    background-color 120ms ease,
    color 120ms ease,
    box-shadow 120ms ease;
  white-space: nowrap;
}

.strategy-chip {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  gap: 7px;
}

.strategy-chip-marker {
  border-radius: 50%;
  display: block;
  flex: 0 0 auto;
  height: 6px;
  width: 6px;
}

.strategy-chip small {
  align-items: center;
  background: rgb(255 255 255 / 6%);
  border-radius: 3px;
  color: var(--faint);
  display: inline-flex;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
  height: 17px;
  justify-content: center;
  min-width: 17px;
  padding: 0 4px;
}

.strategy-chip.active,
.segment.active {
  background: #fff;
  box-shadow: 0 1px 2px rgb(16 24 40 / 10%);
  color: var(--ink);
}

.overview-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 2.2fr) minmax(290px, 0.8fr);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
}

.performance-panel {
  overflow: hidden;
}

.performance-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  min-height: 88px;
  padding: 14px 18px;
}

.hero-value,
.hero-change {
  display: grid;
  gap: 3px;
}

.hero-value span,
.hero-change span {
  color: var(--muted);
  font-size: 10px;
}

.hero-value strong {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 27px;
  font-weight: 680;
  line-height: 1.1;
}

.hero-value small,
.hero-change small {
  color: var(--faint);
  font-size: 9px;
}

.hero-change {
  border-left: 1px solid var(--line);
  margin-left: 20px;
  padding-left: 20px;
}

.hero-change strong {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 18px;
}

.chart-controls {
  align-items: center;
  display: flex;
  gap: 9px;
  margin-left: auto;
}

.segmented {
  background: #eceef1;
  border-radius: 6px;
  display: flex;
  padding: 3px;
}

.range-switch {
  align-items: center;
  background: #eceef1;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  padding: 3px;
}

.range-switch button {
  color: var(--faint);
  height: 27px;
  padding: 0 7px;
}

.range-switch button.active {
  background: var(--surface);
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 5%);
  color: var(--ink);
}

.chart-toolbar {
  align-items: flex-start;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr);
  min-height: 38px;
  padding: 8px 18px 0;
}

.chart-legend {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.legend-item {
  color: var(--muted);
  font-size: 11px;
  gap: 6px;
  transition:
    background-color 120ms ease,
    border-color 120ms ease,
    color 120ms ease,
    opacity 120ms ease;
}

.legend-item span {
  white-space: nowrap;
}

.legend-item strong {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 650;
}

.legend-item i {
  background: transparent;
  border-top: 2px solid;
  display: block;
  height: 0;
  width: 14px;
}

.legend-item i.benchmark {
  border-top-style: dashed;
}

.chart-caption {
  color: var(--faint);
  flex: 0 0 auto;
  font-size: 11px;
  justify-self: end;
  padding-top: 3px;
  white-space: nowrap;
}

.chart-wrap {
  height: 340px;
  position: relative;
}

#equity-chart {
  cursor: crosshair;
  display: block;
  height: 100%;
  touch-action: pan-y;
  width: 100%;
}

#equity-chart:focus-visible {
  outline: 1px solid var(--cyan);
  outline-offset: -2px;
}

.chart-tooltip {
  background: #17191cef;
  border: 1px solid #3b3f45;
  border-radius: 5px;
  color: #fff;
  font-size: 11px;
  line-height: 1.6;
  max-width: 260px;
  min-width: 205px;
  padding: 9px 11px;
  pointer-events: none;
  position: absolute;
  transform: none;
  z-index: 5;
}

.tooltip-time {
  color: #aeb4bd;
  display: block;
  margin-bottom: 3px;
}

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

.tooltip-row > span {
  align-items: center;
  display: flex;
  gap: 7px;
  min-width: 0;
}

.tooltip-row > span:not(strong) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tooltip-row strong {
  flex: 0 0 auto;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.tooltip-row i {
  border-radius: 50%;
  height: 6px;
  width: 6px;
}

.empty-state {
  align-items: center;
  color: var(--faint);
  display: flex;
  font-size: 11px;
  inset: 0;
  justify-content: center;
  position: absolute;
}

.strategy-board {
  display: flex;
  flex-direction: column;
  max-height: 495px;
  overflow: hidden;
}

.panel-title,
.table-title {
  border-bottom: 1px solid var(--line);
  justify-content: space-between;
  min-height: 55px;
  padding: 0 16px;
}

.panel-title > div {
  display: grid;
  gap: 2px;
}

.panel-title span,
.table-title > span {
  font-size: 13px;
  font-weight: 690;
}

.panel-title small,
.table-title small {
  color: var(--faint);
  font-size: 10px;
}

.panel-title svg {
  color: var(--faint);
  height: 16px;
  width: 16px;
}

.strategy-list {
  flex: 1;
  overflow-y: auto;
}

.strategy-row {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-left: 2px solid transparent;
  color: inherit;
  cursor: pointer;
  display: grid;
  gap: 7px;
  padding: 10px 16px 10px 14px;
  text-align: left;
  transition:
    background-color 120ms ease,
    border-color 120ms ease;
  width: 100%;
}

.strategy-row:hover,
.strategy-row.active {
  background: var(--surface-alt);
}

.strategy-row.active {
  border-left-color: var(--cyan);
}

.strategy-row:focus-visible {
  outline: 1px solid var(--cyan);
  outline-offset: -2px;
}

.strategy-row-head,
.strategy-row-metrics,
.strategy-name,
.strategy-return {
  align-items: center;
  display: flex;
}

.strategy-row-head,
.strategy-row-metrics {
  justify-content: space-between;
}

.strategy-name {
  gap: 8px;
}

.strategy-name i {
  border-radius: 50%;
  height: 8px;
  width: 8px;
}

.strategy-name strong {
  font-size: 13px;
}

.strategy-return {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
  font-weight: 700;
  gap: 3px;
}

.strategy-row-metrics {
  color: var(--muted);
  font-size: 11px;
  gap: 8px;
}

.strategy-row-metrics span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strategy-position-list {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0;
  padding-top: 4px;
}

.strategy-position-row {
  align-items: center;
  display: grid;
  gap: 6px;
  grid-template-columns: minmax(82px, 1.2fr) minmax(64px, 0.8fr) minmax(58px, 0.7fr);
  min-height: 34px;
}

.strategy-position-row + .strategy-position-row {
  border-top: 1px solid rgb(255 255 255 / 4%);
}

.strategy-position-row > span {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.strategy-position-row strong {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 680;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strategy-position-row small,
.strategy-position-empty span {
  color: var(--faint);
  font-size: 9px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strategy-position-asset strong {
  color: var(--ink);
  font-family: inherit;
  font-size: 11px;
}

.strategy-position-pnl {
  justify-items: end;
}

.strategy-position-empty {
  align-items: center;
  color: var(--faint);
  display: flex;
  font-size: 10px;
  justify-content: space-between;
  min-height: 30px;
}

.strategy-position-empty strong {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
}

.exposure-meter {
  background: #eceef1;
  border-radius: 2px;
  height: 4px;
  overflow: hidden;
}

.exposure-meter span {
  display: block;
  height: 100%;
}

.kpi-band {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 12px;
}

.kpi-cell {
  align-items: center;
  display: flex;
  gap: 11px;
  min-height: 67px;
  padding: 12px 16px;
}

.kpi-cell + .kpi-cell {
  border-left: 1px solid var(--line);
}

.kpi-cell svg {
  color: var(--faint);
  height: 17px;
  width: 17px;
}

.kpi-cell > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

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

.kpi-cell strong {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 2.2fr) minmax(290px, 0.8fr);
}

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

.observer-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 15px;
}

.observer-head {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: 32px minmax(0, 1fr) auto;
}

.observer-icon {
  align-items: center;
  background: var(--blue-soft);
  border-radius: 6px;
  color: var(--blue);
  display: flex;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.observer-icon svg {
  height: 16px;
  width: 16px;
}

.observer-head > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.observer-head strong {
  font-size: 12px;
}

.observer-head small {
  color: var(--faint);
  font-size: 9px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.observer-progress {
  background: #eceef1;
  border-radius: 2px;
  height: 5px;
  overflow: hidden;
}

.observer-progress > span {
  background: var(--cyan);
  display: block;
  height: 100%;
}

.observer-progress-label {
  color: var(--faint);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  margin-top: -8px;
}

.observer-metrics {
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.observer-metrics > span {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 8px;
}

.observer-metrics > span + span {
  border-left: 1px solid var(--line);
}

.observer-metrics small {
  color: var(--faint);
  font-size: 9px;
}

.observer-metrics strong {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.observer-targets {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 24px;
}

.observer-target {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  padding: 4px 6px;
}

.observer-targets > span:only-child:not(.observer-target),
.observer-empty {
  color: var(--faint);
  font-size: 10px;
}

.observer-empty {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  grid-column: 1 / -1;
  padding: 24px;
  text-align: center;
}

.table-panel,
.signal-panel,
.ledger-panel {
  overflow: hidden;
}

.table-scroll {
  overflow: auto;
}

.strategy-table-scroll,
.positions-table-scroll {
  max-height: 430px;
}

.trades-table-scroll {
  max-height: 620px;
}

table {
  border-collapse: collapse;
  min-width: 800px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
  white-space: nowrap;
}

th {
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 2;
}

td {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fafbfc;
}

.strategy-table-row {
  cursor: pointer;
}

.strategy-table-row.active {
  background: var(--blue-soft);
}

.strategy-table-row:focus-visible {
  outline: 1px solid var(--cyan);
  outline-offset: -2px;
}

.table-scroll th:first-child {
  left: 0;
  z-index: 3;
}

.table-scroll td:first-child {
  background: var(--surface);
  left: 0;
  position: sticky;
  z-index: 1;
}

.table-scroll tbody tr:hover td:first-child,
.table-scroll .strategy-table-row.active td:first-child {
  background: #151e28;
}

.numeric {
  text-align: right;
}

.asset-cell {
  align-items: center;
  display: flex;
  gap: 9px;
}

.asset-icon {
  align-items: center;
  background: #eceef1;
  border-radius: 50%;
  color: var(--ink-soft);
  display: flex;
  font-size: 9px;
  font-weight: 780;
  height: 25px;
  justify-content: center;
  width: 25px;
}

.asset-copy {
  display: grid;
  gap: 2px;
}

.asset-copy strong {
  font-size: 11px;
}

.asset-copy span {
  color: var(--faint);
  font-size: 9px;
}

.allocation-cell {
  display: grid;
  gap: 4px;
  min-width: 120px;
}

.allocation-copy {
  display: flex;
  font-size: 9px;
  justify-content: space-between;
}

.allocation-copy span {
  color: var(--faint);
}

.allocation-bar {
  background: #eceef1;
  border-radius: 2px;
  height: 4px;
  overflow: hidden;
}

.allocation-bar span {
  background: var(--blue);
  display: block;
  height: 100%;
}

.positive {
  color: var(--green) !important;
}

.negative {
  color: var(--red) !important;
}

.signal-list {
  max-height: 368px;
  overflow-y: auto;
}

.signal-row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  min-height: 52px;
  padding: 8px 14px;
}

.signal-row + .signal-row {
  border-top: 1px solid var(--line);
}

.signal-rank {
  align-items: center;
  background: var(--surface-alt);
  border-radius: 4px;
  color: var(--muted);
  display: flex;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  height: 25px;
  justify-content: center;
  width: 25px;
}

.signal-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.signal-main,
.signal-meta {
  align-items: center;
  display: flex;
  gap: 7px;
}

.signal-main strong {
  font-size: 11px;
}

.signal-main span,
.signal-meta {
  color: var(--faint);
  font-size: 9px;
}

.signal-weight {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  text-align: right;
}

.gate-indicator {
  border-radius: 50%;
  display: inline-block;
  height: 6px;
  width: 6px;
}

.gate-indicator.pass {
  background: var(--green);
}

.gate-indicator.block {
  background: var(--amber);
}

.table-empty {
  min-height: 110px;
  position: static;
}

.trade-summary {
  color: var(--muted);
  font-size: 10px;
  gap: 18px;
}

.trade-summary b {
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, monospace;
}

.ledger-toolbar {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 50px;
  padding: 8px 14px;
}

.ledger-status {
  align-items: center;
  display: flex;
  gap: 12px;
}

.ledger-status > span,
.pagination > span {
  color: var(--faint);
  font-size: 10px;
}

.pagination {
  align-items: center;
  display: flex;
  gap: 7px;
}

.pagination-button {
  align-items: center;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  height: 28px;
  justify-content: center;
  padding: 0;
  width: 28px;
}

.pagination-button:hover:not(:disabled) {
  border-color: var(--cyan);
  color: var(--cyan);
}

.pagination-button:disabled {
  cursor: default;
  opacity: 0.32;
}

.pagination-button svg {
  height: 14px;
  width: 14px;
}

.strategy-switcher,
.strategy-list,
.signal-list,
.table-scroll {
  scrollbar-color: rgb(255 255 255 / 20%) transparent;
  scrollbar-width: thin;
}

.strategy-switcher::-webkit-scrollbar,
.strategy-list::-webkit-scrollbar,
.signal-list::-webkit-scrollbar,
.table-scroll::-webkit-scrollbar {
  height: 7px;
  width: 7px;
}

.strategy-switcher::-webkit-scrollbar-thumb,
.strategy-list::-webkit-scrollbar-thumb,
.signal-list::-webkit-scrollbar-thumb,
.table-scroll::-webkit-scrollbar-thumb {
  background: rgb(255 255 255 / 18%);
  border-radius: 4px;
}

.side-buy,
.side-sell {
  align-items: center;
  display: inline-flex;
  font-weight: 700;
  gap: 5px;
}

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

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

.side-buy::before,
.side-sell::before {
  border-radius: 50%;
  content: "";
  height: 6px;
  width: 6px;
}

.side-buy::before {
  background: var(--green);
}

.side-sell::before {
  background: var(--red);
}

.validation-grid,
.account-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.65fr);
}

.progress-panel {
  display: grid;
  gap: 26px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 21px;
}

.progress-block {
  display: grid;
  gap: 12px;
}

.progress-heading {
  align-items: flex-end;
}

.progress-heading > div {
  display: grid;
  gap: 5px;
}

.progress-heading span {
  color: var(--muted);
  font-size: 10px;
}

.progress-heading strong {
  font-size: 13px;
}

.progress-heading b {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 19px;
}

.progress-track {
  background: #e8eaed;
  border-radius: 2px;
  overflow: hidden;
}

.progress-track {
  height: 7px;
}

.progress-track span {
  background: var(--blue);
  display: block;
  height: 100%;
  transition: width 260ms ease;
  width: 0;
}

.secondary-progress span {
  background: var(--violet);
}

.gate-panel {
  display: grid;
}

.gate-row {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-height: 47px;
  padding: 10px 15px;
}

.gate-row + .gate-row {
  border-top: 1px solid var(--line);
}

.gate-name {
  align-items: center;
  display: flex;
  font-size: 10px;
  gap: 8px;
}

.gate-check {
  align-items: center;
  background: #eceef1;
  border-radius: 50%;
  color: var(--muted);
  display: inline-flex;
  height: 19px;
  justify-content: center;
  width: 19px;
}

.gate-check.passed {
  background: var(--green-soft);
  color: var(--green);
}

.gate-value {
  color: var(--muted);
  font-size: 10px;
}

.status-badge {
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  gap: 6px;
  min-height: 25px;
  padding: 0 9px;
  white-space: nowrap;
}

.status-stack {
  align-items: flex-end;
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
}

.status-stack small {
  color: var(--faint);
  font-size: 8px;
  white-space: nowrap;
}

.status-badge.good {
  background: var(--green-soft);
  color: var(--green);
}

.status-badge.warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-badge.bad {
  background: var(--red-soft);
  color: var(--red);
}

.status-badge.neutral {
  background: #e9ebee;
  color: #5c626c;
}

.account-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
}

.account-panel {
  display: grid;
  grid-template-columns: minmax(180px, 0.55fr) minmax(0, 1.45fr);
  min-height: 150px;
}

.account-primary {
  border-right: 1px solid var(--line);
  display: grid;
  padding: 20px;
}

.account-identity {
  align-self: start;
  gap: 10px;
}

.exchange-mark {
  align-items: center;
  background: var(--ink);
  border-radius: 4px;
  color: #fff;
  display: flex;
  font-size: 9px;
  font-weight: 800;
  height: 30px;
  justify-content: center;
  width: 38px;
}

.account-identity > div {
  display: grid;
  gap: 2px;
}

.account-identity strong {
  font-size: 11px;
}

.account-identity small {
  color: var(--muted);
  font-size: 9px;
}

.account-equity {
  align-self: end;
  display: grid;
  gap: 4px;
}

.account-equity span {
  color: var(--muted);
  font-size: 9px;
}

.account-equity strong {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 22px;
}

.account-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.account-stat {
  align-content: center;
  display: grid;
  gap: 6px;
  padding: 16px;
}

.account-stat + .account-stat {
  border-left: 1px solid var(--line);
}

.account-stat span {
  color: var(--muted);
  font-size: 9px;
}

.account-stat strong {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 18px;
}

.account-error {
  align-content: center;
  color: var(--red);
  display: grid;
  gap: 5px;
  grid-column: 1 / -1;
  line-height: 1.5;
  padding: 20px;
}

.account-error strong {
  font-size: 12px;
}

.account-error span {
  color: var(--muted);
  font-size: 10px;
}

.health-panel {
  overflow: hidden;
}

.health-list {
  display: grid;
}

.health-row {
  align-items: center;
  display: flex;
  justify-content: space-between;
  min-height: 43px;
  padding: 9px 15px;
}

.health-row + .health-row {
  border-top: 1px solid var(--line);
}

.health-name {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 10px;
  gap: 8px;
}

.health-name svg {
  height: 14px;
  width: 14px;
}

.health-row strong {
  font-size: 10px;
  font-weight: 680;
}

footer {
  align-items: center;
  color: var(--faint);
  display: flex;
  font-size: 9px;
  justify-content: space-between;
  padding: 34px 2px 0;
}

.toast {
  background: #17191cf2;
  border: 1px solid #3b3e44;
  border-radius: 6px;
  bottom: 22px;
  color: #fff;
  font-size: 11px;
  left: 50%;
  opacity: 0;
  padding: 10px 13px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 10px);
  transition:
    opacity 150ms ease,
    transform 150ms ease;
  z-index: 50;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes value-tick-up {
  from {
    background: var(--green-soft);
    box-shadow: 0 0 0 3px var(--green-soft);
  }

  to {
    background: transparent;
    box-shadow: 0 0 0 0 transparent;
  }
}

@keyframes value-tick-down {
  from {
    background: var(--red-soft);
    box-shadow: 0 0 0 3px var(--red-soft);
  }

  to {
    background: transparent;
    box-shadow: 0 0 0 0 transparent;
  }
}

.value-tick-up,
.value-tick-down {
  border-radius: 3px;
}

.value-tick-up {
  animation: value-tick-up 520ms ease-out;
}

.value-tick-down {
  animation: value-tick-down 520ms ease-out;
}

/* Dark terminal surface */
.command-bar {
  background: rgb(10 14 20 / 94%);
  backdrop-filter: blur(14px);
}

.control-strip,
.strategy-chip.active,
.segment.active {
  background: var(--surface);
}

.strategy-switcher,
.segmented,
.range-switch,
.exposure-meter,
.allocation-bar,
.progress-track,
.gate-check,
.status-badge.neutral {
  background: rgb(255 255 255 / 5%);
}

.status-badge.neutral {
  color: var(--muted);
}

.strategy-chip.active,
.segment.active {
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 5%);
}

.strategy-chip:hover:not(.active),
.segment:hover:not(.active),
.range-switch button:hover:not(.active) {
  background: rgb(255 255 255 / 5%);
  color: var(--ink);
}

.strategy-chip.active {
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / 7%),
    inset 0 -2px 0 var(--cyan);
}

.panel,
.control-strip,
.kpi-band {
  box-shadow: 0 12px 30px rgb(0 0 0 / 8%);
}

tbody tr:hover,
.strategy-row:hover,
.strategy-row.active {
  background: rgb(255 255 255 / 3%);
}

.asset-icon,
.signal-rank {
  background: rgb(255 255 255 / 5%);
}

.connection-state {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 9px;
  gap: 7px;
}

.connection-state.connected strong {
  color: var(--green);
}

.connection-state.disconnected strong {
  color: var(--red);
}

.language-switcher {
  align-items: center;
  color: var(--faint);
  display: flex;
  font-size: 9px;
  gap: 4px;
  flex-shrink: 0;
}

.language-switcher button {
  background: transparent;
  border: 0;
  color: var(--faint);
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
  padding: 4px 2px;
}

.language-switcher button.active {
  color: var(--cyan);
}

.legend-item {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  padding: 4px 6px;
}

.legend-item:hover {
  background: rgb(255 255 255 / 4%);
  border-color: var(--line);
  color: var(--ink);
}

.legend-item.muted {
  opacity: 0.38;
}

.sort-button {
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding-right: 24px;
  position: relative;
}

.sort-button::after {
  color: var(--faint);
  content: "↕";
  position: absolute;
  right: 10px;
}

.sort-button.active::after {
  color: var(--cyan);
  content: "↓";
}

.sort-button.active[data-direction="asc"]::after {
  content: "↑";
}

.strategy-table-row {
  cursor: pointer;
}

.loading-shell {
  display: none;
  gap: 14px;
}

.is-loading .loading-shell {
  display: grid;
}

.is-loading .control-strip,
.is-loading .section {
  display: none;
}

.skeleton-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 0.8fr);
}

.skeleton-line,
.skeleton-panel {
  animation: skeleton-pulse 1.2s ease-in-out infinite alternate;
  background: rgb(255 255 255 / 5%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.skeleton-line {
  height: 68px;
  width: 62%;
}

.skeleton-line.wide {
  height: 42px;
  width: 100%;
}

.skeleton-panel {
  height: 430px;
}

@keyframes skeleton-pulse {
  to {
    background: rgb(255 255 255 / 8%);
  }
}

@media (max-width: 1500px) {
  .market-tape .ticker-item:nth-child(n + 4) {
    display: none;
  }

  .ticker-item {
    padding-left: 13px;
    padding-right: 13px;
  }
}

@media (max-width: 1180px) {
  .market-tape .ticker-item:nth-child(n + 4) {
    display: none;
  }

  .overview-grid,
  .data-grid {
    grid-template-columns: minmax(0, 1.7fr) minmax(270px, 0.8fr);
  }

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

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

  .kpi-cell:nth-child(3) {
    border-left: 0;
  }

  .kpi-cell:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 900px) {
  :root {
    --rail-width: 72px;
  }

  .command-bar {
    grid-template-columns: 1fr auto;
  }

  .market-tape {
    display: none;
  }

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

  .control-item:nth-child(3) {
    border-left: 0;
  }

  .control-item:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .overview-grid,
  .data-grid,
  .validation-grid,
  .account-grid,
  .observer-grid {
    grid-template-columns: 1fr;
  }

  .strategy-board {
    max-height: none;
    min-height: 0;
  }

  .strategy-board .strategy-list {
    overflow-y: visible;
  }
}

@media (max-width: 640px) {
  :root {
    --command-height: 58px;
  }

  body {
    padding-bottom: 66px;
  }

  .app-rail {
    bottom: 0;
    flex-direction: row;
    height: 62px;
    padding: 5px 8px;
    right: 0;
    top: auto;
    width: 100%;
  }

  .logo,
  .rail-health,
  .rail-toggle {
    display: none;
  }

  .rail-nav {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin: 0;
    width: 100%;
  }

  .rail-link {
    flex-direction: column;
    font-size: 9px;
    gap: 3px;
    justify-content: center;
    min-height: 50px;
    padding: 0;
  }

  .rail-link.active::before {
    border-radius: 0 0 2px 2px;
    height: 3px;
    left: 50%;
    top: -5px;
    transform: translateX(-50%);
    width: 25px;
  }

  .rail-link::after {
    display: none;
  }

  .workspace {
    margin-left: 0;
  }

  .command-bar {
    padding: 0 14px;
  }

  .product-kicker,
  .sync-copy {
    display: none;
  }

  main {
    padding: 12px 12px 34px;
  }

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

  .control-item {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
    padding: 9px 11px;
  }

  .control-item svg,
  .control-item > .live-dot {
    display: none;
  }

  .section {
    scroll-margin-top: 70px;
    padding-top: 23px;
  }

  .page-heading,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .page-heading > div:first-child {
    flex: 0 0 auto;
  }

  h1 {
    font-size: 23px;
  }

  .strategy-switcher {
    align-self: stretch;
    display: flex;
    flex: 0 0 auto;
    max-width: 100%;
    overflow-x: auto;
    width: 100%;
  }

  .strategy-chip {
    height: 34px;
    padding: 0 10px;
    white-space: nowrap;
  }

  .performance-head {
    align-items: flex-start;
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr 1fr;
  }

  .hero-change {
    margin: 0;
    padding-left: 14px;
  }

  .chart-controls {
    display: grid;
    gap: 8px;
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
    margin: 0;
    width: 100%;
  }

  .segmented,
  .range-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .range-switch {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .range-switch button {
    height: 34px;
    padding: 0 4px;
    width: 100%;
  }

  .segment {
    height: 34px;
  }

  .chart-wrap {
    height: 280px;
  }

  .chart-toolbar {
    align-items: flex-start;
  }

  .chart-caption {
    justify-self: start;
    line-height: 1.45;
    white-space: normal;
  }

  .strategy-board {
    max-height: none;
    min-height: 0;
  }

  .strategy-table-scroll,
  .positions-table-scroll {
    max-height: 360px;
  }

  .trades-table-scroll {
    max-height: 520px;
  }

  .ledger-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .ledger-status {
    justify-content: space-between;
  }

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

  .kpi-cell {
    min-height: 61px;
    padding: 10px 12px;
  }

  .kpi-cell:nth-child(3),
  .kpi-cell:nth-child(5) {
    border-left: 0;
  }

  .kpi-cell:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .trade-summary {
    justify-content: space-between;
  }

  .progress-panel {
    grid-template-columns: 1fr;
  }

  .account-panel {
    grid-template-columns: 1fr;
  }

  .account-primary {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    gap: 20px;
    grid-template-columns: 1fr auto;
  }

  .account-equity {
    align-self: center;
    justify-items: end;
  }

  .account-summary {
    min-height: 100px;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }
}

@media (max-width: 420px) {
  .control-item span:last-child {
    max-width: 150px;
  }

  .hero-value strong {
    font-size: 23px;
  }

  .segment {
    width: 100%;
  }

  .range-switch {
    justify-content: stretch;
  }

  .account-summary {
    grid-template-columns: 1fr;
  }

  .account-stat + .account-stat {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .strategy-chip,
  .segment,
  .range-switch button,
  .strategy-row,
  .value-tick-up,
  .value-tick-down {
    animation: none;
    transition: none;
  }
}
