/* ============================================================
   WhatsApp CRM — Design System
   Dark mode by default, glassmorphism, smooth animations
   ============================================================ */

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

/* ── Custom Properties ─────────────────────────────────────── */
:root {
  --bg-primary:     #0f1117;
  --bg-secondary:   #161b27;
  --bg-card:        #1e2536;
  --bg-hover:       #252d3f;
  --bg-input:       #1a2033;

  --border:         rgba(255,255,255,0.08);
  --border-active:  rgba(99,102,241,0.6);

  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;

  --brand:          #6366f1;
  --brand-light:    #818cf8;
  --brand-dark:     #4f46e5;
  --brand-glow:     rgba(99,102,241,0.25);

  --green:          #22c55e;
  --green-bg:       rgba(34,197,94,0.12);
  --yellow:         #f59e0b;
  --yellow-bg:      rgba(245,158,11,0.12);
  --red:            #ef4444;
  --red-bg:         rgba(239,68,68,0.12);
  --blue:           #3b82f6;
  --blue-bg:        rgba(59,130,246,0.12);
  --purple:         #a855f7;
  --purple-bg:      rgba(168,85,247,0.12);

  --wa-green:       #25d366;
  --wa-dark:        #075e54;

  --sidebar-w:      260px;
  --topbar-h:       64px;
  --radius:         12px;
  --radius-sm:      8px;
  --radius-lg:      16px;
  --shadow:         0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm:      0 2px 8px rgba(0,0,0,0.3);
  --shadow-glow:    0 0 30px var(--brand-glow);

  --transition:     all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --font:           'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* ── Layout ─────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-left: var(--sidebar-w);
  transition: var(--transition);
}

.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  padding-top: calc(var(--topbar-h) + 24px);
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: var(--transition);
}

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

.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--wa-green), var(--brand));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: 15px;
  font-weight: 700;
  background: linear-gradient(135deg, #fff, var(--brand-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.sidebar-logo-sub {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
  -webkit-text-fill-color: var(--text-muted);
  background: none;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section {
  padding: 8px 10px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--brand-glow);
  color: var(--brand-light);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 25%; bottom: 25%;
  width: 3px;
  background: var(--brand);
  border-radius: 0 3px 3px 0;
}

.nav-item .nav-icon {
  width: 18px; height: 18px;
  opacity: 0.8;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.user-card:hover { background: var(--bg-hover); }

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
}

.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--text-muted); }

/* ── Top Bar ─────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: rgba(22, 27, 39, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: fixed;
  top: 0; right: 0;
  left: var(--sidebar-w);
  z-index: 90;
}

.topbar-search {
  flex: 1;
  max-width: 360px;
}

.search-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  transition: var(--transition);
}
.search-box:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.search-box input {
  background: none; border: none; outline: none;
  color: var(--text-primary); font-size: 13.5px; width: 100%;
}
.search-box input::placeholder { color: var(--text-muted); }

.topbar-actions {
  display: flex; align-items: center; gap: 8px;
  margin-left: auto;
}

.topbar-btn {
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition);
  position: relative;
}
.topbar-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--brand); }

.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: var(--transition);
}
.card:hover { border-color: rgba(255,255,255,0.12); }

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.card-title {
  font-size: 15px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.card-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── KPI / Stat Cards ────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--color, var(--brand));
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: rgba(255,255,255,0.12);
}

.stat-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--icon-bg, var(--brand-glow));
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; margin-bottom: 14px;
}
.stat-value {
  font-size: 26px; font-weight: 800;
  line-height: 1; margin-bottom: 4px;
}
.stat-label {
  font-size: 12px; color: var(--text-muted); font-weight: 500;
}
.stat-change {
  font-size: 11px; font-weight: 600; margin-top: 8px;
  display: flex; align-items: center; gap: 4px;
}
.stat-change.up   { color: var(--green); }
.stat-change.down { color: var(--red); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; padding: 9px 18px;
  border-radius: var(--radius-sm); border: none;
  font-size: 13.5px; font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  box-shadow: 0 2px 12px var(--brand-glow);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--brand-light), var(--brand));
  box-shadow: 0 4px 20px var(--brand-glow);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, #16a34a, var(--green));
  color: #fff;
}
.btn-success:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); }

.btn-danger {
  background: linear-gradient(135deg, #dc2626, var(--red));
  color: #fff;
}
.btn-danger:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-outline:hover:not(:disabled) {
  background: var(--bg-hover); color: var(--text-primary); border-color: var(--brand);
}

.btn-ghost {
  background: var(--bg-hover); color: var(--text-secondary); border: none;
}
.btn-ghost:hover:not(:disabled) { color: var(--text-primary); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { padding: 8px; }
.btn-wa {
  background: linear-gradient(135deg, var(--wa-dark), var(--wa-green));
  color: #fff;
}

/* ── Badges / Pills ──────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 600;
}
.badge-green   { background: var(--green-bg);  color: var(--green); }
.badge-red     { background: var(--red-bg);    color: var(--red); }
.badge-yellow  { background: var(--yellow-bg); color: var(--yellow); }
.badge-blue    { background: var(--blue-bg);   color: var(--blue); }
.badge-purple  { background: var(--purple-bg); color: var(--purple); }
.badge-gray    { background: rgba(255,255,255,0.08); color: var(--text-muted); }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
table {
  width: 100%; border-collapse: collapse;
  font-size: 13.5px;
}
thead tr {
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
}
th {
  padding: 12px 16px;
  text-align: left; font-weight: 600;
  color: var(--text-secondary); font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.5px;
  white-space: nowrap;
}
td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: var(--transition); }
tbody tr:hover { background: var(--bg-hover); }

.table-actions { display: flex; align-items: center; gap: 6px; }

/* ── Form Elements ───────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; margin-bottom: 6px;
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
}
.form-label.required::after { content: ' *'; color: var(--red); }

.form-control {
  width: 100%; padding: 10px 14px;
  background: var(--bg-input); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13.5px; outline: none; transition: var(--transition);
}
.form-control:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.form-control::placeholder { color: var(--text-muted); }

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

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

.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 5px; }
.form-error { font-size: 11.5px; color: var(--red); margin-top: 5px; }

.form-row {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.form-check {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
}
.form-check input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer;
}

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; visibility: hidden; transition: var(--transition);
}
.modal-overlay.show { opacity: 1; visibility: visible; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow);
  transform: translateY(20px) scale(0.97);
  transition: var(--transition);
}
.modal-overlay.show .modal { transform: translateY(0) scale(1); }

.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1100px; }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 700; }

.modal-close {
  width: 30px; height: 30px; border-radius: 6px;
  border: none; background: var(--bg-hover);
  color: var(--text-secondary); font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.modal-close:hover { background: var(--red-bg); color: var(--red); }

.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

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

.toast {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  min-width: 300px; max-width: 400px;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease forwards;
}
.toast.toast-success { border-left-color: var(--green); }
.toast.toast-error   { border-left-color: var(--red); }
.toast.toast-warning { border-left-color: var(--yellow); }

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

.toast-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.toast-body { flex: 1; }
.toast-title { font-size: 13px; font-weight: 600; }
.toast-message { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.toast-close { background: none; border: none; color: var(--text-muted); font-size: 16px; padding: 0; }

/* ── Page Header ─────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.page-title { font-size: 22px; font-weight: 800; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── Progress Bar ────────────────────────────────────────────── */
.progress-bar {
  height: 6px; background: var(--bg-hover); border-radius: 99px; overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--brand), var(--brand-light));
  transition: width 0.5s ease;
}
.progress-fill.green { background: linear-gradient(90deg, #16a34a, var(--green)); }
.progress-fill.red   { background: linear-gradient(90deg, #dc2626, var(--red)); }

/* ── Inbox Layout ────────────────────────────────────────────── */
.inbox-layout {
  display: grid;
  grid-template-columns: 300px 1fr 280px;
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
}

.inbox-sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}

.inbox-list {
  flex: 1; overflow-y: auto;
}

.inbox-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: var(--transition);
  display: flex; align-items: flex-start; gap: 12px;
}
.inbox-item:hover { background: var(--bg-hover); }
.inbox-item.active { background: var(--brand-glow); }

.inbox-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.inbox-item-content { flex: 1; min-width: 0; }
.inbox-item-name { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.inbox-item-msg { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.inbox-item-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

.inbox-chat {
  display: flex; flex-direction: column;
  background: var(--bg-primary);
  overflow: hidden;
}

.chat-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  display: flex; align-items: center; gap: 12px;
}

.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 20px; display: flex; flex-direction: column; gap: 12px;
}

.chat-bubble {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13.5px; line-height: 1.5;
}
.chat-bubble.out {
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.chat-bubble.in {
  background: var(--bg-card);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.bubble-time { font-size: 10px; opacity: 0.7; margin-top: 4px; text-align: right; }

.chat-input-area {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  display: flex; gap: 10px; align-items: flex-end;
}

.chat-input {
  flex: 1; resize: none;
  background: var(--bg-input); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 14px; font-size: 13.5px; outline: none;
  max-height: 120px; transition: var(--transition);
}
.chat-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }

.inbox-info {
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 20px 16px;
}

/* ── Wizard Steps ────────────────────────────────────────────── */
.wizard-steps {
  display: flex; align-items: center;
  margin-bottom: 32px; position: relative;
}
.wizard-steps::before {
  content: '';
  position: absolute; top: 16px; left: 0; right: 0; height: 2px;
  background: var(--border); z-index: 0;
}
.wizard-step {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  position: relative; z-index: 1;
}
.step-num {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-card); border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--text-muted);
  transition: var(--transition);
}
.wizard-step.active .step-num {
  background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: 0 0 16px var(--brand-glow);
}
.wizard-step.done .step-num {
  background: var(--green); border-color: var(--green); color: #fff;
}
.step-label { font-size: 11px; color: var(--text-muted); margin-top: 6px; text-align: center; }
.wizard-step.active .step-label { color: var(--brand-light); font-weight: 600; }

/* ── Loading States ──────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 64px 24px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 13px; max-width: 320px; margin: 0 auto 20px; }

/* ── Dropdown ────────────────────────────────────────────────── */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  min-width: 180px; z-index: 200;
  overflow: hidden;
  opacity: 0; visibility: hidden; transform: translateY(-8px);
  transition: var(--transition);
}
.dropdown-menu.show { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; font-size: 13.5px;
  color: var(--text-secondary); transition: var(--transition); cursor: pointer;
}
.dropdown-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.dropdown-item.danger:hover { background: var(--red-bg); color: var(--red); }
.dropdown-divider { height: 1px; background: var(--border); }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; gap: 4px;
  justify-content: center; margin-top: 20px;
}
.page-btn {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-card);
  color: var(--text-secondary); font-size: 13px; font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition); cursor: pointer;
}
.page-btn:hover { border-color: var(--brand); color: var(--brand); }
.page-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Tabs ────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab {
  padding: 10px 20px; font-size: 13.5px; font-weight: 500;
  color: var(--text-muted); border-bottom: 2px solid transparent;
  transition: var(--transition); cursor: pointer;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--brand-light); border-bottom-color: var(--brand); font-weight: 600; }

/* ── Audience Builder ────────────────────────────────────────── */
.filter-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px;
  margin-bottom: 10px;
}
.filter-row select, .filter-row input {
  background: none; border: none; outline: none;
  color: var(--text-primary); font-size: 13px;
}
.filter-row select { color: var(--text-secondary); }

/* ── Audience Preview Card ───────────────────────────────────── */
.audience-summary {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
  background: var(--bg-input); border-radius: var(--radius-sm); padding: 16px;
}
.aud-item { text-align: center; }
.aud-value { font-size: 22px; font-weight: 800; }
.aud-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── Animations ──────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.3s ease forwards; }

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.6} }
.pulse { animation: pulse 2s infinite; }

/* ── Login Page ──────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-primary);
  position: relative; overflow: hidden;
}
.auth-page::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  background: radial-gradient(circle, var(--brand-glow) 0%, transparent 70%);
  top: -150px; right: -150px; pointer-events: none;
}
.auth-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(37,211,102,0.1) 0%, transparent 70%);
  bottom: -100px; left: -100px; pointer-events: none;
}
.auth-card {
  width: 100%; max-width: 420px; padding: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow), var(--shadow-glow);
  position: relative; z-index: 1;
  animation: fadeIn 0.5s ease;
}
.auth-logo {
  text-align: center; margin-bottom: 32px;
}
.auth-logo-icon {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--wa-green), var(--brand));
  border-radius: 16px; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
  box-shadow: 0 8px 32px rgba(37,211,102,0.25);
}
.auth-logo h1 { font-size: 22px; font-weight: 800; }
.auth-logo p  { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ── Chart Containers ────────────────────────────────────────── */
.chart-card { padding: 20px; }
.chart-container { height: 240px; }

/* ── Status Indicators ───────────────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  margin-right: 6px;
}
.status-dot.connected, .status-dot.opted_in, .status-dot.running { background: var(--green); }
.status-dot.pending,   .status-dot.unknown { background: var(--yellow); }
.status-dot.error, .status-dot.opted_out, .status-dot.failed    { background: var(--red); }
.status-dot.disconnected { background: var(--text-muted); }
.status-dot.paused { background: var(--blue); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .inbox-layout { grid-template-columns: 260px 1fr; }
  .inbox-info   { display: none; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); width: 260px; }
  .main-content { margin-left: 0; }
  .topbar { left: 0; }
  .page-content { padding: 16px; padding-top: calc(var(--topbar-h) + 16px); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .inbox-layout { grid-template-columns: 1fr; }
  .inbox-sidebar { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 24px; }
}
