/* ================================== */
/* DESIGN SYSTEM & CSS VARIABLES      */
/* ================================== */
/* LOGIN SCREEN */
.login-overlay { position: fixed; inset: 0; background: var(--bg-dark); display: flex; align-items: center; justify-content: center; z-index: 10000; }
.login-card { background: var(--card-bg); width: 100%; max-width: 400px; padding: 40px; border-radius: 20px; border: 1px solid var(--border-color); box-shadow: 0 20px 50px rgba(0,0,0,0.5); }
.login-header { text-align: center; margin-bottom: 30px; }
.login-header .logo-icon.large { width: 60px; height: 60px; font-size: 30px; margin: 0 auto 15px; }
.login-error { color: var(--accent-red); margin-top: 15px; font-size: 0.9rem; text-align: center; }
.btn-block { width: 100%; }

:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.8);
  --bg-card-hover: rgba(31, 41, 55, 0.9);
  --bg-sidebar: rgba(10, 14, 26, 0.95);
  --bg-modal: rgba(17, 24, 39, 0.98);
  --bg-input: rgba(31, 41, 55, 0.6);
  --border-color: rgba(75, 85, 99, 0.3);
  --border-active: rgba(0, 104, 255, 0.5);

  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --text-inverse: #0a0e1a;

  --accent-blue: #0068FF;
  --accent-blue-light: #3b8aff;
  --accent-blue-dark: #0050cc;
  --accent-green: #10b981;
  --accent-orange: #f59e0b;
  --accent-red: #ef4444;
  --accent-purple: #8b5cf6;
  --accent-pink: #ec4899;
  --accent-cyan: #06b6d4;

  --gradient-blue: linear-gradient(135deg, #0068FF, #00b4ff);
  --gradient-orange: linear-gradient(135deg, #f59e0b, #ef4444);
  --gradient-green: linear-gradient(135deg, #10b981, #06b6d4);
  --gradient-purple: linear-gradient(135deg, #8b5cf6, #ec4899);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow-blue: 0 0 20px rgba(0,104,255,0.3);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --topbar-height: 68px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ================================== */
/* RESET & BASE                       */
/* ================================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
}

a { color: var(--accent-blue-light); text-decoration: none; }
a:hover { color: var(--accent-blue); }

input, select, textarea, button { font-family: var(--font); }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(75, 85, 99, 0.5); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(107, 114, 128, 0.7); }

/* ================================== */
/* APP LAYOUT                         */
/* ================================== */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ================================== */
/* SIDEBAR                            */
/* ================================== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  position: relative;
  z-index: 15;
  backdrop-filter: blur(20px);
  flex-shrink: 0;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .sidebar-footer span,
.sidebar.collapsed .oa-status span { display: none; }

.sidebar.collapsed .nav-item { justify-content: center; padding: 12px; }
.sidebar.collapsed .nav-item i { margin-right: 0; font-size: 1.2rem; }

.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--gradient-blue);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: white;
  box-shadow: var(--shadow-glow-blue);
}

.logo-text {
  font-weight: 700;
  font-size: 1.25rem;
  background: var(--gradient-blue);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.sidebar-toggle:hover { background: var(--bg-input); color: var(--text-primary); }

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

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 14px 14px 4px;
  user-select: none;
}
.nav-section-label:first-child { padding-top: 4px; }
.sidebar.collapsed .nav-section-label { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: var(--transition);
  position: relative;
  font-weight: 500;
  font-size: 0.9rem;
}

.nav-item i {
  margin-right: 12px;
  width: 20px;
  text-align: center;
  font-size: 1rem;
}

.nav-item:hover {
  background: var(--bg-input);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(0, 104, 255, 0.15);
  color: var(--accent-blue-light);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: var(--accent-blue);
  border-radius: 0 3px 3px 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent-blue);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.nav-badge.warning {
  background: var(--accent-orange);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
}

.oa-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.online { 
  background: var(--accent-green); 
  box-shadow: 0 0 6px var(--accent-green);
  animation: pulse-green 2s infinite;
}
.status-dot.offline { background: var(--text-muted); }

@keyframes pulse-green {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ================================== */
/* MAIN CONTENT                       */
/* ================================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ================================== */
/* TOPBAR                             */
/* ================================== */
.topbar {
  height: var(--topbar-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  backdrop-filter: blur(20px);
  flex-shrink: 0;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 6px;
}

.page-title {
  font-size: 1.3rem;
  font-weight: 700;
  white-space: nowrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.source-tabs {
  display: flex;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.source-tab {
  padding: 6px 14px;
  border: none;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
}

.source-tab.active {
  background: var(--accent-blue);
  color: white;
}

.source-tab:hover:not(.active) {
  color: var(--text-primary);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  position: relative;
}

.btn-icon:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--accent-red);
  border-radius: 50%;
  display: none;
}

.notif-dot.show { display: block; }

/* ================================== */
/* BUTTONS                            */
/* ================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-blue);
  color: white;
  box-shadow: var(--shadow-glow-blue);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 0 30px rgba(0,104,255,0.4); }
.btn-primary:active { transform: translateY(0); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--accent-blue); color: var(--accent-blue-light); }

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--accent-red);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.25); }

.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; width: 100%; justify-content: center; }

/* ================================== */
/* PAGE CONTAINER                     */
/* ================================== */
.page-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.page { display: none; animation: fadeIn 0.3s ease; }
.page.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================================== */
/* STATS CARDS                        */
/* ================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  padding: 20px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.12;
  border-radius: inherit;
}

.stat-card.gradient-blue { border: 1px solid rgba(0,104,255,0.2); background: rgba(0,104,255,0.08); }
.stat-card.gradient-blue::before { background: var(--gradient-blue); }
.stat-card.gradient-orange { border: 1px solid rgba(245,158,11,0.2); background: rgba(245,158,11,0.08); }
.stat-card.gradient-orange::before { background: var(--gradient-orange); }
.stat-card.gradient-green { border: 1px solid rgba(16,185,129,0.2); background: rgba(16,185,129,0.08); }
.stat-card.gradient-green::before { background: var(--gradient-green); }
.stat-card.gradient-purple { border: 1px solid rgba(139,92,246,0.2); background: rgba(139,92,246,0.08); }
.stat-card.gradient-purple::before { background: var(--gradient-purple); }

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  position: relative;
}

.gradient-blue .stat-icon { background: rgba(0,104,255,0.2); color: var(--accent-blue-light); }
.gradient-orange .stat-icon { background: rgba(245,158,11,0.2); color: var(--accent-orange); }
.gradient-green .stat-icon { background: rgba(16,185,129,0.2); color: var(--accent-green); }
.gradient-purple .stat-icon { background: rgba(139,92,246,0.2); color: var(--accent-purple); }

.stat-info { position: relative; }
.stat-value { font-size: 1.8rem; font-weight: 800; display: block; line-height: 1.2; }
.stat-label { font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; }

/* ================================== */
/* CARDS                              */
/* ================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.card-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-header h3 i { color: var(--accent-blue-light); }

.card-link {
  font-size: 0.8rem;
  font-weight: 600;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.pipeline-card { grid-column: 1 / -1; }

/* ================================== */
/* PIPELINE                           */
/* ================================== */
.pipeline {
  padding: 20px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.pipeline-stage {
  flex: 1;
  min-width: 120px;
  text-align: center;
  padding: 16px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}

.pipeline-stage:hover { background: var(--bg-card-hover); transform: translateY(-2px); }

.pipeline-stage .stage-count {
  font-size: 2rem;
  font-weight: 800;
  display: block;
  line-height: 1.2;
}

.pipeline-stage .stage-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-top: 4px;
}

.pipeline-stage .stage-bar {
  height: 3px;
  border-radius: 2px;
  margin-top: 10px;
  transition: var(--transition);
}

.stage-conv {
  font-size: 0.65rem;
  color: var(--accent-green);
  font-weight: 700;
  margin-top: 5px;
  opacity: 0.8;
}

.pipeline-stage[data-status="new"] .stage-count { color: var(--accent-cyan); }
.pipeline-stage[data-status="new"] .stage-bar { background: var(--accent-cyan); }
.pipeline-stage[data-status="approaching"] .stage-count { color: var(--accent-blue-light); }
.pipeline-stage[data-status="approaching"] .stage-bar { background: var(--accent-blue); }
.pipeline-stage[data-status="contacted"] .stage-count { color: var(--accent-purple); }
.pipeline-stage[data-status="contacted"] .stage-bar { background: var(--accent-purple); }
.pipeline-stage[data-status="waiting"] .stage-count { color: var(--accent-orange); }
.pipeline-stage[data-status="waiting"] .stage-bar { background: var(--accent-orange); }
.pipeline-stage[data-status="closed"] .stage-count { color: var(--accent-green); }
.pipeline-stage[data-status="closed"] .stage-bar { background: var(--accent-green); }
.pipeline-stage[data-status="rejected"] .stage-count { color: var(--accent-red); }
.pipeline-stage[data-status="rejected"] .stage-bar { background: var(--accent-red); }

/* ================================== */
/* TODAY FOLLOW-UPS list              */
/* ================================== */
.today-followups { padding: 12px 20px; max-height: 300px; overflow-y: auto; }

.followup-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  border-bottom: 1px solid var(--border-color);
}

.followup-item:last-child { border-bottom: none; }
.followup-item:hover { background: var(--bg-input); }

.followup-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.followup-info { flex: 1; min-width: 0; }
.followup-info .name { font-weight: 600; font-size: 0.9rem; }
.followup-info .meta { font-size: 0.75rem; color: var(--text-muted); }

.followup-actions {
  display: flex;
  gap: 6px;
}

.followup-actions .btn-sm { padding: 5px 10px; }

/* ================================== */
/* ACTIVITY LIST                      */
/* ================================== */
.activity-list { padding: 12px 20px; max-height: 300px; overflow-y: auto; }

.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.75rem;
}

.activity-icon.add { background: rgba(16,185,129,0.15); color: var(--accent-green); }
.activity-icon.status { background: rgba(0,104,255,0.15); color: var(--accent-blue-light); }
.activity-icon.message { background: rgba(139,92,246,0.15); color: var(--accent-purple); }
.activity-icon.followup { background: rgba(245,158,11,0.15); color: var(--accent-orange); }

.activity-text { flex: 1; }
.activity-time { color: var(--text-muted); font-size: 0.75rem; white-space: nowrap; }

/* ================================== */
/* FUNNEL & SVG CHARTS                */
/* ================================== */
.funnel-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px;
}

.funnel-tier {
  background: var(--bg-input);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  border: 1px solid var(--border-color);
}

.funnel-tier:hover { background: var(--bg-card-hover); border-color: var(--accent-blue); transform: scale(1.02); }

.tier-label { font-weight: 600; font-size: 0.9rem; }
.tier-value { font-weight: 800; font-size: 1.1rem; color: var(--accent-blue-light); }

.tier-arrow {
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-green);
  z-index: 2;
  border: 1px solid var(--border-color);
}

.svg-chart-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  padding-bottom: 25px;
}

.svg-chart-wrap svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ================================== */
/* CONTACTS PAGE                      */
/* ================================== */
.page-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  flex: 1;
  min-width: 200px;
  transition: var(--transition);
}

.search-bar:focus-within { border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(0,104,255,0.1); }

.search-bar i { color: var(--text-muted); }

.search-bar input {
  border: none;
  background: none;
  color: var(--text-primary);
  padding: 10px 0;
  font-size: 0.9rem;
  outline: none;
  width: 100%;
}

.filter-group {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-select {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}

.filter-select:focus { border-color: var(--accent-blue); }
.filter-select option { background: var(--bg-secondary); }

.contacts-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}

.contacts-table {
  width: 100%;
  border-collapse: collapse;
}

.contacts-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-input);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.contacts-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.88rem;
}

.contacts-table tr:hover td { background: rgba(0,104,255,0.03); }

.contacts-table input[type="checkbox"] {
  accent-color: var(--accent-blue);
  cursor: pointer;
}

.contact-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.contact-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.contact-name-text {
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.contact-name-text:hover { color: var(--accent-blue-light); }

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-badge.new { background: rgba(6,182,212,0.15); color: var(--accent-cyan); }
.status-badge.new::before { background: var(--accent-cyan); }
.status-badge.approaching { background: rgba(0,104,255,0.15); color: var(--accent-blue-light); }
.status-badge.approaching::before { background: var(--accent-blue); }
.status-badge.contacted { background: rgba(139,92,246,0.15); color: var(--accent-purple); }
.status-badge.contacted::before { background: var(--accent-purple); }
.status-badge.waiting { background: rgba(245,158,11,0.15); color: var(--accent-orange); }
.status-badge.waiting::before { background: var(--accent-orange); }
.status-badge.closed { background: rgba(16,185,129,0.15); color: var(--accent-green); }
.status-badge.closed::before { background: var(--accent-green); }
.status-badge.rejected { background: rgba(239,68,68,0.15); color: var(--accent-red); }
.status-badge.rejected::before { background: var(--accent-red); }

.source-badge {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.source-badge.personal { background: rgba(0,104,255,0.12); color: var(--accent-blue-light); }
.source-badge.oa { background: rgba(16,185,129,0.12); color: var(--accent-green); }

.tag-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-right: 4px;
  margin-bottom: 2px;
}

.action-btns {
  display: flex;
  gap: 4px;
}

.action-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: none;
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: var(--transition);
}

.action-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.action-btn.delete:hover { background: rgba(239,68,68,0.15); color: var(--accent-red); }
.action-btn.chat:hover { background: rgba(0,104,255,0.15); color: var(--accent-blue-light); }

/* ================================== */
/* EMPTY STATE                        */
/* ================================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-state i {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.empty-state h3 { color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); margin-bottom: 20px; font-size: 0.9rem; }

.empty-state-small {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-muted);
}

.empty-state-small i {
  font-size: 2rem;
  margin-bottom: 8px;
  display: block;
}

/* ================================== */
/* FOLLOW-UP PAGE                     */
/* ================================== */
.followup-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.followup-tab {
  padding: 10px 20px;
  border: none;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
}

.followup-tab.active { background: var(--accent-blue); color: white; }
.followup-tab:hover:not(.active) { background: var(--bg-card-hover); }

.tab-count {
  background: rgba(255,255,255,0.2);
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 0.72rem;
}

.followup-tab:not(.active) .tab-count {
  background: var(--bg-card);
}

.followup-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.followup-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.followup-card:hover { border-color: var(--accent-blue); background: var(--bg-card-hover); }

.followup-card.overdue { border-left: 3px solid var(--accent-red); }
.followup-card.today { border-left: 3px solid var(--accent-orange); }

.followup-card .followup-time {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.followup-card .followup-time.overdue { color: var(--accent-red); font-weight: 600; }

/* ================================== */
/* AUTOMATION PAGE                    */
/* ================================== */
.automation-list {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.automation-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.automation-item:hover { background: var(--bg-card-hover); }

.automation-item .auto-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: rgba(139,92,246,0.15);
  color: var(--accent-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.automation-item .auto-info { flex: 1; }
.automation-item .auto-name { font-weight: 600; font-size: 0.92rem; }
.automation-item .auto-desc { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

.automation-toggle {
  position: relative;
  width: 44px;
  height: 24px;
}

.automation-toggle input { opacity: 0; width: 0; height: 0; }

.automation-toggle .slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  transition: var(--transition);
}

.automation-toggle .slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  bottom: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: var(--transition);
}

.automation-toggle input:checked + .slider { background: var(--accent-blue); border-color: var(--accent-blue); }
.automation-toggle input:checked + .slider::before { transform: translateX(20px); background: white; }

.automation-info-card {
  margin-top: 20px;
  padding: 24px;
}

.automation-info-card h3 {
  margin-bottom: 20px;
  font-size: 1rem;
  font-weight: 700;
}

.flow-steps {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
  justify-content: center;
}

.flow-step {
  text-align: center;
  padding: 20px;
  flex: 1;
  min-width: 140px;
}

.flow-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(0,104,255,0.1);
  color: var(--accent-blue-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin: 0 auto 12px;
  border: 2px solid rgba(0,104,255,0.2);
}

.flow-step h4 { font-size: 0.85rem; margin-bottom: 4px; }
.flow-step p { font-size: 0.78rem; color: var(--text-muted); }

.flow-arrow {
  color: var(--text-muted);
  font-size: 1.2rem;
  padding: 0 4px;
}

/* ================================== */
/* TEMPLATES PAGE                     */
/* ================================== */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.template-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: var(--transition);
  position: relative;
}

.template-card:hover { border-color: var(--accent-blue); transform: translateY(-2px); }

.template-card .template-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.template-card .template-name { font-weight: 700; font-size: 0.95rem; }

.template-card .template-category {
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(0,104,255,0.1);
  color: var(--accent-blue-light);
  font-weight: 600;
}

.template-card .template-content {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-height: 100px;
  overflow: hidden;
  margin-bottom: 14px;
  white-space: pre-wrap;
}

.template-card .template-actions {
  display: flex;
  gap: 6px;
}

/* ================================== */
/* BROADCAST PAGE                     */
/* ================================== */
.broadcast-form { padding: 20px; }

.broadcast-targets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 8px;
}

.checkbox-card {
  cursor: pointer;
}

.checkbox-card input { display: none; }

.checkbox-card-content {
  padding: 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  text-align: center;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.checkbox-card-content i { font-size: 1.3rem; }

.checkbox-card input:checked + .checkbox-card-content {
  border-color: var(--accent-blue);
  background: rgba(0,104,255,0.08);
  color: var(--accent-blue-light);
}

.checkbox-card-content:hover {
  border-color: rgba(0,104,255,0.5);
  background: rgba(0,104,255,0.04);
}

.radio-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 20px;
  cursor: pointer;
  font-size: 0.9rem;
}

.radio-option input { accent-color: var(--accent-blue); }

.broadcast-preview {
  margin-top: 16px;
  padding: 16px;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.preview-header h4 { font-size: 0.85rem; }
.preview-count { font-size: 0.8rem; color: var(--text-muted); }
.preview-count strong { color: var(--accent-blue-light); }

.preview-message {
  font-size: 0.88rem;
  color: var(--text-secondary);
  white-space: pre-wrap;
  padding: 12px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  min-height: 60px;
}

.broadcast-history { padding: 16px; }

.broadcast-history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
}

.broadcast-history-item:last-child { border-bottom: none; }

.broadcast-history-item .bh-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0,104,255,0.1);
  color: var(--accent-blue-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.broadcast-history-item .bh-info { flex: 1; }
.broadcast-history-item .bh-title { font-weight: 600; font-size: 0.88rem; }
.broadcast-history-item .bh-meta { font-size: 0.75rem; color: var(--text-muted); }

/* ================================== */
/* SETTINGS PAGE                      */
/* ================================== */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 20px;
}

.settings-form { padding: 20px; display: flex; flex-direction: column; gap: 14px; }

/* OA Connection Card */
.oa-connection-card {
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--border-color);
}
.oa-conn-status {
  display: flex;
  align-items: center;
  gap: 14px;
}
.oa-conn-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.oa-conn-icon.online {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
}
.oa-conn-icon.offline {
  background: rgba(107, 114, 128, 0.15);
  color: var(--text-muted);
}
.oa-conn-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.oa-conn-info strong {
  font-size: 0.95rem;
}
.oa-conn-info .text-muted {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.settings-form hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 4px 0;
}

.tags-manager {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.tag-manage-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
}

.tag-manage-item .remove-tag {
  cursor: pointer;
  opacity: 0.6;
  transition: var(--transition);
}

.tag-manage-item .remove-tag:hover { opacity: 1; }

.form-inline {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.form-inline .form-input { flex: 1; }

.connection-status {
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  display: none;
}

.connection-status.success { display: block; background: rgba(16,185,129,0.1); color: var(--accent-green); }
.connection-status.error { display: block; background: rgba(239,68,68,0.1); color: var(--accent-red); }

/* ================================== */
/* FORMS                              */
/* ================================== */
.form-group { margin-bottom: 14px; }

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}

.form-input:focus { border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(0,104,255,0.1); }

.form-input::placeholder { color: var(--text-muted); }

textarea.form-input { resize: vertical; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-help {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.form-help code {
  background: var(--bg-input);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.72rem;
}

.tag-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-option {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: var(--transition);
  opacity: 0.5;
}

.tag-option.selected { opacity: 1; border-color: currentColor; }
.tag-option:hover { opacity: 0.8; }

/* ================================== */
/* MODALS                             */
/* ================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-overlay.show { display: flex; }

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-lg { max-width: 680px; }
.modal-sm { max-width: 420px; }

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 { font-size: 1.1rem; font-weight: 700; }

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover { background: rgba(239,68,68,0.15); color: var(--accent-red); }

.modal-body { padding: 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ================================== */
/* CONTACT DETAIL                     */
/* ================================== */
.detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.detail-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.detail-info h2 { font-size: 1.2rem; font-weight: 700; }
.detail-info .detail-meta { font-size: 0.85rem; color: var(--text-muted); }

.detail-actions-row {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.detail-section {
  margin-bottom: 20px;
}

.detail-section h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.detail-field {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}

.detail-field .field-label { color: var(--text-muted); }

.history-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}

.history-item:last-child { border-bottom: none; }

.history-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.history-content { flex: 1; }
.history-content .h-title { font-weight: 600; font-size: 0.88rem; }
.history-content .h-note { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.history-content .h-time { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }

/* ================================== */
/* TOAST                              */
/* ================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s ease;
  box-shadow: var(--shadow-lg);
  min-width: 280px;
}

.toast.success { background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.3); color: var(--accent-green); }
.toast.error { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: var(--accent-red); }
.toast.info { background: rgba(0,104,255,0.15); border: 1px solid rgba(0,104,255,0.3); color: var(--accent-blue-light); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ================================== */
/* RESPONSIVE                         */
/* ================================== */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .broadcast-targets { grid-template-columns: repeat(2, 1fr); }
  .flow-arrow { display: none; }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    z-index: 50;
    transition: left 0.3s ease;
  }

  .sidebar.open { left: 0; }

  .mobile-menu-btn { display: flex; }

  .topbar { padding: 0 16px; }
  .page-container { padding: 16px; }
  .source-tabs { display: none; }

  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 1.4rem; }

  .form-row { grid-template-columns: 1fr; }
  .broadcast-targets { grid-template-columns: 1fr 1fr; }
  .settings-grid { grid-template-columns: 1fr; }

  .filter-group { width: 100%; }
  .filter-select { flex: 1; }

  .topbar-right { gap: 8px; }
  .btn span { display: none; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .followup-tabs { flex-direction: column; }
  .broadcast-targets { grid-template-columns: 1fr; }
}

/* ============ KANBAN VIEW ============ */
.kanban-view {
  margin-top: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
}

.kanban-board {
  display: flex;
  gap: 1.25rem;
  min-height: calc(100vh - 350px);
}

.kanban-column {
  flex: 0 0 300px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 1rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 0 0.5rem;
}

.kanban-col-title {
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.kanban-col-count {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.1rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.kanban-cards {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 50px;
}

.kanban-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.75rem;
  padding: 1rem;
  cursor: grab;
  transition: all 0.2s;
}

.kanban-card:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
  border-color: var(--primary);
}

.kanban-card:active {
  cursor: grabbing;
}

.k-card-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.k-card-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.k-card-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.k-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.k-card-tags {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

/* ============ BULK TOOLBAR ============ */
.bulk-toolbar {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(150%);
  background: rgba(20, 25, 40, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--primary);
  padding: 0.75rem 1.5rem;
  border-radius: 4rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  z-index: 1000;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 104, 255, 0.3);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bulk-toolbar.show {
  transform: translateX(-50%) translateY(0);
}

.bulk-info {
  font-weight: 500;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  padding-right: 1.5rem;
}

.bulk-actions {
  display: flex;
  gap: 0.5rem;
}

/* ============ GROUPS PAGE ============ */
.page-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.page-header-info h2 {
  margin: 0 0 0.25rem 0;
}

.page-header-info p {
  margin: 0;
  color: var(--text-muted);
}

.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.group-card {
  background: var(--card-bg);
  border: var(--card-border);
  border-radius: 1rem;
  padding: 1.5rem;
  transition: all 0.2s;
}

.group-card:hover {
  border-color: var(--primary-glow);
  transform: translateY(-4px);
}

.group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.group-title {
  font-weight: 700;
  font-size: 1.1rem;
}

.group-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.g-stat {
  display: flex;
  flex-direction: column;
}

.g-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.g-stat-value {
  font-weight: 600;
}

.group-footer {
  display: flex;
  gap: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 1rem;
}

/* ============ VIEW SWITCHER ============ */
.view-switcher {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.25rem;
  border-radius: 0.75rem;
  margin: 0 1rem;
}

.view-switcher .btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 0.5rem;
}

.view-switcher .btn-icon.active {
  background: var(--primary);
  color: white;
}

/* ================================== */
/* GROUP MODAL STYLES                 */
/* ================================== */
.group-contact-item {
  display: flex;
  align-items: center;
  padding: 10px;
  gap: 12px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.group-contact-item:hover {
  background: var(--bg-input);
}

.group-contact-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.group-contact-item .c-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: white;
}

.group-contact-item .c-info {
  flex: 1;
}

.group-contact-item .c-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.group-contact-item .c-phone {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ================================== */
/* CHAT & DETAIL LAYOUT               */
/* ================================== */
.detail-chat-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 500px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.detail-sidebar-info {
  padding: 24px;
  background: rgba(255, 255, 255, 0.03);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

.detail-info-grid h3 { font-size: 1.2rem; font-weight: 700; }
.detail-info-grid p { font-size: 0.9rem; color: var(--text-secondary); }

.detail-field-small {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 8px;
}
.detail-field-small label { color: var(--text-muted); }

.detail-notes-area label { display: block; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; }
.detail-notes-area p { font-size: 0.85rem; line-height: 1.5; color: var(--text-secondary); background: var(--bg-input); padding: 10px; border-radius: var(--radius-sm); }

.detail-chat-main {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
}

.chat-header {
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-color);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent-blue-light);
}

.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-bubble-row { display: flex; width: 100%; }
.chat-bubble-row.sent { justify-content: flex-end; }
.chat-bubble-row.received { justify-content: flex-start; }

.chat-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 18px;
  position: relative;
  font-size: 0.9rem;
}

.sent .chat-bubble {
  background: var(--accent-blue);
  color: white;
  border-bottom-right-radius: 4px;
}

.received .chat-bubble {
  background: var(--bg-input);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.chat-bubble-row .cb-time {
  font-size: 0.65rem;
  opacity: 0.6;
  margin-top: 4px;
}

.chat-bubble-row.sent .cb-time { text-align: right; }

/* System Event in Timeline */
.system-event {
  width: 100%;
  display: flex;
  justify-content: center;
  margin: 10px 0;
}

.system-event-tag {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 600;
}

/* Overdue Pulse Animation for Badge */
.status-badge.overdue-pulse {
  animation: bg-pulse-red 2s infinite;
}

@keyframes bg-pulse-red {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Bulk Progress UI */
.progress-wrap {
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}

.chat-input-area {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
}

.chat-input-tools {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.btn-tool {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.btn-tool:hover { background: var(--border-active); color: white; }

.chat-input-wrap {
  display: flex;
  gap: 12px;
  background: var(--bg-input);
  padding: 8px 12px;
  border-radius: 24px;
  border: 1px solid var(--border-color);
}

.chat-input-wrap textarea {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  padding: 6px 0;
  resize: none;
  max-height: 100px;
}

.btn-send {
  background: var(--accent-blue);
  color: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}
.btn-send:hover { transform: scale(1.1); }
.btn-send:active { transform: scale(0.9); }

.system-event {
  width: 100%;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 10px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.system-event span {
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 12px;
  border-radius: 12px;
}

.system-event i {
  font-size: 0.65rem;
  opacity: 0.5;
  font-style: normal;
}

#bulkProgressOverlay .modal {
  padding: 30px;
}
