/* Portfolio (portfolio.js). The frame is account-pages.css. The balance is the one hero number, the other three totals
   are cards under it; P&L green/red; nothing animates. */
/* the totals: the balance as the hero, plain on the ground; the three others as cards */
/* desktop: the account value as the hero on the left, Settled and Open P&L beside it; then open positions beside the
   chart, recent results beside the stats (the page uses its width, as Markets and Agents do) */
.pfsum { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); align-items: end; }
.pfsum .pfhero { background: none; border: 0; border-radius: 0; padding: 0 0 4px; gap: 6px; }
/* two columns, each its own stack (no row lines across them, so a short card never leaves a hole): open positions
   and stats on the left, the chart and recent results on the right; one column under 1100px, positions first */
.pfgrid { display: grid; gap: 12px; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
.pfcol { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.pfgrid .apanel:has(> div > .empty:only-child) { padding-bottom: 16px; }
.pfgrid .apanel:has(> div > .empty:only-child) > h2 { margin-bottom: 6px; }
@media (max-width: 1100px) { .pfgrid { grid-template-columns: minmax(0, 1fr); } }
/* Stats: one compact block of label-over-value cells (never seven 45px rows down the page) */
.pfgrid .pfstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 14px 16px; }
.pfgrid .pfst { flex-direction: column; justify-content: flex-start; gap: 2px; padding: 0; border-bottom: 0; }
.pfgrid .pfst:first-child { padding-top: 0; } .pfgrid .pfst:last-child { padding-bottom: 0; }
.pfgrid .pfst dt { font-size: var(--ob-t-small); }
.pfgrid .pfst dd { font-size: 16px; }
.pfrecent { display: flex; flex-direction: column; }
.pfrc { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--ob-line-lo); }
.pfrc-l { display: flex; flex-direction: column; min-width: 0; }
.pfrc-t { font-size: 14px; color: var(--ob-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pfrc-s { font-size: var(--ob-t-small); color: var(--ob-label); }
.pfrc-v { font-weight: 600; font-size: 14px; white-space: nowrap; }
.pfrc-more { margin-top: 10px; font-size: var(--ob-t-small); }
.pfsum .pfhero .lbl { font-size: 15px; color: var(--ob-label); }
.pfsum .pfhero .v { font-size: var(--ob-t-hero); font-weight: 600; line-height: 1.05; letter-spacing: -0.025em; }
.pfsum .pfhero .sub { font-size: 15px; }
.pfsum .tile:not(.pfhero) .v { font-size: 24px; }

.pfchart { min-height: 200px; }
.pfchart:has(> .empty) { min-height: 0; }
.pfsvg { display: block; width: 100%; height: auto; }
.pfsvg .grid { stroke: var(--ob-line-lo); stroke-width: 1; }
.pfsvg .zero { stroke: rgba(255, 255, 255, 0.16); stroke-width: 1; } /* solid quiet grey: no dashed or dotted lines (founder, 18 Nov) */
.pfsvg .tick { fill: var(--ob-label); font: 400 12px var(--ob-sans); font-variant-numeric: tabular-nums; }
.pfsvg .axt { fill: var(--ob-label); font: 400 12px var(--ob-sans); }
.pfsvg .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.pfsvg .ln.up, .pfsvg .end.up { stroke: var(--ob-up); }
.pfsvg .ln.down, .pfsvg .end.down { stroke: var(--ob-down); }
.pfsvg .ln.flat, .pfsvg .end.flat { stroke: var(--ob-ink-2); }
.pfsvg .end { fill: var(--ob-surface); stroke-width: 2; }
.pfsvg .endv { font: 600 13px var(--ob-sans); font-variant-numeric: tabular-nums; }
.pfsvg .endv.up { fill: var(--ob-up); } .pfsvg .endv.down { fill: var(--ob-down); } .pfsvg .endv.flat { fill: var(--ob-ink-2); }
.pfstats { margin: 0; display: flex; flex-direction: column; }
.pfst { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--ob-line-lo); font-size: 14px; }
.pfst:first-child { padding-top: 2px; }
.pfst:last-child { border-bottom: 0; padding-bottom: 2px; }
.pfst dt { color: var(--ob-label); }
.pfst dd { margin: 0; color: var(--ob-ink); font-weight: 600; font-variant-numeric: lining-nums tabular-nums; }
.pfst dd.up { color: var(--ob-up); } .pfst dd.down { color: var(--ob-down); }
#pfAv:empty { display: none; }
/* Settings > Show settled losses off: "2 losses hidden" under Stats */
.lhid { margin: 10px 0 0; font-size: var(--ob-t-small); color: var(--ob-label); }
.lhid[hidden] { display: none; }
.lhid a { color: var(--ob-ink-2); }
@media (hover: hover) { .lhid a:hover { color: var(--ob-ink); } }
/* Sell now on an open position (sellback.js): a small secondary pill; armed = one more tap sells, so it turns white.
   Never animated */
.atable td.sl { white-space: nowrap; }
.abtn.pfsell { height: 32px; padding: 0 14px; font-size: 13px; font-variant-numeric: tabular-nums; }
.abtn.pfsell.armed { background: var(--ob-brand); color: var(--ob-on-brand); }
@media (hover: hover) { .abtn.pfsell.armed:hover:not(:disabled) { background: var(--ob-brand); color: var(--ob-on-brand); } }
.abtn.pfsell:disabled { color: var(--ob-mute); cursor: default; }
#pfSellMsg { margin-top: 8px; }
#pfSellMsg:empty { display: none; }
/* the confirm sheet (trade-guard.js) when Settings asks before every trade, as on the Trade page */
.tgc-back { position: fixed; inset: 0; z-index: 90; background: transparent; }
.tgc-back.tgc-phone { background: rgba(0, 0, 0, 0.6); }
.tgc-back[hidden], .tgc[hidden] { display: none; }
.tgc { position: fixed; z-index: 91; width: min(360px, calc(100vw - 24px)); padding: 18px 20px; background: var(--ob-popover); border-radius: 20px; box-shadow: var(--ob-shadow-pop); font-size: 14px; color: var(--ob-ink-2); }
.tgc-t { margin: 0; font-size: 17px; font-weight: 600; color: var(--ob-ink); }
.tgc-w { margin: 6px 0 0; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.tgc-rows { margin: 12px 0 0; padding: 0; }
.tgc-r { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--ob-line-lo); }
.tgc-r:last-child { border-bottom: 0; }
.tgc-r dt { color: var(--ob-label); flex: 0 0 auto; }
.tgc-r dd { margin: 0; color: var(--ob-ink); text-align: right; min-width: 0; overflow-wrap: anywhere; font-variant-numeric: lining-nums tabular-nums; }
.tgc-n { margin: 8px 0 0; font-size: var(--ob-t-small); color: var(--ob-label); }
.tgc-b { display: flex; gap: 8px; margin-top: 14px; }
.tgc-b button { flex: 1 1 0; height: 44px; border: 0; border-radius: var(--ob-pill); font: 600 14px/1 var(--ob-sans); cursor: pointer; }
.tgc-b .secondary { flex: 0 0 110px; background: var(--ob-muted); color: var(--ob-ink); }
@media (hover: hover) { .tgc-b .secondary:hover { background: var(--ob-raise); } }
.tgc-b .primary { background: var(--ob-brand); color: var(--ob-on-brand); }
@media (hover: hover) { .tgc-b .primary:hover { background: var(--ob-brand-2); } }
.tgc.tgc-phone { left: 0; right: 0; bottom: 0; top: auto; width: auto; border-radius: 20px 20px 0 0; padding: 20px 16px calc(16px + env(safe-area-inset-bottom)); font-size: 15px; }
.tgc.tgc-phone .tgc-b button { height: 52px; }
/* a phone: each open position is a short block, Sell now on screen without scrolling the table sideways
     Trade                       P&L
     Paid $1.00  Worth $0.92     14m 38s
     [ Sell $0.92 ]                         */
@media (max-width: 600px) {
  .pfsum { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pfsum .pfhero { grid-column: 1 / -1; }
  /* the bottom nav already has Trade, and History is one tap from the account menu: no header pills on a phone */
  #pf .ahead .acts { display: none; }
  .pfsum .pfhero { padding-bottom: 8px; }
  .pfsum .pfhero .lbl, .pfsum .pfhero .sub { font-size: 14px; }
  .pfsum .tile:not(.pfhero) .v { font-size: 20px; }
  #pfOpen .atable thead { display: none; }
  #pfOpen .atable, #pfOpen .atable tbody { display: block; }
  #pfOpen .atable tr { display: grid; grid-template-columns: auto auto minmax(0, 1fr); grid-template-areas: "t t pl" "pd wv en" "sl sl sl"; gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--ob-line-lo); }
  #pfOpen .atable tr:last-child { border-bottom: 0; }
  #pfOpen .atable td { height: auto; padding: 0; border: 0; text-align: left; white-space: nowrap; }
  #pfOpen .atable td.t { grid-area: t; max-width: none; white-space: normal; overflow-wrap: anywhere; color: var(--ob-ink); }
  #pfOpen .atable td.pd { grid-area: pd; color: var(--ob-label); font-size: var(--ob-t-small); }
  #pfOpen .atable td.wv { grid-area: wv; color: var(--ob-label); font-size: var(--ob-t-small); }
  #pfOpen .atable td.pl { grid-area: pl; text-align: right; font-weight: 600; }
  #pfOpen .atable td.en { grid-area: en; text-align: right; color: var(--ob-label); font-size: var(--ob-t-small); }
  #pfOpen .atable td.pd::before { content: "Paid "; }
  #pfOpen .atable td.wv::before { content: "Worth now "; }
  #pfOpen .atable td.sl { grid-area: sl; margin-top: 6px; }
  #pfOpen .atable td.sl:empty { display: none; }
  #pfOpen .abtn.pfsell { width: 100%; height: 44px; font-size: 14px; }
}
/* Settled and Open P&L beside the account value as a quiet stat pair (no bordered cards): label over value, a
   hairline between them, on the page's ground */
.pfsum .tile:not(.pfhero) { background: none; border: 0; border-radius: 0; box-shadow: none; padding: 4px 24px; border-left: 1px solid var(--ob-line-lo); }
.pfsum { row-gap: 8px; column-gap: 0; margin-bottom: 8px; }
@media (max-width: 600px) {
  .pfsum { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pfsum .tile:not(.pfhero) { padding: 2px 12px; }
  .pfsum .tile:not(.pfhero):nth-child(2) { padding-left: 0; border-left: 0; }
  .pfsum .tile:not(.pfhero) .v { font-size: 20px; }
  .pfsum .tile .sub { font-size: 12px; }
}
/* no account in this browser: one panel with the way to start */
.pfnone .abtn { margin-top: 12px; align-self: flex-start; }
.pfnone[hidden], .pfsum[hidden], .pfgrid[hidden], .pfs[hidden] { display: none; }

/* under a Sell button whose price is well under Worth now: what selling now costs against holding */
#pfOpen .sgap { display: block; margin-top: 4px; font-size: 11px; line-height: 14px; color: var(--ob-mute); white-space: nowrap; }
#pfOpen .sgap[hidden] { display: none; }
/* no open position: one line and the way to trade, inside the card */
#pfOpen .pfnone0 { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
#pfOpen .pfnone0 p { margin: 0; }

/* the blotter: one full-width card, Open positions and Settled as tabs (underlined tab, never a pill), History on the
   right of the tab row; Stats and the chart in a row under it */
.pfgrid { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
.pftabs { display: flex; align-items: center; gap: 24px; margin: -4px 0 12px; border-bottom: 1px solid var(--ob-line); }
.pftabs button { appearance: none; background: none; border: 0; padding: 0 0 12px; margin-bottom: -1px; border-bottom: 2px solid transparent; font: 600 17px/1.2 var(--ob-sans); color: var(--ob-label); cursor: pointer; }
@media (hover: hover) { .pftabs button:hover { color: var(--ob-ink-2); } }
.pftabs button.on { color: var(--ob-ink); border-bottom-color: var(--ob-ink); }
.pftabs .cnt { margin-left: 8px; font-size: 14px; font-weight: 400; color: var(--ob-label); }
.pftabs .cnt:empty { display: none; }
.pftabs-more { margin-left: auto; padding-bottom: 12px; font-size: var(--ob-t-small); color: var(--ob-label); text-decoration: none; }
@media (hover: hover) { .pftabs-more:hover { color: var(--ob-ink); } }
#pfSettled .atable td.rs { color: var(--ob-ink-2); }
.pfrow2 { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.pfrow2.two { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); align-items: start; }
.pfrow2:not(:has(> section:not([hidden]))) { display: none; }
@media (max-width: 1100px) { .pfrow2.two { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) {
  .pftabs { gap: 18px; }
  .pftabs button { font-size: 15px; }
  .pftabs-more { display: none; }
  /* a phone: the trade, its P&L (green or red says how it ended) and when, no sideways scroll */
  #pfSettled .atable th.mk, #pfSettled .atable td.mk, #pfSettled .atable th.rs, #pfSettled .atable td.rs { display: none; }
  #pfSettled .atable .t { max-width: 190px; }
}
/* the account-value line is drawn at the card's own width (portfolio.js chart), never scaled up into a 480px block */
.pfsvg { max-width: 100%; }
/* a narrow phone: the countdown on its own line under Paid / Worth now ("Ends in 14 min 22 s"), never clipped */
@media (max-width: 400px) {
  #pfOpen .atable tr { grid-template-areas: "t t pl" "pd wv wv" "en en en" "sl sl sl"; }
  #pfOpen .atable td.en { text-align: left; }
  #pfOpen .atable td.en:not([data-w])::before { content: none; }
}
/* Robinhood's order: the account value, its line directly under it (scrub it), then the other figures and positions */
.pfsum { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.pfsum .pfhero { grid-column: 1 / -1; }
.pfhchart { min-height: 0; margin-top: 8px; touch-action: pan-y; }
.pfhchart[hidden] { display: none; }
.pfsvg .scrub { stroke: var(--ob-ink-2); stroke-width: 1; }
.pfsvg { cursor: crosshair; }
html.omni-hidebal:not(.omni-showbal) [data-bal-blur] { filter: blur(8px); opacity: .5; }
/* Watchlist: starred markets, a quiet list (name, the hour's line, price) */
.pfwatch { margin-top: 12px; }
.pfwh { display: flex; align-items: baseline; justify-content: space-between; }
.pfwh .hlink { font-size: 14px; color: var(--ob-label); text-decoration: none; }
.pfwr { display: grid; grid-template-columns: 28px minmax(0, 1fr) 140px 52px; align-items: center; gap: 12px; min-height: 52px; border-top: 1px solid rgba(255, 255, 255, .06); color: inherit; text-decoration: none; }
.pfwr:first-child { border-top: 0; }
@media (hover: hover) { .pfwr:hover { background: #0c0c0e; } }
.pfwn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.pfwp { text-align: right; font-weight: 600; }
.pfwsk { width: 80px; height: 24px; display: block; }
.pfwsk.up { color: var(--ob-up); } .pfwsk.down { color: var(--ob-down); }
.pfrng { display: flex; gap: 4px; margin-top: 6px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.pfrng button { height: 36px; padding: 0 12px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--ob-label); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.pfrng button.on { color: var(--ob-ink, #f4f4f5); border-bottom-color: var(--ob-ink, #f4f4f5); }
.pfhchart[hidden] + .pfrng { display: none; }
.pfsug { margin-top: 16px; text-align: left; }

.pfwr .pfwp { text-align: right; }
.pfwr .pfwt { text-align: right; }
.pfwr .pfico, .pfsch .pfico { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #2a2a30; color: #fff; font-size: 12px; font-weight: 700; }
/* the smallest phones: the watchlist row drops its "Trade" word (the whole row opens the Trade page) so nothing spills */
@media (max-width: 360px) { .pfwr { grid-template-columns: 28px minmax(0, 1fr) auto; } .pfwr .pfwt { display: none; } }

/* the trade's name over its line (labels.js plain) */
.atable td.t .tn1 { display: block; }
.atable td.t .tn2 { display: block; font-size: 12px; }

.pfsugh { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--ob-label, #8b8e95); }
/* touch: the Running / Finished tabs and the range buttons are real 44px taps (critic r4) */
@media (pointer: coarse) { .pftabs button { min-height: 44px; padding-top: 10px; } #pfRng button, .pfrng button { min-height: 44px; min-width: 44px; } .pfsell { min-height: 44px; } }
@media (pointer: coarse) { .pftabs-more { display: inline-flex; align-items: center; min-height: 44px; } }

/* final-pass r5: the two returns as one quiet row under the account value, Robinhood's way: no hairline in front of them
   (it read as a left accent stripe) and no 588px box per number; each as wide as its figure, 48px apart */
.pfsum { grid-template-columns: max-content max-content minmax(0, 1fr); column-gap: 48px; }
.pfsum .pfhero { grid-column: 1 / -1; }
.pfsum .tile:not(.pfhero), .pfsum .tile:not(.pfhero):nth-child(2) { border-left: 0; padding: 4px 0; }
@media (max-width: 600px) { .pfsum { grid-template-columns: max-content max-content minmax(0, 1fr); column-gap: 32px; } }
/* Popular markets (no open trades): a short list, never a 1,150px row between the name and Trade */
.pfsug { max-width: 560px; }

/* round 6: the last seconds, after the end and "can't sell" read as plain text, never a dead button */
.abtn.pfsell.plain, .abtn.pfsell.plain:disabled, #pfOpen .abtn.pfsell.plain { background: transparent; border-color: transparent; box-shadow: none; padding: 0; color: var(--ob-mute); font-weight: 500; cursor: default; }
@media (max-width: 900px) { .pfsell { min-height: 44px; } .pftabs button { min-height: 44px; } }
/* round 7: an empty account's markets as a full-width row of cards, each with Up and Down at the price a buyer pays
   (portfolio.js), never a 560px list beside 700px of black */
.pfsug { max-width: none; }
.pfsg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .pfsg { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .pfsg { grid-template-columns: minmax(0, 1fr); } .pfsg .pfsc:nth-child(n+3) { display: none; } } /* a phone: two cards, not a screen and a half */
.pfsc { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 14px 16px; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 14px; background: #0c0c0e; }
.pfsch { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--ob-ink, #f4f4f5); font-weight: 600; text-decoration: none; }
@media (hover: hover) { .pfsch:hover { text-decoration: none; color: #fff; } }
.pfscp { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.pfscq { font-size: 13px; }
.pfscb { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 4px; }
/* Up / Down: the one chip Home and the Markets page use (market-row.css .mrow .ud): a tint of its colour, the side left and
   its price right (critic r9: grey pills here were a fifth look) */
.pfud { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; min-height: 44px; padding: 0 12px; border-radius: 10px; font-size: 14px; font-weight: 600; text-decoration: none; font-variant-numeric: tabular-nums; transition: background-color 120ms; }
.pfud b { font-size: 12px; font-weight: 500; }
.pfud.up { background: rgba(31, 209, 112, 0.10); color: var(--ob-up, #1fd170); } .pfud.down { background: rgba(255, 77, 90, 0.10); color: var(--ob-down, #ff4d5a); }
@media (hover: hover) { .pfud.up:hover { background: rgba(31, 209, 112, 0.18); text-decoration: none; } } @media (hover: hover) { .pfud.down:hover { background: rgba(255, 77, 90, 0.18); text-decoration: none; } }

.pfsum .tile[hidden] { display: none; }

/* round 8 (critic: "I tap Sell and the whole table jumps sideways"): the Sell column keeps one width whatever the
   button says (Sell $0.98, Confirm sell $0.98, Selling…) */
@media (min-width: 901px) { .abtn.pfsell { min-width: 156px; justify-content: center; } }
/* round 9 (critic r9: the popular market's name was a 28px tap): the name row is a 44px link on touch sizes */
@media (pointer: coarse), (max-width: 900px), (max-height: 500px) { .pfsch { min-height: 44px; } }
/* round 10: "Show them in Settings" is a real 44px tap on touch sizes (critic r9: a 15px-tall link) */
@media (pointer: coarse), (max-width: 900px) { .lhid a { display: inline-flex; align-items: center; min-height: 44px; vertical-align: middle; } }
/* round 11 (critic r9: "Phone Portfolio is cards inside a card"): a phone puts the Running / Finished tabs and their rows
   flat on the page, the hairlines between rows doing the work, as the desktop's list and Robinhood's phone portfolio */
@media (max-width: 640px) {
  #pf .pfblot, #pf .pfwatch { background: transparent; border: 0; border-radius: 0; padding: 0; box-shadow: none; }
}
/* a failed read: the error line and a plain text Retry (no bordered pill, no underline) */
#pfErr .pfretry { background: none; border: 0; padding: 0 2px; min-height: 0; color: var(--ob-ink, #fff); font: inherit; font-weight: 600; cursor: pointer; }
#pfErr .pfretry:disabled { color: var(--ob-label, #8e8e93); cursor: default; }

/* hover on the secondary clickables (UX-26): a near-black raise, never a grey box */
@media (hover: hover) { .pfsch:hover { background-color: #18181b; border-radius: 10px; } }

/* final pass r9 r1 (critic: on desktop Portfolio was a phone column scaled up, 60% of the screen empty): a right rail
   beside the chart and the table, as Robinhood's account page keeps one (buying power, stats, watchlist). A phone keeps
   one column: Stats and Watchlist under the table, and no Buying power card (the hero's line under the value says it) */
.pfrail { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.pfrail:not(:has(> :not([hidden]):not(.pfrow2), > .pfrow2 > section:not([hidden]))) { display: none; }
.pfbp { display: flex; flex-direction: column; gap: 4px; }
.pfbp .lbl { font-size: var(--ob-t-small); color: var(--ob-label); }
.pfbp .v { font-size: 24px; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }
.pfbpl { margin: 10px 0 0; padding: 10px 0 0; border-top: 1px solid var(--ob-line-lo); display: grid; gap: 6px; }
.pfbpl div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.pfbpl dt { color: var(--ob-label); } .pfbpl dd { margin: 0; color: var(--ob-ink); }
.pfrail .pfwatch { margin-top: 0; }
@media (max-width: 1100px) { .pfbp { display: none !important; } }
@media (min-width: 1101px) {
  main#pf.apage { display: grid; grid-template-columns: minmax(0, 1fr) 320px; column-gap: 40px; row-gap: 0; align-items: start;
    grid-template-areas: "head head" "err err" "none none" "sum rail" "grid rail"; }
  main#pf.apage > * { margin-top: 12px; }
  main#pf.apage > .ahead { grid-area: head; margin-top: 0; }
  main#pf.apage > #pfErr { grid-area: err; }
  main#pf.apage > #pfNone { grid-area: none; }
  main#pf.apage > #pfSumS { grid-area: sum; }
  main#pf.apage > #pfGrid { grid-area: grid; }
  main#pf.apage > #pfRail { grid-area: rail; position: sticky; top: calc(var(--hdr, 64px) + 16px); }
}

/* Finished return and Running return share one top line (critic r13: they sat at different heights) */
.pfsum { align-items: start; }
.pfsum .tile:not(.pfhero) { display: flex; flex-direction: column; justify-content: flex-start; align-self: start; }

/* r15 (phone audit): a running trade is one compact row, as Robinhood's and Public's position lists, never a 210px block
   with a full-width Sell bar (four trades took two screens). The trade and its P&L on top; under it what you paid and
   what it is worth now, the time left under that; Sell on the right of those two lines, a 44px tap.
     Bitcoin Down · 1 min                      −$0.99
     below $68,733.32
     Paid $1.00  Worth now $0.01          [ Sell $0.01 ]
     0:24 left                                          */
@media (max-width: 600px) {
  #pfOpen .atable tr, #pf #pfOpen .atable tr { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "t t pl" "pd wv sl" "en en sl"; gap: 2px 12px; align-items: center; padding: 14px 0; }
  #pfOpen .atable td.wv { white-space: normal; min-width: 0; }
  #pfOpen .atable td.en { text-align: left; }
  #pfOpen .atable td.en:not([data-w])::before { content: none; }
  #pfOpen .atable td.sl { margin-top: 0; text-align: right; align-self: center; }
  #pfOpen .abtn.pfsell, #pf #pfOpen .abtn.pfsell { width: auto; min-width: 88px; height: 44px; padding: 0 14px; font-size: 14px; }
  #pfOpen .abtn.pfsell.plain { min-width: 0; height: auto; font-size: 13px; white-space: normal; text-align: right; }
  #pfOpen .sgap { max-width: 132px; margin-left: auto; white-space: normal; text-align: right; }
}
/* the tabs' History link on the tabs' own text line (r15: it sat 5px higher than Running / Finished) */
@media (pointer: coarse) { .pftabs-more { padding-top: 10px; } }
/* a narrow phone: Paid, Worth now and the time left as three short lines beside Sell, never "Worth now" broken over two */
@media (max-width: 400px) {
  #pfOpen .atable tr, #pf #pfOpen .atable tr { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "t pl" "pd sl" "wv sl" "en sl"; }
  #pfOpen .atable td.wv { white-space: nowrap; }
}
/* the narrowest phones: "All activity in History" broke over two lines beside the tabs; History is in the Account menu */
@media (max-width: 374px) { .pftabs .pftabs-more { display: none; } }
/* r27: a card is at least 240px wide (one popular market had a quarter of the row, and "Buy Down" wrapped) */
@media (min-width: 521px) { .pfsg { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); } }
.pfsc .ud, .pfsc button, .pfsc a.ud { white-space: nowrap; }
/* r27: Buy Up / Buy Down centred with "Pays $1.96" small and centred under it, the same as Home and Markets */
.pfudw { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pfud { align-items: center; }
.pfpay { text-align: center; font-size: 12px; color: var(--ob-ink-2, #a1a1aa); }
