:root {
  color-scheme: dark;
  --bg: #08090d;
  --panel: #11141c;
  --panel-2: #151923;
  --line: #272b35;
  --line-soft: #1d222c;
  --text: #eef1f6;
  --muted: #8d95a7;
  --amber: #ff9f1c;
  --yellow: #ffd166;
  --green: #37d99e;
  --red: #ff526b;
  --cyan: #4cc9f0;
  --violet: #7c5cff;
  --font-mono: "SFMono-Regular", "Roboto Mono", "Cascadia Mono", monospace;
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
}

button,
input {
  font: inherit;
}

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

.rail {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  height: 100vh;
  padding: 18px 10px;
  border-right: 1px solid var(--line);
  background: #0b0d12;
}

.rail-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid #3a2a15;
  color: var(--amber);
  font-family: var(--font-mono);
  font-weight: 800;
  letter-spacing: 0;
}

.rail-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

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

.terminal {
  width: min(1440px, 100%);
  padding: 28px clamp(16px, 2.4vw, 34px) 48px;
}

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

.masthead {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: clamp(34px, 5vw, 64px);
  line-height: .95;
  text-transform: uppercase;
}

h2 {
  font-size: 18px;
}

.controls {
  display: flex;
  align-items: end;
  gap: 10px;
}

.proxy-control {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
}

.proxy-control input,
.search {
  min-width: min(360px, 44vw);
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

.proxy-control input:focus,
.search:focus {
  border-color: var(--violet);
}

.primary-button {
  height: 42px;
  border: 1px solid #75470c;
  border-radius: 4px;
  background: #1f1508;
  color: var(--amber);
  padding: 0 18px;
  font-family: var(--font-mono);
  font-weight: 800;
  text-transform: uppercase;
  cursor: pointer;
}

.metric-grid,
.pulse-strip {
  display: grid;
  border: 1px solid var(--line);
  background: #0d0f14;
}

.metric-grid {
  grid-template-columns: repeat(8, minmax(120px, 1fr));
}

.metric {
  min-height: 92px;
  padding: 16px;
  border-right: 1px solid var(--line-soft);
}

.metric:last-child {
  border-right: 0;
}

.metric span,
.pulse-strip span {
  display: block;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 22px;
}

.metric small {
  color: var(--muted);
  font-family: var(--font-mono);
}

.good strong,
.good {
  color: var(--green);
}

.bad strong,
.bad {
  color: var(--red);
}

.warn strong,
.accent {
  color: var(--yellow);
}

.info {
  color: var(--cyan);
}

.pulse-strip {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  margin: 20px 0 30px;
}

.pulse-strip div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  padding: 0 16px;
  border-right: 1px solid var(--line-soft);
  font-family: var(--font-mono);
}

.pulse-strip div:last-child {
  border-right: 0;
}

.workspace,
.decision-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, .75fr);
  gap: 18px;
}

.decision-grid {
  margin-top: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
  min-width: 0;
}

.status-pill,
.decision,
.badge {
  border: 1px solid rgba(76, 201, 240, .28);
  border-radius: 4px;
  background: rgba(76, 201, 240, .08);
  color: var(--cyan);
  padding: 6px 9px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.alert-list,
.positions-list,
.universe-list,
.catalyst-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.alert-row,
.position-row,
.universe-row,
.catalyst-row {
  display: grid;
  gap: 12px;
  align-items: center;
  min-height: 54px;
  border: 1px solid var(--line-soft);
  border-left: 4px solid var(--cyan);
  border-radius: 4px;
  background: #0f1219;
  padding: 12px 14px;
}

.alert-row {
  grid-template-columns: 74px 116px 70px minmax(0, 1fr);
  font-family: var(--font-mono);
}

.alert-row.high {
  border-left-color: var(--red);
  background: rgba(255, 82, 107, .06);
}

.alert-row.info-row {
  border-left-color: var(--yellow);
  background: rgba(255, 209, 102, .04);
}

.alert-row span,
.position-meta,
.universe-meta,
.contract-table th,
.contract-table td:first-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.alert-row p,
.position-row p,
.universe-row p,
.catalyst-row p {
  margin: 0;
  color: #d9dde7;
}

.position-row,
.universe-row {
  grid-template-columns: 74px minmax(0, 1fr) auto auto;
}

.ticker {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 900;
}

.position-row h3,
.universe-row h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.price-stack {
  text-align: right;
  font-family: var(--font-mono);
}

.price-stack strong {
  display: block;
}

.segmented {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.segmented button {
  border: 0;
  border-right: 1px solid var(--line);
  background: #0d1017;
  color: var(--muted);
  min-width: 58px;
  height: 34px;
  padding: 0 10px;
  cursor: pointer;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.is-selected {
  background: rgba(124, 92, 255, .16);
  color: #c9c0ff;
}

.contract-table-wrap {
  overflow-x: auto;
  margin-top: 18px;
}

.contract-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-family: var(--font-mono);
}

.contract-table th,
.contract-table td {
  border-bottom: 1px solid var(--line-soft);
  padding: 13px 10px;
  text-align: right;
}

.contract-table th:first-child,
.contract-table td:first-child {
  text-align: left;
}

.contract-table .chosen {
  color: var(--green);
  background: rgba(55, 217, 158, .08);
}

.catalyst-row {
  grid-template-columns: 110px minmax(0, 1fr);
  border-left-color: var(--violet);
}

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

.universe-row[data-status="passed"] {
  opacity: .74;
}

@media (max-width: 1120px) {
  .metric-grid {
    grid-template-columns: repeat(4, minmax(140px, 1fr));
  }

  .metric:nth-child(4) {
    border-right: 0;
  }

  .workspace,
  .decision-grid {
    grid-template-columns: 1fr;
  }
}

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

  .rail {
    position: static;
    flex-direction: row;
    justify-content: space-between;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .masthead,
  .section-heading,
  .controls {
    align-items: stretch;
    flex-direction: column;
  }

  .proxy-control input,
  .search {
    min-width: 100%;
    width: 100%;
  }

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

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

  .position-row,
  .universe-row {
    grid-template-columns: 1fr auto;
  }

  .position-row > div:nth-child(2),
  .universe-row > div:nth-child(2) {
    grid-column: 1 / -1;
  }
}
