:root {
  --bg: #07090b;
  --panel: #10161b;
  --panel2: #151d23;
  --line: #26323a;
  --text: #edf4ef;
  --dim: #8b9b94;
  --green: #28e08b;
  --red: #ff5267;
  --amber: #f3ba4d;
  --cyan: #48c7ff;
  --blue: #7aa7ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
}

.mono {
  font-family: "JetBrains Mono", monospace;
}

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

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  min-height: 56px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: #0b1014;
}

.brand {
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 13px;
}

.top-nav,
.status,
.control-strip,
.market-strip {
  display: flex;
  align-items: center;
}

.top-nav {
  gap: 6px;
  overflow-x: auto;
}

.top-nav a {
  flex: 0 0 auto;
  color: var(--dim);
  text-decoration: none;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
}

.top-nav a:hover,
.top-nav a.active {
  color: var(--text);
  border-color: #3b514b;
  background: #132018;
}

.status {
  gap: 10px;
  font-size: 12px;
}

.sound-toggle,
.control-strip button,
.mini {
  cursor: pointer;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #131b21;
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 800;
  padding: 8px 10px;
}

.sound-toggle {
  border-color: rgba(40, 224, 139, 0.45);
  color: var(--green);
  background: #10251b;
}

.sound-toggle.off {
  border-color: var(--line);
  color: var(--dim);
  background: #121920;
}

.phase-badge {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  text-transform: uppercase;
}

.phase-badge.open {
  color: var(--green);
}

.phase-badge.pre-open {
  color: var(--amber);
}

.phase-badge.replay,
.phase-badge.post {
  color: var(--blue);
}

.control-strip {
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: #0c1115;
}

.ctl .lbl {
  display: block;
  margin-bottom: 4px;
  color: var(--dim);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.ctl input,
.ctl select {
  width: 118px;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #121920;
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
}

.ctl select {
  width: 142px;
}

.control-strip button.primary {
  border-color: rgba(40, 224, 139, 0.55);
  background: #14291f;
  color: var(--green);
}

.stamp {
  margin-left: auto;
  font-size: 11px;
}

.market-strip {
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: #090d10;
  overflow-x: auto;
}

.strip-card {
  min-width: 132px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #10171c;
}

.strip-card span {
  display: block;
  color: var(--dim);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.strip-card b {
  display: block;
  margin-top: 3px;
  font-family: "JetBrains Mono", monospace;
  font-size: 16px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 12px;
  align-items: start;
  padding: 12px 16px 20px;
}

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

.lane-watch {
  grid-column: 1 / -1;
}

.lane,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.lane-head,
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  background: var(--panel2);
}

.lane-head h1,
.panel-head h2 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.05em;
}

.lane-head p,
.panel-head p {
  margin: 4px 0 0;
  color: var(--dim);
  font-size: 11px;
}

.lane-count {
  font-family: "JetBrains Mono", monospace;
  color: var(--dim);
  font-size: 12px;
}

.lane-list {
  max-height: calc(100vh - 245px);
  overflow-y: auto;
  padding: 8px;
}

.watch-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding: 8px;
}

.liq-card {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  background: #0d1318;
  padding: 9px;
  margin-bottom: 8px;
  cursor: pointer;
}

.liq-card:hover,
.liq-card.selected {
  border-color: rgba(72, 199, 255, 0.55);
}

.liq-card.bull {
  border-left-color: var(--green);
}

.liq-card.bear {
  border-left-color: var(--red);
}

.liq-card.forming {
  border-left-color: var(--amber);
}

.liq-card.watch {
  border-left-color: var(--dim);
}

.liq-card header,
.score-line,
.detail-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.liq-card strong {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 15px;
}

.liq-card small {
  display: block;
  margin-top: 2px;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
}

.rank-box {
  min-width: 34px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 6px;
  color: var(--dim);
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
}

.score-line {
  margin-top: 8px;
  align-items: center;
}

.big {
  font-family: "JetBrains Mono", monospace;
  font-size: 26px;
  font-weight: 800;
}

.spark {
  height: 30px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  margin: 8px 0;
}

.spark i {
  flex: 1;
  min-width: 3px;
  border-radius: 2px 2px 0 0;
}

.spark i.up {
  background: var(--cyan);
}

.spark i.down {
  background: var(--red);
}

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

.metric {
  min-width: 0;
  padding: 6px;
  border: 1px solid rgba(38, 50, 58, 0.8);
  border-radius: 6px;
  background: #10171c;
}

.metric em {
  display: block;
  color: var(--dim);
  font-style: normal;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.metric b {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
}

.metric.pos b,
.dir-bull,
.pos {
  color: var(--green);
}

.metric.neg b,
.dir-bear,
.neg {
  color: var(--red);
}

.dir-forming {
  color: var(--amber);
}

.dir-watch {
  color: var(--dim);
}

.band-pill,
.accel-pill {
  display: inline-block;
  padding: 3px 6px;
  border-radius: 5px;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 800;
}

.band-pill.extreme {
  color: #050607;
  background: var(--amber);
}

.band-pill.high,
.band-pill.significant {
  color: #04100a;
  background: var(--green);
}

.band-pill.observe {
  color: var(--dim);
  background: #192229;
}

.accel-pill.building {
  color: var(--green);
  background: rgba(40, 224, 139, 0.12);
}

.accel-pill.peaking {
  color: var(--amber);
  background: rgba(243, 186, 77, 0.12);
}

.accel-pill.reversing {
  color: var(--red);
  background: rgba(255, 82, 103, 0.12);
}

.accel-pill.recovering {
  color: var(--blue);
  background: rgba(122, 167, 255, 0.12);
}

.reason,
.history-line {
  margin-top: 8px;
  color: var(--dim);
  font-size: 10px;
  line-height: 1.5;
  word-break: break-word;
}

.guard {
  margin-bottom: 7px;
  padding: 5px 7px;
  border-radius: 5px;
  background: rgba(243, 186, 77, 0.12);
  color: var(--amber);
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 800;
}

.guard.risk {
  color: var(--red);
  background: rgba(255, 82, 103, 0.12);
}

.watch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 80px 70px 45px;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0d1318;
  color: var(--text);
  cursor: pointer;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  text-align: right;
}

.watch-row span:first-child {
  text-align: left;
}

.watch-row em {
  display: block;
  margin-top: 2px;
  color: var(--dim);
  font-style: normal;
  font-size: 9px;
}

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

.detail-empty,
.empty {
  padding: 16px;
  color: var(--dim);
  font-size: 13px;
}

.detail {
  padding: 13px;
}

.detail-picker {
  display: grid;
  gap: 6px;
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.detail-picker label {
  color: var(--dim);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.detail-picker select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b1116;
  color: var(--text);
  padding: 0 9px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
}

.detail h3 {
  margin: 0;
  font-size: 20px;
}

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

.detail-grid {
  margin-top: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
}

.mini-table th,
.mini-table td {
  padding: 6px 5px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}

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

.alerts {
  max-height: 320px;
  overflow-y: auto;
  padding: 8px;
}

.alert-card {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  background: #0d1318;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.alert-card.bull {
  border-left-color: var(--green);
}

.alert-card.bear {
  border-left-color: var(--red);
}

.alert-card.forming {
  border-left-color: var(--amber);
}

.alert-card span,
.alert-card em,
.alert-card small {
  display: block;
}

.alert-card em {
  margin-top: 3px;
  color: var(--dim);
  font-style: normal;
}

.alert-card small {
  margin-top: 4px;
  color: var(--dim);
  font-family: "JetBrains Mono", monospace;
}

.toast {
  position: fixed;
  top: 68px;
  right: 16px;
  z-index: 100;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid rgba(40, 224, 139, 0.45);
  background: #101a16;
  font-weight: 700;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

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

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr;
    height: auto;
    padding: 10px 12px;
  }

  .lanes,
  .watch-list {
    grid-template-columns: 1fr;
  }

  .lane-watch {
    grid-column: auto;
  }
}
