/* Админка «Лиды курса» — кастомный слой поверх Bootstrap 5 */

:root {
  --plum-900: #2b0f1e;
  --plum-700: #4a1230;
  --plum-600: #64193f;
  --plum-500: #7a1f4d;
  --plum-400: #a13a63;
  --cream: #faf7f2;
  --ink: #2d2430;
  --grad-brand: linear-gradient(135deg, #4a1230 0%, #7a1f4d 55%, #a13a63 100%);
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--cream);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ---------------- верхняя панель ---------------- */
.topbar {
  background: var(--grad-brand);
  color: #fff;
  box-shadow: 0 2px 14px rgba(74, 18, 48, .35);
}
.topbar .brand-badge {
  width: 38px; height: 38px; border-radius: 12px;
  background: rgba(255, 255, 255, .14);
  display: inline-flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.topbar .brand-title { font-weight: 700; letter-spacing: .2px; }
.topbar .brand-sub { font-size: 12px; opacity: .75; margin-top: -2px; }

/* ---------------- карточки ---------------- */
.card-soft {
  border: 1px solid rgba(74, 18, 48, .08);
  border-radius: 1rem;
  box-shadow: 0 1px 3px rgba(45, 36, 48, .05), 0 8px 24px -18px rgba(74, 18, 48, .25);
  background: #fff;
}

.stat-card { transition: transform .15s ease, box-shadow .15s ease; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px -10px rgba(74, 18, 48, .35); }
.stat-icon {
  width: 46px; height: 46px; border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.stat-icon.plum   { background: #f6e6ee; color: var(--plum-500); }
.stat-icon.orange { background: #ffedd9; color: #c2660a; }
.stat-icon.blue   { background: #e3edff; color: #2457c5; }
.stat-icon.teal   { background: #ddf5f0; color: #0d8f74; }
.stat-icon.amber  { background: #e0f2fb; color: #0b6fa4; }
.stat-label {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px;
  color: #8b7f8f; font-weight: 600;
}
.stat-value { font-size: 1.7rem; font-weight: 800; line-height: 1.1; }

/* ---------------- график 14 дней ---------------- */
.chart-wrap { display: flex; align-items: flex-end; gap: 6px; height: 130px; padding-top: 8px; }
.chart-col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.chart-bar-zone { height: 100px; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.chart-bar {
  width: 70%; max-width: 34px; min-height: 3px;
  background: var(--grad-brand);
  border-radius: 6px 6px 3px 3px;
  opacity: .88;
  transition: opacity .15s ease, transform .15s ease;
}
.chart-col:hover .chart-bar { opacity: 1; transform: scaleY(1.02); transform-origin: bottom; }
.chart-zero { background: #ece4e9; opacity: 1; }
.chart-day { font-size: 10.5px; color: #8b7f8f; white-space: nowrap; }
.chart-count { font-size: 11px; font-weight: 700; color: var(--plum-500); min-height: 14px; }

/* ---------------- таблица ---------------- */
.table-leads { margin-bottom: 0; }
.table-leads thead th {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px;
  color: #8b7f8f; font-weight: 700; border-bottom: 1px solid rgba(74, 18, 48, .1);
  background: #fdfbf8; white-space: nowrap;
}
.table-leads tbody td { vertical-align: middle; }
.table-leads tbody tr { cursor: pointer; transition: background .12s ease; }
.table-leads tbody tr:hover { background: #faf3f7; }
.lead-name { font-weight: 600; }
.lead-time { white-space: nowrap; color: #6d6172; font-size: 13.5px; }

.badge-site { font-weight: 700; letter-spacing: .5px; font-size: 11px; }
.badge-site.ru { background: #e3edff; color: #2457c5; }
.badge-site.kz { background: #dff3e4; color: #15803d; }
.badge-site.webinar { background: #f0e6ff; color: #6d28d9; }
/* KZ-вебинар: синий, как флаг Казахстана, и отдельно от зелёного «курс KZ» */
.badge-site.webinar-kz { background: #d6ecf9; color: #0b6fa4; }
.stat-icon.violet { background: #f0e6ff; color: #6d28d9; }

/* ---------------- логин ---------------- */
.login-bg {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(161, 58, 99, .55), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(161, 58, 99, .35), transparent 60%),
    var(--grad-brand);
  padding: 24px;
}
.login-card { max-width: 420px; width: 100%; border: 0; border-radius: 1.4rem; }
.login-logo {
  width: 64px; height: 64px; margin: 0 auto;
  border-radius: 20px; background: var(--grad-brand);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px -10px rgba(122, 31, 77, .6);
}
.btn-brand {
  background: var(--grad-brand); border: 0; color: #fff; font-weight: 600;
}
.btn-brand:hover, .btn-brand:focus { color: #fff; filter: brightness(1.08); }
.btn-brand:disabled { color: rgba(255,255,255,.7); }

/* ---------------- прочее ---------------- */
.skeleton td { color: transparent; }
.spinner-ring {
  display: inline-block; width: 18px; height: 18px;
  border: 2.5px solid rgba(122, 31, 77, .25); border-top-color: var(--plum-500);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state { text-align: center; padding: 48px 16px; color: #8b7f8f; }
.empty-state .big { font-size: 42px; }

.toast-newlead { position: fixed; right: 18px; bottom: 18px; z-index: 2000; min-width: 280px; }

.raw-pre {
  background: #2b0f1e; color: #f3d9e6; border-radius: .6rem;
  padding: 12px; font-size: 12px; max-height: 240px; overflow: auto;
}

.kv-row { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px dashed rgba(74,18,48,.09); }
.kv-row:last-child { border-bottom: 0; }
.kv-key { flex: 0 0 150px; color: #8b7f8f; font-size: 13px; }
.kv-val { flex: 1 1 auto; word-break: break-word; font-size: 14px; }

@media (max-width: 575.98px) {
  .stat-value { font-size: 1.35rem; }
  .chart-day { font-size: 8.5px; }
  .chart-col:nth-child(even) .chart-day { visibility: hidden; }
  .kv-key { flex-basis: 110px; }
}
