:root {
  --bg: #0a0f1f;
  --bg-2: #0f172a;
  --card: rgba(255, 255, 255, 0.04);
  --stroke: rgba(255, 255, 255, 0.1);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #22d3ee;
  --accent-2: #f97316;
  --danger: #ef4444;
  --success: #22c55e;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

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

body {
  margin: 0;
  background: radial-gradient(circle at 20% 20%, rgba(34, 211, 238, 0.06), transparent 30%),
    radial-gradient(circle at 80% 10%, rgba(249, 115, 22, 0.05), transparent 30%),
    linear-gradient(135deg, var(--bg), var(--bg-2));
  color: var(--text);
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 60px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.hero-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 12px;
  margin-left: auto;
}

h1 {
  margin: 0 0 8px;
  font-weight: 600;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-weight: 600;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 6px;
}

.lede {
  margin: 0;
  color: var(--muted);
  max-width: 680px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.badge-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.auth-badge .dot {
  background: var(--success);
}

.auth-logout {
  min-width: 92px;
}

.auth-login {
  min-width: 92px;
}

.badge-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.bot-badge {
  padding: 10px 14px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  transition: border-color 120ms ease, background 120ms ease;
}

.bot-badge.active {
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(34, 197, 94, 0.12);
}

.bot-badge.waiting {
  border-color: rgba(34, 211, 238, 0.5);
  background: rgba(34, 211, 238, 0.12);
}

.bot-badge.inactive {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.12);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
}

.dot.live {
  box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.6);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.7);
  }
  70% {
    box-shadow: 0 0 0 18px rgba(34, 211, 238, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 211, 238, 0);
  }
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  align-items: start;
}

.dashboard-cols {
  display: grid;
  grid-template-columns: minmax(340px, 360px) 1fr;
  gap: 18px;
  align-items: start;
}

.dashboard-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.symbols-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

body.auth-pending .nav-tabs,
body.public-mode .nav-tabs,
body.auth-pending main:not(#page-public),
body.public-mode main:not(#page-public) {
  display: none !important;
}

body.app-mode #page-public {
  display: none !important;
}

body.public-mode .page,
body.auth-pending .page {
  width: 100%;
  max-width: none;
  padding: 24px clamp(16px, 2.6vw, 42px) 56px;
}

.public-page {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.public-page > .panel.stretch,
.public-page > .public-chart-panel {
  grid-column: 1 / -1;
}

.public-hero-panel {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(34, 211, 238, 0.16), rgba(249, 115, 22, 0.07)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025)),
    rgba(255, 255, 255, 0.04);
}

.public-hero-panel::before,
.public-chart-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(34, 211, 238, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 211, 238, 0.045) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.8), transparent 78%);
}

.public-chart-panel {
  position: relative;
  overflow: hidden;
  border-color: rgba(34, 211, 238, 0.24);
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(2, 6, 23, 0.72)),
    rgba(255, 255, 255, 0.04);
}

.public-main-chart {
  min-height: 430px;
}

.public-market-card {
  margin-top: 14px;
  border-color: rgba(34, 211, 238, 0.22);
  background:
    linear-gradient(135deg, rgba(34, 211, 238, 0.08), rgba(249, 115, 22, 0.05)),
    rgba(2, 6, 23, 0.2);
}

.public-market-card .countdown-text {
  font-size: clamp(18px, 2.4vw, 30px);
  color: var(--text);
  text-align: right;
}

.public-chart-box {
  position: relative;
  height: clamp(340px, 42vh, 520px);
  min-height: 320px;
  border: 1px solid rgba(34, 211, 238, 0.16);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(2, 6, 23, 0.48), rgba(15, 23, 42, 0.18)),
    rgba(2, 6, 23, 0.22);
  overflow: hidden;
}

.public-chart-box svg {
  width: 100%;
  height: 100%;
  stroke: var(--accent);
  fill: none;
  cursor: crosshair;
  position: relative;
  z-index: 1;
  transform: translateZ(0);
  will-change: contents;
}

.public-chart-box svg:active {
  cursor: grabbing;
}

.public-table-wrap {
  overflow-x: auto;
  max-height: min(58vh, 620px);
}

.public-table {
  table-layout: fixed;
  min-width: 760px;
}

.public-position-layout {
  display: grid;
  grid-template-columns: minmax(380px, 0.85fr) minmax(0, 1.6fr);
  gap: 16px;
  align-items: start;
}

.public-position-layout > * {
  min-width: 0;
}

.public-position-table-wrap {
  max-height: min(64vh, 720px);
}

.public-position-table {
  min-width: 560px;
}

.public-position-charts {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
}

.public-position-card {
  min-width: 0;
  border: 1px solid rgba(34, 211, 238, 0.16);
  border-radius: 14px;
  padding: 12px;
  background:
    linear-gradient(135deg, rgba(34, 211, 238, 0.055), rgba(249, 115, 22, 0.04)),
    rgba(255, 255, 255, 0.035);
  contain: content;
}

.public-position-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.public-position-card-head > :first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.public-position-card h4 {
  margin: 0 0 3px;
  font-size: 16px;
}

.public-position-card [data-role="meta"] {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.public-position-pnl {
  text-align: right;
  font-weight: 800;
  font-size: 17px;
  line-height: 1.1;
}

.public-position-pnl span {
  display: block;
  font-size: 12px;
  margin-top: 3px;
}

.public-position-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.public-position-metrics span {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: var(--muted);
  background: rgba(2, 6, 23, 0.22);
  overflow-wrap: anywhere;
}

.public-position-metrics strong {
  display: block;
  color: var(--text);
  margin-top: 2px;
}

.public-position-chart-box {
  height: clamp(230px, 24vh, 340px);
  min-height: 220px;
  min-width: 0;
  padding: 0;
  display: flex;
  overflow: hidden;
}

.public-position-chart-box svg {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
}

.public-empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(148, 163, 184, 0.24);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}

.public-symbol-table {
  min-width: 840px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(8px);
}

.login-dialog {
  width: min(440px, 100%);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.98)),
    var(--bg-2);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

.login-dialog .field {
  margin-bottom: 12px;
}

.login-dialog button[type="submit"] {
  min-width: 128px;
}

.symbols-overview .panel-header {
  margin-bottom: 12px;
}

.symbols-summary {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.symbols-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(150px, 220px));
  gap: 10px;
  margin-bottom: 12px;
}

@media (max-width: 960px) {
  .dashboard-cols {
    grid-template-columns: 1fr;
  }
  .symbols-toolbar {
    grid-template-columns: 1fr;
  }
  .public-page {
    grid-template-columns: minmax(0, 1fr);
  }
  .public-position-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .public-position-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .public-market-card .countdown-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .public-market-card .countdown-text {
    text-align: left;
  }
}

.panel {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  min-width: 0;
}

.panel.stretch {
  grid-column: span 2;
}

.hidden {
  display: none !important;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-header > * {
  min-width: 0;
}

.panel-header.compact {
  justify-content: flex-start;
  align-items: flex-start;
}

.panel-header.compact > div:first-child {
  flex: 1 1 180px;
}

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

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

.trader-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}
.button-row.tiny button {
  padding: 6px 8px;
}

.panel-header .button-row {
  flex: 1 1 360px;
  justify-content: flex-end;
  min-width: min(100%, 280px);
}

.panel-header .button-row select,
.panel-header .button-row input {
  flex: 1 1 160px;
  min-width: 140px;
  max-width: 100%;
}

.panel-header.compact button,
.button-row button,
.button-row label {
  flex: 0 1 auto;
  max-width: 100%;
  white-space: normal;
}
.button-col {
  flex-direction: column;
  align-items: flex-start;
}
.button-col button {
  width: 100%;
  max-width: 160px;
}

.account-line {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.mode-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.countdown-card {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.countdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.countdown-text {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.pill.buy-guard {
  background: rgba(34, 197, 94, 0.16);
  color: var(--success);
}
.pill.buy-guard.off {
  background: rgba(239, 68, 68, 0.16);
  color: var(--danger);
}

.log-box-wrapper {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  height: 280px;
}

.log-box {
  background: #050914;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  color: #d6e0ff;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  padding: 10px;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
}
.log-box.small {
  height: 120px;
}

.panel-header.small h3 {
  margin: 0;
}

.panel-header.sub h3 {
  margin: 0;
}

.log-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

button.small {
  padding: 8px 10px;
  font-size: 13px;
}

/* Small action buttons inside tables */
.table-stacked button {
  padding: 6px 8px;
  font-size: 12px;
  border-radius: 8px;
}

.params-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.params-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.params-grid.connections-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

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

label {
  font-size: 13px;
  color: var(--muted);
}

input,
button {
  font: inherit;
}

input,
select,
button {
  min-width: 0;
  max-width: 100%;
}

input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
}

input:focus {
  outline: 2px solid var(--accent);
  border-color: transparent;
}

select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: linear-gradient(var(--bg-2), var(--bg-2));
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--accent) 50%),
    linear-gradient(135deg, var(--accent) 50%, transparent 50%),
    linear-gradient(var(--bg-2), var(--bg-2));
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%, 0 0;
  background-size: 8px 8px, 8px 8px, 100% 100%;
  background-repeat: no-repeat;
  padding-right: 34px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

select:focus {
  outline: 2px solid var(--accent);
  border-color: transparent;
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.25);
}

select:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

select option {
  background: var(--bg-2);
  color: var(--text);
}

select:disabled {
  opacity: 0.7;
}

select::-ms-expand {
  display: none;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--accent), #0ea5e9);
  color: #0b1223;
  font-weight: 600;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.2;
  transition: transform 120ms ease, box-shadow 120ms ease;
  box-shadow: 0 8px 20px rgba(14, 165, 233, 0.35);
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

button:disabled:hover {
  transform: none;
}

button.ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  box-shadow: none;
}

button.danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.5);
  box-shadow: none;
}

button.ghost.danger {
  background: rgba(239, 68, 68, 0.08);
}

.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.actions.split {
  align-items: flex-start;
}

.status {
  min-height: 18px;
  font-size: 13px;
  color: var(--muted);
}

.inline-form {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.inline-form input {
  flex: 1;
}
.inline-form button {
  min-width: 42px;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 10px;
  font-size: 20px;
}

.watchlist {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}

.symbol-pool-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.symbol-pool-scroll {
  max-height: 360px;
  overflow: auto;
}

.strategy-eval-scroll {
  max-height: 320px;
  overflow: auto;
}

.symbols-table-scroll {
  max-height: min(72vh, 720px);
  overflow: auto;
}

.symbol-pool-table {
  min-width: 1240px;
}

.strategy-eval-table {
  min-width: 1360px;
}

.symbols-table {
  table-layout: fixed;
}

.strategy-assignment-table {
  min-width: 1280px;
}

.next-day-plan-table {
  min-width: 1180px;
}

.symbols-table .col-symbol-state {
  width: 18%;
}

.symbols-table .col-category-state {
  width: 18%;
}

.symbols-table .col-scope {
  width: 20%;
}

.symbols-table .col-strategy-wide {
  width: 32%;
}

.symbols-table .col-data-plan {
  width: 20%;
}

.symbols-table .col-mode {
  width: 14%;
}

.symbols-table .col-reason-wide {
  width: 30%;
}

.strategy-eval-table .col-category-state {
  width: 16%;
}

.strategy-eval-table .col-strategy-wide {
  width: 28%;
}

.strategy-eval-table .col-reason-wide {
  width: 28%;
}

.strategy-assignment-table .col-scope {
  width: 21%;
}

.strategy-assignment-table .col-strategy-wide {
  width: 31%;
}

.strategy-assignment-table .col-mode {
  width: 14%;
}

.strategy-assignment-table .col-reason-wide {
  width: 34%;
}

.symbol-pool-table th,
.symbol-pool-table td,
.strategy-eval-table th,
.strategy-eval-table td {
  padding: 8px 10px;
}

.symbols-table th,
.symbols-table td {
  vertical-align: top;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.symbols-table td > *,
.symbols-table th > * {
  max-width: 100%;
  min-width: 0;
}

.note-wrap.wide {
  max-width: none;
}

.symbols-table .summary-pill-row {
  gap: 4px;
  min-width: 0;
  align-items: flex-start;
}

.symbols-table .compact-row {
  margin: 6px 0 4px;
}

.symbols-table .strategy-stack {
  margin-top: 8px;
}

.strategy-eval-table .metric-chip {
  margin: 2px 3px 2px 0;
}

.strategy-chip,
.strategy-name,
.strategy-subline {
  max-width: 100%;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.strategy-chip {
  display: inline-flex;
  vertical-align: top;
  justify-content: flex-start;
  width: min(100%, 260px);
}

.strategy-name,
.strategy-subline {
  display: block;
}

.symbol-cell-title {
  display: block;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.2;
  margin-bottom: 4px;
}

.token-line,
.metric-line {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.symbols-table .reason-cell {
  max-width: none;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.08), rgba(255, 255, 255, 0.04));
  color: var(--text);
}

.chip button {
  background: none;
  color: var(--muted);
  padding: 4px 6px;
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

.chip button:hover {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.4);
}

.trades {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}

.trade-column {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.column-heading {
  font-weight: 600;
  margin-bottom: 8px;
}
.column-heading.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table-stacked {
  table-layout: fixed;
}
/* Support tables up to 6 columns with balanced widths to avoid extreme wrapping */
.table-stacked th:nth-child(1),
.table-stacked td:nth-child(1) {
  width: 24%;
}
.table-stacked th:nth-child(2),
.table-stacked td:nth-child(2) {
  width: 14%;
}
.table-stacked th:nth-child(3),
.table-stacked td:nth-child(3) {
  width: 26%;
}
.table-stacked th:nth-child(4),
.table-stacked td:nth-child(4) {
  width: 16%;
}
.table-stacked th:nth-child(5),
.table-stacked td:nth-child(5) {
  width: 12%;
}
.table-stacked th:nth-child(6),
.table-stacked td:nth-child(6) {
  width: 8%;
}

.table-stacked th,
.table-stacked td {
  vertical-align: top;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.table-stacked th > *,
.table-stacked td > * {
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.table-stacked button {
  max-width: 100%;
  white-space: normal;
}

.stack-cell {
  display: table-cell;
  vertical-align: top;
}

.stack-line {
  display: block;
}

.stack-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  display: block;
  margin-bottom: 2px;
  line-height: 1.2;
}

.stack-value {
  font-weight: 600;
  display: block;
  line-height: 1.3;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.stack-value.strong {
  letter-spacing: 0.2px;
}

.table-stacked .note-wrap {
  white-space: normal;
  word-break: break-word;
}

.stats-trades {
  grid-template-columns: 1fr;
}

.stats-trade-panel.hidden {
  display: none;
}

.stats-trades-table {
  table-layout: fixed;
}

.stats-trades-table th:nth-child(1),
.stats-trades-table td:nth-child(1) {
  width: 20%;
}

.stats-trades-table th:nth-child(2),
.stats-trades-table td:nth-child(2) {
  width: 14%;
}

.stats-trades-table th:nth-child(3),
.stats-trades-table td:nth-child(3) {
  width: 18%;
}

.stats-trades-table th:nth-child(4),
.stats-trades-table td:nth-child(4) {
  width: 48%;
}

.stats-trades-table .note-wrap .stack-value {
  font-weight: 500;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

th,
td {
  text-align: left;
  padding: 6px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.pill.buy {
  background: rgba(34, 197, 94, 0.16);
  color: var(--success);
}

.pill.sell {
  background: rgba(239, 68, 68, 0.16);
  color: var(--danger);
}

.note-truncate {
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 720px) {
  .note-truncate {
    max-width: 100px;
  }
}

.note-wrap {
  max-width: 220px;
  white-space: normal;
  word-break: break-word;
}

.filters-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter input,
.filter select {
  width: 100%;
}

.checks-summary {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: 12px;
}

.summary-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

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

.checks-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.summary-tile {
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.summary-label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.summary-metric {
  font-weight: 700;
  font-size: 14px;
}

.summary-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 24px;
}

.summary-pill {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  white-space: nowrap;
}

.muted-box {
  opacity: 0.85;
}

@media (max-width: 640px) {
  .summary-top {
    flex-direction: column;
    align-items: stretch;
  }

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

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--stroke);
  border-radius: 12px;
}

.table-wide {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.table-wide th,
.table-wide td {
  padding: 10px 10px;
}

.table-wide th {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.table-wide tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.02);
}

.table-wide td.muted {
  color: var(--muted);
}

.checks-layout {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 14px;
}

.checks-main {
  width: 100%;
  max-width: 1200px;
}

.tier-panel {
  width: 100%;
  min-width: 0;
  align-self: flex-start;
}

.tier-table {
  min-width: 0;
}

.tier-table th:nth-child(1),
.tier-table td:nth-child(1) {
  width: 46px;
}

.tier-table .pnl-pos {
  color: var(--success);
}

.tier-table .pnl-neg {
  color: var(--danger);
}

.tier-divider td {
  padding: 0;
}

.tier-divider .divider-line {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 1240px) {
  .checks-layout {
    flex-direction: column;
  }
  .tier-panel {
    width: 100%;
    min-width: 0;
    flex: 1 1 auto;
  }
}

.tier-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 0 0 270px;
  min-width: 360px;
}

@media (max-width: 1240px) {
  .tier-sidebar {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
  }
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

.pill.mini {
  padding: 2px 8px;
  font-size: 11px;
}

.pill-sim {
  background: rgba(14, 165, 233, 0.16);
  color: var(--accent);
}

.pill-real {
  background: rgba(249, 115, 22, 0.16);
  color: var(--accent-2);
}

.nav-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.tab {
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
}

.tab.active {
  background: linear-gradient(135deg, var(--accent), #0ea5e9);
  color: #0b1223;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
  min-width: 0;
}

.stats-card {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
  min-width: 0;
  overflow-wrap: anywhere;
}

.stats-value {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.stats-value.pnl-pos,
.chart-tooltip .pnl-pos,
.pnl-pos {
  color: var(--success);
}

.stats-value.pnl-neg,
.chart-tooltip .pnl-neg,
.pnl-neg {
  color: var(--danger);
}

.platform-runtime-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

.platform-category-assignments {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 10px;
  margin-top: 12px;
  min-width: 0;
}

.platform-category-card {
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.025);
  min-width: 0;
}

.platform-category-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  min-width: 0;
}

.platform-category-card-head strong,
.platform-category-reason,
.platform-assignment-chips {
  overflow-wrap: anywhere;
  word-break: break-word;
}

#page-platform .panel-header .button-row,
#page-agent-live .panel-header .button-row {
  justify-content: flex-start;
}

#page-agent-live .panel-header > .button-row {
  flex: 1 1 100%;
}

#page-agent-live .panel-header > .button-row select,
#page-agent-live .panel-header > .button-row input,
#page-platform .panel-header > .button-row select,
#page-platform .panel-header > .button-row input {
  flex: 1 1 150px;
  min-width: min(100%, 130px);
}

.entity-card-list,
.run-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.entity-card {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  min-width: 0;
  overflow: hidden;
}

.entity-card[open] {
  background: rgba(255, 255, 255, 0.045);
}

.entity-card.success {
  border-left: 4px solid var(--success);
}

.entity-card.warning {
  border-left: 4px solid var(--accent-2);
}

.entity-card.error {
  border-left: 4px solid var(--danger);
}

.entity-card.info {
  border-left: 4px solid var(--accent);
}

.entity-card summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  cursor: pointer;
  min-width: 0;
  flex-wrap: wrap;
}

.entity-card summary::marker {
  color: var(--accent);
}

.entity-summary-main {
  min-width: 0;
  flex: 1 1 260px;
}

.entity-title {
  display: block;
  font-weight: 700;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.entity-subtitle {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.entity-summary-chips,
.entity-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.metric-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
  max-width: 100%;
}

.metric-chip.success {
  color: var(--success);
}

.metric-chip.warning {
  color: var(--accent-2);
}

.metric-chip.error {
  color: var(--danger);
}

.entity-card-body {
  padding: 0 12px 12px;
  min-width: 0;
}

.entity-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
  min-width: 0;
}

.entity-metric-grid > div {
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  padding: 8px;
  min-width: 0;
}

.entity-metric-grid strong,
.entity-warning {
  display: block;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.entity-warning {
  border-left: 3px solid var(--accent-2);
  background: rgba(245, 158, 11, 0.08);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
  color: var(--text);
}

.run-explorer-panel {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
  margin-bottom: 14px;
  min-width: 0;
}

.run-step-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 8px;
  min-width: 0;
}

.run-step {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  position: relative;
  min-width: 0;
}

.run-step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 18px;
  bottom: -1px;
  width: 2px;
  background: rgba(255, 255, 255, 0.12);
}

.run-step-node {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  margin-top: 4px;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12);
}

.run-step.success .run-step-node {
  background: var(--success);
}

.run-step.warning .run-step-node {
  background: var(--accent-2);
}

.run-step.error .run-step-node {
  background: var(--danger);
}

.run-step-body {
  padding-bottom: 10px;
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
}

.chart-box {
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 10px;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.58), rgba(2, 6, 23, 0.92)),
    #050914;
  height: 320px;
  min-height: 260px;
  overflow: hidden;
}

#stats-chart {
  width: 100%;
  height: 100%;
  stroke: var(--accent);
  fill: none;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

#stats-chart:active {
  cursor: grabbing;
}

.chart-tooltip {
  position: fixed;
  pointer-events: none;
  background: rgba(5, 9, 20, 0.94);
  color: var(--text);
  border: 1px solid var(--stroke);
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.35;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 80ms ease-out;
  z-index: 1000;
}

.chart-tooltip.visible {
  opacity: 1;
}

.chart-tooltip .muted {
  color: var(--muted);
  font-size: 11px;
  display: block;
  margin-bottom: 2px;
}

.alpaca-card {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.alpaca-head .meta-line {
  min-height: 16px;
  color: var(--muted);
  font-size: 12px;
}
.stream-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.alpaca-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.small {
  font-size: 12px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.agent-live-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 14px;
  align-items: stretch;
}

.control-room {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
  margin-bottom: 14px;
  min-width: 0;
}

.control-room-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  align-items: end;
}

.control-room-form .checkbox-label {
  align-self: center;
  min-height: 36px;
}

.control-room-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
  min-width: 0;
}

.control-room-status-grid .agent-timeline-item {
  min-width: 0;
  overflow-wrap: anywhere;
}

.agent-feed {
  height: 68vh;
  min-height: 420px;
  overflow: auto;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: rgba(5, 9, 20, 0.76);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.agent-message {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  padding: 10px 12px;
  min-width: 0;
}

.agent-message.success {
  border-left-color: var(--success);
}

.agent-message.warning {
  border-left-color: var(--accent-2);
}

.agent-message.error {
  border-left-color: var(--danger);
}

.agent-message-head,
.agent-message-foot,
.agent-list-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.agent-name {
  font-weight: 600;
}

.agent-meta,
.agent-message-foot {
  color: var(--muted);
  font-size: 12px;
}

.agent-message-foot.selected {
  color: var(--text);
}

.agent-message-body {
  margin: 7px 0;
  line-height: 1.45;
  word-break: break-word;
}

.agent-actions {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.agent-sidebar {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  min-height: 420px;
  min-width: 0;
}

.agent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.agent-list-item {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 13px;
}

button.agent-list-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.agent-action-status {
  margin-top: 16px;
}

.agent-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.agent-detail-panel {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  min-height: 180px;
  min-width: 0;
  overflow: hidden;
}

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

.agent-detail-grid > div {
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  padding: 8px;
  min-width: 0;
}

.agent-detail-grid span,
.agent-detail-grid strong {
  display: block;
  overflow-wrap: anywhere;
}

.agent-timeline {
  max-height: 320px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agent-timeline-item {
  border-left: 3px solid var(--accent);
  background: rgba(255, 255, 255, 0.035);
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.agent-timeline-item.success {
  border-left-color: var(--success);
}

.agent-timeline-item.warning {
  border-left-color: var(--accent-2);
}

.agent-timeline-item.error {
  border-left-color: var(--danger);
}

.entity-detail {
  max-height: 420px;
  overflow-y: auto;
  overflow-x: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.json-preview {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  padding: 10px;
}

@media (max-width: 720px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
  }
  .hero-actions {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-left: 0;
  }
  .badge-stack {
    align-items: flex-start;
  }
  .panel.stretch {
    grid-column: span 1;
  }
  .actions {
    flex-direction: column;
    align-items: flex-start;
  }
  .trader-controls {
    flex-direction: column;
    align-items: flex-start;
  }
  .agent-live-layout {
    grid-template-columns: 1fr;
  }
  .agent-detail-layout {
    grid-template-columns: 1fr;
  }
  .agent-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .control-room-form {
    grid-template-columns: 1fr;
  }
  .control-room-status-grid {
    grid-template-columns: 1fr;
  }
  .agent-feed,
  .agent-sidebar {
    min-height: 260px;
    height: auto;
  }
}
