:root {
  --bg: #0a0d12; --panel: #11161e; --panel2: #161c26; --line: #222a36; --line2: #2c3645;
  --text: #e6ebf2; --muted: #8592a6; --dim: #5b6779;
  --green: #35d49a; --green-bg: rgba(53,212,154,.12);
  --red: #ff5c7a; --red-bg: rgba(255,92,122,.12);
  --amber: #ffb547; --amber-bg: rgba(255,181,71,.12);
  --blue: #5aa9ff; --blue-bg: rgba(90,169,255,.12);
  --violet: #a78bfa;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); text-decoration: none; }
[hidden] { display: none !important; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---- header ---- */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px;
  padding: 12px 24px; background: rgba(10,13,18,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 17px; letter-spacing: .2px; white-space: nowrap; }
.brand .logo { color: var(--red); }
.brand .sub { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 6px; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tabs button { background: none; border: 0; padding: 7px 12px; border-radius: 8px; color: var(--muted); }
.tabs button:hover { background: var(--panel); color: var(--text); }
.tabs button.on { background: var(--panel2); color: var(--text); }
.count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 10px;
  background: var(--line2); font-size: 11px; text-align: center; }
.tabs button.on .count { background: var(--red); color: #fff; }
.status { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 var(--green); }
.pulse.scanning { animation: pulse 1s infinite; background: var(--amber); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,181,71,.7);} 100% { box-shadow: 0 0 0 10px rgba(255,181,71,0);} }
.primary { background: var(--red); border: 0; color: #fff; padding: 7px 14px; border-radius: 8px; font-weight: 600; }
.primary:hover { filter: brightness(1.1); }
.ghost { background: var(--panel); border: 1px solid var(--line); padding: 6px 10px; border-radius: 8px; }
.ghost:hover { border-color: var(--line2); }

/* ---- KPIs ---- */
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; padding: 16px 24px 4px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.kpi .label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; }
.kpi .value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.kpi .hint { color: var(--dim); font-size: 11px; margin-top: 2px; }
.kpi.hot .value { color: var(--red); }
.kpi.money .value { color: var(--green); }

main { padding: 12px 24px 60px; }

/* ---- filters ---- */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 0 14px; }
.filters input[type=search], .filters select, .filters input[type=number] {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
.filters input[type=search] { width: 240px; }
.filters input[type=number] { width: 72px; margin-left: 4px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; font-size: 12px; color: var(--muted); }
.chip.on { border-color: var(--blue); color: var(--text); background: var(--blue-bg); }
.slider, .check { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.slider b { color: var(--text); font-family: var(--mono); width: 24px; }
input[type=range] { accent-color: var(--red); width: 110px; }
input[type=checkbox] { accent-color: var(--red); }

/* ---- list ---- */
.list-head, .row { display: grid; grid-template-columns: 52px minmax(260px, 1fr) 130px 110px 64px 84px 84px 64px 70px 150px;
  align-items: center; gap: 14px; }
.list-head { padding: 0 14px 8px; color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; }
.r { text-align: right; } .c { text-align: center; }
.list { display: flex; flex-direction: column; gap: 8px; }
.row { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; cursor: pointer;
  transition: border-color .15s, transform .15s; position: relative; }
.row:hover { border-color: var(--line2); }
.row.fresh { animation: flash 2.4s ease-out; }
@keyframes flash { 0% { background: rgba(255,92,122,.22); border-color: var(--red);} 100% { background: var(--panel);} }
.row.hot::before { content: ""; position: absolute; left: -1px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--red); }
.thumb { width: 52px; height: 52px; border-radius: 10px; display: grid; place-items: center; font-size: 24px;
  background: var(--panel2); border: 1px solid var(--line); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.item .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .meta { color: var(--muted); font-size: 12px; margin: 2px 0 5px; display: flex; gap: 8px; align-items: center; }
.retailer { font-weight: 600; color: var(--text); }
.tags { display: flex; gap: 5px; flex-wrap: wrap; }
.tag { font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 6px; letter-spacing: .2px; white-space: nowrap; }
.tag.red { color: var(--red); background: var(--red-bg); }
.tag.amber { color: var(--amber); background: var(--amber-bg); }
.tag.green { color: var(--green); background: var(--green-bg); }
.tag.blue { color: var(--blue); background: var(--blue-bg); }
.tag.grey { color: var(--muted); background: var(--panel2); }
.price .now { font-size: 16px; font-weight: 700; }
.price .was { color: var(--dim); text-decoration: line-through; font-size: 12px; }
.off { color: var(--red); font-weight: 700; }
.pos { color: var(--green); font-weight: 600; } .neg { color: var(--red); }
.age { color: var(--muted); font-size: 12px; }
.actions { display: flex; gap: 6px; justify-content: flex-end; }
.btn { white-space: nowrap; border: 1px solid var(--line2); background: var(--panel2); border-radius: 8px; padding: 6px 10px; font-size: 12px; }
.btn:hover { border-color: var(--muted); }
.btn.buy { background: var(--green); border-color: var(--green); color: #04150e; font-weight: 700; }
.btn.icon { padding: 6px 8px; }
.empty { padding: 60px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line2); border-radius: 12px; }
.empty b { color: var(--text); display: block; font-size: 16px; margin-bottom: 6px; }

/* score ring */
.ring { --p: 0; --c: var(--green); width: 44px; height: 44px; border-radius: 50%; margin: auto; display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--line) 0); }
.ring span { width: 36px; height: 36px; border-radius: 50%; background: var(--panel); display: grid; place-items: center;
  font-weight: 700; font-size: 13px; font-family: var(--mono); }

/* ---- pipeline ---- */
.board { display: grid; grid-template-columns: repeat(6, minmax(200px, 1fr)); gap: 12px; align-items: start; }
.col { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; min-height: 200px; }
.col h4 { margin: 2px 4px 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted);
  display: flex; justify-content: space-between; }
.card { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; cursor: pointer; }
.card:hover { border-color: var(--line2); }
.card .t { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.card .m { color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; }

/* ---- sources ---- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.panel h3 { margin: 0 0 12px; font-size: 14px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { color: var(--dim); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }

/* ---- drawer ---- */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 100vw); background: var(--bg);
  border-left: 1px solid var(--line2); z-index: 21; overflow-y: auto; animation: slide .2s ease-out; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.drawer-inner { padding: 22px 24px 40px; }
.d-head { display: flex; gap: 16px; align-items: flex-start; }
.d-head .thumb { width: 72px; height: 72px; font-size: 34px; }
.d-head h2 { margin: 0 0 6px; font-size: 19px; line-height: 1.3; }
.close { margin-left: auto; background: none; border: 0; font-size: 22px; color: var(--muted); }
.d-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0; }
.d-grid .kpi .value { font-size: 20px; }
.section { margin-top: 22px; }
.section h4 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.chart { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.chart svg { display: block; width: 100%; height: 220px; }
.why { display: grid; gap: 8px; }
.why div { display: flex; gap: 10px; align-items: baseline; font-size: 13px; color: var(--muted); }
.why .tag { flex: none; min-width: 120px; text-align: center; }
.calc { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.calc label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.calc input, .track input, .track textarea { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; width: 100%; }
.calc-out { margin-top: 12px; display: flex; gap: 22px; padding: 12px 14px; background: var(--panel); border-radius: 10px; border: 1px solid var(--line); }
.calc-out div span { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.calc-out div b { font-size: 18px; font-family: var(--mono); }
.statusbar { display: flex; flex-wrap: wrap; gap: 6px; }
.statusbar button { border: 1px solid var(--line2); background: var(--panel); border-radius: 8px; padding: 6px 11px; font-size: 12px; text-transform: capitalize; }
.statusbar button.on { background: var(--blue-bg); border-color: var(--blue); }
.track { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.track label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.track .full { grid-column: 1 / -1; }
.prob { display: flex; gap: 10px; }
.bar { flex: 1; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.bar span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.bar .track-bar { height: 6px; background: var(--line); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.bar .fill { height: 100%; border-radius: 3px; }

/* ---- toasts ---- */
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 30; }
.toast { background: var(--panel2); border: 1px solid var(--red); border-left-width: 4px; padding: 10px 14px; border-radius: 10px;
  max-width: 360px; box-shadow: 0 8px 24px rgba(0,0,0,.4); cursor: pointer; animation: slide .2s ease-out; }
.toast b { display: block; color: var(--red); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }

/* ---- community tips ---- */
.tips { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.tip { display: grid; grid-template-columns: 64px 1fr; gap: 12px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px; }
.tip.err { border-color: rgba(255,92,122,.45); }
.tip .thumb { width: 64px; height: 64px; }
.tip .t { font-weight: 600; font-size: 13px; line-height: 1.35; }
.tip .m { display: flex; gap: 8px; align-items: center; margin-top: 6px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.tip .m .num { color: var(--text); font-weight: 700; }
.tip .acts { display: flex; gap: 6px; margin-top: 8px; }

/* ---- settings ---- */
.settings { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; }
.settings .panel { margin: 0; }
.field { display: grid; grid-template-columns: 170px 1fr; gap: 10px; align-items: start; padding: 7px 0; border-bottom: 1px solid var(--line); }
.field:last-child { border-bottom: 0; }
.field > span { color: var(--text); font-size: 13px; padding-top: 7px; }
.field input, .field select { width: 100%; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; }
.field input[type=checkbox] { width: auto; margin-top: 9px; }
.field small { display: block; color: var(--dim); font-size: 11.5px; margin-top: 4px; line-height: 1.35; }
.field .inline { display: flex; gap: 6px; }
.save-bar { position: sticky; bottom: 0; padding: 14px 0; background: linear-gradient(transparent, var(--bg) 30%); display: flex; gap: 10px; align-items: center; }

@media (max-width: 1250px) {
  .top { flex-wrap: wrap; gap: 8px 16px; }
  .tabs { order: 3; flex-basis: 100%; overflow-x: auto; }
  .tabs button { white-space: nowrap; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .list-head { display: none; }
  .row { grid-template-columns: 52px 1fr auto auto; grid-auto-rows: auto; }
  .row .spark, .row .roi-cell, .row .exp-cell, .row .age-cell { display: none; }
  .board { grid-template-columns: repeat(3, 1fr); }
}
.tip .m s { color: var(--dim); }
.tip .m .via { color: var(--dim); }

/* ---- login + public page ---- */
.login-page { display: grid; place-items: center; min-height: 100vh; }
.login { width: min(380px, 92vw); display: grid; gap: 12px; }
.login .brand { font-size: 20px; }
.pub-hero { padding: 18px 22px 4px; }
.pub-hero h1 { margin: 0 0 6px; font-size: 22px; }
.pub-hero p { margin: 0; color: var(--muted); max-width: 760px; line-height: 1.5; }
.pub-foot { padding: 26px 22px 40px; color: var(--dim); font-size: 12px; line-height: 1.6; max-width: 900px; }
.public .row .actions { justify-content: flex-end; }
