/* ═══════════════════════════════════════════════════════════════
   OutSide — redesign 2026
   Тёмная тема (#0e0e0e) · акцент #8ab4f8 · белый для ключевых
   элементов · система: карточки / таблицы / бейджи / кнопки
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg: #0e0e0e;
  --bg-sidebar: #101013;
  --bg-card: #161619;
  --bg-card-hover: #1c1c20;
  --bg-input: #1a1a1e;
  --bg-elevated: #1d1d21;

  --border: #26262b;
  --border-light: #35353c;

  --white: #ffffff;
  --text: #e8eaed;
  --text-dim: #9aa0a6;
  --text-faint: #6b7076;

  --accent: #8ab4f8;
  --accent-strong: #aecbfa;
  --accent-dim: rgba(138, 180, 248, .13);
  --accent-ring: rgba(138, 180, 248, .16);

  --green: #81c995;
  --yellow: #fdd663;
  --red: #f28b82;
  --purple: #c58af9;
  --cyan: #78d9ec;
  --orange: #f9a76c;

  --radius-lg: 16px;
  --radius: 12px;
  --radius-sm: 9px;

  --sidebar-w: 248px;
  --topbar-h: 60px;

  --shadow-pop: 0 16px 48px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .4);

  --font: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Menlo', 'Monaco', 'JetBrains Mono', 'Cascadia Code', 'Consolas', 'Courier New', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

::selection { background: var(--accent-dim); }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ─── Логин ─────────────────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(138, 180, 248, .06) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 30%, #171727 0%, var(--bg) 70%);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 44px 40px 36px;
  width: 400px;
  max-width: 92vw;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
}

.login-logo { margin-bottom: 20px; }
.login-title { font-size: 23px; font-weight: 650; color: var(--white); margin-bottom: 6px; letter-spacing: -.3px; }
.login-sub { font-size: 13.5px; color: var(--text-dim); margin-bottom: 28px; }

.login-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.login-form label { font-size: 12.5px; color: var(--text-dim); font-weight: 550; display: block; margin-bottom: 6px; }

.login-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 11px 14px;
  font-size: 14.5px;
  font-family: var(--font);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.login-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.login-input::placeholder { color: var(--text-faint); }

.login-btn {
  background: var(--white);
  color: #0d0d0f;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px;
  font-size: 14.5px;
  font-weight: 620;
  font-family: var(--font);
  cursor: pointer;
  transition: background .18s, transform .1s;
  margin-top: 6px;
}
.login-btn:hover { background: #ececef; }
.login-btn:active { transform: scale(.985); }
.login-btn:disabled { opacity: .4; cursor: not-allowed; }

.login-error {
  color: var(--red);
  font-size: 13px;
  padding: 10px 14px;
  background: rgba(242, 139, 130, .09);
  border: 1px solid rgba(242, 139, 130, .18);
  border-radius: var(--radius-sm);
}

/* ─── Layout ────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

.main-col {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.main {
  flex: 1;
  padding: 28px 36px 48px;
  max-width: calc(100vw - var(--sidebar-w));
}

.page { animation: pageIn .25s ease both; }
@keyframes pageIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ─── Topbar ────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  height: var(--topbar-h);
  background: rgba(17, 17, 20, .9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  height: 100%;
  padding: 0 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-crumb { font-size: 13px; color: var(--text-faint); letter-spacing: .01em; }
.crumb-sep { margin: 0 8px; color: var(--border-light); }
.crumb-cur { color: var(--text-dim); font-weight: 550; }

.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip-name { font-size: 13.5px; font-weight: 600; color: var(--text); }

.role-chip {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(138, 180, 248, .22);
  padding: 2px 8px;
  border-radius: 999px;
}

/* ─── Sidebar ───────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  height: var(--topbar-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo svg { flex-shrink: 0; }

.sidebar-logo .logo-text {
  font-size: 17px;
  font-weight: 650;
  color: var(--white);
  letter-spacing: -.3px;
}
.sidebar-logo .logo-text .accent { color: var(--accent); }

.sidebar-nav {
  flex: 1;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-section {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 16px 12px 6px;
}
.nav-section:first-child { padding-top: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 550;
  transition: background .15s, color .15s;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: var(--font);
  position: relative;
}

.nav-item svg { flex-shrink: 0; color: var(--text-faint); transition: color .15s; }

.nav-item:hover { background: var(--bg-card); color: var(--text); }
.nav-item:hover svg { color: var(--text-dim); }

.nav-item.active { background: var(--accent-dim); color: var(--white); }
.nav-item.active svg { color: var(--accent); }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 22%;
  bottom: 22%;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
}

.sidebar-user {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role { font-size: 11px; color: var(--text-faint); }

.logout-btn { color: var(--text-faint); }
.logout-btn:hover { color: var(--red); background: rgba(242, 139, 130, .09) !important; }

/* ─── Аватар ────────────────────────────────────────────── */
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--purple) 100%);
  color: var(--white);
  font-size: 14px;
  font-weight: 650;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  user-select: none;
}
.avatar-sm { width: 28px; height: 28px; font-size: 12px; }
.avatar-lg { width: 46px; height: 46px; font-size: 18px; }

/* ─── Заголовки страниц ─────────────────────────────────── */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-title { font-size: 24px; font-weight: 650; color: var(--white); letter-spacing: -.4px; line-height: 1.2; }
.page-sub { font-size: 13.5px; color: var(--text-dim); margin-top: 4px; }
.page-head-actions { display: flex; gap: 10px; align-items: center; }

/* ─── Кнопки ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 570;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: var(--font);
  transition: background .16s, border-color .16s, color .16s, transform .1s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }
.btn svg { flex-shrink: 0; }

.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* белый primary — тот самый «немного белого» */
.btn-primary { background: var(--white); color: #0d0d0f; }
.btn-primary:hover { background: #ecedef; }

.btn-secondary { background: var(--bg-card); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--border-light); color: var(--white); }

.btn-danger { background: transparent; color: var(--red); border-color: rgba(242, 139, 130, .28); }
.btn-danger:hover { background: rgba(242, 139, 130, .09); border-color: rgba(242, 139, 130, .45); }

.btn-ghost { background: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--bg-card); color: var(--text); }

.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }

/* квадратная иконка-кнопка (меню ⋯, удалить, закрыть) */
.icon-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-faint);
  cursor: pointer;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg-card-hover); color: var(--text); }
.icon-btn.danger:hover { background: rgba(242, 139, 130, .09); color: var(--red); }

/* ─── Стат-карточки ─────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
  gap: 16px;
}

.stat-card {
  background: linear-gradient(180deg, #18181c 0%, #151518 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .2s, transform .2s;
  position: relative;
  overflow: hidden;
}
.stat-card:hover { border-color: var(--border-light); transform: translateY(-1px); }

.stat-top { display: flex; align-items: flex-start; justify-content: space-between; }

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-value {
  font-size: 30px;
  font-weight: 680;
  color: var(--white);
  line-height: 1;
  letter-spacing: -.6px;
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 13px; color: var(--text-dim); }

.stat-icon[data-color="blue"]   { background: rgba(138, 180, 248, .13); }
.stat-icon[data-color="blue"] svg   { color: var(--accent); }
.stat-icon[data-color="green"]  { background: rgba(129, 201, 149, .13); }
.stat-icon[data-color="green"] svg  { color: var(--green); }
.stat-icon[data-color="yellow"] { background: rgba(253, 214, 99, .13); }
.stat-icon[data-color="yellow"] svg { color: var(--yellow); }
.stat-icon[data-color="red"]    { background: rgba(242, 139, 130, .13); }
.stat-icon[data-color="red"] svg    { color: var(--red); }
.stat-icon[data-color="purple"] { background: rgba(197, 138, 249, .13); }
.stat-icon[data-color="purple"] svg { color: var(--purple); }

/* маленький тег в правом верхнем углу карточки */
.tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--bg-input);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ─── График ────────────────────────────────────────────── */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px 18px;
  margin-top: 18px;
}

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.chart-title { font-size: 14.5px; font-weight: 620; color: var(--text); }

.legend { display: flex; gap: 16px; }
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 550;
}
.legend-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }

.chart { display: flex; align-items: stretch; gap: 5px; }
.chart-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.chart-bars {
  width: 100%;
  height: 132px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  padding: 0 1px;
  border-bottom: 1px solid var(--border);
}
.chart-col:hover .chart-bars { border-bottom-color: var(--border-light); }

.bar {
  flex: 1;
  max-width: 8px;
  min-height: 3px;
  border-radius: 3px 3px 0 0;
  opacity: .85;
  transition: opacity .15s, filter .15s;
}
.chart-col:hover .bar { opacity: 1; }
.bar-visits   { background: linear-gradient(180deg, var(--accent), rgba(138, 180, 248, .45)); }
.bar-emails   { background: linear-gradient(180deg, var(--yellow), rgba(253, 214, 99, .45)); }
.bar-successes{ background: linear-gradient(180deg, var(--green), rgba(129, 201, 149, .45)); }

.chart-label {
  font-size: 10px;
  color: #7d828a;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ─── Список доменов ────────────────────────────────────── */
.domain-list { display: flex; flex-direction: column; gap: 10px; }

.domain-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  transition: border-color .18s, background .18s;
}
.domain-card:hover { border-color: var(--border-light); background: var(--bg-card-hover); }

.domain-main { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }

.domain-glyph {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.domain-info { flex: 1; min-width: 0; }
.domain-name {
  font-size: 14.5px;
  font-weight: 620;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -.1px;
}
.domain-meta { font-size: 12px; color: var(--text-faint); margin-top: 3px; }

.domain-stats { display: flex; gap: 22px; flex-shrink: 0; }
.metric { text-align: right; }
.metric b {
  display: block;
  font-size: 15px;
  font-weight: 650;
  color: var(--white);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.metric span { font-size: 11px; color: var(--text-faint); }

.domain-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ─── Таблица (логи) ────────────────────────────────────── */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-scroll { overflow-x: auto; }

.logs-table { width: 100%; border-collapse: collapse; min-width: 640px; }

.logs-table th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-faint);
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  background: #141417;
  white-space: nowrap;
}

.logs-table td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid rgba(38, 38, 43, .6);
  vertical-align: middle;
  white-space: nowrap;
}
.logs-table tbody tr:last-child td { border-bottom: none; }

.logs-table tbody tr { cursor: pointer; transition: background .12s; }
.logs-table tbody tr:hover { background: #1a1a1e; }

.cell-email { font-family: var(--font); font-size: 13.5px; font-weight: 500; color: var(--text); letter-spacing: .01em; }
.cell-dim { color: var(--text-dim); }
.cell-faint { color: var(--text-faint); font-size: 12px; }
.cell-time { text-align: right; color: var(--text-faint); font-size: 12px; font-variant-numeric: tabular-nums; }

/* цветной бейдж события (замена эмодзи) */
.log-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  line-height: 1.4;
}
.log-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

/* ─── Фильтры ───────────────────────────────────────────── */
.filters-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.search-wrap { position: relative; flex: 1; min-width: 220px; }
.search-wrap .form-input { padding-left: 38px; }
.search-wrap > span {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  display: inline-flex;
  pointer-events: none;
}

/* ─── Пагинация ─────────────────────────────────────────── */
.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
}
.pager-info { font-size: 12.5px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* ─── Модалки ───────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .66);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn .16s ease;
  padding: 20px;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 720px;
  max-width: 94vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-pop);
  animation: slideUp .22s cubic-bezier(.2, .9, .3, 1);
}

.modal-head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-shrink: 0;
}
.modal-title { font-size: 16.5px; font-weight: 640; color: var(--white); letter-spacing: -.2px; }

.modal-body {
  padding: 22px 24px;
  overflow-y: auto;
  overflow-x: hidden;
}

.modal-foot {
  padding: 15px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.modal-foot.between { justify-content: space-between; }

.modal-close { font-size: 0; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to { opacity: 1; transform: none; }
}

/* ─── Детали лога ───────────────────────────────────────── */
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(38, 38, 43, .55);
  font-size: 13px;
}
.detail-row:last-of-type { border-bottom: none; }
.detail-row .k { color: var(--text-dim); flex-shrink: 0; }
.detail-row .v { color: var(--text); text-align: right; word-break: break-all; }
.detail-row .v.mono { font-family: var(--font-mono); font-size: 12px; color: var(--accent); }

.code-block {
  background: #111114;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.65;
  color: var(--text-dim);
  word-break: break-all;
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* ─── Формы ─────────────────────────────────────────────── */
.form-group { margin-bottom: 15px; }
.form-label {
  font-size: 12.5px;
  color: var(--text-dim);
  font-weight: 570;
  display: block;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 14px;
  font-size: 13.5px;
  font-family: var(--font);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.form-input::placeholder { color: var(--text-faint); }

.form-hint { font-size: 12px; color: var(--text-faint); margin-top: 6px; }

.form-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 14px;
  font-size: 13.5px;
  font-family: var(--font);
  outline: none;
  cursor: pointer;
}
.form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

/* ─── Тоггл ─────────────────────────────────────────────── */
.form-check {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  font-size: 13.5px;
  color: var(--text);
}
.form-check input[type="checkbox"] { display: none; }

.toggle-track {
  width: 40px;
  height: 22px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  position: relative;
  transition: background .2s, border-color .2s;
  flex-shrink: 0;
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: transform .2s, background .2s;
}
.form-check input:checked + .toggle-track { background: var(--accent); border-color: var(--accent); }
.form-check input:checked + .toggle-track::after {
  transform: translateX(18px);
  background: var(--white);
}

/* ─── Сегменты (табы) ───────────────────────────────────── */
.seg-control {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
  flex-wrap: wrap;
}
.seg-btn {
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 570;
  color: var(--text-dim);
  background: transparent;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  font-family: var(--font);
  transition: background .15s, color .15s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--accent-dim); color: var(--accent-strong); }

/* ─── Алерты ────────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
}
.alert-error { background: rgba(242, 139, 130, .09); border: 1px solid rgba(242, 139, 130, .2); color: var(--red); }
.alert-success { background: rgba(129, 201, 149, .09); border: 1px solid rgba(129, 201, 149, .2); color: var(--green); }

/* ─── Визард ────────────────────────────────────────────── */
.wizard-steps { display: flex; align-items: center; gap: 8px; }

.wstep {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--border-light);
  color: var(--text-faint);
  font-size: 11.5px;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .2s;
  font-variant-numeric: tabular-nums;
}
.wstep.current { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-dim); }
.wstep.done { border-color: var(--green); background: rgba(129, 201, 149, .14); color: var(--green); }
.wstep.done svg { display: block; }

.wline { width: 22px; height: 1.5px; background: var(--border-light); flex-shrink: 0; }
.wline.done { background: var(--green); }

.wizard-step-label { font-size: 12px; color: var(--text-dim); margin-left: 6px; white-space: nowrap; }

.step-desc { font-size: 13px; color: var(--text-dim); margin-bottom: 16px; line-height: 1.6; }

/* выбор типа авторизации */
.auth-types { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }

.auth-type-card {
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 12px 14px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  position: relative;
}
.auth-type-card:hover { border-color: var(--border-light); background: var(--bg-card-hover); }
.auth-type-card.selected { border-color: var(--accent); background: var(--accent-dim); }

.auth-type-card .type-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-type-card .type-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.auth-type-card.selected .type-name { color: var(--accent-strong); }

.auth-type-card .type-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #0d0d0f;
  display: none;
  align-items: center;
  justify-content: center;
}
.auth-type-card.selected .type-check { display: inline-flex; }

.auth-type-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}
.auth-type-desc strong { color: var(--text); font-weight: 620; }

.preview-frame {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #111;
}
/* скрины превью — само окно целиком (940×1280, element-shot): режем только
   пустой низ, верхний бар с кнопкой закрытия всегда в кадре */
.preview-frame img {
  display: block;
  width: 100%;
  height: 300px;
  object-fit: cover;
  object-position: top;
}

/* ─── Шаблоны ───────────────────────────────────────────── */
.template-list { display: flex; flex-direction: column; gap: 8px; }
.template-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 15px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .15s;
}
.template-item:hover { border-color: var(--border-light); }
.template-item.selected { border-color: var(--accent); background: var(--accent-dim); }
.template-name { font-size: 13.5px; font-weight: 550; color: var(--text); }
.template-item.selected .template-name { color: var(--accent-strong); }

.check-ind { color: var(--accent); display: inline-flex; }

/* ─── Подсказка в редакторе ─────────────────────────────── */
.code-hint {
  background: rgba(253, 214, 99, .05);
  border: 1px solid rgba(253, 214, 99, .18);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
  line-height: 1.6;
}
.code-hint-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--yellow);
  font-weight: 620;
  margin-bottom: 8px;
  font-size: 13px;
}
.code-hint code {
  background: var(--bg-input);
  color: var(--accent);
  padding: 2px 7px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 12px;
  border: 1px solid var(--border);
}

/* ─── Редактор кода (IDE: гуттер + textarea) ────────────── */
.code-editor {
  display: flex;
  align-items: stretch;
  background: #101013;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color .18s;
}
.code-editor:focus-within { border-color: var(--border-light); }
.ce-gutter {
  flex: 0 0 46px;
  overflow: hidden;
  background: #0c0c0f;
  border-right: 1px solid var(--border);
  user-select: none;
}
.ce-gutter pre {
  margin: 0;
  padding: 14px 10px 14px 0;
  text-align: right;
  color: #4a4a52;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  min-height: 100%;
}
.code-editor textarea {
  flex: 1;
  min-height: 320px;
  background: transparent;
  border: none;
  color: #c9d1d9;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  padding: 14px 15px;
  resize: vertical;
  outline: none;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
  display: block;
}

.live-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 16px;
  height: 320px;
  background: var(--white);
}

/* ─── Меню ⋯ ────────────────────────────────────────────── */
.dot-menu { position: relative; }

.dot-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 5px;
  min-width: 190px;
  z-index: 150;
  box-shadow: var(--shadow-pop);
}

.dot-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 550;
  color: var(--text);
  border-radius: 7px;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: var(--font);
  transition: background .12s;
}
.dot-item:hover { background: rgba(255, 255, 255, .05); }
.dot-item.danger { color: var(--red); }
.dot-item.danger:hover { background: rgba(242, 139, 130, .09); }
.dot-item svg { color: var(--text-faint); flex-shrink: 0; }
.dot-item.danger svg { color: var(--red); }

/* ─── Пустые состояния / загрузка ───────────────────────── */
.empty {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-faint);
}
.empty-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
}
.empty-title { font-size: 15px; font-weight: 600; color: var(--text-dim); margin-bottom: 5px; }
.empty-desc { font-size: 13px; }

.spinner {
  width: 22px;
  height: 22px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Карточки-секции (настройки, поддержка) ────────────── */
.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.section-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.section-card-title { font-size: 15.5px; font-weight: 630; color: var(--white); letter-spacing: -.2px; }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  align-items: start;
}

/* ─── Поддержка ─────────────────────────────────────────── */
.support-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.support-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.support-card .stat-icon { margin-bottom: 10px; }
.support-desc { font-size: 13.5px; color: var(--text-dim); }
.support-link {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 570;
  text-decoration: none;
  font-family: var(--font-mono);
}
.support-link:hover { color: var(--accent-strong); text-decoration: underline; }
.support-link svg { color: var(--text-faint); }

/* ─── Соглашение ────────────────────────────────────────── */
.doc-card { max-width: 720px; }
.doc-section { display: flex; gap: 16px; padding: 16px 0; }
.doc-section + .doc-section { border-top: 1px solid rgba(38, 38, 43, .6); }
.doc-num {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 650;
  color: var(--accent);
  background: var(--accent-dim);
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.doc-title { font-size: 14.5px; font-weight: 620; color: var(--text); margin-bottom: 6px; }
.doc-text { font-size: 13.5px; color: var(--text-dim); line-height: 1.7; }

/* ─── Ссылки-строки ─────────────────────────────────────── */
.link-path {
  font-size: 14px;
  font-weight: 600;
  color: var(--white);
  font-family: var(--font-mono);
  letter-spacing: -.1px;
}
.link-meta { font-size: 12px; color: var(--text-faint); margin-top: 3px; }

/* ─── Скроллбар ─────────────────────────────────────────── */
* { scrollbar-color: #2c2c31 transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2c2c31; border-radius: 5px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #3a3a41; background-clip: content-box; border: 2px solid transparent; }

/* ─── Мобильная версия ──────────────────────────────────── */
.hamburger {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 300;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 9px;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
}
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 99;
  display: none;
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; }
  .sidebar.open { transform: none; }
  .main-col { margin-left: 0; }
  .main { padding: 20px 16px 40px; }
  .topbar-inner { padding: 0 16px; }
  .topbar-crumb { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .domain-card { flex-wrap: wrap; }
  .domain-stats { width: 100%; justify-content: flex-end; }
  .hamburger { display: flex; }
  .sidebar-overlay.active { display: block; }
}

/* ═══ Аккаунты на дашборде ═══ */
.acc-val {
  user-select: all;
  background: #131315;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 13px;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.acc-break {
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 90px;
  overflow-y: auto;
}
.dl-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
}
.dl-title {
  width: 100%;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 2px;
}
.dl-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #131315;
}
.dl-check:has(input:checked) {
  border-color: var(--accent);
  background: rgba(138, 180, 248, .08);
}
.dl-check input { accent-color: var(--accent); }
.dl-check:has(input:disabled) { opacity: .4; cursor: not-allowed; }
.dl-section .btn { margin-left: auto; }

/* ═══ Секции доменов ═══ */
.domain-section {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
  margin: 18px 0 10px;
}
.domain-section:first-child { margin-top: 0; }
