:root {
  color-scheme: dark;
  --bg: #0d120e;
  --bg-elevated: #141b16;
  --bg-surface: #1a241d;
  --bg-surface-2: #202c24;
  --line: rgba(132, 204, 22, 0.12);
  --line-strong: rgba(132, 204, 22, 0.22);
  --text: #edf4ee;
  --muted: #9fb0a1;
  --muted-strong: #c1cec3;
  --emerald: #10b981;
  --lime: #84cc16;
  --army: #4b5320;
  --red: #ef4444;
  --amber: #f59e0b;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top right, rgba(16, 185, 129, 0.09), transparent 28%),
    radial-gradient(circle at left center, rgba(75, 83, 32, 0.14), transparent 25%),
    linear-gradient(180deg, #0d120e 0%, #0b110c 100%);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  padding: 20px;
}

a {
  color: var(--lime);
}

.app-shell {
  max-width: 1440px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lime);
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: clamp(1.85rem, 3vw, 2.7rem);
  line-height: 1.05;
}

h2 {
  font-size: 1.15rem;
}

.caption,
.section-subtext,
.section-label {
  color: var(--muted);
}

.caption {
  max-width: 520px;
  margin: 0;
  text-align: right;
  line-height: 1.45;
}

.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-md);
  background: rgba(127, 29, 29, 0.35);
  color: #fee2e2;
}

.banner.warning {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(120, 53, 15, 0.35);
  color: #fef3c7;
}

.hidden {
  display: none !important;
}

.dashboard {
  display: grid;
  gap: 18px;
}

.card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0)),
    var(--bg-elevated);
  border: 1px solid rgba(132, 204, 22, 0.12);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 18px;
}

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

.section-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mode-badge,
.kill-switch {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.mode-paper {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.35);
  color: #9ff3d0;
}

.mode-live {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fecaca;
}

.mode-unknown,
.kill-unknown {
  background: rgba(148, 163, 184, 0.1);
  border-color: rgba(148, 163, 184, 0.22);
  color: var(--muted-strong);
}

.kill-off {
  background: rgba(132, 204, 22, 0.12);
  border-color: rgba(132, 204, 22, 0.28);
  color: #d9f99d;
}

.kill-on {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fecaca;
}

.heartbeat-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--muted-strong);
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.03);
}

.status-green {
  background: var(--emerald);
}

.status-amber {
  background: var(--amber);
}

.status-red {
  background: var(--red);
}

.chart-card,
.table-card {
  padding: 18px;
}

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

.section-subtext {
  margin: 6px 0 0;
  line-height: 1.45;
}

.chart-last-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--emerald);
  white-space: nowrap;
}

.chart-wrap {
  position: relative;
  min-height: 320px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(132, 204, 22, 0.04), transparent 36%),
    var(--bg-surface);
  border: 1px solid rgba(132, 204, 22, 0.08);
}

#equity-chart {
  display: block;
  width: 100%;
  height: 320px;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(13, 18, 14, 0.5);
}

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

.stat-card {
  padding: 18px;
}

.stat-value {
  display: block;
  margin-top: 10px;
  font-size: clamp(1.45rem, 2vw, 2rem);
  line-height: 1.1;
}

.positive {
  color: var(--emerald);
}

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

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

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid rgba(132, 204, 22, 0.08);
  background: var(--bg-surface);
}

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

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(132, 204, 22, 0.08);
  text-align: left;
  vertical-align: top;
}

thead th {
  position: sticky;
  top: 0;
  background: rgba(32, 44, 36, 0.98);
  color: var(--muted-strong);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

tbody tr:hover {
  background: rgba(132, 204, 22, 0.04);
}

.side-buy {
  color: var(--emerald);
  font-weight: 700;
}

.side-sell {
  color: var(--red);
  font-weight: 700;
}

.bias-bullish {
  color: var(--emerald);
  font-weight: 700;
}

.bias-bearish {
  color: var(--red);
  font-weight: 700;
}

.bias-neutral {
  color: var(--muted-strong);
}

.reasoning-cell {
  min-width: 280px;
  max-width: 520px;
  white-space: normal;
  word-break: break-word;
  line-height: 1.45;
}

.empty-row td {
  color: var(--muted);
  text-align: center;
  padding: 20px 14px;
}

@media (max-width: 960px) {
  .page-header,
  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .caption {
    text-align: left;
  }

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

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

@media (max-width: 640px) {
  body {
    padding: 14px;
  }

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

  .chart-wrap {
    min-height: 260px;
  }

  #equity-chart {
    height: 260px;
  }

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