/* ==========================================================================
   DOGMA CAPITAL - terminal stylesheet
   One file. No build step, no framework, no CDN. Load it and the desk renders.

   The design is a trading terminal, which means the rules are not decorative:
     - Density over whitespace. A row is 26px because a trader wants forty
       instruments on screen, not eight.
     - Tabular figures everywhere a number appears, so digits line up in a
       column and a change of magnitude is visible without reading the value.
     - Colour carries exactly one meaning: green is up or better, red is down
       or worse, amber is the desk itself. Nothing is coloured for decoration.
     - Every surface is a panel with a labelled header, because a number with
       no stated provenance is a number nobody can act on.
   ========================================================================== */

/* --------------------------------------------------------------- tokens */
:root {
  /* Ground. Four steps of elevation, all cool and near-black - the terminal
     lives in a dark room and the instrument grid is the only bright thing. */
  --bg:            #05070a;
  --bg-sunk:       #030508;
  --panel:         #0a0e15;
  --panel-2:       #0e131c;
  --panel-3:       #131a25;
  --hover:         #172030;

  --line:          #1a2231;
  --line-soft:     #131a26;
  --line-strong:   #27364a;

  /* Ink */
  --text:          #c6d2e2;
  --text-strong:   #eef3fa;
  --muted:         #6d7d93;
  --muted-2:       #4a5769;

  /* Meaning */
  --brand:         #ffb020;   /* DOGMA CAPITAL itself */
  --brand-dim:     #6b4a12;
  --up:            #1fd07d;
  --up-dim:        #0e3f2a;
  --down:          #ff4d5e;
  --down-dim:      #4a1620;
  --info:          #4fc3f7;
  --warn:          #ffb020;
  --violet:        #a78bfa;

  --radius:        3px;
  --radius-lg:     6px;

  --mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular,
          "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;

  --row-h:         26px;
  --header-h:      52px;
  --nav-h:         36px;

  --shadow:        0 8px 32px rgba(0,0,0,.6);
  --shadow-sm:     0 2px 8px rgba(0,0,0,.4);
}

/* ------------------------------------------------------------- baseline */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.dogma-terminal { overflow-x: hidden; }

a { color: var(--info); text-decoration: none; }
a:hover { color: var(--text-strong); text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; color: var(--text-strong); letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
h4 { font-size: 12px; }

p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

code, pre, .mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
code {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1px 5px;
  font-size: 12px;
  color: var(--brand);
}
pre {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.65;
  margin: 0 0 14px;
}
pre code { background: none; border: 0; padding: 0; color: var(--text); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #34455e; }

::selection { background: var(--brand-dim); color: var(--text-strong); }

/* ============================================================== chrome */

.masthead {
  position: sticky;
  top: 0;
  z-index: 200;
  background: linear-gradient(180deg, #0a0e15 0%, #070a10 100%);
  border-bottom: 1px solid var(--line);
}

.masthead-bar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }

.brand-mark {
  width: 30px; height: 30px;
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  display: grid; place-items: center;
  background: linear-gradient(160deg, rgba(255,176,32,.16), transparent);
  color: var(--brand);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -1px;
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .22em;
  color: var(--text-strong);
  white-space: nowrap;
}
.brand-name em { font-style: normal; color: var(--brand); }

.brand-sub {
  font-size: 9px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-top: -2px;
}

/* The live status strip: chain, block, latency, UTC clock. */
.status-strip {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.status-item { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.status-item b { color: var(--text); font-weight: 500; }

.pulse {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--up);
  box-shadow: 0 0 0 0 rgba(31,208,125,.55);
  animation: pulse 2.4s infinite;
  flex-shrink: 0;
}
.pulse.is-down { background: var(--down); animation: none; box-shadow: none; }
.pulse.is-warn { background: var(--warn); }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(31,208,125,.5); }
  70%  { box-shadow: 0 0 0 7px rgba(31,208,125,0); }
  100% { box-shadow: 0 0 0 0 rgba(31,208,125,0); }
}

@media (prefers-reduced-motion: reduce) {
  .pulse { animation: none; }
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* --------------------------------------------------------- navigation */

.nav {
  height: var(--nav-h);
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0 12px;
  border-top: 1px solid var(--line-soft);
  background: var(--bg);
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav a {
  display: flex;
  align-items: center;
  padding: 0 13px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  text-decoration: none;
  transition: color .12s, border-color .12s, background .12s;
}
.nav a:hover { color: var(--text); background: var(--panel); text-decoration: none; }
.nav a.is-active { color: var(--brand); border-bottom-color: var(--brand); }
.nav .nav-sep { width: 1px; background: var(--line-soft); margin: 8px 8px; flex-shrink: 0; }

/* ------------------------------------------------------------- wallet */

.wallet-slot { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.btn-connect {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 14px;
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,176,32,.14), rgba(255,176,32,.06));
  color: var(--brand);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: background .14s, color .14s;
}
.btn-connect:hover { background: var(--brand); color: #100b02; }

.wallet-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 30px;
  padding: 0 6px 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel-2);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text);
}
.wallet-chip:hover { border-color: var(--brand); }
.wallet-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--up); }
.wallet-chip .dot.is-wrong { background: var(--down); }
.wallet-chip .bal { color: var(--muted); }
.wallet-chip .caret { color: var(--muted-2); font-size: 9px; }

.wallet-avatar {
  width: 20px; height: 20px;
  border-radius: 3px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand), var(--violet));
}

/* Account dropdown */
.wallet-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 268px;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 300;
}
.wallet-menu[hidden] { display: none; }
.wallet-menu .wm-head { padding: 10px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.wallet-menu .wm-addr { font-family: var(--mono); font-size: 12px; color: var(--text-strong); word-break: break-all; }
.wallet-menu .wm-meta { font-size: 11px; color: var(--muted); margin-top: 6px; display: flex; justify-content: space-between; }
.wallet-menu a, .wallet-menu button {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  padding: 7px 10px;
  border: 0; background: none;
  border-radius: var(--radius);
  color: var(--text);
  font: inherit; font-size: 12px;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}
.wallet-menu a:hover, .wallet-menu button:hover { background: var(--hover); text-decoration: none; color: var(--text-strong); }
.wallet-menu .wm-danger { color: var(--down); }
.wallet-menu .wm-sep { height: 1px; background: var(--line); margin: 6px 0; }

.wallet-anchor { position: relative; }

/* -------------------------------------------------- wallet picker modal */

.modal-veil {
  position: fixed; inset: 0;
  background: rgba(2,4,7,.78);
  backdrop-filter: blur(3px);
  z-index: 400;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-veil[hidden] { display: none; }

.modal {
  width: 100%;
  max-width: 440px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.modal.is-wide { max-width: 720px; }

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-title {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--brand);
}
.modal-close {
  background: none; border: 0; cursor: pointer;
  color: var(--muted); font-size: 20px; line-height: 1;
  padding: 0 4px;
}
.modal-close:hover { color: var(--text-strong); }
.modal-body { padding: 16px 18px 18px; }

/* One row per detected wallet. */
.wallet-option {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 11px 12px;
  margin-bottom: 7px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font: inherit;
  transition: border-color .12s, background .12s;
}
.wallet-option:hover { border-color: var(--brand); background: var(--panel-3); }
.wallet-option:disabled { opacity: .45; cursor: not-allowed; }
.wallet-option img, .wallet-option .wo-fallback {
  width: 30px; height: 30px;
  border-radius: var(--radius);
  flex-shrink: 0;
  object-fit: contain;
  background: var(--panel-3);
}
.wallet-option .wo-fallback {
  display: grid; place-items: center;
  font-family: var(--mono); font-weight: 700; font-size: 13px;
  color: var(--brand);
}
.wallet-option .wo-name { font-weight: 600; color: var(--text-strong); font-size: 13px; }
.wallet-option .wo-note { font-size: 11px; color: var(--muted); margin-top: 1px; }
.wallet-option .wo-badge {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--up);
  border: 1px solid var(--up-dim);
  background: rgba(31,208,125,.09);
  border-radius: 2px;
  padding: 2px 6px;
  flex-shrink: 0;
}

.wallet-empty {
  text-align: center;
  padding: 26px 10px;
  color: var(--muted);
}
.wallet-empty h3 { margin-bottom: 8px; color: var(--text-strong); }

.wallet-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.wallet-links a {
  display: block; padding: 9px; text-align: center;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel-2); font-size: 12px; color: var(--text);
}
.wallet-links a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }

/* ============================================================== layout */

.shell { padding: 16px; max-width: 1760px; margin: 0 auto; }
.shell.is-wide { max-width: none; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.page-title { display: flex; flex-direction: column; gap: 3px; }
.page-title .eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--brand);
}
.page-title p { color: var(--muted); font-size: 12px; margin: 2px 0 0; max-width: 76ch; }

/* Grids */
.grid { display: grid; gap: 12px; }
.g-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g-5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
.g-6 { grid-template-columns: repeat(6, minmax(0,1fr)); }
.g-main-side { grid-template-columns: minmax(0,1fr) 380px; }
.g-side-main { grid-template-columns: 300px minmax(0,1fr); }

@media (max-width: 1400px) {
  .g-6 { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .g-5 { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 1100px) {
  .g-main-side, .g-side-main { grid-template-columns: minmax(0,1fr); }
  .g-4, .g-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 720px) {
  .g-2, .g-3, .g-4, .g-5, .g-6 { grid-template-columns: minmax(0,1fr); }
  .shell { padding: 12px; }
  .status-strip .status-hide-sm { display: none; }
}

/* =============================================================== panel */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  min-height: 34px;
  flex-shrink: 0;
}
.panel-head h2, .panel-head h3 {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-strong);
}
.panel-head .tag { margin-left: auto; }
.panel-body { padding: 12px; flex: 1; min-width: 0; }
.panel-body.is-flush { padding: 0; }
.panel-foot {
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  background: var(--panel-2);
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ================================================================ tags */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 2px;
  border: 1px solid var(--line-strong);
  background: var(--panel-3);
  color: var(--muted);
  white-space: nowrap;
}
.tag-up      { color: var(--up);    border-color: var(--up-dim);   background: rgba(31,208,125,.08); }
.tag-down    { color: var(--down);  border-color: var(--down-dim); background: rgba(255,77,94,.08); }
.tag-brand   { color: var(--brand); border-color: var(--brand-dim); background: rgba(255,176,32,.09); }
.tag-info    { color: var(--info);  border-color: #14384d;         background: rgba(79,195,247,.08); }
.tag-violet  { color: var(--violet); border-color: #382a5e;        background: rgba(167,139,250,.08); }
.tag-muted   { color: var(--muted-2); }

/* The provenance badge: is this quote exact, or indicative? */
.tag-exact      { color: var(--up);   border-color: var(--up-dim);   background: rgba(31,208,125,.08); }
.tag-indicative { color: var(--warn); border-color: var(--brand-dim); background: rgba(255,176,32,.08); }

/* =============================================================== tables */

.table-wrap { overflow-x: auto; width: 100%; }

table.dt {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
table.dt thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line-strong);
  padding: 7px 10px;
  text-align: right;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  user-select: none;
}
table.dt thead th:first-child,
table.dt tbody td:first-child { text-align: left; }
table.dt thead th.al, table.dt tbody td.al { text-align: left; }
table.dt thead th.ac, table.dt tbody td.ac { text-align: center; }
table.dt thead th.sortable { cursor: pointer; }
table.dt thead th.sortable:hover { color: var(--text); }
table.dt thead th.is-sorted { color: var(--brand); }

table.dt tbody tr { border-bottom: 1px solid var(--line-soft); }
table.dt tbody tr:hover { background: var(--hover); }
table.dt tbody tr.is-selected { background: rgba(255,176,32,.07); }
table.dt tbody td {
  padding: 0 10px;
  height: var(--row-h);
  text-align: right;
  white-space: nowrap;
  color: var(--text);
}
table.dt tbody td.wrap { white-space: normal; }
table.dt.is-roomy tbody td { height: 34px; }

table.dt tbody tr.is-empty td {
  text-align: center;
  color: var(--muted);
  height: 90px;
  font-family: var(--sans);
}

.sym { font-weight: 700; color: var(--text-strong); }
.sym-sub { color: var(--muted); font-weight: 400; font-size: 11px; margin-left: 6px; }

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

/* Price ticks flash when they change - the eye catches motion before value. */
@keyframes tickUp   { from { background: rgba(31,208,125,.22); } to { background: transparent; } }
@keyframes tickDown { from { background: rgba(255,77,94,.22); } to { background: transparent; } }
.tick-up   { animation: tickUp .7s ease-out; }
.tick-down { animation: tickDown .7s ease-out; }

.addr {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.addr a { color: var(--muted); }
.addr a:hover { color: var(--info); }

/* =============================================================== stats */

.stat-row { display: grid; gap: 10px; }

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 13px;
  min-width: 0;
}
.stat .k {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat .v {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-strong);
  line-height: 1.15;
  letter-spacing: -.02em;
}
.stat .v.is-sm { font-size: 15px; }
.stat .d { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* =============================================================== forms */

label.field { display: block; margin-bottom: 12px; }
label.field > span.lbl {
  display: block;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}
label.field > span.hint { display: block; font-size: 11px; color: var(--muted-2); margin-top: 5px; }

input[type=text], input[type=number], input[type=email], input[type=search],
input[type=url], select, textarea {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text-strong);
  font-family: var(--mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  outline: none;
  transition: border-color .12s;
}
textarea { height: auto; min-height: 78px; padding: 9px 10px; line-height: 1.55; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:disabled, select:disabled, textarea:disabled { opacity: .5; cursor: not-allowed; }

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

/* The amount field on a trade ticket: big, so a fat-finger is visible. */
.amount-field {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 8px 10px;
}
.amount-field:focus-within { border-color: var(--brand); }
.amount-field input {
  border: 0; height: auto; padding: 0;
  font-size: 22px; font-weight: 600;
  background: none;
  letter-spacing: -.02em;
}
.amount-field input:focus { border: 0; }
.amount-field .asset {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  color: var(--text-strong);
  flex-shrink: 0;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.chip-row { display: flex; gap: 5px; flex-wrap: wrap; }
.chip {
  padding: 3px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--panel-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  cursor: pointer;
  transition: all .12s;
}
.chip:hover { color: var(--text); border-color: var(--muted-2); }
.chip.is-on { color: var(--brand); border-color: var(--brand); background: rgba(255,176,32,.1); }

/* ============================================================= buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: all .12s;
  text-decoration: none;
}
.btn:hover { border-color: var(--muted-2); color: var(--text-strong); text-decoration: none; }
.btn:disabled, .btn.is-disabled { opacity: .42; cursor: not-allowed; }
.btn:disabled:hover { border-color: var(--line-strong); }

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #100b02;
}
.btn-primary:hover { background: #ffc040; border-color: #ffc040; color: #100b02; }

.btn-buy  { background: var(--up); border-color: var(--up); color: #03150c; }
.btn-buy:hover { background: #35e392; border-color: #35e392; color: #03150c; }
.btn-sell { background: var(--down); border-color: var(--down); color: #1a0509; }
.btn-sell:hover { background: #ff6675; border-color: #ff6675; color: #1a0509; }

.btn-ghost { background: none; }
.btn-danger { color: var(--down); border-color: var(--down-dim); }
.btn-danger:hover { background: var(--down); color: #1a0509; border-color: var(--down); }

.btn-sm { height: 26px; padding: 0 10px; font-size: 10px; }
.btn-lg { height: 42px; padding: 0 22px; font-size: 12px; }
.btn-block { width: 100%; }

.btn-icon {
  width: 28px; height: 28px; padding: 0;
  display: grid; place-items: center;
  font-size: 13px;
}

.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* Segmented switch (buy / sell, chart intervals) */
.seg {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}
.seg button {
  border: 0;
  background: none;
  padding: 0 13px;
  height: 28px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all .12s;
}
.seg button + button { border-left: 1px solid var(--line-soft); }
.seg button:hover { color: var(--text); background: var(--panel-2); }
.seg button.is-on { background: var(--brand); color: #100b02; }
.seg.is-side button.is-on[data-side=buy]  { background: var(--up);   color: #03150c; }
.seg.is-side button.is-on[data-side=sell] { background: var(--down); color: #1a0509; }

/* ============================================================== notices */

.notice {
  display: flex;
  gap: 11px;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-left-width: 3px;
  border-radius: var(--radius);
  background: var(--panel-2);
  font-size: 12px;
  line-height: 1.6;
  margin-bottom: 12px;
}
.notice .ico { flex-shrink: 0; font-size: 14px; line-height: 1.4; }
.notice strong { color: var(--text-strong); }
.notice-info    { border-left-color: var(--info); }
.notice-warn    { border-left-color: var(--warn); }
.notice-danger  { border-left-color: var(--down); }
.notice-success { border-left-color: var(--up); }
.notice-brand   { border-left-color: var(--brand); }

/* Toasts */
.toast-stack {
  position: fixed;
  bottom: 18px; right: 18px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}
.toast {
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--info);
  border-radius: var(--radius);
  padding: 11px 13px;
  box-shadow: var(--shadow);
  font-size: 12px;
  animation: toastIn .22s ease-out;
}
.toast.is-success { border-left-color: var(--up); }
.toast.is-error   { border-left-color: var(--down); }
.toast.is-warn    { border-left-color: var(--warn); }
.toast b { display: block; color: var(--text-strong); margin-bottom: 3px; }
.toast .t-body { color: var(--muted); line-height: 1.55; }
.toast a { font-size: 11px; }

@keyframes toastIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

/* ============================================================= the book */

/* The consolidated ladder. One row per venue, sorted best first, with a depth
   bar behind each row so relative size reads without parsing the number. */
.book-row {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0,1fr) 74px 96px 62px;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 10px;
  font-family: var(--mono);
  font-size: 12px;
  border-bottom: 1px solid var(--line-soft);
  overflow: hidden;
}
.book-row .depth-bar {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  background: rgba(31,208,125,.07);
  z-index: 0;
  transition: width .3s ease;
}
.book-row > * { position: relative; z-index: 1; }
.book-row.is-best { background: rgba(255,176,32,.05); }
.book-row.is-best .rank { color: var(--brand); }
.book-row .rank { color: var(--muted-2); font-size: 10px; }
.book-row .venue { color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-row .venue small { color: var(--muted); margin-left: 6px; }
.book-row .out { text-align: right; color: var(--text-strong); }
.book-row .delta { text-align: right; font-size: 11px; }

/* The route: how the order was cut up. */
.route-bar {
  display: flex;
  height: 26px;
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg);
}
.route-bar .leg {
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: #05070a;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: width .3s ease;
}
.route-bar .leg:nth-child(1) { background: var(--brand); }
.route-bar .leg:nth-child(2) { background: var(--info); }
.route-bar .leg:nth-child(3) { background: var(--violet); }
.route-bar .leg:nth-child(4) { background: var(--up); }

.route-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 9px; font-size: 11px; }
.route-legend .item { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.route-legend .swatch { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }
.route-legend .item:nth-child(1) .swatch { background: var(--brand); }
.route-legend .item:nth-child(2) .swatch { background: var(--info); }
.route-legend .item:nth-child(3) .swatch { background: var(--violet); }
.route-legend .item:nth-child(4) .swatch { background: var(--up); }

/* The quote summary block on the ticket. */
.quote-lines { font-family: var(--mono); font-size: 12px; }
.quote-lines .ql {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line-soft);
}
.quote-lines .ql:last-child { border-bottom: 0; }
.quote-lines .ql .k { color: var(--muted); }
.quote-lines .ql .v { color: var(--text-strong); text-align: right; font-variant-numeric: tabular-nums; }
.quote-lines .ql.is-headline { padding: 9px 0; }
.quote-lines .ql.is-headline .v { font-size: 17px; font-weight: 600; }

/* =============================================================== charts */

.chart {
  width: 100%;
  height: 240px;
  display: block;
}
.chart-tall { height: 340px; }
.chart-mini { height: 44px; }

.chart-empty {
  display: grid;
  place-items: center;
  height: 240px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding: 20px;
}

.spark { width: 84px; height: 22px; vertical-align: middle; }

/* =============================================================== ticker */

/* The tape across the top of the terminal. */
.tape {
  display: flex;
  align-items: center;
  gap: 0;
  height: 30px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
  position: relative;
}
.tape-label {
  flex-shrink: 0;
  padding: 0 11px;
  height: 100%;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: #100b02;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .16em;
}
.tape-track {
  display: flex;
  gap: 26px;
  padding-left: 20px;
  white-space: nowrap;
  animation: tapeScroll 90s linear infinite;
}
.tape:hover .tape-track { animation-play-state: paused; }
@keyframes tapeScroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.tape-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 11px;
}
.tape-item .s { color: var(--text-strong); font-weight: 700; }
.tape-item .p { color: var(--text); }

/* ============================================================== profile */

.profile-head {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px;
  background: linear-gradient(120deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.profile-avatar {
  width: 66px; height: 66px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand), var(--violet));
  flex-shrink: 0;
}
.profile-id { min-width: 0; }
.profile-id .name { font-size: 19px; font-weight: 600; color: var(--text-strong); }
.profile-id .addr { font-size: 12px; margin-top: 3px; word-break: break-all; }
.profile-id .meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 11px; color: var(--muted); }
.profile-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- tabs */

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button, .tabs a {
  padding: 9px 15px;
  border: 0;
  background: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}
.tabs button:hover, .tabs a:hover { color: var(--text); text-decoration: none; }
.tabs button.is-on, .tabs a.is-on { color: var(--brand); border-bottom-color: var(--brand); }

.tab-panel[hidden] { display: none; }

/* ============================================================ marketing */

.hero {
  padding: 76px 20px 60px;
  text-align: center;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(900px 340px at 50% -80px, rgba(255,176,32,.10), transparent 70%),
    var(--bg);
}
.hero .eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 18px;
}
.hero h1 {
  font-size: clamp(30px, 5.4vw, 58px);
  line-height: 1.06;
  letter-spacing: -.035em;
  max-width: 17ch;
  margin: 0 auto 20px;
}
.hero p.lede {
  font-size: 15px;
  color: var(--muted);
  max-width: 62ch;
  margin: 0 auto 30px;
  line-height: 1.7;
}
.hero-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.section { padding: 54px 0; border-bottom: 1px solid var(--line-soft); }
.section-head { margin-bottom: 24px; max-width: 74ch; }
.section-head .eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 8px;
}
.section-head h2 { font-size: 26px; letter-spacing: -.025em; margin-bottom: 10px; }
.section-head p { color: var(--muted); font-size: 14px; line-height: 1.7; }

.feature {
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  height: 100%;
}
.feature .ico { font-size: 20px; margin-bottom: 10px; }
.feature h3 { font-size: 14px; margin-bottom: 7px; }
.feature p { color: var(--muted); font-size: 12.5px; line-height: 1.68; margin: 0; }

/* =============================================================== footer */

.foot {
  border-top: 1px solid var(--line);
  background: var(--panel);
  padding: 30px 16px 22px;
  margin-top: 34px;
}
.foot-grid {
  max-width: 1760px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.6fr repeat(4, 1fr);
  gap: 26px;
}
@media (max-width: 900px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
.foot h4 {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li { margin-bottom: 6px; }
.foot a { color: var(--text); font-size: 12px; }
.foot a:hover { color: var(--brand); }
.foot .blurb { color: var(--muted); font-size: 12px; line-height: 1.7; max-width: 42ch; margin-top: 10px; }
.foot-bar {
  max-width: 1760px;
  margin: 24px auto 0;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--muted-2);
  font-family: var(--mono);
}

/* ============================================================== utility */

.muted     { color: var(--muted); }
.muted-2   { color: var(--muted-2); }
.strong    { color: var(--text-strong); }
.brand     { color: var(--brand); }
.tiny      { font-size: 11px; }
.xs        { font-size: 10px; }
.center    { text-align: center; }
.right     { text-align: right; }
.nowrap    { white-space: nowrap; }
.break     { word-break: break-all; }
.flex      { display: flex; }
.between   { justify-content: space-between; }
.middle    { align-items: center; }
.wrap-f    { flex-wrap: wrap; }
.gap-4     { gap: 4px; }
.gap-6     { gap: 6px; }
.gap-8     { gap: 8px; }
.gap-12    { gap: 12px; }
.gap-16    { gap: 16px; }
.mt-4  { margin-top: 4px; }  .mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-4  { margin-bottom: 4px; }  .mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.grow  { flex: 1; min-width: 0; }
.hidden { display: none !important; }

.skeleton {
  background: linear-gradient(90deg, var(--panel-2) 25%, var(--panel-3) 50%, var(--panel-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 2px;
  color: transparent !important;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.copy-btn {
  background: none; border: 0; padding: 0 3px;
  color: var(--muted-2); cursor: pointer; font-size: 11px;
}
.copy-btn:hover { color: var(--brand); }

kbd {
  font-family: var(--mono);
  font-size: 10px;
  padding: 1px 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 3px;
  background: var(--panel-3);
  color: var(--muted);
}

/* Docs prose */
.prose { max-width: 84ch; font-size: 13.5px; line-height: 1.75; }
.prose h2 { font-size: 20px; margin: 32px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.prose h3 { font-size: 15px; margin: 24px 0 8px; color: var(--brand); }
.prose p { color: var(--text); margin-bottom: 14px; }
.prose ul, .prose ol { color: var(--text); padding-left: 22px; margin-bottom: 14px; }
.prose li { margin-bottom: 6px; }
.prose table.dt { margin-bottom: 18px; }
.prose blockquote {
  border-left: 3px solid var(--brand);
  background: var(--panel-2);
  padding: 11px 15px;
  margin: 0 0 14px;
  color: var(--muted);
}

/* Print: a blotter should print like a statement. */
@media print {
  .masthead, .nav, .foot, .tape, .btn, .toast-stack { display: none !important; }
  body { background: #fff; color: #000; }
  .panel { border-color: #ccc; break-inside: avoid; }
  table.dt tbody td, table.dt thead th { color: #000; }
}
