:root {
  --bg: #090c10;
  --panel: #111821;
  --panel-soft: #16202b;
  --panel-strong: #1d2935;
  --line: #2c3947;
  --line-strong: #465669;
  --text: #eef4f8;
  --muted: #9cabba;
  --faint: #71808f;
  --accent: #f2b84b;
  --cyan: #62c3df;
  --green: #6bd394;
  --red: #f07b7b;
  --radius: 8px;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: #090c10;
  font-family: Inter, "Avenir Next", "Segoe UI", Arial, sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

h1 {
  margin-bottom: 0;
  font-size: 1.55rem;
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 1rem;
  letter-spacing: 0;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 78px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 12, 16, 0.96);
  backdrop-filter: blur(14px);
}

.view-switcher {
  position: relative;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--panel-soft);
  font-size: 1.2rem;
}

.view-mode-menu {
  position: absolute;
  top: 48px;
  left: 0;
  z-index: 30;
  display: none;
  width: 164px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.view-mode-menu.is-open {
  display: grid;
}

.view-mode-menu button,
.view-mode-buttons button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.view-mode-menu button:hover,
.view-mode-buttons button:hover {
  background: var(--panel-strong);
}

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

.eyebrow,
.section-kicker,
.metric span,
.form-panel label span,
.select-control span {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  color: var(--muted);
  font-size: 0.84rem;
}

.topbar-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.035);
}

.topbar-link:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
}

.layout-grid {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: calc(100vh - 78px);
}

.sidebar {
  padding: 18px;
  border-right: 1px solid var(--line);
  background: #0d1218;
}

.page-nav {
  display: grid;
  gap: 8px;
}

.nav-btn {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.nav-btn:hover,
.nav-btn.is-active {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--panel-soft);
}

.side-status {
  margin-top: 16px;
}

.side-status p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.main-panel {
  min-width: 0;
  padding: 20px;
}

.panel,
.alert-banner,
.story-card,
.metric {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.alert-banner {
  margin-bottom: 16px;
  padding: 13px 14px;
  color: #dff6ff;
  background: #10202a;
}

.page {
  display: none;
}

.page.is-active {
  display: block;
}

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

.inline-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.select-control {
  min-width: 190px;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--text);
  background: #0b1117;
  padding: 10px 11px;
}

textarea {
  resize: vertical;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  min-height: 96px;
  padding: 16px;
}

.metric strong {
  display: block;
  font-size: 2rem;
}

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

.story-card {
  padding: 16px;
  background: var(--readiness-bg, var(--panel));
  box-shadow:
    var(--shadow),
    0 0 0 1px var(--state-outline),
    0 0 22px color-mix(in srgb, var(--readiness-accent) 16%, transparent);
  border-color: color-mix(in srgb, var(--readiness-accent) 34%, var(--line));
}

.story-card-head,
.note-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.chapter-code {
  margin-bottom: 5px;
  color: var(--readiness-accent);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text);
  background: var(--panel-strong);
  font-size: 0.74rem;
  white-space: nowrap;
}

.story-name {
  margin-bottom: 12px;
  color: var(--muted);
}

.story-details {
  display: grid;
  gap: 8px;
}

.story-details div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 7px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 0.86rem;
}

.story-details strong {
  color: var(--text);
  text-align: right;
}

.ohlc-line {
  margin: 12px 0 0;
  color: var(--green);
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.82rem;
}

.story-note,
.muted {
  color: var(--muted);
  line-height: 1.5;
}

.story-note {
  margin: 12px 0 0;
}

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

.history-layout {
  grid-template-columns: minmax(340px, 0.9fr) minmax(0, 1.1fr);
}

.ob-monitor-layout {
  margin-top: 16px;
}

.stack-list {
  display: grid;
  gap: 10px;
}

.ob-group {
  display: grid;
  gap: 10px;
}

.ob-group + .ob-group {
  margin-top: 14px;
}

.ob-group h4 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  color: var(--text);
  font-size: 0.88rem;
  letter-spacing: 0;
}

.ob-group h4 span {
  color: var(--accent);
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.78rem;
}

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

.form-panel {
  display: grid;
  gap: 14px;
}

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

.full-label {
  display: block;
}

.primary-btn {
  min-height: 44px;
  border: 0;
  border-radius: var(--radius);
  color: #17110a;
  background: var(--accent);
  font-weight: 900;
}

.primary-btn:hover {
  background: #ffd06f;
}

.note-card,
.relationship-card,
.raw-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.child-card {
  border-left: 3px solid var(--green);
}

.role-extended-child.child-card,
.role-unattached.child-card {
  border-left-color: var(--accent);
}

.orphan-card {
  border-left: 3px solid #d28454;
}

.ob-box-card {
  border-left: 3px solid var(--cyan);
}

.ob-box-card.ob-status-liquidity-engineering-active {
  border-left-color: var(--accent);
}

.ob-box-card.ob-status-tapped-pending-reaction {
  border-left-color: var(--green);
}

.ob-box-card.ob-status-invalidated {
  border-left-color: var(--red);
}

.ob-short-id {
  margin-bottom: 0;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.74rem;
}

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

.ob-story-grid div {
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.025);
}

.ob-story-grid span,
.ob-story-grid strong {
  display: block;
}

.ob-story-grid span {
  margin-bottom: 4px;
  color: var(--faint);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.ob-story-grid strong {
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.tap-match-card {
  border-left: 3px solid var(--line-strong);
}

.tap-match-card.result-matched-tap {
  border-left-color: var(--green);
}

.tap-match-card.result-multi-zone-tap {
  border-left-color: var(--accent);
}

.tap-match-card.result-unmatched-tap {
  border-left-color: var(--red);
}

.json-box {
  width: 100%;
  max-height: 460px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #dce9f3;
  background: #070b10;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.small-json {
  max-height: 180px;
  margin-top: 10px;
}

.settings-panel p {
  color: var(--muted);
}

.view-mode-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.view-mode-buttons button {
  min-width: 120px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  background: var(--panel-soft);
}

body.view-mobile .layout-grid {
  grid-template-columns: 1fr;
}

body.view-mobile .sidebar {
  border-right: 0;
  border-bottom: 1px solid var(--line);
}

body.view-mobile .page-nav {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.view-mobile .metric-grid,
body.view-mobile .split-layout,
body.view-mobile .history-layout,
body.view-mobile .form-grid {
  grid-template-columns: 1fr;
}

body.view-mobile .story-grid {
  grid-template-columns: 1fr;
}

body.view-mobile .topbar {
  grid-template-columns: auto minmax(0, 1fr);
}

body.view-mobile .topbar-meta {
  grid-column: 1 / -1;
  align-items: flex-start;
}

body.view-tablet .layout-grid {
  grid-template-columns: 200px minmax(0, 1fr);
}

body.view-tablet .metric-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.view-tablet .split-layout,
body.view-tablet .history-layout {
  grid-template-columns: 1fr;
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .metric-grid,
  .split-layout,
  .history-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .topbar-meta {
    grid-column: 1 / -1;
    align-items: flex-start;
  }

  .main-panel,
  .sidebar {
    padding: 14px;
  }

  .page-nav,
  .metric-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.detected-role-note {
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #0b1117;
}

.detected-role-note strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 1rem;
}

.detected-role-note p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.segmented-control {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.segmented-control button {
  width: 42px;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 1rem;
}

.segmented-control button.is-active,
.segmented-control button:hover {
  color: var(--text);
  background: var(--panel-strong);
}

.tfc-workspace {
  min-height: 520px;
}

.family-map {
  display: grid;
  gap: 14px;
}

.family-map-cards {
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
}

.family-card,
.tree-family {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--chapter-bg, var(--panel-soft));
  overflow: hidden;
  box-shadow:
    var(--shadow),
    0 0 0 1px var(--state-outline);
}

.family-card details {
  display: block;
}

.family-card summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  cursor: pointer;
  list-style: none;
}

.family-card summary::-webkit-details-marker {
  display: none;
}

.family-card summary h3,
.tree-node strong {
  color: var(--text);
}

.family-card summary p,
.tree-node p,
.family-member p {
  margin: 4px 0 0;
  color: var(--muted);
}

.tree-node-meta {
  font-size: 0.75rem;
  color: rgba(191, 205, 224, 0.62);
  line-height: 1.35;
}

.family-medium {
  border-color: rgba(242, 184, 75, 0.54);
}

.family-large {
  border-color: rgba(107, 211, 148, 0.66);
}

.family-loose {
  border-style: dashed;
}

.family-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 280px;
}

.family-stats span {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.76rem;
  white-space: nowrap;
}

.family-members {
  display: grid;
  gap: 8px;
  padding: 0 16px 16px;
}

.family-member {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--readiness-accent);
  border-radius: 8px;
  background: var(--readiness-bg);
  box-shadow:
    0 0 0 1px var(--state-outline),
    0 0 18px color-mix(in srgb, var(--readiness-accent) 14%, transparent);
  border-color: color-mix(in srgb, var(--readiness-accent) 28%, var(--line));
}

.story-card,
.family-card,
.family-member,
.tree-node {
  --readiness-accent: var(--cyan);
  --readiness-bg: rgba(98, 195, 223, 0.05);
  --state-outline: transparent;
}

.family-map-tree {
  display: block;
}

.tree-node {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--readiness-accent);
  border-radius: 8px;
  background: var(--readiness-bg);
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.18),
    0 0 0 1px var(--state-outline),
    0 0 20px color-mix(in srgb, var(--readiness-accent) 16%, transparent);
  border-color: color-mix(in srgb, var(--readiness-accent) 32%, var(--line));
}

.tree-node.role-conflict-child,
.tree-node.role-orphan {
  border-left-color: #8793a5;
}

.tree-root {
  border-left-color: var(--cyan);
  background: rgba(98, 195, 223, 0.06);
}

.node-chapter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-height: 34px;
  border: 1px solid color-mix(in srgb, var(--readiness-accent) 52%, var(--line-strong));
  border-radius: 8px;
  color: var(--readiness-accent);
  font-weight: 900;
  background: color-mix(in srgb, var(--readiness-accent) 10%, var(--panel-strong));
}

.tree-map-shell {
  position: relative;
  min-height: 720px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at top left, rgba(98, 195, 223, 0.08), transparent 30%),
    radial-gradient(circle at bottom right, rgba(242, 184, 75, 0.07), transparent 24%),
    var(--panel-soft);
  overflow: hidden;
}

.tree-map-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 4;
  display: inline-flex;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(11, 17, 23, 0.92);
  backdrop-filter: blur(10px);
}

.tree-map-controls button {
  min-width: 42px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-strong);
  color: var(--text);
  font: inherit;
}

.tree-map-controls button:hover {
  border-color: var(--line-strong);
}

.tree-map-viewport {
  position: relative;
  min-height: 720px;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.tree-map-viewport:active {
  cursor: grabbing;
}

.tree-map-canvas {
  position: absolute;
  inset: 0 auto auto 0;
  transform-origin: 0 0;
  will-change: transform;
}

.tree-map-svg {
  position: absolute;
  inset: 0;
  overflow: visible;
}

.tree-edge {
  stroke: rgba(134, 153, 178, 0.55);
  stroke-width: 1.5;
  fill: none;
}

.tree-edge.role-close-child,
.tree-edge.role-child {
  stroke: rgba(119, 227, 163, 0.85);
}

.tree-edge.role-extended-child {
  stroke: rgba(242, 184, 75, 0.88);
}

.tree-edge.role-conflict-child {
  stroke: rgba(135, 147, 165, 0.9);
  stroke-dasharray: 7 5;
}

.tree-edge-tap {
  stroke: rgba(94, 240, 143, 0.9);
  stroke-width: 2.6;
  stroke-dasharray: 10 6;
  fill: none;
  filter: drop-shadow(0 0 5px rgba(94, 240, 143, 0.26));
}

.tree-row-label {
  position: absolute;
  left: 24px;
  color: rgba(191, 205, 224, 0.68);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tree-row-label::after {
  content: "";
  position: absolute;
  top: 50%;
  left: calc(100% + 14px);
  width: 120px;
  border-top: 1px dashed rgba(134, 153, 178, 0.24);
}

.tree-row-label.row-granddad {
  top: 74px;
}

.tree-row-label.row-parent {
  top: 198px;
}

.tree-row-label.row-child {
  top: 436px;
}

.tree-row-label.row-orphan {
  top: 700px;
}

.tree-graph-node {
  position: absolute;
  z-index: 2;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.tree-node-kind-granddad {
  opacity: 0.82;
  border-left-color: color-mix(in srgb, var(--readiness-accent) 44%, var(--line));
  background: color-mix(in srgb, var(--readiness-bg) 76%, rgba(255, 255, 255, 0.02));
}

.tree-node-kind-parent {
  background: color-mix(in srgb, var(--readiness-bg) 88%, rgba(255, 255, 255, 0.018));
}

.tree-node-kind-tap {
  background: color-mix(in srgb, var(--readiness-bg) 92%, rgba(255, 255, 255, 0.02));
  border-style: dashed;
}

.tree-node-kind-orphan {
  border-style: dashed;
  background: color-mix(in srgb, var(--readiness-bg) 65%, rgba(255, 255, 255, 0.014));
}

.tree-node-kind-child.role-conflict-child {
  background: color-mix(in srgb, var(--readiness-bg) 72%, rgba(135, 147, 165, 0.08));
}

.tree-node-kind-child.role-extended-child {
  background: color-mix(in srgb, var(--readiness-bg) 82%, rgba(242, 184, 75, 0.06));
}

.tree-node-kind-child.role-close-child,
.tree-node-kind-child.role-child {
  background: color-mix(in srgb, var(--readiness-bg) 86%, rgba(119, 227, 163, 0.04));
}

.story-card.readiness-monitoring,
.family-card.readiness-monitoring,
.family-member.readiness-monitoring,
.tree-node.readiness-monitoring {
  --readiness-accent: #6ed3ff;
  --readiness-bg: rgba(66, 160, 215, 0.09);
  --state-outline: rgba(110, 211, 255, 0.36);
}

.story-card.readiness-attention,
.family-card.readiness-attention,
.family-member.readiness-attention,
.tree-node.readiness-attention {
  --readiness-accent: #ffb14a;
  --readiness-bg: rgba(255, 166, 53, 0.12);
  --state-outline: rgba(255, 177, 74, 0.46);
}

.story-card.readiness-actionable,
.family-card.readiness-actionable,
.family-member.readiness-actionable,
.tree-node.readiness-actionable {
  --readiness-accent: #5ef08f;
  --readiness-bg: rgba(66, 208, 113, 0.13);
  --state-outline: rgba(94, 240, 143, 0.52);
}

.story-card.readiness-monitoring .chapter-code,
.family-card.readiness-monitoring .chapter-code,
.family-member.readiness-monitoring strong,
.tree-node.readiness-monitoring strong {
  color: #cfefff;
}

.story-card.readiness-attention .chapter-code,
.family-card.readiness-attention .chapter-code,
.family-member.readiness-attention strong,
.tree-node.readiness-attention strong {
  color: #ffe2b7;
}

.story-card.readiness-actionable .chapter-code,
.family-card.readiness-actionable .chapter-code,
.family-member.readiness-actionable strong,
.tree-node.readiness-actionable strong {
  color: #d8ffe7;
}

.story-card.readiness-monitoring .role-pill,
.family-card.readiness-monitoring .role-pill,
.family-member.readiness-monitoring .role-pill {
  border-color: rgba(110, 211, 255, 0.48);
  background: rgba(110, 211, 255, 0.08);
}

.story-card.readiness-attention .role-pill,
.family-card.readiness-attention .role-pill,
.family-member.readiness-attention .role-pill {
  border-color: rgba(255, 177, 74, 0.52);
  background: rgba(255, 177, 74, 0.1);
}

.story-card.readiness-actionable .role-pill,
.family-card.readiness-actionable .role-pill,
.family-member.readiness-actionable .role-pill {
  border-color: rgba(94, 240, 143, 0.54);
  background: rgba(94, 240, 143, 0.1);
}

.tree-node.readiness-monitoring .node-chapter {
  border-color: rgba(110, 211, 255, 0.54);
  background: rgba(110, 211, 255, 0.12);
  color: #6ed3ff;
}

.tree-node.readiness-attention .node-chapter {
  border-color: rgba(255, 177, 74, 0.62);
  background: rgba(255, 177, 74, 0.14);
  color: #ffb14a;
}

.tree-node.readiness-actionable .node-chapter {
  border-color: rgba(94, 240, 143, 0.68);
  background: rgba(94, 240, 143, 0.16);
  color: #5ef08f;
}

.tree-node.readiness-monitoring .tree-node-meta,
.story-card.readiness-monitoring .story-name {
  color: rgba(207, 239, 255, 0.78);
}

.tree-node.readiness-attention .tree-node-meta,
.story-card.readiness-attention .story-name {
  color: rgba(255, 226, 183, 0.8);
}

.tree-node.readiness-actionable .tree-node-meta,
.story-card.readiness-actionable .story-name {
  color: rgba(216, 255, 231, 0.82);
}

.chart-panel {
  min-height: 680px;
}

.chart-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.chart-toolbar h3 {
  margin: 0;
}

.phase-readout {
  margin: 6px 0 0;
  font-size: 0.86rem;
}

.chart-legend {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.legend-up {
  background: #5ef08f;
}

.legend-down {
  background: #ff6f7d;
}

.candle-chart {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: #0a1017;
  overflow: hidden;
}

.candle-chart.empty-state {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.candle-chart-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-plot-bg {
  fill: #0d141d;
  stroke: rgba(134, 153, 178, 0.34);
}

.chart-grid-line {
  stroke: rgba(134, 153, 178, 0.16);
  stroke-width: 1;
}

.chart-line-path {
  fill: none;
  stroke: #5ef08f;
  stroke-width: 2.2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart-line-point {
  fill: #5ef08f;
  stroke: #0a1017;
  stroke-width: 1.8;
}

.chart-axis,
.chart-time-tick {
  stroke: rgba(191, 205, 224, 0.42);
  stroke-width: 1;
}

.chart-price-label,
.chart-time-label {
  fill: rgba(191, 205, 224, 0.76);
  font-size: 11px;
}

.chart-time-label {
  text-anchor: middle;
}

.chart-candle line {
  stroke-width: 1.4;
}

.chart-candle rect {
  rx: 1;
}

.chart-candle-up line,
.chart-candle-up rect {
  stroke: #5ef08f;
  fill: rgba(94, 240, 143, 0.7);
}

.chart-candle-down line,
.chart-candle-down rect {
  stroke: #ff6f7d;
  fill: rgba(255, 111, 125, 0.72);
}

.chart-ob-overlay {
  pointer-events: none;
}

.chart-ob-overlay rect {
  fill: rgba(125, 169, 255, 0.18);
  stroke: rgba(174, 201, 255, 0.9);
  stroke-width: 2;
}

.chart-ob-overlay text {
  fill: rgba(247, 251, 255, 0.96);
  font-size: 12px;
  paint-order: stroke;
  stroke: rgba(7, 11, 16, 0.96);
  stroke-width: 4px;
}

.chart-ob-overlay-liquidity rect {
  fill: rgba(255, 210, 96, 0.2);
  stroke: rgba(255, 210, 96, 0.95);
  stroke-dasharray: 6 4;
  stroke-width: 2.4;
}

.chart-ob-overlay-respected rect {
  fill: rgba(94, 240, 143, 0.18);
  stroke: rgba(94, 240, 143, 0.95);
  stroke-width: 2.4;
}

.chart-ob-overlay-inactive rect {
  fill: rgba(191, 205, 224, 0.1);
  stroke: rgba(191, 205, 224, 0.58);
  stroke-dasharray: 4 5;
}

.chart-ob-overlay-inactive text {
  fill: rgba(218, 228, 242, 0.82);
}

.chart-phase-range,
.chart-phase-expansion,
.chart-phase-origin,
.chart-phase-progress-break {
  pointer-events: none;
}

.chart-phase-range rect {
  fill: rgba(136, 165, 205, 0.055);
  stroke: rgba(174, 201, 255, 0.38);
  stroke-width: 1.2;
  stroke-dasharray: 7 5;
}

.chart-phase-range text,
.chart-phase-expansion text,
.chart-phase-origin text,
.chart-phase-progress-break text {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  paint-order: stroke;
  stroke: rgba(7, 11, 16, 0.95);
  stroke-width: 3px;
}

.chart-phase-range text {
  fill: rgba(196, 213, 238, 0.78);
}

.chart-phase-expansion line {
  stroke-width: 1.3;
  stroke-dasharray: 4 6;
}

.chart-phase-expansion-up line,
.chart-phase-origin-up line {
  stroke: rgba(94, 240, 143, 0.62);
}

.chart-phase-expansion-down line,
.chart-phase-origin-down line {
  stroke: rgba(255, 111, 125, 0.62);
}

.chart-phase-expansion-up text,
.chart-phase-origin-up text {
  fill: rgba(151, 255, 187, 0.86);
}

.chart-phase-expansion-down text,
.chart-phase-origin-down text {
  fill: rgba(255, 166, 176, 0.9);
}

.chart-phase-origin line {
  stroke-width: 1.6;
  stroke-dasharray: 8 5;
}

.chart-phase-progress-break line {
  stroke: rgba(255, 210, 96, 0.58);
  stroke-width: 1.3;
  stroke-dasharray: 3 7;
}

.chart-phase-progress-break text {
  fill: rgba(255, 226, 151, 0.92);
}

.chart-structure-point {
  pointer-events: none;
}

.chart-structure-point line {
  stroke-width: 1.5;
  stroke-dasharray: 3 3;
}

.chart-structure-point text {
  font-size: 11px;
  font-weight: 800;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(7, 11, 16, 0.92);
  stroke-width: 3px;
}

.chart-structure-point-high line {
  stroke: rgba(255, 210, 96, 0.95);
}

.chart-structure-point-high text {
  fill: #ffd260;
}

.chart-structure-point-low line {
  stroke: rgba(104, 211, 255, 0.95);
}

.chart-structure-point-low text {
  fill: #68d3ff;
}

.chartlab-body {
  height: 100vh;
  overflow: hidden;
}

.chartlab-shell {
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.chartlab-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 12, 16, 0.96);
  backdrop-filter: blur(14px);
}

.chartlab-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.compact-control {
  min-width: 120px;
}

.compact-control input,
.compact-control select {
  width: 110px;
  min-height: 36px;
  border: 0;
  outline: none;
  color: var(--text);
  background: transparent;
  font: inherit;
}

.chartlab-main {
  min-height: 0;
  padding: 18px 24px 24px;
  overflow: hidden;
}

.chartlab-panel {
  height: calc(100vh - 126px);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.chart-viewport {
  position: relative;
  min-height: 0;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0a1017;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.chart-viewport:active {
  cursor: grabbing;
}

#chart-world {
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
  will-change: transform;
}

.candle-chart-large {
  height: 100%;
}

.candle-chart-svg-large {
  min-height: 0;
  height: 100%;
}

.traderoom-body {
  min-height: 100vh;
  overflow: auto;
}

.traderoom-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.traderoom-main {
  display: grid;
  gap: 18px;
  min-width: 0;
  padding: 18px 24px 24px;
}

.trade-desk-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow-x: auto;
}

.trade-desk-tabs button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  white-space: nowrap;
}

.trade-desk-tabs button:hover,
.trade-desk-tabs button.is-active {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--panel-strong);
}

.trade-desk-page {
  display: none;
}

.trade-desk-page.is-active {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.trade-desk-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.trade-desk-header h2 {
  font-size: 1.18rem;
  overflow-wrap: anywhere;
}

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

.trade-status-card {
  min-height: 112px;
}

.trade-status-card h2 {
  margin-bottom: 8px;
}

.trade-status-card p:last-child {
  margin-bottom: 0;
}

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

.traderoom-main-column,
.traderoom-side-column {
  display: grid;
  gap: 18px;
}

.trade-section {
  min-width: 0;
}

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

.trade-room-board {
  grid-template-columns: 1fr;
  gap: 16px;
  min-width: 0;
}

.trade-desk-hero,
.trade-board-section {
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.trade-desk-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  padding: 18px;
  border-color: rgba(104, 211, 255, 0.26);
  background:
    linear-gradient(135deg, rgba(104, 211, 255, 0.12), rgba(94, 240, 143, 0.055) 46%, rgba(22, 32, 43, 0.96));
}

.trade-desk-hero h2 {
  margin: 0 0 8px;
  font-size: clamp(1.25rem, 2vw, 2rem);
  line-height: 1.1;
}

.trade-desk-hero p {
  max-width: 820px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.trade-hero-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.trade-hero-chips span {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(104, 211, 255, 0.22);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.78rem;
  font-weight: 800;
  overflow-wrap: anywhere;
  white-space: nowrap;
}

.trade-board-section {
  padding: 16px;
}

.trade-board-section .trade-section-head {
  margin-bottom: 12px;
}

.trade-board-section .trade-section-head p:not(.section-kicker) {
  max-width: 760px;
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.trade-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.trade-card-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.trade-workflow-rail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  min-width: 0;
}

.trade-workflow-step {
  position: relative;
  min-width: 0;
  overflow: hidden;
  min-height: 190px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.trade-step-index {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-bottom: 12px;
  border: 1px solid rgba(104, 211, 255, 0.24);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(104, 211, 255, 0.08);
  font-size: 0.78rem;
  font-weight: 900;
}

.trade-workflow-step h3 {
  margin-bottom: 8px;
  font-size: 1rem;
  line-height: 1.3;
}

.trade-workflow-step p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

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

.trade-operator-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.trade-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.trade-section-head h2 {
  font-size: 1.08rem;
}

.trade-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.78rem;
  white-space: nowrap;
}

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

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

.trade-ladder-card,
.trade-model-card,
.trade-operator-card,
.trade-evidence-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.trade-ladder-card,
.trade-model-card,
.trade-operator-card {
  min-height: 190px;
  min-width: 0;
  overflow: hidden;
  padding: 14px;
}

.trade-room-board .trade-operator-card {
  min-height: 178px;
}

.trade-card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.78rem;
}

.trade-card-topline span {
  color: var(--accent);
  font-weight: 800;
}

.trade-card-topline strong {
  min-width: 0;
  text-align: right;
  text-transform: capitalize;
  overflow-wrap: anywhere;
}

.trade-ladder-card h3,
.trade-model-card h3,
.trade-operator-card h3 {
  margin-bottom: 8px;
  font-size: 1.08rem;
  line-height: 1.25;
}

.trade-ladder-card p,
.trade-model-card p,
.trade-operator-card p {
  min-height: 38px;
  color: var(--muted);
  line-height: 1.45;
}

.trade-operator-card .trade-card-source,
.trade-workflow-step .trade-card-source {
  min-height: 0;
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--faint);
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.trade-ladder-card dl {
  display: grid;
  gap: 7px;
  margin: 12px 0 0;
}

.trade-ladder-card dl div,
.trade-evidence-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.trade-ladder-card dt,
.trade-ladder-card dd {
  margin: 0;
}

.trade-ladder-card dt {
  color: var(--faint);
  font-size: 0.76rem;
}

.trade-ladder-card dd {
  color: var(--text);
  font-size: 0.82rem;
  text-align: right;
}

.trade-model-card ul {
  display: grid;
  gap: 7px;
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.4;
}

.trade-operator-card ul {
  display: grid;
  gap: 7px;
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.42;
}

.trade-operator-card li::marker {
  color: var(--accent);
}

.trade-evidence-strip {
  min-width: 0;
}

.trade-evidence-list {
  display: grid;
  gap: 10px;
}

.trade-evidence-item {
  min-height: 62px;
  padding: 10px 12px;
}

.trade-evidence-item div {
  display: grid;
  gap: 4px;
}

.trade-evidence-item strong {
  color: var(--text);
}

.trade-evidence-item span {
  color: var(--faint);
  font-size: 0.76rem;
}

.trade-evidence-item p {
  margin: 0;
  color: var(--accent);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.trade-bullish {
  border-color: rgba(94, 240, 143, 0.38);
  background: linear-gradient(180deg, rgba(94, 240, 143, 0.08), rgba(22, 32, 43, 0.96));
}

.trade-bearish {
  border-color: rgba(255, 111, 125, 0.38);
  background: linear-gradient(180deg, rgba(255, 111, 125, 0.08), rgba(22, 32, 43, 0.96));
}

.trade-mixed {
  border-color: rgba(255, 210, 96, 0.36);
  background: linear-gradient(180deg, rgba(255, 210, 96, 0.075), rgba(22, 32, 43, 0.96));
}

.trade-forming {
  border-color: rgba(104, 211, 255, 0.26);
}

.trade-watching {
  border-color: rgba(104, 211, 255, 0.32);
  background: linear-gradient(180deg, rgba(104, 211, 255, 0.065), rgba(22, 32, 43, 0.96));
}

.trade-pending {
  border-color: rgba(255, 210, 96, 0.34);
  background: linear-gradient(180deg, rgba(255, 210, 96, 0.07), rgba(22, 32, 43, 0.96));
}

.trade-parked {
  border-color: rgba(156, 171, 186, 0.26);
  background: linear-gradient(180deg, rgba(156, 171, 186, 0.04), rgba(22, 32, 43, 0.96));
}

.trade-warning {
  border-color: rgba(255, 111, 125, 0.36);
  background: linear-gradient(180deg, rgba(255, 111, 125, 0.075), rgba(22, 32, 43, 0.96));
}

.trade-observation {
  border-color: rgba(94, 240, 143, 0.28);
  background: linear-gradient(180deg, rgba(94, 240, 143, 0.055), rgba(22, 32, 43, 0.96));
}

@media (max-width: 1180px) {
  .tree-map-shell,
  .tree-map-viewport {
    min-height: 680px;
  }

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

  .traderoom-status-grid,
  .trade-ladder-grid,
  .trade-dashboard-grid,
  .trade-card-grid,
  .trade-card-grid.three,
  .trade-card-grid.two,
  .trade-operator-grid,
  .trade-operator-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .tree-map-shell,
  .tree-map-viewport {
    min-height: 640px;
  }

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

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

  .traderoom-main {
    padding: 14px;
  }

  .traderoom-status-grid,
  .trade-ladder-grid,
  .trade-model-grid,
  .trade-dashboard-grid,
  .trade-card-grid,
  .trade-card-grid.three,
  .trade-card-grid.two,
  .trade-operator-grid,
  .trade-operator-grid.compact {
    grid-template-columns: 1fr;
  }

  .trade-desk-hero {
    grid-template-columns: 1fr;
  }

  .trade-hero-chips {
    justify-content: flex-start;
  }
}

/* ─── GO / ABORT card states ──────────────────────────────────────────────── */

.trade-go {
  border-color: rgba(94, 240, 143, 0.55);
  background: linear-gradient(180deg, rgba(94, 240, 143, 0.12), rgba(22, 32, 43, 0.97));
  box-shadow: 0 0 22px rgba(94, 240, 143, 0.1);
}

.trade-abort {
  border-color: rgba(255, 111, 125, 0.55);
  background: linear-gradient(180deg, rgba(255, 111, 125, 0.12), rgba(22, 32, 43, 0.97));
  box-shadow: 0 0 22px rgba(255, 111, 125, 0.1);
}

/* ─── Candidates list ─────────────────────────────────────────────────────── */

.trade-candidates-list {
  display: grid;
  gap: 8px;
}

.trade-candidate-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s;
  user-select: none;
}

.trade-candidate-row:hover {
  border-color: var(--line-strong);
  background: var(--panel-strong);
}

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

.trade-candidate-row.dir-bull {
  border-left: 3px solid rgba(94, 240, 143, 0.5);
}

.trade-candidate-row.dir-bear {
  border-left: 3px solid rgba(255, 111, 125, 0.5);
}

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

.candidate-dir {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 900;
  flex-shrink: 0;
}

.candidate-dir.dir-bull {
  color: var(--green);
  background: rgba(94, 240, 143, 0.1);
  border: 1px solid rgba(94, 240, 143, 0.2);
}

.candidate-dir.dir-bear {
  color: var(--red);
  background: rgba(255, 111, 125, 0.1);
  border: 1px solid rgba(255, 111, 125, 0.2);
}

.candidate-row-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.candidate-id {
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 800;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

.candidate-tf {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.candidate-row-mid {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.trade-lifecycle-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid transparent;
}

.trade-lifecycle-badge.badge-go {
  color: #0c1a10;
  background: #5ef08f;
  border-color: rgba(94, 240, 143, 0.5);
  box-shadow: 0 0 10px rgba(94, 240, 143, 0.28);
}

.trade-lifecycle-badge.badge-abort {
  color: #fff8f8;
  background: #ff6f7d;
  border-color: rgba(255, 111, 125, 0.5);
  box-shadow: 0 0 10px rgba(255, 111, 125, 0.28);
}

.trade-lifecycle-badge.badge-ready {
  color: #1a1100;
  background: var(--accent);
  border-color: rgba(242, 184, 75, 0.5);
  box-shadow: 0 0 8px rgba(242, 184, 75, 0.18);
}

.trade-lifecycle-badge.badge-truth {
  color: var(--text);
  background: rgba(104, 211, 255, 0.1);
  border-color: rgba(104, 211, 255, 0.26);
}

.trade-lifecycle-badge.badge-watching {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  border-color: var(--line);
}

.candidate-tp-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.trade-tp-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border: 1px solid rgba(94, 240, 143, 0.2);
  border-radius: 5px;
  color: rgba(94, 240, 143, 0.78);
  background: rgba(94, 240, 143, 0.055);
  font-size: 0.68rem;
  font-weight: 800;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

.candidate-row-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.candidate-live-price {
  color: var(--cyan);
  font-size: 0.8rem;
  font-weight: 800;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

.candidate-chevron {
  color: var(--faint);
  font-size: 1.2rem;
  line-height: 1;
  transition: color 0.14s, transform 0.14s;
}

.trade-candidate-row:hover .candidate-chevron {
  color: var(--text);
  transform: translateX(2px);
}

/* ─── Popup overlay ───────────────────────────────────────────────────────── */

.trade-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.74);
  backdrop-filter: blur(5px);
}

.trade-popup-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--panel);
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.62),
    0 0 0 1px rgba(104, 211, 255, 0.08);
  overflow: hidden;
}

.trade-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
  flex-shrink: 0;
}

.trade-popup-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.candidate-id-large {
  color: var(--text);
  font-size: 1rem;
  font-weight: 900;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

.candidate-tf-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--muted);
  background: var(--panel-strong);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.popup-dir-label {
  font-size: 0.82rem;
  font-weight: 800;
}

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

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

.trade-popup-close {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-size: 0.9rem;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}

.trade-popup-close:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--panel-strong);
}

.trade-popup-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
}

.trade-price-ladder-svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  overflow: hidden;
}

.trade-ladder-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  line-height: 1.6;
}

.trade-position-bundle {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(6, 11, 18, 0.44);
}

.trade-position-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.trade-position-head span {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.trade-position-head strong {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.trade-position-grid {
  display: grid;
  gap: 8px;
}

.trade-position-row {
  display: grid;
  grid-template-columns: minmax(76px, 1.25fr) repeat(3, minmax(56px, 0.75fr));
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(94, 240, 143, 0.22);
  border-left: 3px solid var(--green);
  border-radius: 7px;
  background: rgba(94, 240, 143, 0.055);
}

.trade-position-row.is-runner {
  border-color: rgba(104, 211, 255, 0.24);
  border-left-color: var(--cyan);
  background: rgba(104, 211, 255, 0.05);
}

.trade-position-row div {
  min-width: 0;
}

.trade-position-row span {
  display: block;
  color: var(--muted);
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.trade-position-row strong {
  display: block;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.trade-position-row p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.dash-live-trade-list {
  display: grid;
  gap: 10px;
}

.dash-trade-bundle {
  border: 1px solid rgba(94, 240, 143, 0.22);
  border-left: 3px solid var(--green);
  border-radius: 8px;
  background: rgba(94, 240, 143, 0.05);
  overflow: hidden;
}

.dash-trade-bundle.dir-bear {
  border-color: rgba(240, 123, 123, 0.24);
  border-left-color: var(--red);
  background: rgba(240, 123, 123, 0.045);
}

.dash-trade-bundle.is-open {
  border-color: rgba(94, 240, 143, 0.42);
}

.dash-trade-bundle.is-history {
  border-color: rgba(134, 153, 178, 0.24);
  border-left-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.025);
}

.dash-trade-toggle {
  display: grid;
  grid-template-columns: minmax(150px, 1.1fr) minmax(210px, 1.4fr) minmax(190px, 0.9fr) 28px;
  gap: 14px;
  align-items: center;
  width: 100%;
  min-height: 74px;
  padding: 14px 16px;
  border: 0;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.dash-trade-toggle:hover {
  background: rgba(255, 255, 255, 0.035);
}

.dash-trade-title,
.dash-trade-summary,
.dash-trade-levels,
.dash-position-main,
.dash-position-level {
  min-width: 0;
}

.dash-trade-title strong {
  display: block;
  color: var(--text);
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.25;
}

.dash-trade-title span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dash-trade-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dash-trade-summary span,
.dash-trade-levels span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid rgba(134, 153, 178, 0.22);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.2;
}

.dash-trade-summary .dir-bull {
  color: var(--green);
}

.dash-trade-summary .dir-bear {
  color: var(--red);
}

.dash-trade-levels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.dash-trade-levels strong {
  margin-left: 5px;
  color: var(--text);
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

.dash-trade-chevron {
  justify-self: end;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 900;
}

.dash-trade-expanded {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.dash-trade-position {
  display: grid;
  grid-template-columns: minmax(86px, 0.7fr) minmax(82px, 0.55fr) minmax(82px, 0.55fr) minmax(92px, 0.6fr) minmax(240px, 1.65fr);
  gap: 10px;
  align-items: center;
  padding: 11px;
  border: 1px solid rgba(94, 240, 143, 0.18);
  border-radius: 7px;
  background: rgba(8, 14, 22, 0.5);
}

.dash-trade-position.is-runner {
  border-color: rgba(104, 211, 255, 0.22);
}

.dash-trade-position.is-locked {
  grid-template-columns: minmax(120px, 0.7fr) minmax(0, 1fr);
  border-color: rgba(134, 153, 178, 0.22);
  background: rgba(255, 255, 255, 0.025);
}

.dash-trade-position.is-closed {
  border-color: rgba(134, 153, 178, 0.24);
  background: rgba(255, 255, 255, 0.025);
}

.dash-position-main strong,
.dash-position-level strong {
  display: block;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.dash-position-main span,
.dash-position-level span {
  display: block;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dash-trade-position p {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

.dash-position-progress-wrap {
  min-width: 0;
}

.dash-position-progress {
  position: relative;
  height: 42px;
  min-width: 220px;
  border: 1px solid rgba(134, 153, 178, 0.2);
  border-radius: 7px;
  background: #09111a;
  overflow: hidden;
}

.dash-position-progress.is-muted {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.72rem;
}

.dash-progress-danger,
.dash-progress-profit {
  position: absolute;
  top: 8px;
  bottom: 15px;
}

.dash-progress-danger {
  left: 8px;
  right: 50%;
  background: rgba(255, 111, 125, 0.13);
  border-right: 1px solid rgba(238, 244, 248, 0.55);
}

.dash-progress-profit {
  left: 50%;
  right: 8px;
  background: rgba(94, 240, 143, 0.16);
}

.dash-progress-entry,
.dash-progress-live {
  position: absolute;
  transform: translateX(-50%);
}

.dash-progress-entry {
  top: 7px;
  bottom: 13px;
  width: 2px;
  background: rgba(238, 244, 248, 0.85);
}

.dash-progress-live {
  top: 3px;
  width: 9px;
  height: 9px;
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 999px;
  background: var(--cyan);
  box-shadow: 0 0 0 6px rgba(98, 195, 223, 0.12);
}

.dash-progress-live span {
  position: absolute;
  top: -2px;
  left: 13px;
  color: var(--cyan);
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.68rem;
  font-weight: 900;
  white-space: nowrap;
}

.dash-progress-labels {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 3px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
}

.dash-progress-labels span:first-child {
  color: var(--red);
}

.dash-progress-labels span:last-child {
  color: var(--green);
}

.dash-history-head {
  display: grid;
  grid-template-columns: minmax(150px, 1.1fr) minmax(210px, 1.4fr) minmax(190px, 0.9fr);
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
}

.dash-history-positions {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.dash-history-position {
  display: grid;
  grid-template-columns: minmax(90px, 0.8fr) repeat(3, minmax(110px, 0.8fr));
  gap: 10px;
  align-items: center;
  padding: 11px;
  border: 1px solid rgba(134, 153, 178, 0.2);
  border-left: 3px solid var(--line-strong);
  border-radius: 7px;
  background: rgba(8, 14, 22, 0.45);
}

.dash-history-position.is-win {
  border-left-color: var(--green);
}

.dash-history-position.is-loss {
  border-left-color: var(--red);
}

.dash-history-position div {
  min-width: 0;
}

.dash-history-position span {
  display: block;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dash-history-position strong {
  display: block;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.trade-popup-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}

.trade-popup-live-tag {
  color: var(--cyan);
  font-size: 0.8rem;
  font-weight: 800;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  white-space: nowrap;
}

/* ─── Price ladder SVG animations ─────────────────────────────────────────── */

@keyframes pricePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

@keyframes ringExpand {
  0% { opacity: 0.65; transform: scale(1); }
  100% { opacity: 0; transform: scale(2.6); }
}

.live-price-dot {
  animation: pricePulse 1.9s ease-in-out infinite;
}

.live-price-ring {
  transform-box: fill-box;
  transform-origin: center;
  animation: ringExpand 1.9s ease-out infinite;
}

/* ─── Responsive popup ────────────────────────────────────────────────────── */

@media (max-width: 540px) {
  .trade-popup-card {
    max-width: 100%;
    max-height: 88vh;
  }

  .candidate-row-mid {
    display: none;
  }

  .candidate-live-price {
    display: none;
  }

  .trade-position-row {
    grid-template-columns: 1fr 1fr;
  }

  .dash-trade-toggle,
  .dash-trade-position {
    grid-template-columns: 1fr 1fr;
  }

  .dash-position-progress-wrap {
    grid-column: 1 / -1;
  }

  .dash-position-progress {
    min-width: 0;
  }
}

/* ─── Dashboard command bar ───────────────────────────────────────────────── */

.dash-command-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  min-width: 0;
}

.dash-command-bar.dash-cmd-watching {
  border-color: rgba(104, 211, 255, 0.28);
  background: linear-gradient(135deg, rgba(104, 211, 255, 0.07) 0%, rgba(22, 32, 43, 0.97) 55%);
}

.dash-command-bar.dash-cmd-warning {
  border-color: rgba(242, 184, 75, 0.42);
  background: linear-gradient(135deg, rgba(242, 184, 75, 0.09) 0%, rgba(22, 32, 43, 0.97) 55%);
}

.dash-command-bar.dash-cmd-pending {
  border-color: var(--line);
  background: var(--panel);
}

.dash-cmd-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.dash-cmd-symbol {
  font-size: clamp(1.7rem, 3.5vw, 2.5rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--text);
}

.dash-cmd-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.84rem;
}

.dash-cmd-desk-label {
  color: var(--accent);
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.dash-cmd-sep {
  color: var(--faint);
}

.dash-cmd-range {
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.82rem;
}

.dash-cmd-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex-shrink: 0;
}

.dash-cmd-price {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--cyan);
  font-size: 1rem;
  font-weight: 800;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

.dash-price-live {
  font-size: 0.55rem;
  animation: pricePulse 2s ease-in-out infinite;
}

.dash-readiness-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
  border: 1px solid transparent;
}

.dash-readiness-badge.dash-readiness-watching {
  color: var(--cyan);
  border-color: rgba(104, 211, 255, 0.28);
  background: rgba(104, 211, 255, 0.08);
}

.dash-readiness-badge.dash-readiness-pending {
  color: var(--muted);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.dash-readiness-badge.dash-readiness-parked {
  color: var(--faint);
  border-color: var(--line);
  background: transparent;
}

.dash-warnings-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(242, 184, 75, 0.38);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(242, 184, 75, 0.08);
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.dash-cmd-updated {
  color: var(--faint);
  font-size: 0.72rem;
  white-space: nowrap;
}

/* ─── Session gate strip ──────────────────────────────────────────────────── */

.dash-session-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.dash-gate-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.dash-gate-item.gate-warning {
  border-color: rgba(255, 111, 125, 0.34);
  background: linear-gradient(180deg, rgba(255, 111, 125, 0.07), rgba(22, 32, 43, 0.96));
}

.dash-gate-item.gate-parked {
  border-color: rgba(156, 171, 186, 0.22);
  background: rgba(255, 255, 255, 0.015);
}

.dash-gate-icon {
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 900;
}

.gate-warning .dash-gate-icon {
  color: #ff6f7d;
  background: rgba(255, 111, 125, 0.12);
  border: 1px solid rgba(255, 111, 125, 0.24);
}

.gate-parked .dash-gate-icon {
  color: var(--faint);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}

.dash-gate-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.dash-gate-label {
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 800;
}

.gate-warning .dash-gate-label {
  color: #ff6f7d;
}

.dash-gate-status {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dash-gate-detail {
  color: var(--faint);
  font-size: 0.76rem;
  line-height: 1.4;
}

/* ─── Dashboard parked group ──────────────────────────────────────────────── */

.dash-parked-group {
  display: grid;
  gap: 16px;
  opacity: 0.65;
  transition: opacity 0.22s;
}

.dash-parked-group:hover {
  opacity: 1;
}

/* ─── Scalping state banner ───────────────────────────────────────────────── */

.scalp-state-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  min-width: 0;
}

.scalp-state-banner.state-go {
  border-color: rgba(94, 240, 143, 0.62);
  background: linear-gradient(135deg, rgba(94, 240, 143, 0.13) 0%, rgba(22, 32, 43, 0.97) 56%);
  box-shadow: 0 0 32px rgba(94, 240, 143, 0.12), inset 0 1px 0 rgba(94, 240, 143, 0.14);
}

.scalp-state-banner.state-abort {
  border-color: rgba(255, 111, 125, 0.62);
  background: linear-gradient(135deg, rgba(255, 111, 125, 0.13) 0%, rgba(22, 32, 43, 0.97) 56%);
  box-shadow: 0 0 32px rgba(255, 111, 125, 0.12), inset 0 1px 0 rgba(255, 111, 125, 0.14);
}

.scalp-state-banner.state-ready {
  border-color: rgba(242, 184, 75, 0.55);
  background: linear-gradient(135deg, rgba(242, 184, 75, 0.1) 0%, rgba(22, 32, 43, 0.97) 56%);
  box-shadow: 0 0 24px rgba(242, 184, 75, 0.1);
}

.scalp-state-banner.state-watching {
  border-color: rgba(104, 211, 255, 0.28);
  background: linear-gradient(135deg, rgba(104, 211, 255, 0.07) 0%, rgba(22, 32, 43, 0.97) 56%);
}

.scalp-state-banner.state-pending {
  border-color: var(--line);
  background: var(--panel);
}

.scalp-state-main {
  display: flex;
  align-items: baseline;
  gap: 18px;
  min-width: 0;
  flex-wrap: wrap;
}

.scalp-state-label {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
  white-space: nowrap;
}

.state-go .scalp-state-label    { color: #5ef08f; }
.state-abort .scalp-state-label { color: #ff6f7d; }
.state-ready .scalp-state-label { color: var(--accent); }
.state-watching .scalp-state-label { color: var(--cyan); }
.state-pending .scalp-state-label  { color: var(--muted); }

.scalp-state-desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.scalp-state-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex-shrink: 0;
}

.scalp-meta-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.scalp-meta-chip.chip-bull {
  color: var(--green);
  border-color: rgba(94, 240, 143, 0.22);
  background: rgba(94, 240, 143, 0.06);
}

.scalp-meta-chip.chip-bear {
  color: var(--red);
  border-color: rgba(255, 111, 125, 0.22);
  background: rgba(255, 111, 125, 0.06);
}

.scalp-meta-chip.chip-live {
  color: var(--cyan);
  border-color: rgba(104, 211, 255, 0.26);
  background: rgba(104, 211, 255, 0.06);
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

.scalp-meta-chip.chip-symbol {
  color: var(--accent);
  border-color: rgba(242, 184, 75, 0.22);
  background: rgba(242, 184, 75, 0.05);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

/* ─── OB watch table ──────────────────────────────────────────────────────── */

.trade-ob-watch-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.ob-watch-header,
.ob-watch-row {
  display: grid;
  grid-template-columns: 1.1fr 48px 1fr 1.1fr 46px 84px;
  align-items: center;
  gap: 0;
  padding: 0 14px;
}

.ob-watch-header {
  height: 34px;
  background: rgba(255, 255, 255, 0.022);
  border-bottom: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ob-watch-row {
  min-height: 46px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.12s;
}

.ob-watch-row:last-child {
  border-bottom: 0;
}

.ob-watch-row:hover {
  background: rgba(255, 255, 255, 0.022);
}

.ob-watch-id {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

.ob-watch-tf {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.ob-watch-dir {
  font-size: 0.82rem;
  font-weight: 800;
}

.ob-watch-taps {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 800;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

.ob-watch-distance {
  color: var(--muted);
  font-size: 0.8rem;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  text-align: right;
}

.trade-lifecycle-badge.badge-sm {
  min-height: 20px;
  padding: 0 7px;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
}

/* ─── Scalp detail grid (5 cards, 3 columns) ──────────────────────────────── */

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

/* ─── Parked group (dimmed lower section) ─────────────────────────────────── */

.scalp-parked-group {
  display: grid;
  gap: 16px;
  opacity: 0.68;
  transition: opacity 0.22s;
}

.scalp-parked-group:hover {
  opacity: 1;
}

/* ─── Responsive additions ────────────────────────────────────────────────── */

@media (max-width: 1180px) {
  .scalp-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

@media (max-width: 860px) {
  .dash-command-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .dash-cmd-right {
    justify-content: flex-start;
  }

  .dash-session-strip {
    grid-template-columns: 1fr;
  }

  .scalp-state-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .scalp-state-meta {
    justify-content: flex-start;
  }

  .scalp-detail-grid {
    grid-template-columns: 1fr;
  }

  .ob-watch-header,
  .ob-watch-row {
    grid-template-columns: 1.1fr 40px 1fr 1.1fr 40px;
  }

  .ob-col-distance {
    display: none;
  }
}

/* ─── Mobile Trade Room ───────────────────────────────────────────────────── */

.mobile-room-body {
  min-height: 100vh;
  margin: 0;
  background: #070c12;
  color: #eef4f8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.mobile-room-shell {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 14px 12px 32px;
}

.mobile-room-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0 12px;
}

.mobile-room-header h1,
.mobile-section-head h2 {
  margin: 0;
  letter-spacing: 0;
}

.mobile-room-header h1 {
  font-size: clamp(1.6rem, 7vw, 2.35rem);
  line-height: 1;
}

.mobile-muted {
  margin: 6px 0 0;
  color: #a8bfd8;
  line-height: 1.35;
}

.mobile-sync-line {
  margin: 4px 0 0;
  color: #6f879f;
  font-size: 0.8rem;
  line-height: 1.35;
}

.mobile-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 0;
  background: #070c12;
}

.mobile-tabs button {
  min-height: 44px;
  border: 1px solid #314458;
  background: #101820;
  color: #a8bfd8;
  font: inherit;
  font-weight: 800;
  border-radius: 8px;
}

.mobile-tabs button.is-active {
  border-color: #39657f;
  background: #162332;
  color: #eef4f8;
}

.mobile-view {
  display: none;
}

.mobile-view.is-active {
  display: grid;
  gap: 12px;
}

.mobile-section {
  padding: 0;
  border: 0;
  background: transparent;
}

.mobile-section-head {
  margin-bottom: 12px;
}

.mobile-section-head.split {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.mobile-symbol-select {
  display: grid;
  gap: 5px;
  min-width: 130px;
  color: #ffc04d;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mobile-symbol-select select {
  min-height: 38px;
  border: 1px solid #34485c;
  background: #0b1118;
  color: #eef4f8;
  padding: 0 10px;
  font: inherit;
  font-size: 0.95rem;
  letter-spacing: 0;
  text-transform: none;
}

.mobile-stack {
  display: grid;
  gap: 10px;
}

.mobile-empty {
  color: #a8bfd8;
  line-height: 1.45;
}

.mobile-alerts-btn {
  min-height: 38px;
  align-self: flex-start;
}

.mobile-alerts-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.mobile-notification-grid {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.mobile-notification-option {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid #26394c;
  border-radius: 8px;
  background: #0d151e;
}

.mobile-notification-option input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: #58f58b;
}

.mobile-notification-option strong {
  display: block;
  color: #eef4f8;
  font-size: 0.95rem;
}

.mobile-notification-option small {
  display: block;
  margin-top: 2px;
  color: #8fa7c0;
  line-height: 1.35;
}

.mobile-real-card .dash-trade-toggle {
  cursor: default;
}

.mobile-real-card .dash-trade-expanded {
  display: grid;
  gap: 10px;
}

.mobile-candidate-row {
  cursor: default;
}

.mobile-ob-table {
  overflow: hidden;
}

.mobile-ob-real-row {
  min-width: 0;
}

.mobile-view .dash-live-trade-list,
.mobile-view .trade-candidates-list {
  gap: 10px;
}

.mobile-view .dash-trade-bundle,
.mobile-view .trade-candidate-row,
.mobile-view .trade-ob-watch-list {
  border-radius: 8px;
}

.mobile-view .dash-trade-toggle {
  grid-template-columns: 1fr auto;
}

.mobile-view .dash-trade-summary,
.mobile-view .dash-trade-levels {
  grid-column: 1 / -1;
}

@media (max-width: 420px) {
  .mobile-room-header {
    display: grid;
  }

  .mobile-section-head.split {
    display: grid;
  }

  .mobile-symbol-select {
    min-width: 0;
  }

  .mobile-view .dash-trade-toggle,
  .mobile-view .dash-history-head {
    grid-template-columns: 1fr;
  }

  .mobile-view .dash-position-level {
    min-width: 0;
  }

  .mobile-view .ob-watch-header,
  .mobile-view .ob-watch-row {
    grid-template-columns: 1fr 44px 1.2fr 1fr 42px;
  }
}
