:root {
  color-scheme: light;
  --page: #f4f4f1;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, .10);
  --brand: #00005a;
  --accent: #2a78d6;        /* series 1 */
  --accent-2: #eb6834;      /* series 2 */
  --up: #006300;
  --down: #d03b3b;
  --warn: #fab219;
  --mark: #ffe58a;
  /* categorical series, fixed order (validated palette) */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --s-other: #a8a69f;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --letter-size: 16.5px;
  --top: 58px;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --surface-2: #242423; --ink: #f0efec; --ink-2: #c3c2b7;
    --muted: #898781; --grid: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,.10);
    --brand: #9085e9; --accent: #3987e5; --accent-2: #d95926; --up: #0ca30c; --down: #e66767;
    --mark: #6b5310; --shadow: none;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --s-other: #5f5e59;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #242423; --ink: #f0efec; --ink-2: #c3c2b7;
  --muted: #898781; --grid: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,.10);
  --brand: #9085e9; --accent: #3987e5; --accent-2: #d95926; --up: #0ca30c; --down: #e66767;
  --mark: #6b5310; --shadow: none;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --s-other: #5f5e59;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--page); color: var(--ink); font: 14px/1.5 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h2 { font-size: 15px; margin: 0; letter-spacing: .01em; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--ink-2); }
[hidden] { display: none !important; }
kbd { font: 12px var(--font); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 0 6px; background: var(--surface-2); }

/* buttons & inputs */
.btn { font: inherit; font-weight: 600; border: 1px solid transparent; background: var(--accent); color: #fff;
  border-radius: 8px; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--ink-2); border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.icon { padding: 5px 9px; }
.btn.on { color: var(--up); border-color: currentColor; }
.btn:disabled { opacity: .4; cursor: default; }
input, select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; min-width: 0; }
input:focus, select:focus, .btn:focus-visible, .tabs a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { font: inherit; font-size: 13px; font-weight: 600; border: 0; background: transparent; color: var(--ink-2);
  padding: 4px 10px; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; min-height: var(--top);
  padding: 8px 20px; background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.brand { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.brand small { display: block; color: var(--muted); font-size: 12px; line-height: 1.2; white-space: nowrap; }
.brand strong { font-size: 16px; }
/* a nod to the black-and-amber Bloomberg Terminal */
.logo { width: 32px; height: 32px; border-radius: 8px; background: #111; color: #ff9f1a; display: grid;
  place-items: center; font-weight: 800; font-size: 19px; box-shadow: inset 0 0 0 1px rgba(255,159,26,.35);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.brand strong { letter-spacing: .01em; }
.tabs { display: flex; gap: 2px; }
.tabs a { color: var(--ink-2); font-weight: 600; padding: 6px 12px; border-radius: 8px; white-space: nowrap; }
.tabs a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.tabs a.on { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.quicksearch { flex: 1; max-width: 420px; margin-left: auto; }
.quicksearch input { width: 100%; padding: 7px 14px; border-radius: 999px; background: var(--surface-2); }
.actions { display: flex; gap: 6px; align-items: center; }
.clocks { display: flex; gap: 6px; }
.clock { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.clock::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; background: var(--muted); vertical-align: 1px; }
.clock.open::before { background: #0ca30c; }
.user-box { display: flex; gap: 6px; align-items: center; margin: 0; }
.user-name { font-size: 12.5px; font-weight: 600; color: var(--ink-2); padding: 3px 9px; border-radius: 999px; background: var(--surface-2); white-space: nowrap; }
.user-name::before { content: "●"; color: #ff9f1a; margin-right: 5px; font-size: 9px; vertical-align: 1px; }
.user-name:hover { text-decoration: none; color: var(--ink); }
.list .badge { font-size: 10px; font-weight: 700; padding: 0 5px; border-radius: 4px; background: var(--surface-2); color: var(--brand); margin-left: 6px; border: 1px solid var(--border); }
.list .row-acts { display: flex; gap: 6px; flex-shrink: 0; }
.signup-box { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); margin-bottom: 10px; }
.signup-box .seg { background: var(--surface); }
.signup-box .seg button.on { background: var(--surface-2); }
h3.mini { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0; }
.invite { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.invite code { font: 600 15px ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .12em; padding: 2px 8px;
  border-radius: 6px; background: var(--surface); border: 1px solid var(--border); }
.sync { font-size: 12px; color: var(--muted); white-space: nowrap; }
.sync.busy::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%;
  background: var(--accent); animation: pulse 1s infinite alternate; }
@keyframes pulse { from { opacity: .25 } to { opacity: 1 } }

/* markets strip */
.strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(136px, 1fr); gap: 8px;
  overflow-x: auto; padding: 12px 20px 2px; scrollbar-width: thin; max-width: 1840px; margin: 0 auto; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 7px 11px;
  box-shadow: var(--shadow); min-width: 0; }
.tile .lbl { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .row { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.tile .val { font-weight: 650; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.tile .chg { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile svg { display: block; width: 100%; height: 24px; margin-top: 2px; }

/* views */
.view { padding: 12px 20px 40px; max-width: 1840px; margin: 0 auto; }
.today-grid { display: grid; gap: 16px; align-items: start;
  grid-template-columns: minmax(290px, 340px) minmax(0, 1fr) minmax(330px, 400px);
  grid-template-areas: "left letter right"; }
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.col-left { grid-area: left; }
.col-center { grid-area: letter; }
.col-right { grid-area: right; position: sticky; top: calc(var(--top) + 12px); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.tools-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); align-items: start; }

/* letter */
.letter { padding: 16px 28px 28px; }
.letter-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.letter-head .nav, .letter-head .links { display: flex; gap: 6px; align-items: center; }
.letter-head .links a { margin-left: 6px; }
.banner { margin: 12px 0 0; padding: 10px 14px; border-radius: 10px; background: color-mix(in srgb, var(--warn) 18%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--warn) 55%, transparent); font-size: 13.5px; }
.banner .tag { cursor: pointer; font-weight: 700; }
.letter-meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.scorecard { display: flex; gap: 6px; flex-wrap: wrap; }
.score { display: flex; gap: 6px; align-items: baseline; padding: 4px 10px; border-radius: 8px; background: var(--surface-2); font-size: 13px; }
.score b { font-variant-numeric: tabular-nums; }
.letter-body { font-family: var(--serif); font-size: var(--letter-size); line-height: 1.68; color: var(--ink); max-width: 740px; margin: 0 auto; }
.letter-body .main-head-news h1 { font-family: var(--font); font-size: 1.75em; line-height: 1.2; margin: 18px 0 4px; color: var(--ink); }
.letter-body .timestamp h2 { font-family: var(--font); font-size: 13px; font-weight: 500; color: var(--muted); margin: 0 0 8px; }
.letter-body article { margin: 24px 0; scroll-margin-top: calc(var(--top) + 16px); }
.letter-body article > h2 { font-family: var(--font); font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--brand); margin-bottom: 8px; }
.letter-body img { max-width: 100%; height: auto; border-radius: 8px; margin: 6px 0 10px; }
.letter-body font[color] { font-family: var(--font); font-weight: 600; font-size: .94em; }
.letter-body .read-more-btn { display: none; }
.letter-body a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: 2px; }
.letter-body a.src { font-family: var(--font); font-size: 12px; font-weight: 600; text-decoration: none; white-space: nowrap;
  padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); vertical-align: 1px; }
.letter-body a.src:hover { color: var(--accent); }
mark, .hit { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 2px; }
.hit { box-shadow: 0 0 0 1px color-mix(in srgb, var(--warn) 70%, transparent); }

/* watchlist (compact list) */
.add { display: flex; gap: 6px; margin-bottom: 8px; }
.add input { flex: 1; }
.msg { margin: 0 0 8px; font-size: 13px; color: var(--down); }
.msg.ok { color: var(--up); }
.watch { list-style: none; margin: 0 -8px; padding: 0; }
.watch li { display: grid; grid-template-columns: minmax(0, 1fr) 64px 76px 22px; gap: 8px; align-items: center;
  padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.watch li + li { border-top: 1px solid var(--grid); }
.watch li:hover { background: var(--surface-2); }
.watch .sym { font-weight: 700; }
.watch .name { display: block; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watch svg { width: 64px; height: 24px; display: block; }
.watch .px { text-align: right; font-variant-numeric: tabular-nums; line-height: 1.25; }
.watch .px small { display: block; font-size: 12px; font-weight: 600; }
.watch .rm { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; padding: 2px; border-radius: 5px; opacity: .45; }
.watch li:hover .rm, .watch .rm:focus-visible { opacity: 1; }
.watch .rm:hover { color: var(--down); background: color-mix(in srgb, var(--down) 12%, transparent); }
.tag-hit { display: inline-block; margin-left: 4px; font-size: 9.5px; font-weight: 700; padding: 0 4px; border-radius: 4px;
  background: var(--mark); color: var(--ink); vertical-align: 1px; }
.tag-pick { display: inline-block; margin-left: 4px; font-size: 9.5px; font-weight: 700; padding: 0 4px; border-radius: 4px;
  background: var(--surface-2); color: var(--brand); vertical-align: 1px; border: 1px solid var(--border); }
.mentions { font-size: 11px; color: var(--muted); }

/* movers */
.movers { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; font-size: 13px; }
.movers .h { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.movers .m { display: flex; justify-content: space-between; gap: 6px; cursor: pointer; padding: 2px 0; }
.movers .m:hover .n { color: var(--accent); }
.movers .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 7px 0; border-bottom: 1px solid var(--grid); display: flex; gap: 10px; justify-content: space-between; align-items: baseline; }
.list li:last-child { border-bottom: 0; }
.list .when { color: var(--muted); font-size: 12px; white-space: nowrap; }
.list .t { font-weight: 600; }
.list .sub { display: block; font-size: 12.5px; color: var(--ink-2); }
.otd li { display: block; }
.linkish { cursor: pointer; color: var(--accent); }
.linkish:hover { text-decoration: underline; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-size: 12.5px; border: 1px solid var(--border); background: var(--surface-2); color: var(--ink);
  border-radius: 999px; padding: 3px 10px; cursor: pointer; }
.chip:hover, .chip.on { border-color: var(--accent); color: var(--accent); }
.chip .n { color: var(--muted); margin-left: 4px; font-variant-numeric: tabular-nums; }
.chips.small .chip { font-size: 12px; padding: 2px 9px; }

/* news */
.news-card { display: flex; flex-direction: column; max-height: calc(100vh - var(--top) - 290px); min-height: 380px; }
#wnews-filter { margin-bottom: 6px; }
.news { list-style: none; margin: 0 -4px; padding: 0 4px; overflow-y: auto; flex: 1; }
.news li { display: grid; grid-template-columns: 52px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--grid); }
.news li.nothumb { grid-template-columns: 1fr; }
.news img { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; background: var(--surface-2); }
.news a { color: var(--ink); font-weight: 600; line-height: 1.35; font-size: 13.5px; }
.news a:hover { color: var(--accent); }
.news .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.news .tk { font-size: 10.5px; font-weight: 700; padding: 0 5px; border-radius: 4px; background: var(--surface-2); color: var(--ink-2); margin-right: 4px; }

/* tables (picks, portfolio) */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { font-size: 11.5px; font-weight: 600; color: var(--muted); text-align: left; padding: 6px 8px;
  border-bottom: 1px solid var(--grid); white-space: nowrap; user-select: none; }
.table th[data-k] { cursor: pointer; }
.table th[data-k]:hover { color: var(--ink); }
.table th.sorted::after { content: " ▾"; }
.table th.sorted.asc::after { content: " ▴"; }
.table td { padding: 8px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr.click:hover { background: var(--surface-2); }
.table tr.group td { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
  background: var(--surface-2); padding: 5px 8px; }
.table .stock b { font-weight: 700; }
.table .stock .code { color: var(--muted); font-size: 12px; margin-left: 6px; }
.table .stock .desc { display: block; font-size: 12px; color: var(--ink-2); max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table svg { width: 110px; height: 28px; display: block; margin-left: auto; }
.table input { width: 96px; text-align: right; padding: 4px 8px; }
.table .acts { white-space: nowrap; text-align: right; }
.star { border: 1px solid var(--border); background: transparent; color: var(--ink-2); border-radius: 7px; padding: 2px 8px;
  cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; white-space: nowrap; }
.star.on { color: var(--brand); border-color: currentColor; }
.pill { display: inline-block; min-width: 26px; text-align: center; padding: 0 6px; border-radius: 999px; background: var(--surface-2);
  font-weight: 600; font-size: 12px; }
.weight { height: 8px; border-radius: 4px; background: var(--accent); min-width: 2px; }
.weight-cell { width: 140px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.stat .k { font-size: 11.5px; color: var(--muted); }
.stat .v { font-weight: 700; font-size: 20px; font-variant-numeric: tabular-nums; line-height: 1.3; }
.stat .s { font-size: 12.5px; }
/* portfolio allocation & groups */
.pf-bar-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 8px; }
.alloc { margin-bottom: 14px; }
.alloc-bar { display: flex; gap: 2px; height: 22px; border-radius: 6px; overflow: hidden; }
.alloc-bar span { min-width: 3px; cursor: default; }
.alloc-bar span:hover { opacity: .8; }
.alloc-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 8px; font-size: 12.5px; color: var(--ink-2); }
.alloc-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.alloc-legend b { color: var(--ink); font-variant-numeric: tabular-nums; margin-left: 4px; }
.table.pf tr.grp td { background: var(--surface-2); font-weight: 650; cursor: pointer; border-bottom: 1px solid var(--grid); }
.table.pf tr.grp td:first-child { white-space: nowrap; }
.table.pf tr.grp .caret { display: inline-block; width: 14px; color: var(--muted); transition: transform .15s; }
.table.pf tr.grp.closed .caret { transform: rotate(-90deg); }
.table.pf tr.grp i.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.table.pf tr.grp .cnt { color: var(--muted); font-weight: 500; margin-left: 6px; font-size: 12px; }
.table.pf tr.unheld td { color: var(--ink-2); }
.table.pf .grp-in { width: 110px; text-align: left; }
.wt { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.wt .bar { width: 60px; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.wt .bar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.wt b { font-variant-numeric: tabular-nums; min-width: 46px; text-align: right; font-weight: 600; }
/* portfolio card */
.pf-card { padding: 18px 22px 22px; }
.pf-head { margin-bottom: 14px; }
.pf-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pf-actions .add { margin: 0; }
.pf-actions .add input { width: 200px; }
#pf-edit[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.pf-hero { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr); gap: 24px; align-items: stretch;
  padding: 16px 18px; border-radius: 12px; background: var(--surface-2); margin-bottom: 18px; }
.pf-hero .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.pf-hero .big { font-size: 34px; font-weight: 750; letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.15; margin-top: 2px; }
.pf-today { font-size: 15px; font-weight: 600; margin-top: 2px; }
.pf-today .muted { font-weight: 400; font-size: 13px; }
.pf-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin-top: 16px; }
.pf-stats .k { font-size: 11px; }
.pf-stats .v { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; }
.pf-stats .s { font-size: 12px; color: var(--muted); }
.pf-hero-chart { min-width: 0; align-self: center; }
.pf-hero-chart .title { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.pf-empty { padding: 18px 20px; border: 1px dashed var(--axis); border-radius: 12px; margin-bottom: 16px; }
.pf-empty h3 { margin: 0 0 6px; font-size: 16px; }
.pf-empty ol { margin: 0; padding-left: 20px; color: var(--ink-2); line-height: 1.8; }
.pf-section { margin-bottom: 14px; }
.pf-editing { margin: 0 0 8px; padding: 8px 12px; border-radius: 8px; font-size: 13px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--ink-2); }
.table.pf td .sub2, .table.pf td .sub { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; white-space: nowrap; }
.table.pf td.stock b { font-size: 13.5px; }
#pf-table th:first-child { width: 28%; }
.table.pf tbody tr:not(.grp):hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table.pf .rm { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; padding: 2px 6px; border-radius: 6px; }
.table.pf .rm:hover { color: var(--down); background: color-mix(in srgb, var(--down) 12%, transparent); }
.table.pf tr.grp.total td { background: transparent; border-top: 2px solid var(--grid); border-bottom: 0; cursor: default; font-size: 14px; }
.table.pf input { width: 92px; }
.table.pf .grp-in { width: 130px; }
.table.pf tr.just-added td { animation: flash 4s ease-out; }
@keyframes flash { 0%, 40% { background: color-mix(in srgb, var(--warn) 28%, var(--surface)); } 100% { background: transparent; } }
.table.pf thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }

/* group cards */
.pf-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 0 0 18px; }
.gcard { text-align: left; font: inherit; color: inherit; cursor: pointer; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gcard:hover { border-color: var(--axis); }
.gcard.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.gcard .gn { font-weight: 650; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcard .gv { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.gcard .gs { font-size: 12px; color: var(--muted); }
.gcard i.sw, .grp-title i.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: 0 0 10px; }
.gcard.new { border-style: dashed; align-items: center; justify-content: center; color: var(--accent); font-weight: 650; min-height: 74px; }
.gcard.new:hover { background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }

/* one group's page */
.grp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.grp-title { margin: 0; font-size: 20px; display: flex; align-items: center; gap: 8px; }
.grp-title i.sw { width: 12px; height: 12px; }
.grp-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.grp-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.grp-plan { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 8px; }
.gp-item { padding: 12px 14px; border-radius: 10px; background: var(--surface-2); display: flex; flex-direction: column; gap: 6px; }
.gp-item label:first-child, .gp-item .lbl { font-weight: 650; font-size: 13.5px; }
.gp-item .row-btns { margin: 0; }
.gp-item label.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.pl-amount-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pl-amount-row .amt input { width: 140px; }
.grp-apply { margin-top: 12px; align-items: center; }
#g-table th.th-plan { color: var(--accent); }
#g-table .tw { width: 64px; }
#g-table td.sh { font-weight: 700; }
#g-table tfoot td { font-weight: 650; border-top: 2px solid var(--grid); background: var(--surface-2); }
.drift { display: block; font-size: 11px; }

/* modal (new group guide) */
.modal { position: fixed; inset: 0; z-index: 55; display: grid; place-items: center; padding: 16px; }
.modal-back { position: absolute; inset: 0; background: rgba(0,0,0,.4); }
.modal-panel { position: relative; width: min(520px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface);
  border-radius: 14px; padding: 22px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: pop .15s ease-out; }
@keyframes pop { from { transform: scale(.97); } to { transform: none; } }
.modal-panel .close { position: absolute; right: 14px; top: 14px; }
.modal-panel h2 { font-size: 19px; margin: 0 0 10px; }
.wiz-steps { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 18px; counter-reset: s; }
.wiz-steps li { counter-increment: s; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.wiz-steps li::before { content: counter(s); width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 11px; background: var(--surface-2); color: var(--muted); }
.wiz-steps li + li::after { content: none; }
.wiz-steps li:not(:last-child) { margin-right: 10px; }
.wiz-steps li.on { color: var(--ink); font-weight: 650; }
.wiz-steps li.on::before, .wiz-steps li.done::before { background: var(--ink); color: var(--surface); }
.wiz-label { display: block; font-weight: 650; margin: 0 0 8px; }
.wiz-step > input { width: 100%; font-size: 16px; padding: 9px 12px; }
.wiz-step .chips { margin-top: 10px; }
.wiz-stocks { list-style: none; margin: 0 0 12px; padding: 0; max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; }
.wiz-stocks li + li { border-top: 1px solid var(--grid); }
.wiz-stocks label { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; }
.wiz-stocks label:hover { background: var(--surface-2); }
.wiz-stocks input { width: 18px; height: 18px; flex: 0 0 18px; }
.wiz-stocks .nm { flex: 1; min-width: 0; }
.wiz-stocks .nm small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wiz-stocks .tag { font-size: 11px; color: var(--muted); white-space: nowrap; }
.wiz-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 18px; }
#wiz-summary { margin-top: 10px; }

@media (max-width: 1000px) {
  .pf-hero { grid-template-columns: 1fr; }
  .grp-plan { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .pf-card { padding: 14px; }
  .pf-hero .big { font-size: 28px; }
  .pf-actions, .pf-actions .add { width: 100%; }
  .pf-actions .add input { flex: 1; width: auto; }
  .table.pf .hide-sm { display: none; }
}
.amt { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); padding-left: 10px; }
.amt span { color: var(--muted); font-weight: 600; }
.amt input { border: 0; width: 170px; font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; }
.amt:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.amt input:focus { outline: none; }
.pl-check { margin: 4px 0 10px; font-size: 13.5px; }
.pl-check.bad { color: var(--down); font-weight: 600; }
#g-table .px small, #g-table .sub2 { display: block; color: var(--muted); font-size: 11.5px; }
.trade { font-weight: 700; white-space: nowrap; }
.wt-sub { display: block; font-size: 11px; color: var(--muted); text-align: right; white-space: nowrap; }
.plan-link { font: inherit; font-size: 11.5px; font-weight: 600; border: 1px solid var(--border); background: var(--surface); color: var(--accent);
  border-radius: 6px; padding: 0 7px; margin-left: 8px; cursor: pointer; }
.pf-add { display: flex; gap: 10px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.pf-add .add { margin: 0; }

/* search */
.search-form { display: grid; grid-template-columns: 1fr auto auto auto auto; gap: 8px; }
.history { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; align-items: center; font-size: 12px; color: var(--muted); }
.chart { margin-top: 12px; }
.chart svg { width: 100%; display: block; overflow: visible; }
.chart .title { font-size: 12.5px; color: var(--ink-2); margin-bottom: 4px; }
.search-stock { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.ss-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.ss-head .nm { font-weight: 700; font-size: 16px; }
.ss-head .px { font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
.ss-head .spacer { flex: 1; }
.ss-head form { display: flex; gap: 6px; align-items: center; }
.ss-head form input { width: 100px; padding: 4px 8px; }
.ss-stats { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }
.mention-dot { fill: var(--accent-2); stroke: var(--surface); stroke-width: 2; cursor: pointer; }
.mention-dot.hover { stroke: var(--ink); }
.results { list-style: none; padding: 0; margin: 8px 0 0; columns: 3 380px; column-gap: 28px; }
.results li { break-inside: avoid; padding: 10px 0; border-bottom: 1px solid var(--grid); }
.results .head { display: flex; gap: 10px; align-items: baseline; }
.results .date { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.results .t { font-weight: 650; cursor: pointer; }
.results .t:hover { color: var(--accent); }
.results p { margin: 2px 0 0; color: var(--ink-2); font-size: 13.5px; }
.results .more { color: var(--muted); font-size: 13px; }

/* tools */
.fx { display: grid; grid-template-columns: 1fr auto auto auto; gap: 6px; }
.fx-out { font-size: 26px; font-weight: 700; margin: 12px 0 4px; font-variant-numeric: tabular-nums; }
.fx-rates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.cg { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.cg label, .settings label { font-size: 12px; color: var(--ink-2); display: flex; flex-direction: column; gap: 3px; }
.settings { display: flex; flex-direction: column; gap: 10px; }
.settings label.check { display: block; font-size: 13.5px; color: var(--ink); line-height: 2; }
.settings label.check input[type="checkbox"] { margin: 0 6px 0 0; vertical-align: -2px; }
.cg-out { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; word-break: break-all; }
.hours .open { color: var(--up); font-weight: 600; }

/* drawer */
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer-back { position: absolute; inset: 0; background: rgba(0,0,0,.35); }
.drawer-panel { position: absolute; right: 0; top: 0; bottom: 0; width: min(600px, 100%); background: var(--surface);
  border-left: 1px solid var(--border); padding: 22px 24px; overflow-y: auto; animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(30px); opacity: .5 } to { transform: none; opacity: 1 } }
.drawer .close { position: absolute; right: 16px; top: 16px; }
.d-title { font-size: 22px; margin: 0; }
.d-name { color: var(--muted); margin: 0 0 12px; }
.d-desc { color: var(--ink-2); margin: -6px 0 12px; font-size: 13.5px; }
.d-price { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.d-price .big { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.d-actions { display: flex; gap: 8px; margin: 12px 0 0; flex-wrap: wrap; }
.d-section { margin-top: 22px; }
.d-section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 8px; }
.d-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-top: 12px; }
.d-stats .v { font-size: 15px; }
.research li { display: block; }
.research p { margin: 2px 0 0; font-size: 13px; color: var(--ink-2); }
.inline-form { display: flex; gap: 6px; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 90px; }
.danger { color: var(--down) !important; border-color: color-mix(in srgb, var(--down) 40%, transparent) !important; }

/* tooltip & toast */
.tip { position: fixed; z-index: 60; pointer-events: none; background: var(--ink); color: var(--surface); font-size: 12px;
  padding: 5px 8px; border-radius: 6px; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); }
.toast { position: fixed; z-index: 70; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--surface);
  padding: 10px 16px; border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.2); font-weight: 500; display: flex; gap: 14px; align-items: center; max-width: calc(100% - 32px); }
.toast button { font: inherit; font-weight: 700; background: transparent; border: 0; color: var(--surface); text-decoration: underline; cursor: pointer; }

/* chart marks */
.spark { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark-area { fill: var(--accent); opacity: .08; }
.gridline { stroke: var(--grid); stroke-width: 1; }
.axis-line { stroke: var(--axis); stroke-width: 1; }
.axis-text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.bar { fill: var(--accent); }
.bar.b2 { fill: var(--accent-2); }
.bar.hover { opacity: .75; }
.cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* responsive */
@media (max-width: 1480px) {
  .clocks { display: none; }
}
@media (max-width: 640px) {
  .user-box .btn { padding: 5px 8px; }
  .user-name { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 1360px) {
  .today-grid { grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
    grid-template-areas: "letter left" "letter right"; }
  .col-right { position: static; }
  .news-card { max-height: 560px; }
  .sync { display: none; }
}
@media (max-width: 1100px) {
  .topbar { flex-wrap: wrap; gap: 10px; }
  .tabs { order: 3; flex-basis: 100%; overflow-x: auto; }
  .quicksearch { max-width: none; }
}
@media (max-width: 900px) {
  .view, .strip { padding-left: 16px; padding-right: 16px; }
  .today-grid { grid-template-columns: 1fr; grid-template-areas: "letter" "left" "right"; }
  .letter { padding: 14px 16px 20px; }
  .results { columns: 1; }
  .search-form { grid-template-columns: 1fr 1fr; }
  .search-form #sq { grid-column: 1 / -1; }
  .tools-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar { padding: 8px 12px; }
  .brand small { display: none; }
  .quicksearch { order: 2; flex-basis: 100%; }
  :root { --letter-size: 15.5px; }
  .fx { grid-template-columns: 1fr 1fr; }
  .fx #fx-swap { display: none; }
  .cg-out, .fx-rates, .d-stats { grid-template-columns: 1fr 1fr; }
  .table .stock .desc { max-width: 180px; }
}
