:root {
  --bg: #0a0b0d;
  --panel: #14171c;
  --panel-2: #1a1d24;
  --border: #23262d;
  --text: #e6e8ea;
  --muted: #7d8590;
  --green: #16c784;
  --red: #ea3943;
  --accent: #22d3ee;
  --gold: #fdcb6e;
  --violet: #c084fc;
  --sky: #38bdf8;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Roboto Mono", Menlo, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.spacer { flex: 1; }

/* Header */
header.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #101317, #0b0e11);
  position: sticky; top: 0; z-index: 30;
}
.brand { font-weight: 800; letter-spacing: 1px; font-size: 15px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand .slash { color: var(--accent); }
.topbar nav { display: inline-flex; align-items: center; }
.topbar nav a { color: var(--muted); margin-left: 14px; font-weight: 600; }
.topbar nav a.active, .topbar nav a:hover { color: var(--text); text-decoration: none; }
.stamp { color: var(--muted); font-size: 11px; }

/* Page shell */
.page { max-width: 720px; margin: 0 auto; padding: 20px 16px 60px; }
.page-wide { max-width: 1080px; }
.titlebar { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.titlebar h1 { margin: 0; font-size: 20px; }
.account-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover;
  background: var(--panel-2); border: 1px solid var(--border); align-self: center; flex-shrink: 0; }
.note { color: var(--muted); font-size: 12px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.card h3 { margin: 0 0 12px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.empty { color: var(--muted); text-align: center; padding: 40px 16px; }

/* Feed */
.feed { display: flex; flex-direction: column; gap: 12px; }
.tw {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; transition: border-color .12s ease;
}
.tw:hover { border-color: #30343c; }
.tw-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tw-avatar-link { display: inline-flex; flex-shrink: 0; margin-right: -2px; line-height: 0; }
.tw-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
  background: var(--panel-2); border: 1px solid var(--border); flex-shrink: 0; }
.tw-user { font-weight: 700; font-family: var(--mono); color: var(--text); }
.tw-user:hover { color: var(--accent); text-decoration: none; }
.tw-time { font-size: 11px; }
.tw-text { white-space: pre-wrap; line-height: 1.55; word-wrap: break-word; }
/* Trade-action highlight: the sentence where the author reports a position change.
   Highlighter-pen look -- yellow background, dark text for contrast. */
.tw-text mark.trade {
  background: var(--gold); color: #14171c;
  border-radius: 3px; padding: 0 3px;
}
/* First-mention cashtag inside the body: the $TICKER the author is naming for the
   first time. Violet, distinct from the gold trade highlight and gold ticker chips. */
.tw-text .first-tk { color: var(--violet); }
/* When it sits inside a gold trade <mark>, violet-on-gold is low contrast:
   use a deep-violet text color instead. */
.tw-text mark.trade .first-tk { color: #3b0a63; }
/* Intent highlight: a conditional / planned / teased move, not an executed trade.
   Tentative look -- no solid fill, just a dashed gold underline -- so it reads as
   "forward-looking" against the solid-gold executed-trade highlight. */
.tw-text mark.trade.kind-intent {
  background: transparent; color: inherit;
  border-radius: 0; padding: 0; border-bottom: 2px dashed var(--gold);
}
.tw-text mark.trade.kind-intent .first-tk { color: var(--violet); }
/* Position highlight: a disclosed standing holding (no fresh trade). A cool dotted
   underline -- distinct from gold trade/intent, reads as "already in the book". */
.tw-text mark.trade.kind-position {
  background: transparent; color: inherit;
  border-radius: 0; padding: 0; border-bottom: 2px dotted var(--sky);
}
.tw-text mark.trade.kind-position .first-tk { color: var(--violet); }
/* Media: photos / video posters attached to a tweet. The trailing pic.x.com
   link is stripped from the text in views._tweet_row; the image renders here. */
.tw-media { margin-top: 10px; display: grid; gap: 4px; border-radius: 10px; overflow: hidden; }
.tw-media-1 { grid-template-columns: 1fr; }
.tw-media-2, .tw-media-n { grid-template-columns: 1fr 1fr; }
.tw-media-item { position: relative; display: block; min-height: 0; }
.tw-media-item:hover { text-decoration: none; }
.tw-media-item img {
  width: 100%; height: 100%; max-height: 440px; object-fit: cover; display: block;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
}
/* A lone image isn't cropped -- show it whole, capped in height. */
.tw-media-1 .tw-media-item img { max-height: 520px; object-fit: contain; }
.tw-media-play {
  position: absolute; inset: 0; margin: auto; width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center; padding-left: 3px;
  font-size: 18px; color: #fff; background: rgba(0,0,0,.55); border-radius: 50%;
}

/* Quoted-tweet link: the quote renders as a card on X, here as a compact link. */
.tw-quote { display: inline-block; margin-top: 8px; font-size: 13px; text-decoration: none;
  padding: 4px 10px; border: 1px solid var(--border); border-radius: 6px; }
.tw-quote:hover { color: var(--accent); border-color: var(--accent); }
.tw-summary { margin-top: 8px; padding-left: 10px; border-left: 2px solid var(--border); font-style: italic; }
.tw-foot { display: flex; align-items: center; gap: 16px; margin-top: 12px; font-size: 12px; }
.tw-foot a { color: var(--muted); }
.tw-foot a:hover { color: var(--accent); }

/* Tickers */
.tickers { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ticker {
  font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--gold);
  background: #2a230d; border: 1px solid #5a4a18; border-radius: 5px; padding: 2px 8px;
}
.ticker:hover { text-decoration: none; border-color: var(--gold); }
/* First-mention ticker chip: same violet language as the in-body cashtag. */
.ticker.first { color: var(--violet); background: #1e1233; border-color: #6d28d9; }
.ticker.first:hover { border-color: var(--violet); }

/* Returns heatmap: how each detected trade call performed, per time window. Rows are
   tickers, columns are windows; numbers are direction-signed so green always = "right". */
.tw-returns {
  margin-top: 10px; border-collapse: collapse; width: 100%;
  font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 12px;
}
.tw-returns th, .tw-returns td {
  padding: 4px 8px; text-align: right; border: 1px solid var(--border);
}
.tw-returns thead th {
  color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase;
  letter-spacing: .3px; background: var(--panel-2);
}
.tw-returns .ret-corner { text-align: left; }
.tw-returns .ret-tk {
  text-align: left; color: var(--gold); font-weight: 700; white-space: nowrap;
}
/* long / short tag next to the ticker, so a signed (esp. short) number reads correctly. */
.ret-dir {
  margin-left: 6px; font-size: 9px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .3px; padding: 1px 5px; border-radius: 4px; vertical-align: middle;
}
.ret-dir-long  { color: #0a0b0d; background: var(--sky); }
.ret-dir-short { color: var(--gold); background: transparent; border: 1px solid var(--gold); }
/* Cell tint scales with sign: faint green/red wash behind the number. */
.ret-cell { color: var(--text); }
.ret-cell.ret-pos  { color: var(--green); background: rgba(22,199,132,.12); }
.ret-cell.ret-neg  { color: var(--red);   background: rgba(234,57,67,.12); }
.ret-cell.ret-flat { color: var(--muted); }
.ret-cell.ret-na   { color: var(--muted); opacity: .55; }

/* Badges */
.badge {
  display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .4px;
  text-transform: uppercase; padding: 2px 7px; border-radius: 5px; border: 1px solid var(--border);
}
.badge.stock, .badge.v-stock { color: #0a0b0d; background: var(--green); border-color: var(--green); }
.badge.first { color: #0a0b0d; background: var(--violet); border-color: var(--violet); }
.badge.trade { color: #14171c; background: var(--gold); border-color: var(--gold); }
/* Intent: forward-looking (conditional / planned / teased), not executed. Hollow,
   dashed gold -- the "tentative" sibling of the solid-gold trade badge. */
.badge.intent { color: var(--gold); background: transparent; border: 1px dashed var(--gold); }
/* Position: a disclosed standing holding, no fresh trade. Cool sky-blue, its own
   colour family so it never reads as an executed (gold) move. */
.badge.position { color: #0a0b0d; background: var(--sky); border-color: var(--sky); }
.badge.thesis, .badge.v-thesis { color: var(--gold); border-color: var(--gold); background: #2a230d; }
.badge.v-unclassified { color: var(--violet); border-color: #6d28d9; background: #2e1065; }
.badge.none, .badge.v-not-qualified { color: var(--muted); }
.badge.v-queued, .badge.v-resolving, .badge.v-harvesting, .badge.v-classifying {
  color: var(--accent); border-color: #155e63; background: #0c2326;
}
.badge.v-done { color: #0a0b0d; background: var(--green); border-color: var(--green); }
.badge.v-error { color: var(--red); border-color: var(--red); background: rgba(234,57,67,.12); }

/* Account meta toggle */
.acct-meta { margin-bottom: 14px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; margin-left: 6px; }
.seg a { padding: 3px 10px; color: var(--muted); font-size: 12px; }
.seg a:hover { text-decoration: none; color: var(--text); }
.seg a.on { background: var(--panel-2); color: var(--text); }
.debughint { margin-bottom: 14px; padding: 10px 12px; border: 1px dashed var(--border); border-radius: 8px; }

/* Pager */
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 22px; }

/* Buttons + forms */
.btn { background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
       border-radius: 6px; padding: 7px 14px; cursor: pointer; font-weight: 600; font-size: 13px; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.disabled { color: var(--muted); border-color: var(--border); cursor: default; opacity: .5; }
.btn.disabled:hover { border-color: var(--border); }
input, select, textarea {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 6px 9px; font-family: var(--mono); font-size: 13px;
}
.harvest-form { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.settings-form { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; max-width: 420px; }
.settings-form .note { margin: 0; }
.settings-form select { align-self: stretch; }
.harvest-form label { font-size: 11px; color: var(--muted); }

/* Jobs + accounts tables */
table.jobs { width: 100%; border-collapse: collapse; }
table.jobs th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase;
                letter-spacing: .4px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
table.jobs td { padding: 8px; border-bottom: 1px solid #181b21; vertical-align: middle; }
.jobline { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 10px 12px;
           border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); }
.livedot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green);
           animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* Auth */
.logout-form { display: inline; margin: 0 0 0 14px; }
.linkbtn { background: none; border: none; padding: 0; cursor: pointer; color: var(--muted);
           font: inherit; font-weight: 600; }
.linkbtn:hover { color: var(--text); }
.login-wrap { display: flex; justify-content: center; padding: 48px 16px; }
.login-card { width: 340px; max-width: 100%; }
.login-card h1 { margin: 0 0 6px; font-size: 18px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.login-card input { width: 100%; }
.login-card .btn { margin-top: 4px; }
.login-err { margin: 10px 0; padding: 8px 10px; border-radius: 6px;
             background: rgba(234,57,67,0.12); border: 1px solid var(--red); color: var(--red); font-size: 12px; }
.code-input { font-size: 22px; letter-spacing: 8px; text-align: center;
              font-family: var(--mono, ui-monospace, monospace); }
.resend-form { margin-top: 14px; text-align: center; }
.upgrade-link { color: var(--green); font-weight: 600; }

/* Traders (follow manager) */
.trader-ok { margin: 10px 0; padding: 8px 10px; border-radius: 6px; font-size: 12px;
             background: rgba(22,199,132,0.12); border: 1px solid var(--green); color: var(--green); }
.track-form { display: flex; gap: 10px; padding: 12px; margin: 4px 0 6px; }
.track-form input { flex: 1; min-width: 0; }
.track-note { margin: 0 0 18px 2px; }
.upgrade-banner { margin: 4px 0 18px; padding: 12px 14px; }
.trader-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
               gap: 12px; }
@media (max-width: 720px) { .trader-grid { grid-template-columns: 1fr; } }
.trader-card { background: var(--panel, #0d1117); border: 1px solid var(--border, #1c232c);
               border-radius: 11px; padding: 14px 16px; display: flex; flex-direction: column;
               gap: 8px; transition: border-color .15s; }
.trader-card:hover { border-color: #2a3542; }
.trader-card.followed { border-color: rgba(22,199,132,.35); }
.trader-head { display: flex; align-items: center; gap: 11px; }
.trader-pic { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; }
.trader-id { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.trader-name { font-weight: 600; font-size: 14.5px; color: var(--text);
               white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trader-name:hover { color: var(--green); }
.trader-handle { font-size: 11.5px; color: var(--muted); }
.trader-default { color: var(--green); }
.trader-head .follow-form { margin-left: auto; flex: none; }
.trader-bio { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin: 0;
              display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
              overflow: hidden; }
.trader-stats { font-size: 12px; }
.trader-stats a { color: var(--muted); text-decoration: underline; text-decoration-color: #2a3542; }
.trader-stats a:hover { color: var(--text); }
.follow-form { display: inline; margin: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
             gap: 10px; margin-bottom: 16px; }
.card.stat { text-align: center; padding: 14px 8px; }
.card.stat b { display: block; font-size: 24px; font-family: var(--mono, ui-monospace, monospace); }
.bar { display: inline-block; height: 10px; background: var(--green); border-radius: 3px; }
.upgrade-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 700px; }
@media (max-width: 700px) { .upgrade-grid { grid-template-columns: 1fr; } }
.pro-card { border-color: var(--green); }
.price-line b { font-size: 30px; font-family: var(--mono, ui-monospace, monospace); }
.plan-list { list-style: none; margin: 14px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.plan-list li::before { content: "› "; color: var(--green); }
.plan-list li.off { color: var(--muted); }
.plan-list li.off::before { content: "· "; color: var(--muted); }

/* Site-wide footer (all app pages) */
.sitefoot { max-width: 980px; margin: 48px auto 0; padding: 20px 16px 36px;
            border-top: 1px solid var(--border, #1c232c); font-size: 12px; color: var(--muted); }
.sitefoot-disc { line-height: 1.6; margin-bottom: 12px; opacity: .8; }
.sitefoot-links { display: flex; gap: 18px; flex-wrap: wrap; }
.sitefoot-links a { color: var(--muted); }
.sitefoot-links a:hover { color: var(--text); }

/* Trader page: bio, summary, sibling nav */
.titlebar h1 .handle { font-size: 14px; color: var(--muted); font-weight: 400; margin-left: 8px; }
.acct-bio { margin: -6px 0 10px; max-width: 640px; white-space: pre-line; }
.acct-summary { font-size: 13.5px; color: var(--text); max-width: 680px; margin: 0 0 14px;
                line-height: 1.6; opacity: .92; }
.feed-h2 { font-size: 15px; margin: 18px 0 10px; color: var(--text); }
.sibling-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.sibling { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 6px;
           border: 1px solid var(--border, #1c232c); border-radius: 999px; font-size: 12.5px;
           color: var(--text); background: var(--panel, #0d1117); }
.sibling:hover { border-color: var(--green); }
.sibling img { border-radius: 50%; }

/* Legal / about prose pages */
.legal { max-width: 720px; }
.legal h1 { font-size: 24px; margin-bottom: 4px; }
.legal h2 { font-size: 16px; margin: 26px 0 8px; }
.legal p, .legal li { font-size: 14px; line-height: 1.65; color: var(--text); }
.legal ul { padding-left: 22px; display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.legal a { color: var(--green); }
.legal b { font-weight: 600; }
.btn-small { padding: 4px 12px; font-size: 12px; }
.btn.following { background: var(--green); color: #04140d; }
.btn.following:hover { background: rgba(234,57,67,0.15); color: var(--red); border-color: var(--red); }
