:root { color-scheme: light dark; --bg:#f5f6f8; --card:#fff; --fg:#111; --muted:#667; --line:#e4e6ea; --off:#dcdfe4; --accent:#0a7d4f; --ok:#0a7d4f; --ok-bg:#e1f3ea; --bad:#b42318; --bad-bg:#fde8e6; --warn:#9a6700; --warn-bg:#fbf0d5; --chart:#2a78d6; --vwap:#b45309; }
@media (prefers-color-scheme: dark) {
  :root { --bg:#0b0f14; --card:#151b23; --fg:#e8eaed; --muted:#9aa4b2; --line:#252d38; --off:#3a4350; --accent:#3ccf8e; --ok:#3ccf8e; --ok-bg:#123527; --bad:#ff6b5e; --bad-bg:#3d1a17; --warn:#f2c94c; --warn-bg:#3a3115; --chart:#3987e5; --vwap:#f59e0b; }
}
body { margin:0; font:16px/1.4 -apple-system, system-ui, sans-serif; background:var(--bg); color:var(--fg); }
main { max-width:560px; margin:0 auto; padding:24px 16px; }
.card { background:var(--card); border-radius:14px; padding:16px 20px; margin-bottom:16px; }
.card.warn { border:2px solid var(--warn); }
h1 { font-size:22px; margin:0 0 8px; }
h2 { font-size:15px; text-transform:uppercase; letter-spacing:.04em; color:var(--muted); margin:0 0 10px; }
label { display:block; margin-bottom:6px; color:var(--muted); }
input, button { width:100%; box-sizing:border-box; font-size:17px; padding:12px; border-radius:10px; border:1px solid var(--muted); }
button { margin-top:12px; background:var(--accent); color:#fff; border:none; font-weight:600; }
button.secondary { background:transparent; color:var(--fg); border:1px solid var(--muted); }
button.link { width:auto; margin:0; padding:0; background:none; color:var(--accent); font:inherit; text-decoration:underline; }
a { color:var(--accent); }
code { font-size:14px; }
.muted { color:var(--muted); }
.error { color:var(--bad); min-height:1.4em; }
.notice { font-weight:600; }
.notice:empty, .small:empty, .detail:empty { display:none; }
.check { display:flex; justify-content:space-between; padding:6px 0; }
.ok { color:var(--ok); font-weight:600; }
.bad { color:var(--bad); font-weight:600; }
table { width:100%; border-collapse:collapse; font-size:14px; }
th { text-align:left; color:var(--muted); font-weight:500; padding:4px 8px 4px 0; vertical-align:top; }
td { word-break:break-all; padding:4px 0; }
/* Account page */
/* The page header: one line that stays at the top while the page scrolls under it. Full width
   over main's side padding, and opaque, so nothing shows through. It wraps only if even one
   line can't fit, as with a larger text size. */
.masthead { position:sticky; top:0; z-index:1; background:var(--bg); margin:-24px -16px 12px; padding:calc(12px + env(safe-area-inset-top)) 16px 10px; border-bottom:1px solid var(--line); }
.top { display:flex; flex-wrap:wrap; align-items:center; gap:4px 10px; }
.links { margin-left:auto; display:flex; align-items:center; gap:10px; }
a.nav { padding:6px 14px; border-radius:9px; background:var(--ok-bg); color:var(--accent); font-size:14px; font-weight:600; line-height:20px; text-decoration:none; }
/* The busy light: red while the engine asks Schwab for data; otherwise the page color, with an
   outline so it's always there and the line never shifts. */
.busy { flex:none; width:11px; height:11px; box-sizing:border-box; border-radius:50%; border:1.5px solid var(--fg); background:var(--bg); }
.busy.on { background:#ff3b30; }
/* The countdown, left of the button: to the close in red while the market is open, to the
   next open in green while it's closed. One unit (3h, 45m, 30s), so it stays short. */
.market { font-size:14px; font-weight:600; color:var(--ok); font-variant-numeric:tabular-nums; white-space:nowrap; }
.market.open { color:var(--bad); }
.market:empty { display:none; }
.uptime { font-size:14px; color:var(--muted); font-variant-numeric:tabular-nums; white-space:nowrap; }
.uptime.live { color:var(--ok); }
.battery { font-size:14px; color:var(--warn); font-variant-numeric:tabular-nums; white-space:nowrap; }
.battery:empty { display:none; }
/* The green dot and how long the Schwab login has left. */
.status { font-size:14px; color:var(--muted); white-space:nowrap; }
.status:empty { display:none; }
.card > p:first-child { margin-top:0; }
.label { font-size:14px; color:var(--muted); margin:0; }
.big { font-size:32px; font-weight:600; margin:2px 0 12px; }
.pair { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.tile { background:var(--bg); border-radius:10px; padding:10px 12px; }
.tile p { margin:0; }
.value { font-size:19px; font-weight:600; }
.small { font-size:14px; color:var(--muted); margin:12px 0 0; }
.rows { list-style:none; margin:0; padding:0; }
.row { display:flex; justify-content:space-between; align-items:baseline; gap:12px; padding:9px 0; border-top:1px solid var(--line); }
.row:first-child { border-top:none; padding-top:0; }
.title { display:block; font-weight:600; }
.sub { display:block; font-size:14px; color:var(--muted); }
.end { text-align:right; white-space:nowrap; }
.reason { white-space:normal; max-width:8em; margin-left:auto; }
.tag { display:inline-block; font-size:13px; font-weight:600; padding:2px 10px; border-radius:999px; }
.tag.live { background:var(--ok-bg); color:var(--ok); }
.tag.waiting { background:var(--warn-bg); color:var(--warn); }
.empty { color:var(--muted); margin:0; }
.more { font-size:14px; color:var(--muted); margin:10px 0 0; }
.up { color:var(--ok); }
.down { color:var(--bad); }
/* The holdings: the stock with your shares and average price on the left, its value on the
   right, and between them, at the same place on every line, Buy over Sell (trade.js). */
.row.holding { display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); align-items:center; }
.holding .end { white-space:normal; }
.trade { display:flex; flex-direction:column; gap:6px; width:64px; }
.trade button { width:100%; margin:0; padding:4px 0; border-radius:9px; background:transparent; font-size:15px; font-weight:600; line-height:20px; -webkit-tap-highlight-color:transparent; }
.trade .buy { border:2px solid var(--ok); color:var(--ok); }
.trade .sell { border:2px solid var(--bad); color:var(--bad); }
.trade button:active { opacity:.55; }
h2 .mode { margin-left:8px; padding:1px 8px; border-radius:999px; background:var(--warn-bg); color:var(--warn); font-size:12px; letter-spacing:0; text-transform:none; vertical-align:1px; }
h2 .mode.live { background:var(--bad-bg); color:var(--bad); }
/* The order popup (trade.js). In the upper middle, so the keyboard never covers it. */
.ticket { width:min(380px, calc(100vw - 32px)); max-height:calc(100dvh - 32px); box-sizing:border-box; margin:max(12vh, calc(env(safe-area-inset-top) + 16px)) auto auto; padding:0; border:none; border-radius:16px; background:var(--card); color:var(--fg); box-shadow:0 12px 40px rgba(0,0,0,.35); }
.ticket::backdrop { background:rgba(0,0,0,.45); }
.ticket form { padding:20px; }
.ticket h2 { font-size:21px; letter-spacing:0; text-transform:none; color:var(--fg); margin:0 0 4px; }
.ticket.buy h2 { color:var(--ok); }
.ticket.sell h2 { color:var(--bad); }
.t-facts { font-size:14px; color:var(--muted); margin:0 0 14px; min-height:1.4em; }
.t-amount { display:flex; align-items:center; gap:8px; }
.t-amount span { font-size:22px; font-weight:600; }
.t-amount input { font-size:22px; font-weight:600; font-variant-numeric:tabular-nums; }
.t-shares { font-size:15px; font-weight:600; margin:10px 0 0; min-height:1.4em; }
.t-terms { font-size:13px; color:var(--muted); margin:2px 0 0; }
.t-mode { font-size:13px; font-weight:600; margin:12px 0 0; padding:8px 10px; border-radius:8px; }
.t-mode.dry { background:var(--warn-bg); color:var(--warn); }
.t-mode.live { background:var(--bad-bg); color:var(--bad); }
.ticket .error { margin:8px 0 0; font-size:14px; }
.t-buttons { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.ticket.sell #ticket-submit { background:var(--bad); }
#ticket-submit:disabled { opacity:.45; }
/* What came of an order, once the popup closes. A tap hides it. */
.toast { position:fixed; z-index:3; left:16px; right:16px; bottom:calc(16px + env(safe-area-inset-bottom)); max-width:528px; margin:0 auto; padding:12px 16px; border-radius:12px; font-size:15px; font-weight:600; box-shadow:0 8px 30px rgba(0,0,0,.3); }
.toast[hidden] { display:none; }
.toast.sent { background:var(--ok-bg); color:var(--ok); }
.toast.dry { background:var(--warn-bg); color:var(--warn); }
.toast.bad { background:var(--bad-bg); color:var(--bad); }
.footer { text-align:center; color:var(--muted); font-size:14px; padding:8px 0 24px; }
/* The account page's footer: the links on the left, the Live switch (live.js) bottom right. On,
   it's red: the Buy and Sell buttons send real orders. */
.footer.with-switch { display:flex; justify-content:space-between; align-items:center; gap:12px; text-align:left; }
.live-switch { position:relative; display:flex; align-items:center; gap:8px; font-size:15px; font-weight:600; color:var(--muted); cursor:pointer; -webkit-tap-highlight-color:transparent; }
.live-switch input { position:absolute; width:1px; height:1px; margin:0; padding:0; opacity:0; }
.live-switch input:checked + .switch { background:var(--bad); }
.live-switch input:checked + .switch::after { transform:translateX(16px); }
.live-switch:has(input:checked) { color:var(--bad); }
.live-switch input:focus-visible + .switch { outline:2px solid var(--accent); outline-offset:2px; }
.live-switch input:disabled + .switch { opacity:.6; }
.footer form { display:inline; }
/* Stocks page. Each stock's line: symbol and name, your average price and shares, the price,
   the weight, then the × (edit mode) or the card's arrow (view mode). */
.stock { display:block; }
.stock .line { display:grid; grid-template-columns:minmax(0,1fr) 86px 76px 34px 12px; align-items:center; gap:6px; }
.stock .who { min-width:0; }
.stock .price .title { font-size:15px; }
.avg { min-width:0; white-space:nowrap; }
.avg > span { overflow:hidden; text-overflow:ellipsis; }
.avg .title { font-size:14px; }
.avg .what { color:var(--muted); font-size:12px; font-weight:400; }
.weight-cell { text-align:right; }
.weight-text { color:var(--muted); }
.stock .end { display:flex; align-items:center; justify-content:flex-end; }
.arrow { display:inline-block; width:7px; height:7px; margin:0 2px 4px 0; border-right:2px solid var(--muted); border-bottom:2px solid var(--muted); transform:rotate(45deg); }
.stock.open .arrow { margin:4px 2px 0 0; transform:rotate(-135deg); }
a.button { display:block; box-sizing:border-box; margin-top:12px; padding:12px; border-radius:10px; background:var(--accent); color:#fff; font-size:17px; font-weight:600; text-align:center; text-decoration:none; }
/* View mode shows the weights as text; edit mode as fields, with the × and Save weights, and
   without the average (the fields need its room on a phone). */
#weights:not(.editing) .weight, #weights:not(.editing) .remove, #weights:not(.editing) > button[type="submit"] { display:none; }
#weights.editing .avg, #weights.editing .weight-text, #weights.editing .arrow, #weights.editing .edit { display:none; }
#weights.editing .stock .line { grid-template-columns:minmax(0,1fr) 76px auto auto; }
/* Adding stocks is part of edit mode. With no stocks yet there's no list to edit, so Add
   stocks shows then. */
main:has(#weights:not(.editing)) #add-stocks { display:none; }
.stock .who .sub { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.stock .price { text-align:right; white-space:nowrap; }
.weight { display:flex; align-items:center; gap:3px; margin:0; color:var(--muted); }
.weight input { width:3.2em; padding:6px 8px; text-align:right; }
button.remove { width:auto; margin:0; padding:4px 2px 4px 6px; background:none; color:var(--muted); font-size:22px; font-weight:400; line-height:1; }
.total { display:flex; justify-content:space-between; margin:10px 0 0; padding-top:10px; border-top:1px solid var(--line); }
.total.over { color:var(--bad); font-weight:600; }
.prices { text-align:center; margin:0 0 4px; }
/* The notifications switch (push.js), at the end of the positions note's line; shown by the
   script once it knows whether this device can get notifications. */
.note-line { display:flex; align-items:flex-start; gap:10px; margin-top:12px; }
.note-line .small { margin:0; flex:1; min-width:0; }
.push { position:relative; display:flex; align-items:center; gap:6px; margin:-2px 0 0 auto; font-size:15px; cursor:pointer; -webkit-tap-highlight-color:transparent; }
.push[hidden] { display:none; }
.push input { position:absolute; width:1px; height:1px; margin:0; padding:0; opacity:0; }
.switch { flex:none; position:relative; width:40px; height:24px; border-radius:12px; background:var(--off); transition:background .2s; }
.switch::after { content:""; position:absolute; top:2px; left:2px; width:20px; height:20px; border-radius:50%; background:#fff; box-shadow:0 1px 2px rgba(0,0,0,.35); transition:transform .2s; }
.push input:checked + .switch { background:var(--ok); }
.push input:checked + .switch::after { transform:translateX(16px); }
.push input:focus-visible + .switch { outline:2px solid var(--accent); outline-offset:2px; }
.push input:disabled + .switch { opacity:.6; }
/* A stock's card, under its line in view mode: data only, so color means up or down and
   nothing else. The meters and the chart are SVG; their colors are set here. */
.stock .line[role="button"] { cursor:pointer; -webkit-tap-highlight-color:transparent; }
.card-slot { margin:2px 0 10px; }
.c-card { background:var(--bg); border-radius:12px; padding:12px 14px; font-variant-numeric:tabular-nums; }
.c-card p { margin:0; }
.c-card h3 { font-size:14px; font-weight:500; color:var(--muted); margin:16px 0 6px; }
.c-hold { font-size:14px; color:var(--muted); }
.c-hold strong { color:var(--fg); }
.c-hold strong.up { color:var(--ok); }
.c-hold strong.down { color:var(--bad); }
/* Your open orders in the stock and its last trades, under the holding. */
.c-yours { font-size:14px; color:var(--muted); margin-top:6px; }
.c-yours p + p { margin-top:2px; }
.c-yours strong { color:var(--fg); font-weight:500; }
.c-tiles { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:6px; margin-top:10px; text-align:center; }
.c-tiles .tile { background:var(--card); padding:6px 4px; }
.c-tiles .label { font-size:13px; }
.c-tiles .value { font-size:16px; }
.c-meter { margin-top:10px; }
.c-head, .c-fact, .c-facts li { display:flex; justify-content:space-between; align-items:baseline; gap:8px; font-size:14px; }
.c-head span, .c-fact span, .c-facts li span { color:var(--muted); }
.c-fact { margin-top:12px !important; padding-top:8px; border-top:1px solid var(--line); }
.c-fact strong { text-align:right; }
.c-fact small { display:block; color:var(--muted); font-size:13px; font-weight:400; }
.meter { display:block; width:100%; height:auto; margin:5px 0 3px; overflow:visible; }
.meter .track { fill:var(--line); }
.meter .dot { fill:var(--fg); stroke:var(--bg); stroke-width:2; }
.meter .tick { stroke:var(--muted); stroke-width:1; }
.meter text { fill:var(--muted); font-size:13px; }
.c-ends { display:flex; justify-content:space-between; font-size:12px; color:var(--muted); }
.c-ladder { list-style:none; margin:0; padding:0 0 0 18px; position:relative; }
.c-ladder::before { content:""; position:absolute; left:5px; top:12px; bottom:12px; width:2px; background:var(--line); }
.c-ladder li { display:flex; align-items:center; gap:8px; padding:3px 6px; font-size:14px; position:relative; }
.c-ladder li::before { content:""; position:absolute; left:-17px; width:8px; height:8px; border-radius:50%; background:var(--muted); border:2px solid var(--bg); }
.c-ladder li.last { background:var(--card); border-radius:8px; }
.c-ladder li.last::before { background:var(--fg); }
.c-price { min-width:76px; font-weight:600; }
.c-label { flex:1; min-width:0; color:var(--muted); }
.c-ladder li.last .c-label { color:var(--fg); font-weight:600; }
.c-away { color:var(--muted); white-space:nowrap; }
.c-facts { list-style:none; margin:12px 0 0; padding:0; }
.c-facts li { padding:6px 0; border-top:1px solid var(--line); }
.c-facts strong { white-space:nowrap; }
.c-readout { font-size:13px; color:var(--muted); min-height:1.4em; }
.chart { display:block; width:100%; height:auto; margin-top:4px; touch-action:pan-y; -webkit-user-select:none; user-select:none; }
.chart text { fill:var(--muted); font-size:12px; }
.chart .axis { stroke:var(--line); }
.chart .price-line, .chart .rsi-line { fill:none; stroke:var(--chart); stroke-width:2; stroke-linejoin:round; stroke-linecap:round; }
.chart .vwap-line { fill:none; stroke:var(--vwap); stroke-width:1.5; stroke-linejoin:round; stroke-linecap:round; }
.chart .vwap-key { fill:var(--vwap); }
.chart .volume { fill:var(--muted); opacity:.55; }
.chart .guide { stroke:var(--muted); stroke-dasharray:3 3; opacity:.6; }
.chart .day { stroke:var(--muted); stroke-dasharray:2 3; }
.chart .cross { stroke:var(--muted); visibility:hidden; }
.chart .cross-dot { fill:var(--chart); stroke:var(--bg); stroke-width:2; visibility:hidden; }
.chart.reading .cross, .chart.reading .cross-dot { visibility:visible; }
.chart .hit { fill:transparent; }
.c-asof { font-size:12px; color:var(--muted); text-align:center; margin-top:10px !important; }
.c-note { color:var(--muted); font-size:14px; margin:6px 0 10px; }
