:root {
  --primary: #10B981;
  --primary-light: #34D399;
  --primary-dark: #059669;
  --accent: #3B82F6;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;
  --white: #FFFFFF;

  --sidebar-width: 280px;
  --header-height: 72px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--white);
  border-bottom: 2px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

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

.logo-section img {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.logo-text {
  font-size: 22px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--gray-100);
  border-radius: 12px;
  transition: all 0.3s ease;
}

.user-info:hover {
  background: var(--gray-200);
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-weight: 700;
  font-size: 14px;
}

.user-name {
  font-weight: 600;
  color: var(--gray-900);
  font-size: 14px;
}

.btn-logout {
  padding: 10px 20px;
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  color: var(--gray-700);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-logout:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(239, 68, 68, 0.05);
}

/* User Dropdown */
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  min-width: 200px;
  z-index: 1001;
  overflow: hidden;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--gray-700);
  text-decoration: none;
  transition: all 0.2s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
}

.dropdown-item:hover {
  background: var(--gray-50);
  color: var(--gray-900);
}

.dropdown-item i {
  width: 20px;
  color: var(--gray-500);
}

.dropdown-item:hover i {
  color: var(--primary);
}

.dropdown-divider {
  height: 1px;
  background: var(--gray-200);
  margin: 4px 0;
}

/* Sidebar */
.sidebar {
  position: fixed;
  left: 0;
  top: var(--header-height);
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--white);
  border-right: 2px solid var(--gray-200);
  padding: 2rem 0;
  overflow-y: auto;
  z-index: 900;
}

.nav-section {
  margin-bottom: 2rem;
}

.nav-section-title {
  padding: 0 1.5rem;
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.nav-item {
  padding: 12px 1.5rem;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--gray-700);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.3s ease;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: var(--gray-50);
  color: var(--primary);
  border-left-color: var(--primary);
}

.nav-item.active {
  background: rgba(16, 185, 129, 0.1);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}

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

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  padding: 2rem;
  min-height: calc(100vh - var(--header-height));
}

/* Instance page specific styles */
.instance-main-content {
  margin-left: var(--sidebar-width);
}

.instance-sidebar {
  position: fixed;
  left: 0;
  top: var(--header-height);
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--white);
  border-right: 2px solid var(--gray-200);
  padding: 2rem 0;
  overflow-y: auto;
  z-index: 900;
}

.instance-sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 1.5rem;
  background: transparent;
  border: none;
  color: var(--gray-600);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  font-family: inherit;
}

.instance-sidebar .nav-item:hover {
  background: var(--gray-50);
  color: var(--primary);
}

.instance-sidebar .nav-item.active {
  background: rgba(16, 185, 129, 0.05);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}

/* Parent item should not be green when submenu items are active */
.instance-sidebar .nav-item-parent.expanded:not(.active) {
  background: transparent;
  color: var(--gray-600);
  border-left-color: transparent;
  font-weight: 500;
}

.instance-sidebar .nav-item-parent.expanded:not(.active):hover {
  background: var(--gray-50);
  color: var(--primary);
}

.instance-sidebar .nav-item i {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.instance-sidebar .nav-item span {
  flex: 1;
  white-space: nowrap;
}

/* Submenu Styles */
.nav-item-parent {
  cursor: pointer;
}

.nav-chevron {
  margin-left: auto;
  font-size: 12px;
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.nav-item-parent.expanded .nav-chevron {
  transform: rotate(180deg);
}

.nav-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: var(--white);
}

.nav-item-parent.expanded+.nav-submenu {
  max-height: 1000px;
}

/* Submenu items - use more specific selector to override any other styles */
.instance-sidebar .nav-submenu .nav-subitem {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 1.5rem 10px 3rem;
  background: var(--white) !important;
  border: none;
  color: var(--gray-600) !important;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  border-left: 3px solid transparent !important;
  font-family: inherit;
}

.instance-sidebar .nav-submenu .nav-subitem:hover:not(.active) {
  background: var(--gray-50) !important;
  color: var(--primary) !important;
}

.instance-sidebar .nav-submenu .nav-subitem.active {
  background: rgba(16, 185, 129, 0.1) !important;
  color: var(--primary) !important;
  border-left-color: var(--primary) !important;
  font-weight: 600 !important;
}

.nav-subitem i {
  font-size: 14px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.nav-subitem span {
  flex: 1;
  white-space: nowrap;
}

.page {
  display: block;
}

.page.hidden {
  display: none;
}

.page-header {
  margin-bottom: 2rem;
}

/* Trial Banner */
.trial-banner {
  background: linear-gradient(135deg, #3B82F6, #2563EB);
  border-radius: 16px;
  padding: 0;
  margin-bottom: 2rem;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.2);
  overflow: hidden;
}

.trial-banner.hidden {
  display: none !important;
}

.trial-banner-content {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem 2rem;
  color: white;
}

.trial-banner-icon {
  font-size: 32px;
  opacity: 0.9;
}

.trial-banner-text {
  flex: 1;
}

.trial-banner-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.trial-banner-subtitle {
  font-size: 14px;
  opacity: 0.9;
}

.trial-banner-countdown {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.15);
  padding: 12px 20px;
  border-radius: 12px;
  backdrop-filter: blur(10px);
}

.countdown-label {
  font-size: 12px;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.countdown-timer {
  display: flex;
  align-items: center;
  gap: 4px;
}

.countdown-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 50px;
}

.countdown-value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 2px;
}

.countdown-unit {
  font-size: 10px;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.countdown-separator {
  font-size: 20px;
  font-weight: 700;
  opacity: 0.6;
  margin: 0 4px;
}

.trial-banner-action {
  display: flex;
  align-items: center;
}

.btn-white {
  background: white;
  color: #3B82F6;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s;
  cursor: pointer;
}

.btn-white:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@media (max-width: 768px) {
  .trial-banner-content {
    flex-direction: column;
    text-align: center;
    padding: 1.5rem;
  }
  
  .trial-banner-countdown {
    width: 100%;
  }
  
  .countdown-timer {
    justify-content: center;
  }
  
  .countdown-item {
    min-width: 40px;
  }
  
  .countdown-value {
    font-size: 20px;
  }
}

.page-title {
  font-size: 32px;
  font-weight: 900;
  color: var(--gray-900);
  margin-bottom: 8px;
}

.page-subtitle {
  font-size: 16px;
  color: var(--gray-600);
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--white);
  padding: 24px;
  border-radius: 16px;
  border: 2px solid var(--gray-200);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100px;
  height: 100px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  opacity: 0.1;
  border-radius: 50%;
  transform: translate(30%, -30%);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
  border-color: var(--primary);
}

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

.stat-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 20px;
}

.stat-value {
  font-size: 32px;
  font-weight: 900;
  color: var(--gray-900);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 14px;
  color: var(--gray-600);
  font-weight: 500;
}

/* Section Header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--gray-900);
}

.section-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* Search Box */
.search-box {
  position: relative;
  width: 300px;
}

.search-box input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  font-size: 14px;
  color: var(--gray-900);
  background: var(--gray-50);
  transition: all 0.3s ease;
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

.search-box i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 14px;
}

/* Instance Cards */
.instances-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 24px;
  margin-top: 2rem;
}

.instance-card {
  background: var(--white);
  border-radius: 20px;
  border: 2px solid var(--gray-200);
  padding: 28px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.card {
  background: var(--white);
  border-radius: 16px;
  border: 1px solid var(--gray-200);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: all 0.3s ease;
}

.card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  border-color: var(--primary);
}

.card-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--gray-900);
  margin: 0 0 20px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--gray-100);
}

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

.card h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-800);
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.instance-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.instance-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  border-color: var(--primary);
}

.instance-card:hover::before {
  transform: scaleX(1);
}

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

.instance-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 10px;
}

.instance-status {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}

.instance-status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.instance-status.connected {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.instance-status.connected::before {
  background: var(--success);
}

.instance-status.disconnected {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.instance-status.disconnected::before {
  background: var(--danger);
  animation: none;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.instance-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.instance-detail {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--gray-600);
}

.instance-detail i {
  color: var(--primary);
  width: 18px;
}

.instance-detail .truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--gray-600);
}

.info-item i {
  color: var(--primary);
  width: 18px;
}

.instance-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--white);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  font-weight: 500;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--white);
  color: var(--gray-700);
  border: 2px solid var(--gray-200);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-danger {
  background: var(--white);
  color: var(--danger);
  border: 2px solid var(--gray-200);
}

.btn-danger:hover {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.05);
}

.btn-warning {
  background: var(--white);
  color: var(--warning);
  border: 2px solid var(--gray-200);
}

.btn-warning:hover {
  border-color: var(--warning);
  background: rgba(245, 158, 11, 0.05);
}

.btn-icon {
  padding: 10px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--white);
  border-radius: 20px;
  border: 2px dashed var(--gray-300);
  margin-top: 2rem;
}

.empty-icon {
  width: 80px;
  height: 80px;
  background: var(--gray-100);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 36px;
  color: var(--gray-400);
}

.empty-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 12px;
}

.empty-text {
  font-size: 16px;
  color: var(--gray-600);
  margin-bottom: 24px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

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

.modal {
  background: var(--white);
  border-radius: 24px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }

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

.modal-header {
  padding: 28px 32px;
  border-bottom: 2px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.modal-title {
  font-size: 24px;
  font-weight: 900;
  color: var(--gray-900);
  flex: 1;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--gray-100);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--gray-600);
  font-size: 18px;
}

.modal-close:hover {
  background: var(--danger);
  color: var(--white);
  transform: rotate(90deg);
}

.modal-body {
  padding: 32px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.modal-footer {
  padding: 20px 32px;
  border-top: 2px solid var(--gray-200);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  background: var(--gray-50);
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.message-type-form {
  animation: fadeIn 0.3s ease;
}

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

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

.message-type-selector {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.05), rgba(59, 130, 246, 0.05));
  border-radius: 12px;
  margin-bottom: 24px;
}

.message-type-selector .btn {
  flex: 1;
  min-width: 120px;
  justify-content: center;
  transition: all 0.2s ease;
}

.message-type-selector .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.message-type-selector .btn.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.api-section {
  margin-bottom: 32px;
  padding: 24px;
  background: var(--white);
  border-radius: 16px;
  border: 1px solid var(--gray-200);
}

.api-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--gray-100);
}

.api-section-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 10px;
}

.api-section-title i {
  color: var(--primary);
  font-size: 20px;
}

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

.api-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.2s ease;
}

.api-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);
  transform: translateY(-2px);
}

.api-card h5 {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.input-group {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

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

.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
  white-space: nowrap;
}

.btn-icon {
  padding: 10px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  z-index: 10;
}

.loading-overlay .spinner {
  width: 40px;
  height: 40px;
}

/* API Response Modal Styles */
.api-response-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.api-response-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--gray-50);
  border-radius: 12px;
  margin-bottom: 20px;
  border: 1px solid var(--gray-200);
}

.api-response-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
}

.api-response-status.status-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.api-response-status.status-error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.api-response-status i {
  font-size: 16px;
}

.api-response-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--gray-600);
}

.api-response-meta i {
  color: var(--gray-500);
}

.api-response-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.api-response-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--gray-200);
}

.api-tab-btn {
  padding: 10px 20px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--gray-600);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: -2px;
}

.api-tab-btn:hover {
  color: var(--primary);
  background: rgba(16, 185, 129, 0.05);
}

.api-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(16, 185, 129, 0.05);
}

.api-tab-btn i {
  font-size: 14px;
}

.api-response-content {
  display: none;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.api-response-content.active {
  display: flex;
  flex-direction: column;
}

.api-response-code {
  flex: 1;
  margin: 0;
  padding: 20px;
  background: #1e1e1e;
  border-radius: 8px;
  overflow: auto;
  font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: #d4d4d4;
  border: 1px solid var(--gray-300);
  min-height: 300px;
  max-height: 60vh;
}

.api-response-code code {
  display: block;
  white-space: pre;
  color: inherit;
  font-family: inherit;
}

/* JSON Syntax Highlighting (basic) */
.api-response-code code {
  color: #d4d4d4;
}

.api-response-code code .json-key {
  color: #9cdcfe;
}

.api-response-code code .json-string {
  color: #ce9178;
}

.api-response-code code .json-number {
  color: #b5cea8;
}

.api-response-code code .json-boolean {
  color: #569cd6;
}

.api-response-code code .json-null {
  color: #569cd6;
}

.collapsible-section {
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
}

.collapsible-header {
  padding: 16px 20px;
  background: var(--gray-50);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s ease;
  user-select: none;
}

.collapsible-header:hover {
  background: var(--gray-100);
}

.collapsible-header.active {
  background: rgba(16, 185, 129, 0.1);
  border-bottom: 2px solid var(--primary);
}

.collapsible-content {
  padding: 20px;
  display: none;
}

.collapsible-content.active {
  display: block;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }

  to {
    opacity: 1;
    max-height: 1000px;
  }
}

.collapsible-header i.fa-chevron-down {
  transition: transform 0.3s ease;
}

.collapsible-header.active i.fa-chevron-down {
  transform: rotate(180deg);
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  background: var(--primary);
  color: white;
}

.badge-success {
  background: var(--success);
}

.badge-error {
  background: var(--danger);
}

.badge-info {
  background: var(--info);
}

.help-text {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.help-text i {
  font-size: 10px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-box {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(59, 130, 246, 0.1));
  border-radius: 12px;
  padding: 16px;
  border: 1px solid var(--gray-200);
}

.stat-box-label {
  font-size: 12px;
  color: var(--gray-600);
  margin-bottom: 4px;
}

.stat-box-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}

/* Groups List Modal Styles */
.group-item {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.group-item:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.1);
  transform: translateY(-1px);
}

.group-item h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-900);
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.group-item h4 i {
  color: var(--primary);
}

.group-item .group-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--gray-600);
}

.group-item .group-info div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.group-item .group-info i {
  width: 16px;
  color: var(--gray-500);
}

.group-item .group-jid {
  font-family: 'Courier New', monospace;
  background: var(--gray-100);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 8px;
}

.form-label i {
  color: var(--primary);
  font-size: 14px;
}

.form-label .required {
  color: var(--danger);
  margin-left: 4px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  color: var(--gray-900);
  transition: all 0.3s ease;
  background: var(--gray-50);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-hint {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-style: italic;
}

.form-hint i {
  font-size: 11px;
  color: var(--info);
}

.input-group {
  display: flex;
  gap: 12px;
}

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

/* Loading */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  margin-top: 16px;
  color: var(--gray-600);
  font-weight: 500;
}

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

/* Alerts */
.alert {
  padding: 16px 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
}

.alert i {
  font-size: 18px;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  border: 2px solid rgba(16, 185, 129, 0.2);
  color: var(--success);
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border: 2px solid rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.alert-info {
  background: rgba(59, 130, 246, 0.1);
  border: 2px solid rgba(59, 130, 246, 0.2);
  color: var(--info);
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border: 2px solid rgba(245, 158, 11, 0.2);
  color: var(--warning);
}

/* QR Code */
.qr-container {
  text-align: center;
}

.qr-image {
  max-width: 100%;
  border-radius: 12px;
  border: 2px solid var(--gray-200);
  padding: 16px;
  background: var(--white);
  margin-bottom: 20px;
}

.qr-instructions {
  background: var(--gray-50);
  padding: 16px;
  border-radius: 12px;
  text-align: left;
  border: 2px solid var(--gray-200);
}

.qr-instructions h4 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--gray-900);
}

.qr-instructions ol {
  margin-left: 20px;
  line-height: 1.8;
}

.qr-instructions li {
  font-size: 14px;
  color: var(--gray-700);
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--white);
  padding: 16px 24px;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 3000;
  min-width: 300px;
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }

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

.toast.success {
  border-left: 4px solid var(--success);
}

.toast.error {
  border-left: 4px solid var(--danger);
}

.toast.info {
  border-left: 4px solid var(--info);
}

.toast i {
  font-size: 20px;
}

.toast.success i {
  color: var(--success);
}

.toast.error i {
  color: var(--danger);
}

.toast.info i {
  color: var(--info);
}

.toast-message {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-900);
}

.toast-close {
  cursor: pointer;
  color: var(--gray-400);
  font-size: 18px;
  transition: color 0.3s ease;
}

.toast-close:hover {
  color: var(--gray-600);
}

/* Hidden class */
.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .instance-main-content {
    margin-left: 0;
  }

  .instance-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .instance-sidebar.open {
    transform: translateX(0);
  }

  .instances-grid {
    grid-template-columns: 1fr;
  }

  .search-box {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .header {
    padding: 0 1rem;
  }

  .logo-text {
    font-size: 18px;
  }

  .user-name {
    display: none;
  }

  .main-content {
    padding: 1rem;
  }

  .page-title {
    font-size: 24px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .section-header {
    flex-direction: column;
    align-items: stretch;
  }

  .section-actions {
    flex-direction: column;
  }

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

/* Instance Detail Page Styles */
.instance-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--gray-200);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--gray-200);
  overflow-x: auto;
}

.tab-btn {
  padding: 14px 24px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--gray-600);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--primary);
  background: var(--gray-50);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(16, 185, 129, 0.05);
}

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

.tab-content {
  margin-top: 2rem;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* Group action forms - similar to message type forms */
.group-action-form {
  display: block;
}

.group-action-form.hidden {
  display: none;
}

/* User action forms - similar to message type forms */
.user-action-form {
  display: block;
}

.user-action-form.hidden {
  display: none;
}

/* Chat action forms - similar to message type forms */
.chat-action-form {
  display: block;
}

.chat-action-form.hidden {
  display: none;
}

/* Connection tabs */
.connection-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--gray-200);
}

.connection-tab-btn {
  padding: 12px 24px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--gray-600);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.connection-tab-btn:hover {
  color: var(--primary);
  background: var(--gray-50);
}

.connection-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.connection-method-section {
  display: block;
}

.connection-method-section.hidden {
  display: none;
}

.pair-section {
  max-width: 600px;
}

.pair-code-display {
  padding: 24px;
  background: var(--gray-50);
  border-radius: 12px;
  border: 2px solid var(--primary);
}

.pair-code-value {
  font-family: 'Courier New', monospace;
  text-align: center;
  padding: 16px;
  background: var(--white);
  border-radius: 8px;
  border: 2px dashed var(--primary);
  margin: 12px 0;
}

.pair-instructions {
  margin-top: 20px;
}

.pair-instructions h4 {
  color: var(--gray-800);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pair-instructions ol {
  margin-left: 20px;
  color: var(--gray-700);
  line-height: 1.8;
}

/* Card */
.card {
  background: var(--white);
  border-radius: 16px;
  border: 2px solid var(--gray-200);
  padding: 32px;
  margin-bottom: 24px;
}

.card-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title i {
  color: var(--primary);
}

/* QR Section */
.qr-section {
  text-align: center;
}

.qr-loading {
  padding: 60px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.qr-loading.hidden {
  display: none !important;
}

.qr-loading .spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

.qr-loading p {
  color: var(--gray-600);
  font-size: 14px;
  margin: 0;
  font-weight: 500;
}

.qr-display {
  display: none;
}

.qr-display.show {
  display: block !important;
}

.qr-generate {
  display: block;
  text-align: center;
  padding: 40px 20px;
}

.qr-generate.hidden {
  display: none !important;
}

.qr-box {
  background: var(--gray-50);
  border: 2px dashed var(--gray-300);
  border-radius: 12px;
  padding: 24px;
  margin: 0 auto 24px;
  max-width: 350px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 350px;
}

.qr-box img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.qr-instructions {
  background: var(--gray-50);
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  padding: 20px;
  margin: 24px auto;
  max-width: 500px;
  text-align: left;
}

.qr-instructions h4 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 8px;
}

.qr-instructions ol {
  margin-left: 20px;
  line-height: 1.8;
}

.qr-instructions li {
  font-size: 14px;
  color: var(--gray-700);
  margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 768px) {
  .instance-detail-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .tab-btn {
    flex-shrink: 0;
  }

  .card {
    padding: 20px;
  }
}

/* Avatar Response Styles */
.avatar-response-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.avatar-image-section {
  text-align: center;
  padding: 20px;
  background: var(--gray-50);
  border-radius: 12px;
  border: 2px solid var(--gray-200);
}

.avatar-image-section h4 {
  margin-bottom: 15px;
  color: var(--gray-800);
  font-size: 16px;
  font-weight: 600;
}

.avatar-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.avatar-image {
  max-width: 300px;
  max-height: 300px;
  width: auto;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border: 3px solid var(--gray-200);
  background: var(--white);
  object-fit: contain;
}

.avatar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.avatar-details-section {
  margin-top: 10px;
}

.avatar-details-section h4 {
  margin-bottom: 15px;
  color: var(--gray-800);
  font-size: 16px;
  font-weight: 600;
}

@media (max-width: 768px) {
  .avatar-image {
    max-width: 200px;
    max-height: 200px;
  }

  .avatar-actions {
    flex-direction: column;
    width: 100%;
  }

  .avatar-actions .btn {
    width: 100%;
  }
}

/* Contacts List Styles */
.contacts-list-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 70vh;
  overflow: hidden;
}

.contacts-list-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.contacts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--gray-200);
}

.contacts-header h4 {
  margin: 0;
  color: var(--gray-800);
  font-size: 18px;
  font-weight: 600;
}

.contacts-actions {
  display: flex;
  gap: 8px;
}

.contacts-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 8px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.contact-item:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.1);
  transform: translateY(-1px);
}

.contact-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 24px;
  flex-shrink: 0;
}

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

.contact-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--gray-900);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.contact-pushname {
  font-weight: 400;
  color: var(--gray-600);
  font-size: 13px;
}

.contact-details {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--gray-600);
}

.contact-phone,
.contact-business {
  display: flex;
  align-items: center;
  gap: 6px;
}

.contact-phone i,
.contact-business i {
  font-size: 12px;
  color: var(--gray-500);
}

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

.contacts-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-600);
}

.contacts-empty-state h4 {
  margin: 16px 0 8px;
  color: var(--gray-800);
}

.contacts-json-section {
  margin-top: 20px;
  border-top: 2px solid var(--gray-200);
  padding-top: 20px;
}

.contacts-json-section h4 {
  margin-bottom: 12px;
  color: var(--gray-800);
  font-size: 16px;
  font-weight: 600;
}

/* Scrollbar styling for contacts list */
.contacts-list::-webkit-scrollbar {
  width: 8px;
}

.contacts-list::-webkit-scrollbar-track {
  background: var(--gray-100);
  border-radius: 4px;
}

.contacts-list::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 4px;
}

.contacts-list::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

@media (max-width: 768px) {
  .contacts-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .contacts-actions {
    width: 100%;
  }

  .contacts-actions .btn {
    flex: 1;
  }

  .contact-item {
    flex-wrap: wrap;
  }

  .contact-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

.contacts-saved-badge {
  display: inline-block;
  background: var(--success);
  color: var(--white);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  margin-left: 8px;
  vertical-align: middle;
}

/* Contact Autocomplete Styles */
.contact-autocomplete {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  margin-top: 4px;
  display: none;
}

.autocomplete-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  border-bottom: 1px solid var(--gray-100);
}

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

.autocomplete-item:hover,
.autocomplete-item.selected {
  background: var(--gray-50);
}

.autocomplete-item-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 18px;
  flex-shrink: 0;
}

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

.autocomplete-item-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--gray-900);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.autocomplete-item-phone {
  font-size: 12px;
  color: var(--gray-600);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Scrollbar for autocomplete */
.contact-autocomplete::-webkit-scrollbar {
  width: 6px;
}

.contact-autocomplete::-webkit-scrollbar-track {
  background: var(--gray-100);
  border-radius: 3px;
}

.contact-autocomplete::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}

.contact-autocomplete::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* Message ID Autocomplete Styles */
.message-id-autocomplete {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  margin-top: 4px;
  display: none;
}

.message-id-autocomplete .autocomplete-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  border-bottom: 1px solid var(--gray-100);
}

.message-id-autocomplete .autocomplete-item:last-child {
  border-bottom: none;
}

.message-id-autocomplete .autocomplete-item:hover,
.message-id-autocomplete .autocomplete-item.selected {
  background: var(--gray-50);
}

.message-id-autocomplete .autocomplete-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 2px;
}

.message-id-autocomplete .autocomplete-item-info {
  flex: 1;
  min-width: 0;
}

.message-id-autocomplete .autocomplete-item-id {
  font-weight: 600;
  font-size: 13px;
  color: var(--gray-900);
  margin-bottom: 2px;
  font-family: 'Courier New', monospace;
  word-break: break-all;
}

.message-id-autocomplete .autocomplete-item-preview {
  font-size: 12px;
  color: var(--gray-600);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-id-autocomplete .autocomplete-item-time {
  font-size: 11px;
  color: var(--gray-500);
}

/* Scrollbar for message ID autocomplete */
.message-id-autocomplete::-webkit-scrollbar {
  width: 6px;
}

.message-id-autocomplete::-webkit-scrollbar-track {
  background: var(--gray-100);
  border-radius: 3px;
}

.message-id-autocomplete::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}

.message-id-autocomplete::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* Messages Dialog Styles */
.messages-dialog-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--gray-200);
}

.messages-search-container {
  width: 100%;
}

.messages-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--gray-600);
}

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

.message-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--white);
}

.message-item:hover {
  border-color: var(--primary);
  background: var(--gray-50);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message-item.selected {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(34, 197, 94, 0.05));
}

.message-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 16px;
  flex-shrink: 0;
}

.message-item-content {
  flex: 1;
  min-width: 0;
}

.message-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.message-item-id {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  word-break: break-all;
}

.message-item-time {
  font-size: 11px;
  color: var(--gray-500);
  white-space: nowrap;
  margin-left: 8px;
}

.message-item-preview {
  font-size: 13px;
  color: var(--gray-600);
  margin-top: 4px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-item-type {
  display: inline-block;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--gray-100);
  color: var(--gray-600);
  margin-top: 4px;
}

.messages-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray-500);
}

.messages-empty-state i {
  font-size: 48px;
  margin-bottom: 15px;
  opacity: 0.5;
}

.messages-empty-state h4 {
  margin: 10px 0;
  color: var(--gray-700);
}

.messages-empty-state p {
  margin: 5px 0;
  font-size: 13px;
}

/* Scrollbar for messages list */
#messagesListContent::-webkit-scrollbar {
  width: 8px;
}

#messagesListContent::-webkit-scrollbar-track {
  background: var(--gray-100);
  border-radius: 4px;
}

#messagesListContent::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 4px;
}

#messagesListContent::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* API Documentation Styles */
.api-method {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.api-method.get {
  background: #10b981;
  color: white;
}

.api-method.post {
  background: #3b82f6;
  color: white;
}

.api-method.put {
  background: #f59e0b;
  color: white;
}

.api-method.delete {
  background: #ef4444;
  color: white;
}

.api-path {
  font-family: 'Courier New', monospace;
  color: var(--gray-700);
  font-size: 14px;
  margin-left: 8px;
}

/* Pricing Page Styles */
.pricing-container {
  max-width: 1200px;
  margin: 0 auto;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.pricing-card {
  background: var(--white);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border: 2px solid var(--gray-200);
  transition: all 0.3s ease;
  position: relative;
  display: flex;
  flex-direction: column;
}

.pricing-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border-color: var(--primary);
}

.pricing-card.featured {
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.2);
}

.pricing-card.featured::before {
  content: 'Popular';
  position: absolute;
  top: -12px;
  right: 24px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--white);
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pricing-header {
  margin-bottom: 1.5rem;
}

.pricing-name {
  font-size: 24px;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 8px;
}

.pricing-description {
  font-size: 14px;
  color: var(--gray-600);
  line-height: 1.6;
}

.pricing-price {
  margin: 1.5rem 0;
  padding: 1.5rem 0;
  border-top: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
}

.pricing-amount {
  font-size: 48px;
  font-weight: 900;
  color: var(--gray-900);
  line-height: 1;
  margin-bottom: 8px;
}

.pricing-period {
  font-size: 14px;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pricing-features {
  flex: 1;
  margin: 1.5rem 0;
  list-style: none;
}

.pricing-features li {
  padding: 12px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
}

.pricing-features li:last-child {
  border-bottom: none;
}

.pricing-features li i {
  color: var(--primary);
  font-size: 18px;
  width: 20px;
  flex-shrink: 0;
}

.pricing-cta {
  margin-top: auto;
  padding-top: 1.5rem;
}

.pricing-limits {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-200);
  font-size: 13px;
  color: var(--gray-600);
}

.pricing-limits div {
  margin: 4px 0;
  display: flex;
  justify-content: space-between;
}

/* Subscription Page Styles */
.subscription-container {
  max-width: 1000px;
  margin: 0 auto;
}

.subscription-card {
  background: var(--white);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border: 2px solid var(--gray-200);
  margin-bottom: 2rem;
}

.subscription-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--gray-200);
}

.subscription-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
}

.subscription-status.active {
  background: rgba(16, 185, 129, 0.1);
  color: var(--primary-dark);
}

.subscription-status.inactive {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.subscription-plan-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.subscription-info-item {
  padding: 1rem;
  background: var(--gray-50);
  border-radius: 12px;
}

.subscription-info-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-600);
  margin-bottom: 8px;
  font-weight: 600;
}

.subscription-info-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
}

.usage-stats {
  margin-top: 2rem;
}

.usage-stats h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 1rem;
}

.usage-bar {
  margin: 1rem 0;
}

.usage-bar-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--gray-700);
}

.usage-bar-progress {
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}

.usage-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  border-radius: 4px;
  transition: width 0.3s ease;
}

.usage-bar-fill.warning {
  background: linear-gradient(90deg, var(--warning), #F59E0B);
}

.usage-bar-fill.danger {
  background: linear-gradient(90deg, var(--danger), #DC2626);
}