/* Terminal — dense, glassy-dark. Accent vars are injected by brand.js. */

:root {
  --bg: #07080a;
  --panel: #0c0e11;
  --panel-2: #12151a;
  --line: rgba(255, 255, 255, 0.07);
  --line-soft: rgba(255, 255, 255, 0.045);
  --ink: #eef1ef;
  --ink-dim: #8b949e;
  --accent: #00e5a8;
  --accent-ink: #04110c;
  --accent-soft: rgba(0, 229, 168, 0.14);
  --accent-line: rgba(0, 229, 168, 0.3);
  --long: #0ecb81;
  --short: #f6465d;
  --warn: #f0b90b;
  --font: "Inter", -apple-system, "Segoe UI", sans-serif;
  --mono-font: "IBM Plex Mono", "SF Mono", ui-monospace, Menlo, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 12.5px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.mono { font-family: var(--mono-font); font-variant-numeric: tabular-nums; }
.up { color: var(--long); }
.dn { color: var(--short); }
.warn { color: var(--warn); }
.dim { color: var(--ink-dim); }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input {
  font: inherit; color: var(--ink); background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; width: 100%;
  font-family: var(--mono-font);
  transition: border-color 0.15s, background 0.15s;
}
input::placeholder { color: rgba(139, 148, 158, 0.6); font-family: var(--font); }
input:focus { outline: none; border-color: var(--accent-line); background: rgba(255, 255, 255, 0.06); }

/* ---------- shell ---------- */

.shell { display: grid; grid-template-rows: 48px 1fr; height: 100vh; }

main {
  display: grid;
  grid-template-columns: 1fr 274px 302px;
  grid-template-rows: minmax(0, 1fr) 236px;
  gap: 1px;
  background: var(--line-soft);
  min-height: 0;
}

/* ---------- header ---------- */

header {
  display: flex; align-items: center; gap: 14px;
  padding: 0 16px;
  background: rgba(12, 14, 17, 0.75);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--line);
}

.logo {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 15px; letter-spacing: -0.02em;
  color: var(--ink); text-decoration: none;
}
.logo svg { width: 17px; height: 17px; fill: var(--accent); filter: drop-shadow(0 0 7px rgba(0, 229, 168, 0.55)); }

.badge {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.09em;
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid rgba(240, 185, 11, 0.45); color: var(--warn);
  background: rgba(240, 185, 11, 0.08);
}

.feed-status {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.09em;
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink-dim);
}
.feed-status.live { border-color: rgba(14, 203, 129, 0.45); color: var(--long); background: rgba(14, 203, 129, 0.08); }
.feed-status.sim, .feed-status.reconnecting, .feed-status.connecting {
  border-color: rgba(240, 185, 11, 0.45); color: var(--warn); background: rgba(240, 185, 11, 0.08);
}

.mkt-wrap { position: relative; }
.mkt-btn {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 13px; border-radius: 9px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line);
  font-weight: 650; font-size: 13.5px;
  transition: border-color 0.15s, background 0.15s;
}
.mkt-btn:hover { border-color: rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.07); }
.mkt-btn .car { color: var(--ink-dim); font-size: 8.5px; }

.mkt-dd {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 40;
  width: 330px; padding: 6px;
  background: rgba(18, 21, 26, 0.92);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  display: none;
}
.mkt-dd.open { display: block; }
.mkt-dd input { width: calc(100% - 8px); margin: 4px 4px 6px; background: rgba(255, 255, 255, 0.04); font-size: 12.5px; }
#mkt-list { max-height: 380px; overflow-y: auto; scrollbar-width: thin; }
.mkt-row {
  display: grid; grid-template-columns: 1fr auto 74px; gap: 10px;
  width: 100%; padding: 8px 11px; border-radius: 8px; text-align: left;
  font-size: 12.5px;
}
.mkt-row:hover, .mkt-row.active { background: rgba(255, 255, 255, 0.06); }
.mkt-row span:first-child { font-weight: 600; }
.mkt-row span:last-child { text-align: right; }

.stats { display: flex; align-items: center; gap: 20px; overflow: hidden; }
.stat { display: flex; flex-direction: column; gap: 1px; white-space: nowrap; }
.stat label {
  font-size: 9px; color: var(--ink-dim);
  letter-spacing: 0.07em; text-transform: uppercase; font-weight: 550;
}
.stat .big { font-size: 16px; font-weight: 650; }

header .spacer { flex: 1; }
.acct-mini { display: flex; gap: 18px; }

/* ---------- chart cell ---------- */

.chart-cell { grid-column: 1; grid-row: 1; background: var(--panel); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chart-top { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-bottom: 1px solid var(--line-soft); }
#tf-row { display: flex; gap: 2px; }
#tf-row button {
  padding: 4px 11px; border-radius: 7px; color: var(--ink-dim);
  font-weight: 600; font-size: 11.5px;
  transition: color 0.12s, background 0.12s;
}
#tf-row button:hover { color: var(--ink); }
#tf-row button.active { background: var(--accent-soft); color: var(--accent); }
.chart-body { flex: 1; position: relative; min-height: 0; }
.chart-body #chart { position: absolute; inset: 0; }

/* ---------- order book / tape ---------- */

.book-cell { grid-column: 2; grid-row: 1; background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.book-tabs, .bottom-tabs { display: flex; gap: 2px; padding: 6px 8px; border-bottom: 1px solid var(--line-soft); }
.book-tabs button, .bottom-tabs button {
  padding: 5px 11px; border-radius: 7px; color: var(--ink-dim);
  font-weight: 600; font-size: 11.5px;
  transition: color 0.12s, background 0.12s;
}
.book-tabs button.active, .bottom-tabs button.active { background: var(--accent-soft); color: var(--accent); }

.bk-head, .bk-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 6px; padding: 1.5px 12px; font-size: 11px; }
.bk-head {
  color: var(--ink-dim); padding: 7px 12px 5px;
  font-size: 9px; letter-spacing: 0.07em; text-transform: uppercase; font-weight: 550;
}
.bk-row { position: relative; font-family: var(--mono-font); font-variant-numeric: tabular-nums; }
.bk-row span { position: relative; }
.bk-row span:nth-child(n+3) { text-align: right; color: rgba(238, 241, 239, 0.78); }
.bk-row i { position: absolute; right: 0; top: 0; bottom: 0; opacity: 0.09; border-radius: 2px 0 0 2px; }
.bk-row.bid span:first-child { color: var(--long); }
.bk-row.ask span:first-child { color: var(--short); }
.bk-row.bid i { background: var(--long); }
.bk-row.ask i { background: var(--short); }

#book-pane, #tape-pane { flex: 1; overflow-y: auto; scrollbar-width: thin; }
#book-mid {
  padding: 6px 12px; text-align: center; font-size: 15px; font-weight: 650;
  border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.02);
}

/* ---------- order panel ---------- */

.order-cell {
  grid-column: 3; grid-row: 1 / span 2;
  background: var(--panel);
  display: flex; flex-direction: column; gap: 13px;
  padding: 13px; overflow-y: auto; scrollbar-width: thin;
}

.side-toggle {
  display: grid; grid-template-columns: 1fr 1fr; gap: 3px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line);
  border-radius: 10px; padding: 3px;
}
.side-toggle button {
  padding: 8px; border-radius: 7px; font-weight: 700; font-size: 13px;
  color: var(--ink-dim);
  transition: all 0.15s;
}
.side-toggle button[data-side="long"].active {
  background: var(--long); color: #04150c;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 2px 10px rgba(14, 203, 129, 0.35);
}
.side-toggle button[data-side="short"].active {
  background: var(--short); color: #1b0509;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 2px 10px rgba(246, 70, 93, 0.35);
}

.type-tabs { display: flex; gap: 2px; }
.type-tabs button { padding: 4px 11px; border-radius: 7px; color: var(--ink-dim); font-weight: 600; font-size: 11.5px; }
.type-tabs button.active { background: var(--accent-soft); color: var(--accent); }

.field label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11px; color: var(--ink-dim); margin-bottom: 6px;
}
.pct-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 7px; }
.pct-row button {
  padding: 4.5px; border-radius: 7px; font-size: 11px; font-weight: 550;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); color: var(--ink-dim);
  transition: all 0.12s;
}
.pct-row button:hover { color: var(--ink); border-color: rgba(255, 255, 255, 0.18); }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  padding: 0; height: 4px; border: none; border-radius: 2px;
  background: rgba(255, 255, 255, 0.1); accent-color: var(--accent);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%;
  background: var(--accent); cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 229, 168, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.tpsl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.tk-rows { display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.tk-rows div { display: flex; justify-content: space-between; }
.tk-rows dt { color: var(--ink-dim); }
.tk-rows dd { font-family: var(--mono-font); }

#ord-btn {
  padding: 12px; border-radius: 10px;
  font-weight: 750; font-size: 13.5px; letter-spacing: 0.01em;
  transition: transform 0.12s, box-shadow 0.12s, filter 0.12s;
}
#ord-btn.long {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0)), var(--long);
  color: #04150c;
  box-shadow: 0 6px 20px rgba(14, 203, 129, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
#ord-btn.short {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0)), var(--short);
  color: #1b0509;
  box-shadow: 0 6px 20px rgba(246, 70, 93, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
#ord-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
#ord-btn:active { transform: none; }

.acct-box {
  margin-top: auto;
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px;
  background: rgba(255, 255, 255, 0.02);
  display: flex; flex-direction: column; gap: 6px; font-size: 12px;
}
.acct-box div { display: flex; justify-content: space-between; }
.acct-box .hd {
  font-size: 9.5px; color: var(--ink-dim);
  letter-spacing: 0.08em; font-weight: 600; margin-bottom: 2px;
}
#reset-acct { color: var(--ink-dim); font-size: 11px; text-decoration: underline; text-align: right; }
#reset-acct:hover { color: var(--short); }

/* ---------- bottom panel ---------- */

.bottom-cell { grid-column: 1 / span 2; grid-row: 2; background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.bottom-tabs em { font-style: normal; color: var(--accent); margin-left: 3px; }
#bottom-body { flex: 1; overflow: auto; scrollbar-width: thin; }
#bottom-body table { width: 100%; border-collapse: collapse; font-size: 12px; }
#bottom-body th {
  text-align: left; font-size: 9.5px; letter-spacing: 0.07em; text-transform: uppercase;
  font-weight: 550; color: var(--ink-dim);
  padding: 8px 14px; position: sticky; top: 0; background: var(--panel); z-index: 1;
}
#bottom-body td { padding: 7px 14px; border-top: 1px solid var(--line-soft); white-space: nowrap; }
#bottom-body tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.empty { display: grid; place-items: center; height: 100%; color: var(--ink-dim); }
button.mini {
  padding: 4px 13px; border-radius: 999px; font-size: 11px; font-weight: 600;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line);
  transition: all 0.12s;
}
button.mini:hover { border-color: var(--accent-line); color: var(--accent); }

/* ---------- toasts ---------- */

#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 11px 15px; border-radius: 11px; font-weight: 600; font-size: 12.5px;
  background: rgba(18, 21, 26, 0.92);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--accent-line); border-left: 3px solid var(--accent);
  opacity: 0; transform: translateY(6px); transition: all 0.25s ease;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.toast.err { border-color: rgba(246, 70, 93, 0.5); border-left-color: var(--short); }
.toast.show { opacity: 1; transform: none; }

/* narrow screens: hide secondary stats rather than wrap */
@media (max-width: 1180px) {
  .stat.opt { display: none; }
}
