:root {
  --bg: #070b14; --bg2: #0c1322; --card: #101a2d; --card2: #14213a; --line: #1e2c47;
  --text: #e6edf7; --muted: #8391aa; --dim: #5b6882;
  --accent: #22d3a6; --accent2: #3b82f6; --hot: #ff5d73; --warn: #fbbf24; --ok: #22c55e;
  --r: 14px; --mono: "JetBrains Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 Inter, system-ui, sans-serif; }
body { min-height: 100vh; background:
  radial-gradient(1200px 600px at 85% -10%, rgba(34,211,166,.08), transparent 60%),
  radial-gradient(900px 500px at -10% 10%, rgba(59,130,246,.08), transparent 60%), var(--bg); }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }

/* ---------- Header ---------- */
.top { display: flex; align-items: center; gap: 24px; padding: 14px 24px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px); background: rgba(7,11,20,.82); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { margin: 0; font-size: 20px; letter-spacing: -.02em; font-weight: 800; }
.brand small { color: var(--muted); font-size: 12px; }
.radar { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--accent); position: relative; overflow: hidden;
  background: radial-gradient(circle, rgba(34,211,166,.15) 0 30%, transparent 31%), #06101b; }
.radar span { position: absolute; inset: 0; background: conic-gradient(from 0deg, rgba(34,211,166,.55), transparent 25%);
  animation: sweep 2.4s linear infinite; }
.radar::after { content: ""; position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--hot);
  top: 9px; right: 9px; box-shadow: 0 0 10px var(--hot); animation: blip 2.4s infinite; }
@keyframes sweep { to { transform: rotate(360deg); } }
@keyframes blip { 0%,60%{opacity:.2} 70%{opacity:1} 100%{opacity:.2} }
.kpis { display: flex; gap: 10px; flex: 1; flex-wrap: wrap; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; min-width: 96px; }
.kpi b { display: block; font: 700 17px var(--mono); }
.kpi span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.kpi.hot b { color: var(--hot); } .kpi.acc b { color: var(--accent); }
.live { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.live i { width: 9px; height: 9px; border-radius: 50%; background: var(--dim); }
.live.on i { background: var(--ok); box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }

.tabs { display: flex; gap: 4px; padding: 10px 24px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; font-weight: 600; white-space: nowrap; }
.tabs button.on { color: var(--text); border-color: var(--accent); }
main { padding: 20px 24px 60px; }
.tab { display: none; } .tab.on { display: block; }
#tab-feed.on { display: grid; grid-template-columns: 260px 1fr; gap: 20px; }

/* ---------- Filter ---------- */
.filters { position: sticky; top: 132px; align-self: start; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; cursor: pointer; font-size: 12.5px; }
.chips button.on { border-color: var(--accent); background: rgba(34,211,166,.12); color: var(--accent); }
select, input[type=search], .discform input { background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; width: 100%; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.chk { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; margin-top: 6px; }
.legend { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 12px; }
.legend p { margin: 4px 0; }

/* ---------- Feed ---------- */
.feedhead { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.feedhead h2 { margin: 0; font-size: 18px; } .feedhead span { color: var(--muted); }
.feed { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.card { background: linear-gradient(180deg, var(--card), var(--bg2)); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px; display: grid; grid-template-columns: 58px 1fr; gap: 12px; cursor: pointer; transition: .15s; position: relative; }
.card:hover { border-color: #2d4570; transform: translateY(-1px); }
.card.new { animation: flash 1.8s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 2px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.ring { width: 58px; height: 58px; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font: 700 16px var(--mono); }
.card h3 { margin: 0 0 4px; font-size: 14px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { color: var(--muted); font-size: 12px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.price { display: flex; gap: 8px; align-items: baseline; margin: 6px 0; flex-wrap: wrap; }
.price b { font: 700 18px var(--mono); }
.price s { color: var(--dim); font-size: 12.5px; }
.disc { background: rgba(255,93,115,.14); color: var(--hot); padding: 1px 7px; border-radius: 6px; font: 700 12px var(--mono); }
.badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--card2); border: 1px solid var(--line); white-space: nowrap; }
.badge.price_error { background: rgba(255,93,115,.15); color: var(--hot); border-color: rgba(255,93,115,.35); }
.badge.error_fare { background: rgba(251,191,36,.13); color: var(--warn); border-color: rgba(251,191,36,.35); }
.badge.deal { color: var(--accent); } .badge.flight { color: #7cb4ff; }
.badge.ai { background: rgba(59,130,246,.14); color: #8db8ff; border-color: rgba(59,130,246,.35); }
.badge.ai.neg { background: rgba(255,93,115,.1); color: #ff8b9b; }
.sigs { display: flex; gap: 4px; margin-top: 8px; }
.sigs i { height: 4px; flex: 1; border-radius: 2px; background: var(--line); position: relative; overflow: hidden; }
.sigs i::after { content: ""; position: absolute; inset: 0; width: var(--w); background: var(--c, var(--accent)); }
.thumb { position: absolute; right: 12px; top: 12px; width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: #fff; opacity: .9; }
.card.has-thumb h3 { padding-right: 46px; }
.empty { color: var(--muted); padding: 40px; text-align: center; border: 1px dashed var(--line); border-radius: var(--r); grid-column: 1/-1; }

/* ---------- Drawer ---------- */
.drawer { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.drawer.open { pointer-events: auto; }
.drawer-bg { position: absolute; inset: 0; background: rgba(0,0,0,.5); opacity: 0; transition: .2s; }
.drawer.open .drawer-bg { opacity: 1; }
.drawer-body { position: absolute; right: 0; top: 0; bottom: 0; width: min(620px, 100%); background: var(--bg2); border-left: 1px solid var(--line);
  transform: translateX(100%); transition: .25s; overflow-y: auto; padding: 22px; }
.drawer.open .drawer-body { transform: none; }
.dh { display: flex; gap: 16px; align-items: flex-start; }
.dh h2 { margin: 0 0 6px; font-size: 18px; line-height: 1.3; }
.close { margin-left: auto; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; cursor: pointer; }
.gauges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.gauge { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.gauge span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.gauge b { display: block; font: 700 22px var(--mono); }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--c, var(--accent)); }
h4 { margin: 20px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.sig { display: grid; grid-template-columns: 150px 1fr 44px; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.sig .n { font-weight: 600; font-size: 13px; } .sig .n small { display: block; color: var(--dim); font-weight: 400; font-size: 11px; }
.sig .d { color: var(--muted); font-size: 12.5px; }
.sig .v { font: 700 13px var(--mono); text-align: right; }
.sig.na .n, .sig.na .v { color: var(--dim); }
.risk { background: rgba(255,93,115,.08); border: 1px solid rgba(255,93,115,.25); color: #ffb3bd; padding: 8px 10px; border-radius: 9px; margin: 6px 0; font-size: 13px; }
.note { background: rgba(59,130,246,.08); border: 1px solid rgba(59,130,246,.25); padding: 8px 10px; border-radius: 9px; margin: 6px 0; font-size: 13px; color: #b9d0ff; }
.aibox { background: linear-gradient(135deg, rgba(59,130,246,.12), rgba(34,211,166,.06)); border: 1px solid rgba(59,130,246,.3); border-radius: 12px; padding: 14px; }
.aibox .v { font-weight: 800; font-size: 15px; margin-bottom: 6px; }
.aibox ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }
.aibox small { color: var(--dim); }
.actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; position: sticky; bottom: -22px; background: var(--bg2); padding: 12px 0; }
.btn { background: var(--card); border: 1px solid var(--line); padding: 9px 14px; border-radius: 10px; cursor: pointer; font-weight: 600; text-decoration: none; color: var(--text); }
.btn.good { border-color: rgba(34,197,94,.5); color: #86efac; } .btn.bad { border-color: rgba(255,93,115,.5); color: #ff9aa8; }
.btn.sel { background: var(--card2); box-shadow: inset 0 0 0 1px currentColor; }
.primary { background: var(--accent); color: #04110d; border: 0; padding: 9px 16px; border-radius: 10px; font-weight: 700; cursor: pointer; }
.chart { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.chart svg { width: 100%; height: 140px; display: block; }
.xs { font-size: 12px; color: var(--muted); }
.same { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }

/* ---------- Panels ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.panelhead h2 { margin: 0 0 4px; } .panelhead p { color: var(--muted); margin: 0 0 14px; max-width: 900px; }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 8px; border-bottom: 1px solid var(--line); }
td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--dim); }
.dot.ok { background: var(--ok); } .dot.err { background: var(--hot); } .dot.key { background: var(--warn); }
.err-txt { color: #ff9aa8; font-size: 12px; max-width: 320px; }
.mini { background: var(--bg2); border: 1px solid var(--line); border-radius: 7px; padding: 3px 9px; cursor: pointer; font-size: 12px; }
.muted { color: var(--muted); }
.discform { display: grid; grid-template-columns: 1.3fr .5fr 2fr auto; gap: 8px; margin-bottom: 12px; }
.disclist { display: grid; gap: 10px; margin-top: 12px; }
.dcard { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.dcard ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; }
.st { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; }
.st.verified { background: rgba(34,197,94,.15); color: #86efac; } .st.rejected { background: rgba(255,93,115,.12); color: #ff9aa8; }
.st.needs_connector { background: rgba(251,191,36,.12); color: var(--warn); } .st.retry { background: rgba(148,163,184,.15); color: #cbd5e1; } .st.active { background: rgba(59,130,246,.15); color: #8db8ff; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.biz h3 { margin: 18px 0 8px; }
.biz .idea { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 8px 0; }
.biz .idea b { color: var(--accent); }
.wbar { display: grid; grid-template-columns: 120px 1fr 60px; gap: 8px; align-items: center; margin: 4px 0; font-size: 12.5px; }
.wbar .t { height: 8px; background: var(--line); border-radius: 4px; position: relative; }
.wbar .t i { position: absolute; top: 0; bottom: 0; border-radius: 4px; }

.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--card2); border: 1px solid var(--hot); border-radius: 12px; padding: 12px 14px; max-width: 380px; white-space: pre-line;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: slide .3s; cursor: pointer; font-size: 13px; }
@keyframes slide { from { transform: translateY(20px); opacity: 0; } }

@media (max-width: 900px) {
  #tab-feed.on { grid-template-columns: 1fr; }
  .filters { position: static; }
  .top, main, .tabs { padding-left: 16px; padding-right: 16px; }
  .feed { grid-template-columns: 1fr; }
  .grid2, .discform { grid-template-columns: 1fr; }
  .sig { grid-template-columns: 110px 1fr 40px; }
  .kpi { min-width: 80px; }
}

body.public .admin-only { display: none !important; }
