/* ============================================
   WBA Pro - WhatsApp Business Automation
   Premium Dark Theme Dashboard
============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@400;600;700;800&display=swap');

:root {
  --wa-green: #25D366;
  --wa-dark-green: #128C7E;
  --wa-light-green: #DCF8C6;
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: #161d2e;
  --bg-card-hover: #1a2235;
  --bg-sidebar: #0d1422;
  --border: rgba(255,255,255,0.07);
  --text-primary: #f0f4ff;
  --text-secondary: #8892a4;
  --text-muted: #4a5568;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-orange: #f59e0b;
  --accent-red: #ef4444;
  --success: #22c55e;
  --sidebar-width: 240px;
  --topbar-height: 72px;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.4);
  --glow-green: 0 0 20px rgba(37,211,102,0.3);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ==================== SIDEBAR ==================== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 100;
  padding: 20px 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.logo-img {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  object-fit: cover;
}

.logo-text {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--wa-green);
  display: block;
  line-height: 1.2;
}

.logo-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  display: block;
}

.sidebar-nav {
  flex: 1;
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(37,211,102,0.08);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(37,211,102,0.15), rgba(37,211,102,0.05));
  color: var(--wa-green);
  box-shadow: inset 0 0 0 1px rgba(37,211,102,0.2);
}

.nav-icon { font-size: 1.1rem; }

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

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

.status-dot.connected { background: var(--wa-green); }
.status-dot.disconnected { background: var(--accent-red); }

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(37,211,102,0.4); }
  50% { opacity: 0.8; box-shadow: 0 0 0 6px rgba(37,211,102,0); }
}

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

/* ==================== TOPBAR ==================== */
.topbar {
  height: var(--topbar-height);
  background: rgba(13,20,34,0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left { display: flex; flex-direction: column; }

.page-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
}

.page-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 1px;
}

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

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
}

.search-box input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.85rem;
  width: 160px;
}

.search-box input::placeholder { color: var(--text-muted); }

.notif-bell {
  position: relative;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.notif-bell:hover { background: var(--bg-card); }

.notif-badge {
  position: absolute;
  top: 2px; right: 2px;
  width: 16px; height: 16px;
  background: var(--accent-red);
  border-radius: 50%;
  font-size: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-style: normal;
}

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

.notif-panel {
  position: absolute;
  top: var(--topbar-height);
  right: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 280px;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.notif-header {
  padding: 14px 16px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.notif-item {
  padding: 12px 16px;
  font-size: 0.83rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  transition: var(--transition);
}

.notif-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.notif-item:last-child { border-bottom: none; }

/* ==================== SECTIONS ==================== */
.section {
  display: none;
  padding: 28px;
  animation: fadeIn 0.3s ease;
}

.section.active { display: block; }

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

/* ==================== CARDS ==================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
}

.card:hover { border-color: rgba(37,211,102,0.15); }

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

.card-header h2 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ==================== STAT CARDS ==================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid transparent;
  transition: var(--transition);
  cursor: default;
}

.stat-card:hover { transform: translateY(-2px); }

.stat-card.green {
  background: linear-gradient(135deg, rgba(37,211,102,0.12), rgba(37,211,102,0.04));
  border-color: rgba(37,211,102,0.2);
}

.stat-card.blue {
  background: linear-gradient(135deg, rgba(59,130,246,0.12), rgba(59,130,246,0.04));
  border-color: rgba(59,130,246,0.2);
}

.stat-card.purple {
  background: linear-gradient(135deg, rgba(139,92,246,0.12), rgba(139,92,246,0.04));
  border-color: rgba(139,92,246,0.2);
}

.stat-card.orange {
  background: linear-gradient(135deg, rgba(245,158,11,0.12), rgba(245,158,11,0.04));
  border-color: rgba(245,158,11,0.2);
}

.stat-icon {
  font-size: 2rem;
  line-height: 1;
}

.stat-value {
  font-family: 'Outfit', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.stat-change {
  font-size: 0.72rem;
  color: var(--wa-green);
  margin-top: 4px;
}

/* ==================== DASHBOARD ROWS ==================== */
.dashboard-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.chart-card canvas {
  max-height: 200px;
}

/* ==================== RECENT LIST ==================== */
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

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

.recent-icon {
  width: 36px; height: 36px;
  background: rgba(37,211,102,0.1);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.recent-info { flex: 1; }

.recent-title {
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text-primary);
}

.recent-meta {
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.badge {
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge.success {
  background: rgba(34,197,94,0.15);
  color: var(--success);
}

.badge.pending {
  background: rgba(245,158,11,0.15);
  color: var(--accent-orange);
}

/* ==================== QUICK ACTIONS ==================== */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.quick-btn {
  padding: 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.quick-btn:hover { transform: translateY(-2px); filter: brightness(1.1); }

.green-btn { background: rgba(37,211,102,0.15); color: var(--wa-green); border: 1px solid rgba(37,211,102,0.3); }
.blue-btn { background: rgba(59,130,246,0.15); color: var(--accent-blue); border: 1px solid rgba(59,130,246,0.3); }
.purple-btn { background: rgba(139,92,246,0.15); color: var(--accent-purple); border: 1px solid rgba(139,92,246,0.3); }
.orange-btn { background: rgba(245,158,11,0.15); color: var(--accent-orange); border: 1px solid rgba(245,158,11,0.3); }

/* ==================== TOGGLE SWITCH ==================== */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 99px;
  transition: 0.3s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 16px; width: 16px;
  left: 3px; bottom: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: 0.3s;
}
.toggle input:checked + .toggle-slider { background: rgba(37,211,102,0.2); border-color: var(--wa-green); }
.toggle input:checked + .toggle-slider::before { background: var(--wa-green); transform: translateX(20px); }

.ar-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.ar-item:last-child { border-bottom: none; }
.ar-name { font-size: 0.85rem; font-weight: 500; }
.ar-trigger { font-size: 0.73rem; color: var(--text-muted); margin-top: 2px; }

/* ==================== BUTTONS ==================== */
.btn-primary {
  background: linear-gradient(135deg, var(--wa-green), var(--wa-dark-green));
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--glow-green); }

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-outline:hover { border-color: var(--wa-green); color: var(--wa-green); }

.big-btn { width: 100%; justify-content: center; padding: 14px; font-size: 0.95rem; }
.small-btn { padding: 6px 14px; font-size: 0.78rem; }

/* ==================== FORMS ==================== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 6px; font-weight: 500; }
.form-group label small { color: var(--text-muted); font-weight: 400; }

.form-input, .form-textarea {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: var(--transition);
}

.form-input:focus, .form-textarea:focus {
  border-color: var(--wa-green);
  box-shadow: 0 0 0 3px rgba(37,211,102,0.1);
}

.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }

.select-small {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  padding: 6px 10px;
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
}

/* ==================== SECTION TOOLBAR ==================== */
.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.toolbar-left { display: flex; align-items: center; gap: 12px; }
.toolbar-right { display: flex; align-items: center; gap: 10px; }

.search-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  width: 240px;
  transition: var(--transition);
}

.search-input:focus { border-color: var(--wa-green); }

/* ==================== TABLE ==================== */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 13px 14px;
  font-size: 0.83rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

.data-table tr:hover td { background: var(--bg-card-hover); }
.data-table tr:last-child td { border-bottom: none; }

.group-pill {
  padding: 2px 10px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 500;
}

.group-pill.customer { background: rgba(59,130,246,0.15); color: var(--accent-blue); }
.group-pill.community { background: rgba(139,92,246,0.15); color: var(--accent-purple); }
.group-pill.business { background: rgba(245,158,11,0.15); color: var(--accent-orange); }

.action-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px 6px;
  border-radius: 4px;
  transition: var(--transition);
  color: var(--text-muted);
}
.action-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }

/* ==================== TEMPLATES GRID ==================== */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.template-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: var(--transition);
}

.template-card:hover {
  border-color: var(--wa-green);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

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

.tmpl-name { font-weight: 600; font-size: 0.9rem; }

.tmpl-body {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-line;
  border-left: 2px solid rgba(37,211,102,0.4);
  padding-left: 10px;
  margin-bottom: 12px;
}

.tmpl-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ==================== WA BUBBLE ==================== */
.wa-bubble {
  background: var(--wa-light-green);
  color: #1a1a1a;
  border-radius: 12px 12px 12px 2px;
  padding: 12px 16px;
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: pre-line;
  max-width: 320px;
}

.preview-box {
  background: linear-gradient(135deg, #0d1422, #111827);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.preview-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ==================== BROADCAST ==================== */
.broadcast-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.recipient-options { display: flex; gap: 16px; flex-wrap: wrap; }

.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text-secondary);
}

.radio-label input { accent-color: var(--wa-green); }

.broadcast-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.recipient-count {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.recipient-count strong { color: var(--wa-green); font-size: 1rem; }

.broadcast-history { overflow-y: auto; max-height: 540px; }

.bh-item {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

.bh-item:hover { background: var(--bg-card-hover); }
.bh-item:last-child { border-bottom: none; }

.bh-name { font-size: 0.85rem; font-weight: 500; margin-bottom: 4px; }
.bh-meta { font-size: 0.75rem; color: var(--text-muted); display: flex; gap: 10px; }

/* ==================== AUTO-REPLY ==================== */
.ar-rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.ar-rule-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: var(--transition);
}

.ar-rule-card:hover { border-color: rgba(37,211,102,0.2); }

.ar-rule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.ar-rule-name { font-weight: 600; font-size: 0.9rem; }
.ar-rule-triggers { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 10px; }

.ar-rule-reply {
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--bg-primary);
  padding: 10px;
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--wa-green);
  margin-bottom: 12px;
  white-space: pre-wrap;
}

.ar-rule-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==================== COMMUNITY ==================== */
.community-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.groups-list { display: flex; flex-direction: column; gap: 10px; }

.group-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.group-item:hover { border-color: rgba(37,211,102,0.2); background: var(--bg-card-hover); }

.group-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.group-info { flex: 1; }
.group-name { font-size: 0.85rem; font-weight: 500; }
.group-count { font-size: 0.73rem; color: var(--text-muted); margin-top: 2px; }

.invite-generator { display: flex; flex-direction: column; gap: 14px; }

.invite-result { margin-top: 8px; }

.invite-link-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-primary);
  border: 1px solid var(--wa-green);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.82rem;
  color: var(--wa-green);
  word-break: break-all;
}

.copy-btn {
  background: rgba(37,211,102,0.1);
  border: 1px solid rgba(37,211,102,0.3);
  color: var(--wa-green);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 10px;
  transition: var(--transition);
}

.copy-btn:hover { background: rgba(37,211,102,0.2); }

/* ==================== SETUP ==================== */
.setup-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.setup-timeline { display: flex; flex-direction: column; gap: 0; }

.setup-step {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.setup-step:last-child { border-bottom: none; }

.step-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--text-muted);
  background: var(--bg-primary);
  transition: var(--transition);
}

.setup-step.completed .step-num {
  border-color: var(--wa-green);
  background: rgba(37,211,102,0.15);
  color: var(--wa-green);
}

.step-title { font-size: 0.88rem; font-weight: 600; margin-bottom: 4px; }
.step-desc { font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; }

.step-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--accent-blue);
  text-decoration: none;
  transition: var(--transition);
}

.step-link:hover { color: var(--text-primary); }

.step-btn {
  margin-top: 8px;
  background: rgba(37,211,102,0.1);
  border: 1px solid rgba(37,211,102,0.2);
  color: var(--wa-green);
  border-radius: var(--radius-sm);
  padding: 4px 12px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: var(--transition);
}

.step-btn:hover { background: rgba(37,211,102,0.2); }

.token-input { position: relative; display: flex; }
.token-input .form-input { padding-right: 44px; }
.toggle-vis {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}

.webhook-box {
  display: flex;
  align-items: center;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.78rem;
  color: var(--text-muted);
  word-break: break-all;
}

.pricing-info {
  margin-top: 20px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.pricing-header { font-weight: 600; margin-bottom: 12px; font-size: 0.88rem; }

.pricing-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

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

.price { font-weight: 600; color: var(--text-primary); }
.price.free { color: var(--wa-green); }

.connection-result {
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  text-align: center;
}

/* ==================== MODAL ==================== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.open { display: flex; }

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}

.large-modal { max-width: 620px; }
.small-modal { max-width: 340px; }

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

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

.modal-header h3 { font-size: 1rem; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  border-radius: 4px;
  transition: var(--transition);
}

.modal-close:hover { color: var(--text-primary); background: var(--bg-card-hover); }

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.text-center { text-align: center; }
.success-icon { font-size: 3rem; margin-bottom: 12px; }

/* ==================== TAB GROUP ==================== */
.tab-group { display: flex; gap: 4px; }

.tab-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
}

.tab-btn:hover { border-color: var(--wa-green); color: var(--wa-green); }
.tab-btn.active { background: rgba(37,211,102,0.1); border-color: var(--wa-green); color: var(--wa-green); }

/* ==================== INBOX / CHAT UI ==================== */
.inbox-layout { display: grid; grid-template-columns: 320px 1fr; gap: 20px; height: calc(100vh - 120px); }
.inbox-sidebar { display: flex; flex-direction: column; overflow: hidden; }
.inbox-contacts { flex: 1; overflow-y: auto; }
.inbox-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: 0.2s; }
.inbox-item:hover { background: var(--bg-card-hover); }
.inbox-item.active { background: rgba(37,211,102,0.1); border-left: 3px solid var(--wa-green); }
.inbox-item-details { flex: 1; overflow: hidden; }
.inbox-item-name { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.inbox-item-preview { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-item-time { font-size: 0.7rem; color: var(--text-muted); }

.inbox-chat { display: flex; flex-direction: column; overflow: hidden; }
.chat-header { padding: 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: var(--bg-card); }
.chat-user-info { display: flex; align-items: center; gap: 12px; }
.chat-user-details h3 { font-size: 1rem; margin: 0; color: var(--text-primary); }
.chat-user-details span { font-size: 0.75rem; color: var(--text-muted); }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; background: rgba(0,0,0,0.15); }

.chat-bubble { max-width: 75%; padding: 10px 14px; border-radius: 8px; font-size: 0.85rem; line-height: 1.4; position: relative; }
.chat-bubble-in { background: var(--bg-card); color: var(--text-primary); border-bottom-left-radius: 2px; align-self: flex-start; }
.chat-bubble-out { background: var(--wa-dark-green); color: white; border-bottom-right-radius: 2px; align-self: flex-end; }
.chat-time { display: block; font-size: 0.65rem; margin-top: 4px; opacity: 0.7; text-align: right; }

.chat-input-area { padding: 16px; border-top: 1px solid var(--border); display: flex; gap: 10px; align-items: center; background: var(--bg-card); }
.attach-btn { background: none; border: none; color: var(--text-secondary); font-size: 1.2rem; cursor: pointer; padding: 8px; transition: 0.2s; }
.attach-btn:hover { color: var(--wa-green); }
.chat-input { flex: 1; border-radius: 20px; padding: 10px 16px; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1100px) {
  .stats-grid, .community-stats { grid-template-columns: repeat(2, 1fr); }
  .dashboard-row, .broadcast-layout, .setup-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .stats-grid, .community-stats { grid-template-columns: 1fr 1fr; }
}
