/* ═══════════════════════════════════════════════════════════════════════════════
   AIPRAKTOR PLATFORM DESIGN SYSTEM & STYLESHEET
   Sleek Dark & Light Themes · Precision Typography · Glassmorphism
   ═══════════════════════════════════════════════════════════════════════════════ */

:root {
  /* Dark Theme Tokens (Default) */
  --bg-app: #0b0f17;
  --bg-sidebar: #0f172a;
  --bg-card: #131d31;
  --bg-card-hover: #18243c;
  --bg-input: #1e293b;
  --bg-input-focus: #24344d;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.12);
  --border-active: #10b981;

  --text-main: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --emerald: #10b981;
  --emerald-bg: rgba(16, 185, 129, 0.12);
  --emerald-hover: #059669;

  --indigo: #6366f1;
  --indigo-bg: rgba(99, 102, 241, 0.12);

  --amber: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.12);

  --rose: #f43f5e;
  --rose-bg: rgba(244, 63, 94, 0.12);

  --sidebar-width: 270px;
  --topbar-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-app: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #f1f5f9;
  --bg-input-focus: #e2e8f0;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-light: rgba(0, 0, 0, 0.12);
  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', 'Hind Siliguri', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TOP NOTIFICATION BANNER
   ═══════════════════════════════════════════════════════════════════════════════ */
.top-alert-bar {
  background: linear-gradient(90deg, #1e1b4b 0%, #0f172a 100%);
  border-bottom: 1px solid rgba(99, 102, 241, 0.3);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
  z-index: 100;
  animation: slideDown 0.3s ease-out;
}

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

.alert-tag {
  background: var(--indigo);
  color: #fff;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
}

.alert-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   LAYOUT (SIDEBAR + MAIN)
   ═══════════════════════════════════════════════════════════════════════════════ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  transition: var(--transition);
}

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

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
  min-width: 0;
}

.brand-logo-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.25);
  flex-shrink: 0;
  background: #ffffff;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.brand-link:hover .brand-logo-img {
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

.brand-title-wrap {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  white-space: nowrap;
}

.brand-title-wrap .brand-text {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.2px;
}

.brand-title-wrap .brand-subtext {
  font-size: 10.5px;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.brand-symbol {
  width: 26px;
  height: 26px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--emerald);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.dot-accent {
  width: 8px;
  height: 8px;
  background: var(--emerald);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--emerald);
}

.brand-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.system-status-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 3px 7px;
  border-radius: 20px;
  flex-shrink: 0;
}

.status-pulse-dot {
  width: 6px;
  height: 6px;
  background: var(--emerald);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.status-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--emerald);
  letter-spacing: 0.5px;
}

.ai-reply-toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  user-select: none;
}
.ai-reply-toggle-pill.enabled {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.35);
}
.ai-reply-toggle-pill.enabled:hover {
  background: rgba(16, 185, 129, 0.25);
  transform: translateY(-1px);
}
.ai-reply-toggle-pill.disabled {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
}
.ai-reply-toggle-pill.disabled:hover {
  background: rgba(239, 68, 68, 0.25);
  transform: translateY(-1px);
}

.whatsapp-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}
.whatsapp-status-pill.connected {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.3);
}
.whatsapp-status-pill.disconnected,
.whatsapp-status-pill.waiting {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
  animation: pulse-border 2s infinite ease-in-out;
}
@keyframes pulse-border {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.02); }
}

.sidebar-scrollable {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  padding: 12px 10px 6px 10px;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
}

.nav-item i {
  font-size: 14px;
  width: 18px;
  text-align: center;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.nav-item.active {
  background: rgba(16, 185, 129, 0.12);
  color: var(--emerald);
  font-weight: 600;
}

.badge-pill {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.badge-pill.setup-badge {
  background: rgba(99, 102, 241, 0.2);
  color: var(--indigo);
}

.balance-inline {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--emerald);
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.user-avatar-initial {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--indigo);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.user-role-label {
  display: block;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.user-email {
  font-size: 12px;
  color: var(--text-main);
  font-weight: 500;
}

.device-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.sub-link-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 11.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 6px;
  border-radius: 4px;
}

.sub-link-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.live-ai-pill {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 6px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}

.live-tag {
  color: var(--emerald);
  font-weight: 800;
}

.live-mode-text {
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   MAIN CONTENT & TOPBAR
   ═══════════════════════════════════════════════════════════════════════════════ */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  height: var(--topbar-height);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-app);
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(12px);
}

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

.mobile-sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 18px;
  cursor: pointer;
}

.section-kicker {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1px;
  display: block;
}

.page-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

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

.live-clock-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.live-dot-mini {
  width: 6px;
  height: 6px;
  background: var(--emerald);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

.timezone-badge {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
}

.lang-toggle-group, .theme-toggle-group {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 2px;
}

.lang-btn, .theme-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.lang-btn.active, .theme-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

.mode-badge-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.mode-badge-pill.practice-mode {
  background: var(--amber-bg);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--amber);
}

/* PWA Card Banner */
.pwa-banner-card {
  margin: 16px 28px 0 28px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.pwa-banner-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pwa-icon {
  width: 40px;
  height: 40px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--emerald);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--emerald);
  font-size: 18px;
}

.pwa-banner-left h4 {
  font-size: 14px;
  font-weight: 600;
}

.pwa-banner-left p {
  font-size: 12.5px;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   VIEWPORT & CARDS
   ═══════════════════════════════════════════════════════════════════════════════ */
.view-container {
  flex: 1;
  padding: 24px 28px 40px 28px;
}

.view-pane {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}

.view-pane.active {
  display: block;
}

.pane-header-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 20px;
}

.meta-kicker {
  font-size: 11px;
  font-weight: 700;
  color: var(--emerald);
  letter-spacing: 1px;
  display: block;
  margin-bottom: 4px;
}

.pane-header-card h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

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

.card-header h3, .card-header h4 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.card-subtitle {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   BUTTONS & INPUTS
   ═══════════════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 4px;
}

.btn-primary {
  background: var(--emerald);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--emerald-hover);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

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

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.btn-link {
  background: none;
  color: var(--emerald);
  padding: 0;
  font-size: 13px;
}

.form-group {
  margin-bottom: 16px;
}

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

input[type="text"], input[type="number"], input[type="email"], input[type="password"], input[type="date"], select, textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--emerald);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

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

/* ═══════════════════════════════════════════════════════════════════════════════
   KPI METRIC GRIDS
   ═══════════════════════════════════════════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.kpi-title {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  display: block;
  margin-bottom: 8px;
}

.kpi-number {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.kpi-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 4px;
  display: block;
}

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

/* ═══════════════════════════════════════════════════════════════════════════════
   SETUP GUIDE WIZARD
   ═══════════════════════════════════════════════════════════════════════════════ */
.overview-setup-card {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.setup-bar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.setup-progress-circle {
  width: 46px;
  height: 46px;
  background: rgba(99, 102, 241, 0.2);
  border: 2px solid var(--indigo);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--indigo);
}

.setup-steps-stepper {
  margin-bottom: 24px;
}

.stepper-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.step-nav-pill {
  flex: 1;
  min-width: 140px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  cursor: pointer;
  transition: var(--transition);
}

.step-nav-pill.active {
  border-color: var(--emerald);
  background: rgba(16, 185, 129, 0.08);
}

.step-nav-pill.completed {
  border-color: var(--indigo);
}

.step-nav-pill .step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.step-nav-pill .step-name {
  font-size: 13px;
  font-weight: 600;
  margin-top: 4px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.setup-step-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.practice-notice-banner {
  background: var(--amber-bg);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
  color: #fde68a;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   INBOX SPLIT LAYOUT
   ═══════════════════════════════════════════════════════════════════════════════ */
.inbox-split-layout {
  display: flex;
  height: calc(100vh - var(--topbar-height) - 95px);
  min-height: 520px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
}

.inbox-sidebar {
  width: 320px;
  min-width: 290px;
  max-width: 330px;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  flex-shrink: 0;
}

.inbox-search-header {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
}

.search-input-wrap {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
}

.search-input-wrap input {
  padding-left: 34px;
}

.inbox-filter-tabs {
  display: flex;
  padding: 8px 12px;
  gap: 4px;
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
}

.filter-chip {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 14px;
  cursor: pointer;
  white-space: nowrap;
}

.filter-chip.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.inbox-label-filter-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.12);
  overflow-x: auto;
}

.label-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.label-filter-chip:hover {
  background: rgba(255, 255, 255, 0.08);
}

.label-filter-chip.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}

.convo-labels-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.label-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}

.active-chat-labels {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.active-chat-label-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.active-chat-label-badge .remove-label-btn {
  cursor: pointer;
  opacity: 0.6;
  margin-left: 2px;
}

.active-chat-label-badge .remove-label-btn:hover {
  opacity: 1;
}

.label-picker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
}

.label-picker-row:hover {
  background: var(--bg-card-hover);
}

.chip-count {
  background: rgba(255, 255, 255, 0.15);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 10px;
  margin-left: 4px;
}

.conversation-list {
  flex: 1;
  overflow-y: auto;
}

.convo-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 12px;
}

.convo-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  background: rgba(99, 102, 241, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  border: 1.5px solid var(--border-color);
}

.convo-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.convo-body {
  flex: 1;
  min-width: 0;
}

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

.convo-item.active {
  background: rgba(16, 185, 129, 0.08);
  border-left: 3px solid var(--emerald);
}

.convo-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.convo-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
}

.convo-time {
  font-size: 11px;
  color: var(--text-muted);
}

.convo-snippet {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inbox-keyboard-hints {
  padding: 8px 12px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.inbox-keyboard-hints kbd {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 10px;
  margin-right: 2px;
}

/* Chat Pane */
.inbox-chat-pane {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.empty-chat-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
}

.empty-icon-wrap {
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.active-chat-container {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.chat-header {
  flex-shrink: 0;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 5;
}

.active-chat-support-banner {
  flex-shrink: 0;
  background: linear-gradient(90deg, rgba(249, 115, 22, 0.15), rgba(236, 72, 153, 0.12));
  border-bottom: 1px solid rgba(249, 115, 22, 0.35);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 6;
  animation: pulse-glow 3s infinite ease-in-out;
}

.support-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.support-banner-icon {
  width: 34px;
  height: 34px;
  background: rgba(249, 115, 22, 0.25);
  color: #fb923c;
  border: 1px solid rgba(249, 115, 22, 0.4);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.support-banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.support-banner-actions {
  flex-shrink: 0;
}

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

.chat-avatar {
  width: 38px;
  height: 38px;
  background: var(--indigo);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.takeover-switch-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.takeover-label {
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.takeover-label.active-ai {
  color: #10b981;
}
.takeover-label.human-active {
  color: #f59e0b;
}

.takeover-action-btn {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 12px;
}

.chat-messages-scroll {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.message-bubble {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 13.5px;
  line-height: 1.4;
  position: relative;
}

.message-bubble.user {
  align-self: flex-start;
  background: var(--bg-input);
  color: var(--text-main);
  border-bottom-left-radius: 2px;
}

.message-bubble.assistant {
  align-self: flex-end;
  background: #064e3b;
  color: #ecfdf5;
  border-bottom-right-radius: 2px;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.message-bubble.human_agent {
  align-self: flex-end;
  background: #312e81;
  color: #e0e7ff;
  border-bottom-right-radius: 2px;
  border: 1px solid rgba(99, 102, 241, 0.4);
}

.msg-meta {
  display: block;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 4px;
  text-align: right;
}

.chat-input-footer {
  flex-shrink: 0;
  padding: 12px 18px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.45);
}

.quick-replies-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.quick-reply-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.quick-reply-pill:hover {
  border-color: #3b82f6;
  color: #60a5fa;
  background: rgba(59, 130, 246, 0.12);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.quick-reply-pill:active {
  transform: translateY(0);
}

.quick-reply-manage-btn {
  background: rgba(16, 185, 129, 0.08);
  border: 1px dashed rgba(16, 185, 129, 0.4);
  border-radius: 20px;
  padding: 5px 11px;
  font-size: 11.5px;
  font-weight: 600;
  color: #10b981;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
  margin-left: 2px;
}

.quick-reply-manage-btn:hover {
  background: rgba(16, 185, 129, 0.18);
  border-color: #10b981;
  color: #34d399;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

/* Quick Replies Management Modal */
.qr-item-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  transition: all 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.qr-item-card:hover {
  border-color: rgba(59, 130, 246, 0.3);
  background: rgba(59, 130, 246, 0.03);
}

.qr-item-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.qr-item-msg {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.qr-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}


.chat-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-input-row textarea {
  flex: 1;
  resize: none;
  padding: 10px 14px;
  border-radius: 20px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  max-height: 100px;
  line-height: 1.4;
  transition: border-color 0.2s;
}

.chat-input-row textarea:focus {
  border-color: var(--primary-color);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   AGENT DESK (PROMPT ARCHITECT & INSTRUCTIONS)
   ═══════════════════════════════════════════════════════════════════════════════ */
.prompt-architect-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.architect-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.architect-header i {
  font-size: 22px;
}

.nl-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nl-actions-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.proposal-box {
  margin-top: 14px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  padding: 14px;
}

.instruction-blocks-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.test-simulator-card {
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.desk-test-chat-box {
  min-height: 180px;
  max-height: 260px;
  overflow-y: auto;
  background: var(--bg-app);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.desk-test-input-row {
  display: flex;
  gap: 10px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   BILLING & TOP-UP SYSTEM
   ═══════════════════════════════════════════════════════════════════════════════ */
.billing-hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.balance-card {
  background: linear-gradient(135deg, #064e3b, #0f172a);
  border: 1px solid var(--emerald);
  border-radius: var(--radius-xl);
  padding: 28px;
}

.balance-amount {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -1px;
  color: #ffffff;
  margin: 6px 0;
}

.balance-sub {
  font-size: 13px;
  color: #a7f3d0;
  margin-bottom: 18px;
}

.preset-chips-row {
  display: flex;
  gap: 10px;
  margin: 10px 0 14px 0;
}

.preset-chip {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
}

.preset-chip.active, .preset-chip:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--emerald);
  color: var(--emerald);
}

.calculation-breakdown-box {
  background: var(--bg-app);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
}

.calc-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 4px;
}

.calc-row.highlight {
  color: var(--emerald);
  font-weight: 700;
  border-top: 1px solid var(--border-color);
  padding-top: 6px;
  margin-top: 6px;
}

.payment-method-selector {
  display: flex;
  gap: 10px;
  margin: 10px 0 16px 0;
}

.method-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
}

.method-btn.active {
  border-color: var(--indigo);
  background: var(--indigo-bg);
  color: var(--indigo);
}

.gateway-instruction-card {
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}

.instruction-steps {
  padding-left: 20px;
  font-size: 13.5px;
}

.instruction-steps li {
  margin-bottom: 8px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   PRODUCTS GRID & KANBAN
   ═══════════════════════════════════════════════════════════════════════════════ */
.products-grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.product-thumb {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: #1e293b;
}

.product-body {
  padding: 14px;
}

.product-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.product-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.price-tag {
  font-size: 16px;
  font-weight: 700;
  color: var(--emerald);
}

.stock-tag {
  font-size: 11px;
  color: var(--text-muted);
}

/* Kanban Pipeline for Leads */
.kanban-pipeline-wrapper {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 12px;
}

.kanban-col {
  flex: 1;
  min-width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.kanban-cards-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lead-card-mini {
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.lead-card-mini:hover {
  border-color: var(--indigo);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-dialog {
  background: var(--bg-card, #161e2e);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
  border-radius: var(--radius-xl, 16px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: scaleUp 0.2s ease-out;
  position: relative;
  z-index: 1010;
}

.app-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 520px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  z-index: 1010;
  animation: scaleUp 0.2s ease-out;
}

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

.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}

.modal-body {
  padding: 22px;
  max-height: 70vh;
  overflow-y: auto;
}

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

/* ═══════════════════════════════════════════════════════════════════════════════
   ANIMATIONS & UTILITIES
   ═══════════════════════════════════════════════════════════════════════════════ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

@keyframes scaleUp {
  from { opacity: 0; transform: translate(-50%, -46%) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

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

.text-emerald { color: var(--emerald) !important; }
.text-indigo { color: var(--indigo) !important; }
.text-amber { color: var(--amber) !important; }
.text-rose { color: var(--rose) !important; }
.text-muted { color: var(--text-muted) !important; }

/* Multi-Agent System & Chat Assignment Styles */
.user-topbar-pill:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.convo-item.is-my-assigned {
  border-left: 3px solid #10b981;
  background: rgba(16, 185, 129, 0.04);
}

.convo-item.is-my-assigned:hover {
  background: rgba(16, 185, 129, 0.08);
}

.convo-assigned-badge {
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 10px;
}

.convo-assigned-badge.my-assigned {
  background: rgba(16, 185, 129, 0.18);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.convo-assigned-badge.other-assigned {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.convo-assigned-badge.unassigned {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.msg-sender-tag {
  font-size: 10px;
  font-weight: 700;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0.9;
}

.msg-sender-tag.ai {
  color: #818cf8;
}

.message-bubble.human_agent {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #ffffff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  border: 1px solid rgba(16, 185, 129, 0.4);
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.2);
}

.team-member-card:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.open {
    transform: translateX(0);
  }
  .app-main {
    margin-left: 0;
  }
  .mobile-sidebar-toggle {
    display: block;
  }
  .dashboard-split-grid, .instruction-blocks-grid, .billing-hero-grid {
    grid-template-columns: 1fr;
  }
  .inbox-split-layout {
    flex-direction: column;
    height: auto;
  }
  .inbox-sidebar {
    width: 100%;
    height: 300px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* 📸 MEDIA ATTACHMENT & PREVIEW TRAY */
/* ═══════════════════════════════════════════════════════════════════════════ */
.chat-attach-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 16px;
  flex-shrink: 0;
}

.chat-attach-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: #6366f1;
  color: #818cf8;
  transform: translateY(-1px);
}

.active-media-preview-tray {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  animation: slideDownTray 0.2s ease-out;
}

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

.media-preview-thumb-box {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.media-preview-thumb-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-preview-thumb-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-preview-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.media-preview-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
}

.media-preview-filename {
  font-weight: 600;
  color: var(--text-main);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-preview-filesize {
  color: var(--text-secondary);
}

.media-preview-badge {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.media-preview-caption-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text-main);
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.2s;
}

.media-preview-caption-input:focus {
  border-color: #6366f1;
  background: rgba(255, 255, 255, 0.08);
}

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

.btn-cancel-media {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-cancel-media:hover {
  background: #ef4444;
  color: #fff;
}

.btn-send-media {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* 💬 CHAT BUBBLE MEDIA & CLICK-TO-COPY STYLES */
/* ═══════════════════════════════════════════════════════════════════════════ */
.message-bubble {
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  user-select: text;
}

.message-bubble:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.bubble-copy-btn {
  position: absolute;
  top: 4px;
  right: 6px;
  opacity: 0;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.85);
  transition: opacity 0.15s ease, background 0.15s ease;
  display: flex;
  align-items: center;
  gap: 3px;
}

.message-bubble:hover .bubble-copy-btn {
  opacity: 1;
}

.message-bubble.bubble-just-copied {
  animation: copiedPulse 0.4s ease;
}

@keyframes copiedPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); filter: brightness(1.2); }
  100% { transform: scale(1); }
}

.msg-copy-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #10b981;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 20px;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.msg-copy-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.chat-media-attachment-wrap {
  margin-bottom: 6px;
  border-radius: 8px;
  overflow: hidden;
}

.chat-media-bubble-img {
  max-width: 100%;
  max-height: 240px;
  border-radius: 8px;
  display: block;
  object-fit: cover;
  cursor: zoom-in;
  transition: transform 0.2s ease, opacity 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.chat-media-bubble-img:hover {
  opacity: 0.95;
  transform: scale(1.01);
}

.chat-media-bubble-video {
  max-width: 100%;
  max-height: 240px;
  border-radius: 8px;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* 🔍 FULLSCREEN MEDIA LIGHTBOX */
/* ═══════════════════════════════════════════════════════════════════════════ */
.media-lightbox-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(10px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeInModal 0.2s ease;
}

.media-lightbox-wrap {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.media-lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
}

.media-lightbox-close:hover {
  background: #ef4444;
  border-color: #ef4444;
  transform: rotate(90deg);
}

.media-lightbox-content {
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 80vh;
}

.media-lightbox-content img {
  max-width: 85vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

.media-lightbox-content video {
  max-width: 85vw;
  max-height: 80vh;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

.media-lightbox-caption {
  margin-top: 12px;
  color: #e2e8f0;
  font-size: 14px;
  text-align: center;
  max-width: 600px;
  line-height: 1.4;
}

/* ═══════════════════════════════════════════════════════════════════ */
/* SMART SUPPORT ISSUES NOTIFICATION & ALERT SYSTEM */
/* ═══════════════════════════════════════════════════════════════════ */

/* Topbar Support Notification Button */
.topbar-support-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.18), rgba(249, 115, 22, 0.15));
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.topbar-support-btn:hover {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.3), rgba(249, 115, 22, 0.25));
  border-color: #ef4444;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

.support-btn-pulse {
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  animation: pulse-ring 1.8s infinite cubic-bezier(0.66, 0, 0, 1);
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.support-badge-pill {
  background: #ef4444;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  line-height: 1.2;
}

/* Inbox Sidebar Prominent Support Alert Card */
.inbox-support-alert-card {
  margin: 8px 12px 6px 12px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.16) 0%, rgba(249, 115, 22, 0.14) 100%);
  border: 1px solid rgba(239, 68, 68, 0.45);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.12);
}

.inbox-support-alert-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(to bottom, #ef4444, #f97316);
}

.inbox-support-alert-card:hover {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.25) 0%, rgba(249, 115, 22, 0.22) 100%);
  border-color: #ef4444;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.25);
}

.support-alert-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.support-alert-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.alert-wrench-icon {
  font-size: 16px;
  color: #fb923c;
  background: rgba(249, 115, 22, 0.2);
  padding: 6px;
  border-radius: 8px;
  flex-shrink: 0;
}

.support-alert-headline {
  font-size: 13px;
  font-weight: 700;
  color: #fee2e2;
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 6px;
}

.support-alert-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.support-alert-badge-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.support-alert-badge {
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

.alert-arrow-icon {
  font-size: 12px;
  color: #f87171;
  opacity: 0.8;
  transition: transform 0.2s;
}

.inbox-support-alert-card:hover .alert-arrow-icon {
  transform: translateX(3px);
  opacity: 1;
}

/* Label chip counts */
.label-filter-chip .chip-count {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  margin-left: 4px;
}

.label-filter-chip.is-support-chip {
  border-color: rgba(239, 68, 68, 0.4) !important;
  background: rgba(239, 68, 68, 0.12) !important;
  color: #fca5a5 !important;
  font-weight: 600;
}

.label-filter-chip.is-support-chip .chip-count {
  background: #ef4444 !important;
  color: #fff !important;
}

/* ═══════════════════════════════════════════════════════════════════ */
/* SMART SUPPORT ISSUES MODAL */
/* ═══════════════════════════════════════════════════════════════════ */

.support-modal-dialog {
  max-width: 780px !important;
  width: 95vw !important;
  max-height: 90vh !important;
  display: flex;
  flex-direction: column;
}

.support-stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-color);
}

.support-stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.support-stat-label {
  font-size: 11.5px;
  color: var(--text-secondary);
  font-weight: 500;
}

.support-stat-num {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
}

.support-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.support-filter-tabs-group {
  display: flex;
  gap: 6px;
  overflow-x: auto;
}

.support-tab-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.support-tab-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.support-tab-btn.active {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}

.support-tickets-list {
  flex: 1 1 0%;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 55vh;
}

.support-ticket-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
  position: relative;
}

.support-ticket-item:hover {
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  background: rgba(255, 255, 255, 0.03);
}

.support-ticket-item.high-priority {
  border-left: 4px solid #ef4444;
}

.support-ticket-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.support-ticket-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.support-ticket-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #4f46e5;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.support-ticket-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.support-ticket-phone {
  font-size: 11.5px;
  color: var(--text-muted);
}

.support-ticket-body {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.45;
  border-left: 2px solid rgba(249, 115, 22, 0.5);
}

.support-ticket-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
}

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

/* ═══════════════════════════════════════════════════════════════════════════ */
/* 📞 INCOMING & MISSED CALL NOTIFICATION SYSTEM */
/* ═══════════════════════════════════════════════════════════════════════════ */
.floating-call-alert-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.floating-call-alert {
  pointer-events: auto;
  background: rgba(18, 24, 38, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(239, 68, 68, 0.4);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5), 0 0 20px rgba(239, 68, 68, 0.25);
  border-radius: 16px;
  padding: 16px 18px;
  width: 360px;
  max-width: calc(100vw - 32px);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  animation: slideInCallAlert 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.floating-call-alert::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(to bottom, #ef4444, #f97316);
}

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

.call-alert-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.18);
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  position: relative;
  animation: pulseCallRing 1.5s infinite;
}

@keyframes pulseCallRing {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(239, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.call-alert-content {
  flex: 1;
  min-width: 0;
}

.call-alert-title {
  font-size: 14px;
  font-weight: 700;
  color: #f87171;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.call-alert-time {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.call-alert-caller {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.call-alert-phone {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

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

.call-alert-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 13px;
  transition: color 0.2s;
}

.call-alert-close-btn:hover {
  color: var(--text-primary);
}

/* Active Chat Callback Reminder Banner */
.active-chat-callback-banner {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.15) 0%, rgba(249, 115, 22, 0.1) 100%);
  border-bottom: 1px solid rgba(239, 68, 68, 0.3);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  animation: fadeInModal 0.2s ease;
}

.callback-banner-text {
  font-size: 12.5px;
  font-weight: 600;
  color: #fca5a5;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

/* AI Message Delete & Correction Learning Styles */
.bubble-delete-correct-btn {
  position: absolute;
  top: 6px;
  right: 56px;
  opacity: 0;
  background: rgba(239, 68, 68, 0.85);
  border: none;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 10px;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 3px;
  transition: all 0.2s ease;
  z-index: 5;
}
.message-bubble.assistant:hover .bubble-delete-correct-btn {
  opacity: 1;
}
.bubble-delete-correct-btn:hover {
  background: #dc2626;
  transform: scale(1.04);
}
.message-bubble.is-deleted {
  opacity: 0.65;
  border: 1px dashed rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.05) !important;
}
.msg-deleted-note {
  font-size: 11px;
  color: #ef4444;
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 5px;
}
.correction-learning-banner {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.15));
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 6px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #e2e8f0;
}
.correction-learning-banner .clb-icon {
  font-size: 16px;
  color: #a855f7;
}
.correction-learning-banner .clb-content {
  flex: 1;
  line-height: 1.4;
}
.correction-learning-banner .clb-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
}
