/* ═══════════════════════════════════════════════════════════════════════════
   77 — THE PHONE LAYOUT (2026-10-14)
   ───────────────────────────────────────────────────────────────────────────
   Every rule here is scoped to :root.phone, the ONE switch stamped before
   first paint by app.html's head (window.MPPhone, max-width 640px, with a
   "Desktop layout" opt out). Behaviour: static/js/phone.js. Markup:
   templates/_phone_nav.html.

   LAST in the cascade on purpose: it overrides the desktop shell, so it must
   never be overridden by it. Owns .pnav-* (tab bar), .pvs-* (view strip),
   .pbs-* (Buy / Sell bar) and .pdo-* (desktop only screen).

   THE SHAPE. The desktop shell is a fixed sidebar rail + a drawing tools
   column + a trade rail around the content. On a phone all three go, the
   content takes the full width, and navigation moves to a bottom tab bar:
     [ header / view strip ]
     [ the page (scrolls inside) ]
     [ Buy / Sell bar ]            chart page only
     [ Watchlist Chart Tools Portfolio Ask ]
   The sidebar is kept, as a full screen sheet the Watchlist tab opens; it is
   the phone's "More" (every tool group, Settings, the account menu).

   SIZES are px here, not rem: the root font is fluid on desktop, and the
   phone gets its own fixed root below, so a 44px touch target means 44px.
   ═══════════════════════════════════════════════════════════════════════════ */

/* The tab bar exists in the markup on every width; only a phone shows it. */
.pnav{display:none;}

:root.phone{
  /* Root font: the desktop clamp floors at 12px, which made every rem based
     label ~9-11px on a phone. 14px keeps the desktop proportions at a size a
     thumb and an eye can use. */
  font-size:14px;
  --pnav-h:56px;
  --pnav-total:calc(var(--pnav-h) + env(safe-area-inset-bottom, 0px));
  --tap:44px;
  /* The desktop rails are gone: zero their widths so every rule that
     reserves room for them (margins, --dock-r) reserves nothing. */
  --rail-w:0px;
  --chart-rail-w:0px;
  --trade-rail-w:0px;
  --dock-r:0px;
  --sidebar-w:100vw;
  -webkit-text-size-adjust:100%;
  text-size-adjust:100%;
}

/* ── The shell ─────────────────────────────────────────────────────────────
   An app shell, not a scrolling page: the body is exactly the visible
   viewport (dvh, so the collapsing address bar never leaves a gap or hides
   the tab bar), the tab bar is fixed under it, and each view scrolls inside
   itself as on desktop. Undoes 08-chart-chrome.css's older 640px block,
   which turned the body into a scrolling page. */
:root.phone,
:root.phone body{height:100%;overflow:hidden;}
:root.phone body{
  height:100dvh;min-height:0;
  padding-bottom:var(--pnav-total);
  box-sizing:border-box;
  overscroll-behavior:none;
}
:root.phone .main,
:root.phone.sb-open .main{
  margin-left:0;
  height:auto;min-height:0;
  overflow:hidden;
}
:root.phone .charts{min-height:0;margin-left:0;margin-right:0;}

/* The desktop rails. The drawing tools column comes back as a sheet later
   (phone.js "Draw"); the trade rail's job is done by the Buy / Sell bar. */
:root.phone #chart-rail,
:root.phone .trade-rail{display:none !important;}

/* ── The sidebar as the Watchlist / More sheet ─────────────────────────────
   With --rail-w at 0 the closed rail clips to nothing; open, it covers the
   page down to the tab bar, which stays visible so the same tab closes it. */
:root.phone .sidebar{
  bottom:var(--pnav-total);
  height:auto;
  width:100vw;
}
:root.phone .sidebar-clip{border-right:0;}
:root.phone body::before{display:none;}
/* The Collapse row is the tab bar's job on a phone. */

/* ── The tab bar ──────────────────────────────────────────────────────────── */
:root.phone .pnav{
  display:flex;
  position:fixed;left:0;right:0;bottom:0;
  height:var(--pnav-total);
  padding:0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  box-sizing:border-box;
  background:var(--bg-primary);
  border-top:1px solid var(--border-default);
  /* Above the sidebar sheet (56) and the page; below menus, dialogs and the
     trade sheet (60+), which cover it like any modal. */
  z-index:57;
}
.pnav-tab{
  flex:1 1 0;min-width:0;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
  height:var(--pnav-h);
  padding:0;margin:0;border:0;background:none;
  color:var(--text-muted);
  font:500 11px/1.1 var(--font-sans);
  letter-spacing:0.01em;
  text-decoration:none;
  cursor:pointer;
  -webkit-tap-highlight-color:transparent;
  touch-action:manipulation;
}
.pnav-ico{width:22px;height:22px;flex:none;}
.pnav-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;
  padding-block:0.2em;margin-block:-0.2em;}   /* 2026-11-10: room inside the ellipsis clip for descenders, same layout */
.pnav-tab.active{color:var(--accent);}
.pnav-tab.active .pnav-ico{stroke-width:2.1;}
.pnav-tab:focus-visible{outline:2px solid var(--accent);outline-offset:-4px;border-radius:10px;}

/* ── The chart header ──────────────────────────────────────────────────────
   Desktop: ticker + price on the left, a long right anchored command
   cluster (the toolbar, Indicators, Key stats, Trade, the view dropdown).
   Phone: the same row keeps ticker + price and FOUR controls (chart type,
   interval, Indicators, Key stats) plus a "more" toggle (#pcl-more,
   phone.js) that opens everything else as a panel under the header. The
   view dropdown is replaced by the view strip, Trade by the Buy / Sell bar.
   app.js's toolbar fit tiers stand down on a phone (they would only grow
   --header-h), so this file owns the header height outright. */
:root.phone{--header-h:48px;}
:root.phone .hdr{
  height:var(--header-h);min-height:0;
  padding:0 12px;
  flex-wrap:nowrap;align-content:normal;gap:8px;
}
:root.phone .hdr-sym{font-size:17px;}
:root.phone .hdr-price{font-size:15px;}
:root.phone .top-cluster{
  top:0;right:8px;
  height:var(--header-h);min-height:0;
  flex-wrap:nowrap;gap:2px;
  --ctl-h:36px;
}
:root.phone .top-cluster .time-controls{flex-wrap:nowrap;gap:2px;padding:0;}
/* Hidden until "more": every toolbar control but chart type and interval,
   the Trade button (Buy / Sell bar) and the view dropdown (view strip). */
:root.phone .top-cluster:not(.pcl-open) .time-controls > :not(#charttype-picker):not(#interval-picker),
:root.phone .top-cluster:not(.pcl-open) #hdr-trade-btn,
:root.phone .top-cluster #view-toggle,
:root.phone .top-cluster:not(.pcl-open) .ctpl-caret{display:none !important;}
:root.phone .top-cluster #hdr-trade-btn{display:none !important;}
/* Touch sized, icon only. */
:root.phone .top-cluster .hdr-graphs-btn{
  min-width:var(--tap);height:var(--tap);padding:0;justify-content:center;
  background:none;box-shadow:none;
}
:root.phone .top-cluster .hdr-graphs-label{display:none;}
:root.phone .time-controls > *{min-height:var(--tap);}
/* The "more" toggle and its open panel. */
.pcl-more{display:none;}
:root.phone .pcl-more{
  display:inline-flex;align-items:center;justify-content:center;
  width:var(--tap);height:var(--tap);flex:none;
  border:0;border-radius:10px;background:none;color:var(--text-secondary);
  -webkit-tap-highlight-color:transparent;
}
:root.phone body.no-charts .pcl-more{display:none;}   /* chart page only */
:root.phone .pcl-more[aria-expanded="true"]{color:var(--accent);background:color-mix(in srgb, var(--accent) 12%, transparent);}
/* Open: the header row stays as it is (ticker, price, the four controls)
   and the whole toolbar drops down UNDER it as a panel across the page.
   position:fixed resolves against .main, not the viewport: .main is a size
   container (04-header.css), and container-type implies layout
   containment, which makes it the containing block of fixed descendants. */
:root.phone .top-cluster.pcl-open .time-controls{
  position:fixed;top:var(--header-h);left:0;right:0;
  z-index:51;
  flex-wrap:wrap;justify-content:flex-start;gap:2px 4px;
  padding:6px 8px 8px;
  background:var(--bg-primary);
  box-shadow:0 1px 0 var(--border-default), var(--shadow-drop);
}
/* A hidden header (every view but the chart) takes its row with it. */
:root.phone .hdr.hidden{display:none;}

/* ── The view strip ────────────────────────────────────────────────────── */
.pvs{display:none;}
:root.phone .pvs:not([hidden]){
  display:flex;flex:none;gap:4px;
  height:40px;padding:0 8px;
  overflow-x:auto;overflow-y:hidden;
  scrollbar-width:none;
  -webkit-overflow-scrolling:touch;
  scroll-snap-type:x proximity;
  border-bottom:1px solid var(--border-default);
  background:var(--bg-primary);
}
:root.phone .pvs::-webkit-scrollbar{display:none;}
.pvs-tab{
  flex:none;position:relative;
  padding:0 12px;border:0;background:none;
  color:var(--text-muted);
  font:500 14px/40px var(--font-sans);
  white-space:nowrap;scroll-snap-align:start;
  -webkit-tap-highlight-color:transparent;touch-action:manipulation;
}
.pvs-tab.active{color:var(--text-primary);font-weight:600;}
.pvs-tab.active::after{
  content:'';position:absolute;left:12px;right:12px;bottom:0;height:2px;
  border-radius:2px;background:var(--accent);
}

/* ── The Buy / Sell bar ────────────────────────────────────────────────── */
.pbs{display:none;}
:root.phone .pbs:not([hidden]){
  display:flex;flex:none;gap:8px;
  padding:8px 12px;
  border-top:1px solid var(--border-default);
  background:var(--bg-primary);
}
.pbs-btn{
  flex:1 1 0;height:var(--tap);
  border:0;border-radius:10px;
  font:600 15px/1 var(--font-sans);letter-spacing:0.01em;
  color:var(--on-accent);
  -webkit-tap-highlight-color:transparent;touch-action:manipulation;
}
.pbs-buy{background:var(--green);}
.pbs-sell{background:var(--red);}
.pbs-btn:active{filter:brightness(.92);}

/* ── Sheets: the trade ticket and Key stats ───────────────────────────────
   Both already turn into overlays at 720px (12-trade-wallet.css,
   13-widgets.css) but kept their desktop width (~174px on a phone). On a
   phone they are full screen sheets, above the tab bar, with the notch and
   the home bar kept clear. */
:root.phone{--trade-w:100vw;--ksd-w:100vw;}
:root.phone .trade-overlay{
  top:0;bottom:0;
  z-index:60;
  padding-top:env(safe-area-inset-top, 0px);
  padding-bottom:env(safe-area-inset-bottom, 0px);
  background:var(--bg-primary);
}
:root.phone .trade-overlay:not(.hidden):not(.closing){box-shadow:none;}
:root.phone .trade-drawer{width:100%;border:0;}
:root.phone .ksd-panel{
  top:0;bottom:0;left:0;right:0;width:auto;
  z-index:58;
  padding-top:env(safe-area-inset-top, 0px);
  padding-bottom:env(safe-area-inset-bottom, 0px);
}

/* ── The Watchlist / More sheet: touch density ─────────────────────────────
   The desktop rows are 2rem (28px here) with 13px labels. A thumb needs
   44px; the sheet has the whole screen, so it can afford them. */
:root.phone .sidebar{
  --snv-h:46px;
  --snv-ico:18px;
}
:root.phone .sidebar .stock-list .stock-item{height:52px;font-size:15px;}
/* The brand block is 100px of logo; the tab bar already says where you are. */
:root.phone .sidebar-brand{display:none;}
/* 16px or iOS Safari zooms the page in on focus. */
:root.phone #search-input{font-size:16px;}   /* no iOS focus zoom */
/* The sidebar's own geometry (row columns, the account chip's inset, the
   rail glyph centring) is all derived from --rail-w. The page needs it at 0
   (no rail beside the content), the sheet needs its desktop value, so the
   sheet restores it for itself, and the closed rail clips to nothing by an
   explicit inset instead of by --rail-w. */
:root.phone .sidebar{--rail-w:56px;}
:root.phone:not(.sb-open) .sidebar .sidebar-clip{clip-path:inset(0 100% 0 0);visibility:hidden;}
:root.phone .sidebar::after{display:none;}
/* One scroll for the whole sheet: on a phone the pinned top rows and the
   footer would leave the watchlist a few rows of its own. */
:root.phone .sidebar-clip{overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;}
:root.phone .sidebar .wl-scroll{flex:none;overflow:visible;height:auto;max-height:none;}
/* Rows are laid out at --sidebar-w (100vw here), which ran them under the
   sheet's scrollbar and clipped the quote column. Fill the sheet instead. */
:root.phone .sidebar .stock-list .stock-item{padding-right:16px;}

/* The ticket and Key stats are dense desktop panels (10-12px labels, 24px
   segment buttons). On a phone sheet they are scaled whole with zoom, the
   same tool home's login sheet uses (--ap-z): every control, label and gap
   keeps its proportions and lands at touch size (24px -> 31px segments,
   27px -> 35px Buy / Sell, 37px -> 48px close). Measured: the zoomed drawer
   still fills the sheet exactly (its height is a percentage, which zoom does
   not multiply), and its scroll well still scrolls. */
:root.phone .trade-drawer{zoom:1.3;}
/* Inputs at 13px x 1.3 = ~17px: above the 16px at which iOS zooms the page
   on focus. */
:root.phone .trade-overlay input{font-size:13px;}
:root.phone .ksd-panel{zoom:1.2;}
/* The dock's drawer is --ksd-w wide, and zoom MULTIPLIES vw: at 100vw x 1.2
   it ran 20% off the right edge. A percentage is not multiplied. */
:root.phone .ksd-panel .ksd-drawer{width:100%;}

/* ═══ THE SHARED TABLE ON A PHONE (66-table.css, .mpt-*) ══════════════════
   One pass here fixes every page built on MPTable: Movers, Scanner,
   Earnings, Economic calendar, Analyst targets, Alternative data,
   Competitions, Alerts, Time and sales, the Portfolio blotter.

   The phone pattern for dense market tables: keep the table a table (rows
   stay comparable down a column), let it scroll sideways at the width its
   cells need, and pin the first column (the symbol) so a row never loses
   its name. Desktop sizes the columns to the page (table-layout:fixed,
   width 100%), which on a phone squeezed every cell to an ellipsis.
   Touch sizes: 40px rows, 36px controls, 14px text. */
:root.phone .mpt:not(.mpt-pane){
  --mpt-head:52px;
  --mpt-title:17px;
  --mpt-fs:14px;
  --mpt-ctl:36px;
  --mpt-row:40px;
  --mpt-colhead:32px;
  --mpt-padx:12px;
  --mpt-cellx:10px;
  --mpt-gap:6px;
}
/* The one bar: a single row that scrolls sideways instead of squeezing.
   Its popovers become bottom sheets (below), so the scroller cannot clip
   them. */
:root.phone .mpt:not(.mpt-pane) .mpt-bar{
  overflow-x:auto;overflow-y:hidden;
  scrollbar-width:none;
  -webkit-overflow-scrolling:touch;
}
:root.phone .mpt:not(.mpt-pane) .mpt-bar::-webkit-scrollbar{display:none;}
:root.phone .mpt:not(.mpt-pane) .mpt-sp{flex:0 0 4px;}
:root.phone .mpt:not(.mpt-pane) .mpt-search{width:150px;min-width:120px;}
:root.phone .mpt:not(.mpt-pane) .mpt-q{font-size:16px;}   /* no iOS focus zoom */
:root.phone .mpt:not(.mpt-pane) .mpt-dd-v{max-width:9rem;}
/* The table: natural column widths, sideways scroll, sticky first column. */
:root.phone .mpt:not(.mpt-pane) .mpt-t{
  width:auto;min-width:100%;
  table-layout:auto;
}
/* Company names may wrap (to two lines at most in practice): with an auto
   table that fits what it can, the long names give way first, so the figures
   sit beside the ticker instead of a full name's width to its right. Every
   other cell stays on one line, so the table still scrolls sideways when its
   numbers alone are wider than the phone. */
:root.phone .mpt:not(.mpt-pane) .mpt-t td.mpt-nm{
  white-space:normal;min-width:120px;
  line-height:1.25;padding-top:4px;padding-bottom:4px;
}
:root.phone .mpt:not(.mpt-pane) .mpt-t th,
:root.phone .mpt:not(.mpt-pane) .mpt-t td{max-width:220px;}
:root.phone .mpt:not(.mpt-pane) .mpt-t th:first-child,
:root.phone .mpt:not(.mpt-pane) .mpt-t td:first-child{
  position:sticky;left:0;z-index:1;
  background-color:var(--mpt-bg);
  box-shadow:inset -1px 0 0 var(--border-subtle);
}
:root.phone .mpt:not(.mpt-pane) .mpt-t thead th:first-child{z-index:3;}
/* Stripes and states are td backgrounds; the pinned cell repaints them over
   an opaque base so scrolled cells never show through it. */
:root.phone .mpt:not(.mpt-pane) .mpt-t:where(:not(.mpt-grouped)) > tbody > tr.mpt-r:where(:nth-child(even)) > td:first-child,
:root.phone .mpt:not(.mpt-pane) .mpt-t:where(.mpt-grouped) > tbody > tr.mpt-r:where(.mpt-z) > td:first-child{
  background-image:linear-gradient(var(--bg-stripe), var(--bg-stripe));
}
@media (hover:hover){
  :root.phone .mpt:not(.mpt-pane) .mpt-t > tbody > tr.mpt-r:hover > td:first-child{
    background-image:linear-gradient(var(--bg-row-hover), var(--bg-row-hover));
  }
}
:root.phone .mpt:not(.mpt-pane) .mpt-t > tbody > tr.mpt-r.mpt-sel > td:first-child,
:root.phone .mpt:not(.mpt-pane) .mpt-t > tbody > tr.mpt-r.is-sel > td:first-child,
:root.phone .mpt:not(.mpt-pane) .mpt-t > tbody > tr.mpt-r[aria-selected="true"] > td:first-child{
  background-image:linear-gradient(var(--bg-row-sel), var(--bg-row-sel));
}
/* Group rows span the table; pin their label too. */
:root.phone .mpt:not(.mpt-pane) .mpt-t > tbody > tr.mpt-g > td{left:0;}
/* QA 2026-11-13: the pinned first cell's opaque base (above) painted the
   group label's cell in the page colour while the rest of the group row kept
   its tertiary band ("Your competitions" sat on a two tone strip). The
   Portfolio's pinned Total row (68-blotter.css tfoot) had the same split. */
:root.phone .mpt:not(.mpt-pane) .mpt-t > tbody > tr.mpt-g > td:first-child,
:root.phone .mpt:not(.mpt-pane) .mpt-t > tfoot > tr > td:first-child{background-color:var(--bg-tertiary);}
/* No hover on touch: a tapped row would keep the hover tint. */
@media (hover:none){
  :root.phone .mpt-t > tbody > tr.mpt-r:hover > td{background:inherit;}
}
/* The chat launcher room under the last row (66-table.css) is the tab
   bar's on a phone; the launcher is never drawn (44-research-chat.css). */
:root.phone .mpt:not(.mpt-pane) .mpt-scroll::after{height:16px;}

/* Popovers (dropdowns, Columns, the Filters sheet) as bottom sheets. A
   position:fixed popover resolves against the VIEWPORT (container-type gives
   .mpt / .main no containing block for it), so the scrolling bar above
   cannot clip it; and since .main is its own stacking context, nothing in it
   can paint over the tab bar, so the sheet ends just above it. */
:root.phone .mpt:not(.mpt-pane) .mpt-pop{
  position:fixed;top:auto;left:0;right:0;bottom:var(--pnav-total);
  z-index:46;
  min-width:0;max-height:70%;
  padding:8px;
  border-radius:14px 14px 0 0;
  box-shadow:0 -1px 0 var(--border-default), var(--shadow-sheet-up);
}
:root.phone .mpt:not(.mpt-pane) .mpt-pop-opt{min-height:44px;font-size:15px;}
:root.phone .mpt:not(.mpt-pane) .mpt-pop-opt input{width:18px;height:18px;}

/* The side panel (row details, the Alerts rule editor) as a bottom sheet
   over the table, with the close control phone.js adds (.pts-x). */
:root.phone .mpt:not(.mpt-pane) .mpt-side{
  position:fixed;left:0;right:0;bottom:var(--pnav-total);top:auto;
  z-index:45;
  width:auto;max-height:82%;
  border-radius:14px 14px 0 0;
  box-shadow:0 -1px 0 var(--border-default), var(--shadow-sheet-up);
  overscroll-behavior:contain;
}
.pts-x{display:none;}
/* Room for the close button, only where phone.js added one. */
:root.phone .mpt:not(.mpt-pane) .mpt-side:has(> .pts-x){padding-top:44px;}
:root.phone .mpt-side > .pts-x{
  /* Sticky, so it stays reachable while the sheet scrolls; pulled up into
     the sheet's 44px top padding and pushed to the right edge (works in
     both the block and the flex column side panels). */
  display:flex;align-items:center;justify-content:center;
  position:sticky;top:4px;z-index:2;
  align-self:flex-end;flex:none;
  width:var(--tap);height:var(--tap);
  margin:-40px -6px 0 auto;
  border:0;border-radius:10px;
  background:var(--bg-secondary);color:var(--text-secondary);
  -webkit-tap-highlight-color:transparent;
}

/* ── "Best on a larger screen" (phone.js section 7) ────────────────────────
   Covers the page area only: the tab bar stays, so the user can leave by
   any tab as well as by Back. Same words and shape as the standalone
   consoles' templates/_desktop_only.html. */
.pdo{display:none;}
:root.phone .pdo:not([hidden]){
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;
  position:absolute;inset:0;z-index:52;
  padding:24px 28px;
  background:var(--bg-primary);color:var(--text-primary);
  text-align:center;
}
.pdo-ico{width:40px;height:40px;color:var(--text-muted);}
.pdo-t{margin:4px 0 0;font:600 19px/1.3 var(--font-sans);}
.pdo-p{margin:0;max-width:22rem;font-size:15px;line-height:1.45;color:var(--text-secondary);}
.pdo-row{display:flex;gap:10px;margin-top:8px;}
.pdo-btn{
  min-height:var(--tap);padding:0 18px;border:0;border-radius:10px;
  font:600 15px/1 var(--font-sans);cursor:pointer;
  -webkit-tap-highlight-color:transparent;
}
.pdo-back{background:var(--accent);color:var(--on-accent);}
.pdo-go{background:var(--bg-secondary);color:var(--text-primary);}

/* ── The chart's action menu as a bottom sheet ─────────────────────────────
   chart/context-menu.js opens it at the pointer (inline left/top); on a
   phone it is raised by a long press (phone.js section 8) and reads as an
   action sheet along the bottom edge instead, with 46px rows. */
:root.phone .ctx-menu{
  left:0 !important;right:0;top:auto !important;bottom:0;
  min-width:0;max-height:75dvh;overflow:auto;
  padding:8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  border-radius:14px 14px 0 0;
  box-shadow:0 -1px 0 var(--border-default), var(--shadow-sheet-up);
  transform:translateY(8px);
}
:root.phone .ctx-menu.open{transform:translateY(0);}
:root.phone .ctx-item{min-height:46px;padding:0 14px;font-size:15px;}
/* No iOS callout or text selection under a long press on the chart. */
:root.phone #cp-price,
:root.phone #charts{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;}

/* ── Drawing tools: the rail as an overlay, toggled from the More panel ── */
.pcl-draw{display:none;}
:root.phone .top-cluster.pcl-open .pcl-draw{
  display:inline-flex;align-items:center;gap:6px;
  height:36px;padding:0 12px;margin-right:4px;
  border:0;border-radius:8px;
  background:var(--bg-secondary);color:var(--text-primary);
  font:500 14px/1 var(--font-sans);
}
:root.phone .pcl-draw[aria-pressed="true"]{background:color-mix(in srgb, var(--accent) 16%, transparent);color:var(--accent);}
:root.phone.pdraw body:not(.no-charts):not(.chart-zen) #chart-rail{
  display:flex !important;
  /* Under the header and the view strip, over the Buy / Sell bar. */
  top:calc(var(--header-h) + 41px);bottom:61px;
  width:48px;
  overflow-y:auto;overscroll-behavior:contain;
  box-shadow:inset -1px 0 0 var(--border-default), var(--shadow-drop);
}
:root.phone.pdraw #chart-rail .draw-tool{width:44px;height:42px;padding-right:0;}
/* The rail scrolls, so a flyout absolutely placed beside it was clipped by
   the 48 px column and only the nine default tools could be reached. Fixed
   to the window instead; drawing.js placeFlyout puts it beside its group. */
:root.phone.pdraw #chart-rail .draw-flyout{
  position:fixed;
  max-height:calc(100dvh - 16px);overflow-y:auto;overscroll-behavior:contain;
}
:root.phone.pdraw #chart-rail .draw-fly-item{height:40px;}
/* A wider chevron lane: 11 px was too narrow a target for a thumb. */
:root.phone.pdraw #chart-rail .draw-caret{width:16px;}
/* The rail sits over the chart's left edge: the title and readout start
   to its right instead of under it. */
:root.phone.pdraw body:not(.no-charts):not(.chart-zen) #chart-legend{
  left:calc(48px + 0.75rem + var(--cp-left-inset, 0px));
}

/* ── Settings (13-widgets.css) ─────────────────────────────────────────────
   The page is a 54rem column with 2.5rem gutters; on a phone that left a
   280px panel. Gutters drop to the phone's 12px, the labels grow to read,
   and the scope tag under each label may wrap (it is nowrap on desktop,
   which ran it under the two way switch at 360px). */
:root.phone #settings-view .pf-wrap{max-width:none;padding:12px 12px 32px;}
:root.phone .stg-row{column-gap:12px;padding:12px 0;}
:root.phone .stg-k{font-size:15px;}
:root.phone .stg-q{white-space:normal;font-size:12px;}
:root.phone .stg-2way-face{height:36px;}

/* ── Add symbol search (#search-overlay, app.js positionPop) ───────────────
   Desktop anchors the popover beside the Watchlist's "Add symbol" row. On a
   phone that row is usually in the lower half of the sheet, exactly where the
   keyboard rises the moment the field takes focus, so the results were typed
   blind under it. It is pinned to the top of the screen across its width
   instead (inline left / top from positionPop, hence !important), and its
   field reads at 16px, under which iOS zooms the page on focus. */
:root.phone #search-overlay{
  left:8px !important;right:8px;top:8px !important;
  width:auto;max-height:min(60dvh, 30rem);
}
:root.phone #search-overlay .search-head{min-height:48px;}
:root.phone #search-input{font-size:16px;}
:root.phone #search-overlay .search-close{width:var(--tap);height:var(--tap);}

/* ── Chat file cards (.rcb-doc, 75-chat-blocks.css, 2026-10-16) ─────────────
   Full width, buttons on their own row at the tap size, the two splitting
   the row so neither is a sliver. */
:root.phone .rcb-doc{max-width:none;grid-template-columns:auto minmax(0, 1fr);}
:root.phone .rcb-doc-acts{grid-column:1 / -1;justify-content:stretch;}
:root.phone .rcb-doc-acts > .rcb-doc-btn{flex:1 1 0;min-height:var(--tap);justify-content:center;}
