/* board-tools.css - the tool, market, account, list and alert surfaces.
   The second board sheet: split from styles.css at its original section boundary. */
/* ---------------------------------------------------------------- shared --- */
.toolview .hb-crumbs,
.itemview .hb-crumbs {
  display: flex; flex-wrap: wrap; gap: 5px; align-items: center;
  margin: 0; color: var(--ink-4); font-size: var(--text-label);
}
.toolview .hb-crumbs a,
.itemview .hb-crumbs a { color: var(--ink-3); text-decoration: none; }
.toolview .hb-crumbs a:hover,
.itemview .hb-crumbs a:hover { color: var(--accent); }
.tool-field-head label,
.tool-field-label {
  color: var(--ink-2); font-size: var(--text-label); font-weight: var(--fw-medium);
  letter-spacing: 0; line-height: var(--leading-heading);
}
.toolview .up { color: var(--up); }
.toolview .down { color: var(--down); }

/* ---------------------------------------------------------------- height --- */
/* A calculator is a screen, not a document. The workspace, the card, the board
   and the toolview are one height chain; the desk takes the remainder. The
   numeric fields still need the browser's normal keyboard/pan behavior, so the
   body is not fixed the way the optimizer's is. */
html:has(.toolview-calc),
body:has(.toolview-calc) { overflow: hidden; overscroll-behavior: none; }
.shell[data-screen="tools"]:has(.toolview-calc) .workspace {
  flex: 1 1 auto; display: flex; flex-direction: column;
  align-items: stretch; gap: 0; min-height: 0; overflow: hidden;
  scrollbar-gutter: auto;
  padding-right: calc(var(--page-pad) + var(--shell-gutter, 0px));
  padding-bottom: 16px;
}
.shell[data-screen="tools"]:has(.toolview-calc) .col-main { display: contents; }
.shell[data-screen="tools"]:has(.toolview-calc) .list-card {
  flex: 1 1 auto; min-height: 0; display: flex;
  padding: 0; border: 0; background: none; overflow: visible;
}
.shell[data-screen="tools"]:has(.toolview-calc) #board {
  flex: 1 1 auto; display: flex; min-height: 0; overflow: hidden;
}
.toolview-calc { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.tool-top .hb-crumbs { margin: 0; font-size: var(--text-label); }

/* ------------------------------------------------------------------ hub ---- */
.toolview-hub {
  display: flex; flex-direction: column; gap: 14px; padding-top: 2px;
}

/* ------------------------------------------------------------------ tax ---- */
.tax-desk {
  flex: 1 1 auto; min-height: 0;
  display: grid; grid-template-rows: auto minmax(0, 1fr);
  gap: 12px; margin-top: 10px;
}
/* One action row keeps the CTA on the same baseline as the inputs. As a column
   the 80px action stack pushed the button up through the ticket's head rule. */
/* The fee rules are one quiet footnote, not three columns spread across the
   ticket. Keeping them together stops the eye reading them as field values. */
.tax-receipt { display: flex; flex-direction: column; min-height: 0; }
/* The receipt has two bands. The top band is the answer and its two key
   figures; the bottom band is the arithmetic tally and its audit. Proximity
   does the grouping the old five equal rows could not. */
.tax-profit {
  grid-column: 1; grid-row: 1;
  display: flex; flex-direction: column; justify-content: flex-start;
  min-width: 0; padding: 2px 24px 12px 0; border-right: 1px solid var(--tool-rule);
}
.tax-profit b {
  display: block; overflow: hidden; margin-top: 7px;
  font-family: var(--mono); font-size: var(--text-display); font-weight: var(--fw-medium);
  font-variant-numeric: tabular-nums; letter-spacing: 0;
  line-height: var(--leading-tight); text-overflow: ellipsis; white-space: nowrap;
  word-spacing: -.08em;
}
.tax-profit p {
  margin-top: 9px; color: var(--ink-3); font-size: var(--text-label); line-height: var(--leading-label);
}

/* ----------------------------------------------------------------- alch ---- */
/* The cast setup is a full-width recipe, not a narrow rail with decorative
   gaps. The return is one sheet: the per-cast answer and its break-even
   ceiling on the left, the rate facts on the right. */
.alch-desk {
  flex: 1 1 auto; min-height: 0;
  display: grid; grid-template-rows: auto minmax(0, 1fr);
  gap: 12px; margin-top: 10px;
}
/* Three bands share the sheet's full height: answer plus batch, the four
   throughput facts, then the break-even rail. The old two-column split left
   one tall hero floating in a mostly empty half at desk sizes. */
.alch-profit {
  display: flex; flex-direction: column; justify-content: center;
  min-width: 0; padding: 4px 28px 12px 0;
  border-right: 1px solid var(--tool-rule);
}
.alch-verdict.up {
  border-color: rgba(115, 215, 165, .22); color: var(--up);
  background: rgba(115, 215, 165, .055);
}
.alch-verdict.down {
  border-color: rgba(255, 133, 140, .3); color: var(--down);
  background: rgba(255, 133, 140, .055);
}
.alch-profit > b {
  display: block; overflow: hidden; margin-top: 7px;
  font-family: var(--mono); font-size: var(--text-display); font-weight: var(--fw-medium);
  font-variant-numeric: tabular-nums; letter-spacing: 0;
  line-height: var(--leading-tight); text-overflow: ellipsis; white-space: nowrap;
  word-spacing: -.08em;
}
.alch-gauge.over .alch-gauge-track > span { background: var(--down); }
.alch-scale dd.up, .alch-scale dd.down { font-weight: var(--fw-medium); }

/* ---------------------------------------------------------------- limit ---- */

/* ---------------------------------------------------------------- extras --- */

/* The item page keeps the breadcrumb styles it shared with the tools section;
   these answer blocks are item-page content, not a desk. */
.ssr-answers { margin-top: 22px; }
.ssr-answers h3 { margin: 14px 0 4px; color: var(--ink-2); font-size: var(--text-body); }
.ssr-answers p { margin: 0; color: var(--ink-3); font-size: var(--text-label); line-height: var(--leading-body); }


/* --------------------------------------------------------------- responsive --- */
@media (max-width: 1200px) {
  .toolview { --tool-pad: 14px; }
  .tax-desk, .alch-desk, .limit-desk { gap: 10px; margin-top: 8px; }
  .tax-profit b, .alch-profit > b, .limit-hero b { font-size: var(--text-title); }
}

@media (max-width: 1100px) {
  .toolview { --tool-pad: 12px 14px; }
  .tool-field-head label, .tool-field-label { font-size: var(--text-label); }
  .alch-profit { padding-right: 18px; }
  .tax-profit { padding-right: 18px; }
}

@media (max-width: 900px) {
  /* At tablet width the exempt field is narrower than its helper line. The
     box's label and "No GE tax" already say enough; drop the repetition. */
  .alch-profit { padding-right: 16px; }
  .alch-profit > b { font-size: var(--text-title); }
}

@media (max-width: 620px) {
  .toolview-hub { gap: 10px; padding-top: 0; }
  .tool-top .hb-crumbs { font-size: var(--text-label); }

  .tax-desk, .alch-desk, .limit-desk { gap: 8px; margin-top: 6px; }
  .tool-field-head label, .tool-field-label { font-size: var(--text-label); }
  .tax-profit {
    grid-column: 1; grid-row: 1;
    padding: 0 0 8px; border-right: 0;
    border-bottom: 1px solid var(--tool-rule);
  }
  .tax-profit b { font-size: var(--text-title); }
  .tax-profit p { margin-top: 6px; font-size: var(--text-label); }
  /* A one-column grid still placed the scale in an implicit second track:
     `.alch-scale` carries `grid-column: 2` from the desk layout. Flex drops
     the explicit placement and lets the two blocks stack. */
  /* A one-column grid still placed the second answer block in an implicit
     track; flex drops explicit placement and lets the sheet stack. */
  .alch-profit {
    display: block; padding: 0 0 6px; border-right: 0;
  }
  .alch-profit > b { font-size: var(--text-title); }
}

@media (min-width: 621px) and (max-height: 760px) {
  .toolview { --tool-pad: 10px 14px; }
  .tax-desk, .alch-desk, .limit-desk { gap: 8px; margin-top: 6px; }
  .tax-profit b, .alch-profit > b, .limit-hero b { font-size: var(--text-title); }
  .tax-profit { padding-bottom: 9px; }
}

@media (max-width: 620px) and (max-height: 700px) {
  .shell[data-screen="tools"]:has(.toolview-calc) .workspace { padding-bottom: 8px; }
  .tax-desk, .alch-desk, .limit-desk { gap: 6px; margin-top: 5px; }
  .tax-desk .tool-run, .limit-desk .tool-run { height: 42px; }
  .tax-desk .tool-reset, .limit-desk .tool-reset { height: 42px; }
  .tax-profit b, .alch-profit > b, .limit-hero b { font-size: var(--text-title); }
  .tax-profit { padding-bottom: 6px; }
  /* The gauge is a reading aid, not a second copy of the number. On a short
     phone it costs more height than it earns; the label, value and note stay. */
}

@media (max-width: 620px) and (max-height: 620px) {
  .tax-profit p { display: none; }
  .alch-profit { padding-bottom: 2px; }
  .alch-profit > b { font-size: var(--text-heading); }
}

/* Below about 660px tall the 2x2 tally has less height than its two lines of
   type need. Turn it into one four-cell receipt line rather than let the
   labels and values collide. The 11px values are the floor here; above 660px
   the two-column tally keeps the larger type. */
@media (max-width: 620px) and (max-height: 660px) {
}

/* A calculator keeps the open-item strip and the search on one head row.
   The generic phone head gives the strip a row of its own, which is right for
   the market and costs a no-scroll calculator 46px it cannot spare. */
@media (max-width: 620px) {
  .shell[data-screen="tools"] .page-head:has(.tb-pages:not([hidden])) {
    height: 62px;
    min-height: 62px;
    flex-wrap: nowrap;
    padding-top: 0;
    padding-bottom: 0;
    row-gap: 0;
  }
  .shell[data-screen="tools"] .page-head:has(.tb-pages:not([hidden])) .tb-pages {
    order: 1;
    flex: 0 1 54%;
    min-width: 0;
  }
  .shell[data-screen="tools"] .page-head:has(.tb-pages:not([hidden])) .ph-actions {
    order: 2;
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    margin-left: 0;
  }
  .shell[data-screen="tools"] .page-head:has(.tb-pages:not([hidden])) .ph-search {
    width: auto;
    min-width: 0;
  }
}

@media (max-width: 380px) and (max-height: 700px) {
  .shell[data-screen="tools"] .page-head:has(.tb-pages:not([hidden])) {
    height: 58px;
    min-height: 58px;
  }
}

/* ==========================================================================
   Data tools — production, kingdom and loot
   ==========================================================================
   The workbench is still one screen: form, answer and reference sit in three
   columns on a desk, and a page never asks the reader to scroll. Long drop
   tables split into two short tables in the reference column. The forms and
   results keep the same surfaces, rules, mono figures and accent as the
   tax/alch/limit calculators. */
.shell[data-screen="tools"]:has(.toolview-data) .workspace {
  flex: 1 1 auto; display: flex; flex-direction: column;
  align-items: stretch; gap: 0; min-height: 0; overflow: hidden;
  padding-bottom: 16px;
}
.shell[data-screen="tools"]:has(.toolview-data) .col-main { display: contents; }
.shell[data-screen="tools"]:has(.toolview-data) .list-card {
  flex: 1 1 auto; min-height: 0; display: flex;
  padding: 0; border: 0; background: none; overflow: visible;
}
.shell[data-screen="tools"]:has(.toolview-data) #board {
  flex: 1 1 auto; display: flex; min-height: 0; overflow: hidden;
}
.data-answer > b.up { color: var(--up); }
.data-answer > b.down { color: var(--down); }
.data-stats dd .up { color: var(--up); }
.data-stats dd .down { color: var(--down); }
.data-grid .up { color: var(--up); }
.data-grid .down { color: var(--down); }
.data-name { display: block; color: var(--ink); font-family: var(--sans); font-weight: var(--fw-regular); font-size: var(--text-label); line-height: var(--leading-heading); }

@media (max-width: 1180px) {
}

@media (max-width: 900px) {
}

@media (max-width: 620px) {
}

@media (max-height: 760px) {
}

/* ==========================================================================
   Tools — the market's type and surfaces
   ==========================================================================
   The calculators are pages of the same terminal as the market board, not a
   separate instrument. They borrow its card plate, 1px rules, spacing and type
   scale: one sans family, tabular figures and sentence-case labels. The old
   display/mono split was a second design language; this block is the one the
   tools actually wear. */
.toolview {


  --tool-rule: var(--line-soft);

  --tool-pad: 16px;
}
.toolview .tool-surface {
  padding: var(--tool-pad);
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card);
}
.toolview .tool-head {
  align-items: center; padding-bottom: 0; margin-bottom: 12px;
  border-bottom: 0;
}
.toolview .tool-head h2,
.toolview .tool-head h3 {
  font-size: var(--text-body); font-weight: var(--fw-medium); letter-spacing: 0; line-height: var(--leading-heading);
}
.toolview .tool-eyebrow {
  margin: 0 0 3px; color: var(--ink-4);
  font: var(--fw-medium) var(--text-body) var(--sans); letter-spacing: 0;
  line-height: var(--leading-label); text-transform: none;
}
.toolview .tool-head-note {
  color: var(--ink-4); font: var(--fw-regular) var(--text-body) var(--sans);
  line-height: var(--leading-label);
}
.toolview .tool-index {
  font: var(--fw-medium) var(--text-body) var(--mono); line-height: var(--leading-heading);
}
.toolview .tool-field-head { margin-bottom: 5px; }
.toolview .tool-field-head label,
.toolview .tool-field-label {
  color: var(--ink-2); font-size: var(--text-label); font-weight: var(--fw-regular);
  letter-spacing: 0; line-height: var(--leading-label);
}
.toolview .tool-field-note {
  color: var(--ink-4); font: var(--fw-medium) var(--text-label) var(--mono); line-height: var(--leading-label);
}
.toolview .tool-input input,
.toolview .tool-select {
  height: 36px; padding: 0 38px 0 9px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg-2); color: var(--ink);
  font: var(--fw-medium) var(--text-body) var(--mono); font-variant-numeric: tabular-nums;
}
.toolview .tool-select { padding-right: 9px; font-family: var(--sans); font-weight: var(--fw-regular); }
.toolview .tool-input input:hover,
.toolview .tool-select:hover { border-color: var(--line-strong); }
.toolview .tool-input input:focus,
.toolview .tool-select:focus {
  border-color: var(--accent-line); box-shadow: 0 0 0 2px var(--accent-soft);
}
.toolview .tool-input em { right: 9px; color: var(--ink-4); font: var(--fw-medium) var(--text-label) var(--mono); }
.toolview .tool-select option { background: var(--card); color: var(--ink); }
.toolview .tool-check {
  min-height: 36px; padding: 0 9px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg-2); color: var(--ink-2); font-size: var(--text-label);
}
.toolview .tool-check b { font-size: var(--text-label); }
.toolview .tool-check small { font-size: var(--text-label); }
.toolview .tool-actions { gap: 8px; margin-top: 12px; }
.toolview .tool-run {
  height: 40px; padding: 0 13px; border-radius: 8px;
  font-size: var(--text-label); font-weight: var(--fw-medium);
}
.toolview .tool-reset {
  height: 30px; padding: 0 11px; border-radius: 8px;
  color: var(--ink-3); font-size: var(--text-label);
}
.toolview .tool-reset:hover { border-color: var(--line-strong); color: var(--ink); }
.toolview .tool-hero-label {
  color: var(--ink-4); font: var(--fw-regular) var(--text-body) var(--sans);
  letter-spacing: 0; line-height: var(--leading-label); text-transform: none;
}
.toolview .tool-footnote {
  margin: 12px 0 0; padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  color: var(--ink-4); font-size: var(--text-label); line-height: var(--leading-body);
}
.toolview .tool-col-title {
  padding-bottom: 6px; margin-bottom: 2px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-4); font: var(--fw-medium) var(--text-body) var(--sans);
  letter-spacing: 0; line-height: var(--leading-label); text-transform: none;
}
.toolview .tool-facts dt { color: var(--ink-3); font-size: var(--text-label); }
.toolview .tool-facts dd { font: var(--fw-medium) var(--text-body) var(--mono); }

/* The hub is a card of market rows, not a separate register skin. */
.toolview-hub .tool-hub-head h2 { font-size: var(--text-heading); letter-spacing: 0; }
.toolview-hub .tool-hub-lede { font-size: var(--text-label); line-height: var(--leading-body); }
.toolview-hub .tool-register { padding: 16px; }
.toolview-hub .tool-row { padding: 12px 2px; }
.toolview-hub .tool-row-no { font-size: var(--text-label); }
.toolview-hub .tool-row-copy b { font-size: var(--text-body); }
.toolview-hub .tool-row-copy small { font-size: var(--text-label); }
.toolview-hub .tool-row-kind { font-size: var(--text-label); }
.toolview-hub .tool-row-go { font-size: var(--text-label); }
.toolview-hub .tool-flow-steps b { font-size: var(--text-label); }
.toolview-hub .tool-flow-steps p { font-size: var(--text-label); }
.toolview-hub .tool-flow-link { font-size: var(--text-label); }
.toolview-hub .tool-foot { font-size: var(--text-label); }

/* The three original calculators keep their desks, but their figures now use
   the market's answer scale instead of an oversized mono hero. */
.toolview .tax-profit b,
.toolview .alch-profit > b,
.toolview .limit-hero b {
  font: var(--fw-medium) var(--text-title)/var(--leading-display) var(--sans);
  letter-spacing: 0; font-variant-numeric: tabular-nums;
}
.toolview .tax-profit p,
.toolview .alch-profit p,
.toolview .limit-hero p {
  color: var(--ink-3); font-size: var(--text-label); line-height: var(--leading-label);
}
.toolview .tax-key dt,
.toolview .tax-equation dt,
.toolview .tax-audit dt { font-size: var(--text-label); }
.toolview .tax-key dd { font: var(--fw-medium) var(--text-body) var(--mono); }
.toolview .tax-equation dd { font: var(--fw-medium) var(--text-body) var(--mono); }
.toolview .tax-audit dd { font: var(--fw-medium) var(--text-body) var(--mono); }
.toolview .tax-fee-strip span { font: var(--fw-regular) var(--text-label) var(--sans); }
.toolview .tax-fee-strip b { font-size: var(--text-label); }
.toolview .alch-assumptions { font: var(--fw-regular) var(--text-label) var(--sans); }
.toolview .alch-verdict { font: var(--fw-medium) var(--text-body) var(--sans); }
.toolview .alch-batch-sheet > p,
.toolview .alch-ceiling-copy > span {
  color: var(--ink-4); font: var(--fw-medium) var(--text-body) var(--sans);
  letter-spacing: 0; text-transform: none;
}
.toolview .alch-batch-facts dt { font-size: var(--text-label); }
.toolview .alch-batch-facts dd { font: var(--fw-medium) var(--text-body) var(--mono); }
.toolview .alch-formula { font: var(--fw-medium) var(--text-label) var(--mono); }
.toolview .alch-ceiling-copy > b { font: var(--fw-medium) var(--text-body) var(--mono); }
.toolview .alch-ceiling-copy p { font-size: var(--text-label); }
.toolview .alch-scale dt { font-size: var(--text-label); }
.toolview .alch-scale dd { font: var(--fw-medium) var(--text-body) var(--mono); }
.toolview .alch-gauge-ends { font-size: var(--text-label); }
.toolview .alch-scale dt small { font-size: var(--text-label); }
.toolview .limit-hero p { margin-top: 7px; }

/* Data workbenches: natural card heights, not three plates stretched to the
   window. The tallest one still sits inside the desktop screen. */
.toolview-data .data-name { font-size: var(--text-label); font-weight: var(--fw-regular); line-height: var(--leading-label); }

@media (max-width: 1180px) {
}

@media (max-width: 900px) {
}

@media (max-width: 620px) {
}

@media (max-height: 760px) {
  .toolview { --tool-pad: 12px 14px; }
  .toolview .tool-head { margin-bottom: 8px; }
  .toolview .tool-head h2,
  .toolview .tool-head h3 { font-size: var(--text-body); }
  .toolview .tool-input input,
  .toolview .tool-select { height: 34px; }
  .toolview .tool-check { min-height: 34px; }
  .toolview .tool-run { height: 38px; }
  .toolview .tool-actions { margin-top: 8px; }
  .toolview .tax-profit b,
  .toolview .alch-profit > b,
  .toolview .limit-hero b { font-size: var(--text-title); }
}

@media (max-width: 620px) and (max-height: 720px) {
  .toolview { --tool-pad: 10px 12px; }
  .toolview .tool-eyebrow { display: none; }
  .toolview .tool-head { margin-bottom: 7px; }
}

@media (prefers-reduced-motion: reduce) {
}
/* ==========================================================================
   Tools — the ruled workbench
   ==========================================================================
   Every calculator is one sheet, divided into zones by hairlines: inputs at
   the left, the answer beside them, the reference table at the right. The
   market's type scale and row rhythm carry across all eleven tools, and the
   sheet is a single frame instead of a stack of nested cards. */

html:has(.toolview),
body:has(.toolview) { overflow: hidden; overscroll-behavior: none; }

.shell[data-screen="tools"] .workspace {
  flex: 1 1 auto; display: flex; flex-direction: column;
  align-items: stretch; gap: 0; min-height: 0; overflow: hidden;
  padding-bottom: 16px;
}
.shell[data-screen="tools"] .col-main { display: contents; }
.shell[data-screen="tools"] .list-card {
  flex: 1 1 auto; min-height: 0; display: flex;
  padding: 0; border: 0; background: none; overflow: visible;
}
.shell[data-screen="tools"] #board {
  flex: 1 1 auto; display: flex; min-height: 0;
  padding: 0; border: 0; background: none; overflow: hidden;
}

.toolview {
  flex: 1 1 auto; display: flex; flex-direction: column;
  min-width: 0; min-height: 0; width: 100%;
}
.toolview-calc,
.toolview-hub {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); overflow: hidden;
}
.tool-top .hb-crumbs {
  margin: 0; color: var(--ink-4); font-size: var(--text-label); letter-spacing: 0;
}
.tool-top .hb-crumbs a { color: var(--ink-3); }
.tool-top .hb-crumbs a:hover { color: var(--accent); }

/* A tool's name is its heading. No kicker, no 01/02 index. */
.toolview .tool-eyebrow,
.toolview .tool-index { display: none; }
.toolview .tool-surface {
  min-width: 0; padding: 18px;
  border: 0; border-radius: 0; background: transparent;
  animation: none;
}
.toolview .tool-head {
  flex: 0 0 auto; align-items: flex-start;
  gap: 12px; padding: 0 0 14px; margin: 0;
  border: 0;
}
.toolview .tool-head h2,
.toolview .tool-head h3 {
  color: var(--ink); font-size: var(--text-body); font-weight: var(--fw-medium);
  letter-spacing: 0; line-height: var(--leading-heading);
}
.toolview .tool-head-note {
  flex: 0 0 auto; padding-top: 2px; color: var(--ink-4);
  font: var(--fw-regular) var(--text-body) var(--sans); line-height: var(--leading-label);
  text-align: right; white-space: nowrap;
}
.toolview .tool-field-head { gap: 5px; margin-bottom: 5px; }
.toolview .tool-field-head label,
.toolview .tool-field-label {
  color: var(--ink-2); font-size: var(--text-label); font-weight: var(--fw-regular);
  letter-spacing: 0; line-height: var(--leading-label);
}
.toolview .tool-field-note {
  color: var(--ink-4); font: var(--fw-medium) var(--text-label) var(--mono); line-height: var(--leading-label);
}
.toolview .tool-input input,
.toolview .tool-select {
  height: 36px; padding: 0 40px 0 9px;
  border: 1px solid var(--line); border-radius: 8px;
  outline: none; background: var(--bg-2); color: var(--ink);
  font: var(--fw-medium) var(--text-body) var(--mono); font-variant-numeric: tabular-nums;
  transition: border-color var(--t-quick), box-shadow var(--t-quick);
}
.toolview .tool-select { padding-right: 9px; font-family: var(--sans); font-weight: var(--fw-regular); font-size: var(--text-label); }
.toolview .tool-input input:hover,
.toolview .tool-select:hover { border-color: var(--line-strong); }
.toolview .tool-input input:focus,
.toolview .tool-select:focus {
  border-color: var(--accent-line); box-shadow: 0 0 0 2px var(--accent-soft);
}
.toolview .tool-input em { right: 9px; color: var(--ink-4); font: var(--fw-medium) var(--text-label) var(--mono); }
.toolview .tool-select option { background: var(--card); color: var(--ink); }
.toolview .tool-check {
  min-height: 36px; padding: 0 9px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg-2); color: var(--ink-2); font-size: var(--text-label);
}
.toolview .tool-check:hover { border-color: var(--line-strong); }
.toolview .tool-check b { font-size: var(--text-label); }
.toolview .tool-check small { font-size: var(--text-label); }
.toolview .tool-actions { gap: 8px; margin-top: 14px; }
.toolview .tool-run {
  height: 38px; padding: 0 12px; border-radius: 8px;
  font-size: var(--text-label); font-weight: var(--fw-medium);
}
.toolview .tool-run:hover { background: var(--accent-2); }
.toolview .tool-reset {
  height: 30px; padding: 0 10px; border-radius: 8px;
  color: var(--ink-3); font-size: var(--text-label);
}
.toolview .tool-reset:hover { border-color: var(--line-strong); color: var(--ink); }
.toolview .tool-hero-label {
  color: var(--ink-4); font: var(--fw-regular) var(--text-body) var(--sans);
  letter-spacing: 0; line-height: var(--leading-label); text-transform: none;
}
.toolview .tool-footnote {
  padding-top: 10px; margin: 12px 0 0;
  border-top: 1px solid var(--line-soft);
  color: var(--ink-4); font-size: var(--text-label); line-height: var(--leading-body);
}
.toolview .tool-col-title {
  padding: 0 0 6px; margin: 0 0 3px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-4); font: var(--fw-medium) var(--text-body) var(--sans);
  letter-spacing: 0; line-height: var(--leading-label); text-transform: none;
}
.toolview .tool-facts dt { color: var(--ink-3); font-size: var(--text-label); }
.toolview .tool-facts dd { font: var(--fw-medium) var(--text-body) var(--mono); }

/* The answer is the market's scale, not a display number. */
.toolview .data-answer > b,
.toolview .tax-profit b,
.toolview .alch-profit > b,
.toolview .limit-hero b {
  display: block; overflow: hidden; margin-top: 4px;
  color: var(--ink); font: var(--fw-medium) var(--text-title)/var(--leading-display) var(--sans);
  letter-spacing: 0; font-variant-numeric: tabular-nums;
  text-overflow: ellipsis; white-space: nowrap;
}
.toolview .data-answer > p,
.toolview .tax-profit p,
.toolview .alch-profit p,
.toolview .limit-hero p {
  margin-top: 7px; color: var(--ink-3);
  font-size: var(--text-label); line-height: var(--leading-label);
}

/* ---------------------------------------------------------------- data ---- */
.toolview .data-form .data-field-grid .tool-field-head label { font-size: var(--text-label); }
.toolview .data-form .data-field-grid .tool-input em { font-size: var(--text-label); }
.data-result .up { color: var(--up); }
.data-result .down { color: var(--down); }

/* The reference grid reads like the market board, only denser. */
/* The market board owns `th:first-child { width: 34px }`; the reference
   tables need their name column measured as a share of the table. */
.data-grid .up { color: var(--up); }
.data-grid .down { color: var(--down); }
.data-name,
.data-sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-name { color: var(--ink); font: var(--fw-regular) var(--text-body)/var(--leading-heading) var(--sans); }
/* A split loot table gives the drop its full name over two lines. The inline
   item name below it is the same fact, not a second one. */
.data-table-cols .data-name {
  display: -webkit-box; white-space: normal; line-height: var(--leading-heading);
  -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}

/* ------------------------------------------------------- tax / alch / limit -- */
.tax-desk,
.alch-desk,
.limit-desk {
  flex: 1 1 auto; min-height: 0; overflow: hidden;
  display: grid; grid-template-rows: minmax(0, 1fr);
  gap: 0; margin: 0;
}
.tax-desk { grid-template-columns: 320px minmax(0, 1fr); }
.alch-desk { grid-template-columns: 340px minmax(0, 1fr); }
.tax-receipt,
.alch-result,
.limit-result {
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  padding: 18px 20px 16px;
}
.tax-profit {
  grid-column: 1; grid-row: 1; min-width: 0;
  padding: 2px 24px 12px 0; border-right: 1px solid var(--line-soft);
}
.tax-receipt .tool-footnote { margin-top: auto; }
.alch-profit { display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: 4px 28px 12px 0; border-right: 1px solid var(--line-soft); }
.alch-verdict.up { border-color: rgba(115, 215, 165, .22); color: var(--up); background: rgba(115, 215, 165, .055); }
.alch-verdict.down { border-color: rgba(255, 133, 140, .3); color: var(--down); background: rgba(255, 133, 140, .055); }
.alch-gauge.over .alch-gauge-track > span { background: var(--down); }

/* ------------------------------------------------------------------ hub ---- */
.toolview-hub { display: flex; flex-direction: column; padding: 20px; overflow: hidden; }
.toolview-hub .tool-register { padding: 0; margin-top: 16px; }
.toolview-hub .tool-register .tool-head { padding-bottom: 10px; }
.toolview-hub .tool-row-go {
  display: flex; align-items: center; justify-content: flex-end;
  color: var(--accent); font-size: 0;
}
.toolview-hub .tool-row-go span { display: none; }.toolview-hub .tool-flow {
  padding: 0;
  margin-top: auto; border-top: 1px solid var(--line-soft); }
.toolview-hub .tool-flow .tool-head { padding: 12px 0 8px; }

/* The long explanation is an overlay, not a taller page. */

@media (max-width: 1180px) {
  .alch-desk { grid-template-columns: 300px minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .toolview-hub .tool-flow { display: none; }
}

@media (max-width: 760px) {
  .tax-desk,
  .alch-desk,
  .limit-desk {
    grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr);
  }
}

@media (max-width: 620px) {
  .toolview-calc,
  .toolview-hub { border-radius: 0; }
  .toolview .tool-surface { padding: 12px; }
  .toolview .tool-head { padding-bottom: 10px; }
  .toolview .tool-head h2,
  .toolview .tool-head h3 { font-size: var(--text-body); }
  .toolview .tool-head-note { display: none; }
  .data-answer > b,
  .tax-profit b,
  .alch-profit > b,
  .limit-hero b { font-size: var(--text-title); }
  .toolview-hub { padding: 14px; }
}

@media (max-height: 820px) {
  .toolview .tool-surface { padding: 14px 16px; }
  .toolview .tool-head { padding-bottom: 10px; }
  .toolview .tool-head h2,
  .toolview .tool-head h3 { font-size: var(--text-body); }
  .toolview .tool-field-head { margin-bottom: 4px; }
  .toolview .tool-input input,
  .toolview .tool-select { height: 34px; }
  .toolview .tool-check { min-height: 34px; }
  .data-answer > b,
  .tax-profit b,
  .alch-profit > b,
  .limit-hero b { font-size: var(--text-title); }
  .data-answer > p,
  .tax-profit p,
  .alch-profit p,
  .limit-hero p { margin-top: 5px; }
  .data-table-cols .data-name { font-size: var(--text-label); line-height: var(--leading-heading); }
  .toolview-hub { padding: 16px 18px; }
  .toolview-hub .tool-register { margin-top: 12px; }
  .toolview-hub .tool-flow { margin-top: 12px; }
}

@media (max-height: 700px) {
  .toolview .tool-footnote { display: none; }
  .toolview-hub .tool-flow { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .toolview .tool-run,
  .toolview .tool-reset,
  .toolview .tool-input input,
  .toolview .tool-select,
  .tool-row,
  .tool-flow-link { transition: none; }
}

@media (max-height: 820px) {
  .toolview-hub .tool-register { padding: 0; }
  .toolview-hub .tool-row { padding-top: 7px; padding-bottom: 7px; }
  .data-table-cols .data-name { font-size: var(--text-label); line-height: var(--leading-heading); }
}

@media (max-width: 620px) {
  .toolview-hub { padding: 12px; }
  .toolview-hub .tool-register { padding: 0; margin-top: 10px; }
  .toolview-hub .tool-row { padding: 7px 0; }
  .toolview-hub .tool-foot { display: none; }
  .tax-profit {
    grid-column: 1; grid-row: 1; padding: 0 14px 8px 0;
    border-right: 1px solid var(--line-soft); border-bottom: 0;
  }
  .tax-profit b { font-size: var(--text-heading); }
  .toolview-calc:has(form[action$="/kingdom-calculator"]) .data-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Reference tables sit inside the market board, whose generic cell rules are
   more specific than the surface defaults. These are the final table metrics. */
.data-table .data-name { font: var(--fw-regular) var(--text-body)/var(--leading-heading) var(--sans); }

@media (max-width: 620px) {
  .tax-profit {
    grid-column: 1; grid-row: 1; padding: 0 0 8px;
    border-right: 0; border-bottom: 1px solid var(--line-soft);
  }
}

/* A four-column split table has 294px per half at the widest desktop. Give
   quantities the space the decimals need, and keep values clear of the edge. */

@media (max-width: 620px) {
}

/* ---------------------------------------------------- tool icons and tones -- */
/* Each tool owns one accent. The tone is carried by the icon tile, category
   chip, section marks and hover state; the primary action stays the app accent. */
.tool-high-alch-calculator { --tool-tone: #f6bd3a; }
.tool-flip-optimizer { --tool-tone: #9cb3ff; }

.tool-icon {
  display: block; flex: 0 0 auto; width: 16px; height: 16px;
}
.tool-head-icon .tool-icon { width: 16px; height: 16px; }
.tool-hero-label .tool-icon { width: 13px; height: 13px; color: var(--tool-tone); }
.tool-col-title .tool-icon { width: 12px; height: 12px; color: var(--tool-tone); }
.tool-reset .tool-icon { width: 12px; height: 12px; }
.tool-more > summary .tool-icon { width: 13px; height: 13px; color: var(--tool-tone); }
.toolview-calc .tool-check input { accent-color: var(--tool-tone); }
.toolview-calc .tool-footnote { display: none; }

/* The register is now a row of tools, not a row of descriptions. */
.toolview-hub .tool-row {
  grid-template-columns: 30px minmax(0, 1fr) auto 16px;
  gap: 10px; padding: 11px 2px;
}
.tool-row-icon .tool-icon { width: 16px; height: 16px; }
.toolview-hub .tool-row-go { color: var(--tool-tone); }
.tool-row-go .tool-icon { width: 15px; height: 15px; transition: transform var(--t-quick); }
.toolview-hub .tool-row:hover {
  background: color-mix(in srgb, var(--tool-tone) 6%, var(--bg));
}
.toolview-hub .tool-row:hover .tool-row-icon {
  background: color-mix(in srgb, var(--tool-tone) 19%, transparent);
  border-color: color-mix(in srgb, var(--tool-tone) 42%, transparent);
}
.toolview-hub .tool-row:hover .tool-row-go .tool-icon { transform: translateX(2px); }
.tool-flow-icon .tool-icon { width: 15px; height: 15px; }
.tool-flow-link .tool-icon { color: var(--accent); }

@media (max-width: 620px) {
  .toolview-hub .tool-row {
    grid-template-columns: 28px minmax(0, 1fr) 16px;
    gap: 8px; padding: 7px 0;
  }
  .tool-row-icon .tool-icon { width: 15px; height: 15px; }
  .tool-head-icon .tool-icon { width: 14px; height: 14px; }
}

/* The tool surfaces have no secondary line under a row name either. */
.toolview-calc .data-sub { display: none; }

/* ---------------------------------------------------- shell and item marks -- */
/* A card's head is a label, not a paragraph: one icon tile in the card's tone
   beside the name, and the market's kicker gets the same mark. */
.filters-title { display: flex; align-items: center; gap: 7px; }
.iv-head .back {
  display: inline-grid; place-items: center; flex: 0 0 auto;
  width: 26px; height: 26px; border: 1px solid var(--line);
  border-radius: 6px; color: var(--ink-3);
}
.iv-head .back:hover { color: var(--ink); border-color: var(--line-strong); }

/* A sprite keeps a table row's identity without adding a second line: the
   icon sits on the name's baseline, and a split loot table gets a smaller
   copy so the figures keep their width. */
.data-item { display: flex; align-items: center; gap: 7px; min-width: 0; }
.tool-item-img {
  flex: 0 0 16px; width: 16px; height: 16px;
  border-radius: 3px; background: var(--field);
  image-rendering: pixelated; object-fit: contain;
}
.data-item .data-name {
  min-width: 0; overflow-wrap: anywhere;
}
.data-table-cols .tool-item-img { flex-basis: 14px; width: 14px; height: 14px; }
.data-table-cols .data-item { gap: 5px; }

@media (max-width: 620px) {
  .iv-head .back { width: 32px; height: 32px; }
}

/* A short laptop is the tightest split table: Hespori's sixteen-row half has
   to fit under 768px. The sprite adds a little width, which wraps a few more
   names onto a second line, so the rows give back the padding the second line
   needs rather than letting the last row leave the glass. */
@media (min-width: 901px) and (max-height: 780px) {
}

/* The hub is two working sheets, not a register with a footer stranded under a
   void: the register keeps the left, the four-step workflow keeps a rail on the
   right and anchors its way out to the bottom of that rail. */
.toolview-hub {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  grid-template-rows: auto minmax(0, 1fr);
  column-gap: 24px;
  align-items: stretch;
}
.toolview-hub .tool-hub-head { grid-column: 1 / -1; }
.toolview-hub .tool-register { grid-column: 1; grid-row: 2; }
.toolview-hub .tool-flow {
  grid-column: 2; grid-row: 2;
  margin-top: 16px; padding: 0 0 0 20px;
  border-top: 0; border-left: 1px solid var(--line-soft);
}
.toolview-hub .tool-flow .tool-head { padding: 0 0 10px; }
.toolview-hub .tool-register-list { grid-template-columns: minmax(0, 1fr); }
.toolview-hub .tool-flow-steps {
  display: flex; flex-direction: column; justify-content: space-between;
  flex: 1 1 auto; min-height: 0;
}
.toolview-hub .tool-flow-steps li {
  padding: 10px 0; border-left: 0; border-top: 1px solid var(--line-soft);
}
.toolview-hub .tool-flow-steps li:first-child { padding-top: 0; border-top: 0; }
.toolview-hub .tool-flow-link { margin-top: auto; }

@media (max-width: 900px) {
  .toolview-hub { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; }
  .toolview-hub .tool-register { grid-column: 1; grid-row: 2; }
  .toolview-hub .tool-flow { display: none; }
}

/* ==========================================================================
   Shell — global bar, workspace tabs, notification sheet
   ==========================================================================
   The desk keeps the site's destinations in one bar across the top. The
   open-item tabs are a second, quieter line: documents on the desk, not more
   destinations. The phone keeps the destinations in its bottom bar and gives
   the workspace tabs the line under the search. */

:root {
  --topbar-h: 60px;
  --strip-h: 40px;
  --nav-h: 56px;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: var(--topbar-h) minmax(0, 1fr);
  height: 100dvh;
  min-height: 0;
}

.main {
  grid-column: 1;
  grid-row: 2;
  min-height: 0;
}

/* --------------------------------------------------------------- topbar --- */
.topbar {
  position: relative;
  z-index: 80;
  grid-column: 1;
  grid-row: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  height: var(--topbar-h);
  /* The bar keeps the full width of the glass, and its contents sit on the
     page column below: the brand starts with the board and the account mark
     ends with it, with the workspace's scrollbar lane reserved on the right. */
  padding: 0 calc(var(--page-pad) + var(--shell-gutter, 0px)) 0 var(--page-pad);
  background: var(--bg);
  border-bottom: 1px solid var(--line-soft);
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  margin: 0;
  color: var(--ink);
  text-decoration: none;
}
.topbar-brand .brand-mark { width: 30px; height: 30px; }
.brand-word {
  font-family: var(--sans);
  font-size: var(--text-body);
  font-weight: var(--fw-medium);
  line-height: 1;
  letter-spacing: 0;
}

@media (min-width: 621px) {
.topbar .rail {
  flex: 0 1 auto;
  width: auto;
  height: auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  padding: 0;
  background: transparent;
  border: 0;
  z-index: auto;
}
.topbar .rail-switch {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 2px;
  width: auto;
}
.topbar .rail-tab {
  position: relative;
  width: auto;
  height: 34px;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-3);
  font-size: var(--text-label);
  font-weight: var(--fw-medium);
  line-height: 1;
  white-space: nowrap;
}
.topbar .rail-tab svg { display: none; }
.topbar .rail-tab > .rail-caret {
  display: block;
  width: 10px;
  height: 7px;
  margin-left: 4px;
}
.topbar .rail-lbl {
  display: block;
  font-size: var(--text-label);
  font-weight: var(--fw-medium);
  line-height: 1;
  letter-spacing: 0;
}
.topbar .rail-tab:hover { color: var(--ink); background: var(--hover); }
.topbar .rail-tab[aria-pressed="true"],
.topbar .rail-tab[aria-current="page"] {
  color: var(--ink);
  background: transparent;
}
.topbar .rail-tab[aria-pressed="true"]::after,
.topbar .rail-tab[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.topbar .rail-you { display: none; }
.topbar .rail-badge {
  top: 1px;
  right: 1px;
  min-width: 14px;
  height: 14px;
  padding: 0 4px;
}

.topbar .rail-tools {
  position: relative;
  width: auto;
  display: block;
  flex: 0 0 auto;
}
.topbar .rail-tools > summary { width: auto; }
.topbar .rail-tools[open] > summary {
  color: var(--ink);
  background: var(--hover);
}
}

/* ---------------------------------------------------------- topbar tools --- */
.topbar-tools {
  display: flex;
  align-items: center;
  gap: 7px;
  justify-self: end;
  min-width: 0;
}
.topbar .ph-search {
  flex: 0 1 320px;
  width: 320px;
  height: 36px;
  padding: 0 8px 0 3px;
  gap: 0;
  border-radius: 8px;
  background: var(--card);
}
.topbar .search-mark {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}
.topbar .ph-search input { font-size: var(--text-label); }
.topbar .tb-bell {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-3);
}
.topbar .tb-bell:hover { background: var(--hover); color: var(--ink); }
.topbar .rail-foot {
  margin: 0;
  width: auto;
  display: flex;
  flex-direction: row;
}
.topbar .rail-marks {
  display: flex;
  flex-direction: row;
  gap: 5px;
  width: auto;
}
.topbar .rail-marks .acct {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}
.topbar .rail-marks .acct .rail-lbl { display: none; }

/* --------------------------------------------------------- workspace bar --- */
.page-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  height: var(--strip-h);
  min-height: var(--strip-h);
  padding: 0 calc(var(--page-pad) + var(--shell-gutter, 0px)) 0 var(--page-pad);
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg);
  width: 100%;
}
.shell .page-head:not(.ph-pane):not(:has(.tb-pages:not([hidden]))) { display: none; }

.page-head.ph-pane .ph-copy { display: block; }
.page-head .ph-copy h1 { font-size: var(--text-title); }
.ph-back {
  order: -1;
  width: 30px;
  height: 30px;
}

.topbar .page-head { width: auto; }

.tb-pages {
  order: 1;
  flex: 1 1 auto;
  height: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 0;
}
.tb-pages[hidden] { display: none; }
.tb-pages::-webkit-scrollbar { display: none; }
.tb-pages.can-drag,
.tb-pages.can-drag .tb-page,
.tb-pages.can-drag .tb-page-open { cursor: grab; }
.tb-pages.can-drag .tb-page-x { cursor: pointer; }
.tb-pages.dragging,
.tb-pages.dragging .tb-page,
.tb-pages.dragging button { cursor: grabbing; user-select: none; -webkit-user-select: none; }
.tb-pages.more {
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent);
}

.tb-page {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 30px;
  padding: 0 2px 0 7px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  flex: 0 0 auto;
  max-width: 210px;
}
.tb-page:hover { border-color: var(--line); background: var(--card); }
.tb-page.on {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
.tb-page-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 3px 3px;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  font-size: var(--text-label);
}
.tb-page.on .tb-page-open { color: var(--ink); }
.tb-page-open img { width: 16px; height: 16px; object-fit: contain; }
.tb-page-nm {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tb-page-x {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-4);
  cursor: pointer;
  font-size: var(--text-body);
}
.tb-page-x:hover { background: var(--field-2); color: var(--ink); }

.tb-all {
  order: 2;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 36px;
  height: 30px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
}
.tb-all:hover { border-color: var(--line-strong); background: var(--card); color: var(--ink); }
.tb-all[hidden] { display: none; }
.tb-all-count {
  font-family: var(--mono);
  font-size: var(--text-label);
  font-weight: var(--fw-medium);
  line-height: 1;
  color: var(--ink-3);
}
.tb-all:hover .tb-all-count { color: var(--ink); }

/* --------------------------------------------------------------- menu --- */
.items-menu {
  width: 280px;
  max-height: min(60vh, 460px);
  z-index: 110;
}
.items-head {
  padding: 7px 8px 8px;
  color: var(--ink-4);
  font-size: var(--text-label);
  font-weight: var(--fw-medium);
}
.items-menu .items-row { min-height: 34px; }
.items-menu .items-open { font-size: var(--text-label); }
.items-menu .items-x { width: 28px; height: 28px; }
.items-menu .items-x:hover { background: var(--field-2); color: var(--ink); }

/* --------------------------------------------------------- notification --- */
#notif-drawer {
  position: fixed;
  top: var(--topbar-h);
  right: 0;
  bottom: 0;
  left: auto;
  width: 380px;
  max-height: none;
  z-index: 120;
  border: 0;
  border-left: 1px solid var(--line-strong);
  border-radius: 0;
  background: var(--card);
  box-shadow: none;
}
#notif-drawer .nd-head { min-height: 56px; padding: 0 16px; }
#notif-drawer .nd-head h2 { font-size: var(--text-body); font-weight: var(--fw-medium); }
#notif-drawer .nd-body { padding: 8px 10px; }
#notif-drawer .nd-foot { padding: 10px 12px; }

/* The drawer is no longer a floating card from the rail; it is the right-hand
   record, and it begins where the topbar ends. The same edge on a phone is the
   bottom of the screen, above the thumb bar. */

/* ----------------------------------------------------------- drawer offset --- */
.shell > .facets:not(.inline) {
  top: var(--pane-top, calc(var(--topbar-h) + 8px));
  bottom: auto;
  left: var(--pane-left, var(--page-pad));
  width: min(336px, calc(100vw - 24px));
  max-height: min(72dvh, calc(100dvh - var(--pane-top, 68px) - 8px));
}
/* The rail panes are dropdowns, not the old drawer: keep the compact card's
   width and its room under the topbar where this later shell rule would
   otherwise restore the drawer's 336px. The phone's inline pane is excluded. */
@media (min-width: 621px) {
  .shell > .facets.nav-dropdown:not(.inline) {
    width: min(300px, calc(100vw - 24px));
    max-height: min(70dvh, calc(100dvh - 24px - var(--topbar-h, 60px)));
  }
}
.shell > .scrim {
  inset: var(--topbar-h) 0 0 0;
}

@media (min-width: 1081px) {
  .shell .page-head,
  .shell.item-view .page-head {
    display: flex;
    grid-template-columns: none;
    column-gap: normal;
  }
  .shell .page-head .tb-pages,
  .shell.item-view .page-head .tb-pages { grid-column: auto; }
  .shell.item-view .ph-back { grid-column: auto; }
  .shell.item-view .page-head .ph-actions { grid-column: auto; }
  .shell[data-screen="tools"] .page-head:has(.tb-pages:not([hidden])) {
    height: var(--strip-h);
    min-height: var(--strip-h);
    flex-wrap: nowrap;
    padding-top: 0;
    padding-bottom: 0;
    row-gap: 0;
  }
  .shell[data-screen="tools"] .page-head:has(.tb-pages:not([hidden])) .tb-pages {
    order: 1;
    flex: 1 1 auto;
    min-width: 0;
  }
}

@media (min-width: 621px) and (max-width: 1120px) {
  .topbar { gap: 14px; }
  .topbar .ph-search { flex-basis: 240px; width: 240px; }
  .topbar .rail-tab { padding: 0 8px; }
}
@media (min-width: 621px) and (max-width: 900px) {
  .topbar-brand { display: none; }
  .topbar { gap: 10px; }
  .topbar .ph-search { flex-basis: 170px; width: 170px; }
  .topbar .rail-tab { padding: 0 6px; }
}

@media (max-width: 620px) {
  :root { --strip-h: 44px; }
  .topbar {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 0 12px;
  }
  .topbar-brand { display: none; }
  .topbar-tools { width: 100%; gap: 8px; }
  .topbar .ph-search {
    flex: 1 1 auto;
    width: auto;
    height: 40px;
  }
  .topbar .tb-bell { width: 40px; height: 40px; }
  .topbar .rail-foot { display: none; }
  .topbar .rail-marks { display: none; }

  .shell .page-head,
  .shell .page-head:has(.tb-pages:not([hidden])),
  .shell[data-screen="tools"] .page-head,
  .shell[data-screen="tools"] .page-head:has(.tb-pages:not([hidden])) {
    height: var(--strip-h);
    min-height: var(--strip-h);
    flex-wrap: nowrap;
    gap: 6px;
    padding: 0 12px;
  }
  .ph-back { width: 36px; height: 36px; }
  .tb-page { height: 32px; max-width: 170px; }
  .tb-all { height: 32px; }
  .tb-pages { padding: 5px 0; }
  /* The old phone rule made the strip a second full-width row. It is one row
     with the back button now; the strip grows into the room instead, and the
     overflow control stays at its trailing edge. */
  .shell .page-head #tb-pages {
    order: 1;
    flex: 1 1 0;
    width: auto;
  }
  .shell .page-head #items-all { order: 2; }

  /* The inline pane carries its own "Watchlists" header; the page head on a
     phone is the open-item strip. The h1 stays available to a screen reader
     through the phone rule above, but it is not drawn beside the tabs. */

  .main { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); }
  .shell > .facets:not(.inline) {
    top: var(--topbar-h);
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
    left: 0;
    width: 88vw;
  }
  .shell > .scrim {
    inset: var(--topbar-h) 0 calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)) 0;
  }
  .shell > .facets.inline {
    top: calc(var(--topbar-h) + var(--strip-h));
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  }
  #notif-drawer {
    top: var(--topbar-h);
    left: 0;
    right: 0;
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
    width: auto;
    border-left: 0;
    border-top: 1px solid var(--line-strong);
  }
  #items-menu {
    left: 12px;
    right: 12px;
    top: auto !important;
    bottom: calc(var(--nav-h) + 10px);
    width: auto;
    max-height: min(60dvh, 460px);
    border-radius: 12px;
  }
  .items-menu .items-x { width: 44px; height: 44px; }
  .items-menu .items-row { min-height: 44px; }
}

@media (min-width: 1181px) {
  .shell.item-view #board {
    height: calc(100dvh - var(--topbar-h) - var(--strip-h));
  }
}

/* ==========================================================================
   Item page — the night ledger
   ==========================================================================
   The item is a live exchange record, not a second list. Its workspace shares
   the site's night ground, so the page reads as one instrument from topbar to
   tape. The old quote strip moves into the live statistics grid, so the masthead can
   carry one huge mid price and one set of actions. Cards stop at the chart
   instrument: statistics, performance and the tape are ruled sections on the
   ground, not a stack of plates. */

/* The item workspace now inherits the site's night ground; only its
   composition - masthead, chart instrument and ruled ledger - is item-specific. */
.shell.item-view .workspace { background: var(--bg); }
:root:has(.shell.item-view) .chart-wrap.full {
  background: var(--card);
  border-color: var(--line);
}
.shell.item-view .workspace ::selection {
  background: var(--accent); color: var(--on-accent);
}

.shell.item-view .itemview {
  display: block;
  padding: 0 0 10px;
  color: var(--ink);
}

/* The app's own wait for an item. The server's article is the page for a reader
   without scripts; a scripted browser gets the server's skeleton in front of it
   and then this same skeleton once the app reads the item. It reserves the
   masthead and chart instead of showing the SEO facts table through the fetch. */
.shell.item-view .item-loading { display: block; padding: 0 0 10px; }
.shell.item-view .il-head {
  display: flex; align-items: center; gap: 16px;
  padding: 22px 0 20px;
}
.shell.item-view .il-icon {
  flex: 0 0 56px; width: 56px; height: 56px;
  border: 1px solid var(--line); border-radius: 6px;
  background: #15181c;
}
.shell.item-view .il-copy { display: grid; gap: 10px; flex: 1 1 auto; min-width: 0; }
.shell.item-view .il-name {
  width: min(220px, 40vw); height: 18px; border-radius: 4px;
}
.shell.item-view .il-examine {
  width: min(340px, 55vw); height: 9px; border-radius: 4px;
}
.shell.item-view .il-quote {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.shell.item-view .il-cell {
  display: grid; gap: 8px; padding: 12px 18px 13px 0;
}
.shell.item-view .il-cell + .il-cell {
  padding-left: 18px; border-left: 1px solid var(--line);
}
.shell.item-view .il-k { width: 30px; height: 7px; border-radius: 3px; }
.shell.item-view .il-v { width: 68px; height: 15px; border-radius: 3px; }
.shell.item-view .il-skel {
  background: var(--field-2);
  animation: il-breathe 1.5s ease-in-out infinite alternate;
}
.shell.item-view .il-chart {
  display: grid; place-items: center;
  height: clamp(420px, 52vh, 560px); min-height: 400px;
  margin-top: 18px; overflow: hidden;
  border: 1px solid var(--line); border-radius: 8px;
  background: #0b0c0e;
}
.shell.item-view .il-state {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  color: var(--ink-3); font-size: var(--text-label);
}
.shell.item-view .il-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  animation: il-pulse 1.4s ease-in-out infinite;
}
@keyframes il-breathe {
  from { opacity: .5; }
  to { opacity: .95; }
}
@keyframes il-pulse {
  0%, 100% { opacity: .35; transform: scale(.9); }
  50% { opacity: 1; transform: scale(1); }
}
@media (min-width: 1181px) {
  .shell.item-view .il-chart {
    height: clamp(460px, 54vh, 620px); min-height: 440px;
  }
}
@media (max-width: 860px) {
  .shell.item-view .il-chart { height: 340px; min-height: 340px; }
}
@media (max-width: 620px) {
  .shell.item-view .il-head { padding: 16px 0; }
  .shell.item-view .il-icon { flex-basis: 44px; width: 44px; height: 44px; }
  .shell.item-view .il-quote { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shell.item-view .il-cell { padding: 10px 12px 11px 0; }
  .shell.item-view .il-cell + .il-cell {
    padding-left: 0; border-left: 0;
  }
  .shell.item-view .il-cell:nth-child(even) {
    padding-left: 12px; border-left: 1px solid var(--line);
  }
  .shell.item-view .il-cell:nth-child(n + 3) { border-top: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) {
  .shell.item-view .il-skel,
  .shell.item-view .il-dot { animation: none; }
}
.shell.item-view .iv-head {
  padding: 22px 0 20px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}
.shell.item-view .iv-top {
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 16px;
}
.shell.item-view .iv-head .ico-lg,
.shell.item-view .iv-head > img {
  width: 56px; height: 56px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #15181c;
}
.shell.item-view .iv-head .ico-lg img {
  inset: 7px;
  width: calc(100% - 14px); height: calc(100% - 14px);
}
.shell.item-view .iv-id { min-width: 260px; }
.shell.item-view .iv-title h2 {
  font-family: var(--sans);
  font-size: var(--text-title);
  font-weight: var(--fw-display);
  letter-spacing: var(--track-display);
  line-height: 1.08;
  overflow-wrap: anywhere;
}
.shell.item-view .examine {
  max-width: 62ch;
  margin-top: 6px;
  color: var(--ink-4);
  font-size: var(--text-label);
  line-height: 1.45;
}
.shell.item-view .ix-head-side {
  display: flex;
  flex: 0 1 auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  max-width: 58%;
  margin-left: auto;
}
.shell.item-view .iv-acts { justify-content: flex-end; gap: 6px; }
.shell.item-view .iv-btn {
  height: 32px;
  padding: 0 10px;
  border-radius: 4px;
  border-color: var(--line);
  background: transparent;
  color: var(--ink-3);
}
.shell.item-view .iv-btn:hover {
  border-color: var(--line-strong);
  background: var(--field);
  color: var(--ink);
}
.shell.item-view .iv-btn.on {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}
/* The masthead is the page's one oversized number. The label is the price's
   context, not a kicker; the actions live at the other edge. */
.ix-change {
  color: var(--ink-2);
  font-weight: var(--fw-medium);
  font-variant-numeric: tabular-nums;
}
.ix-change.up { color: var(--up); }
.ix-change.down { color: var(--down); }

/* Section headings are text, not a second masthead. The right-hand reading says
   which window the figures below answer. */
.shell.item-view .ix-section {
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.shell.item-view .ix-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 17px;
}
.shell.item-view .ix-section-head :is(h2, h3) {
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(1.125rem, 1.8vw, 1.375rem);
  font-weight: var(--fw-medium);
  letter-spacing: -.012em;
  line-height: 1.15;
}
.ix-sec-meta {
  color: var(--ink-4);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0;
  line-height: 1.35;
  text-align: right;

}

/* The chart is the one framed instrument on the ground. The frame keeps the
   controls and the SVG one object; the rest of the page is ruled, not plated. */
.shell.item-view .iv-grid { display: block; min-height: 0; }
.shell.item-view .iv-main { display: block; min-height: 0; }
.shell.item-view .chart-wrap {
  display: block;
  min-height: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b0c0e;
  box-shadow: none;
}
.shell.item-view .chart-wrap.full {
  position: fixed;
  inset: 0;
  z-index: 90;
  margin: 0;
  padding: 12px;
  border-radius: 0;
  border: 0;
}
.shell.item-view .chart-top { margin-bottom: 10px; }
.shell.item-view .chart {
  width: 100%;
  height: 360px;
  min-height: 320px;
  flex: none;
}
.shell.item-view .chart.chart-margin { height: 96px; min-height: 96px; flex: none; }
.shell.item-view .chart-wrap.full .chart { height: auto; min-height: 0; flex: 1 1 auto; }
.shell.item-view .chart-wrap.full .chart.chart-margin { height: 96px; min-height: 96px; flex: 0 0 96px; }
:root:has(.shell.item-view) .chart-wrap.full .chart { height: auto; min-height: 0; flex: 1 1 auto; }
:root:has(.shell.item-view) .chart-wrap.full .chart.chart-margin { height: 96px; min-height: 96px; flex: 0 0 96px; }
.shell.item-view .chart-wrap.chart-empty .chart { height: 150px; min-height: 150px; }

/* The live grid is four clear columns of readings. The top rule on each cell
   makes the rows scan across; nothing is boxed. */
.shell.item-view .ix-stats { margin-top: 2px; }
.shell.item-view .ix-stat-grid,
.shell.item-view .ix-perf-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: 26px;
  row-gap: 22px;
  margin: 0;
}
.shell.item-view .ix-stat,
.shell.item-view .ix-perf-cell {
  min-width: 0;
  padding-top: 11px;
  border-top: 1px solid var(--line-soft);
}
.shell.item-view .ix-stat dt,
.shell.item-view .ix-perf-cell dt {
  color: var(--ink-4);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: var(--fw-regular);
  line-height: 1.2;
}
.shell.item-view .ix-stat dt span {
  margin-left: 4px;
  color: var(--ink-3);
  font-size: 11px;
}
.shell.item-view .ix-stat dd,
.shell.item-view .ix-perf-cell dd {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 7px;
  margin: 5px 0 0;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 17px;
  font-weight: var(--fw-medium);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.shell.item-view .ix-buy { color: var(--up); }
.shell.item-view .ix-sell { color: var(--down); }
.shell.item-view .ix-stat dd .q-pct {
  color: var(--ink-4);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: var(--fw-regular);
}
.shell.item-view .ix-stat dd .q-pct:empty { display: none; }
.shell.item-view .ix-stat dd .q-pct.up,
.shell.item-view .ix-stat dd .up { color: var(--up); }
.shell.item-view .ix-stat dd .q-pct.down,
.shell.item-view .ix-stat dd .down { color: var(--down); }


/* The performance delta is the section's headline; the four facts follow.
   The old range marker repeated Low and High and earned no row of its own. */
.shell.item-view .ix-performance { margin-top: 26px; }
.shell.item-view .ix-perf-summary {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}
.shell.item-view .ix-perf-change {
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 17px;
  font-weight: var(--fw-medium);
  letter-spacing: -.01em;
  line-height: 1;
  text-transform: none;
  font-variant-numeric: tabular-nums;
}
.shell.item-view .ix-perf-change.up { color: var(--up); }
.shell.item-view .ix-perf-change.down { color: var(--down); }

/* The tape is a record, not a card. The time cell carries the bucket and its
   age; the four figures keep their own columns all the way down. */
/* The tape's caption is visually hidden but absolutely positioned. With the
   item's wrappers flattened it had no boxed positioned ancestor, so it fell
   back to the initial containing block and stretched the root's scroll height
   to its static place at the end of the tape - a second scrollbar beside the
   workspace's. The tape's scroll box is its containing block. */
.shell.item-view .ix-tape-scroll { position: relative; }

.shell.item-view .ix-tape { margin-top: 26px; padding-bottom: 0; }
.shell.item-view .ix-tape-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  font-variant-numeric: tabular-nums;
  table-layout: fixed;
  display: table;
}
/* The board's phone table is a card list: every row is a block and its cells
   grow labels down the side. The tape is a real record and keeps its columns
   at every width, so it resets those board-only rules down to the display
   role and removes the injected labels. */
.shell.item-view .ix-tape-table thead { display: table-header-group; }
.shell.item-view .ix-tape-table tbody { display: table-row-group; }
.shell.item-view .ix-tape-table tr {
  display: table-row;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.shell.item-view .ix-tape-table th,
.shell.item-view .ix-tape-table td {
  display: table-cell;
  min-height: 0;
  border-radius: 0;
  background: transparent;
}
.shell.item-view .ix-tape-table th::before,
.shell.item-view .ix-tape-table td::before,
.shell.item-view .ix-tape-table th::after,
.shell.item-view .ix-tape-table td::after {
  content: none !important;
  display: none !important;
}
.shell.item-view .ix-tape-table th {
  /* The board's header sticks inside its own scrolling body; this page scrolls
     the document, where the same rule parks the tape's header under the top
     bar. The tape is a short record, so its head is ordinary table furniture. */
  position: static;
  z-index: auto;
  padding: 0 10px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-4);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: var(--fw-regular);
  line-height: 1.2;
  text-align: right;
  white-space: nowrap;
}
.shell.item-view .ix-tape-table th:first-child {
  width: 92px;
  padding-left: 0;
  text-align: left;
}
.shell.item-view .ix-tape-table th:last-child,
.shell.item-view .ix-tape-table td:last-child { padding-right: 0; }
.shell.item-view .ix-tape-table td {
  padding: 10px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.2;
  text-align: right;
  white-space: nowrap;
}
.shell.item-view .ix-tape-table td:first-child {
  padding-left: 0;
  text-align: left;
  white-space: normal;
}
.shell.item-view .ix-tape-table tbody tr:last-child td { border-bottom: 0; }
.shell.item-view .ix-tape-time time {
  display: block;
  color: var(--ink-2);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.shell.item-view .ix-tape-time span {
  display: block;
  margin-top: 3px;
  color: var(--ink-4);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.25;
}
.shell.item-view .ix-tape-buy { color: var(--up); }
.shell.item-view .ix-tape-sell { color: var(--down); }
.shell.item-view .ix-tape-qty { color: var(--ink-3); }
.shell.item-view .ix-tape-empty {
  padding: 22px 0 !important;
  color: var(--ink-4) !important;
  font-family: var(--sans) !important;
  font-size: 12px !important;
  text-align: left !important;
}

.shell.item-view .col-main { gap: 0; }

/* The fill estimate, read after its tape rather than in a side column. */
.ix-readings { display: none; }
.shell.item-view .ix-readings { display: block; }
.shell.item-view:not(:has(#board .itemview:not(.ssr))) .ix-readings { display: none; }
.reading-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  max-width: 560px;
  row-gap: 30px;
}
.shell.item-view .reading-grid > .reading-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.shell.item-view .reading-grid .fill-body { flex: 1; }
.shell.item-view .reading-grid .card-lock { flex: 1; justify-content: space-between; gap: 13px; }
.reading-grid .card-head { margin-bottom: 10px; }
.reading-grid .card-head h3 {
  margin: 0;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: var(--fw-regular);
  letter-spacing: 0;
  line-height: var(--leading-label);
}
.reading-grid .card-lock p { max-width: 39ch; }
.reading-grid .fill-top-copy { max-width: 34ch; margin-right: auto; }
@media (max-width: 760px) {
  .reading-grid { row-gap: 28px; }
}

/* The calculator and the pressure card join the readings as flat blocks. The
   ticket keeps its own controls; only its card frame is gone. */
.shell.item-view .reading-grid > .calc-card,
.shell.item-view .reading-grid > .press-card { display: flex; }
.shell.item-view .reading-grid .calc-card .card-head,
.shell.item-view .reading-grid .press-card .card-head { margin-bottom: 10px; }
.shell.item-view .reading-grid .calc-card .tool { gap: 9px; }
.shell.item-view .reading-grid .calc-card .calc-plate { padding: 9px 10px; }
.shell.item-view .reading-grid .calc-card .calc-plan { margin-top: 2px; }
.shell.item-view .reading-grid .press-body { gap: 10px; }
.shell.item-view .reading-grid .press-tape { height: 26px; }

/* The item page is one document across the page: the board scrolls with it
   rather than in a column of its own. */
@media (min-width: 1081px) {
  .shell.item-view #board { height: auto; overflow: visible; }
  .shell.item-view .list-card {
    display: block;
    flex: none;
    min-height: 0;
  }
  .shell.item-view .board-body {
    display: block;
    flex: none;
    overflow: visible;
  }
  .shell.item-view .itemview { flex: none; }
  .shell.item-view .iv-grid,
  .shell.item-view .iv-main,
  .shell.item-view .chart-wrap { display: block; flex: none; }
  .shell.item-view .chart-wrap { min-height: 0; }
  .shell.item-view .chart { flex: none; }
  .shell.item-view .col-side { max-height: 100%; }
}

@media (max-width: 860px) {
  .shell.item-view .iv-head { padding-top: 18px; }
  .shell.item-view .iv-head .ico-lg,
  .shell.item-view .iv-head > img { width: 48px; height: 48px; }
  .shell.item-view .iv-head .ico-lg img { inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); }
  .shell.item-view .ix-price { font-size: clamp(2.5rem, 6.5vw, 3.1rem); }
  .shell.item-view .ix-stat-grid,
  .shell.item-view .ix-perf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; }
  .shell.item-view .chart { height: 300px; min-height: 300px; }
}

@media (max-width: 620px) {
  .shell.item-view .itemview { padding-bottom: 4px; }
  .shell.item-view .iv-head { padding: 16px 0 16px; }
  .shell.item-view .iv-top { gap: 10px 12px; }
  .shell.item-view .iv-id { min-width: 0; flex: 1 1 0; }
  .shell.item-view .iv-title h2 { font-size: 1.5rem; }
  .shell.item-view .examine { max-width: none; margin-top: 4px; font-size: 12px; }
  .shell.item-view .ix-head-side {
    order: 4;
    width: 100%;
    max-width: none;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 2px 0 0;
  }
  .shell.item-view .iv-acts { width: auto; flex: 1 1 auto; justify-content: flex-start; gap: 5px; }
  .shell.item-view .iv-btn { height: 34px; padding: 0 9px; font-size: 12px; }
  .shell.item-view .ix-price { font-size: clamp(2.5rem, 11vw, 3rem); }
  .shell.item-view .ix-price-unit { font-size: 11px; }
  .shell.item-view .ix-hero-sub { margin-top: 8px; font-size: 12px; }
  .shell.item-view .ix-section { padding-top: 22px; }
  .shell.item-view .ix-section-head { gap: 10px; margin-bottom: 15px; }
  .shell.item-view .ix-section-head :is(h2, h3) { font-size: 18px; }
  .ix-sec-meta { font-size: 11px; letter-spacing: 0; }
  .shell.item-view .chart-wrap { padding: 10px; border-radius: 8px; }
  .shell.item-view .chart { height: 280px; min-height: 280px; }
  .shell.item-view .chart-top { margin-bottom: 8px; }
  .shell.item-view .ix-stat-grid,
  .shell.item-view .ix-perf-grid { column-gap: 14px; row-gap: 18px; }
  .shell.item-view .ix-stat dd,
  .shell.item-view .ix-perf-cell dd { margin-top: 4px; font-size: 15px; }
  .shell.item-view .ix-stat dt,
  .shell.item-view .ix-perf-cell dt { font-size: 12px; }
  .shell.item-view .ix-stat dt span { display: block; margin: 2px 0 0; font-size: 11px; }
  .shell.item-view .ix-performance { margin-top: 0; }
  .shell.item-view .ix-tape { margin-top: 0; }
  .shell.item-view .ix-tape-table th {
    padding: 0 4px 8px;
    font-size: 11px;
  }
  .shell.item-view .ix-tape-table th:first-child { width: 68px; }
  .shell.item-view .ix-th-long { display: none; }
  .shell.item-view .ix-tape-table td {
    padding: 9px 4px;
    font-size: 11px;
  }
  .shell.item-view .ix-tape-table td:first-child { padding-left: 0; }
  .shell.item-view .ix-tape-time time { font-size: 11px; }
  .shell.item-view .ix-tape-time span { margin-top: 2px; font-size: 11px; }
}

/* At the smallest phone the section heading and its window note each need a
   line of their own; side by side, both wrap and the heading loses its edge. */
@media (max-width: 360px) {
  .shell.item-view .ix-section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .ix-sec-meta { text-align: left; }
}


/* The navigation panes are anchored menus, not modal drawers: the page head
   and the open-item strip remain live while one is up. The panel's height is
   its content up to the room below the strip, so an empty watchlist does not
   become a full-height wall. */
@media (min-width: 621px) {
  .facets:not(.inline) .rail-body { height: auto; max-height: inherit; }
  .facets:not(.inline) .rail-pane { min-height: 0; }
}
.rail-pane:focus { outline: none; }
.pane-close {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  padding: 0;
  border: 0; border-radius: 7px;
  background: transparent; color: var(--ink-4);
  cursor: pointer;
}
.pane-close:hover { color: var(--ink); background: var(--field); }
.pane-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pane-close svg { width: 14px; height: 14px; }
@media (max-width: 620px), (pointer: coarse) {
  .pane-close { width: 44px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .topbar, .page-head, #notif-drawer { transition: none; }
}

/* ==========================================================================
   Command scope — the item chart is the page's instrument
   ==========================================================================
   The plot leaves its card. The controls ride above the full-width field.
   Only the item chart wears `.chart-command`; the market and pricing charts keep
   their own frames. */
.shell.item-view .chart-command {
  position: relative;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.shell.item-view .chart-command .chart-top { margin: 0 0 10px; padding: 0; }
.shell.item-view .chart-command .chart {
  width: 100%;
  height: clamp(420px, 52vh, 560px);
  min-height: 400px;
  flex: none;
}


@media (min-width: 1181px) {
  .shell.item-view .chart-command {
    /* The rail owns its band instead of sitting over the price line. The chart
       starts below it, so a high wick cannot disappear under the controls. The
       band is exactly the toolbar: 33px of controls and its bottom hairline.
       It opens under the quote strip, with no margin above it. */
    padding-top: 34px;
  }
  .shell.item-view .chart-command .chart-top {
    position: absolute;
    top: 0; left: 0; right: 0; z-index: 4;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    margin: 0;
  }
  .shell.item-view .chart-command::before {
    content: "";
    position: absolute; top: 0; left: 0; right: 0; height: 70px;
    z-index: 3;
    pointer-events: none;
    background: linear-gradient(180deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 76%, transparent) 58%, transparent 100%);
  }
  .shell.item-view .chart-command .chart {
    height: clamp(400px, 48vh, 560px);
    min-height: 380px;
  }
}

@media (max-width: 860px) {
  .shell.item-view .chart-command .chart { height: 300px; min-height: 300px; }
}

@media (max-width: 620px) {
  .shell.item-view .chart-command .chart { height: 300px; min-height: 300px; }
}

.chart-command.full {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 12px;
  border: 0;
  border-radius: 0;
  background: var(--bg);
  box-shadow: none;
}
.chart-command.full .chart-top {
  position: static;
  top: auto; left: auto; right: auto;
  z-index: auto;
  margin: 0 0 10px;
  flex: 0 0 auto;
}
.chart-command.full::before { display: none; }
.chart-command.full .chart {
  margin-top: 0;
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}

/* ==========================================================================
   Item workspace — the record and its ticket rail
   ==========================================================================
   The item is one record: masthead and chart, the ledger beneath, and the
   ticket rail beside them at desk width. Only this surface flattens the board
   column and the side column, so the market screen keeps its grid. */

/* The item page is a document: the window owns the scrollbar, and the
   workspace is the record's full height rather than a viewport inside it. */
.shell.item-view {
  height: auto;
  min-height: 100dvh;
  grid-template-rows: var(--topbar-h) auto;
}
.shell.item-view .workspace {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: visible;
  scrollbar-gutter: auto;
}
/* The workspace no longer reserves a scrollbar lane, so neither the topbar
   nor the page head should reserve one. The window's own scrollbar already
   takes that width, and both bars end on the same content edge as the page. */
.shell.item-view .topbar,
.shell.item-view .page-head { padding-right: var(--page-pad); }
.shell.item-view .col-main,
.shell.item-view .list-card,
.shell.item-view .board-body,
.shell.item-view .itemview,
.shell.item-view .iv-grid,
.shell.item-view .iv-main,
.shell.item-view .col-side { display: contents; }

.shell.item-view .iv-head { order: 1; }
.shell.item-view .chart-wrap { order: 2; }
.shell.item-view .chart-wrap:not(.full) { flex: 0 0 auto; }
.shell.item-view .ix-stats { order: 3; }
.shell.item-view .ix-readings { order: 4; }
.shell.item-view .ix-performance { order: 5; }
.shell.item-view .ix-tape { order: 6; }

/* ==========================================================================
   Item page — quiet ledger
   ==========================================================================
   A refinement of the night ledger: the instrument, the ruled record and the
   order ticket stay, but the furniture goes. No boxes around the item's
   actions, no tinted icon tiles, no ticks on the range rail, no rule under
   every tape row, no pulsing light. Type scale and alignment carry the
   hierarchy, so the quote and its figures are the only loud thing on the page. */

/* The sprite is a specimen, not a badge. It sits directly on the ground. */
.shell.item-view .iv-head .ico-lg,
.shell.item-view .iv-head > img {
  width: 48px; height: 48px;
  border: 0;
  border-radius: 4px;
  background: transparent;
}
.shell.item-view .iv-head .ico-lg img {
  inset: 4px;
  width: calc(100% - 8px); height: calc(100% - 8px);
}

/* The actions are words, not more boxes. The glyphs stay; the marks around
   them would be another border in the masthead. */
.shell.item-view .iv-acts { gap: 2px; }
.shell.item-view .iv-btn {
  height: 32px;
  padding: 0 7px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink-3);
  font-size: 12px;
}
.shell.item-view .iv-btn:hover,
.shell.item-view .iv-btn:focus-visible {
  background: var(--hover);
  color: var(--ink);
}
/* The tint alone is too easy to miss against the dark masthead: a keyboard
   press gets the same visible ring as the chart's tools. */
.shell.item-view .iv-btn:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 2px;
}
.shell.item-view .iv-btn.on { background: transparent; color: var(--accent); }
.shell.item-view .iv-btn.on:hover { background: var(--hover); }
/* A Free account's press is the way to the pitch, so its link wears the Pro
   crown beside the word. The action itself keeps the strip's neutral weight:
   the crown marks the plan, not the button. */
.shell.item-view .iv-crown { display: inline-flex; width: 11px; height: 11px; }
.shell.item-view .iv-crown svg { width: 11px; height: 11px; }
@media (max-width: 620px) {
  /* The phone drops the action glyphs; this late rule would put the crown's
     slot back, so the slot goes with them. */
  .shell.item-view .iv-acts .iv-btn.iv-flip .iv-crown { display: none; }
}

/* The quote is the page's one oversized figure: title scale, full weight, so
   it reads across the chart rather than looking like a caption. */
.ix-change { font-weight: var(--fw-medium); }

/* A section head is an index label: small, tracked, quiet. The figure below it
   is the section's voice, so the head does not need to compete. */
.shell.item-view .ix-section {
  padding-top: 40px;
  border-top: 0;
}
.shell.item-view .ix-section-head { margin-bottom: 20px; }
.shell.item-view .ix-section-head :is(h2, h3) {
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: var(--text-micro);
  font-weight: var(--fw-semibold);
  letter-spacing: 0;

}
.ix-sec-meta {
  color: var(--ink-4);
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}

/* Readings are separated by air and alignment, not by twelve little rules.
   The figures keep their mono face and give back the medium weight. */
.shell.item-view .ix-stat-grid,
.shell.item-view .ix-perf-grid { column-gap: 30px; row-gap: 28px; }
.shell.item-view .ix-stat,
.shell.item-view .ix-perf-cell {
  padding-top: 0;
  border-top: 0;
}
.shell.item-view .ix-stat dt,
.shell.item-view .ix-perf-cell dt {
  color: var(--ink-4);
  font-size: var(--text-micro);
  line-height: 1.3;
}
.shell.item-view .ix-stat dd,
.shell.item-view .ix-perf-cell dd {
  margin-top: 6px;
  font-size: 16px;
  font-weight: var(--fw-semibold);
  letter-spacing: -.01em;
}
.shell.item-view .ix-buy { color: color-mix(in srgb, var(--up) 84%, var(--ink-3)); }
.shell.item-view .ix-sell { color: color-mix(in srgb, var(--down) 84%, var(--ink-3)); }
.shell.item-view .ix-stat dd .q-pct { font-size: var(--text-micro); }


.shell.item-view .ix-performance { margin-top: 0; }
.shell.item-view .ix-perf-change { font-size: 14px; font-weight: var(--fw-regular); }

/* The tape reads as one record: a head rule, then rows that hold their columns
   by alignment alone. */
.shell.item-view .ix-tape { margin-top: 0; }
.shell.item-view .ix-tape-table th {
  padding: 0 10px 9px;
  border-bottom-color: var(--line-soft);
  font-size: var(--text-micro);
  letter-spacing: 0;

}
.shell.item-view .ix-tape-table th:first-child { width: 88px; }
.shell.item-view .ix-tape-table td {
  padding: 11px 10px;
  border-bottom: 0;
  font-size: var(--text-micro);
  color: var(--ink-3);
}
.shell.item-view .ix-tape-time time { font-size: var(--text-micro); color: var(--ink-3); }
.shell.item-view .ix-tape-time span { font-size: var(--text-micro); }
.shell.item-view .ix-tape-buy { color: color-mix(in srgb, var(--up) 82%, var(--ink-3)); }
.shell.item-view .ix-tape-sell { color: color-mix(in srgb, var(--down) 82%, var(--ink-3)); }
.shell.item-view .ix-tape-table tbody tr:last-child td { border-bottom: 0; }

/* The Pro reading joins the ledger as a flat block, with no per-card chrome. */
.shell.item-view .ix-readings { margin-top: 0; }
/* On a desk the locked reading is one band: the question stays left and the
   way to unlock it sits at the column's right edge. Stacked, the 560px column
   read as a half-finished block under the full-width tape. */
@media (min-width: 861px) {
  .shell.item-view .reading-grid .card-lock {
    flex-direction: row;
    align-items: center;
  }
}

/* The reading's own body reads as flat ledger rows too: no badge ring, no
   rules between rows, and the Pro CTA is an outline, not a second amber
   action on the page. */
.shell.item-view .reading-grid .fill-top { border-bottom: 0; padding-bottom: 0; }
.shell.item-view .reading-grid .fill-badge {
  width: auto; height: auto;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 26px;
  font-weight: var(--fw-regular);
  line-height: 1;
}
.shell.item-view .reading-grid .fill-body { gap: 0; }
.shell.item-view .reading-grid .fill-row { border-bottom: 0; padding: 7px 0; }
.shell.item-view .reading-grid .fill-row-last { padding-bottom: 0; }
.shell.item-view .reading-grid .fill-bar { height: 3px; background: var(--line-soft); }
.shell.item-view .reading-grid .fill-bar span { background: var(--ink-3); }
.shell.item-view .reading-grid .pro-cta {
  min-height: 34px;
  margin-top: 0;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font-weight: var(--fw-regular);
}
.shell.item-view .reading-grid .pro-cta:hover {
  border-color: var(--line-strong);
  background: var(--hover);
  color: var(--ink);
}
.shell.item-view .reading-grid .pro-cta:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 2px;
}
.shell.item-view .reading-grid .pro-cta svg { width: 13px; height: 13px; color: var(--ink-4); }
@media (max-width: 620px) {
  .shell.item-view .reading-grid .pro-cta { min-height: 44px; }
}

/* The chart tools are glyphs first. The strip holds one quiet row of marks;
   a plate appears only when the control is hovered, open or locked. */
.shell.item-view .ct-tools { gap: 2px; }
.shell.item-view .tool-btn {
  width: 32px; height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--ink-3);
}
.shell.item-view .tool-btn:hover,
.shell.item-view .tool-btn:focus-visible {
  border-color: transparent;
  background: var(--hover);
  color: var(--ink-2);
}
.shell.item-view .tool-btn:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 2px;
}
/* A locked drawing tool is a quiet glyph with an amber crown, matching
   Compare; the plate belongs to the control that is open or selected. */
.shell.item-view .chart-draw.pro-locked {
  border-color: transparent;
  background: transparent;
  color: var(--ink-3);
}
.shell.item-view .chart-draw.pro-locked:hover,
.shell.item-view .chart-draw.pro-locked:focus-visible {
  border-color: transparent;
  background: var(--hover);
  color: var(--ink-2);
}
.shell.item-view .tool-crown {
  top: -2px; right: -2px;
  width: 12px; height: 12px;
  border: 0;
  background: transparent;
  color: var(--accent);
}
.shell.item-view .tool-crown svg { width: 8px; height: 8px; }

/* The window is a row of words on the chart's own ground. Only the selected
   window takes a plate; the inactive labels stay quiet until hovered. */
.shell.item-view .ranges {
  align-items: center;
  gap: 0;
  padding: 2px 0;
  border: 0;
  border-radius: 0;
  background: none;
}
.shell.item-view .ranges::after { display: none; }
.shell.item-view .ranges button {
  min-width: 34px;
  padding: 0 9px;
  border-radius: 4px;
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: var(--text-micro);
  font-weight: var(--fw-medium);
  letter-spacing: 0;
}
.shell.item-view .ranges button:hover { background: var(--hover); color: var(--ink); }
.shell.item-view .ranges button.on {
  color: var(--ink);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}
.shell.item-view .ranges button::after,
.shell.item-view .ranges button.on::after { display: none; }
.shell.item-view .ranges .live-dot { width: 4px; height: 4px; }
.shell.item-view .ck { gap: 7px; font-size: var(--text-micro); color: var(--ink-3); }
.shell.item-view .ck-line { width: 12px; height: 1px; }



/* The chart is the page's instrument, so it keeps more of the first screen. */
@media (min-width: 1181px) {
  .shell.item-view .chart-command .chart {
    height: clamp(460px, 54vh, 620px);
    min-height: 440px;
  }
}

@media (max-width: 860px) {
  .shell.item-view .ix-stat-grid,
  .shell.item-view .ix-perf-grid { column-gap: 20px; row-gap: 24px; }
  .shell.item-view .chart-command .chart { height: 340px; min-height: 340px; }
}

@media (max-width: 620px) {
  .shell.item-view .iv-head .ico-lg,
  .shell.item-view .iv-head > img { width: 40px; height: 40px; }
  .shell.item-view .iv-head .ico-lg img { inset: 3px; width: calc(100% - 6px); height: calc(100% - 6px); }
  .shell.item-view .iv-btn { height: 32px; padding: 0 6px; font-size: var(--text-micro); }
  .shell.item-view .ix-price { font-size: 1.875rem; }
  .shell.item-view .ix-section { padding-top: 34px; }
  .shell.item-view .ix-section-head { margin-bottom: 16px; }
  .shell.item-view .ix-section-head :is(h2, h3) { font-size: var(--text-micro); }
  .shell.item-view .ix-stat dd,
  .shell.item-view .ix-perf-cell dd { font-size: 15px; }
  /* The note stays beside its label at a phone's width, so the row's figures
     keep one baseline instead of the noted cell dropping below its neighbours. */
  .shell.item-view .ix-stat dt span {
    display: inline;
    margin: 0 0 0 4px;
    font-size: var(--text-micro);
  }
  .shell.item-view .ix-stat-grid { row-gap: 22px; }
  .shell.item-view .ix-tape-table th { font-size: var(--text-micro); }
  .shell.item-view .ix-tape-table th:first-child { width: 64px; }
  .shell.item-view .ix-tape-table td { padding: 10px 4px; font-size: 11px; }
  .shell.item-view .ranges button { padding: 0 1px; font-size: var(--text-micro); }
  /* The legend and the glyph toolbar share one line under the range rail, so
     the phone does not spend a whole band on four icons and empty space. */
  .shell.item-view .chart-legend-row { flex: 1 1 auto; justify-content: flex-start; }
  .shell.item-view .chart-actions { order: 2; flex: 0 0 auto; margin-left: auto; }
}


/* ==========================================================================
   Item page - the ledger speaks up
   ==========================================================================
   The quiet pass took the section heads down to micro-labels and the figures
   with them. The record under the chart is evidence, not footnotes: each
   section gets its rule and a real heading, the figures come back up to the
   heading scale, and the tape reads at a row height it can be scanned at. */
.shell.item-view .ix-section {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.shell.item-view .ix-stats { margin-top: 26px; }
.shell.item-view .ix-section-head { margin-bottom: 16px; }
.shell.item-view .ix-section-head :is(h2, h3) {
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--text-heading);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--track-display);
  line-height: var(--leading-heading);
  text-transform: none;
}
.ix-sec-meta {
  color: var(--ink-4);
  font-family: var(--sans);
  font-size: var(--text-micro);
  font-weight: var(--fw-regular);
  letter-spacing: 0;
  text-transform: none;
}

/* The labels are read before the figures, so they give up neither size nor
   contrast; only the note steps back. */
.shell.item-view .ix-stat dt,
.shell.item-view .ix-perf-cell dt {
  color: var(--ink-3);
  font-size: var(--text-label);
  font-weight: var(--fw-regular);
  line-height: var(--leading-label);
}
.shell.item-view .ix-stat dt span {
  color: var(--ink-4);
  font-size: var(--text-micro);
}
.shell.item-view .ix-stat dd,
.shell.item-view .ix-perf-cell dd {
  margin-top: 7px;
  font-size: var(--text-heading);
  font-weight: var(--fw-semibold);
  letter-spacing: -.02em;
  line-height: 1.1;
}
.shell.item-view .ix-stat dd .q-pct { font-size: var(--text-micro); }


.shell.item-view .ix-perf-change {
  font-size: var(--text-body);
  font-weight: var(--fw-medium);
}

/* The tape is a record: the head rule is the section's second rule, and every
   row keeps its columns by alignment. */
.shell.item-view .ix-tape-table th {
  padding-bottom: 10px;
  border-bottom-color: var(--line);
  color: var(--ink-3);
  font-size: var(--text-micro);
  font-weight: var(--fw-medium);
  letter-spacing: 0;
}
.shell.item-view .ix-tape-table td {
  padding: 12px 10px;
  font-size: var(--text-label);
  color: var(--ink-2);
}
.shell.item-view .ix-tape-time time { font-size: var(--text-label); color: var(--ink-2); }
.shell.item-view .ix-tape-time span { font-size: var(--text-micro); color: var(--ink-4); }
.shell.item-view .ix-tape-qty { color: var(--ink-2); }
.shell.item-view .ix-tape-buy { color: color-mix(in srgb, var(--up) 90%, var(--ink-3)); }
.shell.item-view .ix-tape-sell { color: color-mix(in srgb, var(--down) 90%, var(--ink-3)); }

/* The paid reading is the same ledger, so its head and copy sit at the same
   size as the rest of the record. */
.reading-grid .card-head h3 {
  color: var(--ink-2);
  font-size: var(--text-body);
  font-weight: var(--fw-medium);
}
.reading-grid .card-lock p { color: var(--ink-3); }

@media (max-width: 860px) {
  .shell.item-view .ix-section { margin-top: 28px; padding-top: 18px; }
  .shell.item-view .ix-stats { margin-top: 24px; }
  .shell.item-view .ix-section-head :is(h2, h3) { font-size: var(--text-body); }
  .shell.item-view .ix-stat dd,
  .shell.item-view .ix-perf-cell dd { font-size: var(--text-heading); }
}

@media (max-width: 620px) {
  .shell.item-view .ix-section { margin-top: 26px; padding-top: 16px; }
  .shell.item-view .ix-stats { margin-top: 22px; }
  .shell.item-view .ix-section-head { margin-bottom: 14px; }
  .shell.item-view .ix-section-head :is(h2, h3) { font-size: var(--text-body); }
  .shell.item-view .ix-stat dt,
  .shell.item-view .ix-perf-cell dt { font-size: var(--text-label); }
  .shell.item-view .ix-stat dd,
  .shell.item-view .ix-perf-cell dd { margin-top: 6px; font-size: var(--text-heading); }
  .shell.item-view .ix-stat-grid { row-gap: 24px; }
  .shell.item-view .ix-tape-table th { font-size: var(--text-micro); }
  .shell.item-view .ix-tape-table th:first-child { width: 70px; }
  .shell.item-view .ix-tape-table td { padding: 11px 4px; font-size: 12px; }
  .shell.item-view .ix-tape-time time { font-size: 12px; }
  .shell.item-view .ix-tape-time span { font-size: var(--text-micro); }
}

/* ------------------------------------------------------------- market board --- */
/* The market is a quotation board, not a page of cards. A ruled masthead states
   the market's own totals, the ledger groups its figures under one line of
   column heads, and the filters read as the board's margin index. The item
   page's hairlines and flat ink are the reference: there is no plate here that
   a rule can do the work of. */
.market-mast {
  display: none;
  grid-column: 1 / -1;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  min-width: 0;
  padding: 16px 0 18px;
  border-bottom: 1px solid var(--line);
}
.shell[data-screen="market"]:not(.item-view) .market-mast { display: flex; }

.market-mast-copy,
.page-mast-copy { min-width: 0; }
.market-mast-copy h2,
.page-mast-title {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--text-title);
  font-weight: var(--fw-display);
  line-height: var(--leading-display);
  letter-spacing: var(--track-display);
}
.market-lede,
.page-mast-lede {
  max-width: 54ch;
  margin: 7px 0 0;
  color: var(--ink-3);
  font-size: var(--text-body);
  line-height: 1.45;
}

/* The mast's trail is navigation, not a kicker: a real parent above the page
   name, with the current page last and quiet enough that the title still
   leads. Top-level masts have none. */
.page-crumb {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0 7px; margin: 0 0 8px;
  color: var(--ink-4);
  font-size: var(--text-label);
  line-height: 1.3;
}
.page-crumb a { color: var(--ink-3); text-decoration: none; }
.page-crumb a:hover { color: var(--accent); }
.page-crumb .sep { color: var(--ink-4); }
.page-crumb [aria-current="page"] { color: var(--ink-4); }

/* The mast is one component across screens that are otherwise different
   instruments. The market is the source; the page brings its own name, one
   reading and, on the right, its own actions or live total. */
.page-mast {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 28px;
  min-width: 0;
  padding: 16px 0 18px;
  border-bottom: 1px solid var(--line);
}
.page-mast-side {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 11px 16px;
  min-width: 0;
}
/* The optimizer mast is part of the shared shell, so its hidden default has
   to live here: the server tool pages ship the shell without optimizer.css. */
.opt-mast { display: none; }

/* The tape is the answer's own totals, not a second reading of the rows: the
   count, the window's volume, the market's average return and when the snapshot
   was built all arrive with the page that drew the ledger. It reads as one
   annotation line, not a second headline, and stays hidden until that answer
   lands, so no placeholder figures are ever on the glass. */

/* The ledger has no card under it: its rules are the enclosure. */
.shell[data-screen="market"]:not(.item-view) .list-card {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.shell[data-screen="market"]:not(.item-view) .board-body thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 7px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  color: var(--ink-4);
  font-size: var(--text-micro);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.shell[data-screen="market"]:not(.item-view) .board-body thead th[aria-sort] {
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.shell[data-screen="market"]:not(.item-view) .board-body thead th .caret { color: var(--accent); }

.shell[data-screen="market"]:not(.item-view) .board-body tbody td {
  padding: 7px 10px;
  color: var(--ink-3);
  font-size: var(--text-label);
}
.shell[data-screen="market"]:not(.item-view) .board-body tbody td.name {
  padding-top: 6px; padding-bottom: 6px;
}
/* The quote is the row's primary reading; the flow under it is provenance. */
.shell[data-screen="market"]:not(.item-view) .board-body tbody td.col-buy,
.shell[data-screen="market"]:not(.item-view) .board-body tbody td.col-sell {
  color: var(--ink);
}
.shell[data-screen="market"]:not(.item-view) .board-body tbody td.col-price,
.shell[data-screen="market"]:not(.item-view) .board-body tbody td.col-margin {
  color: var(--ink-2);
}
.shell[data-screen="market"]:not(.item-view) .board-body tbody td:is(.col-limit, .col-bought, .col-sold) {
  color: var(--ink-4);
}
.shell[data-screen="market"]:not(.item-view) .board-body .suspect { color: var(--accent-2); }

/* One rule between each group of readings, so an eye crossing from the quote to
   the flow knows where it changed subject. */
.shell[data-screen="market"]:not(.item-view) .board-body :is(thead th, tbody td):is(.col-price, .col-buy, .col-margin, .col-volume, .col-highalch, .col-change) {
  border-left: 1px solid var(--line-soft);
}

.shell[data-screen="market"]:not(.item-view) .item-cell { gap: 9px; }
.shell[data-screen="market"]:not(.item-view) .item-cell img {
  width: 26px; height: 26px;
  padding: 2px;
  border-radius: 4px;
}
.shell[data-screen="market"]:not(.item-view) .item-cell .f2p {
  padding: 1px 4px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: transparent;
  font-size: var(--text-micro);
}
.shell[data-screen="market"]:not(.item-view) .item-cell .f2p.new {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent);
}
.shell[data-screen="market"]:not(.item-view) .item-cell .row-spark {
  flex: 0 0 46px; width: 46px; height: 13px;
}
.shell[data-screen="market"]:not(.item-view) .bar-cell .bar {
  width: 58px; height: 2px;
  background: var(--line);
}
.shell[data-screen="market"]:not(.item-view) .bar-cell .bar i { background: var(--ink-3); }

.shell[data-screen="market"]:not(.item-view) .board-body tbody tr:hover { background: var(--hover); }

/* A change carries its direction as a mark as well as a colour. */
.shell[data-screen="market"]:not(.item-view) .board-body tbody td.col-change .mkt-delta::before {
  margin-right: 4px;
  font-size: .68em;
  vertical-align: .08em;
}
.shell[data-screen="market"]:not(.item-view) .board-body tbody td.col-change.up .mkt-delta::before { content: "▲"; }
.shell[data-screen="market"]:not(.item-view) .board-body tbody td.col-change.down .mkt-delta::before { content: "▼"; }

.shell[data-screen="market"]:not(.item-view) .board-body .mkt-delta,
.shell[data-screen="market"]:not(.item-view) .board-body td.up .mkt-delta,
.shell[data-screen="market"]:not(.item-view) .board-body td.down .mkt-delta {
  padding: 0;
  border-radius: 0;
  background: transparent;
}
.shell[data-screen="market"]:not(.item-view) .board-body td.up .mkt-delta { color: var(--up); }
.shell[data-screen="market"]:not(.item-view) .board-body td.down .mkt-delta { color: var(--down); }

/* The foot is a tape marker, not a second card: the window, then the pages. */
.shell[data-screen="market"]:not(.item-view) .pager {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.shell[data-screen="market"]:not(.item-view) .pg {
  border-radius: 4px;
  font-size: var(--text-micro);
}
.shell[data-screen="market"]:not(.item-view) .pg.on {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: var(--fw-semibold);
}
.shell[data-screen="market"]:not(.item-view) .pg-info {
  color: var(--ink-4);
  font-size: var(--text-micro);
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* The margin index: one quiet column of names, boxes and numbers. The search
   is the one raised field; the groups are separated by air, not rules. */
.shell[data-screen="market"]:not(.item-view) .filters-card .facets-head {
  min-height: 0;
  padding: 0 0 12px;
  border-bottom: 0;
}
.shell[data-screen="market"]:not(.item-view) .filters-title {
  color: var(--ink-4);
  font-family: var(--mono);
  font-size: var(--text-micro);
  font-weight: var(--fw-medium);
  letter-spacing: 0;
  text-transform: none;
}
.shell[data-screen="market"]:not(.item-view) .filters-actions .ghost {
  height: 24px; padding: 0;
  border: 0; background: none;
  color: var(--ink-4);
  font-family: var(--mono);
  font-size: var(--text-micro);
  letter-spacing: 0;
  text-transform: none;
}
.shell[data-screen="market"]:not(.item-view) .filters-actions .ghost:hover {
  border: 0;
  color: var(--accent);
}
.shell[data-screen="market"]:not(.item-view) .filters-card .facets-body { gap: 0; }
.shell[data-screen="market"]:not(.item-view) .facet-label {
  color: var(--ink-4);
  font-family: var(--mono);
  font-size: var(--text-micro);
  letter-spacing: 0;
  text-transform: none;
}
.shell[data-screen="market"]:not(.item-view) .facet-view { padding-bottom: 14px; }
.shell[data-screen="market"]:not(.item-view) .saveonly {
  height: 40px; padding: 0 10px;
  border-radius: 4px;
  background: transparent;
  font-family: var(--mono);
  font-size: var(--text-label);
}
.shell[data-screen="market"]:not(.item-view) .saveonly.on {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
.shell[data-screen="market"]:not(.item-view) .saveonly .s-caret { font-family: var(--sans); }
.shell[data-screen="market"]:not(.item-view) .scope-x {
  width: 34px; height: 40px;
  border-radius: 4px;
}
.shell[data-screen="market"]:not(.item-view) .filter-tools {
  padding-top: 0;
  border-top: 0;
}
.shell[data-screen="market"]:not(.item-view) .filter-search {
  height: 42px; padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  color: var(--ink-3);
  cursor: text;
  transition: border-color var(--t-quick), background var(--t-quick);
}
.shell[data-screen="market"]:not(.item-view) .filter-search:hover { border-color: var(--line-strong); }
.shell[data-screen="market"]:not(.item-view) .filter-search:focus-within {
  border-color: var(--accent);
  background: var(--field-2);
}
.shell[data-screen="market"]:not(.item-view) .filter-search svg { width: 16px; height: 16px; color: var(--ink-3); }
.shell[data-screen="market"]:not(.item-view) .filter-search input::placeholder { color: var(--ink-3); }
.shell[data-screen="market"]:not(.item-view) .filter-active {
  margin-bottom: 12px;
  border-radius: 4px;
}
.shell[data-screen="market"]:not(.item-view) .filter-catalog {
  margin-top: 12px;
  border-top: 0;
}
.shell[data-screen="market"]:not(.item-view) .filter-block {
  padding-top: 0;
  border-top: 0;
  border-bottom: 0;
}
.shell[data-screen="market"]:not(.item-view) .filter-block summary {
  height: 40px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: var(--text-micro);
  font-weight: var(--fw-medium);
  letter-spacing: 0;
  text-transform: none;
}
.shell[data-screen="market"]:not(.item-view) .filter-block summary:hover { color: var(--ink); }
.shell[data-screen="market"]:not(.item-view) .filter-index { padding: 0 0 14px; }
.shell[data-screen="market"]:not(.item-view) .filter-input > span,
.shell[data-screen="market"]:not(.item-view) .filter-editor-hint,
.shell[data-screen="market"]:not(.item-view) .filter-empty {
  color: var(--ink-4);
}
.shell[data-screen="market"]:not(.item-view) .filter-input input:focus {
  border-color: var(--accent);
}
.shell[data-screen="market"]:not(.item-view) .filter-field-chip {
  min-height: 32px;
  padding: 0 8px;
  border-radius: 4px;
  background: transparent;
  font-family: var(--mono);
  font-size: var(--text-micro);
}
.shell[data-screen="market"]:not(.item-view) .filter-field-chip:hover { color: var(--ink); }
.shell[data-screen="market"]:not(.item-view) .filter-field-chip .ff-mark { color: var(--ink-4); }
.shell[data-screen="market"]:not(.item-view) .filter-field-chip.on .ff-mark,
.shell[data-screen="market"]:not(.item-view) .filter-field-chip.open .ff-mark {
  color: var(--accent);
}
.shell[data-screen="market"]:not(.item-view) .filter-field-chip.on,
.shell[data-screen="market"]:not(.item-view) .filter-field-chip.open {
  background: var(--accent-soft);
  color: var(--accent);
}
.shell[data-screen="market"]:not(.item-view) .filter-editor {
  border-radius: 4px;
  background: var(--bg-2);
}
/* The market's chips are 32px in the rail; under a thumb they keep the app's
   44px floor, the same box as every other control in the phone's sheet. */
@media (max-width: 620px), (pointer: coarse) {
  .shell[data-screen="market"]:not(.item-view) .filter-search { height: 44px; }
  .shell[data-screen="market"]:not(.item-view) .filter-field-chip { min-height: 44px; }
}

/* The rail's header is deliberately flush at its top; the phone sheet is a
   rounded card, so it needs its own inset or the title is clipped by the top
   edge. */
@media (max-width: 620px) {
  .shell[data-screen="market"]:not(.item-view) .filters-card.open .facets-head {
    min-height: 58px;
    padding: 12px 16px;
  }
}

@media (min-width: 1081px) {
  .shell[data-screen="market"]:not(.item-view) .workspace {
    grid-template-rows: auto minmax(0, 1fr);
    align-items: stretch;
    /* The mast and the ledger are one instrument. The workspace's 18px row
       gap put a strip of empty glass between the mast rule and the column
       names; the ledger's own header padding is the only rule needed. */
    column-gap: var(--col-gap);
    row-gap: 0;
    padding-bottom: 0;
    overflow: auto;
  }
  .shell[data-screen="market"]:not(.item-view) .market-mast {
    grid-column: 1 / -1;
    grid-row: 1;
  }
  .shell[data-screen="market"]:not(.item-view) .col-main {
    display: flex;
    flex-direction: column;
    grid-column: 1;
    grid-row: 2;
    min-height: 0;
  }
  .shell[data-screen="market"]:not(.item-view) .col-side {
    position: static;
    grid-column: 2;
    grid-row: 2;
    min-height: 0;
    /* The ledger's column names sit directly under the mast rule; the filter
       rail keeps the mast's old breathing room instead of riding up with it. */
    padding-top: var(--col-gap);
  }
  .shell[data-screen="market"]:not(.item-view) .list-card {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }
  .shell[data-screen="market"]:not(.item-view) .board-body {
    flex: 1 1 0;
    min-height: 0;
    overflow: auto;
  }
  .shell[data-screen="market"]:not(.item-view) .pager { flex: 0 0 auto; }
  .shell[data-screen="market"]:not(.item-view) .filters-card {
    align-self: stretch;
    min-height: 100%;
    padding: 0 0 0 24px;
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .shell[data-screen="market"]:not(.item-view) .filters-card .facets-body { padding: 16px 0 0; }
}

@media (max-width: 1080px) {
  .market-mast {
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 14px 24px;
    padding: 10px 2px 16px;
  }
  .market-mast-copy { flex: 1 1 320px; }
}

/* A tablet gets a ruled filter bar, shut by default: the board is the screen,
   not the form. Show opens the same fields in place. */
@media (min-width: 621px) and (max-width: 1080px) {
  .shell[data-screen="market"]:not(.item-view) .filters-card {
    padding: 0;
    border: 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .shell[data-screen="market"]:not(.item-view) .filters-card .facets-head { padding: 10px 2px; }
  .shell[data-screen="market"]:not(.item-view) .filters-card.open .facets-body {
    padding: 14px 2px 18px;
  }
}

@media (max-width: 620px) {
  .market-mast {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 14px;
    padding: 8px 0 14px;
  }
  .market-mast-copy, .market-tape { flex: 0 0 auto; }
  .market-mast-copy h2 { font-size: var(--text-title); }
  .market-lede { display: none; }

  .shell[data-screen="market"]:not(.item-view) .board-body .sortbar button,
  .shell[data-screen="market"]:not(.item-view) #filters-open {
    height: 40px;
    padding: 0 11px;
    border-radius: 5px;
    background: transparent;
    font-family: var(--mono);
    font-size: var(--text-micro);
    font-weight: var(--fw-medium);
    letter-spacing: .08em;
    text-transform: uppercase;
  }
  .shell[data-screen="market"]:not(.item-view) #filters-open { height: 44px; padding: 0 12px; }
  .shell[data-screen="market"]:not(.item-view) .board-body .sortbar button[aria-pressed="true"],
  .shell[data-screen="market"]:not(.item-view) .board-filter.on {
    background: var(--accent-soft);
    border-color: var(--accent-line);
    color: var(--accent);
  }
  .shell[data-screen="market"]:not(.item-view) .board-body .sortbar button .caret { color: var(--accent); }

  /* The card is a quote strip: the name and the move on one line, then the four
     readings divided by the same hairlines the desk's groups use. The desk's
     cell padding is taken back off first: a card's padding lives on the row, so
     its sprite and its first reading start on the same edge. */
  .shell[data-screen="market"]:not(.item-view) .board-body table.grid tbody td {
    padding: 0;
    border-left: 0;
  }
  /* The card is closed by the row's own rule. A bottom border on each reading
     left four short hairlines that stopped at every cell's padding; the
     readings keep the vertical rules that divide them. */
  #shell[data-screen="market"]:not(.item-view) .board-body table.grid tbody td {
    border-bottom: 0;
  }
  .shell[data-screen="market"]:not(.item-view) .board-body table.grid tbody td.name {
    padding: 0;
  }
  .shell[data-screen="market"]:not(.item-view) .board-body table.grid tbody tr {
    padding: 8px 10px 9px;
    row-gap: 4px;
  }
  .shell[data-screen="market"]:not(.item-view) .board-body table.grid tbody td.name .item-cell img {
    width: 28px; height: 28px;
    padding: 2px;
  }
  .shell[data-screen="market"]:not(.item-view) .board-body tbody td.col-buy::before,
  .shell[data-screen="market"]:not(.item-view) .board-body tbody td.col-sell::before,
  .shell[data-screen="market"]:not(.item-view) .board-body tbody td.col-margin::before,
  .shell[data-screen="market"]:not(.item-view) .board-body tbody td.col-roi::before {
    margin-bottom: 1px;
    font-family: var(--mono);
    font-size: var(--text-micro);
    font-weight: var(--fw-medium);
    letter-spacing: .08em;
    text-transform: uppercase;
  }
  .shell[data-screen="market"]:not(.item-view) .board-body table.grid tbody td.col-sell,
  .shell[data-screen="market"]:not(.item-view) .board-body table.grid tbody td.col-margin,
  .shell[data-screen="market"]:not(.item-view) .board-body table.grid tbody td.col-roi {
    padding-left: 8px;
    border-left: 1px solid var(--line-soft);
  }
  .shell[data-screen="market"]:not(.item-view) .board-body table.grid tbody td.col-buy,
  .shell[data-screen="market"]:not(.item-view) .board-body table.grid tbody td.col-roi {
    padding-right: 0;
  }
  .shell[data-screen="market"]:not(.item-view) .mkt-win {
    font-family: var(--mono);
    font-size: var(--text-micro);
    letter-spacing: .08em;
    text-transform: uppercase;
  }
  .shell[data-screen="market"]:not(.item-view) .board-body table.grid tbody .mkt-delta {
    padding: 0;
    background: transparent;
  }
  .shell[data-screen="market"]:not(.item-view) .board-body table.grid tbody td.up .mkt-delta { color: var(--up); }
  .shell[data-screen="market"]:not(.item-view) .board-body table.grid tbody td.down .mkt-delta { color: var(--down); }
}
/* ==========================================================================
   Item ledger — the chart, its record and the ticket rail
   ==========================================================================
   The plot and the ledger read in the left track, while the calculator and the
   paid market readings keep the ticket rail beside them. The no-script article
   and the loading shell never enter this grid. */
@media (min-width: 1181px) {
  .shell.item-view:has(#board .itemview:not(.ssr)) .workspace {
    display: grid;
    /* The sheet is the page's subject; the rail is the ticket beside it. A
       340px rail still holds the two quote plates and the figure column, and
       the width it gives back goes to the chart and the print tape. */
    grid-template-columns: minmax(0, 1fr) 340px;
    grid-template-areas:
      "head head"
      "chart rail"
      "ledger rail";
    column-gap: 30px;
    row-gap: 0;
    align-items: start;
    /* The sheet is the last thing on the page; the page padding that follows
       the board elsewhere would show as a band under the ledger. */
    padding-bottom: 0;
  }
  .shell.item-view:has(#board .itemview:not(.ssr)) .tp-head { grid-area: head; }
  .shell.item-view:has(#board .itemview:not(.ssr)) .chart-wrap { grid-area: chart; }
  .shell.item-view:has(#board .itemview:not(.ssr)) .tp-split {
    grid-area: ledger;
    min-width: 0;
  }
  .shell.item-view:has(#board .itemview:not(.ssr)) .reading-rail {
    grid-area: rail;
    /* The rail begins on the workspace's first row, not the chart row below
       it. `head` has no element of its own (the sheet is one block in column
       one), so starting the rail on row two left it a row's height (16px)
       under the card it sits beside. */
    grid-row-start: 1;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 0;
    padding-top: 0;
    padding-left: 0;
    border-top: 0;
  }
  .shell.item-view:has(#board .itemview:not(.ssr)) .reading-rail .ix-readings {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }
  .shell.item-view .ix-stats,
  .shell.item-view .ix-performance,
  .shell.item-view .ix-tape { min-width: 0; }
}

/* A phone gets one named Chart tools control instead of four unlabelled marks.
   The triggers remain in the DOM so their menus, Pro gates and keyboard paths
   do not fork; only the visible entry point changes. */
.chart-tools { display: none; }
.chart-tools-menu { display: none; }
.menu-item .mi-pro {
  margin-left: auto;
  color: var(--ink-4);
  font-size: var(--text-micro);
  letter-spacing: 0;
}
@media (max-width: 620px) {
  .shell.item-view .ct-tools > .tool-btn:not(.chart-tools) { display: none; }
  .shell.item-view .tool-btn.chart-tools {
    display: inline-flex;
    width: auto;
    height: 44px;
    padding: 0 12px;
    gap: 7px;
    border-color: var(--line);
    background: var(--field);
    color: var(--ink-2);
    font-family: var(--sans);
    font-size: var(--text-label);
    font-weight: var(--fw-medium);
    letter-spacing: 0;
  }
  .shell.item-view .tool-btn.chart-tools:hover,
  .shell.item-view .tool-btn.chart-tools:focus-visible {
    border-color: var(--line-strong);
    background: var(--field-2);
    color: var(--ink);
  }
  .shell.item-view .tool-btn.chart-tools[aria-expanded="true"] {
    border-color: var(--accent-line);
    background: var(--accent-soft);
    color: var(--accent);
  }
  .chart-tools .ct-chev { transition: transform var(--t-quick); }
  .chart-tools[aria-expanded="true"] .ct-chev { transform: rotate(180deg); }
  .chart-tools-menu:not([hidden]) { display: block; }
  .chart-tools-menu .menu-item { min-height: 44px; }
}

/* The settings sheet can outgrow a phone. The fade is a cue that there are more
   switches under the fold; it leaves as soon as the sheet reaches its foot. */
.studies-more {
  display: none;
  position: absolute;
  left: 0; right: 0; bottom: 0;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 36px;
  padding-top: 12px;
  background: linear-gradient(to top, var(--card-2) 55%, transparent);
  color: var(--ink-3);
  font-size: var(--text-micro);
  letter-spacing: 0;
  pointer-events: none;
}
#studies.has-more .studies-more { display: flex; }

/* ------------------------------------------------------- loading skeletons --- */
/* The server's loading layer. `.boot-loading` is hidden when scripts are off,
   which leaves the real SSR content as the readable document; a scripted
   browser sees the skeleton from the first paint and lets the app replace it
   with the real screen. */
html:not(.js) .boot-loading { display: none !important; }
html.js .board-body > .boot-loading { display: block; }
html.js .board-body > .ssr { display: none; }

.view-loading { padding: 22px 18px 28px; }
.view-loading .vl-head { display: grid; gap: 10px; max-width: 340px; margin-bottom: 22px; }
.view-loading .vl-title { width: 168px; height: 16px; }
.view-loading .vl-line { width: min(310px, 72vw); height: 9px; }
.view-loading .vl-rows { display: grid; gap: 10px; max-width: 780px; }
.view-loading .vl-row {
  display: flex; align-items: center; gap: 12px;
  min-height: 52px; padding: 0 12px;
  border: 1px solid var(--line-soft); border-radius: 6px;
}
.view-loading .vl-icon { width: 28px; height: 28px; border-radius: 6px; flex: 0 0 28px; }
.view-loading .vl-name { height: 9px; max-width: 42%; }
.view-loading .vl-meta { width: 54px; height: 8px; margin-left: auto; flex: 0 0 54px; }

/* A placeholder has to hold the box the real content will take, or it is just a
   different layout shift. These two surfaces are the first-paint ones: the open
   items strip (height 30 on a desk, 44 on a phone) and the market table (49px
   rows on a desk, 101px cards on a phone). */
.skel {
  display: inline-block;
  flex: 0 0 auto;
  background: linear-gradient(90deg, var(--field) 20%, var(--field-2) 50%, var(--field) 80%);
  background-size: 220% 100%;
  border-radius: 4px;
  animation: skel-sweep 1.45s ease-in-out infinite;
}
@keyframes skel-sweep {
  from { background-position: 200% 0; }
  to { background-position: -20% 0; }
}

/* The strip's placeholder uses the pill's own box, not a second tab design. */
.tb-pages.tabs-loading { pointer-events: none; min-height: 30px; }
.tb-page.tb-page-skel {
  height: 30px;
  min-height: 30px;
  padding: 0 2px 0 7px;
  gap: 7px;
  overflow: hidden;
}
.tb-page-skel .tb-skel-ico { width: 18px; height: 18px; border-radius: 5px; flex-basis: 18px; }
.tb-page-skel .tb-skel-name { height: 9px; flex: 1 1 auto; min-width: 0; }
.tb-page-skel .tb-skel-x { width: 24px; height: 24px; border-radius: 999px; flex-basis: 24px; }

/* The board's first wait. Its caption and header are the real table's, so the
   table that replaces it starts on the same lines. */
.board-loading { width: 100%; }
.board-loading-chips { display: none; }
.board-loading-head {
  position: relative;
  display: flex;
  align-items: center;
  height: 37px;
  padding: 0 14px;
}
.board-loading-head .board-title { white-space: nowrap; }
.board-skel {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.board-loading-tag {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-4);
  font-family: var(--mono);
  font-size: var(--text-micro);
  letter-spacing: var(--track-label);
  white-space: nowrap;
}
.board-loading-tag i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: loading-pulse 1.3s ease-in-out infinite;
}
@keyframes loading-pulse {
  0%, 100% { opacity: .35; transform: scale(.78); }
  50% { opacity: 1; transform: scale(1); }
}
.board-skel thead th {
  height: 41px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.board-skel thead th:first-child { width: 34px; }
.board-skel .skel-head { width: 36px; height: 6px; }
.board-skel thead th:nth-child(2) .skel-head { width: 74px; }
.board-skel tbody tr { height: 49px; cursor: default; }
.board-skel tbody tr:hover { background: transparent; }
.board-skel tbody td { height: 49px; }
.board-skel .skel-star { width: 14px; height: 14px; border-radius: 4px; }
.board-skel .skel-icon { width: 30px; height: 30px; border-radius: 6px; flex-basis: 30px; }
.board-skel .skel-name { height: 9px; max-width: 45%; }
.board-skel .skel-spark { width: 44px; height: 10px; flex-basis: 44px; margin-left: auto; }
.board-skel .skel-num { width: 42px; height: 8px; }
.board-skel .skel-num.skel-short { width: 28px; }
.board-skel .skel-pill { width: 38px; height: 18px; }
.board-skel .skel-bar { width: 64px; height: 3px; }
.board-skel .skel-win { display: none; width: 22px; height: 7px; }
.board-skel .skel-delta { width: 42px; height: 18px; }

@media (max-width: 620px) {
  .tb-pages.tabs-loading { min-height: 44px; }
  .tb-page.tb-page-skel { height: 44px; min-height: 44px; }

  .board-loading-chips {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px 6px;
    overflow: hidden;
  }
  .board-loading-chips .load-chip { width: 58px; height: 44px; border-radius: 999px; }
  .board-loading-chips .load-chip-filter { width: 82px; }
  .board-loading-head { height: 35px; padding: 0 10px; }
  .board-loading-tag { right: 10px; }
  .board-skel thead { display: none; }
  .board-skel tbody tr { height: 101px; min-height: 101px; padding: 6px 10px 7px; }
  .board-skel tbody td { height: auto; padding: 0; }
  .board-skel .skel-icon { width: 30px; height: 30px; }
  .board-skel .skel-name { width: 44% !important; max-width: 150px; }
  .board-skel .skel-spark { width: 8ch; flex-basis: 8ch; height: 12px; }
  .board-skel .skel-num { width: 34px; }
  .board-skel .skel-pill { width: 34px; height: 17px; }
  .board-skel .skel-win { display: block; width: 20px; height: 6px; }
  .board-skel .skel-delta { width: 34px; height: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; }
  .board-loading-tag i { animation: none; opacity: 1; transform: none; }
}

/* ==========================================================================
   Item reading rail — calculator above, pressure-led readings
   ==========================================================================
   The calculator is its own section above the paid readings. Market readings
   keeps pressure first and the fill estimate second; all three are visible.
   The rail's rule is the one frame; the sections divide with hairlines, not
   cards. */
.reading-rail { display: none; }
.shell.item-view .reading-rail {
  display: block;
  order: 4;
  min-width: 0;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.shell.item-view:not(:has(#board .itemview:not(.ssr))) .reading-rail { display: none; }

.shell.item-view .reading-rail .ix-section { margin-top: 0; padding-top: 0; border-top: 0; }
.shell.item-view .reading-rail .ix-section-head { margin-bottom: 18px; align-items: baseline; }
.shell.item-view .reading-rail .ix-section-head h2 {
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  font-weight: var(--fw-medium);
  letter-spacing: -.01em;
  line-height: 1.2;
}
.shell.item-view .reading-rail .ix-sec-meta { color: var(--ink-4); font-size: 12px; }

.shell.item-view .reading-rail .ix-readings {
  margin-top: 32px;
  padding: 28px 0 0;
  border-top: 1px solid var(--line);
  border-left: 0;
}

/* The calculator's quote row is a pair of ledger cells: the whole cell is
   still the button that lights one side, but the frame belongs to the row. */
.shell.item-view .reading-rail .calc-card {
  max-width: 560px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.shell.item-view .reading-rail .calc-card .calc-body { gap: 0; }
.shell.item-view .reading-rail .calc-card .tool { gap: 14px; }
.shell.item-view .reading-rail .calc-row {
  gap: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.shell.item-view .reading-rail .calc-plate {
  align-items: flex-start;
  padding: 13px 0 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transition: background-color var(--t-quick), color var(--t-quick);
}
.shell.item-view .reading-rail .calc-plate + .calc-plate {
  padding-left: 16px;
  border-left: 1px solid var(--line);
}
.shell.item-view .reading-rail .calc-plate:hover { background: var(--hover); }
.shell.item-view .reading-rail .calc-plate.on {
  background: transparent;
  box-shadow: none;
}
.shell.item-view .reading-rail .calc-plate span { color: var(--ink-3); font-size: 12.5px; }
.shell.item-view .reading-rail .calc-plate.on span { color: var(--ink-2); }
.shell.item-view .reading-rail .calc-plate.buy.on span { color: var(--up); }
.shell.item-view .reading-rail .calc-plate.sell.on span { color: var(--down); }
.shell.item-view .reading-rail .calc-plate .amt { justify-content: flex-start; }
.shell.item-view .reading-rail .calc-plate .amt b {
  font-size: 18px;
  font-weight: var(--fw-medium);
  letter-spacing: -.01em;
}
/* Structural rules use --line; peer rows use --line-soft. The fields separate
   above the second field, and the receipt below reads by spacing: one
   structural rule sets the answer apart from the working. */
.shell.item-view .reading-rail .calc-field {
  gap: 7px;
  padding: 0 0 12px;
  border-bottom: 0;
}
.shell.item-view .reading-rail .calc-field + .calc-field {
  padding-top: 4px;
  border-top: 1px solid var(--line-soft);
}
.shell.item-view .reading-rail .calc-field label {
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.3;
}
.shell.item-view .reading-rail .calc-field input {
  height: 38px;
  font-size: 15px;
}
.shell.item-view .reading-rail .calc-field .numbox button {
  width: 30px;
  height: 30px;
  border-color: var(--line-soft);
  border-radius: 6px;
  background: transparent;
  color: var(--ink-3);
  font-size: 15px;
}
.shell.item-view .reading-rail .calc-field:has(+ .calc-out) { padding-bottom: 2px; }
.shell.item-view .reading-rail .calc-out {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.shell.item-view .reading-rail .calc-out > div {
  padding: 6px 0;
  border-bottom: 0;
  color: var(--ink-3);
  font-size: 12.5px;
}
.shell.item-view .reading-rail .calc-out b { font-size: 13px; }
.shell.item-view .reading-rail .calc-out .sum {
  padding: 6px 0;
  border-top: 0;
  border-bottom: 0;
}
.shell.item-view .reading-rail .calc-out .calc-basis {
  margin: 0;
  padding: 0 0 4px;
  border-bottom: 0;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.4;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.shell.item-view .reading-rail .calc-out .hero {
  margin: 8px 0 0;
  padding: 12px 0 1px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}
.shell.item-view .reading-rail .calc-out .hero b {
  font-size: 20px;
  font-weight: var(--fw-medium);
}
.shell.item-view .reading-rail .calc-plan {
  height: 40px;
  margin-top: 4px;
  border-radius: 6px;
}

/* The paid readings sit under the calculator as one ledger. Pressure is the
   first reading and carries the largest number; fill is a quieter secondary
   block, separated by a hairline. */
.shell.item-view .reading-rail .reading-grid {
  max-width: 560px;
  row-gap: 0;
}
.shell.item-view .reading-rail .reading-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.shell.item-view .reading-rail .reading-card + .reading-card {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.shell.item-view .reading-rail .reading-card .card-head { margin-bottom: 14px; }
.shell.item-view .reading-rail .reading-card .card-head h3 {
  margin: 0;
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: var(--fw-medium);
  letter-spacing: 0;
  line-height: 1.2;
}
.shell.item-view .reading-rail .press-body { gap: 16px; }
.shell.item-view .reading-rail .press-hero { grid-template-columns: minmax(0, 1fr); }
.shell.item-view .reading-rail .press-kicker {
  margin-bottom: 8px;
  gap: 0;
  color: var(--ink-2);
  font-size: 12.5px;
}
.shell.item-view .reading-rail .press-kicker::before { display: none; }
.shell.item-view .reading-rail .press-lead b {
  font-size: 32px;
  font-weight: var(--fw-medium);
  line-height: .95;
}
.shell.item-view .reading-rail .press-lead i { font-size: 13px; }
.shell.item-view .reading-rail .press-lead span { color: var(--ink-3); font-size: 12.5px; }
.shell.item-view .reading-rail .press-tape {
  height: 38px;
  padding-bottom: 0;
  border-bottom: 0;
}
.shell.item-view .reading-rail .press-ledger { gap: 16px; }
.shell.item-view .reading-rail .press-ledger span { padding-top: 8px; }
.shell.item-view .reading-rail .press-ledger em { color: var(--ink-3); font-size: 12px; }
.shell.item-view .reading-rail .press-ledger b { font-size: 13.5px; }

.shell.item-view .reading-rail .fill-body { gap: 0; }
.shell.item-view .reading-rail .fill-top {
  align-items: baseline;
  justify-content: flex-start;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.shell.item-view .reading-rail .fill-badge {
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 23px;
  font-weight: var(--fw-medium);
  letter-spacing: -.02em;
  line-height: 1;
}
.shell.item-view .reading-rail .fill-top-copy {
  max-width: 30ch;
  margin: 0;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.45;
  text-wrap: pretty;
}
.shell.item-view .reading-rail .fill-row {
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
}
.shell.item-view .reading-rail .fill-row b { font-size: 12.5px; }
.shell.item-view .reading-rail .fill-row-last {
  padding-bottom: 0;
  border-bottom: 0;
}
.shell.item-view .reading-rail .card-lock {
  flex: none;
  gap: 10px;
  padding-top: 2px;
}
.shell.item-view .reading-rail .card-lock p { font-size: 12px; }
.shell.item-view .reading-rail :is(.press-empty, .fill-empty) {
  padding: 14px 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  font-size: 12px;
  line-height: 1.5;
  text-align: left;
}

@media (max-width: 1180px) {
  .shell.item-view .reading-rail .ix-section-head,
  .shell.item-view .reading-rail .calc-card,
  .shell.item-view .reading-rail .reading-grid { max-width: 560px; }
}
@media (max-width: 620px) {
  .shell.item-view .reading-rail .press-lead b { font-size: 30px; }
}

/* The plot and the ledger below it are one field: the chart's frame closes at
   its sides rather than with a bar between the chart and the readings. */
.shell.item-view .chart-wrap {
  border-bottom: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

/* ------------------------------------------------------- account register --- */
/* My Account is one account document: a masthead, a quiet section index, and
   ruled sections. The boxed cards and the empty right rail are gone; the type,
   spacing and rules carry the hierarchy instead. */
.settings.account {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 0 88px;
  display: flex;
  flex-direction: column;
  gap: 0;
  color: var(--ink);
}
.settings.account ::selection {
  background: var(--accent-soft);
  color: var(--ink);
}
.settings.account a { color: inherit; }
.settings.account :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.settings.account .set-head.mast {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 28px;
  padding: 16px 0 18px;
  border-bottom: 1px solid var(--line);
}
.settings.account .set-id { min-width: 0; }
.settings.account .set-head h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--text-title);
  font-weight: var(--fw-display);
  letter-spacing: var(--track-display);
  line-height: var(--leading-display);
  text-wrap: balance;
}
.settings.account .set-who {
  max-width: 54ch;
  margin: 7px 0 0;
  color: var(--ink-3);
  font-size: var(--text-body);
  line-height: 1.45;
}
.settings.account .set-who b {
  color: var(--ink-2);
  font-weight: var(--fw-medium);
}
.settings.account .set-head-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 16px;
  padding-bottom: 2px;
}
.settings.account .set-plan-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-3);
  font-size: 11.5px;
  line-height: 1;
  white-space: nowrap;
}
.settings.account .set-plan-mark {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.settings.account .sbtn {
  height: 36px;
  text-decoration: none;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font-size: var(--text-label);
  transition: border-color var(--t-quick) var(--ease),
    color var(--t-quick) var(--ease), background-color var(--t-quick) var(--ease);
}
.settings.account .sbtn:hover {
  border-color: var(--ink-4);
  background: var(--field);
  color: var(--ink);
}
.settings.account .sbtn:disabled {
  cursor: default;
  opacity: .5;
}
.settings.account .ghost {
  height: 30px;
  text-decoration: none;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--ink-3);
  font-size: 11.5px;
}
.settings.account .ghost:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}
.settings.account .sbtn.danger {
  border-color: rgba(255, 133, 140, .3);
  color: var(--down);
}
.settings.account .sbtn.danger:hover {
  border-color: var(--down);
  background: rgba(255, 133, 140, .08);
}

.settings.account .set-sheet {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  column-gap: clamp(36px, 5vw, 72px);
  align-items: start;
}
.settings.account .set-nav-rail {
  min-width: 0;
  align-self: stretch;
}
.settings.account .set-nav {
  position: static;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-top: 31px;
}
.settings.account .set-nav a {
  display: block;
  padding: 10px 0;
  border-bottom: 1px solid transparent;
  color: var(--ink-4);
  font-size: 12px;
  line-height: 1.2;
  text-decoration: none;
  transition: color var(--t-quick) var(--ease),
    border-color var(--t-quick) var(--ease);
}
.settings.account .set-nav a:hover {
  border-bottom-color: var(--line-strong);
  color: var(--ink);
}
.settings.account .acct-grid { display: block; }
.settings.account .acct-main { display: block; min-width: 0; }

.settings.account .scard {
  position: relative;
  display: block;
  overflow: visible;
  margin: 0;
  padding: 28px 0 30px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  scroll-margin-top: 24px;
}
.settings.account .acct-main > .scard:first-child {
  padding-top: 30px;
  border-top: 0;
}
.settings.account .scard h3 {
  margin: 0 0 20px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(1.25rem, 1.85vw, 1.55rem);
  font-weight: var(--fw-regular);
  letter-spacing: -.022em;
  line-height: 1.15;
  text-wrap: balance;
}
.settings.account .scard p,
.settings.account .sub {
  color: var(--ink-4);
  font-size: 12px;
  line-height: 1.5;
}
.settings.account .scard .sub.good { color: var(--up); }
.settings.account .scard .sub.bad { color: var(--down); }

/* sign-in: one email row, then the three password fields on one register line;
   a phone stacks both forms at full width. */
.settings.account .signin-cols { display: block; }
.settings.account .signin-col { min-width: 0; }
.settings.account .signin-col + .signin-col { margin-top: 28px; }
.settings.account .signin-col .signin-note { margin: 0 0 18px; }
.settings.account .passform {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 0;
}
.settings.account .passform label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.35;
}
.settings.account .passform label b {
  color: var(--ink-2);
  font-weight: var(--fw-medium);
}
.settings.account .passform input {
  width: 100%;
  height: 40px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: .9375rem;
  font-weight: var(--fw-regular);
  outline: none;
  transition: border-color var(--t-quick) var(--ease);
}
.settings.account .passform input:hover { border-bottom-color: var(--ink-4); }
.settings.account .passform input:focus { border-bottom-color: var(--accent); }
.settings.account .passform input:focus-visible,
.settings.account .acfg-row input.num:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.settings.account .passform input::placeholder { color: var(--ink-4); opacity: 1; }
.settings.account .passform .sbtn {
  align-self: flex-start;
  margin-top: 2px;
}
.settings.account .signin-col .sub { margin: 8px 0 0; }

@media (min-width: 761px) {
  .settings.account .signin-col:first-child .passform {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 16px;
  }
  .settings.account .signin-col:first-child .passform .sbtn {
    align-self: end;
    margin-top: 0;
  }
  .settings.account .signin-col:last-child .passform {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
    gap: 18px 24px;
  }
  .settings.account .signin-col:last-child .passform .sbtn {
    grid-column: 1 / -1;
    justify-self: start;
    margin-top: 0;
  }
}

.settings.account .acfg-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}
.settings.account .acfg-head h3 { margin: 0; }
.settings.account .acfg-power {
  flex: 0 0 auto;
  color: var(--ink-4);
  font-size: 12px;
  line-height: 1.3;
}
.settings.account .acct-alert .acfg-power {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-3);
}
.settings.account .acfg-power-lbl { color: var(--ink-3); }
.settings.account .switch {
  width: 38px;
  height: 22px;
  border: 1px solid var(--line-strong);
  background: var(--field);
}
.settings.account .switch:checked {
  border-color: var(--accent);
  background: var(--accent);
}
.settings.account .acfg-rows {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}
.settings.account .acfg-row {
  display: grid;
  grid-template-columns: 8px 88px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line-soft);
}
.settings.account .acfg-row:last-child { border-bottom: 0; }
.settings.account .acfg-dot {
  width: 6px;
  height: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: transparent;
}
.settings.account .acfg-dot.on {
  border-color: var(--up);
  background: var(--up);
}
.settings.account .acfg-name {
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.35;
}
.settings.account .acfg-state {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-4);
  font-size: 12px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.settings.account .acfg-row input.num {
  width: 100%;
  height: 34px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 12.5px;
  outline: none;
  transition: border-color var(--t-quick) var(--ease);
}
.settings.account .acfg-row input.num:hover { border-bottom-color: var(--ink-4); }
.settings.account .acfg-row input.num:focus { border-bottom-color: var(--accent); }
.settings.account .acfg-row input.num::placeholder { color: var(--ink-4); opacity: 1; }
.settings.account .acfg-row input.num:disabled { cursor: not-allowed; }
.settings.account .acfg-row.off { opacity: .5; }
.settings.account .set-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.settings.account .acfg-row .ghost,
.settings.account .acfg-row .sbtn {
  height: 30px;
  min-height: 30px;
  padding: 0 10px;
  border-color: var(--line);
  background: transparent;
  color: var(--ink-3);
  font-size: 11.5px;
}
.settings.account .acfg-row .ghost:hover,
.settings.account .acfg-row .sbtn:hover {
  border-color: var(--line-strong);
  background: var(--field);
  color: var(--ink);
}
.settings.account .alertfoot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding-top: 16px;
}
.settings.account .acct-alert .alertfoot {
  margin-top: 4px;
  padding-right: 18px;
  border-top: 1px solid var(--line);
}
.settings.account .alertfoot .sub {
  margin: 0 auto 0 0;
  max-width: 62ch;
}
.settings.account .acct-alert .alertfoot .sbtn {
  border-color: var(--accent-line);
  color: var(--accent);
}
.settings.account .acct-alert .alertfoot .sbtn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* billing reads like the statement line it is */
.settings.account .acct-billing .facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 40px;
  margin: 0;
}
.settings.account .facts > div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 5px;
  padding: 12px 0;
  border: 0;
  border-top: 1px solid var(--line-soft);
}
.settings.account .facts dt {
  color: var(--ink-4);
  font-size: 11px;
  line-height: 1.3;
}
.settings.account .facts dd {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: var(--fw-medium);
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}
.settings.account .facts dd em {
  color: var(--ink-3);
  font-size: 12px;
  font-style: normal;
  font-weight: var(--fw-regular);
}
.settings.account .facts .pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: var(--fw-medium);
  letter-spacing: 0;
  line-height: 1;
}
.settings.account .acct-billing .facts > div:last-child { border-bottom: 0; }
.settings.account .bacts {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
}
.settings.account .bacts .ghost {
  height: auto;
  padding: 0;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  color: var(--ink-3);
  font-size: 12px;
}
.settings.account .bacts .ghost:hover {
  border-bottom-color: var(--line-strong);
  background: transparent;
  color: var(--ink);
}

/* the way out stays a closing rule, not a red card in the middle of the page */
.settings.account .scard.danger-fold {
  padding: 0;
  border-top: 1px solid var(--line);
}
.settings.account .scard.danger-fold > summary {
  padding: 26px 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(1.25rem, 1.85vw, 1.55rem);
  font-weight: var(--fw-regular);
  letter-spacing: -.022em;
  line-height: 1.15;
  list-style: none;
}
.settings.account .scard.danger-fold > summary::-webkit-details-marker { display: none; }
.settings.account .scard.danger-fold > summary::after {
  float: right;
  color: var(--ink-4);
  font-family: var(--sans);
  font-size: 20px;
  font-weight: var(--fw-regular);
  line-height: 1;
}
.settings.account .scard.danger-fold[open] > summary {
  border-bottom: 1px solid var(--line);
}
.settings.account .danger-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 680px;
  padding: 20px 0 30px;
}
.settings.account .danger-body .sub {
  max-width: 72ch;
  margin: 0;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.55;
}
.settings.account .danger-body .scard-foot { margin-top: 2px; }
.settings.account .danger-body .sbtn.danger { align-self: flex-start; }
.settings.account .danger-body .drow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.settings.account #del-form { margin-top: 4px; }
.settings.account #del-form .sub { margin-top: 2px; }

@media (max-width: 900px) {
  .settings.account .set-sheet { grid-template-columns: minmax(0, 1fr); }
  .settings.account .set-nav {
    position: static;
    flex-direction: row;
    gap: 22px;
    overflow-x: auto;
    padding: 0;
    border-bottom: 1px solid var(--line);
    scrollbar-width: none;
  }
  .settings.account .set-nav::-webkit-scrollbar { display: none; }
  .settings.account .set-nav a {
    flex: 0 0 auto;
    padding: 14px 0 12px;
    border-bottom: 0;
    font-size: 12px;
    white-space: nowrap;
  }
  .settings.account .set-nav a:hover {
    border-bottom: 0;
    color: var(--ink);
  }
  .settings.account .acct-main > .scard:first-child {
    padding-top: 26px;
    border-top: 0;
  }
}

/* At the smallest phone the five section names would otherwise push the last
   one off the end of the rail. Tighten the gap rather than hide a section or
   make the reader discover a horizontal scroll for a destructive action. */
@media (max-width: 360px) {
  .settings.account .set-nav { gap: 14px; }
}

@media (max-width: 760px) {
  .settings.account .set-head.mast {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 15px;
    padding: 14px 0 16px;
  }
  .settings.account .set-head-actions {
    justify-content: space-between;
    width: 100%;
    padding-bottom: 0;
  }
  .settings.account .acct-billing .facts {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 620px) {
  .settings.account { padding-bottom: 98px; }
  .settings.account .set-head h2 { font-size: var(--text-title); }
  .settings.account .set-who {
    margin-top: 10px;
    font-size: 12.5px;
  }
  .settings.account .set-plan-tag {
    height: 28px;
    padding: 0 10px;
    font-size: 11px;
  }
  .settings.account .sbtn {
    height: 38px;
    min-height: 38px;
  }
  .settings.account .set-head .sbtn { height: 38px; }
  .settings.account .passform { gap: 20px; }
  .settings.account .passform input {
    height: 42px;
    font-size: 16px;
  }
  .settings.account .acfg-head {
    align-items: center;
    gap: 12px;
  }
  .settings.account .acfg-row,
  .settings.account .acfg-row:not(.acfg-field),
  .settings.account .acfg-row.acfg-field {
    grid-template-columns: 7px minmax(0, 1fr) auto;
    align-items: start;
    column-gap: 10px;
    row-gap: 5px;
    padding: 13px 0;
  }
  .settings.account .acfg-row .acfg-dot {
    grid-column: 1;
    grid-row: 1;
    margin-top: 6px;
  }
  .settings.account .acfg-row .acfg-name {
    grid-column: 2;
    grid-row: 1;
  }
  .settings.account .acfg-row .acfg-state,
  .settings.account .acfg-row input.num {
    grid-column: 2 / -1;
    grid-row: 2;
  }
  .settings.account .acfg-row .acfg-state {
    padding-right: 4px;
    white-space: normal;
  }
  .settings.account .acfg-row .set-actions {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
  }
  .settings.account .acfg-row input.num {
    height: 34px;
    font-size: 16px;
  }
  .settings.account .acfg-row .ghost,
  .settings.account .acfg-row .sbtn {
    height: 32px;
    min-height: 32px;
    padding: 0 10px;
  }
  .settings.account .alertfoot {
    align-items: flex-end;
    gap: 10px;
  }
  .settings.account .facts dd { font-size: 15px; }
  .settings.account .bacts {
    flex-wrap: wrap;
    gap: 14px 18px;
  }
  .settings.account .danger-body { padding: 18px 0 26px; }
}

/* ---------------------------------------------------------- account pages --- */
/* Lists, flips and alerts are three instruments on one desk: an index, a
   blotter and a signal board. They share ruled rows, square controls and a
   single reading rhythm instead of a stack of cards. */
a.rail-tab { text-decoration: none; }

.shell:is([data-screen="lists"], [data-screen="flips"], [data-screen="alerts"]) .workspace {
  grid-template-columns: minmax(0, 1fr);
}
.shell:is([data-screen="lists"], [data-screen="flips"], [data-screen="alerts"]) .market-mast,
.shell:is([data-screen="lists"], [data-screen="flips"], [data-screen="alerts"]) .col-side,
.shell:is([data-screen="lists"], [data-screen="flips"], [data-screen="alerts"]) .opt-screen,
.shell:is([data-screen="lists"], [data-screen="flips"], [data-screen="alerts"]) .band-stats,
.shell:is([data-screen="lists"], [data-screen="flips"], [data-screen="alerts"]) .ph-filter {
  display: none;
}

.desk-page {
  display: flex; flex-direction: column; gap: 0;
  /* The surface ends with its last row. The old 50px pad sat inside the card
     border and read as an empty footer; the phone's nav clearance is added in
     the narrow-window rules below. */
  padding: 0;
}
.desk-head { padding: 16px 0 18px; }
.desk-page .hub-title {
  margin: 0; color: var(--ink);
  font-size: clamp(2.4rem, 3.4vw, 3.5rem); font-weight: var(--fw-medium);
  letter-spacing: -.04em; line-height: .94;
}
.desk-side {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 11px; min-width: 0;
}
.desk-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.desk-meta {
  margin: 0; color: var(--ink-4);
  font-size: var(--text-micro); line-height: var(--leading-label);
  letter-spacing: .01em; text-align: right;
}
.desk-page :is(.sbtn, .ghost) {
  min-height: 36px; height: 36px; padding: 0 13px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 3px; font-size: var(--text-label); font-weight: var(--fw-medium);
  white-space: nowrap;
}
.desk-page .ghost { background: transparent; }
.desk-page .panel-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; padding: 17px 20px 15px;
  border-bottom: 1px solid var(--line);
}
.desk-page .panel-head h3 {
  margin: 0; color: var(--ink);
  font-size: var(--text-body); font-weight: var(--fw-medium); letter-spacing: -.005em;
}
.desk-page .panel-sub {
  margin: 3px 0 0; max-width: 46ch;
  color: var(--ink-4); font-size: var(--text-micro); line-height: var(--leading-label);
}
.desk-page .panel-head .n,
.desk-page .panel-link {
  flex: 0 0 auto; color: var(--ink-4);
  font-size: var(--text-micro); font-variant-numeric: tabular-nums;
}
.desk-page .panel-link {
  padding-bottom: 2px; border-bottom: 1px solid var(--line-strong);
  text-decoration: none; white-space: nowrap;
}
.desk-page .panel-link:hover { color: var(--ink); border-bottom-color: var(--ink-3); }

/* ---- Lists: an index, a quote ledger and the read ---- */
.lists-work {
  display: grid; grid-template-columns: 214px minmax(0, 1fr) 286px;
  align-items: stretch; border-bottom: 1px solid var(--line);
}
@media (min-width: 901px) {
  /* The ledger owns the window rather than stopping under four rows: its
     foot and the read's note meet the same quiet edge. */
  .lists-work { min-height: calc(100dvh - 220px); }
}
.lists-rail {
  display: flex; flex-direction: column; gap: 0;
  align-self: stretch; min-width: 0;
  padding: 17px 16px 16px 2px;
  border: 0; border-right: 1px solid var(--line);
  border-radius: 0; background: none;
  position: static;
}
.lists-cap {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 0 0 8px; padding: 0 5px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-4); font-size: 11px; font-weight: var(--fw-medium);
  letter-spacing: .08em; text-transform: uppercase;
}
.lists-cap span:last-child { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.lists-none, .lists-kept {
  margin: 6px 5px 10px; color: var(--ink-4);
  font-size: var(--text-micro); line-height: var(--leading-body);
}
.lists-kept { color: var(--ink-3); }
.list-pick {
  display: flex; align-items: center; gap: 9px; width: 100%;
  min-height: 48px; padding: 8px 5px;
  border: 0; border-bottom: 1px solid var(--line-soft); border-radius: 0;
  background: none; color: var(--ink-2); text-align: left; cursor: pointer;
  transition: color var(--t-quick), background var(--t-quick), border-color var(--t-quick);
}
.list-pick:hover { color: var(--ink); background: var(--hover); }
.list-pick[aria-current="true"] {
  border-bottom-color: var(--accent-line); background: var(--accent-soft); color: var(--ink);
}
.list-pick .lamp {
  flex: 0 0 7px; width: 7px; height: 7px;
  background: var(--line-strong); transition: background var(--t-quick);
}
.list-pick[aria-current="true"] .lamp { background: var(--accent); }
.list-pick .nm {
  flex: 1 1 auto; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
  font-size: var(--text-label); font-weight: var(--fw-medium);
}
.list-pick .n {
  flex: 0 0 auto; color: var(--ink-4);
  font-size: 11px; font-variant-numeric: tabular-nums;
}
.list-pick[aria-current="true"] .n { color: var(--accent-2); }

.lists-ledger {
  display: flex; flex-direction: column; min-width: 0;
  padding: 17px 22px 0;
  border-right: 1px solid var(--line);
}
.ledger-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-bottom: 14px; border-bottom: 1px solid var(--line);
}
.ledger-head h2 {
  margin: 0; color: var(--ink);
  font-size: 1.6rem; font-weight: var(--fw-medium);
  line-height: 1.12; letter-spacing: -.02em;
}
.sheet-sub {
  margin: 4px 0 0; color: var(--ink-4);
  font-size: var(--text-micro); font-variant-numeric: tabular-nums;
}
.lists-body { flex: 1 1 auto; min-width: 0; min-height: 280px; }

.ltable { display: flex; flex-direction: column; }
.lhead, .lline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px 72px 86px 28px;
  align-items: center; gap: 10px; padding: 0 4px;
}
/* The board's ruler: mono micro labels over a hairline, with the figures'
   columns named on their own right edge. */
.lhead {
  height: 39px; border-bottom: 1px solid var(--line);
  color: var(--ink-4);
  font-family: var(--mono); font-size: var(--text-micro); font-weight: var(--fw-medium);
  letter-spacing: .1em; text-transform: uppercase;
}
.lhead button {
  justify-self: start; padding: 3px 0; border: 0; background: none;
  color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit;
  white-space: nowrap; cursor: pointer;
}
.lhead button[data-wsort="last"],
.lhead button[data-wsort="chg"],
.lhead > span { justify-self: end; }
.lhead button:hover { color: var(--ink-2); }
.lhead button[aria-pressed="true"] { color: var(--ink); }
.lhead i { margin-left: 3px; color: var(--accent); font-style: normal; }
.lline { min-height: 40px; border-bottom: 1px solid var(--line-soft); }
.lline:last-child { border-bottom: 0; }
.lline:hover { background: var(--hover); }
.litem {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  padding: 4px 0; border: 0; background: none;
  color: var(--ink); text-align: left; cursor: pointer;
}
.litem .lico {
  width: 30px; height: 30px; flex: 0 0 30px;
  display: grid; place-items: center;
  padding: 3px; border-radius: 6px; background: var(--field);
}
.litem .lico img { width: 24px; height: 24px; object-fit: contain; image-rendering: pixelated; }
.litem b {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: var(--text-label); font-weight: var(--fw-medium); letter-spacing: 0;
}
.litem .f2p {
  flex: 0 0 auto;
  padding: 1px 5px; border-radius: 5px;
  background: var(--field); color: var(--ink-4);
  font-size: var(--text-label); font-weight: var(--fw-medium); letter-spacing: 0;
}
.llast, .lchg {
  text-align: right; font-variant-numeric: tabular-nums;
  font-family: var(--mono); font-size: var(--text-label);
  font-weight: var(--fw-medium); white-space: nowrap;
}
.llast { color: var(--ink); }
.lchg { color: var(--ink-3); }
.lchg.up { color: var(--up); }
.lchg.down { color: var(--down); }
/* A change carries its direction as a mark as well as a colour, as on the board. */
.lchg.up::before, .lchg.down::before {
  margin-right: 4px; font-size: .68em; vertical-align: .08em;
}
.lchg.up::before { content: "▲"; }
.lchg.down::before { content: "▼"; }
.lmove {
  position: relative; display: block; width: 100%; height: 12px;
}
.lmove::before {
  content: ""; position: absolute; left: 50%; top: 3px; width: 1px; height: 6px;
  background: var(--line);
}
.lmove i {
  position: absolute; top: 5px; left: 50%; height: 2px; min-width: 0;
  background: var(--ink-4); transition: width var(--t-move) var(--ease);
}
.lmove i.up { background: var(--up); }
.lmove i.down { right: 50%; left: auto; background: var(--down); }
.lists-ledger .wdel {
  width: 28px; height: 32px; opacity: 0;
  border-radius: 2px; color: var(--ink-4);
}
.lline:hover .wdel, .lists-ledger .wdel:focus-visible { opacity: 1; }
.lline .wdel:hover { color: var(--down); background: var(--down-soft); }

.lists-readout {
  min-width: 0; padding: 17px 20px 20px;
  background: var(--bg-2);
}
.readout-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 0 0 11px; border-bottom: 1px solid var(--line);
  color: var(--ink-3); font-size: 11px; font-weight: var(--fw-medium);
  letter-spacing: .08em; text-transform: uppercase;
}
.readout-head span:last-child { color: var(--ink-4); font-size: 10px; letter-spacing: .02em; text-transform: none; }
.readout-avg {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline;
  gap: 2px 12px; padding: 17px 0 16px; border-bottom: 1px solid var(--line-soft);
}
.readout-avg span { color: var(--ink-4); font-size: 11px; }
.readout-avg b {
  grid-column: 2; grid-row: 1 / span 2; justify-self: end;
  color: var(--ink); font-size: 26px; font-weight: var(--fw-medium);
  line-height: 1; letter-spacing: -.03em;
}
.readout-avg b.up { color: var(--up); }
.readout-avg b.down { color: var(--down); }
.readout-avg small { color: var(--ink-4); font-size: 10px; }
.readout-mover {
  display: grid; grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center; gap: 5px 8px; padding: 13px 0;
  border-bottom: 1px solid var(--line-soft);
}
.readout-label {
  grid-column: 1 / -1; color: var(--ink-4);
  font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
}
.readout-ico { width: 24px; height: 24px; display: grid; place-items: center; }
.readout-ico img { width: 24px; height: 24px; object-fit: contain; image-rendering: pixelated; }
.readout-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink-2); font-size: var(--text-label);
}
.readout-mover b { font-size: 13px; font-weight: var(--fw-medium); font-variant-numeric: tabular-nums; }
.readout-mover b.up { color: var(--up); }
.readout-mover b.down { color: var(--down); }
.readout-breadth { padding: 16px 0 0; }
.readout-breadth-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  color: var(--ink-4); font-size: 11px;
}
.readout-breadth-head span:last-child { font-size: 10px; }
.breadth-bar {
  display: flex; width: 100%; height: 5px; margin: 9px 0 8px;
  background: var(--field); overflow: hidden;
}
.breadth-bar i { display: block; height: 100%; }
.breadth-bar .up { background: var(--up); }
.breadth-bar .flat { background: var(--line-strong); }
.breadth-bar .down { background: var(--down); }
.breadth-key {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  color: var(--ink-4); font-size: 10px;
}
.breadth-key b { color: var(--ink-2); font-weight: var(--fw-medium); }
.readout-note {
  margin: 18px 0 0; padding-top: 13px; border-top: 1px solid var(--line-soft);
  color: var(--ink-4); font-size: 11px; line-height: 1.5;
}

/* ---- Flips: a position blotter ---- */
.page-flips-body { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.flip-summary {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0; padding: 0; border: 0; border-bottom: 1px solid var(--line);
  border-radius: 0; background: transparent;
}
.book-kpi {
  display: flex; flex-direction: column; gap: 3px; min-width: 0;
  padding: 17px 20px 16px 0;
}
.book-kpi + .book-kpi { padding-left: 20px; border-left: 1px solid var(--line-soft); }
.book-kpi span {
  color: var(--ink-4); font-size: 10px; font-weight: var(--fw-medium);
  letter-spacing: .08em; text-transform: uppercase;
}
.book-kpi b {
  color: var(--ink); font-size: 28px; font-weight: var(--fw-medium);
  line-height: 1.05; letter-spacing: -.03em; font-variant-numeric: tabular-nums;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.book-kpi b.up { color: var(--up); }
.book-kpi b.down { color: var(--down); }
.book-kpi small {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink-4); font-size: 10px; line-height: var(--leading-label);
}
.flip-tools {
  display: flex; align-items: center; justify-content: space-between; gap: 8px 16px;
  flex-wrap: wrap; margin: 0; padding: 9px 2px 10px;
  border-bottom: 1px solid var(--line);
}
.flip-tools .flip-filters { margin: 0; }
.flip-filters { display: flex; align-items: center; gap: 1px; flex-wrap: wrap; }
.flip-filters button {
  height: 32px; padding: 0 10px;
  display: inline-flex; align-items: center; gap: 5px;
  border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  background: none; color: var(--ink-3); font-size: 12px; cursor: pointer;
}
.flip-filters button span { color: var(--ink-4); font-size: 10px; font-variant-numeric: tabular-nums; }
.flip-filters button:hover { color: var(--ink-2); background: var(--hover); }
.flip-filters button[aria-pressed="true"] {
  border-bottom-color: var(--accent); background: transparent; color: var(--ink);
}
.flip-filters button[aria-pressed="true"] span { color: var(--accent); }
.flip-sort {
  display: inline-flex; align-items: center; gap: 7px;
  margin: 0 0 0 auto; color: var(--ink-4); font-size: 11px;
}
.flip-sort select {
  height: 30px; padding: 0 25px 0 8px;
  border: 1px solid var(--line); border-radius: 3px;
  background: var(--bg-2); color: var(--ink-2);
  font-size: 11px; cursor: pointer;
}
.flip-sort select:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; }
.flip-error { margin: 10px 0 0; color: var(--down); font-size: var(--text-micro); }

.blotter-head, .flip-row-main {
  display: grid;
  grid-template-columns: minmax(230px, 1.55fr) minmax(150px, 1fr) minmax(145px, .9fr) minmax(150px, .95fr) 192px;
  gap: 18px;
}
.blotter-head {
  align-items: center; min-height: 33px; padding: 0 20px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-4); font-size: 10px; font-weight: var(--fw-medium);
  letter-spacing: .08em; text-transform: uppercase;
}
.flip-list { display: flex; flex-direction: column; gap: 0; }
.page-flips-body .flip-list { display: flex; flex-direction: column; gap: 0; }
.page-flips .flip-card.flip-row {
  padding: 0; border: 0; border-bottom: 1px solid var(--line);
  border-radius: 0; background: transparent;
  transition: background var(--t-quick);
}
.page-flips .flip-card.flip-row:hover { background: var(--hover); }
.page-flips .flip-card.flip-row.open { background: var(--bg-2); border-bottom-color: var(--line-strong); }
.flip-row-main { align-items: center; padding: 15px 20px 11px; min-width: 0; }
.flip-id { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.page-flips .flip-item { gap: 10px; padding: 0; }
.flip-ico {
  display: grid; place-items: center; flex: 0 0 32px;
  width: 32px; height: 32px; overflow: hidden;
  border-radius: 2px; background: var(--field);
  color: var(--ink-3); font-size: var(--text-label);
}
.flip-ico img { width: 28px; height: 28px; object-fit: contain; image-rendering: pixelated; }
.flip-copy { gap: 2px; }
.flip-copy b { font-size: 14px; letter-spacing: -.005em; }
.flip-copy span { color: var(--ink-4); font-size: 11px; }
.flip-tags { margin-top: 0; gap: 5px; }
.page-flips .flip-state {
  padding: 2px 6px; border: 1px solid var(--line); border-radius: 2px;
  font-size: 10px; font-weight: var(--fw-medium); letter-spacing: .04em;
  text-transform: uppercase;
}
.page-flips .flip-state.planned { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.page-flips .flip-state.open { border-color: color-mix(in srgb, var(--up) 35%, transparent); background: var(--up-soft); color: var(--up); }
.page-flips .flip-state.closed { border-color: color-mix(in srgb, var(--down) 35%, transparent); background: var(--down-soft); color: var(--down); }
.page-flips .flip-state.cancelled { color: var(--ink-4); }

.cell-label {
  display: block; margin-bottom: 5px;
  color: var(--ink-4); font-size: 10px; font-weight: var(--fw-medium);
  letter-spacing: .06em; text-transform: uppercase;
}
.flip-quote { min-width: 0; }
.page-flips .flip-live {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 10px; margin: 0;
  font-size: 10px; color: var(--ink-4);
}
.page-flips .flip-live span:not(.flip-age) {
  display: flex; flex-direction: column; gap: 1px; min-width: 0;
}
.page-flips .flip-live b {
  color: var(--ink); font-size: 13px; font-weight: var(--fw-medium);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.page-flips .flip-live .sell b { color: var(--accent-2); }
.page-flips .flip-age {
  grid-column: 1 / -1; margin: 0; color: var(--ink-4);
  font-size: 10px; line-height: var(--leading-label);
}
.page-flips .flip-age.stale { color: var(--down); }
.flip-position { min-width: 0; }
.pos-line { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pos-line b { color: var(--ink-2); font-size: 12px; font-weight: var(--fw-medium); white-space: nowrap; }
.pos-line span { color: var(--ink-4); font-size: 10px; white-space: nowrap; }
.page-flips .flip-bar { height: 3px; margin: 7px 0 0; border-radius: 0; background: var(--field); overflow: hidden; }
.page-flips .flip-bar span { height: 100%; border-radius: 0; background: var(--accent); }
.flip-pnl { min-width: 0; }
.flip-pnl > b {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink); font-size: 20px; font-weight: var(--fw-medium);
  line-height: 1.1; letter-spacing: -.025em; font-variant-numeric: tabular-nums;
}
.flip-pnl > b.up { color: var(--up); }
.flip-pnl > b.down { color: var(--down); }
.pnl-sub {
  display: block; margin-top: 3px; overflow: hidden; text-overflow: ellipsis;
  color: var(--ink-4); font-size: 10px; white-space: nowrap;
}
.page-flips .flip-acts {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 4px; flex-wrap: wrap; margin: 0;
}
.page-flips .flip-acts .abtn,
.page-flips .flip-acts .ghost {
  height: 29px; min-height: 29px; padding: 0 8px;
  border-radius: 2px; font-size: 11px;
}
.page-flips .flip-buy { color: var(--up); border-color: color-mix(in srgb, var(--up) 28%, var(--line)); }
.page-flips .flip-sell { color: var(--accent); border-color: var(--accent-line); }
.page-flips .flip-more { margin-left: 0; }
.flip-facts {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px 16px; padding: 0 20px 12px;
}
.flip-facts span { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.flip-facts em {
  flex: 0 0 34px; color: var(--ink-4);
  font-size: 10px; font-style: normal; letter-spacing: .04em; text-transform: uppercase;
}
.flip-facts b {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink-3); font-size: 11px; font-weight: var(--fw-regular);
  font-variant-numeric: tabular-nums;
}
.flip-facts b.up { color: var(--up); }
.flip-facts b.down { color: var(--down); }
.page-flips .flip-note {
  margin: 0; padding: 0 20px 12px;
  color: var(--ink-3); font-size: 11px; line-height: var(--leading-label);
}
.page-flips .flip-detail {
  margin: 0 20px 14px; padding: 12px 0 5px;
  border-top: 1px solid var(--line-soft);
}
.flip-detail .flip-ledger-head {
  font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-4);
}
.flip-detail-acts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.flip-detail-acts .ghost { height: 29px; min-height: 29px; border-radius: 2px; font-size: 11px; }
.page-flips .flip-empty-line, .page-flips .flip-empty {
  margin: 0; padding: 44px 20px; color: var(--ink-4); font-size: var(--text-micro);
}
.page-flips .flip-empty-line {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding-block: 60px; text-align: center;
}
.page-flips .flip-empty-line b {
  color: var(--ink); font-size: var(--text-body); font-weight: var(--fw-medium);
}
.page-flips .flip-empty-line p {
  max-width: 44ch; margin: 0; line-height: var(--leading-body);
}
.page-flips .flip-empty b { color: var(--ink); font-size: var(--text-body); }

.flip-picker {
  display: block; margin: 0; padding: 15px 20px 16px;
  border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  background: var(--bg-2);
}
.flip-picker[hidden] { display: none; }
.flip-picker-form { display: flex; align-items: center; gap: 12px; }
.flip-picker label {
  flex: 0 0 auto; color: var(--ink-3);
  font-size: 10px; font-weight: var(--fw-medium);
  letter-spacing: .07em; text-transform: uppercase;
}
.flip-picker input {
  flex: 1 1 auto; width: 100%; height: 36px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 3px;
  background: var(--field); color: var(--ink); font-size: var(--text-label);
}
.flip-picker input:focus { outline: 1px solid var(--accent); outline-offset: 0; }
.flip-picker-results {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px; margin-top: 8px;
}
.flip-picker-results:empty { display: none; }
.flip-picker-note { grid-column: 1 / -1; margin: 3px 0; color: var(--ink-4); font-size: 11px; }
.flip-pick {
  display: flex; align-items: center; gap: 9px;
  min-height: 38px; padding: 5px 2px;
  border: 0; border-bottom: 1px solid var(--line-soft); border-radius: 0;
  background: none; color: var(--ink); text-align: left; cursor: pointer;
}
.flip-pick:hover { background: var(--hover); }
.flip-pick-ico { flex: 0 0 24px; width: 24px; height: 24px; line-height: 0; }
.flip-pick-ico img, .flip-pick-ico span { width: 24px; height: 24px; object-fit: contain; display: grid; place-items: center; }
.flip-pick-name { flex: 1 1 auto; font-size: var(--text-label); }
.flip-pick b { color: var(--ink-4); font-size: 11px; font-weight: var(--fw-regular); font-variant-numeric: tabular-nums; }

/* ---- Alerts: a signal board and its record ---- */
.alerts-console {
  display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(340px, .85fr);
  align-items: stretch; border-bottom: 1px solid var(--line);
}
.alerts-rules {
  display: flex; flex-direction: column; min-width: 0;
  border-right: 1px solid var(--line);
}
.alerts-rules #alerts-page-lines { flex: 1 1 auto; min-width: 0; }
.page-alert-lines { gap: 0; padding: 0 20px; }
.page-alerts .aitem {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "name meta"
    "line line";
  gap: 8px 16px; padding: 19px 0 18px;
  border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  background: transparent;
  transition: background var(--t-quick);
}
.page-alerts .aitem:last-child { border-bottom: 0; }
.page-alerts .aitem:hover { background: var(--hover); }
.page-alerts .aitem .anm {
  grid-area: name; gap: 9px; min-width: 0;
  color: var(--ink); font-size: var(--text-label); font-weight: var(--fw-medium);
}
.page-alerts .aico { flex: 0 0 26px; width: 26px; height: 26px; }
.page-alerts .aico img, .page-alerts .aico svg { width: 26px; height: 26px; object-fit: contain; image-rendering: pixelated; }
.page-alerts .anm [data-aname] { font-size: var(--text-label); font-weight: var(--fw-medium); color: var(--ink); }
.page-alerts .aitem .aonce, .page-alerts .aitem .acts {
  grid-area: meta; justify-self: end; align-self: start;
}
.page-alerts .aonce {
  padding: 2px 6px; border: 1px solid var(--line); border-radius: 2px;
  background: transparent; color: var(--ink-4);
  font-size: 10px; font-weight: var(--fw-medium);
  letter-spacing: .05em; text-transform: uppercase;
}
.page-alerts .aonce.fired { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.page-alerts .arearm {
  width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 2px;
  background: transparent; color: var(--ink-3);
}
.page-alerts .arearm:hover { border-color: var(--line-strong); color: var(--accent); }
.page-alerts .alvl {
  grid-area: line; display: grid;
  grid-template-columns: minmax(0, 1fr) auto; align-items: end;
  gap: 2px 20px; min-width: 0;
  color: var(--ink-3); font-size: var(--text-label);
}
.page-alerts .aline {
  align-self: end; min-width: 0; padding-bottom: 4px;
  color: var(--ink-3); font-size: 12px; line-height: var(--leading-label);
}
.page-alerts .aval {
  justify-self: end; color: var(--ink);
  font-size: clamp(1.65rem, 2.5vw, 2rem); font-weight: var(--fw-medium);
  line-height: .95; letter-spacing: -.035em;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.page-alerts .aval em { margin-left: 4px; color: var(--ink-3); font-size: 12px; letter-spacing: 0; }
.page-alerts .aguard {
  grid-column: 1 / -1; margin-top: 3px;
  color: var(--ink-4); font-size: 11px; line-height: var(--leading-label);
}
.alerts-feed {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--bg-2);
}
.alerts-feed #alerts-page-log {
  flex: 1 1 auto; max-height: 680px; overflow: auto;
  scrollbar-width: thin; scrollbar-color: var(--scroll) transparent;
}
.alerts-feed .apanel-note { margin: 0; padding: 20px; color: var(--ink-4); font-size: var(--text-micro); }
.alerts-feed .apanel-logs { padding: 2px 0 10px; }
.alerts-feed .nday {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px 7px;
  color: var(--ink-4); font-size: 10px; font-weight: var(--fw-medium);
  letter-spacing: .08em; text-transform: uppercase;
}
.alerts-feed .nday::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--line); }
.alerts-feed .nday span { flex: 0 0 auto; }
.alerts-feed .nrow {
  display: grid; grid-template-columns: 6px 26px minmax(0, 1fr) auto;
  align-items: center; gap: 10px; width: 100%;
  padding: 11px 18px;
  border: 0; border-bottom: 1px solid var(--line-soft);
  background: transparent; text-align: left;
  transition: background var(--t-quick);
}
.alerts-feed button.nrow:hover { background: var(--hover); }
.alerts-feed .nwrap.unread .nrow { background: var(--accent-soft); }
.alerts-feed .nwrap:last-child .nrow { border-bottom: 0; }
.alerts-feed .ndot {
  width: 6px; height: 6px; border-radius: 0; background: var(--ink-4);
}
.alerts-feed .nwrap.unread .ndot { background: var(--accent); box-shadow: none; }
.alerts-feed .n-ico {
  width: 26px; height: 26px; border-radius: 2px; background: var(--field);
}
.alerts-feed .n-ico img { width: 24px; height: 24px; object-fit: contain; image-rendering: pixelated; }
.alerts-feed .ntext { gap: 2px; }
.alerts-feed .ntext b { font-size: 12px; color: var(--ink-2); }
.alerts-feed .ntext span {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden; white-space: normal;
  color: var(--ink-4); font-size: 11px; line-height: var(--leading-label);
}
.alerts-feed .nwhen { font-size: 10px; color: var(--ink-4); }
.alerts-feed .nwrap.fresh .nrow { animation: none; }

.desk-page .apanel-empty { padding: 52px 20px; }
.desk-page .apanel-empty .ae-title { color: var(--ink); }
.desk-page .apanel-empty .ae-sub { max-width: 48ch; margin-inline: auto; color: var(--ink-4); }

/* The sheet's own frame already closes these surfaces, at every width. A work
   area that is the last block in it drew a second rule: one pixel inside the
   frame on a desk, a floating line above the sheet's foot on a phone. */
.desk-page > :last-child.lists-work { border-bottom: 0; }

@media (max-width: 1120px) {
  .lists-work { grid-template-columns: 190px minmax(0, 1fr); }
  .lists-ledger { border-right: 0; }
  .lists-readout {
    grid-column: 1 / -1; display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0 24px; padding: 18px 20px;
    border-top: 1px solid var(--line);
  }
  .lists-readout .readout-head { grid-column: 1 / -1; }
  .lists-readout .readout-avg { border-bottom: 0; }
  .lists-readout .readout-mover { border-bottom: 0; align-content: start; }
  .lists-readout .readout-breadth { padding-top: 0; }
  .lists-readout .readout-note {
    grid-column: 1 / -1; margin-top: 16px; padding-top: 11px;
    border-top: 1px solid var(--line-soft);
  }
}

@media (max-width: 980px) {
  .alerts-console { grid-template-columns: minmax(0, 1fr); }
  .alerts-rules { border-right: 0; }
  .alerts-feed { border-top: 1px solid var(--line); }
  /* The page owns the scroll once the feed sits under the lines; a second
     scrollport inside it hid the older entries behind a second scrollbar. */
  .alerts-feed #alerts-page-log { max-height: none; overflow: visible; }
  .blotter-head, .flip-row-main {
    grid-template-columns: minmax(190px, 1.35fr) minmax(130px, .9fr) minmax(130px, .85fr) minmax(145px, .9fr) 180px;
    gap: 14px;
  }
}

@media (max-width: 900px) {
  .desk-head { gap: 18px; }
  .book-kpi { padding-right: 14px; }
  .book-kpi + .book-kpi { padding-left: 14px; }
  .book-kpi b { font-size: 24px; }
  .blotter-head { display: none; }
  .flip-row-main {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
    gap: 14px 24px; padding: 16px 20px 12px;
  }
  .flip-id { grid-column: 1 / -1; }
  .flip-quote { grid-column: 1; }
  .flip-position { grid-column: 2; }
  .flip-pnl { grid-column: 1; }
  .flip-acts { grid-column: 2; align-self: end; }
  .flip-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .desk-page { padding-bottom: 28px; }
  .desk-head {
    grid-template-columns: minmax(0, 1fr); align-items: start;
    gap: 15px; padding-bottom: 18px;
  }
  .desk-page .hub-title { font-size: 2.6rem; }
  .desk-side { align-items: stretch; gap: 9px; width: 100%; }
  .desk-actions { justify-content: stretch; width: 100%; flex-wrap: nowrap; }
  .desk-actions > * { flex: 1 1 0; min-width: 0; }
  .desk-actions .sbtn, .desk-actions .ghost { width: auto; }
  .desk-meta { text-align: left; }

  .lists-work { grid-template-columns: minmax(0, 1fr); }
  .lists-rail {
    flex-direction: row; align-items: stretch; gap: 0;
    padding: 0; border-right: 0; border-bottom: 1px solid var(--line);
    overflow-x: auto; scrollbar-width: none;
  }
  /* With no saved lists the strip collapsed to a 1px rule sitting on the
     head's own rule; there is nothing to show. */
  .lists-rail:not(:has(.list-pick)) { display: none; }
  .lists-rail::-webkit-scrollbar { display: none; }
  .lists-cap, .lists-none, .lists-kept { display: none; }
  .list-pick {
    flex: 0 0 auto; width: auto; min-width: 124px;
    min-height: 45px; padding: 0 12px;
    border-bottom: 2px solid transparent;
  }
  .list-pick[aria-current="true"] { border-bottom-color: var(--accent); }
  .list-pick .lamp { display: none; }
  .list-pick .nm { font-size: 12px; }

  .lists-ledger { padding: 14px 14px 0; }
  .ledger-head { padding-bottom: 12px; }
  .ledger-head h2 { font-size: 1.35rem; }
  .ledger-head .ghost { height: 32px; min-height: 32px; padding: 0 9px; font-size: 11px; }
  .lists-body { min-height: 180px; }
  /* On a phone the head is a sort strip, not a column ruler: the values live
     inside each ruled row, so labels that looked like columns only pointed at
     empty space. */
  .lhead {
    display: flex; align-items: center; gap: 0;
    height: 38px; padding: 0 2px;
  }
  .lhead::before {
    content: "Sort"; flex: 0 0 auto; margin-right: 7px;
    color: var(--ink-4); font-size: 9px; font-weight: var(--fw-medium);
    letter-spacing: .08em; text-transform: uppercase;
  }
  .lhead > span { display: none; }
  .lhead button {
    align-self: stretch; display: inline-flex; align-items: center;
    padding: 0 7px;
    border-bottom: 2px solid transparent;
  }
  .lhead button[aria-pressed="true"] { border-bottom-color: var(--accent); }
  .lline {
    grid-template-columns: minmax(0, 1fr) auto 44px;
    grid-template-areas:
      "item chg del"
      "last move move";
    gap: 3px 10px; min-height: 0; padding: 7px 2px 8px;
  }
  .litem { grid-area: item; padding: 0; gap: 8px; }
  .litem .lico { width: 28px; height: 28px; flex: 0 0 28px; padding: 2px; }
  .litem b { font-size: var(--text-label); }
  .litem .f2p { font-size: 10px; padding: 1px 4px; }
  .lchg { grid-area: chg; font-size: var(--text-label); }
  .llast { grid-area: last; justify-self: start; text-align: left; font-size: var(--text-label); color: var(--ink-3); }
  .llast::before { content: "Last "; color: var(--ink-4); font-size: 10px; font-family: var(--sans); letter-spacing: 0; }
  .lmove { grid-area: move; width: 100%; height: 12px; }
  .lmove i { top: 5px; }
  .lists-ledger .wdel { grid-area: del; opacity: 1; width: 44px; height: 44px; min-width: 44px; }
  .lists-ledger .wdel svg { width: 14px; height: 14px; }
  .lists-readout {
    display: block; grid-column: auto; padding: 16px 14px 18px;
  }
  .lists-readout .readout-head { display: flex; }
  .lists-readout .readout-avg { border-bottom: 1px solid var(--line-soft); }
  .lists-readout .readout-mover { border-bottom: 1px solid var(--line-soft); }
  .lists-readout .readout-breadth { padding-top: 15px; }
  .lists-readout .readout-note { margin-top: 16px; }

  .flip-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .book-kpi { padding: 14px 14px 13px 0; }
  .book-kpi:nth-child(3) { padding-left: 0; border-left: 0; border-top: 1px solid var(--line-soft); }
  .book-kpi:nth-child(4) { border-top: 1px solid var(--line-soft); }
  .book-kpi b { font-size: 23px; }
  .flip-tools { padding: 7px 0 8px; }
  .flip-filters { width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .flip-filters::-webkit-scrollbar { display: none; }
  .flip-filters button { flex: 0 0 auto; padding: 0 9px; }
  .flip-sort {
    flex: 1 1 100%; width: 100%;
    margin-left: 0; justify-content: space-between;
  }
  .flip-picker { padding: 13px 14px 14px; }
  .flip-picker-form { flex-direction: column; align-items: stretch; gap: 6px; }
  .flip-picker label { font-size: 10px; }
  .flip-picker-results { grid-template-columns: 1fr; }
  .flip-row-main { padding: 15px 14px 11px; gap: 13px 16px; }
  .flip-facts { padding: 0 14px 11px; gap: 4px 12px; }
  .flip-facts em { flex-basis: 30px; }
  .page-flips .flip-note { margin: 0; padding: 0 14px 12px; }
  .page-flips .flip-detail { margin: 0 14px 12px; padding: 12px 0 5px; }

  .alerts-rules .panel-head, .alerts-feed .panel-head { padding: 14px; }
  .alerts-rules .panel-head h3, .alerts-feed .panel-head h3 { font-size: var(--text-label); }
  .page-alert-lines { padding: 0 14px; }
  .page-alerts .aitem { gap: 7px 12px; padding: 16px 0; }
  .page-alerts .aico, .page-alerts .aico img, .page-alerts .aico svg { width: 24px; height: 24px; flex-basis: 24px; }
  .page-alerts .aitem .anm { font-size: 12px; }
  .page-alerts .aval { font-size: 26px; }
  .page-alerts .aline { font-size: 11px; }
  .page-alerts .aguard { font-size: 10px; }
  .alerts-feed .nday { padding: 12px 14px 5px; }
  .alerts-feed .nrow { padding: 10px 14px; }
  .desk-page .panel-link { display: inline-flex; align-items: center; min-height: 44px; margin-block: -10px; }
}

@media (pointer: coarse) {
  .page-flips .flip-acts .abtn,
  .page-flips .flip-acts .ghost,
  .page-flips .flip-detail-acts .ghost { min-height: 44px; height: 44px; }
  .page-alerts .arearm { width: 44px; height: 44px; min-width: 44px; }
}

@media (max-width: 620px) {
  /* On a phone the task is the page: the title, the state and the actions stay,
     and the explanatory deck steps aside for the rows. */
}

@media (max-width: 520px) {
  .desk-page .hub-title { font-size: 2.35rem; }
  .desk-actions { flex-wrap: wrap; }
  .book-kpi b { font-size: 21px; }
  .book-kpi small { font-size: 9px; }
  .flip-row-main { grid-template-columns: minmax(0, 1fr); gap: 11px; }
  .flip-id, .flip-quote, .flip-position, .flip-pnl, .flip-acts { grid-column: 1; }
  .flip-pnl > b { font-size: 19px; }
  .flip-facts { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .page-flips .flip-acts { justify-content: flex-start; }
  .page-flips .flip-acts .abtn, .page-flips .flip-acts .ghost { flex: 1 1 auto; min-height: 44px; height: 44px; }
  .ledger-head { align-items: flex-start; gap: 10px; }
  .ledger-head .ghost { flex: 0 0 auto; }
  .readout-avg b { font-size: 23px; }
}

/* --------------------------------------------------- site alignment --- */
/* The account surfaces use the same page rhythm as My Account rather than
   starting hard against the shell: the title takes the account page's scale
   and weight, the deck is secondary ink, the header rule is the stronger one,
   and the controls keep the site's radii. */
.shell:is([data-screen="lists"], [data-screen="flips"], [data-screen="alerts"]) .workspace {
  padding-top: 0;
}
/* The mast at hand-held widths: one column, the page's own controls under the
   copy, and the reading line steps aside as it does on the market board. */
@media (max-width: 900px) {
  .page-mast { gap: 18px; }
}

@media (max-width: 760px) {
  .page-mast {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 15px;
    padding: 14px 0 16px;
  }
  .page-mast-side {
    width: 100%;
    justify-content: flex-start;
    align-items: stretch;
  }
}

@media (max-width: 620px) {
  .page-mast { padding: 10px 0 14px; }
  .page-mast-lede { display: none; }
  /* The calculator intro is search-facing copy, not a desktop-only ornament:
     keep it on the phone at reading size. */
  .toolview .page-mast-lede,
  .opt-mast .page-mast-lede {
    display: block;
    max-width: 42ch;
    margin-top: 6px;
    font-size: var(--text-label);
    line-height: var(--leading-body);
  }
  .hist-page { padding-bottom: 88px; }
}
.desk-page .sbtn { border-radius: 6px; }
.desk-page .ghost { border-radius: 8px; }

@media (max-width: 760px) {
  .shell:is([data-screen="lists"], [data-screen="flips"], [data-screen="alerts"]) .workspace {
    padding-top: 0;
  }
  /* A phone has no bar at the foot to clear, so the sheet ends a short breath
     under its last block instead of in an empty band inside the frame. */
  .desk-page { padding-bottom: 24px; }
  .desk-page .hub-title { font-size: 2rem; }
  .desk-actions { justify-content: flex-end; flex-wrap: wrap; }
  .desk-actions > * { flex: 0 1 auto; min-width: 0; }
  .desk-actions .sbtn,
  .desk-actions .ghost,
}

@media (max-width: 360px) {
  .page-flips .flip-filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    width: 100%;
    overflow: visible;
  }
  .page-flips .flip-filters button { justify-content: center; padding-inline: 4px; }
}

/* ---------------------------------------------------------- tools menu --- */
/* One register, not a side-by-side dashboard: a short row of price and planning
   tools over an alphabetical bank of skill calculators. The panel opens from
   the Tools mark itself; the phone keeps the same surface as a sheet above the
   thumb bar. */

.rail-menu {
  z-index: 100;
  display: flex;
  flex-direction: column;
  width: 720px;
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - var(--topbar-h) - 24px);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 4px var(--radius) var(--radius) var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-pop);
  transform-origin: top left;
  overscroll-behavior: contain;
}

.rail-menu-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.rail-menu-body::-webkit-scrollbar { width: 8px; }
.rail-menu-body::-webkit-scrollbar-thumb {
  border: 2px solid var(--card);
  border-radius: 8px;
  background: var(--line-strong);
}

.rail-menu-character {
  padding: 12px 13px 13px;
  border-bottom: 1px solid var(--line);
}
.rail-menu-character .rail-menu-list { display: block; }
.rail-menu-character .rail-menu-item { min-height: 52px; }
.rail-menu-price { padding: 13px 13px 12px; }
.rail-menu-skills {
  padding: 12px 13px 9px;
  border-top: 1px solid var(--line);
}

.rail-menu-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 2px 8px;
}
.rail-menu-heading {
  margin: 0;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: var(--fw-medium);
  line-height: 1.2;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.rail-menu-meta {
  color: var(--ink-4);
  font-size: 10px;
  line-height: 1;
  letter-spacing: .06em;
}

.rail-menu-price .rail-menu-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}
.rail-menu-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 14px;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 8px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--bg-2);
  text-decoration: none;
  transition: background var(--t-quick) var(--ease), border-color var(--t-quick) var(--ease);
}
.rail-menu-item:hover { background: var(--field); border-color: var(--line-strong); }
.rail-menu-item:focus-visible {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.rail-menu-item:active { background: var(--field-2); }
.rm-name {
  min-width: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: var(--fw-medium);
  line-height: 1.3;
}
.rm-go {
  width: 14px;
  height: 14px;
  color: var(--ink-4);
  transition: color var(--t-quick) var(--ease), transform var(--t-quick) var(--ease);
}
.rail-menu-item:hover .rm-go,
.rail-menu-item:focus-visible .rm-go {
  color: var(--accent);
  transform: translateX(2px);
}

.rail-skill-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line-soft);
}
.rail-skill {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 34px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.2;
  text-decoration: none;
  transition: background var(--t-quick) var(--ease), color var(--t-quick) var(--ease);
}
.rail-skill:hover { color: var(--ink); background: var(--field); }
.rail-skill:focus-visible {
  color: var(--ink);
  background: var(--field);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.rail-skill:active { background: var(--field-2); }

/* The panel is an index, not a stack: quick tools keep the left rail and the
   skill calculators take the wider side with the game's own skill marks. */
.rail-menu-body {
  display: grid;
  --sprite-tone: var(--accent);
  --sprite-plate: color-mix(in srgb, var(--sprite-tone) 10%, var(--field-2));
  --sprite-edge: color-mix(in srgb, var(--sprite-tone) 32%, var(--line));
  --sprite-hover: color-mix(in srgb, var(--sprite-tone) 18%, var(--field-2));
  --sprite-edge-hover: color-mix(in srgb, var(--sprite-tone) 48%, var(--line));
  grid-template-columns: 236px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  align-content: start;
}
.rail-menu-body > .rail-menu-character {
  grid-column: 1;
  grid-row: 1;
  padding: 12px 12px 10px;
}
.rail-menu-body > .rail-menu-price {
  grid-column: 1;
  grid-row: 2;
  padding: 10px 12px 12px;
}
.rail-menu-body > .rail-menu-price .rail-menu-list {
  grid-template-columns: 1fr;
  gap: 5px;
}
.rail-menu-body > .rail-menu-character .rail-menu-item { min-height: 60px; }
.rail-menu-body > .rail-menu-price .rail-menu-item {
  min-height: 46px;
  padding-block: 7px;
}
.rail-menu-body > .rail-menu-skills {
  grid-column: 2;
  grid-row: 1 / span 2;
  padding: 12px 12px 10px;
  border-top: 0;
  border-left: 1px solid var(--line);
}
.rail-menu-character .rm-name { font-size: 13px; }
.rm-art {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--sprite-edge);
  border-radius: 7px;
  color: var(--sprite-tone);
  background: var(--sprite-plate);
  transition: background var(--t-quick) var(--ease), border-color var(--t-quick) var(--ease);
}
.rm-art img {
  display: block;
  width: 24px;
  height: 24px;
  object-fit: contain;
  image-rendering: pixelated;
}
.rm-art .rm-mark { width: 17px; height: 17px; }
.rail-skill {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 9px;
  min-height: 44px;
}
.rail-skill-icon {
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: 28px;
  height: 28px;
  padding: 4px;
  /* Match the combat-route plates: original game art, a quiet amber edge and
     a dark plate, rather than an inverted white glyph on a bright outline. */
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 6%, var(--field));
  transition: background var(--t-quick) var(--ease), border-color var(--t-quick) var(--ease);
}
.rail-skill-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}
.rail-menu-item:hover .rm-art,
.rail-menu-item:focus-visible .rm-art {
  background: var(--sprite-hover);
  border-color: var(--sprite-edge-hover);
}
.rail-skill:hover .rail-skill-icon,
.rail-skill:focus-visible .rail-skill-icon {
  background: color-mix(in srgb, var(--accent) 6%, var(--field));
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
}
.rail-skill-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 871px) and (max-width: 1120px) {
  .topbar .rail-tools .rail-menu.rail-menu-wide {
    position: fixed;
    top: calc(var(--topbar-h) + 8px);
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    transform-origin: top center;
  }
}

@media (min-width: 871px) and (max-width: 1120px) {
  .topbar .rail-tools .rail-menu.rail-menu-wide {
    left: max(12px, calc(50vw - 360px));
    right: auto;
    width: 720px;
    max-width: calc(100vw - 24px);
  }
}

@media (max-width: 870px) {
  .rail-menu-body { display: block; }
  .rail-menu-body > .rail-menu-character { padding: 12px 13px 13px; }
  .rail-menu-body > .rail-menu-price { padding: 13px 13px 12px; }
  .rail-menu-body > .rail-menu-price .rail-menu-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }
  .rail-menu-body > .rail-menu-character .rail-menu-item { min-height: 52px; }
  .rail-menu-body > .rail-menu-price .rail-menu-item {
    min-height: 56px;
    padding-block: 8px;
  }
  .rail-menu-body > .rail-menu-skills {
    padding: 12px 13px 9px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
  .rail-skill-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .rail-menu-body > .rail-menu-character { padding: 10px 10px 9px; }
  .rail-menu-body > .rail-menu-price { padding: 11px 10px 10px; }
  .rail-menu-body > .rail-menu-skills { padding: 11px 10px 6px; }
  .rail-menu-body > .rail-menu-character .rail-menu-item {
    grid-template-columns: 30px minmax(0, 1fr) 14px;
    align-content: center;
    min-height: 52px;
    padding: 8px 9px;
  }
  .rail-menu-body > .rail-menu-price .rail-menu-item {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: 7px;
    min-height: 78px;
    padding: 9px;
  }
  .rm-art { width: 30px; height: 30px; }
  .rm-art img { width: 22px; height: 22px; }
}

.rail-menu-all {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 0 15px;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: var(--fw-medium);
  text-decoration: none;
}
.rail-menu-all svg {
  width: 14px;
  height: 14px;
  color: var(--ink-4);
  transition: color var(--t-quick) var(--ease), transform var(--t-quick) var(--ease);
}
.rail-menu-all:hover,
.rail-menu-all:focus-visible {
  color: var(--ink);
  background: var(--field);
}
.rail-menu-all:hover svg,
.rail-menu-all:focus-visible svg {
  color: var(--accent);
  transform: translateX(2px);
}
.rail-menu-all:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* The desktop panel is attached to its mark: same left edge, a short drop,
   and an underline that keeps the trigger visibly current while it is open. */
@media (min-width: 621px) {
  .topbar .rail-tools[open] > summary { color: var(--ink); background: var(--hover); }
  .topbar .rail-tools[open] > summary::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 2px;
    height: 2px;
    border-radius: 2px;
    background: var(--accent);
  }
}

@media (min-width: 871px) {
  .topbar .rail-menu.rail-menu-wide {
    position: absolute;
    top: calc(100% + 20px);
    left: 0;
    right: auto;
    width: 720px;
    max-width: calc(100vw - 32px);
    translate: none;
    transform-origin: top left;
  }
}

@media (min-width: 621px) and (max-width: 870px) {
  .topbar .rail-menu.rail-menu-wide {
    position: fixed;
    top: calc(var(--topbar-h) + 8px);
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    transform-origin: top center;
  }
}

@media (pointer: coarse) and (min-width: 621px) {
  .rail-skill { min-height: 40px; }
}

@media (max-width: 620px) {
  .rail-menu.rail-menu-wide {
    position: fixed;
    top: auto;
    right: 8px;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    left: 8px;
    width: auto;
    max-width: none;
    max-height: min(640px, calc(100dvh - var(--topbar-h, 60px) - 72px - env(safe-area-inset-bottom, 0px)));
    border-radius: var(--radius);
    transform-origin: bottom center;
  }
  .rail-menu-price { padding: 11px 10px 10px; }
  .rail-menu-price .rail-menu-list { gap: 5px; }
  .rail-menu-item {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: 7px;
    min-height: 78px;
    padding: 9px;
  }
  .rm-name { font-size: 11px; line-height: 1.25; }
  .rm-go { display: none; }
  .rail-menu-skills { padding: 11px 10px 6px; }
  .rail-skill-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rail-skill { min-height: 44px; padding: 10px 9px; }
  .rail-menu-all { padding: 0 12px; }
}

@media (max-width: 620px) {
  .rail-menu-character { padding: 10px 10px 9px; }
  .rail-menu-character .rail-menu-item {
    grid-template-columns: 28px minmax(0, 1fr) 14px;
    align-content: center;
    min-height: 52px;
    padding: 8px 9px;
  }
  .rail-menu-character .rm-go { display: block; }
}

/* --------------------------------------------------------- column picker --- */
/* The board owns one quiet control: which readings a desk has room to read.
   It sits above the table rather than in the page head because it changes the
   columns, not the list; the panel is a small settings card, not a dialog. */
.board-tools {
  position: relative;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 5px 8px 1px;
}
.board-tools[hidden] { display: none; }
.columns-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink-4);
  font-family: var(--mono);
  font-size: var(--text-micro);
  font-weight: var(--fw-medium);
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
}
.columns-btn:hover { background: var(--field); color: var(--ink-2); }
.columns-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.columns-btn svg { flex: 0 0 auto; }
.columns-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 17px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--field);
  color: var(--ink-3);
  font-size: 10px;
  letter-spacing: 0;
}
.columns-panel {
  position: absolute;
  top: calc(100% + 4px);
  right: 8px;
  z-index: 60;
  width: 380px;
  max-height: min(560px, calc(100dvh - 140px));
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-gutter: stable;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 18px 40px -26px rgba(0, 0, 0, .55);
}
.columns-panel[hidden] { display: none; }
.columns-panel::-webkit-scrollbar { width: 8px; }
.columns-panel::-webkit-scrollbar-thumb {
  border: 2px solid var(--card);
  border-radius: 8px;
  background: var(--line-strong);
}
.columns-panel::-webkit-scrollbar-track { background: transparent; }
.columns-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 3px 8px;
  border-bottom: 1px solid var(--line-soft);
}
.columns-panel-head > span {
  color: var(--ink-4);
  font-family: var(--mono);
  font-size: var(--text-micro);
  font-weight: var(--fw-medium);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.columns-reset {
  height: 24px;
  padding: 0 5px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: var(--text-micro);
  cursor: pointer;
}
.columns-reset:hover { background: var(--field); color: var(--accent); }
.columns-reset:disabled { opacity: .45; cursor: default; }
.columns-reset:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.columns-list {
  column-count: 2;
  column-gap: 14px;
}
.columns-group {
  break-inside: avoid;
  padding-top: 8px;
}
.columns-group-name {
  display: block;
  padding: 0 3px 4px;
  color: var(--ink-4);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.columns-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 31px;
  padding: 0 5px;
  border-radius: 4px;
  color: var(--ink-2);
  font-size: var(--text-label);
  cursor: pointer;
}
.columns-row:hover { background: var(--field); }
.columns-row input {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent);
}
.columns-row input:disabled { cursor: default; }
.columns-name { flex: 1 1 auto; min-width: 0; }
.columns-tag {
  color: var(--ink-4);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.columns-row.is-sort .columns-name { color: var(--ink); }
.columns-row.is-pinned { opacity: .72; }
.columns-row.is-pinned:hover { background: transparent; }
@media (max-width: 1080px) {
  .board-tools { display: none !important; }
}
.shell:not([data-screen="market"]) .board-tools { display: none !important; }
