/* terminal.css — 2026-07-26
 *
 * The analytics pages read as a wall of small rounded cards with a number in
 * each. That layout answers "what is this metric" one metric at a time; it
 * never answers "how am I doing", because nothing is next to anything else.
 *
 * This layer is ADDITIVE. It defines new `t-` classes and does not modify or
 * override main.css selectors, so every page that does not opt in renders
 * exactly as before.
 *
 * What it borrows from a real terminal:
 *   - DENSITY. Hairline rules instead of gaps; a screen is for scanning, and
 *     whitespace between boxes is the enemy of comparison.
 *   - TABULAR NUMERICS in a monospace face, so digits line up in a column and
 *     the eye can compare magnitudes without reading.
 *   - COLOUR MEANS ONE THING. Green/red are reserved for signed money and R.
 *     Amber is reserved for "attention". Nothing decorative is ever green.
 *   - LABELS ARE SMALL AND QUIET, values are large and loud. The current pages
 *     do the opposite in several places.
 */

:root {
  --t-bg: #06080c;
  --t-panel: #0b0f16;
  --t-panel-2: #0e131c;
  --t-rule: #1b2433;
  --t-rule-soft: #141b26;
  --t-text: #d7e0ec;
  --t-text-dim: #7d8b9e;
  --t-text-faint: #4d5a6b;
  --t-up: #26d07c;
  --t-down: #ff4d5e;
  --t-flat: #64748b;
  --t-amber: #f5a623;
  --t-accent: #4c8dff;
  --t-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', 'Roboto Mono', Menlo, Consolas, monospace;
  --t-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Shell ───────────────────────────────────────────────────────────── */

.t-page {
  background: var(--t-bg);
  color: var(--t-text);
  font-family: var(--t-sans);
  padding: 0 0 48px;
  margin: -16px -16px 0;
}

.t-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--t-rule);
  background: var(--t-panel);
}

.t-head h1 {
  margin: 0;
  font: 700 15px/1 var(--t-sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--t-text);
}

.t-head .t-sub {
  font: 500 11px/1.4 var(--t-sans);
  color: var(--t-text-dim);
}

/* ── The KPI rail ────────────────────────────────────────────────────── */

.t-rail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  border-bottom: 1px solid var(--t-rule);
  background: var(--t-panel);
}

.t-stat {
  padding: 10px 16px 12px;
  border-right: 1px solid var(--t-rule-soft);
  min-width: 0;
}
.t-stat:last-child {
  border-right: 0;
}

.t-stat-k {
  font: 700 9px/1 var(--t-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--t-text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.t-stat-v {
  margin-top: 7px;
  font: 600 21px/1 var(--t-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  color: var(--t-text);
}

.t-stat-n {
  margin-top: 4px;
  font: 500 10px/1.3 var(--t-mono);
  color: var(--t-text-faint);
  font-variant-numeric: tabular-nums;
}

.t-up {
  color: var(--t-up);
}
.t-down {
  color: var(--t-down);
}
.t-flat {
  color: var(--t-flat);
}
.t-amber {
  color: var(--t-amber);
}

/* ── Panels ──────────────────────────────────────────────────────────── */

.t-grid {
  display: grid;
  gap: 1px;
  background: var(--t-rule);
  border-bottom: 1px solid var(--t-rule);
}
.t-grid--1 {
  grid-template-columns: 1fr;
}
.t-grid--2 {
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
}
.t-grid--3 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.t-panel {
  background: var(--t-panel);
  padding: 0 0 12px;
  min-width: 0;
}

.t-panel-h {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--t-rule-soft);
}

.t-panel-t {
  font: 700 10px/1 var(--t-mono);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--t-text-dim);
}

.t-panel-note {
  font: 500 10px/1 var(--t-mono);
  color: var(--t-text-faint);
  font-variant-numeric: tabular-nums;
}

.t-chart {
  width: 100%;
  height: 260px;
}
.t-chart--hero {
  height: 340px;
}
.t-chart--tall {
  height: 320px;
}

/* ── Diagnostics ─────────────────────────────────────────────────────── */

.t-find {
  display: grid;
  grid-template-columns: 3px 1fr auto;
  gap: 0 12px;
  align-items: start;
  padding: 11px 14px 12px;
  border-bottom: 1px solid var(--t-rule-soft);
}
.t-find:last-child {
  border-bottom: 0;
}

.t-find-bar {
  align-self: stretch;
  border-radius: 2px;
  background: var(--t-flat);
}
.t-find--critical .t-find-bar {
  background: var(--t-down);
}
.t-find--warn .t-find-bar {
  background: var(--t-amber);
}
.t-find--good .t-find-bar {
  background: var(--t-up);
}
.t-find--info .t-find-bar {
  background: var(--t-text-faint);
}

.t-find-t {
  font: 650 12.5px/1.35 var(--t-sans);
  color: var(--t-text);
}
.t-find--critical .t-find-t {
  color: #ff8f9a;
}
.t-find--good .t-find-t {
  color: #6fe0a8;
}
.t-find--warn .t-find-t {
  color: #ffc457;
}

.t-find-d {
  margin-top: 5px;
  font: 400 12px/1.55 var(--t-sans);
  color: var(--t-text-dim);
  max-width: 78ch;
}

.t-find-m {
  font: 600 15px/1 var(--t-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--t-text);
}

.t-find-n {
  margin-top: 5px;
  font: 500 9px/1 var(--t-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--t-text-faint);
  text-align: right;
  white-space: nowrap;
}

/* ── Dense tables ────────────────────────────────────────────────────── */

.t-table {
  width: 100%;
  border-collapse: collapse;
  font: 500 11.5px/1 var(--t-mono);
  font-variant-numeric: tabular-nums;
}

.t-table th {
  padding: 7px 14px;
  text-align: right;
  font: 700 9px/1 var(--t-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--t-text-faint);
  border-bottom: 1px solid var(--t-rule);
  white-space: nowrap;
}
.t-table th:first-child,
.t-table td:first-child {
  text-align: left;
}

.t-table td {
  padding: 8px 14px;
  text-align: right;
  border-bottom: 1px solid var(--t-rule-soft);
  color: var(--t-text);
  white-space: nowrap;
}

.t-table tbody tr:hover {
  background: var(--t-panel-2);
}
.t-table td.t-dim {
  color: var(--t-text-faint);
}

/* ── Empty / honest-absence state ────────────────────────────────────── */

.t-empty {
  padding: 26px 16px;
  text-align: center;
  font: 500 11.5px/1.6 var(--t-sans);
  color: var(--t-text-faint);
}
.t-empty strong {
  display: block;
  color: var(--t-text-dim);
  margin-bottom: 4px;
}

/* ── 0.9.5 — dense journal list / trade detail additions (additive) ────── */

/* Horizontal scroll wrapper: a dense table keeps its density on narrow
   screens instead of wrapping into unreadability. */
.t-scroll {
  overflow-x: auto;
}

/* Row that navigates on click. */
.t-table tbody tr.t-rowlink {
  cursor: pointer;
}

/* Small classification pill. Colour stays neutral on purpose: green/red are
   reserved for signed money and R, amber for attention. */
.t-pill {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid var(--t-rule);
  border-radius: 3px;
  font: 600 9.5px/1.4 var(--t-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--t-text-dim);
  white-space: nowrap;
}
.t-pill--accent {
  color: var(--t-accent);
  border-color: rgba(76, 141, 255, 0.35);
}
.t-pill--amber {
  color: var(--t-amber);
  border-color: rgba(245, 166, 35, 0.35);
}

/* Key-value grid for the trade detail page: same density contract as the
   rail, but for labelled fields rather than hero numbers. */
.t-kv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1px;
  background: var(--t-rule-soft);
}
.t-kv-item {
  background: var(--t-panel);
  padding: 8px 14px 9px;
  min-width: 0;
}
.t-kv-k {
  font: 700 9px/1 var(--t-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--t-text-faint);
}
.t-kv-v {
  margin-top: 5px;
  font: 500 12px/1.4 var(--t-mono);
  font-variant-numeric: tabular-nums;
  color: var(--t-text);
  overflow-wrap: anywhere;
}

/* Snapshot pair on the detail page. */
.t-shots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1px;
  background: var(--t-rule);
}
.t-shot {
  background: var(--t-panel);
  padding: 10px 14px 12px;
  min-width: 0;
}
.t-shot-k {
  font: 700 9px/1 var(--t-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--t-text-faint);
  margin-bottom: 8px;
}
.t-shot img {
  max-width: 100%;
  border: 1px solid var(--t-rule);
  border-radius: 2px;
  display: block;
}
.t-shot-trigger {
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  width: 100%;
}
.t-shot-empty {
  padding: 22px 10px;
  text-align: center;
  font: 500 11.5px/1.5 var(--t-sans);
  color: var(--t-text-faint);
  border: 1px dashed var(--t-rule);
  border-radius: 2px;
}
.t-shot-note {
  margin-top: 6px;
  font: 500 10px/1.4 var(--t-sans);
  color: var(--t-amber);
}
.t-shot-meta pre {
  max-height: 180px;
  overflow: auto;
  font: 400 10px/1.5 var(--t-mono);
  color: var(--t-text-dim);
  background: var(--t-panel-2);
  padding: 8px 10px;
  border: 1px solid var(--t-rule-soft);
}

/* Prose blocks (comments / notes / timeline) inside the t-layer. */
.t-prose {
  padding: 10px 14px 12px;
  font: 400 12px/1.6 var(--t-sans);
  color: var(--t-text-dim);
  border-bottom: 1px solid var(--t-rule-soft);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.t-prose:last-child {
  border-bottom: 0;
}
.t-prose-k {
  font: 700 9px/1 var(--t-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--t-text-faint);
  margin-bottom: 5px;
}

/* Inline actions row inside a t-panel header or body. */
.t-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 14px;
}
.t-page a {
  color: var(--t-accent);
  text-decoration: none;
}
.t-page a:hover {
  text-decoration: underline;
}
.t-page .t-btn {
  display: inline-block;
  padding: 5px 12px;
  border: 1px solid var(--t-rule);
  border-radius: 3px;
  background: var(--t-panel-2);
  color: var(--t-text);
  font: 600 11px/1 var(--t-sans);
  cursor: pointer;
}
.t-page .t-btn:hover {
  border-color: var(--t-accent);
  text-decoration: none;
}

/* Empty/absence state inside table cells (distinct from a real zero). */
.t-na {
  color: var(--t-text-faint);
}

@media (max-width: 720px) {
  .t-grid--2,
  .t-grid--3 {
    grid-template-columns: 1fr;
  }
  .t-chart,
  .t-chart--hero,
  .t-chart--tall {
    height: 240px;
  }
}

/* ── 0.9.5 — shared chrome joins the terminal idiom ─────────────────────
   The redesign removed the old card grids but left the SHARED chrome on the
   pre-terminal theme: blue-grey filter bars with blue-bordered inputs, a
   bright green Apply button, blue table-header bands and blue-tinted legacy
   cards on the trade detail page.  Operator review 2026-07-27: those read as
   "cheap squares" next to the terminal layer.  Additive overrides only
   (terminal.css loads after main.css), scoped to: filter forms and the
   buttons inside them, dense tables, and the trade-detail legacy blocks. */

.shared-filter-form,
.filter-bar {
  background: var(--t-panel);
  border-bottom: 1px solid var(--t-rule);
  gap: 6px;
  padding: 8px 14px;
}

.shared-filter-form input,
.shared-filter-form select,
.filter-bar input,
.filter-bar select,
.label-add-form select,
.scenario-edit-select {
  background: var(--t-panel-2);
  color: var(--t-text);
  border: 1px solid var(--t-rule);
  border-radius: 3px;
  padding: 4px 8px;
  font: 500 11px/1.3 var(--t-mono);
}

.shared-filter-form input:focus,
.shared-filter-form select:focus,
.filter-bar input:focus,
.filter-bar select:focus,
.label-add-form select:focus,
.scenario-edit-select:focus {
  outline: none;
  border-color: var(--t-accent);
}

/* The bright green primary was the cheapest-looking element on the page;
   actions go quiet, the submit keeps only an accent tint. */
.shared-filter-form button,
.shared-filter-form .btn-primary,
.shared-filter-form .btn-secondary,
.filter-bar button,
.filter-bar .btn-primary,
.filter-bar .btn-secondary,
.label-add-form .btn-primary {
  background: var(--t-panel-2);
  color: var(--t-text);
  border: 1px solid var(--t-rule);
  border-radius: 3px;
  padding: 5px 12px;
  font: 600 11px/1 var(--t-sans);
  cursor: pointer;
  margin-bottom: 0;
  text-decoration: none;
  display: inline-block;
}

.shared-filter-form button:hover,
.shared-filter-form .btn-primary:hover,
.shared-filter-form .btn-secondary:hover,
.filter-bar button:hover,
.filter-bar .btn-primary:hover,
.filter-bar .btn-secondary:hover,
.label-add-form .btn-primary:hover {
  border-color: var(--t-accent);
  color: var(--t-accent);
  opacity: 1;
}

.shared-filter-form button[type='submit'],
.shared-filter-form .btn-primary,
.filter-bar button[type='submit'],
.filter-bar .btn-primary,
.label-add-form .btn-primary {
  color: var(--t-accent);
  border-color: rgba(76, 141, 255, 0.35);
}

/* Dense tables: kill the blue header band and the blue row striping that
   bled in from the global main.css table rules. */
.t-table th,
.trades-table th {
  background: var(--t-panel);
  color: var(--t-text-faint);
}
.t-table tbody tr:nth-child(even),
.trades-table tbody tr:nth-child(even) {
  background: transparent;
}
.t-table tbody tr:hover,
.trades-table tbody tr:hover {
  background: var(--t-panel-2);
}
.trades-table td {
  border-bottom: 1px solid var(--t-rule-soft);
}

/* Trade detail — the legacy blocks under the new terminal head, re-skinned
   to the same hairline/mono contract.  Markup untouched on purpose: several
   of these blocks are test-pinned, so the change is CSS-only. */
.hero {
  background: transparent;
  border: 0;
  box-shadow: none;
}

.hero-badge,
.scenario-badge {
  display: inline-block;
  padding: 2px 7px;
  background: transparent;
  border: 1px solid var(--t-rule);
  border-radius: 3px;
  font: 600 9.5px/1.4 var(--t-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--t-text-dim);
}

.scenario-display-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1px;
  background: var(--t-rule-soft);
  border: 0;
  border-radius: 0;
  padding: 0;
}
.scenario-display-grid .detail-item {
  background: var(--t-panel);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 8px 14px 9px;
}
.scenario-display-grid .detail-label {
  font: 700 9px/1 var(--t-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--t-text-faint);
  margin-bottom: 5px;
}

.standardized-shots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1px;
  background: var(--t-rule);
  border: 0;
}
.standardized-shot-card {
  background: var(--t-panel);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 10px 14px 12px;
}
.standardized-shot-label {
  font: 700 9px/1 var(--t-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--t-text-faint);
  margin-bottom: 8px;
}
.standardized-shot-empty {
  background: transparent;
  border: 1px dashed var(--t-rule);
  border-radius: 2px;
  color: var(--t-text-faint);
}
.standardized-shot-meta pre {
  background: var(--t-panel-2);
  border: 1px solid var(--t-rule-soft);
  color: var(--t-text-dim);
}

.snapshot-card,
.screenshot-card,
.note-item,
.commentary-block,
.capture-card {
  background: var(--t-panel);
  border: 1px solid var(--t-rule-soft);
  border-radius: 2px;
  box-shadow: none;
}

.premise-row {
  background: var(--t-panel);
  border-bottom: 1px solid var(--t-rule-soft);
}

.snapshot-json {
  background: var(--t-panel-2);
  border: 1px solid var(--t-rule-soft);
  color: var(--t-text-dim);
}
