﻿:root {
  color-scheme: dark;
  --bg: #05070c;
  --bg-soft: #080d14;
  --panel: rgba(14, 21, 33, 0.78);
  --panel-strong: rgba(17, 27, 42, 0.92);
  --line: rgba(117, 226, 205, 0.18);
  --line-strong: rgba(117, 226, 205, 0.34);
  --text: #eef7ff;
  --muted: #8ea0b8;
  --faint: #58677b;
  --cyan: #42d9c8;
  --blue: #5aa7ff;
  --green: #75e2a7;
  --amber: #f3bf55;
  --red: #ff6b7c;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 18% 8%, rgba(66, 217, 200, 0.12), transparent 28%),
    radial-gradient(circle at 84% 24%, rgba(90, 167, 255, 0.12), transparent 24%),
    linear-gradient(135deg, #05070c 0%, #0a1018 44%, #06080d 100%);
  overflow-x: hidden;
}

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

button,
.button,
.ghost-button {
  border: 1px solid var(--line-strong);
  background: rgba(66, 217, 200, 0.12);
  color: var(--text);
  border-radius: 8px;
  min-height: 42px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

button:hover,
.button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
  border-color: var(--cyan);
  background: rgba(66, 217, 200, 0.2);
  box-shadow: 0 0 28px rgba(66, 217, 200, 0.13);
}

.primary-button {
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  color: #041018;
  border-color: transparent;
}

.ambient {
  position: fixed;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(30px);
  opacity: 0.5;
  animation: drift 12s ease-in-out infinite alternate;
}

.ambient-one {
  width: 340px;
  height: 340px;
  left: 18%;
  top: -160px;
  background: rgba(66, 217, 200, 0.16);
}

.ambient-two {
  width: 460px;
  height: 460px;
  right: -190px;
  bottom: 8%;
  background: rgba(90, 167, 255, 0.13);
  animation-delay: -4s;
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }

  to {
    transform: translate3d(24px, 18px, 0) scale(1.08);
  }
}

.terminal-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(5, 9, 15, 0.74);
  backdrop-filter: blur(20px);
  z-index: 2;
}

.brand,
.top-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  color: #041018;
  font-weight: 950;
  box-shadow: 0 0 28px rgba(66, 217, 200, 0.28);
  position: relative;
  overflow: hidden;
}

.brand-mark::after {
  content: "";
  position: absolute;
  width: 70%;
  height: 2px;
  left: 15%;
  bottom: 10px;
  background: rgba(4, 16, 24, 0.65);
}

.brand-mark.compact {
  width: 34px;
  height: 34px;
  font-size: 13px;
}

.brand small,
.source-card small,
.eyebrow,
.metric span,
.metric small,
.panel-heading span,
.muted,
td {
  color: var(--muted);
}

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

.side-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #dbe8f8;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.side-nav a:hover,
.side-nav a.active {
  transform: translateX(2px);
  border-color: var(--line-strong);
  background: rgba(66, 217, 200, 0.08);
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
}

.source-card {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(11, 17, 27, 0.72);
}

.workspace {
  min-width: 0;
  padding: 22px clamp(18px, 3vw, 34px) 34px;
}

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

.top-brand {
  display: none;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.live-badge,
.pill,
.badge {
  min-height: 30px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(66, 217, 200, 0.07);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.view-root {
  display: grid;
  gap: 18px;
  min-width: 0;
  animation: fadeUp 500ms ease both;
}

.view-root > *,
.metric-grid,
.grid-2,
.grid-3,
.panel,
.table-wrap {
  min-width: 0;
  max-width: 100%;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero {
  min-height: calc(100vh - 108px);
  display: grid;
  align-items: center;
  gap: 28px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(117, 226, 205, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(117, 226, 205, 0.06) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, black, transparent 76%);
  animation: gridPulse 5s ease-in-out infinite alternate;
}

@keyframes gridPulse {
  from {
    opacity: 0.35;
  }

  to {
    opacity: 0.7;
  }
}

.hero-content {
  position: relative;
  max-width: 1120px;
  display: grid;
  gap: 24px;
  z-index: 1;
}

.hero h1 {
  margin: 0;
  max-width: 880px;
  font-size: clamp(52px, 9vw, 118px);
  line-height: 0.88;
  letter-spacing: 0;
}

.hero p {
  margin: 0;
  max-width: 680px;
  color: #b8c7da;
  font-size: clamp(18px, 2.2vw, 26px);
  line-height: 1.45;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.selector-panel,
.selector-row,
.risk-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.selector-panel {
  justify-content: space-between;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(11, 17, 27, 0.56);
}

.lab-controls {
  align-items: flex-end;
}

.risk-form {
  align-items: stretch;
}

.risk-field {
  flex: 1 1 220px;
  display: grid;
  gap: 8px;
}

.risk-field input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  font: inherit;
  font-weight: 800;
}

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

.mapping-card {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.mapping-card div {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  border-radius: 8px;
  padding: 12px;
}

.mapping-card span,
.mapping-card small {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
}

.mapping-card strong {
  display: block;
  margin: 4px 0;
  color: var(--text);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.tab-bar,
.quick-grid,
.compact-board,
.marker-legend,
.tv-legend,
.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.tab-bar {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(11, 17, 27, 0.56);
}

.quick-grid {
  align-items: stretch;
}

.quick-grid .button {
  flex: 1 1 180px;
}

.compact-board {
  gap: 12px;
}

.compact-table table {
  min-width: 620px;
}

.selector-button {
  min-height: 36px;
  padding: 0 13px;
  background: rgba(255, 255, 255, 0.045);
}

.compact-review-button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.selector-button.active {
  border-color: var(--cyan);
  background: rgba(66, 217, 200, 0.2);
  color: var(--cyan);
  box-shadow: 0 0 24px rgba(66, 217, 200, 0.12);
}

.export-actions,
.review-actions {
  margin-left: auto;
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-tape {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}

.tape-item,
.metric,
.panel,
.setup-card,
.watch-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.tape-item {
  padding: 14px;
  display: grid;
  gap: 6px;
}

.tape-item strong {
  font-size: 22px;
}

.tape-item small.positive,
.positive {
  color: var(--green);
}

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

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
}

.page-heading h1 {
  margin: 6px 0 0;
  font-size: clamp(34px, 5vw, 62px);
  line-height: 0.98;
}

.page-heading p {
  margin: 0;
  max-width: 650px;
  color: var(--muted);
  line-height: 1.55;
}

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

.metric {
  min-height: 136px;
  padding: 18px;
  display: grid;
  gap: 8px;
  align-content: space-between;
  transition: transform 180ms ease, border-color 180ms ease;
}

.dashboard-metric {
  min-height: 164px;
}

.metric:hover,
.panel:hover,
.setup-card:hover,
.watch-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.metric strong {
  font-size: 36px;
  line-height: 1;
}

.dashboard-metric strong {
  display: grid;
  gap: 6px;
  font-size: clamp(34px, 4vw, 48px);
}

.equity-monitor-panel {
  display: grid;
  gap: 16px;
}

.equity-chart {
  width: 100%;
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(3, 8, 14, 0.78);
}

.metric-subvalue {
  color: var(--cyan);
  font-size: 17px;
  font-weight: 900;
}

.metric-note-lines {
  display: grid;
  gap: 4px;
  line-height: 1.25;
}

.outcome-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.outcome-pill {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
  color: #061014;
}

.outcome-pill.win {
  background: var(--green);
}

.outcome-pill.loss {
  background: var(--red);
}

.grade-card {
  border-color: rgba(117, 226, 205, 0.28);
  background: linear-gradient(145deg, rgba(66, 217, 200, 0.13), rgba(11, 17, 27, 0.82));
}

.metric .sparkline {
  height: 28px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(66, 217, 200, 0.08), rgba(90, 167, 255, 0.18));
  position: relative;
  overflow: hidden;
}

.metric .sparkline::after {
  content: "";
  position: absolute;
  inset: 11px -20px auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  animation: scan 2.6s linear infinite;
}

@keyframes scan {
  from {
    transform: translateX(-30%);
  }

  to {
    transform: translateX(70%);
  }
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.85fr);
  gap: 14px;
}

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

.panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 18px;
}

.chart {
  width: 100%;
  min-height: 320px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    rgba(3, 8, 14, 0.5);
  background-size: 100% 20%, 9% 100%, auto;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
}

.tv-ready-chart {
  min-height: 360px;
}

.tv-legend {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(66, 217, 200, 0.06);
}

.tv-legend span {
  color: var(--muted);
}

.tradingview-shell {
  min-height: 520px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: #05070c;
}

.tradingview-shell iframe {
  display: block;
  width: 100%;
  min-height: 520px;
  border: 0;
}

.tv-embed-note {
  min-height: 116px;
  margin-top: 14px;
}

.chart-placeholder-card {
  min-height: 220px;
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background:
    linear-gradient(rgba(117, 226, 205, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(117, 226, 205, 0.06) 1px, transparent 1px),
    rgba(3, 8, 14, 0.44);
  background-size: 32px 32px;
}

.chart-placeholder-card strong {
  font-size: clamp(22px, 3vw, 34px);
}

.chart-placeholder-card p {
  margin: 0;
  max-width: 620px;
  line-height: 1.55;
}

.chart-placeholder-card code {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--green);
  background: rgba(0, 0, 0, 0.22);
}

.compact-note {
  min-height: 140px;
}

.confidence-warning {
  min-height: 0;
  margin-bottom: 14px;
  border-style: solid;
  border-color: rgba(243, 191, 85, 0.36);
  background: rgba(243, 191, 85, 0.07);
}

.panel-subsection {
  margin-top: 18px;
}

.marker-legend {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  background: var(--cyan);
}

.legend-dot.above,
.legend-dot.reclaim {
  background: var(--green);
}

.legend-dot.below,
.legend-dot.reject {
  background: var(--red);
}

.legend-dot.slide {
  background: var(--blue);
}

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

.compact-context {
  gap: 8px;
}

.context-note {
  margin-top: 12px;
}

.bias-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 13px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

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

.watch-grid {
  grid-template-columns: repeat(4, minmax(220px, 1fr));
}

.setup-card,
.watch-card {
  padding: 16px;
  display: grid;
  gap: 13px;
}

.setup-top,
.watch-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.strength {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.strength span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--green));
}

.table-wrap {
  overflow-x: auto;
}

.clickable-table tbody tr {
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.clickable-table tbody tr:hover {
  background: rgba(66, 217, 200, 0.08);
}

.review-modal[aria-hidden="true"],
.review-modal:empty {
  display: none;
}

.review-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
}

.review-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 5, 10, 0.78);
  backdrop-filter: blur(12px);
}

.review-dialog {
  position: relative;
  width: min(1180px, 96vw);
  max-height: 92vh;
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(8, 13, 20, 0.96);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.66);
}

.review-chart {
  min-height: 420px;
}

.review-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

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

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

th {
  color: #dfeeff;
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.distribution {
  display: grid;
  gap: 11px;
}

.bar-row {
  display: grid;
  grid-template-columns: 100px 1fr 42px;
  gap: 10px;
  align-items: center;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
}

.research-list {
  display: grid;
  gap: 12px;
}

.research-item {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

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

  .sidebar {
    position: static;
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    height: auto;
    min-height: auto;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }

  .brand,
  .source-card {
    display: none;
  }

  .side-nav {
    display: flex;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
  }

  .side-nav a {
    flex: 0 0 auto;
  }

  .top-brand {
    display: inline-flex;
  }

  .grid-2,
  .metric-grid,
  .grid-3,
  .setup-grid,
  .watch-grid,
  .hero-tape {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .workspace {
    padding: 14px;
  }

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

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  .grid-2,
  .metric-grid,
  .grid-3,
  .setup-grid,
  .watch-grid,
  .mapping-card,
  .review-meta,
  .hero-tape {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding: 34px 0;
  }

  .side-nav a {
    padding: 0 10px;
  }
}

/* Shared UI state components */
.section-toolbar {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin: 14px 0;
  flex-wrap: wrap;
}

.status-badge-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-badge {
  border: 1px solid rgba(142, 160, 184, 0.28);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  padding: 7px 10px;
  text-transform: uppercase;
}

.status-badge.source {
  border-color: rgba(90, 167, 255, 0.35);
  color: var(--accent);
}

.status-badge.readonly {
  border-color: rgba(117, 226, 167, 0.35);
  color: var(--green);
}

.mini-refresh {
  background: rgba(90, 167, 255, 0.08);
  border: 1px solid rgba(90, 167, 255, 0.28);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  min-height: 34px;
  padding: 0 12px;
}

.mini-refresh:hover {
  background: rgba(90, 167, 255, 0.16);
}

.state-card {
  background: rgba(11, 18, 32, 0.64);
  border: 1px solid rgba(142, 160, 184, 0.22);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  margin: 10px 0;
  padding: 13px 14px;
}

.state-card-head {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.state-card strong {
  color: var(--text);
  font-size: 13px;
}

.state-card p,
.state-card small,
.state-card span {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.state-loading {
  border-color: rgba(90, 167, 255, 0.36);
}

.state-empty {
  border-color: rgba(142, 160, 184, 0.32);
}

.state-error {
  background: rgba(255, 107, 124, 0.08);
  border-color: rgba(255, 107, 124, 0.42);
}

.state-success,
.state-readonly {
  background: rgba(117, 226, 167, 0.06);
  border-color: rgba(117, 226, 167, 0.32);
}

.state-stale,
.state-warning {
  background: rgba(243, 191, 85, 0.08);
  border-color: rgba(243, 191, 85, 0.42);
}

.data-health-card {
  margin-top: 18px;
}

@media (max-width: 760px) {
  .section-toolbar {
    align-items: stretch;
  }

  .mini-refresh {
    width: 100%;
  }
}
