/* Giro terminal.
   Dark, dense, and alive. Colour means one thing throughout: green is bid /
   gain, red is ask / loss, copper is Giro itself. Nothing decorative is
   coloured, so every colour on screen carries information. */

:root {
  --bg:        #07080a;
  --panel:     #0e1014;
  --panel-2:   #14171d;
  --raised:    #1a1e25;
  --line:      #1e222a;
  --line-soft: #15181e;
  --text:      #e8eaee;   /* 15.8:1 */
  /* Label and hint greys were 5.2:1 and 2.73:1 — the second failed WCAG AA
     outright, and at 9.5px uppercase on a dimmed display neither was
     readable. Both now clear AAA. */
  --dim:       #a3adba;   /*  8.4:1 — field labels */
  --dimmer:    #8a94a3;   /*  6.2:1 — hints and secondary numbers */

  --accent:    #f5a524;   /* Giro */
  --up:        #2ee6a8;   /* bid / gain */
  --down:      #ff5468;   /* ask / loss */
  --up-soft:   rgba(46,230,168,.13);
  --down-soft: rgba(255,84,104,.13);

  --r: 8px;
  color-scheme: dark;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

:root[data-theme="light"] {
  --bg:        #f4f6f8;
  --panel:     #ffffff;
  --panel-2:   #f1f3f6;
  --raised:    #eaedf1;
  --line:      #dde2e8;
  --line-soft: #eef1f4;
  --text:      #12151b;   /* 18.3:1 */
  --dim:       #525c6b;   /*  6.8:1 */
  --dimmer:    #6a7481;   /*  4.7:1 */
  --accent:    #a35c0c;   /*  5.1:1 — copper, darkened for white */
  --up:        #0b7a52;   /*  5.4:1 */
  --down:      #c02a30;   /*  5.8:1 */
  --up-soft:   rgba(11,122,82,.11);
  --down-soft: rgba(192,42,48,.10);
  color-scheme: light;
}
:root[data-theme="light"] .topbar { background: linear-gradient(180deg,#fff,#f7f9fb); }
:root[data-theme="light"] .module { background: #fbfcfd; }
:root[data-theme="light"] .module-bar { background: linear-gradient(180deg,#fff,#f5f7f9); }
:root[data-theme="light"] .btn.primary { color: #fff; }
:root[data-theme="light"] .seg button.neg { color: rgba(192,42,48,.7); }
:root[data-theme="light"] .seg button.pos { color: rgba(11,122,82,.7); }

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
.num, b, .stat-value { font-variant-numeric: tabular-nums; }
.dim { color: var(--dim); } .small { font-size: 11px; }

/* ── top bar ───────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 18px; height: 52px; padding: 0 14px;
  background: linear-gradient(180deg, #101318, var(--panel));
  border-bottom: 1px solid var(--line); position: relative; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: .16em; }
.mascot { width: 24px; height: 24px; border-radius: 6px; display: block; }

.market { display: flex; align-items: center; gap: 6px; }
/* A native <select> cannot be styled below the closed state, so its popup
   always looked like the OS rather than the app. This is the app's own. */
.combo { position: relative; }
.combo-btn {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  background: var(--raised); border: 1px solid var(--line); color: var(--text);
  border-radius: 6px; padding: 7px 10px; font-family: var(--mono); font-size: 12.5px;
  min-width: 118px; justify-content: space-between;
}
.combo.wide .combo-btn { min-width: 132px; }
.combo-btn.strong { font-weight: 700; letter-spacing: .06em; }
.combo-btn:hover { border-color: var(--dimmer); }
.combo-btn[aria-expanded="true"] { border-color: var(--accent); }
.caret {
  width: 0; height: 0; flex: none;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 5px solid var(--dim);
}
.combo-pop {
  position: absolute; top: calc(100% + 5px); left: 0; z-index: 60;
  min-width: 100%; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 14px 34px rgba(0,0,0,.5); overflow: hidden;
}
.combo-pop[hidden] { display: none; }
.combo-search {
  width: 100%; background: var(--bg); border: none;
  border-bottom: 1px solid var(--line); color: var(--text);
  padding: 8px 10px; font-family: var(--mono); font-size: 12px;
}
.combo-search:focus { outline: none; }
.combo-list { max-height: 290px; overflow-y: auto; }
.combo-opt {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 7px 11px; cursor: pointer; font-size: 12.5px; white-space: nowrap;
}
.combo-opt:hover, .combo-opt.active { background: var(--panel-2); }
.combo-opt[aria-selected="true"] { color: var(--accent); }
.combo-opt small { color: var(--dim); font-size: 10.5px; }
.combo-empty { padding: 12px; color: var(--dimmer); font-size: 11.5px; text-align: center; }

.tape { display: flex; align-items: center; gap: 22px; flex: 1; overflow: hidden; }
.tape-item { display: flex; flex-direction: column; gap: 1px; white-space: nowrap; }
.tape-item .tl { font-size: 10px; letter-spacing: .1em; color: var(--dim); }
.tape-item b { font-size: 13px; font-weight: 500; }
.tape-item.price b { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
/* the price flashes the direction it moved */
.tick-up   { color: var(--up); }
.tick-down { color: var(--down); }
@keyframes flashUp   { from { background: var(--up-soft); }   to { background: transparent; } }
@keyframes flashDown { from { background: var(--down-soft); } to { background: transparent; } }
.flash-up   { animation: flashUp .45s ease-out; }
.flash-down { animation: flashDown .45s ease-out; }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dimmer); flex: none; }
.dot.running { background: var(--up); box-shadow: 0 0 0 3px rgba(46,230,168,.16); }
.dot.pulled  { background: var(--accent); box-shadow: 0 0 0 3px rgba(245,165,36,.16); }
.dot.halted, .dot.error, .dot.blocked { background: var(--down); box-shadow: 0 0 0 3px rgba(255,84,104,.16); }
.dot.closing, .dot.flattening { background: var(--accent); box-shadow: 0 0 0 3px rgba(245,165,36,.16); }

/* ── layout: a real terminal grid ──────────────────────────────────────── */
/* Grouped by who owns the data, not by panel type.
   YOUR BOT  — what you configure and what it is doing. This is the product.
   MARKET    — the chart and the book, read from the exchange. Reference.
   Mixing the two across three equal columns made the exchange's data look
   like part of the tool. */
.terminal {
  display: grid; gap: 10px; padding: 10px;
  /* bot setup | activity over performance | market, kept small */
  /* The setup grows with the screen, up to where two controls a row stop
     needing more room; the bot and the market keep theirs. */
  grid-template-columns: clamp(400px, 26vw, 460px) minmax(0, 1fr) 330px;
  height: calc(100vh - 52px); overflow: hidden;
}
.side-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; overflow-y: auto; }
.side-col > .activity-module { flex: none; }
/* The running bot owns the column's first screenful; lifetime history is
   one scroll below it. With history on top, a returning user's session
   table pushed the live figures out of sight. */
.perf-module { flex: 0 0 100%; min-height: 420px; border: none; background: none; }
.module {
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  border: 1px solid var(--line); border-radius: 10px; background: #0b0d11;
  overflow: hidden;
}
.module-bar {
  display: flex; align-items: baseline; gap: 9px; flex: none;
  padding: 8px 12px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #12151b, #0d1014);
}
.module-name {
  font-size: 11px; font-weight: 700; letter-spacing: .15em;
  text-transform: uppercase; color: var(--text);
}
.market-module .module-name { color: var(--dim); }
.module-sub { font-size: 11px; color: var(--dim); letter-spacing: .04em; }
.module-body { flex: 1; min-height: 0; padding: 8px; overflow: hidden; }

/* your bot: setup beside performance */
.app-grid {
  display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr);
  min-height: 0; height: 100%;
}
/* the market: chart over book, both smaller than they were */
.market-grid { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.market-grid .chart-panel { flex: 0 0 190px; min-height: 150px; }
.market-grid .book-panel { flex: 1 1 auto; min-height: 0; }
.col.perf { min-height: 0; }
.col { min-width: 0; display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.centre { overflow: hidden; }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); display: flex; flex-direction: column; min-height: 0;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px; border-bottom: 1px solid var(--line-soft); flex: none;
}
.phead-title {
  font-size: 11px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--dim);
}
.phead-title b { color: var(--text); font-weight: 500; letter-spacing: .04em; margin-left: 6px; }
.reason { color: var(--dim); font-size: 11px; text-align: right; max-width: 62%; }

/* ── order entry ───────────────────────────────────────────────────────── */
.entry {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden;
}
/* Flex rather than a fixed column count: the number of modes has changed
   twice already, and a hardcoded grid leaves a blank cell behind each time. */
.mode-tabs { display: flex; flex: none; }
.mode-tab { flex: 1 1 0; min-width: 0; }
.mode-tab {
  padding: 11px 6px; text-align: center; cursor: pointer; user-select: none;
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em;
  color: var(--dim); background: var(--panel-2);
  border-bottom: 2px solid transparent; border-right: 1px solid var(--line-soft);
  transition: color .12s, background .12s, border-color .12s;
}
.mode-tab:last-child { border-right: none; }
.mode-tab:hover { color: var(--text); }
.mode-tab[aria-pressed="true"] {
  color: var(--accent); background: var(--panel);
  border-bottom-color: var(--accent);
}
.mode-blurb {
  margin: 0; padding: 9px 12px; font-size: 11px; color: var(--dim);
  border-bottom: 1px solid var(--line-soft); flex: none; min-height: 34px;
}
.mode-blurb .badge-cost {
  color: var(--accent); border: 1px solid var(--accent); border-radius: 3px;
  font-size: 8.5px; letter-spacing: .08em; padding: 1px 4px; margin-right: 6px;
}
.entry-body { overflow-y: auto; padding: 14px; flex: 1; min-height: 0; }
/* The column is wide enough for two controls per row, which keeps the whole
   setup on one screen instead of behind a scrollbar. */
/* stretch, not start: a text input and a slider have different natural
   heights, and a row of two cards should read as one row. */
.entry-body .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; align-items: stretch; }
.entry-foot { padding: 10px 12px 12px; border-top: 1px solid var(--line-soft); flex: none; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field { display: block; margin-bottom: 11px; }
.field > span, .range-head > span {
  display: block; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--dim); margin-bottom: 4px;
}
.field em, .range-head em { font-style: normal; color: var(--dimmer); text-transform: none; letter-spacing: 0; }
.field input, .field select {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 5px; padding: 7px 8px;
  font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); }
.hint { display: block; color: var(--dimmer); font-size: 11px; margin-top: 4px; line-height: 1.4; }

/* ── sliders ───────────────────────────────────────────────────────────────
   The track fills up to the thumb, so a glance reads the value without
   reading the number. `--pct` is set from JS on every input. */
.range-field { margin-bottom: 12px; }
.range-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; min-height: 16px;
}
.range-head > span { flex: 1; min-width: 0; margin-bottom: 2px; }
.range-val {
  font-size: 12.5px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.slider-wrap { position: relative; }
.slider {
  --pct: 50%;
  -webkit-appearance: none; appearance: none; width: 100%; height: 20px;
  background: transparent; cursor: pointer; display: block; margin: 4px 0 0;
}
.slider::-webkit-slider-runnable-track {
  height: 4px; border-radius: 3px;
  background: linear-gradient(to right,
    var(--accent) 0 var(--pct), var(--line) var(--pct) 100%);
}
.slider::-moz-range-track {
  height: 4px; border-radius: 3px;
  background: linear-gradient(to right,
    var(--accent) 0 var(--pct), var(--line) var(--pct) 100%);
}
/* a ring, not a dot: it reads against a filled track at any position */
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px; margin-top: -5.5px;
  border-radius: 50%; background: var(--panel);
  border: 2.5px solid var(--accent); box-sizing: border-box;
  transition: transform .1s ease, box-shadow .15s ease;
}
.slider::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%; background: var(--panel);
  border: 2.5px solid var(--accent); box-sizing: border-box;
}
.slider:hover::-webkit-slider-thumb { transform: scale(1.1); }
.slider:active::-webkit-slider-thumb { transform: scale(1.2); }
.slider:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(245,165,36,.22); }

/* risk sliders carry their own meaning */
#stopPct { --tint: var(--down); }
#takePct { --tint: var(--up); }
#stopPct::-webkit-slider-runnable-track, #takePct::-webkit-slider-runnable-track {
  background: linear-gradient(to right, var(--tint) 0 var(--pct), var(--line) var(--pct) 100%);
}
#stopPct::-webkit-slider-thumb, #takePct::-webkit-slider-thumb { border-color: var(--tint); }
#stopPct::-moz-range-thumb, #takePct::-moz-range-thumb { border-color: var(--tint); }

.slider-mark {
  position: absolute; top: 12px; width: 2px; height: 10px;
  background: var(--down); border-radius: 1px; pointer-events: none;
  transform: translateX(-1px); opacity: .85;
}
.slider-mark[hidden] { display: none; }

/* no spinners: the two typed fields are typed, not nudged */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* ── buttons ───────────────────────────────────────────────────────────── */
.btn {
  font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: .08em;
  padding: 7px 13px; border-radius: 5px; border: 1px solid var(--line);
  background: var(--raised); color: var(--text); cursor: pointer;
  transition: border-color .12s, filter .12s;
}
.btn:hover:not(:disabled) { border-color: var(--dimmer); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.big {
  width: 100%; padding: 9px 11px; display: flex; flex-direction: column;
  align-items: center; gap: 1px; line-height: 1.25;
}
/* An author `display` beats the UA's `[hidden] { display: none }`, so a
   flex button ignores the hidden attribute unless this says otherwise. */
.btn.big[hidden], .btn[hidden] { display: none; }
.btn.big b  { font-size: 13px; font-weight: 700; letter-spacing: .14em; }
.btn.big em {
  font-style: normal; font-size: 9.5px; letter-spacing: .04em; opacity: .72;
  font-weight: 400; text-transform: none;
}
/* Mainnet gets its own colour, but not red: red means loss and stop
   everywhere else in this app, and the button that starts your bot is an
   action, not a hazard. Green is the go colour. */
.btn.primary.live {
  background: var(--up); border-color: var(--up); color: #04150f;
}
.btn.primary.live:hover:not(:disabled) { filter: brightness(1.08); }
:root[data-theme="light"] .btn.primary.live { color: #fff; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #17140c; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.danger { background: transparent; border-color: var(--down); color: var(--down); }
.btn.ghost { background: transparent; }
.btn.tiny { padding: 3px 8px; font-size: 10px; }
.btn.icon { padding: 6px 9px; font-size: 14px; line-height: 1; }

/* ── advanced ──────────────────────────────────────────────────────────── */
.adv { border-top: 1px solid var(--line-soft); margin-top: 6px; padding-top: 10px; }
.adv > summary {
  cursor: pointer; list-style: none; user-select: none;
  font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim);
  display: flex; gap: 8px; align-items: baseline;
}
.adv > summary::-webkit-details-marker { display: none; }
.adv > summary::before { content: "+"; color: var(--accent); font-weight: 700; }
.adv[open] > summary::before { content: "−"; }
.adv > summary:hover { color: var(--text); }
.adv > summary .dim { letter-spacing: 0; text-transform: none; font-size: 10px; }
.adv .field, .adv-grid { margin-top: 11px; }

/* ── preview ───────────────────────────────────────────────────────────── */
.preview { border-top: 1px solid var(--line-soft); margin-top: 11px; padding-top: 9px; font-size: 11px; }
.preview-row { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
.preview-row span { color: var(--dim); }
.preview-row b { font-weight: 500; }
.blocker {
  margin-top: 7px; padding: 7px 9px; border-radius: 5px; font-size: 10.5px;
  border: 1px solid var(--down); background: var(--down-soft); color: var(--down);
}
.disclaimer { color: var(--dim); font-size: 11px; line-height: 1.5; margin: 8px 0 0; }
.disclaimer a { color: var(--accent); text-decoration: none; }
.disclaimer a:hover { text-decoration: underline; }

/* ── price chart ───────────────────────────────────────────────────────── */
.chart-tools { display: flex; align-items: center; gap: 12px; font-size: 10px; color: var(--dim); }
.legend { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.legend i { width: 13px; height: 2px; border-radius: 1px; display: inline-block; }
.sw-buy  { background: var(--up); }
.sw-sell { background: var(--down); }
.chart-holder { position: relative; flex: 1; min-height: 0; }
.pricechart { width: 100%; height: 100%; display: block; }
.chart-empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--dimmer); font-size: 11px; pointer-events: none;
}
.chart-empty[hidden] { display: none; }
.px-area { fill: url(#pxfill); }
.px-line { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; }
.px-grid { stroke: var(--line-soft); stroke-width: 1; }
.px-axis { fill: var(--dimmer); font-size: 10px; font-family: var(--mono); }
.q-line { stroke-width: 1; stroke-dasharray: 4 4; opacity: .95; }
.q-buy  { stroke: var(--up); }
.q-sell { stroke: var(--down); }
.q-tag  { font-size: 9px; font-family: var(--mono); }
.q-tag.buy  { fill: var(--up); }
.q-tag.sell { fill: var(--down); }
.px-now { stroke: var(--text); stroke-width: 1; stroke-dasharray: 2 3; opacity: .5; }

/* ── session ───────────────────────────────────────────────────────────── */
/* The figures a user runs the bot for (volume, P&L, fees, cost) are fixed
   size and never give way. The fill tape takes whatever height is left and
   scrolls inside itself. Before, every child could shrink, and `.stats`
   (overflow: hidden) was the one that did: once fills piled up, the second
   row of KPIs was squeezed under the tape and disappeared. */
.perf-module > .col.perf { flex: 1 1 auto; }
.session-panel { flex: 1; min-height: 0; overflow-y: auto; height: 100%; }
.metric-label { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.metric-sub { color: var(--dim); font-size: 10.5px; margin-top: 5px; }
.badge {
  font-size: 8.5px; letter-spacing: .08em; padding: 1px 5px; border-radius: 3px;
  border: 1px solid var(--dimmer); color: var(--dimmer); margin-left: 6px;
}
.budget-bar { height: 5px; background: var(--panel-2); border-radius: 3px; overflow: hidden; margin-top: 9px; }
.budget-fill { height: 100%; width: 0%; background: var(--up); transition: width .4s ease, background .3s; }
.budget-fill.warn { background: var(--accent); }
.budget-fill.over { background: var(--down); }

.halt-banner {
  display: flex; align-items: flex-start; gap: 9px; margin: 12px 12px 0;
  border: 1px solid var(--down); background: var(--down-soft);
  border-radius: 6px; padding: 9px 11px;
}
.halt-banner[hidden] { display: none; }
.halt-banner.ok { border-color: var(--line); background: var(--panel-2); }
.halt-banner.ok .halt-dot { background: var(--dimmer); }
.halt-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--down); margin-top: 6px; flex: none; }
.halt-banner b { display: block; font-size: 11.5px; letter-spacing: .06em; }
.halt-banner span#haltReason { color: var(--dim); font-size: 11px; }


.stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px; background: var(--line-soft); margin: 0 12px;
  border: 1px solid var(--line-soft); border-radius: 6px; overflow: hidden;
}
.stat { background: var(--panel); padding: 8px 9px; }
.stat-label { font-size: 10px; letter-spacing: .09em; text-transform: uppercase; color: var(--dim); }
.stat-value { font-size: 14px; font-weight: 500; margin-top: 2px; white-space: nowrap; }
.stat-value.up { color: var(--up); } .stat-value.down { color: var(--down); }

.fills-wrap { padding: 12px; }
.filltape { flex: 1 1 auto; min-height: 90px; overflow-y: auto; border: 1px solid var(--line-soft); border-radius: 6px; margin-top: 5px; }
.filltape table { width: 100%; border-collapse: collapse; font-size: 11px; }
.filltape td { padding: 3px 9px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.filltape tr:last-child td { border-bottom: none; }
.filltape .buy { color: var(--up); } .filltape .sell { color: var(--down); }
.filltape .num { text-align: right; }
.filltape .taker { color: var(--accent); }
.filltape tr.fresh { animation: flashUp .5s ease-out; }
.tape-empty { padding: 14px; color: var(--dimmer); text-align: center; font-size: 11px; }

/* ── order book ────────────────────────────────────────────────────────── */
.book-panel { flex: 1 1 auto; min-height: 0; }
.book-cols {
  display: grid; grid-template-columns: 1fr auto auto; gap: 10px;
  padding: 5px 12px; font-size: 10px; letter-spacing: .09em; color: var(--dim);
  border-bottom: 1px solid var(--line-soft); flex: none;
}
.book-cols .num { text-align: right; }
.book { flex: 1; overflow-y: auto; min-height: 0; padding: 2px 0; }
.book-row {
  position: relative; display: grid; grid-template-columns: 1fr auto auto; gap: 10px;
  padding: 2px 12px; font-size: 11.5px; font-variant-numeric: tabular-nums;
  cursor: default;
}
/* depth bar: cumulative size, drawn behind the numbers */
.book-row .bar {
  position: absolute; top: 0; bottom: 0; right: 0; opacity: .16; pointer-events: none;
}
.book-row.ask .bar { background: var(--down); }
.book-row.bid .bar { background: var(--up); }
.book-row.ask .bp { color: var(--down); }
.book-row.bid .bp { color: var(--up); }
.book-row .bs, .book-row .bt { color: var(--dim); text-align: right; z-index: 1; }
.book-row .bp { z-index: 1; }
/* your own resting quote, marked inside the book — the layer that matters */
/* your own quote, sitting in the queue where it really is */
.book-row.mine {
  box-shadow: inset 2px 0 0 var(--accent);
  background: rgba(245,165,36,.10);
}
.book-row.mine .bt { color: var(--accent); font-size: 10px; }
/* a preview is where the ticket WOULD rest, not an order: outline only */
.book-row.mine.preview { background: transparent; box-shadow: inset 2px 0 0 var(--dimmer); }
.book-row.mine.preview .bt, .book-row.mine.preview .bp::after { color: var(--dimmer); }
.book-row.mine .bp::after {
  content: "●"; color: var(--accent); font-size: 8px; margin-left: 6px; vertical-align: middle;
}
.book-mid {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 7px 12px; margin: 3px 0; border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft); background: var(--panel-2);
}
.book-mid b { font-size: 14px; }
.book-mid span { font-size: 10px; color: var(--dim); }

/* ── routes ────────────────────────────────────────────────────────────── */
.routes { flex: none; }
.rt { width: 100%; border-collapse: collapse; font-size: 11px; }
.rt th {
  text-align: left; font-size: 10px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--dimmer); font-weight: 500; padding: 6px 12px; border-bottom: 1px solid var(--line-soft);
}
.rt th.num, .rt td.num { text-align: right; }
.rt td { padding: 6px 12px; border-bottom: 1px solid var(--line-soft); }
.rt tr:last-child td { border-bottom: none; }
.rt tr.best td { color: var(--up); }
.rt tr.down td { color: var(--dimmer); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--raised); }
::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ── narrow ────────────────────────────────────────────────────────────── */
@media (max-width: 1240px) {
  .terminal { grid-template-columns: 360px minmax(0,1fr) 290px; }
}
@media (max-width: 1000px) {
  html, body { overflow: auto; }
  .terminal { grid-template-columns: 1fr; height: auto; }
  .app-grid { height: auto; }
  .side-col { overflow: visible; }
  .market-grid .chart-panel { flex: none; height: 220px; }
  .market-grid .book-panel { height: 420px; }
  .module-body { overflow: visible; }
  .stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  /* the page scrolls here, so the tape needs its own ceiling */
  .filltape { max-height: 260px; }
  .session-panel { height: auto; }
  .perf-module { flex: none; min-height: 0; }
}

/* ── segmented controls ────────────────────────────────────────────────────
   Adopted from tread.fi's setup: for a small set of named choices a row of
   buttons beats a dropdown, because every option is readable without a click
   and the selected one is visible at a glance. */
.seg-field { margin-bottom: 13px; }
.seg-label {
  display: block; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--dim); margin-bottom: 5px;
}
.seg {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; padding: 2px;
  border: 1px solid var(--line); border-radius: 7px; background: var(--bg);
}
.seg.three { grid-template-columns: repeat(3, 1fr); }
.seg.two { grid-template-columns: repeat(2, 1fr); }
.seg button {
  font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .06em;
  padding: 6px 4px; background: transparent; color: var(--dim);
  /* Each option is its own rounded chip inside the track, so a selected
     end option is never cut off by the track's rounded corners. */
  border: none; border-radius: 5px; cursor: pointer;
  transition: background .12s, color .12s;
}
.seg button:hover { color: var(--text); background: var(--panel-2); }
.seg button[aria-pressed="true"] {
  background: rgba(245,165,36,.16); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent);
}
.seg button.neg[aria-pressed="true"] {
  background: var(--down-soft); color: var(--down); box-shadow: inset 0 0 0 1px var(--down);
}
.seg button.pos[aria-pressed="true"] {
  background: var(--up-soft); color: var(--up); box-shadow: inset 0 0 0 1px var(--up);
}
/* unselected options still hint at what they mean */
.seg button.neg { color: rgba(255,84,104,.65); }
.seg button.pos { color: rgba(46,230,168,.6); }
.seg button.neg:hover { color: var(--down); }
.seg button.pos:hover { color: var(--up); }
.range-val { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text); }

/* the chart had been eating the screen; the session below it matters more */



/* ── one boundary per setting ──────────────────────────────────────────────
   The form had become a single dense block where nothing separated one
   decision from the next. Each control now sits in its own box, which costs
   a little vertical space and buys a lot of scannability. */
.entry-body .control {
  border: 1px solid var(--line); border-radius: 7px;
  background: var(--panel-2); padding: 9px 11px 10px; margin-bottom: 9px;
}
.entry-body .control:focus-within { border-color: var(--dimmer); }
/* the boxes carry the separation, so the inner margin is no longer needed */
.entry-body .control.range-field { margin-bottom: 9px; }
/* stretch, not start: a text input and a slider have different natural
   heights, and a row of two cards should read as one row. */
.entry-body .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; align-items: stretch; }
.entry-body .pair > .control { margin-bottom: 9px; }
.entry-body .control > span,
.entry-body .control .seg-label { margin-bottom: 6px; }
.entry-body .control .slider { margin-top: 4px; }
/* identical structure means identical height; nothing hangs below a slider */
.entry-body .pair > .control { display: flex; flex-direction: column; justify-content: flex-start; }

/* One packed grid for the whole setup: two controls a row, and no hole where
   this mode hides one (packControls widens a last odd control instead). */
.entry-body .controls { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; align-items: stretch; margin-bottom: 9px; }
.entry-body .controls > .control { margin: 0; display: flex; flex-direction: column; justify-content: flex-start; }
.entry-body .controls > .wide, .entry-body .controls > .span { grid-column: 1 / -1; }
.entry-body .controls > [hidden] { display: none; }
.entry-body .controls .seg-field .seg button { padding: 6px 0; font-size: 10px; letter-spacing: 0; }
/* inputs sit on the page colour so they read as wells inside the box */
.entry-body .control input[type="number"],
.entry-body .control select { background: var(--bg); }

/* the derived dollar figure under a percentage control */
.sub {
  display: block; margin-top: 5px; font-size: 10.5px; color: var(--dim);
  font-variant-numeric: tabular-nums;
}


/* ── agent status ──────────────────────────────────────────────────────────
   The bot cannot place an order without an approved agent, so its state
   belongs next to the button that starts it, not on another screen. */
.agent {
  border: 1px solid var(--line); border-radius: 7px;
  background: var(--panel-2); padding: 8px 10px; margin-bottom: 9px;
}
.agent[hidden] { display: none; }
.agent-row { display: flex; align-items: center; gap: 8px; font-size: 11.5px; }
.agent-row span#agentText { flex: 1; min-width: 0; color: var(--dim); }
.agent-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dimmer); flex: none; }
.agent-dot.ok { background: var(--up); }
.agent-dot.pending { background: var(--accent); }
.agent-dot.none { background: var(--down); }
.agent.ready { border-color: rgba(46,230,168,.35); }


/* ── market picker: best-for-this-mode ─────────────────────────────────────
   Which market to trade is the biggest lever a user has, and it points the
   opposite way for the two modes. So the picker ranks rather than just
   lists, and says what it ranked on. */
.combo-pop.wide { min-width: 400px; }
.combo-tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.combo-tabs button {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em;
  padding: 7px 4px; background: transparent; color: var(--dim);
  border: none; border-bottom: 2px solid transparent; cursor: pointer;
}
.combo-tabs button[aria-pressed="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.combo-tabs button:hover { color: var(--text); }
.combo-opt .mkt-why {
  display: flex; gap: 10px; color: var(--dim); font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.combo-opt .mkt-why b { color: var(--text); font-weight: 500; }
.combo-rank { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.cost-split { display: flex; height: 5px; border-radius: 3px; overflow: hidden; margin: 5px 0 3px; }
.cost-split i { display: block; height: 100%; }
.cost-split .fees { background: var(--up); }
.cost-split .waste { background: var(--down); }

/* `[hidden]` is only a bare attribute selector, so any author rule that sets
   `display` out-specifies it and the element stays on screen. This is the
   second time that has bitten: match the specificity of the rules that set
   display rather than trusting the attribute. */
.entry-body .pair > .control[hidden],
.entry-body .control[hidden],
.adv[hidden], .range-field[hidden], .field[hidden] { display: none; }

/* Keep wallet onboarding reachable on phones. */
@media (max-width: 640px) {
  .topbar { height: auto; min-height: 92px; flex-wrap: wrap; gap: 8px; padding: 10px; }
  .brand { flex: 1; }
  .topbar-right { order: 1; margin-left: auto; gap: 6px; }
  .market { order: 2; width: 100%; }
  .market .combo { flex: 1; min-width: 0; }
  .combo-btn, .combo.wide .combo-btn { min-width: 0; width: 100%; }
  .combo-pop.wide { min-width: 0; width: min(360px, calc(100vw - 20px)); left: auto; right: 0; }
  .topbar .tape { display: none; }
  #stateText { max-width: 65px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .terminal { min-width: 0; }
}

/* ── presets ───────────────────────────────────────────────────────────── */
.preset-block { margin-bottom: 13px; }
.preset-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.preset-head .seg-label { margin: 0; }
.preset-blurb { margin: 6px 0 0; font-size: 10.5px; line-height: 1.45; color: var(--dimmer); min-height: 2.9em; }
.preset-blurb.custom { color: var(--dim); }
.projection {
  margin: -2px 0 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel-2); font-size: 11px;
}
.projection[hidden] { display: none; }
.projection .preview-row b { font-variant-numeric: tabular-nums; }
.projection .warn {
  margin: 6px 0 0; padding: 6px 8px; border-left: 2px solid var(--accent);
  background: var(--raised); color: var(--text); font-size: 10.5px; line-height: 1.45;
}
.projection .fine { margin: 6px 0 0; color: var(--dimmer); font-size: 10px; }

/* ── Volu ──────────────────────────────────────────────────────────────── */
.volu-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 3px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2);
  color: var(--text); font: inherit; font-size: 10.5px; cursor: pointer;
}
.volu-btn img, .volu-head img, .volu-msg img { border-radius: 50%; object-fit: cover; background: #fff; }
.volu-btn:hover, .volu-btn[aria-expanded="true"] { border-color: var(--accent); }
.volu {
  position: fixed; right: 32px; bottom: 124px; z-index: 60;
  width: min(380px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 120px));
  display: flex; flex-direction: column;
  border: 1px solid var(--accent); border-radius: 12px;
  background: var(--panel-2); overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
}
.volu .volu-body { overflow-y: auto; min-height: 0; }
.volu-fab {
  position: fixed; right: 32px; bottom: 32px; z-index: 61;
  width: 80px; height: 80px; padding: 0; border-radius: 50%;
  border: 2px solid var(--accent); background: #fff; cursor: pointer; overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35); transition: transform .15s ease;
}
.volu-fab:hover { transform: scale(1.06); }
.volu-fab[aria-expanded="true"] { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
/* talking: a ring that breathes while his bubble is up */
.volu-fab.talking { animation: volu-talk 1.4s ease-in-out infinite; }
@keyframes volu-talk {
  0%, 100% { box-shadow: 0 8px 24px rgba(0,0,0,.35), 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); }
  50%      { box-shadow: 0 8px 24px rgba(0,0,0,.35), 0 0 0 7px color-mix(in srgb, var(--accent) 0%, transparent); }
}

/* What Volu says when something is pointed at: a speech bubble by his face. */
.volu-say {
  position: fixed; right: 32px; bottom: 124px; z-index: 62;
  width: max-content; max-width: min(300px, calc(100vw - 64px));
  padding: 9px 12px 10px; border: 1px solid var(--accent); border-radius: 12px 12px 4px 12px;
  background: var(--panel-2); color: var(--text); font-size: 11.5px; line-height: 1.5;
  box-shadow: 0 14px 36px rgba(0, 0, 0, .4); pointer-events: none;
  opacity: 0; transform: translateY(6px); transition: opacity .14s ease, transform .14s ease;
}
.volu-say.on { opacity: 1; transform: none; }
.volu-say[hidden] { display: none; }
.volu-say::after {                         /* the tail, pointing down at his face */
  content: ""; position: absolute; right: 30px; bottom: -7px; width: 12px; height: 12px;
  background: var(--panel-2); border-right: 1px solid var(--accent); border-bottom: 1px solid var(--accent);
  transform: rotate(45deg);
}
.volu-say b {
  display: block; margin-bottom: 2px; color: var(--accent);
  font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
}
/* Things Volu can explain carry no mark of their own (a rule under every
   label was clutter); the cursor says it, and Volu says so on a first visit. */
[data-tip] { cursor: help; }
[data-tip] input, [data-tip] select, [data-tip] button, .seg button[data-tip], .mode-tab[data-tip],
.btn[data-tip], summary[data-tip] { cursor: pointer; }
[data-tip] input[type="number"] { cursor: text; }
.module-link { margin-left: auto; font-size: 10.5px; color: var(--dim); text-decoration: none; letter-spacing: .04em; }
.module-link:hover { color: var(--accent); }
.preset-custom { font-style: normal; color: var(--accent); letter-spacing: .06em; text-transform: none; }
.preset-custom[hidden] { display: none; }
.volu-fab video { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; object-position: 50% 30%; display: block; pointer-events: none; }
.volu[hidden] { display: none; }
.volu-head { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.volu-head > div { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.volu-head b { font-size: 12px; }
.volu-head .dim { font-size: 10px; color: var(--dimmer); }
.volu-body { padding: 10px; font-size: 11px; line-height: 1.5; }
.volu-body p { margin: 0 0 8px; }
.volu-body a { color: var(--accent); }
.volu-body textarea, .volu-body input {
  width: 100%; box-sizing: border-box; padding: 7px 8px; border: 1px solid var(--line); border-radius: 5px;
  background: var(--panel); color: var(--text); font: inherit; font-size: 11px; resize: vertical;
}
.volu-body textarea:focus, .volu-body input:focus { outline: none; border-color: var(--accent); }
.volu-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.volu-msg { display: flex; gap: 8px; align-items: flex-start; margin: 9px 0 0; }
.volu-msg > div { flex: 1; padding: 7px 9px; border-radius: 6px; background: var(--raised); }
.volu-msg.error > div { border-left: 2px solid var(--down); }
.volu-msg ul { margin: 5px 0 0; padding-left: 16px; color: var(--dim); }
.volu-foot { margin-top: 9px; font-size: 10px; color: var(--dimmer); display: flex; justify-content: space-between; gap: 8px; }
.volu-foot button { background: none; border: none; padding: 0; color: var(--dimmer); font: inherit; text-decoration: underline; cursor: pointer; }

/* ── activity ──────────────────────────────────────────────────────────── */
.activity-module[hidden] { display: none; }
.activity-body { overflow: visible; }
.act-stats { margin: 4px 4px 10px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.act-platform {
  margin: 0 4px 10px; padding: 8px 10px; border: 1px solid var(--accent); border-radius: 6px;
  font-size: 11px; color: var(--dim); display: flex; flex-wrap: wrap; gap: 6px 16px;
}
.act-platform b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.act-platform .tag { color: var(--accent); letter-spacing: .09em; text-transform: uppercase; font-size: 10px; }
.act-table-wrap { max-height: 280px; overflow: auto; container-type: inline-size; }
/* In a narrow column keep date, market, volume and P&L; drop the rest. */
@container (max-width: 520px) {
  .act-table th:nth-child(3), .act-table td:nth-child(3),
  .act-table th:nth-child(5), .act-table td:nth-child(5) { display: none; }
}
.act-table td { font-variant-numeric: tabular-nums; white-space: nowrap; }
.act-table td.up { color: var(--up); } .act-table td.down { color: var(--down); }
.act-empty { padding: 10px 12px; color: var(--dimmer); font-size: 11px; }
@media (max-width: 720px) {
  .act-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .act-table th:nth-child(3), .act-table td:nth-child(3) { display: none; }
}

/* On a phone the 80px face sat over the form and the tables with nothing
   under it to scroll to. Smaller, and the page ends clear of it. */
@media (max-width: 640px) {
  .volu-fab { width: 56px; height: 56px; right: 16px; bottom: 16px; }
  .volu { right: 12px; bottom: 82px; width: calc(100vw - 24px); max-height: calc(100vh - 100px); }
  .volu-say { right: 16px; bottom: 84px; max-width: calc(100vw - 32px); }
  .terminal { padding-bottom: 80px; }
}

/* the empty platform strip showed through: flex beat [hidden] */
.act-platform[hidden] { display: none; }
.act-open { border-color: var(--line); line-height: 1.8; }
.act-open .down { color: var(--down); } .act-open .up { color: var(--up); }
.stat-sub { margin-top: 3px; font-size: 9.5px; color: var(--dimmer); letter-spacing: .02em; white-space: nowrap; }
.act-claim { align-items: center; }
.act-claim .btn { margin-left: auto; }
.act-claim .down { color: var(--down); flex-basis: 100%; }

/* ── the run card ──────────────────────────────────────────────────────────
   Four numbers a volume farmer acts on, and a sentence saying what the bot is
   doing. Everything a market maker reads beyond that sits in Details. Cost is
   never green: it is money spent. Amber means close to a limit, red past it. */
.run-state { color: var(--dim); font-size: 11px; text-align: right; }
.run-status { margin: 0; padding: 12px 12px 0; font-size: 13px; line-height: 1.5; color: var(--text); }
.run-settings { margin: 5px 12px 0; font-size: 11px; line-height: 1.55; color: var(--dim); }
.run-settings[hidden], .run-body[hidden], .run-bar[hidden] { display: none; }
.run-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px; background: var(--line-soft); margin: 12px;
  border: 1px solid var(--line-soft); border-radius: 6px; overflow: hidden;
}
.run-cell { background: var(--panel); padding: 12px; min-width: 0; }
.run-value { font-size: 26px; font-weight: 700; line-height: 1.1; margin-top: 4px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.run-value.dim { color: var(--dim); }
.run-value.warn { color: var(--accent); }
.run-value.bad { color: var(--down); }
.run-bar { height: 5px; background: var(--panel-2); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.run-bar > i { display: block; height: 100%; width: 0; background: var(--dimmer); transition: width .4s ease, background .3s; }
.run-bar.good > i { background: var(--up); }
.run-bar > i.warn { background: var(--accent); }
.run-bar > i.over { background: var(--down); }
.run-details { margin: 0 12px 12px; border: 1px solid var(--line-soft); border-radius: 6px; }
.run-details > summary {
  cursor: pointer; padding: 9px 12px; font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--dim);
}
.run-details > summary .dim { text-transform: none; letter-spacing: 0; }
.run-details[open] > summary { border-bottom: 1px solid var(--line-soft); margin-bottom: 12px; }
.run-details .fills-wrap { padding: 12px; }
/* Sub-lines wrap rather than cut a number in half. */
.stat-sub { white-space: normal; }
.legend em { font-style: normal; }

@media (max-width: 1000px) {
  /* A running bot is what someone opens the page on a phone to check. */
  body.running .side-col { order: -1; }
}
@media (max-width: 640px) {
  .run-value { font-size: 22px; }
  .run-grid { margin: 10px; }
}
.run-status[hidden] { display: none; }

/* ── Volu's read-back ──────────────────────────────────────────────────── */
.volu-readback { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 11px; }
.volu-readback caption { text-align: left; color: var(--dim); font-size: 10px; letter-spacing: .08em;
  text-transform: uppercase; padding-bottom: 4px; }
.volu-readback td { padding: 4px 6px 4px 0; border-top: 1px solid var(--line-soft); vertical-align: top; }
.volu-readback td:first-child { color: var(--dim); white-space: nowrap; }
.volu-readback td b { font-weight: 600; }
.volu-readback td em { display: block; font-style: normal; color: var(--accent); font-size: 10px; margin-top: 2px; }
.volu-readback td.src { color: var(--dimmer); font-size: 10px; text-align: right; }
.volu-questions, .volu-warn { margin: 6px 0; padding-left: 16px; font-size: 11.5px; line-height: 1.5; }
.volu-warn li { color: var(--accent); }
.volu-ignored, .volu-note { color: var(--dim); font-size: 11px; margin: 6px 0; }
.volu-proof { color: var(--dimmer); font-size: 10px; margin: 8px 0 0; letter-spacing: .02em; }

/* ── wallet menu ───────────────────────────────────────────────────────── */
.wallet-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 70; min-width: 190px;
  display: flex; flex-direction: column; padding: 4px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, .4);
}
.menu[hidden] { display: none; }
.menu-head { display: flex; flex-direction: column; gap: 1px; padding: 7px 9px 8px; border-bottom: 1px solid var(--line-soft); margin-bottom: 3px; }
.menu-head b { font-size: 12px; }
.menu-head span { font-size: 10.5px; color: var(--dimmer); }
.menu > button, .menu > a {
  display: block; width: 100%; text-align: left; padding: 7px 9px; border: 0; border-radius: 5px;
  background: none; color: var(--text); font: inherit; font-size: 12px; text-decoration: none; cursor: pointer;
}
.menu > button:hover, .menu > a:hover, .menu > button:focus-visible, .menu > a:focus-visible { background: var(--raised); outline: none; }
.menu > a[hidden] { display: none; }
.menu > .danger { color: var(--down); }

/* ── lifetime, one line under the run card ─────────────────────────────── */
.life-strip {
  flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #0b0d11;
  color: var(--dim); font: inherit; font-size: 11.5px; text-align: left; cursor: pointer;
}
:root[data-theme="light"] .life-strip { background: #fbfcfd; }
.life-strip[hidden] { display: none; }
.life-strip b { color: var(--text); font-variant-numeric: tabular-nums; }
.life-strip .life-open { margin-left: auto; color: var(--accent); }
.life-strip:hover { border-color: var(--dimmer); }

/* ── profile sheet ─────────────────────────────────────────────────────── */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 80; display: flex; justify-content: center; align-items: flex-start;
  padding: 56px 16px 24px; background: rgba(0, 0, 0, .55); overflow-y: auto;
}
.sheet-backdrop[hidden] { display: none; }
body.sheet-open { overflow: hidden; }
.sheet {
  width: min(980px, 100%); background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .5); display: flex; flex-direction: column;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; }
.sheet-head .dim { font-size: 11px; }
.sheet-body { padding: 14px 16px 18px; display: grid; gap: 12px; }
.pf-tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.pf-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 12px; }
.pf-chart-body { position: relative; padding: 8px 10px 6px; }
.pf-chart-body svg { display: block; width: 100%; height: 150px; }
.pf-chart-body .grid { stroke: var(--line-soft); stroke-width: 1; }
.pf-chart-body .axis { fill: var(--dimmer); font: 9.5px var(--mono); }
.pf-chart-body .col { fill: var(--accent); pointer-events: none; }
.pf-chart-body .col.on { opacity: .75; }
.pf-chart-body .hit { fill: transparent; }
.pf-tip {
  position: absolute; pointer-events: none; transform: translate(-50%, -100%); white-space: nowrap;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; font-size: 10.5px;
}
.pf-tip b { display: block; font-size: 11.5px; }
.pf-tip[hidden] { display: none; }
.pf-rows { display: flex; flex-direction: column; padding: 4px 12px 10px; }
.pf-row { display: grid; grid-template-columns: 104px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 11.5px; }
.pf-k { color: var(--dim); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; }
.pf-v b { font-weight: 700; }
.pf-v .up { color: var(--up); } .pf-v .down { color: var(--down); }
.pf-foot { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding-top: 10px; font-size: 11px; }
.pf-foot a { color: var(--dim); }
.sheet .act-table-wrap { max-height: 320px; overflow-y: auto; }
@media (max-width: 760px) {
  .pf-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pf-grid { grid-template-columns: 1fr; }
  .sheet-backdrop { padding: 0; }
  .sheet { border-radius: 0; min-height: 100%; }
  .pf-row { grid-template-columns: 92px minmax(0, 1fr); }
  .pf-row > .btn { grid-column: 2; justify-self: start; }
}
