:root {
  --bg-main: #070910;
  --bg-panel: #0e1119;
  --bg-panel-2: #111523;
  --line: #1c2434;
  --line-strong: #2a3550;
  --text-main: #dce4f3;
  --text-muted: #8b95aa;
  --up: #00d087;
  --down: #ff4d5e;
  --accent: #4fb8ff;
  --warn: #ffcb4f;
  --perp-row-height: 21px;
  --perp-visible-rows: 8;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at 10% 20%, #101726 0%, #070910 55%, #05070c 100%);
  color: var(--text-main);
  font-family: "IBM Plex Mono", monospace;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.12;
}

.app-shell {
  min-height: 100vh;
  padding: 6px;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 6px;
}

.panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-panel) 0%, var(--bg-panel-2) 100%);
  border-radius: 0;
  padding: 6px;
  min-width: 0;
  animation: panel-in 380ms ease-out both;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
}

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

.brand h1 {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "Rajdhani", sans-serif;
  font-size: 28px;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.brand-beta-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 0 7px;
  border: 1px solid rgba(79, 184, 255, 0.5);
  background: linear-gradient(180deg, rgba(0, 208, 135, 0.2) 0%, rgba(10, 20, 36, 0.94) 100%);
  color: #bff6df;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.brand p {
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
}

.brand-inline-link {
  color: #9ec8ff;
  text-decoration: none;
}

.brand-inline-link:hover {
  color: #c4e0ff;
  text-decoration: underline;
}

.brand-logo {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  background: #0a0f1a;
}

.brand-logo-mark {
  width: 30px;
  height: 30px;
  display: block;
  animation: topbar-logo-mark-pulse 1.8s ease-in-out infinite;
}

.status-cluster {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line-strong);
  background: #0a0f1a;
  color: #b8c6de;
  font-size: 11px;
  padding: 4px 7px;
}

.status-pill.feed-live {
  border-color: rgba(0, 208, 135, 0.45);
  color: #9fe9c8;
}

.status-pill.feed-offline {
  border-color: rgba(158, 176, 206, 0.35);
  color: #9eb0ce;
}

.status-pill.feed-connecting {
  border-color: rgba(79, 184, 255, 0.48);
  color: #b6dcff;
}

.status-pill.feed-error {
  border-color: rgba(255, 77, 94, 0.5);
  color: #ffb8bf;
}

.status-link {
  text-decoration: none;
  cursor: pointer;
}

.status-btn {
  font-family: "IBM Plex Mono", monospace;
  cursor: pointer;
}

.status-btn:hover {
  background: #132138;
}

.account-user {
  font-family: "Rajdhani", sans-serif;
  font-size: 16px;
  letter-spacing: 0.04em;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-plan {
  font-size: 9px;
}

.account-mini-meta {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.2;
}

.account-mini-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.dot.live {
  background: var(--up);
  box-shadow: 0 0 0 0 rgba(0, 208, 135, 0.75);
  animation: pulse 1.8s infinite;
}

.dot.idle {
  background: #61708e;
  box-shadow: none;
  animation: none;
}

.dot.warn {
  background: var(--warn);
  box-shadow: none;
  animation: none;
}

.dot.error {
  background: var(--down);
  box-shadow: none;
  animation: none;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 208, 135, 0.75);
  }
  80% {
    box-shadow: 0 0 0 10px rgba(0, 208, 135, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 208, 135, 0);
  }
}

.account-strip {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 3px;
  align-items: stretch;
  padding: 4px 5px;
}

.metric {
  border: 1px solid var(--line);
  background: #0c1019;
  padding: 3px 5px;
  min-height: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
}

.metric-label {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
}

.metric-value {
  font-size: 15px;
  color: #ecf2ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-value .metric-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pnl-value {
  font-family: "Rajdhani", sans-serif;
  font-size: 22px;
  line-height: 1;
}

.metric-meta {
  color: #8ea2c6;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.metric-meta.source-live {
  color: #9fe9c8;
}

.metric-meta.source-sim {
  color: #b6dcff;
}

.workspace-grid {
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 6px minmax(0, 1fr);
  gap: 0;
}

.column-splitter {
  width: 6px;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: linear-gradient(90deg, #0f1627 0%, #0a111f 100%);
  cursor: col-resize;
}

.column-splitter.disabled {
  opacity: 0.45;
  cursor: default;
}

.left-stack,
.right-stack {
  min-height: 0;
  min-width: 0;
  display: grid;
  gap: 0;
}

.left-stack {
  grid-template-rows: minmax(158px, 0.18fr) 6px minmax(200px, 0.36fr) 6px minmax(202px, 0.46fr);
}

.right-stack {
  grid-template-rows: 430px 6px minmax(200px, 1fr);
  align-content: start;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  margin-bottom: 6px;
}

.panel-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
  max-width: 100%;
}

.panel-collapse-btn {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: #0a0f1a;
  color: #c5d5ef;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.panel-collapse-btn:hover {
  background: #152033;
}

.panel-head.has-corner-collapse {
  position: relative;
  padding-right: 24px;
}

.panel-head.has-corner-collapse .panel-collapse-btn-corner {
  position: absolute;
  right: 0;
  top: 0;
}

.panel-splitter {
  height: 6px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #0f1627 0%, #0a111f 100%);
  cursor: row-resize;
}

.panel-splitter.disabled {
  opacity: 0.45;
  cursor: default;
}

.resizable-panel {
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.resizable-panel.panel-collapsed {
  overflow: hidden;
}

.resizable-panel.panel-collapsed > :not(.panel-head) {
  display: none;
}

h2 {
  margin: 0;
  font-family: "Rajdhani", sans-serif;
  font-size: 17px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  min-width: 0;
}

.inline-tag {
  border: 1px solid var(--line-strong);
  background: #0a0f1a;
  color: #9db0cf;
  font-size: 10px;
  padding: 3px 6px;
  text-transform: uppercase;
  display: inline-flex;
  gap: 8px;
}

.inline-tag.source-live {
  border-color: rgba(0, 208, 135, 0.48);
  color: #9fe9c8;
}

.inline-tag.source-sim {
  border-color: rgba(79, 184, 255, 0.44);
  color: #b6dcff;
}

.chart-source-tag {
  min-width: 152px;
  justify-content: center;
  letter-spacing: 0.04em;
}

.inline-tag.source-error {
  border-color: rgba(255, 96, 96, 0.56);
  color: #ffc0c0;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  min-height: 0;
  min-width: 0;
}

.table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #0b1019;
}

.compact-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.compact-table th,
.compact-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  padding: 3px 5px;
  text-align: left;
  white-space: nowrap;
}

#perp-table th,
#perp-table td {
  height: var(--perp-row-height);
  padding-top: 2px;
  padding-bottom: 2px;
}

#perp-table {
  table-layout: fixed;
  width: 100%;
}

#perp-table th,
#perp-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}

#perp-table th:nth-child(1),
#perp-table td:nth-child(1) {
  width: 24%;
}

#perp-table th:nth-child(2),
#perp-table td:nth-child(2) {
  width: 13%;
}

#perp-table th:nth-child(3),
#perp-table td:nth-child(3) {
  width: 15%;
}

#perp-table th:nth-child(4),
#perp-table td:nth-child(4) {
  width: 17%;
}

#perp-table th:nth-child(5),
#perp-table td:nth-child(5) {
  width: 13%;
}

#perp-table th:nth-child(6),
#perp-table td:nth-child(6) {
  width: 10%;
}

#perp-table th:nth-child(n+2),
#perp-table td:nth-child(n+2) {
  font-variant-numeric: tabular-nums;
}

#perp-table td:nth-child(n+2) {
  text-align: right;
}

#perp-table thead th.sortable {
  cursor: pointer;
  user-select: none;
  position: sticky;
  padding-right: 14px;
}

#perp-table thead th.sortable::after {
  content: "↕";
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  color: #4f5f82;
  line-height: 1;
}

#perp-table thead th.sortable.sort-asc::after {
  content: "▲";
  color: #6fa5ff;
}

#perp-table thead th.sortable.sort-desc::after {
  content: "▼";
  color: #6fa5ff;
}

#perp-table thead th.sortable:focus-visible {
  outline: 1px solid #2f66b1;
  outline-offset: -1px;
}

.compact-table th:last-child,
.compact-table td:last-child {
  border-right: none;
}

#tab-trade-history .table-wrap {
  overflow-x: auto;
}

#tab-trade-history .compact-table {
  width: 100%;
  table-layout: auto;
}

#tab-trade-history .compact-table th,
#tab-trade-history .compact-table td {
  width: 1%;
  white-space: nowrap;
}

#tab-trade-history th.trade-col-fee,
#tab-trade-history td.trade-col-fee {
  display: table-cell !important;
  min-width: 9ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#tab-trade-history tr.trade-row-provisional td {
  background: rgba(206, 132, 37, 0.08);
}

.compact-table th {
  background: #0b1019;
  color: #8f9fbe;
  font-weight: 500;
  position: sticky;
  top: 0;
  z-index: 1;
}

.mode-select {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: #060a11;
  color: var(--text-main);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 0;
}

.compact-table tbody tr:hover {
  background: #141e30;
}

.compact-table tbody tr.selected {
  outline: 1px solid var(--accent);
  background: #172239;
}

.compact-table tbody tr.market-disabled {
  opacity: 0.42;
}

.compact-table tbody tr.market-disabled:hover {
  background: transparent;
  cursor: not-allowed;
}

.compact-table tbody tr.agent-open-flash td {
  animation: agent-open-flash 0.38s ease-in-out 5;
}

.compact-table tbody tr.agent-close-flash td {
  animation: agent-close-flash 0.4s ease-in-out 5;
}

.compact-table tbody tr.placeholder-row td {
  color: var(--text-muted);
}

.compact-table tbody tr.placeholder-row:hover {
  background: transparent;
}

.tight th,
.tight td {
  padding: 3px 4px;
}

@keyframes agent-open-flash {
  0% {
    background: rgba(15, 35, 64, 0.2);
    color: #cfe1ff;
  }
  50% {
    background: rgba(0, 224, 173, 0.28);
    color: #ecfff7;
  }
  100% {
    background: rgba(15, 35, 64, 0.2);
    color: #cfe1ff;
  }
}

@keyframes agent-close-flash {
  0% {
    background: rgba(15, 35, 64, 0.2);
    color: #cfe1ff;
  }
  50% {
    background: rgba(255, 150, 56, 0.34);
    color: #fff2e8;
  }
  100% {
    background: rgba(15, 35, 64, 0.2);
    color: #cfe1ff;
  }
}

.chart-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
}

.chart-stage {
  position: relative;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

#tv-chart {
  position: relative;
  min-height: 140px;
  border: 1px solid var(--line);
  height: 100%;
  width: 100%;
  overflow: hidden;
}

#tv-chart[data-loading="1"]::before {
  content: "Loading chart...";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 4;
  color: #9eb0ce;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: none;
  background: rgba(8, 12, 20, 0.62);
  pointer-events: none;
}

#tv-chart[data-status-message]:not([data-loading="1"])::after {
  content: attr(data-status-message);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 4;
  color: #9eb0ce;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: none;
  background: rgba(8, 12, 20, 0.62);
  pointer-events: none;
}

.perp-panel .table-wrap {
  /* Show header + 8 rows by default, but allow growth when the panel is expanded. */
  min-height: calc((var(--perp-row-height) * (var(--perp-visible-rows) + 1)) + 2px);
  height: 100%;
  max-height: none;
  overflow-y: auto;
}

#tab-positions .table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  overscroll-behavior-y: contain;
  min-width: 0;
  min-height: 0;
}

#tab-positions .positions-scroll-x {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  scrollbar-width: thin;
}

#tab-positions .compact-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

#tab-positions .compact-table th,
#tab-positions .compact-table td {
  white-space: nowrap;
  padding: 2px 4px;
  font-size: 11px;
}

#tab-positions .compact-table thead th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 14px;
}

#tab-positions .compact-table thead th.sortable::after {
  content: "↕";
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  color: #4f5f82;
  line-height: 1;
}

#tab-positions .compact-table thead th.sortable.sort-asc::after {
  content: "▲";
  color: #6fa5ff;
}

#tab-positions .compact-table thead th.sortable.sort-desc::after {
  content: "▼";
  color: #6fa5ff;
}

#tab-positions .compact-table thead th.sortable:focus-visible {
  outline: 1px solid #2f66b1;
  outline-offset: -1px;
}

#tab-positions .positions-col-agent {
  width: 1%;
  min-width: 12ch;
}

#tab-positions .positions-sync-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 4px;
  border: 1px solid rgba(239, 188, 80, 0.55);
  border-radius: 3px;
  color: #efc982;
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#tab-positions .positions-unmonitored-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 4px;
  border: 1px solid rgba(132, 145, 167, 0.55);
  border-radius: 3px;
  color: #9cabbe;
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#tab-positions tr.positions-row-provisional td {
  background: rgba(153, 115, 39, 0.08);
}

#tab-positions tr.positions-row-unmonitored td {
  color: #c6cedd;
  background: rgba(170, 58, 58, 0.10);
}

#tab-positions tr.positions-row-unmonitored .positions-col-side.up {
  color: #d6dee9;
}

#tab-positions tr.positions-row-unmonitored .positions-col-side.down {
  color: #e0d0d0;
}

#tab-positions tr.positions-row-unmonitored .positions-col-upnl.up {
  color: var(--up);
}

#tab-positions tr.positions-row-unmonitored .positions-col-upnl.down {
  color: var(--down);
}

#tab-positions .positions-col-symbol {
  width: 1%;
  min-width: 9ch;
}

#tab-positions .positions-col-side {
  width: 1%;
  min-width: 5ch;
  text-align: center;
}

#tab-positions .positions-col-size,
#tab-positions .positions-col-value,
#tab-positions .positions-col-base,
#tab-positions .positions-col-entry,
#tab-positions .positions-col-upnl {
  width: 1%;
  min-width: 9ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#tab-positions .positions-col-value {
  min-width: 10ch;
}

#tab-positions .positions-col-base {
  min-width: 9ch;
}

#tab-positions th.positions-col-lev,
#tab-positions td.positions-col-lev,
#tab-positions th.positions-eff-lev-col,
#tab-positions td.positions-eff-lev-col {
  width: 1%;
  min-width: 8ch;
  max-width: 10ch;
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#tab-positions .positions-col-hold {
  width: 1%;
  min-width: 9ch;
  text-align: center;
}

#tab-positions .positions-col-mode {
  width: 1%;
  min-width: 6ch;
  text-align: center;
}

#tab-positions .positions-col-action {
  width: 1%;
  min-width: 8ch;
  text-align: center;
}

#tab-positions .positions-col-action .btn-small {
  min-width: 6ch;
  padding: 2px 6px;
}

.market-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
  min-width: 0;
}

.market-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  margin-bottom: 0;
  overflow-x: auto;
  scrollbar-width: thin;
  min-width: 0;
}

.market-tab-btn {
  flex: 0 0 96px;
  min-width: 96px;
  text-align: center;
  font-size: 12px;
  white-space: nowrap;
}

.market-tab-btn:last-child {
  margin-right: 0;
}

.market-tab-btn.active {
  background: #172239;
  border-color: #3a517e;
  color: #d9e5ff;
}

.market-search-input {
  width: 164px;
  max-width: 34%;
  min-width: 132px;
  height: 24px;
  border: 1px solid #203252;
  background: #0a1221;
  color: #d9e5ff;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  padding: 0 8px;
  letter-spacing: 0.01em;
}

.market-search-input::placeholder {
  color: #7b90b3;
}

.market-search-input:focus-visible {
  outline: 1px solid #2f5fb4;
  outline-offset: 0;
}

#market-opportunities-btn {
  height: 24px;
  padding: 0 8px;
  white-space: nowrap;
}

.symbol-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.symbol-avatar {
  --avatar-h: 195;
  width: 18px;
  height: 18px;
  border: 1px solid hsl(var(--avatar-h) 65% 45% / 0.45);
  background: radial-gradient(circle at 30% 30%, hsl(var(--avatar-h) 70% 55% / 0.35), rgba(6, 10, 17, 0.72));
  color: #d2e4ff;
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.model-indicator {
  align-items: center;
}

.model-select {
  border: none;
  background: transparent;
  color: #d2e4ff;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
  padding: 0;
  margin: 0;
  outline: none;
  cursor: pointer;
}

.model-select:disabled {
  opacity: 0.6;
  cursor: default;
}

.strategy-entry-threshold-control {
  display: inline-grid;
  grid-template-columns: auto 58px auto auto;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  min-height: 0;
}

.strategy-entry-threshold-control label {
  color: #8ea6cc;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.strategy-entry-threshold-control input {
  width: 58px;
  height: 22px;
  border: 1px solid rgba(79, 184, 255, 0.3);
  background: rgba(6, 14, 27, 0.92);
  color: #d6e2ff;
  font-size: 11px;
  letter-spacing: 0.02em;
  padding: 2px 6px;
}

.strategy-entry-threshold-control #account-entry-threshold-apply {
  height: 22px;
  min-width: 0;
  padding: 0 7px;
}

.strategy-entry-threshold-control #account-entry-threshold-apply.is-saving {
  animation: entry-threshold-apply-pulse 0.9s ease-in-out infinite;
}

@keyframes entry-threshold-apply-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(79, 184, 255, 0.0);
    opacity: 0.95;
  }
  50% {
    box-shadow: 0 0 10px 1px rgba(79, 184, 255, 0.45);
    opacity: 1;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(79, 184, 255, 0.0);
    opacity: 0.95;
  }
}

.strategy-entry-threshold-control .account-entry-threshold-status {
  min-height: 0;
  white-space: nowrap;
}

.chart-timeframe {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  background: #0a0f1a;
}

.chart-tf-btn {
  border: none;
  border-right: 1px solid var(--line-strong);
  background: transparent;
  color: #9eb0ce;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  padding: 3px 5px;
  cursor: pointer;
}

.chart-tf-btn:last-child {
  border-right: none;
}

.chart-tf-btn:hover {
  background: #152033;
}

.chart-tf-btn.active {
  background: #173055;
  color: #d2e4ff;
}

.chart-tf-btn:disabled,
.chart-tf-btn.disabled {
  color: #54637f;
  cursor: not-allowed;
  background: transparent;
}

.chart-tf-btn:disabled:hover,
.chart-tf-btn.disabled:hover {
  background: transparent;
}

.chart-indicator-toggle {
  border: 1px solid #2f5a93;
  background: #132742;
  color: #cfe2ff;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  padding: 3px 7px;
  text-transform: uppercase;
  cursor: pointer;
}

.chart-indicator-toggle:hover {
  background: #19345d;
}

.chart-indicator-toggle.off {
  border-color: #4a556e;
  background: #1a2030;
  color: #9ba8bf;
}

.chart-refresh-btn:disabled {
  opacity: 0.72;
  cursor: default;
}

.chart-position-lines {
  position: absolute;
  inset: 1px;
  pointer-events: none;
  overflow: hidden;
  z-index: 4;
}

.chart-guide-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

.chart-guide-line.entry {
  border-top-color: rgba(79, 184, 255, 0.75);
}

.chart-guide-line.sl {
  border-top-color: rgba(255, 77, 94, 0.78);
}

.chart-guide-line.tp {
  border-top-color: rgba(0, 208, 135, 0.76);
}

.chart-guide-line.ltp {
  border-top-color: rgba(255, 159, 67, 0.8);
}

.chart-guide-line.l1tp {
  border-top-color: rgba(255, 159, 67, 0.26);
}

.chart-guide-line.l2tp {
  border-top-color: rgba(255, 159, 67, 0.38);
}

.chart-guide-line.l3tp {
  border-top-color: rgba(255, 159, 67, 0.52);
}

.chart-guide-line.d1 {
  border-top-color: rgba(82, 184, 255, 0.52);
}

.chart-guide-line.d2 {
  border-top-color: rgba(62, 157, 255, 0.62);
}

.chart-guide-line.fee {
  border-top-color: rgba(193, 203, 221, 0.72);
}

.chart-guide-line.projected-sl {
  border-top-color: rgba(255, 77, 94, 0.24);
}

.chart-guide-line.projected-tp {
  border-top-color: rgba(0, 208, 135, 0.24);
}

.chart-guide-line.projected-ltp {
  border-top-color: rgba(255, 159, 67, 0.34);
}

.chart-guide-line.projected-l1tp {
  border-top-color: rgba(255, 159, 67, 0.24);
}

.chart-guide-line.projected-l2tp {
  border-top-color: rgba(255, 159, 67, 0.34);
}

.chart-guide-line.projected-l3tp {
  border-top-color: rgba(255, 159, 67, 0.46);
}

.chart-guide-line.projected-d1 {
  border-top-color: rgba(82, 184, 255, 0.40);
}

.chart-guide-line.projected-d2 {
  border-top-color: rgba(62, 157, 255, 0.48);
}

.chart-guide-line.projected-fee {
  border-top-color: rgba(193, 203, 221, 0.52);
}

.chart-guide-line.projected-draggable {
  pointer-events: none;
  cursor: default;
  touch-action: none;
}

.chart-guide-line.projected-draggable .chart-guide-label {
  pointer-events: auto;
  cursor: default;
}

.chart-guide-line.projected-dragging {
  border-top-style: solid;
  border-top-width: 2px;
}

.chart-guide-line-label-shift-down .chart-guide-label {
  top: 7px;
}

.chart-guide-line.indicator {
  border-top-style: solid;
  border-top-width: 1px;
  opacity: 0.78;
}

.chart-guide-label {
  position: absolute;
  right: 5px;
  top: -8px;
  border: 1px solid var(--line-strong);
  background: #091020;
  color: #c8d7ef;
  font-size: 9px;
  padding: 1px 4px;
  text-transform: uppercase;
  pointer-events: none;
}

.chart-guide-label.chart-guide-label-left {
  left: 8px;
  right: auto;
}

.chart-guide-label.indicator {
  background: rgba(9, 16, 32, 0.92);
  color: #d4e2f8;
  border-color: rgba(126, 160, 214, 0.55);
}

.chart-guide-label.projected {
  opacity: 0.92;
}

body.chart-risk-dragging {
  user-select: none;
  cursor: ns-resize;
}

.chart-sltp-confirm {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 8;
  width: min(320px, calc(100% - 24px));
  border: 1px solid #35639d;
  background: rgba(8, 14, 26, 0.95);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  padding: 8px;
  display: grid;
  gap: 6px;
}

.chart-sltp-confirm-title {
  color: #d9e9ff;
  font-family: "Rajdhani", sans-serif;
  font-size: 16px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chart-sltp-confirm-copy {
  color: #a9bfdc;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  line-height: 1.4;
}

.chart-sltp-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.chart-guide-label.legend-style {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(58, 87, 131, 0.72);
  background: rgba(8, 14, 26, 0.88);
  color: #d2e2fb;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.01em;
  line-height: 1.25;
  padding: 2px 6px;
  text-transform: none;
}

.chart-guide-label.indicator-style {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 126px;
  border: 1px solid rgba(58, 87, 131, 0.72);
  background: rgba(8, 14, 26, 0.88);
  color: #d2e2fb;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.01em;
  line-height: 1.25;
  padding: 2px 6px;
  text-transform: none;
}

.chart-guide-label-swatch {
  width: 8px;
  height: 8px;
  border-radius: 1px;
  border: 1px solid rgba(196, 220, 255, 0.55);
  flex: 0 0 auto;
}

.chart-guide-label-swatch.projected-sl {
  background: #ff4d5e;
  border-color: #ff4d5e;
}

.chart-guide-label-swatch.projected-tp {
  background: #00d087;
  border-color: #00d087;
}

.chart-guide-label-swatch.projected-ltp {
  background: #ff9f43;
  border-color: #ff9f43;
}

.chart-guide-label-swatch.projected-l1tp {
  background: #ff9f43;
  border-color: #ff9f43;
  opacity: 0.46;
}

.chart-guide-label-swatch.projected-l2tp {
  background: #ff9f43;
  border-color: #ff9f43;
  opacity: 0.62;
}

.chart-guide-label-swatch.projected-l3tp {
  background: #ff9f43;
  border-color: #ff9f43;
  opacity: 0.78;
}

.chart-guide-label-swatch.projected-d1 {
  background: #52b8ff;
  border-color: #52b8ff;
  opacity: 0.78;
}

.chart-guide-label-swatch.projected-d2 {
  background: #3e9dff;
  border-color: #3e9dff;
  opacity: 0.86;
}

.chart-guide-label-swatch.projected-fee {
  background: #c1cbdd;
  border-color: #c1cbdd;
  opacity: 0.88;
}

.chart-indicator-legend-swatch.projected-sl {
  background: #ff4d5e;
  border-color: #ff4d5e;
}

.chart-indicator-legend-swatch.projected-tp {
  background: #00d087;
  border-color: #00d087;
}

.chart-indicator-legend-swatch.projected-ltp {
  background: #ff9f43;
  border-color: #ff9f43;
}

.chart-indicator-legend-swatch.projected-l1tp {
  background: #ff9f43;
  border-color: #ff9f43;
  opacity: 0.46;
}

.chart-indicator-legend-swatch.projected-l2tp {
  background: #ff9f43;
  border-color: #ff9f43;
  opacity: 0.62;
}

.chart-indicator-legend-swatch.projected-l3tp {
  background: #ff9f43;
  border-color: #ff9f43;
  opacity: 0.78;
}

.chart-indicator-legend-swatch.projected-d1 {
  background: #52b8ff;
  border-color: #52b8ff;
  opacity: 0.78;
}

.chart-indicator-legend-swatch.projected-d2 {
  background: #3e9dff;
  border-color: #3e9dff;
  opacity: 0.86;
}

.chart-indicator-legend-swatch.projected-fee {
  background: #c1cbdd;
  border-color: #c1cbdd;
  opacity: 0.88;
}

.chart-indicator-legend-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  color: #ffd2a6;
  font-variant-numeric: tabular-nums;
}

.chart-guide-label-text {
  color: #edf5ff;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.chart-position-overlay {
  position: absolute;
  left: 6px;
  bottom: 6px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  pointer-events: none;
  max-width: min(58%, 440px);
  max-height: min(42%, 240px);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 4;
}

.chart-indicator-legend {
  position: absolute;
  left: 8px;
  top: 8px;
  display: grid;
  gap: 4px;
  max-width: min(48%, 360px);
  pointer-events: none;
  z-index: 3;
}

.chart-indicator-legend-item {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid rgba(58, 87, 131, 0.72);
  background: rgba(8, 14, 26, 0.88);
  color: #d2e2fb;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.01em;
  line-height: 1.25;
  padding: 2px 6px;
  min-width: 126px;
}

.chart-indicator-legend-key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.chart-indicator-legend-swatch {
  width: 8px;
  height: 8px;
  border-radius: 1px;
  border: 1px solid rgba(196, 220, 255, 0.55);
  flex: 0 0 auto;
}

.chart-indicator-legend-swatch.chart-sltp-drag-handle {
  pointer-events: auto;
  cursor: ns-resize;
  width: 12px;
  height: 12px;
  border-width: 2px;
  box-shadow: 0 0 0 1px rgba(195, 220, 255, 0.35);
}

.chart-indicator-legend-swatch.chart-sltp-drag-handle.chart-sltp-dragging-handle {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.32);
}

.chart-indicator-legend-label {
  color: #b9cff4;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-indicator-legend-value {
  color: #edf5ff;
  font-variant-numeric: tabular-nums;
}

.position-chip {
  border: 1px solid var(--line-strong);
  background: rgba(8, 13, 22, 0.86);
  color: #c5d5ef;
  font-size: 10px;
  padding: 3px 5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.position-chip.projected {
  opacity: 0.62;
  border-style: dashed;
}

.position-chip .tag {
  border: 1px solid var(--line-strong);
  background: #101827;
  padding: 1px 4px;
}

.position-chip .entry {
  color: #4fb8ff;
}

.position-chip .tp {
  color: #00d087;
}

.position-chip .sl {
  color: #ff4d5e;
}

.indicator-chip {
  border: 1px solid #2a3550;
  background: rgba(7, 14, 26, 0.9);
  color: #c8d9f4;
  font-size: 10px;
  padding: 3px 5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.indicator-chip .tag {
  border: 1px solid #324f7f;
  background: #11213a;
  color: #cde4ff;
  padding: 1px 4px;
}

.indicator-item {
  border: 1px solid rgba(79, 184, 255, 0.32);
  background: #0f1d31;
  color: #b7d7ff;
  padding: 1px 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.perp-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 0;
}

.tabs-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 0;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.tab-btn {
  border: 1px solid var(--line-strong);
  background: #0c1019;
  color: #b9c7de;
  font-size: 11px;
  text-transform: uppercase;
  padding: 4px 6px;
  cursor: pointer;
}

.tab-btn.active {
  background: #172239;
  border-color: #3a517e;
  color: #d9e5ff;
}

.tab-btn.has-open-positions {
  border-color: rgba(0, 208, 135, 0.45);
  color: #9fe9c8;
}

.tab-btn.has-open-positions.active {
  border-color: rgba(0, 208, 135, 0.6);
  color: #d9ffef;
}

.tab-panel {
  display: none;
  min-height: 0;
}

.tab-panel.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tab-panel .table-wrap {
  flex: 1 1 auto;
  height: 100%;
  max-height: 100%;
}

.overall-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 8px;
  height: 100%;
  min-height: 0;
}

.overall-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  padding: 7px 8px;
}

.overall-panel .panel-head {
  margin-bottom: 7px;
}

.mini-label {
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
}

.big-number {
  margin: 5px 0 0;
  font-size: 21px;
  letter-spacing: 0.02em;
  font-family: "Rajdhani", sans-serif;
}

.overall-panel .big-number {
  font-size: 18px;
  margin-top: 1px;
  line-height: 1.1;
}

.overall-panel .mini-label {
  font-size: 9px;
  letter-spacing: 0.04em;
}

.overall-card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #0a1220 0%, #0a0f19 100%);
  padding: 7px 9px 6px;
  display: grid;
  align-content: start;
  gap: 3px;
  min-height: 0;
}

.overall-card-pnl {
  border-left: 2px solid rgba(0, 208, 135, 0.5);
}

.overall-card-win {
  border-left: 2px solid rgba(79, 184, 255, 0.5);
}

.overall-sub {
  margin: 1px 0 0;
  color: #8ea2c6;
  font-size: 10px;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.overall-meter {
  height: 5px;
  margin-top: 2px;
  border: 1px solid var(--line-strong);
  background: #070d17;
  position: relative;
  overflow: hidden;
}

.overall-meter-fill {
  display: block;
  height: 100%;
  width: 48%;
  transition: width 220ms ease;
}

.overall-meter-fill.up {
  background: linear-gradient(90deg, rgba(0, 208, 135, 0.35), rgba(0, 208, 135, 0.9));
}

.overall-meter-fill.down {
  background: linear-gradient(90deg, rgba(255, 77, 94, 0.35), rgba(255, 77, 94, 0.9));
}

.overall-meter-fill.neutral {
  background: linear-gradient(90deg, rgba(79, 184, 255, 0.3), rgba(79, 184, 255, 0.75));
}

.strategy-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.strategy-panel .strategy-config {
  border: 1px solid var(--line);
  background: #0a0e17;
  padding: 6px;
  margin-bottom: 0;
  min-height: 0;
  min-width: 0;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: auto;
  overscroll-behavior: contain;
}

.strategy-config #strategy-description {
  margin-top: 0;
  max-height: none;
  min-height: 140px;
  overflow: auto;
  overscroll-behavior: contain;
  line-height: 1.35;
  flex: 1 1 auto;
}

.strategy-config #assign-agent {
  margin-top: 0;
}

.strategy-config #assign-agent:disabled {
  opacity: 0.62;
}

.agents-panel {
  display: grid;
  grid-template-rows: auto minmax(92px, 1fr) auto;
  min-height: 0;
  overflow: hidden;
}

.agents-panel .table-wrap {
  min-height: 0;
  height: 100%;
  max-height: 100%;
}

.agents-panel .agents-list-wrap {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}


#agents-table .agent-software-version-cell {
  font-size: 10px;
  color: #a9bbd8;
  opacity: 0.95;
}

#agents-table .agent-process-id {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  color: #9bb0d3;
  letter-spacing: 0.02em;
}

#agents-table .agent-process-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#agents-table .agent-status-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#agents-table .agent-pos-cell {
  text-align: center;
  width: 46px;
}

#agents-table .agent-invert-cell {
  text-align: center;
  width: 38px;
  font-weight: 700;
  color: #7dd3fc;
}

#agents-table .agent-action-cell {
  text-align: center;
  width: 78px;
}

#agents-table .agent-pos-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

#agents-table .agent-pos-dot {
  width: 8px;
  height: 8px;
}

#agents-table .agent-row-toggle-btn {
  min-width: 58px;
  height: 20px;
  padding: 0 6px;
  font-size: 10px;
}

#agents-table .agent-row-flush-btn {
  min-width: 64px;
  height: 20px;
  padding: 0 6px;
  font-size: 10px;
}

.agent-selected-card {
  margin-top: 6px;
  border: 1px solid var(--line);
  background: #090d14;
  padding: 6px;
  display: grid;
  gap: 6px;
  min-height: 0;
}

.agent-selected-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.agent-selected-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.selected-agent-revise-btn {
  min-width: 82px;
  height: 24px;
  padding: 0 8px;
  white-space: nowrap;
}

.selected-agent-strategy-box {
  margin-top: 0;
  max-height: 68px;
  overflow: auto;
  overscroll-behavior: contain;
}

.strategy-config::before {
  content: "";
  display: none;
}

.account-metric {
  grid-column: 9 / 10;
  grid-row: 1;
  display: grid;
  gap: 3px;
  min-width: 0;
}

.utc-metric {
  grid-column: 8 / 9;
  grid-row: 1;
}

.account-mini-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 5px;
  min-height: 18px;
  min-width: 0;
}

.account-mini-head .account-plan {
  justify-self: end;
  width: max-content;
}

.account-mini-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.account-entry-threshold-row {
  display: grid;
  grid-template-columns: auto 78px auto 1fr;
  align-items: center;
  justify-content: end;
  gap: 6px;
}

.account-entry-threshold-row label {
  color: #8ea6cc;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.account-entry-threshold-row input {
  width: 100%;
  min-width: 0;
  height: 24px;
  border: 1px solid rgba(79, 184, 255, 0.3);
  background: rgba(6, 14, 27, 0.92);
  color: #d6e2ff;
  font-size: 12px;
  letter-spacing: 0.02em;
  padding: 2px 6px;
}

.account-entry-threshold-row input:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.account-entry-threshold-status {
  color: #8ea6cc;
  font-size: 10px;
  min-height: 12px;
  justify-self: start;
  white-space: nowrap;
}

#account-entry-threshold-apply {
  height: 24px;
  padding: 0 8px;
}

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

.risk-preset-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  margin-top: 2px;
}

.risk-estimates {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 0;
}

.risk-pill {
  border: 1px solid rgba(79, 184, 255, 0.28);
  background: linear-gradient(180deg, rgba(9, 17, 30, 0.9) 0%, rgba(8, 14, 25, 0.94) 100%);
  padding: 6px;
  display: grid;
  gap: 6px;
  align-content: start;
  min-width: 0;
}

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

.field-wide {
  grid-column: 1 / -1;
}

.field label {
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
}

.info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  margin-left: 4px;
  border: 1px solid rgba(142, 162, 198, 0.45);
  border-radius: 50%;
  color: #9eb0ce;
  font-size: 9px;
  line-height: 1;
  cursor: help;
}

.field input,
.field select {
  border: 1px solid var(--line-strong);
  background: #060a11;
  color: var(--text-main);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  padding: 4px 5px;
  border-radius: 0;
}

.strategy-parameter-cards {
  margin-top: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.strategy-param-card {
  border: 1px solid rgba(79, 184, 255, 0.28);
  background: linear-gradient(180deg, rgba(9, 17, 30, 0.9) 0%, rgba(8, 14, 25, 0.94) 100%);
  padding: 5px 6px;
  display: grid;
  gap: 5px;
  align-content: start;
  min-width: 0;
}

.strategy-layered-toggle-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.strategy-param-label {
  color: #9eb3d4;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.analysis-result-box {
  margin: 0;
  min-height: 26px;
  border: 1px solid rgba(79, 184, 255, 0.42);
  background: linear-gradient(180deg, rgba(10, 20, 36, 0.92) 0%, rgba(7, 14, 26, 0.92) 100%);
  color: #d6e6ff;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  padding: 4px 8px;
}

.strategy-param-value {
  width: 100%;
}

.strategy-param-card > input:disabled {
  opacity: 1;
  color: #d6e6ff;
  border-color: rgba(79, 184, 255, 0.42);
  background: linear-gradient(180deg, rgba(10, 20, 36, 0.92) 0%, rgba(7, 14, 26, 0.92) 100%);
}

.strategy-inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #d6e6ff;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

.strategy-inline-check input[type="checkbox"] {
  accent-color: #11d3a7;
  width: 14px;
  height: 14px;
}

.analysis-result-input {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.maxhold-hidden-row {
  display: none !important;
}

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

.analysis-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.analysis-row .btn {
  width: auto;
  min-width: 102px;
  padding-left: 8px;
  padding-right: 8px;
  margin-top: 0;
  flex: 0 0 auto;
}

.analysis-row #assign-agent {
  min-width: 86px;
}

.strategy-assign-target {
  min-width: 138px;
  max-width: 180px;
  border: 1px solid var(--line-strong);
  background: #060a11;
  color: var(--text-main);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  padding: 4px 6px;
  border-radius: 0;
  text-transform: uppercase;
}

.btn-secondary {
  background: #0f1a2c;
  border-color: #2f486f;
}

.btn-secondary:hover {
  background: #162844;
}

.analyze-status {
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  text-align: center;
  min-width: 0;
}

.analyze-status-box {
  border: 1px solid rgba(79, 184, 255, 0.35);
  background: linear-gradient(180deg, rgba(9, 16, 30, 0.9) 0%, rgba(8, 14, 24, 0.95) 100%);
  color: #9db4d8;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.04em;
  padding: 6px 8px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.analyze-status-box.is-error {
  border-color: rgba(255, 77, 94, 0.7);
  background: linear-gradient(180deg, rgba(52, 10, 16, 0.92) 0%, rgba(32, 8, 12, 0.96) 100%);
  color: #ff7f8a;
  font-weight: 700;
}

.strategy-box {
  margin-top: 0;
  border: 1px solid var(--line);
  background: #090d14;
  color: #c5d5ef;
  font-size: 11px;
  line-height: 1.4;
  padding: 8px;
  min-height: 48px;
}

.strategy-box.is-editing {
  border-color: rgba(79, 184, 255, 0.6);
  background: #080d18;
  box-shadow: inset 0 0 0 1px rgba(79, 184, 255, 0.15);
}

.strategy-description-block {
  margin-top: 2px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(8, 14, 24, 0.92) 0%, rgba(7, 12, 20, 0.96) 100%);
  display: flex;
  flex-direction: column;
  min-height: 190px;
}

.strategy-description-block .strategy-box {
  border: none;
  background: transparent;
  box-shadow: none;
}

#strategy-description {
  min-height: 140px;
  max-height: none;
  overflow: auto;
  flex: 1 1 auto;
}

.strategy-description-actions {
  margin-top: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  border-top: 1px solid rgba(79, 184, 255, 0.22);
  background: rgba(8, 14, 24, 0.55);
  padding: 6px 8px;
}

.strategy-description-btn {
  margin-top: 0;
  width: auto;
  min-width: 64px;
  padding: 3px 8px;
}

.strategy-description-hint {
  color: #8ea4c7;
  font-size: 10px;
  letter-spacing: 0.02em;
  flex: 1 1 100%;
  min-width: 0;
}

.strategy-description-hint.error {
  color: #ffb4bc;
}

.strategy-input-constraints {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid rgba(79, 184, 255, 0.2);
  background: rgba(9, 15, 27, 0.75);
  padding: 5px 7px;
}

.strategy-debug-log {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.strategy-description-summary {
  white-space: pre-wrap;
  word-break: break-word;
}

.strategy-error-banner {
  border: 1px solid rgba(255, 77, 94, 0.65);
  background: rgba(255, 77, 94, 0.12);
  color: #ffc2c8;
  padding: 6px;
  margin-bottom: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.strategy-downloads {
  margin-top: 6px;
  width: 100%;
  text-align: right;
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.strategy-download-row {
  display: contents;
}

.strategy-download-link {
  color: #9ec8ff;
  text-decoration: none;
  border: 1px solid rgba(79, 184, 255, 0.35);
  background: rgba(9, 16, 32, 0.85);
  padding: 3px 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: inline-block;
  width: fit-content;
  margin-left: 0;
}

.strategy-download-link:hover {
  color: #c4e0ff;
  border-color: rgba(79, 184, 255, 0.55);
  background: rgba(19, 38, 70, 0.85);
}

@media (max-width: 1220px) {
  .analysis-controls-grid {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .strategy-assign-target {
    min-width: 100%;
    max-width: 100%;
    flex: 1 1 100%;
  }

  .strategy-description-hint {
    width: 100%;
  }

  .analyze-status-box {
    width: 100%;
    justify-content: flex-start;
  }

  .risk-estimates {
    grid-template-columns: 1fr;
  }

  .strategy-parameter-cards {
    grid-template-columns: 1fr;
  }
}

.btn {
  margin-top: 7px;
  width: 100%;
  border: 1px solid #3464a2;
  background: #13253f;
  color: #d2e4ff;
  padding: 5px 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
  cursor: pointer;
}

.btn:hover {
  background: #183158;
}

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

.btn-small {
  border: 1px solid #39588f;
  background: #12223b;
  color: #d8e6ff;
  font-size: 10px;
  padding: 2px 5px;
  cursor: pointer;
}

.btn-small:hover {
  background: #19345d;
}

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

.btn-small-danger {
  border-color: #6f3442;
  background: #311722;
  color: #ffd0d7;
}

.btn-small-danger:hover {
  background: #4a1e30;
}

.btn-small-success {
  border-color: #1f5d47;
  background: #103427;
  color: #bff5dd;
}

.btn-small-success:hover {
  background: #154a36;
}

.positions-action-cell {
  white-space: nowrap;
}

.positions-close-btn {
  min-width: 6ch;
}

.tx-toast-stack {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 2400;
  display: grid;
  gap: 8px;
  width: min(420px, calc(100vw - 22px));
  pointer-events: none;
}

.tx-toast {
  pointer-events: auto;
  border: 1px solid var(--line-strong);
  border-left-width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(13, 19, 32, 0.98) 0%, rgba(10, 15, 26, 0.98) 100%);
  color: var(--text-main);
  padding: 8px 10px;
  box-shadow: 0 8px 24px rgba(2, 5, 10, 0.4);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 140ms ease, transform 140ms ease;
  cursor: pointer;
}

.tx-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.tx-toast-info {
  border-left-color: var(--accent);
}

.tx-toast-success {
  border-left-color: var(--up);
}

.tx-toast-error {
  border-left-color: var(--down);
}

.tx-toast-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.tx-toast-body {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
  word-break: break-word;
  line-height: 1.4;
}

.agents-stop-all-btn {
  min-width: 82px;
}

.agents-start-all-btn {
  min-width: 82px;
  border-color: rgba(0, 208, 135, 0.5);
  color: #93ffd7;
  background: rgba(0, 208, 135, 0.16);
}

.agents-start-all-btn:hover:not(:disabled) {
  background: rgba(0, 208, 135, 0.24);
}

.agents-flush-all-btn {
  min-width: 82px;
}

.agents-flush-all-btn:not(:disabled) {
  border-color: rgba(0, 208, 135, 0.5);
  color: #93ffd7;
  background: rgba(0, 208, 135, 0.16);
}

.agents-flush-all-btn:hover:not(:disabled) {
  background: rgba(0, 208, 135, 0.24);
}

.agents-start-selected-btn:not(:disabled) {
  border-color: rgba(0, 208, 135, 0.5);
  color: #93ffd7;
  background: rgba(0, 208, 135, 0.16);
}

.agents-start-selected-btn:hover:not(:disabled) {
  background: rgba(0, 208, 135, 0.24);
}

.positions-row-selectable {
  cursor: pointer;
}

.positions-row-selectable:hover {
  background: rgba(24, 45, 78, 0.34);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 4, 8, 0.74);
  display: grid;
  place-items: center;
  z-index: 140;
  padding: 10px;
}

.modal-overlay[hidden] {
  display: none;
}

.maintenance-modal {
  position: fixed;
  inset: 0;
  z-index: 2200;
  background: rgba(3, 6, 10, 0.82);
  display: grid;
  place-items: center;
  padding: 14px;
}

.maintenance-modal[hidden] {
  display: none;
}

.maintenance-modal-panel {
  width: min(460px, 100%);
  min-height: 190px;
  text-align: left;
  border-color: rgba(79, 184, 255, 0.42);
  background: radial-gradient(circle at 20% 10%, rgba(0, 208, 135, 0.1) 0%, rgba(10, 16, 28, 0.96) 40%, rgba(8, 12, 22, 0.98) 100%);
}

.maintenance-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 0;
  border: none;
  background: transparent;
  padding: 0;
  width: fit-content;
}

.maintenance-brand img {
  width: 22px;
  height: 22px;
  display: block;
  animation: startup-logo-pulse 1.35s ease-in-out infinite;
}

.maintenance-brand span {
  color: #c7ddff;
  font-family: "Rajdhani", sans-serif;
  font-size: 21px;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.maintenance-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 120px;
}

.maintenance-content .modal-head {
  justify-content: center;
}

.maintenance-content h3 {
  margin: 0;
}

#maintenance-message {
  margin: 10px 0 0;
  color: #c7d6ee;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  letter-spacing: 0.03em;
  text-align: center;
}

.modal-panel {
  width: min(520px, 100%);
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, #0b1019 0%, #0a0f18 100%);
  padding: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.48);
}

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

.modal-head h3 {
  margin: 0;
  font-family: "Rajdhani", sans-serif;
  font-size: 18px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.modal-close {
  width: 22px;
  height: 22px;
  border: 1px solid var(--line-strong);
  background: #0a0f1a;
  color: #c7d5ef;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  cursor: pointer;
}

.modal-close:hover {
  background: #16243d;
}

.modal-copy {
  margin: 6px 0;
  color: var(--text-muted);
  font-size: 11px;
}

.modal-form {
  border: 1px solid var(--line);
  background: #080d15;
  padding: 6px;
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 6px 8px;
}

.modal-form label {
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  align-self: center;
}

.modal-form input {
  border: 1px solid var(--line-strong);
  background: #060a11;
  color: var(--text-main);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 0;
}

.modal-form select {
  border: 1px solid var(--line-strong);
  background: #060a11;
  color: var(--text-main);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 0;
}

.integration-fields {
  grid-column: 1 / -1;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 6px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 6px;
  margin-top: 2px;
}

.provider-form {
  display: none;
}

.provider-form.active {
  display: grid;
}

.integration-fields-head {
  grid-column: 1 / -1;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #93a9cc;
  border: 1px solid var(--line);
  background: #070c14;
  padding: 4px 6px;
}

.modal-hint {
  grid-column: 2;
  margin-top: -3px;
  color: #8fa6ca;
  font-size: 10px;
}

.modal-actions {
  margin-top: 7px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.modal-actions .btn {
  margin-top: 0;
}

.modal-status {
  margin-top: 6px;
  border: 1px solid var(--line);
  background: #090d14;
  color: #9eb0ce;
  font-size: 11px;
  padding: 5px 6px;
}

.subscription-modal-panel {
  width: min(640px, 100%);
}

.startup-fetch-panel {
  width: min(420px, 100%);
  text-align: left;
  min-height: 180px;
  display: grid;
  grid-template-rows: auto 1fr;
}

.startup-fetch-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 0;
  border: none;
  background: transparent;
  padding: 0;
  width: fit-content;
}

.startup-fetch-brand img {
  width: 22px;
  height: 22px;
  display: block;
  animation: startup-logo-pulse 1.35s ease-in-out infinite;
}

.startup-fetch-brand span {
  color: #c7ddff;
  font-family: "Rajdhani", sans-serif;
  font-size: 21px;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.startup-fetch-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.startup-fetch-content .modal-head {
  justify-content: center;
}

.startup-fetch-copy {
  margin: 10px 0 0;
  color: #c7d6ee;
  font-size: 13px;
  letter-spacing: 0.03em;
  text-align: center;
}

@keyframes startup-logo-pulse {
  0% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(79, 184, 255, 0.0));
  }
  50% {
    transform: scale(1.08);
    filter: drop-shadow(0 0 8px rgba(79, 184, 255, 0.42));
  }
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(79, 184, 255, 0.0));
  }
}

@keyframes topbar-logo-mark-pulse {
  0% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(79, 184, 255, 0));
  }
  50% {
    transform: scale(1.09);
    filter: drop-shadow(0 0 6px rgba(79, 184, 255, 0.38));
  }
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(79, 184, 255, 0));
  }
}

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

.subscription-plan-card {
  border: 1px solid var(--line-strong);
  background: #0a0f1a;
  color: #b9cbe8;
  text-align: left;
  padding: 8px;
  display: grid;
  gap: 3px;
  cursor: not-allowed;
  opacity: 0.86;
}

.subscription-plan-card:disabled {
  color: #95a7c3;
}

.subscription-plan-name {
  font-family: "Rajdhani", sans-serif;
  font-size: 18px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.subscription-plan-meta {
  font-size: 11px;
  color: #8fa6ca;
}

.subscription-plan-current {
  border-color: rgba(0, 208, 135, 0.58);
  background: linear-gradient(180deg, rgba(0, 208, 135, 0.11) 0%, #0a0f1a 100%);
}

.opportunities-modal-panel {
  width: min(620px, 100%);
}

.market-times-modal-panel {
  width: min(760px, 100%);
}

.market-times-table td:nth-child(2),
.market-times-table td:nth-child(3),
.market-times-table td:nth-child(4),
.market-times-table th:nth-child(2),
.market-times-table th:nth-child(3),
.market-times-table th:nth-child(4) {
  text-align: right;
}

.opportunities-list {
  margin-top: 8px;
  max-height: 360px;
  overflow: auto;
  display: grid;
  gap: 6px;
}

.opportunity-header {
  width: 100%;
  border: 1px solid var(--line);
  background: #0a101a;
  color: #8ea2c5;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 5px 8px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) minmax(90px, 0.95fr) minmax(88px, 0.9fr) 58px;
  gap: 8px;
  align-items: center;
}

.opportunity-header span:nth-child(3),
.opportunity-header span:nth-child(4),
.opportunity-header span:nth-child(5) {
  text-align: right;
}

.opportunity-item {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: #0a1221;
  color: #d7e3fa;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  padding: 6px 8px;
  text-align: left;
  cursor: pointer;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) minmax(90px, 0.95fr) minmax(88px, 0.9fr) 58px;
  gap: 8px;
  align-items: center;
}

.opportunity-item:hover {
  background: #142746;
}

.opportunity-rank {
  color: #95a9c8;
}

.opportunity-symbol {
  color: #dff0ff;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.opportunity-symbol-change {
  color: #95a9c8;
  font-size: 10px;
  font-weight: 400;
  white-space: nowrap;
}

.opportunity-symbol-change.up {
  color: #24e4ad;
}

.opportunity-symbol-change.down {
  color: #ff6c7a;
}

.opportunity-volume {
  color: #9fb0cc;
  min-width: 0;
  text-align: right;
}

.opportunity-volatility {
  color: #a6bde0;
  min-width: 0;
  text-align: right;
}

.opportunity-score {
  color: #26e4af;
  font-weight: 700;
  min-width: 36px;
  text-align: right;
}

#activity-log {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  max-height: none;
  overflow: auto;
  border: 1px solid var(--line);
  background: #090d14;
}

#activity-log li {
  font-size: 11px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding: 4px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

#activity-log li:last-child {
  border-bottom: none;
}

.log-badge {
  border: 1px solid var(--line-strong);
  background: #0a0f1a;
  color: #9eb0ce;
  font-size: 10px;
  padding: 1px 4px;
  text-transform: uppercase;
  flex: 0 0 auto;
}

.log-message {
  min-width: 0;
  flex: 1 1 auto;
}

.log-copy-btn {
  margin-left: auto;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(90, 113, 153, 0.72);
  background: rgba(9, 14, 24, 0.9);
  color: #9eb0ce;
  cursor: pointer;
  position: relative;
  flex: 0 0 18px;
  padding: 0;
}

.log-copy-btn::before,
.log-copy-btn::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  border: 1px solid currentColor;
  background: transparent;
}

.log-copy-btn::before {
  top: 5px;
  left: 4px;
}

.log-copy-btn::after {
  top: 3px;
  left: 6px;
}

.log-copy-btn:hover {
  color: #cde1ff;
  border-color: rgba(126, 160, 214, 0.8);
  background: rgba(14, 24, 40, 0.96);
}

.log-copy-btn:focus-visible {
  outline: 1px solid #2f66b1;
  outline-offset: 1px;
}

.log-copy-btn.copied {
  color: #00d087;
  border-color: rgba(0, 208, 135, 0.75);
}

.log-copy-btn.copy-failed {
  color: #ff6c7a;
  border-color: rgba(255, 108, 122, 0.72);
}

#activity-log li.log-open .log-badge {
  color: #00d087;
  border-color: rgba(0, 208, 135, 0.5);
}

#activity-log li.log-entry .log-badge {
  color: #4fb8ff;
  border-color: rgba(79, 184, 255, 0.55);
}

#activity-log li.log-exit .log-badge {
  color: #ffcb4f;
  border-color: rgba(255, 203, 79, 0.55);
}

#activity-log li.log-open .log-message {
  color: #9fe9c8;
}

#activity-log li.log-entry .log-message {
  color: #9ccfff;
}

#activity-log li.log-exit .log-message {
  color: #f6d893;
}

.admin-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 12, 0.52);
  z-index: 150;
  opacity: 0;
  transition: opacity 180ms ease;
}

.admin-drawer-backdrop.open {
  opacity: 1;
}

.admin-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(640px, 98vw);
  height: 100vh;
  border-left: 1px solid var(--line-strong);
  background: linear-gradient(180deg, #0b1019 0%, #09101a 100%);
  z-index: 160;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  transform: translateX(100%);
  opacity: 0;
  transition: transform 220ms ease, opacity 180ms ease;
  box-shadow: -14px 0 34px rgba(0, 0, 0, 0.5);
}

.admin-drawer.open {
  transform: translateX(0);
  opacity: 1;
}

.admin-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.admin-drawer-head h3 {
  margin: 0;
  font-family: "Rajdhani", sans-serif;
  font-size: 19px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-drawer-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.admin-drawer-body {
  padding: 8px;
  overflow: auto;
  display: grid;
  gap: 8px;
  align-content: start;
}

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

.admin-kpi {
  border: 1px solid var(--line);
  background: #0a0f18;
  padding: 7px;
  display: grid;
  gap: 3px;
}

.admin-kpi-label {
  color: #90a5c8;
  font-size: 10px;
  text-transform: uppercase;
}

.admin-kpi-value {
  font-family: "Rajdhani", sans-serif;
  font-size: 24px;
  line-height: 1;
  color: #e8f0ff;
}

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

.admin-actions-row .btn-small {
  width: 100%;
  min-width: 0;
}

.admin-section {
  border: 1px solid var(--line);
  background: #090e16;
}

.admin-section summary {
  cursor: pointer;
  padding: 7px 8px;
  color: #b8c7e1;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line);
}

.admin-metrics-grid {
  display: grid;
  gap: 0;
}

.admin-metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
}

.admin-metric-row:last-child {
  border-bottom: none;
}

.admin-metric-row span {
  color: var(--text-muted);
}

.admin-metric-row strong {
  color: #e0ebff;
  font-weight: 600;
}

.admin-users-table-wrap {
  max-height: min(42vh, 360px);
  overflow-x: auto;
  overflow-y: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-users-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #0a111c;
}

.admin-users-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  font-size: 11px;
}

.admin-users-table th,
.admin-users-table td {
  padding: 7px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  white-space: nowrap;
}

.admin-users-table th {
  color: #a9bbd8;
  font-size: 10px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.admin-users-table td {
  color: #d9e8ff;
}

.admin-users-empty {
  color: #8098bf;
}

.admin-users-status {
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.admin-users-status.online {
  color: #00d087;
}

.admin-users-status.offline {
  color: #93a4bf;
}

.admin-users-pnl.up {
  color: #00d087;
}

.admin-users-pnl.down {
  color: #ff4d5e;
}

.admin-comms-events {
  margin-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  max-height: 190px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 8px;
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-size: 10px;
  line-height: 1.45;
  color: #9cb1d3;
  white-space: pre-wrap;
}

.tab-panel.agent-activity-tab {
  min-height: 0;
}

.tab-panel.agent-activity-tab.active {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 6px;
}

.tab-panel.agent-activity-tab .agent-activity-head {
  display: grid;
  gap: 6px;
  align-content: start;
}

.tab-panel.agent-activity-tab .activity-head-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.activity-verbose-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: #9cb1d3;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  user-select: none;
}

.activity-verbose-toggle input[type="checkbox"] {
  transform: translateY(0.5px);
}

.tab-panel.agent-activity-tab .activity-download-btn {
  margin-left: auto;
  flex: 0 0 auto;
}

.tab-panel.agent-activity-tab #activity-log {
  min-height: 0;
  height: 100%;
  margin-top: 0;
}

.activity-meta {
  margin-top: 0;
  border: 1px solid var(--line);
  background: #090d14;
  color: #9cb1d3;
  font-size: 11px;
  line-height: 1.35;
  padding: 6px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.activity-meta .meta-pill {
  border: 1px solid var(--line-strong);
  background: #0a111f;
  padding: 2px 6px;
  font-size: 10px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.activity-meta .meta-pill.meta-pnl.up {
  border-color: rgba(0, 208, 135, 0.45);
  color: #9fe9c8;
}

.activity-meta .meta-pill.meta-pnl.down {
  border-color: rgba(255, 77, 94, 0.45);
  color: #ffc2c8;
}

.activity-meta .meta-pill.meta-proximity {
  border-color: rgba(42, 102, 169, 0.45);
  color: #b8d8ff;
}

.activity-meta .meta-pill.meta-proximity.up {
  border-color: rgba(0, 208, 135, 0.45);
  color: #9fe9c8;
}

.activity-meta .meta-pill.meta-proximity.down {
  border-color: rgba(255, 77, 94, 0.45);
  color: #ffc2c8;
}

.activity-meta .meta-pill.meta-best-side.long {
  border-color: rgba(0, 208, 135, 0.45);
  color: #9fe9c8;
}

.activity-meta .meta-pill.meta-best-side.short {
  border-color: rgba(255, 77, 94, 0.45);
  color: #ffc2c8;
}

.activity-meta .meta-pill.meta-pas {
  border-color: rgba(106, 138, 196, 0.42);
  color: #c2d9ff;
}

.activity-meta .meta-pill.meta-pas.long {
  border-color: rgba(0, 208, 135, 0.45);
  color: #9fe9c8;
}

.activity-meta .meta-pill.meta-pas.short {
  border-color: rgba(255, 77, 94, 0.45);
  color: #ffc2c8;
}

.activity-meta .meta-pill.meta-agent-id {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.meta-copy-btn {
  border: 1px solid rgba(111, 144, 194, 0.45);
  background: #0a1322;
  color: #bdd8ff;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  line-height: 1;
  padding: 1px 4px;
  cursor: pointer;
}

.meta-copy-btn:hover {
  background: #12203a;
}

.meta-copy-btn:focus-visible {
  outline: 1px solid rgba(79, 184, 255, 0.6);
  outline-offset: 1px;
}

.meta-copy-btn.copied {
  border-color: rgba(0, 208, 135, 0.52);
  color: #9fe9c8;
}

.meta-copy-btn.copy-failed {
  border-color: rgba(255, 77, 94, 0.55);
  color: #ffc2c8;
}

.activity-manual-entry-btn {
  margin-left: auto;
  min-width: 110px;
  text-transform: uppercase;
}

.trade-size-basis-cell {
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

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

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

.flash-up {
  animation: flash-up 500ms ease-out;
}

.flash-down {
  animation: flash-down 500ms ease-out;
}

@keyframes flash-up {
  0% {
    background: rgba(0, 208, 135, 0.3);
  }
  100% {
    background: transparent;
  }
}

@keyframes flash-down {
  0% {
    background: rgba(255, 77, 94, 0.28);
  }
  100% {
    background: transparent;
  }
}

@media (max-width: 1260px) {
  .workspace-grid {
    grid-template-columns: minmax(0, 1fr) 6px minmax(0, 1fr);
  }

  .left-stack {
    grid-template-rows: minmax(150px, 0.19fr) 6px minmax(192px, 0.38fr) 6px minmax(194px, 0.43fr);
  }

  .right-stack {
    grid-template-rows: 410px 6px minmax(180px, 1fr);
  }
}

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

  .left-stack {
    gap: 6px;
    grid-template-rows: minmax(135px, auto) minmax(200px, auto) minmax(190px, auto);
  }

  .right-stack {
    gap: 6px;
    grid-template-rows: repeat(2, auto);
  }

  .strategy-panel {
    grid-template-rows: auto minmax(320px, auto);
  }

  .strategy-panel .strategy-config {
    padding: 5px;
    gap: 5px;
  }

  .analysis-controls-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .analysis-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.25fr);
    gap: 6px;
  }

  .analysis-row .btn,
  .analysis-row #assign-agent,
  .strategy-assign-target {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .analyze-status-box {
    width: 100%;
    justify-content: flex-start;
  }

  .agents-panel {
    grid-template-rows: auto minmax(140px, auto) auto;
  }

  .panel-splitter {
    display: none;
  }

  .column-splitter {
    display: none;
  }

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

  .account-metric {
    grid-column: span 3;
  }

  #tv-chart {
    min-height: 150px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .status-cluster {
    width: 100%;
  }

  .perp-panel .table-wrap,
  .tabs-panel .table-wrap,
  .agents-panel .table-wrap {
    max-height: 280px;
  }

  .market-toolbar {
    gap: 6px;
  }

  .market-search-input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    order: 2;
  }

  #market-opportunities-btn {
    order: 3;
  }

  .agent-activity-tab #activity-log {
    max-height: 280px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 4px 4px 120px;
    gap: 4px;
  }

  .panel {
    padding: 6px;
  }

  .brand h1 {
    font-size: 22px;
    gap: 6px;
  }

  .brand-beta-badge {
    min-height: 18px;
    padding: 0 6px;
    font-size: 9px;
  }

  .brand-logo {
    width: 34px;
    height: 34px;
  }

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

  .account-entry-threshold-row {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .strategy-entry-threshold-control {
    grid-template-columns: auto 56px auto;
  }

  .account-entry-threshold-row input {
    width: 100%;
    max-width: 140px;
  }

  .strategy-entry-threshold-control .account-entry-threshold-status {
    display: none;
  }

  #account-entry-threshold-apply {
    width: auto;
  }

  .chart-position-overlay {
    max-width: calc(100% - 12px);
  }

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

  .account-metric {
    grid-column: span 2;
  }

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

  .modal-form {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .integration-fields {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .modal-hint {
    grid-column: 1;
    margin-top: 0;
  }

  .analysis-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .analysis-row .btn,
  .strategy-assign-target {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .analyze-status,
  .analyze-status-box {
    width: 100%;
    margin-left: 0;
    text-align: left;
    justify-content: flex-start;
  }

  .risk-pill,
  .strategy-param-card {
    padding: 5px;
    gap: 5px;
  }

  .analysis-result-box {
    min-height: 26px;
    font-size: 11px;
    padding: 3px 7px;
  }

  .opportunity-header,
  .opportunity-item {
    min-width: 0;
    grid-template-columns: 34px minmax(0, 1fr) auto auto;
  }

  .opportunity-volume,
  .opportunity-volatility,
  .opportunity-score {
    justify-self: start;
  }

  .opportunity-header span:nth-child(4),
  .opportunity-item .opportunity-volatility {
    display: none;
  }

  .strategy-box {
    font-size: 10px;
    line-height: 1.35;
  }

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

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

  .admin-drawer {
    width: min(96vw, 560px);
  }

  .admin-kpi-grid {
    grid-template-columns: 1fr;
  }
}
