.page.active#p-cshub {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 145px);
  padding-bottom: 15px;
  margin-bottom: 0;
  overflow: hidden;
  gap: 20px;
}

/* Category Tabs Styling */
.cs-category-tabs {
  display: flex;
  flex-wrap: wrap;
  background: var(--hover-bg);
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 15px;
  gap: 4px;
}

.cs-cat-btn {
  flex: 1;
  min-width: 60px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 10px 5px;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
}

.cs-cat-btn.active {
  background: var(--bg-surface) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-sm) !important;
}

.cs-cat-btn i {
  font-size: 16px;
}

.cs-cat-btn span {
  font-size: 10px;
  font-weight: 700;
}

.cs-cat-btn.active span {
  font-weight: 800;
}

.cs-main-wrapper {
  display: flex;
  gap: 20px;
  /* Matched with stats-four-grid gap */
  flex: 1;
  min-height: 0;
  direction: rtl;
  padding: 0;
  /* Removed redundant padding to align with top cards */
}

.cs-sidebar-list {
  flex: 0 0 350px;
  background: var(--bg-surface);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
}

.cs-chat-center {
  flex: 1;
  background: var(--bg-surface);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
}

.cs-info-sidebar {
  flex: 0 0 320px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.modern-ticket-card {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  background: var(--bg-surface);
  animation: ticketFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes ticketFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modern-ticket-card:hover {
  background: var(--hover-bg);
  transform: translateX(-4px);
}

.modern-ticket-card.active {
  background: var(--active-bg);
  border-right: 4px solid var(--primary);
  box-shadow: inset 4px 0 10px rgba(0, 0, 0, 0.02);
}

.ticket-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
  font-size: 15px;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.modern-ticket-card:hover .ticket-avatar {
  transform: rotate(5deg) scale(1.05);
  background: var(--primary);
  color: white;
  border-color: transparent;
}

.ticket-client-name {
  font-weight: 800;
  font-size: 13.5px;
  color: var(--text-primary);
}

.ticket-id-tag {
  font-size: 9.5px;
  color: var(--text-muted);
  font-weight: 600;
  direction: ltr;
}

.ticket-subject-text {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 600;
  line-height: 1.45;
}

.ticket-badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  display: inline-block;
  letter-spacing: 0.3px;
  backdrop-filter: blur(4px);
}

body.dark-mode .ticket-badge {
  background-opacity: 0.15 !important;
}

body.dark-mode .ticket-badge[style*="#fef2f2"],
body.dark-mode .ticket-badge[style*="239, 68, 68"] {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #f87171 !important;
}

body.dark-mode .ticket-badge[style*="#fff7ed"],
body.dark-mode .ticket-badge[style*="245, 158, 11"] {
  background: rgba(245, 158, 11, 0.15) !important;
  color: #fb923c !important;
}

body.dark-mode .ticket-badge[style*="#f0fdf4"],
body.dark-mode .ticket-badge[style*="16, 185, 129"] {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #4ade80 !important;
}

.chat-msg-row {
  display: flex !important;
  margin-bottom: 16px;
  width: 100% !important;
  flex-direction: row !important;
  opacity: 0;
  animation: msgSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes msgSlideIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.chat-msg-row.me {
  justify-content: flex-end !important;
}

.chat-msg-row.other {
  justify-content: flex-start !important;
}

.bubble-container {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}

.bubble-container.me {
  align-items: flex-end;
}

.bubble-container.other {
  align-items: flex-start;
}

.bubble {
  padding: 11px 18px;
  border-radius: 20px;
  font-size: 13.5px;
  line-height: 1.55;
  position: relative;
  display: inline-block;
  direction: rtl !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s ease;
}

.bubble:hover {
  transform: translateY(-1px);
}

.bubble.me {
  background: linear-gradient(135deg, var(--remind-blue) 0%, #0369a1 100%);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px rgba(2, 132, 199, 0.15);
}

.bubble.other {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}

body.dark-mode .bubble.other {
  background: var(--bg-elevated);
  border-color: var(--border-subtle);
}

.bubble-meta {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 6px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  direction: rtl;
  font-weight: 600;
}

.bubble.system {
  background: var(--hover-bg);
  color: var(--text-secondary);
  font-size: 11.5px;
  text-align: center;
  width: auto;
  max-width: 85%;
  margin: 12px auto;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  padding: 6px 14px;
  border: 1px solid var(--border-subtle);
  font-weight: 700;
}

.chat-time {
  font-size: 10px;
  color: #667781;
  margin-top: 4px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 3px;
}

.chat-date-separator {
  text-align: center;
  margin: 20px 0;
  position: relative;
}

.chat-sender-name {
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 4px;
  color: #008069;
  display: block;
}

.bubble.me .chat-sender-name {
  color: #005a4e;
  text-align: right;
}

.bubble.other .chat-sender-name {
  color: #53bdeb;
  text-align: left;
}


.chat-date-label {
  background: var(--bg-elevated);
  padding: 5px 12px;
  border-radius: 10px;
  font-size: 11px;
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  display: inline-block;
  text-transform: uppercase;
}

@media (max-width: 1024px) {
  .page.active#p-cshub {
    display: flex !important;
    flex-direction: column !important;
    height: 100dvh !important;
    padding-top: 70px !important;
    padding-bottom: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
  }

  .cs-main-wrapper {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
    height: auto !important;
    min-height: unset !important;
    position: relative !important;
    overflow: hidden !important;
  }

  .cs-sidebar-list {
    display: flex !important;
    flex: 1 !important;
    height: auto !important;
    width: 100% !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    transform: translateX(0) !important;
    opacity: 1 !important;
  }

  .cs-chat-center {
    display: flex !important;
    height: 100dvh !important;
    width: 100vw !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 99999 !important;
    transform: translateX(-100%) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s !important;
    visibility: hidden !important;
    background: var(--bg-surface) !important;
    border-radius: 0 !important;
    border: none !important;
  }

  .cs-main-wrapper.show-details .cs-sidebar-list {
    transform: translateX(20%) !important;
    opacity: 0.4 !important;
    pointer-events: none !important;
  }

  .cs-main-wrapper.show-details .cs-chat-center {
    transform: translateX(0) !important;
    visibility: visible !important;
  }

  /* show-details: same flex fill — no height jump */
  .cs-main-wrapper.show-details {
    flex: 1 !important;
    margin-top: 0;
  }

  .cs-mobile-back {
    display: block !important;
    margin-left: 10px;
    font-size: 18px;
    cursor: pointer;
  }

  .cs-info-sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(4px);
  }

  .cs-info-sidebar.mobile-open {
    display: flex !important;
    animation: fadeIn 0.2s ease;
  }

  .cs-info-sidebar .client-super-card {
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
  }

  .cs-mobile-close-info {
    display: flex !important;
  }
}

/* PREMIUM MOBILE RESPONSIVE STYLES FOR CS HUB (SUPPORT) */
@media (max-width: 768px) {
  .page.active#p-cshub {
    display: flex !important;
    flex-direction: column !important;
    height: 100dvh !important;
    padding-top: 70px !important;
    padding-bottom: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
  }

  .cs-main-wrapper {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
    height: auto !important;
    min-height: unset !important;
    margin-top: 0 !important;
    position: relative !important;
    overflow: hidden !important;
  }

  .cs-main-wrapper.show-details {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
    height: auto !important;
    min-height: unset !important;
    margin-top: 0 !important;
    position: relative !important;
    overflow: hidden !important;
  }

  /* PREMIUM MOBILE SUPPORT CHAT HEADER FIXES — single row */
  #cs-ticket-header {
    flex-wrap: nowrap !important;
    gap: 8px !important;
    padding: 10px 14px !important;
    height: auto !important;
    background: #ffffff !important;
    border-bottom: 1px solid var(--border-subtle) !important;
    direction: ltr !important;
  }

  body.dark-mode #cs-ticket-header {
    background: #1e2630 !important;
  }

  /* Back arrow button styling */
  .cs-mobile-back {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px !important;
    background: var(--bg-elevated) !important;
    border: 1px solid var(--border-subtle) !important;
    color: var(--text-primary) !important;
    flex-shrink: 0 !important;
  }

  .cs-mobile-back i {
    transform: scaleX(-1) !important;
    /* Flip so arrow points ← in RTL */
  }

  /* Subject text */
  #cs-ticket-subj {
    color: var(--text-primary) !important;
    font-size: 14px !important;
    font-weight: 800 !important;
    margin: 0 !important;
    text-align: right !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* Action buttons group */
  #cs-ticket-header>div:last-child {
    gap: 4px !important;
  }

  /* Status Dropdown */
  #cs-ticket-header .cs-status-dropdown-container {
    margin: 0 !important;
  }


  .cs-status-trigger {
    height: 32px !important;
    padding: 5px 12px !important;
    border-radius: 8px !important;
    font-size: 12px !important;
    background: var(--bg-elevated) !important;
  }

  /* Fix hardcoded white text for Status label */
  #cs-current-status-label {
    color: var(--text-primary) !important;
  }
}

.cs-mobile-close-info {
  display: none;
  position: absolute;
  top: 15px;
  left: 15px;
  background: rgba(255, 255, 255, 0.3);
  border: none;
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.select2-container--open,
.select2-container--open .select2-dropdown,
.select2-dropdown {
  z-index: 9999999 !important;
}

.client-super-card {
  padding: 0 !important;
  margin: 0;
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  overflow: hidden;
  background: var(--bg-surface);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04), 0 0 0 1px var(--border-subtle);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.client-super-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--border-medium);
}

.client-cover {
  height: 120px;
  background: linear-gradient(135deg, #0868a3 0%, #14b8a6 50%, #0284c7 100%);
  position: relative;
  overflow: hidden;
}

.client-cover::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.15) 1px, transparent 1px);
  background-size: 10px 10px;
  opacity: 0.4;
  pointer-events: none;
}

.client-cover::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  right: -50%;
  bottom: -50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 60%);
  transform: rotate(30deg);
  pointer-events: none;
  animation: coverGlow 8s ease-in-out infinite alternate;
}

@keyframes coverGlow {
  0% {
    transform: rotate(30deg) translate(-5%, -5%);
  }

  100% {
    transform: rotate(35deg) translate(5%, 5%);
  }
}

.client-avatar-wrapper {
  width: 96px;
  height: 96px;
  background: var(--bg-surface);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: -48px auto 16px;
  font-size: 38px;
  font-weight: 900;
  color: #0868a3;
  box-shadow: 0 10px 25px rgba(8, 104, 163, 0.12),
    0 0 0 4px var(--bg-surface),
    0 0 0 6px var(--border-subtle);
  position: relative;
  z-index: 2;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-shadow: 0 2px 10px rgba(8, 104, 163, 0.15);
}

.client-super-card:hover .client-avatar-wrapper {
  transform: scale(1.06) translateY(-2px);
  box-shadow: 0 15px 35px rgba(8, 104, 163, 0.2),
    0 0 0 4px var(--bg-surface),
    0 0 0 6px var(--primary);
  color: #14b8a6;
}

.client-super-card h4.client-name {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.client-super-card p.client-phone {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.5px;
  opacity: 0.8;
}

.quick-actions-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
  margin-bottom: 8px;
}

.action-btn-circle {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  cursor: pointer;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}

.action-btn-circle:hover {
  transform: translateY(-4px) scale(1.05);
}

.action-btn-circle.wa {
  background: rgba(37, 211, 102, 0.06);
  color: #25D366;
  border-color: rgba(37, 211, 102, 0.15);
}

.action-btn-circle.wa:hover {
  background: #25D366;
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 20px rgba(37, 211, 102, 0.25);
}

.action-btn-circle.call {
  background: rgba(59, 130, 246, 0.06);
  color: #3b82f6;
  border-color: rgba(59, 130, 246, 0.15);
}

.action-btn-circle.call:hover {
  background: #3b82f6;
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 20px rgba(59, 130, 246, 0.25);
}

.action-btn-circle.key {
  background: rgba(245, 158, 11, 0.06);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.15);
}

.action-btn-circle.key:hover {
  background: #f59e0b;
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 20px rgba(245, 158, 11, 0.25);
}

.action-btn-circle.edit {
  background: rgba(139, 92, 246, 0.06);
  color: #8b5cf6;
  border-color: rgba(139, 92, 246, 0.15);
}

.action-btn-circle.edit:hover {
  background: #8b5cf6;
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 20px rgba(139, 92, 246, 0.25);
}

.cs-client-details-section {
  margin-top: 24px;
  text-align: right;
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13.5px;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.info-row:hover {
  transform: translateY(-3px);
  background: var(--hover-bg);
  border-color: var(--border-medium);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.03);
}

.info-label {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
  font-weight: 750;
}

.info-label i {
  width: 32px !important;
  height: 32px !important;
  border-radius: 10px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  color: #fff !important;
}

.info-row:nth-child(1) .info-label i {
  background: linear-gradient(135deg, #0868a3, #0284c7) !important;
}

.info-row:nth-child(2) .info-label i {
  background: linear-gradient(135deg, #8b5cf6, #d946ef) !important;
}

.info-row:hover .info-label i {
  transform: scale(1.1) rotate(5deg);
}

.info-val {
  color: var(--text-primary);
  font-weight: 850;
  font-size: 13.5px;
}

.cs-balance-card {
  margin-top: 10px;
  background: linear-gradient(135deg, rgba(8, 104, 163, 0.05) 0%, rgba(20, 184, 166, 0.05) 100%);
  border: 1px solid var(--border-subtle);
  padding: 18px;
  border-radius: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 12px rgba(20, 184, 166, 0.03);
  transition: all 0.3s ease;
}

.cs-balance-card:hover {
  transform: translateY(-3px);
  border-color: rgba(20, 184, 166, 0.25);
  box-shadow: 0 12px 25px rgba(20, 184, 166, 0.06), inset 0 0 12px rgba(20, 184, 166, 0.05);
}

.cs-balance-card::after {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, rgba(20, 184, 166, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.cs-balance-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13.5px;
  font-weight: 800;
  margin-bottom: 12px;
}

.cs-balance-lbl {
  color: var(--text-secondary);
}

#cs-info-balance-text {
  color: #14b8a6;
  font-weight: 900;
  font-size: 15px;
}

.balance-progress-bg {
  background: var(--bg-elevated);
  height: 10px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  position: relative;
}

.balance-progress-fill {
  height: 100%;
  border-radius: 20px;
  background: linear-gradient(90deg, #14b8a6 0%, #0868a3 50%, #14b8a6 100%) !important;
  background-size: 200% auto;
  animation: shimmerBar 3s linear infinite;
  box-shadow: 0 0 12px rgba(20, 184, 166, 0.3);
  transition: width 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes shimmerBar {
  0% {
    background-position: 0% 50%;
  }

  100% {
    background-position: 200% 50%;
  }
}

.cs-ticket-code-footer {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin: 14px auto 0;
  padding: 8px 14px;
  background: var(--bg-elevated);
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.cs-ticket-code-footer:hover {
  background: var(--hover-bg);
  border-color: var(--border-medium);
  color: var(--text-secondary);
  transform: translateY(-1px);
}

.cs-ticket-code-footer i {
  color: var(--text-muted);
  opacity: 0.8;
}

.cs-ticket-code-footer #cs-ticket-id-lbl {
  font-family: 'Inter', monospace;
  font-weight: 700;
  color: var(--text-secondary);
}

.analytics-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  box-shadow: var(--shadow-md);
  margin-bottom: 25px;
  transition: all 0.3s ease;
}

.analytics-header {
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--hover-bg);
}

.analytics-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-weight: 800;
  font-size: 15px;
}

.analytics-title i {
  font-size: 18px;
  color: var(--text-primary);
}

.analytics-stats {
  display: flex;
  gap: 10px;
}

.stat-badge {
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: bold;
}

.stat-badge.blue {
  background: #e0f2fe;
  color: #0284c7;
  border: 1px solid #bae6fd;
}

.stat-badge.green {
  background: #dcfce7;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

.stat-badge .label {
  opacity: 0.8;
}

.analytics-filters {
  display: flex;
  gap: 8px;
  padding: 10px 20px;
  background: var(--active-bg);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  scrollbar-width: none;
}

.analytics-filters::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  padding: 6px 15px;
  border-radius: 8px;
  border: 1px solid var(--border-medium);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-weight: 700;
}

.filter-btn:hover {
  border-color: #475569;
  color: #475569;
}

.filter-btn.active {
  background: #475569;
  color: #fff;
  border-color: #475569;
  box-shadow: var(--shadow-md);
}

.chart-container-wrapper {
  padding: 20px;
  height: 320px;
  position: relative;
}

.hide-on-mobile {
  display: flex;
}

@media (max-width: 600px) {
  .hide-on-mobile {
    display: none !important;
  }

  .analytics-filters {
    padding: 10px 15px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .filter-bar {
    flex-direction: column;
  }

  .glass-btn {
    width: 100%;
  }

  .profile-grid {
    gap: 12px;
    margin: 15px 0;
  }

  .profile-card {
    width: 95px;
    padding: 12px 8px;
    border-radius: 16px;
  }

  .profile-img {
    width: 65px;
    height: 65px;
    border-radius: 14px;
  }

  .profile-name {
    margin-top: 8px;
    font-size: 11px;
  }

  .analytics-header {
    flex-direction: column;
    gap: 15px;
    align-items: center;
    text-align: center;
    padding: 20px 15px;
  }

  .analytics-title {
    justify-content: center;
    width: 100%;
  }

  .premium-badge {
    width: 100%;
    justify-content: center;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

@keyframes tDot {

  0%,
  80%,
  100% {
    opacity: 0.3;
    transform: scale(1)
  }

  40% {
    opacity: 1;
    transform: scale(1.25)
  }
}

#chat-quick-btns::-webkit-scrollbar {
  display: none;
}

.cs-input-area {
  padding: 10px 15px;
  background: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--border-subtle);
  position: sticky;
  bottom: 0;
  z-index: 10;
  box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.06);
}

body.dark-mode .cs-input-area {
  background: #1e2630;
}

.cs-input-wrap {
  flex: 1;
  background: var(--bg-elevated);
  border-radius: 24px;
  padding: 2px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 45px;
}

.cs-input-wrap textarea {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 0;
  font-family: 'Cairo';
  font-size: 14px;
  resize: none;
  max-height: 120px;
  outline: none;
  height: 42px;
  overflow: hidden;
  /* Hide arrows/scrollbars */
  scrollbar-width: none;
}

.cs-input-wrap textarea::-webkit-scrollbar {
  display: none;
}

.cs-input-btn {
  background: transparent;
  border: none;
  color: #54656f;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  transition: color 0.2s;
}

.cs-input-btn:hover {
  color: #111b21;
}

.cs-send-btn-circle {
  background: var(--text-primary);
  color: var(--bg-surface);
  border: none;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
  flex-shrink: 0;
}

.cs-send-btn-circle:hover {
  background: var(--text-secondary);
  transform: scale(1.05);
}

/* WhatsApp Style Custom Status Dropdown */
.cs-status-dropdown-container {
  position: relative;
  display: inline-block;
}

.cs-status-trigger {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
  height: 36px;
  font-family: 'Cairo';
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 700;
  user-select: none;
}

.cs-status-trigger:hover {
  background: var(--hover-bg);
  border-color: var(--border-subtle);
}

.cs-status-menu {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  background: var(--bg-elevated);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  display: none;
  z-index: 1000;
  padding: 8px 0;
  overflow: hidden;
  animation: fadeInScale 0.2s ease;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.cs-status-menu.open {
  display: block;
}

.cs-status-item {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 600;
}

.cs-status-item:hover {
  background: var(--hover-bg);
}

.status-tag-shape {
  width: 16px;
  height: 12px;
  background: currentColor;
  clip-path: polygon(0% 0%, 70% 0%, 100% 50%, 70% 100%, 0% 100%);
  display: inline-block;
  border-radius: 2px 0 0 2px;
}

/* Status Colors */
.color-open {
  color: #ef4444;
}

.color-progress {
  color: #f59e0b;
}

.color-closed {
  color: #10b981;
}

.cs-status-trigger .status-tag-shape {
  margin-top: 1px;
}

/* Enhanced Emoji Picker Styles */
.emoji-menu {
  position: absolute;
  bottom: 75px;
  right: 20px;
  background: var(--bg-surface);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  width: 320px;
  height: 350px;
  display: none;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  animation: emojiFadeIn 0.2s ease-out;
}

@keyframes emojiFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.emoji-menu.open {
  display: flex;
}

.emoji-header {
  padding: 12px 15px;
  background: var(--hover-bg);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  direction: rtl;
}

.emoji-grid {
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  overflow-y: auto;
  overflow-x: hidden !important;
  /* Force no horizontal scroll */
  flex: 1;
  scrollbar-width: thin;
  direction: ltr;
  /* For scrollbar on right */
}

.emoji-grid::-webkit-scrollbar {
  width: 6px;
}

.emoji-grid::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

.emoji-category-title {
  grid-column: span 7;
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  margin: 12px 0 6px;
  padding: 0 4px;
  text-align: right;
  direction: rtl;
}

.emoji-item {
  font-size: 24px;
  cursor: pointer;
  text-align: center;
  padding: 6px;
  border-radius: 10px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  direction: ltr;
}

.emoji-item:hover {
  background: #f1f5f9;
  transform: scale(1.2);
}

.emoji-item:active {
  transform: scale(0.9);
}

/* SMART WIDGET STACK (Samsung Style) */
.widget-stack-container {
  overflow: hidden;
  border-radius: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
  position: relative;
  border: 1px solid rgba(0, 0, 0, 0.05);
  background: #f8fafc;
  direction: rtl;
  /* maintain rtl inside */
}

/* Specific inner Swiper styling */
.widget-stack-container.swiper {
  width: 100%;
  height: 100%;
}

.widget-stack-container .swiper-slide {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  box-sizing: border-box;
  cursor: grab;
  border-radius: 24px;
  padding: 20px;
}

.widget-stack-container .swiper-slide:active {
  cursor: grabbing;
}

.widget-stack-container .swiper-pagination {
  bottom: 8px !important;
}

.widget-stack-container .swiper-pagination-bullet {
  background: rgba(255, 255, 255, 0.5);
  opacity: 1;
  width: 6px;
  height: 6px;
  transition: all 0.3s;
}

.widget-stack-container .swiper-pagination-bullet-active {
  background: #ffffff;
  width: 16px;
  border-radius: 4px;
}

.stack-action-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  padding: 8px 12px;
  border-radius: 12px;
  font-family: 'Cairo';
  font-size: 12px;
  cursor: pointer;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  font-weight: bold;
  backdrop-filter: blur(5px);
  transition: all 0.2s;
}

.stack-action-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.cs-secondary-cards {
  display: flex;
  gap: 15px;
  margin-top: 15px;
}

.cs-secondary-card {
  flex: 1;
  background: #fff;
  border-radius: 20px;
  padding: 15px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cs-secondary-card h4 {
  margin: 0;
  font-size: 13px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cs-card-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.star-item,
.service-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #1e293b;
  padding: 6px 10px;
  background: #f8fafc;
  border-radius: 10px;
}

.star-name,
.service-name {
  font-weight: 600;
}

.star-count,
.service-count {
  color: #f59e0b;
  font-weight: 800;
}

/* LOADING SKELETONS FOR TICKETS LIST */
.cs-skeleton-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--bg-surface);
}

.cs-skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  flex-shrink: 0;
}

.cs-skeleton-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cs-skeleton-line {
  border-radius: 4px;
}

.cs-skeleton-line.title {
  width: 50%;
  height: 14px;
}

.cs-skeleton-line.subtitle {
  width: 80%;
  height: 11px;
}

.cs-skeleton-line.badge {
  width: 25%;
  height: 18px;
  border-radius: 6px;
}

/* Skeleton Glow/Pulse Animation */
.cs-skeleton-glow {
  background: linear-gradient(90deg,
      var(--bg-elevated) 25%,
      var(--hover-bg) 37%,
      var(--bg-elevated) 63%);
  background-size: 400% 100%;
  animation: cs-skeleton-animation 1.4s ease infinite;
}

body.dark-mode .cs-skeleton-glow {
  background: linear-gradient(90deg,
      var(--bg-surface) 25%,
      var(--border-subtle) 37%,
      var(--bg-surface) 63%);
  background-size: 400% 100%;
}

@keyframes cs-skeleton-animation {
  0% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

/* GLOWING ACTIVE STAT CARDS */
#p-cshub .stats-five-grid .stat-card {
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#p-cshub .stats-five-grid .stat-card.active-filter {
  transform: translateY(-5px);
  border-width: 1px;
}

#p-cshub .stats-five-grid .stat-card.blue.active-filter {
  border-color: #3b82f6 !important;
  box-shadow: 0 10px 25px rgba(59, 130, 246, 0.15), var(--shadow-md) !important;
}

#p-cshub .stats-five-grid .stat-card.orange.active-filter {
  border-color: #f59e0b !important;
  box-shadow: 0 10px 25px rgba(245, 158, 11, 0.15), var(--shadow-md) !important;
}

#p-cshub .stats-five-grid .stat-card.red.active-filter {
  border-color: #ef4444 !important;
  box-shadow: 0 10px 25px rgba(239, 68, 68, 0.15), var(--shadow-md) !important;
}

#p-cshub .stats-five-grid .stat-card.green.active-filter {
  border-color: #10b981 !important;
  box-shadow: 0 10px 25px rgba(16, 185, 129, 0.15), var(--shadow-md) !important;
}

/* Specific styling for the fifth archived card */
#p-cshub .stats-five-grid .stat-card:nth-child(5).active-filter {
  border-color: var(--text-muted) !important;
  box-shadow: 0 10px 25px rgba(148, 163, 184, 0.15), var(--shadow-md) !important;
}

/* NOTES LOADER */
.cs-notes-loader {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  width: 100%;
  padding-top: 120px;
  color: var(--remind-blue);
}

/* EMPTY TICKETS LIST */
.cs-empty-tickets {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-weight: 800;
  font-size: 13px;
}

/* MODERN FUTURISTIC EMPTY STATE */
#cs-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 100px 20px;
  animation: fadeIn 0.5s ease-out forwards;
}

.empty-icon-box {
  width: 90px;
  height: 90px;
  border-radius: 30px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.empty-icon-box::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(3, 110, 161, 0.05) 0%, transparent 70%);
}

.empty-icon-box i {
  font-size: 36px;
  color: var(--remind-blue);
  opacity: 0.6;
  animation: floatIcon 3s ease-in-out infinite;
}

#cs-empty-state h4 {
  color: var(--text-primary);
  font-weight: 900;
  font-size: 17px;
  margin: 0 0 8px 0;
}

#cs-empty-state p {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin: 0;
}

@keyframes floatIcon {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

/* ==========================================================================
     WHATSAPP BUSINESS SYSTEM - corporate RE-MIND BEAUTIFUL SCHEME
     ========================================================================== */

/* Collapsible Details Drawer desktop toggling */
@media (min-width: 1025px) {
  .cs-main-wrapper.hide-details .cs-info-sidebar {
    display: none !important;
  }
}

/* WhatsApp search pill & new ticket button */
.cs-search-input {
  margin: 0 !important;
  height: 38px !important;
  font-size: 12.5px !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: 99px !important;
  width: 100% !important;
  padding: 0 16px 0 40px !important;
  outline: none !important;
  background: var(--bg-surface) !important;
  color: var(--text-primary) !important;
  font-family: inherit !important;
  font-weight: 700 !important;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.cs-search-input:focus {
  background: var(--bg-surface) !important;
  border-color: #14b8a6 !important;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15) !important;
}

.cs-new-ticket-btn {
  background: linear-gradient(135deg, #005082, #14b8a6) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 12px !important;
  padding: 8px 16px !important;
  font-size: 12px !important;
  font-family: inherit !important;
  cursor: pointer !important;
  font-weight: 800 !important;
  box-shadow: 0 4px 12px rgba(0, 80, 130, 0.25) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  transition: all 0.2s ease !important;
}

.cs-new-ticket-btn:hover {
  background: linear-gradient(135deg, #003d63, #0d9488) !important;
  box-shadow: 0 6px 16px rgba(0, 80, 130, 0.35) !important;
  transform: translateY(-1px) !important;
}

.cs-new-ticket-btn:active {
  transform: translateY(0) scale(0.97) !important;
}

/* Sidebar WhatsApp cards */
.modern-ticket-card {
  display: flex !important;
  align-items: center !important;
  padding: 12px 18px !important;
  border-bottom: 1px solid var(--border-subtle) !important;
  cursor: pointer !important;
  transition: background 0.15s ease !important;
  background: var(--bg-surface) !important;
  gap: 14px !important;
  animation: ticketFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
  transform: none !important;
}

.modern-ticket-card:hover {
  background: var(--hover-bg) !important;
  transform: none !important;
}

.modern-ticket-card.active {
  background: var(--active-bg) !important;
  border-right: none !important;
  border-left: 4px solid #14b8a6 !important;
}

.ticket-avatar-circle {
  width: 46px !important;
  height: 46px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-weight: 800 !important;
  flex-shrink: 0 !important;
  font-size: 16px !important;
  box-shadow: var(--shadow-sm) !important;
  color: white !important;
}

.ticket-card-content {
  flex: 1 !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 3px !important;
}

.ticket-card-row {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  width: 100% !important;
}

.ticket-card-name {
  font-size: 14.5px !important;
  font-weight: 800 !important;
  color: var(--text-primary) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.ticket-card-time {
  font-size: 11.5px !important;
  color: var(--text-muted) !important;
  font-weight: 700 !important;
}

.ticket-card-message {
  font-size: 12.5px !important;
  color: var(--text-muted) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  font-weight: 600 !important;
}

.ticket-card-badge-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
  gap: 10px !important;
}

/* Sleek Scrollbars */
#cs-tickets-list::-webkit-scrollbar,
#cs-log-area::-webkit-scrollbar,
.cs-status-menu::-webkit-scrollbar {
  width: 6px !important;
  height: 6px !important;
}

#cs-tickets-list::-webkit-scrollbar-track,
#cs-log-area::-webkit-scrollbar-track {
  background: transparent !important;
}

#cs-tickets-list::-webkit-scrollbar-thumb,
#cs-log-area::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12) !important;
  border-radius: 99px !important;
}

body.dark-mode #cs-tickets-list::-webkit-scrollbar-thumb,
body.dark-mode #cs-log-area::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12) !important;
}

/* WhatsApp Log area Backdrop */
#cs-log-area {
  flex: 1 !important;
  overflow-y: auto !important;
  padding: 20px 25px !important;
  background-color: #f0faf9 !important;
  /* ultra-light brand pastel mint/teal */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'><g fill='%2314b8a6' fill-opacity='0.035'><path d='M20 20 H30 V30 H20 Z M60 50 H70 V60 H60 Z M100 20 H110 V30 H100 Z M30 80 H40 V90 H30 Z M80 90 H90 V100 H80 Z'/><circle cx='45' cy='25' r='2'/><circle cx='85' cy='15' r='3'/><circle cx='15' cy='65' r='2.5'/><circle cx='95' cy='75' r='2'/><path d='M10 95 Q 20 90 30 95 Q 40 100 50 95' stroke='%2314b8a6' stroke-width='0.5' stroke-opacity='0.045' fill='none'/><path d='M70 25 Q 80 20 90 25 Q 100 30 110 25' stroke='%2314b8a6' stroke-width='0.5' stroke-opacity='0.045' fill='none'/></g></svg>") !important;
  background-repeat: repeat !important;
  direction: ltr !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
}

body.dark-mode #cs-log-area {
  background-color: #0b1716 !important;
  /* deep premium dark slate-teal */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'><g fill='%2314b8a6' fill-opacity='0.025'><path d='M20 20 H30 V30 H20 Z M60 50 H70 V60 H60 Z M100 20 H110 V30 H100 Z M30 80 H40 V90 H30 Z M80 90 H90 V100 H80 Z'/><circle cx='45' cy='25' r='2'/><circle cx='85' cy='15' r='3'/><circle cx='15' cy='65' r='2.5'/><circle cx='95' cy='75' r='2'/><path d='M10 95 Q 20 90 30 95 Q 40 100 50 95' stroke='%2314b8a6' stroke-width='0.5' stroke-opacity='0.03' fill='none'/><path d='M70 25 Q 80 20 90 25 Q 100 30 110 25' stroke='%2314b8a6' stroke-width='0.5' stroke-opacity='0.03' fill='none'/></g></svg>") !important;
}

/* WhatsApp Speech Bubbles */
.bubble {
  padding: 10px 14px 8px 14px !important;
  font-size: 14.5px !important;
  line-height: 1.5 !important;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12) !important;
  max-width: 100% !important;
  border: none !important;
  transition: none !important;
}

.bubble.me {
  background: #d2f4f2 !important;
  /* corporate teal tint */
  color: #111b21 !important;
  border-radius: 12px 12px 0px 12px !important;
}

body.dark-mode .bubble.me {
  background: #005c53 !important;
  /* dark teal tint */
  color: #e9edef !important;
}

.bubble.other {
  background: #ffffff !important;
  color: #111b21 !important;
  border-radius: 12px 12px 12px 0px !important;
}

body.dark-mode .bubble.other {
  background: #202c33 !important;
  color: #e9edef !important;
}

.chat-sender-name {
  font-size: 12.5px !important;
  font-weight: 850 !important;
  margin-bottom: 4px !important;
  color: #0868a3 !important;
  text-align: right !important;
}

body.dark-mode .chat-sender-name {
  color: #14b8a6 !important;
}

/* Chat Header Styling WhatsApp Web look */
#cs-ticket-header {
  display: none;
  /* controlled dynamically */
  flex-direction: row !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 10px 16px !important;
  border-bottom: 1px solid var(--border-subtle) !important;
  background-color: #ffffff !important;
  min-height: 59px !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06) !important;
  direction: ltr !important;
}

body.dark-mode #cs-ticket-header {
  background-color: #1e2630 !important;
}

.cs-action-btn {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  color: #54656f !important;
  width: 40px !important;
  height: 40px !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 18px !important;
  transition: background 0.2s ease, color 0.2s ease !important;
}

body.dark-mode .cs-action-btn {
  color: #aebac1 !important;
}

.cs-action-btn:hover {
  background-color: rgba(0, 0, 0, 0.05) !important;
  color: #111b21 !important;
}

body.dark-mode .cs-action-btn:hover {
  background-color: rgba(255, 255, 255, 0.05) !important;
  color: #e9edef !important;
}

.cs-action-btn.close:hover {
  background-color: rgba(239, 68, 68, 0.1) !important;
  color: #ef4444 !important;
}

body.dark-mode .cs-action-btn.close:hover {
  background-color: rgba(239, 68, 68, 0.2) !important;
  color: #f87171 !important;
}

/* Custom redesigned Status Dropdown for support hub */
.cs-status-dropdown-container {
  position: relative !important;
  display: inline-block !important;
}

.cs-status-trigger {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 6px 14px !important;
  border-radius: 99px !important;
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border-subtle) !important;
  cursor: pointer !important;
  font-size: 13px !important;
  transition: all 0.2s ease !important;
  user-select: none !important;
}

.cs-status-trigger:hover {
  background: var(--hover-bg) !important;
  border-color: var(--border-medium) !important;
  transform: translateY(-1px) !important;
}

.cs-status-menu {
  position: absolute !important;
  top: 100% !important;
  right: 0 !important;
  margin-top: 8px !important;
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: 16px !important;
  box-shadow: var(--shadow-lg) !important;
  min-width: 140px !important;
  z-index: 1000 !important;
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translateY(10px) !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  overflow: hidden !important;
}

.cs-status-menu.open {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
}

.cs-status-item {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 10px 16px !important;
  cursor: pointer !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  color: var(--text-primary) !important;
  transition: background 0.15s ease !important;
}

.cs-status-item:hover {
  background: var(--hover-bg) !important;
}

.status-tag-shape {
  width: 8px !important;
  height: 8px !important;
  border-radius: 50% !important;
  display: inline-block !important;
}

.status-tag-shape.color-open {
  background-color: #ef4444 !important;
}

.status-tag-shape.color-progress {
  background-color: #f59e0b !important;
}

.status-tag-shape.color-closed {
  background-color: #10b981 !important;
}

/* Premium Options Dropdown (WhatsApp Style) */
.cs-options-dropdown-container {
  position: relative !important;
  display: inline-block !important;
}

.cs-options-trigger {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 36px !important;
  height: 36px !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  user-select: none !important;
  color: var(--text-primary) !important;
}

.cs-options-trigger:hover {
  background: var(--hover-bg) !important;
  transform: scale(1.05) !important;
}

.cs-options-menu {
  position: absolute !important;
  top: 100% !important;
  right: 0 !important;
  margin-top: 8px !important;
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: 16px !important;
  box-shadow: var(--shadow-lg) !important;
  min-width: 160px !important;
  z-index: 1000 !important;
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translateY(10px) !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  overflow: hidden !important;
  direction: rtl !important;
  text-align: right !important;
}

.cs-options-menu.open {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
}

.cs-options-item {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 12px 18px !important;
  cursor: pointer !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  color: var(--text-primary) !important;
  transition: all 0.15s ease !important;
}

.cs-options-item i {
  width: 16px !important;
  text-align: center !important;
  transition: color 0.15s ease !important;
}

.cs-options-item:hover {
  background: var(--hover-bg) !important;
}

.cs-options-item:hover i {
  color: var(--primary) !important;
}

/* WhatsApp Bottom Input Bar */
.cs-input-area {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 10px 16px !important;
  background-color: #ffffff !important;
  border-top: 1px solid var(--border-subtle) !important;
  box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.06) !important;
}

body.dark-mode .cs-input-area {
  background-color: #1e2630 !important;
}

.cs-input-wrap {
  display: flex !important;
  align-items: center !important;
  flex: 1 !important;
  background-color: #ffffff !important;
  border-radius: 24px !important;
  padding: 5px 14px !important;
  gap: 8px !important;
  border: 1px solid transparent !important;
  transition: all 0.2s ease !important;
}

body.dark-mode .cs-input-wrap {
  background-color: #2a3942 !important;
}

.cs-input-wrap:focus-within {
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05) !important;
}

#cs-note-box {
  flex: 1 !important;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  resize: none !important;
  height: 24px !important;
  min-height: 24px !important;
  max-height: 120px !important;
  color: var(--text-primary) !important;
  font-family: inherit !important;
  font-size: 14px !important;
  line-height: 20px !important;
  padding: 2px 4px !important;
}

.cs-input-btn {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  color: #8696a0 !important;
  font-size: 20px !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 36px !important;
  height: 36px !important;
  border-radius: 50% !important;
  transition: background 0.2s ease !important;
}

.cs-input-btn:hover {
  background-color: rgba(0, 0, 0, 0.05) !important;
  color: #54656f !important;
}

body.dark-mode .cs-input-btn:hover {
  background-color: rgba(255, 255, 255, 0.05) !important;
  color: #d1d7db !important;
}

.cs-send-btn-circle {
  width: 44px !important;
  height: 44px !important;
  border-radius: 50% !important;
  background-color: #14b8a6 !important;
  color: #ffffff !important;
  border: none !important;
  outline: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  font-size: 18px !important;
  transition: transform 0.2s ease, background 0.2s ease !important;
  flex-shrink: 0 !important;
}

.cs-send-btn-circle:hover {
  background-color: #0d9488 !important;
  transform: scale(1.05) !important;
}

.cs-send-btn-circle:active {
  transform: scale(0.95) !important;
}

/* Category Switcher Tabs WhatsApp look */
.cs-category-tabs {
  display: flex !important;
  background: var(--bg-elevated) !important;
  padding: 4px !important;
  border-radius: 14px !important;
  margin-bottom: 16px !important;
  gap: 4px !important;
  border: 1px solid var(--border-subtle) !important;
}

.cs-cat-btn {
  flex: 1 !important;
  border: none !important;
  background: transparent !important;
  color: var(--text-muted) !important;
  padding: 10px 8px !important;
  border-radius: 10px !important;
  cursor: pointer !important;
  font-family: inherit !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  transition: all 0.2s ease !important;
}

.cs-cat-btn.active {
  background: #14b8a6 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 10px rgba(20, 184, 166, 0.2) !important;
}

.cs-cat-btn i {
  font-size: 18px !important;
}

.cs-cat-btn span {
  font-size: 11px !important;
  font-weight: 800 !important;
  text-align: center !important;
}

/* =====================================================
     MOBILE & TABLET VERTICAL WHATSAPP BUSINESS REDESIGNS
     ===================================================== */
@media (max-width: 1024px) {

  /* Main Layout padding for the fixed bottom bar */
  #p-cshub .cs-sidebar-list {
    position: relative !important;
    padding-bottom: 75px !important;
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
    height: auto !important;
    min-height: unset !important;
    background: var(--bg-surface) !important;
    overflow: hidden !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
  }

  /* Redesign Stats Grid to display a grid of 4 equal top cards and a full-width archive card */
  #p-cshub .stats-five-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 10px !important;
    padding: 14px 16px 0 16px !important;
    margin-bottom: 16px !important;
    background: transparent !important;
    border-bottom: none !important;
  }

  /* First 4 Cards: All, Open, In Progress, Closed styled as uniform small cards */
  #p-cshub .stats-five-grid .stat-card:nth-child(-n+4) {
    grid-column: span 1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 10px 4px !important;
    border-radius: 16px !important;
    background: var(--bg-elevated) !important;
    border: 1px solid var(--border-subtle) !important;
    cursor: pointer !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02) !important;
    height: 64px !important;
    margin: 0 !important;
    transition: all 0.2s ease !important;
  }

  /* Hide unnecessary headers and arrows for the 4 top cards */
  #p-cshub .stats-five-grid .stat-card:nth-child(-n+4) .card-top {
    display: none !important;
  }

  /* Clear old horizontal ::before content to prevent duplicate text */
  #p-cshub .stats-five-grid .stat-card:nth-child(-n+4) .stat-value::before {
    content: none !important;
  }

  /* Align text vertically */
  #p-cshub .stats-five-grid .stat-card:nth-child(-n+4) .stat-info {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 2px !important;
    margin: 0 !important;
    width: 100% !important;
  }

  #p-cshub .stats-five-grid .stat-card:nth-child(-n+4) .stat-value {
    font-size: 16px !important;
    font-weight: 800 !important;
    color: var(--text-primary) !important;
    margin: 0 !important;
    line-height: 1.2 !important;
  }

  #p-cshub .stats-five-grid .stat-card:nth-child(-n+4) .stat-info .stat-label {
    display: block !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    color: var(--text-muted) !important;
    margin: 0 !important;
    text-align: center !important;
  }

  /* Shorten label for the first card to 'الكل' on mobile */
  #p-cshub .stats-five-grid .stat-card:nth-child(1) .stat-info .stat-label {
    font-size: 0 !important;
  }

  #p-cshub .stats-five-grid .stat-card:nth-child(1) .stat-info .stat-label::after {
    content: "الكل" !important;
    font-size: 11px !important;
  }

  /* Unique theme-matching active filter styles */
  #p-cshub .stats-five-grid .stat-card:nth-child(-n+4).active-filter {
    transform: scale(0.96) !important;
  }

  #p-cshub .stats-five-grid .stat-card:nth-child(1).active-filter {
    border-color: #3b82f6 !important;
    background: rgba(59, 130, 246, 0.08) !important;
  }

  #p-cshub .stats-five-grid .stat-card:nth-child(1).active-filter .stat-value {
    color: #3b82f6 !important;
  }

  #p-cshub .stats-five-grid .stat-card:nth-child(2).active-filter {
    border-color: #f59e0b !important;
    background: rgba(245, 158, 11, 0.08) !important;
  }

  #p-cshub .stats-five-grid .stat-card:nth-child(2).active-filter .stat-value {
    color: #f59e0b !important;
  }

  #p-cshub .stats-five-grid .stat-card:nth-child(3).active-filter {
    border-color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.08) !important;
  }

  #p-cshub .stats-five-grid .stat-card:nth-child(3).active-filter .stat-value {
    color: #ef4444 !important;
  }

  #p-cshub .stats-five-grid .stat-card:nth-child(4).active-filter {
    border-color: #10b981 !important;
    background: rgba(16, 185, 129, 0.08) !important;
  }

  #p-cshub .stats-five-grid .stat-card:nth-child(4).active-filter .stat-value {
    color: #10b981 !important;
  }

  /* Style the 5th Card (Archived) as a beautiful, premium, full-width rounded card */
  #p-cshub .stats-five-grid .stat-card:nth-child(5) {
    grid-column: span 4 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 12px !important;
    background: var(--bg-elevated) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: 16px !important;
    padding: 12px 16px !important;
    margin-top: 6px !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02) !important;
    cursor: pointer !important;
    height: 48px !important;
    transition: all 0.2s ease !important;
  }

  #p-cshub .stats-five-grid .stat-card:nth-child(5):hover {
    background: var(--border-subtle) !important;
    opacity: 0.95 !important;
  }

  /* Keep Archive icon next to the title on the right (RTL layout) */
  #p-cshub .stats-five-grid .stat-card:nth-child(5) .card-top {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    order: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    width: auto !important;
    /* Overrides any desktop full-width constraints */
  }

  #p-cshub .stats-five-grid .stat-card:nth-child(5) .card-top .card-icon-box {
    width: 28px !important;
    height: 28px !important;
    background: rgba(20, 184, 166, 0.08) !important;
    color: #14b8a6 !important;
    border: 1px solid rgba(20, 184, 166, 0.15) !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.dark-mode #p-cshub .stats-five-grid .stat-card:nth-child(5) .card-top .card-icon-box {
    background: rgba(20, 184, 166, 0.15) !important;
    border-color: rgba(20, 184, 166, 0.25) !important;
  }

  #p-cshub .stats-five-grid .stat-card:nth-child(5) .card-top .card-arrow-box {
    display: none !important;
  }

  /* Stat info container - wraps label and ticket count badge */
  #p-cshub .stats-five-grid .stat-card:nth-child(5) .stat-info {
    order: 2 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex: 1 !important;
    margin: 0 !important;
  }

  #p-cshub .stats-five-grid .stat-card:nth-child(5) .stat-info .stat-label {
    display: inline-block !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    margin: 0 !important;
  }

  #p-cshub .stats-five-grid .stat-card:nth-child(5) .stat-info .stat-value {
    font-size: 12px !important;
    font-weight: 700 !important;
    color: #14b8a6 !important;
    background: rgba(20, 184, 166, 0.08) !important;
    padding: 3px 10px !important;
    border-radius: 99px !important;
    border: 1px solid rgba(20, 184, 166, 0.15) !important;
    margin: 0 !important;
    min-width: 24px !important;
    text-align: center !important;
  }

  body.dark-mode #p-cshub .stats-five-grid .stat-card:nth-child(5) .stat-info .stat-value {
    background: rgba(20, 184, 166, 0.15) !important;
    border-color: rgba(20, 184, 166, 0.25) !important;
  }

  /* Archived card active filter style */
  #p-cshub .stats-five-grid .stat-card:nth-child(5).active-filter {
    border-color: #14b8a6 !important;
    background: rgba(20, 184, 166, 0.04) !important;
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.08) !important;
  }

  /* Fixed Bottom Navigation Bar for Chat categories (خدمة العملاء، الدعم الداخلي) */
  #p-cshub .cs-category-tabs {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 999 !important;
    background: var(--bg-surface) !important;
    border: none !important;
    border-top: 1px solid var(--border-subtle) !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 8px 16px !important;
    display: flex !important;
    justify-content: space-around !important;
    align-items: center !important;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.04) !important;
    height: 70px !important;
  }

  /* Style bottom menu items */
  #p-cshub .cs-cat-btn {
    flex: 1 !important;
    max-width: 120px !important;
    padding: 6px 0 !important;
    background: transparent !important;
    color: var(--text-muted) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 2px !important;
  }

  #p-cshub .cs-cat-btn.active {
    background: transparent !important;
    color: var(--text-primary) !important;
    box-shadow: none !important;
  }

  #p-cshub .cs-cat-btn i {
    font-size: 18px !important;
    padding: 4px 16px !important;
    border-radius: 16px !important;
    transition: all 0.2s ease !important;
  }

  /* Premium Active state pill backdrop (just like the light green pill in WhatsApp) */
  #p-cshub .cs-cat-btn.active i {
    background: #e8f9f7 !important;
    color: #0d9488 !important;
  }

  body.dark-mode #p-cshub .cs-cat-btn.active i {
    background: rgba(20, 184, 166, 0.15) !important;
    color: #14b8a6 !important;
  }

  #p-cshub .cs-cat-btn span {
    font-size: 9px !important;
    font-weight: 800 !important;
  }

  /* Floating Action Button (FAB) for creating a new support ticket */
  #p-cshub .cs-new-ticket-btn {
    position: fixed !important;
    bottom: 85px !important;
    left: 20px !important;
    z-index: 1000 !important;
    width: 52px !important;
    height: 52px !important;
    border-radius: 16px !important;
    background: linear-gradient(135deg, #005082 0%, #14b8a6 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 6px 20px rgba(0, 80, 130, 0.35) !important;
    display: block !important;
    /* switch to block to avoid flex text-node issue */
    padding: 0 !important;
    border: none !important;
    font-size: 0 !important;
    overflow: hidden !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }

  #p-cshub .cs-new-ticket-btn i {
    position: absolute !important;
    /* absolute centering — immune to text nodes */
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    font-size: 22px !important;
    line-height: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  #p-cshub .cs-new-ticket-btn:hover {
    background: linear-gradient(135deg, #003d63 0%, #0d9488 100%) !important;
    box-shadow: 0 8px 24px rgba(0, 80, 130, 0.45) !important;
    transform: scale(1.06) !important;
  }

  #p-cshub .cs-new-ticket-btn:active {
    transform: scale(0.94) !important;
  }
}