:root {
  --emerald-50: #ecfdf5;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --sky-500: #0ea5e9;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-500: #64748b;
  --slate-700: #334155;
  --slate-900: #0f172a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--slate-100);
  color: var(--slate-900);
}
h1, h2, h3 { font-family: 'Plus Jakarta Sans', sans-serif; }

/* Login Page */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(circle at 15% 20%, rgba(16, 185, 129, 0.2), transparent 45%),
              radial-gradient(circle at 85% 80%, rgba(14, 165, 233, 0.2), transparent 45%),
              #f8fafc;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 24px;
  padding: 36px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.1);
  border: 1px solid var(--slate-200);
}
.login-brand { text-align: center; margin-bottom: 24px; }
.brand-badge {
  width: 54px; height: 54px;
  border-radius: 16px;
  background: linear-gradient(135deg, #059669, #0ea5e9);
  color: #fff; font-weight: 800; font-size: 1.2rem;
  display: grid; place-items: center; margin: 0 auto 12px;
}
.login-brand p { color: var(--slate-500); font-size: 0.9rem; margin-top: 4px; }
.login-form { display: grid; gap: 16px; }
.login-hint {
  margin-top: 18px;
  background: var(--emerald-50);
  color: var(--emerald-600);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.84rem;
  text-align: center;
}
.alert-error {
  background: #fef2f2; color: #dc2626;
  padding: 10px 14px; border-radius: 12px;
  font-size: 0.86rem; margin-bottom: 14px;
}

/* Dashboard Layout */
.admin-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--slate-900);
  color: #cbd5e1;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 20px;
}
.sidebar-brand strong { color: #fff; font-size: 0.95rem; display: block; }
.sidebar-brand span { font-size: 0.74rem; color: #34d399; }
.sidebar-nav { display: grid; gap: 6px; }
.nav-item {
  width: 100%; text-align: left;
  background: transparent; border: none;
  color: #cbd5e1; padding: 12px 14px;
  border-radius: 12px; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s ease;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
}
.badge-count {
  background: #ef4444; color: #fff;
  font-size: 0.72rem; padding: 2px 8px; border-radius: 999px;
}

.main-area {
  padding: 28px 32px;
  overflow-y: auto;
}
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 14px;
  margin-bottom: 28px;
}
.topbar-actions { display: flex; gap: 10px; align-items: center; }

.panel { display: none; }
.panel.active { display: block; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px;
  margin-bottom: 28px;
}
.stat-card {
  background: #fff; border-radius: 18px; padding: 22px;
  border: 1px solid var(--slate-200);
}
.stat-card span { font-size: 0.82rem; color: var(--slate-500); font-weight: 600; }
.stat-card strong { display: block; font-size: 1.9rem; margin-top: 6px; color: var(--slate-900); }

.card-box {
  background: #fff; border-radius: 20px; padding: 24px;
  border: 1px solid var(--slate-200);
  margin-bottom: 24px;
}
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px; gap: 12px; flex-wrap: wrap;
}

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group label { display: block; font-size: 0.82rem; font-weight: 700; margin-bottom: 6px; color: var(--slate-700); }
.form-control {
  width: 100%; padding: 10px 14px; border-radius: 12px;
  border: 1.5px solid var(--slate-200); font-family: inherit; font-size: 0.9rem;
  background: var(--slate-50);
}
.form-control:focus { outline: none; border-color: var(--emerald-500); background: #fff; }

.btn-admin {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 12px; font-weight: 700; font-size: 0.86rem;
  border: none; cursor: pointer; text-decoration: none; transition: 0.2s ease;
}
.btn-primary { background: linear-gradient(135deg, #059669, #10b981); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-secondary { background: var(--slate-100); color: var(--slate-700); }
.btn-danger { background: #fee2e2; color: #dc2626; }
.btn-sm { padding: 6px 12px; font-size: 0.78rem; border-radius: 8px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--slate-100); }
th { color: var(--slate-500); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; }
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 0.74rem; font-weight: 700; background: var(--emerald-50); color: var(--emerald-600);
}
.pill-unread { background: #fef3c7; color: #d97706; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,0.55);
  display: none; place-items: center; z-index: 2000; padding: 20px;
}
.modal-backdrop.open { display: grid; }
.modal-box {
  background: #fff; border-radius: 20px; max-width: 580px; width: 100%;
  padding: 28px; max-height: 90vh; overflow-y: auto;
}

.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--slate-900); color: #fff; padding: 12px 20px;
  border-radius: 12px; font-size: 0.88rem; font-weight: 600;
  opacity: 0; transform: translateY(40px); transition: 0.3s ease; z-index: 3000;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .admin-layout { grid-template-columns: 1fr; }
  .stats-row, .form-grid-2 { grid-template-columns: 1fr; }
}
