/* styles.css - Main UI Stylesheet */

:root {
  --primary: #00a884;
  --primary-dark: #008f6f;
  --primary-glow: rgba(0, 168, 132, 0.18);

  /* Dark mode surfaces */
  --bg-app: #0b141a;
  --bg-sidebar: #111b21;
  --bg-card: #1e2a32;
  --card-bg: #1e2a32;
  --card-bg-hover: #26343d;
  --bg-main: #0b141a;
  --bg-input: #2a3942;
  --bg-input-focus: #313d45;
  --bg-bubble-in: #202c33;
  --bg-bubble-out: #005c4b;
  --bg-chat-wall: #0d1b21;

  /* Text */
  --text-main: #e9edef;
  --text-muted: #8696a0;
  --text-bubble-in: #e9edef;
  --text-bubble-out: #e9edef;

  /* Borders & shadows */
  --border-color: #222d34;
  --border-input: #2f3d45;
  --shadow-bubble: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-medium: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.35);

  /* Status */
  --danger: #ea0038;
  --danger-hover: #c2002f;
  --warning: #ffbc00;
  --success: #00a884;
  --info: #3498db;

  /* Layout */
  --sidebar-width: 280px;
  --sidebar-collapsed-width: 72px;
  --header-height: 64px;
  --border-radius: 16px;
  --border-radius-sm: 8px;
  --transition-speed: 0.2s;
  --sidebar-transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font-family:
    'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-theme='light'] {
  --bg-app: #f0f2f5;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --card-bg: #ffffff;
  --card-bg-hover: #f5f7f9;
  --bg-main: #f0f2f5;
  --bg-input: #f0f2f5;
  --bg-input-focus: #e6e9ec;
  --bg-bubble-in: #ffffff;
  --bg-bubble-out: #d9fdd3;
  --bg-chat-wall: #e5ddd5;
  --text-main: #111b21;
  --text-muted: #667781;
  --text-bubble-in: #111b21;
  --text-bubble-out: #111b21;
  --border-color: #e9edef;
  --border-input: #d1d7db;
  --shadow-bubble: 0 1px 2px rgba(0, 0, 0, 0.1);
  --shadow-premium: 0 4px 16px rgba(0, 0, 0, 0.07);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(134, 150, 160, 0.35) transparent;
}

/* Custom Modern WhatsApp Gateway Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(134, 150, 160, 0.25);
  border-radius: 999px;
  transition: background var(--transition-speed);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

html {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-main);
  overflow: hidden;
  height: 100%;
  width: 100%;
  -webkit-font-smoothing: antialiased;
  display: flex;
}

.app-layout {
  display: flex;
  width: 100%;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100%;
  transition: var(--sidebar-transition);
  overflow: hidden;
  position: relative;
}

/* ── Collapsed state ─────────────────────────── */
.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .sidebar-footer .sys-info-text,
.sidebar.collapsed .sidebar-footer .sys-info-title {
  display: none !important;
}

.sidebar.collapsed .sidebar-header {
  padding: 0 !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100% !important;
}

.sidebar.collapsed .sidebar-header .logo,
.sidebar.collapsed .logo,
.sidebar.collapsed .logo-icon,
.sidebar.collapsed .logo-text {
  display: none !important;
}

.sidebar.collapsed .sidebar-toggle-btn {
  padding: 0 !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: 48px !important;
  height: 48px !important;
  min-height: 48px !important;
  border-radius: 12px !important;
  margin: 0 auto !important;
  font-size: 16px !important;
  box-sizing: border-box !important;
}

.sidebar.collapsed .nav-menu {
  padding: 16px 8px !important;
  align-items: center !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.sidebar.collapsed .nav-item {
  padding: 0 !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: 48px !important;
  height: 48px !important;
  min-height: 48px !important;
  gap: 0 !important;
  position: relative !important;
  border-radius: 12px !important;
  margin: 0 auto !important;
  box-sizing: border-box !important;
}

.sidebar.collapsed .nav-item .nav-icon,
.sidebar.collapsed .sidebar-toggle-btn i {
  margin: 0 !important;
  width: auto !important;
  min-width: 0 !important;
  text-align: center !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Hide label text in nav items when collapsed */
.sidebar.collapsed .nav-item > span {
  display: none !important;
}

.sidebar.collapsed .sidebar-footer {
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.sidebar-info-badge {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: all var(--transition-speed) ease;
}

.sidebar-info-badge:hover {
  background-color: var(--primary-glow);
  color: var(--primary);
}

.sidebar.collapsed .sidebar-info-badge {
  display: flex;
}

/* Tooltip shown on hover when sidebar is collapsed */
.sidebar.collapsed .nav-item::after,
.sidebar.collapsed .sidebar-info-badge::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-card);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: var(--border-radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  white-space: pre-wrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-premium);
  z-index: 1000;
}

.sidebar.collapsed .nav-item:hover::after,
.sidebar.collapsed .sidebar-info-badge:hover::after {
  opacity: 1;
}

/* Toggle button */
.sidebar-toggle-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--border-radius-sm);
  font-size: 14px;
  line-height: 1;
  transition: all var(--transition-speed) ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: auto;
}

.sidebar.collapsed .sidebar-toggle-btn {
  margin-left: 0;
}

.sidebar-toggle-btn:hover {
  color: var(--text-main);
  background-color: rgba(0, 168, 132, 0.1);
}

/* Smooth text transitions */
.logo-text,
.nav-item > span,
.sidebar-footer .sys-info-text,
.sidebar-footer .sys-info-title {
  transition:
    opacity 0.2s ease,
    width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  transition: padding 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-grow: 1;
  overflow: hidden;
  min-width: 0;
  transition: gap 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo-icon {
  font-size: 28px;
  color: var(--primary);
  filter: drop-shadow(0 0 6px rgba(0, 168, 132, 0.4));
  flex-shrink: 0;
}

.logo-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  white-space: nowrap;
}

.logo-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-main);
  letter-spacing: 0.5px;
}

.logo-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.nav-menu {
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
  overflow-y: auto;
  overflow-x: hidden;
  transition: padding 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  background: none;
  border: none;
  padding: 12px 16px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  text-align: left !important;
  transition: all var(--transition-speed) ease;
  width: 100%;
  text-decoration: none;
  overflow: hidden;
  min-height: unset;
  box-sizing: border-box;
}

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

.nav-item.active {
  color: var(--text-main);
  background-color: rgba(0, 168, 132, 0.15);
  font-weight: 600;
}

.nav-item.active .nav-icon {
  color: var(--primary);
}

.nav-icon {
  font-size: 16px;
  width: 20px;
  min-width: 20px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color var(--transition-speed);
}

.sidebar-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border-color);
  transition: padding 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.chat-back-btn {
  display: none;
}

/* Chat Info Drawer Styles */
.chat-info-drawer {
  width: 360px;
  max-width: 100%;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  border-left: 1px solid var(--border-color);
  background-color: var(--bg-card);
  display: flex;
  flex-direction: column;
  height: 100%;
  z-index: 50;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
  animation: drawerSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes drawerSlideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
}
.drawer-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.drawer-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.drawer-avatar-wrapper {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: 12px;
  box-shadow: var(--shadow-medium);
  position: relative;
}

.drawer-avatar-wrapper.editable {
  cursor: pointer;
}

.drawer-avatar-wrapper.editable:hover .drawer-avatar-overlay {
  opacity: 1;
}

.drawer-avatar-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.2s ease;
  border-radius: 50%;
  user-select: none;
}

.drawer-avatar-overlay i {
  font-size: 20px;
}

.drawer-title-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.drawer-title-edit-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  font-size: 14px;
  border-radius: 4px;
  transition:
    color 0.15s,
    background 0.15s;
}

.drawer-title-edit-btn:hover {
  color: var(--primary);
  background: var(--bg-hover);
}

.drawer-title-edit-form {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 260px;
  margin-top: 4px;
}

.drawer-title-input {
  flex: 1;
  padding: 4px 8px;
  font-size: 14px;
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text-main);
}

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

.drawer-avatar-fallback {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
}

.drawer-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.drawer-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.drawer-section {
  background-color: var(--bg-input);
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.drawer-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.drawer-desc {
  font-size: 13px;
  color: var(--text-main);
  line-height: 1.4;
  white-space: pre-wrap;
}

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

.participants-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
  max-height: 260px;
  overflow-y: auto;
}

.participant-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background 0.15s ease;
}

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

.participant-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 168, 132, 0.12);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.participant-info {
  flex: 1;
  min-width: 0;
}

.participant-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.participant-id {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--primary);
  background: rgba(0, 168, 132, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Mobile Media Queries */
@media (max-width: 768px) {
  /* Universal Responsive Text & Button Overflow Protection */
  .btn,
  button {
    white-space: normal !important;
    word-break: break-word !important;
    height: auto !important;
    min-height: 38px !important;
    max-width: 100% !important;
    text-align: center !important;
    padding: 6px 12px !important;
  }

  .mod-inline-controls,
  .mod-feature-header,
  .mod-field-group,
  .drawer-section,
  .card,
  .mod-card {
    flex-wrap: wrap !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .mod-field-label,
  label,
  .mod-option-label {
    white-space: normal !important;
    word-break: break-word !important;
    max-width: 100% !important;
  }

  .drawer-title,
  .mod-hero-title,
  .mod-feature-title,
  h1,
  h2,
  h3,
  h4 {
    word-break: break-word !important;
    max-width: 100% !important;
  }

  .drawer-value,
  .drawer-desc,
  .mod-feature-desc,
  code {
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    max-width: 100% !important;
  }

  .mod-chip-checkbox,
  label.mod-chip-checkbox {
    white-space: normal !important;
    word-break: break-word !important;
    max-width: 100% !important;
  }

  .chat-info-drawer {
    width: 100% !important;
    position: absolute;
    top: 0;
    left: 0;
  }

  body {
    flex-direction: column;
  }

  .app-layout {
    flex-direction: column;
  }

  /* Mobile Sidebar: Prevent collapsed 72px width bug */
  .sidebar,
  .sidebar.collapsed {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 0 !important;
  }

  /* Restore logo & text hidden by desktop .collapsed mode */
  .sidebar.collapsed .sidebar-header .logo,
  .sidebar.collapsed .logo {
    display: flex !important;
  }

  .sidebar.collapsed .logo-icon {
    display: flex !important;
    font-size: 20px !important;
  }

  .sidebar.collapsed .logo-text {
    display: flex !important;
    flex-direction: column !important;
  }

  .sidebar-header {
    height: 52px !important;
    padding: 0 12px !important;
  }

  .sidebar-toggle-btn {
    display: none !important;
  }

  .nav-menu {
    flex-direction: row !important;
    padding: 6px 8px !important;
    gap: 4px !important;
    width: 100% !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar.collapsed .nav-menu {
    padding: 6px 8px !important;
    align-items: stretch !important;
  }

  .nav-item,
  .sidebar.collapsed .nav-item {
    flex: 0 0 auto !important;
    width: auto !important;
    height: 40px !important;
    padding: 8px 12px !important;
    font-size: 0.85rem !important;
    gap: 6px !important;
    min-height: 40px;
    border-radius: 8px !important;
  }

  .nav-item span,
  .sidebar.collapsed .nav-item > span {
    display: inline-block !important;
    white-space: nowrap !important;
    font-size: 12px !important;
  }

  .sidebar.collapsed .logo-icon {
    font-size: 20px !important;
  }

  .sidebar-footer {
    display: none !important;
  }

  .main-content {
    flex: 1 1 auto !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  /* Mobile Top Header: Responsive controls */
  .top-header {
    height: auto !important;
    min-height: 50px !important;
    padding: 8px 12px !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .header-left {
    gap: 8px !important;
  }

  .header-title {
    font-size: 15px !important;
  }

  .header-actions {
    gap: 6px !important;
    flex-wrap: wrap !important;
    margin-left: auto;
    display: flex !important;
    align-items: center !important;
  }

  .session-selector-container {
    max-width: 150px !important;
    padding: 4px 8px !important;
    display: flex !important;
  }

  .session-label {
    display: none !important;
  }

  .session-select {
    max-width: 120px !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    font-size: 11px !important;
    padding: 4px !important;
  }

  .language-selector-container {
    display: flex !important;
    align-items: center !important;
  }

  .language-selector-container select {
    font-size: 11px !important;
    padding: 4px 6px !important;
    min-width: 65px !important;
  }

  .theme-toggle {
    width: 32px !important;
    height: 32px !important;
    font-size: 14px !important;
    display: flex !important;
  }

  .content-body {
    padding: 10px !important;
    padding-bottom: 10px !important;
    gap: 12px !important;
    flex: 1 1 auto !important;
    height: 100% !important;
    max-height: 100% !important;
  }

  /* Prevent button text wrapping / overflow across cards */
  button,
  .btn,
  .btn-sm,
  .btn-primary,
  .btn-secondary,
  .btn-danger {
    max-width: 100% !important;
    text-overflow: ellipsis !important;
    overflow: hidden !important;
    font-size: 12px !important;
  }

  /* Hero & Card Headers wrap cleanly on mobile */
  .mod-hero,
  .mod-hero-left,
  .mod-settings-card > div[style*='justify-content:space-between'],
  .card > div[style*='justify-content:space-between'] {
    flex-wrap: wrap !important;
    gap: 10px !important;
  }

  /* Mobile Chat Layout: Fullscreen Toggle */
  .chat-container-layout {
    height: 100% !important;
    border-radius: 0 !important;
    border: none !important;
  }

  .chat-list-panel {
    width: 100% !important;
  }

  .chat-thread-panel {
    width: 100% !important;
    display: none;
  }

  .chat-thread-empty,
  #chat-thread-empty {
    display: none !important;
  }

  /* When chat is open on mobile: Hide top app header & sidebar, show chat thread full-screen */
  body.chat-open .top-header,
  body.chat-open .sidebar,
  body.chat-open .banner {
    display: none !important;
  }

  body.chat-open .main-content {
    height: 100% !important;
  }

  body.chat-open .content-body {
    padding: 0 !important;
    height: 100% !important;
  }

  body.chat-open .chat-container-layout {
    height: 100% !important;
  }

  body.chat-open .chat-list-panel {
    display: none !important;
  }

  body.chat-open .chat-thread-panel {
    display: flex !important;
  }

  .chat-back-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.3rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    margin-right: 4px;
  }

  .chat-back-btn:active {
    background-color: var(--bg-input);
  }

  .msg-bubble {
    max-width: 85% !important;
  }

  .emoji-picker {
    width: 100% !important;
    left: 0 !important;
    right: 0 !important;
  }

  .modal-card {
    width: 94% !important;
    padding: 18px !important;
  }
}

/* Modernized Styles & Animations */

.sidebar-header,
.top-header {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.85) !important;
}
html[data-theme='dark'] .sidebar-header,
html[data-theme='dark'] .top-header {
  background: rgba(17, 27, 33, 0.85) !important;
}

.btn {
  transition: all var(--transition-speed) cubic-bezier(0.16, 1, 0.3, 1) !important;
}
.btn:active {
  transform: scale(0.96);
}

.form-group input,
.form-group textarea,
.form-group select {
  transition:
    border-color var(--transition-speed),
    box-shadow var(--transition-speed);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.15);
}

.nav-item {
  transition:
    transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    background-color 0.2s ease,
    color 0.2s ease !important;
}
@media (min-width: 769px) {
  .nav-item:hover {
    transform: translateX(4px);
  }
}
@media (max-width: 768px) {
  .nav-item:active {
    transform: scale(0.95);
  }
}

.chat-message,
.message-wrapper {
  animation: messageSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(4px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.sys-info-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.sys-info-text {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.sys-info-val {
  color: var(--text-main);
  font-weight: 500;
}

.main-content {
  flex: 1 1 0%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-app);
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  position: relative;
}

.top-header {
  height: var(--header-height);
  padding: 0 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-sidebar);
  flex-shrink: 0;
}

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

.header-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

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

.session-selector-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 6px 12px;
  max-width: 320px;
}

.session-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  flex-shrink: 0;
}

.session-select {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  max-width: 220px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.session-select option {
  background-color: var(--bg-card);
  color: var(--text-main);
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-speed);
  background-color: var(--bg-sidebar);
}

.theme-toggle:hover {
  background-color: var(--bg-input);
}

.content-body {
  padding: 32px;
  padding-bottom: 64px;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  flex: 1 1 auto;
  min-height: 0;
  height: calc(100vh - var(--header-height));
  max-height: calc(100vh - var(--header-height));
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 24px;
  -webkit-overflow-scrolling: touch;
}

.banner {
  padding: 16px 20px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: var(--shadow-premium);
}

.banner-warning {
  background-color: rgba(255, 188, 0, 0.08);
  border: 1px solid rgba(138, 109, 28, 0.25);
  color: #7a5f15;
}

html[data-theme='dark'] .banner-warning {
  background-color: rgba(255, 188, 0, 0.08);
  border: 1px solid rgba(255, 188, 0, 0.2);
  color: #ffe699;
}

.banner-warning-icon {
  color: #8f6a00;
  font-size: 20px;
}

html[data-theme='dark'] .banner-warning-icon {
  color: var(--warning);
}

.banner-info {
  background-color: rgba(0, 168, 132, 0.1);
  border: 1px solid rgba(0, 168, 132, 0.3);
  color: #d4f8e3;
}

.banner-info-icon {
  color: var(--primary);
  font-size: 20px;
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 24px;
  width: 100%;
}

.tab-panel.active {
  display: flex;
}

#tab-telegram.active,
#tab-dashboard.active,
#tab-logs.active,
#tab-moderation.active {
  display: flex !important;
  flex-direction: column !important;
  flex: 0 0 auto !important;
  height: auto !important;
  min-height: max-content;
  overflow: visible !important;
  padding-bottom: 32px;
}

#tab-chats.active {
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

@media (min-width: 1100px) {
  .dashboard-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.dashboard-queues-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-top: 24px;
}

@media (min-width: 860px) {
  .dashboard-queues-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 24px;
  box-shadow: var(--shadow-premium);
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 100%;
  box-sizing: border-box;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title i {
  color: var(--primary);
  font-size: 16px;
}

.status-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px 0;
}

.status-badge {
  padding: 8px 18px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.status-badge.connected {
  background-color: rgba(0, 168, 132, 0.15);
  color: var(--primary);
}

.status-badge.disconnected {
  background-color: rgba(234, 0, 56, 0.15);
  color: var(--danger);
}

.status-badge.waiting {
  background-color: rgba(255, 188, 0, 0.15);
  color: var(--warning);
}

.disconnect-reason {
  font-size: 12px;
  color: var(--danger);
  font-weight: 500;
}

.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
}

.stat-box {
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 10px 8px;
  text-align: center;
  position: relative;
}

.stat-scope-tag {
  font-size: 8.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
  background: rgba(37, 211, 102, 0.1);
  padding: 1px 6px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 2px;
}

.stat-val {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.stat-subval {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 3px;
}

.stat-total-badge {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--primary);
  background: rgba(37, 211, 102, 0.08);
  border: 1px solid rgba(37, 211, 102, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 4px;
  letter-spacing: 0.2px;
}

.stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 4px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.info-tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  font-size: 9px;
  border-radius: 50%;
  color: var(--text-muted);
  cursor: help;
  opacity: 0.75;
  transition: opacity 0.2s, color 0.2s;
  text-transform: none;
  font-weight: 700;
}

.info-tooltip-icon:hover {
  opacity: 1;
  color: var(--primary);
}

.qr-container {
  background-color: #ffffff;
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
}

.qr-code {
  max-width: 160px;
  height: auto;
  image-rendering: pixelated;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.history-item {
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 12px;
  position: relative;
}

.history-item.failure {
  border-left: 4px solid var(--danger);
}

.history-time {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.history-target,
.history-sender {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
  display: block;
}

.history-msg {
  font-size: 13px;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-all;
}

.history-reason {
  color: var(--danger);
  font-size: 11px;
  margin-top: 6px;
  font-style: italic;
  font-weight: 500;
}

.empty-state {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 24px;
  font-size: 13px;
}

.details-box {
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.details-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.details-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

code {
  background-color: var(--bg-input);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12px;
  word-break: break-all;
  border: 1px solid var(--border-color);
}

.highlight-token {
  background-color: rgba(0, 168, 132, 0.08);
  border: 1px solid rgba(0, 168, 132, 0.3);
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  user-select: all;
}

.logs-view {
  background-color: #090e11;
  color: #aebbc4;
  padding: 16px;
  border-radius: var(--border-radius-sm);
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  line-height: 1.5;
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
}

.log-entry {
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.log-time {
  color: var(--text-muted);
  margin-right: 10px;
}

.log-type-error {
  color: var(--danger);
}

.log-type-warning {
  color: var(--warning);
}

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition-speed) ease;
  min-height: 40px;
  text-decoration: none;
  text-align: center;
  box-sizing: border-box;
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
  text-overflow: ellipsis;
  overflow: hidden;
}

button > span,
.btn > span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn:active {
  transform: scale(0.98);
}

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

.btn-primary:hover {
  background-color: #34e073;
}

.btn-secondary {
  background-color: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-input-focus);
}

.btn-secondary.active {
  background-color: var(--primary);
  color: #000;
  border-color: var(--primary);
}

.btn-secondary.active:hover {
  background-color: #34e073;
  border-color: #34e073;
}

.btn-danger {
  background-color: rgba(234, 0, 56, 0.1);
  color: var(--danger);
  border: 1px solid rgba(234, 0, 56, 0.2);
}

.btn-danger:hover {
  background-color: rgba(234, 0, 56, 0.2);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 11px;
  min-height: 30px;
}

.btn-ghost {
  background: none;
  color: var(--text-muted);
  padding: 8px;
  border-radius: 50%;
  min-height: auto;
}

.btn-ghost:hover {
  background-color: var(--bg-input);
  color: var(--text-main);
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.info-item {
  display: flex;
  flex-direction: column;
}

.info-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.info-value {
  font-weight: 700;
  font-size: 13px;
  margin-top: 4px;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity var(--transition-speed) ease;
}

.modal-overlay.show {
  display: flex !important;
  opacity: 1 !important;
}

.modal-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  width: 90%;
  max-width: 440px;
  padding: 24px;
  box-shadow: var(--shadow-premium);
  transform: scale(0.95);
  transition: transform var(--transition-speed) cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.show .modal-card {
  transform: scale(1);
}

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

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

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

.modal-close-btn:hover {
  color: var(--text-main);
}

.modal-body {
  margin-bottom: 24px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

.toast {
  background-color: var(--bg-card);
  border-left: 4px solid var(--info);
  color: var(--text-main);
  padding: 14px 20px;
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-premium);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
  min-width: 280px;
  max-width: 400px;
  animation: slideIn var(--transition-speed) cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity var(--transition-speed);
}

.toast.success {
  border-left-color: var(--success);
}
.toast.danger {
  border-left-color: var(--danger);
}
.toast.warning {
  border-left-color: var(--warning);
}

.toast-icon {
  font-size: 16px;
}
.toast.success .toast-icon {
  color: var(--primary);
}
.toast.danger .toast-icon {
  color: var(--danger);
}
.toast.warning .toast-icon {
  color: var(--warning);
}

.footer-info {
  margin-top: auto;
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
  border-top: 1px solid var(--border-color);
  padding: 16px;
}

.steps-list {
  padding-left: 20px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.steps-list li {
  margin-bottom: 6px;
}

.steps-list strong {
  color: var(--text-main);
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s infinite linear;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0% {
    opacity: 0.6;
  }
  100% {
    opacity: 1;
  }
}

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

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.chat-container-layout {
  display: flex;
  flex: 1;
  height: 100%;
  min-height: 0;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  background-color: var(--bg-card);
}
.chat-list-panel {
  width: 320px;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  background-color: var(--bg-main);
}
.chat-list-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}
.search-box-wrapper {
  display: flex;
  align-items: center;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  gap: 8px;
}
.search-icon {
  color: var(--text-muted);
  font-size: 14px;
}
.chat-search-input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 14px;
  color: var(--text-main);
}
.chat-list-items {
  flex: 1;
  overflow-y: auto;
}
.chat-item {
  display: flex;
  padding: 12px 16px;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background-color var(--transition-speed);
  gap: 12px;
}
.chat-item:hover,
.chat-item.active {
  background-color: var(--card-bg-hover);
}
.chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(0, 168, 132, 0.15), rgba(0, 168, 132, 0.05));
  font-size: 20px;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.chat-info {
  flex: 1;
  min-width: 0;
}
.chat-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.sys-info-val {
  font-weight: 600;
  color: var(--text-main);
  transition: color 0.2s ease;
}

.sys-info-link {
  text-decoration: none;
  color: inherit;
  display: block;
  transition:
    color 0.2s ease,
    padding-left 0.2s ease;
}

.sys-info-link:hover {
  color: var(--primary);
  padding-left: 2px;
}

.sys-info-link:hover .sys-info-val {
  color: var(--primary);
}
.chat-name {
  font-weight: 600;
  color: var(--text-main);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.chat-badges {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  vertical-align: middle;
  flex-shrink: 0;
}
.chat-badge-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 10px;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    filter 0.15s ease;
  user-select: none;
}
.chat-badge-icon:hover {
  transform: scale(1.25);
  filter: brightness(1.2);
}
.chat-badge-icon.mod-badge {
  background: rgba(37, 211, 102, 0.15);
  color: var(--primary);
  border: 1px solid rgba(37, 211, 102, 0.3);
}
.chat-badge-icon.tg-badge {
  background: rgba(0, 136, 204, 0.15);
  color: #0088cc;
  border: 1px solid rgba(0, 136, 204, 0.3);
}
.chat-time {
  font-size: 11px;
  color: var(--text-muted);
}
.chat-last-msg {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-thread-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-chat-wall);
  position: relative;
}
.chat-thread-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  background-color: var(--bg-chat-wall);
}
.chat-thread-empty-icon {
  font-size: 72px;
  opacity: 0.25;
  margin-bottom: 16px;
}
.chat-thread-active {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.chat-thread-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-card);
  gap: 16px;
  min-height: 62px;
  width: 100%;
}
.chat-thread-info {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}
.chat-thread-avatar,
.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
  overflow: hidden;
}
.chat-thread-info h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-thread-info p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-thread-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background-color: var(--bg-chat-wall);
  background-image:
    radial-gradient(circle at 25% 25%, rgba(0, 168, 132, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(0, 168, 132, 0.02) 0%, transparent 50%);
}
.chat-thread-messages::-webkit-scrollbar {
  width: 5px;
}
.chat-thread-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chat-thread-messages::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 99px;
}

.msg-bubble-row {
  display: flex;
  width: 100%;
  max-width: 100%;
  margin-bottom: 2px;
  box-sizing: border-box;
}
.msg-bubble-row.outbound {
  justify-content: flex-end;
}
.msg-bubble-row.inbound {
  justify-content: flex-start;
}

.msg-bubble {
  max-width: 75%;
  min-width: 0;
  padding: 6px 10px 5px 11px;
  border-radius: 12px;
  position: relative;
  box-shadow: var(--shadow-bubble);
  word-break: break-word;
  overflow-wrap: break-word;
  animation: bubbleIn 0.18s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  display: inline-block;
  box-sizing: border-box;
}
@keyframes bubbleIn {
  from {
    opacity: 0;
    transform: scale(0.88) translateY(6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
.msg-bubble-row.outbound .msg-bubble {
  background-color: var(--bg-bubble-out);
  color: var(--text-bubble-out);
  border-bottom-right-radius: 4px;
}
.msg-bubble-row.inbound .msg-bubble {
  background-color: var(--bg-bubble-in);
  color: var(--text-bubble-in);
  border-bottom-left-radius: 4px;
}
[data-theme='light'] .msg-bubble-row.inbound .msg-bubble {
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.msg-bubble-text {
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  display: inline-block;
  max-width: 100%;
}
.msg-bubble-time {
  font-size: 10px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  float: right;
  margin-left: 8px;
  margin-top: 4px;
  opacity: 0.65;
  white-space: nowrap;
  user-select: none;
  vertical-align: baseline;
}
.msg-sender-name {
  font-size: 11.5px;
  font-weight: 700;
  margin-bottom: 2px;
  color: var(--primary);
  letter-spacing: 0.1px;
}

.chat-thread-footer {
  position: relative;
  padding: 12px 16px;
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-color);
}
.chat-message-form {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-input);
  border: 1.5px solid var(--border-input);
  border-radius: 99px;
  padding: 6px 6px 6px 18px;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.chat-message-form:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.chat-message-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-family);
  font-size: 14.5px;
  color: var(--text-main);
  padding: 6px 0;
  min-width: 0;
}
.chat-message-input::placeholder {
  color: var(--text-muted);
  opacity: 0.75;
}
[data-theme='light'] .chat-message-input::placeholder {
  color: #8696a0;
  opacity: 1;
}
.chat-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 50%;
  flex-shrink: 0;
  background-color: var(--primary);
  color: #fff;
  transition:
    background-color 0.18s,
    transform 0.15s;
}
.chat-send-btn:hover {
  background-color: var(--primary-dark);
  transform: scale(1.07);
}
.chat-send-btn:active {
  transform: scale(0.93);
}

.chat-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 18px;
  flex-shrink: 0;
  transition:
    color 0.15s,
    background-color 0.15s;
}
.chat-icon-btn:hover {
  color: var(--primary);
  background: var(--bg-input);
}

.msg-context-menu {
  position: fixed;
  z-index: 9999;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  padding: 6px;
  min-width: 170px;
}
.msg-context-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 14px;
  background: none;
  border: none;
  border-radius: 7px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 13.5px;
  cursor: pointer;
  text-align: left;
}
.msg-context-menu button:hover {
  background: var(--bg-input);
}

.msg-buttons-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 8px;
}

.msg-button-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: var(--text-main);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.msg-button-item:hover {
  background: rgba(255, 255, 255, 0.18);
}

.reaction-picker {
  position: fixed;
  z-index: 9999;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 99px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  padding: 6px 10px;
  display: flex;
  gap: 4px;
}
.reaction-picker span {
  font-size: 22px;
  cursor: pointer;
  border-radius: 50%;
  padding: 4px;
  transition: transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.reaction-picker span:hover {
  transform: scale(1.35);
}

.emoji-picker {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: var(--shadow-premium);
  padding: 12px 8px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  max-height: 230px;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 200;
  width: 320px;
  box-sizing: border-box;
}

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

.emoji-picker::-webkit-scrollbar-track {
  background: transparent;
}

.emoji-picker::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.emoji-picker::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.emoji-picker span {
  font-size: 22px;
  cursor: pointer;
  border-radius: 8px;
  padding: 6px 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.15s ease,
    background 0.15s ease;
  user-select: none;
}

.emoji-picker span:hover {
  background: var(--bg-input);
  transform: scale(1.2);
}

.msg-quote {
  background: rgba(0, 0, 0, 0.12);
  border-left: 3px solid var(--primary);
  border-radius: 6px;
  padding: 5px 8px;
  margin-bottom: 5px;
  font-size: 12.5px;
  max-height: 60px;
  overflow: hidden;
}
.msg-bubble-row.outbound .msg-quote {
  background: rgba(0, 0, 0, 0.18);
}
[data-theme='light'] .msg-quote {
  background: rgba(0, 0, 0, 0.06);
}
.msg-quote-sender {
  font-weight: 700;
  color: var(--primary);
  font-size: 11px;
  margin-bottom: 2px;
}
.msg-quote-text {
  color: inherit;
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.msg-reaction-chip {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 99px;
  padding: 2px 7px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s;
}
.msg-reaction-chip:hover {
  background: var(--bg-input-focus);
}
.msg-reaction-count {
  font-size: 11px;
  color: var(--text-muted);
}

.msg-ack {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  font-size: 12px;
}
.msg-ack.ack-pending {
  color: var(--text-muted);
  opacity: 0.5;
}
.msg-ack.ack-sent {
  color: var(--text-muted);
}
.msg-ack.ack-delivered {
  color: var(--text-muted);
}
.msg-ack.ack-read {
  color: #53bdeb;
}
.msg-ack.ack-played {
  color: #53bdeb;
}

.msg-media {
  max-width: 100%;
  border-radius: 10px;
  margin-bottom: 4px;
  display: block;
}
.msg-media-img {
  max-height: 260px;
  width: auto;
  cursor: pointer;
}
.msg-media-video {
  max-height: 260px;
  width: 100%;
}
.msg-media-audio {
  width: 100%;
  min-width: 220px;
}
.msg-media-doc {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
}
[data-theme='light'] .msg-media-doc {
  background: rgba(0, 0, 0, 0.06);
}
.msg-media-doc-icon {
  font-size: 24px;
  color: var(--primary);
}
.msg-media-doc-name {
  font-size: 13px;
  font-weight: 500;
}

.search-highlight {
  background: rgba(255, 210, 0, 0.4);
  border-radius: 2px;
}

/* Update badges & Modal Styles */
.update-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: var(--primary);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: auto;
  letter-spacing: 0.3px;
  box-shadow: 0 0 8px rgba(0, 168, 132, 0.5);
  animation: badgePulse 2s infinite ease-in-out;
}
.update-badge.dep-badge {
  background-color: var(--info);
  box-shadow: 0 0 8px rgba(52, 152, 219, 0.5);
}

@keyframes badgePulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
  }
}

.modal-card.modal-lg {
  max-width: 620px;
  width: 90%;
}

.update-version-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 14px 20px;
  background-color: var(--bg-input);
  border-radius: 12px;
  margin-bottom: 16px;
}
.ver-pill {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}
.ver-current {
  background: rgba(134, 150, 160, 0.15);
  color: var(--text-muted);
}
.ver-new {
  background: var(--primary-glow);
  color: var(--primary);
}
.ver-arrow {
  color: var(--text-muted);
  font-size: 14px;
}

.update-rationale-box {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  background-color: rgba(0, 168, 132, 0.08);
  border: 1px solid rgba(0, 168, 132, 0.25);
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
}
.update-rationale-box.warning {
  background-color: rgba(255, 188, 0, 0.08);
  border-color: rgba(255, 188, 0, 0.25);
}
.update-rationale-box .rationale-icon {
  font-size: 20px;
  color: var(--primary);
  margin-top: 2px;
}
.update-rationale-box.warning .rationale-icon {
  color: var(--warning);
}
.update-rationale-box p {
  margin: 4px 0 0 0;
  color: var(--text-muted);
  line-height: 1.4;
}

.changelog-container {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
}
.changelog-title {
  background: var(--bg-input);
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}
.changelog-body {
  padding: 14px;
  max-height: 200px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  color: var(--text-main);
  background-color: var(--bg-card);
}

.dep-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.dep-detail-card {
  background-color: var(--bg-input);
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}
.dep-detail-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.dep-detail-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

/* ── Unsaved Changes / Dirty Tracking ─────────────────────────────────────── */
.mod-pill.dirty {
  position: relative;
}
.mod-pill.dirty::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b;
  border: 1.5px solid var(--card-bg);
  pointer-events: none;
}

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

.btn-danger {
  background: #ef4444;
  color: #fff;
  border: none;
}
.btn-danger:hover {
  background: #dc2626;
}

/* ── Styled file upload label ─────────────────────────── */
.mod-file-upload-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-input);
  border: 1.5px dashed var(--border-input);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  transition:
    border-color 0.15s,
    background 0.15s,
    color 0.15s;
  width: 100%;
}
.mod-file-upload-label:hover {
  border-color: var(--primary);
  background: var(--primary-glow);
  color: var(--primary);
}
.mod-file-upload-label i {
  font-size: 16px;
  flex-shrink: 0;
}

/* ── Dirty indicator dot on subtab pills ───────────────── */
.mod-pill.dirty::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warning);
  margin-left: 4px;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ── Helper text below form fields ─────────────────────── */
.mod-field-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 4px 0 10px;
}

/* ── Data Tables & Bridge UI Polish ──────────────────────── */
.table-responsive {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  overflow-x: auto;
  background-color: var(--bg-card);
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}

.data-table th {
  background: var(--bg-input);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr {
  transition: background-color 0.15s ease;
}

.data-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.025);
}

html[data-theme='light'] .data-table tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.015);
}

/* --- Native UI Message Widgets (Poll, Location, Contact, Event, Sticker, Badges) --- */
.msg-poll-card {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 4px 0;
  min-width: 240px;
}
[data-theme='light'] .msg-poll-card {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
}
.msg-poll-title {
  font-weight: 700;
  font-size: 14.5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
}
.msg-poll-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.msg-poll-option {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}
[data-theme='light'] .msg-poll-option {
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(0, 0, 0, 0.06);
}
.msg-poll-option-name {
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
}
.msg-poll-bar-container {
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  margin-top: 4px;
  overflow: hidden;
}
.msg-poll-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
}
.msg-poll-footer {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  display: flex;
  align-items: center;
}

/* Location Card */
.msg-location-card {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px;
  margin: 4px 0;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    background 0.15s ease;
  min-width: 220px;
}
.msg-location-card:hover {
  background: rgba(0, 0, 0, 0.25);
  transform: translateY(-1px);
}
.msg-location-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.msg-location-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.msg-location-title {
  font-weight: 700;
  font-size: 13.5px;
  line-height: 1.2;
}
.msg-location-coords {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.msg-location-action {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--primary);
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Contact Card */
.msg-contact-card {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 4px 0;
  min-width: 200px;
}
.msg-contact-body {
  display: flex;
  align-items: center;
  gap: 10px;
}
.msg-contact-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-input);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.msg-contact-name {
  font-weight: 700;
  font-size: 14px;
}
.msg-contact-phone {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}
.msg-contact-action {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}

/* Event Card */
.msg-event-card {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 4px 0;
  min-width: 220px;
}
.msg-event-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.msg-event-title {
  font-weight: 700;
  font-size: 14px;
}
.msg-event-detail {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.msg-event-desc {
  font-size: 12.5px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.msg-event-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}

/* Media Badges for missing downloads */
/* Disabled Section & Out-of-service Overlay Styling */
.disabled-section {
  opacity: 0.45 !important;
  pointer-events: none !important;
  user-select: none !important;
  filter: grayscale(0.5);
  transition:
    opacity 0.25s ease,
    filter 0.25s ease;
}

.disabled-section input,
.disabled-section select,
.disabled-section button,
.disabled-section textarea {
  cursor: not-allowed !important;
}

/* Chat Header Action Buttons */
.chat-header-btn {
  width: 36px !important;
  height: 36px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 15px !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  color: var(--text-main, #e9edef) !important;
  background: var(--bg-card, rgba(255, 255, 255, 0.08)) !important;
  opacity: 1 !important;
  transition: all 0.2s ease;
  flex-shrink: 0 !important;
}
.chat-header-btn:hover {
  background-color: var(--bg-input, rgba(255, 255, 255, 0.18)) !important;
  color: var(--primary, #25d366) !important;
  border-color: var(--primary) !important;
}
.chat-header-btn i {
  font-weight: 900 !important;
  font-style: normal !important;
  display: inline-block !important;
}

/* System Message Row & Pill */
.msg-system-row {
  display: flex !important;
  justify-content: center !important;
  margin: 6px 0 !important;
  width: 100% !important;
}
.msg-system-pill {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-muted) !important;
  font-size: 11px !important;
  padding: 4px 14px !important;
  border-radius: 12px !important;
  box-shadow: var(--shadow-sm) !important;
  text-align: center !important;
  max-width: 80%;
  word-break: break-word;
}

/* ── Modern Custom Select & Group Picker Styling (WhatsApp Gateway Theme) ── */
.mod-group-picker {
  display: inline-flex !important;
  align-items: center !important;
  gap: 10px !important;
  background: var(--bg-card) !important;
  border: 1.5px solid var(--border-color) !important;
  border-radius: 12px !important;
  padding: 4px 12px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.mod-group-picker:hover,
.mod-group-picker:focus-within {
  border-color: var(--primary) !important;
  box-shadow:
    0 0 0 3px rgba(37, 211, 102, 0.2),
    0 4px 12px rgba(0, 0, 0, 0.2) !important;
}

.mod-group-picker select,
.mod-group-picker .mod-select {
  border: none !important;
  background-color: transparent !important;
  box-shadow: none !important;
  padding: 6px 28px 6px 4px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
}

select,
.mod-select,
select.mod-select,
.form-control select,
select.form-control {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-color: var(--bg-input) !important;
  color: var(--text-main) !important;
  border: 1.5px solid var(--border-color) !important;
  border-radius: 10px !important;
  padding: 8px 36px 8px 12px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  font-family: inherit !important;
  line-height: 1.4 !important;
  cursor: pointer !important;
  outline: none !important;
  transition: all 0.2s ease !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2300a884' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  background-size: 14px !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
}

select:hover,
.mod-select:hover,
select.mod-select:hover {
  border-color: var(--primary) !important;
  background-color: var(--bg-hover) !important;
}

select:focus,
.mod-select:focus,
select.mod-select:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.25) !important;
}

select option,
.mod-select option,
select.mod-select option {
  background-color: #111b21 !important;
  color: #e9edef !important;
  padding: 10px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
}

.mod-select-sm {
  padding: 4px 28px 4px 10px !important;
  font-size: 12px !important;
  height: 32px !important;
  line-height: 1.3 !important;
  border-radius: 6px !important;
  background-position: right 8px center !important;
  background-size: 12px !important;
  box-sizing: border-box !important;
}

/* ── Modern Custom Chip & Button Checkboxes (WhatsApp Gateway Theme) ── */
.mod-chip-group {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  margin-top: 6px !important;
}

.mod-chip-checkbox,
label.mod-chip-checkbox {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 6px 14px !important;
  background: var(--bg-input, rgba(255, 255, 255, 0.05)) !important;
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12)) !important;
  border-radius: 20px !important;
  color: var(--text-muted) !important;
  font-size: 12.5px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  user-select: none !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.mod-chip-checkbox input[type='checkbox'] {
  appearance: none !important;
  -webkit-appearance: none !important;
  width: 16px !important;
  height: 16px !important;
  border: 1.5px solid var(--text-muted) !important;
  border-radius: 4px !important;
  background: transparent !important;
  outline: none !important;
  cursor: pointer !important;
  position: relative !important;
  margin: 0 !important;
  flex-shrink: 0 !important;
  transition: all 0.2s ease !important;
}

.mod-chip-checkbox input[type='checkbox']:checked {
  background-color: var(--primary, #25d366) !important;
  border-color: var(--primary, #25d366) !important;
}

.mod-chip-checkbox input[type='checkbox']:checked::after {
  content: '' !important;
  position: absolute !important;
  left: 4px !important;
  top: 1px !important;
  width: 4px !important;
  height: 8px !important;
  border: solid #fff !important;
  border-width: 0 2px 2px 0 !important;
  transform: rotate(45deg) !important;
}

.mod-chip-checkbox:has(input[type='checkbox']:checked) {
  background: rgba(37, 211, 102, 0.12) !important;
  border-color: var(--primary, #25d366) !important;
  color: var(--text-main) !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.15) !important;
}

.mod-chip-checkbox:hover {
  border-color: var(--primary, #25d366) !important;
  color: var(--text-main) !important;
  background: var(--bg-hover) !important;
}

/* ── Desktop Dynamic Full-Height Chats Layout (Zero Wasted Space) ── */
body.tab-chats-active .content-body {
  padding: 12px 16px 8px 16px !important;
  gap: 8px !important;
  overflow: hidden !important;
  height: calc(100vh - var(--header-height, 64px)) !important;
  max-height: calc(100vh - var(--header-height, 64px)) !important;
}

body.tab-chats-active #tab-chats {
  flex: 1 1 0% !important;
  height: 100% !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}

body.tab-chats-active .chat-container-layout {
  flex: 1 1 0% !important;
  height: 100% !important;
  min-height: 0 !important;
  border-radius: 12px !important;
  box-shadow: var(--shadow-medium) !important;
}

body.tab-chats-active .footer-info {
  margin-top: 0 !important;
  padding: 4px 8px !important;
  border-top: none !important;
  font-size: 11px !important;
  flex-shrink: 0 !important;
  background: transparent !important;
}

/* ── Moderation Subpanel & Blacklist Spacious Modern Layout ── */
.mod-subpanel {
  flex-direction: column;
  gap: 20px;
  padding: 8px 4px;
}

.mod-subpanel[style*='display: none'] {
  display: none !important;
}

.mod-subpanel.active,
.mod-subpanel[style*='display: block'] {
  display: flex !important;
}

.mod-feature-header {
  display: flex !important;
  align-items: flex-start !important;
  gap: 16px !important;
  margin-bottom: 12px !important;
  padding-bottom: 16px !important;
  border-bottom: 1px solid var(--border-color) !important;
}

.mod-field-group {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  margin-bottom: 20px !important;
  padding: 16px !important;
  background: var(--bg) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--border-radius-sm, 10px) !important;
}

.mod-input-row {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  margin: 16px 0 !important;
  flex-wrap: wrap !important;
}

.mod-input-row .mod-input {
  flex: 1 1 280px !important;
  min-width: 200px !important;
  padding: 10px 14px !important;
}

.mod-tag-cloud {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  min-height: 56px !important;
  padding: 16px !important;
  background: var(--bg) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--border-radius-sm, 10px) !important;
  margin-bottom: 20px !important;
  align-items: center !important;
}

.mod-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 12px !important;
  margin-top: 20px !important;
  padding-top: 16px !important;
  border-top: 1px solid var(--border-color) !important;
}

.mod-file-upload-label {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 12px !important;
  padding: 16px 20px !important;
  border: 2px dashed var(--primary) !important;
  border-radius: 10px !important;
  background: rgba(0, 168, 132, 0.05) !important;
  color: var(--primary) !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  text-align: center !important;
}

.mod-file-upload-label:hover {
  background: rgba(0, 168, 132, 0.12) !important;
  border-color: var(--primary-hover, var(--primary)) !important;
  transform: translateY(-1px);
}

/* ── WhatsApp Theme Input & DateTime Local Form Elements ── */
input[type='datetime-local'],
input[type='date'],
input[type='time'] {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-color: var(--bg-input) !important;
  color: var(--text-main) !important;
  border: 1.5px solid var(--border-color) !important;
  border-radius: 10px !important;
  padding: 8px 12px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  font-family: inherit !important;
  line-height: 1.4 !important;
  outline: none !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
  color-scheme: dark light;
}

html[data-theme='dark'] input[type='datetime-local'],
html[data-theme='dark'] input[type='date'],
html[data-theme='dark'] input[type='time'] {
  color-scheme: dark !important;
  background-color: var(--bg-input, #1f2c34) !important;
}

input[type='datetime-local']:hover,
input[type='date']:hover,
input[type='time']:hover {
  border-color: var(--primary) !important;
  background-color: var(--bg-hover) !important;
}

input[type='datetime-local']:focus,
input[type='date']:focus,
input[type='time']:focus {
  border-color: var(--primary) !important;
  background-color: var(--bg-input-focus, var(--bg-input)) !important;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.25) !important;
}

input[type='datetime-local']::-webkit-calendar-picker-indicator {
  cursor: pointer;
  filter: invert(0.6) sepia(1) saturate(5) hue-rotate(110deg);
  opacity: 0.85;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

input[type='datetime-local']::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
  transform: scale(1.15);
}

