/* item.css — The filter column, scrim and the item page.
   Split from styles.css at its original section boundary; order is unchanged. */
/* --------------------------------------------------------------- filters ---- */
.facets {
  position: fixed;
  top: var(--pane-top, calc(var(--topbar-h, 60px) + 8px));
  left: var(--pane-left, var(--page-pad, 16px));
  width: min(336px, calc(100vw - 24px));
  max-height: min(72dvh, calc(100dvh - var(--pane-top, 68px) - 8px));
  z-index: 65;
  display: flex; flex-direction: column;
  background: var(--card);
  border: 0;
  border-radius: 12px;
  box-shadow: 0 22px 46px -28px rgba(7, 7, 7, .42), 0 2px 8px -6px rgba(7, 7, 7, .24);
  overflow: hidden;
  transform: translateY(-6px);
  opacity: 0;
  transition: transform var(--t-move) var(--ease), opacity var(--t-quick) var(--ease), visibility 0s linear var(--t-move);
  visibility: hidden;
}
.facets.open {
  transform: none;
  opacity: 1;
  visibility: visible;
  transition: transform var(--t-move) var(--ease), opacity var(--t-quick) var(--ease), visibility 0s;
}
.facets .rail-body { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.facets .rail-pane { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.facets .rail-pane[hidden] { display: none; }

/* The Lists, Flips and Alerts marks open their panes as dropdowns from the
   topbar, in the Tools menu's frame: a compact card under the pressed mark,
   floating over the page rather than becoming a second column. The pane's own
   head and body keep their controls and scrolling. */
@media (min-width: 621px) {
  .facets.nav-dropdown {
    width: min(300px, calc(100vw - 24px));
    max-height: min(70dvh, calc(100dvh - 24px - var(--topbar-h, 60px)));
    z-index: 100;
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow-pop);
  }
  .facets.nav-dropdown .facets-head {
    min-height: 46px;
    padding: 7px 10px;
  }
  .facets.nav-dropdown .facets-body {
    padding: 8px 8px 10px;
    gap: 8px;
  }
}

/* The filters are the market column's own card, where the ticket used to sit. */
.filters-card {
  display: none;
  flex-direction: column;
  padding: 0;
  overflow: visible;
}
.shell[data-screen="market"] .filters-card { display: flex; padding: 0; }
.filters-card .rail-pane { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.filters-card .rail-pane[hidden] { display: none; }
.filters-card .facets-body { padding: 14px 16px 18px; overflow: visible; }
.filters-foot { display: none; }
#filters-open { display: none; position: relative; }
/* The filters belong to the market's column, not to an item or a document. */
.shell:not([data-screen="market"]) #filters-open { display: none; }
.board-filter {
  display: none; position: relative;
  flex: 0 0 auto; align-items: center; gap: 6px;
  height: 44px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--field); color: var(--ink-3);
  font-size: var(--text-label); font-weight: var(--fw-medium); cursor: pointer;
  white-space: nowrap;
}
.board-filter:hover { color: var(--ink); border-color: var(--line-strong); }
.board-filter.on { color: var(--ink); background: var(--field-2); border-color: var(--line-strong); }
#filters-open .filter-count {
  font-weight: var(--fw-medium);
  position: static;
  min-width: 18px; height: 18px; padding: 0 5px;
  display: grid; place-items: center;
  border-radius: 999px; background: var(--accent); color: var(--on-accent);
  font-family: var(--mono); font-size: var(--text-label); line-height: 1;
}
#filters-open .filter-count[hidden] { display: none; }

.facets-head {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 58px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: var(--text-body); font-weight: var(--fw-medium);
}
/* The Flips head is the pane's title, with the current item's plan button when
   there is one. Hiding it with the button made the planner lose its header
   everywhere except an item page; the title keeps the pane legible. */
#facets-head-flips .filters-title { color: var(--ink-2); }
/* One voice for every app header: sentence case, the sans at 600, tracking as
   tight as the card titles'. The pane captions (Filters, Flips, Alerts, the
   watchlist selector) used to be uppercase micro-labels - a second voice for
   the same job as `.card-head h2`, and the one place a user's own list name was
   shouted. A pane's actions keep their own words and case. */
.filters-title {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--text-body); font-weight: var(--fw-medium); letter-spacing: 0;
}
.filters-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
/* Only a narrow screen folds the filters away: there the card is a band above
   the list, and open it is taller than the list's first screen. */
.filter-state {
  display: inline-flex; align-items: center;
  min-height: 19px; padding: 1px 7px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent);
  font-family: var(--mono); font-size: var(--text-label); font-weight: var(--fw-medium);
  letter-spacing: 0; text-transform: none;
}
.filter-state[hidden] { display: none; }

.facets-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  /* The flips filters can shorten the list enough to remove its scrollbar.
     Reserving the scrollbar's lane keeps cards from changing width and
     shifting sideways when that happens. */
  scrollbar-gutter: stable;
  padding: 14px 16px 22px;
  display: flex; flex-direction: column; gap: 14px;
  scrollbar-color: var(--scroll) transparent;
}
/* The planner pane's scrollbar belongs in its right padding, not in the
   column the summary, filters and cards share. Take the measured lane out of
   that padding, leaving a 1px breath: the three then keep the head's full
   width whether a plan list scrolls or not, and the scrollbar sits at the
   pane's edge instead of narrowing the cards. flips.js measures the lane,
   because an overlay scrollbar reserves none. */
#facets-flips {
  --flip-pad-right: 16px;
  padding-right: max(0px, calc(var(--flip-pad-right) - var(--flip-scroll-lane, 0px)));
}
@media (max-width: 620px) {
  #facets-flips { --flip-pad-right: 14px; }
}

.group { display: flex; flex-direction: column; gap: 8px; }

.scope-grid { display: flex; }
.scope-switch { display: flex; align-items: center; gap: 4px; width: 100%; }
.saveonly {
  flex: 1 1 auto;
  display: flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--ink-2);
  font-size: var(--text-label);
  cursor: pointer;
}
.saveonly { transition: color var(--t-quick) var(--ease), border-color var(--t-quick) var(--ease), background var(--t-quick) var(--ease); }
.saveonly:hover { color: var(--ink); border-color: var(--line-strong); }
.saveonly[aria-expanded="true"] { border-color: var(--accent-line); }
.saveonly.on { border-color: var(--accent-line); color: var(--ink); background: var(--accent-soft); }
.saveonly .s-star { color: var(--accent); font-size: var(--text-body); }
.saveonly .lbl { flex: 1 1 auto; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saveonly em {
  font-weight: var(--fw-medium); color: var(--ink-4); font-style: normal; font-family: var(--mono); font-size: var(--text-label); }
.saveonly .s-caret { color: var(--ink-4); font-size: var(--text-label); transition: transform var(--t-quick) var(--ease); }
.saveonly[aria-expanded="true"] .s-caret { transform: rotate(180deg); }
.scope-x {
  width: 32px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-2); color: var(--ink-4);
  cursor: pointer;
  display: none;
}
.scope-switch.scoped .scope-x { display: block; }
.scope-x:hover { color: var(--down); }
.filter-search {
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 9px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg-2); color: var(--ink-4);
}
.filter-search:focus-within { border-color: var(--line-strong); }
.filter-search svg { flex: 0 0 auto; width: 14px; height: 14px; }
.filter-search input {
  flex: 1 1 auto; min-width: 0; height: 100%;
  border: 0; outline: 0; background: none;
  color: var(--ink); font-size: var(--text-label);
}
.filter-search input::placeholder { color: var(--ink-4); }
.filter-search input::-webkit-search-cancel-button { display: none; }

.filter-catalog [hidden] { display: none; }
.filter-block { border-top: 1px solid var(--line); padding-top: 4px; }
.filter-block summary {
  display: flex; align-items: center; justify-content: space-between; gap: 9px;
  height: 34px;
  cursor: pointer;
  list-style: none;
  color: var(--ink-2);
  font-size: var(--text-label); font-weight: var(--fw-medium);
}
.filter-block summary:hover { color: var(--ink); }
.filter-block summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.filter-block summary::-webkit-details-marker { display: none; }
.filter-block summary::after {
  content: ""; width: 7px; height: 7px; flex: 0 0 auto;
  border-right: 1.5px solid var(--ink-4); border-bottom: 1.5px solid var(--ink-4);
  transform: rotate(45deg); margin-top: -3px;
  transition: transform var(--t-quick);
}
.filter-block[open] summary::after { transform: rotate(-135deg); margin-top: 3px; }
.fb-name { flex: 1 1 auto; }
.fb-count {
  display: inline-grid; place-items: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 5px;
  background: var(--accent-soft); color: var(--accent);
  font-family: var(--mono); font-size: var(--text-label); font-weight: var(--fw-medium);
  line-height: 1;
}
.fb-count[hidden] { display: none; }
.filter-fields { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-field-chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 29px; padding: 0 9px;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg-2); color: var(--ink-3);
  font-size: var(--text-label); line-height: 1; cursor: pointer;
}
.filter-field-chip:hover { color: var(--ink); border-color: var(--line-strong); }
.filter-field-chip.on, .filter-field-chip.open {
  color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft);
}
.filter-field-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.filter-field-chip[data-tip] { position: relative; }
.filter-field-chip.has-tip .ff-label {
  text-decoration: underline dotted; text-underline-offset: 2px;
  text-decoration-color: var(--ink-4);
}
.filter-field-chip[data-tip]::after {
  content: attr(data-tip);
  position: absolute; left: 0; bottom: calc(100% + 7px); z-index: 30;
  width: max-content; max-width: min(240px, calc(100vw - 88px));
  padding: 6px 8px;
  border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--card); color: var(--ink-2);
  box-shadow: 0 10px 24px -16px #000;
  font: var(--fw-regular) var(--text-label)/var(--leading-heading) var(--sans); font-weight: var(--fw-regular); text-align: left;
  white-space: normal; pointer-events: none;
  opacity: 0; visibility: hidden; transform: translateY(2px);
  transition: opacity 120ms ease, transform 120ms ease, visibility 0s linear 120ms;
}
.filter-field-chip[data-tip]:hover::after,
.filter-field-chip[data-tip]:focus-visible::after {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity 120ms ease, transform 120ms ease, visibility 0s;
}
.ff-mark {
  font-weight: var(--fw-medium); width: 11px; color: var(--ink-4); font-family: var(--mono); font-size: var(--text-label); text-align: center; }
.ff-mark::before { content: "+"; }
.filter-field-chip.on .ff-mark { color: var(--accent); }
.filter-field-chip.on .ff-mark::before { content: "✓"; }
.filter-editor-hint { margin: -1px 0 0; color: var(--ink-4); font-size: var(--text-label); line-height: var(--leading-label); }
.filter-editor {
  display: flex; flex-direction: column; gap: 9px;
  padding: 10px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--card);
}
.filter-editor[hidden] { display: none; }
.filter-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.filter-editor-name { color: var(--ink-2); font-size: var(--text-label); font-weight: var(--fw-medium); }
.filter-editor-name em {
  font-weight: var(--fw-medium);
  margin-left: 6px; color: var(--ink-4); font-style: normal;
  font-family: var(--mono); font-size: var(--text-label);
}
.filter-editor-clear {
  padding: 0; border: 0; background: none;
  color: var(--ink-4); font-size: var(--text-label); cursor: pointer;
}
.filter-editor-clear:hover { color: var(--ink); }
.filter-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 12px minmax(0, 1fr);
  align-items: end;
  gap: 5px;
}
.filter-input { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.filter-input > span {
  font-weight: var(--fw-medium);
  color: var(--ink-4);
  font-family: var(--mono); font-size: var(--text-label);
  line-height: 1;
}
.filter-input input {
  font-weight: var(--fw-medium);
  width: 100%; height: 34px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--ink);
  font-family: var(--mono); font-size: var(--text-label);
  outline: none;
}
.filter-input input:focus { border-color: var(--line-strong); }
.filter-input input::placeholder { color: var(--ink-4); }
.filter-sep { color: var(--ink-4); font-size: var(--text-label); text-align: center; padding-bottom: 11px; }

@media (pointer: coarse), (max-width: 620px) {
  .filter-sep { padding-bottom: 16px; }
  .filter-search { height: 44px; }
  .filter-field-chip { min-height: 44px; }
  .filter-editor-clear { min-height: 44px; }
}
/* Membership is a choice, not an addable range: it keeps the filter chip's
   box and selected rule, but no plus before a value that is already chosen. */
.members .ff-mark::before { content: none; }

/* shared small controls */
.ghost {
  display: inline-flex; align-items: center; justify-content: center;
  text-align: center;
  height: 30px; padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--ink-3);
  font-size: var(--text-label);
  cursor: pointer;
  white-space: nowrap;
}
.ghost:hover { color: var(--ink); border-color: var(--line-strong); }
.ghost[disabled] { opacity: .4; cursor: default; }
.link {
  border: 0; background: none; padding: 0;
  color: var(--accent); font-size: inherit; cursor: pointer;
}
.link:hover { color: var(--accent-2); }

/* watchlists */
.wl-pick {
  display: inline-flex; align-items: center; gap: 7px;
  min-width: 0; max-width: 100%; height: 30px; padding: 0;
  border: 0; border-radius: 8px;
  background: none; color: var(--ink);
  font-size: var(--text-body); font-weight: var(--fw-medium); letter-spacing: 0;
  cursor: pointer;
  transition: color var(--t-quick) var(--ease), background var(--t-quick) var(--ease);
}
.wl-pick:hover { color: var(--ink); }
.wl-pick[aria-expanded="true"] { color: var(--ink); background: var(--accent-soft); }
#watchlist-pick-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-caret {
  width: 9px; height: 6px; flex: 0 0 auto;
  stroke: var(--ink-4); fill: none; stroke-width: 1.6;
  transition: transform var(--t-quick) var(--ease);
}
.wl-pick[aria-expanded="true"] .wl-caret { transform: rotate(180deg); }
.wl-open { margin-left: auto; }
.wl-add { font-size: var(--text-body); width: 30px; padding: 0; }

/* One saved list as the pane's quote board: a head of sort words over rows of
   sprite, name and change. The row is the way into the item; the bin rides at
   its right end and only shows while the line is being read. */
/* The plate's rows: no column head over them - the pane's own caption is the
   only word above the list - and a dashed hairline between one row and the
   next, the way the item page divides the rows of its plates. */
.wtable { display: flex; flex-direction: column; gap: 0; }
/* A banked watchlist keeps its name and its items and loses only the reading:
   the note names what is waiting and the press is what brings it back. It sits
   over the rows because it answers "where did my other list go?". */
.wline + .wline { border-top: 1px dashed var(--line); }
.whead {
  display: none;
  font-size: var(--text-label);
}
.whead > span { display: none; }
.wsort {
  border: 0; background: none; padding: 0;
  color: var(--ink-4);
  font-size: var(--text-label); font-weight: var(--fw-medium);
  letter-spacing: var(--track-label); text-transform: none;
  cursor: pointer;
}
.wsort:hover { color: var(--ink-2); }
.wsort[aria-pressed="true"] { color: var(--ink); }
.wsort[data-wsort="name"] { flex: 1 1 auto; text-align: left; }
.wsort[data-wsort="chg"] { flex: 0 0 46px; text-align: right; }
.wsort-d { font-style: normal; margin-left: 3px; color: var(--accent); }
.wline {
  display: flex; align-items: center;
  padding-right: 2px;
  border-radius: 4px;
}
.wrow {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; gap: 9px;
  min-height: 30px;
  padding: 6px 8px;
  border: 0; border-radius: 4px; background: transparent;
  color: inherit; text-align: left; cursor: pointer;
}
.wline:hover { background: var(--field); }
/* The sprite is a cell, not the picture's own size: a wiki image is 20px wide
   on one line and 29px on the next, and sizing the picture made every name start
   somewhere else. A 24 box holds them all, the small ones centred in it, so the
   names are one column and sit under the head's own word. */
.wrow .wico {
  flex: 0 0 24px;
  width: 24px; height: 24px;
  display: grid; place-items: center;
}
.wrow .wico img { max-width: 24px; max-height: 24px; object-fit: contain; }
.wname {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink);
  /* The pane is the dense reading, so its name and figure use the label role,
     not the board's roomier name size. That is the same 13px the alert rows
     and the table figures use. */
  font-family: var(--sans); font-size: var(--text-label); font-weight: var(--fw-medium);
}
.wchg {
  font-weight: var(--fw-medium);
  flex: 0 0 46px; text-align: right;
  color: var(--ink-3); font-family: var(--mono); font-size: var(--text-label);
}
.wchg.up { color: var(--up); }
.wchg.down { color: var(--down); }
.wdel {
  flex: 0 0 22px; width: 22px; height: 26px;
  display: grid; place-items: center;
  padding: 0; border: 0; border-radius: 4px; background: transparent;
  color: var(--ink-4); cursor: pointer;
  opacity: 0;
  transition: opacity var(--t-quick), color var(--t-quick), background var(--t-quick);
}
.wline:hover .wdel, .wdel:focus-visible { opacity: 1; }
.wdel:hover { color: var(--down); background: var(--down-soft); }
.wdel svg {
  width: 14px; height: 14px;
  fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round;
}
/* A thumb has no hover: the way off the list is always drawn where there is
   no pointer to reveal it. */
@media (hover: none) { .wdel { opacity: 1; } }

/* The planner and the imported trades are two readings of one ledger, so their
   heads carry the same small switch: a segmented control rather than a second
   row of filters. The rail keeps its own marks for both. */

/* alerts pane */
.alerts-head-lead { display: inline-flex; align-items: center; gap: 4px; }
.alerts-tabs { display: inline-flex; gap: 2px; }
/* The alerts head names its pane in the head's own type, as the flips head
   does. It used to be a filled pill - the only head whose name was a control,
   at the tab size rather than the title's - and the log it switched to is
   behind the bell now, so the pill was a switch with one side. */
.alerts-tabs button {
  height: auto; padding: 0;
  border: 0; border-radius: 0;
  background: transparent; color: var(--ink);
  font-size: var(--text-body); font-weight: var(--fw-medium); cursor: pointer;
  letter-spacing: 0;
}
.alerts-tabs button[aria-pressed="true"] { color: var(--ink); background: transparent; }

.apanel-lines { display: flex; flex-direction: column; gap: 6px; }
.apanel-note { color: var(--ink-4); font-size: var(--text-label); padding: 8px 0; }
.apanel-empty {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 28px 10px; text-align: center;
}
.apanel-empty .ae-glyph { color: var(--ink-4); line-height: 0; }
.apanel-empty .ae-title { color: var(--ink-2); font-size: var(--text-label); font-weight: var(--fw-medium); }
.apanel-empty .ae-sub { max-width: 220px; color: var(--ink-4); font-size: var(--text-label); line-height: var(--leading-body); }
.apanel-empty .abtn { margin-top: 4px; }
.alertcap { color: var(--ink-3); font-size: var(--text-label); }
.alert-row .n { font-size: var(--text-label); color: var(--ink); }

/* --------------------------------------------------------------- the drawer's scrim --- */
.scrim {
  position: fixed; inset: 0 0 0 76px;
  z-index: 60;
  background: rgba(7, 7, 7, .3);
  opacity: 0; visibility: hidden;
  transition: opacity var(--t-move), visibility var(--t-move);
}
.scrim.on { opacity: 1; visibility: visible; }

/* ---------------------------------------------------------------- item page --- */
.itemview { display: flex; flex-direction: column; gap: 16px; }

.iv-head {
  position: relative;
  display: flex; align-items: flex-start; gap: 14px;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
}
.iv-head .ico-lg, .iv-head > img {
  width: 48px; height: 48px; object-fit: contain;
  padding: 5px; border-radius: 8px; background: var(--field);
  flex: 0 0 auto;
}
/* The sprite is drawn in the tile rather than at the corner of it: the picture
   is an inline image on a block anchor, so it sat on the text baseline and
   hugged the top-left - a small icon in a big shifted box. The picture takes
   the tile's whole inner box and `contain` keeps its shape centred in it. */
.iv-head .ico-lg { display: grid; place-items: center; position: relative; }
/* Sized to the inner box rather than to their own height: a percentage height
   against an auto-sized row is indefinite, so a tall sprite was laid out at its
   aspect's height and hung out below the tile. */
.iv-head .ico-lg img {
  position: absolute; inset: 5px;
  width: calc(100% - 10px); height: calc(100% - 10px);
  object-fit: contain;
}
.iv-id { flex: 1 1 auto; min-width: 0; }
/* The name takes focus when its page opens so a screen reader lands on it. It
   is a landing target, not a tab stop, so a mouse or a thumb gets no ring drawn
   around the item's name for the whole time the page is on the glass. */
.examine { margin-top: 3px; color: var(--ink-4); font-size: var(--text-label); }
.iv-acts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* The app's item header carries the quote strip inside the same card. The SSR
   header (`server/itempage.py`) keeps the plain `iv-head` shape and its table,
   so this variant is only on the card the app draws. */
/* The four readings are sections of the same card, not cards inside a card:
   one rule under the identity row and single lines between the figures. */
.iv-btn {
  height: 32px; padding: 0 11px;
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--ink-2);
  font-size: var(--text-label); cursor: pointer;
}
.iv-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.iv-btn.on { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.iv-slot { display: inline-grid; }
.iv-btn.copy .iv-slot > svg { width: 13px; height: 13px; grid-area: 1 / 1; }
.iv-btn.copy .iv-slot .tick, .iv-btn.copy .iv-slot .cross { display: none; }
.iv-btn.copy.done .iv-slot .sheets { display: none; }
.iv-btn.copy.done .iv-slot .tick { display: block; color: var(--up); }
.iv-btn.copy.miss .iv-slot .sheets { display: none; }
.iv-btn.copy.miss .iv-slot .cross { display: block; color: var(--down); }
/* The slot is decorative and a phone hides it, so the button itself carries
   the answer there: the word changes and the border takes the result's colour. */
.iv-btn.copy.done { border-color: var(--up); color: var(--up); }
.iv-btn.copy.miss { border-color: var(--down); color: var(--down); }

.facts-pop {
  /* Fixed: the card lives inside the board's scrolling column, and an absolute
     overlay contributes its height to that scroller even when it is only a
     card. `fitFacts` anchors it under the Details button. */
  position: fixed; top: 60px; right: 14px; z-index: 30;
  width: min(268px, calc(100vw - 24px));
  max-height: min(72vh, 560px);
  overflow: auto;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--card-2);
  box-shadow: var(--shadow);
}
.facts-pop[hidden] { display: none; }
.facts-pop:focus { outline: none; }
.facts-pop:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* A 280px phone leaves less room than the plate's own 268px: right-aligning it
   from the header's content edge pushed its left side off the glass. Left-align
   it there and let it take the width that is actually inside the card. */
@media (max-width: 360px) {
  .facts-pop {
    width: min(268px, calc(100vw - 48px));
  }
}
.facts-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: var(--text-label); color: var(--ink-3); }
.facts-row b { color: var(--ink); font-family: var(--mono); font-weight: var(--fw-medium); }
.facts-row.asof { display: block; padding-top: 8px; margin-top: 5px; border-top: 1px solid var(--line); color: var(--ink-4); font-size: var(--text-label); }
.q-cell .k {
  color: var(--ink-4);
  font-family: var(--mono); font-size: var(--text-micro); font-weight: var(--fw-medium);
 letter-spacing: var(--track-label);
}
/* The item header's four readings are data, not a second display headline:
   the one face at 20px carries the quote, while the labels and change figures
   stay at the small data sizes. The header's focal reading is the heaviest
   figure on the card; the live-stat cells sit one step below it. */
.q-cell .v {
  margin-top: 2px;
  display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap;
  font-family: var(--mono); font-size: var(--text-heading); font-weight: var(--fw-semibold);
  letter-spacing: 0; line-height: var(--leading-label);
  font-variant-numeric: tabular-nums;
}
.iv-head-stats .q-cell .v { font-weight: var(--fw-display); }
.q-cell .q-pct {
  font-family: var(--mono); font-size: var(--text-label); font-weight: var(--fw-medium);
  letter-spacing: 0; font-variant-numeric: tabular-nums;
}
.q-pct.up, .q-cell .v .up { color: var(--up); }
.q-pct.down, .q-cell .v .down { color: var(--down); }

.chart-wrap {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  padding: 14px;
}
/* A press on the plot drags a window, not a text selection: without this a
   drag sweeps over the axis labels and time ticks and leaves them highlighted. */
.chart, .chart * { user-select: none; -webkit-user-select: none; }
/* The plot is a window to drag, and the hand is the only thing that says so:
   open over it, closed while the drag is running, as a map's is. The knobs on
   the axes keep their own stretch cursors, which chart.js sets on the host. */
.pannable .chart-hit { cursor: grab; }
.pannable.panning .chart-hit { cursor: grabbing; }
.chart-top {
  position: relative;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.ranges { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-2); }
.ranges button {
  font-weight: var(--fw-medium);
  height: 25px; min-width: 30px; padding: 0 8px;
  border: 0; border-radius: 999px;
  background: transparent; color: var(--ink-4);
  font-family: var(--mono); font-size: var(--text-label); cursor: pointer;
}
.ranges button:hover { color: var(--ink-2); }
.ranges button.on { background: var(--field-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
/* The live light rides inside the strip's Live button: a window named Live and
   a light named Live are one control's worth of words, not two. Unlit ink while
   another window is on, green and steady while the plot follows the newest
   bucket, and blinking once a drag or a zoom has moved the window - a line that
   stopped moving is otherwise indistinguishable from a market that did. */
.ranges button[data-range="live"] { display: inline-flex; align-items: center; gap: 5px; }
.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: .5;
}
.ranges button[data-range="live"].on .live-dot { background: var(--up); opacity: 1; }
/* Only the dot blinks. The chip itself keeps the ink and the ground of the
   window it is on: a button that floods green reads as a state of the strip
   rather than of the light, and the strip's job is to say which window is
   selected, which `.on` already does. */
/* A moved window drops the chip's highlight, so the dot keeps its own green:
   the light names the window even when the strip says nothing is selected. */
.ranges button[data-range="live"].moved .live-dot {
  background: var(--up); opacity: 1;
  animation: live-blink 1.2s steps(2, start) infinite;
}
@keyframes live-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: .2; }
}
/* A reader who asked for no motion gets the same reading without the pulse:
   the dot stays lit inside its ring, so the light still says the plot has
   stopped - blinking is one way to say it, not the only one. */
@media (prefers-reduced-motion: reduce) {
  .ranges button[data-range="live"].moved .live-dot {
    animation: none !important; opacity: 1;
  }
}
/* The quote's clock: one small line in the action group, naming the time the
   quote was measured. No plate, ring or countdown; freshness is a reading, not
   a progress bar. */
.refresh-clock {
  display: inline-flex; align-items: baseline; gap: 5px;
  height: auto; padding: 0;
  color: var(--ink-3); flex: 0 0 auto;
}
.rclock-copy {
  display: flex; align-items: baseline; gap: 5px; min-width: 0;
  white-space: nowrap;
}
.rclock-k {
  color: var(--ink-4); font-size: var(--text-label); font-weight: var(--fw-regular);
  letter-spacing: 0; line-height: 1;
}
.rclock-v {
  color: var(--ink-2); font-family: var(--mono); font-size: var(--text-label);
  font-weight: var(--fw-medium); font-variant-numeric: tabular-nums; line-height: 1;
  white-space: nowrap;
}
.abtn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 30px; padding: 0 10px; text-decoration: none;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--ink-3);
  font-size: var(--text-label); cursor: pointer;
}
.abtn:hover { color: var(--ink); border-color: var(--line-strong); }
.abtn[aria-pressed="true"], .abtn.on { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.ovs-open {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; padding: 0;
}
/* The chart's readings are switches in one card, opened from Layers on a phone
   and standing with the plot on a desk. */
.ovs { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.read-key.off { opacity: .55; }
.chart { position: relative; min-height: 300px; overflow: hidden; }
.chart .loading { padding: 40px; text-align: center; color: var(--ink-4); font-size: var(--text-label); }
/* The margin pane shares the time axis and has a scale of its own: gp of margin
   is not gp of price, so it is a second plot rather than a second line. */
.chart-sub { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 7px; }
.chart-sub[hidden] { display: none; }
.chart-sub-k {
  display: block; margin: 0 0 2px 2px;
  color: var(--ink-4); font-size: var(--text-label); letter-spacing: var(--track-label);

}
.chart.chart-margin { height: 96px; min-height: 0; }
/* Chart settings' rows: its popover frame is shared with the other menus. */
.cs-title {
  margin: 2px 2px 7px; color: var(--ink-4);
  font-size: var(--text-label); font-weight: var(--fw-medium); letter-spacing: var(--track-label);
}
.cs-title.cs-sub { margin-top: 12px; }
/* The two styles are a scale of marks, like the window's range chips: one
   row, the chosen one in the page's selected ink. */
/* Three styles in one pill: the segment is a scale of words, so it gives each
   option the same share and keeps its own gutters small enough that the words
   never run past the pill's edge. */
.cs-seg {
  display: flex; gap: 2px; padding: 3px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--bg-2);
}
.cs-opt {
  flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 28px; min-width: 0; padding: 0 4px;
  border: 0; border-radius: 999px; background: transparent;
  color: var(--ink-3); font: var(--fw-regular) var(--text-label) var(--sans); white-space: nowrap;
  cursor: pointer;
}
.cs-opt:hover { color: var(--ink-2); }
.cs-opt:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 1px; }
.cs-opt.on {
  background: var(--field-2); color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.cs-swatch { display: inline-grid; place-items: center; width: 13px; height: 8px; flex: 0 0 auto; }
.cs-swatch svg { width: 13px; height: 8px; overflow: visible; }
.sw-up, .sw-down, .sw-mid { fill: none; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.sw-up { stroke: var(--up); }
.sw-down { stroke: var(--down); }
.sw-mid { stroke: var(--accent); }
.cs-note {
  margin: 8px 2px 0; color: var(--ink-4);
  font-size: var(--text-label); line-height: var(--leading-label);
}
.cs-rows { display: flex; flex-direction: column; }
.cs-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 38px; padding: 8px 2px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-2); font-size: var(--text-label); cursor: pointer;
}
.cs-row:last-child { border-bottom: 0; }
.cs-lead { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cs-glyph { flex: 0 0 16px; display: grid; place-items: center; color: var(--ink-3); }
.cs-glyph svg { width: 16px; height: 16px; overflow: visible; }
.ico-line { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ico-up { fill: var(--up); stroke: var(--up); }
.ico-down { fill: var(--down); stroke: var(--down); }
.cs-name { white-space: nowrap; }
/* The switch is the page's own, accent and all. */
.cs-row .switch { flex: 0 0 auto; }
.cs-row.off { opacity: .55; }
.cs-row.disabled { opacity: .35; cursor: default; }
.cs-row.locked { cursor: default; }
.cs-row.locked .cs-lead { opacity: .62; }
.cs-row[hidden] { display: none; }
.chart svg { display: block; width: 100%; max-width: 100%; }
.chart-tip {
  font-weight: var(--fw-medium);
  /* Its own size, whatever the plot's edge is doing. A shrink-to-fit box with
     only `left` set is as wide as the room left of the host's right edge, so a
     readout near the end of the chart wrapped and changed shape; `max-content`
     plus no wrapping keeps every reading one line, and `fixed` (positioned by
     placeTip in chart.js) lets the box hang past the card instead of being
     squeezed into it. */
  position: fixed; z-index: 5;
  width: max-content; white-space: nowrap;
  opacity: 0;
  transition: opacity 120ms var(--ease);
  min-width: 120px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--card-2);
  color: var(--ink-2);
  font-family: var(--mono); font-size: var(--text-label);
  pointer-events: none;
  box-shadow: var(--shadow);
}
.chart-tip.below { transform: none; }
.chart-tip .side.buy { color: var(--up); }
.chart-tip .side.sell { color: var(--down); }

/* The alert press rides the crosshair: out of the flow, invisible until the
   pointer is on the plot, and a chart-sized target rather than a control that
   pushed the plot 25px taller. */
.chart-alert-add {
  position: absolute; z-index: 6;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  padding: 0; margin: 0;
  transform: translate(-50%, -50%);
  border-radius: 5px;
  border: 1px solid var(--line-strong);
  background: var(--card-2);
  color: var(--ink-2);
  font-size: var(--text-body); line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-quick), border-color var(--t-quick), color var(--t-quick);
}
.chart-alert-add:focus-visible { opacity: 1; outline: 2px solid var(--accent-line); outline-offset: 1px; }
.chart-alert-add.is-hot { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
/* A finger covers what it points at, so the press is drawn larger there and its
   target is 44px in chart.js rather than the square's own box. */
@media (pointer: coarse) {
  .chart-alert-add { width: 32px; height: 32px; font-size: var(--text-body); }
}

/* the comparison picker */
/* The picker opens down from the header and over the plot. It is measured from
   the header rather than the menu item that raised it, so a phone does not put
   half of it off the card. */
.cmp-pop {
  position: absolute; left: auto; right: 0; top: calc(100% + 7px); z-index: 40;
  width: 250px; max-width: calc(100vw - 46px); padding: 7px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--card-2);
  box-shadow: var(--shadow);
}
.cmp-pop[hidden] { display: none; }
/* When the header is near the bottom of the window, the shared placer asks for
   the picker above its anchor. The header has no footer under it to rise from
   any more, so it opens over the quote instead of leaving the viewport. */
.cmp-pop.up { top: auto; bottom: calc(100% + 7px); }
.cmp-pop input {
  width: 100%; height: 32px; padding: 0 9px;
  border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--ink); font-size: var(--text-label); outline: none;
}
.cmp-list { margin-top: 5px; max-height: 200px; overflow: auto; }
/* The picker's answers are the page's own rows - a name and the line it trades
   on - rather than the platform's grey buttons. */
.cmp-hit {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 7px 8px;
  border: 0; border-radius: 8px; background: transparent;
  color: var(--ink-2); text-align: left; cursor: pointer;
  font-family: var(--sans); font-weight: var(--fw-regular); font-size: var(--text-label);
}
.cmp-hit:hover, .cmp-hit:focus-visible, .cmp-hit[aria-selected="true"] {
  background: var(--field); color: var(--ink);
}
.cmp-hit .n { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cmp-hit .c {
  font-weight: var(--fw-medium); flex: 0 0 auto; color: var(--ink-4); font-family: var(--mono); font-size: var(--text-label); }
.cmp-pop .note { margin: 0; padding: 8px 9px; color: var(--ink-3); font-size: var(--text-label); }

/* A compared item is a chip like the chart's other keys: its swatch, its name,
   and a cross that takes the line off. */
.cmp-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; margin: 0; padding: 0 9px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg-2); color: var(--ink-2);
  font-family: var(--sans); font-weight: var(--fw-regular); font-size: var(--text-label);
}
.cmp-chip.this { color: var(--ink-3); }
button.cmp-chip { cursor: pointer; }
button.cmp-chip:hover, button.cmp-chip:focus-visible {
  border-color: var(--line-strong); color: var(--ink); background: var(--field);
}
.cmp-chip i { width: 7px; height: 7px; border-radius: 2px; display: inline-block; flex: 0 0 auto; }
.cmp-chip b { font-weight: var(--fw-regular); color: var(--ink-4); margin-left: 2px; }
button.cmp-chip:hover b { color: var(--ink-2); }
.cmp-legend {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 0;
  color: var(--ink-3); font-size: var(--text-label);
}
.cmp-legend[hidden] { display: none; }
/* studies row */

