/* Trade Vantage — the app. Same language as the site (tokens.css): quiet grounds, hairline cards,
   Inter with IBM Plex Mono for figures and labels, one blurple accent. Every colour is a token,
   so light and dark stay in step. */

:root { --page-width: 1280px; }

html { background: var(--ground); }
body {
  font: 400 13.5px/1.55 var(--sans); color: var(--text); background: var(--ground);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss03"; text-rendering: optimizeLegibility;
}
html.auth-pending body { visibility: hidden; }
body.modal-open { overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-ink); }
p { margin: 0; text-wrap: pretty; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; line-height: 1.25; font-family: var(--sans); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: inherit; }
input, textarea { font: inherit; color: inherit; }
::selection { background: color-mix(in srgb, var(--accent-deep) 35%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.m-only { display: none !important; }
.right { text-align: right; }

[data-action] { cursor: pointer; transition: background .18s, border-color .18s, color .18s, box-shadow .2s, transform .12s, opacity .18s; }
[data-action]:active { transform: scale(.985); }
button:disabled { opacity: .45; cursor: not-allowed; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes settleIn { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
.fade { animation: fadeIn .28s ease both; }
#view.fade, #viewTop.fade { animation: settleIn .45s var(--ease-out) both; }
.modal.fade { animation: settleIn .35s var(--ease-out) both; }

.hstrip { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -ms-overflow-style: none; }
.hstrip::-webkit-scrollbar { display: none; }
.hstrip.dragging { cursor: grabbing; user-select: none; }
.hstrip.dragging .chip { pointer-events: none; }

/* ---------- Type & utilities ---------- */

.micro { font: 500 10.5px/1.3 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin-bottom: 8px; }
.kpi .micro, .stat-card .micro, .tf-card .micro, .mini-stat .micro, .equity-head .micro { margin-bottom: 0; }
.title-sm { font: 600 14.5px/1.3 var(--sans); letter-spacing: -.01em; color: var(--text); }
.hint { font: 400 12px/1.5 var(--sans); color: var(--faint); }
.hint7 { font: 400 10.5px var(--sans); color: var(--faint); }
.note { font: 400 13px/1.6 var(--sans); color: var(--muted); }
.note.wide { max-width: 80ch; }
.note i { vertical-align: -2px; }
.empty-note { font: 400 13px/1.55 var(--sans); color: var(--faint); }
.empty-note.pad { padding: 22px 12px; }
.muted3 { color: var(--text); }
.muted4 { color: var(--muted); }
.muted5 { color: var(--muted); }
.muted6 { color: var(--faint); }
.acc3 { color: var(--accent); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.min0 { min-width: 0; }
.grow { flex: 1; min-width: 0; }
.grow2 { flex: 2; min-width: 0; }
.push { margin-left: auto; }
.mt { margin-top: 10px; } .mt7 { margin-top: 8px; } .mt11 { margin-top: 12px; } .mt12 { margin-top: 14px; }
.mt13 { margin-top: 16px; } .mt15 { margin-top: 18px; } .mt18 { margin-top: 20px; } .mb10 { margin-bottom: 12px; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.stack6 { display: flex; flex-direction: column; gap: 8px; }
.stack7 { display: flex; flex-direction: column; gap: 10px; }
.stack8 { display: flex; flex-direction: column; gap: 12px; }
.stack10 { display: flex; flex-direction: column; gap: 14px; }
.between { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pair { display: flex; gap: 10px; flex-wrap: wrap; }
.pair > * { flex: 1 1 0; }

/* Section headers: title, one line of context, controls on the right. */
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.section-title { font: 600 17px/1.3 var(--sans); letter-spacing: -.018em; color: var(--text); }
.section-sub { font: 400 13px/1.45 var(--sans); color: var(--muted); margin-top: 4px; }
.section-right { display: flex; align-items: center; gap: 6px; flex: none; }
.section-right .link-btn { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Controls ---------- */

.chips { display: flex; gap: 6px; align-items: center; }
.chips.wrap { flex-wrap: wrap; }
.chip {
  flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 13px; border-radius: 9px; white-space: nowrap;
  font: 500 12.5px/1 var(--sans); color: var(--muted);
  background: transparent; border: 1px solid var(--line-2);
}
.chip:hover { color: var(--text); border-color: var(--line-3); background: color-mix(in srgb, var(--text) 3%, transparent); }
.chip.on { color: var(--accent-ink); border-color: var(--accent-line); background: var(--accent-tint); }
.chip.sm { height: 30px; padding: 0 11px; border-radius: 8px; font-size: 12px; }
.chip.xs { height: 28px; padding: 0 10px; border-radius: 7px; font-size: 11.5px; }
.chip.lg { height: 38px; padding: 0 15px; border-radius: 10px; font-size: 13px; }
.chip.block { flex: 1; }

.switch {
  width: 38px; height: 22px; flex: none; border-radius: 99px; padding: 3px;
  display: flex; justify-content: flex-start; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-2);
}
.switch span { width: 16px; height: 16px; border-radius: 50%; background: var(--muted); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .22s var(--ease-out), background .18s; }
.switch.on { background: var(--accent-deep); box-shadow: inset 0 0 0 1px var(--accent-line); }
.switch.on span { background: #ffffff; transform: translateX(16px); }

.btn-accent {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 17px; border-radius: 10px; white-space: nowrap;
  font: 500 13.5px/1 var(--sans); letter-spacing: -.005em;
  background: var(--solid-bg); color: var(--solid-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 12px 30px -14px color-mix(in srgb, var(--accent-deep) 80%, transparent);
}
.btn-accent:hover { background: var(--solid-bg-hover); color: var(--solid-ink); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 16px 36px -14px color-mix(in srgb, var(--accent-deep) 95%, transparent); }
.btn-accent i { font-size: 16px; }
.btn-accent.xs { height: 32px; width: 32px; padding: 0; flex: none; }
.btn-accent.block { display: flex; width: 100%; }
.btn-accent.tall { height: 50px; border-radius: 12px; font-size: 15px; }

.circle-btn {
  width: 40px; height: 40px; flex: none; border-radius: 11px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-2); color: var(--muted); font-size: 17px; background: transparent;
}
.circle-btn:hover { color: var(--text); border-color: var(--line-3); background: color-mix(in srgb, var(--text) 4%, transparent); }
.circle-btn.accent { border-color: transparent; background: var(--solid-bg); color: var(--solid-ink); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); }
.circle-btn.accent:hover { background: var(--solid-bg-hover); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 32px; height: 32px; border-radius: 8px; color: var(--muted); font-size: 16px;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.dim { color: var(--faint); font-size: 14px; }
.icon-btn.xs { width: 28px; height: 28px; font-size: 14px; }

.link-btn { font: 500 12.5px/1.3 var(--sans); color: var(--accent); white-space: nowrap; }
.link-btn:hover { color: var(--accent-ink); }
.link-btn i { font-size: 12px; vertical-align: -1px; }

.ghost-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 15px;
  border-radius: 10px; border: 1px solid var(--line-2);
  font: 500 13px/1 var(--sans); color: var(--muted); white-space: nowrap;
}
.ghost-btn:hover { border-color: var(--line-3); color: var(--text); background: color-mix(in srgb, var(--text) 4%, transparent); }
.ghost-btn.danger:hover { border-color: var(--neg-line); color: var(--neg); background: var(--neg-tint); }

.field {
  width: 100%; min-height: 40px; padding: 9px 12px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line-2);
  font: 400 13.5px/1.4 var(--sans); color: var(--text); caret-color: var(--accent);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .08); transition: border-color .15s, box-shadow .2s;
}
.field:hover { border-color: var(--line-3); }
.field:focus, .field:focus-visible { border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px var(--accent-tint); }
.field.sm { min-height: 32px; padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
.field::placeholder { color: var(--faint); }
textarea.field { resize: vertical; min-height: 84px; }

/* Bias: tinted pills, not borders. */
.watch-bias, .bias-pill {
  flex: none; display: inline-flex; align-items: center;
  font: 500 11px/1 var(--sans); padding: 5px 8px; border-radius: 6px; white-space: nowrap;
  color: var(--muted); background: color-mix(in srgb, var(--text) 7%, transparent);
}
.watch-bias.long, .bias-pill.long { color: var(--pos); background: var(--pos-tint); }
.watch-bias.short, .bias-pill.short { color: var(--neg); background: var(--neg-tint); }

/* ---------- Shell ---------- */

.app { display: flex; min-height: 100vh; }

.rail {
  width: 84px; flex: none; position: sticky; top: 0; height: 100vh; z-index: 5;
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 20px 0 18px;
  background: color-mix(in srgb, var(--ground) 45%, var(--surface)); border-right: 1px solid var(--line);
}
.brand {
  width: 38px; height: 38px; flex: none; border-radius: 11px; margin-bottom: 22px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #3d4491, #232760 70%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14), inset 0 1px 0 rgba(255, 255, 255, .18), 0 8px 20px -8px rgba(53, 59, 128, .9);
}
.brand svg { width: 21px; height: 21px; display: block; }
.rail-tab {
  position: relative; width: 64px; padding: 10px 0 9px; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--faint);
}
.rail-tab i { font-size: 21px; }
.rail-tab span { font: 500 10.5px/1 var(--sans); letter-spacing: .01em; }
.rail-tab:hover { color: var(--text); background: color-mix(in srgb, var(--text) 4%, transparent); }
.rail-tab.on { color: var(--accent-ink); background: var(--accent-tint); box-shadow: inset 0 0 0 1px var(--accent-line); }
.rail-tab.on::before {
  content: ""; position: absolute; left: -10px; top: 50%; width: 3px; height: 22px; transform: translateY(-50%);
  border-radius: 0 3px 3px 0; background: var(--accent); box-shadow: 0 0 12px var(--accent-deep);
}
.rail-foot { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.rail-saved { font-size: 16px; color: var(--faint); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  font: 600 14px/1 var(--sans); color: #f5f4ff;
  background: linear-gradient(145deg, #6a5fa8, #262a60);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
}
.avatar:hover { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16), 0 0 0 3px var(--accent-line); }
.avatar i { font-size: 16px; }

.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; isolation: isolate; }
/* A faint aurora behind the page header, the same light as the site's hero. */
.workspace::before {
  content: ""; position: absolute; z-index: -1; top: -220px; left: 50%; transform: translateX(-50%);
  width: min(1200px, 120%); height: 520px; pointer-events: none;
  background: radial-gradient(40% 50% at 30% 40%, color-mix(in srgb, var(--aurora-b) 55%, transparent), transparent 70%),
              radial-gradient(30% 40% at 70% 35%, color-mix(in srgb, var(--aurora-a) 45%, transparent), transparent 70%);
  opacity: .55;
}

/* Page header: kicker, headline, one line of context. */
.topbar {
  width: 100%; max-width: var(--page-width); margin: 0 auto;
  display: flex; align-items: flex-end; gap: 20px; padding: 44px 44px 6px;
}
.title-block { min-width: 0; flex: 1; }
.kicker { font: 500 11px/1 var(--mono); letter-spacing: .15em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }
.view-title { font: 600 34px/1.08 var(--sans); letter-spacing: -.035em; color: var(--text); }
.page-sub { font: 400 14.5px/1.5 var(--sans); color: var(--muted); margin-top: 8px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex: none; }

.main {
  width: 100%; max-width: var(--page-width); margin: 0 auto;
  min-width: 0; padding: 26px 44px 80px; display: flex; flex-direction: column; gap: 44px;
}
#viewTop:empty { display: none; }
#view { display: flex; flex-direction: column; gap: 28px; min-width: 0; }

/* ---------- Panels & cards ---------- */

.panel { padding: 20px 22px; border-radius: 16px; background: var(--surface); box-shadow: var(--card-shadow); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-head.wrap { flex-wrap: wrap; align-items: center; }
.panel-head .micro { margin-bottom: 0; }
.foot-line { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); font: 400 12px var(--sans); color: var(--faint); }
.equity { width: 100%; display: block; margin-top: 18px; overflow: visible; }

.row-today { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.row-half { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.wrap-row { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.flex-460 { flex: 1 1 460px; min-width: 0; }
.flex-260 { flex: 1 1 260px; min-width: 0; }

.stat-card {
  position: relative; overflow: hidden; min-width: 0;
  padding: 18px 18px 16px; border-radius: 14px; background: var(--surface); box-shadow: var(--card-shadow);
}
.stat-card::before, .panel.equity-panel::before, .modal::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 30%, transparent), transparent);
}
.stat-v { font: 600 26px/1.1 var(--sans); margin-top: 14px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat-sub { font: 400 12px/1.4 var(--sans); color: var(--faint); margin-top: 6px; }
.kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }

.coach {
  position: relative; overflow: hidden; isolation: isolate;
  padding: 22px 24px; border-radius: 18px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-deep) 15%, var(--surface)) 0%, var(--surface) 65%);
  box-shadow: inset 0 0 0 1px var(--accent-line), 0 24px 60px -36px color-mix(in srgb, var(--accent-deep) 70%, transparent);
}
.coach::after {
  content: ""; position: absolute; z-index: -1; right: -80px; top: -120px; width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent-deep) 22%, transparent), transparent);
  pointer-events: none;
}
.coach-card { display: flex; gap: 16px; align-items: flex-start; }
.coach-icon {
  width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center;
  color: var(--accent); background: var(--accent-tint); box-shadow: inset 0 0 0 1px var(--accent-line); font-size: 19px;
}
.coach-h { display: flex; align-items: center; gap: 8px; font: 500 10.5px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 3px 0 10px; }
.coach-h span { letter-spacing: .02em; text-transform: none; color: var(--faint); font-weight: 400; }
.coach p { font: 400 15px/1.65 var(--sans); color: var(--text); max-width: 72ch; }
.coach-line { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font: 600 13.5px var(--sans); color: var(--text); }
.coach-line strong { font-weight: 600; }
.coach-line i { font-size: 18px; color: var(--accent); }
.coach-line span { font: 400 12px var(--sans); color: var(--muted); }
.modal .coach { padding: 16px 18px; border-radius: 14px; }
.modal .coach p { font-size: 13px; color: var(--muted); }

.demo-note {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px;
  background: var(--accent-tint); box-shadow: inset 0 0 0 1px var(--accent-line);
  font: 400 13px/1.5 var(--sans); color: var(--muted);
}
.demo-note i { color: var(--accent); font-size: 17px; flex: none; }
.demo-note .link-btn { margin-left: auto; }

/* ---------- Today ---------- */

.today-top {
  display: grid; gap: 36px 32px; align-items: start;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr);
  grid-template-areas: "coach events" "watch events";
}
.coach-card { grid-area: coach; }
.today-watch { grid-area: watch; min-width: 0; }
.today-events { grid-area: events; min-width: 0; }
.today-plan { display: none; }

.bias-edit { margin-bottom: 14px; padding: 14px 16px; border-radius: 14px; background: var(--surface); box-shadow: var(--card-shadow); }
.watch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.watch-item { position: relative; min-width: 0; }
.watch-row, .watch-edit {
  height: 100%; padding: 16px 16px 15px; border-radius: 14px; background: var(--surface); box-shadow: var(--card-shadow);
  transition: box-shadow .2s, transform .25s var(--ease-out), background .2s;
}
.watch-row:hover { box-shadow: var(--lift-shadow); transform: translateY(-2px); }
.watch-row.on { box-shadow: inset 0 0 0 1px var(--accent-line); background: linear-gradient(140deg, color-mix(in srgb, var(--accent-deep) 12%, var(--surface)), var(--surface) 70%); }
.watch-edit { display: flex; flex-direction: column; gap: 10px; }
.watch-line { display: flex; align-items: center; gap: 9px; }
.watch-sym { font: 600 14.5px/1 var(--sans); letter-spacing: .005em; color: var(--text); }
.watch-tfs { display: flex; gap: 6px; transition: opacity .15s; }
.watch-tfs span { font: 500 10.5px/1 var(--mono); letter-spacing: .03em; color: var(--faint); }
.watch-note { font: 400 13px/1.45 var(--sans); color: var(--muted); margin-top: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-remove {
  position: absolute; top: 11px; right: 11px; width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--muted);
  background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-2); opacity: 0; transition: opacity .15s;
}
.watch-item:hover .row-remove, .row-remove:focus-visible { opacity: 1; }
.watch-item:hover .watch-tfs { opacity: 0; }
.row-remove:hover { color: var(--neg); background: var(--neg-tint); box-shadow: inset 0 0 0 1px var(--neg-line); }

.ev-stack { display: flex; flex-direction: column; padding: 4px 20px; border-radius: 16px; background: var(--surface); box-shadow: var(--card-shadow); }
.ev-row { display: flex; align-items: center; gap: 14px; padding: 15px 0; }
.ev-row + .ev-row { border-top: 1px solid var(--line); }
.ev-row.empty-note { padding: 18px 0; }
.ev-row-time { width: 58px; flex: none; font: 500 12.5px/1 var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.impact-bar { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--neg); box-shadow: 0 0 0 4px var(--neg-tint); }
.impact-bar.earn { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-tint); }
.ev-row-name { font: 500 13.5px/1.35 var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-row-meta { font: 400 12px/1.3 var(--sans); color: var(--faint); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-row-tag {
  flex: none; font: 600 10.5px/1 var(--mono); letter-spacing: .04em; padding: 6px 8px; border-radius: 6px;
  color: var(--text); background: color-mix(in srgb, var(--text) 7%, transparent);
}

.today-watch .watch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat-grid.month-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---------- Chart panel ---------- */

.chart-panel { padding: 0; overflow: hidden; border-radius: 18px; }
.chart-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.sym-strip {
  display: flex; gap: 8px; flex-basis: 100%; min-width: 0; padding-bottom: 14px; margin-bottom: 2px;
  border-bottom: 1px solid var(--line); touch-action: pan-x pan-y; overscroll-behavior-x: contain;
}
.add-chip { min-width: 40px; border-style: dashed; border-color: var(--line-3); color: var(--accent); }
.add-chip i { font-size: 14px; }
.chart-sym { font: 600 20px/1 var(--sans); letter-spacing: -.02em; }
.tf-row { display: flex; gap: 2px; margin-left: 8px; padding: 3px; border-radius: 10px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.tf { height: 28px; padding: 0 10px; border-radius: 7px; font: 500 11.5px/28px var(--mono); color: var(--faint); }
.tf:hover { color: var(--text); }
.tf.on { background: var(--accent-tint); color: var(--accent-ink); box-shadow: inset 0 0 0 1px var(--accent-line); }
.chart-note { font: 400 13px var(--sans); color: var(--muted); margin-left: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-ext { display: inline-grid; place-items: center; width: 32px; height: 32px; font-size: 16px; color: var(--muted); border-radius: 8px; }
.chart-ext:hover { color: var(--text); background: var(--surface-3); }
.chart-body { height: var(--chart-h, 322px); background: var(--chart-pane); transition: height .2s ease; }
.chart-resize { height: 14px; display: flex; align-items: center; justify-content: center; cursor: row-resize; touch-action: none; border-top: 1px solid var(--line); }
.chart-resize span { width: 40px; height: 4px; border-radius: 99px; background: var(--line-3); transition: background .15s, width .2s var(--ease-out); }
.chart-resize:hover span, .chart-resize:focus-visible span, .chart-panel.resizing .chart-resize span { background: var(--accent); width: 56px; }
.chart-resize:focus-visible { outline-offset: -2px; }
.chart-panel.resizing .chart-body { transition: none; }
.chart-panel.resizing iframe { pointer-events: none; }
.chart-body iframe, .tv-events iframe { width: 100%; height: 100%; border: 0; display: block; }

/* ---------- Tables ---------- */

.thead, .trow { display: grid; gap: 0 12px; align-items: center; }
.thead { font: 500 10.5px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); padding: 2px 12px 13px; border-bottom: 1px solid var(--line); }
.trow { padding: 14px 12px; border-bottom: 1px solid var(--line); font: 400 13px var(--sans); font-variant-numeric: tabular-nums; }
.trow:last-child { border-bottom: 0; }
/* A mid-size window onto the list: 8 rows, then scroll — the header stays put above it. */
.trow-scroll { max-height: 376px; overflow-y: auto; }
.trow:hover { background: color-mix(in srgb, var(--text) 3.5%, transparent); }
.trow:focus-visible { outline-offset: -2px; border-radius: 8px; }
.cols-recent { grid-template-columns: minmax(88px, 1.1fr) minmax(56px, .7fr) minmax(90px, 1fr) minmax(56px, .55fr) minmax(40px, .45fr) minmax(64px, .6fr); }
.cols-all { grid-template-columns: minmax(96px, .9fr) minmax(60px, .6fr) minmax(48px, .5fr) minmax(130px, 1.2fr) minmax(76px, .7fr) minmax(64px, .5fr) minmax(44px, .45fr) minmax(58px, .55fr); }
.cols-screen { display: grid; gap: 0 12px; align-items: center; grid-template-columns: minmax(72px, .75fr) minmax(48px, .5fr) minmax(52px, .5fr) minmax(62px, .7fr) minmax(56px, .6fr) minmax(56px, .55fr) minmax(64px, .6fr) minmax(62px, .6fr) minmax(40px, .35fr); }
.sym-cell { font-weight: 600; display: flex; align-items: center; gap: 10px; }
.tick { width: 3px; height: 18px; border-radius: 99px; flex: none; }
.srow { padding: 14px 12px; border-bottom: 1px solid var(--line); font: 400 13px var(--sans); font-variant-numeric: tabular-nums; }
.why { font: 400 12.5px/1.55 var(--sans); color: var(--muted); margin-top: 8px; max-width: 80ch; text-wrap: pretty; }

/* ---------- Month grid ---------- */

.month-head { display: flex; align-items: center; gap: 6px; margin: -4px 0 14px -6px; }
.month-total { font: 600 15px var(--sans); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.month-grid.sm { gap: 4px; }
.month-grid .dow { text-align: center; font: 500 10.5px var(--sans); letter-spacing: .06em; color: var(--faint); padding-bottom: 4px; }
.month-grid .day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 9px;
  font: 500 12px var(--mono); color: var(--faint); background: color-mix(in srgb, var(--text) 2.5%, transparent);
  font-variant-numeric: tabular-nums;
}
.month-grid.sm .day { font-size: 10.5px; aspect-ratio: auto; height: 32px; }
.month-grid .day.green { background: var(--day-green); color: var(--pos); box-shadow: inset 0 0 0 1px var(--pos-line); }
.month-grid .day.red { background: var(--day-red); color: var(--neg); box-shadow: inset 0 0 0 1px var(--neg-line); }
.month-grid .day.flat { background: var(--day-flat); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-2); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; font: 400 12px var(--sans); color: var(--faint); }
.legend span { display: flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.kv-list { display: flex; flex-direction: column; margin-top: 10px; }
.kv { display: flex; align-items: baseline; justify-content: space-between; padding: 11px 0; font: 400 13.5px var(--sans); }
.kv + .kv { border-top: 1px solid var(--line); }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Journal ---------- */

.journal-overview { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 40px; padding: 24px 26px; }
.jo-month .month-grid .day { aspect-ratio: auto; height: 46px; font-size: 12.5px; }
.jo-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-content: start; }
.mini-stat { padding: 14px 16px; border-radius: 12px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
/* What counts as a scratch — set where the outcomes are actually read. */
.jo-be { grid-column: 1 / -1; padding-top: 18px; border-top: 1px solid var(--line); }
.jo-be .micro { margin-bottom: 9px; }
.be-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font: 400 13.5px var(--sans); color: var(--muted); }
.be-field { display: inline-flex; align-items: center; gap: 4px; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.be-field .field { width: 78px; text-align: center; font-variant-numeric: tabular-nums; }
.be-apply { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.be-apply .ghost-btn.is-off { opacity: .5; cursor: not-allowed; }
.mini-stat-v { font: 600 20px/1.1 var(--sans); letter-spacing: -.025em; margin-top: 10px; font-variant-numeric: tabular-nums; }
.list-head { display: flex; align-items: center; gap: 16px; margin-bottom: -10px; }
.list-head .hint { margin-left: auto; }
.list-head .chips { min-width: 0; }
/* Phone equivalent of .trow-scroll: 8 cards, then scroll. */
.journal-cards-scroll { max-height: 590px; overflow-y: auto; }

/* Journal → docked watchlist, TradingView-style: journal left, a narrow panel on the right that stays put while you scroll. */
.journal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.journal-main { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
/* Pinned while the journal scrolls; on a short window the panel scrolls itself rather than running off-screen. */
.journal-side { position: sticky; top: 24px; min-width: 0; max-height: calc(100vh - 48px); overflow-y: auto; border-radius: 16px; scrollbar-width: thin; }
.jw-panel { padding: 0; overflow: hidden; }
.jw-head { display: flex; align-items: center; gap: 8px; padding: 14px 12px 12px 16px; }
.jw-count { font: 500 11px/1 var(--mono); color: var(--faint); padding: 4px 6px; border-radius: 6px; background: color-mix(in srgb, var(--text) 6%, transparent); }
.jw-cols {
  display: flex; padding: 7px 16px; border-block: 1px solid var(--line);
  font: 500 10.5px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--faint);
}
/* Thirteen rows before it scrolls; each row is a fixed 38px, dividers drawn inside it. */
.jw-list { --jw-row: 38px; max-height: calc(var(--jw-row) * 13); overflow-y: auto; }
.jw-row {
  width: 100%; display: flex; align-items: center; gap: 9px; height: var(--jw-row); padding: 0 12px 0 14px; box-sizing: border-box;
  text-align: left; border-left: 2px solid transparent; transition: background .12s;
}
.jw-item + .jw-item { border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.jw-row:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.jw-item.open .jw-row { background: var(--accent-tint); border-left-color: var(--accent); }
.jw-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.jw-caret { flex: none; font-size: 13px; color: var(--faint); transition: transform .2s var(--ease-out); }
.jw-item.open .jw-caret { transform: rotate(180deg); color: var(--text); }
/* Clicking a market opens its options in place, like the cards on phone and tablet. */
.jw-body { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px 14px; background: var(--surface-2); }
.jw-body-actions { display: flex; gap: 8px; }
.jw-body-actions .ghost-btn { flex: 1; }
.jw-body .field.jw-note { min-height: 76px; }
.jw-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--faint); }
.jw-dot.long { background: var(--pos); }
.jw-dot.short { background: var(--neg); }
.jw-sym { flex: none; font: 600 13px/1 var(--sans); color: var(--text); }
.jw-rnote { flex: 1; min-width: 0; font: 400 11.5px/1.2 var(--sans); color: var(--faint); }
.jw-row .watch-bias.pill { flex: none; }
.jw-bias { gap: 6px; }
.field.jw-note { line-height: 1.45; }
.jw-empty { padding: 4px 16px 18px; }

/* Phone & tablet watchlist: cards matching the trade cards, expanding in place. */
.journal-trades { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.jwm-top { display: flex; align-items: center; gap: 8px; min-height: 28px; margin-bottom: 10px; }
.jwm-list { display: flex; flex-direction: column; gap: 10px; }
.jwm-card { border-radius: 14px; background: var(--surface); box-shadow: var(--card-shadow); transition: box-shadow .2s; }
.jwm-card.open { box-shadow: var(--card-shadow), inset 0 0 0 1px var(--accent-line); }
.jwm-head { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px; text-align: left; border-radius: 14px; }
.jwm-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.jwm-head .trade-sub { display: block; }
.jwm-head .trade-line .muted6 { min-width: 0; }
.jwm-bar { background: color-mix(in srgb, var(--text) 22%, transparent); }
.jwm-bar.long { background: var(--pos); }
.jwm-bar.short { background: var(--neg); }
.jwm-head .watch-bias.pill { flex: none; }
.jwm-caret { flex: none; font-size: 14px; color: var(--faint); transition: transform .2s var(--ease-out); }
.jwm-card.open .jwm-caret { transform: rotate(180deg); color: var(--text); }
/* Body lines up with the text, past the colour bar. */
.jwm-body { display: flex; flex-direction: column; gap: 12px; padding: 0 14px 14px 29px; }
.jwm-body .field.jw-note { min-height: 88px; }
.jwm-actions { display: flex; gap: 8px; }
.jwm-actions .ghost-btn { flex: 1; }
/* The picked bias takes its direction's colour, so the board reads at a glance. */
.chip.on.bias-long { color: var(--pos); border-color: color-mix(in srgb, var(--pos) 40%, transparent); background: var(--pos-tint); }
.chip.on.bias-short { color: var(--neg); border-color: var(--neg-line); background: var(--neg-tint); }
.chip.on.bias-neutral { color: var(--text); border-color: var(--line-3); background: color-mix(in srgb, var(--text) 8%, transparent); }

.trade-card {
  display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px;
  background: var(--surface); box-shadow: var(--card-shadow); transition: box-shadow .2s, transform .25s var(--ease-out);
}
.trade-card:hover { box-shadow: var(--lift-shadow); }
.trade-bar { width: 3px; align-self: stretch; border-radius: 99px; flex: none; }
.trade-line { display: flex; align-items: center; gap: 8px; font: 400 12px var(--sans); }
.trade-sym { font: 600 14.5px var(--sans); color: var(--text); }
.trade-sub { font: 400 12px var(--sans); color: var(--faint); margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trade-r { flex: none; text-align: right; font: 600 15px var(--sans); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.trade-max { font: 400 11px var(--mono); color: var(--faint); margin-top: 4px; }
.trade-warn { flex: none; font-size: 15px; color: var(--neg); }

/* ---------- Analysis ---------- */

.range-chips { margin-bottom: -6px; }
.panel.equity-panel { position: relative; overflow: hidden; isolation: isolate; padding: 26px 28px 22px; }
.equity-panel::after {
  content: ""; position: absolute; z-index: -1; left: -120px; top: -160px; width: 520px; height: 360px; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent-deep) 16%, transparent), transparent);
}
.equity-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.equity-toggle { justify-content: flex-end; margin-bottom: 8px; }
.big-r { font: 600 46px/1 var(--sans); margin-top: 12px; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.balance { font: 600 22px/1 var(--sans); margin-top: 12px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.bars { display: flex; align-items: flex-end; gap: 14px; margin-top: 18px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; }
.bar-v { font: 600 11.5px var(--sans); font-variant-numeric: tabular-nums; }
.bar-fill { width: 100%; max-width: 46px; border-radius: 7px 7px 3px 3px; background-image: linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, 0) 70%); }
.bar-l { font: 400 11.5px var(--sans); color: var(--faint); white-space: nowrap; }
.bar-yr { margin-left: 3px; opacity: .62; }
/* Months run on a fixed pitch and scroll sideways, so a long record stays readable. */
.month-bars { gap: 10px; padding-bottom: 2px; }
.month-bars .bar { flex: 0 0 46px; }
.month-bars .bar-fill { max-width: 34px; }
.month-bars .bar-empty .bar-fill { background: color-mix(in srgb, var(--text) 12%, transparent); }
.insight {
  margin-top: 18px; padding: 13px 15px; border-radius: 12px; background: var(--accent-tint); box-shadow: inset 0 0 0 1px var(--accent-line);
  font: 400 13px/1.6 var(--sans); color: var(--text); text-wrap: pretty;
}
.insight i { margin-right: 8px; color: var(--accent); vertical-align: -2px; }

/* ---------- Triple EMA & snapshots ---------- */

.panel-head .switch { align-self: center; }
.ema-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 10px 10px 14px; border-radius: 12px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.ema-row.on { box-shadow: inset 0 0 0 1px var(--line-2); }
.ema-line { width: 22px; height: 4px; border-radius: 99px; flex: none; }
.ema-role { width: 56px; font: 600 13px var(--sans); color: var(--muted); }
.ema-row.on .ema-role { color: var(--text); }
.ema-period { display: flex; align-items: center; gap: 8px; font: 500 11px var(--mono); color: var(--faint); letter-spacing: .04em; }
.ema-period input {
  width: 64px; height: 32px; padding: 0 9px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line-2);
  color: var(--text); font: 500 13px var(--mono); font-variant-numeric: tabular-nums;
}
.ema-period input:hover { border-color: var(--line-3); }
.ema-period input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.ema-colors { display: flex; gap: 6px; margin-left: auto; }
.ema-swatch { width: 20px; height: 20px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); }
.ema-swatch.on { box-shadow: 0 0 0 2px var(--surface-2), 0 0 0 4px var(--accent); }
.ema-opacity { flex-basis: 100%; display: flex; align-items: center; gap: 12px; padding: 2px 0 2px 34px; }
.ema-opacity .micro { margin: 0; font-size: 10px; }
.ema-opacity input { flex: 1; min-width: 0; accent-color: var(--accent-deep); height: 16px; }
.ema-opacity-v { width: 38px; text-align: right; font: 500 11.5px var(--mono); color: var(--muted); }
.panel-head.collapsible { align-items: center; }
.panel-head.collapsible.closed { margin-bottom: 0; }
.collapse-btn { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; padding: 2px 0; }
.collapse-btn i { align-self: center; font-size: 13px; color: var(--faint); }
.collapse-btn:hover .title-sm { color: var(--accent-ink); }
.snap-edit { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; padding: 14px; border-radius: 12px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--accent-line); }
.snap-edit-row { display: flex; align-items: center; gap: 10px; }
.snap-role { width: 72px; flex: none; font: 500 12px var(--sans); color: var(--muted); }
.tool-row { display: flex; gap: 10px; }
.tool-cell {
  flex: 1; min-height: 76px; border-radius: 12px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; color: var(--faint); font: 400 11.5px var(--sans);
}
.tool-tf { font: 600 18px/1 var(--mono); color: var(--text); }
.tool-cell:hover { box-shadow: inset 0 0 0 1px var(--line-3); }
.tool-cell.on { background: var(--accent-tint); box-shadow: inset 0 0 0 1px var(--accent-line); color: var(--accent); }
.tool-cell.on .tool-tf { color: var(--accent-ink); }

/* ---------- Calendar ---------- */

.cal-toolbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: -6px; }
.cal-toolbar .chips { min-width: 0; }
.scope { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.day-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.day-cell {
  min-width: 0; padding: 14px 16px 13px; display: grid; grid-template-columns: auto 1fr; grid-template-areas: "dow dots" "n dots" "sum sum";
  align-items: center; gap: 4px 10px; text-align: left;
  border-radius: 14px; background: var(--surface); color: var(--muted); box-shadow: var(--card-shadow);
}
.day-cell:hover { box-shadow: var(--lift-shadow); }
.day-cell.on {
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent-deep) 18%, var(--surface)), var(--surface) 80%);
  box-shadow: inset 0 0 0 1px var(--accent-line), 0 18px 40px -26px color-mix(in srgb, var(--accent-deep) 90%, transparent);
}
.day-cell-dow { grid-area: dow; font: 500 10.5px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.day-cell.today .day-cell-dow::after { content: " · today"; color: var(--accent); }
.day-cell-n { grid-area: n; font: 600 26px/1.15 var(--sans); letter-spacing: -.03em; color: var(--text); font-variant-numeric: tabular-nums; }
.day-dots { grid-area: dots; justify-self: end; display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: 52px; }
.day-dots i { width: 6px; height: 6px; border-radius: 99px; background: var(--neg); }
.day-dots i.earn { background: var(--accent); }
.day-cell-sum { grid-area: sum; margin-top: 6px; font: 400 12px var(--sans); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; align-items: start; }
.cal-columns.single { grid-template-columns: minmax(0, 1fr); }
.cal-columns.single .stack8 { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.ev-card { padding: 16px 18px; border-radius: 14px; background: var(--surface); box-shadow: var(--card-shadow); }
.ev-card-top { display: flex; align-items: center; gap: 10px; }
.ev-card-time { font: 500 12.5px var(--mono); color: var(--text); font-variant-numeric: tabular-nums; }
.ccy-pill, .ticker-pill { font: 600 10.5px/1 var(--mono); letter-spacing: .04em; padding: 5px 7px; border-radius: 6px; color: var(--text); background: color-mix(in srgb, var(--text) 7%, transparent); }
.ticker-pill { color: var(--accent-ink); background: var(--accent-tint); box-shadow: inset 0 0 0 1px var(--accent-line); }
.ev-impact { display: inline-flex; align-items: center; gap: 7px; font: 500 11.5px var(--sans); color: var(--neg); }
.ev-impact::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--neg); box-shadow: 0 0 0 3px var(--neg-tint); }
.cap-tag { font: 500 11.5px var(--mono); color: var(--muted); }
.watch-tag { display: inline-flex; align-items: center; gap: 5px; font: 500 11.5px var(--sans); color: var(--accent); }
.watch-tag i { font-size: 12px; }
.earn-card.watched { box-shadow: inset 0 0 0 1px var(--accent-line); }
.ev-card-name { font: 500 15px/1.4 var(--sans); letter-spacing: -.005em; margin-top: 12px; text-wrap: pretty; }
.ev-card-foot { display: flex; gap: 24px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.ev-card-foot .micro { margin: 0; font-size: 10px; }
.ev-card-v { font: 500 13px var(--mono); margin-top: 5px; font-variant-numeric: tabular-nums; }
.tv-events { height: 560px; margin-top: 8px; border-radius: 14px; overflow: hidden; box-shadow: var(--card-shadow); }

/* ---------- Screener ---------- */

.sample-flag {
  display: flex; align-items: center; gap: 10px; margin: -2px 0 14px; padding: 10px 13px; border-radius: 10px;
  background: var(--accent-tint); box-shadow: inset 0 0 0 1px var(--accent-line); font: 400 12.5px/1.5 var(--sans); color: var(--muted);
}
.sample-flag i { color: var(--accent); font-size: 16px; flex: none; }
.score-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.score-row input[type="range"] { flex: 0 1 240px; accent-color: var(--accent-deep); }
.score-v { font: 600 12.5px var(--mono); color: var(--accent-ink); min-width: 20px; }
.crit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.crit-card { border-radius: 14px; background: var(--surface); box-shadow: var(--card-shadow); overflow: hidden; }
.crit-card.on { box-shadow: inset 0 0 0 1px var(--accent-line); }
.crit-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.crit-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; font-size: 16px; color: var(--faint); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); flex: none; }
.crit-card.on .crit-icon { color: var(--accent); background: var(--accent-tint); box-shadow: inset 0 0 0 1px var(--accent-line); }
.crit-body { flex: 1; min-width: 0; }
.crit-label { font: 600 13.5px var(--sans); }
.crit-sum { font: 400 12px var(--sans); color: var(--muted); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crit-rows { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 14px; border-top: 1px solid var(--line); }
.crit-row-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.crit-row-head .micro { margin: 0; }

/* ---------- Watchlist sheet ---------- */

.watch-add-row { display: flex; align-items: flex-end; gap: 10px; }
.watch-add-row .add-btn { height: 40px; flex: none; }
.watch-msg { display: flex; align-items: center; gap: 8px; margin-top: -6px; font: 400 12.5px var(--sans); color: var(--accent); }
.watch-msg.error { color: var(--neg); }
.watch-msg.picked { color: var(--pos); }
.quick-chip i { font-size: 11px; color: var(--accent); }
.watch-list > div { gap: 10px; padding: 11px 10px 11px 14px; }
.watch-bias.pill { padding: 4px 7px; font-size: 10.5px; }
.remove-btn { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 8px; font: 500 12px var(--sans); color: var(--muted); border: 1px solid var(--line-2); }
.watch-list .remove-btn i { font-size: 13px; color: var(--faint); }
.remove-btn:hover { border-color: var(--neg-line); color: var(--neg); background: var(--neg-tint); }
.watch-list .remove-btn:hover i { color: var(--neg); }
.combo { position: relative; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 5; max-height: 320px; overflow-y: auto; padding: 6px; border-radius: 12px; background: var(--surface-2); box-shadow: var(--pop-shadow); }
.suggest-row { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "ticker ex" "desc desc"; gap: 3px 10px; padding: 9px 11px; border-radius: 8px; text-align: left; }
.suggest-row.on, .suggest-row:hover { background: var(--accent-tint); }
.suggest-ticker { grid-area: ticker; font: 600 13px var(--sans); }
.suggest-ex { grid-area: ex; justify-self: end; font: 500 11px var(--mono); color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.suggest-desc { grid-area: desc; font: 400 12px var(--sans); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest-empty { padding: 11px; font: 400 12.5px/1.45 var(--sans); color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 16px; padding: 12px 14px 12px 16px; border-radius: 12px;
  background: color-mix(in srgb, var(--surface-3) 94%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: var(--pop-shadow); font: 400 13.5px var(--sans); white-space: nowrap; animation: fadeIn .3s ease;
}
.toast .link-btn { font-size: 13px; font-weight: 600; }

/* ---------- Dialogs ---------- */

.scrim {
  position: fixed; inset: 0; z-index: 50; background: var(--scrim);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 48px 20px;
}
.modal {
  position: relative; width: 100%; max-width: 600px; max-height: 100%; overflow-y: auto;
  background: var(--surface); border-radius: 22px; box-shadow: var(--frame-shadow); padding: 24px 28px 28px;
}
.modal:focus { outline: none; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.modal-title-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.modal-title { font: 600 22px/1.2 var(--sans); letter-spacing: -.025em; }
.meta { font: 400 12.5px var(--sans); color: var(--muted); margin-top: 6px; }
.close-btn { width: 36px; height: 36px; flex: none; border-radius: 10px; border: 1px solid var(--line-2); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 15px; }
.close-btn:hover { border-color: var(--line-3); color: var(--text); background: color-mix(in srgb, var(--text) 4%, transparent); }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 20px; }
.kpi { padding: 14px 10px; border-radius: 12px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); text-align: center; }
.kpi .micro { font-size: 10px; }
.kpi-v { font: 600 17px var(--sans); letter-spacing: -.02em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.shot-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.shot { display: block; min-width: 0; color: inherit; }
.shot-box {
  position: relative; height: 96px; border-radius: 12px; overflow: hidden; border: 1px dashed var(--line-3); background: var(--surface-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--faint); font: 400 10.5px var(--sans); padding: 0 10px; text-align: center;
}
.shot-box span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shot-box i { font-size: 19px; }
.shot-box img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
a.shot:hover .shot-box { border-color: var(--accent-line); }
.shot-foot { display: flex; justify-content: space-between; align-items: baseline; margin-top: 8px; font: 500 12px var(--sans); color: var(--muted); }
.shot-foot .acc3 { font-family: var(--mono); font-size: 11.5px; }
.crit-line { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-radius: 10px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); font: 400 13px var(--sans); color: var(--faint); }
.crit-line i { font-size: 16px; color: var(--faint); }
.crit-line.ok { color: var(--text); }
.crit-line.ok i { color: var(--pos); }
.mistake { font: 500 11.5px var(--sans); padding: 6px 10px; border-radius: 7px; background: var(--neg-tint); color: var(--neg); box-shadow: inset 0 0 0 1px var(--neg-line); }
.mini-card { padding: 13px 14px; border-radius: 12px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.mini-card .micro { font-size: 10px; margin-bottom: 7px; }
.notes { font: 400 13.5px/1.6 var(--sans); color: var(--text); white-space: pre-wrap; }
.modal-actions { display: flex; gap: 10px; margin-top: 22px; }
.steps { display: flex; gap: 6px; margin-top: 18px; }
.steps div { flex: 1; height: 4px; border-radius: 99px; }
.plan-hint { font: 400 13.5px/1.6 var(--sans); color: var(--muted); margin-top: 14px; }
.form { margin-top: 20px; display: flex; flex-direction: column; gap: 18px; }
.form label { display: block; }
.sym-input { width: 104px; min-height: 34px; }
.tf-custom { width: 68px; min-height: 30px; text-transform: uppercase; text-align: center; }
.tf-custom::placeholder { text-transform: none; }
.tf-card { padding: 12px 8px; border-radius: 12px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); text-align: center; }
.tf-card .micro { font-size: 10px; letter-spacing: .08em; }
.tf-card-v { font: 600 16px var(--mono); margin-top: 7px; color: var(--accent-ink); }
.link-field { display: flex !important; align-items: center; gap: 10px; padding: 4px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-2); cursor: text; transition: border-color .15s, box-shadow .2s; }
.link-field.on { border-color: var(--accent-line); }
.link-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-tint); }
.lf-role { font: 500 12px var(--sans); color: var(--muted); width: 76px; flex: none; }
.lf-tf { font: 500 11.5px var(--mono); color: var(--accent); width: 34px; flex: none; }
.link-field input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 8px 0; font: 400 13px var(--sans); color: var(--text); }
.link-field input::placeholder { color: var(--faint); }
.link-field input:focus-visible { outline: none; }
.lf-icon { font-size: 16px; color: var(--faint); flex: none; }
.link-field.on .lf-icon { color: var(--pos); }
.crit-toggle { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-2); font: 400 13px var(--sans); color: var(--text); }
.crit-toggle:hover { border-color: var(--line-3); }
.crit-toggle i { font-size: 17px; color: var(--faint); }
.crit-toggle.on { border-color: var(--pos-line); background: color-mix(in srgb, var(--pos) 6%, var(--surface-2)); }
.crit-toggle.on i { color: var(--pos); }
.summary { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 12px; background: var(--accent-tint); box-shadow: inset 0 0 0 1px var(--accent-line); font: 400 13px/1.5 var(--sans); color: var(--text); }
.summary > i { font-size: 18px; color: var(--accent); flex: none; }
.num-input { width: 100%; border: 0; background: transparent; padding: 2px 0; font: 600 28px/1.15 var(--sans); letter-spacing: -.03em; color: var(--text); border-bottom: 1px solid transparent; border-radius: 0; font-variant-numeric: tabular-nums; }
.num-input:hover { border-bottom-color: var(--line-2); }
.num-input:focus-visible { outline: none; border-bottom-color: var(--accent); }
.stepper { display: flex; gap: 6px; margin-top: 10px; }
.step-btn { flex: 1; height: 34px; border-radius: 8px; border: 1px solid var(--line-2); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }
.step-btn:hover { border-color: var(--accent-line); color: var(--accent-ink); background: var(--accent-tint); }
.block-list { display: flex; flex-direction: column; border-radius: 12px; overflow: hidden; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.block-list > div { display: flex; align-items: center; gap: 12px; padding: 12px 14px; font: 400 13px var(--sans); }
.block-list > div + div { border-top: 1px solid var(--line); }
.block-list i { font-size: 16px; color: var(--pos); }
.block-list .push { font-size: 12px; }
.export-card { display: flex !important; align-items: center; gap: 12px; padding: 14px; border-radius: 12px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; text-align: left; }
.export-card:hover { box-shadow: inset 0 0 0 1px var(--accent-line); }
.export-card:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.export-card > i { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; font-size: 17px; color: var(--accent); background: var(--accent-tint); flex: none; }
.ex-l { font: 600 13px var(--sans); }
.ex-s { font: 400 12px var(--sans); color: var(--faint); margin-top: 3px; }

/* Account */
.account-card { display: flex; align-items: center; gap: 14px; margin-top: 20px; padding: 16px; border-radius: 14px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.account-card .avatar { width: 46px; height: 46px; font-size: 17px; flex: none; cursor: default; }
.account-name { display: flex; align-items: center; gap: 8px; font: 600 15px var(--sans); }
.account-email { font: 400 13px var(--sans); color: var(--muted); overflow-wrap: anywhere; margin-top: 3px; }
.role-tag { font: 500 10px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--accent-ink); background: var(--accent-tint); box-shadow: inset 0 0 0 1px var(--accent-line); padding: 5px 8px; border-radius: 99px; flex: none; }
.account-card .ghost-btn { margin-left: auto; flex: none; }

/* ---------- Responsive ---------- */

@media (max-width: 1240px) {
  .topbar { padding-inline: 32px; }
  .main { padding-inline: 32px; }
  .today-top { grid-template-columns: minmax(0, 1.35fr) minmax(290px, 1fr); }
  .stat-grid, .stat-grid.month-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Small desktops: with the watchlist docked, the journal column is too narrow for calendar and stats side by side. */
@media (min-width: 1025px) and (max-width: 1240px) {
  .journal-main .journal-overview { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .journal-layout { grid-template-columns: minmax(0, 1fr) 280px; }
}

/* Phone and tablet widths: bottom tab bar, the mobile page layouts, dialogs as bottom sheets. */
@media (max-width: 1024px) {
  .d-only { display: none !important; }
  .m-only { display: block !important; }
  .circle-btn.m-only { display: flex !important; }

  .rail {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; width: auto; height: auto; z-index: 40;
    display: grid; grid-template-columns: repeat(6, 1fr); gap: 0;
    padding: 8px 4px calc(10px + env(safe-area-inset-bottom));
    background: var(--nav-bg); -webkit-backdrop-filter: saturate(160%) blur(18px); backdrop-filter: saturate(160%) blur(18px);
    border-right: 0; border-top: 1px solid var(--line);
  }
  .brand, .rail-foot { display: none; }
  .rail-tab { width: auto; min-height: 48px; padding: 7px 0 6px; gap: 5px; justify-content: flex-start; border-radius: 12px; }
  .rail-tab i { font-size: 22px; line-height: 22px; height: 22px; display: block; }
  .rail-tab span { font: 500 10.5px/1 var(--sans); }
  .rail-tab:hover { background: transparent; }
  .rail-tab.on { background: transparent; box-shadow: none; color: var(--accent); }
  .rail-tab.on::before { left: 50%; top: -9px; width: 24px; height: 3px; transform: translateX(-50%); border-radius: 0 0 3px 3px; }
  .workspace { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .workspace::before { top: -260px; opacity: .45; }

  .topbar { padding: 24px 20px 2px; gap: 12px; align-items: flex-start; }
  body[data-tab="chart"] .topbar { display: none; }
  .kicker { font-size: 10.5px; margin-bottom: 10px; }
  .view-title { font-size: 28px; }
  .page-sub { font-size: 13.5px; margin-top: 6px; }
  .topbar-actions { gap: 8px; }
  .topbar-actions .circle-btn { width: 38px; height: 38px; }
  .circle-btn.avatar-m { border: 0; border-radius: 50%; font: 600 14px/1 var(--sans); color: #f5f4ff; background: linear-gradient(145deg, #6a5fa8, #262a60); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16); }

  .main { padding: 18px 20px 30px; gap: 30px; }
  #view { gap: 20px; }
  .panel { padding: 16px; border-radius: 14px; }
  .stat-card { padding: 14px 14px 13px; border-radius: 12px; }
  .stat-v { font-size: 21px; margin-top: 10px; }
  .kpi-grid, .shot-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row-today, .row-half, .crit-grid { grid-template-columns: minmax(0, 1fr); }
  .stat-grid, .stat-grid.month-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .ema-colors { margin-left: 0; }
  .section-head { margin-bottom: 12px; align-items: baseline; }
  .section-title { font-size: 15px; }

  /* Today: coach, watchlist (four markets), today's events, plan a trade, month stats. */
  .today-top { grid-template-columns: minmax(0, 1fr); grid-template-areas: "coach" "watch" "events" "plan"; gap: 26px; }
  .today-plan { display: block; grid-area: plan; margin-top: -8px; }
  .coach { padding: 16px; border-radius: 16px; }
  .coach-card { gap: 12px; }
  .coach-icon { width: 34px; height: 34px; border-radius: 10px; font-size: 16px; }
  .coach-h { margin: 0 0 8px; }
  .coach p { font-size: 14px; line-height: 1.6; }
  .watch-grid, .today-watch .watch-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .watch-row, .watch-edit { padding: 13px 14px; }
  .watch-row:hover { transform: none; }
  .watch-row.on { background: var(--surface); }
  .watch-note { margin-top: 8px; }
  .ev-stack { padding: 2px 16px; border-radius: 14px; }
  .ev-row { padding: 13px 0; gap: 12px; }
  .ev-row-time { width: 52px; }
  .month-card .section-title { margin-bottom: 2px; }
  .toast { bottom: calc(90px + env(safe-area-inset-bottom)); }

  /* Chart: watchlist symbols above a full-bleed chart. */
  body[data-tab="chart"] .main { padding-top: 12px; }
  .chart-panel { margin: 0 -20px; border-radius: 0; box-shadow: none; background: transparent; overflow: visible; }
  .chart-head { padding: 0 20px 12px; gap: 8px 10px; border-bottom: 0; }
  .sym-strip { flex-basis: calc(100% + 40px); margin: 0 -20px 8px; padding: 4px 20px; border-bottom: 0; }
  .chart-sym { order: 1; font-size: 24px; letter-spacing: -.03em; }
  .chart-head .bias-pill { order: 2; margin-left: auto; }
  .chart-note { order: 3; flex-basis: 100%; margin-left: 0; white-space: normal; }
  .tf-row { order: 4; margin: 4px 0 0; }
  .chart-ext { display: none; }
  .chart-body { height: 420px; border-block: 1px solid var(--line); }
  .chart-resize { display: none; }

  /* Calendar: filters, a swipeable day strip, then one column of cards. */
  .cal-toolbar { gap: 10px; }
  .scope { margin-left: 0; }
  .day-strip { display: flex; gap: 8px; padding: 2px 0 4px; }
  .day-cell { flex: none; width: 62px; padding: 10px 0 9px; display: flex; flex-direction: column; align-items: center; gap: 0; text-align: center; border-radius: 12px; }
  .day-cell:hover { box-shadow: var(--card-shadow); }
  .day-cell-dow { font-size: 10px; }
  .day-cell.today .day-cell-dow::after { content: ""; }
  .day-cell-n { font-size: 18px; margin-top: 5px; }
  .day-dots { height: 5px; margin-top: 6px; max-width: none; justify-content: center; flex-wrap: nowrap; gap: 3px; }
  .day-dots i { width: 5px; height: 5px; }
  .day-cell-sum { display: none; }
  .cal-columns, .cal-columns.single { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .cal-columns.single .stack8 { display: flex; flex-direction: column; gap: 10px; }
  .ev-card { padding: 14px; border-radius: 12px; }
  .ev-card-name { font-size: 14px; }

  /* Journal: month card, then filters and trade cards. */
  .journal-overview { grid-template-columns: minmax(0, 1fr); padding: 16px; gap: 0; }
  .jo-month .month-grid .day { aspect-ratio: 1; height: auto; font-size: 11px; border-radius: 8px; }
  .list-head { margin-bottom: -6px; }
  .list-head .section-title { display: none; }

  .panel.equity-panel { padding: 18px 16px 16px; }
  .big-r { font-size: 34px; }
  .balance { font-size: 18px; }

  .scrim { align-items: flex-end; padding: 0; }
  .modal { max-width: none; max-height: 92%; border-radius: 24px 24px 0 0; padding: 22px 20px calc(28px + env(safe-area-inset-bottom)); }
  .modal::before { left: 50%; right: auto; top: 8px; width: 40px; height: 4px; border-radius: 99px; transform: translateX(-50%); background: var(--line-3); }
  .modal.fade { animation: riseIn .34s var(--ease-out) both; }
  .account-card { flex-wrap: wrap; }
  .account-card .ghost-btn { width: 100%; margin-left: 0; }
}

/* Tablet: the phone layout in a centred column, so cards keep phone-like proportions. */
@media (min-width: 768px) and (max-width: 1024px) {
  .topbar, .main { max-width: 760px; }
  .topbar { padding: 30px 26px 4px; }
  .main { padding-inline: 26px; }
  .chart-panel { margin-inline: -26px; }
  .chart-head { padding-inline: 26px; }
  .sym-strip { flex-basis: calc(100% + 52px); margin-inline: -26px; padding-inline: 26px; }
  .chart-body { height: 540px; }
  .view-title { font-size: 32px; }
  .month-grid .day, .jo-month .month-grid .day { aspect-ratio: auto; height: 52px; font-size: 12.5px; }
  .rail { grid-template-columns: repeat(6, minmax(0, 104px)); justify-content: center; }
  .scrim { justify-content: center; }
  .modal { max-width: 640px; }
  .toast { bottom: 100px; }
}

/* Journal on phone & tablet: the month spans the width, then trades and watchlist split the row beneath it.
   Sits after the main mobile block so it wins over the single-column list-head rules there. */
@media (max-width: 1024px) {
  .journal-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 12px; }
  .journal-main { display: contents; }
  .journal-main > .demo-note, .journal-main > .journal-overview { grid-column: 1 / -1; }
  .journal-trades { gap: 10px; container: jcol / inline-size; }
  .journal-side { position: static; max-height: none; overflow: visible; container: jcol / inline-size; }
  /* Both columns share one head shape — a 28px title row, then a chip row — so their cards line up row for row. */
  .journal-layout .list-head { flex-direction: column; align-items: stretch; gap: 10px; margin-bottom: 10px; }
  .journal-trades > .list-head { margin-bottom: 0; }
  .journal-layout .list-head .section-title { display: flex; align-items: center; min-height: 28px; }
  .journal-layout .jwm-top { min-height: 28px; margin-bottom: 0; }
  .journal-layout .list-head .chip.lg { height: 32px; padding: 0 11px; font-size: 12px; border-radius: 8px; }
  /* Both columns show eight cards, then scroll. Cards get a set height so "eight" holds at every width.
     No scrollbar gutter (it made cards narrower than the column and ragged on the right), and a 1px inset
     so the cards' hairline border isn't clipped by the scroll edge — every card edge reads the same. */
  .journal-cards-scroll, .jwm-list {
    --jcard: 65px; --jgap: 10px; gap: var(--jgap); padding: 1px; max-height: calc(var(--jcard) * 8 + var(--jgap) * 7 + 2px);
    overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
  }
  .journal-cards-scroll::-webkit-scrollbar, .jwm-list::-webkit-scrollbar { display: none; }
  .journal-cards-scroll .trade-card, .jwm-head { box-sizing: border-box; min-height: var(--jcard); }
}
@media (min-width: 768px) and (max-width: 1024px) {
  .journal-layout { column-gap: 16px; }
}
/* Phones: the balance toggle and figure don't fit beside the big R, and the panel clips overflow.
   Toggle gets its own full-width row; cumulative R and the balance share the line beneath it. */
@media (max-width: 767px) {
  /* Labels share one line, figures share the next, bottoms aligned. */
  .equity-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "toggle toggle" "rl bl" "rv bv"; gap: 0 12px; align-items: end; }
  .equity-head .eq-side, .equity-head .eq-r, .equity-head .eq-bal { display: contents; }
  .equity-head .eq-r > .micro { grid-area: rl; }
  .equity-head .eq-r > .big-r { grid-area: rv; }
  .equity-head .eq-bal > .micro { grid-area: bl; text-align: right; }
  .equity-head .eq-bal > .balance { grid-area: bv; text-align: right; }
  .equity-toggle { grid-area: toggle; margin-bottom: 16px; }
  .equity-toggle .chip { flex: 1; }
}
/* A column narrower than ~260px (phones): cards drop their secondary lines and stack their controls. */
@container jcol (max-width: 260px) {
  .journal-cards-scroll, .jwm-list { --jcard: 56px; }
  /* Two lines: symbol and R on top, direction and date beneath. */
  .trade-card {
    display: grid; grid-template-columns: 3px auto minmax(0, 1fr) auto; column-gap: 8px; row-gap: 3px; padding: 11px 10px;
    grid-template-areas: "bar sym sym r" "bar dir date date";
  }
  .trade-card > .grow, .trade-card .trade-line { display: contents; }
  .trade-card .trade-bar { grid-area: bar; }
  .trade-card .trade-sym { grid-area: sym; font-size: 13.5px; line-height: 1.2; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .trade-card .trade-line > :nth-child(2) { grid-area: dir; font-size: 11.5px; }
  .trade-card .trade-line > :nth-child(3) { grid-area: date; font-size: 11.5px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .trade-card .trade-r { grid-area: r; font-size: 13px; align-self: center; }
  .trade-card .trade-sub, .trade-card .trade-max, .trade-card .trade-warn { display: none; }
  .jwm-head { gap: 8px; padding: 11px 10px; }
  .jwm-head .trade-sub, .jwm-head .trade-line .muted6, .jwm-caret { display: none; }
  .jwm-head .trade-sym { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
  .jwm-body { padding: 0 10px 10px; gap: 8px; }
  .jwm-body .jw-bias, .jwm-actions { flex-direction: column; align-items: stretch; }
  .jwm-body .chip { height: 30px; }
  .jwm-body .field.jw-note { min-height: 72px; }
}

@media (prefers-reduced-motion: reduce) {
  .fade, #view.fade, #viewTop.fade, .modal.fade, .toast { animation: none; }
  [data-action]:active { transform: none; }
  .watch-row:hover { transform: none; }
}
