@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Sidebar */
  --sidebar-bg: #0f172a;
  --sidebar-hover: rgba(255,255,255,0.06);
  --sidebar-active-bg: rgba(59,130,246,0.18);
  --sidebar-active-text: #60a5fa;
  --sidebar-text: #94a3b8;
  --sidebar-section: #475569;
  --sidebar-border: rgba(255,255,255,0.07);
  --sidebar-logo-bg: #1e3a5f;

  /* Main content */
  --main-bg: #f1f5f9;
  --card-bg: #ffffff;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --card-shadow-hover: 0 4px 12px rgba(0,0,0,0.1);
  --border: #e2e8f0;
  --border-light: #f1f5f9;

  /* Text */
  --text: #0f172a;
  --text2: #64748b;
  --text3: #94a3b8;
  --text4: #cbd5e1;

  /* Top bar */
  --topbar-bg: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);

  /* Accent colors */
  --blue: #3b82f6;
  --blue-light: #eff6ff;
  --blue-border: #3b82f6;
  --green: #22c55e;
  --green-light: #f0fdf4;
  --green-border: #22c55e;
  --orange: #f97316;
  --orange-light: #fff7ed;
  --orange-border: #f97316;
  --purple: #a855f7;
  --purple-light: #faf5ff;
  --purple-border: #a855f7;
  --red: #ef4444;
  --red-light: #fef2f2;

  --radius: 10px;
  --radius-sm: 7px;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--main-bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  font-size: 14px;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* ========================
   APP LAYOUT
======================== */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ========================
   SIDEBAR
======================== */
.sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 18px;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.sidebar-brand-info { overflow: hidden; }
.sidebar-brand-name {
  font-size: 15px;
  font-weight: 700;
  color: #f1f5f9;
  white-space: nowrap;
}
.sidebar-brand-sub {
  font-size: 11px;
  color: var(--sidebar-section);
  margin-top: 1px;
}

.sidebar-body { flex: 1; padding: 12px 10px; overflow-y: auto; }

.nav-section {
  margin-bottom: 6px;
  margin-top: 14px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--sidebar-section);
  padding: 0 8px;
  margin-bottom: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 1px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  position: relative;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #e2e8f0;
}

.nav-item.active {
  background: rgba(59, 130, 246, 0.22);
  color: #93c5fd;
  box-shadow: inset 3px 0 0 0 #3b82f6;
}

.nav-item .nav-icon {
  font-size: 15px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--blue);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.sidebar-user:hover { background: var(--sidebar-hover); }

.sidebar-avatar {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user-name { font-size: 13px; font-weight: 600; color: #e2e8f0; }
.sidebar-user-role { font-size: 11px; color: var(--sidebar-section); }

/* ========================
   MAIN CONTENT
======================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--main-bg);
}

/* Top greeting bar */
.topbar {
  background: var(--topbar-bg);
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.topbar-greeting {
  font-size: 13px;
  color: #94a3b8;
}

.topbar-greeting strong {
  color: #f1f5f9;
  font-size: 15px;
  display: block;
  margin-bottom: 2px;
}

.topbar-date {
  font-size: 12px;
  color: #64748b;
}

/* Page content scroll area */
.page-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}

/* Section heading in page */
.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.section-sub { font-size: 13px; color: var(--text2); margin-bottom: 20px; }

/* Sections */
.section { display: none; }
.section.active { display: block; }

/* ========================
   QUOTE CARD
======================== */
.quote-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 16px 20px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--border);
}

.quote-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #8b5cf6, #3b82f6);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  color: #fff;
}

.quote-text { font-size: 14px; font-weight: 500; color: var(--text); }
.quote-author { font-size: 12px; color: var(--text2); margin-top: 2px; }

/* ========================
   STAT CARDS
======================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  position: relative;
  border-radius: 16px;
  padding: 22px 22px 20px;
  overflow: hidden;
  border: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.10);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  color: #fff;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
}
/* Coloured gradient backgrounds per card */
.stat-card.blue   { background: linear-gradient(135deg, #2563eb 0%, #4f8ef7 100%); }
.stat-card.green  { background: linear-gradient(135deg, #16a34a 0%, #4ade80 100%); }
.stat-card.orange { background: linear-gradient(135deg, #ea580c 0%, #fb923c 100%); }
.stat-card.purple { background: linear-gradient(135deg, #7c3aed 0%, #c084fc 100%); }

/* Decorative circle in top-right corner */
.stat-card::after {
  content: '';
  position: absolute;
  top: -22px;
  right: -22px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  pointer-events: none;
}
.stat-card::before {
  content: '';
  position: absolute;
  bottom: -30px;
  right: 30px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  pointer-events: none;
}

.stat-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 14px;
  background: rgba(255,255,255,0.22);
  backdrop-filter: blur(4px);
}
.stat-card.blue  .stat-card-icon { background: rgba(255,255,255,0.22); }
.stat-card.green .stat-card-icon { background: rgba(255,255,255,0.22); }
.stat-card.orange .stat-card-icon { background: rgba(255,255,255,0.22); }
.stat-card.purple .stat-card-icon { background: rgba(255,255,255,0.22); }

.stat-card-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.82);
  margin-bottom: 6px;
}
.stat-card-value {
  font-size: 34px;
  font-weight: 800;
  color: #ffffff;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1;
  text-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

/* ========================
   CARDS / PANELS
======================== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  margin-bottom: 20px;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body { padding: 20px; }
.card-body-sm { padding: 0; }

/* ========================
   TABLES
======================== */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: #f8fafc;
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background 0.12s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }
tbody td { padding: 12px 16px; vertical-align: middle; color: var(--text); }

.empty-row td {
  text-align: center;
  padding: 40px 20px;
  color: var(--text3);
  font-size: 13px;
}

/* ========================
   FORMS
======================== */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-input {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 10px 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.form-input::placeholder { color: var(--text4); }

.form-select {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}
.form-select:focus { border-color: var(--blue); }

/* ========================
   BUTTONS
======================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.18s;
  white-space: nowrap;
  line-height: 1;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 1px 3px rgba(59,130,246,0.3);
}
.btn-primary:hover { background: #2563eb; box-shadow: 0 4px 12px rgba(59,130,246,0.3); }

.btn-secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: #f8fafc; border-color: #cbd5e1; }

.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #16a34a; }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-warning:hover { background: #d97706; }

.btn-outline {
  background: transparent;
  color: var(--blue);
  border: 1px solid var(--blue);
}
.btn-outline:hover { background: var(--blue-light); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 10px; font-size: 11px; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: var(--radius-sm); }
.btn-full { width: 100%; padding: 11px 18px; font-size: 14px; }

/* ========================
   BADGES
======================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-blue   { background: var(--blue-light);   color: #1d4ed8; }
.badge-green  { background: var(--green-light);  color: #15803d; }
.badge-orange { background: var(--orange-light); color: #c2410c; }
.badge-purple { background: var(--purple-light); color: #7c3aed; }
.badge-red    { background: var(--red-light);    color: #dc2626; }
.badge-gray   { background: #f1f5f9;             color: #475569; }

/* ========================
   ALERTS
======================== */
.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
  border-left: 3px solid transparent;
}
.alert.show { display: flex; align-items: center; gap: 8px; }
.alert-error   { background: #fef2f2; border-color: var(--red);   color: #dc2626; }
.alert-success { background: #f0fdf4; border-color: var(--green); color: #15803d; }
.alert-info    { background: var(--blue-light); border-color: var(--blue); color: #1d4ed8; }

/* ========================
   MODAL
======================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }

.modal {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--text); }
.modal-body { padding: 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ========================
   AUTH PAGES
======================== */
.auth-page {
  min-height: 100vh;
  display: flex;
  background: var(--sidebar-bg);
}

.auth-left {
  width: 420px;
  min-height: 100vh;
  max-height: 100vh;
  background: linear-gradient(160deg, #1e3a5f 0%, #0f172a 100%);
  display: flex;
  flex-direction: column;
  padding: 48px 44px;
  justify-content: space-between;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.auth-left-brand { display: flex; align-items: center; gap: 12px; }
.auth-left-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.auth-left-name { font-size: 22px; font-weight: 800; color: #f1f5f9; }
.auth-left-tagline { font-size: 12px; color: #64748b; margin-top: 2px; }

.auth-left-content {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 0 24px;
}
.auth-left-title { font-size: 28px; font-weight: 800; color: #f1f5f9; line-height: 1.3; margin-bottom: 12px; }
.auth-left-desc { font-size: 14px; color: #64748b; line-height: 1.7; }

.auth-features { margin-top: 32px; }
.auth-feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.auth-feature-dot {
  width: 8px; height: 8px;
  background: var(--blue);
  border-radius: 50%;
  flex-shrink: 0;
}
.auth-feature-text { font-size: 13px; color: #94a3b8; }

/* "Get started" in login card (always visible; left column is hidden on narrow screens) */
.auth-cta-get-started { margin-bottom: 20px; }

.auth-right {
  flex: 1;
  background: var(--main-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.auth-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

.auth-card-title { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.auth-card-sub { font-size: 13px; color: var(--text2); margin-bottom: 28px; }

/* ========================
   SPINNER / LOADING
======================== */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
.spinner-dark {
  border-color: var(--border);
  border-top-color: var(--blue);
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-row td {
  text-align: center;
  padding: 32px;
  color: var(--text3);
}

/* ========================
   QUICK ACTIONS
======================== */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 20px;
}

/* ========================
   WEBMAIL
======================== */
.webmail-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--main-bg);
}

.mail-sidebar {
  width: 210px;
  min-width: 210px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.mail-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 16px 14px;
  border-bottom: 1px solid var(--sidebar-border);
}
.mail-sidebar-back {
  font-size: 11px;
  color: var(--sidebar-section);
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 6px 14px;
  transition: color 0.15s;
  border-bottom: 1px solid var(--sidebar-border);
}
.mail-sidebar-back:hover { color: #94a3b8; }

.mail-account-box {
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--sidebar-border);
}
.mail-account-label { font-size: 10px; color: var(--sidebar-section); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 3px; }
.mail-account-email { font-size: 12px; font-weight: 600; color: #e2e8f0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mail-compose-btn { padding: 10px 12px; }

.mail-folder-list { flex: 1; overflow-y: auto; padding: 6px 8px; }

.mail-folder-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 1px;
}
.mail-folder-item:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.mail-folder-item.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-text); }

.mail-folder-left { display: flex; align-items: center; gap: 8px; }
.mail-folder-icon { font-size: 14px; width: 16px; text-align: center; }
.mail-folder-badge {
  background: var(--blue);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}

.mail-sidebar-footer {
  padding: 10px 8px;
  border-top: 1px solid var(--sidebar-border);
}

/* Mail list */
.mail-list-col {
  width: 300px;
  min-width: 300px;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.mail-list-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mail-list-folder-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.mail-search-input {
  flex: 1;
  background: var(--main-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  padding: 7px 10px;
  outline: none;
  transition: border-color 0.2s;
}
.mail-search-input:focus { border-color: var(--blue); background: #fff; }

.mail-list-body { flex: 1; overflow-y: auto; }

.mail-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
}
.mail-item:hover { background: #f8fafc; }
.mail-item.active { background: #eff6ff; border-left: 3px solid var(--blue); padding-left: 11px; }
.mail-item.unread .mail-item-subject { font-weight: 700; color: var(--text); }

.mail-item-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.mail-item-from { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.mail-item-date { font-size: 11px; color: var(--text3); white-space: nowrap; flex-shrink: 0; }
.mail-item-subject { font-size: 12px; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 3px; }
.mail-item-preview { font-size: 11px; color: var(--text3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-unread-dot {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px; height: 6px;
  background: var(--blue);
  border-radius: 50%;
}

/* Mail view */
.mail-view-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mail-view-topbar {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mail-view-body { flex: 1; overflow-y: auto; padding: 24px; }
.mail-view-subject { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 14px; }

.mail-meta-row { font-size: 12px; color: var(--text2); margin-bottom: 6px; }
.mail-meta-row strong { color: var(--text); }

.mail-divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

.mail-html-body { font-size: 14px; line-height: 1.7; color: var(--text); }
.mail-html-body * { max-width: 100%; }

/* Compose */
.compose-panel {
  position: fixed;
  bottom: 0; right: 24px;
  width: 480px;
  background: #fff;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
  z-index: 600;
  display: none;
}
.compose-panel.open { display: block; }

.compose-header {
  padding: 12px 16px;
  background: var(--sidebar-bg);
  border-radius: 12px 12px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 600;
}

.compose-body { padding: 0 16px 8px; }
.compose-field {
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 9px 0;
  outline: none;
}
.compose-field::placeholder { color: var(--text4); }
.compose-textarea {
  width: 100%;
  min-height: 160px;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 10px 0;
  resize: none;
  outline: none;
}
.compose-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.compose-status { font-size: 12px; color: var(--text2); }

/* Mailbox picker */
.mailbox-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  padding: 0;
}

.mailbox-pick-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all 0.18s;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--card-shadow);
}
.mailbox-pick-card:hover {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1), var(--card-shadow-hover);
  transform: translateY(-2px);
}

.mailbox-pick-avatar {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.mailbox-pick-email { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mailbox-pick-name { font-size: 12px; color: var(--text2); }
.mailbox-pick-status { font-size: 11px; margin-top: 4px; }
.mailbox-pick-status.connected { color: var(--green); }
.mailbox-pick-status.disconnected { color: var(--red); }

/* Assign layout */
.assign-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* Notification toast */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: #0f172a;
  color: #f1f5f9;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Responsive */
@media (max-width: 780px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .auth-left { display: none; }
  .auth-right { padding: 24px; }
}
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-scroll { padding: 16px; }
}
