/* ============================================================
   ADMIN PANEL - MAIN STYLESHEET
   Supports: Theme Color Switcher via CSS Variables
   ============================================================ */

:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #818cf8;
  --primary-bg: #eef2ff;
  --accent: #06b6d4;
  --sidebar-bg: #1e1b4b;
  --sidebar-text: #c7d2fe;
  --sidebar-active: #4f46e5;
  --sidebar-hover: #312e81;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --bg-body: #f1f5f9;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 2px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --font: 'Segoe UI', system-ui, sans-serif;
  --transition: 0.22s ease;
}

/* ---- THEME VARIANTS ---- */
body.theme-green {
  --primary: #059669; --primary-dark: #047857; --primary-light: #34d399;
  --primary-bg: #ecfdf5; --sidebar-bg: #064e3b; --sidebar-active: #059669;
  --sidebar-hover: #065f46; --accent: #10b981;
}
body.theme-red {
  --primary: #dc2626; --primary-dark: #b91c1c; --primary-light: #f87171;
  --primary-bg: #fef2f2; --sidebar-bg: #450a0a; --sidebar-active: #dc2626;
  --sidebar-hover: #7f1d1d; --accent: #f97316;
}
body.theme-orange {
  --primary: #ea580c; --primary-dark: #c2410c; --primary-light: #fb923c;
  --primary-bg: #fff7ed; --sidebar-bg: #431407; --sidebar-active: #ea580c;
  --sidebar-hover: #7c2d12; --accent: #f59e0b;
}
body.theme-teal {
  --primary: #0d9488; --primary-dark: #0f766e; --primary-light: #2dd4bf;
  --primary-bg: #f0fdfa; --sidebar-bg: #042f2e; --sidebar-active: #0d9488;
  --sidebar-hover: #134e4a; --accent: #06b6d4;
}
body.theme-purple {
  --primary: #7c3aed; --primary-dark: #6d28d9; --primary-light: #a78bfa;
  --primary-bg: #f5f3ff; --sidebar-bg: #2e1065; --sidebar-active: #7c3aed;
  --sidebar-hover: #3b0764; --accent: #ec4899;
}
body.theme-blue {
  --primary: #3d8ee8; --primary-dark: #2272cc; --primary-light: #74b3f5;
  --primary-bg: #eff6ff; --sidebar-bg: #0c2a4a; --sidebar-active: #3d8ee8;
  --sidebar-hover: #153d6b; --accent: #38bdf8;
}
body.theme-dark {
  --primary: #6366f1; --primary-dark: #4f46e5; --primary-light: #a5b4fc;
  --primary-bg: #1e1e2e; --sidebar-bg: #111827; --sidebar-active: #4f46e5;
  --sidebar-hover: #1f2937; --accent: #06b6d4;
  --bg-body: #0f172a; --bg-card: #1e293b;
  --text-main: #f1f5f9; --text-muted: #94a3b8; --border: #334155;
}

/* ---- RESET ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg-body); color: var(--text-main); min-height: 100vh; overflow-x: hidden; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { display: block; max-width: 100%; }
input, select, textarea, button { font-family: inherit; }

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: 10px; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--sidebar-bg) 0%, var(--primary) 100%);
  position: relative; overflow: hidden;
}
.login-page::before {
  content: ''; position: absolute; width: 600px; height: 600px;
  border-radius: 50%; background: rgba(255,255,255,0.04);
  top: -200px; right: -200px;
}
.login-page::after {
  content: ''; position: absolute; width: 400px; height: 400px;
  border-radius: 50%; background: rgba(255,255,255,0.04);
  bottom: -150px; left: -100px;
}
.login-card {
  background: var(--bg-card); border-radius: 20px; padding: 48px 40px;
  width: 100%; max-width: 420px; position: relative; z-index: 2;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  display: flex; align-items: center; gap: 12px; margin-bottom: 8px;
}
.login-logo .logo-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff;
}
.login-logo .brand { font-size: 22px; font-weight: 800; color: var(--text-main); }
.login-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 32px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-main); margin-bottom: 6px; }
.form-group .input-wrap { position: relative; }
.form-group .input-wrap i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 16px; }
.form-group input {
  width: 100%; padding: 12px 14px 12px 40px;
  border: 1.5px solid var(--border); border-radius: 10px;
  background: var(--bg-body); color: var(--text-main); font-size: 14px;
  transition: border-color var(--transition);
}
.form-group input:focus { outline: none; border-color: var(--primary); }
.form-row-check { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; font-size: 13px; }
.form-row-check label { display: flex; align-items: center; gap: 6px; color: var(--text-muted); cursor: pointer; }
.form-row-check a { color: var(--primary); font-weight: 600; }
.btn-login {
  width: 100%; padding: 13px; background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; border: none; border-radius: 10px; font-size: 15px; font-weight: 700;
  cursor: pointer; transition: opacity var(--transition), transform var(--transition);
}
.btn-login:hover { opacity: 0.9; transform: translateY(-1px); }
.login-error { color: var(--danger); font-size: 13px; margin-top: 10px; text-align: center; display: none; }

/* ============================================================
   LAYOUT - SIDEBAR + TOPBAR
   ============================================================ */
.layout { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: 260px; min-height: 100vh; background: var(--sidebar-bg);
  display: flex; flex-direction: column; position: fixed; left: 0; top: 0; bottom: 0;
  z-index: 100; transition: width var(--transition), transform var(--transition);
  overflow: hidden;
}
.sidebar.collapsed { width: 70px; }
.sidebar-header {
  padding: 24px 20px; display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.sidebar-logo {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff;
}
.sidebar-brand { font-size: 17px; font-weight: 800; color: #fff; white-space: nowrap; overflow: hidden; }
.sidebar-toggle {
  margin-left: auto; background: none; border: none; color: var(--sidebar-text);
  cursor: pointer; font-size: 18px; padding: 4px; flex-shrink: 0;
}
.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-section-title {
  font-size: 10px; font-weight: 700; letter-spacing: 1.2px;
  color: rgba(255,255,255,0.3); text-transform: uppercase;
  padding: 8px 8px 4px; white-space: nowrap; overflow: hidden;
}
.sidebar.collapsed .nav-section-title { opacity: 0; }
.nav-item { margin-bottom: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px;
  border-radius: 10px; color: var(--sidebar-text); font-size: 14px; font-weight: 500;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap; overflow: hidden;
}
.nav-link i { font-size: 18px; flex-shrink: 0; width: 22px; text-align: center; }
.nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.nav-link.active { background: var(--primary); color: #fff; }
/* Parent menu — active class nahi milegi, sirf hover effect */
.nav-link.nav-parent:hover { background: var(--sidebar-hover); color: #fff; }
/* Submenu active item — poora primary color */
.submenu-link.active {
  background: var(--sidebar-active) !important;
  color: #fff !important;
}
/* Submenu indent */
.submenu { border-left: 2px solid rgba(255,255,255,0.12); margin-left: 14px; }
.nav-link .badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 20px;
}
.sidebar.collapsed .nav-link span, .sidebar.collapsed .badge { display: none; }
.sidebar-footer {
  padding: 16px 12px; border-top: 1px solid rgba(255,255,255,0.07);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 10px; cursor: pointer; transition: background var(--transition);
}
.sidebar-user:hover { background: var(--sidebar-hover); }
.sidebar-user .avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.sidebar-user .info { overflow: hidden; }
.sidebar-user .name { color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .role { color: var(--sidebar-text); font-size: 11px; }
.sidebar.collapsed .sidebar-user .info { display: none; }

/* MAIN AREA */
.main { margin-left: 260px; flex: 1; display: flex; flex-direction: column; transition: margin-left var(--transition); }
.main.expanded { margin-left: 70px; }

/* TOPBAR */
.topbar {
  height: 64px; background: var(--bg-card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 28px; gap: 16px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 18px; font-weight: 700; color: var(--text-main); flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1.5px solid var(--border);
  background: var(--bg-body); color: var(--text-muted); display: flex;
  align-items: center; justify-content: center; cursor: pointer; font-size: 17px;
  transition: all var(--transition); position: relative;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); border: 2px solid var(--bg-card); }
.theme-switcher-btn {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  border: 1.5px solid var(--border); border-radius: 10px; background: var(--bg-body);
  color: var(--text-muted); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all var(--transition);
}
.theme-switcher-btn:hover { border-color: var(--primary); color: var(--primary); }

/* CONTENT */
.content { padding: 28px; flex: 1; }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px; margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-card); border-radius: var(--radius); padding: 22px 24px;
  border: 1px solid var(--border); box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 18px; transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-icon {
  width: 52px; height: 52px; border-radius: 14px; display: flex;
  align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0;
}
.stat-icon.blue { background: var(--primary-bg); color: var(--primary); }
.stat-icon.green { background: #ecfdf5; color: var(--success); }
.stat-icon.yellow { background: #fffbeb; color: var(--warning); }
.stat-icon.red { background: #fef2f2; color: var(--danger); }
.stat-info .label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-info .value { font-size: 26px; font-weight: 800; color: var(--text-main); line-height: 1.2; margin: 2px 0; }
.stat-info .change { font-size: 12px; font-weight: 600; }
.stat-info .change.up { color: var(--success); }
.stat-info .change.down { color: var(--danger); }

/* ============================================================
   CHARTS SECTION
   ============================================================ */
.charts-grid {
  display: grid; grid-template-columns: 2fr 1fr;
  gap: 20px; margin-bottom: 28px;
}
.card {
  background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow); overflow: hidden;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.card-title { font-size: 15px; font-weight: 700; color: var(--text-main); }
.card-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.card-body { padding: 20px 22px; }
.chart-wrap { position: relative; height: 260px; }

/* ============================================================
   TABLE
   ============================================================ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  padding: 12px 16px; text-align: left; font-size: 11px; font-weight: 700;
  letter-spacing: 0.6px; text-transform: uppercase; color: var(--text-muted);
  background: var(--bg-body); border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); color: var(--text-main); }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--primary-bg); }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 700;
}
.user-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.user-name { font-weight: 600; font-size: 13px; }
.user-email { font-size: 11px; color: var(--text-muted); }

/* BADGES */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700;
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef9c3; color: #a16207; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-info { background: #e0f2fe; color: #0369a1; }
.badge-muted { background: var(--border); color: var(--text-muted); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: 9px; font-size: 13px; font-weight: 600;
  cursor: pointer; border: none; transition: all var(--transition);
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text-main); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.88; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 7px; }
.btn-icon { padding: 8px; border-radius: 8px; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  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;
  opacity: 0; pointer-events: none; transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card); border-radius: 18px; width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg);
  transform: translateY(30px) scale(0.97); transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 26px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted); line-height: 1; }
.modal-body { padding: 24px 26px; }
.modal-footer { padding: 18px 26px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* FORM INSIDE MODAL */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border);
  border-radius: 9px; background: var(--bg-body); color: var(--text-main); font-size: 13.5px;
  transition: border-color var(--transition);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.file-upload-area {
  border: 2px dashed var(--border); border-radius: 12px; padding: 28px 20px;
  text-align: center; cursor: pointer; transition: border-color var(--transition), background var(--transition);
}
.file-upload-area:hover { border-color: var(--primary); background: var(--primary-bg); }
.file-upload-area i { font-size: 32px; color: var(--primary); margin-bottom: 8px; }
.file-upload-area p { font-size: 13px; color: var(--text-muted); }
.file-upload-area strong { color: var(--primary); }
.file-upload-area input[type="file"] { display: none; }

/* ============================================================
   THEME SWITCHER PANEL
   ============================================================ */
.theme-panel {
  position: fixed; right: 24px; top: 80px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 14px; padding: 20px;
  box-shadow: var(--shadow-lg); z-index: 999; width: 220px;
  display: none;
}
.theme-panel.open { display: block; }
.theme-panel h4 { font-size: 13px; font-weight: 700; margin-bottom: 14px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.theme-colors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.theme-dot {
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  border: 3px solid transparent; transition: transform var(--transition), border-color var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.theme-dot:hover, .theme-dot.active { transform: scale(1.15); border-color: var(--text-main); }
.theme-dot i { font-size: 14px; color: #fff; opacity: 0; }
.theme-dot.active i { opacity: 1; }

/* ============================================================
   FILTERS BAR
   ============================================================ */
.filters-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px;
}
.search-box {
  display: flex; align-items: center; gap: 8px; background: var(--bg-card);
  border: 1.5px solid var(--border); border-radius: 10px; padding: 8px 14px; flex: 1; min-width: 200px;
}
.search-box i { color: var(--text-muted); }
.search-box input { border: none; background: transparent; color: var(--text-main); font-size: 13.5px; flex: 1; }
.search-box input:focus { outline: none; }
.filter-select {
  padding: 9px 14px; border: 1.5px solid var(--border); border-radius: 10px;
  background: var(--bg-card); color: var(--text-main); font-size: 13px; cursor: pointer;
}
.filter-select:focus { outline: none; border-color: var(--primary); }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination { display: flex; align-items: center; gap: 6px; justify-content: center; padding: 20px 0 4px; }
.page-btn {
  width: 34px; height: 34px; border-radius: 8px; border: 1.5px solid var(--border);
  background: var(--bg-card); color: var(--text-main); font-size: 13px; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ============================================================
   PAYMENT HISTORY PAGE
   ============================================================ */
.sort-bar { display: flex; align-items: center; gap: 8px; }
.sort-btn {
  padding: 7px 14px; border: 1.5px solid var(--border); border-radius: 8px;
  background: var(--bg-card); color: var(--text-muted); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all var(--transition); display: flex; align-items: center; gap: 5px;
}
.sort-btn.active, .sort-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }
.sort-btn i { font-size: 11px; }

/* LOADING SPINNER */
.spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 2px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* TOAST */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); min-width: 280px; max-width: 360px;
  animation: slideIn 0.3s ease;
}
@keyframes slideIn { from { transform: translateX(100px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast-icon { font-size: 20px; }
.toast-msg { flex: 1; font-size: 13.5px; font-weight: 500; }
.toast-close { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 16px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .charts-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main { margin-left: 0 !important; }
  .stats-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.ml-auto { margin-left: auto; }
.hidden { display: none !important; }
.avatar-lg {
  width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 22px; font-weight: 700;
}
.tag {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; background: var(--primary-bg); color: var(--primary);
}
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state i { font-size: 48px; margin-bottom: 12px; opacity: 0.3; }
.empty-state p { font-size: 14px; }

/* User Detail Card */
.user-detail-card {
  background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border);
  box-shadow: var(--shadow); padding: 28px; margin-bottom: 20px;
}
.user-profile-header {
  display: flex; align-items: center; gap: 20px; margin-bottom: 24px;
}
.profile-photo {
  width: 80px; height: 80px; border-radius: 50%; object-fit: cover;
  border: 3px solid var(--primary); background: var(--primary-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: var(--primary); flex-shrink: 0;
}
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-item label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); }
.detail-item p { font-size: 14px; font-weight: 500; margin-top: 3px; }

/* Progress bar */
.progress-bar { height: 6px; background: var(--border); border-radius: 10px; overflow: hidden; margin-top: 6px; }
.progress-fill { height: 100%; border-radius: 10px; background: linear-gradient(90deg, var(--primary), var(--accent)); }

/* ============================================================
   SUBMENU (Mail expand/collapse)
   ============================================================ */
.submenu {
  max-height: 0; overflow: hidden;
  transition: max-height 0.32s ease, opacity 0.25s ease;
  opacity: 0; padding-left: 14px;
}
.submenu.open { max-height: 300px; opacity: 1; }
.submenu-link { font-size: 13px !important; padding: 9px 12px !important; }
.nav-parent { user-select: none; }

/* ============================================================
   MAIL PAGES
   ============================================================ */
.mail-layout { display: flex; gap: 0; height: calc(100vh - 64px); overflow: hidden; }

/* Left sidebar mail list */
.mail-list-panel {
  width: 320px; flex-shrink: 0; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; background: var(--bg-card); overflow: hidden;
}
.mail-list-header {
  padding: 16px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.mail-list-header h3 { font-size: 15px; font-weight: 700; flex: 1; }
.mail-search {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.mail-search input {
  border: none; background: var(--bg-body); flex: 1; font-size: 13px;
  color: var(--text-main); outline: none; padding: 6px 10px; border-radius: 8px;
}
.mail-search i { color: var(--text-muted); font-size: 18px; }
.mail-items { overflow-y: auto; flex: 1; }
.mail-item {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background var(--transition); position: relative;
}
.mail-item:hover { background: var(--primary-bg); }
.mail-item.active { background: var(--primary-bg); border-left: 3px solid var(--primary); }
.mail-item.unread .mail-item-subject { font-weight: 800; color: var(--text-main); }
.mail-item.unread::after {
  content: ''; position: absolute; top: 18px; right: 14px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--primary);
}
.mail-item-from { font-size: 12px; font-weight: 700; color: var(--text-main); margin-bottom: 3px; display: flex; justify-content: space-between; }
.mail-item-from .time { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.mail-item-subject { font-size: 13px; color: var(--text-main); margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-item-preview { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Right reading/compose panel */
.mail-view-panel {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column;
  background: var(--bg-body);
}
.mail-view-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; color: var(--text-muted);
}
.mail-view-empty i { font-size: 64px; opacity: 0.2; margin-bottom: 12px; }
.mail-view-empty p { font-size: 15px; }

/* Mail reading area */
.mail-reading { padding: 28px 32px; flex: 1; }
.mail-reading-header { margin-bottom: 24px; }
.mail-reading-subject { font-size: 20px; font-weight: 800; margin-bottom: 10px; }
.mail-reading-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mail-reading-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.mail-reading-from { font-size: 13px; }
.mail-reading-from strong { display: block; font-size: 14px; }
.mail-reading-from span { color: var(--text-muted); font-size: 12px; }
.mail-reading-time { margin-left: auto; font-size: 12px; color: var(--text-muted); }
.mail-reading-actions { display: flex; gap: 8px; margin-top: 14px; }
.mail-body {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 28px; border: 1px solid var(--border); line-height: 1.75; font-size: 14px;
  min-height: 200px;
}

/* COMPOSE */
.compose-wrap { padding: 20px 28px; flex: 1; display: flex; flex-direction: column; }
.compose-field {
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border); padding: 10px 0;
}
.compose-field label { font-size: 13px; font-weight: 700; color: var(--text-muted); min-width: 56px; }
.compose-field input, .compose-field select {
  flex: 1; border: none; background: transparent; font-size: 13.5px;
  color: var(--text-main); outline: none;
}
.compose-field .tags-wrap { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; align-items: center; }
.email-tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--primary-bg); color: var(--primary);
  padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.email-tag button { background: none; border: none; cursor: pointer; color: var(--primary); font-size: 14px; line-height: 1; padding: 0 0 0 2px; }

/* RICH TEXT TOOLBAR */
.compose-toolbar {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  padding: 8px 4px; border-bottom: 1px solid var(--border);
  background: var(--bg-body); position: sticky; top: 0; z-index: 5;
}
.tb-btn {
  width: 32px; height: 32px; border: none; background: transparent;
  color: var(--text-muted); cursor: pointer; border-radius: 6px;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  transition: background var(--transition), color var(--transition);
}
.tb-btn:hover, .tb-btn.active { background: var(--primary-bg); color: var(--primary); }
.tb-btn.active { font-weight: 900; }
.tb-divider { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }
.tb-select {
  border: 1px solid var(--border); border-radius: 6px; background: var(--bg-card);
  color: var(--text-main); font-size: 12px; padding: 4px 8px; cursor: pointer; outline: none;
}
.compose-editor {
  flex: 1; padding: 20px; outline: none; font-size: 14px;
  color: var(--text-main); line-height: 1.75; min-height: 280px;
  background: var(--bg-card); border-radius: 0 0 var(--radius) var(--radius);
  border: 1px solid var(--border); border-top: none;
}
.compose-editor:empty::before { content: attr(data-placeholder); color: var(--text-muted); }

/* ── AFFZIP LOGO IN SIDEBAR ────────────────────────────────── */
.sidebar-logo-img {
  height: 44px;
  width: auto;
  object-fit: contain;
  mix-blend-mode: multiply;   /* removes white bg in light mode */
  filter: drop-shadow(0 1px 4px rgba(0,0,0,0.12));
  transition: opacity 0.2s;
}
body.theme-dark .sidebar-logo-img,
.sidebar .sidebar-logo-img { mix-blend-mode: normal; filter: brightness(0) invert(1) drop-shadow(0 1px 4px rgba(0,0,0,.3)); }
.sidebar.collapsed .sidebar-logo-img { height: 32px; }
.sidebar-header { padding: 16px 14px; min-height: 72px; display: flex; align-items: center; border-bottom: 1px solid rgba(255,255,255,0.07); }

/* ── FLASH MESSAGE ─────────────────────────────────────────── */
.flash-msg {
  padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 600;
}
.flash-success { background: #dcfce7; color: #166534; }
.flash-error   { background: #fee2e2; color: #b91c1c; }

/* ── SUBMENU ───────────────────────────────────────────────── */
.submenu { max-height:0; overflow:hidden; transition:max-height .32s ease,opacity .25s ease; opacity:0; padding-left:14px; }
.submenu.open { max-height:300px; opacity:1; }
.submenu-link { font-size:13px !important; padding:9px 12px !important; }
.nav-parent { user-select:none; cursor:pointer; }

/* ── MAIL PAGES ────────────────────────────────────────────── */
.mail-item { padding:12px 16px; border-bottom:1px solid var(--border); cursor:pointer; transition:background .15s; }
.mail-item:hover { background:var(--primary-bg); }
