/* CARRY-1 dashboard — chart chrome per the reference dataviz palette. */
:root {
  --surface-1: #fcfcfb; --page: #f9f9f7;
  --ink-1: #0b0b0b; --ink-2: #52514e; --ink-3: #898781;
  --grid: #e1e0d9; --baseline: #c3c2b7; --border: rgba(11,11,11,0.10);
  --s1: #2a78d6; --s2: #1baf7a; --s3: #eda100; --s4: #008300;
  --s6: #e34948;
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --delta-good: #006300;
}
@media (prefers-color-scheme: dark) {
  :root {
    --surface-1: #1a1a19; --page: #0d0d0d;
    --ink-1: #ffffff; --ink-2: #c3c2b7; --ink-3: #898781;
    --grid: #2c2c2a; --baseline: #383835; --border: rgba(255,255,255,0.10);
    --s1: #3987e5; --s2: #199e70; --s3: #c98500; --s4: #008300;
    --s6: #e66767;
    --delta-good: #0ca30c;
  }
}
* { box-sizing: border-box; margin: 0; }
/* stable gutter: the modal's body scroll lock drops the scrollbar — without
   this the whole page shifts sideways behind the scrim on open/close */
html { scrollbar-color: var(--border) transparent; scrollbar-gutter: stable; }
body {
  background: var(--page); color: var(--ink-1);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: inherit; }
main {
  max-width: 1180px; margin: 0 auto;
  padding: 20px max(24px, env(safe-area-inset-right))
           calc(64px + env(safe-area-inset-bottom))
           max(24px, env(safe-area-inset-left));
}

/* nav */
nav {
  display: flex; align-items: center; gap: 14px; row-gap: 4px; flex-wrap: wrap;
  padding: 10px max(24px, env(safe-area-inset-right)) 10px max(24px, env(safe-area-inset-left));
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
}
nav .brand { font-weight: 650; letter-spacing: .02em; }
nav a.tab { color: var(--ink-2); text-decoration: none; padding: 4px 2px; }
nav a.tab.active { color: var(--ink-1); font-weight: 600;
  border-bottom: 2px solid var(--s1); }
nav .tabs { display: contents; }
nav .spacer { flex: 1; }
nav .who { color: var(--ink-3); font-size: 13px; }
@media (max-width: 1450px) { nav .who { display: none; } }
nav .utc-clock { color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.badge {
  font-size: 11px; font-weight: 650; letter-spacing: .05em;
  padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border);
}
.badge.paper { color: var(--ink-2); }
.badge.live { color: #fff; background: var(--critical); border-color: transparent; }
.badge.backtest { color: #1a1a19; background: var(--s3); border-color: transparent; }

.view-banner {
  text-align: center; padding: 6px 12px; font-weight: 600; font-size: 13px;
}
.view-banner.backtest { background: var(--s3); color: #1a1a19; }
.view-banner.real { background: var(--good); color: #fff; }

button.ghost.active-view {
  border-color: var(--ink-1); font-weight: 700;
  /* a border alone is too quiet for "which book am I looking at?" */
  background: color-mix(in srgb, var(--ink-1) 9%, var(--surface-1));
}

.explainer {
  margin-top: 16px; padding: 10px 14px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface-1);
  color: var(--ink-2); font-size: 13px;
}
.explainer strong { color: var(--ink-1); }

/* cards / tiles */
.grid { display: grid; gap: 14px; }
.grid > * { min-width: 0; }  /* let cards shrink below their content's min width */
.tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 18px 0; }
/* 8 tiles auto-fit as a ragged 6+2 — a balanced 4×2 reads finished (fitTiles
   keeps values inside even at the narrower column) */
.tiles.balanced { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px;
}
.tile .label { color: var(--ink-2); font-size: 12.5px; }
.tile .value { font-size: 26px; font-weight: 650; margin-top: 2px; white-space: nowrap;
  font-variant-numeric: tabular-nums; }
/* "Tether mark" money treatment: the roundel sits beside the tile/mini LABEL
   (label text first, icon after — the label names the unit) while the value is
   a plain number whose cents drop to a soft small size — the integer carries
   the glance. Em-sized against the label font (tile 12.5px, mini 11.5px,
   report date 17px). Same teal in both themes (brand color). */
.tether-mark { width: .85em; height: .85em; margin-left: .35em; vertical-align: -0.1em; }
.cents-soft { font-size: .58em; font-weight: 550; color: var(--ink-3); }
.tile .value.hero { font-size: clamp(26px, 3.4vw, 42px); line-height: 1.15; }
.tile .delta { font-size: 12.5px; margin-top: 2px; color: var(--ink-2); }
.tile .delta.up { color: var(--delta-good); }
.tile .delta.down { color: var(--critical); }

.card h2 {
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  margin-bottom: 10px; letter-spacing: .01em;
}
.two-col { grid-template-columns: 1fr 1fr; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

/* chart bits */
.chart { position: relative; }
.chart svg { display: block; width: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 6px; }
.legend .key { display: flex; align-items: center; gap: 6px;
  color: var(--ink-2); font-size: 12.5px; }
.legend .key .swatch-line { width: 14px; height: 0; border-top: 2.5px solid; border-radius: 2px; }
.tooltip {
  position: absolute; pointer-events: none; z-index: 5; display: none;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; box-shadow: 0 4px 14px rgba(0,0,0,.18); font-size: 12.5px;
  min-width: 130px;
}
.tooltip .tt-date { color: var(--ink-3); margin-bottom: 4px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 7px; padding: 1px 0; }
.tooltip .tt-row .k { width: 12px; border-top: 2.5px solid; border-radius: 2px; }
.tooltip .tt-row .v { font-weight: 650; margin-left: auto; padding-left: 12px; }
.tooltip .tt-row .n { color: var(--ink-2); }

/* tables — wide ones scroll inside their card, the page never scrolls sideways */
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
  background:
    linear-gradient(to right, var(--surface-1) 30%, transparent),
    linear-gradient(to left, var(--surface-1) 30%, transparent) 100% 0,
    radial-gradient(farthest-side at 0 50%, rgba(120,120,120,.35), transparent),
    radial-gradient(farthest-side at 100% 50%, rgba(120,120,120,.35), transparent) 100% 0;
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
.scroll-x table { min-width: 480px; }
th { text-align: left; color: var(--ink-3); font-weight: 500; font-size: 12px;
  padding: 6px 8px; border-bottom: 1px solid var(--grid); }
td { padding: 7px 8px; border-bottom: 1px solid var(--grid); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.side { font-size: 11px; font-weight: 650; padding: 1px 7px; border-radius: 999px; }
.side.long { color: var(--delta-good); border: 1px solid var(--delta-good); }
.side.short { color: var(--critical); border: 1px solid var(--critical); }
.pos { color: var(--delta-good); } .neg { color: var(--critical); }
.muted { color: var(--ink-3); }

/* status chips (icon + label, never color alone) */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px;
  font-weight: 600; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--border);
  white-space: nowrap; }  /* "✓ OK" must never fold into a two-line pill */
.chip.ok { color: var(--delta-good); }
.chip.fired { color: #fff; background: var(--critical); border-color: transparent; }
.chip.armed { color: var(--ink-2); }
.chip.accent { color: var(--s1); border-color: var(--s1); }
.chip.near { color: var(--serious); border-color: var(--serious); }
.warn-val { color: var(--serious); }

/* square letter badges — compact per-row state markers; the notice above the
   positions table carries the words, the square just points at the row */
.sq { display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border-radius: 4px; font-size: 11px; font-weight: 700;
  margin-left: 7px; vertical-align: middle; line-height: 1; cursor: default; }
.sq.delist { background: var(--critical); color: #fff; }
.sq.closing { background: var(--s3); color: #14140f; }
.sq.hold { background: var(--s1); color: #fff; }

/* rules page: reference prose — reading width, roomy lists, formula blocks;
   centered like Reports (left-hugging a 1440px window reads unstyled) */
.rules { max-width: 780px; margin: 0 auto; width: 100%; }
.rules p { margin: 8px 0; }
.rules ul { margin: 8px 0 8px 4px; padding-left: 18px; }
.rules li { margin: 5px 0; }
.rules .formula { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px; background: var(--page); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 12px; margin: 8px 0; overflow-x: auto;
  white-space: nowrap; }
.rules table td, .rules table th { white-space: normal; }
.rules .scroll-x table { min-width: 0; }
.rules .sq { margin-left: 0; }
/* center squares against the text with flex, not baseline math — baseline
   offsets land differently across platform fonts (iOS SF vs desktop) */
#positions td:first-child > span:first-child {
  display: inline-flex; align-items: center; }
.pos-note .line { display: flex; align-items: flex-start; }
.pos-note .line .sq { flex: none; margin: 1px 7px 0 0; }

/* positions: cells never wrap — the card scrolls sideways instead of rows
   ballooning to two and three lines */
#positions td { white-space: nowrap; }
#positions button.ghost { white-space: nowrap; padding: 5px 12px; }
.pos-note { margin-bottom: 10px; }
.pos-note .line + .line { margin-top: 3px; }

/* events feed */
.events { max-height: 420px; overflow-y: auto; }
.fade-bottom {
  -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 28px), transparent);
  mask-image: linear-gradient(to bottom, black calc(100% - 28px), transparent);
}
.ev { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--grid); }
.ev:last-child { border-bottom: 0; }
.ev .ts { color: var(--ink-3); font-size: 12px; white-space: nowrap;
  font-variant-numeric: tabular-nums; }
.ev .lvl { font-size: 11px; font-weight: 650; width: 52px; flex: none; }
.ev .lvl.info { color: var(--ink-3); }
.ev .lvl.warn { color: var(--serious); }
.ev .lvl.error, .ev .lvl.critical { color: var(--critical); }
.ev .msg { color: var(--ink-2); overflow-wrap: anywhere; }

/* forms & buttons */
input, select {
  background: var(--page); color: var(--ink-1);
  border: 1px solid var(--baseline); border-radius: 7px; padding: 7px 10px;
  font: inherit;
}
label { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 3px; }
button {
  font: inherit; font-weight: 600; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--baseline); background: var(--surface-1);
  color: var(--ink-1); padding: 7px 14px;
}
button:hover { border-color: var(--ink-3); }
button:disabled { opacity: .45; cursor: not-allowed; }
button:disabled:hover { border-color: var(--baseline); }
button.primary { background: var(--s1); border-color: transparent; color: #fff; }
button.danger { background: var(--critical); border-color: transparent; color: #fff; }
button.ghost { background: transparent; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; }
/* Risk control groups: Emergency vs Routine — labeled distance between
   "Halt trading" and "Resume", never one mis-tap apart */
.ctl-group-label { font-size: 11px; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.cfg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.notice { padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-1); color: var(--ink-2); font-size: 13px; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; }
.login-card { width: 340px; }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card .sub { color: var(--ink-3); font-size: 13px; margin-bottom: 18px; }
.login-card form { display: grid; gap: 12px; }
.err { color: var(--critical); font-size: 13px; }

/* meter (drawdown vs thresholds) */
.meter { position: relative; height: 14px; border-radius: 7px; background: #cde2fb33;
  border: 1px solid var(--border); overflow: visible; margin: 26px 4px 22px; }
/* neutral by default — blue said "progress" where the number means drawdown;
   risk.js paints it amber/red as thresholds are crossed. The Book preview
   meter sets --s1 inline, where progress IS the meaning. */
.meter .fill { position: absolute; left: 0; top: 0; bottom: 0;
  border-radius: 7px 0 0 7px; background: var(--ink-3); }
.meter .mark { position: absolute; top: -5px; bottom: -5px; width: 2px; }
.meter .mark span { position: absolute; top: -18px; left: 50%; transform: translateX(-50%);
  font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.meter .mark.soft { background: var(--warning); }
.meter .mark.hard { background: var(--critical); }

/* clickable position rows */
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: color-mix(in srgb, var(--s1) 6%, transparent); }

/* any symbol cell that opens the contract detail modal */
.symbol-link { cursor: pointer; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }
.symbol-link:hover { color: var(--s1); }
/* symbol links and clickable rows are keyboard-reachable — show where focus is */
.symbol-link:focus-visible, tr.clickable:focus-visible {
  outline: 2px solid var(--s1); outline-offset: 1px; border-radius: 3px; }

/* compact segment buttons (chart timeframe/unit switchers) — one spec instead
   of the same inline padding pasted beside every chart header */
button.seg-btn { padding: 3px 10px; font-size: 12px; flex: none; }

/* symbol detail modal */
.modal-back[hidden] { display: none; }
.modal-back {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,.45);
  display: grid; place-items: center;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
}
.modal { width: min(720px, 96vw); max-height: 90vh; overflow-y: auto;
  /* scrolling past the modal's end must not scroll the page behind the scrim
     (body.modal-open locks the rest) */
  overscroll-behavior: contain; }
body.modal-open { overflow: hidden; }
/* the title and ✕ stay reachable however deep the modal scrolls — same sticky
   treatment as the Reports week nav; negative margins pull the head over the
   card's padding so content scrolls under it, not past it */
.modal-head { display: flex; align-items: center; justify-content: space-between;
  /* above the chart tooltips (z-index 5) — they must slide under the title bar */
  position: sticky; top: 0; z-index: 6; background: var(--surface-1);
  margin: -14px -16px 10px; padding: 12px 16px 8px; }
.modal-head h2 { font-size: 16px; color: var(--ink-1); }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
  gap: 10px; margin-bottom: 12px; }
/* the modal's stats carry long labels ("Realized on partial closes") and
   compound values ("−1.245%/4h · in 2h") that 105px columns keep fracturing —
   four roomy columns beat six cramped ones (phones stay 2-up below) */
.modal .stat-row { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat-row .mini { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
  min-width: 0; }
.stat-row .mini .label { font-size: 11.5px; color: var(--ink-3); }
/* hard guarantee: a long value ("10000REKT") wraps inside its own tile — it
   must never paint over the neighbour */
.stat-row .mini .val { font-size: 15px; font-weight: 650; margin-top: 1px;
  overflow-wrap: anywhere; }
/* quiet second line inside a stat value (the funding countdown) — reads like
   a tile's delta line, never competes with the number above it */
.stat-row .mini .val .sub { font-size: 12px; font-weight: 400; color: var(--ink-3);
  margin-top: 1px; }
/* the two single-name exits, as price levels: the one question a held name
   raises is "how far am I from being cut, and from being taken profit on?" —
   so they get cards, not minis, and a meter for the distance */
.risk-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px; margin: 0 0 12px; }
.risk-card { padding: 9px 12px 8px; }
/* a hold that blocks the exit means the level is informational — dashed and
   quieted, so it can't be misread as an armed trigger */
.risk-card.dim { opacity: .72; border-style: dashed; }
.risk-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.risk-head .label { font-size: 12.5px; color: var(--ink-2); }
/* status wears a word, never color alone */
.risk-badge { font-size: 9.5px; font-weight: 650; letter-spacing: .03em;
  text-transform: uppercase; padding: 1px 5px; border-radius: 4px;
  border: 1px solid currentColor; white-space: nowrap; flex: none; }
.risk-badge.warn { color: var(--warning); }
.risk-badge.bad { color: var(--critical); }
.risk-badge.good { color: var(--delta-good); }
/* a standalone price at this size takes the font's proportional figures —
   tabular-nums is for columns that must align, and it reads loose here.
   One step above the stat minis' 15px: these lead, they don't shout */
.risk-level { font-size: 19px; font-weight: 650; margin-top: 1px; line-height: 1.2;
  overflow-wrap: anywhere; }
.risk-sub { font-size: 11.5px; color: var(--ink-2); margin-top: 1px; }
/* the mark's label hangs above the track (top: -18px) — the top margin is its room */
.risk-card .meter { height: 6px; margin: 24px 2px 6px; }
.risk-card .meter .mark.good { background: var(--delta-good); }
/* a fill that reaches past the mark must not swallow it: a surface-colored
   ring keeps the threshold legible on top of its own color */
.risk-card .meter .mark { box-shadow: 0 0 0 1px var(--surface-1); }
.risk-foot { font-size: 11px; color: var(--ink-3); line-height: 1.45; }
@media (max-width: 620px) { .risk-row { grid-template-columns: 1fr; } }

/* same heading spec as the card h2s — the modal's sections are not a new
   heading tier, they just happen to sit one card deep */
.modal h3 { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 14px 0 6px; }
@media (max-width: 620px) {
  .modal-back { align-items: end; padding: 0; }
  .modal { width: 100vw; max-height: 92vh; border-radius: 14px 14px 0 0; }
  /* phone cards pad 12px — the sticky head's pull-over margins follow */
  .modal-head { margin: -12px -12px 10px; padding: 12px 12px 8px; }
  /* three-across stat tiles wrap every second value on a phone — two breathe */
  .modal .stat-row { grid-template-columns: repeat(2, 1fr); }
}

/* phones */
@media (max-width: 620px) {
  nav { gap: 10px; padding-top: max(10px, env(safe-area-inset-top)); }
  nav .who { display: none; }
  nav a.tab { font-size: 13px; }
  main { padding-left: max(12px, env(safe-area-inset-left));
         padding-right: max(12px, env(safe-area-inset-right)); padding-top: 12px; }
  .grid { gap: 10px; }
  /* .balanced included: its 4-col desktop rule outweighs .tiles on specificity */
  .tiles, .tiles.balanced { grid-template-columns: repeat(2, 1fr); margin: 12px 0; }
  .tile .value { font-size: 21px; }
  .tile .value.hero { font-size: 26px; }
  .card { padding: 12px; border-radius: 9px; }
  .controls button { flex: 1 1 44%; }
  button { padding: 9px 12px; }   /* comfortable touch targets */
  .events { max-height: 320px; }
}

/* daily reports */
.reports-wrap { max-width: 680px; margin: 0 auto; }
/* tables inside a report hug their content — five columns strewn across a
   wide card read as disconnected numbers */
.report table { width: auto; min-width: 55%; }
.report th, .report td { padding-right: 18px; }
.report th:last-child, .report td:last-child { padding-right: 4px; }
.week-nav { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 18px 0 22px; position: sticky; top: 0; z-index: 5;
  background: var(--page); padding: 8px 0; }
.week-title { text-align: center; font-weight: 700; font-size: 14.5px; }
.week-btns { display: flex; gap: 6px; }
.week-btns button { white-space: nowrap; }  /* "Newer ›" / "Per day" never split */
.week-net { font-size: 12px; font-weight: 600; margin-top: 1px; }
.report { margin-bottom: 28px; padding: 20px 22px; }
@media (max-width: 620px) { .report { padding: 16px; margin-bottom: 20px; } }
.report-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.report-date { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.report-sub { font-size: 12px; margin-top: 1px; }
.report-net { text-align: right; }
.report-net-usd { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* component strip: negatives left of the notch, positives right */
.comp-bar { display: flex; align-items: center; gap: 2px; height: 8px; margin: 14px 0 8px; }
.comp-seg { height: 8px; border-radius: 2px; }
.comp-seg.loss { opacity: 0.45; }
.comp-seg:first-child { border-radius: 4px 2px 2px 4px; }
.comp-seg:last-child { border-radius: 2px 4px 4px 2px; }
.comp-notch { width: 2px; height: 16px; background: var(--ink-2); border-radius: 1px;
  flex: none; margin: 0 3px; }
.comp-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px;
  color: var(--ink-2); font-variant-numeric: tabular-nums; }
.comp-item { display: inline-flex; align-items: center; gap: 6px; }
.comp-swatch { width: 8px; height: 8px; border-radius: 2px; flex: none; }

/* by-side mini grid on the report card: the day's price/funding split per
   leg, column swatches matching the component bar above it */
.byside { display: grid; gap: 3px 18px; width: fit-content; margin-top: 12px;
  font-size: 12.5px; font-variant-numeric: tabular-nums; }
.byside .num { text-align: right; }
.byside-h { display: inline-flex; align-items: center; justify-content: flex-end;
  gap: 6px; font-size: 11.5px; color: var(--ink-3); }
.byside-lab { color: var(--ink-2); font-weight: 600; }

.report-sec { font-size: 11px; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--ink-3); margin: 16px 0 4px; }
.chg { display: flex; align-items: baseline; gap: 10px; padding: 3.5px 0; font-size: 13.5px; }
.chg-act { flex: none; width: 96px; font-weight: 600; font-size: 12.5px; }
.chg-act.enter { color: var(--delta-good); }
.chg-act.exit { color: var(--ink-2); }
.chg-act.squeeze { color: var(--s3); }
.chg-act.skip { color: var(--ink-3); }
.chg-act.hold { color: var(--s1); }
/* alert-kind labels share one fixed min width so their texts left-align */
.chg-act.note-warn { color: var(--s3); width: auto; min-width: 110px; }
.chg-act.note-bad { color: var(--critical); width: auto; min-width: 110px; }
.chg-sym { flex: none; min-width: 104px; font-weight: 550; }
.chg-text { color: var(--ink-3); min-width: 0; }

/* rebalance preview: slim progress meter + "shown working" equation rows */
.meter.slim { height: 8px; border-radius: 4px; }
.eq { display: flex; align-items: baseline; gap: 10px; padding: 3px 0; font-size: 13px; }
.eq-sym { flex: none; min-width: 104px; font-weight: 550; }
.eq-math { color: var(--ink-3); min-width: 0; font-variant-numeric: tabular-nums; }
@media (max-width: 620px) {
  .eq { flex-wrap: wrap; gap: 2px 10px; }
}

.report table { font-size: 13px; }
.book-line { font-size: 12.5px; margin-top: 14px; line-height: 1.7; }
.book-label { font-weight: 650; letter-spacing: 0.02em; margin-right: 8px; color: var(--ink-2); }
.book-tok { white-space: nowrap; }
@media (max-width: 620px) {
  .chg { flex-wrap: wrap; gap: 4px 10px; }
  .chg-sym { min-width: 0; }
  .chg-text { flex-basis: 100%; padding-left: 106px; }
  .report-date { font-size: 15.5px; }
  .report-net-usd { font-size: 15.5px; }
}

/* phone nav: one compact control row, then a swipeable tab row — never a
   three-deep wrap of full-size buttons */
@media (max-width: 700px) {
  nav { gap: 8px; row-gap: 6px; }
  nav .tabs {
    display: flex; order: 10; flex: 1 1 100%; gap: 16px;
    overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    /* fade the clipped edge so "there's more" is visible; scrolled fully right,
       the local-attached gradient rides off with the content */
    -webkit-mask-image: linear-gradient(to right, black calc(100% - 34px), transparent);
    mask-image: linear-gradient(to right, black calc(100% - 34px), transparent);
  }
  nav .tabs::-webkit-scrollbar { display: none; }
  nav .tabs a.tab { flex: none; padding: 8px 0 10px; }
  nav .tabs a.tab:last-child { padding-right: 40px; }  /* room to escape the fade */
  nav button.ghost { padding: 6px 10px; font-size: 12px; }
  nav .utc-clock { font-size: 11px; }
  .symbol-link { padding: 4px 0; margin: -4px 0; }  /* bigger touch box, same layout */
  /* the report fills, modal, and positions tables size to their content on a
     phone — no artificial 480px floor forcing a sideways scroll */
  .report .scroll-x table, .modal .scroll-x table, #positions table { min-width: 0; }
  .report table { width: 100%; }  /* on a phone the card is narrow: fill it */
  #positions table { font-size: 13px; }
  #positions th, #positions td { padding-left: 6px; padding-right: 6px; }
}

/* P&L episodes table: rows never wrap — the card scrolls sideways instead
   (the expanded detail cell restores normal wrapping inline) */
#attr-table td { white-space: nowrap; }

/* Config tables hug their content — no artificial 480px floor on a phone */
.scroll-x table.cfg-table { min-width: 0; }

/* desktop: make row-click affordance unmissable on hover */
tr.clickable:hover td:first-child {
  text-decoration: underline dotted; text-underline-offset: 3px;
}
