/* Mirror components. Class -> future React component map lives in components.html.
   Depends on styles/tokens.css. Screen-specific layout stays in each screen's own <style>. */
button { cursor: pointer; }
/* ---------- Sticky top ---------- */
.top { position: sticky; top: 0; z-index: 30; }
.appbar { transition: background-color .25s ease, box-shadow .25s ease; }
.appbar.scrolled { background: color-mix(in oklch, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); box-shadow: 0 1px 0 var(--line); }
.appbar-in { max-width: 1120px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: var(--fs-lg); letter-spacing: -0.02em; }
.brand svg { width: 26px; height: 26px; }
.market { display: flex; align-items: center; gap: 8px; margin-left: auto; font-size: var(--fs-sm); color: var(--ink-2); }
.dot-live { width: 7px; height: 7px; border-radius: 50%; background: var(--profit); box-shadow: 0 0 0 3px var(--profit-weak); }
.broker { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--ink-2); }
.broker .t { display: none; }
@media (min-width: 640px) {
  .broker .t { display: inline; }
}
.broker svg.i { width: 15px; height: 15px; color: var(--profit); }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; flex: none; border: 0; background: color-mix(in oklch, var(--surface) 70%, transparent); border-radius: var(--r-md); color: var(--ink-2); transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--surface); color: var(--ink); }
.banner { display: none; background: var(--surface); box-shadow: 0 1px 0 var(--line), 0 8px 20px -12px oklch(0.2 0.05 280 / 0.35); }
.banner.show { display: block; animation: drop .28s var(--ease-out); }
.banner-in { max-width: 1120px; margin: 0 auto; padding: 10px 16px; display: flex; gap: 12px; align-items: center; }
.banner-txt { flex: 1; min-width: 0; cursor: pointer; }
.banner-txt strong { display: block; font-weight: 600; }
.banner-txt span { color: var(--ink-2); font-size: var(--fs-body); }
.banner-actions { display: flex; gap: 8px; }
.lbl-short { display: none; }
@keyframes drop { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
.st { display: flex; flex-direction: column; gap: 2px; }
.state-chip { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-sm); font-weight: 600; padding: 5px 10px 5px 9px; border-radius: var(--r-pill); background: color-mix(in oklch, var(--surface) 78%, transparent); color: var(--ink); }
.state-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.rail { position: relative; height: 6px; border-radius: var(--r-pill); background: color-mix(in oklch, var(--ink) 12%, transparent); overflow: hidden; }
.rail span { position: absolute; inset: 0; border-radius: inherit; background: var(--warn); transform-origin: left; transform: scaleX(0); transition: transform .5s var(--ease-out); }
.rail .tick { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bg); left: 60%; }
.rules-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: var(--r-pill); padding: 5px 8px 5px 11px; font-size: var(--fs-sm); font-weight: 600; background: var(--surface); color: var(--ink); }
.rules-btn:hover { background: color-mix(in oklch, var(--surface) 80%, var(--ink)); }
.rules-btn .kept { color: var(--ink-2); font-weight: 600; }
.rules-btn svg.i { width: 15px; height: 15px; color: var(--ink-3); }
/* Rules checklist */
.rule-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.rule-list li { display: grid; grid-template-columns: 28px minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; }
.rule-list li + li { border-top: 1px solid var(--line); }
.rk { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; }
.rk svg.i { width: 15px; height: 15px; stroke-width: 2.2; }
.rk.ok { background: var(--profit-weak); color: var(--profit); }
.rk.bad { background: var(--loss-weak); color: var(--loss); }
.rk.warn { background: var(--warn-weak); color: var(--warn-ink); }
.rl-name { font-weight: 600; font-size: var(--fs-body); }
.rl-now { font-size: var(--fs-sm); color: var(--ink-2); margin-top: 1px; }
.rl-tag { font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.rl-tag.ok { color: var(--profit); }
.rl-tag.bad { color: var(--loss); }
.rl-tag.warn { color: var(--warn-ink); }
.rules-sum { display: flex; align-items: baseline; gap: 8px; }
.rules-sum b { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -0.03em; }
.rules-sum span { color: var(--ink-2); font-size: var(--fs-body); }
/* ---------- Content ---------- */
.page { position: relative; z-index: 2; max-width: 1120px; margin: 0 auto; padding: 0 16px 40px; }
.sec .panel-head { border-bottom-color: color-mix(in oklch, var(--ink) 10%, transparent); }
.cols { display: grid; grid-template-columns: minmax(0,1fr); gap: 28px; grid-template-areas: "alerts" "positions" "streaks" "scratch"; }
.panel { background: var(--surface); border-radius: var(--r-xl); border: 1px solid var(--line); }
.panel.raised { border-color: transparent; box-shadow: var(--shadow-raise); }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; }
.sec .panel-head { padding: 0 0 12px; border-bottom: 1px solid var(--line-strong); }
.panel-head h2 { font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.02em; }
.panel-head .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.badge { font-size: var(--fs-xs); font-weight: 600; border-radius: var(--r-pill); padding: 2px 9px; background: var(--surface-3); color: var(--ink-2); }
.badge.todo { background: var(--accent); color: var(--on-accent); }
.badge.clear { background: var(--profit-weak); color: var(--profit); }
/* Alerts */
.alerts { list-style: none; margin: 0; padding: 0 6px 6px; }
.alerts > li + li::before, .reviewed > li + li::before { content: ""; position: absolute; top: 0; left: 12px; right: 12px; height: 1px; background: var(--line); }
.al:hover { background: var(--surface-2); }
.al { position: relative; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px; border-radius: var(--r-lg); transition: background .15s; }
.al-open { display: grid; grid-template-columns: 32px minmax(0,1fr); gap: 0 11px; align-items: center; text-align: left; border: 0; background: transparent; padding: 10px 0 10px 10px; border-radius: var(--r-lg); min-width: 0; }
.al-open:hover .al-title { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.al-ic { grid-row: span 2; width: 32px; height: 32px; border-radius: var(--r-sm); display: grid; place-items: center; }
.al-ic svg.i { width: 18px; height: 18px; stroke-width: 2; }
.al-l1 { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.al-title { font-weight: 600; font-size: var(--fs-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.al-meta { margin-left: auto; font-size: var(--fs-xs); color: var(--ink-3); white-space: nowrap; flex: none; }
.al-meta .sv { font-weight: 600; }
.al[data-sev="high"] .sv { color: var(--loss); }
.al[data-sev="medium"] .sv { color: var(--warn-ink); }
.al[data-sev="low"] .sv { color: var(--info); }
.al-ctx { display: none; }
.al-sum { font-size: var(--fs-sm); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.al-ack { position: relative; width: 40px; height: 40px; margin: 0 8px 0 4px; flex: none; border-radius: 50%; border: 1.5px solid color-mix(in oklch, var(--ink) 30%, transparent); background: var(--surface); color: var(--ink); display: grid; place-items: center; transition: background .15s, color .15s, border-color .15s; }
.al-ack::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; }
.al-ack:hover { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.al-ack svg.i { width: 18px; height: 18px; stroke-width: 2.2; }
.al-done { width: 40px; margin: 0 8px 0 4px; display: grid; place-items: center; color: var(--profit); }
.al-done svg.i { width: 16px; height: 16px; }
.al.done .al-title { font-weight: 500; color: var(--ink-2); }
.al.done .al-ic { filter: saturate(.5); opacity: .8; }
.al.done:hover { background: var(--surface-2); }
.sev-ic[data-sev="high"], .al-ic[data-sev="high"] { background: var(--loss-weak); color: var(--loss); }
.sev-ic[data-sev="medium"], .al-ic[data-sev="medium"] { background: var(--warn-weak); color: var(--warn-ink); }
.sev-ic[data-sev="low"], .al-ic[data-sev="low"] { background: var(--info-weak); color: var(--info); }
.al .al-ic { background: var(--surface-3); color: var(--ink-2); }
.al.todo .al-ic { color: var(--ink); }
.al.enter { animation: enter .45s var(--ease-out); }
@keyframes enter { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.al-empty { padding: 4px 16px 12px; font-size: var(--fs-sm); color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.al-empty svg.i { width: 16px; height: 16px; color: var(--profit); }
.rev-toggle { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; border-top: 1px solid var(--line); background: transparent; padding: 11px 16px; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); border-radius: 0 0 18px 18px; }
.rev-toggle:hover { color: var(--ink); background: var(--surface-2); }
.rev-toggle svg.i { width: 16px; height: 16px; transition: transform .2s; }
.rev-toggle[aria-expanded="true"] svg.i { transform: rotate(180deg); }
.reviewed { list-style: none; margin: 0; padding: 0 6px 6px; }
.reviewed[hidden] { display: none; }
/* Positions */
.tabs { display: inline-flex; background: var(--surface-3); border-radius: var(--r-md); padding: 3px; gap: 2px; }
.tab { border: 0; background: transparent; padding: 5px 11px; border-radius: var(--r-sm); font-size: var(--fs-sm); font-weight: 500; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; }
.tab[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-key); }
.tab .n { opacity: .7; }
.pos-head, .pos-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 16px; gap: 2px 10px; align-items: center; }
.pos-head { display: none; }
.pos-list { list-style: none; margin: 0; padding: 0; }
.pos-list li + li { border-top: 1px solid var(--line); }
.pos-row { width: 100%; text-align: left; border: 0; background: transparent; padding: 13px 0; transition: background .15s; }
.pos-row:hover { background: var(--surface-2); }
.pos-id { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 0 12px; align-items: center; min-width: 0; }
.pbadge { grid-row: span 2; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .02em; background: var(--surface-3); color: var(--ink-2); }
.ptype { font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .03em; padding: 1px 5px; border-radius: var(--r-xs); background: color-mix(in oklch, var(--ink) 8%, transparent); color: var(--ink-2); }
.sym { font-weight: 600; font-size: var(--fs-body); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.sym-sub { font-size: var(--fs-xs); color: var(--ink-3); margin-top: 2px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flag { font-size: var(--fs-2xs); font-weight: 600; padding: 1px 7px; border-radius: var(--r-pill); background: var(--loss-weak); color: var(--loss); }
.flag.m { background: var(--warn-weak); color: var(--warn-ink); }
.pos-pnl { text-align: right; font-weight: 600; font-size: var(--fs-md); }
.pos-pnl small { display: block; font-weight: 500; font-size: var(--fs-xs); }
.cell { display: none; font-size: var(--fs-body); }
.jr { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); color: var(--ink-3); }
.jr.done { color: var(--profit); }
.jr svg.i { width: 15px; height: 15px; }
.empty { padding: 22px 0; color: var(--ink-2); font-size: var(--fs-body); }
/* Scratchpad: ruled paper panel */
.save-state { font-size: var(--fs-xs); color: var(--ink-3); display: inline-flex; align-items: center; gap: 5px; }
.save-state svg.i { width: 14px; height: 14px; }
.chip-btn { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); padding: 5px 10px; font-size: var(--fs-sm); color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; transition: background .15s, color .15s; }
.chip-btn:hover { color: var(--ink); background: var(--surface-2); }
.chip-btn svg.i { width: 15px; height: 15px; }
/* ---------- Buttons ---------- */
.btn { border: 1px solid transparent; border-radius: var(--r-md); padding: 9px 14px; font-size: var(--fs-body); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: background .15s, border-color .15s, color .15s, transform .1s; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn-sm { padding: 7px 12px; font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn svg.i { width: 16px; height: 16px; }
/* ---------- Dialogs ---------- */
dialog { border: 0; padding: 0; background: var(--surface); color: var(--ink); width: 100%; max-width: 100%; max-height: 92dvh; margin: auto auto 0; border-radius: var(--r-sheet) var(--r-sheet) 0 0; box-shadow: var(--shadow-float); }
dialog::backdrop { background: var(--scrim); }
dialog[open] { animation: sheet-up .32s var(--ease-out); }
dialog[open]::backdrop { animation: fade .25s ease-out; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } }
.dlg { display: flex; flex-direction: column; max-height: 92dvh; }
.dlg:focus { outline: none; }
.grab { width: 40px; height: 4px; border-radius: var(--r-pill); background: var(--line-strong); margin: 8px auto 0; }
.dlg-head { display: flex; gap: 12px; align-items: flex-start; padding: 14px 20px 12px; border-bottom: 1px solid var(--line); }
.dlg-head .sev-ic { width: 36px; height: 36px; border-radius: var(--r-md); display: grid; place-items: center; flex: none; }
.dlg-head h3 { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; }
.dlg-head .sub { color: var(--ink-3); font-size: var(--fs-sm); margin-top: 3px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dlg-head .icon-btn { margin-left: auto; background: var(--surface-2); }
.dlg-body { padding: 16px 20px 28px; overflow: auto; display: flex; flex-direction: column; gap: 18px; }
.dlg-body > * { flex-shrink: 0; }
.dlg-foot { padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.dlg-foot .grow { flex: 1; }
.dlg-foot .note { font-size: var(--fs-xs); color: var(--ink-3); width: 100%; order: 3; }
.sev-tag { font-size: var(--fs-2xs); font-weight: 600; letter-spacing: .02em; padding: 1px 7px; border-radius: var(--r-pill); }
.sev-tag[data-sev="high"] { background: var(--loss-weak); color: var(--loss); }
.sev-tag[data-sev="medium"] { background: var(--warn-weak); color: var(--warn-ink); }
.sev-tag[data-sev="low"] { background: var(--info-weak); color: var(--info); }
.sec-t { font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.lead { font-size: var(--fs-md); line-height: 1.55; max-width: 60ch; }
.evidence { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.evidence li { display: grid; grid-template-columns: 54px minmax(0,1fr) auto; gap: 10px; padding: 10px 12px; font-size: var(--fs-sm); align-items: center; }
.evidence li + li { border-top: 1px solid var(--line); }
.evidence li.hl { background: var(--surface-2); }
.evidence .t { color: var(--ink-3); }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; margin: 0; }
.kv div { background: var(--surface); padding: 10px 12px; }
.kv dt { font-size: var(--fs-xs); color: var(--ink-3); }
.kv dd { margin: 2px 0 0; font-weight: 600; font-size: var(--fs-body); }
.rule { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: var(--r-lg); background: var(--paper); border: 1px solid var(--paper-line); font-size: var(--fs-sm); color: var(--ink-2); }
.rule svg.i { margin-top: 1px; }
.rule b { color: var(--ink); font-weight: 600; }
.side { font-size: var(--fs-xs); font-weight: 600; padding: 1px 8px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink-2); }
.field label, .field .lbl { display: block; font-size: var(--fs-sm); font-weight: 600; margin-bottom: 7px; }
.opt-row { display: flex; gap: 6px; flex-wrap: wrap; }
.opt { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-pill); padding: 6px 12px; font-size: var(--fs-sm); color: var(--ink-2); transition: background .15s, border-color .15s, color .15s; }
.opt:hover { border-color: var(--line-strong); color: var(--ink); }
.opt[aria-pressed="true"] { background: var(--accent-weak); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-md); padding: 3px; gap: 2px; background: var(--surface-2); }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: var(--r-sm); font-size: var(--fs-sm); color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-key); }
select { width: 100%; border: 1px solid var(--line); border-radius: var(--r-md); background-color: var(--surface-2); padding: 10px 12px; font-size: var(--fs-body); appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237a7b8a' stroke-width='1.75' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.dlg textarea { width: 100%; resize: vertical; border: 1px solid var(--paper-line); border-radius: var(--r-md); background: var(--paper); padding: 12px 14px; line-height: 1.6; font-size: var(--fs-body); color: var(--ink); caret-color: var(--accent); min-height: 110px; }
.dlg textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--focus); }
/* ---------- Toast ---------- */
.toasts { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(420px, calc(100% - 32px)); pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: var(--bg); border-radius: var(--r-lg); padding: 11px 14px; font-size: var(--fs-body); display: flex; gap: 10px; align-items: center; box-shadow: var(--shadow-float); animation: enter .3s var(--ease-out); }
.toast button { margin-left: auto; background: transparent; border: 0; color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
@media (max-width: 639px) {
  .banner-txt span, #banner-view { display: none; }
  .banner-txt strong { font-size: var(--fs-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .banner .sev-ic { width: 28px; height: 28px; }
  #banner-ack { padding: 6px 10px; }
  #banner-ack .lbl { display: none; }
  #banner-ack .lbl-short { display: inline; }
  .dlg-foot { display: grid; grid-template-columns: 1fr 1fr; }
  .dlg-foot .grow { display: none; }
  #da-ack { grid-column: 1 / -1; order: -1; }
  .dlg-foot .note { grid-column: 1 / -1; }
  #j-state { display: none; }
}
@media (min-width: 640px) {
  dialog { width: min(560px, calc(100% - 48px)); margin: auto; border-radius: var(--r-xl); }
  dialog[open] { animation: dlg-in .26s var(--ease-out); }
  .grab { display: none; }
  .page { padding: 0 16px 40px; }
}
@keyframes dlg-in { from { transform: translateY(8px) scale(.985); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 768px) {
  .al-sum { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .al-ctx { display: flex; grid-column: 2; gap: 8px; align-items: center; margin-top: 7px; font-size: var(--fs-xs); color: var(--ink-2); }
  .al-ctx .tr { display: inline-flex; gap: 6px; align-items: center; }
  .al-ctx > * + *::before { content: '·'; margin-right: 8px; color: var(--ink-3); }
  .al-ctx .tr b { font-weight: 600; color: var(--ink); }
  .pos-head, .pos-row { grid-template-columns: minmax(0, 2.6fr) 0.5fr 0.9fr 0.9fr 1.2fr 0.9fr; gap: 12px; }
  .pos-head { display: grid; padding: 10px 0 8px; font-size: var(--fs-xs); color: var(--ink-3); border-bottom: 1px solid color-mix(in oklch, var(--ink) 10%, transparent); }
  .pos-head span:not(:first-child) { text-align: right; }
  .cell { display: block; text-align: right; }
  .pos-row .jr-cell { display: flex; justify-content: flex-end; }
}
@media (min-width: 1024px) {
  .appbar-in, .banner-in { padding-left: 32px; padding-right: 32px; }
  .st { padding: 0 22px; border-left: 1px solid color-mix(in oklch, var(--ink) 14%, transparent); }
  .al-open { padding: 13px 0 13px 12px; }
  .page { padding: 0 32px 48px; }
  .cols { margin-top: -92px; }
  .cols { gap: 40px; }
  .pos-pnl small { display: none; }
  .sym-sub .m-only { display: none; }
}
@media (min-width: 1024px) {
  .st { padding: 0 18px; }
}
@media (max-width: 639px) {
  .market .clock-lbl { display: none; }
}
.shell { margin-left: var(--side-w); min-width: 0; }
.sidebar {
  display: none; position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 40;
  background: var(--side); border-right: 1px solid var(--line);
  flex-direction: column; padding: 14px 12px 14px;
}
.sb-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: var(--fs-lg); letter-spacing: -0.02em; padding: 4px 8px 18px; }
.sb-brand svg { width: 28px; height: 28px; flex: none; }
.sb-nav, .sb-foot { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.sb-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.nav-i {
  width: 100%; display: flex; align-items: center; gap: 12px; border: 0; background: transparent; text-align: left;
  padding: 9px 10px; border-radius: var(--r-md); font-size: var(--fs-body); font-weight: 500; color: var(--ink-2); min-height: 40px;
  transition: background .15s, color .15s; position: relative;
}
.nav-i svg.i { width: 19px; height: 19px; }
.nav-i:hover { background: color-mix(in oklch, var(--ink) 6%, transparent); color: var(--ink); }
.nav-i[aria-current="page"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px oklch(0.2 0.03 280 / .08); }
.nav-i[aria-current="page"] svg.i { color: var(--accent); }
.nav-i .lbl { flex: 1; white-space: nowrap; }
.nav-i .nb { font-size: var(--fs-2xs); font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); display: grid; place-items: center; background: var(--accent); color: var(--on-accent); }
.nav-i .nb.soft { background: color-mix(in oklch, var(--ink) 10%, transparent); color: var(--ink-2); }
.nav-i .nb:empty { display: none; }
.sw { width: 34px; height: 20px; border-radius: var(--r-pill); background: color-mix(in oklch, var(--ink) 18%, transparent); position: relative; flex: none; transition: background .2s; }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px oklch(0 0 0 / .2); transition: transform .2s var(--ease-out); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-weak); color: var(--accent); font-size: var(--fs-xs); font-weight: 700; flex: none; }
.nav-i .who { display: grid; line-height: 1.25; flex: 1; min-width: 0; }
.nav-i .who small { font-size: var(--fs-xs); color: var(--ink-3); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Rail by default from 768; .is-exp expands it (pinned on ≥1280, overlay below) */
.shell { transition: margin-left .22s var(--ease-out); }
.sb-toggle { display: none; margin-left: auto; width: 32px; height: 32px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink-3); place-items: center; }
.sb-toggle:hover { background: color-mix(in oklch, var(--ink) 7%, transparent); color: var(--ink); }
.sb-toggle svg.i { width: 18px; height: 18px; }
.sb-scrim { position: fixed; inset: 0; z-index: 39; background: var(--scrim); border: 0; padding: 0; animation: fade .2s ease-out; }
@media (min-width: 768px) {
  .sidebar { display: flex; padding: 14px 10px; width: 76px; transition: width .22s var(--ease-out), box-shadow .22s; overflow: hidden; }
  .sb-brand { flex-direction: column; gap: 10px; padding: 4px 0 14px; }
  .sb-toggle { display: grid; margin: 0 auto; }
  .sb-brand span, .nav-i .lbl, .nav-i .who, .nav-i .sw { display: none; }
  .nav-i { justify-content: center; padding: 10px 0; }
  .nav-i .nb { position: absolute; top: 3px; right: 6px; min-width: 16px; height: 16px; font-size: var(--fs-2xs); padding: 0 4px; }
  .nav-i .nb.soft { display: none; }
  .appbar .brand { display: none; }
  .sidebar.is-exp { width: 248px; padding: 16px 14px; }
  .sidebar.is-exp.overlay { box-shadow: var(--shadow-float); }
  .sidebar.is-exp .sb-brand { flex-direction: row; padding: 4px 4px 20px 8px; }
  .sidebar.is-exp .sb-toggle { margin: 0 0 0 auto; }
  .sidebar.is-exp .sb-brand span, .sidebar.is-exp .nav-i .lbl { display: inline; }
  .sidebar.is-exp .nav-i .who { display: grid; }
  .sidebar.is-exp .nav-i .sw { display: block; }
  .sidebar.is-exp .nav-i { justify-content: flex-start; padding: 9px 10px; }
  .sidebar.is-exp .nav-i .nb { position: static; min-width: 20px; height: 20px; font-size: var(--fs-2xs); padding: 0 6px; }
  .sidebar.is-exp .nav-i .nb.soft { display: grid; }
}
/* Page title in app bar (≥768, where the brand lives in the sidebar) */
.page-title { display: none; font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.01em; }
.page-title small { font-weight: 500; color: var(--ink-3); margin-left: 8px; font-size: var(--fs-sm); }
@media (min-width: 768px) {
  .page-title { display: block; }
  .bell-btn { display: none; }
}
/* Phone bottom tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in oklch, var(--surface) 92%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  box-shadow: 0 -1px 0 var(--line);
}
.tb-i { border: 0; background: transparent; display: grid; justify-items: center; gap: 3px; padding: 6px 0 4px; min-height: 52px; font-size: var(--fs-2xs); font-weight: 600; color: var(--ink-3); position: relative; border-radius: var(--r-lg); }
.tb-i svg.i { width: 22px; height: 22px; }
.tb-i[aria-current="page"] { color: var(--accent); }
.tb-i[aria-current="page"] svg.i { stroke-width: 2.1; }
.tb-i .nb { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: var(--r-pill); font-size: var(--fs-2xs); font-weight: 700; display: grid; place-items: center; background: var(--loss); color: var(--on-count); box-shadow: 0 0 0 2px var(--surface); }
.tb-i .nb:empty { display: none; }
@media (min-width: 768px) {
  .tabbar { display: none; }
}
@media (max-width: 767px) {
  .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }
}
/* Raised AI tab, avatar tab, bell badge */
.tb-ai { color: var(--ink-2); }
.ai-dot { width: 44px; height: 28px; margin-top: 0; border-radius: var(--r-pill); display: grid; place-items: center; background: var(--accent-weak); color: var(--accent); }
.tb-ai[aria-current="page"] .ai-dot { background: var(--accent); color: var(--on-accent); }
.tb-ai .ai-dot svg.i { width: 20px; height: 20px; }
.tb-ai[aria-current="page"] { color: var(--accent); }
.tb-av { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: var(--fs-2xs); font-weight: 700; background: var(--accent-weak); color: var(--accent); }
.bell-btn { position: relative; }
.bell-btn .nb { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--r-pill); font-size: var(--fs-2xs); font-weight: 700; display: grid; place-items: center; background: var(--loss); color: var(--on-count); box-shadow: 0 0 0 2px var(--bg); }
.bell-btn .nb:empty { display: none; }
.you-av { width: 40px; height: 40px; font-size: var(--fs-xs); }
/* Top-bar shortcuts (phone): bell -> Alerts page, gear -> Settings */
.gear-btn { margin-left: -4px; }
@media (min-width: 768px) {
  .gear-btn { display: none; }
}
/* You sheet (phone) */
.more-list { list-style: none; margin: 0; padding: 0; display: grid; }
.more-list li + li { border-top: 1px solid var(--line); }
.more-list .nav-i { padding: 12px 4px; min-height: 52px; border-radius: 0; font-size: var(--fs-md); }
.more-list .nav-i .lbl, .more-list .nav-i .who, .more-list .nav-i .sw { display: inline; }
.more-list .nav-i .who { display: grid; }
.more-list .nav-i .sw { display: block; }
.more-list .nav-i:hover { background: transparent; }
.more-list .nav-i > svg.i:last-child { color: var(--ink-3); width: 16px; height: 16px; }
.more-h { font-size: var(--fs-xs); font-weight: 600; color: var(--ink-3); margin: 14px 0 4px; letter-spacing: .02em; }
.more-h:first-child { margin-top: 0; }
/* Market status states */
.xs-show { display: none; }
@media (max-width: 639px) {
  .xs-hide { display: none; }
  .xs-show { display: inline; }
}
.dot-live.stale { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in oklch, var(--warn) 30%, transparent); animation: pulse 1.4s ease-in-out infinite; }
.dot-live.closed { background: var(--ink-3); box-shadow: none; }
@keyframes pulse { 50% { opacity: .35; } }
/* Skeleton (first load) */
.skel { display: inline-block; border-radius: var(--r-sm); background: linear-gradient(90deg, color-mix(in oklch, var(--ink) 7%, transparent) 25%, color-mix(in oklch, var(--ink) 13%, transparent) 50%, color-mix(in oklch, var(--ink) 7%, transparent) 75%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skel-row { display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: center; padding: 14px 12px; }
.skel-row div { display: grid; gap: 8px; }
/* Phone: journal cue on position rows */
.pchev { color: var(--ink-3); display: grid; place-items: center; }
.pchev svg.i { width: 16px; height: 16px; }
@media (min-width: 768px) {
  .pchev { display: none; }
}
@media (pointer: coarse) {
  .rules-btn, .tab, .chip-btn, .quick button { min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
}

/* Self-contained state variants (usable outside the dashboard band) */
.state-chip[data-state="calm"] i { background: var(--accent); box-shadow: none; }
.state-chip[data-state="caution"] i { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in oklch, var(--warn) 30%, transparent); }
.state-chip[data-state="stop"] i { background: var(--loss); box-shadow: 0 0 0 3px color-mix(in oklch, var(--loss) 30%, transparent); }
.rail[data-tone="calm"] span { background: var(--accent); }
.rail[data-tone="caution"] span { background: var(--warn); }
.rail[data-tone="stop"] span { background: var(--loss); }

/* Empty count badges never render */
.nav-i .nb:empty, .sidebar.is-exp .nav-i .nb.soft:empty { display: none; }

.rec-link { color: var(--accent); font-weight: 600; font-size: var(--fs-sm); text-decoration: none; margin-left: auto; } .rec-link:hover { text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 430px) { .appbar-in { gap: 6px; } .market { font-size: var(--fs-xs); white-space: nowrap; gap: 6px; } .appbar-in .icon-btn { width: 34px; height: 34px; } }

.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
/* Shield pill is a button; page title hides where a page band carries the h1 */
button.broker { border: 0; background: transparent; padding: 6px 4px; border-radius: var(--r-md); cursor: pointer; font: inherit; font-size: var(--fs-sm); color: var(--ink-2); }
button.broker:hover { background: color-mix(in oklch, var(--ink) 6%, transparent); }
.has-band .page-title { display: none; }
.bell-btn[aria-current="page"] { background: var(--accent-weak); color: var(--accent); }
.soon { margin-left: auto; font-size: var(--fs-2xs); font-weight: 600; color: var(--ink-3); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 1px 7px; }
.sidebar:not(.is-exp) .nav-i .soon { display: none; }
.tb-soon { opacity: .7; }
/* Broker-disconnected banner (injected by sessions.js) */
.broker-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 auto; max-width: 1120px; padding: 10px 16px; background: var(--loss-weak); color: var(--ink); font-size: var(--fs-sm); }
.broker-banner b { font-weight: 600; }
.broker-banner a { color: var(--accent); font-weight: 600; text-decoration: underline; }

/* Plan vs actual: paper = what you wrote, indigo = what Mirror saw. The solid and faded arcs of the logo are the pair mark. */
.pl { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .01em; margin-bottom: 3px; }
.pl svg.i { width: 15px; height: 15px; }
.pair { display: grid; width: 100%; max-width: 70ch; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--paper-line); }
.pair > p, .pair > div { margin: 0; padding: 10px 14px; font-size: var(--fs-sm); line-height: 1.5; }
.pair .you { background: var(--paper); color: var(--ink); }
.pair .you .pl { color: var(--paper-ink); }
.pair .mir { background: var(--accent-weak); color: var(--ink); border-top: 1px solid color-mix(in oklch, var(--accent) 14%, transparent); }
.pair .mir .pl { color: var(--accent); }
.pair .you:only-child, .pair .mir:only-child { border-top: 0; }
.paper-box { background: var(--paper); border: 1px solid var(--paper-line); border-radius: var(--r-lg); }
.rule svg.i { color: var(--paper-ink); }

/* Page band: shared by Journal (.jband), My rules and My record (.rband) and the other pages (.pband). Each page sets only its own padding-bottom and layout. */
.pband, .jband, .rband {
  --glow: var(--glow-calm);
  position: relative; margin-top: -57px; padding-top: 57px;
  background: radial-gradient(90% 120% at 0% 0%, var(--glow) 0%, transparent 62%), radial-gradient(60% 100% at 100% 0%, var(--glow-2) 0%, transparent 60%), var(--tint-calm);
}
.pband::before, .jband::before, .rband::before { content: ""; position: absolute; inset: 0; pointer-events: none; background-image: radial-gradient(var(--band-dot) 1px, transparent 1.6px); background-size: 18px 18px; -webkit-mask-image: linear-gradient(to bottom, #000, transparent 90%); mask-image: linear-gradient(to bottom, #000, transparent 90%); }
.pt h1, .jt h1, .rt h1 { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.pt p, .jt p, .rt p { font-size: var(--fs-sm); color: var(--ink-2); margin-top: 4px; }
.js-st { display: flex; flex-direction: column; gap: 2px; padding-right: 20px; min-width: 0; }
.js-st + .js-st { padding-left: 20px; border-left: 1px solid color-mix(in oklch, var(--ink) 14%, transparent); }
.js-st .k { font-size: var(--fs-xs); color: var(--ink-3); font-weight: 500; white-space: nowrap; }
.js-st .v { font-size: var(--fs-md); font-weight: 600; color: var(--ink); white-space: nowrap; }
.js-st .v em { font-style: normal; font-weight: 500; color: var(--ink-2); }
/* Touch: every tappable control reaches 44px on coarse pointers */
@media (pointer: coarse) {
  .btn, .btn-sm, .opt, .seeall, .sb-toggle, .dchip { min-height: 44px; }
  button.broker { min-width: 44px; min-height: 44px; justify-content: center; }
  .seeall { display: inline-flex; align-items: center; }
}
/* Native selects get a visible chevron and room for the text */
select.pill-sel, select.bs-sel, select.fld { -webkit-appearance: none; appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6f87' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 14px; }
select.pill-sel, select.bs-sel { padding-left: 14px; }
/* Underline variant of .tabs: used wherever tabs say "where you are" (page modes and card sections). Pills stay for "how you slice it". */
.tabs.ul { display: flex; background: none; border-radius: 0; padding: 0; gap: 2px; border-bottom: 1px solid var(--line); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs.ul::-webkit-scrollbar { display: none; }
.tabs.ul .tab { flex: none; justify-content: center; border-radius: 0; background: none; box-shadow: none; padding: 12px 14px; min-height: 46px; font-size: var(--fs-body); font-weight: 600; color: var(--ink-3); }
.tabs.ul .tab:hover { color: var(--ink); }
.tabs.ul .tab[aria-selected="true"] { background: none; color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.tabs.ul .tab svg.i { width: 16px; height: 16px; }
.jband .tabs.ul, .rband .tabs.ul, .pband .tabs.ul { border-bottom-color: color-mix(in oklch, var(--ink) 14%, transparent); }
.jband .tabs.ul .tab, .rband .tabs.ul .tab { padding-inline: 4px; margin-right: 18px; }
/* Filter sheet: one pill that opens a bottom sheet of choices (Alerts, My rules breaches) */
.fbtn { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; height: 40px; border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: var(--surface); padding: 0 14px; font: inherit; font-size: var(--fs-sm); font-weight: 600; color: var(--ink); max-width: 100%; min-width: 0; } .fbtn svg.i { width: 16px; height: 16px; flex: none; } .fbtn svg.chev { color: var(--ink-3); }
.fgrp { display: grid; gap: 2px; } .fgrp h4 { margin: 0 0 4px; padding: 0 4px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.fopt { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: transparent; text-align: left; padding: 12px 8px; min-height: 48px; border-radius: var(--r-md); font: inherit; font-size: var(--fs-body); color: var(--ink); cursor: pointer; }
.fopt:hover { background: var(--surface-2); } .fopt .n { margin-left: auto; font-size: var(--fs-sm); color: var(--ink-3); }
.fopt .ck { width: 18px; height: 18px; flex: none; color: var(--accent); visibility: hidden; } .fopt[aria-pressed="true"] { font-weight: 600; } .fopt[aria-pressed="true"] .ck { visibility: visible; }
.fdate { margin: 4px 8px 6px 38px; max-width: 220px; }
@media (pointer: coarse) { .fbtn { height: 44px; } }
/* Page sub-lines under titles are not needed: the title, the tabs and the section colour already say where you are */
.pt p, .jt p, .rt p { display: none; }
/* Demo strip (scripts/demo.js): a thin, visible line at the very top of every screen */
.demo-strip { position: relative; z-index: 60; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 28px; padding: 4px 12px; background: linear-gradient(90deg, oklch(0.4 0.19 278), oklch(0.5 0.2 296) 55%, oklch(0.44 0.19 278)); color: #fff; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .01em; line-height: 1.25; text-align: center; box-shadow: 0 1px 0 oklch(0.3 0.15 278 / .5); }
.demo-strip b { flex: none; font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 2px 8px; border-radius: var(--r-pill); background: #fff; color: oklch(0.4 0.19 278); }
.demo-strip span { min-width: 0; }
