:root {
  /* Smile Chups Identity Accents (default = синий; переключается accent-switcher'ом, см. nav-shell.js) */
  --brand-pink: #2563eb;
  --brand-purple: #8b5cf6;
  --brand-yellow: #fbbf24;

  /* Smile Chups Design System Tokens (--sc-*) */
  --sc-brand: #2563eb;
  --sc-brand-hover: color-mix(in srgb, var(--sc-brand) 82%, black);
  --sc-brand-soft: color-mix(in srgb, var(--sc-brand) 10%, white);
  --sc-purple: #8b5cf6;
  --sc-yellow: #fbbf24;
  --sc-bg: #f7f8fc;
  --sc-surface: #ffffff;
  --sc-surface-soft: #f1f5f9;
  --sc-surface-hover: #f2f4f7;
  --sc-ink: #111827;
  --sc-muted: #667085;
  --sc-border: #e5e7eb;
  --sc-success: #16a34a;
  --sc-warning: #f59e0b;
  --sc-danger: #dc2626;
  --sc-info: #2563eb;
  --sc-radius-sm: 8px;
  --sc-radius-md: 12px;
  --sc-radius-lg: 16px;
  --sc-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.04);
  --sc-shadow-md: 0 4px 16px rgba(15, 23, 42, 0.1);
  --sc-shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.12);

  /* Neutral B2B SaaS Foundation */
  --bg: #f7f8fc;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --surface-hover: #f2f4f7;
  --ink: #111827;
  --muted: #667085;
  --line: #e5e7eb;

  /* Functional Status Palettes — --blue-* выведен из акцента (--sc-brand), чтобы
     кнопки/фокус/чат-элементы следовали за accent-switcher'ом (nav-shell.js).
     Категориальные бейджи (--blue вариант рядом с green/violet/amber/red на
     Обзоре) используют отдельный фиксированный синий ниже, чтобы не сливаться
     с другими цветами при смене акцента. */
  --blue-primary: var(--sc-brand);
  --blue-dark: color-mix(in srgb, var(--sc-brand) 82%, black);
  --blue-light: color-mix(in srgb, var(--sc-brand) 75%, white);
  --blue-soft: color-mix(in srgb, var(--sc-brand) 8%, white);
  --blue-glow: color-mix(in srgb, var(--sc-brand) 12%, transparent);
  --badge-blue: #2563eb;
  --badge-blue-soft: #eff6ff;

  --ai-indigo: #8b5cf6;
  --ai-soft: rgba(139, 92, 246, 0.12);
  --green-online: #16a34a;
  --green-soft: #f0fdf4;
  --amber-warning: #f59e0b;
  --amber-soft: #fffbeb;
  --red-danger: #dc2626;
  --red-soft: #fef2f2;

  --nav: #0f172a;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.12);
  --chat-sidebar-width: 390px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --brand-pink: #3b82f6;
  --brand-purple: #a78bfa;
  --brand-yellow: #fcd34d;

  --sc-brand: #3b82f6;
  --sc-brand-hover: color-mix(in srgb, var(--sc-brand) 85%, white);
  --sc-brand-soft: color-mix(in srgb, var(--sc-brand) 16%, transparent);
  --sc-purple: #a78bfa;
  --sc-yellow: #fcd34d;
  --sc-bg: #0b1320;
  --sc-surface: #111c2e;
  --sc-surface-soft: #18263e;
  --sc-surface-hover: #1e304f;
  --sc-ink: #f1f5f9;
  --sc-muted: #94a3b8;
  --sc-border: #1e293b;
  --sc-success: #22c55e;
  --sc-warning: #fbbf24;
  --sc-danger: #ef4444;
  --sc-info: #3b82f6;
  --sc-shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.3);
  --sc-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --sc-shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);

  --bg: #0b1320;
  --surface: #111c2e;
  --surface-soft: #18263e;
  --surface-hover: #1e304f;
  --ink: #f1f5f9;
  --muted: #94a3b8;
  --line: #1e293b;

  --blue-primary: var(--sc-brand);
  --blue-dark: color-mix(in srgb, var(--sc-brand) 80%, black);
  --blue-light: color-mix(in srgb, var(--sc-brand) 70%, white);
  --blue-soft: color-mix(in srgb, var(--sc-brand) 14%, transparent);
  --blue-glow: color-mix(in srgb, var(--sc-brand) 22%, transparent);
  --badge-blue: #3b82f6;
  --badge-blue-soft: rgba(59, 130, 246, 0.14);

  --ai-indigo: #a78bfa;
  --ai-soft: rgba(139, 92, 246, 0.18);
  --green-online: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.15);
  --amber-warning: #fbbf24;
  --amber-soft: rgba(245, 158, 11, 0.15);
  --red-danger: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.15);

  --nav: #070d18;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; -webkit-text-size-adjust: 100%; }
body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.chat-mode { overflow: hidden; }

button, input, textarea { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--blue-primary);
  outline-offset: 2px;
}

@media (max-width: 768px) {
  .welcome-hero { padding: 20px; }
  .topbar { min-height: 64px; }
  .content { padding-top: 16px; }
  .chat-composer, .composer { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}
[hidden] { display: none !important; }

/* SVG Vector Icon Centering Helper */
svg { display: inline-block; vertical-align: middle; flex-shrink: 0; }
.svg-icon { display: inline-flex; align-items: center; justify-content: center; }

/* Custom Scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* App Layout Shell — shared chrome lives in ui-system.css */
.app-shell { display: flex; min-height: 100vh; min-height: 100dvh; }

/* Dashboard-only sidebar accents (shell/collapse shared via ui-system + nav-shell.js) */
.nav-item--crm {
  text-decoration: none;
  margin-top: 4px;
}
.nav-item--crm:hover {
  background: rgba(139, 92, 246, 0.15);
  color: #c084fc;
}
.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 99px;
  background: linear-gradient(135deg, var(--sc-brand), var(--sc-purple));
  color: white;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--sc-brand) 35%, transparent);
}
.nav-badge--alert{background:#ef4444;box-shadow:0 0 0 0 rgba(239,68,68,.55);animation:managerQueuePulse 1.35s infinite}
@keyframes managerQueuePulse{70%{box-shadow:0 0 0 8px rgba(239,68,68,0)}100%{box-shadow:0 0 0 0 rgba(239,68,68,0)}}
.crm-topbar-link {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  width: auto !important;
  text-decoration: none;
  color: white !important;
  background: linear-gradient(135deg, var(--sc-brand), var(--sc-purple)) !important;
  border: 0 !important;
  padding: 0 14px !important;
  height: 36px !important;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--sc-brand) 25%, transparent);
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.crm-topbar-link:hover {
  transform: translateY(-1px);
  opacity: 0.92;
}
.nav-count {
  margin-left: auto;
  min-width: 22px;
  padding: 2px 7px;
  border-radius: 20px;
  color: #fff;
  background: #25d366;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 2px 8px rgba(37,211,102,.5);
}
.nav-count[hidden] { display: none !important; }
.nav-item.active .nav-count { color: #fff; background: var(--sc-brand); }

.system-card .status-dot { margin-top: 0; }
.status-dot {
  display: inline-block;
  flex: 0 0 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green-online);
  box-shadow: 0 0 0 3px rgba(37,211,102,.2);
}
.status-dot.offline { background: var(--amber-warning); box-shadow: 0 0 0 3px rgba(245,158,11,.2); }

/* Top Navigation Bar */
.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.topbar h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.4px; }
.topbar p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.topbar__right { display: flex; align-items: center; gap: 12px; margin-left: auto; }

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.theme-toggle:hover { color: var(--blue-primary); border-color: var(--blue-light); background: var(--blue-soft); }

.topbar-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
  transition: all .15s;
}
.topbar-btn:hover { color: var(--blue-primary); border-color: var(--blue-light); background: var(--blue-soft); }
.topbar-btn.active { color: var(--blue-primary); background: var(--blue-soft); border-color: color-mix(in srgb, var(--sc-brand) 30%, transparent); }

.live-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
}
.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--blue-primary), var(--blue-dark));
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 4px 12px var(--blue-glow);
}
.mobile-menu { display: none; border: 0; background: transparent; cursor: pointer; color: var(--muted); }

/* Main Content Area */
.content { padding: 32px 32px 40px; }
.page { display: none; max-width: 1280px; margin: 0 auto; }
.page.active { display: block; animation: page-in .2s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes page-in { from { opacity: .2; transform: translateY(6px); } }

/* Welcome Hero Section */
.welcome-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 32px;
  margin-bottom: 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--surface) 96%, var(--blue-primary)) 0%, var(--surface) 100%);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.welcome-hero::after {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--blue-soft) 0%, transparent 70%);
  pointer-events: none;
}
.welcome-hero__text { flex: 1; min-width: 0; }
.welcome-hero__text h2 { margin: 6px 0 8px; font-size: clamp(22px, 2.2vw, 30px); font-weight: 800; letter-spacing: -.8px; }
.welcome-hero__text p { margin: 0; color: var(--muted); font-size: 14px; max-width: 640px; }

.hero-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--surface);
}
.hero-badge--green { border-color: rgba(37,211,102,.3); background: rgba(37,211,102,.08); color: #0a8f4a; }
.hero-badge--blue { border-color: color-mix(in srgb, var(--badge-blue) 30%, transparent); background: var(--badge-blue-soft); color: var(--badge-blue); }
.hero-badge--violet { border-color: rgba(99,102,241,.3); background: rgba(99,102,241,.08); color: #6366f1; }

.welcome-hero__actions { display: flex; flex-direction: column; gap: 10px; flex-shrink: 0; }

.secondary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--surface);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .18s ease;
}
.secondary-button:hover { background: var(--surface-soft); border-color: var(--blue-primary); color: var(--blue-primary); }

.primary-button, .login-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue-primary), var(--blue-dark));
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 16px var(--blue-glow);
  cursor: pointer;
  transition: all .18s ease;
}
.primary-button { padding: 12px 20px; }
.primary-button:hover, .login-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--blue-glow);
  opacity: 0.96;
}

/* Notices */
.notice { position: relative; display: flex; align-items: flex-start; gap: 14px; padding: 16px 20px; border: 1px solid; border-radius: 14px; }
.notice--info { border-color: color-mix(in srgb, var(--sc-brand) 25%, transparent); background: var(--blue-soft); }
.notice.margin-top { margin-top: 24px; }
.notice__icon { display: grid; place-items: center; flex: 0 0 26px; height: 26px; border-radius: 50%; color: #fff; background: var(--blue-primary); }
.notice strong { font-size: 13px; font-weight: 700; }
.notice p { margin: 2px 0 0; padding-right: 28px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.notice__close { position: absolute; top: 12px; right: 14px; border: 0; color: var(--muted); background: transparent; font-size: 20px; cursor: pointer; }

/* Dashboard Metrics Grid */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 24px 0; }
.metric-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 150px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.metric-card:hover {
  transform: translateY(-4px);
  border-color: var(--blue-primary);
  box-shadow: 0 12px 32px color-mix(in srgb, var(--sc-brand) 12%, transparent);
}
.metric-card__header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.metric-card__icon { display: grid; place-items: center; flex: 0 0 44px; height: 44px; border-radius: 14px; }
.metric-card__icon--green { color: #00a884; background: rgba(0,168,132,.12); }
.metric-card__icon--blue { color: var(--badge-blue); background: var(--badge-blue-soft); }
.metric-card__icon--violet { color: #6366f1; background: rgba(99,102,241,.12); }
.metric-card__icon--amber { color: #d97706; background: rgba(245,158,11,.12); }
.metric-card__icon--red { color: #dc2626; background: rgba(220,38,38,.12); }

.metric-trend { padding: 4px 9px; border-radius: 12px; font-size: 10.5px; font-weight: 700; }
.metric-trend.green { color: #0a8f4a; background: rgba(37,211,102,.12); }
.metric-trend.blue { color: var(--badge-blue); background: var(--badge-blue-soft); }
.metric-trend.violet { color: #6366f1; background: rgba(99,102,241,.12); }
.metric-trend.amber { color: #d97706; background: rgba(245,158,11,.12); }
.metric-trend.red { color: #b91c1c; background: rgba(220,38,38,.12); }
.metric-card--urgent {
  border-color: rgba(220, 38, 38, 0.28);
  background: linear-gradient(180deg, rgba(254, 242, 242, 0.9), var(--surface));
}
.metric-card--urgent:hover {
  border-color: #dc2626;
  box-shadow: 0 12px 32px rgba(220, 38, 38, 0.14);
}

.metric-card__body { margin: 14px 0 10px; }
.metric-card__body span { display: block; color: var(--muted); font-size: 12.5px; font-weight: 600; margin-bottom: 4px; }
.metric-card__body strong { display: block; font-size: 30px; font-weight: 800; line-height: 1.1; letter-spacing: -1px; }

.metric-card__footer { display: flex; align-items: center; justify-content: space-between; border-top: 1px dashed var(--line); padding-top: 10px; }
.metric-card__footer small { color: var(--muted); font-size: 11px; }
.metric-card__link { color: var(--blue-primary); font-size: 11.5px; font-weight: 700; transition: color .15s; }
.metric-card:hover .metric-card__link { color: var(--blue-dark); text-decoration: underline; }

/* Dashboard Overview Grid */
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); gap: 20px; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.panel__header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 22px 14px; }
.panel__header h3 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -.3px; }
.panel__header p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.panel-badge-btn { padding: 6px 12px; border: 1px solid var(--line); border-radius: 20px; color: var(--ink); background: var(--surface-soft); font-size: 11.5px; font-weight: 600; cursor: pointer; transition: all .15s; }
.panel-badge-btn:hover { background: var(--blue-soft); border-color: var(--blue-light); color: var(--blue-primary); }
.text-button { padding: 6px 12px; border: 0; border-radius: 8px; color: var(--blue-primary); background: var(--blue-soft); font-size: 12px; font-weight: 700; cursor: pointer; transition: all .15s; }
.text-button:hover { background: var(--blue-primary); color: white; }

/* Analytics Modal Popup */
.modal-overlay {
  position: fixed;
  z-index: 250;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.modal-overlay.visible { opacity: 1; pointer-events: auto; }

.analytics-modal {
  position: fixed;
  z-index: 260;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -46%) scale(0.96);
  width: min(640px, 92vw);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  opacity: 0;
  pointer-events: none;
  transition: transform .22s cubic-bezier(0.16, 1, 0.3, 1), opacity .22s ease;
  overflow: hidden;
}
.analytics-modal.open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  pointer-events: auto;
}
.analytics-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.analytics-modal__header h2 { margin: 0; font-size: 18px; font-weight: 800; }
.analytics-modal__header p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.analytics-modal__body { padding: 24px; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.chart { display: flex; align-items: stretch; height: 210px; padding: 20px 24px 22px; border-top: 1px solid var(--line); }
.chart-column { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-width: 24px; }
.chart-bar-wrap { display: flex; align-items: flex-end; width: 48%; height: 132px; border-radius: 6px 6px 3px 3px; background: var(--surface-soft); overflow: hidden; }
.chart-bar { width: 100%; min-height: 3px; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, var(--blue-light), var(--blue-primary)); transition: height .4s cubic-bezier(0.16, 1, 0.3, 1); }
.chart-column small { margin-top: 10px; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: capitalize; }
.chart-value { height: 16px; color: var(--muted); font-size: 11px; font-weight: 700; }
.recent-list { border-top: 1px solid var(--line); }
.recent-item { display: flex; width: 100%; align-items: center; gap: 12px; padding: 12px 20px; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); text-align: left; cursor: pointer; transition: background .15s; }
.recent-item:last-child { border-bottom: 0; }
.recent-item:hover { background: var(--surface-soft); }

/* Chats Section Layout */
.content.content--chats { padding: 0; }
.content--chats .chats-page { max-width: none; margin: 0; }
.chats-page { height: calc(100vh - 72px); height: calc(100dvh - 72px); min-height: 0; overflow: hidden; }
.chat-layout {
  --chat-sidebar-width: 390px;
  display: grid;
  grid-template-columns: var(--chat-sidebar-width) 5px minmax(0, 1fr);
  height: 100%;
  max-height: 100%;
  background: var(--surface);
  overflow: hidden;
}

/* Chat Sidebar (Left Pane) */
.chat-sidebar { display: flex; flex-direction: column; min-width: 0; height: 100%; min-height: 0; overflow: hidden; border-right: 1px solid var(--line); background: var(--surface); }
.chat-sidebar__header { display: flex; align-items: center; justify-content: space-between; min-height: 72px; padding: 16px 20px 12px; }
.chat-sidebar__header h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.6px; }
.chat-sidebar__header p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
  transition: all .15s;
}
.icon-button:hover { color: var(--sc-brand); border-color: color-mix(in srgb, var(--sc-brand) 25%, transparent); background: var(--sc-brand-soft); }
.chat-header-actions { display: flex; gap: 6px; }

.chat-resizer { position: relative; z-index: 4; width: 5px; cursor: col-resize; background: var(--surface-soft); touch-action: none; }
.chat-resizer::after { content: ""; position: absolute; inset: 0 1px; background: var(--line); transition: background .15s; }
.chat-resizer:hover::after, .chat-resizer.dragging::after { background: var(--blue-primary); }

.chat-layout.chat-list-collapsed { grid-template-columns: 84px 5px minmax(0, 1fr); }
.chat-sidebar.collapsed .chat-sidebar__header { justify-content: center; padding-inline: 10px; }
.chat-sidebar.collapsed .chat-sidebar__header > div:first-child,
.chat-sidebar.collapsed #refreshChats,
.chat-sidebar.collapsed .search-box,
.chat-sidebar.collapsed .chat-filters,
.chat-sidebar.collapsed .chat-item__body { display: none; }
.chat-sidebar.collapsed .chat-item { justify-content: center; padding-inline: 8px; }

/* Search Box & Filters */
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 18px 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  transition: all .18s;
}
.search-box span { color: var(--muted); display: inline-flex; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 13px; }
.search-box:focus-within { border-color: var(--sc-brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sc-brand) 16%, transparent); background: var(--surface); }

.chat-filters { display: flex; gap: 6px; padding: 0 18px 14px; border-bottom: 1px solid var(--line); }
.filter-button {
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: 18px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all .15s;
}
.filter-button:hover { color: var(--ink); background: var(--surface-soft); }
.filter-button.active { color: var(--sc-brand); background: var(--sc-brand-soft); border-color: color-mix(in srgb, var(--sc-brand) 22%, transparent); font-weight: 700; }

/* Chat Items List */
.chat-list { flex: 1 1 0%; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.chat-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 74px;
  padding: 14px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.chat-item:hover { background: var(--surface-soft); }
.chat-item.active { background: var(--sc-brand-soft); border-left: 3px solid var(--sc-brand); }

.client-avatar, .empty-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 46px;
  height: 46px;
  border-radius: 50%;
  color: var(--blue-primary);
  background: var(--blue-soft);
  font-size: 14px;
  font-weight: 800;
  border: 1px solid color-mix(in srgb, var(--sc-brand) 20%, transparent);
}
.empty-avatar { color: var(--muted); background: var(--surface-soft); border-color: var(--line); }

.chat-item__body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.chat-item__top, .chat-item__bottom { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.chat-item__name-row { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; }
.chat-item__top strong { min-width: 0; overflow: hidden; color: var(--ink); font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.chat-item__top time { color: var(--muted); font-size: 11px; flex-shrink: 0; }
.chat-item__tags { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.chat-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
}
.tag--manager { background: var(--green-soft); color: var(--green-online); border: 1px solid rgba(16, 185, 129, 0.3); }
.tag--ai { background: var(--ai-soft); color: var(--ai-indigo); border: 1px solid rgba(99, 102, 241, 0.3); }
.tag--hot { background: var(--red-soft); color: var(--red-danger); font-weight: 800; }
.tag--warm { background: var(--amber-soft); color: var(--amber-warning); font-weight: 700; }

.chat-item__bottom { margin-top: 2px; }
.chat-item__preview { flex: 1; min-width: 0; overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.chat-item__action-hint {
  display: inline-block;
  margin-top: 4px;
  color: var(--blue-primary);
  font-size: 11px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-empty { margin: auto; padding: 48px 24px; color: var(--muted); text-align: center; }
.list-empty > span { display: block; margin-bottom: 10px; font-size: 28px; }
.list-empty strong { color: var(--ink); font-size: 13px; }
.list-empty p { margin: 6px 0 0; font-size: 11px; line-height: 1.5; }

/* Conversation View Pane (Center) */
.conversation { display: flex; flex-direction: column; min-width: 0; height: 100%; min-height: 0; overflow: hidden; background: var(--bg); position: relative; }
.conversation__header {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 12px;
  min-height: 72px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
  overflow: hidden;
}
.conversation__person { min-width: 0; flex: 1 1 0%; overflow: hidden; cursor: pointer; }
.conversation__person strong { display: block; overflow: hidden; font-size: 16px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.conversation__person > span { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.conversation__header .client-avatar { cursor: pointer; flex-shrink: 0; }

.presence-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
}
.presence-tag.typing {
  color: var(--blue-primary);
  font-weight: 600;
}
.presence-tag.typing .typing-dots i { background: currentColor; }

.typing-preview {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #0a8f4a;
  font-weight: 600;
}
html[data-theme="dark"] .typing-preview { color: #25d366; }

.chat-item__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 2px;
}

.chat-unread-badge {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  max-width: 20px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  background: #25d366 !important;
  color: #ffffff !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  box-shadow: 0 2px 6px rgba(37,211,102,.35) !important;
  flex: 0 0 20px !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
}
.chat-unread-badge.multi-digit {
  width: auto !important;
  min-width: 20px !important;
  max-width: none !important;
  padding: 0 6px !important;
  border-radius: 10px !important;
}

.back-button { display: none; border: 0; background: transparent; cursor: pointer; color: var(--muted); }

.mode-switch {
  display: flex;
  flex-shrink: 0;
  margin-left: auto;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}
.mode-switch__option {
  padding: 8px 14px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.mode-switch__option:hover:not(.active) { color: var(--ink); }
.mode-switch__option:disabled { cursor: wait; opacity: .6; }
.mode-switch__option.active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(11,20,26,.12);
}
.mode-switch__option.active[data-mode="ai"] { color: #0a8f4a; background: rgba(37,211,102,.14); }
.mode-switch__option.active[data-mode="manager"] { color: #b3690a; background: rgba(245,158,11,.16); }
html[data-theme="dark"] .mode-switch__option.active[data-mode="ai"] { color: #4ad2a4; background: rgba(37,211,102,.16); }
html[data-theme="dark"] .mode-switch__option.active[data-mode="manager"] { color: #f5a623; background: rgba(245,158,11,.18); }

/* On mobile, wrap the mode-switch below the name/phone */
@media (max-width: 760px) {
  .conversation__header {
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    row-gap: 6px;
    min-height: auto;
    padding: calc(6px + env(safe-area-inset-top, 0px)) 12px 8px;
  }
  .back-button {
    flex-shrink: 0;
    order: 0;
  }
  .conversation__header .client-avatar {
    flex-shrink: 0;
    order: 1;
  }
  .conversation__person {
    flex: 1 1 0%;
    order: 2;
    min-width: 0;
  }
  .mode-switch {
    order: 3;
    flex: 0 0 100%;
    margin-left: 0;
    justify-content: center;
  }
  .mode-switch__option { flex: 1; justify-content: center; text-align: center; padding: 7px 8px; font-size: 11px; }
}

/* Client Profile Panel */
.profile-panel {
  position: fixed;
  z-index: 200;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(360px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 32px rgba(0,0,0,.18);
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}
.profile-panel.open { transform: none; }
.profile-panel__overlay {
  position: fixed;
  z-index: 190;
  inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.profile-panel__overlay.visible { opacity: 1; pointer-events: auto; }

.profile-panel__header {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 64px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex-shrink: 0;
}
.profile-panel__header h2 { margin: 0; font-size: 17px; font-weight: 800; flex: 1; }
.profile-panel__close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--muted);
  cursor: pointer;
  transition: background .15s;
}
.profile-panel__close:hover { background: var(--line); color: var(--ink); }

.profile-panel__body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.profile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 24px 24px;
  background: linear-gradient(180deg, var(--blue-soft) 0%, transparent 100%);
}
.profile-hero__avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 800;
  color: white;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
}
.profile-hero__name { font-size: 20px; font-weight: 800; text-align: center; }
.profile-hero__phone { font-size: 13px; color: var(--muted); }

.profile-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.profile-section h3 { margin: 0 0 12px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.profile-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.profile-row:last-child { border-bottom: 0; }
.profile-row__icon { flex: 0 0 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue-primary); }
.profile-row__label { font-size: 11px; color: var(--muted); }
.profile-row__value { font-size: 13px; font-weight: 600; color: var(--ink); margin-top: 1px; word-break: break-all; }

.profile-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.profile-action-btn:hover { background: var(--blue-soft); color: var(--blue-primary); border-color: color-mix(in srgb, var(--sc-brand) 20%, transparent); }
.profile-action-btn:disabled { opacity: .55; cursor: wait; }
.profile-action-btn--danger { color: #dc2626; border-color: rgba(220,38,38,.25); background: rgba(220,38,38,.06); }
.profile-action-btn--danger:hover { color: #b91c1c; border-color: rgba(220,38,38,.4); background: rgba(220,38,38,.12); }
.profile-delete-hint { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; line-height: 1.45; text-align: center; }

/* WhatsApp Messages Feed Canvas */
.messages {
  flex: 1 1 0%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px clamp(16px, 3vw, 48px) 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background-color: #f4f1f4;
  background-image:
    radial-gradient(circle at 18% 12%, color-mix(in srgb, var(--sc-brand) 05%, transparent), transparent 28%),
    radial-gradient(circle at 88% 82%, rgba(139, 92, 246, .05), transparent 26%);
}
html[data-theme="dark"] .messages {
  background-color: #111827;
  background-image:
    radial-gradient(circle at 18% 12%, color-mix(in srgb, var(--sc-brand) 08%, transparent), transparent 30%),
    radial-gradient(circle at 88% 82%, rgba(139, 92, 246, .07), transparent 28%);
}

.conversation-empty { max-width: 360px; margin: auto; padding: 32px; color: var(--muted); text-align: center; }
.conversation-empty__icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  color: var(--sc-brand);
  background: var(--sc-brand-soft);
}
.conversation-empty h3 { margin: 0; color: var(--ink); font-size: 16px; font-weight: 700; }
.conversation-empty p { margin: 8px 0 0; font-size: 12px; line-height: 1.6; }

/* Message Bubbles */
.message-row {
  display: flex;
  flex-direction: column;
  max-width: min(72%, 560px);
  position: relative;
}
.date-divider {
  position: sticky;
  z-index: 3;
  top: 8px;
  align-self: center;
  margin: 10px 0 6px;
  padding: 5px 12px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 1px 4px rgba(15, 23, 42, .06);
  font-size: 11px;
  font-weight: 650;
  backdrop-filter: blur(10px);
}
html[data-theme="dark"] .date-divider { background: rgba(17, 24, 39, .78); }
.message-row.in { align-self: flex-start; align-items: flex-start; }
.message-row.out { align-self: flex-end; align-items: flex-end; }

.bubble {
  min-width: 92px;
  max-width: 100%;
  padding: 8px 10px 6px 12px;
  border: 0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
}
.bubble__body {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-end;
  column-gap: 10px;
  row-gap: 2px;
}
.message-row.in .bubble { border-bottom-left-radius: 5px; }
.message-row.out .bubble {
  border-bottom-right-radius: 5px;
  background: var(--sc-brand-soft);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--sc-brand) 08%, transparent);
}
html[data-theme="dark"] .bubble { background: #1f2937; }
html[data-theme="dark"] .message-row.out .bubble { background: color-mix(in srgb, var(--sc-brand) 22%, #1f2937); }

.message-text {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.bubble__meta {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  gap: 5px;
  margin: 0 0 -1px auto;
  color: #8b93a0;
  line-height: 1;
  white-space: nowrap;
}
.bubble time { font-size: 11px; font-variant-numeric: tabular-nums; letter-spacing: .01em; }

.msg-author-chip {
  display: inline-flex;
  align-items: center;
  height: 16px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
}
.msg-author-chip.ai { color: #6d28d9; background: rgba(139, 92, 246, .14); }
.msg-author-chip.manager { color: color-mix(in srgb, var(--sc-brand) 70%, black); background: color-mix(in srgb, var(--sc-brand) 12%, transparent); }
html[data-theme="dark"] .msg-author-chip.ai { color: #c4b5fd; }
html[data-theme="dark"] .msg-author-chip.manager { color: color-mix(in srgb, var(--sc-brand) 70%, white); }

.message-status { display: inline-flex; align-items: center; justify-content: center; color: #9aa3af; }
.message-status.read { color: #0ea5e9; }
.message-status.failed {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  color: white;
  background: var(--red-danger);
  font-size: 10px;
  font-weight: 800;
}
.bubble img,
.bubble video {
  display: block;
  flex: 1 1 100%;
  max-width: min(100%, 380px);
  margin: 0 0 4px;
  border-radius: 10px;
}
.bubble__body > .voice-message,
.bubble__body > .document-card { flex: 1 1 100%; }

/* Toolbar: edit / delete / AI rating — outside the bubble */
.msg-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-height: 22px;
  margin: 0 2px 4px;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity .15s ease, transform .15s ease;
  pointer-events: none;
}
.message-row:hover .msg-toolbar,
.message-row:focus-within .msg-toolbar { opacity: 1; transform: none; pointer-events: auto; }
.msg-actions { display: inline-flex; align-items: center; gap: 4px; }
.msg-action-btn {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
  cursor: pointer;
  transition: all .15s;
}
.msg-action-btn:hover { color: var(--sc-brand); border-color: color-mix(in srgb, var(--sc-brand) 28%, transparent); transform: scale(1.05); }

.ai-rating {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .78);
  border: 1px solid var(--line);
}
.ai-rate-btn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  opacity: .55;
  transition: opacity .15s, background .15s, transform .15s;
}
.ai-rate-btn:hover { opacity: 1; background: rgba(15, 23, 42, .05); }
.ai-rate-btn.is-on { opacity: 1; background: var(--sc-brand-soft); transform: none; }

.edited-label { color: var(--muted); font-size: 10px; font-style: italic; }
.bubble--deleted { background: transparent !important; border: 1px dashed var(--line) !important; box-shadow: none !important; }
.message-text--deleted { color: var(--muted); font-style: italic; }

.msg-edit-form { display: flex; flex-direction: column; gap: 8px; min-width: 220px; }
.msg-edit-input {
  width: 100%;
  min-height: 60px;
  padding: 8px 10px;
  border: 1px solid var(--blue-light);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  font: inherit;
  font-size: 14px;
  resize: vertical;
}
.msg-edit-actions { display: flex; justify-content: flex-end; gap: 8px; }
.msg-edit-actions button { padding: 5px 12px; border: none; border-radius: 8px; font-size: 12px; font-weight: 700; cursor: pointer; }
.msg-edit-cancel { color: var(--muted); background: var(--surface-soft); }
.msg-edit-save { color: white; background: var(--blue-primary); }

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 6px 24px;
  border-top: 1px solid var(--line);
  color: var(--blue-primary);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
}
.typing-dots { display: flex; align-items: center; gap: 4px; }
.typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: typing-bounce 1.2s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: .18s; }
.typing-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes typing-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }

/* Composer Input Area */
.composer { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface); }
.composer__row { display: flex; align-items: flex-end; gap: 10px; }
.composer textarea {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  max-height: 130px;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: 0;
  color: var(--ink);
  background: var(--surface-soft);
  font-size: 14px;
  line-height: 1.45;
  resize: none;
  overflow-y: auto;
  transition: border-color .15s, box-shadow .15s;
}
.composer textarea:focus { border-color: var(--sc-brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sc-brand) 16%, transparent); background: var(--surface); }
.composer textarea:disabled { opacity: .6; cursor: not-allowed; }

.composer button {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  color: white;
  background: linear-gradient(135deg, var(--sc-brand), var(--sc-brand-hover));
  cursor: pointer;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--sc-brand) 28%, transparent);
  transition: all .18s ease;
}
.composer button:hover:not(:disabled) { transform: scale(1.05); }
.composer button:disabled { color: var(--muted); background: var(--surface-soft); box-shadow: none; cursor: not-allowed; }

.composer__attach {
  display: grid !important;
  place-items: center !important;
  flex: 0 0 44px !important;
  width: 44px !important;
  height: 44px !important;
  border-radius: 50% !important;
  color: var(--muted) !important;
  background: var(--surface-soft) !important;
  box-shadow: none !important;
  cursor: pointer !important;
  transition: all .18s ease !important;
}
.composer__attach:hover:not(:disabled) {
  color: var(--sc-brand) !important;
  background: var(--sc-brand-soft) !important;
  transform: scale(1.06) !important;
}
.composer__attach:disabled {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
}

.composer small { display: block; min-height: 14px; margin: 6px 4px 0; color: var(--muted); font-size: 11px; }

/* Document & Media Attachment Card */
.document-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: min(240px, 70vw);
  max-width: 320px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--blue-primary) 20%, transparent);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  margin-bottom: 4px;
}
.document-card__icon {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: var(--blue-primary);
  background: color-mix(in srgb, var(--blue-primary) 12%, transparent);
}
.document-card__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.document-card__name {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.document-card__meta {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}
.document-card__download {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--blue-primary);
  background: var(--surface-soft);
  text-decoration: none;
  transition: all .15s ease;
}
.document-card__download:hover {
  color: white;
  background: var(--blue-primary);
  transform: translateY(-1px);
}

/* Drag & Drop File Overlay */
.drag-drop-overlay {
  position: absolute;
  z-index: 100;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  pointer-events: none;
  animation: drag-drop-fade .2s ease;
}
@keyframes drag-drop-fade { from { opacity: 0; } }

.drag-drop-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  max-width: 380px;
  width: 100%;
  padding: 32px 24px;
  border: 2px dashed var(--blue-primary);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  transform: scale(0.96);
  animation: drag-drop-pop .2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes drag-drop-pop { to { transform: scale(1); } }

.drag-drop-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  color: var(--blue-primary);
  background: color-mix(in srgb, var(--blue-primary) 12%, transparent);
  box-shadow: 0 0 20px var(--blue-glow);
}
.drag-drop-box strong { font-size: 17px; font-weight: 800; color: var(--ink); }
.drag-drop-box p { font-size: 13px; color: var(--muted); margin: 0; }

/* Voice message bubble (player + waveform) */
.voice-message {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 220px;
  padding: 2px 0;
  user-select: none;
  box-sizing: border-box;
}
.voice-message__play {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  color: white;
  background: linear-gradient(135deg, var(--blue-primary), var(--blue-dark));
  cursor: pointer;
  box-shadow: 0 2px 8px var(--blue-glow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.voice-message__play:hover {
  transform: scale(1.05);
}
.voice-message__play:active {
  transform: scale(0.95);
}
.voice-message__play svg { pointer-events: none; }
.voice-message__play .icon-play { margin-left: 2px; }

.voice-message__wave {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  overflow: hidden; /* ABSOLUTE MUST: Prevents waveform bars from spilling out of container! */
}
.voice-message__bars {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
  box-sizing: border-box;
}
.voice-message__bars span {
  flex: 1 1 0px;
  min-width: 1px;
  max-width: 3px;
  height: var(--h, 20%);
  border-radius: 2px;
  background: currentColor;
  transition: height .12s ease;
}
.voice-message__bars--base {
  color: color-mix(in srgb, var(--ink) 25%, transparent);
}
html[data-theme="dark"] .voice-message__bars--base {
  color: rgba(255, 255, 255, 0.25);
}
.voice-message__bars--fill {
  color: var(--blue-primary);
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.1s linear;
}

.voice-message__time {
  flex: 0 0 auto;
  min-width: 30px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  line-height: 1;
}

/* Voice Message Transcript Quote Block */
.message-text--transcript {
  margin-top: 8px;
  padding: 6px 10px;
  border-left: 2.5px solid var(--blue-primary);
  border-radius: 0 8px 8px 0;
  background: color-mix(in srgb, var(--blue-primary) 8%, transparent);
  color: var(--ink);
  font-size: 12.5px;
  font-style: normal;
  line-height: 1.45;
}
.message-text--transcript small {
  display: block;
  margin-bottom: 2px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--blue-primary);
}

/* Composer Voice Recording State */
.voice-recorder {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 4px 12px;
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 16px;
  background: rgba(239, 68, 68, 0.04);
  animation: voice-recorder-slide .2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes voice-recorder-slide {
  from { opacity: 0; transform: translateY(4px); }
}

.voice-recorder__cancel, .voice-recorder__send {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: all .18s ease;
}
.voice-recorder__cancel {
  color: var(--muted);
  background: var(--surface-soft);
}
.voice-recorder__cancel:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  transform: scale(1.05);
}
.voice-recorder__send {
  color: white;
  background: linear-gradient(135deg, var(--blue-primary), var(--blue-dark));
  box-shadow: 0 4px 14px var(--blue-glow);
}
.voice-recorder__send:hover {
  transform: scale(1.06);
}

.voice-recorder__status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.voice-recorder__dot {
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
  animation: voice-recorder-pulse 1.2s ease-in-out infinite;
}
.voice-recorder__timer {
  flex: 0 0 auto;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.voice-recorder__hint {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.voice-recorder__wave-anim {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 16px;
  flex: 0 0 auto;
}
.voice-recorder__wave-anim span {
  width: 3px;
  border-radius: 2px;
  background: #ef4444;
  animation: voice-wave-anim 1s ease-in-out infinite alternate;
}
.voice-recorder__wave-anim span:nth-child(1) { height: 6px; animation-delay: 0.1s; }
.voice-recorder__wave-anim span:nth-child(2) { height: 14px; animation-delay: 0.25s; }
.voice-recorder__wave-anim span:nth-child(3) { height: 10px; animation-delay: 0.4s; }
.voice-recorder__wave-anim span:nth-child(4) { height: 16px; animation-delay: 0.15s; }
.voice-recorder__wave-anim span:nth-child(5) { height: 8px; animation-delay: 0.3s; }

@keyframes voice-wave-anim {
  0% { transform: scaleY(0.4); }
  100% { transform: scaleY(1); }
}
@keyframes voice-recorder-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.8); }
}

/* Loading & Toast States */
.message-loading { display: flex; align-items: center; justify-content: center; gap: 10px; margin: auto; padding: 28px; color: var(--muted); font-size: 12px; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--blue-primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton { height: 52px; margin: 10px 18px; border-radius: 12px; background: linear-gradient(90deg, var(--surface-soft) 25%, var(--surface-hover) 50%, var(--surface-soft) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; }
.skeleton--chart { width: 100%; height: 140px; margin: 0; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Compact Interactive Toast Notification Card */
.toast {
  position: fixed;
  z-index: 900;
  right: 20px;
  bottom: 20px;
  width: min(calc(100vw - 32px), 280px);
  padding: 8px 12px;
  border-radius: 14px;
  color: var(--ink);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  font-size: 12px;
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  pointer-events: none;
  backdrop-filter: blur(12px);
  transition: all .2s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.visible { opacity: 1; transform: none; pointer-events: auto; }

.toast-card { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.toast-avatar { flex: 0 0 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 12px; }
.toast-body { flex: 1; min-width: 0; }
.toast-header { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.toast-header strong { font-size: 12px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast-header time { font-size: 10px; color: var(--muted); }
.toast-text { margin-top: 1px; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast-arrow { color: var(--muted); display: flex; align-items: center; justify-content: center; flex: 0 0 16px; transition: transform .15s, color .15s; }
.toast-card:hover .toast-arrow { color: var(--blue-primary); transform: translateX(2px); }
.toast-simple { padding: 4px 6px; text-align: center; font-weight: 600; font-size: 12px; }

.mobile-overlay { display: none; }
.mobile-bottom-nav { display: none; }

/* Login Page Styling */
.login-page { background: var(--bg); }
.login-shell { display: grid; grid-template-columns: minmax(360px, 43%) 1fr; min-height: 100vh; min-height: 100dvh; }
.login-aside {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 40px clamp(36px, 5vw, 76px);
  color: white;
  background: radial-gradient(circle at 85% 15%, color-mix(in srgb, var(--sc-brand) 30%, transparent), transparent 40%), linear-gradient(145deg, #070a12, #0b141a);
  overflow: hidden;
}
.login-aside::after {
  content: "";
  position: absolute;
  right: -130px;
  bottom: -160px;
  width: 440px;
  height: 440px;
  border: 1px solid color-mix(in srgb, var(--sc-brand) 15%, transparent);
  border-radius: 50%;
  box-shadow: 0 0 0 70px color-mix(in srgb, var(--sc-brand) 3%, transparent), 0 0 0 140px color-mix(in srgb, var(--sc-brand) 1.5%, transparent);
}
.brand--light { padding: 0; }
.login-aside__content { position: relative; z-index: 1; max-width: 440px; margin: auto 0; padding: 60px 0; }
.eyebrow--light { color: var(--blue-light); }
.login-aside h1 { margin: 0; font-size: clamp(36px, 4vw, 56px); font-weight: 800; line-height: 1.08; letter-spacing: -2px; }
.login-aside__content > p { max-width: 410px; margin: 20px 0 36px; color: #8696a0; font-size: 14px; line-height: 1.65; }
.login-feature { display: flex; align-items: flex-start; gap: 14px; margin-top: 18px; }
.login-feature > span { display: grid; place-items: center; flex: 0 0 26px; height: 26px; border-radius: 50%; color: var(--blue-light); background: color-mix(in srgb, var(--sc-brand) 16%, transparent); font-size: 12px; font-weight: 800; }
.login-feature strong, .login-feature small { display: block; }
.login-feature strong { color: #e9edef; font-size: 13px; font-weight: 600; }
.login-feature small { margin-top: 3px; color: #8696a0; font-size: 11px; }
.login-copyright { position: relative; z-index: 1; color: #8696a0; font-size: 11px; }

.login-main { display: grid; place-items: center; padding: 40px; background: var(--bg); }
.login-card { width: min(100%, 400px); padding: 36px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.login-card h2 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -1px; }
.login-card__lead { margin: 8px 0 28px; color: var(--muted); font-size: 13px; }
.field { display: block; margin-bottom: 18px; }
.field > span:first-child { display: block; margin-bottom: 8px; color: var(--ink); font-size: 12px; font-weight: 700; }
.field input { width: 100%; height: 46px; padding: 0 16px; border: 1px solid var(--line); border-radius: 12px; outline: 0; color: var(--ink); background: var(--surface-soft); font-size: 14px; transition: all .15s; }
.field input:focus { border-color: var(--blue-primary); box-shadow: 0 0 0 3px var(--blue-glow); background: var(--surface); }
.password-wrap { position: relative; display: block; }
.password-wrap input { padding-right: 46px; }
.password-wrap button { position: absolute; top: 0; right: 4px; width: 40px; height: 46px; border: 0; color: var(--muted); background: transparent; cursor: pointer; }
.login-button { width: 100%; height: 48px; margin-top: 10px; font-size: 14px; }
.security-note { display: flex; align-items: flex-start; justify-content: center; gap: 10px; margin-top: 24px; color: var(--muted); text-align: left; }
.security-note p { margin: 0; font-size: 11px; line-height: 1.45; }
.login-alert { display: none; align-items: center; gap: 10px; margin: -10px 0 20px; padding: 12px 14px; border: 1px solid rgba(234,67,53,.3); border-radius: 10px; color: #ea4335; background: rgba(234,67,53,.08); }
.login-alert.visible { display: flex; }
.login-alert > span { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: white; background: #ea4335; font-size: 11px; font-weight: 800; }
.login-alert p { margin: 0; font-size: 12px; }
.login-mobile-brand { display: none; }

/* Responsive Mobile Phone Styling (< 760px) */
@media (max-width: 1050px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .overview-grid { grid-template-columns: 1fr; }
  .chat-layout { --chat-sidebar-width: min(350px, 40vw); }
}

@media (max-width: 1180px) {
  /* На средних ширинах (нетбук/половина экрана) topbar__right может не влезать
     в одну строку и переносится — убираем текстовую подпись темы и сужаем gap,
     чтобы контролы оставались в один ряд. */
  .theme-toggle__text { display: none; }
  .theme-toggle { width: 40px; padding: 0; justify-content: center; }
  .topbar__right { gap: 8px; }
  .live-pill { display: none; }
}

@media (max-width: 760px) {
  /* Workspace & Topbar — sidebar open/overlay live in ui-system.css */
  .topbar {
    height: 60px;
    padding: 0 12px;
    gap: 8px;
    justify-content: space-between;
  }
  .topbar h1 { font-size: 17px; font-weight: 800; }
  .mobile-menu { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 10px; flex-shrink: 0; }
  .topbar p { display: none; }
  .topbar__right { gap: 6px; margin-left: 0; }

  /* Content & Dashboard Overview */
  .content { padding: 16px 12px calc(76px + env(safe-area-inset-bottom, 0px)); }
  .welcome-hero {
    flex-direction: column;
    align-items: stretch;
    padding: 20px 16px;
    gap: 16px;
  }
  .welcome-hero__actions {
    flex-direction: row;
    gap: 8px;
  }
  .welcome-hero__actions .primary-button,
  .welcome-hero__actions .secondary-button {
    flex: 1;
    padding: 10px 12px;
    font-size: 12px;
  }
  .metrics { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .metric-card { padding: 14px; min-height: 130px; }
  .metric-card__body strong { font-size: 24px; }
  .metric-trend { font-size: 9.5px; padding: 3px 6px; }

  @media (max-width: 480px) {
    .welcome-hero__actions { flex-direction: column; }
    .metrics { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .metric-card { padding: 12px 10px; min-height: 120px; }
    .metric-card__body strong { font-size: 20px; }
    .metric-card__footer small { font-size: 9.5px; }
    .metric-card__link { font-size: 10px; }
  }

  /* Chats Page Layout */
  .chats-page { height: calc(100vh - 122px); height: calc(100dvh - 60px - 60px - env(safe-area-inset-bottom, 0px)); min-height: 0; }
  .chat-layout { position: relative; display: block; height: 100%; }
  .chat-resizer { display: none; }
  .chat-sidebar { height: 100%; border: 0; background: var(--surface); }
  .chat-sidebar__header { min-height: 60px; padding: 12px 14px 8px; }
  #chatSidebarToggle { display: none; }

  .chat-filters {
    overflow-x: auto;
    padding: 0 14px 10px;
    gap: 6px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .chat-filters::-webkit-scrollbar { display: none; }
  .filter-button { flex-shrink: 0; }

  /* Full Screen Mobile Conversation View */
  .conversation {
    position: fixed;
    z-index: 100;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    transform: translateX(100%);
    transition: transform .22s cubic-bezier(0.16, 1, 0.3, 1);
    background: var(--bg);
  }
  .conversation.mobile-open { transform: translateX(0); }

  .conversation__header {
    height: auto;
    min-height: auto;
    padding: calc(6px + env(safe-area-inset-top, 0px)) 12px 6px;
    gap: 8px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    flex-shrink: 0;
  }
  .back-button { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--surface-soft); color: var(--ink); }

  .messages { gap: 8px; padding: 12px 10px 14px; flex: 1 1 0%; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .message-row { max-width: 88%; }
  .msg-toolbar { opacity: 1; transform: none; pointer-events: auto; min-height: 20px; }
  .ai-rate-btn { width: 30px; height: 24px; }

  .composer {
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
    gap: 8px;
    border-top: 1px solid var(--line);
    background: var(--surface);
    flex-shrink: 0;
  }
  .composer textarea { font-size: 16px !important; line-height: 1.35; min-height: 42px; max-height: 120px; border-radius: 20px; padding: 10px 14px; }

  .voice-message {
    min-width: min(200px, 68vw);
    gap: 8px;
  }
  .voice-message__play {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
  }
  .voice-message__time {
    font-size: 10.5px;
    min-width: 30px;
  }
  .voice-recorder {
    padding: 4px 8px;
    gap: 8px;
  }
  .voice-recorder__hint { display: none; }
  .voice-recorder__cancel, .voice-recorder__send {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
  }

  /* Background Page Lock when Chat is Open on Mobile */
  body.mobile-conversation-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
  }
  body.mobile-conversation-open .topbar,
  body.mobile-conversation-open .mobile-bottom-nav { display: none !important; }

  /* Toast Notification Placement */
  .toast {
    z-index: 120;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: calc(100vw - 24px);
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
  body.mobile-conversation-open .toast {
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  /* Mobile Bottom Navigation Bar */
  .mobile-bottom-nav {
    position: fixed;
    z-index: 90;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    height: calc(60px + env(safe-area-inset-bottom, 0px));
    padding: 4px 12px env(safe-area-inset-bottom, 0px);
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(16px);
  }
  .mobile-nav-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 48px;
    border: 0;
    border-radius: 12px;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    text-decoration: none;
  }
  .mobile-nav-item small { font-size: 11px; font-weight: 700; }
  .mobile-nav-item.active { color: var(--sc-brand); }
  .mobile-nav-item i {
    position: absolute;
    top: 4px;
    left: calc(50% + 10px);
    min-width: 18px;
    padding: 2px 5px;
    border-radius: 10px;
    color: white;
    background: var(--sc-brand);
    font-size: 9px;
    font-style: normal;
    font-weight: 700;
  }

  /* Mobile Login Page */
  .login-shell { display: block; }
  .login-aside { display: none; }
  .login-main { min-height: 100dvh; padding: 24px 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
  .login-mobile-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 32px; }
}

@media (max-width: 480px) {
  .live-pill { display: none; }
  .topbar__right { gap: 4px; }
  .theme-toggle__text { display: none; }
  .theme-toggle { width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: 10px; }
  .topbar-btn { width: 36px; height: 36px; flex-shrink: 0; }
  .avatar { width: 32px; height: 32px; font-size: 12px; flex-shrink: 0; }
}

/* Shared production UI layer: the inbox and CRM use the same visual grammar.
   Placed last on purpose — these are theme overrides for selectors that are
   fully defined earlier in the file; keeping this block last guarantees it wins
   the cascade instead of being silently shadowed by the base rules above. */
.app-shell { background: var(--sc-bg); }
.navigation { background: #111827; }
.workspace { min-width: 0; }
.topbar { border-bottom-color: var(--sc-border); background: color-mix(in srgb, var(--sc-surface) 94%, transparent); }
.welcome-hero { border-radius: var(--sc-radius-lg); box-shadow: var(--sc-shadow-sm); }
.panel, .metric-card, .chat-sidebar, .chat-main, .customer-info, .list-panel { box-shadow: var(--sc-shadow-sm); }
.metric-card, .panel { border-radius: var(--sc-radius-md); }
.primary-button, .primary-button-sm { background: var(--sc-brand); background-image: none; box-shadow: var(--sc-shadow-sm); }
.primary-button:hover, .primary-button-sm:hover { background: var(--sc-brand-hover); transform: translateY(-1px); }
.secondary-button, .topbar-btn, .theme-toggle { border-radius: var(--sc-radius-sm); }
.nav-item.active {
  background: color-mix(in srgb, var(--sc-brand) 16%, transparent);
  border-color: transparent;
  color: #fff;
  box-shadow: inset 3px 0 0 var(--sc-brand);
}
.status-dot.online, .status-dot.connected { background: var(--sc-success); }
.toast, .toast-simple { border-radius: var(--sc-radius-sm); box-shadow: var(--sc-shadow-md); }
