:root {
  --bg: #0b0f1a;
  --bg-2: #121826;
  --card: #161d2e;
  --card-2: #1b2336;
  --line: #25304a;
  --text: #e8edf7;
  --muted: #8a97b2;
  --primary: #5b8cff;
  --primary-2: #7aa2ff;
  --accent: #34d399;
  --danger: #f87171;
  --warn: #fbbf24;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #15203a 0%, transparent 60%), var(--bg);
  background-color: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

#app { max-width: 1100px; margin: 0 auto; padding-bottom: 84px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; gap: 12px;
  background: rgba(11, 15, 26, .85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  font-size: 22px; width: 40px; height: 40px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), #9b6bff);
  border-radius: 11px; box-shadow: var(--shadow);
}
.brand h1 { font-size: 18px; margin: 0; letter-spacing: -.02em; }
.tagline { margin: 0; font-size: 11px; color: var(--muted); }

.pill {
  font-size: 12px; padding: 6px 11px; border-radius: 999px; font-weight: 600;
  border: 1px solid var(--line); white-space: nowrap;
}
.pill-muted { color: var(--muted); }
.pill-ok { color: var(--accent); border-color: rgba(52, 211, 153, .4); background: rgba(52, 211, 153, .08); }

/* ---------- views ---------- */
main { padding: 16px; }
.view { display: none; animation: fade .25s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- toolbar / filters ---------- */
.toolbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.search-wrap input {
  width: 100%; padding: 12px 14px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); color: var(--text); font-size: 15px;
}
.filters { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.export-actions { display: flex; gap: 8px; flex-wrap: wrap; }
select, input, textarea {
  font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  outline: none; width: 100%;
}
select:focus, input:focus, textarea:focus { border-color: var(--primary); }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  padding: 10px 14px; border-radius: 10px; font-weight: 600; font-size: 14px;
  cursor: pointer; transition: .15s; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); border-color: transparent; color: #fff; width: 100%; padding: 13px; font-size: 15px; }
.btn-soft { background: var(--card-2); }
.btn-ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: rgba(248, 113, 113, .35); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- stats ---------- */
.stats-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; color: var(--muted); font-size: 13px; }
.stats-row b { color: var(--text); }

/* ---------- leads ---------- */
.leads-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.lead-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; position: relative; transition: .15s;
}
.lead-card:hover { border-color: #34406a; }
.lead-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.lead-name { font-weight: 700; font-size: 16px; margin: 0 0 2px; letter-spacing: -.01em; }
.lead-sub { color: var(--muted); font-size: 13px; margin: 0; }
.lead-rating { font-size: 12px; color: var(--warn); font-weight: 700; white-space: nowrap; }
.lead-tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 0; }
.tag {
  font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 600;
  background: rgba(91, 140, 255, .12); color: var(--primary-2); border: 1px solid rgba(91, 140, 255, .25);
}
.tag.niche { background: rgba(52, 211, 153, .12); color: var(--accent); border-color: rgba(52, 211, 153, .25); }
.lead-contacts { display: flex; flex-direction: column; gap: 5px; margin-top: 10px; font-size: 13px; }
.lead-contacts a { color: var(--primary-2); text-decoration: none; word-break: break-all; }
.lead-contacts .ico { color: var(--muted); margin-right: 6px; }
.lead-del {
  position: absolute; top: 10px; right: 10px; background: transparent; border: none;
  color: var(--muted); cursor: pointer; font-size: 16px; opacity: .6;
}
.lead-del:hover { color: var(--danger); opacity: 1; }

.empty { text-align: center; color: var(--muted); padding: 48px 16px; }
.empty .big { font-size: 40px; margin-bottom: 8px; }

.pager { display: flex; justify-content: center; gap: 10px; margin: 18px 0; align-items: center; }

/* ---------- cards / forms ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 6px; font-size: 18px; }
.card h3 { margin: 0 0 12px; font-size: 15px; }
.form-card label { display: block; margin: 12px 0 0; font-size: 13px; color: var(--muted); font-weight: 600; }
.form-card label input, .form-card label select { margin-top: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 4px; }
.grid3 { display: grid; grid-template-columns: 1fr; gap: 4px; }
.row { display: flex; gap: 10px; margin-top: 14px; }
.row .btn { flex: 1; }
.check { display: flex; align-items: center; gap: 10px; margin-top: 16px; cursor: pointer; }
.check input { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--primary); }
.check span { font-size: 13px; color: var(--text); font-weight: 500; }
.email-badge { font-size: 10px; background: rgba(52,211,153,.15); color: var(--accent); padding: 2px 7px; border-radius: 6px; font-weight: 700; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.5; }
.muted.small { font-size: 12px; }
.code {
  background: #0a0e18; border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  font-size: 12px; color: #b8c4e0; overflow-x: auto; white-space: pre-wrap; word-break: break-word;
}

/* ---------- progress / runs ---------- */
.progress { margin-top: 14px; padding: 12px; border-radius: 10px; background: var(--card-2); font-size: 13px; }
.progress.run { border-left: 3px solid var(--primary); }
.progress.ok { border-left: 3px solid var(--accent); }
.progress.err { border-left: 3px solid var(--danger); }
.hidden { display: none; }
.spinner {
  display: inline-block; width: 13px; height: 13px; border: 2px solid var(--line);
  border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.runs-list { display: flex; flex-direction: column; gap: 8px; }
.run-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; background: var(--card-2); border-radius: 10px; font-size: 13px; }
.run-item .meta { color: var(--muted); font-size: 12px; }
.badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; }
.badge.SUCCEEDED { background: rgba(52,211,153,.15); color: var(--accent); }
.badge.RUNNING, .badge.READY { background: rgba(91,140,255,.15); color: var(--primary-2); }
.badge.FAILED, .badge.ABORTED, .badge\[TIMED-OUT\] { background: rgba(248,113,113,.15); color: var(--danger); }

/* ---------- actors ---------- */
.actors-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.actor-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.actor-card h3 { margin: 0 0 4px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.actor-card .star { color: var(--warn); font-weight: 700; font-size: 13px; }
.actor-meta { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; font-size: 12px; color: var(--muted); }
.actor-meta span b { color: var(--text); }
.actor-card .desc { font-size: 13px; color: var(--muted); margin: 0 0 12px; line-height: 1.5; }
.price-tag { font-weight: 700; color: var(--accent); }
.curated-flag { font-size: 10px; background: rgba(155,107,255,.15); color: #b794ff; padding: 2px 7px; border-radius: 6px; }

/* ---------- bottom nav ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; max-width: 1100px; margin: 0 auto;
  background: rgba(18, 24, 38, .96); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
}
.tab {
  flex: 1; background: none; border: none; color: var(--muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 600; padding: 8px 4px; border-radius: 10px; transition: .15s;
}
.tab span { font-size: 19px; }
.tab.active { color: var(--primary-2); background: rgba(91,140,255,.1); }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--card-2); border: 1px solid var(--line); color: var(--text);
  padding: 12px 18px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { border-color: rgba(52,211,153,.4); }
.toast.err { border-color: rgba(248,113,113,.4); }

/* ---------- responsive (tablet/desktop) ---------- */
@media (min-width: 640px) {
  .toolbar { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .search-wrap { flex: 1; min-width: 220px; }
  .filters { grid-template-columns: repeat(4, auto); }
  .grid2 { grid-template-columns: 1fr 1fr; }
  .grid3 { grid-template-columns: 1fr 1fr 1fr; }
  .leads-grid { grid-template-columns: 1fr 1fr; }
  .actors-grid { grid-template-columns: 1fr 1fr; }
  .btn-primary { width: auto; }
}
@media (min-width: 960px) {
  .leads-grid { grid-template-columns: 1fr 1fr 1fr; }
}
