:root {
  --bg: #0b0f17;
  --bg-2: #0f1420;
  --panel: #141a28;
  --panel-2: #1a2233;
  --border: #222c40;
  --text: #eef2f9;
  --muted: #8893a7;
  --violet: #6c5cff;
  --violet-2: #9b8cff;
  --bull: #1fd093;
  --bull-dim: #1fd0931a;
  --bear: #ff5470;
  --bear-dim: #ff54701a;
  --warn: #f2b13c;
  --warn-dim: #f2b13c1a;
  --radius: 13px;
  --shadow: 0 16px 40px -16px rgba(0,0,0,.65);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(1100px 520px at 88% -8%, #1a1f3e 0%, transparent 55%),
    radial-gradient(820px 460px at -8% 0%, #161a33 0%, transparent 52%),
    var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; font-size: 14px;
}
h1,h2,h3 { margin: 0; }
.muted { color: var(--muted); font-size: 12px; }
.link { background: none; border: none; color: var(--violet-2); cursor: pointer; font: inherit; font-size: 12px; padding: 0; }
.link:hover { text-decoration: underline; }

/* logo */
.logo { font-weight: 800; font-size: 26px; letter-spacing: -.5px; color: var(--text); }
.logo-tick { color: var(--bull); font-size: .55em; vertical-align: super; margin-left: 1px; }
.logo-sm { font-size: 20px; }

/* buttons + inputs */
.btn { font: inherit; cursor: pointer; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); color: var(--text); padding: 9px 14px; transition: .15s; }
.btn:hover { border-color: var(--violet); }
.btn-primary { background: linear-gradient(135deg, var(--violet), #5a7bff); border: none; font-weight: 650; }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; padding: 12px; margin-top: 6px; }
input[type=text], input[type=email], input[type=password] {
  font: inherit; color: var(--text); background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; outline: none; width: 100%;
}
input:focus { border-color: var(--violet); box-shadow: 0 0 0 3px #6c5cff22; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; }
.field > span { font-size: 12px; color: var(--muted); }

/* ---------- landing + login ---------- */
.login-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 24px; }
.landing { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 56px; align-items: center; max-width: 980px; width: 100%; }
.logo-xl { font-size: 34px; }
.hero-tag { font-size: 42px; line-height: 1.08; letter-spacing: -1.2px; font-weight: 800; margin: 22px 0 14px; }
.hero-sub { color: var(--muted); font-size: 15.5px; line-height: 1.55; margin: 0 0 26px; max-width: 46ch; }
.hero-sub em { color: var(--text); font-style: normal; font-weight: 600; }
.hero-pillars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.hero-pillars li { display: flex; flex-direction: column; gap: 2px; padding-left: 14px; border-left: 3px solid var(--violet); }
.hero-pillars b { font-size: 14px; }
.hero-pillars span { color: var(--muted); font-size: 13px; line-height: 1.45; }
.login-card { width: 100%; max-width: 390px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px; box-shadow: var(--shadow); }
.login-tag { font-size: 16px; font-weight: 600; margin: 0 0 18px; }
.login-blurb { color: var(--muted); margin: 0 0 22px; }
@media (max-width: 860px) {
  .landing { grid-template-columns: 1fr; gap: 36px; }
  .hero-tag { font-size: 32px; }
  .login-card { max-width: none; }
}
.login-error { color: var(--bear); font-size: 13px; min-height: 18px; margin: 4px 0 0; }
.login-note { font-size: 11px; color: var(--muted); margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; line-height: 1.5; }

/* ---------- topbar ---------- */
.app-view { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 22px; padding: 12px 20px; border-bottom: 1px solid var(--border); background: #0c111ccc; backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20; }
.tabs { display: flex; gap: 4px; }
.tab { font: inherit; background: none; border: none; color: var(--muted); cursor: pointer; padding: 8px 14px; border-radius: 9px; font-weight: 550; display: flex; align-items: center; gap: 7px; }
.tab:hover { color: var(--text); background: var(--panel); }
.tab.active { color: var(--text); background: var(--panel-2); }
.badge-count { background: var(--violet); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; min-width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-email { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--bull); box-shadow: 0 0 8px var(--bull); animation: pulse 1.7s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }
.mode-pill { font-size: 10px; font-weight: 800; letter-spacing: .08em; padding: 3px 7px; border-radius: 6px; border: 1px solid var(--border); color: var(--muted); }
.mode-pill.live { color: var(--bull); border-color: #1fd09355; background: var(--bull-dim); }

/* ---------- layout ---------- */
.layout { flex: 1; display: grid; grid-template-columns: 248px 1fr 300px; gap: 16px; padding: 16px 20px; align-items: start; }
.rail-left, .rail-right { position: sticky; top: 74px; display: flex; flex-direction: column; gap: 14px; }
.search { margin-bottom: 2px; }
.filter-group { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px; }
.filter-head { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; margin: 7px 0; }
.check input { width: auto; }
.seg { display: flex; background: var(--bg-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; margin: 9px 0; }
.seg button { flex: 1; font: inherit; font-size: 12px; background: none; border: none; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 6px; }
.seg button.active { background: var(--panel-2); color: var(--text); }
.type-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tchip { font: inherit; font-size: 11.5px; cursor: pointer; background: var(--bg-2); border: 1px solid var(--border); color: var(--muted); border-radius: 999px; padding: 5px 10px; transition: .12s; }
.tchip:hover { color: var(--text); }
.tchip.on { background: var(--violet); border-color: var(--violet); color: #fff; }
.watch-summary { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; }
.wpill { background: var(--bg-2); border: 1px solid var(--border); border-radius: 999px; padding: 4px 9px; color: var(--muted); }
.wpill b { color: var(--text); font-weight: 600; }

/* ---------- main / feed ---------- */
.main { min-width: 0; }
.view-head { display: flex; align-items: baseline; gap: 12px; margin: 4px 0 14px; }
.view-head h2 { font-size: 17px; }
.feed { display: flex; flex-direction: column; gap: 12px; }
.empty { padding: 40px; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius); }

.story { background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--border); border-radius: var(--radius); padding: 15px 16px; cursor: pointer; transition: border-color .14s, transform .14s; }
.story:hover { border-color: #33405e; transform: translateY(-1px); }
@keyframes arrive { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.story.d-bull { border-left-color: var(--bull); }
.story.d-bear { border-left-color: var(--bear); }
.story.d-bull:hover { border-left-color: var(--bull); }
.story.d-bear:hover { border-left-color: var(--bear); }
.story.fresh .src::before { content: "●"; color: var(--violet-2); font-size: 8px; margin-right: 6px; vertical-align: 2px; }
.art-link { color: var(--muted); text-decoration: none; font-size: 13px; padding: 0 4px; border-radius: 5px; }
.art-link:hover { color: var(--violet-2); }
.story-top { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.src { font-weight: 600; color: var(--text); }
.dot-sep::before { content: "·"; margin: 0 2px; }
.type-tag { margin-left: auto; font-size: 11px; padding: 3px 8px; border-radius: 6px; background: var(--bg-2); border: 1px solid var(--border); color: var(--muted); }
.headline { font-size: 16px; font-weight: 600; line-height: 1.35; letter-spacing: -.1px; margin-bottom: 10px; }
.story-bottom { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tickers { display: flex; gap: 5px; flex-wrap: wrap; }
.tk { font-size: 12px; font-weight: 600; background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; padding: 3px 7px; }
.tk.watched { border-color: var(--violet); color: var(--violet-2); }
.px { font-size: 12px; font-weight: 600; color: var(--text); background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; font-variant-numeric: tabular-nums; }
.px b { font-weight: 700; }
.px.up b { color: var(--bull); }
.px.down b { color: var(--bear); }

/* impact pill */
.impact { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 650; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border); }
.impact .arrow { font-size: 11px; }
.impact.bull { background: var(--bull-dim); color: var(--bull); border-color: #1fd09355; }
.impact.bear { background: var(--bear-dim); color: var(--bear); border-color: #ff547055; }
.impact.neutral { background: var(--warn-dim); color: var(--warn); border-color: #f2b13c55; }
.impact.none { color: var(--muted); }
.rev-flag { font-size: 10.5px; font-weight: 800; letter-spacing: .04em; color: var(--violet-2); border: 1px solid var(--violet); border-radius: 5px; padding: 2px 6px; text-transform: uppercase; }
.why { font-size: 12.5px; color: var(--muted); margin-top: 9px; }
.why b { color: var(--text); font-weight: 600; }

/* confidence bar */
.conf { margin-left: auto; display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); }
.conf-bar { width: 54px; height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; }
.conf-fill { height: 100%; border-radius: 999px; }

/* ---------- screener topics ---------- */
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 12px; margin-bottom: 22px; }
.topic { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.topic h3 { font-size: 14px; margin-bottom: 4px; }
.topic .meta { font-size: 11.5px; color: var(--muted); }
.topic .arm { margin-top: 11px; width: 100%; }
.topic.armed { border-color: var(--violet); box-shadow: 0 0 0 1px var(--violet) inset; }
.topic.armed .arm { background: var(--violet); border-color: var(--violet); color: #fff; }

/* ---------- alerts ---------- */
.alerts-list { display: flex; flex-direction: column; gap: 10px; }
.alert-row { display: flex; gap: 12px; align-items: flex-start; background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--violet); border-radius: 11px; padding: 12px 14px; }
.alert-row .a-when { font-size: 11px; color: var(--muted); white-space: nowrap; }
.alert-row .a-body { flex: 1; cursor: pointer; }
.alert-row .a-trigger { font-size: 11px; font-weight: 700; color: var(--violet-2); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- watchlist ---------- */
.watch-add { display: flex; gap: 8px; margin-left: auto; }
.watch-add input { width: 180px; }
.watch-tickers { display: flex; flex-direction: column; gap: 12px; }
.wt-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.wt-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.wt-sym { font-size: 17px; font-weight: 700; }
.wt-mini { font-size: 12.5px; color: var(--muted); }
.wt-stories { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.wt-story { font-size: 13px; display: flex; gap: 9px; align-items: center; cursor: pointer; padding: 5px 0; border-top: 1px dashed var(--border); }
.wt-story:hover { color: #fff; }
.move { font-weight: 700; font-variant-numeric: tabular-nums; }
.move.up { color: var(--bull); } .move.down { color: var(--bear); }

/* ---------- right rail mini ---------- */
.rail-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px; }
.rail-head { display: flex; align-items: center; gap: 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; }
.live-mini { display: flex; flex-direction: column; gap: 9px; }
.lm { font-size: 12.5px; cursor: pointer; padding-bottom: 9px; border-bottom: 1px solid var(--border); }
.lm:last-child { border-bottom: none; padding-bottom: 0; }
.lm:hover .lm-head { color: #fff; }
.lm-head { display: flex; gap: 7px; align-items: center; margin-bottom: 3px; }

/* ---------- detail modal ---------- */
.modal { position: fixed; inset: 0; background: #05070bd0; display: flex; align-items: flex-start; justify-content: center; padding: 40px 20px; z-index: 60; overflow: auto; }
.modal-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); position: relative; }
.detail-card { width: 100%; max-width: 640px; padding: 26px; }
.modal-close { position: absolute; top: 14px; right: 14px; background: var(--bg-2); border: 1px solid var(--border); color: var(--muted); width: 30px; height: 30px; border-radius: 8px; cursor: pointer; }
.modal-close:hover { color: var(--text); border-color: var(--violet); }
.d-source { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.d-headline { font-size: 22px; font-weight: 700; line-height: 1.25; letter-spacing: -.3px; margin-bottom: 14px; }
.d-verdict { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.d-section { margin-top: 20px; }
.d-section h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 10px; }
.d-mech { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; font-size: 13.5px; line-height: 1.5; }
.d-affected { display: flex; flex-direction: column; gap: 8px; }
.d-aff-row { display: flex; align-items: center; gap: 10px; font-size: 13px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 9px; padding: 9px 12px; }
.d-aff-row .sym { font-weight: 700; min-width: 54px; }
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl { display: grid; grid-template-columns: 92px 1fr 64px; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--border); font-size: 13px; cursor: pointer; }
.tl:hover .tl-h { color: #fff; }
.tl-date { font-size: 11.5px; color: var(--muted); }
.tl-h { line-height: 1.3; }
.similar-stat { background: var(--violet); background: linear-gradient(135deg,#241f55,#1a2440); border: 1px solid var(--violet); border-radius: 10px; padding: 12px 14px; font-size: 13.5px; margin-bottom: 12px; }
.similar-stat b { color: var(--violet-2); }
.disclaimer { margin-top: 22px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 14px; }

/* ---------- v2: skeletons, scoreboard, realized strip, sort ---------- */
.seg-sm { margin: 0; padding: 2px; }
.seg-sm button { padding: 4px 10px; font-size: 11.5px; }
.story.skel { cursor: default; pointer-events: none; }
.skel-line { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--bg-2) 25%, var(--panel-2) 50%, var(--bg-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; margin: 10px 0; }
.skel-line.w40 { width: 40%; } .skel-line.w70 { width: 70%; } .skel-line.w90 { width: 90%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.sb-rate { font-size: 30px; font-weight: 800; letter-spacing: -.5px; margin-bottom: 6px; }
.sb-rate.up { color: var(--bull); } .sb-rate.down { color: var(--bear); }
.rail-note { color: var(--muted); font-size: 11px; line-height: 1.5; margin: 0; padding: 0 4px; }
.realized-strip { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; font-size: 13px; color: var(--muted); }
.realized-strip b { font-size: 15px; margin-left: 6px; }
.call-hit { color: var(--bull); font-weight: 650; }
.call-miss { color: var(--bear); font-weight: 650; }
.real-tag { font-style: normal; font-size: 10px; color: var(--bull); }
.d-art { color: var(--violet-2); text-decoration: none; }
.d-art:hover { text-decoration: underline; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 80; }
.toast { background: var(--panel-2); border: 1px solid var(--violet); border-left: 4px solid var(--violet); border-radius: 11px; padding: 12px 14px; max-width: 330px; box-shadow: var(--shadow); cursor: pointer; animation: arrive .3s ease; }
.toast .t-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--violet-2); margin-bottom: 4px; }
.toast .t-headline { font-size: 13px; font-weight: 600; line-height: 1.3; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) { .layout { grid-template-columns: 220px 1fr; } .rail-right { display: none; } }
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; row-gap: 10px; gap: 14px; }
  .layout { grid-template-columns: 1fr; }
  .rail-left { position: static; }
}
