/* =========================================================
   Instagram Automation Panel — Main Stylesheet
   RTL Persian UI | Vazirmatn Font | Dark & Light Mode
   ========================================================= */

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

/* ─── CSS Variables ────────────────────────────────────── */
:root {
  /* Brand */
  --accent:        #6C63FF;
  --accent-hover:  #5A52E0;
  --accent-light:  rgba(108, 99, 255, 0.12);
  --success:       #22C55E;
  --warning:       #F59E0B;
  --danger:        #EF4444;
  --info:          #3B82F6;

  /* Spacing */
  --sidebar-w:     260px;
  --topbar-h:      64px;
  --radius:        12px;
  --radius-sm:     8px;
  --radius-lg:     16px;

  /* Transitions */
  --transition:    0.2s ease;
}

/* Light Mode */
[data-theme="light"] {
  --bg:            #F3F4F6;
  --bg-card:       #FFFFFF;
  --bg-sidebar:    #1E1B4B;
  --bg-input:      #F9FAFB;
  --border:        #E5E7EB;
  --text:          #111827;
  --text-muted:    #6B7280;
  --text-sidebar:  rgba(255,255,255,0.75);
  --text-sidebar-active: #FFFFFF;
  --shadow:        0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg:     0 10px 40px rgba(0,0,0,0.12);
}

/* Dark Mode */
[data-theme="dark"] {
  --bg:            #0F0F1A;
  --bg-card:       #1A1A2E;
  --bg-sidebar:    #12122A;
  --bg-input:      #16213E;
  --border:        #2D2D4A;
  --text:          #E2E8F0;
  --text-muted:    #94A3B8;
  --text-sidebar:  rgba(255,255,255,0.65);
  --text-sidebar-active: #FFFFFF;
  --shadow:        0 1px 3px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.2);
  --shadow-lg:     0 10px 40px rgba(0,0,0,0.4);
}

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

html {
  direction: rtl;
  font-family: 'Vazirmatn', sans-serif;
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; }
ul { list-style: none; }

/* ─── Layout ─────────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ───────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  right: 0;
  top: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  text-decoration: none;
}

.sidebar-logo .logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent), #EC4899);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo .logo-icon svg { color: #fff; width: 22px; height: 22px; }

.sidebar-logo .logo-text {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.sidebar-logo .logo-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  font-weight: 400;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.35);
  padding: 12px 8px 6px;
  text-transform: uppercase;
}

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

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-sidebar-active);
}

.nav-item.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(108,99,255,0.4);
}

.nav-item .badge {
  margin-right: auto;
  background: rgba(255,255,255,0.2);
  border-radius: 20px;
  font-size: 11px;
  padding: 2px 8px;
  font-weight: 600;
}

.nav-item.active .badge { background: rgba(255,255,255,0.3); }

/* Sidebar footer */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user .avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #fff;
  flex-shrink: 0;
}

.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { font-size: 11px; color: rgba(255,255,255,0.4); }

/* ─── Main Content ──────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-right: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Topbar ─────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  flex: 1;
}

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

.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}

.icon-btn:hover { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; }

/* Hamburger (mobile) */
.hamburger { display: none; }

/* ─── Page Content ──────────────────────────────────────── */
.page-content { padding: 24px; flex: 1; }

/* ─── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.card-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title { font-size: 15px; font-weight: 700; }
.card-body  { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); }

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg { width: 24px; height: 24px; color: #fff; }
.stat-icon.purple { background: linear-gradient(135deg, #6C63FF, #8B5CF6); }
.stat-icon.green  { background: linear-gradient(135deg, #22C55E, #10B981); }
.stat-icon.orange { background: linear-gradient(135deg, #F59E0B, #EF4444); }
.stat-icon.blue   { background: linear-gradient(135deg, #3B82F6, #6366F1); }

.stat-info { flex: 1; }
.stat-value { font-size: 26px; font-weight: 800; line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; font-weight: 500; }

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: 'Vazirmatn', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover  { background: var(--accent-hover); box-shadow: 0 4px 12px rgba(108,99,255,0.35); color: #fff; }

.btn-success  { background: var(--success); color: #fff; }
.btn-success:hover  { background: #16A34A; color: #fff; }

.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover   { background: #DC2626; color: #fff; }

.btn-warning  { background: var(--warning); color: #fff; }
.btn-warning:hover  { background: #D97706; color: #fff; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { background: var(--accent-light); border-color: var(--accent); color: var(--accent); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { background: var(--accent-light); color: var(--accent); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }

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

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

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-label.required::after {
  content: ' *';
  color: var(--danger);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Vazirmatn', sans-serif;
  font-size: 13px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  direction: rtl;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-control::placeholder { color: var(--text-muted); }

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

select.form-control { cursor: pointer; }

.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.form-error { font-size: 11px; color: var(--danger); margin-top: 4px; }

/* Checkbox / Toggle */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  transition: var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px; width: 18px;
  right: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition);
}

input:checked + .toggle-slider { background: var(--accent); }
input:checked + .toggle-slider::before { transform: translateX(-20px); }

/* ─── Tables ─────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  padding: 12px 16px;
  background: var(--bg);
  font-weight: 700;
  color: var(--text-muted);
  text-align: right;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

tbody tr:hover { background: var(--accent-light); }

tbody td {
  padding: 12px 16px;
  color: var(--text);
  vertical-align: middle;
}

tbody tr:last-child { border-bottom: none; }

/* ─── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success { background: rgba(34,197,94,0.12); color: #16A34A; }
.badge-danger  { background: rgba(239,68,68,0.12);  color: #DC2626; }
.badge-warning { background: rgba(245,158,11,0.12); color: #D97706; }
.badge-info    { background: rgba(59,130,246,0.12); color: #2563EB; }
.badge-purple  { background: rgba(108,99,255,0.12); color: var(--accent); }
.badge-gray    { background: var(--bg); color: var(--text-muted); }

/* ─── Modal ──────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

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

.modal-backdrop.show .modal { transform: translateY(0); }

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

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

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

.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}

.modal-close:hover { background: var(--danger); color: #fff; }
.modal-close svg { width: 18px; height: 18px; }

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

/* ─── Toast ──────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: slideInToast 0.3s ease;
  border-right: 4px solid;
}

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

.toast.success { border-right-color: var(--success); }
.toast.error   { border-right-color: var(--danger);  }
.toast.warning { border-right-color: var(--warning); }
.toast.info    { border-right-color: var(--info);    }

.toast-icon svg { width: 20px; height: 20px; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--success); }
.toast.error   .toast-icon { color: var(--danger);  }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info    .toast-icon { color: var(--info);    }

.toast-body { flex: 1; }
.toast-title { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.toast-msg   { font-size: 12px; color: var(--text-muted); }

.toast-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 2px; border-radius: 4px;
}
.toast-close:hover { color: var(--text); }
.toast-close svg { width: 14px; height: 14px; }

/* ─── Search / Filter Bar ────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-bar .form-control { width: auto; min-width: 180px; }

/* ─── Pagination ─────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px 0;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 36px; height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-family: 'Vazirmatn', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  text-decoration: none;
}

.page-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── Empty State ────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state svg { width: 64px; height: 64px; opacity: 0.3; margin-bottom: 16px; }
.empty-state h3  { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.empty-state p   { font-size: 13px; margin-bottom: 20px; }

/* ─── Rule Cards ─────────────────────────────────────────── */
.rule-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all var(--transition);
  box-shadow: var(--shadow);
}

.rule-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(108,99,255,0.12);
}

.rule-card-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.rule-card-icon svg { width: 22px; height: 22px; }

.rule-card-body { flex: 1; min-width: 0; }
.rule-card-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.rule-card-meta  { font-size: 11px; color: var(--text-muted); display: flex; gap: 12px; flex-wrap: wrap; }

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

/* ─── Log rows ───────────────────────────────────────────── */
.log-event-icon { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.log-event-icon svg { width: 14px; height: 14px; }
.log-event-icon.comment  { background: rgba(59,130,246,0.12); color: #3B82F6; }
.log-event-icon.dm       { background: rgba(108,99,255,0.12); color: var(--accent); }
.log-event-icon.rule     { background: rgba(34,197,94,0.12);  color: var(--success); }
.log-event-icon.sent     { background: rgba(245,158,11,0.12); color: var(--warning); }
.log-event-icon.error    { background: rgba(239,68,68,0.12);  color: var(--danger);  }

/* ─── Dashboard chart ────────────────────────────────────── */
.chart-container { position: relative; height: 200px; }

/* ─── Media preview ──────────────────────────────────────── */
.media-preview {
  display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px;
}

.media-item {
  position: relative;
  width: 100px; height: 100px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid var(--border);
  background: var(--bg);
}

.media-item img, .media-item video {
  width: 100%; height: 100%; object-fit: cover;
}

.media-item-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 6px;
  text-align: center;
}

.media-del-btn {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px;
  background: var(--danger);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

.media-del-btn svg { width: 12px; height: 12px; }

/* ─── Keyword tags ───────────────────────────────────────── */
.tags-input-container {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 44px;
  cursor: text;
}

.tags-input-container:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px; font-weight: 600;
}

.tag-remove {
  background: none; border: none; cursor: pointer;
  color: var(--accent); padding: 0; display: flex;
  opacity: 0.6;
}

.tag-remove:hover { opacity: 1; }
.tag-remove svg { width: 12px; height: 12px; }

.tags-input {
  border: none; outline: none; background: transparent;
  color: var(--text);
  font-family: 'Vazirmatn', sans-serif;
  font-size: 13px;
  min-width: 120px;
  flex: 1;
  direction: rtl;
}

/* ─── Reply list ─────────────────────────────────────────── */
.reply-list { display: flex; flex-direction: column; gap: 8px; }

.reply-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.reply-text { flex: 1; font-size: 13px; }
.reply-num  { font-size: 11px; font-weight: 700; color: var(--accent); min-width: 24px; }

/* ─── Loader ─────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

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

.page-loader {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s;
}

.page-loader.hidden { opacity: 0; pointer-events: none; }

/* ─── Tabs ───────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 2px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.tab-btn {
  flex: 1; padding: 9px 16px;
  border-radius: 6px;
  border: none; background: none;
  color: var(--text-muted);
  font-family: 'Vazirmatn', sans-serif;
  font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
  text-align: center;
}

.tab-btn.active {
  background: var(--bg-card);
  color: var(--accent);
  box-shadow: var(--shadow);
}

/* ─── Account card ───────────────────────────────────────── */
.account-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
  transition: all var(--transition);
}

.account-card.connected { border-color: var(--success); }

.account-avatar {
  width: 60px; height: 60px; border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
}

.account-info { flex: 1; }
.account-name { font-weight: 700; font-size: 15px; }
.account-username { color: var(--text-muted); font-size: 13px; }
.account-stats { display: flex; gap: 16px; margin-top: 8px; }
.account-stat  { font-size: 12px; color: var(--text-muted); }
.account-stat strong { color: var(--text); font-weight: 700; }

/* ─── Grid helpers ───────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ─── Utility ────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success{ color: var(--success); }
.fw-bold     { font-weight: 700; }
.mt-4        { margin-top: 16px; }
.mb-4        { margin-bottom: 16px; }
.mb-2        { margin-bottom: 8px; }
.d-flex      { display: flex; }
.align-center{ align-items: center; }
.gap-2       { gap: 8px; }
.gap-3       { gap: 12px; }
.flex-1      { flex: 1; }
.w-100       { width: 100%; }
.overflow-hidden { overflow: hidden; }
.text-truncate   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: -4px 0 24px rgba(0,0,0,0.3);
  }

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

  .hamburger { display: flex; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  .page-content { padding: 16px; }

  .topbar { padding: 0 16px; }

  .filter-bar { gap: 8px; }
  .filter-bar .form-control { min-width: 140px; }

  #toast-container { left: 12px; right: 12px; max-width: none; }
}

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

/* ─── Overlay for mobile sidebar ─────────────────────────── */
.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  display: none;
}

.sidebar-overlay.show { display: block; }

/* ─── Login page ─────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  padding: 20px;
}

.login-card {
  width: 100%; max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .logo-circle {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--accent), #EC4899);
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
}

.login-logo .logo-circle svg { width: 34px; height: 34px; color: #fff; }
.login-logo h1 { font-size: 20px; font-weight: 800; }
.login-logo p  { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
