/* ══════════════════════════════════════════════════════════════════
   «нормальный VPN» · панель — добавочные стили (drawer, фильтры, login,
   модалки, тосты, таймлайн, аналитика). Палитра — только :root мока.
   ══════════════════════════════════════════════════════════════════ */

.hidden { display: none !important; }

/* ───────────── LOGIN ───────────── */
#login-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: var(--page-bg);
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 360px; max-width: 92vw;
  padding: 28px;
}
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.login-title { font-size: 17px; font-weight: 700; color: var(--text-1); margin-bottom: 2px; }
.login-sub { font-size: 13px; color: var(--text-3); margin-bottom: 18px; }

.fld { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.fld label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.fld input {
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 12px;
  font-size: 13.5px; font-family: inherit; color: var(--text-1);
  background: #fff; outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.fld input:focus { border-color: #a5b4fc; box-shadow: 0 0 0 3px rgba(99,102,241,.09); }

.login-err {
  background: var(--red-bg); color: var(--red);
  font-size: 12.5px; border-radius: var(--radius-sm);
  padding: 8px 10px; margin-bottom: 12px;
}

.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: default; pointer-events: none; }
a.btn { text-decoration: none; }

/* Вход через CRM-бота */
.login-code-hint {
  font-size: 12.5px; color: var(--text-2);
  background: var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 12px; margin: 12px 0;
  line-height: 1.55; text-align: center;
}
.login-code-hint b { letter-spacing: 2px; font-size: 14px; color: var(--text-1); }
.login-wait {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 12.5px; color: var(--text-3); margin-bottom: 12px;
}
.login-wait::before {
  content: ''; width: 12px; height: 12px; flex-shrink: 0;
  border: 2px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: rp-spin .8s linear infinite;
}
@keyframes rp-spin { to { transform: rotate(360deg); } }

/* ───────────── DRAWER (карточка клиента) ───────────── */
#drawer-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(17,24,39,.38);
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 440px; max-width: 96vw;
  background: var(--card-bg);
  box-shadow: -12px 0 32px rgba(0,0,0,.14);
  display: flex; flex-direction: column;
  animation: drawer-in .18s ease;
}
@keyframes drawer-in { from { transform: translateX(36px); opacity: .4; } to { transform: none; opacity: 1; } }

.drawer-hd {
  display: flex; align-items: center; gap: 14px;
  padding: 18px; border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.drawer-score {
  width: 62px; height: 62px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; flex-shrink: 0;
  border: 4px solid var(--border);
  color: var(--text-2);
}
.ds-green  { color: var(--green-dark); border-color: var(--green);  background: var(--green-bg);  }
.ds-yellow { color: #d97706;           border-color: var(--yellow); background: var(--yellow-bg); }
.ds-orange { color: var(--orange);     border-color: var(--orange); background: var(--orange-bg); }
.ds-red    { color: var(--red);        border-color: var(--red);    background: var(--red-bg);    }

.drawer-hd-info { flex: 1; min-width: 0; }
.drawer-name { font-size: 15px; font-weight: 700; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-ids  { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.drawer-exp  { font-size: 12.5px; font-weight: 600; margin-top: 4px; }

.drawer-x {
  width: 30px; height: 30px; border-radius: 7px;
  border: 1px solid var(--border); background: #fff;
  color: var(--text-3); font-size: 15px; line-height: 1;
  cursor: pointer; flex-shrink: 0; align-self: flex-start;
  transition: all .1s;
}
.drawer-x:hover { background: #f9fafb; color: var(--text-1); }

.drawer-body {
  flex: 1; overflow-y: auto;
  padding: 18px;
  display: flex; flex-direction: column; gap: 16px;
}

.dgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.dfield {
  background: #f9fafb;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 8px 10px;
}
.dfield-l { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .4px; font-weight: 600; }
.dfield-v { font-size: 13px; font-weight: 600; color: var(--text-1); margin-top: 2px; word-break: break-word; }

.dsec-title { font-size: 13px; font-weight: 700; color: var(--text-1); }

.factor-row { margin-bottom: 9px; }
.factor-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; margin-bottom: 4px; }
.factor-name { color: var(--text-2); }
.factor-val  { color: var(--text-3); font-weight: 600; white-space: nowrap; }
.factor-bar  { height: 5px; background: var(--border-light); border-radius: 10px; overflow: hidden; }
.factor-fill { height: 100%; border-radius: 10px; }

/* ───────────── ТАЙМЛАЙН ───────────── */
.tl { position: relative; padding-left: 32px; display: flex; flex-direction: column; gap: 14px; }
.tl::before {
  content: ''; position: absolute; left: 11px; top: 8px; bottom: 8px;
  width: 2px; background: var(--border-light);
}
.tl-item { position: relative; min-height: 24px; }
.tl-dot {
  position: absolute; left: -32px; top: 0;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.tl-dot svg { width: 11px; height: 11px; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: var(--text-3); }
.td-green  { background: var(--green-bg);   } .td-green  svg { stroke: var(--green-dark); }
.td-red    { background: var(--red-bg);     } .td-red    svg { stroke: var(--red);        }
.td-yellow { background: var(--yellow-bg);  } .td-yellow svg { stroke: #d97706;           }
.td-orange { background: var(--orange-bg);  } .td-orange svg { stroke: var(--orange);     }
.td-indigo { background: var(--primary-bg); } .td-indigo svg { stroke: var(--primary);    }
.td-purple { background: var(--purple-bg);  } .td-purple svg { stroke: var(--purple);     }
.td-gray   { background: var(--border-light); }

.tl-title { font-size: 13px; font-weight: 600; color: var(--text-1); }
.tl-date  { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.tl-meta  { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* ───────────── МОДАЛКА ───────────── */
#modal-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(17,24,39,.45);
  display: flex; align-items: center; justify-content: center;
}
.modal {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 460px; max-width: 94vw;
  padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
  animation: modal-in .15s ease;
}
@keyframes modal-in { from { transform: translateY(8px); opacity: .5; } to { transform: none; opacity: 1; } }

.modal-hd { display: flex; align-items: flex-start; gap: 10px; }
.modal-titles { flex: 1; min-width: 0; }
.modal-title { font-size: 15px; font-weight: 700; color: var(--text-1); }
.modal-sub   { font-size: 12.5px; color: var(--text-3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.modal textarea {
  min-height: 130px; resize: vertical;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font: inherit; font-size: 13.5px; color: var(--text-1);
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.modal textarea:focus { border-color: #a5b4fc; box-shadow: 0 0 0 3px rgba(99,102,241,.09); }
.modal-cnt { font-size: 11.5px; color: var(--text-3); text-align: right; }
.modal-ft { display: flex; justify-content: flex-end; gap: 8px; }

/* ───────────── ТОСТЫ ───────────── */
#toast-root {
  position: fixed; right: 20px; bottom: 20px; z-index: 120;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--text-1); color: #fff;
  font-size: 13px; font-weight: 500;
  padding: 10px 16px; border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  max-width: 340px;
  animation: toast-in .18s ease;
}
.toast-err { background: var(--red); }
.toast-out { opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ───────────── ПАНЕЛЬ ФИЛЬТРОВ ───────────── */
.filter-panel {
  background: #f9fafb;
  border-bottom: 1px solid var(--border-light);
  padding: 14px 18px;
  display: flex; flex-direction: column; gap: 14px;
}
.fgroups { display: flex; flex-wrap: wrap; gap: 14px 26px; }
.fgroup { min-width: 140px; }
.fgroup-title {
  font-size: 10.5px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 6px;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
/* Свой диапазон дней по окончанию подписки (группа занимает всю ширину) */
.fgroup-wide { flex-basis: 100%; }
.frange { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.frange-lbl { font-size: 12px; color: var(--text-2); }
.frange-inp {
  width: 76px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; font-family: inherit; color: var(--text-1); background: #fff;
}
.frange-inp:focus { outline: none; border-color: #a5b4fc; box-shadow: 0 0 0 3px rgba(99,102,241,.09); }
.frange-hint { flex-basis: 100%; font-size: 11.5px; color: var(--text-3); }
.chip {
  display: inline-flex; align-items: center;
  border: 1px solid var(--border); background: #fff;
  color: var(--text-2);
  border-radius: 20px; padding: 4px 11px;
  font-size: 12.5px; cursor: pointer; user-select: none;
  transition: all .1s; white-space: nowrap;
}
.chip:hover { border-color: #d1d5db; }
.chip.on {
  background: var(--primary-bg); border-color: #c7d2fe;
  color: var(--primary); font-weight: 600;
}
.filter-actions { display: flex; gap: 8px; }

.ctrl-btn.on {
  background: var(--primary-bg); border-color: #c7d2fe;
  color: var(--primary); font-weight: 600;
}
.ctrl-btn.on svg { stroke: var(--primary); }

/* ───────────── ТАБЛИЦА: мелочи ───────────── */
.th-sort { cursor: pointer; user-select: none; }
.th-sort:hover { color: var(--text-1); }
.th-arrow { color: var(--primary); }

.hf-none { background: var(--border); }
.hn-none { color: var(--text-3); }

.pg-btn:disabled { opacity: .45; cursor: default; pointer-events: none; }
.pg-dots {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 13px;
}

.empty { padding: 26px; text-align: center; color: var(--text-3); font-size: 13px; }

/* KPI-карточки без клика (аналитика) */
.stat-static { cursor: default; }
.stat-static:hover { transform: none; box-shadow: none; }

/* ───────────── АНАЛИТИКА ───────────── */
.an-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }

.saved-banner {
  display: flex; align-items: center; gap: 14px;
  background: var(--green-bg);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}
.saved-ic {
  width: 38px; height: 38px; border-radius: 10px;
  background: #dcfce7;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.saved-ic svg { width: 18px; height: 18px; stroke: var(--green-dark); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.saved-text { font-size: 14.5px; font-weight: 700; color: var(--green-dark); }
.saved-sub  { font-size: 12px; color: var(--text-2); margin-top: 2px; font-weight: 400; }

.bars-wrap { padding: 16px 18px 12px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; }
.bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; gap: 4px; height: 100%; }
.bar { border-radius: 4px 4px 0 0; min-height: 2px; }
.bar-l { text-align: center; font-size: 10.5px; color: var(--text-3); flex-shrink: 0; }

.card-pad { padding: 16px 18px; }

/* ───────────── КАМПАНИИ ───────────── */
/* у таблицы кампаний нет колонки-чекбокса — снимаем ширину 38px мока */
.camp-tbl thead th:first-child { width: auto; }

.st-badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 20px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.st-draft    { background: var(--border-light); color: var(--text-2);     }
.st-running  { background: var(--primary-bg);   color: var(--primary);    }
.st-done     { background: var(--green-bg);     color: var(--green-dark); }
.st-canceled { background: var(--red-bg);       color: var(--red);        }
.st-running::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: var(--primary); margin-right: 6px;
  animation: camp-pulse 1.2s ease infinite;
}
@keyframes camp-pulse { 50% { opacity: .35; } }

.camp-prog { display: flex; align-items: center; gap: 8px; min-width: 140px; }
.camp-prog .hs-track { flex: 1; min-width: 60px; }
.camp-prog-n { font-size: 12.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.hf-indigo { background: var(--primary); }

.camp-dlv { color: var(--green-dark); font-weight: 600; }
.camp-blk { color: var(--red); font-weight: 600; }
/* Не дошло: человек не нажимал Start у бота или удалил аккаунт. Не ошибка
   рассылки, поэтому цвет приглушённый, а не красный. */
.camp-fail { color: var(--text-3); font-weight: 600; }
.camp-ret { color: var(--green-dark); font-weight: 600; white-space: nowrap; }

.rb-danger { border-color: #fecaca; color: var(--red); }
.rb-danger:hover { background: var(--red-bg); border-color: #fca5a5; }

/* Модалка создания кампании */
.camp-modal { width: 560px; max-height: 92vh; overflow-y: auto; }
.camp-modal .fld { margin-bottom: 0; }
.camp-modal textarea { min-height: 96px; }
.camp-vars { font-size: 11.5px; color: var(--text-3); line-height: 1.6; }
/* Бонус кампании: чипы типа + поля суммы/срока */
.bonus-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 8px 0 6px; }
.bonus-inp { width: 92px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-family: inherit; color: var(--text-1); background: #fff; }
.bonus-inp:focus { outline: none; border-color: #a5b4fc; box-shadow: 0 0 0 3px rgba(99,102,241,.09); }
.bonus-inp-sm { width: 64px; }
.bonus-unit, .bonus-lbl { font-size: 12.5px; color: var(--text-2); }
.camp-bonus-line { color: var(--text-2); margin-top: 2px; }
.camp-vars code {
  background: var(--border-light); border-radius: 4px;
  padding: 1px 5px; font-size: 11px; color: var(--text-2);
}
.camp-seg { display: flex; flex-direction: column; gap: 10px; }
.camp-summary {
  font-size: 12.5px; color: var(--text-2); line-height: 1.5;
  background: #f9fafb; border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); padding: 8px 10px;
}
.camp-preview {
  font-size: 13px; font-weight: 600;
  color: var(--primary); background: var(--primary-bg);
  border-radius: var(--radius-sm); padding: 9px 12px;
}
.camp-preview.cp-warn { color: var(--orange); background: var(--orange-bg); }
.camp-confirm { text-align: center; padding: 14px 6px 4px; }
.camp-confirm-num { font-size: 22px; font-weight: 800; color: var(--text-1); letter-spacing: -0.5px; }
.camp-confirm-sub { font-size: 13px; color: var(--text-2); margin-top: 6px; }

/* ───────────── МОБИЛЬНАЯ АДАПТАЦИЯ (SPEC §13b) ───────────── */
.burger-btn {
  display: none;
  width: 38px; height: 38px;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-md);
  align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: border-color .12s;
}
.burger-btn:hover { border-color: #d1d5db; }
.burger-btn svg { width: 18px; height: 18px; stroke: var(--text-2); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
#sb-overlay { display: none; }

@media (max-width: 1100px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .an-two { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    height: 100vh; z-index: 70;
    transform: translateX(-102%);
    transition: transform .2s ease;
  }
  body.sb-open .sidebar {
    transform: none;
    box-shadow: 12px 0 32px rgba(0,0,0,.16);
  }
  body.sb-open #sb-overlay {
    display: block; position: fixed; inset: 0;
    background: rgba(17,24,39,.38); z-index: 65;
  }
  .burger-btn { display: flex; }
  .topbar { padding: 10px 14px; }
  .content { padding: 16px 14px; }
  .kbd-pair { display: none; }
  .page-hd { flex-direction: column; align-items: stretch; gap: 10px; }
  .hd-btns { flex-wrap: wrap; }
  .drawer { width: 100%; max-width: 100%; }
  .qa-row { flex-direction: column; align-items: stretch; }
}

/* ───────────── НАСТРОЙКИ ───────────── */
.set-cols { grid-template-columns: 380px 1fr; }
.set-pad { padding: 14px 18px; }
.set-hint { font-size: 12px; color: var(--text-3); line-height: 1.5; margin-bottom: 12px; }
.sw-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid var(--border-light);
}
.sw-row:last-of-type { border-bottom: none; }
.sw-lbl { flex: 1; font-size: 13px; color: var(--text-2); }
.sw-inp {
  width: 64px; height: 32px; text-align: right;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0 8px; font-size: 13px; font-family: inherit; color: var(--text-1);
  background: #fff; outline: none;
}
.sw-inp:focus { border-color: #a5b4fc; box-shadow: 0 0 0 3px rgba(99,102,241,.09); }
.sw-pct { font-size: 12px; color: var(--text-3); }
.sw-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.team-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--border-light);
}
.team-row:last-child { border-bottom: none; }
.team-info { flex: 1; min-width: 0; }
.audit-row { padding: 8px 0; border-bottom: 1px solid var(--border-light); font-size: 13px; }
.audit-row:last-child { border-bottom: none; }
.audit-top { display: flex; justify-content: space-between; gap: 10px; }
@media (max-width: 1100px) { .set-cols { grid-template-columns: 1fr; } }

/* ───────────── ПЕРИОДЫ / ФИНАНСЫ / ЖУРНАЛ ───────────── */
.period-bar {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
}
.ctrl-btn.on { background: var(--primary-bg); border-color: #c7d2fe; color: var(--primary); font-weight: 600; }
.period-custom { display: inline-flex; align-items: center; gap: 6px; margin-left: 6px; }
.period-custom input[type="date"] {
  height: 30px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0 8px; font-size: 12.5px; font-family: inherit; color: var(--text-2);
  background: #fff; outline: none;
}
.period-custom input[type="date"]:focus { border-color: #a5b4fc; }
.fin-row { padding: 7px 0; border-bottom: 1px solid var(--border-light); }
.fin-row:last-child { border-bottom: none; }
.fin-top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.fin-k { font-size: 13px; color: var(--text-2); }
.fin-v { font-size: 13px; font-weight: 700; color: var(--text-1); white-space: nowrap; }
.audit-text {
  margin-top: 6px; padding: 8px 10px;
  background: var(--border-light); border-radius: var(--radius-sm);
  font-size: 12.5px; color: var(--text-1);
  white-space: pre-wrap; word-break: break-word;
}
.fin-sub .sw-lbl { padding-left: 16px; color: var(--text-3); }
