/* ===== DESIGN TOKENS ===== */
:root {
  --color-primary-50: #effcf6;
  --color-primary-100: #c6f7e2;
  --color-primary-200: #8eedc7;
  --color-primary-300: #65d6ad;
  --color-primary-400: #3ebd93;
  --color-primary-500: #199473;
  --color-primary-600: #147d64;
  --color-primary-700: #0c6b58;
  --color-primary-800: #0a5a4c;
  --color-primary-900: #084c41;

  --color-secondary-500: #4fc3f7;
  --color-secondary-600: #0d98d9;
  --color-secondary-soft: #e8f7fe;

  --color-neutral-0: #ffffff;
  --color-neutral-25: #fdfdfb;
  --color-neutral-50: #f5f5f3;
  --color-neutral-100: #ebebea;
  --color-neutral-200: #dddcda;
  --color-neutral-300: #c4c3c0;
  --color-neutral-400: #9a9994;
  --color-neutral-500: #73726d;
  --color-neutral-600: #545350;
  --color-neutral-700: #373634;
  --color-neutral-800: #222120;
  --color-neutral-900: #141413;

  --color-info: #2777f8;
  --color-info-light: #edf4ff;
  --color-info-border: #bfd5ff;
  --color-warning: #db8a1b;
  --color-warning-light: #fff7e8;
  --color-warning-border: #f5d39a;
  --color-danger: #d84d5e;
  --color-danger-light: #fff0f2;
  --color-danger-border: #f7bec8;

  --font-sans: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', 'Fira Code', Consolas, monospace;
  --text-xs: 0.6875rem;
  --text-sm: 0.8125rem;
  --text-base: 0.875rem;
  --text-md: 0.9375rem;
  --text-lg: 1.0625rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

  --space-0: 0;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  --shadow-xs: 0 1px 2px rgba(20, 19, 17, 0.04);
  --shadow-sm: 0 10px 24px rgba(26, 23, 18, 0.06);
  --shadow-md: 0 18px 36px rgba(26, 23, 18, 0.09);
  --shadow-lg: 0 28px 50px rgba(26, 23, 18, 0.12);
  --shadow-xl: 0 34px 64px rgba(26, 23, 18, 0.14);
  --shadow-modal: 0 34px 80px rgba(12, 12, 10, 0.26);
  --shadow-focus: 0 0 0 3px rgba(25, 148, 115, 0.16);
  --shadow-focus-blue: 0 0 0 3px rgba(39, 119, 248, 0.16);

  --transition-fast: 120ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;

  --z-dropdown: 50;
  --z-sticky: 60;
  --z-sidebar: 70;
  --z-overlay: 80;
  --z-modal: 100;
  --z-toast: 200;

  --sidebar-width: 272px;
  --sidebar-collapsed: 0px;
}

/* ===== DARK MODE ===== */
[data-theme="dark"] {
  --color-neutral-0: #131515;
  --color-neutral-25: #171919;
  --color-neutral-50: #1c1f1f;
  --color-neutral-100: #252828;
  --color-neutral-200: #323534;
  --color-neutral-300: #474b48;
  --color-neutral-400: #7c807b;
  --color-neutral-500: #9b9f99;
  --color-neutral-600: #c7cbc5;
  --color-neutral-700: #dde1da;
  --color-neutral-800: #f1f3ef;
  --color-neutral-900: #fafbf8;
  --color-info-light: rgba(39, 119, 248, 0.12);
  --color-info-border: rgba(39, 119, 248, 0.28);
  --color-warning-light: rgba(219, 138, 27, 0.12);
  --color-warning-border: rgba(219, 138, 27, 0.28);
  --color-danger-light: rgba(216, 77, 94, 0.12);
  --color-danger-border: rgba(216, 77, 94, 0.28);
  --color-primary-50: rgba(25, 148, 115, 0.15);
  --color-primary-100: rgba(25, 148, 115, 0.25);
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.24);
  --shadow-sm: 0 16px 30px rgba(0,0,0,0.24);
  --shadow-md: 0 20px 40px rgba(0,0,0,0.3);
  --shadow-lg: 0 28px 56px rgba(0,0,0,0.34);
  --shadow-modal: 0 34px 80px rgba(0,0,0,0.55);
}

/* ===== RESET ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: var(--font-sans);
  background: radial-gradient(circle at top, rgba(25,148,115,0.1), transparent 30%), linear-gradient(180deg, #f5f7f5 0%, #eff2ef 100%);
  color: var(--color-neutral-800);
  min-height: 100vh;
  line-height: var(--leading-normal);
  font-size: var(--text-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}
[data-theme="dark"] body {
  background: radial-gradient(circle at top, rgba(25,148,115,0.12), transparent 28%), linear-gradient(180deg, #111313 0%, #171919 100%);
}

.app-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.app-bg-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(26px);
  opacity: 0.55;
}
.orb-a {
  width: 22rem;
  height: 22rem;
  top: -8rem;
  right: -4rem;
  background: radial-gradient(circle, rgba(25,148,115,0.24) 0%, rgba(25,148,115,0) 70%);
}
.orb-b {
  width: 18rem;
  height: 18rem;
  bottom: -7rem;
  left: -3rem;
  background: radial-gradient(circle, rgba(79,195,247,0.22) 0%, rgba(79,195,247,0) 72%);
}
.app-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(55, 54, 52, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(55, 54, 52, 0.05) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.65), transparent 85%);
}
[data-theme="dark"] .app-bg-grid {
  background-image:
    linear-gradient(rgba(199, 203, 197, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(199, 203, 197, 0.04) 1px, transparent 1px);
}

/* ===== APP LAYOUT ===== */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: linear-gradient(180deg, rgba(255,255,255,0.82), rgba(255,255,255,0.7));
  border-right: 1px solid rgba(196, 195, 192, 0.45);
  box-shadow: 1px 0 0 rgba(255,255,255,0.55);
  backdrop-filter: blur(22px);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: var(--z-sidebar);
  transition: transform var(--transition-slow);
}
[data-theme="dark"] .sidebar {
  background: linear-gradient(180deg, rgba(19,21,21,0.92), rgba(19,21,21,0.82));
  border-right-color: rgba(71, 75, 72, 0.7);
  box-shadow: 1px 0 0 rgba(255,255,255,0.02);
}
.sidebar-header {
  padding: var(--space-4) var(--space-4) var(--space-3);
  border-bottom: 1px solid rgba(196, 195, 192, 0.4);
  flex-shrink: 0;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.sidebar-logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background:
    radial-gradient(circle at top left, rgba(255,255,255,0.4), transparent 35%),
    linear-gradient(135deg, var(--color-primary-500), var(--color-primary-700));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 10px 24px rgba(25,148,115,0.22);
}
.sidebar-title { font-size: 1rem; font-weight: 800; color: var(--color-neutral-900); letter-spacing: -0.03em; }
.sidebar-sub { font-size: var(--text-xs); color: var(--color-neutral-500); letter-spacing: 0.04em; text-transform: uppercase; }
.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-3);
}
.nav-section-label {
  font-size: 10px;
  font-weight: var(--weight-semibold);
  color: var(--color-neutral-500);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  padding: var(--space-3) var(--space-3) var(--space-2);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: 0.65rem 0.95rem;
  border-radius: 12px;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-neutral-600);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}
.nav-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(25,148,115,0.08), rgba(79,195,247,0.08));
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.nav-item:hover { background: rgba(255,255,255,0.5); color: var(--color-neutral-800); }
.nav-item:hover::before { opacity: 1; }
.nav-item.active {
  background: linear-gradient(135deg, rgba(25,148,115,0.14), rgba(79,195,247,0.12));
  color: var(--color-neutral-900);
  font-weight: var(--weight-semibold);
  box-shadow: inset 0 0 0 1px rgba(25,148,115,0.16);
}
.nav-item > * { position: relative; z-index: 1; }
.nav-item svg { flex-shrink: 0; opacity: 0.78; }
.nav-item.active svg { opacity: 1; }
.nav-badge {
  margin-left: auto;
  background: linear-gradient(135deg, var(--color-danger), #c73649);
  color: white;
  font-size: 10px;
  font-weight: var(--weight-bold);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  line-height: 1.4;
}
.sidebar-footer {
  padding: var(--space-3) var(--space-4) var(--space-4);
  border-top: 1px solid rgba(196, 195, 192, 0.35);
  flex-shrink: 0;
}
.sidebar-session-card {
  border: 1px solid rgba(196, 195, 192, 0.42);
  border-radius: 18px;
  background: rgba(255,255,255,0.58);
  padding: 0.65rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5);
}
[data-theme="dark"] .sidebar-session-card {
  background: rgba(19,21,21,0.5);
  border-color: rgba(71, 75, 72, 0.74);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.sidebar-session-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}
.sidebar-action-btn {
  width: 100%;
  min-height: 30px;
  justify-content: center;
  background: rgba(255,255,255,0.45);
  border-color: rgba(196, 195, 192, 0.38);
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: calc(var(--z-sidebar) - 1);
}

/* ===== MOBILE HEADER ===== */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: rgba(255,255,255,0.78);
  border-bottom: 1px solid rgba(196, 195, 192, 0.4);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}
.mobile-header-brand { display: flex; flex-direction: column; align-items: center; }
.mobile-header-title { font-weight: 800; letter-spacing: -0.03em; }
.mobile-header-sub { font-size: 10px; color: var(--color-neutral-500); text-transform: uppercase; letter-spacing: 0.12em; }

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6) var(--space-8) var(--space-8);
  max-height: 100vh;
}
#page-content { max-width: 1200px; margin: 0 auto; }

.shell-hero {
  max-width: 1200px;
  margin: 0 auto var(--space-4);
  padding: 1.35rem 1.45rem 1.25rem;
  border-radius: 26px;
  border: 1px solid rgba(196, 195, 192, 0.42);
  background:
    radial-gradient(circle at top right, rgba(25,148,115,0.14), transparent 26%),
    radial-gradient(circle at bottom left, rgba(79,195,247,0.14), transparent 28%),
    linear-gradient(135deg, rgba(255,255,255,0.86), rgba(250,252,250,0.76));
  box-shadow: var(--shadow-md);
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  gap: var(--space-3);
  align-items: end;
}
[data-theme="dark"] .shell-hero {
  background:
    radial-gradient(circle at top right, rgba(25,148,115,0.18), transparent 26%),
    radial-gradient(circle at bottom left, rgba(79,195,247,0.16), transparent 28%),
    linear-gradient(135deg, rgba(28,31,31,0.9), rgba(19,21,21,0.84));
  border-color: rgba(71, 75, 72, 0.78);
}
.shell-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.38rem 0.75rem;
  border-radius: 999px;
  background: rgba(20,19,17,0.05);
  color: var(--color-neutral-600);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 700;
  margin-bottom: var(--space-3);
}
[data-theme="dark"] .shell-kicker { background: rgba(255,255,255,0.06); }
.shell-page-title {
  font-size: clamp(1.8rem, 2vw + 1rem, 3.2rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
  margin-bottom: 0.45rem;
  color: var(--color-neutral-900);
}
.shell-page-subtitle {
  max-width: 62ch;
  font-size: 0.98rem;
  color: var(--color-neutral-500);
}
.shell-hero-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}
.shell-meta-card {
  min-height: 88px;
  border-radius: 18px;
  border: 1px solid rgba(196, 195, 192, 0.42);
  background: rgba(255,255,255,0.66);
  padding: 0.95rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
[data-theme="dark"] .shell-meta-card {
  background: rgba(19,21,21,0.6);
  border-color: rgba(71, 75, 72, 0.74);
}
.shell-meta-card:last-child { grid-column: span 2; }
.shell-meta-label {
  color: var(--color-neutral-500);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 700;
}
.shell-meta-card strong {
  font-size: 1.05rem;
  color: var(--color-neutral-900);
  letter-spacing: -0.04em;
}

.page-surface {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.3rem;
  border-radius: 28px;
  border: 1px solid rgba(196, 195, 192, 0.4);
  background: rgba(255,255,255,0.68);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .page-surface {
  background: rgba(19,21,21,0.62);
  border-color: rgba(71, 75, 72, 0.74);
}

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  gap: var(--space-3);
}
.page-title { font-size: var(--text-2xl); font-weight: var(--weight-bold); color: var(--color-neutral-900); letter-spacing: -0.02em; }
.page-subtitle { font-size: var(--text-sm); color: var(--color-neutral-500); margin-top: 2px; }

/* ===== DASHBOARD ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.stat-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.88), rgba(255,255,255,0.72));
  border: 1px solid rgba(196, 195, 192, 0.42);
  border-radius: 22px;
  padding: var(--space-5);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  inset: auto -20% -55% auto;
  width: 7rem;
  height: 7rem;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(25,148,115,0.12), transparent 68%);
}
.stat-card:hover { box-shadow: var(--shadow-md); border-color: rgba(62, 189, 147, 0.45); transform: translateY(-1px); }
.stat-label { font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--color-neutral-500); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: var(--text-3xl); font-weight: 800; color: var(--color-neutral-900); margin-top: 2px; letter-spacing: -0.05em; }
.stat-card.stat-primary { box-shadow: inset 0 0 0 1px rgba(25,148,115,0.08); }
.stat-card.stat-info { box-shadow: inset 0 0 0 1px rgba(39,119,248,0.08); }
.stat-card.stat-warning { box-shadow: inset 0 0 0 1px rgba(219,138,27,0.08); }
.stat-card.stat-danger { box-shadow: inset 0 0 0 1px rgba(216,77,94,0.08); }

[data-theme="dark"] .stat-card {
  background: linear-gradient(180deg, rgba(28,31,31,0.88), rgba(19,21,21,0.72));
  border-color: rgba(71, 75, 72, 0.6);
}

/* ===== CONVERSATIONS ===== */
/* Chat layout */
.chat-layout { display: flex; height: calc(100vh - 260px); min-height: 400px; border-radius: 16px; overflow: hidden; background: rgba(255,255,255,0.6); border: 1px solid rgba(196,195,192,0.38); }
.chat-sidebar { width: 320px; min-width: 260px; border-right: 1px solid rgba(196,195,192,0.38); display: flex; flex-direction: column; background: rgba(255,255,255,0.8); }
.chat-sidebar-header { padding: 12px; border-bottom: 1px solid rgba(196,195,192,0.25); }
.chat-search { width: 100%; padding: 8px 12px; border: 1px solid rgba(196,195,192,0.38); border-radius: 10px; font-size: var(--text-sm); background: rgba(255,255,255,0.9); outline: none; }
.chat-search:focus { border-color: var(--color-primary-400); }
.chat-contacts { flex: 1; overflow-y: auto; }
.chat-contact { display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; transition: background 0.15s; border-bottom: 1px solid rgba(196,195,192,0.15); }
.chat-contact:hover { background: rgba(62,189,147,0.06); }
.chat-contact-active { background: rgba(62,189,147,0.12); }
.chat-contact-info { flex: 1; min-width: 0; }
.chat-contact-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.chat-contact-name { font-weight: var(--weight-medium); font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-contact-time { font-size: 11px; color: var(--color-neutral-400); flex-shrink: 0; }
.chat-contact-preview { font-size: var(--text-xs); color: var(--color-neutral-400); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; display: flex; align-items: center; gap: 4px; }
.chat-unread-badge { background: var(--color-primary-500); color: #fff; font-size: 11px; font-weight: 600; min-width: 18px; height: 18px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; flex-shrink: 0; }
.chat-agent-tag { font-size: 10px; background: rgba(62,189,147,0.15); color: var(--color-primary-700); padding: 1px 6px; border-radius: 4px; flex-shrink: 0; }
.chat-paused-tag { font-size: 10px; background: rgba(239,68,68,0.12); color: #dc2626; padding: 1px 6px; border-radius: 4px; flex-shrink: 0; }
.conversation-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--color-primary-100); display: flex; align-items: center; justify-content: center; font-weight: var(--weight-semibold); font-size: var(--text-sm); color: var(--color-primary-700); flex-shrink: 0; }
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-header { display: flex; align-items: center; padding: 14px 20px; border-bottom: 1px solid rgba(196,195,192,0.25); background: rgba(255,255,255,0.9); }
.chat-header-name { font-weight: var(--weight-semibold); font-size: var(--text-base); flex: 1; }
.chat-header-right { display: flex; align-items: center; gap: 8px; }
.chat-ai-badge { font-size: 12px; padding: 3px 10px; border-radius: 12px; font-weight: 500; }
.chat-ai-badge.active { background: rgba(62,189,147,0.15); color: #1a8a5e; }
.chat-ai-badge.paused { background: rgba(242,84,91,0.12); color: #d94148; }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 8px; background: rgba(240,240,235,0.3); }
.chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--color-neutral-400); gap: 12px; }
.chat-bubble { max-width: 70%; padding: 10px 14px; border-radius: 16px; font-size: var(--text-sm); line-height: 1.45; word-wrap: break-word; }
.chat-bubble-in { align-self: flex-start; background: #fff; border: 1px solid rgba(196,195,192,0.3); border-bottom-left-radius: 4px; }
.chat-bubble-out { align-self: flex-end; background: rgba(62,189,147,0.12); border: 1px solid rgba(62,189,147,0.25); border-bottom-right-radius: 4px; }
.chat-bubble-text { white-space: pre-wrap; }
.chat-bubble audio { display: block; width: 100%; min-width: 240px; height: 40px; margin: 4px 0; border-radius: 20px; }
.chat-bubble img { display: block; border-radius: 6px; }
.chat-bubble video { display: block; border-radius: 6px; }
.chat-bubble-meta { font-size: 11px; color: var(--color-neutral-400); margin-top: 4px; text-align: right; }
.chat-bubble { position: relative; }
.chat-bubble-deleted { opacity: 0.6; }
.chat-bubble-deleted .chat-bubble-text { font-style: italic; color: var(--color-neutral-400); }
.chat-quote { background: rgba(0,0,0,0.04); border-left: 3px solid var(--primary, #3ebd93); border-radius: 6px; padding: 4px 8px; margin-bottom: 4px; cursor: pointer; font-size: 12px; }
.chat-quote-name { font-weight: 600; font-size: 11px; color: var(--primary, #3ebd93); }
.chat-quote-text { color: var(--color-neutral-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 250px; }
[data-theme="dark"] .chat-quote { background: rgba(255,255,255,0.06); }
.chat-msg-menu-btn { position: absolute; top: 4px; right: 4px; background: none; border: none; cursor: pointer; font-size: 16px; color: var(--color-neutral-400); opacity: 0; transition: opacity 0.15s; padding: 2px 4px; line-height: 1; border-radius: 4px; }
.chat-bubble:hover .chat-msg-menu-btn { opacity: 1; }
.chat-msg-menu-btn:hover { background: rgba(0,0,0,0.06); color: var(--text); }
.chat-msg-popup { position: fixed; background: var(--card-bg, #fff); border: 1px solid rgba(0,0,0,0.12); border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); z-index: 1000; min-width: 140px; }
.chat-msg-reactions { display: flex; gap: 2px; padding: 6px 8px; border-bottom: 1px solid rgba(0,0,0,0.08); }
.chat-msg-reactions button { background: none; border: none; cursor: pointer; font-size: 18px; padding: 2px 4px; border-radius: 6px; transition: background 0.15s; }
.chat-msg-reactions button:hover { background: rgba(0,0,0,0.06); }
.chat-msg-popup > button { display: block; width: 100%; text-align: left; padding: 8px 14px; border: none; background: none; cursor: pointer; font-size: 13px; color: var(--text); }
.chat-msg-popup > button:hover { background: rgba(0,0,0,0.04); }
.chat-bubble-reactions { display: flex; gap: 2px; position: absolute; bottom: -10px; right: 8px; }
.chat-bubble-in .chat-bubble-reactions { left: 8px; right: auto; }
.chat-reaction { display: inline-flex; align-items: center; font-size: 14px; background: var(--card-bg, #fff); border-radius: 10px; padding: 1px 5px; box-shadow: 0 1px 4px rgba(0,0,0,0.15); cursor: default; line-height: 1.4; }
.chat-bubble:has(.chat-bubble-reactions) { margin-bottom: 14px; }
[data-theme="dark"] .chat-reaction { background: #2a2a2a; box-shadow: 0 1px 4px rgba(0,0,0,0.4); }
.chat-emoji-more-btn { font-size: 16px !important; font-weight: bold; color: var(--color-neutral-400) !important; }
.chat-emoji-picker { position: absolute; bottom: 100%; left: 0; width: 300px; max-height: 320px; display: flex; flex-direction: column; background: var(--card-bg, #fff); border: 1px solid rgba(0,0,0,0.12); border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); margin-bottom: 4px; overflow: hidden; }
[data-theme="dark"] .chat-emoji-picker { background: #2a2a2a; border-color: rgba(255,255,255,0.1); }
.chat-emoji-search { width: 100%; padding: 6px 10px; border: none; border-bottom: 1px solid rgba(0,0,0,0.08); font-size: 13px; outline: none; background: transparent; color: var(--text); }
.chat-emoji-body { overflow-y: auto; flex: 1; max-height: 280px; }
.chat-emoji-cat-title { font-size: 11px; font-weight: 600; color: var(--color-neutral-400); padding: 6px 10px 2px; position: sticky; top: 0; background: inherit; }
.chat-emoji-grid { display: flex; flex-wrap: wrap; padding: 2px 6px; }
.chat-emoji-grid button { background: none; border: none; cursor: pointer; font-size: 22px; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 6px; transition: background 0.1s; }
.chat-emoji-grid button:hover { background: rgba(0,0,0,0.06); }
[data-theme="dark"] .chat-msg-popup { background: #2a2a2a; border-color: rgba(255,255,255,0.1); }
[data-theme="dark"] .chat-msg-reactions button:hover, [data-theme="dark"] .chat-msg-popup > button:hover { background: rgba(255,255,255,0.08); }
[data-theme="dark"] .chat-emoji-grid button:hover { background: rgba(255,255,255,0.1); }
@media (max-width: 768px) {
  .chat-layout { flex-direction: column; height: calc(100vh - 200px); }
  .chat-sidebar { width: 100%; max-height: 40%; border-right: none; border-bottom: 1px solid rgba(196,195,192,0.38); }
  .chat-bubble { max-width: 85%; }
}
[data-theme="dark"] .chat-layout { background: rgba(30,30,30,0.6); border-color: rgba(80,80,80,0.4); }
[data-theme="dark"] .chat-sidebar { background: rgba(30,30,30,0.8); }
[data-theme="dark"] .chat-contact:hover { background: rgba(62,189,147,0.1); }
[data-theme="dark"] .chat-contact-active { background: rgba(62,189,147,0.18); }
[data-theme="dark"] .chat-bubble-in { background: rgba(50,50,50,0.8); border-color: rgba(80,80,80,0.4); }
[data-theme="dark"] .chat-bubble-out { background: rgba(62,189,147,0.18); border-color: rgba(62,189,147,0.3); }
[data-theme="dark"] .chat-messages { background: rgba(20,20,20,0.3); }
[data-theme="dark"] .chat-search { background: rgba(50,50,50,0.6); border-color: rgba(80,80,80,0.4); color: #e0e0e0; }

/* Quick replies */
.chat-quick-replies { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 16px; background: rgba(255,255,255,0.95); border-top: 1px solid rgba(196,195,192,0.2); }
.chat-quick-btn { font-size: 0.78rem; padding: 6px 12px; border: 1px solid rgba(62,189,147,0.3); border-radius: 16px; background: rgba(62,189,147,0.06); color: var(--color-primary-700); cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.chat-quick-btn:hover { background: rgba(62,189,147,0.15); border-color: rgba(62,189,147,0.5); }
[data-theme="dark"] .chat-quick-replies { background: rgba(30,30,30,0.95); }
[data-theme="dark"] .chat-quick-btn { color: var(--color-primary-300); }

/* Notes panel */
.chat-notes-panel { padding: 12px 20px; background: rgba(255,252,240,0.95); border-bottom: 1px solid rgba(196,195,192,0.25); }
[data-theme="dark"] .chat-notes-panel { background: rgba(50,48,40,0.95); }

/* Typing indicator */
.chat-typing { display: flex; gap: 4px; padding: 12px 16px !important; min-height: auto !important; width: fit-content; }
.typing-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(62,189,147,0.5); animation: typingBounce 1.4s infinite ease-in-out; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce { 0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; } 40% { transform: scale(1); opacity: 1; } }

/* Chat input area */
.chat-input-area { display: flex; align-items: flex-end; gap: 8px; padding: 10px 16px; background: rgba(255,255,255,0.9); border-top: 1px solid rgba(196,195,192,0.25); }
.chat-input { flex: 1; border: 1px solid rgba(196,195,192,0.38); border-radius: 10px; padding: 10px 14px; font-size: var(--text-sm); font-family: inherit; resize: none; min-height: 40px; max-height: 120px; outline: none; line-height: 1.35; background: rgba(255,255,255,0.9); }
.chat-input:focus { border-color: var(--color-primary-400); }
.chat-send-btn { background: var(--color-primary-500); border: none; cursor: pointer; padding: 10px; border-radius: 50%; color: #fff; flex-shrink: 0; transition: background 0.15s; }
.chat-send-btn:hover { background: var(--color-primary-600); }
.chat-mic-btn { background: none; border: none; cursor: pointer; padding: 8px; border-radius: 50%; color: var(--color-neutral-500); flex-shrink: 0; transition: background 0.15s; }
.chat-mic-btn:hover { background: rgba(0,0,0,0.06); }
.chat-attach-wrap { position: relative; }
.chat-attach-btn { background: none; border: none; cursor: pointer; padding: 8px; border-radius: 50%; color: var(--color-neutral-500); transition: background 0.15s; }
.chat-attach-btn:hover { background: rgba(0,0,0,0.06); }
.chat-attach-menu { display: none; position: absolute; bottom: 44px; left: 0; background: #fff; border-radius: 12px; box-shadow: 0 2px 16px rgba(0,0,0,0.15); padding: 6px 0; z-index: 10; min-width: 140px; }
.chat-attach-menu.show { display: block; }
.chat-attach-item { display: block; padding: 8px 16px; cursor: pointer; font-size: var(--text-sm); transition: background 0.1s; }
.chat-attach-item:hover { background: rgba(0,0,0,0.04); }

/* Chat recording bar */
.chat-rec-bar { display: none; align-items: center; gap: 10px; padding: 10px 16px; background: rgba(255,255,255,0.95); border-top: 1px solid rgba(196,195,192,0.25); }
.chat-rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #f2545b; animation: chatRecPulse 1s infinite; }
@keyframes chatRecPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
.chat-rec-time { font-size: var(--text-sm); font-variant-numeric: tabular-nums; flex: 1; }

/* Chat file preview bar */
.chat-preview-bar { display: none; align-items: center; gap: 10px; padding: 8px 16px; background: rgba(62,189,147,0.08); border-top: 1px solid rgba(196,195,192,0.25); }
.chat-preview-name { flex: 1; font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Dark mode chat input */
[data-theme="dark"] .chat-input-area { background: rgba(30,30,30,0.9); }
[data-theme="dark"] .chat-input { background: rgba(50,50,50,0.6); border-color: rgba(80,80,80,0.4); color: #e0e0e0; }
[data-theme="dark"] .chat-rec-bar { background: rgba(30,30,30,0.95); }
[data-theme="dark"] .chat-preview-bar { background: rgba(62,189,147,0.1); }
[data-theme="dark"] .chat-attach-menu { background: #2a2a2a; }
[data-theme="dark"] .chat-attach-item:hover { background: rgba(255,255,255,0.06); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  font-family: inherit;
  border: 1px solid rgba(196, 195, 192, 0.48);
  background: rgba(255,255,255,0.76);
  color: var(--color-neutral-700);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  min-height: 36px;
  line-height: 1;
  text-decoration: none;
}
.btn:hover { background: rgba(255,255,255,0.96); border-color: rgba(62, 189, 147, 0.46); box-shadow: var(--shadow-xs); }
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus-blue); }
.btn-primary {
  background: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-700));
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-xs), 0 10px 22px rgba(25,148,115,0.24);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--color-primary-600), var(--color-primary-800));
  box-shadow: var(--shadow-sm), 0 16px 28px rgba(25,148,115,0.28);
}
.btn-danger { background: var(--color-neutral-0); color: var(--color-danger); border-color: var(--color-danger-border); }
.btn-danger:hover { background: var(--color-danger-light); }
.btn-icon { padding: var(--space-2); min-width: 36px; font-size: 15px; }
.btn-sm { padding: 3px var(--space-3); font-size: var(--text-xs); min-height: 28px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--color-neutral-100); }
.btn-blue { background: linear-gradient(135deg, var(--color-info), #2563eb); color: white; border-color: transparent; }
.btn-blue:hover { filter: brightness(0.95); }

/* ===== AGENTS ===== */
.agents-list { display: flex; flex-direction: column; gap: var(--space-3); }
.agent-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.86), rgba(255,255,255,0.74));
  border: 1px solid rgba(196, 195, 192, 0.42);
  border-radius: 24px;
  padding: 1.2rem 1.3rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all var(--transition-base);
  position: relative;
}
.agent-card:hover { box-shadow: var(--shadow-md); border-color: rgba(62, 189, 147, 0.46); transform: translateY(-1px); }
[data-theme="dark"] .agent-card {
  background: linear-gradient(180deg, rgba(28,31,31,0.86), rgba(19,21,21,0.74));
  border-color: rgba(71, 75, 72, 0.6);
}
.agent-avatar {
  width: 48px; height: 48px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4);
}
.agent-avatar.claude { background: linear-gradient(135deg, #fff7ed, #ffedd5); color: #ea580c; }
.agent-avatar.openai { background: linear-gradient(135deg, #f0fdf4, #dcfce7); color: #16a34a; }
.agent-avatar.gemini { background: linear-gradient(135deg, #eff6ff, #dbeafe); color: #2563eb; }
.agent-avatar.groq { background: linear-gradient(135deg, #faf5ff, #f3e8ff); color: #9333ea; }
.agent-avatar.openrouter { background: linear-gradient(135deg, #ecfeff, #cffafe); color: #0891b2; }
.agent-avatar.nvidia { background: linear-gradient(135deg, #f0fdf4, #d9f99d); color: #65a30d; }
[data-theme="dark"] .agent-avatar.claude { background: linear-gradient(135deg, #431407, #7c2d12); }
[data-theme="dark"] .agent-avatar.openai { background: linear-gradient(135deg, #14532d, #166534); }
[data-theme="dark"] .agent-avatar.gemini { background: linear-gradient(135deg, #1e3a5f, #1e40af); }
[data-theme="dark"] .agent-avatar.groq { background: linear-gradient(135deg, #3b0764, #6b21a8); }
[data-theme="dark"] .agent-avatar.openrouter { background: linear-gradient(135deg, #164e63, #0e7490); }
[data-theme="dark"] .agent-avatar.nvidia { background: linear-gradient(135deg, #1a2e05, #3f6212); }
.agent-info { flex: 1; min-width: 0; }
.agent-name {
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1.15;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.agent-model {
  font-size: 12px;
  color: var(--color-neutral-400);
  margin-top: 0.18rem;
}
.agent-actions {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex-shrink: 0;
}

/* ===== BADGES ===== */
.badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: var(--radius-sm); font-size: var(--text-xs); font-weight: var(--weight-medium); border: 1px solid; line-height: var(--leading-tight); }
.badge-orange { color: #c2410c; background: #fff7ed; border-color: #fed7aa; }
.badge-green { color: var(--color-primary-700); background: var(--color-primary-50); border-color: rgba(25,148,115,0.2); }
.badge-blue { color: #1d4ed8; background: #eff6ff; border-color: #bfdbfe; }
.badge-red { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }
.badge-purple { color: #7c3aed; background: #faf5ff; border-color: #e9d5ff; }
.badge-cyan { color: #0e7490; background: #ecfeff; border-color: #a5f3fc; }
.badge-lime { color: #4d7c0f; background: #f7fee7; border-color: #d9f99d; }
.badge-neutral { color: var(--color-neutral-600); background: var(--color-neutral-100); border-color: var(--color-neutral-200); }
[data-theme="dark"] .badge-neutral { background: var(--color-neutral-100); border-color: var(--color-neutral-200); color: var(--color-neutral-500); }
[data-theme="dark"] .badge-orange { background: #431407; border-color: #7c2d12; }
[data-theme="dark"] .badge-green { background: #14532d; border-color: #166534; }
[data-theme="dark"] .badge-blue { background: #1e3a5f; border-color: #1e40af; }
[data-theme="dark"] .badge-red { background: #450a0a; border-color: #7f1d1d; color: #fca5a5; }
[data-theme="dark"] .badge-purple { background: #3b0764; border-color: #6b21a8; }

/* ===== TOGGLE ===== */
.toggle { width: 38px; height: 22px; border-radius: var(--radius-full); background: var(--color-neutral-300); cursor: pointer; position: relative; transition: background var(--transition-base); border: none; flex-shrink: 0; }
.toggle.on { background: var(--color-primary-500); }
.toggle::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: white; top: 2px; left: 2px; transition: left var(--transition-base); box-shadow: var(--shadow-xs); }
.toggle.on::after { left: 18px; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,0.4); backdrop-filter: blur(4px);
  z-index: var(--z-modal); display: flex; align-items: flex-start; justify-content: center;
  padding: var(--space-10) var(--space-4); overflow-y: auto;
}
.modal {
  background: var(--color-neutral-0); border-radius: var(--radius-xl); width: 100%; max-width: 640px;
  box-shadow: var(--shadow-modal); animation: modalIn 0.25s cubic-bezier(0.16,1,0.3,1);
  border: 1px solid rgba(196, 195, 192, 0.35);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--color-neutral-200); }
.modal-header h2 { font-size: var(--text-lg); font-weight: var(--weight-semibold); display: flex; align-items: center; gap: var(--space-2); color: var(--color-neutral-900); letter-spacing: -0.01em; }
.modal-header p { font-size: var(--text-sm); color: var(--color-neutral-400); margin-top: 2px; }
.modal-body { padding: var(--space-5) var(--space-6); max-height: 65vh; overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-4) var(--space-6); border-top: 1px solid var(--color-neutral-200); }
.close-btn { width: 32px; height: 32px; border-radius: var(--radius-md); border: none; background: var(--color-neutral-100); cursor: pointer; font-size: 15px; display: flex; align-items: center; justify-content: center; color: var(--color-neutral-500); transition: all var(--transition-fast); flex-shrink: 0; }
.close-btn:hover { background: var(--color-neutral-200); color: var(--color-neutral-700); }

/* ===== FORMS ===== */
.form-group { margin-bottom: var(--space-4); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
label { display: block; font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-neutral-700); margin-bottom: var(--space-1); }
input, select, textarea {
  width: 100%; padding: var(--space-2) var(--space-3); border: 1px solid var(--color-neutral-300); border-radius: var(--radius-md);
  font-size: var(--text-sm); font-family: inherit; transition: all var(--transition-fast); background: rgba(255,255,255,0.82); color: var(--color-neutral-800);
}
input::placeholder, textarea::placeholder { color: var(--color-neutral-400); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--color-primary-400); box-shadow: var(--shadow-focus); }
textarea { resize: vertical; min-height: 80px; }

/* ===== KB / DOCUMENTS ===== */
.kb-item { display: flex; align-items: center; justify-content: space-between; padding: var(--space-3); border: 1px solid var(--color-neutral-200); border-radius: var(--radius-md); margin-bottom: var(--space-2); transition: all var(--transition-fast); }
.kb-item:hover { border-color: var(--color-neutral-300); }
.kb-item .kb-name { font-size: var(--text-sm); font-weight: var(--weight-medium); }
.kb-item .kb-meta { font-size: var(--text-xs); color: var(--color-neutral-400); }

/* ===== SUBSCRIPTION TABLE ===== */
.sub-table { width: 100%; border-collapse: collapse; }
.sub-table th { text-align: left; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--color-neutral-500); text-transform: uppercase; letter-spacing: 0.08em; padding: var(--space-2) var(--space-3); border-bottom: 2px solid var(--color-neutral-200); }
.sub-table td { padding: var(--space-3); border-bottom: 1px solid var(--color-neutral-100); font-size: var(--text-sm); color: var(--color-neutral-800); }
.sub-table tr:hover td { background: rgba(25,148,115,0.03); }

/* ===== USAGE TABLE ===== */
.usage-table { width: 100%; border-collapse: collapse; }
.usage-table th { text-align: left; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--color-neutral-500); text-transform: uppercase; letter-spacing: 0.08em; padding: var(--space-2) var(--space-3); border-bottom: 2px solid var(--color-neutral-200); }
.usage-table td { padding: var(--space-3); border-bottom: 1px solid var(--color-neutral-100); font-size: var(--text-sm); color: var(--color-neutral-800); }
.usage-table tr:hover td { background: rgba(25,148,115,0.03); }

/* ===== WHATSAPP STATUS ===== */
.wa-status-card {
  border: 1px solid rgba(196, 195, 192, 0.42);
  border-radius: 20px;
  background: rgba(255,255,255,0.72);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
[data-theme="dark"] .wa-status-card {
  background: rgba(19,21,21,0.6);
  border-color: rgba(71, 75, 72, 0.74);
}
.wa-status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
}
.wa-status-indicator.online { background: var(--color-primary-500); }
.wa-status-indicator.offline { background: var(--color-danger); }

/* ===== TOAST ===== */
.toast-container { position: fixed; bottom: var(--space-5); right: var(--space-5); z-index: var(--z-toast); display: flex; flex-direction: column; gap: var(--space-2); }
.toast { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); font-size: var(--text-sm); font-weight: var(--weight-medium); color: white; animation: toastIn 0.3s cubic-bezier(0.16,1,0.3,1); box-shadow: var(--shadow-lg); max-width: 360px; }
.toast.success { background: linear-gradient(135deg, var(--color-primary-600), var(--color-primary-700)); }
.toast.error { background: linear-gradient(135deg, var(--color-danger), #dc2626); }
.toast.info { background: linear-gradient(135deg, var(--color-info), #2563eb); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px) scale(0.95); } to { opacity: 1; transform: translateX(0) scale(1); } }

/* ===== PROVIDER LIST ===== */
.provider-list { display: flex; flex-direction: column; gap: var(--space-2); }
.provider-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: linear-gradient(180deg, rgba(255,255,255,0.86), rgba(255,255,255,0.74));
  border: 1px solid rgba(196, 195, 192, 0.42);
  border-radius: 16px;
  transition: all var(--transition-base);
}
.provider-row:hover {
  border-color: rgba(62, 189, 147, 0.46);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
[data-theme="dark"] .provider-row {
  background: linear-gradient(180deg, rgba(28,31,31,0.86), rgba(19,21,21,0.74));
  border-color: rgba(71, 75, 72, 0.6);
}
.provider-row .agent-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: var(--weight-bold); flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4);
}
.provider-row-info { flex: 1; min-width: 0; }
.provider-row-name {
  font-weight: var(--weight-semibold);
  font-size: var(--text-base);
  color: var(--color-neutral-900);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.provider-row-meta {
  font-size: var(--text-xs);
  color: var(--color-neutral-400);
  margin-top: 2px;
}
.provider-row-actions {
  display: flex;
  gap: var(--space-1);
  align-items: center;
  flex-shrink: 0;
}
.provider-delete-btn:hover { color: var(--color-danger) !important; }

/* Modal raw mode (structured header/body/footer inside) */
.modal-raw { padding: 0; }

/* Checkbox toggle */
.checkbox-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; }
.checkbox-row input[type="checkbox"] { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--color-primary-500); cursor: pointer; }
.checkbox-row label { margin: 0; cursor: pointer; font-size: var(--text-sm); color: var(--color-neutral-700); }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: var(--space-16) var(--space-5); }
.empty-icon { font-size: 48px; margin-bottom: var(--space-4); opacity: 0.6; }
.empty-state h3 { font-size: var(--text-xl); font-weight: var(--weight-semibold); margin-bottom: var(--space-2); color: var(--color-neutral-700); }
.empty-state p { font-size: var(--text-base); color: var(--color-neutral-500); margin-bottom: var(--space-5); }

/* ===== SPINNER ===== */
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--color-neutral-200); border-top-color: var(--color-primary-500); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== INFO BOX ===== */
.info-box { background: var(--color-info-light); border: 1px solid var(--color-info-border); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); font-size: var(--text-xs); color: #1e40af; margin-bottom: var(--space-4); display: flex; align-items: flex-start; gap: var(--space-2); }
[data-theme="dark"] .info-box { color: var(--color-info); }

/* ===== SCROLLBAR ===== */
.modal-body::-webkit-scrollbar, .sidebar-nav::-webkit-scrollbar, .main-content::-webkit-scrollbar { width: 6px; }
.modal-body::-webkit-scrollbar-track, .sidebar-nav::-webkit-scrollbar-track, .main-content::-webkit-scrollbar-track { background: transparent; }
.modal-body::-webkit-scrollbar-thumb, .sidebar-nav::-webkit-scrollbar-thumb, .main-content::-webkit-scrollbar-thumb { background: var(--color-neutral-300); border-radius: var(--radius-full); }
.modal-body::-webkit-scrollbar-thumb:hover, .sidebar-nav::-webkit-scrollbar-thumb:hover, .main-content::-webkit-scrollbar-thumb:hover { background: var(--color-neutral-400); }

/* ===== LINKS / CODE ===== */
a { color: var(--color-primary-600); text-decoration: none; }
a:hover { color: var(--color-primary-700); text-decoration: underline; }
code { font-family: var(--font-mono); font-size: 0.9em; background: var(--color-neutral-100); padding: 1px 5px; border-radius: var(--radius-sm); color: var(--color-neutral-700); }

/* ===== AUTH ===== */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  z-index: 2;
}
.auth-card {
  width: min(100%, 420px);
  background: rgba(255,255,255,0.84);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: 28px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
  padding: 1.5rem;
}
[data-theme="dark"] .auth-card {
  background: rgba(15, 23, 42, 0.74);
  border-color: rgba(148, 163, 184, 0.18);
}
.auth-card-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.auth-logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-700));
}
.auth-title {
  font-size: 1.5rem;
  font-weight: var(--weight-bold);
}
.auth-subtitle {
  font-size: var(--text-sm);
  color: var(--color-neutral-500);
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.auth-submit {
  width: 100%;
  justify-content: center;
}
.auth-error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.18);
  color: var(--color-danger);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
  font-size: var(--text-sm);
}
.auth-switch {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-neutral-500);
  margin-top: 0.9rem;
}
.auth-switch a { color: var(--color-primary-600); cursor: pointer; font-weight: var(--weight-medium); }
.auth-switch a:hover { text-decoration: underline; }

.password-field { position: relative; }
.password-field input { padding-right: 2.5rem; }
.password-toggle-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  color: var(--color-neutral-400);
  display: grid;
  place-items: center;
}
.password-toggle-btn:hover { color: var(--color-neutral-600); }

.pending-card { text-align: center; }
.pending-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
}
.pending-card p { color: var(--color-neutral-500); font-size: var(--text-sm); margin-bottom: 1.25rem; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .mobile-header { display: flex; }
  .main-content { padding: var(--space-4); max-height: calc(100vh - 52px); }
  .shell-hero { grid-template-columns: 1fr; padding: 1.1rem; border-radius: 22px; }
  .shell-hero-meta { grid-template-columns: 1fr; }
  .shell-meta-card:last-child { grid-column: auto; }
  .page-surface { padding: 1rem; border-radius: 24px; }
  .form-row { grid-template-columns: 1fr; }
  .modal-overlay { padding: var(--space-4) var(--space-2); }
  .modal { border-radius: var(--radius-lg); }
  .modal-header, .modal-body, .modal-footer { padding-left: var(--space-4); padding-right: var(--space-4); }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .auth-screen { padding: 1rem; }
  .auth-card { border-radius: 22px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .main-content { padding: 0.85rem; }
  .shell-page-title { font-size: 1.9rem; }
}

/* ===== PAGE TRANSITIONS ===== */
@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.page-transition { animation: pageIn 0.32s cubic-bezier(0.16, 1, 0.3, 1) both; }

/* ===== STAGGERED LIST ANIMATION ===== */
@keyframes listItemIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-list > * {
  opacity: 0;
  animation: listItemIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.animate-list > *:nth-child(1) { animation-delay: 0ms; }
.animate-list > *:nth-child(2) { animation-delay: 40ms; }
.animate-list > *:nth-child(3) { animation-delay: 80ms; }
.animate-list > *:nth-child(4) { animation-delay: 120ms; }
.animate-list > *:nth-child(5) { animation-delay: 160ms; }
.animate-list > *:nth-child(6) { animation-delay: 200ms; }
.animate-list > *:nth-child(7) { animation-delay: 240ms; }
.animate-list > *:nth-child(8) { animation-delay: 280ms; }
.animate-list > *:nth-child(9) { animation-delay: 320ms; }
.animate-list > *:nth-child(10) { animation-delay: 360ms; }
.animate-list > *:nth-child(n+11) { animation-delay: 400ms; }

/* ===== SKELETON LOADERS ===== */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--color-neutral-100) 25%, var(--color-neutral-50) 37%, var(--color-neutral-100) 63%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease infinite;
  border-radius: var(--radius-md);
  color: transparent !important;
  user-select: none;
  pointer-events: none;
}
.skeleton * { visibility: hidden; }
.skeleton-card {
  height: 88px;
  border-radius: 22px;
}
.skeleton-row {
  height: 72px;
  border-radius: 16px;
  margin-bottom: var(--space-3);
}
.skeleton-line {
  height: 14px;
  border-radius: 7px;
  margin-bottom: var(--space-2);
}
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-80 { width: 80%; }
[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, var(--color-neutral-100) 25%, var(--color-neutral-200) 37%, var(--color-neutral-100) 63%);
  background-size: 200% 100%;
}

/* ===== STATUS DOT ===== */
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-dot.active {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}
.status-dot.inactive {
  background: var(--color-neutral-300);
}
@keyframes statusPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); }
  50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.08); }
}
.status-dot.active { animation: statusPulse 2.5s ease-in-out infinite; }

/* ===== STAT CARD ENHANCED ===== */
.stat-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-3);
  flex-shrink: 0;
}
.stat-card-icon.primary { background: rgba(25, 148, 115, 0.12); color: var(--color-primary-600); }
.stat-card-icon.info { background: rgba(39, 119, 248, 0.12); color: var(--color-info); }
.stat-card-icon.warning { background: rgba(219, 138, 27, 0.12); color: var(--color-warning); }
.stat-card-icon.danger { background: rgba(216, 77, 94, 0.12); color: var(--color-danger); }
[data-theme="dark"] .stat-card-icon.primary { background: rgba(25, 148, 115, 0.2); }
[data-theme="dark"] .stat-card-icon.info { background: rgba(39, 119, 248, 0.2); }
[data-theme="dark"] .stat-card-icon.warning { background: rgba(219, 138, 27, 0.2); }
[data-theme="dark"] .stat-card-icon.danger { background: rgba(216, 77, 94, 0.2); }

.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: var(--weight-semibold);
  margin-top: var(--space-1);
}
.stat-trend.up { color: #16a34a; }
.stat-trend.down { color: var(--color-danger); }
.stat-trend.neutral { color: var(--color-neutral-400); }

/* Mini sparkline bars */
.sparkline {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 28px;
  margin-top: var(--space-2);
}
.sparkline-bar {
  flex: 1;
  min-width: 4px;
  border-radius: 2px;
  background: var(--color-primary-300);
  transition: height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0.6;
}
.sparkline-bar:last-child { opacity: 1; background: var(--color-primary-500); }

/* ===== TOGGLE GROUP (period selector) ===== */
.toggle-group {
  display: inline-flex;
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-neutral-50);
}
.toggle-group-btn {
  padding: 6px 14px;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  font-family: inherit;
  border: none;
  background: transparent;
  color: var(--color-neutral-500);
  cursor: pointer;
  transition: all var(--transition-fast);
  border-right: 1px solid var(--color-neutral-200);
}
.toggle-group-btn:last-child { border-right: none; }
.toggle-group-btn:hover { color: var(--color-neutral-700); background: var(--color-neutral-100); }
.toggle-group-btn.active {
  background: var(--color-primary-500);
  color: white;
  font-weight: var(--weight-semibold);
}
[data-theme="dark"] .toggle-group { background: var(--color-neutral-100); border-color: var(--color-neutral-200); }
[data-theme="dark"] .toggle-group-btn { border-right-color: var(--color-neutral-200); }

/* ===== CHART ENHANCED ===== */
.chart-bar {
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--color-primary-400), var(--color-primary-600));
  transition: height 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s;
  cursor: pointer;
  position: relative;
  min-width: 8px;
}
.chart-bar:hover {
  opacity: 0.85;
}
.chart-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-neutral-800);
  color: white;
  font-size: 10px;
  font-weight: var(--weight-medium);
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 10;
}
.chart-bar:hover .chart-tooltip { opacity: 1; }
[data-theme="dark"] .chart-tooltip { background: var(--color-neutral-0); color: var(--color-neutral-900); }

/* ===== DONUT CHART ===== */
.donut-chart {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.donut-center {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--color-neutral-0);
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  font-size: 11px;
  font-weight: var(--weight-semibold);
  color: var(--color-neutral-700);
}
.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-xs);
  color: var(--color-neutral-600);
}
.donut-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ===== COLLAPSIBLE ===== */
.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius-lg);
  transition: background var(--transition-fast);
}
.collapsible-header:hover { background: var(--color-neutral-50); }
.collapsible-chevron {
  transition: transform 0.25s ease;
  color: var(--color-neutral-400);
}
.collapsible.open .collapsible-chevron { transform: rotate(180deg); }
.collapsible-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s;
  opacity: 0;
}
.collapsible.open .collapsible-body {
  max-height: 800px;
  opacity: 1;
}

/* ===== NAMESPACE COLORS ===== */
.ns-tag { padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: var(--weight-medium); }
.ns-tag[data-ns="sara-geral"] { background: rgba(25,148,115,0.12); color: #147d64; }
.ns-tag[data-ns="sara-receitas"] { background: rgba(245,158,11,0.12); color: #b45309; }
.ns-tag[data-ns="sara-prato"] { background: rgba(16,185,129,0.12); color: #059669; }
.ns-tag[data-ns="sara-fde"] { background: rgba(139,92,246,0.12); color: #7c3aed; }
.ns-tag[data-ns="sara-detox"] { background: rgba(239,68,68,0.12); color: #dc2626; }
.ns-tag[data-ns="sara-jejum"] { background: rgba(59,130,246,0.12); color: #2563eb; }
.ns-tag[data-ns="sara-menopausa"] { background: rgba(236,72,153,0.12); color: #db2777; }
.ns-tag[data-ns="sara-lowcarb"] { background: rgba(6,182,212,0.12); color: #0891b2; }
[data-theme="dark"] .ns-tag[data-ns="sara-geral"] { background: rgba(25,148,115,0.22); color: #65d6ad; }
[data-theme="dark"] .ns-tag[data-ns="sara-receitas"] { background: rgba(245,158,11,0.22); color: #fbbf24; }
[data-theme="dark"] .ns-tag[data-ns="sara-prato"] { background: rgba(16,185,129,0.22); color: #6ee7b7; }
[data-theme="dark"] .ns-tag[data-ns="sara-fde"] { background: rgba(139,92,246,0.22); color: #c4b5fd; }
[data-theme="dark"] .ns-tag[data-ns="sara-detox"] { background: rgba(239,68,68,0.22); color: #fca5a5; }
[data-theme="dark"] .ns-tag[data-ns="sara-jejum"] { background: rgba(59,130,246,0.22); color: #93c5fd; }
[data-theme="dark"] .ns-tag[data-ns="sara-menopausa"] { background: rgba(236,72,153,0.22); color: #f9a8d4; }
[data-theme="dark"] .ns-tag[data-ns="sara-lowcarb"] { background: rgba(6,182,212,0.22); color: #67e8f9; }

/* ===== KB DOC CARD ===== */
.kb-doc-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.88), rgba(255,255,255,0.72));
  border: 1px solid rgba(196, 195, 192, 0.42);
  border-radius: 16px;
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  transition: all var(--transition-base);
}
.kb-doc-card:hover {
  border-color: rgba(62, 189, 147, 0.46);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
[data-theme="dark"] .kb-doc-card {
  background: linear-gradient(180deg, rgba(28,31,31,0.86), rgba(19,21,21,0.74));
  border-color: rgba(71, 75, 72, 0.6);
}
.kb-doc-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(139, 92, 246, 0.1);
  color: #7c3aed;
  flex-shrink: 0;
}
[data-theme="dark"] .kb-doc-icon { background: rgba(139, 92, 246, 0.2); }
.kb-doc-info { flex: 1; min-width: 0; }
.kb-doc-title { font-weight: var(--weight-semibold); font-size: var(--text-base); }
.kb-doc-meta { font-size: var(--text-xs); color: var(--color-neutral-400); margin-top: 2px; display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.kb-doc-actions { display: flex; gap: var(--space-1); flex-shrink: 0; }

/* ===== PROGRESS BAR ===== */
@keyframes progressPulse {
  0% { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}
.progress-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--color-neutral-200);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--color-primary-400), var(--color-primary-600));
  transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.progress-bar-fill.indeterminate {
  width: 100%;
  background: linear-gradient(90deg, var(--color-primary-300), var(--color-primary-500), var(--color-primary-300));
  background-size: 200% 100%;
  animation: progressPulse 1.5s ease infinite;
}

/* ===== CHIP / TOOL TAG ===== */
.tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: var(--weight-medium);
  background: var(--color-neutral-100);
  color: var(--color-neutral-600);
  border: 1px solid var(--color-neutral-200);
}
.tool-chip svg { width: 12px; height: 12px; }
[data-theme="dark"] .tool-chip { background: var(--color-neutral-100); border-color: var(--color-neutral-200); }

/* ===== ACTIVITY FEED ===== */
.activity-feed { display: flex; flex-direction: column; gap: 0; }
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-neutral-100);
  font-size: var(--text-sm);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}
.activity-dot.inbound { background: var(--color-info); }
.activity-dot.outbound { background: var(--color-primary-500); }
.activity-dot.system { background: var(--color-warning); }
.activity-content { flex: 1; min-width: 0; }
.activity-text { color: var(--color-neutral-700); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-meta { font-size: 11px; color: var(--color-neutral-400); margin-top: 1px; }

/* ===== SYSTEM STATUS ===== */
.system-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
}
.system-status-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-neutral-50);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}
.system-status-item .status-dot { width: 8px; height: 8px; }
[data-theme="dark"] .system-status-item { background: var(--color-neutral-100); }

/* ===== RELATIVE TIME ===== */
.chat-contact-time { font-size: 11px; color: var(--color-neutral-400); flex-shrink: 0; font-variant-numeric: tabular-nums; }

/* ===== WA PULSE ===== */
@keyframes waPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}
.wa-status-indicator.online { animation: waPulse 2s ease-in-out infinite; }

/* ===== QA SEVERITY BORDER ===== */
.qa-report-card {
  border-radius: 14px;
  border: 1px solid var(--color-neutral-200);
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  transition: all var(--transition-base);
  border-left: 4px solid var(--color-neutral-300);
}
.qa-report-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.qa-report-card.severity-low { border-left-color: #22c55e; }
.qa-report-card.severity-medium { border-left-color: #f59e0b; }
.qa-report-card.severity-high { border-left-color: #ef4444; }
[data-theme="dark"] .qa-report-card { border-color: var(--color-neutral-200); background: var(--color-neutral-50); }

/* ===== PROVIDER ICONS ===== */
.provider-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: var(--weight-bold);
  flex-shrink: 0;
}
.provider-icon.anthropic { background: linear-gradient(135deg, #fff7ed, #ffedd5); color: #ea580c; }
.provider-icon.gemini { background: linear-gradient(135deg, #eff6ff, #dbeafe); color: #2563eb; }
.provider-icon.openai { background: linear-gradient(135deg, #f0fdf4, #dcfce7); color: #16a34a; }
.provider-icon.groq { background: linear-gradient(135deg, #faf5ff, #f3e8ff); color: #9333ea; }
.provider-icon.elevenlabs { background: linear-gradient(135deg, #fdf2f8, #fce7f3); color: #db2777; }
.provider-icon.nvidia { background: linear-gradient(135deg, #f7fee7, #d9f99d); color: #65a30d; }
.provider-icon.openrouter { background: linear-gradient(135deg, #ecfeff, #cffafe); color: #0891b2; }
[data-theme="dark"] .provider-icon.anthropic { background: linear-gradient(135deg, #431407, #7c2d12); }
[data-theme="dark"] .provider-icon.gemini { background: linear-gradient(135deg, #1e3a5f, #1e40af); }
[data-theme="dark"] .provider-icon.openai { background: linear-gradient(135deg, #14532d, #166534); }
[data-theme="dark"] .provider-icon.groq { background: linear-gradient(135deg, #3b0764, #6b21a8); }
[data-theme="dark"] .provider-icon.elevenlabs { background: linear-gradient(135deg, #500724, #9d174d); }
[data-theme="dark"] .provider-icon.nvidia { background: linear-gradient(135deg, #1a2e05, #3f6212); }
[data-theme="dark"] .provider-icon.openrouter { background: linear-gradient(135deg, #164e63, #0e7490); }

/* ===== ENTITY TOOLTIP ===== */
.entity-badge {
  position: relative;
  cursor: default;
  display: inline-block;
  background: color-mix(in srgb, var(--entity-color, #64748b) 15%, transparent);
  color: var(--entity-color, #64748b);
  border: 1px solid color-mix(in srgb, var(--entity-color, #64748b) 30%, transparent);
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}
.entity-badge .entity-tip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-neutral-800);
  color: white;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 10;
}
.entity-badge:hover .entity-tip { opacity: 1; }

/* ===== COMMUNITY EXPANDABLE ===== */
.community-card {
  border: 1px solid var(--color-neutral-200);
  border-left: 3px solid var(--color-primary-400);
  border-radius: 10px;
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: all var(--transition-base);
}
.community-card:hover { background: var(--color-neutral-50); }
.community-entities {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, margin 0.3s ease;
  margin-top: 0;
}
.community-card.expanded .community-entities {
  max-height: 200px;
  margin-top: var(--space-3);
}
[data-theme="dark"] .community-card { border-color: var(--color-neutral-200); }
[data-theme="dark"] .community-card:hover { background: var(--color-neutral-100); }

/* Global search panel */
.chat-global-search-panel {
  padding: 10px;
  border-bottom: 1px solid rgba(0,0,0,0.1);
  background: var(--color-bg-card, #fff);
}

/* Tags */
.chat-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-right: 8px;
}
.chat-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 8px;
  font-size: 0.68rem;
  border-radius: 10px;
  background: var(--color-primary-50, #eff6ff);
  color: var(--color-primary-600, #2563eb);
  border: 1px solid var(--color-primary-200, #bfdbfe);
}
[data-theme="dark"] .chat-tag {
  background: rgba(59,130,246,0.15);
  border-color: rgba(59,130,246,0.3);
}
.chat-contact-tags {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.chat-contact-tag {
  font-size: 0.6rem;
  padding: 0 4px;
  border-radius: 6px;
  background: rgba(59,130,246,0.1);
  color: rgba(59,130,246,0.8);
}

/* Search results */
.search-result-item:hover {
  background: rgba(0,0,0,0.03);
}
[data-theme="dark"] .search-result-item:hover {
  background: rgba(255,255,255,0.05);
}
