/* ╔══════════════════════════════════════════════════════════════════╗
   ║  Элька · кабинет для бизнеса · v7 redesign                       ║
   ║  Linear / Stripe / Vercel-style enterprise SaaS UI               ║
   ╚══════════════════════════════════════════════════════════════════╝ */

/* ─── Дизайн-токены ─────────────────────────────────────────────── */
:root {
  /* Palette — нейтральная slate-шкала Tailwind для текста/бордеров */
  --color-bg:           #F8FAFC;   /* slate-50  · фон всего приложения */
  --color-surface:      #FFFFFF;   /* белые карточки и поверхности */
  --color-surface-2:    #F1F5F9;   /* slate-100 · второй уровень фона */
  --color-surface-hover:#F8FAFC;   /* hover для строк/пунктов nav */

  --color-border:       #E2E8F0;   /* slate-200 · линии и обводки */
  --color-border-strong:#CBD5E1;   /* slate-300 · фокус и сильные границы */

  --color-text:         #0F172A;   /* slate-900 · основной текст */
  --color-text-muted:   #64748B;   /* slate-500 · вторичный текст */
  --color-text-subtle:  #94A3B8;   /* slate-400 · метки/иконки */

  /* Brand — фирменный L-ka синий, гладкая шкала */
  --color-brand:        #004AAD;
  --color-brand-hover:  #003B8E;
  --color-brand-50:     #EFF6FF;   /* мягкий фон активных пунктов */
  --color-brand-100:    #DBEAFE;   /* hover акцент */
  --color-brand-700:    #1D4ED8;

  /* Семантика */
  --color-success:      #059669;
  --color-success-50:   #ECFDF5;
  --color-warning:      #B45309;
  --color-warning-50:   #FFFBEB;
  --color-danger:       #DC2626;
  --color-danger-50:    #FEF2F2;
  --color-info-50:      #EFF6FF;

  /* Charts — гармоничная палитра не яркая, дашборд-стиль */
  --chart-1: #2563EB;     /* blue-600 */
  --chart-2: #10B981;     /* emerald-500 */
  --chart-3: #F59E0B;     /* amber-500 */
  --chart-4: #8B5CF6;     /* violet-500 */
  --chart-5: #EC4899;     /* pink-500 */
  --chart-6: #06B6D4;     /* cyan-500 */
  --chart-7: #64748B;     /* slate-500 */
  --chart-8: #F43F5E;     /* rose-500 */

  /* Spacing */
  --sp-1:  4px;   --sp-2:  8px;   --sp-3:  12px;  --sp-4:  16px;
  --sp-5:  20px;  --sp-6:  24px;  --sp-8:  32px;  --sp-10: 40px;
  --sp-12: 48px;  --sp-16: 64px;

  /* Radius */
  --r-sm: 6px;  --r-md: 8px;  --r-lg: 10px;  --r-xl: 12px;
  --r-2xl: 16px; --r-pill: 999px;

  /* Type */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', 'Menlo', 'Consolas', monospace;

  --fs-xs:   11px;  /* eyebrow */
  --fs-sm:   12px;  /* small body */
  --fs-base: 13px;  /* default body — компактнее чем 14, читается как enterprise */
  --fs-md:   14px;
  --fs-lg:   16px;  /* card title */
  --fs-xl:   18px;
  --fs-2xl:  20px;
  --fs-3xl:  24px;  /* page title */
  --fs-4xl:  30px;  /* KPI value */
  --fs-5xl:  36px;

  /* Elevation — мягкие layered shadows */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-md: 0 2px 4px rgba(15, 23, 42, .04), 0 4px 8px rgba(15, 23, 42, .04);
  --shadow-lg: 0 4px 8px rgba(15, 23, 42, .04), 0 12px 24px rgba(15, 23, 42, .08);
  --shadow-xl: 0 10px 30px rgba(15, 23, 42, .10), 0 20px 60px rgba(15, 23, 42, .08);

  /* Focus ring */
  --focus-ring: 0 0 0 3px rgba(0, 74, 173, .15);

  /* Layout */
  --topbar-h:  56px;
  --sidebar-w: 240px;
  --content-max: 1240px;

  /* Motion */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --t-fast: 120ms;
  --t-base: 180ms;
  --t-slow: 280ms;
}

/* ─── Reset & базовая типографика ───────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  font-feature-settings: 'cv02','cv03','cv04','cv11'; /* красивые Inter-альтернаты */
  background: var(--color-bg);
  color: var(--color-text);
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--color-text); letter-spacing: -0.01em; }
h1 { font-size: var(--fs-3xl); font-weight: 700; line-height: 1.2; margin: 0; }
h2 { font-size: var(--fs-2xl); font-weight: 700; line-height: 1.3; margin: 0; }
h3 { font-size: var(--fs-lg); font-weight: 600; line-height: 1.35; margin: 0; }
h4 { font-size: var(--fs-md); font-weight: 600; line-height: 1.4; margin: 0; }
p  { margin: 0; }

a { color: var(--color-brand); text-decoration: none; transition: color var(--t-fast) var(--ease-out); }
a:hover { color: var(--color-brand-hover); text-decoration: underline; }

.muted { color: var(--color-text-muted); }
.small { font-size: var(--fs-sm); }
.error { color: var(--color-danger); margin: var(--sp-2) 0 0; min-height: 18px; font-size: var(--fs-base); }
.form-row { margin-bottom: var(--sp-3); }
.form-row label { display: block; font-size: var(--fs-sm); color: var(--color-text-2); margin-bottom: var(--sp-1); font-weight: 500; }
.form-row label .muted { font-weight: 400; }
.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  height: 38px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--fs-base);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--motion-fast);
}
.form-row textarea { height: auto; padding: var(--sp-2) var(--sp-3); resize: vertical; }
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none; border-color: var(--color-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 14%, transparent);
}

/* Toggle-блок: iOS-style switch + текстовое описание справа. */
.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-top: 1px solid var(--color-border);
}
.toggle-row:first-of-type { border-top: 0; }
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute; inset: 0;
  background: #cbd5e1;
  border-radius: 999px;
  transition: background var(--motion-fast);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform var(--motion-fast);
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.toggle input:checked + .toggle-slider { background: var(--color-accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }
.toggle input:focus-visible + .toggle-slider { box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 24%, transparent); }
.toggle-text { flex: 1; min-width: 0; }
.toggle-title { font-weight: 500; font-size: var(--fs-base); color: var(--color-text); }
.toggle-desc { font-size: var(--fs-sm); color: var(--color-text-2); margin-top: 2px; line-height: 1.45; }
.success { color: var(--color-success); margin: var(--sp-2) 0 0; min-height: 18px; font-size: var(--fs-base); }

/* ─── Кнопки ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border-radius: var(--r-md); border: 1px solid var(--color-border);
  background: var(--color-surface); color: var(--color-text);
  font-family: inherit; font-size: var(--fs-md); font-weight: 500;
  cursor: pointer; user-select: none;
  transition: background var(--t-fast) var(--ease-out),
              border-color var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out),
              transform var(--t-fast) var(--ease-out);
  text-decoration: none;
}
.btn:hover { background: var(--color-surface-2); border-color: var(--color-border-strong); color: var(--color-text); }
.btn:active { transform: translateY(.5px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: var(--color-brand); color: #fff; border-color: var(--color-brand);
  box-shadow: 0 1px 2px rgba(0,74,173,.18), inset 0 1px 0 rgba(255,255,255,.12);
}
.btn-primary:hover { background: var(--color-brand-hover); border-color: var(--color-brand-hover); color: #fff; }
.btn-danger { background: var(--color-danger); color: #fff; border-color: var(--color-danger); }
.btn-danger:hover { background: #B91C1C; border-color: #B91C1C; color: #fff; }
.btn-sm { height: 30px; padding: 0 10px; font-size: var(--fs-sm); }
.btn-lg { height: 42px; padding: 0 20px; font-size: var(--fs-md); font-weight: 600; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--color-surface-2); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--r-md);
  border: none; background: transparent; color: var(--color-text-muted);
  cursor: pointer; transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.icon-btn:hover { background: var(--color-surface-2); color: var(--color-text); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* ─── Формы ─────────────────────────────────────────────────────── */
input, select, textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  font-family: inherit; font-size: var(--fs-md);
  background: var(--color-surface); color: var(--color-text);
  outline: none;
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px rgba(0, 74, 173, .12);
}
input:read-only { background: var(--color-surface-2); color: var(--color-text-muted); }
textarea { resize: vertical; min-height: 72px; padding-top: 10px; }
label {
  display: block; font-size: var(--fs-base); font-weight: 500;
  margin: var(--sp-4) 0 var(--sp-2); color: var(--color-text);
}
.req { color: var(--color-danger); margin-left: 2px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
@media (max-width: 500px) { .form-grid-2 { grid-template-columns: 1fr; } }

/* ─── Логин ─────────────────────────────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-5);
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(0,74,173,.10), transparent 50%),
    radial-gradient(800px 400px at 90% 90%, rgba(124,180,255,.12), transparent 60%),
    var(--color-bg);
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-2xl);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: var(--sp-4); }
.login-card h1 { text-align: center; margin: 0 0 4px; font-size: 22px; }
.login-card > p.muted { text-align: center; margin: 0 0 var(--sp-6); }
.login-form { margin-top: var(--sp-2); }
.login-form label:first-of-type { margin-top: 0; }
.login-form button { width: 100%; margin-top: var(--sp-5); height: 42px; }
.login-card p.muted.small { text-align: center; margin-top: var(--sp-5); }

/* ─── App shell ─────────────────────────────────────────────────── */
.app { min-height: 100vh; display: flex; flex-direction: column; }

/* — Topbar — */
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--sp-6);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: var(--sp-5); min-width: 0; }
.brand { display: flex; align-items: center; gap: var(--sp-3); }
.brand-logo { flex-shrink: 0; border-radius: 8px; }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name {
  font-family: var(--font-display); font-size: 15px; font-weight: 700;
  letter-spacing: -0.01em; color: var(--color-text);
}
.brand-sub {
  font-size: 10px; color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: .08em; margin-top: 2px;
}

/* Переключатель компаний (в topbar) */
.ws-switcher {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  height: 34px; padding: 0 var(--sp-3);
  border: 1px solid var(--color-border); border-radius: var(--r-md);
  background: var(--color-surface);
  font-family: inherit; font-size: var(--fs-md); font-weight: 500; color: var(--color-text);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
  max-width: 240px;
}
.ws-switcher:hover { background: var(--color-surface-2); border-color: var(--color-border-strong); }
.ws-switcher-avatar {
  width: 22px; height: 22px; border-radius: var(--r-sm);
  background: var(--color-brand-50); color: var(--color-brand);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px;
}
.ws-switcher-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.topbar-right { display: flex; align-items: center; gap: var(--sp-2); }
.topbar-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: var(--r-md);
  font-size: var(--fs-base); color: var(--color-text-muted);
  text-decoration: none;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.topbar-link:hover { background: var(--color-surface-2); color: var(--color-text); text-decoration: none; }
.topbar-link svg { color: currentColor; }
.topbar-divider { width: 1px; height: 20px; background: var(--color-border); margin: 0 var(--sp-1); }
.topbar-icon-btn {
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; border-radius: var(--r-md);
  color: var(--color-text-muted); cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.topbar-icon-btn:hover { background: var(--color-surface-2); color: var(--color-text); }

.user-menu { position: relative; }
.user-menu-trigger {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  height: 34px; padding: 0 10px 0 4px;
  border: 1px solid var(--color-border); border-radius: var(--r-md);
  background: var(--color-surface);
  cursor: pointer; font-family: inherit; font-size: var(--fs-base); color: var(--color-text);
  transition: background var(--t-fast) var(--ease-out);
}
.user-menu-trigger:hover { background: var(--color-surface-2); }
.user-avatar {
  width: 26px; height: 26px; border-radius: var(--r-sm);
  background: linear-gradient(135deg, #7CB4FF, #004AAD);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px;
}
.user-name { font-weight: 500; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-dropdown {
  position: absolute; right: 0; top: calc(100% + 6px);
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  padding: 4px; min-width: 200px; z-index: 60;
  animation: dropdown-in var(--t-base) var(--ease-out);
}
@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.user-menu-item {
  display: flex; align-items: center; gap: var(--sp-2); width: 100%;
  padding: 8px 10px; border: none; background: transparent;
  border-radius: var(--r-sm); cursor: pointer; font-family: inherit; font-size: var(--fs-md);
  color: var(--color-text); text-align: left;
  transition: background var(--t-fast) var(--ease-out);
}
.user-menu-item:hover { background: var(--color-surface-2); }

/* — Invites banner — */
.invites-banner {
  padding: 10px var(--sp-6);
  background: var(--color-warning-50); border-bottom: 1px solid #FEF3C7;
  color: var(--color-warning);
  display: flex; align-items: center; justify-content: space-between;
  font-size: var(--fs-md);
}
.invites-banner button { font-size: var(--fs-base); padding: 0 12px; height: 30px; }

/* ─── Layout: sidebar + content ─────────────────────────────────── */
.layout { flex: 1; display: flex; min-height: 0; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex; flex-direction: column; flex-shrink: 0;
  overflow-y: auto;
}
.sidebar-section { padding: var(--sp-3) var(--sp-3) 0; }
.sidebar-section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--color-text-subtle);
  font-weight: 600;
}
.sidebar-action {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none; border-radius: var(--r-sm);
  color: var(--color-text-muted); cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.sidebar-action:hover { background: var(--color-surface-2); color: var(--color-text); }

.ws-list { display: flex; flex-direction: column; gap: 2px; padding: 0 var(--sp-2) var(--sp-2); }
.ws-list-loading { padding: var(--sp-2); }
.ws-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out);
}
.ws-item:hover { background: var(--color-surface-2); }
.ws-item.active { background: var(--color-brand-50); }
.ws-avatar {
  width: 28px; height: 28px; border-radius: var(--r-md);
  background: var(--color-surface-2); color: var(--color-text-muted);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; flex-shrink: 0;
}
.ws-item.active .ws-avatar { background: var(--color-brand); color: #fff; }
.ws-info { flex: 1; min-width: 0; }
.ws-info-name {
  font-weight: 500; font-size: var(--fs-md);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--color-text);
}
.ws-info-sub { font-size: 10px; color: var(--color-text-subtle); text-transform: uppercase; letter-spacing: .04em; margin-top: 1px; }

.sidebar-nav { flex: 1; padding: 0 var(--sp-3) var(--sp-3); display: flex; flex-direction: column; }
.sidebar-nav .sidebar-section-head { margin-top: var(--sp-2); }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 10px; margin: 1px 0;
  background: transparent; border: none; border-radius: var(--r-md);
  font-family: inherit; font-size: var(--fs-md); font-weight: 500; color: var(--color-text-muted);
  cursor: pointer; text-align: left;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.nav-item:hover { background: var(--color-surface-2); color: var(--color-text); }
.nav-item.active {
  background: var(--color-brand-50);
  color: var(--color-brand);
  font-weight: 600;
}
.nav-item.active .nav-icon { color: var(--color-brand); }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; color: var(--color-text-subtle); }
.nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--color-warning, #f59e0b);
  color: white;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  letter-spacing: 0;
}
.nav-item span { flex: 1; }
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--color-brand); color: #fff;
  border-radius: var(--r-pill); font-size: 10px; font-weight: 700;
}

.sidebar-foot { margin-top: auto; padding: var(--sp-4) var(--sp-3) 0; }
.plan-chip {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: var(--r-md);
  background: linear-gradient(135deg, rgba(0,74,173,.04), rgba(124,180,255,.07));
  border: 1px solid var(--color-border);
}
.plan-chip-label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--color-text-subtle); font-weight: 600; }
.plan-chip-value { font-weight: 700; color: var(--color-text); font-size: var(--fs-md); }

/* — Content area — */
.content {
  flex: 1; overflow-y: auto;
  padding: var(--sp-8) var(--sp-8);
}
@media (max-width: 800px) { .content { padding: var(--sp-5); } }

.ws-view { max-width: var(--content-max); margin: 0 auto; }

/* Page header (внутри секции) */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-5);
  margin-bottom: var(--sp-6); flex-wrap: wrap;
}
.page-breadcrumb {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-xs); color: var(--color-text-subtle);
  text-transform: uppercase; letter-spacing: .08em; font-weight: 600;
  margin-bottom: var(--sp-2);
}
.page-breadcrumb-sep { color: var(--color-text-subtle); }
.page-title {
  font-size: var(--fs-3xl); font-weight: 700;
  font-family: var(--font-display); letter-spacing: -0.02em; line-height: 1.15;
}
.page-subtitle {
  margin-top: 6px; color: var(--color-text-muted);
  font-size: var(--fs-md); max-width: 560px;
}
.page-header-side { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }

.role-badge {
  padding: 4px 10px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 600;
  background: var(--color-brand-50); color: var(--color-brand);
  text-transform: uppercase; letter-spacing: .04em;
}
.role-badge.owner   { background: #FFFBEB; color: #B45309; }
.role-badge.admin   { background: #F5F3FF; color: #6D28D9; }
.role-badge.agent   { background: #ECFDF5; color: #047857; }

/* ─── Empty state ───────────────────────────────────────────────── */
.empty-state {
  max-width: 480px; margin: 80px auto 0; text-align: center; padding: var(--sp-5);
}
.empty-icon { font-size: 56px; margin-bottom: var(--sp-3); opacity: .7; }
.empty-state h2 { margin: 0 0 var(--sp-3); font-size: var(--fs-3xl); }
.empty-state p { margin: 0 0 var(--sp-6); }

/* Skeleton-плейсхолдеры */
.skeleton {
  background: linear-gradient(90deg, var(--color-surface-2) 0%, #E2E8F0 50%, var(--color-surface-2) 100%);
  background-size: 200% 100%; animation: skeleton 1.5s ease-in-out infinite;
  border-radius: var(--r-sm);
}
@keyframes skeleton {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-ws { height: 36px; margin: 4px 8px; }

/* ─── Cards ─────────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-xl);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
}
.card h3 { margin: 0 0 var(--sp-3); font-size: var(--fs-lg); }
.card.center { text-align: center; padding: var(--sp-10) var(--sp-5); }
.card.danger-zone { border-color: #FECACA; background: #FFFBFB; }
.card.danger-zone h3 { color: var(--color-danger); }

.card-head-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); flex-wrap: wrap; }
.card-head-row h3 { margin: 0; }

.row-buttons { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-2); }

/* Стат-карточки для обзора */
.cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-3); margin-bottom: var(--sp-5);
}
.stat-card {
  padding: var(--sp-4) var(--sp-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-xl);
}
.stat-label {
  font-size: var(--fs-xs); color: var(--color-text-subtle);
  text-transform: uppercase; letter-spacing: .08em; font-weight: 600;
}
.stat-value {
  font-size: var(--fs-4xl); font-weight: 800;
  font-family: var(--font-display); letter-spacing: -0.02em;
  margin-top: 4px; color: var(--color-text);
}
.checklist { margin: 0; padding-left: 20px; line-height: 1.7; }
.checklist li { margin-bottom: 6px; }
.checklist li.done { color: var(--color-text-muted); text-decoration: line-through; }
.checklist li.current strong { color: var(--color-brand); }
.checklist li.current::marker { color: var(--color-brand); }

/* ─── Status banner ─────────────────────────────────────────────── */
.status-banner {
  padding: 14px 18px; border-radius: var(--r-lg); margin-bottom: var(--sp-4);
  display: flex; align-items: center; gap: var(--sp-3); font-size: var(--fs-md);
  border: 1px solid;
}
.status-banner.pending         { background: var(--color-warning-50); border-color: #FDE68A; color: #92400E; }
.status-banner.pending_review  { background: var(--color-info-50);    border-color: #BFDBFE; color: #1E40AF; }
.status-banner.suspended       { background: var(--color-danger-50);  border-color: #FECACA; color: #991B1B; }
.status-banner.active          { display: none !important; }
.status-banner-icon { font-size: 22px; line-height: 1; }
.status-banner-text { flex: 1; }
.status-banner-text strong { display: block; margin-bottom: 2px; }

.status-value.pending         { color: #92400E; }
.status-value.pending_review  { color: #1E40AF; }
.status-value.suspended       { color: #991B1B; }
.status-value.active          { color: var(--color-success); }

/* ─── Team / Members ────────────────────────────────────────────── */
.invite-form { display: grid; grid-template-columns: 1.5fr 1fr auto; gap: var(--sp-2); margin-top: var(--sp-3); align-items: end; }
.invite-form button { padding: 0 18px; height: 36px; }
@media (max-width: 600px) { .invite-form { grid-template-columns: 1fr; } }

.members-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.member-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md);
  transition: background var(--t-fast) var(--ease-out);
}
.member-row:hover { background: var(--color-surface-2); }
.member-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--color-brand-50); color: var(--color-brand);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: var(--fs-md); flex-shrink: 0;
}
.member-info { flex: 1; min-width: 0; }
.member-name { font-weight: 500; font-size: var(--fs-md); }
.member-username { font-size: var(--fs-sm); color: var(--color-text-muted); }
.member-actions { display: flex; align-items: center; gap: var(--sp-2); }
.member-actions select { padding: 6px 10px; font-size: var(--fs-base); width: auto; height: 30px; }
.member-status-pending {
  font-size: 10px; padding: 3px 8px; border-radius: var(--r-pill);
  background: var(--color-warning-50); color: var(--color-warning);
  font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.member-status-declined {
  font-size: 10px; padding: 3px 8px; border-radius: var(--r-pill);
  background: var(--color-surface-2); color: var(--color-text-muted);
  font-weight: 700; letter-spacing: .04em;
}
.crm-link-chip {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  display: inline-flex; align-items: center; gap: 4px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.crm-link-chip.linked {
  background: #ecfdf5; color: #047857;
  border: 1px solid #a7f3d0;
}
.crm-link-chip.not-linked {
  background: var(--color-surface-2); color: var(--color-text-muted);
  border: 1px dashed var(--color-border);
}
.btn-xs {
  font-size: 11.5px;
  padding: 2px 8px;
  height: auto;
  line-height: 1.5;
}

/* ─── Модалка «Привязать external_operator к team-member» ─────────── */
.op-link-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .50);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-5);
  animation: overlay-in 180ms var(--ease-out);
}
.op-link-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-2xl);
  padding: var(--sp-6);
  width: 100%; max-width: 520px;
  max-height: 80vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-xl);
}
.op-link-title { margin: 0 0 var(--sp-2); font-size: var(--fs-lg); font-weight: 600; color: var(--color-text); }
.op-link-sub { margin: 0 0 var(--sp-4); font-size: var(--fs-sm); color: var(--color-text-muted); line-height: 1.5; }
.op-link-list {
  flex: 1; min-height: 0;
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
}
.op-link-row {
  /* ВАЖНО: переопределяем глобальный label { display:block; margin:... } */
  display: grid !important;
  grid-template-columns: 20px 32px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin: 0 !important;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  font-weight: normal;
  transition: background var(--t-fast) var(--ease-out);
}
.op-link-row:last-child { border-bottom: 0; }
.op-link-row:hover:not(.is-linked) { background: var(--color-surface-2); }
.op-link-row.is-linked { opacity: .55; cursor: not-allowed; }
.op-link-row input[type="radio"] { margin: 0; cursor: pointer; justify-self: center; }
.op-link-row.is-linked input[type="radio"] { cursor: not-allowed; }
.op-link-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--color-brand-50); color: var(--color-brand);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
}
.op-link-text {
  min-width: 0;
  overflow: hidden;
}
.op-link-name {
  display: block;
  font-size: 14px; font-weight: 500; color: var(--color-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  line-height: 1.3;
}
.op-link-meta {
  display: block;
  font-size: 12px; color: var(--color-text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  line-height: 1.3; margin-top: 2px;
}
.op-link-actions {
  display: flex; justify-content: flex-end; gap: var(--sp-2);
  margin-top: var(--sp-4);
}

/* ─── Settings ──────────────────────────────────────────────────── */
.settings-form label:first-of-type { margin-top: 0; }
.settings-form button { margin-top: var(--sp-4); }

/* ─── Modals ────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .50);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-5);
  animation: overlay-in 180ms var(--ease-out);
}
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-2xl);
  padding: var(--sp-6);
  width: 100%; max-width: 480px; position: relative;
  box-shadow: var(--shadow-xl);
  max-height: 90vh; overflow-y: auto;
  animation: modal-in 260ms var(--ease-out);
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-sm { max-width: 380px; }
.modal-lg { max-width: 640px; }
.modal h2 { margin: 0 0 var(--sp-4); font-size: var(--fs-2xl); }
.modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px; border: none; background: transparent;
  border-radius: var(--r-md); font-size: 22px; color: var(--color-text-muted);
  cursor: pointer; transition: background var(--t-fast) var(--ease-out);
}
.modal-close:hover { background: var(--color-surface-2); color: var(--color-text); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); margin-top: var(--sp-5); }

.invites-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.invite-row { padding: 14px; border: 1px solid var(--color-border); border-radius: var(--r-lg); }
.invite-row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.invite-row-name { font-weight: 600; font-size: var(--fs-md); }
.invite-row-meta { font-size: var(--fs-sm); color: var(--color-text-muted); margin-bottom: 10px; }
.invite-row-actions { display: flex; gap: var(--sp-2); }
.invite-row-actions button { flex: 1; }

/* ─── Links & widgets ───────────────────────────────────────────── */
.links-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.link-row {
  padding: var(--sp-3); border: 1px solid var(--color-border); border-radius: var(--r-lg);
  display: flex; gap: var(--sp-3); align-items: center;
}
.link-row.revoked, .link-row.expired { opacity: .5; }
.link-row-info { flex: 1; min-width: 0; }
.link-row-url { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--color-text); word-break: break-all; }
.link-row-meta { font-size: var(--fs-sm); color: var(--color-text-muted); margin-top: 4px; }
.link-row-actions { display: flex; gap: 6px; align-items: center; }
.link-display { display: flex; gap: var(--sp-2); margin: var(--sp-3) 0; }
.link-display input { font-family: var(--font-mono); font-size: var(--fs-base); background: var(--color-surface-2); }

.widgets-list { display: grid; gap: var(--sp-3); }
.widget-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-xl);
  padding: var(--sp-4) var(--sp-5);
  display: flex; gap: var(--sp-4); align-items: center;
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}
.widget-card:hover { border-color: var(--color-border-strong); box-shadow: var(--shadow-sm); }
.widget-color-dot { width: 38px; height: 38px; border-radius: var(--r-md); flex-shrink: 0; }
.widget-card-info { flex: 1; min-width: 0; }
.widget-card-name { font-weight: 600; font-size: var(--fs-md); margin-bottom: 4px; color: var(--color-text); }
.widget-card-meta { font-size: var(--fs-sm); color: var(--color-text-muted); font-family: var(--font-mono); }
.widget-card-stats { font-size: var(--fs-sm); color: var(--color-text-muted); margin-top: 4px; }
.widget-card-actions { display: flex; gap: 6px; flex-shrink: 0; }

.widget-empty {
  text-align: center; padding: var(--sp-10) var(--sp-5);
  background: var(--color-surface);
  border-radius: var(--r-xl);
  border: 1px dashed var(--color-border-strong);
}
.widget-empty .empty-icon { font-size: 48px; margin-bottom: var(--sp-3); }
.widget-empty h3 { margin: 0 0 var(--sp-2); }

/* Code block */
.code-block {
  background: #0F172A; color: #E2E8F0; border-radius: var(--r-lg);
  padding: var(--sp-4); position: relative; margin: var(--sp-3) 0;
}
.code-block pre {
  margin: 0; padding: 0 0 var(--sp-3); font-size: var(--fs-sm); line-height: 1.55;
  font-family: var(--font-mono); white-space: pre-wrap; word-break: break-all;
  max-height: 200px; overflow-y: auto;
}
.code-block .btn { width: 100%; background: #1E293B; color: #fff; border-color: #334155; }
.code-block .btn:hover { background: #334155; }

code { background: var(--color-surface-2); padding: 1px 6px; border-radius: var(--r-sm); font-family: var(--font-mono); font-size: var(--fs-base); }

/* ╔══════════════════════════════════════════════════════════════════╗
   ║  ВКЛАДКА: КТО НА САЙТЕ                                            ║
   ╚══════════════════════════════════════════════════════════════════╝ */

.online-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4); flex-wrap: wrap;
}
.online-headline { display: flex; align-items: center; gap: var(--sp-2); }
.online-headline h3 { font-family: var(--font-display); font-size: var(--fs-xl); }
.online-controls { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.ctrl {
  height: 34px; padding: 0 12px;
  border: 1px solid var(--color-border); border-radius: var(--r-md);
  background: var(--color-surface);
  font-family: inherit; font-size: var(--fs-md); color: var(--color-text);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
}
.ctrl:hover { border-color: var(--color-border-strong); }
.ctrl:focus { outline: none; border-color: var(--color-brand); box-shadow: 0 0 0 3px rgba(0,74,173,.12); }

.live-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 0 0 rgba(5,150,105,.5);
  animation: live-pulse 1.6s ease-out infinite;
}
.live-dot.idle { background: var(--color-text-subtle); animation: none; box-shadow: none; }
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(5,150,105,.5); }
  70%  { box-shadow: 0 0 0 10px rgba(5,150,105,0); }
  100% { box-shadow: 0 0 0 0 rgba(5,150,105,0); }
}

.online-summary {
  display: flex; flex-wrap: wrap; gap: var(--sp-2);
  margin-top: var(--sp-3);
}
.online-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--r-pill);
  padding: 4px 10px;
  font-size: var(--fs-sm); color: var(--color-text);
}
.online-pill b { color: var(--color-brand); font-weight: 700; }
.online-pill.empty { color: var(--color-text-muted); background: transparent; border-style: dashed; }

.online-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: var(--sp-3);
  margin-top: var(--sp-4);
}
.online-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-success);
  border-radius: var(--r-xl);
  padding: var(--sp-4) var(--sp-4) var(--sp-4) calc(var(--sp-4) - 2px);
  position: relative;
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.online-card:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.online-card .row-1 { display: flex; align-items: flex-start; gap: var(--sp-3); }
.online-card .avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, #7CB4FF, #004AAD);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: var(--fs-md); flex-shrink: 0;
}
.online-card .meta-title { font-weight: 600; font-size: var(--fs-md); color: var(--color-text); }
.online-card .meta-sub  { font-size: var(--fs-sm); color: var(--color-text-muted); margin-top: 2px; }
.online-card .stat-strip {
  display: flex; gap: var(--sp-4); align-items: center;
  margin-left: auto; font-size: 10px; color: var(--color-text-subtle);
  text-align: right; text-transform: uppercase; letter-spacing: .06em; font-weight: 600;
}
.online-card .stat-strip b { color: var(--color-success); font-size: var(--fs-lg); font-weight: 800; display: block; margin-top: 1px; letter-spacing: -0.01em; font-family: var(--font-display); text-transform: none; }
.online-card .badges {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: var(--sp-3) 0 var(--sp-2);
}
.online-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--r-sm);
  padding: 3px 8px; font-size: var(--fs-sm); color: var(--color-text);
}
.online-badge.utm  { background: #FFF7ED; border-color: #FED7AA; color: #9A3412; }
.online-badge.geo  { background: var(--color-success-50); border-color: #A7F3D0; color: #047857; }
.online-badge.dev  { background: var(--color-info-50); border-color: #BFDBFE; color: #1D4ED8; }
.online-card .url-row { font-size: var(--fs-sm); word-break: break-all; margin-bottom: var(--sp-3); }
.online-card .url-row a { color: var(--color-brand); }
.online-card .url-row a:hover { text-decoration: underline; }
.online-card .url-title { font-weight: 500; color: var(--color-text); margin-bottom: 2px; }
.online-card .actions { display: flex; align-items: center; gap: var(--sp-2); }
.online-card .actions .seen { margin-left: auto; font-size: 10px; color: var(--color-text-subtle); text-transform: uppercase; letter-spacing: .04em; }

.online-empty {
  grid-column: 1 / -1;
  text-align: center; padding: var(--sp-10) var(--sp-5);
  background: var(--color-surface);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--r-xl);
}
.online-empty .empty-icon { font-size: 40px; margin-bottom: var(--sp-2); }
.online-empty h4 { margin: 0 0 4px; font-size: var(--fs-lg); }
.online-empty p { margin: 0; color: var(--color-text-muted); font-size: var(--fs-md); max-width: 480px; margin: 0 auto; }

/* ╔══════════════════════════════════════════════════════════════════╗
   ║  ВКЛАДКА: АНАЛИТИКА                                               ║
   ╚══════════════════════════════════════════════════════════════════╝ */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-3); margin-bottom: var(--sp-4);
}
.kpi-card {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-xl);
  padding: var(--sp-4) var(--sp-5);
  overflow: hidden;
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}
.kpi-card:hover { border-color: var(--color-border-strong); box-shadow: var(--shadow-sm); }
.kpi-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-2); margin-bottom: var(--sp-3);
}
.kpi-label {
  font-size: var(--fs-xs); color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: .08em; font-weight: 600;
}
.kpi-icon {
  width: 30px; height: 30px; border-radius: var(--r-md);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--color-brand-50); color: var(--color-brand);
}
.kpi-icon svg { width: 16px; height: 16px; }
.kpi-icon.success { background: var(--color-success-50); color: var(--color-success); }
.kpi-icon.warning { background: var(--color-warning-50); color: var(--color-warning); }
.kpi-icon.danger  { background: var(--color-danger-50);  color: var(--color-danger); }
.kpi-icon.violet  { background: #F5F3FF; color: #7C3AED; }
.kpi-icon.pink    { background: #FDF2F8; color: #DB2777; }
.kpi-icon.cyan    { background: #ECFEFF; color: #0891B2; }
.kpi-icon.amber   { background: #FFFBEB; color: #B45309; }

.kpi-value {
  font-family: var(--font-display);
  font-size: var(--fs-4xl); font-weight: 800;
  letter-spacing: -0.02em; line-height: 1;
  color: var(--color-text);
}
.kpi-sub {
  font-size: var(--fs-sm); color: var(--color-text-muted);
  margin-top: 4px;
}
.kpi-delta {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: var(--sp-3);
  font-size: var(--fs-sm); font-weight: 600;
  padding: 2px 8px; border-radius: var(--r-pill);
}
.kpi-delta.up   { background: var(--color-success-50); color: var(--color-success); }
.kpi-delta.down { background: var(--color-danger-50);  color: var(--color-danger); }
.kpi-delta.zero { background: var(--color-surface-2);  color: var(--color-text-muted); }
.kpi-delta svg { width: 12px; height: 12px; }

.kpi-spark {
  position: absolute; right: var(--sp-3); bottom: var(--sp-3);
  width: 90px; height: 36px;
  opacity: .9;
}

/* Большие чарт-секции */
.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: var(--sp-4); margin-bottom: var(--sp-4);
}
.chart-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-xl);
  padding: var(--sp-5);
}
.chart-card h4 {
  margin: 0 0 var(--sp-4); font-size: var(--fs-md); font-weight: 600;
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
}
.chart-card .chart-note { font-size: var(--fs-sm); color: var(--color-text-muted); margin-top: var(--sp-2); }

.chart-legend {
  display: flex; gap: var(--sp-4); flex-wrap: wrap;
  font-size: var(--fs-sm); color: var(--color-text-muted);
  margin-bottom: var(--sp-3);
}
.chart-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend-dot { width: 9px; height: 9px; border-radius: 2px; }

/* Горизонтальные бары */
.bar-row {
  display: grid; grid-template-columns: 1fr 90px;
  gap: var(--sp-3); align-items: center;
  padding: 7px 0;
}
.bar-row .label-wrap { min-width: 0; }
.bar-row .label {
  font-size: var(--fs-md); color: var(--color-text);
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-bottom: 4px;
}
.bar-row .bar-bg {
  background: var(--color-surface-2); border-radius: var(--r-pill);
  height: 6px; overflow: hidden;
}
.bar-row .bar-fg {
  background: linear-gradient(90deg, var(--color-brand), #3B82F6);
  height: 100%; border-radius: var(--r-pill);
  transition: width var(--t-slow) var(--ease-out);
}
.bar-row .count {
  text-align: right; color: var(--color-text-muted);
  font-size: var(--fs-base); font-variant-numeric: tabular-nums; font-weight: 600;
}

/* Donut chart */
.donut-wrap { display: flex; align-items: center; gap: var(--sp-4); }
.donut-wrap svg { flex-shrink: 0; }
.donut-center {
  position: relative;
}
.donut-center-text {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  text-align: center;
}
.donut-center-value { font-family: var(--font-display); font-size: 22px; font-weight: 800; color: var(--color-text); line-height: 1; }
.donut-center-label { font-size: 10px; color: var(--color-text-subtle); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; margin-top: 3px; }
.donut-legend { font-size: var(--fs-sm); flex: 1; min-width: 0; }
.donut-legend .lg-row { display: flex; align-items: center; gap: var(--sp-2); padding: 4px 0; }
.donut-legend .lg-dot { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.donut-legend .lg-label { flex: 1; min-width: 0; color: var(--color-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend .lg-val { color: var(--color-text-muted); font-variant-numeric: tabular-nums; font-weight: 600; }

/* Рейтинги */
.rating-stars { color: #F59E0B; letter-spacing: 1px; font-size: var(--fs-md); }
.rating-bar-row { display: grid; grid-template-columns: 80px 1fr 40px; gap: var(--sp-2); align-items: center; padding: 4px 0; font-size: var(--fs-sm); }
.rating-bar-row .label { color: var(--color-text); }
.rating-bar-row .bar-bg { background: var(--color-surface-2); border-radius: var(--r-pill); height: 6px; overflow: hidden; }
.rating-bar-row .bar-fg { background: linear-gradient(90deg, #FBBF24, #F59E0B); height: 100%; }
.rating-summary {
  display: flex; align-items: baseline; gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.rating-summary-value { font-family: var(--font-display); font-size: 28px; font-weight: 800; color: var(--color-text); letter-spacing: -0.01em; }
.rating-summary-meta  { font-size: var(--fs-sm); color: var(--color-text-muted); }

/* Breakdown table — для «по сайтам» */
.bd-table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.bd-table th {
  text-align: left; color: var(--color-text-subtle);
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em;
  padding: var(--sp-2) var(--sp-2); font-weight: 600;
  border-bottom: 1px solid var(--color-border);
}
.bd-table td {
  padding: 10px var(--sp-2); border-top: 1px solid var(--color-border);
  vertical-align: middle;
}
.bd-table td:last-child { text-align: right; color: var(--color-text); font-weight: 600; }
.bd-table .site-marker {
  display: inline-flex; align-items: center; gap: var(--sp-2);
}
.bd-table .site-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.bd-table .site-bar {
  display: block; height: 4px; border-radius: 2px;
  background: var(--color-surface-2); margin-top: 4px; overflow: hidden;
}
.bd-table .site-bar-fg { display: block; height: 100%; background: linear-gradient(90deg, var(--color-brand), #3B82F6); }

/* Большой area-chart (посетители + диалоги по дням) */
.area-chart-wrap { overflow-x: auto; padding-bottom: var(--sp-2); }
.area-chart-wrap svg { display: block; }
.area-chart-wrap .grid line { stroke: var(--color-border); stroke-dasharray: 2 3; }
.area-chart-wrap .axis text { fill: var(--color-text-subtle); font-size: 10px; font-family: var(--font-sans); }

/* ─── Мобильная адаптация ───────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .topbar { padding: 0 var(--sp-4); }
  .user-name { display: none; }
  .topbar-link span { display: none; }
}
@media (max-width: 600px) {
  .online-header { flex-direction: column; align-items: flex-start; }
  .online-controls { width: 100%; }
  .online-card .stat-strip { flex-basis: 100%; justify-content: flex-end; margin: 4px 0 0 0; text-align: left; }
}
