:root {
  --bg: #f6f7f9; --card: #fff; --line: #e4e7ec; --text: #1d2433; --muted: #6b7385;
  --accent: #3b5bdb; --accent-soft: #edf1ff; --ok: #2b8a3e; --warn: #c27c0e; --bad: #c92a2a;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }
main { max-width: 1320px; margin: 0 auto; padding: 20px; }
.top { display: flex; align-items: center; gap: 18px; padding: 10px 20px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.logo { font-weight: 700; font-size: 17px; color: var(--text); }
.top nav { display: flex; gap: 4px; }
.top nav a { padding: 6px 10px; border-radius: 6px; color: var(--muted); }
.top nav a.on, .top nav a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.qsearch { flex: 1; min-width: 180px; }
.qsearch input { width: 100%; }
.me { color: var(--muted); font-size: 13px; }
.flash { background: #fff8e1; border: 1px solid #f1d98a; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: 1fr 1fr; } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); }
.side { grid-template-columns: 2fr 1fr; }
@media (max-width: 900px) { .g2, .g3, .g4, .side { grid-template-columns: 1fr; } }
.kpi { font-size: 26px; font-weight: 700; } .kpi-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
td.n, th.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr:hover td { background: #fafbfd; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.err { color: var(--bad); font-size: 12px; }
.ok { color: var(--ok); }
input, select, textarea { font: inherit; padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text); }
textarea { width: 100%; min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
label { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 3px; }
.btn, button { font: inherit; display: inline-block; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; }
.btn:hover, button:hover { filter: brightness(1.08); text-decoration: none; }
.btn.ghost, button.ghost { background: #fff; color: var(--accent); }
.btn.small, button.small { padding: 3px 9px; font-size: 13px; }
button.danger { background: #fff; color: var(--bad); border-color: #f0c4c4; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-bottom: 12px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; background: #eef0f4; color: var(--muted); white-space: nowrap; }
.st-new { background: #eef0f4; } .st-to_contact { background: #fff3d6; color: #8a5a00; } .st-contacted { background: #e7f0ff; color: #2b4fb8; }
.st-replied { background: #e3f4ff; color: #106ba3; } .st-agreed { background: #e3f8e8; color: #2b8a3e; } .st-working { background: #d3f2dc; color: #1e6b31; }
.st-declined { background: #fde8e8; color: #a52020; } .st-unfit { background: #f1f1f1; color: #999; }
.plat { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: #eef0f4; color: #444; }
.plat-instagram { background: #fde7f3; color: #b0186d; } .plat-telegram { background: #e3f2fd; color: #1769aa; }
.plat-vk { background: #e8eefc; color: #2852b5; } .plat-max { background: #efe8ff; color: #5b34c2; }
.funnel { display: flex; gap: 6px; flex-wrap: wrap; }
.funnel a { flex: 1; min-width: 110px; padding: 10px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); }
.funnel a b { display: block; font-size: 22px; }
.funnel a:hover { border-color: var(--accent); text-decoration: none; }
.log { max-height: 420px; overflow: auto; }
.log div { padding: 6px 0; border-bottom: 1px dashed var(--line); }
pre.tpl { white-space: pre-wrap; background: #f8f9fb; border: 1px solid var(--line); padding: 10px; border-radius: 8px; margin: 8px 0; font: inherit; }
.pager { display: flex; gap: 6px; margin-top: 12px; }
.login { max-width: 340px; margin: 12vh auto; }
.login input { width: 100%; }
.stagebar { display: flex; gap: 4px; flex-wrap: wrap; }
.stagebar button { background: #fff; color: var(--text); border-color: var(--line); }
.stagebar button.cur { background: var(--accent); color: #fff; border-color: var(--accent); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.dot.on { background: var(--ok); } .dot.off { background: #ccc; }
