/* Tr8er design system: dark trading terminal, light scheme follows the OS.
   Semantic color is reserved: green = gain/BUY, red = loss/SELL, amber = caution.
   Accent blue is for interactive state only. Spacing runs on a 4px scale, radii on 8/12/16. */

:root {
  color-scheme: dark;
  --bg: #070a12; --bg2: #0b101c;
  --panel: #10182a; --panel2: #162036; --panel3: #1f2c46;
  --line: rgba(148,163,184,.13); --line2: rgba(148,163,184,.24);
  --text: #e9edf6; --dim: #9aa6bd; --faint: #8794ad;
  /* chart series (dataviz palette, dark steps; validated on --panel #10182a). Not --s1..: that's the spacing scale */
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  --accent: #4f8bff; --accent2: #86b0ff; --accent-solid: #2a63e0;
  --green: #26d07c; --green-bg: rgba(38,208,124,.13);
  --red: #ff5f57; --red-bg: rgba(255,95,87,.13); --danger-solid: #d6342c;
  --amber: #ffb648; --amber-bg: rgba(255,182,72,.15);
  --cash: #5b6b88;
  --r-s: 8px; --r-m: 12px; --r-l: 16px;
  --radius: var(--r-l); --radius-s: var(--r-s);
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --shadow: 0 8px 28px rgba(2,6,16,.55);
  --elev1: 0 1px 0 rgba(255,255,255,.03) inset, 0 1px 2px rgba(2,6,16,.35);
  --card-bg: linear-gradient(180deg, rgba(24,35,56,.62), rgba(16,24,42,.92));
  --glass: rgba(9,13,23,.82);
  --chart-text: #8794ad; --chart-grid: rgba(148,163,184,.07);
  --bucket-ETF_CORE: #4f8bff;
  --bucket-LONG_HOLD: #35c4c8;
  --bucket-INDIVIDUAL: #a78bfa;
  --bucket-POLITICIAN: #fb7185;
  --bucket-CRYPTO: #f7931a;
  --tabbar-h: 56px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; font-size: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100%; color: var(--text);
  background: radial-gradient(1100px 500px at 75% -10%, #101c38 0%, transparent 60%),
              radial-gradient(900px 420px at -10% 110%, #0d1830 0%, transparent 55%),
              linear-gradient(180deg, var(--bg2), var(--bg));
  background-attachment: fixed;
  font: .875rem/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
body.sheet-open { overflow: hidden; }
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: rgba(79,139,255,.35); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--panel3); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
.hidden { display: none !important; }
.pos { color: var(--green); } .neg { color: var(--red); } .dim { color: var(--dim); }
.warn { color: var(--amber); } .orange { color: #ff8a3d; }
.block { display: block; }
.spin { color: var(--dim); font-size: .8125rem; }
:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }
button { font: inherit; color: inherit; }

/* ---------- app shell ---------- */
#app-view { display: flex; min-height: 100vh; }
aside {
  width: 212px; flex: 0 0 212px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; padding: 18px 12px 14px;
  border-right: 1px solid var(--line); background: rgba(10,15,26,.72);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 16px; }
.brand svg { width: 30px; height: 30px; flex: 0 0 30px; }
.brand b { font-size: 1rem; letter-spacing: 2.5px; }
.brand small { display: block; color: var(--faint); font-size: .72rem; letter-spacing: 1.6px; margin-top: 1px; }
#nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
#nav a {
  display: flex; align-items: center; gap: 11px; width: 100%;
  color: var(--dim); padding: 9px 10px; text-decoration: none;
  border-radius: var(--r-s); cursor: pointer; font-size: .84rem; font-weight: 500;
  position: relative; transition: background .15s, color .15s;
}
#nav a:hover { background: rgba(148,163,184,.07); color: var(--text); text-decoration: none; }
#nav a svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: .85; }
#nav a.active { background: linear-gradient(90deg, rgba(79,139,255,.16), rgba(79,139,255,.05)); color: var(--text); }
#nav a.active::before {
  content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}
.userbox {
  margin-top: 10px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--r-s); background: var(--panel);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-weight: 600; font-size: .8125rem;
}
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 12px 26px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 6;
  background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  padding-top: calc(12px + env(safe-area-inset-top));
}
.titlebox { display: flex; flex-direction: column; min-width: 0; }
#view-title { font-size: 1.05rem; font-weight: 650; margin: 0; letter-spacing: .1px; line-height: 1.25; }
.view-sub { font-size: .72rem; color: var(--faint); min-height: 1em; line-height: 1.2; }
.badges { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.badge { padding: 4px 11px; border-radius: 999px; font-size: .72rem; font-weight: 700; letter-spacing: .8px; }
.badge.paper { background: var(--green-bg); color: var(--green); box-shadow: inset 0 0 0 1px rgba(38,208,124,.35); }
.badge.live { background: var(--red-bg); color: var(--red); box-shadow: inset 0 0 0 1px rgba(255,95,87,.4); animation: pulse 2.2s infinite; }
.badge.kill { background: var(--amber-bg); color: var(--amber); box-shadow: inset 0 0 0 1px rgba(255,182,72,.4); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }
main { max-width: 1180px; width: 100%; margin: 0 auto; padding: 24px 26px 80px; }
.offline {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 16px; background: var(--amber-bg); color: var(--amber);
  font-size: .8125rem; border-bottom: 1px solid rgba(255,182,72,.35);
}
.offline button { background: none; border: 1px solid rgba(255,182,72,.5); color: var(--amber); border-radius: var(--r-s); padding: 4px 12px; cursor: pointer; }
#tabbar { display: none; }
.handbook-link { color: var(--dim); font-size: .75rem; text-decoration: none; padding: 6px 9px; border: 1px solid var(--line); border-radius: var(--r-s); }
.handbook-link:hover { color: var(--text); border-color: var(--line2); }

/* ---------- primitives ---------- */
.eyebrow { color: var(--dim); font-size: .72rem; letter-spacing: 1px; text-transform: uppercase; font-weight: 600; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.card, .stat {
  background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--r-m);
  padding: 14px 16px; box-shadow: var(--elev1); min-width: 0;
}
.card .k, .stat .k { color: var(--dim); font-size: .72rem; margin-bottom: 4px; letter-spacing: .5px; text-transform: uppercase; font-weight: 600; }
.card .v, .stat .v { font-size: 1.25rem; font-weight: 700; letter-spacing: -.3px; line-height: 1.25; }
.card .s, .stat .s { color: var(--faint); font-size: .72rem; margin-top: 3px; }
.stat .v .small-v { font-size: .9rem; font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stats.three { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 0; }
.panel {
  background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--r-l);
  padding: 18px; margin-bottom: 14px; box-shadow: var(--elev1);
}
.panel.flush { padding: 4px 14px; }
.panel h3, .panel-head h3 {
  margin: 0 0 12px; font-size: .72rem; color: var(--dim);
  text-transform: uppercase; letter-spacing: 1px; font-weight: 650;
}
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.panel-head h3 { margin: 0; }
.panel-head .chev, .panel-head .see-all { margin-left: auto; }
.panel.danger { border-color: rgba(255,95,87,.5); box-shadow: inset 0 0 0 1px rgba(255,95,87,.15); }
.see-all { font-size: .8rem; font-weight: 600; padding: 14px 0 14px 12px; margin: -14px 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.split.two { margin-top: 14px; }
.subhead { margin: 16px 0 8px; font-size: .72rem; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); font-weight: 650; }
.subhead.pos { color: var(--green); } .subhead.neg { color: var(--red); }
.linkbtn { background: none; border: none; color: var(--accent2); cursor: pointer; padding: 6px 4px; font-size: .8125rem; font-weight: 600; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border-radius: 999px; border: 1px solid var(--line2); background: none; color: var(--dim);
  cursor: pointer; font-weight: 700; font-size: .875rem; padding: 0;
}
.icon-btn:hover { color: var(--text); }
.info-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px;
  border-radius: 50%; border: 1px solid var(--line2); background: none; color: var(--accent2);
  font-size: .68rem; font-weight: 700; font-style: italic; font-family: Georgia, serif; line-height: 1;
  cursor: pointer; padding: 0; margin-left: 4px; vertical-align: 1px; position: relative;
}
.info-btn::after { content: ""; position: absolute; inset: -13px; }

/* ---------- tables (kept for dense reference data) ---------- */
.tbl-wrap { overflow-x: auto; margin: 0 -6px; padding: 0 6px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--faint); font-size: .72rem; font-weight: 650; letter-spacing: .7px;
     text-transform: uppercase; padding: 7px 9px; border-bottom: 1px solid var(--line2); white-space: nowrap; }
th.num, td.num { text-align: right; }
td { padding: 10px 9px; border-bottom: 1px solid var(--line); font-size: .84rem; white-space: nowrap; }
tr:last-child td { border-bottom: none; }

/* ---------- buttons + forms ---------- */
button.act, a.act {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--accent-solid); color: #fff; border: 1px solid transparent;
  padding: 8px 15px; border-radius: var(--r-s); cursor: pointer; font-size: .8125rem; font-weight: 600;
  min-height: 36px; text-decoration: none; transition: filter .12s, transform .12s;
}
button.act:hover, a.act:hover { filter: brightness(1.12); text-decoration: none; }
button.act:active, a.act:active { transform: translateY(1px); }
button.act.ghost, a.act.ghost { background: var(--panel2); color: var(--text); border-color: var(--line2); }
button.act.danger { background: var(--danger-solid); color: #fff; }
button.act.danger-ghost { background: transparent; color: var(--red); border-color: rgba(255,95,87,.45); }
button.act.ok { background: #22c070; color: #031a0d; }
button.act.icon { padding: 8px 12px; }
button.act:disabled { opacity: .45; cursor: default; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 14px;
  border-radius: 999px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text);
  font-size: .8125rem; font-weight: 600; cursor: pointer;
}
input, select, textarea {
  background: rgba(8,12,22,.7); color: var(--text); border: 1px solid var(--line2);
  border-radius: var(--r-s); padding: 9px 12px; font: inherit; font-size: .875rem; width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,139,255,.2);
}
input::placeholder { color: var(--faint); }
label { display: block; color: var(--dim); font-size: .75rem; margin: 10px 0 5px; }
label.row { margin-top: 12px; color: var(--text); font-size: .84rem; }
label.row input { width: auto; }
input[type=checkbox] {
  appearance: none; -webkit-appearance: none; width: 20px; height: 20px; padding: 0; flex: 0 0 20px;
  border-radius: 6px; border: 1.5px solid var(--line2); background: var(--panel2); cursor: pointer;
  display: inline-grid; place-content: center; margin: 0;
}
input[type=checkbox]:checked { background: var(--accent-solid); border-color: var(--accent-solid); }
input[type=checkbox]:checked::after {
  content: ""; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg);
}
input.switch { width: 46px; height: 28px; flex: 0 0 46px; border-radius: 999px; background: var(--panel3); border: none; position: relative; }
input.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: none; transform: none; transition: transform .18s; }
input.switch:checked { background: var(--green); }
input.switch:checked::after { transform: translateX(18px); border: none; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 0; padding: 12px 4px; border-top: 1px solid var(--line); color: var(--text); font-size: .9rem; }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
        font-size: .72rem; font-weight: 600; background: var(--panel3); color: var(--dim); white-space: nowrap; line-height: 1.5; }
.chip.buy  { background: var(--green-bg); color: var(--green); }
.chip.sell { background: var(--red-bg);   color: var(--red); }
.chip.warn { background: var(--amber-bg); color: var(--amber); }
.chip.beat { background: var(--green-bg); color: var(--green); }
.chip.miss { background: var(--red-bg);   color: var(--red); }
.chip.info { background: rgba(79,139,255,.15); color: var(--accent2); }
.chip.auto { background: rgba(79,139,255,.16); color: var(--accent2); }
.chip.manual { background: var(--amber-bg); color: var(--amber); }
.chip.bucket::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--bucket, var(--faint)); }
.side-BUY  { color: var(--green); font-weight: 750; letter-spacing: .5px; }
.side-SELL { color: var(--red);   font-weight: 750; letter-spacing: .5px; }
.side-chip { display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: .72rem; font-weight: 800; letter-spacing: .6px; }
.side-chip.buy { background: var(--green-bg); color: var(--green); }
.side-chip.sell { background: var(--red-bg); color: var(--red); }
.tag { display: inline-block; font-size: .72rem; color: var(--faint); letter-spacing: .6px; text-transform: uppercase; }
.pill {
  display: inline-flex; align-items: center; justify-content: center; min-width: 62px; padding: 2px 8px;
  border-radius: 8px; font-size: .78rem; font-weight: 650; line-height: 1.5;
}
.pill.pos { background: var(--green-bg); color: var(--green); }
.pill.neg { background: var(--red-bg); color: var(--red); }
.pill.flat { background: var(--panel3); color: var(--dim); }
.delta { padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.delta.pos { background: var(--green-bg); color: var(--green); }
.delta.neg { background: var(--red-bg); color: var(--red); }
.delta.flat { background: var(--panel3); color: var(--dim); }

/* ---------- gauges + bars ---------- */
.gauge { display: inline-flex; align-items: center; gap: 7px; }
.gauge .track { width: 74px; height: 5px; border-radius: 5px; background: var(--panel3); overflow: hidden; }
.gauge .fill { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--accent), var(--green)); }
.gauge .val { color: var(--dim); font-size: .72rem; }
.gauge.big .track { width: 120px; height: 7px; }
.bipolar { position: relative; width: 110px; height: 7px; border-radius: 5px; background: var(--panel3); }
.bipolar::before { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--line2); }
.bipolar i { position: absolute; top: 0; bottom: 0; border-radius: 5px; }
.bipolar i.pos { left: 50%; background: var(--green); }
.bipolar i.neg { right: 50%; background: var(--red); }
.donut-wrap { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.donut { width: 148px; height: 148px; border-radius: 50%; position: relative; flex: 0 0 148px; }
.donut::after { content: ""; position: absolute; inset: 24px; border-radius: 50%; background: var(--panel); border: 1px solid var(--line); }
.donut .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 1; text-align: center; }
.donut .center b { font-size: 1.15rem; }
.donut .center span { color: var(--faint); font-size: .72rem; text-transform: uppercase; letter-spacing: .6px; max-width: 80px; }
.legend { display: flex; flex-direction: column; gap: 7px; min-width: 170px; flex: 1; }
.legend .li { display: flex; align-items: center; gap: 8px; font-size: .8rem; }
.legend .sw { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 9px; }
.legend .li b { margin-left: auto; }
.stackbar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; gap: 2px; margin-top: 14px; background: var(--panel3); }
.stackbar i { display: block; min-width: 3px; }
.stack-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: .75rem; color: var(--dim); }
.stack-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.stack-legend b { color: var(--text); }
.bar { height: 6px; border-radius: 4px; background: var(--panel3); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.semi { width: 100%; max-width: 260px; display: block; margin: 0 auto; }
.bt { position: relative; height: 8px; border-radius: 5px; background: var(--panel3); overflow: hidden; display: block; min-width: 40px; }
.bt i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; background: var(--accent); }
.bt i.up { background: var(--green); } .bt i.down { background: var(--red); } .bt i.warn { background: var(--amber); }
/* ---------- messages / toasts ---------- */
.msg { display: none; margin: 10px 0; padding: 10px 14px; border-radius: var(--r-s); font-size: .8125rem; }
.msg.err  { display: block; background: var(--red-bg);   color: #ffb3ae; border: 1px solid rgba(255,95,87,.3); }
.msg.ok   { display: block; background: var(--green-bg); color: #8ceebb; border: 1px solid rgba(38,208,124,.3); }
.msg.info { display: block; background: rgba(79,139,255,.1); color: #b7cdff; border: 1px solid rgba(79,139,255,.3); }
#toasts {
  position: fixed; top: calc(14px + env(safe-area-inset-top)); right: 14px; z-index: 80;
  display: flex; flex-direction: column; gap: 8px; max-width: 380px;
}
.toast {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--r-m); font-size: .8125rem;
  box-shadow: var(--shadow); animation: slidein .18s ease-out;
}
.toast span { flex: 1; }
.toast-act { background: none; border: none; color: inherit; font-weight: 750; text-transform: uppercase; letter-spacing: .5px; font-size: .75rem; cursor: pointer; padding: 6px 4px; min-height: 36px; }
.toast.ok  { background: #0e2a1c; color: #8ceebb; border: 1px solid rgba(38,208,124,.35); }
.toast.err { background: #2e1211; color: #ffb3ae; border: 1px solid rgba(255,95,87,.35); }
.toast.info { background: #14213a; color: #c4d6ff; border: 1px solid rgba(79,139,255,.4); }
@keyframes slidein { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- skeleton + empty ---------- */
.skel { border-radius: var(--r-s); background: linear-gradient(90deg, var(--panel2) 25%, var(--panel3) 40%, var(--panel2) 55%);
        background-size: 300% 100%; animation: shimmer 1.4s infinite linear; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.skel-list { display: flex; flex-direction: column; gap: 8px; }
.skel-row { height: 62px; border-radius: var(--r-m); }
.empty { padding: 26px 18px; text-align: center; color: var(--dim); font-size: .84rem; }
.empty .glyph { font-size: 1.6rem; opacity: .5; margin-bottom: 8px; }

/* ---------- sheets: bottom sheet on phones, slide-over on desktop ---------- */
#overlay { position: fixed; inset: 0; background: rgba(4,7,14,.6); z-index: 39; backdrop-filter: blur(3px); animation: fade .2s both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(430px, 94vw); z-index: 40;
  background: var(--panel); border-left: 1px solid var(--line2); overflow-y: auto; padding: 20px;
  box-shadow: -18px 0 50px rgba(2,6,16,.6); animation: slideleft .22s ease-out;
  overscroll-behavior: contain; touch-action: pan-y;
}
@keyframes slideleft { from { transform: translateX(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-grab { display: none; justify-content: center; padding: 4px 0 10px; touch-action: none; cursor: grab; }
.sheet-grab i { width: 38px; height: 5px; border-radius: 3px; background: var(--line2); display: block; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; touch-action: none; }
.sheet h3 { margin: 0; font-size: 1.05rem; text-transform: none; letter-spacing: 0; color: var(--text); font-weight: 650; }
.sheet .recap { color: var(--dim); font-size: .8rem; margin-bottom: 10px; }
.sheet-text { margin: 4px 0 6px; color: var(--dim); font-size: .92rem; line-height: 1.65; max-width: 62ch; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 8px; }
.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 84px; padding: 12px 6px; border-radius: var(--r-m); background: var(--panel2);
  border: 1px solid var(--line); color: var(--text); font-size: .78rem; font-weight: 600; text-decoration: none; text-align: center;
}
.tile:hover { text-decoration: none; border-color: var(--line2); }
.tile svg { width: 24px; height: 24px; color: var(--accent2); }
.tile.active { border-color: var(--accent); background: rgba(79,139,255,.12); }
.more-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--dim); font-size: .8125rem; }
.opts { display: flex; flex-direction: column; margin-top: 4px; }
.opt { display: flex; align-items: center; justify-content: space-between; min-height: 50px; padding: 0 4px; background: none; border: none; border-bottom: 1px solid var(--line); color: var(--text); font-size: .95rem; cursor: pointer; text-align: left; }
.opt i { color: var(--faint); font-size: .75rem; font-style: normal; }
.opt.active { color: var(--accent2); font-weight: 650; }
.opt.active i { color: var(--accent2); }

.modal-overlay { position: fixed; inset: 0; background: rgba(4,7,14,.6); z-index: 41; backdrop-filter: blur(3px); }
.modal {
  position: fixed; z-index: 42; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(430px, 92vw); max-height: 88vh; overflow-y: auto; background: var(--panel);
  border: 1px solid var(--line2); border-radius: var(--r-l); padding: 20px;
  box-shadow: var(--shadow); animation: slidein .16s ease-out;
}
.modal h3 { margin: 0; font-size: 1rem; text-transform: none; letter-spacing: 0; color: var(--text); }

/* ---------- login ---------- */
#login-view { max-width: 400px; margin: 9vh auto 0; padding: 0 18px; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 22px; }
.login-brand svg { width: 56px; height: 56px; filter: drop-shadow(0 6px 22px rgba(38,208,124,.35)); }
.login-brand b { font-size: 1.4rem; letter-spacing: 5px; }
.login-brand span { color: var(--faint); font-size: .75rem; letter-spacing: 1.4px; text-transform: uppercase; }
#login-view .panel { box-shadow: var(--shadow); }
#login-view .panel h3 { color: var(--text); font-size: 1rem; text-transform: none; letter-spacing: 0; }
/* ---------- dashboard hero ---------- */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 18px; align-items: start; }
.hero { padding: 4px 2px 8px; margin-bottom: 8px; }
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hero-top { align-items: flex-start; }
.hero-link { white-space: nowrap; font-size: .8rem; font-weight: 650; padding: 12px 0 12px 14px; margin: -10px 0; }
.snap { display: block; color: var(--amber); text-transform: none; letter-spacing: 0; margin-top: 2px; font-weight: 500; font-size: .75rem; }
.hero .big, .pos-hero .big, .pnl-hero .big, .ret-hero .big, .split-hero .big, .act-hero .big {
  font-size: 2.6rem; font-weight: 750; letter-spacing: -1.2px; line-height: 1.08; margin-top: 4px;
}
.hero-delta { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; margin-top: 6px; font-size: .95rem; min-height: 1.5em; }
.hero-delta b { font-weight: 700; }
.hero-delta .arrow { font-size: .7em; margin-right: 4px; position: relative; top: -1px; }
.hero-delta .lead { color: var(--dim); font-size: .84rem; }
.hero-sub { margin-top: 10px; font-size: .8125rem; color: var(--dim); }
.hero-sub:empty { display: none; }
.sub-main b { font-weight: 700; }
.sub-note { font-size: .75rem; color: var(--faint); margin-top: 2px; }
.hero-chart { position: relative; height: 188px; margin: 14px -2px 0; touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.hero-chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.hero-chart .eq-line { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.hero-chart .bench-line { fill: none; stroke: var(--dim); stroke-width: 1.4; stroke-dasharray: 3 3; opacity: .8; stroke-linejoin: round; }
.hero-chart .base { stroke: var(--line2); stroke-width: 1; stroke-dasharray: 2 4; }
.hero-chart .end-halo { opacity: .25; animation: halo 2.4s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes halo { 0% { transform: scale(.8); opacity: .45; } 100% { transform: scale(2.4); opacity: 0; } }
.hero-chart .scrub line { stroke: var(--dim); stroke-width: 1; }
.hero-chart .scrub .sc-b { fill: var(--dim); stroke: var(--bg); stroke-width: 2; }
.hero-chart .scrub circle { stroke: var(--bg); stroke-width: 2.5; }
.hero-chart .axis { position: absolute; left: 3px; right: 9px; bottom: -16px; display: flex; justify-content: space-between; font-size: .72rem; color: var(--faint); pointer-events: none; }
.hero-chart.scrubbing { cursor: grabbing; }
.chart-empty { height: 100%; display: flex; align-items: center; justify-content: center; color: var(--faint); font-size: .84rem; border: 1px dashed var(--line2); border-radius: var(--r-m); text-align: center; padding: 0 16px; }
.chart-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 24px; min-height: 36px; }
.legend-l { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .8rem; color: var(--dim); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.lg i.up { background: var(--green); } .lg i.down { background: var(--red); }
.lg i.bench-sw { background: var(--dim); }
.lg b { color: var(--text); font-weight: 700; }
.lg b.pos { color: var(--green); } .lg b.neg { color: var(--red); }
.bench-tog { display: inline-flex; align-items: center; gap: 6px; }
.bench-tog button:not(.info-btn) {
  position: relative; min-width: 46px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line2);
  background: transparent; color: var(--dim); font-size: .75rem; font-weight: 700; cursor: pointer;
}
.bench-tog button:not(.info-btn)::after { content: ""; position: absolute; inset: -7px -3px; }
.bench-tog button.active { background: var(--panel3); color: var(--text); border-color: var(--line2); }
.periods { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin: 6px 0 4px; padding: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-m); }
.periods button {
  height: 40px; border: none; background: none; color: var(--dim); font-size: .84rem; font-weight: 650;
  border-radius: 9px; cursor: pointer; transition: background .15s, color .15s;
}
.periods button.active { background: var(--panel3); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.periods button:disabled { color: var(--faint); opacity: .38; cursor: default; }
.banner {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 12px; color: var(--text);
  background: var(--amber-bg); border: 1px solid rgba(255,182,72,.4); border-radius: var(--r-m); font-size: .9rem; text-decoration: none;
}
.banner:hover { text-decoration: none; filter: brightness(1.1); }
.banner-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(255,182,72,.2); flex: 0 0 9px; }
.banner-go { margin-left: auto; font-size: 1.3rem; color: var(--amber); }
.ai-card { display: block; color: var(--text); text-decoration: none; }
.ai-card:hover { text-decoration: none; border-color: var(--line2); }
.ai-cells { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ai-cells > div { min-width: 0; }
.ai-cells .k { display: block; font-size: .72rem; color: var(--dim); text-transform: uppercase; letter-spacing: .6px; font-weight: 600; margin-bottom: 2px; }
.ai-cells b { display: block; font-size: 1.15rem; font-weight: 700; }
.ai-cells small { display: block; color: var(--faint); font-size: .72rem; margin-top: 1px; }
.ai-note { margin: 10px 0 0; font-size: .78rem; }
.chev { color: var(--faint); font-size: 1.2rem; }
.verdict-pill { padding: 3px 10px; border-radius: 999px; font-size: .72rem; font-weight: 700; background: var(--panel3); color: var(--dim); white-space: nowrap; }
.verdict-pill.good { background: var(--green-bg); color: var(--green); }
.verdict-pill.bad { background: var(--red-bg); color: var(--red); }
.verdict-pill.neutral { background: var(--amber-bg); color: var(--amber); }
.limit-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.limit-top b { font-size: 1.15rem; }
.limit-sub { font-size: .75rem; margin-top: 6px; }
.kv { display: flex; flex-direction: column; margin-top: 12px; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: .84rem; }
.kv span { color: var(--dim); }
.dash-search { margin: 0 0 14px; flex-wrap: nowrap; }
.dash-search button { flex: 0 0 auto; }
.stats > .stat .v { font-size: 1.2rem; }

/* ---------- lists: dense rows, tap to expand ---------- */
.listbar { display: flex; align-items: center; gap: 10px; margin: 6px 0 12px; flex-wrap: wrap; }
.listbar .live-dot { margin-left: auto; }
.live-dot { font-size: .72rem; color: var(--dim); display: inline-flex; align-items: center; gap: 6px; }
.live-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--line2); }
.live-dot.on::before { background: #26d07c; box-shadow: 0 0 0 3px rgba(38,208,124,.18); }
.list { background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; margin-bottom: 12px; box-shadow: var(--elev1); }
.list.flat { background: none; border: none; box-shadow: none; border-radius: 0; margin: 0; }
.lrow { border-top: 1px solid var(--line); }
.list > .lrow:first-child, .list > .arow:first-child { border-top: none; }
.lrow-main {
  display: grid; align-items: center; width: 100%; gap: 12px; min-height: 64px; padding: 10px 14px;
  background: none; border: none; text-align: left; cursor: pointer; color: var(--text);
  grid-template-columns: 36px minmax(0, 1fr) 58px auto;
}
.lrow-main.static { cursor: default; grid-template-columns: 36px minmax(0, 1fr) auto; }
.lrow-main.no-spark { grid-template-columns: 36px minmax(0, 1fr) auto; }
.lrow-main:active { background: rgba(148,163,184,.06); }
.ava {
  width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 750; font-size: .95rem; color: var(--c, var(--accent2));
  background: color-mix(in srgb, var(--c, var(--accent)) 16%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c, var(--accent)) 28%, transparent);
}
.who { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.who b { font-size: .95rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { color: var(--dim); font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spark { display: flex; align-items: center; justify-content: center; height: 24px; min-width: 56px; }
.spark:empty::before { content: ""; width: 44px; border-top: 1.5px dotted var(--line2); }
.nums { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; }
.nums { white-space: nowrap; }
.nums b { font-size: .95rem; font-weight: 650; }
.lrow-main .chev { display: none; }
.lrow-more { display: none; }
.lrow.open .lrow-more { display: block; padding: 2px 14px 14px; animation: view-in .2s ease both; }
.lrow.open { background: rgba(148,163,184,.04); }
.kvgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 10px; margin: 2px 0 10px; }
.kvgrid dt { font-size: .72rem; color: var(--faint); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.kvgrid dd { margin: 2px 0 0; font-size: .875rem; font-weight: 600; }
.more-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.more-note { margin: 0 0 10px; color: var(--dim); font-size: .8125rem; line-height: 1.55; }
.more-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.more-actions .act { min-height: 40px; padding: 8px 6px; }
.more-actions .wide { grid-column: 1 / -1; }
.list-head, .c-qty, .c-avg, .c-wt, .c-pl { display: none; }
.pos-hero, .pnl-hero { padding: 6px 2px 4px; margin-bottom: 4px; }
.pos-hero .stackbar { margin-top: 16px; }
.pos-count { font-size: .75rem; margin-top: 10px; }
.pnl-hero.panel { padding: 18px; }
.pnl-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.pnl-split .k { display: block; color: var(--dim); font-size: .72rem; text-transform: uppercase; letter-spacing: .6px; font-weight: 600; }
.pnl-split b { display: block; font-size: 1.2rem; font-weight: 700; margin-top: 2px; }
.pnl-split small { color: var(--faint); font-size: .72rem; }
.pnl-foot { font-size: .75rem; margin: 12px 0 0; }
.pnl-tools { margin-top: 4px; }
details.bucket { margin-bottom: 14px; }
details.bucket > summary {
  list-style: none; cursor: pointer; display: flex; gap: 10px; align-items: center; min-height: 44px;
  padding: 6px 4px; font-weight: 650; font-size: .875rem; user-select: none;
  border-left: 3px solid var(--bucket, var(--line2)); padding-left: 12px; margin-bottom: 8px;
}
details.bucket > summary::-webkit-details-marker { display: none; }
details.bucket > summary .caret { transition: transform .15s; color: var(--faint); font-size: .6rem; }
details.bucket[open] > summary .caret { transform: rotate(90deg); }
details.bucket > summary .sub { margin-left: auto; display: flex; gap: 10px; align-items: center; color: var(--dim); font-size: .8125rem; font-weight: 500; }
details.bucket .list { margin-bottom: 0; }
.watch-add { display: flex; gap: 8px; margin-bottom: 4px; }
.watch-add #w-ticker { flex: 1.2; }
.watch-add #w-note { flex: 1; }
.watch-add button { flex: 0 0 auto; }
.arow { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--line); }
.arow:first-child { border-top: none; }
.arow .who { flex: 1; }
.arow-act { display: inline-flex; gap: 6px; }
.arow.hist { padding: 12px 14px; }
.arow.hist .nums { margin-left: auto; }
.panel.flush .arow.hist { padding: 12px 0; }

/* ---------- activity timeline ---------- */
.act-summary { margin-bottom: 14px; }
.act-hero { padding: 4px 2px 10px; }
.act-hero .k { color: var(--dim); font-size: .72rem; letter-spacing: 1px; text-transform: uppercase; font-weight: 600; }
.act-hero .big { font-size: 2.2rem; }
.act-hero .s { font-size: .78rem; margin-top: 2px; }
.act-stats .stat { padding: 12px; }
.act-stats .stat .v { font-size: 1.05rem; }
.act-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.day { margin-bottom: 8px; }
.day-h { display: flex; justify-content: space-between; align-items: baseline; margin: 16px 4px 8px; font-size: .78rem; font-weight: 650; color: var(--text); text-transform: none; letter-spacing: 0; }
.day-h span { color: var(--faint); font-weight: 500; font-size: .72rem; }
.lrow.act .lrow-main { grid-template-columns: 36px minmax(0, 1fr) auto; }
.act-ico { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem; font-weight: 700; }
.act-ico.buy { background: var(--green-bg); color: var(--green); }
.act-ico.sell { background: var(--red-bg); color: var(--red); }
.act-pl { font-size: .78rem; font-weight: 700; }
.act-pl i { font-style: normal; font-weight: 500; opacity: .85; }
.working { color: var(--amber); font-style: normal; font-weight: 600; }
.more-btn { width: 100%; margin: 8px 0 20px; min-height: 46px; }
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-m); max-width: 100%; margin-bottom: 12px; }
.seg button { min-height: 36px; padding: 0 14px; border: none; background: none; color: var(--dim); font-size: .84rem; font-weight: 650; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.seg button.active { background: var(--panel3); color: var(--text); }
.seg.scroll { display: flex; overflow-x: auto; scrollbar-width: none; }
.seg.scroll::-webkit-scrollbar { display: none; }
.ap-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ap-top .seg { margin-bottom: 14px; }
/* ---------- approvals ---------- */
.swipe { position: relative; margin-bottom: 12px; border-radius: var(--r-l); overflow: hidden; transition: max-height .22s ease, margin .22s ease, opacity .2s ease; }
.swipe.leaving { opacity: 0; max-height: 0 !important; margin-bottom: 0; transform: translateX(-30px); }
.swipe-bg { position: absolute; inset: 0; display: flex; align-items: center; padding: 0 22px; font-weight: 750; font-size: .95rem; opacity: 0; letter-spacing: .3px; }
.swipe-bg.ok { background: #1c9d5f; color: #fff; justify-content: flex-start; }
.swipe-bg.no { background: var(--danger-solid); color: #fff; justify-content: flex-end; }
.swipe[data-dir="ok"] .swipe-bg.ok, .swipe[data-dir="no"] .swipe-bg.no { opacity: calc(.35 + var(--p, 0) * .65); }
.swipe.armed .swipe-bg span { transform: scale(1.12); }
.swipe-bg span { transition: transform .15s; }
.prop {
  border: 1px solid var(--line); border-left: 3px solid var(--line2); border-radius: var(--r-m);
  padding: 14px 16px; margin-bottom: 10px; background: var(--card-bg); box-shadow: var(--elev1);
}
.prop.buy { border-left-color: var(--green); }
.prop.sell { border-left-color: var(--red); }
.swipe .prop { margin-bottom: 0; border-radius: var(--r-l); touch-action: pan-y; position: relative; background: var(--panel); transition: transform .22s cubic-bezier(.2,.8,.2,1); }
.swipe-card.dragging { transition: none; cursor: grabbing; }
.ap-head { display: flex; align-items: center; gap: 10px; }
.ap-head .tkr { font-size: 1.2rem; font-weight: 750; letter-spacing: .2px; }
.ap-usd { margin-left: auto; font-size: 1.2rem; font-weight: 750; }
.ap-meta { margin-top: 6px; font-size: .78rem; color: var(--dim); line-height: 1.45; }
.ap-qty { margin-top: 4px; font-size: .78rem; }
.ap-conv { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: .75rem; }
.ap-links { display: flex; gap: 6px; margin-top: 4px; }
.reason { color: var(--dim); font-size: .84rem; margin: 8px 0 0; line-height: 1.55; }
.reason.clamp { padding: 1px 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.updown { margin: 8px 0 2px; font-size: .8125rem; }
.ap-actions { display: grid; grid-template-columns: 1fr 1.3fr; gap: 10px; margin-top: 14px; }
.ap-actions .act { min-height: 48px; font-size: .95rem; }
.swipe-hint { margin: 0 2px 10px; font-size: .75rem; text-align: center; }
.confirm { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 10px; }
.confirm-note { font-size: .84rem; line-height: 1.5; padding: 10px 12px; border-radius: var(--r-s); background: var(--amber-bg); color: var(--text); border: 1px solid rgba(255,182,72,.35); }
.confirm .row { flex-wrap: nowrap; } .confirm .row .act { flex: 1; min-height: 48px; }
.slide { position: relative; height: 54px; border-radius: 999px; background: rgba(34,192,112,.16); border: 1px solid rgba(34,192,112,.5); overflow: hidden; touch-action: none; user-select: none; }
.slide::before { content: ""; position: absolute; inset: 0; background: rgba(34,192,112,.35); transform-origin: left; transform: scaleX(var(--p, 0)); }
.slide-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem; color: var(--green); padding-left: 40px; letter-spacing: .2px; }
.slide-thumb { position: absolute; left: 3px; top: 3px; width: 46px; height: 46px; border-radius: 50%; background: #22c070; color: #031a0d; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; font-weight: 800; cursor: grab; box-shadow: 0 2px 8px rgba(0,0,0,.35); transition: transform .2s ease; }
.slide-thumb.dragging { transition: none; cursor: grabbing; }

/* ---------- performance ---------- */
.perf { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.ret-hero { margin-bottom: 14px; }
.bench-rows { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.brow { display: grid; grid-template-columns: minmax(0, 138px) 1fr 66px; align-items: center; gap: 10px; font-size: .8125rem; }
.brow .bl { color: var(--dim); } .brow.me .bl { color: var(--text); font-weight: 600; }
.brow b { text-align: right; }
.bench-cap { margin: 0 0 12px; font-size: .75rem; color: var(--faint); }
.edge-line { margin: 12px 0 0; font-size: .84rem; font-weight: 600; }
.same-dollar { margin: 8px 0 0; font-size: .8125rem; color: var(--dim); line-height: 1.55; }
.same-dollar b { color: var(--text); }
.verdict-text { margin: 0 0 4px; font-size: 1.05rem; font-weight: 650; }
.n-note { margin: 0 0 12px; font-size: .78rem; }
.meter2 { margin: 6px 2px 4px; }
.m-track { position: relative; height: 10px; border-radius: 6px; background: var(--panel3); margin-top: 14px; }
.m-ci { position: absolute; top: 0; bottom: 0; background: rgba(79,139,255,.45); border-radius: 6px; }
.m-base { position: absolute; top: -6px; bottom: -6px; width: 2px; background: var(--amber); border-radius: 1px; }
.m-dot { position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--text); border: 3px solid var(--panel); box-shadow: 0 0 0 1px var(--line2); }
.m-scale { display: flex; justify-content: space-between; font-size: .72rem; color: var(--faint); margin-top: 6px; }
.m-text { margin: 8px 0 14px; font-size: .84rem; }
.stats.three .s .early { color: var(--amber); font-style: normal; font-weight: 600; }
.srow { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(40px, 1fr) 76px; align-items: center; gap: 10px; padding: 8px 0; font-size: .84rem; }
.srow .bl { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; font-weight: 600; }
.srow .bl small { color: var(--faint); font-size: .72rem; font-weight: 500; }
.srow b { text-align: right; }
.split-hero .k { color: var(--dim); font-size: .72rem; letter-spacing: 1px; text-transform: uppercase; font-weight: 600; }
.split-hero .big { font-size: 2.1rem; margin-bottom: 8px; }
.kv-lines { display: flex; flex-direction: column; }
.kv-line { display: flex; align-items: baseline; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: .875rem; flex-wrap: wrap; }
.kv-line span { color: var(--dim); }
.kv-line b { margin-left: auto; }
.kv-line span small { color: var(--faint); font-size: .72rem; margin-left: 6px; }
.kv-line b.dim { font-weight: 600; }
.top-hold { margin-top: 14px; font-size: .8rem; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.top-hold i { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); display: inline-block; align-self: center; }
details.more-stats > summary { cursor: pointer; font-weight: 650; font-size: .9rem; list-style: none; min-height: 28px; display: flex; align-items: center; gap: 8px; }
details.more-stats > summary::-webkit-details-marker { display: none; }
details.more-stats > summary::after { content: "›"; margin-left: auto; transition: transform .15s; font-size: 1.3rem; color: var(--faint); }
details.more-stats[open] > summary::after { transform: rotate(90deg); }
details.more-stats > summary .dim { font-weight: 400; font-size: .75rem; }
.more-body { margin-top: 14px; }
.uw { height: 130px; margin-top: 10px; }
.uw.hidden { display: none; }

/* ---------- risk + x-ray ---------- */
.risk-hero { text-align: center; padding-bottom: 14px; }
.gauge-wrap { position: relative; max-width: 260px; margin: 4px auto 0; }
.gauge-c { position: absolute; left: 0; right: 0; bottom: 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.gauge-c b { font-size: 2.4rem; line-height: 1; letter-spacing: -1px; }
.gauge-scale { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; margin: 10px auto 0; font-size: .72rem; color: var(--dim); }
.gauge-scale i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.gauge-note { margin: 10px 0 0; font-size: .8rem; }
.xray { display: flex; flex-direction: column; gap: 9px; }
.xrow { display: grid; grid-template-columns: minmax(0, 118px) 1fr 52px; align-items: center; gap: 10px; font-size: .84rem; }
.xrow b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xrow .xw { text-align: right; color: var(--dim); }
.bt i.acc { background: var(--accent); }

/* ---------- debate report ---------- */
.verdict { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.verdict .decision { font-size: 1.25rem; font-weight: 800; letter-spacing: 1px; padding: 5px 16px; border-radius: 10px; }
.verdict .decision.buy { background: var(--green-bg); color: var(--green); box-shadow: inset 0 0 0 1px rgba(38,208,124,.35); }
.verdict .decision.trim { background: var(--amber-bg); color: var(--amber); box-shadow: inset 0 0 0 1px rgba(255,182,72,.4); }
.verdict .decision.pass { background: var(--red-bg); color: var(--red); box-shadow: inset 0 0 0 1px rgba(255,95,87,.35); }
.quote {
  border-left: 3px solid var(--accent); padding: 10px 14px; margin: 12px 0;
  background: rgba(79,139,255,.07); border-radius: 0 10px 10px 0; color: var(--text); font-size: .84rem; line-height: 1.6;
}
.case { border: 1px solid var(--line); border-radius: var(--r-m); padding: 13px 16px; background: rgba(8,12,22,.4); }
.case h4 { margin: 0 0 8px; font-size: .75rem; text-transform: uppercase; letter-spacing: .9px; }
.case.bull h4 { color: var(--green); } .case.bear h4 { color: var(--red); }
.case p { margin: 0; color: var(--dim); font-size: .8125rem; line-height: 1.6; }
details.features { margin-top: 12px; }
details.features summary { cursor: pointer; color: var(--faint); font-size: .75rem; min-height: 32px; display: flex; align-items: center; }
details.features pre { background: rgba(8,12,22,.6); border: 1px solid var(--line); border-radius: 9px; padding: 12px; font-size: .75rem; overflow-x: auto; color: var(--dim); }
.tkr { font-weight: 750; letter-spacing: .2px; }
.prop .head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.prop .row { margin-top: 10px; }

/* ---------- research forecasts, settings folds, misc ---------- */
#view-root > .panel, #view-root > .cards, #view-root > .grid2, #view-root > .split, #view-root > .dash, #view-root > .perf {
  animation: view-in .28s cubic-bezier(.2,.75,.25,1) both;
}
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.research-note { margin: 10px 0 0; font-size: .75rem; }
.source-settings { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.source-settings summary, .evidence summary { cursor: pointer; color: var(--dim); font-size: .8125rem; min-height: 32px; display: flex; align-items: center; }
.source-add { margin-top: 10px; }
.source-add input:first-child { max-width: 180px; }
.source-add input:nth-child(2) { min-width: 280px; flex: 1; }
.source-list { display: grid; gap: 7px; margin-top: 10px; }
.source-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.015); }
.source-row span { min-width: 0; }
.source-row small { display: block; overflow: hidden; text-overflow: ellipsis; color: var(--faint); margin-top: 2px; }
.source-row em { color: var(--accent2); font-size: .72rem; font-style: normal; text-transform: uppercase; letter-spacing: .5px; }
.forecast-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 13px 0; }
.forecast-card { display: flex; flex-direction: column; gap: 7px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-m); background: rgba(255,255,255,.018); }
.forecast-card strong { font-size: 1.25rem; letter-spacing: .8px; }
.forecast-card.up strong { color: var(--green); } .forecast-card.down strong { color: var(--red); } .forecast-card.flat strong { color: var(--dim); }
.forecast-card span { font-size: .8125rem; }
.forecast-card small { color: var(--dim); line-height: 1.5; }
.evidence { margin-top: 10px; }
.evidence ul { margin: 10px 0 0; padding-left: 20px; }
.evidence li { margin: 7px 0; font-size: .8125rem; line-height: 1.45; }
details.fold > summary { cursor: pointer; list-style: none; display: flex; align-items: center; min-height: 28px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h3 { margin: 0; flex: 1; }
details.fold > summary::after { content: "›"; font-size: 1.3rem; color: var(--faint); transition: transform .15s; }
details.fold[open] > summary::after { transform: rotate(90deg); }
details.fold[open] > summary { margin-bottom: 12px; }
.bell { position: relative; background: none; border: 1px solid var(--line2); color: var(--dim);
  border-radius: 999px; width: 36px; height: 34px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.bell svg { width: 16px; height: 16px; }
.bell:hover { color: var(--text); }
.bell-count { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--danger-solid); color: #fff; font-size: .72rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.navbadge { background: var(--accent-solid); color: #fff; font-size: .72rem; font-weight: 700; border-radius: 999px; padding: 1px 7px; min-width: 18px; text-align: center; margin-left: auto; }
.prop.unread { box-shadow: inset 3px 0 0 var(--accent); }
.prop.more { display: none; }
.stack { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.auto-job { padding: 14px 0; border-bottom: 1px solid var(--line); }
.auto-job:last-of-type { border-bottom: none; margin-bottom: 10px; }
.auto-job .dim { margin: 6px 0 10px; line-height: 2.2; }
.auto-job input[type=number] { padding: 4px 8px; width: 84px; display: inline-block; }
#bt-form label { font-size: .8125rem; }
.note-item { border-left: 2px solid var(--line); padding: 4px 0 4px 12px; margin: 0 0 12px; }
.note-item .quote { margin-top: 6px; }
.meter { display: inline-block; width: 120px; height: 6px; border-radius: 3px; background: var(--line2); vertical-align: middle; overflow: hidden; }
.chart-wrap-note { font-size: .75rem; }
.ct-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin-bottom: 6px; }
@media (max-width: 840px) {
  .ct-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -4px; }
  .ct-bar::-webkit-scrollbar { display: none; }
  .ct-bar button, .ct-sep { flex: 0 0 auto; }
  #chart-form { flex-wrap: nowrap; }
  #chart-form input { max-width: none !important; flex: 1; }
  #chart-form .live-dot { display: none; }
}
.ct-bar button { background: none; border: none; color: var(--dim); font-size: .72rem; font-weight: 650; padding: 5px 9px; border-radius: 7px; cursor: pointer; }
.ct-bar button.active { background: var(--panel3); color: var(--text); }
.ct-sep { width: 1px; height: 14px; background: var(--line); margin: 0 6px; }
.ct-wrap { position: relative; }
.ct-legend { display: flex; flex-wrap: wrap; gap: 2px 10px; min-height: 16px; margin: 0 0 4px 2px; font-size: .72rem; color: var(--dim); white-space: nowrap; }
.ct-legend b { color: var(--text); }
/* ---------- desktop refinements ---------- */
@media (min-width: 841px) {
  .hero-chart { height: 240px; }
  .dash-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
  .lrow-main { grid-template-columns: 36px minmax(0, 1fr) 64px auto 26px; gap: 14px; }
  .lrow-main.no-spark { grid-template-columns: 36px minmax(0, 1fr) auto 26px; }
  .lrow-main.pos-row { grid-template-columns: 36px minmax(0, 1.3fr) 64px repeat(3, minmax(0, .8fr)) minmax(0, .6fr) minmax(0, .8fr) 26px; }
  .lrow-main .nums.c-val { align-items: flex-end; }
  .lrow-main .c-pl-m { display: none; }
  .lrow-main .c-qty, .lrow-main .c-avg, .lrow-main .c-wt, .lrow-main .c-pl { display: block; text-align: right; font-size: .84rem; }
  .lrow-main .c-qty, .lrow-main .c-avg { color: var(--dim); }
  .lrow-main .chev { display: block; width: 8px; height: 8px; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint); transform: rotate(-45deg); transition: transform .2s; justify-self: center; }
  .lrow.open .lrow-main .chev { transform: rotate(45deg); }
  .lrow.act .lrow-main, .lrow-main.static { grid-template-columns: 36px minmax(0, 1fr) auto 26px; }
  .lrow.act .lrow-main .chev { display: block; }
  .lrow-main:hover { background: rgba(79,139,255,.05); }
  .list-head { display: grid; grid-template-columns: 36px minmax(0, 1.3fr) 64px repeat(3, minmax(0, .8fr)) minmax(0, .6fr) minmax(0, .8fr) 26px; gap: 14px; padding: 0 14px; margin: 14px 0 6px; }
  .list-head > * { display: block; text-align: right; background: none; border: none; color: var(--faint); font-size: .72rem; font-weight: 650; letter-spacing: .7px; text-transform: uppercase; padding: 4px 0; cursor: pointer; }
  .list-head > span { cursor: default; }
  .list-head > :first-child { text-align: left; grid-column: 1 / 3; }
  .list-head > .c-spark { text-align: center; }
  .list-head .c-qty, .list-head .c-avg, .list-head .c-wt, .list-head .c-pl, .list-head .c-val { display: block; }
  .list-head .c-spark { display: block; }
  .kvgrid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .more-actions { grid-template-columns: repeat(4, max-content); }
  .more-actions .wide { grid-column: auto; }
  .perf { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 18px; align-items: start; }
  .perf > .panel:first-child, .perf > #pf-more { grid-column: 1 / -1; }
  .swipe-hint { display: none; }
}

/* ---------- tablets and phones ---------- */
@media (max-width: 840px) {
  #app-view { flex-direction: column; }
  aside { display: none; }
  .handbook-link { display: none; }
  .topbar { padding: calc(8px + env(safe-area-inset-top)) 16px 8px; gap: 8px; }
  #view-title { font-size: 1.15rem; }
  main { padding: 14px 14px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); }
  #tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
    border-top: 1px solid var(--line2);
  }
  #tabbar > * {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    background: none; border: none; color: var(--faint); font-size: .72rem; font-weight: 600; text-decoration: none;
    position: relative; cursor: pointer; padding: 6px 0 4px; min-width: 0;
  }
  #tabbar svg { width: 24px; height: 24px; }
  #tabbar > .active { color: var(--accent2); }
  #tabbar > .active svg { filter: drop-shadow(0 0 8px rgba(79,139,255,.45)); }
  #tabbar .navbadge { position: absolute; top: 2px; left: calc(50% + 6px); margin: 0; }
  #toasts { top: auto; right: 12px; left: 12px; bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom)); max-width: none; flex-direction: column-reverse; }
  .sheet {
    top: auto; left: 0; right: 0; width: 100%; max-height: 88vh; max-height: 88dvh;
    border-left: none; border-top: 1px solid var(--line2); border-radius: 20px 20px 0 0;
    animation: slideup .26s cubic-bezier(.2,.8,.2,1); padding: 8px 18px calc(24px + env(safe-area-inset-bottom));
    box-shadow: 0 -20px 60px rgba(2,6,16,.6); transition: transform .2s ease;
  }
  .sheet-grab { display: flex; }
  .sheet.sheet-more { max-height: 80dvh; }
  @keyframes slideup { from { transform: translateY(100%); } to { transform: none; } }
  .grid2, .split, .dash-grid { grid-template-columns: 1fr; }
  .forecast-grid { grid-template-columns: 1fr; }
  .source-add { align-items: stretch; }
  .source-add input:first-child, .source-add input:nth-child(2), .source-add select, .source-add button { width: 100%; max-width: none; min-width: 0; }
  .hero .big { font-size: 2.5rem; }
  .watch-add { flex-wrap: wrap; }
  .watch-add #w-ticker { flex: 1 1 100%; }
  .watch-add #w-note { flex: 1; }
  .modal { top: auto; bottom: 0; left: 0; transform: none; width: 100%; border-radius: 20px 20px 0 0; padding-bottom: calc(20px + env(safe-area-inset-bottom)); animation: slideup .22s ease-out; }
  .cards, .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 12px 14px; }
  .card .v { font-size: 1.1rem; }
  .stats.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  main { padding-left: 14px; padding-right: 14px; }
  .panel { padding: 16px; }
  .brow { grid-template-columns: minmax(0, 104px) 1fr 62px; }
  .srow { grid-template-columns: minmax(0, 1.1fr) minmax(30px, .8fr) 68px; }
  .xrow { grid-template-columns: minmax(0, 96px) 1fr 46px; }
  #research-form { align-items: stretch; }
  #research-form input, #research-form button { width: 100%; max-width: none !important; }
  /* reference tables collapse to two-up cards instead of one long label/value stack */
  table.collapse thead { display: none; }
  table.collapse tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; border-bottom: 1px solid var(--line); padding: 12px 0; }
  table.collapse tr:last-child { border-bottom: none; }
  table.collapse td { display: block; border: none; padding: 0; white-space: normal; text-align: left; font-size: .84rem; min-width: 0; overflow-wrap: anywhere; }
  table.collapse td.num { text-align: left; }
  table.collapse td::before { content: attr(data-label); display: block; color: var(--faint); font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 1px; }
  table.collapse td:not([data-label])::before { display: none; }
  table.collapse td:first-child, table.collapse td:not([data-label]) { grid-column: 1 / -1; font-size: .95rem; }
  .auto-job .dim { line-height: 2.6; }
  .ai-cells { gap: 8px; }
  .ai-cells b { font-size: 1.02rem; }
  .kvgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-height: 720px) and (max-width: 840px) {
  .hero-chart { height: 150px; }
}
@media (max-width: 380px) {
  .hero .big { font-size: 2.2rem; }
  .lrow-main { gap: 10px; padding: 10px 12px; }
  .lrow-main:not(.no-spark):not(.static) { grid-template-columns: 34px minmax(0, 1fr) 48px auto; }
  .spark { min-width: 48px; }
  .periods button { font-size: .78rem; }
}

/* ---------- touch: 44pt targets, 16px inputs so iOS never zooms on focus ---------- */
@media (max-width: 840px) {
  input, select, textarea { font-size: 1rem; }
}
@media (pointer: coarse) {
  button.act, a.act, .chip-btn, .seg button, .linkbtn, .opt, .toast-act { min-height: 44px !important; }
  .topbar .icon-btn, .bell { width: 38px; height: 38px; position: relative; }
  .topbar .icon-btn::after, .bell::after { content: ""; position: absolute; inset: -6px -3px; }
  .source-row .icon-btn { width: 44px; height: 44px; }
  .sheet-head .icon-btn { width: 44px; height: 44px; }
  .bell-count { top: -4px; right: -4px; }
  input, select, textarea { font-size: 1rem; min-height: 44px; }
  input[type=checkbox] { width: 24px; height: 24px; min-height: 0; flex-basis: 24px; }
  input.switch { width: 52px; height: 32px; min-height: 0; flex-basis: 52px; }
  input.switch::after { width: 26px; height: 26px; }
  input.switch:checked::after { transform: translateX(20px); }
  label.row { min-height: 44px; gap: 10px; align-items: center; }
  .periods button { height: 44px; }
  .bench-tog button:not(.info-btn) { height: 36px; }
  .ct-bar button { min-height: 44px; padding: 8px 12px; }
  summary, details.fold > summary, details.more-stats > summary, details.source-settings summary, .evidence summary, details.features summary { min-height: 44px; }
  .auto-job input[type=number], td input { min-height: 44px; }
  .more-actions .act { min-height: 44px; }
  .lrow-main { min-height: 64px; }
  .lrow-main.static { min-height: 60px; }
  .info-btn { width: 20px; height: 20px; }
}

/* ---------- light scheme ---------- */
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f4f6fb; --bg2: #f9fafd;
    --panel: #ffffff; --panel2: #f1f4fa; --panel3: #e5eaf4;
    --line: rgba(15,23,42,.09); --line2: rgba(15,23,42,.18);
    --text: #0e1626; --dim: #4b5873; --faint: #5d6a85;
    --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
    --series-5: #e87ba4; --series-6: #008300; --series-7: #4a3aa7; --series-8: #e34948;
    --accent: #2a63e0; --accent2: #1f56cf; --accent-solid: #2a63e0;
    --green: #087a42; --green-bg: rgba(8,122,66,.11);
    --red: #bd251d; --red-bg: rgba(189,37,29,.09);
    --amber: #9a5b00; --amber-bg: rgba(214,134,0,.14);
    --cash: #94a0b8;
    --shadow: 0 8px 28px rgba(15,23,42,.14);
    --elev1: 0 1px 2px rgba(15,23,42,.06);
    --card-bg: #ffffff; --glass: rgba(249,250,253,.86);
    --chart-text: #5d6a85; --chart-grid: rgba(15,23,42,.07);
  }
  body { background: linear-gradient(180deg, var(--bg2), var(--bg)); background-attachment: fixed; }
  aside { background: rgba(255,255,255,.8); }
  input, select, textarea { background: #fff; }
  .skel { background: linear-gradient(90deg, var(--panel2) 25%, var(--panel3) 40%, var(--panel2) 55%); background-size: 300% 100%; }
  #overlay, .modal-overlay { background: rgba(15,23,42,.35); }
  ::-webkit-scrollbar-thumb { border-color: var(--bg); }
  .msg.err { color: #8d1b15; } .msg.ok { color: #0a6a3b; } .msg.info { color: #1b469b; }
  .toast.ok { background: #e4f7ec; color: #0a6a3b; } .toast.err { background: #fde8e6; color: #8d1b15; } .toast.info { background: #e7eefc; color: #1b469b; }
  button.act.ok { background: #19a35f; color: #fff; }
  button.act.danger-ghost { color: var(--red); border-color: rgba(189,37,29,.4); }
  .case { background: var(--panel2); }
  .swipe .prop { background: var(--panel); }
  .confirm-note { color: var(--text); }
  .hero-chart .scrub circle, .hero-chart .scrub .sc-b { stroke: var(--bg); }
  .m-dot { border-color: var(--panel); }
  .semi circle { stroke: var(--panel); }
  details.features pre { background: var(--panel2); }
  .banner { color: var(--text); }
  .slide-label { color: #0a6a3b; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .hero-chart .end-halo { display: none; }
}

/* Siri */
.siri-list { list-style: none; margin: 12px 0 16px; padding: 0; display: grid; gap: 12px; }
.siri-list li { padding: 12px 14px; border: 1px solid var(--line, rgba(255,255,255,.08)); border-radius: 12px; }
.siri-say { font-weight: 600; margin-bottom: 4px; }

/* Why sheet */
.why-verdict { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.why-sec { margin: 14px 0; }
.why-sec h4 { margin: 0 0 6px; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
.why-sec p { margin: 0; line-height: 1.5; }
.why-sec summary { cursor: pointer; color: var(--dim); min-height: 44px; display: flex; align-items: center; }
.why-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.why-facts dt { color: var(--dim); } .why-facts dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.pre { white-space: pre-wrap; }

/* Today's move */
.lrow .c-val .today { display: block; font-size: .75rem; font-weight: 500; margin-top: 2px; }
.hero-delta.today { font-size: .9rem; margin-top: 2px; }
.hero-sub .sub-today { font-size: .95rem; margin-bottom: 4px; }

/* A name you can tap in a table row (Politicians → All) */
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-align: left; }
.linkish:hover { text-decoration: underline; }

/* Research: bullish / bearish tag per article */
.chip.tone { margin-left: 8px; font-size: .7rem; }
.chip.tone.up { background: var(--green-bg); color: var(--green); }
.chip.tone.down { background: var(--red-bg); color: var(--red); }
.reason.tone-why { font-size: .8rem; font-weight: 500; }

/* Weekly recap letter */
.panel.recap { max-width: 760px; line-height: 1.55; }
.panel.recap h3 { margin: 18px 0 6px; }
.panel.recap ul { margin: 4px 0 10px; padding-left: 20px; }
.panel.recap li { margin: 3px 0; }

/* Debate history: every call, graded; tap for the case, a post-mortem and a rerun */
.deb-list .deb-item { border-bottom: 1px solid var(--line); }
.deb-row { display: grid; grid-template-columns: 1.4fr 1fr .9fr auto; gap: 8px; align-items: center;
  width: 100%; background: none; border: 0; padding: 10px 2px; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.deb-row .who small { display: block; }
.deb-row .nums { text-align: right; }
.deb-detail:not(:empty) { padding: 4px 2px 14px; display: grid; gap: 8px; }
.deb-detail details summary { cursor: pointer; font-size: .85rem; color: var(--dim); }
.deb-detail .pm { background: var(--panel2); border-radius: var(--r-s); padding: 10px 12px; }
.deb-rerun { display: grid; gap: 6px; }
@media (max-width: 640px) { .deb-row { grid-template-columns: 1.3fr 1fr .9fr; } .deb-row > span:last-child { grid-column: 1 / -1; } }

/* Theme targets (Risk page) */
.theme-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.theme-bar { height: 6px; background: var(--panel2); border-radius: 3px; margin: 6px 0 4px; overflow: hidden; }
.theme-bar i { display: block; height: 100%; background: var(--accent); }
.theme-bar i.over { background: var(--amber); }
.theme-form { display: grid; gap: 8px; margin-top: 12px; }

/* Area labels (theme or industry) on every stock row; filled after one batched fetch. */
.area-tag { color: var(--accent2); font-weight: 600; }
.area-tag:empty, .chip.area:empty { display: none; }
.area-tag:not(:empty) + span::before { content: " · "; color: var(--dim); font-weight: 400; }
.chip.area { background: rgba(79,139,255,.12); color: var(--accent2); font-weight: 600; }

/* Approvals rank: #1 is the trade we think matters most (approvals.rank). */
.ap-rank { font-size: .78rem; font-weight: 750; color: var(--dim); min-width: 22px; }
.ap-rank.top { color: var(--accent2); }

/* Sector donut on Positions */
.pos-sectors .sub { font-size: .78rem; margin: 2px 0 10px; }
/* earnings panel (Positions, below the list: Blaide 10-30) */
.pos-earnings { margin-top: 16px; }
.pos-earnings .er-h { margin: 14px 0 2px; font-size: .74rem; font-weight: 650; letter-spacing: .6px;
                      text-transform: uppercase; color: var(--dim); }
.pos-earnings .er { display: block; width: 100%; text-align: left; background: none; border: 0;
                    border-top: 1px solid var(--line); padding: 9px 2px; color: var(--text); font: inherit; cursor: pointer; }
.pos-earnings .er-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pos-earnings .er-tag { color: var(--faint); font-size: .72rem; }
.pos-earnings .er.watch b { color: var(--dim); }
.pos-earnings .er-move, .pos-earnings .er-when { margin-left: auto; white-space: nowrap; }
.pos-earnings .er-when { color: var(--dim); font-size: .8rem; }
.pos-earnings .er-sub { display: block; margin-top: 3px; color: var(--dim); font-size: .8rem; line-height: 1.45; }
.pos-earnings .er-all { margin-top: 10px; }
.pos-sectors .legend { flex: 1 1 220px; min-width: 0; }
.pos-sectors .legend .li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 50px; gap: 8px; align-items: center; }
.pos-sectors .legend .li .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos-sectors .legend .li small { font-size: .72rem; white-space: nowrap; text-align: right; }
