:root {
  --bg: #0c0d10;
  --bg-2: #14161b;
  --bg-3: #1c1f26;
  --line: #262a33;
  --text: #e9ebf0;
  --muted: #8b909c;
  --accent: #d4af6a;
  --accent-2: #b8924d;
  --good: #4caf6a;
  --warn: #d8a93a;
  --bad: #d85a3a;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
}
@media (prefers-color-scheme: light) {
  :root {
    --bg:#fafaf7; --bg-2:#fff; --bg-3:#f3f1ea; --line:#e6e3d8; --text:#1a1c20; --muted:#6e7480;
    --shadow:0 8px 24px rgba(0,0,0,.06);
  }
}
* { box-sizing: border-box; }
html, body { background: var(--bg); color: var(--text); margin:0; font-family: -apple-system, "Segoe UI", Inter, Roboto, system-ui, sans-serif; font-size:15px; line-height:1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size:.85em; }
.top { display:flex; align-items:center; justify-content:space-between; padding:18px 28px; border-bottom:1px solid var(--line); background: var(--bg-2); position:sticky; top:0; z-index:5; }
.brand { display:flex; gap:12px; align-items:center; }
.logo-dot { width:30px; height:30px; border-radius:8px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 0 0 1px rgba(255,255,255,.05) inset; }
.brand-name { font-weight:700; letter-spacing:.3px; }
.brand-sub { color: var(--muted); font-size:12px; }
.topnav { display:flex; gap:6px; }
.topnav .nav { padding:8px 14px; border-radius:8px; color: var(--muted); font-weight:500; }
.topnav .nav:hover { background: var(--bg-3); text-decoration:none; }
.topnav .nav.active { background: var(--bg-3); color: var(--text); }
.stop-btn { margin-left: 8px; background: var(--bad); color: #fff; border:0; padding: 8px 14px; border-radius: 8px; font-weight: 700; font-size: 13px; letter-spacing:.04em; cursor: pointer; box-shadow: 0 0 0 1px rgba(0,0,0,.15) inset; }
.stop-btn:hover { background: #ff5f3a; }
.stop-btn:disabled { opacity: .4; cursor: not-allowed; }
.stop-banner { background: rgba(216,90,58,.12); color: #ff7a55; border: 1px solid rgba(216,90,58,.4); padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; }
.child-progress { background: var(--bg-3); padding: 10px 14px; border-radius: 10px; margin-bottom: 10px; display:flex; justify-content:space-between; gap:14px; align-items:center; flex-wrap:wrap; }
.child-progress .nums { font-weight: 600; }
.child-progress .bar-mini { width: 200px; height: 6px; background: var(--bg-2); border-radius: 999px; overflow:hidden; }
.child-progress .bar-mini > div { height:100%; background: linear-gradient(90deg, var(--accent-2), var(--good)); transition: width .4s; }
.card-row .res-status { font-size: 12px; }
.res-status.pending { color: var(--muted); }
.res-status.running { color: var(--accent); }
.res-status.done { color: var(--good); }
.res-status.error, .res-status.cancelled { color: var(--bad); }

/* topbar pills */
.spend-pill { margin-left: auto; padding: 6px 12px; background: var(--bg-3); border:1px solid var(--line); border-radius: 999px; font-size: 12.5px; color: var(--text); }

/* filter bar */
.list-head { display:flex; align-items:baseline; justify-content:space-between; margin-bottom: 8px; }
.filter-bar { display:flex; flex-wrap:wrap; gap:8px; margin-bottom: 14px; align-items:center; }
.filter-bar input[type="text"], .filter-bar input:not([type]), .filter-bar select { padding: 8px 10px; font-size: 13px; }
.filter-bar > * { flex: 0 0 auto; }
.filter-bar #filter { flex: 1 1 240px; min-width: 200px; }
.filter-bar select { background: var(--bg-3); border:1px solid var(--line); color:var(--text); border-radius: 8px; padding: 8px 28px 8px 10px; appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M3 5l3 3 3-3' stroke='%23888' fill='none' stroke-width='1.5'/></svg>"); background-repeat:no-repeat; background-position: right 8px center; }
.filter-bar .check { display:inline-flex; align-items:center; gap:6px; background: var(--bg-3); border:1px solid var(--line); padding: 6px 10px; border-radius: 8px; font-size:13px; cursor:pointer; }
.filter-bar .check input { width:auto; margin:0; }
.range-wrap { display:flex; align-items:center; gap:4px; font-size:13px; color: var(--muted); }
.range-wrap input { width: 56px; padding: 6px 8px; font-size:13px; }
.btn.small { padding: 6px 12px; font-size: 13px; }

/* enriched company row */
.crow { display:grid; grid-template-columns: 1.7fr 1fr .8fr .55fr .55fr 1.5fr .9fr .35fr; gap: 10px; padding: 12px 14px; background: var(--bg-2); border:1px solid var(--line); border-radius: 10px; margin-bottom: 6px; cursor: pointer; align-items: center; }
.crow:hover { border-color: var(--accent); }
.crow .name { font-weight:600; }
.crow .url { font-size: 12px; color: var(--muted); }
.crow .url a { color: var(--muted); }
.crow .url a:hover { color: var(--accent); }
.crow .icons { display:flex; gap:5px; flex-wrap:wrap; font-size:15px; }
.crow .ico { width: 24px; height: 24px; border-radius: 6px; display:flex; align-items:center; justify-content:center; background: var(--bg-3); color: var(--muted); border:1px solid var(--line); font-size: 13px; }
.crow .ico.on { background: rgba(76,175,106,.15); color: var(--good); border-color: rgba(76,175,106,.4); }
.crow .ico.off { opacity: .25; }
.crow .ico[title] { cursor: help; }
.crow .actions { display:flex; gap: 4px; justify-content: flex-end; }
.crow .btn-ico { width: 30px; height: 30px; border:1px solid var(--line); background: var(--bg-3); border-radius: 8px; cursor:pointer; display:flex; align-items:center; justify-content:center; color: var(--text); font-size: 13px; }
.crow .btn-ico:hover { border-color: var(--accent); color: var(--accent); }
.crow .cost { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.crow .status-tag { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: var(--bg-3); color: var(--muted); border:1px solid var(--line); }
.crow .status-tag.running { color: var(--accent); border-color: rgba(212,175,106,.4); background: rgba(212,175,106,.1); }
.crow .status-tag.done { color: var(--good); border-color: rgba(76,175,106,.4); background: rgba(76,175,106,.1); }
.crow .status-tag.pending { color: var(--muted); }
.crow .status-tag.error, .crow .status-tag.cancelled { color: var(--bad); border-color: rgba(216,90,58,.4); background: rgba(216,90,58,.1); }

@media (max-width: 1100px) {
  .crow { grid-template-columns: 1.7fr 1fr 1fr 1.5fr; gap: 10px; }
  .crow .city-col, .crow .score-col, .crow .lead-col { display:none; }
}

/* settings */
.settings-view .stats-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-top: 10px; }
.stat-card { background: var(--bg-3); border:1px solid var(--line); border-radius: 10px; padding: 14px; }
.stat-card .v { font-size: 24px; font-weight: 700; }
.stat-card .lab { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.mono { font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace; font-size: 13px; }
.test-result.ok { color: var(--good); }
.test-result.bad { color: var(--bad); }

main { padding: 30px 28px 80px; max-width: 1280px; margin: 0 auto; }
button { font: inherit; cursor: pointer; }
input, textarea { font: inherit; background: var(--bg-3); color: var(--text); border:1px solid var(--line); border-radius:10px; padding: 10px 12px; width:100%; outline:none; }
input:focus, textarea:focus { border-color: var(--accent); }
label { display:block; }
.lbl { display:block; color: var(--muted); font-size:12px; margin: 0 0 4px 2px; text-transform: uppercase; letter-spacing:.05em; }

/* HOME */
.hero h1 { font-size: 34px; margin: 8px 0 6px; letter-spacing:-.02em; }
.mode-grid { display:grid; grid-template-columns: repeat(3, 1fr); gap:14px; margin-top: 28px; }
.mode { background: var(--bg-2); border:1px solid var(--line); border-radius: var(--radius); padding: 20px; text-align:left; color: var(--text); transition: .15s; }
.mode:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.mode-ico { width:34px; height:34px; border-radius:8px; background: var(--bg-3); display:flex; align-items:center; justify-content:center; color: var(--accent); font-weight:700; margin-bottom: 14px; }
.mode-title { font-size:18px; font-weight:600; margin-bottom: 6px; }
.mode-desc { color: var(--muted); font-size: 14px; }

.recent { margin-top: 40px; }
.recent h3 { font-size: 14px; text-transform: uppercase; letter-spacing:.08em; color: var(--muted); margin-bottom: 8px; }
.recent-list { display:grid; gap:6px; }
.recent-item { padding: 10px 12px; background: var(--bg-2); border:1px solid var(--line); border-radius: 8px; display:flex; justify-content: space-between; align-items:center; cursor:pointer; }
.recent-item:hover { border-color: var(--accent); }
.recent-item .t { color: var(--muted); font-size:12px; }

/* SEARCH */
.search-view, .run-view, .list-view, .dossier { animation: fade .25s ease; }
@keyframes fade { from { opacity:0; transform: translateY(4px); } to { opacity:1; transform:none; } }
.search-title { margin: 10px 0 16px; }
.back { background:none; border:0; color: var(--muted); margin-bottom: 10px; padding: 4px 0; }
.back:hover { color: var(--text); }
.search-card { background: var(--bg-2); border:1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.big-input-wrap textarea { font-size: 18px; padding: 14px; }
.row { display:flex; gap:12px; margin-top: 12px; }
.row label { flex:1; }
.suggest { display:flex; flex-wrap:wrap; gap:6px; margin: 14px 0 10px; }
.suggest .chip { padding: 4px 10px; background: var(--bg-3); border:1px solid var(--line); border-radius: 999px; font-size:12px; color: var(--muted); cursor:pointer; }
.suggest .chip:hover { color: var(--text); border-color: var(--accent); }
.primary { background: var(--accent); color:#1a1409; border:0; border-radius: 10px; padding: 12px 22px; font-weight:600; }
.primary:hover { background: var(--accent-2); }
.primary.big { width:100%; padding: 16px; font-size: 16px; margin-top: 10px; }

/* RUN */
.run-grid { display:grid; grid-template-columns: 1fr 1.4fr; gap: 16px; }
@media (max-width: 1000px){ .run-grid { grid-template-columns: 1fr; } }
.log-card, .result-card { background: var(--bg-2); border:1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.log-head { display:flex; align-items:center; gap:8px; margin-bottom: 8px; }
.dot { width: 8px; height: 8px; border-radius: 999px; background: var(--muted); display:inline-block; }
.dot.live { background: var(--good); box-shadow: 0 0 8px var(--good); animation: pulse 1.2s infinite; }
.dot.done { background: var(--muted); }
@keyframes pulse { 0%{opacity:.4} 50%{opacity:1} 100%{opacity:.4} }
.cost-bar { display:flex; gap:6px; flex-wrap:wrap; margin-bottom: 10px; }
.pill { background: var(--bg-3); color: var(--text); padding: 4px 10px; border-radius: 999px; font-size: 12px; border:1px solid var(--line); }
.runs-row { grid-template-columns: 1fr 90px 90px 160px 90px; }
#log { background: #0a0b0e; color:#cfd3dc; padding: 12px; border-radius: 10px; font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace; font-size:12.5px; line-height:1.55; max-height: 540px; overflow:auto; white-space:pre-wrap; }
#log .err { color: #ff8a72; }
#log .warn { color: #ffd76b; }
#log .done { color: #8effa6; }

/* LIST + CARDS */
.list-view h2 { margin-top: 0; }
#filter { max-width: 380px; margin-bottom: 14px; }
.card-row { display:grid; grid-template-columns: 1.7fr 1fr .7fr .5fr .8fr; gap: 12px; padding: 14px 16px; background: var(--bg-2); border:1px solid var(--line); border-radius: 10px; margin-bottom: 6px; cursor: pointer; align-items:center; }
.card-row:hover { border-color: var(--accent); }
.card-row .name { font-weight:600; }
.card-row .url { font-size: 12px; color: var(--muted); }
.badge { display:inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.hot { background: rgba(216,90,58,.15); color: #ff7a55; }
.badge.strong { background: rgba(212,175,106,.18); color: var(--accent); }
.badge.potential { background: rgba(76,175,106,.15); color: var(--good); }
.badge.weak { background: rgba(139,144,156,.18); color: var(--muted); }
.badge.notrel { background: rgba(139,144,156,.1); color: var(--muted); }
.badge.score { background: var(--bg-3); color: var(--text); }

/* DOSSIER */
.dossier-head { background: var(--bg-2); border:1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 16px; }
.dossier-head h1 { margin: 0 0 6px; font-size: 28px; letter-spacing:-.01em; }
.dossier-head .meta { color: var(--muted); }
.dossier-actions { margin-top: 14px; display:flex; gap:8px; flex-wrap:wrap; }
.btn { background: var(--bg-3); color: var(--text); border:1px solid var(--line); border-radius: 8px; padding: 8px 14px; font-size: 14px; }
.btn:hover { border-color: var(--accent); }
.section { background: var(--bg-2); border:1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 12px; }
.section h3 { margin: 0 0 10px; font-size: 14px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.kv { display:grid; grid-template-columns: 200px 1fr; gap: 6px 16px; }
.kv .k { color: var(--muted); }
.tag { display:inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; background: var(--bg-3); color: var(--text); margin-right: 6px; }
.conf-h { color: var(--good); } .conf-m { color: var(--warn); } .conf-l { color: var(--bad); }
.item { padding: 10px 0; border-top: 1px dashed var(--line); }
.item:first-child { border-top: 0; padding-top: 0; }
.item .title { font-weight:600; }
.item .sub { color: var(--muted); font-size: 13px; }
.score-bars { display:grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; margin-top: 6px; }
.score-bars .bar-row { display:flex; align-items:center; gap: 10px; }
.bar-row .lab { width: 140px; color: var(--muted); font-size: 13px; }
.bar { flex:1; height: 6px; background: var(--bg-3); border-radius: 999px; overflow:hidden; }
.bar > div { height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.outreach pre { white-space: pre-wrap; background: var(--bg-3); padding: 12px; border-radius: 10px; }
@media (max-width: 720px) {
  .mode-grid { grid-template-columns: 1fr; }
  .card-row { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  main { padding: 18px 14px 80px; }
}
