/* ChatHub Modern Design System - Pixel Accurate to Screenshot */
:root {
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  
  /* Top Nav */
  --top-nav-bg: #131b2e;
  --top-nav-border: #1e2942;
  --top-nav-text: #94a3b8;
  --top-nav-text-hover: #e2e8f0;
  --top-nav-active-bg: #223254;
  --top-nav-active-text: #ffffff;
  
  /* Demo Banner */
  --banner-bg: #faeccb;
  --banner-border: #fae19c;
  --banner-text: #854d0e;
  
  /* Sidebar & Layout */
  --slim-sidebar-bg: #ffffff;
  --slim-sidebar-border: #eaedf2;
  --slim-sidebar-icon: #64748b;
  --slim-sidebar-active: #2563eb;
  
  /* Inbox List */
  --inbox-bg: #ffffff;
  --inbox-border: #eaedf2;
  --inbox-item-hover: #f8fafc;
  --inbox-item-active: #edf4ff;
  
  /* Workspace Canvas */
  --workspace-bg: #f3efe6;
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  
  /* Brand & Status Colors */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  /* Tags */
  --tag-open-bg: #ecfdf5;
  --tag-open-text: #059669;
  --tag-open-border: #a7f3d0;
  
  --tag-bot-bg: #f0f9ff;
  --tag-bot-text: #0284c7;
  --tag-bot-border: #bae6fd;
  
  --tag-urgent-bg: #fef2f2;
  --tag-urgent-text: #dc2626;
  --tag-urgent-border: #fecaca;
  
  --tag-complaint-bg: #fff7ed;
  --tag-complaint-text: #ea580c;
  --tag-complaint-border: #fed7aa;
  
  --tag-vip-bg: #faf5ff;
  --tag-vip-text: #9333ea;
  --tag-vip-border: #e9d5ff;
}

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

body {
  font-family: var(--font-family);
  color: var(--text-main);
  background: var(--workspace-bg);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

[hidden] {
  display: none !important;
}

/* ==========================================================================
   1. Login View
   ========================================================================== */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #1e3a8a 100%);
  padding: 20px;
}

.card {
  background: #ffffff;
  border-radius: 16px;
  padding: 36px 32px;
  width: min(420px, 92vw);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 24px;
}

.brand-logo-svg {
  flex-shrink: 0;
}

.card h1 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  color: #0f172a;
}

.card label {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
  color: #475569;
  font-size: 13px;
  font-weight: 500;
}

.card input {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: all 0.15s ease;
}

.card input:focus {
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.btn-primary {
  width: 100%;
  background: #2563eb;
  color: #ffffff;
  border-radius: 8px;
  padding: 11px;
  font-size: 14px;
  font-weight: 600;
  margin-top: 8px;
  transition: background 0.15s ease;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-secondary {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px;
  font-size: 13.5px;
  font-weight: 600;
  transition: background 0.15s ease;
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.error {
  color: #dc2626;
  font-size: 13px;
  margin-top: 12px;
  min-height: 18px;
}

/* ==========================================================================
   2. Top Dark Navigation Bar
   ========================================================================== */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.top-nav {
  height: 52px;
  background: var(--top-nav-bg);
  border-bottom: 1px solid var(--top-nav-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  color: var(--top-nav-text);
  flex-shrink: 0;
  z-index: 100;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #ffffff;
  margin-right: 8px;
}

.brand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-title {
  font-size: 15px;
  font-weight: 750;
  letter-spacing: -0.2px;
  color: #ffffff;
}

.brand-sub {
  font-weight: 400;
  color: #cbd5e1;
}

.brand-dot {
  width: 5px;
  height: 5px;
  background: #3b82f6;
  border-radius: 50%;
  display: inline-block;
  margin-left: 2px;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 100%;
}

.top-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--top-nav-text);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.top-tab:hover {
  background: #1c263f;
  color: var(--top-nav-text-hover);
}

.top-tab.active {
  background: var(--top-nav-active-bg);
  color: var(--top-nav-active-text);
  font-weight: 600;
}

.tab-icon {
  flex-shrink: 0;
  opacity: 0.85;
}

.top-tab.active .tab-icon {
  opacity: 1;
}

.nav-pill-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  background: #2563eb;
  color: #ffffff;
  line-height: 1.3;
}

.nav-pill-badge.danger {
  background: #dc2626;
}

.chevron-icon {
  margin-left: 1px;
  opacity: 0.7;
}

/* Dropdown Menu styling */
.nav-dropdown {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
}

.dropdown-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  padding: 6px;
  min-width: 220px;
  z-index: 1000;
}

.dropdown-panel.right-align {
  left: auto;
  right: 0;
}

.nav-dropdown:hover .dropdown-panel,
.nav-dropdown.open .dropdown-panel {
  display: block;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 500;
  color: #334155;
  text-align: left;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.12s ease;
}

.dropdown-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.dropdown-item.text-danger {
  color: #dc2626;
}

.dropdown-item.text-danger:hover {
  background: #fef2f2;
}

.dropdown-divider {
  height: 1px;
  background: #f1f5f9;
  margin: 4px 0;
}

.dropdown-header {
  padding: 8px 12px;
}

.dropdown-header strong {
  display: block;
  font-size: 13.5px;
  color: #0f172a;
}

.dropdown-header small {
  display: block;
  font-size: 11.5px;
  color: #64748b;
  margin-top: 2px;
}

/* Nav Right */
.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  cursor: pointer;
}

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

.switch-track {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #475569;
  border-radius: 20px;
  transition: 0.2s ease;
}

.switch-track::before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.2s ease;
}

.toggle-switch input:checked + .switch-track {
  background-color: #10b981;
}

.toggle-switch input:checked + .switch-track::before {
  transform: translateX(16px);
}

.nav-icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--top-nav-text);
  transition: all 0.15s ease;
  position: relative;
}

.nav-icon-btn:hover {
  background: #1c263f;
  color: #ffffff;
}

.noti-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 14px;
  height: 14px;
  background: #dc2626;
  color: #ffffff;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--top-nav-bg);
}

.user-pill-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 20px;
  color: #ffffff;
  transition: background 0.15s ease;
}

.user-pill-btn:hover {
  background: #1c263f;
}

.user-avatar-wrap {
  position: relative;
  width: 26px;
  height: 26px;
}

.user-avatar-init {
  width: 26px;
  height: 26px;
  background: #c26522;
  color: #ffffff;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
}

.online-indicator {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 8px;
  height: 8px;
  background: #22c55e;
  border: 1.5px solid var(--top-nav-bg);
  border-radius: 50%;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
}

/* ==========================================================================
   3. Yellow Demo Notice Banner
   ========================================================================== */
.demo-banner {
  background: var(--banner-bg);
  border-bottom: 1px solid var(--banner-border);
  padding: 7px 16px;
  flex-shrink: 0;
}

.demo-banner-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--banner-text);
}

.eye-icon {
  opacity: 0.85;
}

/* ==========================================================================
   4. Main App Layout & Slim Sidebar
   ========================================================================== */
.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/* Slim Left Sidebar */
.slim-sidebar {
  width: 50px;
  background: var(--slim-sidebar-bg);
  border-right: 1px solid var(--slim-sidebar-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  flex-shrink: 0;
  z-index: 20;
}

.slim-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.slim-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--slim-sidebar-icon);
  transition: all 0.15s ease;
}

.slim-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.slim-icon-box {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}

.slim-icon-box.blue {
  background: #2563eb;
  color: #ffffff;
}

.slim-divider {
  width: 24px;
  height: 1px;
  background: var(--slim-sidebar-border);
  margin: 10px 0;
}

/* ==========================================================================
   5. Middle Inbox Conversation Column
   ========================================================================== */
.inbox-column {
  width: 340px;
  background: var(--inbox-bg);
  border-right: 1px solid var(--inbox-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-height: 0;
}

.inbox-header {
  padding: 14px 16px 8px;
  border-bottom: 1px solid #f1f5f9;
}

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

.inbox-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inbox-title-group h2 {
  font-size: 18px;
  font-weight: 750;
  color: #0f172a;
}

.unread-pill {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 600;
}

.inbox-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn-subtle {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #64748b;
  transition: all 0.12s ease;
}

.icon-btn-subtle:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.inbox-subheading {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #64748b;
  margin-bottom: 10px;
}

.sub-blue-dot {
  color: #2563eb;
  font-size: 10px;
}

.inbox-search-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search-svg-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
}

.search-input-wrap input {
  width: 100%;
  padding: 7px 10px 7px 32px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  font-size: 12.5px;
  outline: none;
  transition: all 0.15s ease;
}

.search-input-wrap input:focus {
  border-color: #3b82f6;
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.search-tool-btn {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #64748b;
  display: grid;
  place-items: center;
  transition: all 0.12s ease;
  flex-shrink: 0;
}

.search-tool-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #cbd5e1;
}

.filters-scroll-row {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  padding: 4px 0 2px;
}

.filter-chip {
  padding: 4px 9px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.12s ease;
}

.filter-chip:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.filter-chip.selected {
  background: #eff6ff;
  color: #2563eb;
  font-weight: 600;
}

.mine-filter-label {
  font-size: 11.5px;
  color: #64748b;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  cursor: pointer;
}

/* Conversation List */
.conversation-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.convo-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 15px;
  border-bottom: 1px solid #f1f5f9;
  background: #ffffff;
  width: 100%;
  text-align: left;
  transition: background 0.12s ease;
  cursor: pointer;
}

.convo-item:hover {
  background: #f8fafc;
}

.convo-item.current {
  background: #eff6ff;
  border-left: 3px solid #2563eb;
  padding-left: 12px;
}

/* Conversation Avatar & Badge */
.convo-avatar-wrap {
  position: relative;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
}

.convo-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
}

.avatar-badge-icon {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #0084ff;
  border: 2px solid #ffffff;
  display: grid;
  place-items: center;
}

/* Conversation Body */
.convo-body {
  flex: 1;
  min-width: 0;
}

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

.convo-name {
  font-size: 13.5px;
  font-weight: 650;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.convo-time {
  font-size: 11.5px;
  color: #94a3b8;
  white-space: nowrap;
  margin-left: 6px;
}

.convo-preview {
  font-size: 12.5px;
  color: #475569;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 6px;
  line-height: 1.4;
}

.convo-tags-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

/* Specific Tag Pills */
.tag-pill {
  font-size: 11px;
  font-weight: 550;
  padding: 1.5px 6px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  line-height: 1.3;
}

.tag-open {
  background: var(--tag-open-bg);
  color: var(--tag-open-text);
  border: 1px solid var(--tag-open-border);
}

.tag-bot {
  background: var(--tag-bot-bg);
  color: var(--tag-bot-text);
  border: 1px solid var(--tag-bot-border);
}

.tag-urgent {
  background: var(--tag-urgent-bg);
  color: var(--tag-urgent-text);
  border: 1px solid var(--tag-urgent-border);
}

.tag-complaint {
  background: var(--tag-complaint-bg);
  color: var(--tag-complaint-text);
  border: 1px solid var(--tag-complaint-border);
}

.tag-vip {
  background: var(--tag-vip-bg);
  color: var(--tag-vip-text);
  border: 1px solid var(--tag-vip-border);
}

.assignee-avatar-mini {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #c26522;
  color: #ffffff;
  font-size: 9.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
  margin-left: 2px;
}

.convo-unread-circle {
  margin-left: auto;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #2563eb;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

/* ==========================================================================
   6. Right Main Workspace
   ========================================================================== */
.main-workspace {
  flex: 1;
  min-width: 0;
  background: var(--workspace-bg);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.inbox-section {
  display: flex;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

/* Empty State */
.chat-empty-state {
  flex: 1;
  display: grid;
  place-items: center;
  height: 100%;
  background: var(--workspace-bg);
}

.empty-state-box {
  text-align: center;
  max-width: 440px;
  padding: 30px;
}

.empty-icon-card {
  width: 60px;
  height: 60px;
  background: #ffffff;
  border-radius: 16px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
  border: 1px solid #e2e8f0;
}

.empty-state-box h3 {
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 8px;
}

.empty-state-box p {
  font-size: 13.5px;
  color: #64748b;
  line-height: 1.5;
}

/* Active Chat View */
.chat-active-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  background: #f8fafc;
}

.chat-header {
  height: 60px;
  background: #ffffff;
  border-bottom: 1px solid #eaedf2;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

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

.back-btn {
  display: none;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: #f1f5f9;
  place-items: center;
  color: #334155;
}

.chat-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #d946ef;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.chat-header-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-header-name-row strong {
  font-size: 15px;
  color: #0f172a;
}

.channel-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #475569;
  background: #f1f5f9;
  padding: 2px 7px;
  border-radius: 12px;
}

.chat-header-meta small {
  font-size: 11.5px;
  color: #94a3b8;
  display: block;
  margin-top: 1px;
}

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

.status-select {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #059669;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 7px;
  outline: none;
}

/* Messages Area */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8fafc;
}

.bubble {
  max-width: 72%;
  padding: 10px 14px;
  line-height: 1.5;
  font-size: 13.5px;
  border-radius: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bubble small {
  display: block;
  font-size: 10.5px;
  margin-bottom: 4px;
  opacity: 0.75;
}

.bubble.customer {
  align-self: flex-start;
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.bubble.agent {
  align-self: flex-end;
  background: #2563eb;
  color: #ffffff;
  border-bottom-right-radius: 3px;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.2);
}

.bubble.agent small {
  color: #bfdbfe;
}

.bubble.note {
  align-self: center;
  max-width: 85%;
  background: #fef3c7;
  border: 1px solid #fde68a;
  color: #92400e;
  border-radius: 8px;
  font-size: 12.5px;
}

/* Composer */
.composer-area {
  background: #ffffff;
  border-top: 1px solid #eaedf2;
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.compose-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 6px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #2563eb;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.12s ease;
}

.ai-button:hover {
  background: #dbeafe;
}

.compose-options {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sender-select, .reply-select {
  font-size: 12px;
  padding: 5px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #334155;
  outline: none;
}

.compose-input-box textarea {
  width: 100%;
  border: 0;
  outline: none;
  font-size: 13.5px;
  resize: none;
  min-height: 48px;
  font-family: inherit;
}

.compose-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #f1f5f9;
  padding-top: 8px;
}

.compose-hint {
  font-size: 11.5px;
  color: #94a3b8;
}

.btn-send {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #2563eb;
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s ease;
}

.btn-send:hover {
  background: #1d4ed8;
}

/* Customer Profile Drawer */
.profile-drawer {
  width: 270px;
  background: #ffffff;
  border-left: 1px solid #eaedf2;
  padding: 20px;
  overflow-y: auto;
  flex-shrink: 0;
}

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

.profile-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.profile-avatar-wrap {
  text-align: center;
  padding-bottom: 18px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 16px;
}

.profile-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #d946ef;
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  display: grid;
  place-items: center;
  margin: 0 auto 10px;
}

.profile-avatar-wrap h2 {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 6px;
}

.profile-tag-badge {
  display: inline-block;
  font-size: 11.5px;
  background: #eff6ff;
  color: #2563eb;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.profile-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-label {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

.field-value {
  font-size: 13.5px;
  color: #0f172a;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.field-select {
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12.5px;
  background: #ffffff;
}

/* ==========================================================================
   7. Modules & Business Sections
   ========================================================================== */
.module-section {
  padding: 24px 32px;
  overflow-y: auto;
  height: 100%;
}

.module-section h2 {
  font-size: 22px;
  font-weight: 750;
  color: #0f172a;
  margin-bottom: 6px;
}

.muted {
  font-size: 13.5px;
  color: #64748b;
  margin-bottom: 18px;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin: 18px 0;
}

.module-card, .settings-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  margin-bottom: 18px;
}

.module-card h3, .settings-card h3 {
  font-size: 15.5px;
  font-weight: 700;
  margin-bottom: 14px;
  color: #0f172a;
}

.module-form {
  display: grid;
  gap: 12px;
}

.module-form.inline {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.module-form.inline > * {
  flex: 1;
  min-width: 150px;
}

.module-form input, .module-form select, .module-form textarea,
.quick-form input, .quick-form select, .quick-form textarea,
.settings-card input, .settings-card textarea {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 13px;
  outline: none;
}

.module-form input:focus, .module-form select:focus, .module-form textarea:focus {
  border-color: #2563eb;
}

.module-form button, .module-card button, .quick-form button, .settings-card button {
  background: #2563eb;
  color: #ffffff;
  border-radius: 7px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  justify-self: start;
}

.module-card button:hover, .module-form button:hover {
  background: #1d4ed8;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  color: #64748b;
  font-weight: 600;
  background: #f8fafc;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
}

td {
  padding: 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.stat {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
}

.stat strong {
  display: block;
  font-size: 24px;
  color: #2563eb;
  font-weight: 750;
}

.stat span {
  font-size: 12px;
  color: #64748b;
}

.quick-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  margin: 10px 0;
}

.quick-row small {
  color: #64748b;
  font-size: 12px;
  display: block;
  margin-top: 3px;
}

.quick-row p {
  font-size: 13px;
  color: #334155;
  margin-top: 6px;
}

.quick-row button {
  background: #f1f5f9;
  color: #334155;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.quick-row button:hover {
  background: #e2e8f0;
}

.export-link {
  display: inline-block;
  color: #2563eb;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}

.export-link:hover {
  text-decoration: underline;
}

/* Floating Widget Helper */
.floating-widget-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 46px;
  height: 46px;
  background: #ec4899;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(236, 72, 153, 0.4);
  text-decoration: none;
  transition: transform 0.2s ease;
  z-index: 99;
}

.floating-widget-trigger:hover {
  transform: scale(1.08);
}

/* ==========================================================================
   8. Responsive Design
   ========================================================================== */
@media (max-width: 1024px) {
  .profile-drawer {
    display: none;
  }
}

@media (max-width: 820px) {
  .top-tab span, .user-name {
    display: none;
  }
  .inbox-column {
    width: 290px;
  }
}

@media (max-width: 640px) {
  .slim-sidebar {
    display: none;
  }
  .inbox-column {
    width: 100%;
  }
  .main-workspace {
    display: none;
  }
  .inbox-section.has-selection .inbox-column {
    display: none;
  }
  .inbox-section.has-selection .main-workspace {
    display: flex;
    width: 100%;
  }
  .back-btn {
    display: grid;
  }
}
