/* ============================================
   Mailpilot — Dark Refined Admin Theme
   ============================================ */

:root {
  --bg-deep: #060b18;
  --bg-base: #0a1128;
  --bg-surface: #111d3a;
  --bg-elevated: #162040;
  --bg-card: rgba(17, 29, 58, 0.7);
  --border-subtle: rgba(99, 140, 255, 0.08);
  --border-medium: rgba(99, 140, 255, 0.15);
  --border-focus: rgba(74, 222, 128, 0.5);
  --text-primary: #e8ecf4;
  --text-secondary: #8b97b8;
  --text-muted: #5a6785;
  --accent: #4ade80;
  --accent-dim: #22c55e;
  --accent-deep: #166534;
  --accent-glow: rgba(74, 222, 128, 0.15);
  --danger: #f87171;
  --danger-dim: #dc2626;
  --warning: #fbbf24;
  --info: #60a5fa;
  --sidebar-w: 260px;
  --radius: 12px;
  --radius-sm: 8px;
}

/* ── Light Theme Override ─────────────────── */
[data-theme="light"] {
  --bg-deep: #f0f2f5;
  --bg-base: #e8ebf0;
  --bg-surface: #ffffff;
  --bg-elevated: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --border-subtle: rgba(0, 0, 0, 0.06);
  --border-medium: rgba(0, 0, 0, 0.10);
  --border-focus: rgba(22, 163, 74, 0.5);
  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --text-muted: #94a3b8;
  --accent: #16a34a;
  --accent-dim: #15803d;
  --accent-deep: #166534;
  --accent-glow: rgba(22, 163, 74, 0.12);
  --danger: #dc2626;
  --danger-dim: #b91c1c;
  --warning: #d97706;
  --info: #2563eb;
}

[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

[data-theme="light"] .bg-grid {
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
}

[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.12); }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.2); }

[data-theme="light"] .nav-item:hover { background: rgba(22, 163, 74, 0.06); }
[data-theme="light"] .nav-item.active { background: rgba(22, 163, 74, 0.08); }

[data-theme="light"] .form-input { background: rgba(0, 0, 0, 0.03); }
[data-theme="light"] .filter-bar select { background-color: rgba(0, 0, 0, 0.03); }

[data-theme="light"] .table-wrap thead th { background: rgba(0, 0, 0, 0.03); }
[data-theme="light"] .table-wrap tbody tr:hover { background: rgba(22, 163, 74, 0.04); }
[data-theme="light"] .table-wrap tbody td { border-bottom-color: rgba(0, 0, 0, 0.04); }

[data-theme="light"] .badge-active { background: rgba(22, 163, 74, 0.1); color: #15803d; }
[data-theme="light"] .badge-active::before { background: #15803d; }
[data-theme="light"] .badge-sent { background: rgba(22, 163, 74, 0.1); color: #15803d; }
[data-theme="light"] .badge-sent::before { background: #15803d; }
[data-theme="light"] .badge-failed { background: rgba(220, 38, 38, 0.08); color: #dc2626; }
[data-theme="light"] .badge-failed::before { background: #dc2626; }
[data-theme="light"] .badge-processing { background: rgba(37, 99, 235, 0.08); color: #2563eb; }
[data-theme="light"] .badge-processing::before { background: #2563eb; }
[data-theme="light"] .badge-pending, [data-theme="light"] .badge-retry { background: rgba(217, 119, 6, 0.08); color: #d97706; }
[data-theme="light"] .badge-pending::before, [data-theme="light"] .badge-retry::before { background: #d97706; }
[data-theme="light"] .badge-inactive, [data-theme="light"] .badge-cancelled { background: rgba(0, 0, 0, 0.05); color: #64748b; }
[data-theme="light"] .badge-inactive::before, [data-theme="light"] .badge-cancelled::before { background: #94a3b8; }
[data-theme="light"] .badge-default { background: rgba(37, 99, 235, 0.08); color: #2563eb; }

[data-theme="light"] .icon-btn:hover { background: rgba(0, 0, 0, 0.05); }
[data-theme="light"] .user-action:hover { background: rgba(0, 0, 0, 0.05); }
[data-theme="light"] .mobile-toggle:hover { background: rgba(0, 0, 0, 0.05); }

[data-theme="light"] .code-inline { background: rgba(0, 0, 0, 0.04); }

[data-theme="light"] .pagination a { background: rgba(0, 0, 0, 0.04); }
[data-theme="light"] .pagination a:hover { background: rgba(22, 163, 74, 0.08); }

[data-theme="light"] .flash-success { background: rgba(22, 163, 74, 0.08); border-color: rgba(22, 163, 74, 0.2); }
[data-theme="light"] .flash-error { background: rgba(220, 38, 38, 0.06); border-color: rgba(220, 38, 38, 0.15); }

[data-theme="light"] .trend-btn.active { background: rgba(22, 163, 74, 0.1); border-color: rgba(22, 163, 74, 0.3); }

[data-theme="light"] .login-bg { background: #f0f2f5; }
[data-theme="light"] .login-bg::before { background: radial-gradient(circle, rgba(22, 163, 74, 0.06) 0%, transparent 70%); }
[data-theme="light"] .login-card { background: rgba(255, 255, 255, 0.9); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08); }

[data-theme="light"] .mobile-header { background: linear-gradient(180deg, #ffffff 0%, rgba(255, 255, 255, 0.95) 100%); }

[data-theme="light"] .feed-item { border-bottom-color: rgba(0, 0, 0, 0.04); }

[data-theme="light"] .btn-secondary { background: rgba(0, 0, 0, 0.04); border-color: rgba(0, 0, 0, 0.1); }
[data-theme="light"] .btn-secondary:hover { background: rgba(0, 0, 0, 0.07); }

/* ── Theme Toggle Button ─────────────────── */
.theme-toggle {
  padding: 6px;
  border-radius: 8px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.06); }
[data-theme="light"] .theme-toggle:hover { background: rgba(0, 0, 0, 0.05); }
.theme-toggle .icon-sun, .theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }
:root .theme-toggle .icon-moon { display: block; }
:root .theme-toggle .icon-sun { display: none; }

.mobile-theme-toggle {
  margin-left: auto;
}

.login-theme-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
}

/* ── Reset & Base ─────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Scrollbar ────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(99, 140, 255, 0.15);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(99, 140, 255, 0.25); }

/* ── Background Pattern ───────────────────── */
.bg-grid {
  background-image:
    linear-gradient(rgba(99, 140, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 140, 255, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* ── Sidebar ──────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0d1529 0%, #0a1020 100%);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  padding: 24px 24px 8px;
}

.sidebar-logo h1 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.sidebar-logo .brand-olive { color: var(--accent); }
.sidebar-logo .brand-name { color: var(--text-primary); }
.sidebar-logo .brand-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Nav Items */
.nav-section {
  padding: 16px 12px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  margin-bottom: 2px;
  position: relative;
}

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(74, 222, 128, 0.06);
}

.nav-item.active {
  color: var(--accent);
  background: rgba(74, 222, 128, 0.1);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon { opacity: 1; }

/* Sidebar Footer */
.sidebar-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 12px 16px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-deep), var(--accent-dim));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.user-name {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-action {
  padding: 6px;
  border-radius: 8px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-decoration: none;
}

.user-action:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

/* ── Main Content Area ────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  width: calc(100vw - var(--sidebar-w));
  max-width: calc(100vw - var(--sidebar-w));
  min-width: 0;
  min-height: 100vh;
  padding: 32px 36px;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* ── Cards ────────────────────────────────── */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color 0.2s;
}

.card:hover {
  border-color: var(--border-medium);
}

.card-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}

.card-value {
  font-family: 'Outfit', sans-serif;
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
}

/* ── Tables ───────────────────────────────── */
.table-wrap {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow-x: auto;
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table-wrap thead th {
  padding: 14px 18px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.15);
}

.table-wrap tbody td {
  padding: 14px 18px;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(99, 140, 255, 0.04);
}

.table-wrap tbody tr {
  transition: background 0.15s;
}

.table-wrap tbody tr:hover {
  background: rgba(74, 222, 128, 0.03);
}

.table-wrap tbody tr:last-child td {
  border-bottom: none;
}

/* ── Status Badges ────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-active {
  background: rgba(74, 222, 128, 0.12);
  color: #4ade80;
}
.badge-active::before { background: #4ade80; }

.badge-inactive {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
}
.badge-inactive::before { background: #94a3b8; }

.badge-sent {
  background: rgba(74, 222, 128, 0.12);
  color: #4ade80;
}
.badge-sent::before { background: #4ade80; }

.badge-failed {
  background: rgba(248, 113, 113, 0.12);
  color: #f87171;
}
.badge-failed::before { background: #f87171; }

.badge-processing {
  background: rgba(96, 165, 250, 0.12);
  color: #60a5fa;
}
.badge-processing::before { background: #60a5fa; animation: pulse-dot 1.5s infinite; }

.badge-pending, .badge-retry {
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
}
.badge-pending::before, .badge-retry::before { background: #fbbf24; }

.badge-cancelled {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
}
.badge-cancelled::before { background: #94a3b8; }

.badge-default {
  background: rgba(96, 165, 250, 0.12);
  color: #60a5fa;
  font-size: 0.65rem;
  padding: 2px 8px;
}
.badge-default::before { display: none; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── Buttons ──────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  line-height: 1.2;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-dim), #15803d);
  color: white;
  box-shadow: 0 2px 12px rgba(34, 197, 94, 0.25);
}

.btn-primary:hover {
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border-medium);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

/* Icon buttons for table actions */
.icon-btn {
  padding: 7px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.icon-btn:hover { background: rgba(255, 255, 255, 0.06); }
.icon-btn-edit:hover { color: var(--info); }
.icon-btn-danger:hover { color: var(--danger); }
.icon-btn-warning:hover { color: var(--warning); }
.icon-btn-success:hover { color: var(--accent); }

/* ── Form Inputs ──────────────────────────── */
.form-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 28px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  transition: all 0.2s;
  outline: none;
}

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

select.form-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235a6785' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea.form-input {
  resize: vertical;
  min-height: 44px;
}

.form-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── Filter bar ───────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.filter-bar select {
  padding: 8px 36px 8px 14px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.825rem;
  font-family: inherit;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235a6785' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  transition: border-color 0.2s;
}

.filter-bar select:focus {
  border-color: var(--border-focus);
}

.filter-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Page Title ───────────────────────────── */
.page-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header .page-title { margin-bottom: 0; }

/* ── Flash Messages ───────────────────────── */
.flash {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: flash-in 0.3s ease;
}

.flash-success {
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.2);
  color: var(--accent);
}

.flash-error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.2);
  color: var(--danger);
}

@keyframes flash-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Pagination ───────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 20px;
}

.pagination a {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.825rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-subtle);
}

.pagination a:hover {
  background: rgba(74, 222, 128, 0.08);
  border-color: var(--border-medium);
}

.pagination a.active {
  background: var(--accent-dim);
  color: white;
  border-color: var(--accent-dim);
}

/* ── API Key code ─────────────────────────── */
.code-inline {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.72rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--text-secondary);
}

/* ── Trend Toggle Buttons ─────────────────── */
.trend-btn {
  padding: 6px 16px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.trend-btn:hover {
  background: rgba(255, 255, 255, 0.04);
}

.trend-btn.active {
  background: rgba(74, 222, 128, 0.12);
  border-color: rgba(74, 222, 128, 0.3);
  color: var(--accent);
}

/* ── SMTP Health Card ─────────────────────── */
.smtp-health-item {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px;
  transition: border-color 0.2s;
}

.smtp-health-item:hover {
  border-color: var(--border-medium);
}

/* ── Modal ────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius);
  width: 100%;
  max-width: 48rem;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.3rem;
  transition: all 0.2s;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.modal-body {
  flex: 1;
  overflow: auto;
  padding: 4px;
}

/* ── Activity Feed ────────────────────────── */
.feed-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(99, 140, 255, 0.04);
  font-size: 0.825rem;
}

.feed-time {
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* ── Footer ───────────────────────────────── */
.app-footer {
  margin-top: 48px;
  padding: 20px 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.app-footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.app-footer a:hover { color: var(--text-secondary); }

/* ── Staggered Reveal Animation ───────────── */
.reveal {
  animation: reveal 0.5s ease both;
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.reveal-delay-1 { animation-delay: 0.05s; }
.reveal-delay-2 { animation-delay: 0.10s; }
.reveal-delay-3 { animation-delay: 0.15s; }
.reveal-delay-4 { animation-delay: 0.20s; }
.reveal-delay-5 { animation-delay: 0.25s; }

/* ── Login Page ───────────────────────────── */
.login-bg {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-deep);
  position: relative;
  overflow: hidden;
}

.login-bg::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(74, 222, 128, 0.08) 0%, transparent 70%);
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.login-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-medium);
  border-radius: 16px;
  padding: 40px 36px;
  width: 400px;
  max-width: 90vw;
  position: relative;
  z-index: 1;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* ── Queue status rows ────────────────────── */
.queue-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.85rem;
}

.queue-row span:first-child { color: var(--text-secondary); }
.queue-row span:last-child {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  color: var(--text-primary);
}

/* ── Stat colors ──────────────────────────── */
.text-success { color: var(--accent) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }

/* ── Metric stat blocks ───────────────────── */
.stat-inline {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  font-size: 0.825rem;
}

/* ── Grid Utility Classes ─────────────────── */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.grid-2-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.grid-2-tight {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Mobile Header ────────────────────────── */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 41;
  height: 56px;
  background: linear-gradient(180deg, #0d1529 0%, rgba(10, 16, 32, 0.95) 100%);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}

.mobile-toggle {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: none;
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}

.mobile-toggle:hover { background: rgba(255, 255, 255, 0.06); }

.mobile-brand {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.03em;
}

.mobile-brand .brand-olive { color: var(--accent); }
.mobile-brand .brand-name { color: var(--text-primary); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 39;
}

/* ── Responsive ───────────────────────────── */

/* Tablet */
@media (max-width: 1024px) {
  .sidebar { width: 220px; }
  .main-content { margin-left: 220px; width: calc(100vw - 220px); max-width: calc(100vw - 220px); padding: 24px 20px; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

/* Mobile */
@media (max-width: 768px) {
  .mobile-header { display: flex; }
  .sidebar-overlay.active { display: block; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
    width: 280px;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
  }
  .sidebar.open { transform: translateX(0); }

  .main-content {
    margin-left: 0;
    width: 100vw;
    max-width: 100vw;
    padding: 68px 16px 24px;
  }

  .page-title { font-size: 1.3rem; }
  .page-header { flex-wrap: wrap; gap: 12px; }
  .card { padding: 18px; }
  .card-value { font-size: 1.6rem; }

  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-2-form { grid-template-columns: 1fr; }
  .grid-2-tight { grid-template-columns: 1fr; }

  .filter-bar { flex-wrap: wrap; }
  .filter-bar form { flex-wrap: wrap; }

  .table-wrap { border-radius: 8px; }
  .table-wrap thead th { padding: 10px 12px; font-size: 0.7rem; }
  .table-wrap tbody td { padding: 10px 12px; font-size: 0.8rem; }
  .table-wrap table { min-width: 600px; }

  .pagination { flex-wrap: wrap; }
  .pagination a { padding: 6px 10px; font-size: 0.75rem; }

  .modal-content { max-width: 95vw; margin: 16px; }

  .form-card { padding: 20px; }

  .feed-item { flex-wrap: wrap; gap: 6px; }
  .feed-item span:last-child { margin-left: 0; }

  .stat-inline { flex-wrap: wrap; gap: 8px; }

  .trend-btn { padding: 5px 12px; font-size: 0.75rem; }

  .smtp-health-item { padding: 12px; }
}
