/* ============================================
   WOAIL Dashboard - Glassmorphism Style
   Based on TemplateMo 607 Glass Admin
============================================ */

/* ===== CSS Variables ===== */
:root {
  --emerald: #059669; --emerald-light: #34d399;
  --gold: #d4a574; --gold-light: #e8c9a0;
  --coral: #e07a5f; --amber: #b45309;
  --success: #22c55e; --warning: #eab308; --info: #0ea5e9; --danger: #dc2626;
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-hover: rgba(255, 255, 255, 0.08);
  --bg-dark: #0a0f0d;
  --bg-gradient-1: #0d1a14; --bg-gradient-2: #132419; --bg-gradient-3: #1a2e23;
  --text-primary: #f5f5f4;
  --text-secondary: rgba(245, 245, 244, 0.7);
  --text-muted: rgba(245, 245, 244, 0.4);
  --font-body: 'Outfit', -apple-system, sans-serif;
  --font-mono: 'Space Mono', 'Consolas', monospace;
  --sidebar-width: 280px; --navbar-height: 70px;
  --border-radius: 20px; --card-padding: 24px;
  --transition-fast: 0.2s ease; --transition-normal: 0.3s ease;
}

[data-theme="light"] {
  --glass-bg: rgba(255, 255, 255, 0.6);
  --glass-border: rgba(0, 0, 0, 0.1);
  --glass-hover: rgba(255, 255, 255, 0.8);
  --bg-dark: #f5f5f0;
  --bg-gradient-1: #e8f5e9; --bg-gradient-2: #f1f8e9; --bg-gradient-3: #fefefe;
  --text-primary: #1a1a1a;
  --text-secondary: rgba(26, 26, 26, 0.7);
  --text-muted: rgba(26, 26, 26, 0.5);
}
[data-theme="light"] .orb { opacity: 0.15; }
[data-theme="light"] .glass-card::before { background: linear-gradient(90deg, transparent, rgba(0,0,0,0.05), transparent); }

/* ===== Reset ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body); color: var(--text-primary);
  background: var(--bg-dark); min-height: 100vh; overflow-x: hidden; line-height: 1.6;
  max-width: 100vw;
  position: relative;
}
a { text-decoration: none; color: inherit; }

/* ===== Animated Background ===== */
.background {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -2;
  background: linear-gradient(135deg, var(--bg-gradient-1) 0%, var(--bg-gradient-2) 50%, var(--bg-gradient-3) 100%);
}
.background::before {
  content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background:
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(120,0,255,0.15) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 60%, rgba(0,200,255,0.12) 0%, transparent 50%),
    radial-gradient(ellipse 50% 30% at 50% 80%, rgba(255,0,200,0.1) 0%, transparent 50%);
}
.orb {
  position: fixed; border-radius: 50%; filter: blur(80px);
  opacity: 0.4; z-index: -1; animation: float 20s ease-in-out infinite;
}
.orb-1 { width: 400px; height: 400px; background: var(--emerald); top: 10%; left: 10%; animation-delay: 0s; }
.orb-2 { width: 350px; height: 350px; background: var(--gold); top: 60%; right: 10%; animation-delay: -5s; }
.orb-3 { width: 300px; height: 300px; background: var(--coral); bottom: 10%; left: 30%; animation-delay: -10s; }
@keyframes float {
  0%,100% { transform: translate(0,0) scale(1); }
  25% { transform: translate(30px,-30px) scale(1.05); }
  50% { transform: translate(-20px,20px) scale(0.95); }
  75% { transform: translate(20px,10px) scale(1.02); }
}

/* ===== Dashboard Layout ===== */
.dashboard { display: flex; min-height: 100vh; }

/* ===== Sidebar ===== */
.sidebar {
  position: fixed; left: 0; top: 0; width: var(--sidebar-width); height: 100vh;
  background: var(--glass-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border); padding: 24px; z-index: 100;
  transition: all var(--transition-normal); overflow-y: auto;
  display: flex; flex-direction: column;
}
.nav-menu { flex: 1; overflow-y: auto; }
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 3px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--emerald-light); }

.sidebar-header {
  display: flex; align-items: center; gap: 12px;
  padding-bottom: 30px; border-bottom: 1px solid var(--glass-border); margin-bottom: 30px;
}
.sidebar-close-btn {
  display: none; width: 32px; height: 32px; border-radius: 8px;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  color: var(--text-secondary); font-size: 16px; cursor: pointer;
  align-items: center; justify-content: center; flex-shrink: 0;
  transition: all 0.15s;
}
.sidebar-close-btn:hover { background: var(--glass-hover); border-color: var(--emerald-light); }
.logo {
  width: 45px; height: 45px; background: linear-gradient(135deg, var(--emerald), var(--gold));
  border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 20px; box-shadow: 0 8px 32px rgba(5,150,105,0.3);
}
.logo-text {
  font-size: 22px; font-weight: 600;
  background: linear-gradient(135deg, var(--emerald-light), var(--gold));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

.nav-menu { list-style: none; flex: 1; }
.nav-menu ul { list-style: none; padding: 0; margin: 0; }
.nav-section { margin-bottom: 25px; list-style: none; }
.nav-section-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--text-muted); margin-bottom: 12px; padding-left: 15px;
}
.nav-item { margin-bottom: 5px; list-style: none; }
.nav-link {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px;
  color: var(--text-secondary); text-decoration: none; border-radius: 12px;
  transition: all var(--transition-fast); position: relative; overflow: hidden;
}
.nav-link:hover { background: var(--glass-hover); color: var(--text-primary); }
.nav-link.active { background: var(--glass-hover); color: var(--text-primary); }
.nav-icon { width: 22px; height: 22px; opacity: 0.8; }
.nav-link.active .nav-icon, .nav-link:hover .nav-icon { opacity: 1; }

.sidebar-footer { padding-top: 20px; border-top: 1px solid var(--glass-border); flex-shrink: 0; }
.user-profile {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  border-radius: 12px; cursor: pointer; transition: background var(--transition-fast);
}
.user-profile:hover { background: var(--glass-hover); }
.user-avatar {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, var(--emerald), var(--gold));
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 16px;
}
.user-info { flex: 1; }
.user-name { font-weight: 500; font-size: 14px; }
.user-role { font-size: 12px; color: var(--text-muted); }

/* ===== Main Content ===== */
.main-content {
  flex: 1; margin-left: var(--sidebar-width); padding: 30px; min-height: 100vh;
}

/* ===== Top Navbar ===== */
.navbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 30px; gap: 20px;
}
.page-title { font-size: 28px; font-weight: 600; }
.navbar-right { display: flex; align-items: center; gap: 15px; }
.search-box { position: relative; }
.search-input {
  width: 280px; padding: 12px 20px 12px 48px;
  background: var(--glass-bg); backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border); border-radius: 12px;
  color: var(--text-primary); font-family: inherit; font-size: 14px; transition: all var(--transition-fast);
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { outline: none; border-color: var(--emerald-light); box-shadow: 0 0 20px rgba(52,211,153,0.2); }
.search-icon {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; color: var(--text-muted);
}
.nav-btn {
  width: 45px; height: 45px; background: var(--glass-bg); backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border); border-radius: 12px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative;
  transition: all var(--transition-fast);
}
.nav-btn:hover { background: var(--glass-hover); border-color: var(--emerald-light); }
.nav-btn svg { width: 20px; height: 20px; color: var(--text-secondary); }

/* ===== Glass Card ===== */
.glass-card {
  background: var(--glass-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border); border-radius: var(--border-radius);
  padding: var(--card-padding); position: relative; overflow: hidden;
  transition: all var(--transition-normal);
}
.glass-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
}
.glass-card:hover {
  background: var(--glass-hover); border-color: rgba(255,255,255,0.15);
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.3), 0 0 40px rgba(52,211,153,0.1);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 28px; border: none; border-radius: 12px;
  font-family: inherit; font-size: 15px; font-weight: 500; cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-primary {
  width: 100%; background: linear-gradient(135deg, var(--emerald), var(--emerald-light));
  color: white; box-shadow: 0 8px 24px rgba(5,150,105,0.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(5,150,105,0.4); }
.btn-secondary {
  width: 100%; background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text-primary);
}
.btn-secondary:hover { background: var(--glass-hover); border-color: var(--emerald-light); }
.btn-danger { background: rgba(220,38,38,0.15); color: #fca5a5; border: 1px solid rgba(220,38,38,0.25); }
.btn-danger:hover { background: rgba(220,38,38,0.3); }
.btn-sm { padding: 6px 14px; font-size: 13px; width: auto; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 50%; }
.btn-inline { width: auto; display: inline-flex; }

/* ===== Form Inputs ===== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 8px; }
.form-input {
  width: 100%; padding: 14px 18px; background: var(--glass-bg);
  border: 1px solid var(--glass-border); border-radius: 12px;
  color: var(--text-primary); font-family: inherit; font-size: 15px;
  transition: all var(--transition-fast);
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus { outline: none; border-color: var(--emerald-light); box-shadow: 0 0 20px rgba(52,211,153,0.2); }
textarea.form-input { resize: vertical; min-height: 100px; }

/* ===== Login Page ===== */
.login-page {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 40px 20px;
}
.login-container { width: 100%; max-width: 440px; }
.login-card {
  background: var(--glass-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border); border-radius: var(--border-radius);
  padding: 48px 40px; position: relative; overflow: hidden;
}
.login-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
}
.login-header { text-align: center; margin-bottom: 40px; }
.login-logo {
  width: 70px; height: 70px; background: linear-gradient(135deg, var(--emerald), var(--gold));
  border-radius: 18px; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 28px; margin: 0 auto 20px;
  box-shadow: 0 12px 40px rgba(5,150,105,0.3);
}
.login-title { font-size: 28px; font-weight: 600; margin-bottom: 8px; }
.login-subtitle { font-size: 14px; color: var(--text-muted); }
.login-error { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 20px; text-align: center; }
.form-row {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 30px;
}
.checkbox-label {
  display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-secondary); cursor: pointer;
}
.checkbox-label input { width: 18px; height: 18px; accent-color: var(--emerald); }
.forgot-link { font-size: 14px; color: var(--emerald-light); transition: color var(--transition-fast); }
.forgot-link:hover { color: var(--gold); }

/* Floating Theme Toggle for Login */
.theme-toggle-float {
  position: fixed; top: 24px; right: 24px;
  width: 45px; height: 45px; background: var(--glass-bg); backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border); border-radius: 12px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 100;
  transition: all var(--transition-fast);
}
.theme-toggle-float:hover { background: var(--glass-hover); border-color: var(--emerald-light); }
.theme-toggle-float svg { width: 20px; height: 20px; color: var(--text-secondary); }

/* ===== Page Header ===== */
.page-header { margin-bottom: 30px; }
.page-header .page-title { margin-bottom: 8px; }
.page-header p { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

/* ===== Toolbar ===== */
.toolbar { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.toolbar .form-input { width: auto; min-width: 240px; }
.toolbar-spacer { flex: 1; }

/* ===== Data Table ===== */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
  text-align: left; padding: 16px; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); border-bottom: 1px solid var(--glass-border);
}
.data-table td {
  padding: 16px; font-size: 14px; color: var(--text-secondary);
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.data-table tr { transition: background var(--transition-fast); }
.data-table tbody tr:hover { background: var(--glass-hover); }
.data-table .file-name { display: flex; align-items: center; gap: 10px; }
.data-table .file-icon {
  width: 36px; height: 36px; border-radius: 8px; display: flex;
  align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0;
}
.data-table .file-icon.img { background: rgba(59,130,246,0.15); color: #60a5fa; }
.data-table .file-icon.doc { background: rgba(5,150,105,0.15); color: var(--emerald-light); }
.data-table .file-icon.zip { background: rgba(245,158,11,0.15); color: #eab308; }
.data-table .file-icon.other { background: rgba(156,163,175,0.1); color: var(--text-secondary); }

/* ===== Table User & Status Badge (from template) ===== */
.table-user { display: flex; align-items: center; gap: 12px; }
.table-user-name { color: var(--text-primary); font-weight: 500; }
.table-wrapper { overflow-x: auto; margin: 0 -10px; padding: 0 10px; }
.table-wrapper::-webkit-scrollbar { height: 8px; }
.table-wrapper::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); border-radius: 4px; }
.table-wrapper::-webkit-scrollbar-thumb { background: linear-gradient(90deg, var(--emerald), var(--gold)); border-radius: 4px; }
.table-wrapper::-webkit-scrollbar-thumb:hover { background: linear-gradient(90deg, var(--emerald-light), var(--gold-light)); }
.status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 500;
}
.status-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; }
.status-badge.completed { background: rgba(16,185,129,0.15); color: var(--success); }
.status-badge.completed::before { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-badge.pending { background: rgba(245,158,11,0.15); color: var(--warning); }
.status-badge.pending::before { background: var(--warning); box-shadow: 0 0 8px var(--warning); }
.status-badge.processing { background: rgba(59,130,246,0.15); color: var(--info); }
.status-badge.processing::before { background: var(--info); box-shadow: 0 0 8px var(--info); }

/* ===== Progress Bars & Route Cards ===== */
.progress-card { padding: var(--card-padding); }
.progress-item { margin-bottom: 24px; }
.progress-item:last-child { margin-bottom: 0; }
.progress-header { display: flex; justify-content: space-between; margin-bottom: 10px; }
.progress-label { font-size: 14px; font-weight: 500; }
.progress-value { font-family: 'Space Mono', monospace; font-size: 14px; color: var(--text-secondary); }
.progress-bar { height: 8px; background: rgba(255,255,255,0.1); border-radius: 10px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 10px; transition: width 1s ease-out; position: relative; }
.progress-fill::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 50%; background: linear-gradient(180deg, rgba(255,255,255,0.3), transparent); }
.progress-fill.cyan { background: linear-gradient(90deg, var(--emerald-light), var(--emerald)); box-shadow: 0 0 20px rgba(52,211,153,0.4); }
.progress-fill.magenta { background: linear-gradient(90deg, var(--gold-light), var(--gold)); box-shadow: 0 0 20px rgba(212,165,116,0.4); }
.progress-fill.purple { background: linear-gradient(90deg, var(--coral), var(--amber)); box-shadow: 0 0 20px rgba(224,122,95,0.4); }

/* ===== Card Actions ===== */
.card-actions { display: flex; gap: 8px; }
.card-btn {
  padding: 8px 16px; background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-radius: 8px; color: var(--text-secondary); font-family: inherit; font-size: 13px;
  cursor: pointer; transition: all var(--transition-fast);
}
.card-btn:hover, .card-btn.active { background: var(--glass-hover); border-color: var(--emerald-light); color: var(--text-primary); }

/* ===== Batch Glass Buttons ===== */
.batch-glass-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 6px 14px; font-size: 13px; font-family: inherit; cursor: pointer;
  background: var(--glass-bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border); border-radius: 8px;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}
.batch-glass-btn:hover {
  transform: translateY(-2px);
  background: var(--glass-hover);
  border-color: var(--emerald-light);
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}
.batch-glass-btn:active {
  transform: translateY(0);
}
.batch-glass-btn.danger {
  color: #fca5a5;
  border-color: rgba(220,38,38,0.25);
}
.batch-glass-btn.danger:hover {
  background: rgba(220,38,38,0.12);
  border-color: rgba(220,38,38,0.4);
  box-shadow: 0 8px 20px rgba(220,38,38,0.15);
}

/* ===== Email List ===== */
.email-list { display: flex; flex-direction: column; gap: 2px; }
.email-item {
  display: flex; align-items: center; gap: 16px; padding: 14px 18px;
  border-radius: 12px; cursor: pointer; transition: all var(--transition-fast);
  border: 1px solid transparent;
}
.email-item:hover { background: var(--glass-hover); }
.email-item.unread { background: rgba(5,150,105,0.08); }
.email-item .email-from { width: 180px; flex-shrink: 0; font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-item .email-subject { flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-item .email-date { width: 120px; flex-shrink: 0; text-align: right; font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); }
.email-item .email-actions { display: flex; gap: 6px; opacity: 0; transition: opacity var(--transition-fast); }
.email-item:hover .email-actions { opacity: 1; }
/* ===== Mail Stats Cards ===== */
.mail-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}
.mail-stat-card {
  position: relative;
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}
.mail-stat-card.active { border: 2px solid var(--emerald-light); }
.stat-card-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.stat-info h3 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
}
.stat-change.positive { color: var(--success); background: rgba(34,197,94,0.15); }
.stat-change.negative { color: #ff6b6b; background: rgba(255,107,107,0.15); }
.stat-icon {
  width: 55px;
  height: 55px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-icon.cyan { background: linear-gradient(135deg, rgba(52,211,153,0.2), rgba(52,211,153,0.05)); box-shadow: 0 8px 32px rgba(52,211,153,0.2); }
.stat-icon.magenta { background: linear-gradient(135deg, rgba(212,165,116,0.2), rgba(212,165,116,0.05)); box-shadow: 0 8px 32px rgba(212,165,116,0.2); }
.stat-icon.purple { background: linear-gradient(135deg, rgba(224,122,95,0.2), rgba(224,122,95,0.05)); box-shadow: 0 8px 32px rgba(224,122,95,0.2); }
.stat-icon.success { background: linear-gradient(135deg, rgba(34,197,94,0.2), rgba(34,197,94,0.05)); box-shadow: 0 8px 32px rgba(34,197,94,0.2); }
.stat-icon svg { width: 26px; height: 26px; }
.mail-stats-grid .glass-card:nth-child(1) { animation-delay: 0.1s; }
.mail-stats-grid .glass-card:nth-child(2) { animation-delay: 0.2s; }
.mail-stats-grid .glass-card:nth-child(3) { animation-delay: 0.3s; }
.mail-stats-grid .glass-card:nth-child(4) { animation-delay: 0.4s; }

/* ===== Notes ===== */
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.note-card { cursor: pointer; min-height: 140px; display: flex; flex-direction: column; }
.note-card .note-title { font-weight: 600; font-size: 16px; margin-bottom: 8px; }
.note-card .note-preview { font-size: 13px; color: var(--text-secondary); flex: 1; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.note-card .note-date { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); margin-top: 12px; }

/* ===== Editor ===== */
.editor-toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
#note-editor { width: 100%; min-height: 300px; font-family: var(--font-body); font-size: 15px; }
.note-editor-hidden { display: none; }
.note-view-hidden { display: none; }
.note-view-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.note-view-title { font-size: 22px; font-weight: 600; margin-bottom: 4px; word-break: break-word; }
.note-view-date { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); margin-bottom: 20px; }
.note-view-body { font-size: 14px; line-height: 1.8; word-break: break-word; min-height: 100px; }
.note-view-body img { max-width: 100% !important; height: auto !important; }
.note-view-body a { word-break: break-all; }

/* ===== API Keys ===== */
.keys-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.key-card { cursor: default; min-height: 120px; display: flex; flex-direction: column; }
.key-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.key-card-name { font-weight: 600; font-size: 16px; flex: 1; word-break: break-word; }
.key-card-category {
  display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px;
  background: rgba(5,150,105,0.15); color: var(--emerald-light); white-space: nowrap;
}
.key-card-value {
  font-family: var(--font-mono); font-size: 13px; color: var(--text-secondary);
  background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 8px;
  padding: 8px 12px; margin-bottom: 8px; word-break: break-all;
  display: flex; align-items: center; gap: 8px; min-height: 38px;
}
.key-card-value-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.key-card-actions { display: flex; gap: 6px; margin-top: auto; flex-wrap: wrap; }
.key-card-actions .btn { font-size: 12px; padding: 4px 10px; }
.key-card-date { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); margin-top: auto; }

/* ===== Calendar ===== */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--glass-border); border-radius: var(--border-radius); overflow: hidden; border: 1px solid var(--glass-border); }
.calendar-cell { background: var(--glass-bg); min-height: 80px; padding: 8px; cursor: pointer; transition: background 0.15s; position: relative; }
.calendar-cell:hover { background: var(--glass-hover); }
.calendar-cell.today { background: rgba(5,150,105,0.1); }
.calendar-cell.other-month { color: var(--text-muted); opacity: 0.5; }
.calendar-cell.selected { box-shadow: inset 0 0 0 2px var(--emerald); }
.calendar-cell-header { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.calendar-event-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; margin-right: 2px; }
.calendar-event-item { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-secondary); margin-top: 2px; padding: 1px 4px; border-radius: 4px; background: rgba(255,255,255,0.05); }
.calendar-lunar { font-size: 10px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calendar-lunar.holiday { color: #fca5a5; font-weight: 600; }
.calendar-weekday { text-align: center; padding: 8px; font-size: 12px; color: var(--text-muted); font-weight: 600; background: var(--glass-bg); }

/* ===== Bookmarks ===== */
.bookmarks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.bookmark-card { cursor: pointer; min-height: 100px; display: flex; flex-direction: column; }
.bookmark-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.bookmark-card-favicon { width: 18px; height: 18px; border-radius: 4px; flex-shrink: 0; }
.bookmark-card-title { font-weight: 600; font-size: 15px; flex: 1; word-break: break-word; }
.bookmark-card-url { font-size: 12px; color: var(--text-muted); word-break: break-all; margin-bottom: 8px; }
.bookmark-card-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.bookmark-tag { font-size: 11px; padding: 2px 8px; border-radius: 6px; background: rgba(5,150,105,0.15); color: var(--emerald-light); }
.bookmark-card-actions { display: flex; gap: 6px; margin-top: auto; }
.bookmark-card-actions .btn { font-size: 12px; padding: 4px 10px; }

/* ===== Clipboard ===== */
.clipboard-list { display: flex; flex-direction: column; gap: 10px; }
.clipboard-item { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-radius: var(--border-radius); background: var(--glass-bg); border: 1px solid var(--glass-border); transition: all 0.15s; }
.clipboard-item:hover { background: var(--glass-hover); }
.clipboard-item-title { font-weight: 600; font-size: 15px; word-break: break-word; }
.clipboard-item-content { font-family: var(--font-mono); font-size: 13px; color: var(--text-secondary); background: rgba(0,0,0,0.2); padding: 10px 12px; border-radius: 8px; word-break: break-all; max-height: 120px; overflow-y: auto; }
.clipboard-item-meta { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.clipboard-item-date { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); }
.clipboard-item-actions { display: flex; gap: 6px; }
.clipboard-item-actions .btn { font-size: 12px; padding: 4px 10px; }
.calendar-events .event-card { padding: 12px; margin-bottom: 8px; border-radius: var(--border-radius); border-left: 3px solid var(--emerald); }
.calendar-events .event-card.blue { border-left-color: #3b82f6; }
.calendar-events .event-card.purple { border-left-color: #a855f7; }
.calendar-events .event-card.orange { border-left-color: #f97316; }
.calendar-events .event-card.red { border-left-color: #ef4444; }

/* ===== Home / Dashboard ===== */
.home-welcome { margin-bottom: 24px; }
.home-welcome h1 { font-size: 24px; font-weight: 700; }
.home-stats-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.home-stat-card { padding: 16px; text-align: center; cursor: pointer; transition: all 0.15s; }
.home-stat-card:hover { transform: translateY(-2px); }
.home-stat-icon { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; margin: 0 auto 10px; }
.home-stat-icon svg { width: 20px; height: 20px; }
.home-stat-value { font-family: var(--font-mono); font-size: 26px; font-weight: 700; margin-bottom: 4px; }
.home-stat-label { font-size: 12px; color: var(--text-muted); }
.home-stat-badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px; margin-top: 6px; }
.home-stat-badge.alert { background: rgba(239,68,68,0.15); color: #fca5a5; }
.home-stat-badge.ok { background: rgba(16,185,129,0.15); color: var(--emerald-light); }
.home-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.home-col { display: flex; flex-direction: column; gap: 16px; }
.home-section-card { padding: 16px; }
.home-section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.home-section-header h3 { font-size: 15px; font-weight: 600; margin: 0; }
.home-section-link { font-size: 12px; color: var(--emerald-light); text-decoration: none; }
.home-section-link:hover { text-decoration: underline; }
.home-list-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--glass-border); cursor: pointer; transition: all 0.1s; }
.home-list-item:last-child { border-bottom: none; }
.home-list-item:hover { padding-left: 4px; }
.home-list-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.home-list-dot.emerald { background: var(--emerald); }
.home-list-dot.blue { background: #3b82f6; }
.home-list-dot.purple { background: #a855f7; }
.home-list-dot.orange { background: #f97316; }
.home-list-dot.red { background: #ef4444; }
.home-list-dot.gray { background: var(--text-muted); }
.home-list-content { flex: 1; min-width: 0; overflow: hidden; }
.home-list-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
@media (max-width: 768px) {
  .home-list-title { max-width: calc(100vw - 80px); }
}
.home-list-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.home-list-priority { font-size: 10px; padding: 1px 6px; border-radius: 4px; flex-shrink: 0; }
.home-list-priority.high { background: rgba(239,68,68,0.15); color: #fca5a5; }
.home-list-priority.medium { background: rgba(245,158,11,0.15); color: #fcd34d; }
.home-list-priority.low { background: rgba(16,185,129,0.15); color: var(--emerald-light); }
.home-empty { color: var(--text-muted); font-size: 13px; padding: 12px 0; text-align: center; }

@media (max-width: 768px) {
  .home-two-col { grid-template-columns: 1fr; }
  .home-stats-row { grid-template-columns: repeat(2, 1fr); }
  .home-list-title { max-width: calc(100vw - 80px); }
}

/* ===== Todos ===== */
.todos-list { display: flex; flex-direction: column; gap: 10px; }
.todo-item { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: var(--border-radius); background: var(--glass-bg); border: 1px solid var(--glass-border); transition: all 0.15s; }
.todo-item:hover { background: var(--glass-hover); }
.todo-item.completed { opacity: 0.5; }
.todo-item.completed .todo-title { text-decoration: line-through; color: var(--text-muted); }
.todo-checkbox { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--glass-border); cursor: pointer; flex-shrink: 0; margin-top: 2px; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.todo-checkbox:hover { border-color: var(--emerald-light); }
.todo-checkbox.checked { background: var(--emerald); border-color: var(--emerald); }
.todo-checkbox.checked::after { content: '✓'; color: #fff; font-size: 12px; }
.todo-content { flex: 1; min-width: 0; }
.todo-title { font-weight: 500; font-size: 15px; word-break: break-word; }
.todo-desc { font-size: 13px; color: var(--text-secondary); margin-top: 4px; word-break: break-word; }
.todo-meta { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.todo-priority { font-size: 11px; padding: 2px 8px; border-radius: 6px; }
.todo-priority.high { background: rgba(239,68,68,0.15); color: #fca5a5; }
.todo-priority.medium { background: rgba(245,158,11,0.15); color: #fcd34d; }
.todo-priority.low { background: rgba(16,185,129,0.15); color: var(--emerald-light); }
.todo-due { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); }
.todo-actions { display: flex; gap: 6px; }
.todo-actions .btn { font-size: 12px; padding: 4px 10px; }

/* ===== Email Compose ===== */
.compose-form { display: flex; flex-direction: column; gap: 16px; }
.compose-form .form-row { display: flex; gap: 12px; }
.compose-form .form-row .form-group { flex: 1; margin-bottom: 0; }
.compose-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* Sender selector */
.compose-sender-row { display: flex; align-items: center; gap: 0; }
.compose-sender-input { flex: 1; border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; }
.compose-sender-suffix {
  display: inline-flex; align-items: center; padding: 0 14px;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-left: none; border-radius: 0 12px 12px 0;
  color: var(--text-muted); font-size: 14px; font-family: var(--font-mono);
  white-space: nowrap; height: 48px; box-sizing: border-box;
}

/* CC/BCC toggle */
.compose-toggle-row { display: flex; gap: 8px; margin-top: 6px; }
.compose-toggle-btn {
  background: none; border: none; color: var(--emerald-light);
  font-size: 13px; cursor: pointer; padding: 2px 0; font-family: inherit;
}
.compose-toggle-btn:hover { text-decoration: underline; }
.compose-toggle-btn.active { color: var(--text-muted); text-decoration: line-through; }

/* Tag input (pill recipients) */
.compose-tag-input {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 8px 12px; min-height: 48px;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-radius: 12px; cursor: text; transition: border-color 0.15s;
}
.compose-tag-input:focus-within { border-color: var(--emerald-light); }
.compose-tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.compose-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 20px;
  background: rgba(5,150,105,0.15); color: var(--emerald-light);
  font-size: 13px; font-family: var(--font-mono); white-space: nowrap;
  animation: tagIn 0.15s ease;
}
@keyframes tagIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.compose-tag-remove {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%; cursor: pointer;
  font-size: 14px; line-height: 1; color: var(--emerald-light);
  background: rgba(5,150,105,0.2); transition: background 0.15s;
}
.compose-tag-remove:hover { background: rgba(220,38,38,0.3); color: #fca5a5; }
.compose-tag-field {
  flex: 1; min-width: 120px; border: none; outline: none;
  background: transparent; color: var(--text-primary);
  font-size: 14px; font-family: inherit;
}
.compose-tag-field::placeholder { color: var(--text-muted); }

/* HTML Editor */
.compose-editor-wrap { border: 1px solid var(--glass-border); border-radius: 12px; overflow: hidden; }
.compose-editor-toolbar {
  display: flex; flex-wrap: wrap; gap: 2px; padding: 8px 10px;
  background: var(--glass-bg); border-bottom: 1px solid var(--glass-border);
}
.ed-btn {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 6px;
  cursor: pointer; font-size: 13px; color: var(--text-primary); transition: all 0.15s;
}
.ed-btn:hover { background: var(--glass-hover); border-color: var(--emerald-light); }
.ed-btn.active { background: var(--emerald); color: #fff; border-color: var(--emerald); }
.ed-sep { width: 1px; background: var(--glass-border); margin: 4px 4px; align-self: stretch; }
.compose-editor-body {
  min-height: 280px; padding: 16px; font-size: 14px; line-height: 1.7;
  color: var(--text-primary); outline: none; word-break: break-word;
}
.compose-editor-body:empty::before {
  content: attr(placeholder); color: var(--text-muted); pointer-events: none;
}
.compose-editor-source {
  border: none !important; border-radius: 0 !important; min-height: 280px;
  resize: vertical;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  z-index: 200; display: flex; align-items: center; justify-content: center;
}
.modal-overlay.hidden { display: none; }
.modal { width: 90%; max-width: 560px; max-height: 85vh; overflow-y: auto; }
.modal-wide { max-width: 800px; }
.modal h2 { margin-bottom: 20px; font-size: 1.2rem; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ===== Route Rules Table ===== */
.route-rule {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border-radius: 10px; border: 1px solid var(--glass-border); margin-bottom: 8px;
}
.route-rule .rule-info { flex: 1; }
.route-rule .rule-name { font-weight: 500; font-size: 14px; }
.route-rule .rule-detail { font-size: 12px; color: var(--text-secondary); }
.route-rule .rule-action { font-size: 12px; padding: 4px 10px; border-radius: 20px; font-weight: 500; }
.route-rule .rule-action.forward { background: rgba(59,130,246,0.15); color: #93c5fd; }
.route-rule .rule-action.store { background: rgba(5,150,105,0.15); color: var(--emerald-light); }
.route-rule .rule-action.discard { background: rgba(239,68,68,0.15); color: #fca5a5; }
.route-rule .rule-action.forward_discard { background: rgba(245,158,11,0.15); color: #fcd34d; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 24px; right: 24px; padding: 12px 24px;
  border-radius: 12px; font-size: 14px; z-index: 300;
  animation: slideUp 0.3s ease; backdrop-filter: blur(10px);
}
.toast.success { background: rgba(16,185,129,0.2); color: var(--success); border: 1px solid rgba(16,185,129,0.3); }
.toast.error { background: rgba(239,68,68,0.2); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.toast.hidden { display: none; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.empty-state svg { width: 64px; height: 64px; opacity: 0.3; margin-bottom: 16px; }
.empty-state p { font-size: 15px; }

/* ===== Login Footer ===== */
.login-page .site-footer {
  margin-left: 0; padding: 30px 20px; text-align: center; margin-top: 30px;
  color: var(--text-muted); font-size: 14px;
}

/* ===== Footer ===== */
.site-footer {
  text-align: center; padding: 20px; margin-left: var(--sidebar-width);
  color: var(--text-muted); font-size: 14px;
}
.site-footer a { color: var(--emerald-light); transition: color var(--transition-fast); }
.site-footer a:hover { color: var(--gold); }

/* ===== Mobile Hamburger Button - In Navbar ===== */
.mobile-hamburger {
  display: none;
  width: 36px;
  height: 36px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}
.mobile-hamburger:hover { background: var(--glass-hover); }
.mobile-hamburger:active { transform: scale(0.95); }
.mobile-hamburger svg { width: 20px; height: 20px; color: var(--text-primary); }
.mobile-hamburger.active svg { color: var(--emerald); }

/* ===== Card Header ===== */
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.card-title { font-size: 18px; font-weight: 600; }
.card-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ===== Responsive ===== */
@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; max-width: 100vw; overflow-x: hidden; box-sizing: border-box; }
  .mobile-hamburger { display: flex; }
  .sidebar-close-btn { display: flex; }
  .email-item { flex-wrap: wrap; }
  .email-item .email-from { width: 100%; }
  .email-item .email-date { width: auto; }
  .mail-stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .main-content { padding: 16px; max-width: 100vw; overflow-x: hidden; }
  section.module { max-width: 100%; overflow-x: hidden; }
  .notes-grid { grid-template-columns: 1fr; }
  /* mail-stats-grid handled in mail module section */
  .compose-form .form-row { flex-direction: column; }
  .toolbar { flex-direction: column; }
  .toolbar .form-input { width: 100%; }
  .navbar { flex-direction: row; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
  .navbar .page-title { font-size: 20px !important; }
  .navbar-right { margin-left: auto; }
  .search-input { width: 100%; }
}
@media (min-width: 993px) {
  .mobile-menu-toggle { display: none; }
}

/* ========== Route Cards Grid ========== */
.content-grid {
  display: grid;
  gap: 24px;
  margin-bottom: 30px;
}
.route-grid {
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

@media (max-width: 992px) {
  .route-grid {
    grid-template-columns: 1fr;
  }
}

/* Mail body content rendering */
.mail-body-content img {
  max-width: 100% !important;
  height: auto !important;
  display: block;
}
.mail-body-content a {
  word-break: break-all;
}



/* ===== Mail Module Mobile Optimization ===== */

/* --- Mobile mail card layout (div-based, not table) --- */
@media (max-width: 768px) {
  /* Stats cards: 2x2 grid with balanced size */
  .mail-stats-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    margin-bottom: 14px !important;
  }
  .mail-stat-card {
    padding: 12px 14px !important;
    margin: 0 !important;
    border-radius: 14px !important;
  }
  .mail-stat-card .stat-card-inner {
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 8px !important;
  }
  .mail-stat-card .stat-info { flex: 1; min-width: 0; }
  .mail-stat-card .stat-icon { display: none !important; }
  .mail-stat-card h3 { font-size: 11px !important; margin-bottom: 2px !important; white-space: nowrap; }
  .mail-stat-card .stat-value { font-size: 22px !important; margin-bottom: 0 !important; }
  .mail-stat-card .stat-change { display: none !important; }

  /* Toolbar: horizontal compact */
  #mailToolbar {
    display: flex !important;
    flex-direction: row !important;
    gap: 8px !important;
    margin-bottom: 10px !important;
  }
  #mailToolbar .form-input { flex: 1 !important; min-width: 0 !important; font-size: 14px !important; padding: 8px 12px !important; }
  #mailToolbar .toolbar-spacer { display: none !important; }
  #mailToolbar .btn { flex-shrink: 0 !important; padding: 8px 14px !important; font-size: 13px !important; white-space: nowrap; }

  /* Table card compact */
  .table-card { margin: 0 !important; border-radius: 12px !important; padding: 0 !important; overflow: hidden !important; box-sizing: border-box !important; width: 100% !important; border: none !important; }
  .table-card .card-header { padding: 10px 20px !important; margin: 0 !important; }
  .table-card .card-title { font-size: 16px !important; }
  .table-card .card-subtitle { font-size: 12px !important; }

  /* Hide the table on mobile - JS renders div cards instead */
  .data-table thead { display: none !important; }
  .data-table { display: block !important; width: 100% !important; box-sizing: border-box !important; table-layout: fixed !important; }
  .table-wrapper { overflow: hidden !important; padding: 0 !important; max-width: 100% !important; margin: 0 !important; }
  #mailTableCard { max-width: 100% !important; overflow: hidden !important; }

  /* Batch bar: compact wrap */
  #mailBatchBar {
    flex-wrap: wrap !important;
    gap: 6px !important;
    padding: 8px 20px !important;
  }
  #mailBatchBar .batch-glass-btn {
    font-size: 11px !important;
    padding: 5px 10px !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    text-align: center !important;
  }

  /* Mobile card styles - rendered by JS when isMobile */
  .mobile-mail-list {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  .mobile-mail-card {
    display: block;
    padding: 10px 20px !important;
    border-bottom: 1px solid var(--glass-border);
    cursor: pointer;
    transition: background 0.15s;
    box-sizing: border-box;
    width: 100%;
    overflow: hidden;
  }
  .mobile-mail-card:active { background: var(--glass-hover); }
  .mobile-mail-row1 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    min-width: 0;
    width: 100%;
  }
  .mobile-mail-from {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-mail-unread .mobile-mail-from::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--emerald);
    margin-right: 6px;
    vertical-align: middle;
    flex-shrink: 0;
  }
  .mobile-mail-time {
    flex-shrink: 0;
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    width: 60px;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-mail-subject {
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 2px;
    line-height: 1.35;
    width: 100%;
  }

  /* Mobile detail expand */
  .mobile-mail-detail {
    padding: 12px 14px;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--primary);
    box-sizing: border-box;
    width: 100%;
    overflow: hidden;
    word-break: break-all;
  }
  .mobile-detail-header { margin-bottom: 10px; }
  .mobile-detail-subject {
    font-size: 15px;
    font-weight: 600;
    word-break: break-word;
    margin: 0 0 4px 0;
  }
  .mobile-detail-meta {
    color: var(--text-secondary);
    font-size: 11px;
    word-break: break-all;
  }
  .mobile-detail-body {
    max-height: 60vh;
    overflow-y: auto;
    word-break: break-word;
    font-size: 13px;
    line-height: 1.6;
  }
  .mobile-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
  }
  .mobile-detail-actions .batch-glass-btn { flex: 1; min-width: 60px; text-align: center; font-size: 12px !important; }

  /* Pagination */
  #mailPagination { display: flex !important; flex-wrap: wrap !important; gap: 6px !important; justify-content: center !important; padding: 8px 20px !important; font-size: 11px !important; }
  #mailPagination span { width: 100%; text-align: center; }
  #mailPagination .btn { font-size: 11px !important; padding: 6px 12px !important; }

  /* Compose form */
  #mailComposeSection .glass-card { padding: 14px !important; }
  .compose-form .form-group input,
  .compose-form .form-group textarea { width: 100%; font-size: 16px !important; box-sizing: border-box !important; }
  #mailBody { min-height: 200px !important; }
  .compose-actions { flex-direction: row !important; }
  .compose-actions .btn { flex: 1; text-align: center; }

  /* Route cards */
  .route-grid { grid-template-columns: 1fr !important; }

  /* Modal */
  .modal { width: 95% !important; max-width: none !important; max-height: 90vh !important; margin: 10px auto !important; padding: 16px !important; }
  .modal-wide { max-width: none !important; }

  /* Card headers */
  .table-card .card-header { flex-direction: column !important; align-items: flex-start !important; gap: 4px !important; }
}

@media (max-width: 480px) {
  .mail-stats-grid { gap: 6px !important; }
  .mail-stat-card { padding: 10px 12px !important; }
  .mail-stat-card h3 { font-size: 10px !important; }
  .mail-stat-card .stat-value { font-size: 18px !important; }
  .mobile-mail-from { font-size: 12px !important; }
  .mobile-mail-subject { font-size: 11px !important; }
  .mobile-mail-time { font-size: 9px !important; width: 52px !important; }
  .mobile-detail-subject { font-size: 14px !important; }
  .mobile-detail-body { font-size: 12px !important; max-height: 50vh !important; }
  .mobile-mail-card { padding: 8px 12px !important; }
}

/* Drive folders */
.drive-breadcrumb { margin-bottom: 12px; font-size: 13px; color: var(--text-secondary); }
.drive-breadcrumb a { color: var(--primary); cursor: pointer; text-decoration: none; }
.drive-breadcrumb a:hover { text-decoration: underline; }
.drive-folders { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.drive-folder-card { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 8px; cursor: pointer; transition: all 0.2s; }
.drive-folder-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.drive-folder-name { font-size: 14px; font-weight: 500; flex: 1; }

/* Global search */
.global-search-input { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 8px; padding: 6px 12px; color: var(--text-primary); font-size: 13px; width: 200px; outline: none; transition: border-color 0.2s; }
.global-search-input:focus { border-color: var(--primary); }
@media (max-width: 768px) { .global-search-input { width: 120px; } }

/* Drive sort + selection bar */
.drive-sort-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 10px 14px; background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 10px; margin-bottom: 14px; }
.drive-sort-bar .drive-sort-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.drive-select-all-label { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); font-size: 12px; cursor: pointer; }
.drive-select-all-label input { cursor: pointer; }

/* Drive table + checkbox */
.drive-table-wrap { overflow-x: auto; }
.drive-actions button { margin-right: 4px; margin-bottom: 4px; }
.data-table .selected-row { background: rgba(59, 130, 246, 0.08); }
.data-table tbody tr:hover { background: var(--glass-hover); }
.file-name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }

/* Drive folder drag-over */
.drive-folder-card.drag-over { border-color: var(--primary); background: rgba(59, 130, 246, 0.1); }
#driveFileList.drag-over-main { outline: 2px dashed var(--primary); outline-offset: 4px; border-radius: 12px; }

/* Drive cards (mobile) */
.drive-cards { display: none; flex-direction: column; gap: 10px; }
.drive-file-card { padding: 14px; background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 10px; transition: all 0.2s; }
.drive-file-card.selected { border-color: var(--primary); background: rgba(59, 130, 246, 0.08); }

/* Modal overlay (preview / share) */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.7); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(8px); }
.modal-overlay.hidden { display: none !important; }

/* Responsive: hide table, show cards on mobile; hide toolbar labels on mobile */
@media (max-width: 768px) {
  .drive-table-wrap { display: none; }
  .drive-cards { display: flex; }
  .file-name-text { max-width: calc(100vw - 140px); }
  .toolbar .drive-stats-text { display: inline-block; }
  .drive-sort-bar { font-size: 12px; padding: 8px 10px; }
  .drive-sort-bar .btn { padding: 5px 9px; font-size: 12px; }
}

/* Print-friendly hide (just in case) */
@media print { .drive-cards, .modal-overlay { display: none; } }

/* Mail attachments */
.attachment-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 6px; font-size: 12px; color: var(--text-primary); }
.attachment-remove { cursor: pointer; color: var(--text-muted); font-weight: bold; }
.attachment-remove:hover { color: var(--danger); }

/* Mail filter buttons */
.mail-filter-btn.active { background: var(--primary); color: white; }

/* Recipient suggestions dropdown */
#recipientSuggestions div:hover { background: var(--glass-hover); }

/* Mail settings button */
.mail-settings-btn { font-size: 12px; padding: 4px 10px; }

/* =====================================================
   Settings Page
   ===================================================== */
.settings-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
}
@media (max-width: 768px) {
  .settings-grid { grid-template-columns: 1fr; }
}

.settings-nav-card { padding: 12px; }
.settings-nav { list-style: none; padding: 0; margin: 0; }
.settings-nav-item { margin: 2px 0; }
.settings-nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text); text-decoration: none;
  font-size: 14px; font-weight: 500;
  transition: background .15s, color .15s, transform .15s;
}
.settings-nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.settings-nav-link:hover { background: var(--glass-hover); }
.settings-nav-link.active {
  background: linear-gradient(135deg, rgba(16,185,129,.2), rgba(212,165,116,.2));
  color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--glass-border);
}

.settings-tab-content { display: none; }
.settings-tab-content.active { display: block; animation: settingsFade .25s ease-out; }
@keyframes settingsFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.profile-header {
  display: flex; align-items: center; gap: 20px;
  padding: 20px; margin-bottom: 20px;
  background: linear-gradient(135deg, rgba(16,185,129,.1), rgba(212,165,116,.1));
  border-radius: 16px;
  border: 1px solid var(--glass-border);
}
.profile-avatar-large {
  width: 80px; height: 80px; border-radius: 50%;
  background: linear-gradient(135deg, var(--emerald), var(--gold));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 32px; font-weight: 700;
  position: relative; overflow: hidden;
  box-shadow: 0 8px 24px rgba(16,185,129,.25);
}
.profile-avatar-edit {
  position: absolute; right: 0; bottom: 0;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
  transition: transform .15s;
}
.profile-avatar-edit:hover { transform: scale(1.1); }
.profile-avatar-edit svg { width: 14px; height: 14px; }
.profile-info h2 { margin: 0 0 4px 0; font-size: 22px; }
.profile-info p { margin: 0; color: var(--text-muted); font-size: 14px; }

.settings-section {
  padding: 20px 0;
  border-bottom: 1px solid var(--glass-border);
}
.settings-section:last-child { border-bottom: none; }
.settings-section-title {
  font-size: 16px; font-weight: 600;
  margin: 0 0 16px 0;
}

.form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.form-grid .full-width { grid-column: span 2; }
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full-width { grid-column: span 1; }
}
.form-group-settings label {
  display: block; font-size: 13px; font-weight: 500;
  margin-bottom: 6px; color: var(--text-muted);
}
.form-group-settings input,
.form-group-settings textarea,
.settings-select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text);
  font-size: 14px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}
.form-group-settings input:focus,
.form-group-settings textarea:focus,
.settings-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16,185,129,.15);
}
.form-group-settings textarea { resize: vertical; min-height: 80px; }

.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
  gap: 16px;
}
.settings-label { flex: 1; }
.settings-label-title { display: block; font-weight: 500; font-size: 14px; }
.settings-label-desc { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Toggle switch */
.toggle-switch {
  position: relative; display: inline-block;
  width: 44px; height: 24px; flex-shrink: 0;
}
.toggle-switch input { display: none; }
.toggle-slider {
  position: absolute; cursor: pointer;
  inset: 0;
  background: rgba(120,120,120,.35);
  border-radius: 999px;
  transition: background .2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* Password strength bar */
.password-strength {
  margin-top: 8px;
  display: flex; align-items: center; gap: 10px;
}
.password-strength span {
  display: block;
  height: 6px;
  border-radius: 3px;
  background: rgba(120,120,120,.25);
  min-width: 120px;
  transition: width .2s, background .2s;
}
.password-strength span.weak { background: #ef4444; }
.password-strength span.medium { background: #f59e0b; }
.password-strength span.strong { background: #10b981; }
.password-strength small { color: var(--text-muted); font-size: 12px; }

/* User cards */
.user-card { margin-bottom: 8px; }

/* Accent swatches */
.accent-swatches {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.accent-swatches .swatch {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid transparent; cursor: pointer;
  transition: transform .15s, border-color .15s;
  padding: 0;
}
.accent-swatches .swatch:hover { transform: scale(1.1); }
.accent-swatches .swatch.active {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--primary);
}

/* Compact & no-animation */
body.compact-layout {
  --card-padding: 12px;
}
body.compact-layout .glass-card { padding: 12px; }
body.no-animations * { transition: none !important; animation: none !important; }

/* Generic status-badge variants */
.status-badge { background: rgba(120,120,120,.15); color: var(--text-muted); }
.status-badge::before { background: var(--text-muted); }

/* Support data-accent CSS vars */
:root[data-accent="blue"] { --primary: #3b82f6; --emerald: #3b82f6; }
:root[data-accent="purple"] { --primary: #8b5cf6; --emerald: #8b5cf6; }
:root[data-accent="orange"] { --primary: #f59e0b; --emerald: #f59e0b; }
:root[data-accent="pink"] { --primary: #ec4899; --emerald: #ec4899; }
:root[data-accent="red"] { --primary: #ef4444; --emerald: #ef4444; }
:root[data-accent="emerald"] { --primary: #10b981; --emerald: #10b981; }

