@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&family=Saira+Condensed:wght@600;700&display=swap");

:root {
  color-scheme: dark;
  --bg: #000000;
  --pan: #070707;
  --panhead: #141008;
  --line: #2b2b2b;
  --amber: #ff9e1b;
  --orange: #ff6a00;
  --amber-dim: #b87814;
  --ink: #e8e8e8;
  --dim: #7c8492;
  --up: #23e07a;
  --down: #ff3b46;
  --cy: #3aa6ff;

  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --cond: "Saira Condensed", "IBM Plex Mono", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

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

b {
  font-weight: 700;
}

/* ---- GRID SHELL ---- */
.terminal {
  display: grid;
  grid-template-rows: auto auto auto auto 1fr auto auto;
  height: 100vh;
  min-height: 0;
  border-bottom: 1px solid var(--line);
}

/* ---- 1. COMMAND BAR ---- */
.cmdbar {
  display: flex;
  align-items: stretch;
  height: 38px;
  border-bottom: 1px solid var(--line);
  background: var(--pan);
}

.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  background: var(--amber);
  color: #000;
  font-family: var(--cond);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand-go {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  opacity: 0.7;
}

.cmd {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0 14px;
  border-left: 1px solid var(--line);
}

.cmd-prompt {
  color: var(--amber);
  font-weight: 700;
  letter-spacing: 0.1em;
}

.cmd-input {
  flex: 1;
  min-width: 0;
  height: 24px;
  padding: 0 6px;
  border: 1px solid var(--line);
  background: #000;
  color: var(--amber);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.cmd-input::placeholder {
  color: #4a4a4a;
  letter-spacing: 0.04em;
}

.cmd-input:focus {
  outline: none;
  border-color: var(--amber);
}

.cmd-go {
  height: 24px;
  padding: 0 12px;
  border: none;
  background: var(--orange);
  color: #000;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.cmd-go:hover {
  background: var(--amber);
}

.cmd-clock {
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-left: 1px solid var(--line);
  color: var(--up);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: 0.12em;
}

/* ---- 2. INTRO BAND ---- */
.intro {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--pan);
}

.intro-tag {
  flex: none;
  padding: 3px 8px;
  background: var(--amber);
  color: #000;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.intro-text {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: var(--ink);
}

.legend {
  display: flex;
  flex: none;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--dim);
  font-weight: 600;
  letter-spacing: 0.06em;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-live {
  background: var(--up);
}

.dot-wip {
  background: var(--amber);
}

.dot-halt {
  background: var(--down);
}

/* ---- 3. FUNCTION MENU ---- */
.fnmenu {
  display: flex;
  gap: 22px;
  padding: 5px 16px;
  border-bottom: 1px solid var(--line);
  background: #000;
  color: var(--ink);
  letter-spacing: 0.08em;
  overflow-x: auto;
}

.fn {
  flex: none;
  white-space: nowrap;
}

.fn b {
  color: var(--orange);
}

/* ---- 4. MONITOR STRIP ---- */
.monitor {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-bottom: 1px solid var(--line);
  background: var(--pan);
}

.mon {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 16px;
  border-left: 1px solid var(--line);
}

.mon:first-child {
  border-left: none;
}

.mon-label {
  color: var(--dim);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.mon-value {
  font-family: var(--cond);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}

/* ---- 5. MAIN MOSAIC ---- */
.mosaic {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.col {
  display: grid;
  min-height: 0;
  overflow: hidden;
}

.col-left {
  grid-template-rows: minmax(0, 1.6fr) minmax(0, 1fr);
  border-right: 1px solid var(--line);
}

.col-right {
  grid-template-rows: minmax(0, 1.5fr) minmax(0, 0.8fr) minmax(0, 0.9fr);
}

.panel {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
  border-bottom: 1px solid var(--line);
  background: var(--pan);
}

.col-left .panel:last-child,
.col-right .panel:last-child {
  border-bottom: none;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 12px;
  border-bottom: 1px solid var(--amber-dim);
  background: var(--panhead);
  color: var(--amber);
  font-weight: 700;
  letter-spacing: 0.1em;
}

.panel-head-dim {
  color: var(--dim);
  font-weight: 500;
  letter-spacing: 0.06em;
}

.panel-body {
  min-height: 0;
  padding: 10px 12px;
  overflow: auto;
}

.panel-body-flush {
  padding: 0;
}

/* ---- WATCHLIST TABLE ---- */
.watch {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.watch thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 6px 10px;
  background: #000;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: left;
  white-space: nowrap;
}

.watch tbody td {
  padding: 5px 10px;
  border-bottom: 1px solid #161616;
  white-space: nowrap;
}

.watch tbody tr {
  cursor: pointer;
}

.watch tbody tr:hover {
  background: #120d04;
}

.ta-r {
  text-align: right;
}

.ta-c {
  text-align: center;
}

.ta-l {
  text-align: left;
}

.w-sym {
  color: var(--amber);
  font-weight: 700;
  letter-spacing: 0.04em;
}

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

.w-tokens {
  text-align: right;
  font-weight: 600;
}

.w-chg {
  text-align: right;
  font-weight: 600;
}

.chg-up {
  color: var(--up);
}

.chg-down {
  color: var(--down);
}

.w-status {
  font-weight: 700;
  letter-spacing: 0.06em;
}

.st-live {
  color: var(--up);
}

.st-wip {
  color: var(--amber);
}

.st-halt {
  color: var(--down);
}

.w-spark {
  display: block;
  margin: 0 auto;
}

/* Signature reverse-video selected row */
.watch tbody tr.is-selected {
  background: var(--amber);
}

.watch tbody tr.is-selected td {
  color: #000;
  border-bottom-color: var(--amber);
}

.watch tbody tr.is-selected .w-sym,
.watch tbody tr.is-selected .w-name,
.watch tbody tr.is-selected .w-status,
.watch tbody tr.is-selected .chg-up,
.watch tbody tr.is-selected .chg-down {
  color: #000;
}

/* ---- COMMIT BLOTTER ---- */
.blotter,
.news {
  margin: 0;
  padding: 0;
  list-style: none;
}

.blotter li {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 10px;
  align-items: baseline;
  padding: 4px 0;
  border-bottom: 1px solid #161616;
  white-space: nowrap;
}

.blot-time {
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

.blot-sym {
  color: var(--amber);
  font-weight: 700;
}

.blot-msg {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}

.blot-hash {
  color: var(--cy);
}

/* ---- DES PANEL ---- */
.des-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}

.des-symbol {
  font-family: var(--cond);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--amber);
}

.des-name {
  color: var(--dim);
  letter-spacing: 0.04em;
}

.des-price {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}

.des-price-val {
  font-family: var(--cond);
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
}

.des-price-chg {
  font-weight: 600;
}

.des-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  margin-bottom: 12px;
  background: var(--line);
  border: 1px solid var(--line);
}

.des-cell {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 9px;
  background: var(--pan);
}

.des-cell .k {
  color: var(--dim);
  letter-spacing: 0.06em;
}

.des-cell .v {
  color: var(--ink);
  font-weight: 600;
  text-align: right;
}

.des-desc {
  margin: 0;
  color: var(--ink);
  line-height: 1.5;
}

.open-btn {
  padding: 2px 10px;
  background: var(--orange);
  color: #000;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.open-btn:hover {
  background: var(--amber);
}

.open-btn.is-disabled {
  background: #2b2b2b;
  color: var(--dim);
  cursor: not-allowed;
}

/* ---- GP CHART ---- */
.gp-chart {
  width: 100%;
  height: 100%;
}

.gp-chart svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---- NEWS ---- */
.news li {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 5px 0;
  border-bottom: 1px solid #161616;
}

.news-time {
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

.news-tag {
  color: var(--orange);
  font-weight: 700;
}

.news-head {
  color: var(--ink);
}

/* ---- 6. FUNCTION-KEY BAR ---- */
.fnkeys {
  display: flex;
  gap: 18px;
  padding: 4px 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--panhead);
  color: var(--dim);
  letter-spacing: 0.06em;
  overflow: hidden;
}

.fnkeys b {
  color: var(--amber);
}

.fnkeys-note {
  margin-left: auto;
  color: var(--down);
  font-weight: 700;
}

/* ---- 7. TICKER TAPE ---- */
.tape {
  overflow: hidden;
  height: 24px;
  background: #000;
  border-top: 1px solid var(--line);
}

.tape-track {
  display: inline-flex;
  align-items: center;
  gap: 26px;
  height: 100%;
  padding-left: 100%;
  white-space: nowrap;
  animation: tape-scroll 60s linear infinite;
}

.tape-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tape-sym {
  color: var(--amber);
  font-weight: 700;
}

@keyframes tape-scroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tape-track {
    animation: none;
    padding-left: 0;
  }
}

/* ---- RESPONSIVE: collapse to one column + scroll ---- */
@media (max-width: 920px) {
  body {
    overflow: auto;
  }

  .terminal {
    height: auto;
    min-height: 100vh;
    grid-template-rows: none;
  }

  .cmdbar {
    flex-wrap: wrap;
    height: auto;
  }

  .cmd {
    order: 3;
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--line);
    padding: 8px 14px;
  }

  .intro {
    flex-wrap: wrap;
  }

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

  .mon:nth-child(odd) {
    border-left: none;
  }

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

  .col-left {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .col-left,
  .col-right {
    grid-template-rows: none;
  }

  .panel {
    grid-template-rows: auto auto;
  }

  .panel-body {
    max-height: 420px;
  }

  .gp-chart {
    min-height: 240px;
  }
}
