/* Voltera terminal. Inherits the design tokens in app.css. */

body.terminal { overflow: hidden; height: 100vh; background: transparent; }

.term {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) 332px;
  grid-template-rows: 54px minmax(0, 1fr);
  grid-template-areas: "top top top" "rail main ticket";
  height: 100vh;
}

/* ------------------------------------------------------------------- top -- */
.top {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 16px;
  border-bottom: 1px solid var(--iron);
  background: var(--glass-head);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.top .brand { font-size: 19px; }
.top-div { width: 1px; height: 20px; background: var(--steel); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.stat { display: flex; flex-direction: column; gap: 1px; line-height: 1.2; }
.stat .k { font-size: 9.5px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--steel); }
.stat .v {
  font-size: 13px;
  color: var(--bone);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  letter-spacing: -0.018em;
}
.stat .v.pos { color: var(--pos); }
.stat .v.neg { color: var(--neg); }
.stat .v.dim { color: var(--steel); }

/* ------------------------------------------------------------------ rail -- */
.rail {
  grid-area: rail;
  border-right: 1px solid var(--iron);
  overflow-y: auto;
  background: var(--glass-1);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.rail-head {
  position: sticky; top: 0; z-index: 2;
  padding: 12px 16px 9px;
  background: var(--glass-head);
  border-bottom: 1px solid var(--iron);
  font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--steel);
}
.mkt {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  align-items: center;
  padding: 11px 16px;
  border-bottom: 1px solid var(--iron);
  border-left: 2px solid transparent;
  cursor: pointer;
  transition: background 0.14s ease;
}
.mkt:hover { background: rgba(255,255,255,0.04); }
.mkt.on { background: var(--glass-3); border-left-color: var(--ember); }
.mkt .sym { font-size: 13.5px; font-weight: 500; color: var(--bone); letter-spacing: -0.015em; }
.mkt .sub { grid-column: 1; font-size: 10.5px; color: var(--steel); }
.mkt .lvl {
  font-size: 14px; text-align: right; letter-spacing: -0.028em;
  font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1;
}
.mkt .chg {
  grid-column: 2; text-align: right; font-size: 10.5px;
  font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1;
}
.mkt.dead .lvl, .mkt.dead .chg { color: var(--steel); font-size: 10.5px; }

/* ------------------------------------------------------------------ main -- */
.main {
  grid-area: main;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: var(--glass-1);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.mkt-head {
  display: flex; align-items: center; gap: 22px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--iron);
  flex-wrap: wrap;
}
.mkt-title { display: flex; flex-direction: column; gap: 2px; }
.mkt-title h1 { font-family: var(--display); font-size: 26px; letter-spacing: -0.03em; line-height: 1.1; }
.mkt-title span { font-size: 11.5px; color: var(--steel); }
.big {
  font-size: 34px;
  font-weight: 300;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

.chart-wrap { flex: 1; min-height: 0; position: relative; padding: 6px 8px 0; }
#chart { position: absolute; inset: 6px 8px 0; }
.chart-note {
  position: absolute; left: 20px; top: 14px; z-index: 3;
  font-size: 10.5px; color: var(--steel);
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(6px);
  padding: 3px 8px;
  border-radius: var(--r-sharp);
  pointer-events: none;
  max-width: calc(100% - 120px);
}

.pos-panel { border-top: 1px solid var(--iron); background: rgba(0,0,0,0.3); max-height: 244px; display: flex; flex-direction: column; }
.pos-tabs { display: flex; align-items: center; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--iron); }
.pos-tabs button {
  height: 38px; padding: 0 10px; border: 0; background: transparent;
  color: var(--ash); font-size: 12.5px; font-family: inherit; cursor: pointer;
  border-bottom: 1.5px solid transparent;
}
.pos-tabs button.on { color: var(--bone); border-bottom-color: var(--ember); }
.pos-tabs .acct { margin-left: auto; display: flex; gap: 20px; font-size: 11.5px; color: var(--steel); }
.pos-tabs .acct b {
  font-weight: 500; margin-left: 6px;
  font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1;
}
/* default only, so a .pos / .neg class on the same element still wins */
.pos-tabs .acct b:not(.pos):not(.neg) { color: var(--bone); }

.pos-scroll { overflow: auto; flex: 1; }
table.pos { width: 100%; border-collapse: collapse; min-width: 900px; }
table.pos th {
  position: sticky; top: 0; z-index: 1;
  background: var(--glass-head);
  text-align: right; padding: 9px 14px;
  font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--steel); border-bottom: 1px solid var(--iron); white-space: nowrap;
}
table.pos td {
  text-align: right; padding: 11px 14px; font-size: 12.5px;
  border-bottom: 1px solid var(--iron); white-space: nowrap;
  color: var(--silver);
  font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1;
}
table.pos th:first-child, table.pos td:first-child { text-align: left; padding-left: 20px; }
table.pos td:first-child { color: var(--bone); font-weight: 500; }
table.pos th:last-child, table.pos td:last-child { padding-right: 20px; }
/* Semantic colour must beat the cell default, which is more specific than a
   bare utility class. Stated explicitly rather than left to cascade luck. */
table.pos td.pos { color: var(--pos); }
table.pos td.neg { color: var(--neg); }
table.pos td.dim { color: var(--steel); }
.side {
  font-size: 10px; font-weight: 500; letter-spacing: 0.09em;
  padding: 2px 8px; border-radius: var(--r-pill); border: 1px solid currentColor;
}
.side.long { color: var(--ember); }
.side.short { color: var(--silver); }
.empty { padding: 44px 0; text-align: center; color: var(--steel); font-size: 12.5px; }

/* ---------------------------------------------------------------- ticket -- */
.ticket {
  grid-area: ticket;
  border-left: 1px solid var(--iron);
  background: var(--glass-1);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  overflow-y: auto;
  padding: 16px;
}

.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }
.sides button {
  height: 44px;
  border-radius: var(--r-sharp);
  border: 1px solid var(--iron);
  background: var(--glass-2);
  color: var(--ash);
  font-family: inherit; font-size: 13.5px; font-weight: 500;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  transition: all 0.16s ease;
}
.sides button small { font-size: 9px; font-weight: 400; letter-spacing: 0.08em; opacity: 0.66; }
.sides button.on.long { background: rgba(204, 145, 102, 0.12); border-color: var(--ember); color: var(--ember); }
.sides button.on.short { background: var(--glass-3); border-color: var(--silver); color: var(--bone); }

.field { margin-bottom: 15px; }
.field label {
  display: flex; justify-content: space-between;
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--steel); margin-bottom: 7px;
}
.field label b {
  font-weight: 500; letter-spacing: -0.01em; text-transform: none;
  color: var(--pearl); font-size: 11.5px;
  font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1;
}

.input {
  display: flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 13px;
  border: 1px solid var(--iron);
  border-radius: var(--r-sharp);
  background: var(--glass-2);
  transition: border-color 0.16s ease;
}
.input:focus-within { border-color: var(--steel); }
.input input {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--bone);
  font-family: inherit; font-size: 15px; outline: none; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1;
}
.input input::-webkit-outer-spin-button, .input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.input input[type=number] { -moz-appearance: textfield; }
.input .unit { font-size: 11.5px; color: var(--steel); }

.quick { display: flex; gap: 6px; margin-top: 8px; }
.quick button {
  flex: 1; height: 28px;
  border-radius: var(--r-sharp);
  border: 1px solid var(--iron);
  background: transparent; color: var(--ash);
  font-size: 11.5px; font-family: inherit; cursor: pointer;
  font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1;
  transition: all 0.14s ease;
}
.quick button:hover { color: var(--bone); border-color: var(--steel); background: rgba(255,255,255,0.05); }

input[type=range] { width: 100%; -webkit-appearance: none; appearance: none; background: transparent; height: 20px; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 2px; background: var(--iron); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px; border-radius: var(--r-pill);
  background: var(--bone); margin-top: -5px; border: 0;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.6);
}
.lev-marks {
  display: flex; justify-content: space-between; margin-top: -2px;
  font-size: 10px; color: var(--steel);
  font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1;
}

.summary {
  border: 1px solid var(--iron);
  border-radius: var(--r-card);
  background: rgba(0, 0, 0, 0.32);
  padding: 4px 14px;
  margin: 18px 0 15px;
}
.summary .kv { padding: 9px 0; font-size: 12px; }
.summary .kv span:last-child { font-size: 12.5px; }

.submit {
  width: 100%; height: 46px;
  border-radius: var(--r-sharp);
  border: 1px solid var(--paper);
  background: var(--paper); color: var(--obsidian);
  font-family: inherit; font-size: 14.5px; font-weight: 500;
  cursor: pointer;
  transition: background 0.16s ease, opacity 0.16s ease;
}
.submit:hover { background: var(--bone); }
.submit:disabled { opacity: 0.3; cursor: not-allowed; }

.note { font-size: 11px; color: var(--steel); line-height: 1.6; margin-top: 13px; }
.warn { color: var(--ember); }

.term-btn {
  height: 28px; padding: 0 11px;
  border-radius: var(--r-sharp);
  border: 1px solid var(--iron);
  background: var(--glass-2); color: var(--ash);
  font-size: 11.5px; font-family: inherit; cursor: pointer;
  transition: all 0.14s ease;
}
.term-btn:hover { background: var(--glass-3); border-color: var(--steel); color: var(--bone); }
.term-btn.danger:hover { color: var(--neg); border-color: var(--neg); }

@media (max-width: 1180px) { .term { grid-template-columns: 196px minmax(0,1fr) 300px; } }
@media (max-width: 900px) {
  body.terminal { overflow: auto; height: auto; }
  .term { grid-template-columns: 1fr; grid-template-rows: auto; grid-template-areas: "top" "main" "ticket" "rail"; height: auto; }
  .rail { border-right: 0; border-top: 1px solid var(--iron); }
  .ticket { border-left: 0; border-top: 1px solid var(--iron); }
  .chart-wrap { height: 320px; flex: none; }
}

/* the underlying's real mark, alongside the Voltera ticker */
.mkt .sym { display: flex; align-items: center; gap: 9px; }
.mkt .logo { width: 17px; height: 17px; }
.mkt-title h1 { display: flex; align-items: center; gap: 10px; }
.mkt-title h1 .logo { width: 22px; height: 22px; }
.p-mkt { display: inline-flex; align-items: center; gap: 9px; }
.p-mkt .logo { width: 16px; height: 16px; }

/* The index reading, and what it is a reading OF. Hovering the chart swaps the
   number for that session's value, so the label has to say which. */
.level { display: flex; flex-direction: column; gap: 3px; }
.level-label {
  font-size: 9.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--steel);
}
.level-label.is-hover { color: var(--ember); }
.big.is-hover { font-style: italic; }

/* Transaction status. A real trade takes seconds and can fail, so the ticket has
   to say where it is rather than going quiet. */
.tx {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--iron);
  border-radius: var(--r-sharp);
  background: rgba(0, 0, 0, 0.32);
  font-size: 12px;
  line-height: 1.5;
  color: var(--pearl);
}
.tx.pending { border-color: rgba(204, 145, 102, 0.45); color: var(--ember); }
.tx.ok { border-color: rgba(204, 145, 102, 0.45); }
.tx.err { border-color: rgba(184, 96, 79, 0.5); color: var(--neg); }
.tx a { color: var(--ember); border-bottom: 1px solid rgba(204, 145, 102, 0.4); }
.tx-step { display: block; margin-top: 4px; color: var(--steel); font-size: 11px; }

.mode-tag { cursor: help; }
.faucet-btn { width: 100%; margin-top: 8px; }
