/* Панель VK-лидгена — gubtor.ru/vk-leadgen/ */
* { margin:0; padding:0; box-sizing:border-box; }
:root {
  --bg:#f4f6fb; --panel:#fff; --line:#e4e8f0;
  --ink:#1c2333; --muted:#6b7385; --accent:#3b6ef5; --accent-d:#2c56c9;
  --red:#e5484d; --green:#2f9e62; --amber:#e8a13c;
  --radius:14px; --shadow:0 1px 3px rgba(28,35,51,.06), 0 8px 24px rgba(28,35,51,.05);
}
html,body { background:var(--bg); color:var(--ink);
  font:15px/1.45 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif; }
a { color:var(--accent); text-decoration:none; }
.mono { font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; font-size:13px; }
.muted { color:var(--muted); font-size:13px; }
.hint { color:var(--muted); font-size:13px; margin-top:10px; }
.alert { background:#fdecec; color:#a72b2f; padding:10px 12px; border-radius:10px; font-size:13.5px; margin-bottom:12px; }

/* вход */
.login-body { min-height:100vh; display:flex; align-items:center; justify-content:center; }
.login-card { background:var(--panel); border-radius:18px; box-shadow:var(--shadow); padding:36px 38px; width:380px; }
.login-card h1 { font-size:21px; text-align:center; margin-bottom:4px; }
.login-sub { text-align:center; color:var(--muted); font-size:13px; margin-bottom:22px; }
.form-group { margin-bottom:14px; }
.form-group label { display:block; font-size:13px; color:var(--muted); margin-bottom:5px; }
.form-group input { width:100%; padding:10px 12px; border:1px solid var(--line); border-radius:10px;
  font-size:15px; outline:none; background:#fafbfe; }
.form-group input:focus { border-color:var(--accent); background:#fff; }
.btn { display:inline-block; padding:8px 14px; border:none; border-radius:9px; cursor:pointer;
  font-size:14px; background:#eef1f8; color:var(--ink); font-weight:500; }
.btn:hover { background:#e3e8f3; }
.btn-primary { background:var(--accent); color:#fff; } .btn-primary:hover { background:var(--accent-d); }
.btn-danger { background:var(--red); color:#fff; } .btn-danger:hover { opacity:.9; }
.btn-block { width:100%; padding:11px; font-size:15px; margin-top:6px; }
.btn-sm { padding:5px 11px; font-size:13px; }
.file-btn { position:relative; overflow:hidden; }
.file-btn input { position:absolute; inset:0; opacity:0; cursor:pointer; }

/* шапка */
.top { background:var(--panel); border-bottom:1px solid var(--line); padding:12px 18px;
  display:flex; align-items:center; gap:18px; flex-wrap:wrap; position:sticky; top:0; z-index:20; }
.brand { font-weight:700; font-size:17px; display:flex; align-items:center; gap:8px; }
.brand-sub { font-weight:400; font-size:13px; color:var(--muted); }
.dot { width:9px; height:9px; border-radius:50%; background:var(--accent); display:inline-block; }
.tabs { display:flex; gap:6px; flex-wrap:wrap; }
.tab { padding:8px 14px; border-radius:9px; font-size:13.5px; font-weight:600; color:var(--ink);
  background:#eef1f8; border:1px solid transparent; }
.tab:hover { background:#e3e8f3; }
.tab-active { background:var(--accent); color:#fff; }
.cnt { background:rgba(255,255,255,.35); border-radius:20px; padding:1px 7px; font-size:12px; margin-left:4px; }
.tab-active .cnt { background:rgba(255,255,255,.25); }
.top-right { margin-left:auto; display:flex; gap:8px; }

main { padding:18px; max-width:1900px; margin:0 auto; }
.stats { display:flex; gap:10px; flex-wrap:wrap; margin-bottom:14px; }
.stat { background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:10px 16px; box-shadow:var(--shadow); }
.stat-v { font-size:21px; font-weight:700; }
.stat-k { font-size:12.5px; color:var(--muted); }
.card { background:var(--panel); border:1px solid var(--line); border-radius:var(--radius);
  box-shadow:var(--shadow); padding:14px; margin-bottom:16px; }
.card h2 { font-size:16px; margin-bottom:10px; }

/* фильтры и добавление */
.filters { display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-bottom:12px; }
.in { padding:8px 10px; border:1px solid var(--line); border-radius:9px; font-size:13.5px;
  background:#fafbfe; color:var(--ink); outline:none; min-width:170px; }
.in:focus { border-color:var(--accent); background:#fff; }
.in-sm { min-width:150px; padding:6px 8px; font-size:13px; }
.addbox { background:#f7f9fe; border:1px dashed #c9d6f5; border-radius:12px; padding:10px 12px; margin-bottom:12px; }
.addbox-head { font-size:13.5px; font-weight:600; margin-bottom:6px; }
.addbox textarea { width:100%; padding:8px 10px; border:1px solid var(--line); border-radius:9px;
  font-size:13.5px; font-family:ui-monospace,Menlo,Consolas,monospace; margin-bottom:8px; }
.bulkbar { display:flex; gap:8px; flex-wrap:wrap; align-items:center; background:#eef4ff;
  border:1px solid #c9d6f5; border-radius:12px; padding:9px 12px; margin-bottom:12px; }
.bulkbar[hidden] { display:none; }

/* таблица */
.tbl-wrap { overflow:auto; max-height:66vh; border:1px solid var(--line); border-radius:12px; }
.tbl { border-collapse:separate; border-spacing:0; width:100%; font-size:13px; }
.tbl th, .tbl td { border-bottom:1px solid var(--line); padding:5px 7px; text-align:left; vertical-align:middle; }
.tbl thead th { position:sticky; top:0; background:#f7f9fe; z-index:5; font-size:12.5px; white-space:nowrap; }
.tbl thead a { color:var(--ink); }
.tbl tbody tr:hover { background:#fafcff; }
.tbl .empty { text-align:center; color:var(--muted); padding:26px; }
.chk { width:34px; text-align:center; }
.row-actions { white-space:nowrap; }
.cell { width:100%; min-width:64px; padding:4px 6px; border:1px solid transparent; border-radius:7px;
  font-size:12.5px; background:transparent; color:var(--ink); font-family:inherit; }
.cell:hover { border-color:var(--line); background:#fff; }
.cell:focus { border-color:var(--accent); background:#fff; outline:none; }
.cell-saved { border-color:var(--green) !important; background:#f1fbf5 !important; }
select.cell { max-width:230px; }
.pager { display:flex; gap:6px; align-items:center; margin-top:12px; flex-wrap:wrap; }
.pbtn { padding:6px 11px; border:1px solid var(--line); border-radius:8px; background:#fafbfe; font-size:13px; }
.pbtn-active { background:var(--accent); border-color:var(--accent); color:#fff; font-weight:600; }

/* модалка */
.modal { position:fixed; inset:0; background:rgba(20,26,40,.45); display:flex; align-items:center;
  justify-content:center; z-index:100; padding:20px; }
.modal[hidden] { display:none; }
.modal-card { background:var(--panel); border-radius:16px; width:min(760px,100%); max-height:88vh;
  overflow:auto; box-shadow:0 20px 60px rgba(20,26,40,.3); }
.modal-head { display:flex; justify-content:space-between; align-items:center; gap:10px;
  padding:14px 16px; border-bottom:1px solid var(--line); font-weight:600; position:sticky; top:0; background:var(--panel); }
.modal-body { padding:12px 16px; }
.modal-body th { width:210px; color:var(--muted); font-weight:500; font-size:13px; }
.card-in { min-width:380px; }

/* всплывашка */
.toast { position:fixed; left:50%; transform:translateX(-50%); bottom:26px; padding:11px 18px;
  border-radius:11px; color:#fff; font-size:14px; z-index:200; box-shadow:0 10px 30px rgba(20,26,40,.25); }
.toast-ok { background:var(--green); } .toast-err { background:var(--red); }

/* ── настройки и запуск модулей ── */
.running-bar { display:flex; align-items:center; gap:10px; flex-wrap:wrap; background:#eef4ff; border:1px solid #c9d6f5;
  border-radius:12px; padding:10px 14px; margin-bottom:14px; font-size:14px; }
.pulse { width:10px; height:10px; border-radius:50%; background:var(--green); box-shadow:0 0 0 0 rgba(47,158,98,.6); animation:pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow:0 0 0 0 rgba(47,158,98,.55); } 70% { box-shadow:0 0 0 12px rgba(47,158,98,0); } 100% { box-shadow:0 0 0 0 rgba(47,158,98,0); } }
.badge { display:inline-block; padding:2px 9px; border-radius:20px; font-size:12.5px; font-weight:600; background:#eef1f8; color:var(--ink); }
.badge-running { background:#e6f5ec; color:#1f7a4a; }
.badge-done { background:#e8f0fe; color:#2c56c9; }
.badge-error { background:#fdecec; color:#a72b2f; }
.badge-stopped { background:#fdf3e3; color:#8a5a13; }
.run-tbl td, .sched-tbl td { vertical-align:middle; }
.report-row td { background:#fafcff; }
.report { white-space:pre-wrap; font-family:ui-monospace,Menlo,Consolas,monospace; font-size:12.5px;
  background:#f7f9fe; border:1px solid var(--line); border-radius:10px; padding:10px; margin-top:8px; }
details summary { cursor:pointer; color:var(--accent); font-size:13.5px; }
.two-col { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:6px; }
.lbl { display:block; font-size:13px; color:var(--muted); margin:10px 0 5px; }
.ta { width:100%; padding:10px 12px; border:1px solid var(--line); border-radius:10px; font-size:13.5px;
  background:#fafbfe; color:var(--ink); line-height:1.45; resize:vertical; }
.ta:focus { border-color:var(--accent); background:#fff; outline:none; }
.ta.mono { font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; font-size:12.5px; }
.prompt-box { border:1px solid var(--line); border-radius:12px; padding:12px; margin-top:14px; background:#fcfdff; }
.prompt-head { display:flex; justify-content:space-between; align-items:center; gap:10px; }
.save-bar { display:flex; gap:10px; align-items:center; margin-top:16px; flex-wrap:wrap; }
.sw { display:inline-flex; align-items:center; gap:6px; font-size:13.5px; }
code { background:#eef1f8; padding:1px 6px; border-radius:6px; font-size:12.5px; }
@media (max-width: 900px) { .two-col { grid-template-columns:1fr; } }

.url-cell { display:flex; align-items:center; gap:4px; }
.url-go { flex:0 0 auto; width:24px; height:24px; line-height:22px; text-align:center; border:1px solid var(--line);
  border-radius:7px; background:#f7f9fe; color:var(--accent); font-size:13px; font-weight:700; }
.url-go:hover { background:#eef4ff; border-color:var(--accent); }

.addbox-row { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.lbl-inline { display:inline-flex; align-items:center; gap:6px; font-size:13px; color:var(--muted); }

.num { width:46px; text-align:right; color:var(--muted); font-variant-numeric:tabular-nums; font-size:12.5px; }
.tbl thead th.num { cursor:default; }

/* ── живое обновление ── */
.livebar { display:flex; align-items:center; gap:14px; flex-wrap:wrap; margin:0 0 10px; font-size:13px; }
.live-warn { color:#8a5a13; background:#fdf3e3; border-radius:8px; padding:2px 8px; display:none; }
.cell-flash { background:#fff8e6 !important; border-color:var(--amber) !important; }

/* ── индикатор прогона над таблицей ── */
.runbar { display:none; align-items:center; gap:12px; flex-wrap:wrap; position:sticky; top:0; z-index:20;
  margin:0 0 12px; padding:10px 14px; border-radius:12px; background:#eef4ff; border:1px solid #c9d6f5; }
.runbar.active { display:flex; }
.rdot { width:10px; height:10px; border-radius:50%; background:#1f8f4e; box-shadow:0 0 0 0 rgba(31,143,78,.6);
  animation:rpulse 1.6s infinite; }
@keyframes rpulse { 0%{box-shadow:0 0 0 0 rgba(31,143,78,.55)} 70%{box-shadow:0 0 0 10px rgba(31,143,78,0)} 100%{box-shadow:0 0 0 0 rgba(31,143,78,0)} }
.pbar { width:220px; height:8px; border-radius:6px; background:#d8e2f7; overflow:hidden; }
.pbar i { display:block; height:100%; width:0; background:#2f6df6; transition:width .5s ease; }
.runbar-btns { margin-left:auto; display:flex; gap:8px; }
tr.row-current td { background:#e8f4ea !important; }
tr.row-current td:first-child, tr.row-current td:nth-child(2) { border-left:3px solid #1f8f4e; }

.pause-chip { color:#7a4d06; background:#fdf0d9; border:1px solid #f0d9a8; border-radius:999px;
  padding:2px 10px; font-size:12.5px; font-variant-numeric:tabular-nums; }

/* предупреждение о дневном лимите ВК */
.blocked-banner {
  background: #fff4e5; border: 1px solid #f0b46a; border-left: 5px solid #e08b21;
  color: #7a4b06; padding: 12px 14px; border-radius: 8px; margin: 10px 0 18px;
  font-size: 14px; line-height: 1.5;
}
