:root {
  color-scheme: dark;
  --bg: #06080b;
  --bg-elevated: #0b1016;
  --bg-pane: #111820;
  --bg-pane-2: #0d141b;
  --bg-soft: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 177, 48, 0.35);
  --text: #e6edf4;
  --text-dim: #90a0b2;
  --text-faint: #6e7b8c;
  --accent: #f5a623;
  --accent-soft: rgba(245, 166, 35, 0.12);
  --green: #25c17a;
  --green-soft: rgba(37, 193, 122, 0.12);
  --red: #ff6b5f;
  --red-soft: rgba(255, 107, 95, 0.14);
  --blue: #4da3ff;
  --blue-soft: rgba(77, 163, 255, 0.14);
  --rail-width: 236px;
  --topbar-height: 64px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  font-family: var(--font-sans), sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(245, 166, 35, 0.12), transparent 26%),
    linear-gradient(180deg, #081017 0%, #05070a 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.terminal-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--rail-width) minmax(0, 1fr);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 18%),
    var(--bg);
  background-size: 32px 32px, 32px 32px, 100% 100%, auto;
}

.terminal-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: linear-gradient(180deg, rgba(11, 16, 22, 0.96), rgba(6, 8, 11, 0.98));
  border-right: 1px solid var(--border);
}

.terminal-brand {
  display: grid;
  gap: 4px;
}

.terminal-brand-kicker {
  font-family: var(--font-display), sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.24em;
  color: var(--accent);
}

.terminal-brand-name {
  font-family: var(--font-display), sans-serif;
  font-size: 1.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.terminal-nav {
  display: grid;
  gap: 6px;
}

.terminal-nav-link {
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.terminal-nav-link:hover {
  border-color: var(--border);
  color: var(--text);
  background: var(--bg-soft);
}

.terminal-nav-link-active {
  border-color: var(--border-strong);
  color: var(--text);
  background: linear-gradient(90deg, rgba(245, 166, 35, 0.12), rgba(245, 166, 35, 0.04));
}

.shell-metrics {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.shell-metric {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.shell-metric-label,
.overview-label,
.focus-label,
.terminal-filter-label,
.summary-title,
.filter-label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.68rem;
}

.shell-metric-value,
.overview-cell strong,
.focus-value {
  font-family: var(--font-mono), monospace;
  font-size: 0.92rem;
}

.terminal-frame {
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(var(--topbar-height), auto) minmax(0, 1fr);
}

.terminal-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 10px 20px;
  background: rgba(7, 10, 14, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.status-dot,
.chart-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--text-faint);
}

.status-connected .status-dot,
.chart-status-connected .chart-dot {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(37, 193, 122, 0.14);
}

.chart-status-connecting .chart-dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(245, 166, 35, 0.12);
  animation: pulse 1.3s ease-in-out infinite;
}

.status-stale .status-dot,
.chart-status-stale .chart-dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(245, 166, 35, 0.18);
}

.status-disconnected .status-dot,
.chart-status-disconnected .chart-dot {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(255, 107, 95, 0.12);
}

.terminal-topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
  width: auto;
  margin-left: auto;
}

.terminal-topbar-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  flex: 0 1 auto;
}

.terminal-topbar-mode {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  margin-left: auto;
}

.terminal-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: clamp(220px, 24vw, 360px);
  flex: 0 1 clamp(220px, 24vw, 360px);
}

.terminal-filter-label {
  margin-bottom: 0;
  line-height: 1;
}

.terminal-filter-field {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 32px;
}

.terminal-filter-field::before,
.terminal-filter-field::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.terminal-filter-field::before {
  height: 1px;
  background: linear-gradient(90deg, rgba(245, 166, 35, 0.88), rgba(245, 166, 35, 0.14));
  opacity: 0.72;
}

.terminal-filter-field::after {
  height: 2px;
  background: linear-gradient(90deg, rgba(255, 216, 154, 0.98), rgba(245, 166, 35, 0.92));
  transform: scaleX(0.18);
  transform-origin: left center;
  opacity: 0;
}

.terminal-input {
  min-width: 0;
  width: 100%;
  padding: 0 0 6px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono), monospace;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.terminal-input::placeholder {
  color: rgba(193, 203, 224, 0.58);
  font-size: 0.86rem;
}

.terminal-filter:focus-within .terminal-filter-label {
  color: #ffd89a;
}

.terminal-filter:focus-within .terminal-filter-field::before {
  background: linear-gradient(90deg, rgba(255, 216, 154, 0.9), rgba(245, 166, 35, 0.26));
  opacity: 0.94;
}

.terminal-filter:focus-within .terminal-filter-field::after {
  transform: scaleX(1);
  opacity: 1;
  box-shadow: 0 0 18px rgba(245, 166, 35, 0.34);
}

.terminal-filter:focus-within .terminal-input {
  color: #fff1cf;
  text-shadow: 0 0 14px rgba(245, 166, 35, 0.16);
}

.terminal-input:focus-visible,
.filter-input:focus-visible {
  outline: none;
}

.terminal-button,
.mode-button,
.filter-clear,
.jump-button,
.pause-button,
.interval-button,
.overlay-toggle,
.drawer-close {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
}

.terminal-button:disabled,
.filter-clear:disabled,
.jump-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.terminal-button-primary,
.interval-button.active,
.overlay-toggle.overlay-toggle-on,
.mode-button {
  border-color: var(--border-strong);
  background: linear-gradient(180deg, rgba(245, 166, 35, 0.18), rgba(245, 166, 35, 0.08));
  color: #ffd89a;
}

.instrument-focus-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  max-width: min(360px, 32vw);
  padding: 5px 8px 5px 10px;
  border: 1px solid rgba(255, 216, 154, 0.34);
  border-radius: 8px;
  background: rgba(245, 166, 35, 0.08);
  color: #ffe2aa;
  font-family: var(--font-mono), monospace;
  font-size: 0.72rem;
  font-weight: 700;
}

.instrument-focus-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.instrument-focus-chip button,
.instrument-cell-button {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.instrument-focus-chip button {
  padding: 4px 6px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.62rem;
}

.instrument-cell-button {
  padding: 0;
  text-align: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(255, 216, 154, 0.36);
  text-underline-offset: 3px;
}

.instrument-cell-button:hover,
.instrument-cell-button:focus-visible {
  color: #ffd89a;
  outline: none;
}

.pause-button {
  padding: 7px 10px;
  font-size: 0.66rem;
}

.terminal-content {
  min-width: 0;
  padding: 24px 24px 24px;
}

.page-shell {
  display: grid;
  gap: 18px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.page-title,
h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display), sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.page-title {
  font-size: clamp(2rem, 3vw, 2.8rem);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.contract-filter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  min-width: 0;
  max-width: min(440px, 42vw);
}

.contract-filter-button-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contract-filter-button.is-active {
  border-color: rgba(245, 166, 35, 0.55);
  background: linear-gradient(180deg, rgba(245, 166, 35, 0.18), rgba(245, 166, 35, 0.07));
  color: #ffe2aa;
}

.flow-filter-popover {
  position: relative;
}

.flow-filter-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.flow-filter-trigger.is-active {
  border-color: rgba(245, 166, 35, 0.55);
  background: linear-gradient(180deg, rgba(245, 166, 35, 0.18), rgba(245, 166, 35, 0.07));
}

.flow-filter-badge {
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(245, 166, 35, 0.22);
  color: #ffe4b3;
  font-family: var(--font-mono), monospace;
  font-size: 0.7rem;
  text-align: center;
}

.flow-filter-popover-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 30;
  width: min(420px, calc(100vw - 72px));
  max-height: min(70vh, 560px);
  overflow: auto;
  border: 1px solid rgba(245, 166, 35, 0.24);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
    rgba(11, 16, 22, 0.92);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(18px);
}

.flow-filter-popover-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.flow-filter-popover-title {
  font-family: var(--font-display), sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.flow-filter-popover-copy {
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 0.78rem;
}

.flow-filter-popover-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.flow-filter-section {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(0, 0, 0, 0.1));
}

.flow-filter-section-title {
  color: #ffd89a;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.flow-filter-checkbox-grid,
.flow-filter-chip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.flow-filter-checkbox-grid-wide {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.flow-filter-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.82rem;
  text-transform: uppercase;
  cursor: pointer;
}

.flow-filter-check input {
  margin: 0;
  accent-color: var(--accent);
}

.filter-chip {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  min-height: 42px;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
  text-transform: uppercase;
}

.filter-chip.is-active {
  border-color: rgba(245, 166, 35, 0.45);
  background: linear-gradient(180deg, rgba(245, 166, 35, 0.18), rgba(245, 166, 35, 0.07));
  color: #ffe4b3;
}

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

.overview-cell {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.02));
}

.page-grid {
  display: grid;
  gap: 16px;
  align-items: stretch;
}

.page-grid-home {
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
}

.page-grid-tape {
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr);
}

.page-grid-signals {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 2fr) minmax(0, 1fr);
  height: calc(100vh - var(--topbar-height) - 172px);
  min-height: 620px;
}

.page-grid-charts {
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 1fr);
}

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

.page-grid-home > :nth-child(3),
.page-grid-tape > :nth-child(1),
.page-grid-replay > :nth-child(1) {
  grid-column: 1 / -1;
}

.terminal-pane {
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 40%),
    var(--bg-pane);
  overflow: hidden;
}

.terminal-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.terminal-pane-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.terminal-pane-title {
  font-size: 1rem;
}

.terminal-pane-status {
  min-width: 0;
}

.terminal-pane-actions,
.card-controls,
.chart-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
}

.terminal-pane-body,
.card-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  gap: 14px;
  padding: 16px 18px 18px;
}

.chart-panel {
  display: grid;
  gap: 12px;
}

.chart-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.chart-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.chart-meta-time,
.chart-hint,
.overlay-legend,
.timestamp,
.drawer-subtitle,
.drawer-note,
.drawer-empty,
.note,
.time {
  color: var(--text-dim);
}

.chart-surface {
  width: 100%;
  height: 460px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0b1218;
  overflow: hidden;
}

.chart-empty {
  margin-top: -2px;
}

.chart-intervals {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.status span,
.timestamp,
.missed-count,
.chart-hint,
.meta,
.note,
.drawer-note,
.drawer-row-meta {
  font-family: var(--font-mono), monospace;
}

.status-replay .status-dot {
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(77, 163, 255, 0.14);
}

.status-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  min-width: 0;
  font-family: var(--font-mono), monospace;
}

.status-inline-label {
  color: var(--text);
  font-size: 0.82rem;
}

.status-inline-meta {
  color: var(--text-dim);
  font-size: 0.72rem;
}

.status-inline-counter {
  min-width: 82px;
  color: var(--accent);
  font-size: 0.72rem;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.status-inline-counter-visible {
  opacity: 1;
}

.tape-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
}

.tape-controls button {
  white-space: nowrap;
}

.missed-count {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: 0.72rem;
  color: var(--accent);
  opacity: 0;
  transform: translateX(6px);
  transition:
    max-width 180ms ease,
    opacity 140ms ease,
    transform 180ms ease;
}

.missed-count-visible {
  max-width: 92px;
  opacity: 1;
  transform: translateX(0);
}

.list {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  padding: 12px;
  padding-right: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0.09));
  align-self: stretch;
}

.terminal-list-compact {
  flex: 0 0 auto;
  max-height: 260px;
}

.page-grid-home > :nth-child(1),
.page-grid-home > :nth-child(2) {
  height: clamp(430px, 56vh, 760px);
}

.page-grid-home > :nth-child(3),
.page-grid-replay > :not(:first-child) {
  height: clamp(430px, 58vh, 760px);
}

.page-grid-signals > .terminal-pane {
  height: 100%;
  min-height: 0;
}

.page-grid-signals > .signals-pane-alerts {
  grid-column: 1;
  grid-row: 1;
}

.page-grid-signals > .signals-pane-rules {
  grid-column: 2;
  grid-row: 1;
}

.page-grid-signals > .signals-pane-dark {
  grid-column: 1 / -1;
  grid-row: 2;
}

.page-grid-tape > :first-child {
  height: clamp(460px, 64vh, 880px);
}

.page-grid-tape > :not(:first-child) {
  height: clamp(400px, 50vh, 680px);
}

.page-grid-charts > :first-child {
  height: auto;
}

.page-grid-charts > :last-child {
  height: clamp(430px, 58vh, 760px);
}

.row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.018));
}

.row-button {
  width: 100%;
  text-align: left;
  color: inherit;
}

.row-button:hover {
  border-color: rgba(245, 166, 35, 0.25);
  background: linear-gradient(180deg, rgba(245, 166, 35, 0.07), rgba(255, 255, 255, 0.018));
}

.data-table-shell,
.options-table-wrap {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

.data-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: rgba(5, 8, 12, 0.42);
}

.data-table {
  display: block;
  min-width: 980px;
}

.data-table-options {
  min-width: 1280px;
}

.data-table-equities {
  min-width: 660px;
}

.data-table-flow {
  min-width: 1260px;
}

.data-table-alerts {
  min-width: 900px;
}

.data-table-classifier {
  min-width: 760px;
}

.data-table-dark {
  min-width: 820px;
}

.data-table-head,
.data-table-row {
  display: grid;
  align-items: center;
  column-gap: 8px;
}

.data-table-head {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 30px;
  padding: 0 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.095);
  background: rgba(8, 11, 16, 0.98);
  color: var(--text-faint);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.data-table-row {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
  background: rgba(255, 255, 255, 0.008);
  color: inherit;
  font: inherit;
  text-align: left;
}

.data-table-row:nth-child(even) {
  background: rgba(255, 255, 255, 0.022);
}

.data-table-row:hover,
.data-table-row:focus-visible {
  outline: none;
  background: rgba(245, 166, 35, 0.055);
}

.data-table-row-button {
  cursor: pointer;
}

.data-table-row-options {
  min-height: 36px;
}

.data-table-row-equities {
  min-height: 34px;
}

.data-table-row-flow,
.data-table-row-alerts,
.data-table-row-classifier,
.data-table-row-dark {
  min-height: 44px;
}

.data-table-row-classified {
  background:
    linear-gradient(90deg, rgba(var(--classifier-rgb, 192, 200, 210), calc(0.02 + var(--classifier-intensity, 0) * 0.12)), transparent 62%),
    rgba(255, 255, 255, 0.008);
}

.data-table-row-classified:hover,
.data-table-row-classified:focus-visible {
  background:
    linear-gradient(90deg, rgba(var(--classifier-rgb, 192, 200, 210), calc(0.04 + var(--classifier-intensity, 0) * 0.18)), transparent 68%),
    rgba(245, 166, 35, 0.04);
}

.data-table-row-classified.is-classified {
  border-left: 3px solid rgba(var(--classifier-rgb), calc(0.35 + var(--classifier-intensity) * 0.45));
  padding-left: 7px;
}

.data-table-row-warn,
.data-table-row-severity-high,
.data-table-row-direction-bearish {
  border-left: 3px solid rgba(255, 107, 95, 0.58);
  padding-left: 7px;
}

.data-table-row-severity-medium,
.data-table-row-direction-neutral {
  border-left: 3px solid rgba(77, 163, 255, 0.46);
  padding-left: 7px;
}

.data-table-row-severity-low,
.data-table-row-direction-bullish {
  border-left: 3px solid rgba(37, 193, 122, 0.5);
  padding-left: 7px;
}

.data-table-options .data-table-head,
.data-table-options .data-table-row {
  grid-template-columns: minmax(72px, 0.8fr) minmax(50px, 0.55fr) minmax(64px, 0.7fr) minmax(58px, 0.6fr) minmax(34px, 0.35fr) minmax(62px, 0.65fr) minmax(104px, 1fr) minmax(54px, 0.55fr) minmax(66px, 0.7fr) minmax(48px, 0.5fr) minmax(42px, 0.45fr) minmax(92px, 0.9fr);
}

.data-table-equities .data-table-head,
.data-table-equities .data-table-row {
  grid-template-columns: minmax(76px, 0.9fr) minmax(70px, 0.8fr) minmax(76px, 0.8fr) minmax(70px, 0.75fr) minmax(80px, 0.8fr) minmax(76px, 0.75fr);
}

.data-table-flow .data-table-head,
.data-table-flow .data-table-row {
  grid-template-columns: minmax(148px, 1.1fr) minmax(180px, 1.4fr) minmax(62px, 0.45fr) minmax(70px, 0.5fr) minmax(88px, 0.7fr) minmax(74px, 0.55fr) minmax(132px, 1fr) minmax(110px, 0.8fr) minmax(210px, 1.6fr);
}

.data-table-alerts .data-table-head,
.data-table-alerts .data-table-row {
  grid-template-columns: minmax(76px, 0.75fr) minmax(170px, 1.4fr) minmax(52px, 0.45fr) minmax(58px, 0.45fr) minmax(52px, 0.4fr) minmax(66px, 0.55fr) minmax(260px, 2fr);
}

.data-table-classifier .data-table-head,
.data-table-classifier .data-table-row {
  grid-template-columns: minmax(76px, 0.75fr) minmax(180px, 1.45fr) minmax(70px, 0.6fr) minmax(74px, 0.65fr) minmax(300px, 2.2fr);
}

.data-table-dark .data-table-head,
.data-table-dark .data-table-row {
  grid-template-columns: minmax(76px, 0.75fr) minmax(170px, 1.35fr) minmax(76px, 0.65fr) minmax(74px, 0.65fr) minmax(74px, 0.65fr) minmax(260px, 2fr);
}

.data-table-cell {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
}

.data-table-cell-number {
  font-family: var(--font-mono), monospace;
  font-variant-numeric: tabular-nums;
}

.data-table-spacer {
  min-width: 100%;
  pointer-events: none;
}

.options-table {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
}

.options-table-head,
.options-table-row {
  display: grid;
  grid-template-columns: minmax(72px, 0.8fr) minmax(50px, 0.55fr) minmax(64px, 0.7fr) minmax(58px, 0.6fr) minmax(34px, 0.35fr) minmax(62px, 0.65fr) minmax(104px, 1fr) minmax(54px, 0.55fr) minmax(66px, 0.7fr) minmax(48px, 0.5fr) minmax(42px, 0.45fr) minmax(92px, 0.9fr);
  align-items: center;
  column-gap: 8px;
}

.options-table-head {
  flex: 0 0 auto;
  height: 30px;
  padding: 0 8px;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 11, 16, 0.98);
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.options-table-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.options-table-row {
  width: 100%;
  min-height: 34px;
  padding: 0 8px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
  background:
    linear-gradient(90deg, rgba(var(--classifier-rgb, 192, 200, 210), calc(0.02 + var(--classifier-intensity, 0) * 0.12)), transparent 62%),
    rgba(255, 255, 255, 0.012);
  color: inherit;
  font: inherit;
  text-align: left;
}

.options-table-row:hover,
.options-table-row:focus-visible {
  outline: none;
  background:
    linear-gradient(90deg, rgba(var(--classifier-rgb, 192, 200, 210), calc(0.04 + var(--classifier-intensity, 0) * 0.18)), transparent 68%),
    rgba(255, 255, 255, 0.03);
}

.options-table-row.is-classified {
  cursor: pointer;
  border-left: 3px solid rgba(var(--classifier-rgb), calc(0.35 + var(--classifier-intensity) * 0.45));
  padding-left: 7px;
}

.options-table-row > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
}

.mono {
  font-variant-numeric: tabular-nums;
}

.classifier-green { --classifier-rgb: 37, 193, 122; }
.classifier-red { --classifier-rgb: 255, 107, 95; }
.classifier-amber { --classifier-rgb: 245, 166, 35; }
.classifier-copper { --classifier-rgb: 198, 122, 75; }
.classifier-blue { --classifier-rgb: 77, 163, 255; }
.classifier-teal { --classifier-rgb: 64, 210, 190; }
.classifier-yellowgreen { --classifier-rgb: 174, 210, 78; }
.classifier-violet { --classifier-rgb: 170, 130, 255; }
.classifier-cyan { --classifier-rgb: 94, 214, 255; }
.classifier-magenta { --classifier-rgb: 255, 92, 205; }
.classifier-neutral { --classifier-rgb: 192, 200, 210; }

.contract,
.drawer-row-title {
  margin-bottom: 6px;
  font-size: 0.92rem;
  font-weight: 600;
}

.option-contract {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta,
.drawer-row-meta,
.flow-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.76rem;
}

.notional-emphasis {
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #ffe08c;
}

.condition-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.condition-sweep {
  border-color: rgba(37, 193, 122, 0.34);
  color: #98f0c0;
  background: var(--green-soft);
}

.condition-iso {
  border-color: rgba(77, 163, 255, 0.34);
  color: #bddcff;
  background: var(--blue-soft);
}

.condition-neutral {
  border-color: rgba(192, 200, 210, 0.28);
  color: #d4dbe3;
  background: rgba(192, 200, 210, 0.08);
}

.pill,
.drawer-chip,
.flag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.structure-tag {
  border-color: rgba(77, 163, 255, 0.36);
  color: #9bcbff;
  background: var(--blue-soft);
}

.aggressor-tag,
.direction-bullish,
.severity-low,
.flag {
  border-color: rgba(37, 193, 122, 0.34);
  color: #98f0c0;
  background: var(--green-soft);
}

.direction-bearish,
.severity-high,
.nbbo-missing {
  border-color: rgba(255, 107, 95, 0.34);
  color: #ffc3bd;
  background: var(--red-soft);
}

.direction-neutral,
.severity-medium,
.flag-muted,
.nbbo-stale {
  border-color: rgba(77, 163, 255, 0.26);
  color: #bddcff;
  background: var(--blue-soft);
}

.nbbo-meta {
  margin-top: 8px;
}

.nbbo-side {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.nbbo-tag {
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.nbbo-tag-a,
.nbbo-tag-aa {
  border-color: rgba(37, 193, 122, 0.34);
  color: #98f0c0;
  background: var(--green-soft);
}

.nbbo-tag-b,
.nbbo-tag-bb {
  border-color: rgba(255, 107, 95, 0.34);
  color: #ffc3bd;
  background: var(--red-soft);
}

.nbbo-tooltip {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(7, 10, 14, 0.96);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 5;
}

.nbbo-tooltip-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
}

.nbbo-side:hover .nbbo-tooltip,
.nbbo-side:focus-within .nbbo-tooltip {
  opacity: 1;
  transform: translateY(0);
}

.alert-strips {
  display: grid;
  gap: 12px;
}

.alert-strip-section {
  display: grid;
  gap: 6px;
}

.alert-strip-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
}

.alert-strip-bar {
  display: flex;
  height: 24px;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.strip-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #03130a;
}

.alert-strip-bar .severity-high,
.alert-strip-bar .direction-bearish {
  background: rgba(255, 107, 95, 0.9);
  color: #230705;
}

.alert-strip-bar .severity-medium,
.alert-strip-bar .direction-neutral {
  background: rgba(77, 163, 255, 0.9);
  color: #04111f;
}

.alert-strip-bar .severity-low,
.alert-strip-bar .direction-bullish {
  background: rgba(37, 193, 122, 0.92);
  color: #03130a;
}

.focus-stack {
  display: grid;
  gap: 14px;
}

.focus-block {
  display: grid;
  gap: 8px;
}

.focus-value {
  font-size: 1.4rem;
}

.empty {
  padding: 18px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-dim);
}

.drawer {
  position: fixed;
  top: 24px;
  right: 24px;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 18px;
  border-radius: 14px;
  border: 1px solid rgba(245, 166, 35, 0.2);
  background: rgba(7, 10, 14, 0.97);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  z-index: 40;
}

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

.drawer-eyebrow {
  margin: 0 0 6px;
  font-size: 0.68rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.drawer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.drawer-section {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.drawer-section h4 {
  margin: 0;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
}

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

.drawer-row {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.18);
  }
  100% {
    transform: scale(1);
  }
}

@media (max-width: 1180px) {
  .terminal-shell {
    grid-template-columns: 1fr;
  }

  .terminal-rail {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .shell-metrics {
    margin-top: 0;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .page-grid-home,
  .page-grid-tape,
  .page-grid-signals,
  .page-grid-charts,
  .page-grid-replay,
  .replay-matrix,
  .shell-metrics {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-grid-home > :nth-child(3),
  .page-grid-tape > :nth-child(1),
  .page-grid-replay > :nth-child(1) {
    grid-column: auto;
    grid-row: auto;
  }

  .page-grid-home > :nth-child(1),
  .page-grid-home > :nth-child(2),
  .page-grid-home > :nth-child(3),
  .page-grid-signals > .terminal-pane,
  .page-grid-replay > :not(:first-child),
  .page-grid-tape > :first-child,
  .page-grid-tape > :not(:first-child),
  .page-grid-charts > :last-child {
    height: auto;
  }

  .page-grid-signals {
    grid-template-rows: auto;
    min-height: 0;
  }

  .terminal-topbar {
    position: static;
    align-items: center;
    justify-content: flex-end;
    padding: 10px 16px;
  }

  .terminal-topbar-actions {
    justify-content: flex-end;
    margin-left: auto;
    width: auto;
  }

  .terminal-topbar-controls {
    flex: 0 1 auto;
  }

  .flow-filter-popover-panel {
    width: min(420px, calc(100vw - 56px));
  }
}

@media (max-width: 720px) {
  .terminal-content {
    padding: 18px 14px 22px;
  }

  .page-header,
  .terminal-pane-head,
  .chart-controls,
  .card-controls,
  .terminal-pane-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .terminal-pane-title-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .terminal-topbar-actions,
  .terminal-topbar-controls,
  .terminal-topbar-mode {
    width: 100%;
    justify-content: flex-start;
  }

  .terminal-topbar-actions,
  .terminal-topbar-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .terminal-filter {
    width: 100%;
    min-width: 0;
    flex-basis: auto;
    flex: 1 1 auto;
  }

  .terminal-input {
    width: 100%;
  }

  .page-actions {
    width: 100%;
  }

  .flow-filter-popover {
    width: 100%;
  }

  .flow-filter-trigger {
    width: 100%;
    justify-content: space-between;
  }

  .flow-filter-popover-panel {
    position: fixed;
    top: calc(var(--topbar-height) + 26px);
    left: 14px;
    right: 14px;
    width: auto;
    max-height: min(68vh, 560px);
  }

  .flow-filter-checkbox-grid,
  .flow-filter-checkbox-grid-wide,
  .flow-filter-chip-grid {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .time {
    text-align: left;
  }

  .chart-surface {
    height: 320px;
  }

  .drawer {
    position: static;
    width: auto;
    max-height: none;
    margin-top: 14px;
  }
}
