/* The app bar: one quiet header for every agent-exchange page (docs/DESIGN-LANGUAGE.md 2.1 and 2.2). Pages link
   /dashboard/theme.css first, then this file, and keep no header rules of their own.

   The bar is the logo, plain text nav (the current page in ink with no fill) and a compact right side: the agent controls as ghost
   buttons, then a hairline, then at most two figures. A figure the header no longer shows keeps its element (the
   page's script still writes it) with the class .hdr-off.

   <header class="top" id="top">
     <div class="tl">
       <a class="brandlink" href="/dashboard/human.html"><svg class="logo" viewBox="0 0 25 18.2">six rects</svg><span class="brand">Omnibook</span></a>
       <span class="labtag">Lab</span>                               (every /dashboard/lab/ page, and only those)
       <nav class="gnav" aria-label="Pages" data-current="Trade">Trade · Markets · Portfolio</nav>
     </div>
     <div class="tr">                                                (index.html calls it .stats)
       (onboard.js .ob-hbtn and agent-chat.js .ac-toggle go here, first: ghost buttons)
       <div class="stat"><span class="lbl">Balance</span><span class="v num">$0.00</span></div>
       <div class="stat hdr-off">...</div>                           (kept for the script, not shown in the bar)
     </div>
   </header>
   <script src="/dashboard/shell.js"></script><script src="/dashboard/labels.js"></script>

   A live state in the bar is the .livebadge below, never a label-over-value stat.

   The nav's one source is dashboard/shell.js (NAV): every page carries its markup pre-rendered and test/shell-nav.test.js
   holds each copy to it. Explain is not in the nav (a lab experiment, like the other lab screens).

   Position (sticky) and the display of .tr, .stats, .stat and .labtag have no specificity (:where), so a page can still hide one of its
   figures (.s-hide and the like) from its own stylesheet, whatever the load order.

   Desktop: 52px, the page ground, a bottom hairline. Logo 22x16 and a 15px/600 wordmark, the nav 24px after it:
   32px items at 13px/510 in label grey, the current one ink (no fill, no pill). Right side: ghost agent buttons,
   a 1px hairline, then figures as an 11px label over a 13px/510 value, 24px apart. Phone (<=640px): one 52px row
   (logo, the key figure, the Agent icon, a menu button); the menu holds the pages and the rest (see below).
   Nothing animates at rest. */
:root { --hdr: 64px; }

:where(header.top) { position: sticky; top: 0; z-index: 20; }
header.top {
  box-sizing: border-box;
  display: flex; align-items: center; justify-content: flex-start; gap: 16px;
  height: 64px; min-height: 64px; padding: 0 28px; margin: 0;
  background: var(--ob-ground); border-bottom: 1px solid var(--ob-line);
  -webkit-backdrop-filter: none; backdrop-filter: none;
  font-family: var(--ob-sans); font-feature-settings: "cv01", "ss03"; font-variant-numeric: lining-nums tabular-nums;
  color: var(--ob-ink); line-height: normal;
}
header.top .tl { display: flex; align-items: center; gap: 28px; min-width: 0; flex: 0 1 auto; }
header.top .brandlink { display: flex; align-items: center; gap: 9px; flex: none; color: var(--ob-ink); text-decoration: none; }
@media (hover: hover) { header.top .brandlink:hover { color: var(--ob-ink); } }
header.top .logo { display: block; width: 24px; height: 18px; flex: none; color: var(--ob-ink); }
header.top .brand { font-size: 19px; font-weight: 700; line-height: 24px; letter-spacing: -0.02em; color: var(--ob-ink); }

/* the lab badge: a neutral 18px tag, set close to the wordmark */
:where(header.top .labtag) { display: inline-block; }
header.top .labtag { flex: none; height: 18px; padding: 0 6px; margin: 0 0 0 -14px; border: 0; border-radius: 5px; box-shadow: none; background: rgba(250, 248, 240, 0.06); color: var(--ob-label); font-size: 11px; font-weight: 510; line-height: 18px; letter-spacing: 0.01em; cursor: default; }

/* nav: plain text, the current page in ink */
/* the row scrolls if it must; 4px/3px of padding (cancelled by the margin) keep the 3px focus ring inside its clip */
header.top .gnav { display: flex; align-items: center; gap: 2px; margin: -4px -3px; padding: 4px 3px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
header.top .gnav::-webkit-scrollbar { display: none; }
header.top .gnav a {
  flex: 0 0 auto; display: block; box-sizing: border-box; height: 36px; min-height: 0; padding: 0 10px; border-radius: var(--ob-pill, 999px);
  font-size: 15px; font-weight: 500; line-height: 36px; letter-spacing: normal; white-space: nowrap; text-decoration: none; text-align: center;
  color: var(--ob-label); background: transparent; box-shadow: none;
  transition: color 160ms cubic-bezier(.2, .8, .2, 1), background-color 160ms cubic-bezier(.2, .8, .2, 1);
}
@media (hover: hover) { header.top .gnav a:hover { color: var(--ob-ink); background: transparent; } }
header.top .gnav a[aria-current="page"] { color: var(--ob-ink); background: transparent; }
header.top a:focus-visible, header.top button:focus-visible { outline: 3px solid var(--ob-focus); outline-offset: 0; }

/* right side: ghost agent controls, a hairline, then the page's figures (label over value) */
:where(header.top .tr, header.top .stats) { display: flex; }
header.top .tr, header.top .stats { align-items: center; justify-content: flex-end; gap: 24px; margin-left: auto; min-width: 0; flex: 0 1 auto; padding: 0; }
:where(header.top .stat) { display: flex; }
header.top .stat { flex-direction: column; align-items: flex-end; gap: 2px; min-width: 0; line-height: normal; text-align: right; }
header.top .stat .lbl { font-size: 12px; font-weight: 400; line-height: 14px; letter-spacing: 0; white-space: nowrap; }
header.top .stat .v { font-size: 15px; font-weight: 600; line-height: 18px; white-space: nowrap; }
header.top .stat .lbl { color: var(--ob-label); }
:where(header.top .stat) .v { color: var(--ob-ink); }
header.top .stat .v.up, header.top .stat .v .up { color: var(--ob-up); }
header.top .stat .v.down, header.top .stat .v .down { color: var(--ob-down); }
/* a figure the bar no longer shows: its element stays for the page's script */
header.top .stat.hdr-off, header.top .stats .stat.hdr-off { display: none; }
/* the Trade page's running trades at fair value ride on the P&L figure's line, when there are any */
header.top .stat .vline { display: flex; align-items: baseline; gap: 6px; }
header.top .stat .opn { font-size: 12px; line-height: 16px; color: var(--ob-label); white-space: nowrap; }
header.top .stat .opn .v { font-size: 12px; font-weight: 510; }
/* the hairline between the controls and the first figure */
header.top .tr > .ac-toggle + .stat, header.top .tr > .ob-hbtn + .stat { padding-left: 24px; margin-left: -8px; border-left: 1px solid var(--ob-line); }

/* The one live badge (2.10), on every page that shows a live state (the bar's feed state, a "Live" section tag):
   neutral, 18px, 12px/510, a 5px teal dot when live. "Live" is never green. Amber when offline; no dot while
   connecting. <span class="livebadge on">Live</span> */
.livebadge { display: inline-flex; align-items: center; gap: 5px; flex: none; box-sizing: border-box; height: 18px; padding: 0 6px; border-radius: 5px; background: rgba(250, 248, 240, 0.06); color: var(--ob-label); font: 510 11px/18px var(--ob-sans); letter-spacing: 0.01em; white-space: nowrap; vertical-align: middle; }
.livebadge.on::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--ob-up); flex: none; }
.livebadge.bad { color: var(--ob-amber); background: rgba(232, 176, 75, 0.12); }
.livebadge:empty { display: none; }

/* The agent controls (onboard.js .ob-hbtn "Connect agent", agent-chat.js .ac-toggle "Agent"): one ghost style, label
   grey until hovered or open, no filled pills and no shortcut key cap (the shortcut is in the button's title). */
html header.top .tr .ob-hbtn, html header.top .tr .ac-toggle {
  position: relative; align-items: center; justify-content: center; gap: 7px; flex: none; box-sizing: border-box;
  height: 36px; width: auto; min-width: 0; margin: 0 -8px 0 0; padding: 0 12px; border: 0; border-radius: var(--ob-pill, 999px);
  background: transparent; box-shadow: none; color: var(--ob-label); font: 500 14px/1 var(--ob-sans); cursor: pointer; white-space: nowrap;
  transition: background-color 160ms cubic-bezier(.2, .8, .2, 1), color 160ms cubic-bezier(.2, .8, .2, 1);
}
@media (hover: hover) { html header.top .tr .ob-hbtn:hover, html header.top .tr .ac-toggle:hover { background: var(--ob-hover); color: var(--ob-ink); } }
html header.top .tr .ac-toggle.on, html header.top .tr .ac-toggle[aria-pressed="true"] { background: rgba(250, 248, 240, 0.07); box-shadow: none; color: var(--ob-ink); }
html header.top .tr .ob-hbtn.paused { background: rgba(232, 176, 75, 0.12); color: var(--ob-amber); }
html header.top .tr .ac-toggle .ac-kbd { display: none; }
@media (min-width: 641px) { html header.top .tr .ob-hbtn, html header.top .tr .ac-toggle { display: inline-flex; } }
header.top .ob-hbtn .ob-dot { width: 6px; height: 6px; }
/* the agent pair sits as one group: the second button tucks in */
html header.top .tr .ob-hbtn + .ac-toggle, html header.top .tr .ac-toggle + .ob-hbtn, html header.top .tr .ob-hbtn + .ob-hbtn { margin-left: -16px; }

/* the same bar a little tighter on small laptops and tablets */
@media (max-width: 1100px) {
  header.top .tl { gap: 16px; }
  header.top .labtag { margin-left: -6px; }
  header.top .gnav a { padding: 0 8px; }
  header.top .tr, header.top .stats { gap: 20px; }
  html header.top .tr .ac-toggle { width: 32px; padding: 0; }
  html header.top .tr .ac-toggle .ac-togl { display: none; }
  header.top .tr > .ac-toggle + .stat, header.top .tr > .ob-hbtn + .stat { padding-left: 20px; }
}
@media (max-width: 900px) and (min-width: 641px) {
  header.top { padding: 0 20px; }
  header.top .brand { display: none; }
  header.top .labtag { margin-left: 0; }
  header.top .gnav a { padding: 0 7px; }
  header.top .tr, header.top .stats { gap: 16px; }
  header.top .stat .opn { display: none; }
  header.top .tr > .ac-toggle + .stat, header.top .tr > .ob-hbtn + .stat { padding-left: 16px; }
}

/* the menu button (shell.js adds it to every bar): phones only */
header.top .mbtn { display: none; }

/* Phone (<=640px): ONE 52px row, so the page stays short. The logo, the page's key figure
   (its first .stat, e.g. Balance), a live badge, the Agent button as an icon, and a menu button. The menu opens
   under the row, over the page (shell.js gives the bar a negative bottom margin so nothing below moves): the six
   pages as 44px rows, the page's other figures, then its other buttons (Connect agent, Invite, Sign out) full
   width. .tr and .tl become display: contents so their children can be placed in the row or in the menu. */
@media (max-width: 640px) {
  :root { --hdr: 56px; }
  header.top { flex-wrap: wrap; align-content: flex-start; align-items: center; height: auto; min-height: 56px; gap: 0 4px; padding: 0 8px 0 16px; }
  header.top > .tl, header.top > .tr, header.top > .stats { display: contents; }
  header.top .brandlink { order: 0; height: 55px; margin-right: auto; }
  :where(header.top .brand) { display: inline; }
  header.top .brandlink:has(+ .labtag) { margin-right: 8px; }
  header.top .labtag { order: 0; margin: 0 auto 0 0; }

  /* row: the key figure, a live badge, the Agent icon, the menu button; everything else waits in the menu */
  header.top > .tr > *, header.top > .stats > * { display: none; order: 12; }
  header.top > .tr > div.stat:first-of-type, header.top > .stats > div.stat:first-of-type { display: flex; order: 1; margin: 0; padding: 0 6px 0 0; }
  header.top > .tr > .livebadge, header.top > .stats > .livebadge, header.top > .tr > .upd { display: inline-flex; order: 1; margin: 0 6px; }
  header.top > .tr > .upd:empty { display: none; }
  header.top > .tr > .livebadge:empty { display: none; }
  header.top .stat.hdr-off, header.top .stats .stat.hdr-off, header.top > .tr > .stat.hdr-off, header.top > .stats > .stat.hdr-off { display: none; }
  header.top .stat .opn { display: none; }
  html header.top > .tr > .ac-toggle, html header.top > .tr > .ac-toggle.on { order: 2; display: inline-flex; width: 44px; height: 44px; min-width: 44px; padding: 0; margin: 0; border-radius: 10px; background: transparent; box-shadow: none; color: var(--ob-label); }
  html header.top > .tr > .ac-toggle[aria-expanded="true"] { color: var(--ob-ink); background: rgba(250, 248, 240, 0.07); }
  header.top .ac-toggle .ac-togl { display: none; }
  header.top .ac-toggle::after { content: none; }
  header.top .mbtn {
    order: 3; display: inline-flex; align-items: center; justify-content: center; flex: none; box-sizing: border-box;
    width: 44px; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--ob-ink); cursor: pointer;
  }
  header.top .mbtn svg { display: block; width: 20px; height: 20px; }
  header.top .mbtn .mi-close, header.top.menu-open .mbtn .mi-open { display: none; }
  header.top.menu-open .mbtn .mi-close { display: block; }
  @media (hover: hover) { header.top .mbtn:hover { background: var(--ob-hover); } }
  header.top.menu-open .mbtn { background: rgba(250, 248, 240, 0.07); }
  header.top .gnav { display: none; }

  /* the menu: under the row, full width */
  header.top.menu-open { box-shadow: 0 16px 32px rgba(0, 0, 0, 0.55); padding-bottom: 12px; }
  header.top.menu-open .gnav {
    order: 10; display: flex; flex-direction: column; align-items: stretch; flex: 1 0 calc(100% + 24px);
    height: auto; margin: 0 -8px 0 -16px; padding: 6px 8px; gap: 0; overflow: visible; border-top: 1px solid var(--ob-line);
  }
  header.top.menu-open .gnav a {
    height: 44px; min-height: 44px; line-height: 44px; padding: 0 8px; border-radius: 8px; text-align: left;
    font-size: 15px; font-weight: 510; color: var(--ob-label); background: none;
  }
  @media (hover: hover) { header.top.menu-open .gnav a:hover { background: var(--ob-hover); color: var(--ob-ink); } }
  header.top.menu-open .gnav a[aria-current="page"] { color: var(--ob-ink); background: rgba(250, 248, 240, 0.06); box-shadow: none; }
  header.top.menu-open .gnav a:focus-visible { outline-offset: -3px; }
  /* the page's other figures, label over value, in one line of their own */
  header.top.menu-open > .tr > div.stat:not(:first-of-type):not(.hdr-off), header.top.menu-open > .stats > div.stat:not(:first-of-type):not(.hdr-off) {
    order: 11; display: flex; flex-direction: column; align-items: flex-start; text-align: left; flex: 1 1 40%; margin: 0; padding: 12px 0 8px; border-top: 1px solid var(--ob-line);
  }
  header.top.menu-open > .tr > div.stat:not(:first-of-type) .vline { flex-wrap: wrap; }
  header.top.menu-open > .tr > div.stat:not(:first-of-type) .opn { display: inline; }
  /* its other buttons: full-width 44px rows */
  html header.top.menu-open > .tr > button:not(.ac-toggle):not([hidden]) {
    order: 12; display: flex; align-items: center; justify-content: flex-start; gap: 8px; flex: 1 0 calc(100% + 8px); box-sizing: border-box;
    height: 44px; min-height: 44px; margin: 4px 0 0 -8px; padding: 0 8px; border: 0; border-radius: 8px;
    background: rgba(250, 248, 240, 0.06); box-shadow: none; color: var(--ob-ink); font: 510 15px/1 var(--ob-sans); text-align: left; cursor: pointer;
  }
  @media (hover: hover) { html header.top.menu-open > .tr > button:not(.ac-toggle):not([hidden]):hover { background: rgba(250, 248, 240, 0.1); } }
  header.top.menu-open .ob-hbtn .ob-hl { display: inline; }
  header.top.menu-open .ob-hbtn .ob-hs { display: none; }
}

/* phones: no text under 12px — the header's labels and badges read at 12px */
@media (max-width: 640px) { header.top .stat .lbl, header.top .labtag, .livebadge { font-size: 12px; }
  header.top .brand { font-size: 18px; } }

/* ---------- "Ask for any trade": a search-style pill in the bar (shell.js askPill). On the Trade page it opens the Ask
   card and focuses its input; elsewhere it links to it. Desktop and tablet only (a phone has Ask on the page). ---------- */
header.top .hask {
  flex: 1 1 auto; display: flex; align-items: center; gap: 10px; box-sizing: border-box; min-width: 0; max-width: 460px; height: 42px;
  margin: 0 0 0 4px; padding: 0 16px; border: 0; border-radius: var(--ob-pill, 999px); background: var(--ob-muted); color: var(--ob-label);
  font: 400 14px/1 var(--ob-sans); text-align: left; text-decoration: none; white-space: nowrap; overflow: hidden; cursor: text;
  transition: background-color 160ms cubic-bezier(.2, .8, .2, 1), color 160ms cubic-bezier(.2, .8, .2, 1);
}
@media (hover: hover) { header.top .hask:hover { background: var(--ob-fill); color: var(--ob-ink-2); } }
header.top .hask svg { flex: none; width: 16px; height: 16px; }
header.top .hask span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
header.top .hask span.hask-s { display: none; }
@media (max-width: 1280px) { header.top .hask { max-width: 300px; } }
@media (max-width: 1100px) { header.top .hask { flex: 0 0 42px; width: 42px; padding: 0; justify-content: center; } header.top .hask span { display: none; } }
@media (max-width: 640px) { header.top .hask { order: 1; flex: 0 0 auto; width: auto; height: 36px; margin: 0; padding: 0 12px 0 10px; gap: 6px; justify-content: center; border-radius: 10px; background: #0d0d0f; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); color: var(--ob-ink-2); font-weight: 600; font-size: 13px; cursor: pointer; } header.top .hask span { display: none; } header.top .hask span.hask-s { display: inline; } }
@media (max-width: 640px) and (hover: none) { header.top .hask:hover { background: #0d0d0f; color: var(--ob-ink-2); } }
/* the agent connect button: the one filled white pill in the bar (no ring, no border) */
html header.top .tr .ob-hbtn:not(.paused) { background: var(--ob-ink); color: var(--ob-ground); font-weight: 600; margin-right: 0; padding: 0 16px; }
@media (hover: hover) { html header.top .tr .ob-hbtn:not(.paused):hover { background: var(--ob-brand-2); color: var(--ob-ground); } }
html header.top .tr .ob-hbtn:not(.paused) .ob-dot { display: none; }
html header.top .tr .ob-hbtn + .ac-toggle, html header.top .tr .ac-toggle + .ob-hbtn { margin-left: -12px; }

/* the bar holds the pages, the Ask pill, the balance and the account menu. The agent controls (Connect agent, Invite,
   the Agent chat button) are items in the account menu (account-menu.js); their buttons stay in the DOM for the
   scripts that drive them and for keyboard shortcuts */
html header.top .tr .ob-hbtn, html header.top .tr .ac-toggle, html header.top > .tr > .ac-toggle, html header.top > .tr > .ac-toggle.on { display: none; }
header.top .tr > .ac-toggle + .stat, header.top .tr > .ob-hbtn + .stat { padding-left: 0; margin-left: 0; border-left: 0; }
/* the narrowest phones: the mark without the wordmark, so the bar stays one row */
@media (max-width: 360px) { header.top .brand { display: none; } header.top .brandlink { margin-right: auto; } }

/* ---------- one header on every page: the pages, Ask, the balance, the account (account-menu.js). A page's other
   figures and live badges keep their elements for its scripts and leave the bar ---------- */
header.top [data-hdr-off] { display: none !important; }
header.top .stat.obal[hidden] { display: none !important; }

/* ---------- phones (<=640px): a bottom bar, Trade / Markets / Portfolio / Account (shell.js bottomBar). The bar on top
   keeps the logo, Ask and the balance; its menu button and avatar give way to this bar ---------- */
.bbar { display: none; }
/* the account menu opens over every fixed bar on the page (the Trade page's 1-tap bar and its sheet: UX-01, a tap on
   "Sign in" under the bar placed a trade) */
header.top:has(.oacct.open) { z-index: 97; }
@media (max-width: 640px) {
  :root { --bbar-h: 60px; }
  header.top .mbtn { display: none; }
  header.top > .tr > .stat.obal:not([hidden]) { display: flex; order: 1; margin: 0; padding: 0 6px 0 0; }
  /* while the account loads, Account value keeps its place unseen, so Ask never jumps left when it lands; with no
     account at all, Sign in takes that place instead */
  header.top > .tr > .stat.obal[hidden] { display: flex !important; visibility: hidden; order: 1; margin: 0; padding: 0 6px 0 0; }
  header.top:has(.oacct-signin:not([hidden])) > .tr > .stat.obal[hidden] { display: none !important; }
  body.has-bbar { padding-bottom: calc(var(--bbar-h) + env(safe-area-inset-bottom)); }
  .bbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; box-sizing: border-box; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    height: calc(var(--bbar-h) + env(safe-area-inset-bottom)); padding: 0 4px env(safe-area-inset-bottom);
    background: #000; border-top: 1px solid var(--ob-line); font-family: var(--ob-sans);
  }
  body .bbar > a, body .bbar > button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0; height: var(--bbar-h); padding: 0; border: 0; background: transparent;
    color: var(--ob-label); font: 500 12px/14px var(--ob-sans); text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .bbar svg { display: block; width: 22px; height: 22px; }
  .bbar .oav { width: 24px; height: 24px; font-size: 10.5px; } /* r27: 9px initials were unreadable */
  body .bbar > a[aria-current="page"], body .bbar > button[aria-current="page"], body .bbar > button[aria-expanded="true"] { color: var(--ob-ink); } /* beats a page's own "a { color: inherit }" (UX-39: no tab lit on Home); Account is lit on the pages it leads to (UX-40) */
  @media (hover: hover) { .bbar > a:hover, .bbar > button:hover { color: var(--ob-ink); text-decoration: none; } }
  .bbar > a:focus-visible, .bbar > button:focus-visible { outline: 3px solid var(--ob-focus); outline-offset: -3px; border-radius: 10px; }
}
/* r15: six tabs on the narrowest phones (52px each at 320): "Portfolio" and "Account" ran into each other at 12px */
@media (max-width: 374px) {
  body .bbar > a, body .bbar > button { font-size: 11px; letter-spacing: -0.01em; }
  body .bbar > a > span, body .bbar > button > span:not(.oav) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
/* 320-359: the bar runs edge to edge and the words are iOS tab-bar size, so "Portfolio" and "Account" keep a clear gap */
@media (max-width: 359px) {
  .bbar { padding-left: 0; padding-right: 0; }
  body .bbar > a, body .bbar > button { font-size: 10.5px; letter-spacing: 0; }
}

/* ---------- Ask, always on the right: a small tab on the right edge (an icon with "Ask" under it, ⌘L / Ctrl+L in its
   tooltip), the one way in on a desktop: the bar's Ask pill is hidden wherever the tab is. On the Trade page it opens
   the chat panel (chat.js), which pushes the page over from 1600px up; elsewhere it goes to the Trade page with the
   chat open (shell.js askRail). A phone has no tab: the bar's chat button (.hask) opens the chat. ---------- */
:root { --oc-rail: 48px; }
.ochat-rail {
  position: fixed; top: calc(var(--hdr, 64px) + 20px); right: 0; z-index: 30; width: var(--oc-rail); height: 56px; box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 0 0 0 2px; margin: 0;
  border: 0; border-radius: 12px 0 0 12px; background: #0d0d0f; color: var(--ob-ink-2, #d4d4d8);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  font-family: var(--ob-sans); text-decoration: none; cursor: pointer; transition: background-color 120ms, color 120ms;
}
.ochat-rail:focus-visible { background: #121214; color: var(--ob-ink); text-decoration: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); }
@media (hover: hover) { .ochat-rail:hover { background: #121214; color: var(--ob-ink); text-decoration: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); } }
.ochat-rail:focus-visible { outline: 3px solid var(--ob-focus); outline-offset: -3px; }
.ochat-rail svg { display: block; width: 18px; height: 18px; }
.ochat-rail-t { font: 600 11px/1 var(--ob-sans); letter-spacing: 0.01em; }
/* the tab sits in the page's own gutter; only where the page reaches the edge does it take its width */
/* every width: full-bleed pages (Markets, Portfolio, History) ran their right-hand buttons under the tab at 1440 and 1920 */
/* critic r3: the 48px gutter the tab took cut the header's line short and set the page off-centre. Ask now lives in the
   header on every width (the bar's Ask pill, .hask), so the header runs full width and nothing floats over the page */
.ochat-rail { display: none !important; }
html.ochat-has-rail body { padding-right: 0; }
body.tk-more .ochat-rail { display: none; } /* More ways to trade covers the right edge; Done closes it */
html.ochat-has-rail.ochat-push body { padding-right: var(--oc-w, 420px); }
html.ochat-push .ochat-rail { display: none; }
html.ochat-is-open .ochat-rail { background: #121214; color: var(--ob-ink); }
html.ochat-drawer-open .ochat-rail { visibility: hidden; } /* the panel covers it; its own header closes it */

@media (max-width: 700px) {
  html.ochat-has-rail body { padding-right: 0; }
  .ochat-rail { display: none; }
}
@media (prefers-reduced-motion: reduce) { .ochat-rail { transition: none; } }
/* Home and Portfolio open on the account value: the bar does not repeat it (the figure stays in the page for scripts) */
header.top .stat.hero-dup { display: none !important; }
/* a phone's Ask: a plain chat icon, no bordered pill */
@media (max-width: 640px) {
  header.top .hask { width: 40px; padding: 0; border-radius: 10px; background: transparent; box-shadow: none; color: var(--ob-ink); }
  header.top .hask span.hask-s { display: none; }
  header.top .hask svg { width: 20px; height: 20px; }
}
@media (max-width: 640px) and (hover: none) { header.top .hask:hover { background: transparent; } }

/* ---------- one column on every page (critic r1: "every page looks like a different app"): Markets, Portfolio,
   History, Settings, Leaderboard and Oracle sit in Home's centred column (1240 px, 32 px gutters), not edge to edge ---------- */
@media (min-width: 701px) {
  main.apage, main#wrap.wrap, main#lbpage.page, main#orpage.page { box-sizing: border-box; width: 100%; max-width: 1240px; margin-left: auto; margin-right: auto; padding-left: 32px; padding-right: 32px; }
}
@media (min-width: 701px) and (max-width: 1279px) {
  main.apage, main#wrap.wrap, main#lbpage.page, main#orpage.page { padding-left: 24px; padding-right: 24px; }
}

/* ---------- one asset icon on every page: a coloured circle per market, the Markets page's set (feeds/page.css .mi);
   Home's rows use it too (home.js icoHtml: class "ico mi", data-m) ---------- */
.ico.mi[data-m="BTC"] { background: #f7931a; } .ico.mi[data-m="XAU"] { background: #c9a227; } .ico.mi[data-m="WTI"], .ico.mi[data-m="BRENT"] { background: #3b3b42; }
.ico.mi[data-m="PJM"] { background: #e0a100; } .ico.mi[data-m="H100"] { background: #1fae6a; }
.ico.mi[data-m="EURUSD"], .ico.mi[data-m="GBPUSD"], .ico.mi[data-m="AUDUSD"], .ico.mi[data-m="USDJPY"], .ico.mi[data-m="USDCNH"], .ico.mi[data-m="DXY"] { background: #2b5cd6; }
.ico.mi[data-m="ETH"] { background: #627eea; } .ico.mi[data-m="SOL"] { background: #9945ff; } .ico.mi[data-m="XRP"] { background: #23292f; }
.ico.mi[data-m="BNB"] { background: #f0b90b; color: #000; } .ico.mi[data-m="DOGE"] { background: #c2a633; } .ico.mi[data-m="HYPE"] { background: #3ccfb4; color: #000; }
.ico.mi[data-m="LINK"] { background: #2a5ada; } .ico.mi[data-m="AVAX"] { background: #e84142; } .ico.mi[data-m="SUI"] { background: #4da2ff; } .ico.mi[data-m="ADA"] { background: #0033ad; }
.ico.mi[data-m="NVDA"] { background: #76b900; color: #000; } .ico.mi[data-m="TSLA"] { background: #cc0000; } .ico.mi[data-m="AAPL"] { background: #555; } .ico.mi[data-m="MSFT"] { background: #00a4ef; }
.ico.mi[data-m="AMZN"] { background: #ff9900; color: #000; } .ico.mi[data-m="GOOGL"] { background: #4285f4; } .ico.mi[data-m="META"] { background: #0866ff; } .ico.mi[data-m="AMD"] { background: #1f1f1f; }
.ico.mi[data-m="TSM"] { background: #c4161c; } .ico.mi[data-m="PLTR"] { background: #2b2b2b; } .ico.mi[data-m="COIN"] { background: #0052ff; } .ico.mi[data-m="MSTR"] { background: #d9232e; }
.ico.mi[data-m="HOOD"] { background: #ccff00; color: #000; } .ico.mi[data-m="JPM"] { background: #6b5a45; }
.ico.mi[data-m="US500"], .ico.mi[data-m="US100"], .ico.mi[data-m="US30"], .ico.mi[data-m="US2000"] { background: #3a4a6b; } .ico.mi[data-m="VIX"] { background: #7a3b8f; }
.ico.mi[data-m="HSI"], .ico.mi[data-m="NIKKEI"] { background: #8a2b3a; } .ico.mi[data-m="XAG"], .ico.mi[data-m="XPT"] { background: #8e9196; } .ico.mi[data-m="COPPER"] { background: #b8733e; }
.ico.mi[data-m="NATGAS"] { background: #3a7bd5; } .ico.mi[data-m="WHEAT"] { background: #c8a04a; } .ico.mi[data-m="URANIUM"] { background: #5a8f29; }
.ico.mi[data-m="US10Y"], .ico.mi[data-m="US2Y"], .ico.mi[data-m="CPI"] { background: #4a5568; } .ico.mi[data-m="HOME"], .ico.mi[data-m="RENT"], .ico.mi[data-m="EGGS"] { background: #8a6d3b; }
.ico.mi[data-m="OPENAI"], .ico.mi[data-m="SPACEX"] { background: #3a3a3f; } .ico.mi[data-m="ANT"], .ico.mi[data-m="ANTHROPIC"] { background: #d97757; }

/* list pages: the list sits on the page, as Home's Markets list does, with no outer panel around it (Settings' forms and
   the Live trades rail keep theirs). A hairline under the section head is the only frame. */
@media (min-width: 701px) {
  main#wrap .pane.mkts.ob-panel, main#pf .apanel.pfblot, main#hs > .apanel, main#hs > section.apanel, main#lbpage > .ob-panel.pane {
    background: transparent; border: 0; border-radius: 0; box-shadow: none; padding-left: 0; padding-right: 0;
  }
}

/* touch screens: the invisible 44px hit area shell.js touchTargets() gives a control smaller than that (its look unchanged) */
.ob-hit-rel { position: relative; }
.ob-hit:not(.ob-hit-b)::after, .ob-hit.ob-hit-b::before { content: ""; position: absolute; z-index: 1; top: var(--ht, 0); bottom: var(--hb, 0); left: var(--hl, 0); right: var(--hr, 0); }
.ob-hit-ov { overflow: visible !important; }
/* touch: the bar's chat button is a 44px tap */
@media (max-width: 700px) and (pointer: coarse) { header.top .hask { min-width: 44px; height: 44px; } }

/* the account-value line, Home and Portfolio (acct-chart.js draw): one colour by all-time change, a filled end dot */
svg.acx .ln { fill: none; stroke: var(--ob-ink-2, #a1a1aa); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg.acx .end { fill: var(--ob-ink-2, #a1a1aa); stroke: none; }
/* the starting value: a quiet solid grey line (never dotted or dashed), and the scrub's hairline and dot (critic r4) */
svg.acx .base { stroke: rgba(255, 255, 255, 0.16); stroke-width: 1; } /* a solid quiet hairline: no dashed lines (round 6) */
svg.acx .basel { fill: var(--ob-label, #8a8d95); font: 500 12px/1 var(--ob-sans, system-ui); font-variant-numeric: tabular-nums; }
svg.acx .scrub { stroke: rgba(255, 255, 255, 0.4); stroke-width: 1; }
svg.acx .sdot { fill: var(--ob-ink-2, #a1a1aa); stroke: #000; stroke-width: 2; }
svg.acx.up .sdot { fill: var(--ob-up); } svg.acx.down .sdot { fill: var(--ob-down); }
svg.acx { touch-action: pan-y; cursor: crosshair; }
svg.acx.up .ln { stroke: var(--ob-up); } svg.acx.up .end { fill: var(--ob-up); }
svg.acx.down .ln { stroke: var(--ob-down); } svg.acx.down .end { fill: var(--ob-down); }

/* a sideways row of tabs or chips (shell.js edges): the edge with more past it fades; a mouse screen gets a chevron there */
.srow { position: relative; min-width: 0; }
.srow-el.fr { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent); }
.srow-el.fl { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 56px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 56px), transparent); }
.srow-el.fl.fr { -webkit-mask-image: linear-gradient(to right, transparent, #000 56px, #000 calc(100% - 56px), transparent); mask-image: linear-gradient(to right, transparent, #000 56px, #000 calc(100% - 56px), transparent); }
.srow-el:not(.fl):not(.fr) { -webkit-mask-image: none; mask-image: none; }
.srow-b { display: none; }
@media (hover: hover) and (pointer: fine) {
  .srow-b { position: absolute; top: 50%; z-index: 2; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; margin-top: -16px; padding: 0; border: 0; border-radius: 50%; background: #1c1c20; color: var(--ob-ink, #fff); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12); cursor: pointer; }
  .srow-b[hidden] { display: none; }
  .srow-b:hover { background: #26262b; }
  .srow-b svg { width: 14px; height: 14px; }
  .srow-prev { left: 0; }
  .srow-next { right: 0; }
  /* the arrow never sits on a chip (critic r4: "Private cc" cut under it): the row fades out over 56px before the
     arrow and is fully clear under it, and the row ends with room to scroll its last chip out from under the arrow */
  .srow-el.fr { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 96px), transparent calc(100% - 40px)); mask-image: linear-gradient(to right, #000 calc(100% - 96px), transparent calc(100% - 40px)); }
  .srow-el.fl { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 96px), transparent calc(100% - 40px)); mask-image: linear-gradient(to left, #000 calc(100% - 96px), transparent calc(100% - 40px)); }
  .srow-el.fl.fr { -webkit-mask-image: linear-gradient(to right, transparent 40px, #000 96px, #000 calc(100% - 96px), transparent calc(100% - 40px)); mask-image: linear-gradient(to right, transparent 40px, #000 96px, #000 calc(100% - 96px), transparent calc(100% - 40px)); }
  .srow-el.fr, .srow-el.fl { scroll-padding-inline: 48px; }
  .srow-el.fr::after, .srow-el.fl::after { content: ""; flex: 0 0 48px; height: 1px; }
}
/* touch screens of every width (critic r3: the 44px rule reached only narrow widths): the logo link is a 44px tap */
@media (pointer: coarse) { header.top .brandlink { min-height: 44px; min-width: 44px; justify-content: center; } }
/* touch (critic r4: boxes measured): the header's pages, Ask and the account button are real 44px taps */
@media (pointer: coarse) {
  header.top .gnav a { min-height: 44px; display: inline-flex; align-items: center; }
  header.top .hask { min-width: 44px; min-height: 44px; }
  header.top .oacct-btn, header.top .oacct-signin { min-height: 44px; display: inline-flex; align-items: center; }
}

/* round 6: on a very wide screen the header's edges line up with the page's 1240px content (critic r6: logo at x≈28 and
   the avatar at x≈2530 over a centred column) */
/* final pass r9 r1 (critic: at 1920 and 2560 the logo sat 80-220px right of Trade's content): ONE container width for
   the header and every page, --page-w: Home's 1240px, then 1400px from 1920 and 1680px from 2200 (the widths Trade
   already used there, so a big screen still reads as a trading screen) */
:root { --page-w: 1240px; }
@media (min-width: 1920px) { :root { --page-w: 1400px; } }
@media (min-width: 2200px) { :root { --page-w: 1680px; } }
@media (min-width: 1600px) {
  header.top { padding-left: calc((100vw - var(--page-w)) / 2 + 32px); padding-right: calc((100vw - var(--page-w)) / 2 + 32px); }
  main.apage, main#wrap.wrap, main#lbpage.page, main#orpage.page { max-width: var(--page-w); }
}
/* round 7 (critic r1): with the Ask panel docked (1600px up, html.ochat-push) the header centred itself on the whole
   window, so its content box was ~800px and the Ask pill slid over Markets and Portfolio. It now centres on the width the
   panel leaves, and the page links never shrink under the pill (the pill gives way, down to its icon) */
@media (min-width: 1600px) {
  html.ochat-push header.top { padding-left: max(32px, calc((100vw - var(--oc-w, 420px) - var(--page-w)) / 2 + 32px)); padding-right: max(32px, calc((100vw - var(--oc-w, 420px) - var(--page-w)) / 2 + 32px)); }
}
@media (min-width: 1101px) { header.top .gnav { flex-shrink: 0; } }
/* final pass r9 (critic: "the whole top bar jumps sideways when I go from Trade to Markets"): the header keeps ONE
   container width (1240px, Home's column) on every page, Trade included; only the page content under it differs, as on
   Robinhood, where the nav never moves between tabs */

/* round 8 (critic: 36px page links, a 32px account button at 768x1024 and 844x390): touch-sized layouts (a touch screen,
   anything up to 1024px wide, any screen under 500px tall) get real 44px header taps, the look unchanged */
@media (pointer: coarse), (max-width: 1024px), (max-height: 500px) {
  header.top .gnav a { min-height: 44px; display: inline-flex; align-items: center; }
  header.top .hask { min-height: 44px; min-width: 44px; }
  header.top .oacct-btn, header.top .oacct-signin { min-height: 44px; display: inline-flex; align-items: center; }
  header.top .brandlink { min-height: 44px; min-width: 44px; }
}
/* round 10: the Ask bar's example only where it fits whole (critic r9: cut to "Nvidia down 5..." at 1280) */
@media (max-width: 1359px) { .hask .hask-x { display: none; } }
/* r27 phone audit: a small phone held sideways (568x320) gave 60% of the screen to the bars. In short landscape the tab
   bar is icons only at 44px and the top bar scrolls away with the page, so the chart keeps the screen */
@media (max-width: 640px) and (max-height: 500px) and (orientation: landscape) {
  :root { --bbar-h: 44px; }
  body .bbar > a > span, body .bbar > button > span:not(.oav) { display: none; }
  body header.top { position: relative; top: auto; }
}
