@import url('./crm-ui-v2.css');

/**
 * ALT CRM — institutional dark (enterprise / fintech)
 * Inter + Outfit + IBM Plex Mono, слои, микродвижение и детальная полировка.
 */
:root {
  --bg-root: #040508;
  --bg-base: #090b10;
  --bg-raised: #0e1016;
  --bg-sidebar: rgba(8, 9, 13, 0.97);
  --surface: rgba(255, 255, 255, 0.032);
  --surface-hover: rgba(255, 255, 255, 0.055);
  --surface-solid: #10131a;
  --surface-nav: rgba(0, 0, 0, 0.28);
  --border: rgba(255, 255, 255, 0.07);
  --border-subtle: rgba(255, 255, 255, 0.048);
  --border-strong: rgba(255, 255, 255, 0.11);
  --text: #f8fafc;
  --text-secondary: #eef2f7;
  --muted: #8b9cb3;
  --muted-bright: #a8b8cc;
  --muted-quiet: #6b7c90;
  /* Семантика дашборда: клики / конверсии / риск */
  --semantic-click: #60a5fa;
  --semantic-click-dim: #3b82f6;
  --semantic-conv: #4ade80;
  --semantic-conv-dim: #22c55e;
  --semantic-risk: #fb923c;
  --semantic-risk-strong: #f87171;
  --semantic-telegram: #2dd4bf;
  /* Единые состояния */
  --state-up: #4ade80;
  --state-down: #f87171;
  --state-flat: #94a3b8;
  --accent: #3b82f6;
  --accent-bright: #60a5fa;
  --accent-dim: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.24);
  --brand-gold: #d4af37;
  --cyan: #38bdf8;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --radius-xl: 20px;
  --radius-pill: 999px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.2, 0.64, 1);
  --shadow-lg: 0 32px 80px -16px rgba(0, 0, 0, 0.62);
  --shadow-card: 0 0 0 1px rgba(0, 0, 0, 0.45), 0 20px 48px -20px rgba(0, 0, 0, 0.55);
  --shadow-card-hover: 0 0 0 1px rgba(59, 130, 246, 0.12), 0 28px 64px -24px rgba(0, 0, 0, 0.58);
  --crm-masthead-bg: linear-gradient(145deg, rgba(59, 130, 246, 0.09) 0%, rgba(8, 11, 18, 0.92) 42%, rgba(6, 8, 14, 0.96) 100%);
  --crm-masthead-shine: radial-gradient(ellipse 90% 80% at 100% 0%, rgba(255, 255, 255, 0.07), transparent 55%);
  --shadow-inset-top: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --font-display: "Outfit", "Inter", var(--font);
  --sidebar-width: 280px;
  --header-blur: 28px;
  --ring-focus: 0 0 0 2px var(--bg-base), 0 0 0 4px rgba(59, 130, 246, 0.45);
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --icon-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  /* Кнопки: «премиум» слои и свечение */
  --btn-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --btn-ease-spring: cubic-bezier(0.34, 1.45, 0.64, 1);
  --btn-glow-blue: 0 0 0 1px rgba(59, 130, 246, 0.12), 0 4px 20px rgba(37, 99, 235, 0.35), 0 18px 44px -12px rgba(59, 130, 246, 0.38);
  --btn-glow-blue-hover: 0 0 0 1px rgba(96, 165, 250, 0.35), 0 8px 28px rgba(37, 99, 235, 0.45), 0 24px 56px -10px rgba(59, 130, 246, 0.5);
  --btn-glow-gold: 0 0 0 1px rgba(212, 175, 55, 0.25), 0 6px 24px rgba(0, 0, 0, 0.28), 0 16px 40px -18px rgba(212, 175, 55, 0.22);
  /* Комфорт: цели касания и ритм форм */
  --crm-touch: 2.75rem;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Skip link: доступность с клавиатуры */
.crm-skip-link {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 99999;
  padding: 0.65rem 1.1rem;
  margin: 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  background: var(--surface-solid);
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg), 0 0 0 2px var(--bg-base), 0 0 0 4px rgba(59, 130, 246, 0.45);
  transform: translateY(-120%);
  transition: transform 0.2s var(--ease-out);
}
.crm-skip-link:focus {
  outline: none;
}
.crm-skip-link:focus-visible {
  transform: translateY(0);
}

#main-content:focus-visible,
#login-main:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-base), 0 0 0 4px rgba(59, 130, 246, 0.35);
  border-radius: var(--radius-sm);
}

/* Якоря внутри страниц (например /ads#links-section) не прячутся под шапкой */
.app-main [id$="-section"] {
  scroll-margin-top: 5rem;
}

.app-main a:focus-visible:not(.btn):not(.sidebar__brand):not(.sidebar__logout):not(.dashboard-quick__link):not(.crm-breadcrumb__link):not(.crm-palette__hit),
.copy-url:focus-visible {
  outline: none;
  border-radius: 4px;
  box-shadow: 0 0 0 2px var(--bg-base), 0 0 0 4px rgba(59, 130, 246, 0.4);
}

.dashboard-quick__link:focus-visible {
  outline: none;
  box-shadow: var(--ring-focus);
}

.crm-breadcrumb__link:focus-visible,
.crm-palette__hit:focus-visible {
  outline: none;
  border-radius: 6px;
  box-shadow: 0 0 0 2px var(--bg-base), 0 0 0 4px rgba(59, 130, 246, 0.35);
}

@media print {
  .sidebar,
  .crm-topbar,
  .crm-skip-link,
  .crm-sidebar-toggle,
  .crm-sidebar-backdrop {
    display: none !important;
  }
  .app-layout {
    display: block !important;
  }
  .app-main {
    padding: 0 !important;
  }
}

::selection {
  background: rgba(59, 130, 246, 0.35);
  color: var(--text);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .crm-skip-link {
    transition: none;
  }
  .nav.sidebar__nav a:hover,
  .sidebar__link:hover {
    transform: none;
  }
  .ads-kpi-card:hover {
    transform: none;
  }
  .metric:hover,
  .card:hover {
    transform: none;
  }
}

body.crm-app {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.58;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  scrollbar-gutter: stable;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  background-color: var(--bg-root);
  background-image:
    radial-gradient(ellipse 100% 70% at 50% -30%, rgba(59, 130, 246, 0.09), transparent 55%),
    radial-gradient(ellipse 80% 50% at 100% 50%, rgba(56, 189, 248, 0.04), transparent 50%),
    linear-gradient(180deg, var(--bg-root) 0%, var(--bg-base) 35%, #06070a 100%);
  background-attachment: fixed;
}

body.crm-app::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.32;
  background-image: radial-gradient(rgba(148, 163, 184, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
}

body.crm-app::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(ellipse 85% 65% at 50% 100%, transparent 40%, rgba(0, 0, 0, 0.45) 100%);
  opacity: 0.85;
}

body.crm-app::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
body.crm-app::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
body.crm-app::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.45);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
body.crm-app::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.55);
  background-clip: padding-box;
}

.app-layout {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
  align-items: stretch;
  box-shadow: inset 1px 0 0 var(--border-subtle);
}

/* ——— Sidebar ——— */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0.875rem 1.25rem;
  background: linear-gradient(180deg, rgba(12, 14, 20, 0.98) 0%, rgba(8, 9, 13, 0.99) 100%);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(var(--header-blur)) saturate(1.25);
  -webkit-backdrop-filter: blur(var(--header-blur)) saturate(1.25);
  box-shadow:
    4px 0 48px rgba(0, 0, 0, 0.35),
    inset -1px 0 0 rgba(255, 255, 255, 0.03);
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.5rem 0.65rem 1.35rem;
  margin: 0 0.2rem 0.65rem;
  text-decoration: none;
  color: var(--text);
  border-radius: var(--radius);
  border: 1px solid transparent;
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 50%, transparent 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  transition:
    background 0.25s var(--ease-soft),
    border-color 0.25s var(--ease-soft),
    box-shadow 0.25s var(--ease-soft);
}

.sidebar__brand:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(255, 255, 255, 0.04) 45%, rgba(212, 175, 55, 0.04) 100%);
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow:
    0 0 0 1px rgba(59, 130, 246, 0.12) inset,
    0 12px 40px -20px rgba(0, 0, 0, 0.5);
}

.sidebar__logo {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 13px;
  background:
    linear-gradient(160deg, rgba(56, 189, 248, 0.12) 0%, transparent 42%),
    linear-gradient(155deg, #1a3a62 0%, #0c1220 38%, #152a52 100%);
  color: #e8c547;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: -0.05em;
  text-shadow: 0 0 20px rgba(212, 175, 55, 0.35);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.1) inset,
    0 1px 0 rgba(255, 255, 255, 0.07) inset,
    0 14px 36px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(0, 0, 0, 0.35);
}

.sidebar__logo::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.14), transparent 55%);
  opacity: 0.85;
}

.sidebar__brand-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  min-width: 0;
}

.sidebar__brand-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.035em;
  line-height: 1.15;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0;
}

.sidebar__brand-st {
  color: var(--text);
}

.sidebar__brand-dot {
  color: var(--brand-gold);
  font-weight: 800;
  padding: 0 0.12em;
  text-shadow: 0 0 24px rgba(212, 175, 55, 0.25);
}

.sidebar__brand-crypto {
  background: linear-gradient(105deg, #f8fafc 0%, #e2e8f0 38%, #7dd3fc 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sidebar__brand-tag {
  display: block;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin: 0;
  padding-left: 0.05em;
}

.sidebar__section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem 0.75rem 0.65rem;
  padding: 0 0.5rem;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.sidebar__section::before {
  content: "";
  width: 1.25rem;
  height: 1px;
  background: linear-gradient(90deg, var(--border-strong), transparent);
  opacity: 0.8;
}

.nav.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
  padding: 0.45rem;
  min-height: 0;
  background: var(--surface-nav);
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-inset-top), 0 1px 0 rgba(255, 255, 255, 0.02);
}

/* Навигация по высоте только по содержимому — без flex:1, иначе внутри блока «Меню» тянется пустота. */
.sidebar__nav--service {
  flex: 0 0 auto;
  margin-top: 0.35rem;
}

.nav.sidebar__nav a,
.sidebar__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--crm-touch);
  padding: 0.7rem 0.85rem;
  margin: 0;
  border-radius: var(--radius-sm);
  color: var(--muted-bright);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: color 0.2s var(--ease-soft), background 0.2s var(--ease-soft), box-shadow 0.2s var(--ease-soft), transform 0.2s var(--ease-soft);
  border: 1px solid transparent;
}

.sidebar__iconwrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.125rem;
  height: 2.125rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted-bright);
  flex-shrink: 0;
  transition: background 0.2s var(--ease-soft), color 0.2s var(--ease-soft), box-shadow 0.2s var(--ease-soft);
}

.sidebar__iconwrap svg {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
}

.sidebar__link-text {
  flex: 1;
  min-width: 0;
}

.nav.sidebar__nav a:hover,
.sidebar__link:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  transform: translateX(2px);
}

.nav.sidebar__nav a:hover .sidebar__iconwrap,
.sidebar__link:hover .sidebar__iconwrap {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.nav.sidebar__nav a:focus-visible,
.sidebar__link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-sidebar), 0 0 0 4px var(--accent);
}

.nav.sidebar__nav a[aria-current="page"],
.sidebar__link[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
  background: rgba(59, 130, 246, 0.11);
  border-color: rgba(59, 130, 246, 0.16);
  box-shadow:
    inset 3px 0 0 0 var(--accent-bright),
    inset 0 0 0 1px rgba(59, 130, 246, 0.1),
    0 0 20px -12px var(--accent-glow);
  transform: none;
}

.nav.sidebar__nav a[aria-current="page"] .sidebar__iconwrap,
.sidebar__link[aria-current="page"] .sidebar__iconwrap {
  background: rgba(59, 130, 246, 0.22);
  color: var(--accent-bright);
  box-shadow: 0 0 10px -4px var(--accent-glow);
}

.sidebar__footer {
  padding-top: 1rem;
  margin-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

.sidebar__logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: calc(100% - 0.25rem);
  margin: 0 0.125rem;
  min-height: var(--crm-touch);
  padding: 0.625rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
  transition: color 0.2s var(--ease-soft), border-color 0.2s var(--ease-soft), background 0.2s var(--ease-soft);
}

.sidebar__logout svg {
  width: 1rem;
  height: 1rem;
  opacity: 0.85;
  flex-shrink: 0;
}

.sidebar__logout:hover {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.28);
  background: rgba(248, 113, 113, 0.07);
}

.sidebar__logout:hover svg {
  opacity: 1;
}

.sidebar__logout:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-sidebar), 0 0 0 4px var(--accent);
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 70% 45% at 15% 0%, rgba(59, 130, 246, 0.07), transparent 52%),
    radial-gradient(ellipse 55% 40% at 100% 15%, rgba(56, 189, 248, 0.05), transparent 48%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, transparent 32%, rgba(59, 130, 246, 0.03) 100%);
  position: relative;
}

.app-main::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06) 20%, rgba(255, 255, 255, 0.06) 80%, transparent);
  pointer-events: none;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2.5rem 2.25rem 4.5rem;
  width: 100%;
  position: relative;
  z-index: 1;
}

.container--crm {
  max-width: 1280px;
}

.container--narrow {
  max-width: 880px;
}

/* Единый «шапочный» блок раздела: стекло + градиент */
.crm-masthead {
  margin-bottom: 2rem;
  padding: 1.625rem 1.875rem 1.75rem;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: var(--crm-masthead-bg);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
  box-shadow:
    var(--shadow-card),
    0 0 0 1px rgba(59, 130, 246, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  position: relative;
  overflow: hidden;
}

.crm-masthead::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--crm-masthead-shine);
  pointer-events: none;
  opacity: 0.9;
}

.crm-masthead > .page-header {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
  position: relative;
  z-index: 1;
}

.crm-masthead > .page-header::after {
  display: none;
}

.crm-masthead > .dashboard__hero-meta {
  position: relative;
  z-index: 1;
}

.page-header {
  margin-bottom: 2.25rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.page-header::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 4.5rem;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-bright), transparent);
  opacity: 0.85;
}

/* Заголовки секций вне карточек (напр. Реклама) */
.crm-section-title {
  position: relative;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text-secondary);
  margin: 2.25rem 0 1rem;
  padding: 0 0 0.5rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
}
.crm-section-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.15rem;
  bottom: 0.55rem;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent-bright) 0%, rgba(56, 189, 248, 0.35) 55%, rgba(212, 175, 55, 0.25) 100%);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.25);
}

.crm-section-title:first-of-type {
  margin-top: 0;
}

/* Страница «Реклама»: сворачиваемые блоки (Кампании / TG-ссылки / Рекламные ссылки) */
.crm-page-section {
  margin-bottom: 0;
}

.crm-page-section__head {
  margin: 0;
}

.crm-page-section__toggle {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0 0 0.5rem 0;
  margin: 2rem 0 0 0;
  color: inherit;
  font: inherit;
  border-bottom: 1px solid var(--border-subtle);
  border-radius: 0;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.2s var(--ease-soft), background 0.2s var(--ease-soft);
}

.crm-page-section:first-of-type .crm-page-section__toggle {
  margin-top: 0;
}

.crm-page-section__toggle:hover {
  border-bottom-color: rgba(59, 130, 246, 0.22);
}

.crm-page-section__toggle:focus {
  outline: none;
}

.crm-page-section__toggle:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 2px var(--bg-base), 0 0 0 4px rgba(59, 130, 246, 0.4);
}

.crm-page-section__title {
  position: relative;
  flex: 1;
  min-width: 0;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text-secondary);
  margin: 0;
  padding: 0 0 0 0.85rem;
  text-align: left;
}

.crm-page-section__title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.15rem;
  bottom: 0.1rem;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent-bright) 0%, rgba(56, 189, 248, 0.35) 55%, rgba(212, 175, 55, 0.25) 100%);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.25);
}

.crm-page-section__chevron {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  color: var(--muted-bright);
  font-size: 0.65rem;
  line-height: 1;
  transition: transform 0.22s var(--ease-out), border-color 0.2s var(--ease-soft), color 0.2s var(--ease-soft);
}

.crm-page-section__toggle:hover .crm-page-section__chevron {
  border-color: rgba(59, 130, 246, 0.25);
  color: var(--text-secondary);
}

.crm-page-section--collapsed .crm-page-section__chevron {
  transform: rotate(-90deg);
}

.crm-page-section__panel {
  padding-top: 1rem;
}

.crm-page-section__panel > .crm-page-section__lead {
  margin-top: 0;
  margin-bottom: 1rem;
}

.crm-page-section--collapsed .crm-page-section__panel {
  display: none;
}

.crm-page-section--collapsed .crm-page-section__toggle {
  margin-bottom: 0.35rem;
}

@media (prefers-reduced-motion: reduce) {
  .crm-page-section__chevron {
    transition: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .page-header > * {
    animation: crm-fade-up 0.55s var(--ease-out) backwards;
  }
  .page-header > *:nth-child(1) { animation-delay: 0.03s; }
  .page-header > *:nth-child(2) { animation-delay: 0.08s; }
  .page-header > *:nth-child(3) { animation-delay: 0.13s; }
}

@keyframes crm-fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.page-eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent-dim));
  box-shadow: 0 0 12px var(--accent-glow);
  flex-shrink: 0;
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 3.2vw, 2.35rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  margin: 0 0 0.5rem 0;
  line-height: 1.12;
  text-rendering: optimizeLegibility;
}

.page-title__gradient {
  background: linear-gradient(105deg, #fff 0%, #cbd5e1 42%, var(--accent-bright) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-lead {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.65;
  margin: 0;
  max-width: 56ch;
  font-weight: 450;
}

.page-lead--tight { margin-top: -0.25rem; }

.section-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--muted);
  margin: 2.5rem 0 1rem 0;
}

.section-title:first-of-type { margin-top: 0; }

.card__subtitle {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 0.625rem 0;
  letter-spacing: -0.015em;
}

.card__intro {
  font-size: 0.8125rem;
  color: var(--muted-bright);
  line-height: 1.55;
  margin: 0 0 0.875rem 0;
}

.form-hint {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.55;
  margin-top: 0.5rem;
}

.form-hint--spaced { margin-top: 0.25rem; }

.muted,
.text-muted { color: var(--muted); }

.card {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.045) 0%, rgba(255, 255, 255, 0.02) 40%, rgba(0, 0, 0, 0.12) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  padding: 1.75rem 1.875rem;
  margin-bottom: 1.35rem;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(22px) saturate(1.15);
  -webkit-backdrop-filter: blur(22px) saturate(1.15);
  position: relative;
  transition:
    border-color 0.28s var(--ease-out),
    box-shadow 0.28s var(--ease-out),
    transform 0.28s var(--ease-soft);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.08) 0%, transparent 38%, transparent 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.95;
}

.card::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.12), transparent);
  pointer-events: none;
  opacity: 0.7;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.14);
  transform: translateY(-3px);
  box-shadow:
    var(--shadow-card-hover),
    0 0 48px -18px rgba(59, 130, 246, 0.18);
}

@media (prefers-reduced-motion: reduce) {
  .card:hover {
    transform: none;
  }
}

.card__title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 1.125rem;
}

/* =============================================================================
 * Таблицы CRM (.table-wrap)
 * Порядок: база → --nested → скроллбар → --scroll (вертикальный скролл + nowrap ячеек)
 * → глобальный table / .table-wrap > table (width: max-content — колонки не схлопываются).
 * Узкий экран: @media (max-width: 960px) — перенос в ячейках, лимиты ширины.
 * Страничные блоки: реклама — .table-wrap--ads сразу ниже; антифрод — .table-wrap--sticky
 * и .af-table дальше по файлу (~секция Antifraud).
 * ============================================================================= */

.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  margin-top: 1rem;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, rgba(0, 0, 0, 0.28) 100%);
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 116, 139, 0.5) transparent;
}

.table-wrap--nested {
  margin-top: 0.75rem;
  border-color: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.table-wrap::-webkit-scrollbar {
  height: 8px;
}

.table-wrap::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 4px;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.45);
  border-radius: 4px;
}

.table-wrap::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.55);
}

.table-wrap table { margin: 0; }

/* Длинные таблицы: вертикальная прокрутка, заголовок остаётся видимым (sticky внутри блока). */
.table-wrap--scroll {
  max-height: min(70vh, 720px);
  overflow-x: auto;
  overflow-y: auto;
}

/* Скролл-область: ячейки без переноса по умолчанию (ширина по контенту, горизонтальный скролл). */
.table-wrap--scroll th,
.table-wrap--scroll td {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
}

/* Реклама: ссылки (много колонок) — горизонтальный скролл, URL/цель с переносом. */
.table-wrap--ads {
  border-radius: var(--radius-sm);
  overflow-x: auto;
  overflow-y: auto;
}

.table-wrap--ads > .ads-table {
  table-layout: auto;
  width: max-content;
  min-width: 100%;
  max-width: none;
}

.table-wrap--ads .ads-table th,
.table-wrap--ads .ads-table td {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
}

.table-wrap--ads .ads-table th:nth-child(14),
.table-wrap--ads .ads-table td:nth-child(14),
.table-wrap--ads .ads-table th:nth-child(15),
.table-wrap--ads .ads-table td:nth-child(15),
.table-wrap--ads .ads-table th:nth-child(16),
.table-wrap--ads .ads-table td:nth-child(16) {
  min-width: 17rem;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ads-table tbody tr {
  transition: background 0.15s var(--ease-soft);
}
.ads-table tbody tr:hover {
  background: rgba(59, 130, 246, 0.06);
}

.ads-table tbody.table-refreshing {
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.2s var(--ease-soft);
}

.ads-table tbody tr.ads-row-link-paused {
  opacity: 0.92;
}

table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.table-wrap > table {
  table-layout: auto;
  width: max-content;
  min-width: 100%;
  max-width: none;
}

th, td {
  padding: 0.9375rem 1.125rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.table-wrap th,
.table-wrap td {
  overflow-wrap: break-word;
  word-break: normal;
}

/* Утилиты ячеек: явный nowrap / перенос длинного текста (в т.ч. поверх .table-wrap--scroll … nowrap). */
.table-cell--nowrap {
  white-space: nowrap;
}

.table-cell--wrap {
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}

.table-wrap--scroll th.table-cell--wrap,
.table-wrap--scroll td.table-cell--wrap {
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}

/* Узкий экран: перенос и пределы ширины ячеек (базовая ширина таблицы — см. .table-wrap > table выше). */
@media (max-width: 960px) {
  .table-wrap th,
  .table-wrap td {
    word-break: normal;
    overflow-wrap: break-word;
    white-space: normal;
    min-width: 4.75rem;
    max-width: min(20rem, 85vw);
  }

  .table-wrap th {
    hyphens: none;
  }

  /* Перебить nowrap у .table-wrap--scroll — на узком экране пусть переносится внутри ячейки. */
  .table-wrap--scroll th,
  .table-wrap--scroll td {
    white-space: normal;
  }

  .af-table .reason-list .tag {
    overflow-wrap: break-word;
    word-break: normal;
    white-space: normal;
  }
}

td.table-cell--top {
  vertical-align: top;
  padding-top: 1.05rem;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--muted-bright);
  font-weight: 600;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: linear-gradient(180deg, rgba(16, 19, 26, 0.98) 0%, rgba(10, 12, 18, 0.96) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(59, 130, 246, 0.12);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
  white-space: normal;
  line-height: 1.3;
  min-width: 0;
}

tbody tr {
  transition: background 0.18s var(--ease-soft), box-shadow 0.18s var(--ease-soft);
  box-shadow: inset 3px 0 0 transparent;
}

tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.018);
}

tbody tr:hover {
  background: rgba(59, 130, 246, 0.09);
  box-shadow: inset 3px 0 0 rgba(96, 165, 250, 0.85);
}

tbody tr:hover td {
  color: var(--text-secondary);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* Данные в ячейках */
.table-wrap td code,
.table-code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.table-wrap a.table-link {
  color: var(--accent-bright);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.8125rem;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.table-wrap a.table-link:hover {
  border-bottom-color: rgba(96, 165, 250, 0.45);
  color: #93c5fd;
}

.table-cell--muted {
  font-size: 0.8125rem;
  color: var(--muted-bright);
  line-height: 1.5;
  max-width: 220px;
}

.table-cell--tight {
  font-size: 0.8125rem;
  line-height: 1.45;
}

.table-cell--hashes {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

.table-cell--actions {
  white-space: nowrap;
}

/* Бейджи статусов (антифрод и др.) */
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1;
  border: 1px solid transparent;
}

.status-badge--normal {
  color: #86efac;
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.28);
}

.status-badge--review {
  color: #fde047;
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.28);
}

.status-badge--suspicious {
  color: #fecaca;
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.32);
}

.status-badge--blocked {
  color: #fecaca;
  background: rgba(220, 38, 38, 0.2);
  border-color: rgba(248, 113, 113, 0.38);
}

.status-badge--yes {
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.22);
}

.status-badge--mini {
  padding: 0.2rem 0.45rem;
  font-size: 0.58rem;
  margin-left: 0.35rem;
  font-weight: 600;
  vertical-align: middle;
}

.fraud-score {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-variant-numeric: tabular-nums;
}

.fraud-score__num {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.fraud-score__band-text {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--muted-bright);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hash-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.ip-cell {
  font-size: 0.8125rem;
  line-height: 1.55;
}

.ip-cell--warn {
  color: #fcd34d;
}

.ip-cell--warn code {
  color: inherit;
  border-color: rgba(251, 191, 36, 0.25);
  background: rgba(251, 191, 36, 0.08);
}

.ip-cell .ip-meta {
  display: block;
  font-size: 0.6875rem;
  color: var(--muted);
  margin-top: 0.15rem;
  font-weight: 500;
}

.ip-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
}

.table-cell--placeholder {
  color: var(--muted);
  font-weight: 500;
}

.table-user {
  font-weight: 600;
  color: var(--text);
}

.btn {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.58rem 1.45rem;
  min-height: var(--crm-touch);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  cursor: pointer;
  font-size: 0.875rem;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
  line-height: 1.2;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0.03) 48%, rgba(0, 0, 0, 0.12) 100%);
  color: var(--text-secondary);
  text-decoration: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -1px 0 rgba(0, 0, 0, 0.28),
    0 2px 8px rgba(0, 0, 0, 0.22);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 0.28s var(--btn-ease-spring),
    box-shadow 0.28s var(--btn-ease),
    border-color 0.28s var(--btn-ease),
    background 0.28s var(--btn-ease),
    color 0.28s var(--btn-ease),
    opacity 0.28s var(--btn-ease),
    filter 0.28s var(--btn-ease);
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, transparent 52%);
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
  mix-blend-mode: overlay;
}

.btn > * {
  position: relative;
  z-index: 1;
}

.btn:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.05) 45%, rgba(0, 0, 0, 0.08) 100%);
  color: var(--text);
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2),
    0 8px 28px rgba(0, 0, 0, 0.32) !important;
}

.btn:active {
  transform: translateY(0) scale(0.98);
  transition-duration: 0.12s;
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

.btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px var(--bg-base),
    0 0 0 5px rgba(96, 165, 250, 0.65),
    0 0 28px rgba(59, 130, 246, 0.28);
}

.btn.btn--key:focus-visible {
  box-shadow:
    0 0 0 2px var(--bg-base),
    0 0 0 5px rgba(147, 197, 253, 0.9),
    0 0 40px rgba(59, 130, 246, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    inset 0 -1px 0 rgba(15, 23, 42, 0.35);
}

.btn.btn--primary:focus-visible {
  box-shadow:
    0 0 0 2px var(--bg-base),
    0 0 0 5px rgba(212, 175, 55, 0.55),
    0 0 32px rgba(212, 175, 55, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -1px 0 rgba(148, 163, 184, 0.45);
}

.btn:disabled,
.btn[aria-disabled='true'] {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none !important;
  pointer-events: none;
  box-shadow: none !important;
  filter: none !important;
}

.btn:disabled::before,
.btn[aria-disabled='true']::before {
  opacity: 0.2;
}

.btn--primary {
  background: linear-gradient(175deg, #ffffff 0%, #f1f5f9 38%, #cbd5e1 100%) !important;
  color: #0f172a !important;
  border-color: rgba(212, 175, 55, 0.45) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -1px 0 rgba(148, 163, 184, 0.45),
    var(--btn-glow-gold);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.btn--primary::before {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.85) 0%, transparent 55%);
  opacity: 0.55;
  mix-blend-mode: normal;
}

.btn--primary:hover {
  transform: translateY(-2px) scale(1.01);
  filter: brightness(1.02);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    inset 0 -1px 0 rgba(148, 163, 184, 0.35),
    0 0 0 1px rgba(212, 175, 55, 0.42),
    0 12px 40px rgba(0, 0, 0, 0.28),
    0 20px 48px -16px rgba(212, 175, 55, 0.35) !important;
}

.btn--primary:active {
  transform: translateY(0) scale(0.98);
  filter: brightness(0.98);
}

.btn--key {
  overflow: hidden;
  background: linear-gradient(155deg, #93c5fd 0%, #3b82f6 32%, #1d4ed8 72%, #1e3a8a 100%) !important;
  color: #fff !important;
  border: 1px solid rgba(186, 230, 253, 0.45) !important;
  letter-spacing: 0.06em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    inset 0 -1px 0 rgba(15, 23, 42, 0.35),
    var(--btn-glow-blue);
}

.btn--key::before {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.45) 0%, transparent 50%);
  opacity: 0.55;
  mix-blend-mode: soft-light;
}

.btn--key::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -60%;
  width: 55%;
  height: 220%;
  background: linear-gradient(105deg, transparent 0%, rgba(255, 255, 255, 0.22) 45%, transparent 78%);
  transform: rotate(18deg) translateX(-120%);
  pointer-events: none;
  z-index: 2;
  transition: transform 0.65s var(--btn-ease);
}

.btn--key:hover {
  transform: translateY(-3px) scale(1.015);
  filter: brightness(1.04) saturate(1.05);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.48),
    inset 0 -1px 0 rgba(15, 23, 42, 0.35),
    var(--btn-glow-blue-hover) !important;
}

.btn--key:hover::after {
  transform: rotate(18deg) translateX(280%);
}

.btn--key:active {
  filter: brightness(0.94);
  transform: translateY(0) scale(0.985);
}

/* Главные CTA: чуть крупнее и заметнее на дашборде и в пустых состояниях */
.btn--cta {
  font-weight: 700 !important;
  letter-spacing: 0.04em !important;
  text-transform: none;
  padding-inline: 1.35rem !important;
  min-height: 2.5rem !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    inset 0 -1px 0 rgba(15, 23, 42, 0.35),
    0 0 0 1px rgba(147, 197, 253, 0.35),
    0 10px 36px -8px rgba(37, 99, 235, 0.55),
    0 22px 50px -18px rgba(59, 130, 246, 0.45) !important;
}

.btn--cta:hover {
  transform: translateY(-3px) scale(1.02) !important;
}

.btn--danger {
  background: linear-gradient(165deg, rgba(254, 202, 202, 0.12) 0%, rgba(248, 113, 113, 0.08) 100%) !important;
  color: #fecaca !important;
  border-color: rgba(248, 113, 113, 0.42) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 4px 12px rgba(220, 38, 38, 0.12);
}

.btn--danger::before {
  opacity: 0.35;
}

.btn--danger:hover {
  background: linear-gradient(165deg, rgba(254, 202, 202, 0.2) 0%, rgba(248, 113, 113, 0.14) 100%) !important;
  color: #fff !important;
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 0 1px rgba(248, 113, 113, 0.25),
    0 0 0 1px rgba(220, 38, 38, 0.12),
    0 12px 40px rgba(220, 38, 38, 0.12) !important;
}

.btn--danger:active {
  transform: translateY(0) scale(0.98);
}

.btn--danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn--small {
  padding: 0.48rem 1.05rem;
  font-size: 0.8125rem;
  min-height: 2.5rem;
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.btn--secondary {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.02) 100%);
  color: var(--text-secondary);
  border-color: rgba(255, 255, 255, 0.12);
}

.btn--secondary:hover {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.11) 0%, rgba(255, 255, 255, 0.04) 100%);
  border-color: rgba(255, 255, 255, 0.18);
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 6px 20px rgba(0, 0, 0, 0.2) !important;
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .btn::after,
  .login-card button[type="submit"],
  .login-card button[type="submit"]::after {
    transition-duration: 0.01ms !important;
  }
  .btn.btn--key:hover::after {
    transform: rotate(18deg) translateX(-120%);
  }
  .btn:hover {
    transform: none;
  }
  .btn.btn--key:hover,
  .btn.btn--primary:hover {
    transform: none;
  }
  .btn:active {
    transform: none;
  }
  .login-card button[type="submit"]:hover {
    transform: none;
  }
  .login-card button[type="submit"]:hover::after {
    transform: rotate(18deg) translateX(-120%);
  }
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.card > .filters {
  padding: 1.125rem 1.25rem;
  margin-bottom: 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.form-group { margin-bottom: 1.2rem; }

.form-group label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.065em;
  color: var(--muted);
  margin-bottom: 0.5rem;
  line-height: 1.35;
}

.filters .form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}

.filters .form-group label { margin-bottom: 0.25rem; }

.form-group input:not([type="checkbox"]):not([type="radio"]),
.form-group select,
.form-group textarea {
  width: 100%;
  min-height: var(--crm-touch);
  padding: 0.65rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.38);
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.45;
  font-family: inherit;
  transition: border-color 0.2s var(--ease-soft), box-shadow 0.2s var(--ease-soft);
  box-shadow: var(--shadow-inset-top);
}

.form-group textarea {
  min-height: 5.5rem;
  resize: vertical;
}

.form-group select {
  appearance: none;
  -webkit-appearance: none;
  background-color: rgba(0, 0, 0, 0.38);
  background-image: var(--select-chevron);
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  padding-right: 2.35rem;
  cursor: pointer;
}

.form-group select option {
  background: var(--surface-solid);
  color: var(--text);
}

.form-group input:not([type="checkbox"]):not([type="radio"]):focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: var(--shadow-inset-top), 0 0 0 3px rgba(59, 130, 246, 0.14);
}

.form-actions {
  margin-top: 1.65rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

/* Длинные формы в модалке: кнопки остаются у нижнего края при прокрутке */
.modal__box form .form-actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  margin-top: 1.5rem;
  padding: 1rem 0 0.35rem;
  background: linear-gradient(180deg, transparent 0%, var(--surface-solid) 32%);
  border-top: 1px solid var(--border-subtle);
  box-shadow: 0 -10px 28px -12px rgba(0, 0, 0, 0.45);
}

select.status-select {
  min-width: 100px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  padding: 0.375rem 2rem 0.375rem 0.5rem;
  font-size: 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background-color: rgba(0, 0, 0, 0.35);
  background-image: var(--select-chevron);
  background-repeat: no-repeat;
  background-position: right 0.45rem center;
  background-size: 0.875rem;
  color: var(--text-secondary);
  font-family: inherit;
  box-shadow: var(--shadow-inset-top);
}

select.status-select:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: var(--shadow-inset-top), 0 0 0 2px rgba(59, 130, 246, 0.12);
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: linear-gradient(165deg, rgba(2, 6, 18, 0.88) 0%, rgba(0, 0, 0, 0.78) 100%);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  overflow: auto;
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
}

.modal.show {
  display: flex;
  animation: crm-modal-bg 0.35s var(--ease-out) forwards;
}

@keyframes crm-modal-bg {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal__box {
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 1.875rem 2rem;
  max-width: 580px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  scroll-padding-bottom: 5.5rem;
  margin: auto;
  box-shadow:
    var(--shadow-lg),
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 48px -12px rgba(59, 130, 246, 0.18);
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 116, 139, 0.45) transparent;
  position: relative;
}
.modal__box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 1.25rem;
  right: 1.25rem;
  height: 2px;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.55), rgba(212, 175, 55, 0.35), transparent);
  opacity: 0.8;
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .modal.show .modal__box {
    animation: crm-modal-pop 0.4s var(--ease-spring) forwards;
  }
}

@keyframes crm-modal-pop {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal__title {
  margin: 0 0 1.35rem 0;
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.25;
}

.loading {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
}

.loading::after {
  content: "";
  display: block;
  width: 1.5rem;
  height: 1.5rem;
  margin: 1rem auto 0;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: crm-spin 0.7s linear infinite;
}

@keyframes crm-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .loading::after { animation: none; border-top-color: var(--border); }
}

.error {
  color: var(--red);
  padding: 1rem 1.125rem;
  border-radius: var(--radius-sm);
  background: rgba(248, 113, 113, 0.06);
  border: 1px solid rgba(248, 113, 113, 0.2);
  font-size: 0.875rem;
}
.error:empty {
  display: none;
  padding: 0;
  margin: 0;
  border: none;
  min-height: 0;
}
.error:not(:empty) {
  margin-top: 0.75rem;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 0.875rem;
  margin-bottom: 2.25rem;
}

.metric {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.25rem 1.25rem;
  padding-top: 1.35rem;
  backdrop-filter: blur(16px);
  overflow: hidden;
  transition: border-color 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out), transform 0.25s var(--ease-out);
  box-shadow: var(--shadow-card);
}

.metric::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.5), transparent);
  opacity: 0.85;
}

.metric:hover {
  transform: translateY(-4px);
  border-color: rgba(59, 130, 246, 0.28);
  box-shadow:
    var(--shadow-card),
    0 0 52px -12px var(--accent-glow),
    0 20px 48px -28px rgba(0, 0, 0, 0.45);
}

.metric__label {
  position: relative;
  z-index: 1;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.metric__value {
  position: relative;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.metric--warning .metric__value { color: var(--amber); }
.metric--danger .metric__value { color: var(--red); }
.metric--success .metric__value { color: var(--green); }
.metric--warning::after { background: linear-gradient(90deg, transparent, rgba(251, 191, 36, 0.55), transparent); }
.metric--danger::after { background: linear-gradient(90deg, transparent, rgba(248, 113, 113, 0.55), transparent); }
.metric--success::after { background: linear-gradient(90deg, transparent, rgba(52, 211, 153, 0.55), transparent); }

.tops {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 2.25rem;
}

@media (max-width: 900px) { .tops { grid-template-columns: 1fr; } }

.top-list { list-style: none; margin: 0; padding: 0; }

.top-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.625rem;
  margin: 0 -0.625rem;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
  transition: background 0.18s var(--ease-soft);
}

.top-list li:not(.muted):hover {
  background: rgba(59, 130, 246, 0.06);
}

.top-list li:last-child { border-bottom: none; }

.top-list li.muted {
  justify-content: center;
  font-style: normal;
  font-weight: 500;
  color: var(--muted);
  border-bottom: none;
}

.top-list .name {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 0.5rem;
}

.top-list .count {
  color: var(--muted-bright);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
}

.charts--dashboard {
  grid-template-columns: 1fr;
  margin-top: 0.15rem;
  gap: 1.35rem;
}

/* Динамика: стабильная сетка 2 колонки — 2+2+1, пятый по центру (без «дыры» как в сетке 3+2) */
@media (min-width: 720px) {
  .charts--dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .charts--dashboard .chart-wrap:nth-child(5) {
    grid-column: 1 / -1;
    max-width: min(100%, 560px);
    justify-self: center;
  }
}

.chart-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.045) 0%, rgba(0, 0, 0, 0.18) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  padding: 1rem 1.125rem 0.75rem;
  min-height: 268px;
  height: auto;
  backdrop-filter: blur(20px) saturate(1.1);
  -webkit-backdrop-filter: blur(20px) saturate(1.1);
  box-shadow: var(--shadow-card);
  transition:
    border-color 0.28s var(--ease-out),
    box-shadow 0.28s var(--ease-out),
    transform 0.28s var(--ease-soft);
  overflow: hidden;
}

.chart-wrap::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.35), rgba(56, 189, 248, 0.15), transparent);
  opacity: 0.65;
  pointer-events: none;
}

.chart-wrap:hover {
  border-color: rgba(255, 255, 255, 0.13);
  transform: translateY(-3px);
  box-shadow:
    var(--shadow-card-hover),
    0 0 44px -16px rgba(59, 130, 246, 0.14);
}

@media (prefers-reduced-motion: reduce) {
  .chart-wrap:hover {
    transform: none;
  }
}

.chart-wrap canvas {
  flex: 1;
  min-height: 220px;
  max-height: 260px;
  width: 100% !important;
}

.chart-wrap--empty canvas {
  display: none;
}

.chart-wrap__empty {
  flex: 1;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.25rem 1rem;
  font-size: 0.8125rem;
  color: var(--muted-bright);
  line-height: 1.5;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(59, 130, 246, 0.14);
  background: rgba(0, 0, 0, 0.28);
}

.chart-wrap__empty .empty-state {
  gap: 0.65rem;
}

.chart-wrap__empty .btn {
  margin-top: 0.25rem;
}

.chart-wrap__title {
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-transform: none;
  color: var(--text);
  margin: 0 0 0.5rem 0;
  line-height: 1.35;
}

.copy-url {
  font-size: 0.75rem;
  color: var(--accent-bright);
  cursor: pointer;
  word-break: break-all;
  font-weight: 500;
}

.copy-url:hover { text-decoration: underline; text-underline-offset: 3px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.5rem;
  font-size: 0.75rem;
}

.stats-grid span { color: var(--muted); }
.stats-grid strong { display: block; color: var(--text); font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-weight: 500; }

.status-draft { color: var(--muted); }
.status-active { color: var(--green); }
.status-paused { color: var(--amber); }
.empty { color: var(--muted); padding: 1.25rem 0; font-size: 0.875rem; }

.status-pending { color: var(--muted); }
.status-approved { color: var(--green); }
.status-rejected { color: var(--red); }
.band { font-size: 0.75rem; }
.band.band-normal { color: var(--green); }
.band.band-review { color: var(--amber); }
.band.band-suspicious { color: var(--red); }

.events-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.8125rem;
  max-height: 200px;
  overflow: auto;
}

.events-list li {
  padding: 0.4375rem 0;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.events-list li:last-child { border-bottom: none; }

.risk-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; }

.risk-tag {
  background: rgba(255, 255, 255, 0.04);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.6875rem;
  border: 1px solid var(--border);
  font-weight: 500;
}

.user-id-open {
  color: var(--accent-bright);
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
}

.user-id-open:hover { text-decoration: underline; text-underline-offset: 2px; }

.status-normal { color: var(--green); }
.status-review { color: var(--amber); }
.status-suspicious { color: var(--red); }
.status-blocked { color: var(--red); font-weight: 600; }

.reason-list {
  font-size: 0.8125rem;
  color: var(--muted-bright);
  max-width: 280px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  line-height: 1.4;
}

.table-wrap .tag {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.3rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: 0.65rem;
  font-weight: 600;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.tag {
  display: inline-block;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.125rem 0.4375rem;
  border-radius: 6px;
  font-size: 0.625rem;
  font-weight: 500;
  margin-right: 0.25rem;
  margin-bottom: 0.25rem;
  border: 1px solid var(--border);
}

.hint {
  font-size: 0.875rem;
  color: var(--muted-bright);
  margin-top: 1.125rem;
  line-height: 1.6;
}

ul.report-types { list-style: none; padding: 0; margin: 0.75rem 0 0 0; }

ul.report-types li {
  padding: 0.5rem 0;
  font-size: 0.875rem;
  color: var(--muted-bright);
  border-bottom: 1px solid var(--border-subtle);
  line-height: 1.5;
}

ul.report-types li:last-child { border-bottom: none; }

ul.report-types li strong { color: var(--text-secondary); font-weight: 600; }

.accounts-error { color: var(--red); font-size: 0.875rem; margin-top: 0.5rem; }

/* ——— Dashboard (главная) ——— */
.dashboard {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.dashboard__hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 1.5rem;
}

.dashboard__hero.crm-masthead {
  align-items: flex-end;
}

.dashboard__hero .page-header {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
  flex: 1;
  min-width: min(100%, 280px);
}

.page-title-row {
  display: flex;
  align-items: center;
  gap: 1rem 1.125rem;
  flex-wrap: wrap;
  margin: 0.15rem 0 0.25rem;
}

.page-title-row__text {
  min-width: 0;
}

.page-title--hero {
  margin: 0;
  line-height: 1.1;
}

.page-hero-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  border-radius: 14px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.06em;
  color: #e8c547;
  text-shadow:
    0 0 28px rgba(96, 165, 250, 0.45),
    0 0 20px rgba(212, 175, 55, 0.35);
  background:
    linear-gradient(155deg, rgba(96, 165, 250, 0.2) 0%, transparent 45%),
    linear-gradient(160deg, #1a3a62 0%, #0a0e18 42%, #152a52 100%);
  box-shadow:
    0 0 0 1px rgba(96, 165, 250, 0.22),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 1px 0 rgba(255, 255, 255, 0.07) inset,
    0 16px 42px rgba(0, 0, 0, 0.55);
  position: relative;
}

.page-hero-logo::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.16), transparent 52%);
  opacity: 0.9;
}

.dashboard__hero .page-header::after {
  display: none;
}

.dashboard__hero-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  text-align: right;
}

.dashboard__date {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted-bright);
  letter-spacing: -0.01em;
}

.dashboard__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-pill, 999px);
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-bright);
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.22);
}

.dashboard__badge svg {
  width: 0.75rem;
  height: 0.75rem;
}

.dashboard-quick {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.875rem;
  margin-bottom: 2rem;
}

.dashboard-quick__link {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 1.125rem 1.25rem;
  border-radius: var(--radius-xl);
  text-decoration: none;
  color: inherit;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.05) 0%, rgba(0, 0, 0, 0.15) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(18px) saturate(1.1);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
  transition: border-color 0.2s var(--ease-soft), transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

.dashboard-quick__link:hover {
  border-color: rgba(59, 130, 246, 0.3);
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover), 0 16px 40px -18px var(--accent-glow);
}

.dashboard-quick__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent-bright);
  flex-shrink: 0;
}

.dashboard-quick__icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.dashboard-quick__body {
  flex: 1;
  min-width: 0;
}

.dashboard-quick__title {
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 0.2rem 0;
}

.dashboard-quick__desc {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.4;
}

.dashboard-quick__arrow {
  color: var(--muted);
  flex-shrink: 0;
  opacity: 0.5;
  transition: transform 0.2s var(--ease-out), opacity 0.2s;
}

.dashboard-quick__link:hover .dashboard-quick__arrow {
  transform: translateX(3px);
  opacity: 1;
  color: var(--accent-bright);
}

.dashboard-quick__arrow svg {
  width: 1.125rem;
  height: 1.125rem;
}

.dash-block {
  margin-bottom: 2rem;
}

.dash-block__head {
  margin-bottom: 1rem;
}

.dash-block__head .dash-block__title {
  display: block;
  width: 100%;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.035em;
  color: var(--text);
  margin: 0 0 0.35rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
  text-transform: none;
}

.dash-block__head .dash-block__title::after {
  display: none;
}

.dash-block h2.dash-block__title {
  margin-top: 0;
}

.dash-block__lead {
  font-size: 0.8125rem;
  color: var(--muted-quiet);
  margin: 0;
  line-height: 1.5;
  max-width: 52ch;
  font-weight: 450;
}

.dash-block__head--split {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 1.5rem;
}

.dash-block__head--split .dash-block__head-main {
  flex: 1;
  min-width: min(100%, 260px);
}

.dash-block__head--split .dash-block__title {
  margin-bottom: 0.35rem;
}

.dash-block__head--split .dash-block__lead {
  max-width: 58ch;
}

.dash-block__head--kpi.dash-block__head--split {
  align-items: flex-start;
}

.dash-block__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
  padding-top: 0.2rem;
}

@media (max-width: 720px) {
  .dash-block__head--split {
    flex-direction: column;
    align-items: stretch;
  }
  .dashboard-toolbar--inline {
    align-self: stretch;
  }
  .dash-block__actions {
    justify-content: flex-start;
    padding-top: 0;
  }
}

.metrics--dashboard {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 1rem;
  margin-bottom: 0;
}

.metrics--dashboard .metric,
.metrics--dashboard a.metric--link {
  flex: 1 1 240px;
  max-width: 320px;
  min-width: 212px;
  display: grid;
  grid-template-columns: 2.75rem 1fr;
  grid-template-rows: auto auto;
  column-gap: 1rem;
  row-gap: 0.2rem;
  align-items: center;
}

.metrics--dashboard .metric__iconwrap {
  grid-row: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted-bright);
  border: 1px solid var(--border-subtle);
}

.metrics--dashboard .metric__iconwrap svg {
  width: 1.35rem;
  height: 1.35rem;
}

.metrics--dashboard .metric__label {
  grid-column: 2;
  align-self: end;
  margin-bottom: 0;
}

.metrics--dashboard .metric__value {
  grid-column: 2;
  align-self: start;
}

.metrics--dashboard .metric--warning .metric__iconwrap {
  color: var(--amber);
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.15);
}

.metrics--dashboard .metric--danger .metric__iconwrap {
  color: var(--red);
  background: rgba(248, 113, 113, 0.08);
  border-color: rgba(248, 113, 113, 0.15);
}

.metrics--dashboard .metric--success .metric__iconwrap {
  color: var(--green);
  background: rgba(52, 211, 153, 0.08);
  border-color: rgba(52, 211, 153, 0.15);
}

/* Дашборд: две главные метрики и семантические акценты */
.metrics--dashboard .metric--hero {
  flex: 1 1 280px;
  max-width: 380px;
  min-width: 240px;
  padding: 1.35rem 1.35rem 1.2rem;
  padding-top: 1.45rem;
}

.metrics--dashboard .metric--hero .metric__value {
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.metrics--dashboard .metric--hero .metric__iconwrap {
  width: 3.1rem;
  height: 3.1rem;
  border-radius: 14px;
}

.metrics--dashboard .metric--hero .metric__iconwrap svg {
  width: 1.55rem;
  height: 1.55rem;
}

.metrics--dashboard .metric--sem-clicks .metric__value {
  color: var(--semantic-click);
}

.metrics--dashboard .metric--sem-clicks::after {
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.65), transparent);
}

.metrics--dashboard .metric--sem-clicks .metric__iconwrap {
  color: var(--semantic-click);
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.22);
}

.metrics--dashboard .metric--sem-conv .metric__value {
  color: var(--semantic-conv);
}

.metrics--dashboard .metric--sem-conv:not(.metric--success)::after {
  background: linear-gradient(90deg, transparent, rgba(74, 222, 128, 0.55), transparent);
}

.metrics--dashboard .metric--sem-conv .metric__iconwrap {
  color: var(--semantic-conv-dim);
  background: rgba(74, 222, 128, 0.09);
  border-color: rgba(74, 222, 128, 0.2);
}

.metrics--dashboard .metric--success.metric--sem-conv .metric__iconwrap {
  color: var(--semantic-conv);
  background: rgba(74, 222, 128, 0.1);
  border-color: rgba(74, 222, 128, 0.22);
}

.metrics--dashboard .metric--sem-telegram .metric__value {
  color: var(--semantic-telegram);
}

.metrics--dashboard .metric--sem-telegram::after {
  background: linear-gradient(90deg, transparent, rgba(45, 212, 191, 0.5), transparent);
}

.metrics--dashboard .metric--sem-telegram .metric__iconwrap {
  color: var(--semantic-telegram);
  background: rgba(45, 212, 191, 0.08);
  border-color: rgba(45, 212, 191, 0.18);
}

.metrics--dashboard .metric--sem-risk .metric__value {
  color: var(--semantic-risk);
}

.metrics--dashboard .metric--sem-risk::after {
  background: linear-gradient(90deg, transparent, rgba(251, 146, 60, 0.55), transparent);
}

.metrics--dashboard .metric--sem-risk .metric__iconwrap {
  color: var(--semantic-risk);
  background: rgba(251, 146, 60, 0.08);
  border-color: rgba(251, 146, 60, 0.18);
}

.metrics--dashboard .metric--warning.metric--sem-risk .metric__value {
  color: var(--semantic-risk-strong);
}

.metrics--dashboard .metric--warning.metric--sem-risk::after {
  background: linear-gradient(90deg, transparent, rgba(248, 113, 113, 0.55), transparent);
}

.metric-period {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
  margin-top: 0.35rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.metric-period__pct {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.metric-period--up .metric-period__pct {
  color: var(--state-up);
}

.metric-period--down .metric-period__pct {
  color: var(--state-down);
}

.metric-period--flat .metric-period__pct {
  color: var(--state-flat);
}

/* Рост подозрительных сигналов — красный; снижение — зелёный */
.metric-period--invert.metric-period--up .metric-period__pct {
  color: var(--state-down);
}

.metric-period--invert.metric-period--down .metric-period__pct {
  color: var(--state-up);
}

.metric-period__hint,
.metric-period__muted {
  color: var(--muted-quiet);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0.01em;
}

.metric-period__fine {
  grid-column: 2;
  width: 100%;
  margin-top: 0.15rem;
  font-size: 0.625rem;
  color: var(--muted-quiet);
  font-weight: 500;
  line-height: 1.35;
}

.metric-period--na .metric-period__muted {
  font-style: normal;
}

.metrics--dashboard .metric-cmp,
.metrics--dashboard .metric-cmp-note {
  grid-column: 2;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
}

.empty-state__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 14px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.18);
  color: var(--accent-bright);
  margin-bottom: 0.15rem;
}

.empty-state__icon--subtle {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
  color: var(--muted-bright);
}

.empty-state__title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.4;
}

.empty-state__body {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted-quiet);
  line-height: 1.45;
  max-width: 28ch;
}

.empty-state--in-list {
  padding: 1.25rem 0.75rem;
}

.top-list__empty {
  display: block;
  border-bottom: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

.top-list__empty .empty-state {
  width: 100%;
}

.tops--dashboard .card__title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted-quiet);
  font-weight: 600;
}

.tops--dashboard .card__title svg {
  width: 1rem;
  height: 1rem;
  color: var(--accent-bright);
  opacity: 0.9;
}

.loading--dashboard {
  padding: 2.25rem 1rem 2rem;
  margin: 0.25rem 0 0.5rem;
}

.error--dashboard {
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
}

.is-hidden { display: none !important; }

/* ——— Login ——— */
body.crm-login {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background-color: var(--bg-root);
  background-image:
    radial-gradient(ellipse 90% 80% at 50% -20%, rgba(59, 130, 246, 0.12), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 100%, rgba(56, 189, 248, 0.06), transparent 45%),
    linear-gradient(180deg, var(--bg-root), var(--bg-base));
  background-attachment: fixed;
  position: relative;
  overflow-x: hidden;
}

body.crm-login::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
  background-image: radial-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px);
  background-size: 28px 28px;
}

.login-shell {
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.5rem;
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-secondary);
  transition: color 0.2s ease, transform 0.2s var(--ease-out);
}

.login-brand:hover {
  color: var(--text);
  transform: translateY(-1px);
}

.login-brand__mark {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.65rem;
  height: 2.65rem;
  border-radius: 13px;
  background:
    linear-gradient(160deg, rgba(56, 189, 248, 0.12) 0%, transparent 42%),
    linear-gradient(155deg, #1a3a62 0%, #0c1220 38%, #152a52 100%);
  color: #e8c547;
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: -0.05em;
  text-shadow: 0 0 20px rgba(212, 175, 55, 0.35);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.1) inset,
    0 1px 0 rgba(255, 255, 255, 0.07) inset,
    0 14px 36px rgba(0, 0, 0, 0.55);
}

.login-brand__mark::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.14), transparent 55%);
  opacity: 0.85;
}

.login-brand__copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.login-brand__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.035em;
  line-height: 1.15;
  color: var(--text);
  display: flex;
  align-items: baseline;
}

.login-brand__st {
  color: var(--text-secondary);
}

.login-brand__dot {
  color: var(--brand-gold);
  font-weight: 800;
  padding: 0 0.12em;
}

.login-brand__crypto {
  background: linear-gradient(105deg, #f8fafc 0%, #e2e8f0 38%, #7dd3fc 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.login-brand__tag {
  display: block;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin-top: 0.2rem;
}

.login-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 2.25rem 2rem 2rem;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(24px) saturate(1.15);
  -webkit-backdrop-filter: blur(24px) saturate(1.15);
  position: relative;
}

.login-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.35), transparent 50%, rgba(56, 189, 248, 0.12));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.55;
}

.login-card h1 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.038em;
  margin: 0 0 0.375rem 0;
  text-rendering: optimizeLegibility;
}

.login-card .login-sub {
  font-size: 0.875rem;
  color: var(--muted-bright);
  margin: 0 0 1.625rem 0;
  line-height: 1.55;
}

.login-card .form-group { margin-bottom: 1.125rem; }

.login-card label {
  display: block;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  margin-bottom: 0.4375rem;
}

.login-card input {
  width: 100%;
  padding: 0.8125rem 1rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s var(--ease-soft), box-shadow 0.2s var(--ease-soft);
}

.login-card input:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.login-card button[type="submit"] {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  margin-top: 0.625rem;
  padding: 0.9rem 1.25rem;
  border-radius: 12px;
  border: 1px solid rgba(186, 230, 253, 0.45);
  background: linear-gradient(155deg, #93c5fd 0%, #3b82f6 32%, #1d4ed8 72%, #1e3a8a 100%);
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    inset 0 -1px 0 rgba(15, 23, 42, 0.35),
    var(--btn-glow-blue);
  transition: transform 0.28s var(--btn-ease-spring), box-shadow 0.28s var(--btn-ease), filter 0.28s var(--btn-ease);
}

.login-card button[type="submit"]::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.45) 0%, transparent 50%);
  opacity: 0.55;
  mix-blend-mode: soft-light;
  pointer-events: none;
  z-index: 0;
}

.login-card button[type="submit"]::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -60%;
  width: 55%;
  height: 220%;
  background: linear-gradient(105deg, transparent 0%, rgba(255, 255, 255, 0.22) 45%, transparent 78%);
  transform: rotate(18deg) translateX(-120%);
  pointer-events: none;
  z-index: 2;
  transition: transform 0.65s var(--btn-ease);
}

.login-card button[type="submit"]:hover {
  transform: translateY(-3px) scale(1.015);
  filter: brightness(1.04) saturate(1.05);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.48),
    inset 0 -1px 0 rgba(15, 23, 42, 0.35),
    var(--btn-glow-blue-hover);
}

.login-card button[type="submit"]:hover::after {
  transform: rotate(18deg) translateX(280%);
}

.login-card button[type="submit"]:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px var(--bg-base),
    0 0 0 5px rgba(147, 197, 253, 0.9),
    0 0 40px rgba(59, 130, 246, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    inset 0 -1px 0 rgba(15, 23, 42, 0.35);
}

.login-card button[type="submit"]:active {
  transform: translateY(0) scale(0.985);
  filter: brightness(0.94);
}

.login-card .error {
  margin-top: 1rem;
  padding: 0;
  border: none;
  background: none;
}

.login-card .hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 1.5rem;
  line-height: 1.55;
}

h1:not(.page-title):not(.login-card h1) {
  font-family: var(--font-display);
  font-size: 1.625rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  letter-spacing: -0.03em;
}

h2 {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--muted);
  margin: 2.5rem 0 1rem 0;
}

h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border-strong), transparent);
  min-width: 2rem;
}

h2:first-of-type { margin-top: 0; }

.users-search-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.users-search-row input[type="text"] {
  width: 100%;
  max-width: 220px;
  padding: 0.5625rem 0.875rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
}

.users-search-row input[type="text"]:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.modal-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.125rem 0;
}

.modal-subtitle {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 0.5rem 0;
}

.modal-subtitle--form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-subtle);
}
.modal-subtitle--form::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: linear-gradient(135deg, var(--accent-bright), var(--cyan));
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.35);
}

/* ——— Модалка пользователя (карточки, пилюли, события) ——— */
.modal__box--user {
  max-width: min(760px, calc(100vw - 1.75rem));
  max-height: min(92vh, 900px);
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(168deg, rgba(18, 22, 32, 0.97) 0%, rgba(10, 12, 18, 0.99) 45%, rgba(6, 8, 14, 0.99) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    var(--shadow-lg),
    0 0 0 1px rgba(59, 130, 246, 0.08),
    0 0 80px -20px rgba(59, 130, 246, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(26px) saturate(1.2);
  -webkit-backdrop-filter: blur(26px) saturate(1.2);
}

.modal__box--user::before {
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 0 0 8px 8px;
  background: linear-gradient(90deg, transparent 5%, rgba(59, 130, 246, 0.75) 35%, rgba(212, 175, 55, 0.55) 65%, transparent 95%);
  opacity: 0.95;
}

.user-modal__head {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.5rem 1.05rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background:
    radial-gradient(ellipse 120% 180% at 0% 0%, rgba(59, 130, 246, 0.18), transparent 55%),
    radial-gradient(ellipse 80% 120% at 100% 0%, rgba(212, 175, 55, 0.08), transparent 45%),
    linear-gradient(180deg, rgba(15, 18, 28, 0.92) 0%, rgba(10, 12, 18, 0.88) 100%);
  position: relative;
}

.user-modal__head::after {
  content: "";
  position: absolute;
  left: 1.5rem;
  right: 1.5rem;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.35), rgba(212, 175, 55, 0.2), transparent);
  opacity: 0.85;
  pointer-events: none;
}

.user-modal__head-main {
  min-width: 0;
  flex: 1;
}

.user-modal__eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-bright);
  opacity: 0.9;
}

.modal__title--user {
  margin: 0;
  font-size: 1.28rem;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.2;
  color: var(--text);
  text-shadow: 0 2px 24px rgba(59, 130, 246, 0.12);
}

.user-modal__dismiss {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin: -0.2rem -0.25rem 0 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--muted-bright);
  cursor: pointer;
  transition: color 0.2s var(--ease-out), border-color 0.2s var(--ease-out), background 0.2s var(--ease-out), transform 0.2s var(--ease-spring);
}

.user-modal__dismiss:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  transform: scale(1.04);
}

.user-modal__dismiss:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-base), 0 0 0 4px rgba(59, 130, 246, 0.45);
}

.user-modal__form-actions .user-modal__dismiss {
  width: auto;
  height: auto;
  min-height: 2.45rem;
  margin: 0;
  padding: 0.52rem 1.25rem;
  border-radius: 12px;
}

.user-modal__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1.15rem 1.5rem 1.35rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 116, 139, 0.45) transparent;
  background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(59, 130, 246, 0.04), transparent 60%);
}

.user-modal__form-panel {
  flex-shrink: 0;
  padding: 1.2rem 1.5rem 1.45rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(185deg, rgba(8, 10, 16, 0.55) 0%, rgba(4, 5, 10, 0.92) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 -12px 40px -16px rgba(0, 0, 0, 0.5);
}

.user-modal__form .form-group {
  margin-bottom: 0.85rem;
}

.user-modal__form .form-group:last-of-type {
  margin-bottom: 0;
}

.user-modal__form label {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: var(--muted-bright);
}

.user-modal__form input[type="text"],
.user-modal__form input[type="number"],
.user-modal__form select {
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(0, 0, 0, 0.25) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

.user-modal__form input[type="text"]:focus,
.user-modal__form input[type="number"]:focus,
.user-modal__form select:focus {
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.user-modal__form .form-group label:has(input[type="checkbox"]) {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.75rem;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.2);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: border-color 0.2s var(--ease-out), background 0.2s var(--ease-out);
}

.user-modal__form .form-group label:has(input[type="checkbox"]):hover {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
}

.user-modal__form .form-group input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent-bright);
  cursor: pointer;
}

.user-modal__form-actions {
  margin-top: 1.1rem;
  padding-top: 1.15rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.65rem;
}

.user-modal__form-panel .modal-subtitle--form {
  margin-bottom: 1.1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--accent-bright);
  letter-spacing: 0.1em;
}

.user-modal__form-panel .modal-subtitle--form::before {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.45);
}

.user-detail-stack {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.user-detail-stack .risk-tag {
  border-radius: 8px;
  padding: 0.22rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-color: rgba(59, 130, 246, 0.2);
  background: rgba(59, 130, 246, 0.08);
  color: var(--text-secondary);
}
.detail-card {
  position: relative;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.055) 0%, rgba(0, 0, 0, 0.22) 100%);
  padding: 1rem 1.1rem 1.05rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 8px 28px -12px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.detail-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  border-radius: 3px 0 0 3px;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.5), rgba(212, 175, 55, 0.25));
  opacity: 0.65;
  pointer-events: none;
}

.detail-card--risk {
  border-color: rgba(59, 130, 246, 0.18);
  background: linear-gradient(165deg, rgba(59, 130, 246, 0.09) 0%, rgba(0, 0, 0, 0.2) 100%);
}

.detail-card--risk::before {
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.85), rgba(59, 130, 246, 0.35));
}

.detail-card--events {
  padding-bottom: 0.75rem;
}

.detail-card--events::before {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.6), rgba(59, 130, 246, 0.3));
}

.detail-card__title {
  margin: 0 0 0.75rem;
  padding-left: 0.35rem;
  font-size: 0.62rem;
  font-weight: 700;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted-bright);
}
.detail-dl {
  margin: 0;
}
.detail-dl__row {
  display: grid;
  grid-template-columns: minmax(108px, 34%) 1fr;
  gap: 0.45rem 0.85rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  align-items: start;
}
.detail-dl__row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.detail-dl__row:first-child {
  padding-top: 0;
}
.detail-dl__row--full {
  grid-template-columns: 1fr;
}
.detail-dl__row--full dt {
  margin-bottom: 0.25rem;
}
.detail-dl dt {
  margin: 0;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  line-height: 1.4;
}
.detail-dl dd {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
  line-height: 1.45;
  word-break: break-word;
}
.detail-dd--tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.detail-mono {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}
.detail-muted {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 400;
}
.detail-sep {
  color: var(--muted);
  margin: 0 0.2rem;
  opacity: 0.6;
}
.detail-time {
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
}
.detail-code-block {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-subtle);
  color: var(--muted-bright);
  word-break: break-all;
  line-height: 1.35;
}
.detail-empty {
  color: var(--muted);
  font-size: 0.875rem;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
  line-height: 1.2;
}
.user-pill__score {
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}
.user-pill__band {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.9;
}
.user-pill--fraud.user-pill--band-normal {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.28);
  color: #6ee7b7;
}
.user-pill--fraud.user-pill--band-review {
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.3);
  color: #fcd34d;
}
.user-pill--fraud.user-pill--band-suspicious,
.user-pill--fraud.user-pill--band-blocked {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.32);
  color: #fecaca;
}
.user-pill--ver-pending {
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.25);
  color: var(--muted-bright);
}
.user-pill--ver-approved {
  background: rgba(52, 211, 153, 0.14);
  border-color: rgba(52, 211, 153, 0.3);
  color: #6ee7b7;
}
.user-pill--ver-rejected {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.28);
  color: #fecaca;
}

.events-list--rich {
  max-height: 240px;
  overflow-y: auto;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0.5) 100%);
  padding: 0.35rem 0.45rem;
  margin: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 116, 139, 0.4) transparent;
}

.events-list--rich li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  margin-bottom: 0.15rem;
  transition: background 0.15s var(--ease-out);
}

.events-list--rich li:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.events-list--rich li:hover {
  background: rgba(59, 130, 246, 0.06);
}

.events-list__type {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  color: #93c5fd;
  letter-spacing: -0.02em;
}

.events-list__time {
  flex-shrink: 0;
  font-size: 0.7rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.events-list__empty {
  justify-content: center;
  color: var(--muted);
  font-size: 0.8125rem;
  border: none !important;
  display: flex;
  margin-bottom: 0 !important;
}

.events-list--rich li.events-list__empty:hover {
  background: transparent;
}

.funstat-card {
  position: relative;
  border-radius: 14px;
  border: 1px solid rgba(56, 189, 248, 0.2);
  padding: 1rem 1.1rem 1.1rem;
  background: linear-gradient(155deg, rgba(56, 189, 248, 0.1) 0%, rgba(8, 12, 22, 0.65) 45%, rgba(0, 0, 0, 0.2) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 10px 32px -14px rgba(56, 189, 248, 0.15);
  overflow: hidden;
}

.funstat-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 90% 60% at 100% 0%, rgba(56, 189, 248, 0.12), transparent 55%);
  pointer-events: none;
}

.funstat-card--empty {
  border-color: rgba(255, 255, 255, 0.08);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.04) 0%, rgba(0, 0, 0, 0.2) 100%);
}

.funstat-card--empty::before {
  display: none;
}

.funstat-card--error {
  border-color: rgba(248, 113, 113, 0.35);
  background: linear-gradient(155deg, rgba(248, 113, 113, 0.1) 0%, rgba(0, 0, 0, 0.2) 100%);
}

.funstat-card__head {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.funstat-card__badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #e0f2fe;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.45), rgba(37, 99, 235, 0.35));
  border: 1px solid rgba(125, 211, 252, 0.35);
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(14, 165, 233, 0.2);
}

.funstat-card__tier {
  font-size: 0.58rem;
  font-weight: 800;
  padding: 0.2rem 0.45rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(125, 211, 252, 0.25);
  color: #bae6fd;
  letter-spacing: 0.06em;
}

.funstat-card__updated {
  margin-left: auto;
  font-size: 0.68rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.funstat-card__line {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.55;
}
.funstat-card__hint {
  position: relative;
  z-index: 1;
  margin: 0 0 0.65rem;
  font-size: 0.875rem;
  color: var(--muted-bright);
  line-height: 1.45;
}

.funstat-card__meta {
  position: relative;
  z-index: 1;
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  word-break: break-word;
}

.funstat-card__meta-k {
  display: inline-block;
  margin-right: 0.35rem;
  font-weight: 600;
  color: var(--muted-bright);
}

.funstat-card__err {
  position: relative;
  z-index: 1;
  margin: 0 0 0.65rem;
  font-size: 0.875rem;
  color: var(--red);
  line-height: 1.45;
}

.funstat-card .btn-funstat-fetch {
  position: relative;
  z-index: 1;
  margin-top: 0.35rem;
}

.card--flush-bottom { margin-bottom: 1rem; }

@media (max-width: 900px) {
  .app-layout { flex-direction: column; }
  /* Сайдбар на узких экранах — выезжающая панель (см. блок Mobile shell в конце crm.css) */
  .crm-masthead {
    padding: 1.35rem 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius-lg);
  }
  .crm-topbar {
    flex-direction: column;
    align-items: stretch;
  }
  .crm-topbar .crm-cmd-btn {
    align-self: flex-end;
  }
  .page-lead {
    max-width: none;
  }
  .sidebar__quick {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .container {
    padding:
      1.25rem
      max(1rem, var(--safe-left))
      max(2.25rem, var(--safe-bottom))
      max(1rem, var(--safe-right));
  }
  .nav.sidebar__nav a,
  .sidebar__link {
    min-width: 100%;
  }
  .crm-masthead {
    padding: 1.125rem 1rem 1.25rem;
    margin-bottom: 1.25rem;
  }
  .page-title {
    font-size: clamp(1.45rem, 6.5vw, 2rem);
  }
  .crm-section-title {
    margin-top: 1.75rem;
    padding-left: 0.75rem;
    font-size: 1.05rem;
  }
  .card {
    padding: 1.25rem 1rem;
    border-radius: var(--radius-lg);
  }
  .form-row,
  .filters {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .form-row .form-group {
    width: 100%;
    margin-bottom: 0;
  }
  .form-row > .form-group:last-child .btn,
  .form-row .btn.btn--primary {
    width: 100%;
    margin-left: 0;
    justify-content: center;
  }
  .table-actions,
  .table-actions--split {
    flex-direction: column;
    align-items: stretch;
  }
  .table-actions__right {
    width: 100%;
    justify-content: stretch;
  }
  .table-actions__right .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
  .links-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .input--search {
    max-width: none;
    width: 100%;
  }
  .links-toolbar__label,
  .links-toolbar__label .select-compact {
    width: 100%;
  }
  .dashboard-quick {
    grid-template-columns: 1fr;
    gap: 0.65rem;
    margin-bottom: 1.5rem;
  }
  .dashboard-quick__link {
    padding: 1rem 1.1rem;
  }
  .ads-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }
  .ads-kpi-card strong {
    font-size: 1.35rem;
  }
  .modal {
    padding: max(0.65rem, var(--safe-top)) max(0.65rem, var(--safe-right)) max(0.65rem, var(--safe-bottom)) max(0.65rem, var(--safe-left));
    align-items: flex-start;
  }
  .modal__box {
    max-width: 100%;
  }
  .modal__box--user {
    max-height: min(92vh, 100dvh);
    max-width: 100%;
  }
  .user-modal__head,
  .user-modal__scroll,
  .user-modal__form-panel {
    padding-left: max(1rem, var(--safe-left));
    padding-right: max(1rem, var(--safe-right));
  }
  .detail-dl__row {
    grid-template-columns: 1fr;
    gap: 0.2rem 0;
    padding: 0.55rem 0;
  }
  .detail-dl__row dt {
    margin-bottom: 0.1rem;
  }
  .crm-palette {
    padding: max(0.75rem, var(--safe-top)) 0.75rem max(0.75rem, var(--safe-bottom));
    align-items: flex-start;
  }
  .crm-palette__dialog {
    width: 100%;
    max-height: min(85vh, 100dvh);
    overflow: auto;
  }
  .crm-toast-root {
    right: max(0.75rem, var(--safe-right));
    bottom: max(0.75rem, var(--safe-bottom));
    left: max(0.75rem, var(--safe-left));
    max-width: none;
    align-items: flex-end;
  }
  .af-drawer__head {
    flex-wrap: wrap;
    padding-top: max(1rem, var(--safe-top));
    padding-left: max(1.125rem, var(--safe-left));
    padding-right: max(1.125rem, var(--safe-right));
  }
  .af-drawer__body {
    padding-left: max(1.125rem, var(--safe-left));
    padding-right: max(1.125rem, var(--safe-right));
    padding-bottom: max(2rem, var(--safe-bottom));
  }
  .users-search-row {
    flex-direction: column;
    align-items: stretch;
  }
  .af-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .af-toolbar__left,
  .af-toolbar__right {
    width: 100%;
    justify-content: flex-start;
  }
  .af-pagination {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
  }
  body.crm-login {
    padding: max(1rem, var(--safe-top)) max(1rem, var(--safe-right)) max(1.25rem, var(--safe-bottom)) max(1rem, var(--safe-left));
  }
  body.crm-login .login-shell {
    max-width: 100%;
  }
  body.crm-login .login-card {
    padding: 1.5rem 1.25rem 1.75rem;
  }
}

@media (max-width: 480px) {
  .ads-kpi-strip {
    grid-template-columns: 1fr;
  }
  .sidebar__brand {
    min-width: 100%;
  }
  .nav.sidebar__nav a,
  .sidebar__link {
    min-height: 44px;
  }
  .btn {
    min-height: var(--crm-touch);
  }
  .btn--small {
    min-height: 2.5rem;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .modal__box--user {
    max-height: 100dvh;
  }
  .crm-masthead {
    margin-bottom: 1rem;
    padding: 1rem 1.125rem;
  }
}

/* ——— Антифрод: сводка, тулбар, плотность, sticky, drawer, toast ——— */

/* Обычная плотность: чуть крупнее текст в таблицах (режим «компакт» перебивает ниже) */
body:not(.crm-density--compact) table {
  font-size: 0.875rem;
  line-height: 1.52;
}

body:not(.crm-density--compact) th {
  font-size: 0.7rem;
}

.crm-density--compact .table-wrap th,
.crm-density--compact .table-wrap td {
  padding: 0.5rem 0.65rem;
  font-size: 0.78rem;
}

.crm-density--compact .reason-list {
  max-width: 200px;
}

.crm-density--compact .af-table .reason-list {
  max-width: none;
}

.af-summary {
  margin-bottom: 1.25rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.055) 0%, rgba(255, 255, 255, 0.028) 40%, rgba(0, 0, 0, 0.2) 100%);
  box-shadow: var(--shadow-inset-top), 0 0 0 1px rgba(59, 130, 246, 0.06);
  backdrop-filter: blur(16px) saturate(1.05);
  -webkit-backdrop-filter: blur(16px) saturate(1.05);
}

.af-summary__inner--loading {
  opacity: 0.75;
  font-size: 0.8125rem;
  color: var(--muted);
}

.af-summary__chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.af-summary__sep {
  color: var(--muted);
  font-weight: 300;
}

.af-summary__total {
  margin-left: auto;
  font-size: 0.8125rem;
  color: var(--muted-bright);
}

.af-summary__total strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.af-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.af-chip:hover {
  border-color: rgba(96, 165, 250, 0.35);
  background: rgba(59, 130, 246, 0.08);
}

.af-chip strong {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text);
}

.af-chip--muted {
  opacity: 0.85;
}

.af-chip--ghost {
  border-style: dashed;
}

.af-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.af-presets__label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

.af-presets .btn.is-active {
  border-color: rgba(96, 165, 250, 0.45);
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
}

.card--af-filters {
  backdrop-filter: blur(20px) saturate(1.1);
  -webkit-backdrop-filter: blur(20px) saturate(1.1);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.045) 0%, rgba(255, 255, 255, 0.02) 42%, rgba(0, 0, 0, 0.14) 100%);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: var(--shadow-card);
}

.card--af-filters > .filters {
  background: rgba(0, 0, 0, 0.18);
  border-color: var(--border-subtle);
}

.card--af-filters .btn--key {
  align-self: flex-end;
}

body[data-crm-page="antifraud"] #card-ips-multi {
  margin-bottom: 1.15rem;
}

body[data-crm-page="antifraud"] #card-ips-multi .card__subtitle {
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: -0.02em;
}

.af-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  margin: 0.85rem 0 0.65rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-subtle);
}

.af-toolbar__left,
.af-toolbar__right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.af-toolbar__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  color: var(--muted-bright);
  cursor: pointer;
}

.af-toolbar__page-size {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  color: var(--muted-bright);
}

.af-toolbar__page-size select {
  margin-left: 0.25rem;
}

.af-pagination {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.8125rem;
  color: var(--muted-bright);
}

.af-pagination--footer {
  justify-content: flex-end;
  margin-top: 0.75rem;
  margin-bottom: 0.35rem;
}

.af-pagination__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem 0.65rem;
}

.af-pagination__nums {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem;
}

.af-pagination__num {
  min-width: 2rem;
  padding-left: 0.45rem;
  padding-right: 0.45rem;
  font-variant-numeric: tabular-nums;
}

.af-pagination__num.is-active {
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.12);
  color: var(--text);
}

.af-pagination__ellipsis {
  padding: 0 0.2rem;
  opacity: 0.55;
  user-select: none;
}

.af-pagination__label {
  font-variant-numeric: tabular-nums;
  margin-right: 0.35rem;
}

.reason-list--tight {
  max-width: 200px;
}

.af-table--minimal th:nth-child(12),
.af-table--minimal td:nth-child(12),
.af-table--minimal th:nth-child(13),
.af-table--minimal td:nth-child(13) {
  display: none;
}

.table-wrap--sticky {
  position: relative;
  max-width: 100%;
  overflow-x: auto;
  --af-sticky-w1: 118px;
  --af-sticky-w2: 118px;
}

/* Переопределение ширины для sticky-таблицы антифрода (ширина по контенту + скролл). */
.table-wrap--sticky > .af-table {
  table-layout: auto;
  width: max-content;
  min-width: 100%;
  max-width: none;
}

.af-table-wrap--glass {
  backdrop-filter: blur(14px) saturate(1.08);
  -webkit-backdrop-filter: blur(14px) saturate(1.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035) 0%, rgba(0, 0, 0, 0.28) 100%);
  border: 1px solid var(--border);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 10px 36px -18px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(59, 130, 246, 0.05);
  border-radius: var(--radius-sm);
}

.af-table {
  width: max-content;
  min-width: 100%;
  max-width: none;
  table-layout: auto;
}

.af-table thead th {
  white-space: normal;
  line-height: 1.25;
  vertical-align: bottom;
  padding: 0.75rem 0.7rem 0.55rem;
  letter-spacing: 0.055em;
  background: linear-gradient(180deg, rgba(18, 21, 28, 0.98) 0%, rgba(12, 14, 19, 0.96) 100%);
  border-bottom: 1px solid rgba(59, 130, 246, 0.14);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.af-table tbody td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
}

.af-table td:nth-child(5),
.af-table td:nth-child(6),
.af-table td:nth-child(7),
.af-table th:nth-child(5),
.af-table th:nth-child(6),
.af-table th:nth-child(7) {
  min-width: 10rem;
  max-width: 22rem;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}

.af-table th:nth-child(9),
.af-table td:nth-child(9) {
  min-width: 12rem;
  max-width: 28rem;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}

.af-table .table-cell--muted {
  max-width: none;
  line-height: 1.5;
}

.af-table .reason-list {
  max-width: none;
  min-width: 0;
  align-items: flex-start;
  gap: 0.45rem;
  line-height: 1.45;
}

.af-table .reason-list .tag {
  max-width: 100%;
  display: inline-flex;
  align-items: flex-start;
  overflow-wrap: break-word;
  word-break: normal;
  white-space: normal;
  box-sizing: border-box;
  padding: 0.4rem 0.65rem;
  font-size: 0.6875rem;
  line-height: 1.38;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.09) 0%, rgba(0, 0, 0, 0.28) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  color: #cbd5e1;
}

.af-table .reason-list.reason-list--tight {
  max-width: none;
}

.af-table td.table-cell--tight .reason-list.reason-list--tight {
  max-width: none;
}

.af-table .ip-stack .ip-cell code {
  border-radius: 8px;
  padding: 0.28rem 0.5rem;
}

.af-table .fraud-score__num {
  font-size: 0.875rem;
}

.table-wrap--sticky .af-table th:nth-child(1),
.table-wrap--sticky .af-table td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 3;
  width: var(--af-sticky-w1);
  min-width: var(--af-sticky-w1);
  max-width: var(--af-sticky-w1);
  box-sizing: border-box;
  box-shadow: 6px 0 14px -6px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  isolation: isolate;
}

.table-wrap--sticky .af-table th:nth-child(2),
.table-wrap--sticky .af-table td:nth-child(2) {
  position: sticky;
  left: var(--af-sticky-w1);
  z-index: 2;
  width: var(--af-sticky-w2);
  min-width: var(--af-sticky-w2);
  max-width: var(--af-sticky-w2);
  box-sizing: border-box;
  box-shadow: 6px 0 14px -6px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  isolation: isolate;
}

.table-wrap--sticky .af-table td:nth-child(1) code {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
}

.table-wrap--sticky .af-table td:nth-child(2) .table-user {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-wrap--sticky .af-table thead th:nth-child(1),
.table-wrap--sticky .af-table thead th:nth-child(2) {
  z-index: 5;
  background: linear-gradient(180deg, rgba(16, 19, 26, 0.98) 0%, rgba(10, 12, 18, 0.96) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.table-wrap--sticky .af-table tbody td:nth-child(1),
.table-wrap--sticky .af-table tbody td:nth-child(2) {
  background: rgba(11, 13, 18, 0.98);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.table-wrap--sticky .af-table tbody tr:hover td:nth-child(1),
.table-wrap--sticky .af-table tbody tr:hover td:nth-child(2) {
  background: rgba(59, 130, 246, 0.07);
}

.table-wrap--sticky .af-table tbody tr:nth-child(even) td:nth-child(1),
.table-wrap--sticky .af-table tbody tr:nth-child(even) td:nth-child(2) {
  background: rgba(255, 255, 255, 0.028);
}

.table-wrap--sticky .af-table tbody tr:nth-child(even):hover td:nth-child(1),
.table-wrap--sticky .af-table tbody tr:nth-child(even):hover td:nth-child(2) {
  background: rgba(59, 130, 246, 0.07);
}

.af-table--privacy td:nth-child(1) code,
.af-table--privacy td:nth-child(2) .table-user {
  filter: blur(5px);
  transition: filter 0.2s ease;
  user-select: none;
}

@media (prefers-reduced-motion: reduce) {
  .af-table--privacy td:nth-child(1) code,
  .af-table--privacy td:nth-child(2) .table-user {
    transition: none;
  }
}

@media (max-width: 900px) {
  .table-wrap--sticky .af-table th:nth-child(1),
  .table-wrap--sticky .af-table td:nth-child(1),
  .table-wrap--sticky .af-table th:nth-child(2),
  .table-wrap--sticky .af-table td:nth-child(2) {
    position: static;
    left: auto;
    width: auto;
    min-width: 0;
    max-width: none;
    box-shadow: none;
    isolation: auto;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .table-wrap--sticky .af-table td:nth-child(1) code,
  .table-wrap--sticky .af-table td:nth-child(2) .table-user {
    white-space: normal;
    word-break: break-all;
  }

  .af-table {
    min-width: 720px;
  }
}

.af-row {
  cursor: pointer;
}

.af-table tbody tr.af-row:hover {
  background: rgba(59, 130, 246, 0.07);
  box-shadow: inset 3px 0 0 rgba(96, 165, 250, 0.7);
}

.af-row:focus-visible {
  outline: 2px solid rgba(96, 165, 250, 0.65);
  outline-offset: -2px;
}

.af-row--sync {
  opacity: 0.65;
  pointer-events: none;
}

.af-row--flash {
  animation: afRowFlash 0.7s var(--ease-soft);
}

@keyframes afRowFlash {
  0% { background: rgba(52, 211, 153, 0.12); }
  100% { background: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .af-row--flash {
    animation: none;
  }
}

.af-skel-row .af-skel-bar {
  height: 0.9rem;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
  background-size: 200% 100%;
  animation: afSkel 1.1s ease-in-out infinite;
}

@keyframes afSkel {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .af-skel-bar {
    animation: none;
  }
}

.af-table-empty {
  margin-top: 0.75rem;
  padding: 2rem 1.25rem;
  text-align: center;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  background: rgba(0, 0, 0, 0.14);
  color: var(--muted-bright);
  font-size: 0.875rem;
  line-height: 1.5;
}

.af-footer-meta {
  margin-top: 1.35rem;
  font-size: 0.72rem;
  color: var(--muted-quiet);
  letter-spacing: 0.02em;
}

.af-kbd {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  font-size: 0.65rem;
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.35);
}

.af-health-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  vertical-align: middle;
  margin-right: 0.25rem;
}

.af-health-dot--ok {
  background: var(--accent-bright);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.35);
}

.af-health-dot--bad {
  background: rgba(248, 113, 113, 0.95);
  box-shadow: 0 0 6px rgba(248, 113, 113, 0.25);
}

.af-toast-root {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 20000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.af-toast {
  pointer-events: none;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(16, 19, 26, 0.95);
  color: var(--text);
  font-size: 0.8125rem;
  box-shadow: var(--shadow-card);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: min(360px, 92vw);
}

.af-toast--show {
  opacity: 1;
  transform: translateY(0);
}

.af-toast--error {
  border-color: rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

.af-drawer {
  position: fixed;
  inset: 0;
  z-index: 15000;
  pointer-events: none;
}

.af-drawer.af-drawer--open {
  pointer-events: auto;
}

.af-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, rgba(2, 6, 14, 0.82) 0%, rgba(0, 0, 0, 0.65) 100%);
  backdrop-filter: blur(10px) saturate(1.15);
  -webkit-backdrop-filter: blur(10px) saturate(1.15);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.af-drawer--open .af-drawer__backdrop {
  opacity: 1;
}

.af-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(440px, 100%);
  height: 100%;
  background: linear-gradient(195deg, rgba(16, 19, 26, 0.98) 0%, rgba(8, 9, 13, 0.99) 55%, #06070a 100%);
  border-left: 1px solid var(--border);
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.55), inset 1px 0 0 rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.2s var(--ease-soft);
}

.af-drawer--open .af-drawer__panel {
  transform: translateX(0);
}

.af-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.125rem;
  border-bottom: 1px solid var(--border-subtle);
}

.af-drawer__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.af-drawer__actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.af-drawer__body {
  flex: 1;
  overflow: auto;
  padding: 1rem 1.125rem 2rem;
  font-size: 0.875rem;
}

.af-drawer__hint {
  color: var(--muted);
  margin: 0;
}

.af-drawer__section {
  margin-bottom: 1.25rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.03) 0%, rgba(0, 0, 0, 0.12) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.af-drawer__h {
  margin: 0 0 0.5rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.af-drawer__lead {
  margin: 0 0 0.5rem;
  line-height: 1.5;
  color: var(--muted-bright);
}

.af-drawer__lead strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.af-drawer__textarea {
  width: 100%;
  margin: 0.35rem 0 0.75rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  font-family: inherit;
  font-size: 0.8125rem;
}

.af-drawer__json {
  margin: 0;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.35);
  font-size: 0.7rem;
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.af-audit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.8125rem;
}

.af-audit-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.af-audit-list li:last-child {
  border-bottom: none;
}

.af-audit-type {
  color: var(--accent-bright);
  font-weight: 600;
}

.af-audit-payload {
  margin: 0.35rem 0 0;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.4);
  font-size: 0.65rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.af-drawer__actions-row {
  margin-bottom: 0.75rem;
}

@media print {
  .sidebar,
  .crm-masthead,
  .af-summary,
  #card-ips-multi,
  .af-presets,
  .filters,
  .af-toolbar,
  .af-pagination,
  #af-table-wrap,
  .af-footer-meta,
  #af-toast-root {
    display: none !important;
  }

  .af-drawer {
    position: static !important;
    pointer-events: auto !important;
  }

  .af-drawer__backdrop {
    display: none !important;
  }

  .af-drawer__panel {
    transform: none !important;
    width: 100% !important;
    border: none !important;
    box-shadow: none !important;
  }
}

/* ——— CRM shell: topbar, breadcrumbs, command palette, dashboard toolbar ——— */
.crm-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.125rem;
  padding: 0.5rem 0.85rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, rgba(0, 0, 0, 0.08) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.crm-topbar__tail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
}

.crm-session-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  max-width: min(240px, 42vw);
  padding: 0.35rem 0.65rem;
  margin-right: 0.25rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  line-height: 1.2;
  color: var(--text-secondary);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.06) 0%, rgba(0, 0, 0, 0.12) 100%);
  border: 1px solid var(--border-subtle);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.crm-session-pill__user {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.72rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-session-pill__role {
  flex-shrink: 0;
  padding: 0.12rem 0.4rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.65rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--accent-bright);
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.crm-breadcrumb {
  min-height: 1.25rem;
  flex: 1;
}

.crm-breadcrumb__nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.crm-breadcrumb__link {
  color: var(--muted-bright);
  text-decoration: none;
  transition: color 0.15s var(--ease-soft);
}

.crm-breadcrumb__link:hover {
  color: var(--accent-bright);
}

.crm-breadcrumb__sep {
  opacity: 0.45;
  user-select: none;
}

.crm-breadcrumb__current {
  color: var(--text-secondary);
  font-weight: 500;
}

.crm-cmd-btn {
  flex-shrink: 0;
}

.crm-toolbar-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}

.sidebar__quick {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin: 0 0.5rem 0.65rem;
  padding: 0.4rem 0.45rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border-subtle);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.sidebar__quick-link {
  display: flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0.5rem 0.55rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted-bright);
  text-decoration: none;
  transition: background 0.15s var(--ease-soft), color 0.15s var(--ease-soft);
}

.sidebar__quick-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.sidebar__collapse-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: calc(100% - 0.25rem);
  margin: 0.65rem 0.125rem 0.35rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.22);
  color: var(--muted-bright);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s var(--ease-soft), color 0.15s var(--ease-soft), border-color 0.15s var(--ease-soft);
}

.sidebar__collapse-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border-color: rgba(59, 130, 246, 0.2);
}

.sidebar__collapse-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-sidebar), 0 0 0 4px rgba(59, 130, 246, 0.35);
}

.sidebar__collapse-toggle__icon {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
  color: var(--accent-bright);
}

@media (min-width: 961px) {
  body.crm-sidebar--collapsed {
    --sidebar-width: 76px;
  }

  body.crm-sidebar--collapsed .sidebar {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    align-items: center;
  }

  body.crm-sidebar--collapsed .sidebar__brand {
    justify-content: center;
    padding-left: 0.45rem;
    padding-right: 0.45rem;
  }

  body.crm-sidebar--collapsed .sidebar__brand-copy,
  body.crm-sidebar--collapsed .sidebar__section,
  body.crm-sidebar--collapsed .sidebar__quick,
  body.crm-sidebar--collapsed .sidebar__link-text,
  body.crm-sidebar--collapsed .sidebar__logout span:not(.sr-only),
  body.crm-sidebar--collapsed .sidebar__collapse-toggle__text {
    display: none !important;
  }

  body.crm-sidebar--collapsed .sidebar__collapse-toggle {
    width: auto;
    min-width: 2.75rem;
    padding-left: 0.4rem;
    padding-right: 0.4rem;
    margin-left: auto;
    margin-right: auto;
  }

  body.crm-sidebar--collapsed .nav.sidebar__nav a,
  body.crm-sidebar--collapsed .sidebar__nav--service a {
    justify-content: center;
    padding-left: 0.45rem;
    padding-right: 0.45rem;
    gap: 0;
  }

  body.crm-sidebar--collapsed .nav.sidebar__nav a:hover,
  body.crm-sidebar--collapsed .sidebar__nav--service a:hover {
    transform: none;
  }

  body.crm-sidebar--collapsed .sidebar__logout {
    width: auto;
    min-width: 2.75rem;
    padding: 0.55rem;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 960px) {
  .sidebar__collapse-toggle {
    display: none !important;
  }
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.dashboard-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
}

.dashboard-toolbar--inline {
  margin-bottom: 0;
  flex-shrink: 0;
  align-self: flex-end;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  padding: 0.65rem 0.85rem;
  background: linear-gradient(165deg, rgba(59, 130, 246, 0.08) 0%, rgba(0, 0, 0, 0.12) 100%);
  border-color: rgba(59, 130, 246, 0.15);
}

.dashboard-toolbar__label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.dashboard-toolbar__select {
  margin-left: 0.35rem;
  padding: 0.35rem 2rem 0.35rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-solid) var(--select-chevron) right 0.5rem center / 14px no-repeat;
  color: var(--text);
  font-size: 0.875rem;
  appearance: none;
}

.dashboard-toolbar__hint {
  font-size: 0.8125rem;
}

.metric--link {
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform 0.15s var(--ease-soft), box-shadow 0.15s var(--ease-soft);
}

.metric--link:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.metric-cmp {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.35;
}

.metric-cmp__diff {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-secondary);
}

.metric-cmp--up .metric-cmp__diff {
  color: var(--green);
}

.metric-cmp--down .metric-cmp__diff {
  color: var(--red);
}

.metric-cmp--flat .metric-cmp__diff {
  color: var(--muted);
}

.metric-cmp__pair {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  opacity: 0.9;
}

.metric-cmp-note {
  margin-top: 0.25rem;
  font-size: 0.65rem;
  color: var(--muted);
}

.table-skeleton-row td {
  padding: 0.65rem 0.5rem;
  vertical-align: middle;
}

.table-skeleton {
  display: block;
  height: 0.85rem;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.09) 50%,
    rgba(255, 255, 255, 0.04) 100%
  );
  background-size: 200% 100%;
  animation: crm-shimmer 1.1s ease-in-out infinite;
}

@keyframes crm-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.crm-palette {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 1rem;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s var(--ease-soft), visibility 0.18s;
}

.crm-palette.crm-palette--open {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}

.crm-palette__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.crm-palette__dialog {
  position: relative;
  width: min(520px, 100%);
  margin-top: 0;
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.crm-palette__field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.crm-palette__input {
  flex: 1;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  font-size: 0.9375rem;
}

.crm-palette__kbd {
  font-size: 0.65rem;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-mono);
}

.crm-palette__results {
  margin-top: 0.75rem;
  max-height: min(56vh, 440px);
  overflow-y: auto;
}

.crm-palette__hint {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
  padding: 0.5rem 0;
}

.crm-palette__hint--muted {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-bottom: 0.25rem;
}

.crm-palette__hit {
  display: block;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  transition: background 0.12s var(--ease-soft);
}

.crm-palette__hit:hover {
  background: rgba(255, 255, 255, 0.05);
}

.crm-palette__hit--active {
  background: rgba(59, 130, 246, 0.12);
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.28);
}

.crm-palette__tag {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-bright);
}

.crm-palette__meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

/* ——— Справка (горячие клавиши) ——— */
.crm-help {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 1rem;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s var(--ease-soft), visibility 0.2s;
}

.crm-help.crm-help--open {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}

.crm-help__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(5px);
}

.crm-help__dialog {
  position: relative;
  width: min(560px, 100%);
  max-height: min(82vh, 720px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin-top: 0;
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(59, 130, 246, 0.08);
}

.crm-help__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.06) 0%, transparent 100%);
}

.crm-help__title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  color: var(--text-secondary);
}

.crm-help__body {
  padding: 1rem 1.15rem 1.25rem;
  overflow-y: auto;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.crm-help__section {
  margin-bottom: 1.25rem;
}

.crm-help__section:last-child {
  margin-bottom: 0;
}

.crm-help__h {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.crm-help__p {
  margin: 0 0 0.5rem;
  color: var(--muted-bright);
  line-height: 1.5;
}

.crm-help__list {
  margin: 0;
  padding-left: 1.15rem;
  line-height: 1.55;
  color: var(--muted-bright);
}

.crm-help__list li {
  margin-bottom: 0.45rem;
}

.crm-help__list--compact {
  list-style: none;
  padding-left: 0;
}

.crm-help__list--compact li {
  margin-bottom: 0.35rem;
}

.crm-help__keys {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  flex-wrap: wrap;
  vertical-align: middle;
}

.crm-help__kbd {
  display: inline-block;
  padding: 0.12rem 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--muted-bright);
  background: rgba(0, 0, 0, 0.25);
}

/* ——— Реклама: липкая поднавигация по секциям ——— */
.crm-subnav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 1rem;
  padding: 0.5rem 0.7rem;
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(180deg, rgba(9, 11, 16, 0.97) 0%, rgba(9, 11, 16, 0.9) 55%, rgba(9, 11, 16, 0.82) 100%);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.crm-subnav__link {
  display: inline-flex;
  align-items: center;
  padding: 0.42rem 0.85rem;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted-bright);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.15s var(--ease-soft), color 0.15s var(--ease-soft), border-color 0.15s var(--ease-soft);
}

.crm-subnav__link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.crm-subnav__link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-base), 0 0 0 4px rgba(59, 130, 246, 0.4);
}

.crm-subnav__link[aria-current="page"] {
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(59, 130, 246, 0.28);
  color: var(--accent-bright);
}

/* ——— Наверх ——— */
.crm-back-to-top {
  position: fixed;
  right: max(1rem, var(--safe-right));
  bottom: max(1.25rem, var(--safe-bottom));
  z-index: 90;
  width: 2.75rem;
  height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(59, 130, 246, 0.25);
  background: linear-gradient(165deg, rgba(16, 19, 26, 0.96) 0%, rgba(8, 10, 15, 0.98) 100%);
  color: var(--accent-bright);
  cursor: pointer;
  box-shadow: var(--shadow-card), 0 0 0 1px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s var(--ease-soft), box-shadow 0.2s var(--ease-soft), border-color 0.2s var(--ease-soft);
}

.crm-back-to-top:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: var(--shadow-card-hover);
}

.crm-back-to-top:focus-visible {
  outline: none;
  box-shadow: var(--ring-focus), var(--shadow-card);
}

.crm-back-to-top__icon {
  display: flex;
  line-height: 0;
}

@media print {
  .crm-back-to-top,
  .crm-help,
  .crm-subnav {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .crm-back-to-top {
    transition: none;
  }
  .crm-back-to-top:hover {
    transform: none;
  }
}

.settings-card {
  margin-bottom: 1.25rem;
}

.settings-card__title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.settings-card__body {
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.settings-card--danger {
  border-color: rgba(248, 113, 113, 0.22);
  background: linear-gradient(165deg, rgba(248, 113, 113, 0.06) 0%, rgba(0, 0, 0, 0.08) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.settings-card--danger .settings-card__title {
  color: var(--red);
}

.settings-danger-actions {
  margin: 1rem 0 0;
}

.settings-reset-panel {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
}

.settings-reset-panel__hint {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.settings-reset-panel__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.settings-reset-input {
  flex: 1 1 200px;
  min-width: 0;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.settings-reset-input:focus {
  outline: none;
  box-shadow: var(--ring-focus);
}

.settings-reset-status {
  margin: 0.75rem 0 0;
  font-size: 0.8125rem;
}

.settings-kbd {
  display: inline-block;
  padding: 0.12rem 0.4rem;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
}

.settings-dl {
  display: grid;
  grid-template-columns: minmax(120px, 200px) 1fr;
  gap: 0.5rem 1rem;
  margin: 0;
  font-size: 0.875rem;
}

.settings-dl dt {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}

.settings-dl dd {
  margin: 0;
  word-break: break-word;
}

.settings-pre {
  margin: 0;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.45;
  overflow-x: auto;
  white-space: pre-wrap;
}

.settings-audit-payload {
  display: block;
  max-width: 280px;
  font-size: 0.65rem;
  word-break: break-word;
  white-space: pre-wrap;
}

@media (max-width: 720px) {
  .settings-dl {
    grid-template-columns: 1fr;
  }
}

/* ——— Реклама: KPI, тулбар, таблица, тосты ——— */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ads-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.75rem;
}
.ads-kpi-card {
  position: relative;
  padding: 1.05rem 1.15rem 1.1rem;
  border-radius: var(--radius);
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 45%, rgba(0, 0, 0, 0.06) 100%);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-inset-top), 0 1px 0 rgba(255, 255, 255, 0.03);
  transition: transform 0.22s var(--ease-soft), box-shadow 0.22s var(--ease-soft), border-color 0.22s var(--ease-soft);
  overflow: hidden;
}
.ads-kpi-card::after {
  content: "";
  position: absolute;
  top: -40%;
  right: -15%;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.12) 0%, transparent 68%);
  pointer-events: none;
  opacity: 0.9;
}
.ads-kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-card), 0 0 0 1px rgba(59, 130, 246, 0.06);
}
.ads-kpi-card--accent {
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.16) 0%, rgba(56, 189, 248, 0.08) 50%, rgba(15, 23, 42, 0.35) 100%);
  border-color: rgba(59, 130, 246, 0.28);
}
.ads-kpi-card--accent::after {
  background: radial-gradient(circle, rgba(56, 189, 248, 0.22) 0%, rgba(59, 130, 246, 0.08) 45%, transparent 68%);
}
.ads-kpi-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.4rem;
  position: relative;
  z-index: 1;
}
.ads-kpi-strip .ads-kpi-card:nth-child(1) .ads-kpi-label::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: linear-gradient(135deg, #60a5fa, #2563eb);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.45);
  flex-shrink: 0;
}
.ads-kpi-strip .ads-kpi-card:nth-child(2) .ads-kpi-label::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  box-shadow: 0 0 10px rgba(14, 165, 233, 0.35);
  flex-shrink: 0;
}
.ads-kpi-strip .ads-kpi-card:nth-child(3) .ads-kpi-label::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: linear-gradient(135deg, #34d399, #059669);
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.35);
  flex-shrink: 0;
}
.ads-kpi-strip .ads-kpi-card:nth-child(4) .ads-kpi-label::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: linear-gradient(135deg, #fbbf24, #d97706);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.3);
  flex-shrink: 0;
}
.ads-kpi-card strong {
  position: relative;
  z-index: 1;
  display: block;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

.table-actions--split {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.table-actions__right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.links-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 200px;
}
.links-toolbar__label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
}
.input--search {
  flex: 1;
  min-width: 180px;
  max-width: 420px;
  padding: 0.55rem 0.85rem 0.55rem 2.35rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-solid) var(--icon-search) no-repeat 0.75rem 50% / 1rem 1rem;
  color: var(--text);
  font-size: 0.9rem;
}
.input--search::placeholder {
  color: var(--muted);
}
.input--search:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.select-compact {
  padding: 0.45rem 2rem 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
}

.ads-link-status {
  font-size: 0.75rem;
  font-weight: 600;
}
.ads-link-status--off {
  color: var(--muted-bright);
}

.campaign-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.campaign-pill--draft {
  background: rgba(148, 163, 184, 0.15);
  color: var(--muted-bright);
}
.campaign-pill--active {
  background: rgba(52, 211, 153, 0.15);
  color: var(--green);
}
.campaign-pill--paused {
  background: rgba(251, 191, 36, 0.12);
  color: var(--amber);
}

.assignee-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.assignee-chip__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.35), rgba(56, 189, 248, 0.2));
  color: var(--text);
  flex-shrink: 0;
}
.assignee-chip__name {
  font-size: 0.875rem;
}

.link-actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.btn--mini {
  padding: 0.32rem 0.6rem;
  font-size: 0.72rem;
  min-height: 1.9rem;
  border-radius: 9px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.copy-url {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  color: var(--accent-bright);
}
.copy-url:hover {
  color: var(--text);
}

.empty-state--rich {
  text-align: center;
  padding: 2.5rem 1.5rem;
  max-width: 420px;
  margin: 0 auto;
}
.empty-state__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  margin: 0 auto 0.85rem;
  font-size: 1.35rem;
  line-height: 1;
  opacity: 0.55;
  color: var(--muted-bright);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.12), rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border-subtle);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.empty-state__title {
  margin: 0 0 0.5rem;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text-secondary);
}
.empty-state__hint {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.5;
}

.crm-toast-root {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  max-width: min(420px, calc(100vw - 2rem));
}
.crm-toast {
  pointer-events: auto;
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  line-height: 1.45;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  animation: crm-toast-in 0.35s var(--ease-out) both;
}
@keyframes crm-toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.crm-toast--ok {
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.2), rgba(15, 23, 42, 0.95));
  border-color: rgba(52, 211, 153, 0.35);
  color: var(--text);
}
.crm-toast--err {
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.2), rgba(15, 23, 42, 0.95));
  border-color: rgba(248, 113, 113, 0.35);
}

/* ——— v0.1.1 UI polish: числовые колонки, шапка страницы, ошибки полей, фокус карточек ——— */

th.th--num,
td.crm-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

th.th--num {
  font-family: var(--font);
}

.table-wrap td.crm-num {
  font-size: 0.8125rem;
}

tr.crm-table-msg td {
  text-align: center;
  padding: 1.75rem 1rem;
  color: var(--muted-bright);
  font-size: 0.875rem;
  border-bottom: none;
}

tr.crm-table-msg--error td {
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.06);
}

tr.crm-table-msg--error td .crm-table-msg__title {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text-secondary);
}

.crm-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.crm-page-head__main {
  flex: 1;
  min-width: 0;
}

.crm-page-head__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.crm-masthead--inline .page-lead {
  margin-bottom: 0;
}

.form-group--error label {
  color: #fca5a5;
}

.form-group--error input,
.form-group--error select,
.form-group--error textarea {
  border-color: rgba(248, 113, 113, 0.45) !important;
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.12);
}

.form-group .field-error {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.8125rem;
  color: #fca5a5;
}

.card--interactive {
  isolation: isolate;
}

.card--interactive:focus-within {
  outline: none;
  box-shadow: var(--shadow-card), 0 0 0 2px var(--bg-base), 0 0 0 4px rgba(59, 130, 246, 0.35);
}

#crm-density-toggle {
  min-width: 88px;
}

/* ——— Отчёты: сетка карточек экспорта ——— */
.report-export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  align-items: start;
  gap: 1rem;
  margin-top: 1.25rem;
}

.report-export-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
  max-width: 100%;
  padding: 1.15rem 1.3rem;
  margin-bottom: 0;
  min-height: 0;
  height: auto;
  align-self: start;
  transition: box-shadow 0.22s var(--ease-out), border-color 0.22s var(--ease-soft);
}

.report-export-card:hover {
  border-color: rgba(59, 130, 246, 0.18);
  box-shadow: var(--shadow-card-hover);
}

.report-export-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-height: 0;
}

.report-export-card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.18), rgba(212, 175, 55, 0.08));
  color: var(--accent-bright);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.report-export-card__icon svg {
  width: 1.35rem;
  height: 1.35rem;
}

.report-export-card__title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text);
}

.report-export-card__desc {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--muted);
}

.report-export-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.15rem;
}

/* В карточках отчётов — компактный CTA без «неонового» ореола */
.report-export-card .btn--small {
  min-height: 2.25rem;
  padding: 0.45rem 0.95rem;
}

.report-export-card .btn--key {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset 0 -1px 0 rgba(15, 23, 42, 0.35),
    0 2px 10px rgba(37, 99, 235, 0.28),
    0 0 0 1px rgba(30, 64, 175, 0.35);
}

.report-export-card .btn--key:hover {
  filter: brightness(1.04) saturate(1.03);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    inset 0 -1px 0 rgba(15, 23, 42, 0.35),
    0 6px 20px rgba(37, 99, 235, 0.32),
    0 0 0 1px rgba(30, 64, 175, 0.42);
}

.report-export-card .btn--key::after {
  opacity: 0.55;
}

.report-export-card .btn--ghost {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.report-export-card .btn--ghost:hover {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 4px 14px rgba(0, 0, 0, 0.18) !important;
}

.report-btn--preferred {
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.45), 0 4px 16px rgba(59, 130, 246, 0.15);
}

.crm-palette__footer {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.crm-palette__footer-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-quiet);
}

.crm-palette__footer-hint {
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--muted);
}

.crm-palette__kbd-inline {
  display: inline-block;
  margin: 0 0.08rem;
  padding: 0.08rem 0.28rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 600;
  border: 1px solid var(--border);
  color: var(--muted-bright);
  background: rgba(0, 0, 0, 0.25);
}

.dashboard-scope-note {
  margin: 0.65rem 0 0;
  padding: 0.55rem 0.75rem;
  max-width: 52ch;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--muted-bright);
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-sm);
}

.empty-state-cta {
  margin-top: 0.85rem;
}

.links-bulk-bar {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius-sm);
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.18);
}

.links-bulk-bar__count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-right: 0.25rem;
}

.ads-th-check,
.ads-td-check {
  width: 2.25rem;
  text-align: center;
  vertical-align: middle;
}

.ads-th-check input,
.ads-td-check input {
  cursor: pointer;
}

.ads-code-cell {
  white-space: nowrap;
}

.ads-code-cell .ads-link-code {
  margin-right: 0.15rem;
}

html[data-theme="dim"] {
  --bg-root: #050608;
  --bg-base: #0a0c10;
  --bg-raised: #0d1016;
  --text: #e8ecf3;
  --text-secondary: #dce2ea;
  --muted: #7d8fa3;
  --muted-bright: #9aaabe;
  --muted-quiet: #5c6b7c;
  --surface-solid: #0f1218;
  --accent-glow: rgba(59, 130, 246, 0.18);
  --crm-masthead-bg: linear-gradient(145deg, rgba(59, 130, 246, 0.06) 0%, rgba(8, 11, 18, 0.94) 42%, rgba(6, 8, 14, 0.97) 100%);
}

body.crm-app {
  transition: background-color 0.25s var(--ease-soft), color 0.2s var(--ease-soft);
}

.crm-sidebar-toggle {
  display: none;
  position: fixed;
  z-index: 210;
  top: max(0.65rem, var(--safe-top));
  left: max(0.65rem, var(--safe-left));
  width: 2.65rem;
  height: 2.65rem;
  padding: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text-secondary);
  cursor: pointer;
  box-shadow: var(--shadow-card);
}

.crm-sidebar-toggle__bar {
  display: block;
  width: 1.1rem;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
}

.crm-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 205;
  background: rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(2px);
}

.app-layout--nav-open .crm-sidebar-backdrop {
  display: block;
}

@media (max-width: 960px) {
  .crm-sidebar-toggle {
    display: inline-flex;
  }

  .app-layout {
    flex-direction: row !important;
  }

  .app-main {
    padding-top: 3.35rem;
  }

  .sidebar {
    position: fixed;
    z-index: 206;
    top: 0;
    left: 0;
    bottom: 0;
    max-width: min(var(--sidebar-width), 90vw);
    transform: translateX(-102%);
    transition: transform 0.28s var(--ease-out);
    box-shadow: 24px 0 64px rgba(0, 0, 0, 0.45);
  }

  .app-layout--nav-open .sidebar {
    transform: translateX(0);
  }
}

@media (min-width: 961px) {
  .crm-sidebar-toggle {
    display: none !important;
  }

  .crm-sidebar-backdrop {
    display: none !important;
  }
}

/* Таблицы: пагинация (crmTablePager) */
.crm-table-pager {
  margin-top: 0.65rem;
  margin-bottom: 0.35rem;
}

.crm-table-pager__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem 1rem;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.crm-table-pager__label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: default;
  margin: 0;
}

.crm-table-pager__range {
  flex: 1 1 12rem;
  text-align: right;
  min-width: 10rem;
  font-variant-numeric: tabular-nums;
}

.crm-table-pager__nav {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.crm-table-pager__nums {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem;
}

.crm-table-pager__num.crm-table-pager__num--active {
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.12);
  color: var(--text);
}

.crm-table-pager__ellipsis {
  padding: 0 0.15rem;
  opacity: 0.55;
  user-select: none;
}

@media (max-width: 560px) {
  .crm-table-pager__row {
    flex-direction: column;
    align-items: stretch;
  }

  .crm-table-pager__range {
    text-align: left;
  }

  .crm-table-pager__nav {
    justify-content: flex-end;
  }
}

/* ─── Скрытые и опциональные колонки таблиц ─── */
.col-hidden {
  display: none;
}
@media (min-width: 1400px) {
  .col-optional {
    display: table-cell;
  }
}
@media (max-width: 1399px) {
  .col-optional {
    display: none;
  }
}

/* Кнопка «показать все колонки» */
.btn-cols-toggle {
  font-size: 0.75rem;
  opacity: 0.65;
  padding: 0.25rem 0.6rem;
}
.btn-cols-toggle:hover { opacity: 1; }

/* ─── details/summary для форм ─── */
.form-details {
  margin-top: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.form-details__summary {
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: color 0.15s, background 0.15s;
}
.form-details__summary::-webkit-details-marker { display: none; }
.form-details__summary:hover {
  color: var(--text);
  background: var(--surface-hover);
}
.form-details[open] .form-details__summary {
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.form-details__body {
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

/* ─── Антифрод: details для фильтров ─── */
.af-quick-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.af-quick-row__right {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.af-filters-details {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 0.75rem;
}
.af-filters-details__summary {
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  user-select: none;
  list-style: none;
  transition: color 0.15s, background 0.15s;
}
.af-filters-details__summary::-webkit-details-marker { display: none; }
.af-filters-details__summary:hover {
  color: var(--text);
  background: var(--surface-hover);
}
.af-filters-details[open] .af-filters-details__summary {
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

/* ─── card-head-row: заголовок карточки + кнопка справа ─── */
.card-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  gap: 0.75rem;
}
.card-head-row h3 {
  margin: 0;
}
.card-head-row__action {
  flex-shrink: 0;
}

/* ─── form-modal-grid: вертикальная форма внутри модала ─── */
.form-modal-grid {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.form-modal-grid .form-group {
  margin-bottom: 0.5rem;
}
.form-modal-grid .form-group textarea.textarea {
  min-height: 100px;
}
.form-modal-grid .form-actions {
  margin-top: 0.5rem;
}
