/* ============================================
   MKSTEAM — Admin dashboard styles
   The same shell as the Intuition Education admin: a navy sidebar with
   grouped navigation, a white page header, soft rounded cards and
   gradient buttons. Class names are shared with admin.js — keep them.
   ============================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Palette (Tailwind slate / blue / teal, as the Intuition admin) */
  --navy-900: #0f172a;
  --navy-800: #1e2a5e;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-50:  #eff6ff;
  --teal-600: #0d9488;
  --teal-500: #14b8a6;
  --teal-50:  #f0fdfa;
  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;

  /* Names the rest of the admin markup already uses */
  --teal: var(--teal-600);
  --teal-dark: #0f766e;
  --teal-dim: rgba(13,148,136,0.10);
  --coral: #e05c3c;
  --coral-dim: rgba(224,92,60,0.10);
  --purple: #7c5cbf;
  --purple-dim: rgba(124,92,191,0.10);
  --amber: #f59e0b;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --success: #10b981;
  --success-light: #ecfdf5;
  --bg: var(--slate-100);
  --bg-card: #ffffff;
  --text: var(--navy-900);
  --text-light: var(--slate-600);
  --text-lighter: var(--slate-500);
  --border: var(--slate-200);
  --border-light: var(--slate-100);
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --shadow: 0 1px 2px rgba(15,23,42,0.04);
  --shadow-md: 0 4px 32px rgba(15,23,42,0.08);
  --shadow-lg: 0 12px 48px rgba(15,23,42,0.15);
  --glow-blue: 0 0 40px rgba(37,99,235,0.25);
  --gradient: linear-gradient(90deg, var(--blue-600) 0%, var(--teal-600) 100%);
  --gradient-sidebar: linear-gradient(135deg, #0f172a 0%, #1e2a5e 40%, #0f2744 70%, #0f172a 100%);
  --transition: 0.2s ease;
  --display: 'Exo', 'Inter', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, sans-serif;
  --sidebar-width: 256px;
}

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
svg { flex-shrink: 0; }

/* ---------- Login screen ---------- */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--gradient-sidebar);
}

.login-card {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-card .login-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--gradient);
  color: #fff;
  font-size: 1.6rem;
  margin-bottom: 14px;
  box-shadow: var(--glow-blue);
}

.login-card h1 {
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 800;
  margin-bottom: 4px;
  color: var(--text);
}

.login-card .login-sub {
  color: var(--slate-500);
  font-size: 0.9rem;
  margin-bottom: 26px;
}

.login-card input {
  width: 100%;
  padding: 11px 16px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: var(--body);
  margin-bottom: 14px;
  background: #fff;
  color: var(--text);
  transition: box-shadow var(--transition), border-color var(--transition);
}

.login-card input:focus {
  outline: none;
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--blue-500);
}

.login-card .login-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-bottom: 12px;
  display: none;
}

.login-card button {
  width: 100%;
  padding: 12px;
  background: var(--gradient);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--body);
  transition: transform var(--transition), opacity var(--transition);
}

.login-card button:hover { transform: scale(1.02); }
.login-card button:disabled { opacity: 0.7; transform: none; }

/* ---------- Layout ---------- */
.admin-layout {
  display: none;
  min-height: 100vh;
}

.admin-layout.active { display: flex; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--gradient-sidebar);
  color: var(--slate-400);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.05);
}

.sidebar-header {
  padding: 22px 24px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-header .logo {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -0.01em;
}

.sidebar-header .logo .logo-light {
  font-weight: 300;
  color: #93c5fd;
}

.sidebar-header .logo-sub {
  font-size: 0.74rem;
  color: var(--slate-400);
  margin-top: 6px;
}

.sidebar-header .logo-sub code {
  font-family: 'Roboto Mono', ui-monospace, Menlo, monospace;
  font-size: 0.72rem;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid rgba(45,212,191,0.3);
  background: rgba(20,184,166,0.15);
  color: #5eead4;
}

.role-pill.role-admin, .role-pill.role-reviewer, .role-pill.role-instructor {
  border-color: rgba(59,130,246,0.3);
  background: rgba(59,130,246,0.15);
  color: #93c5fd;
}

.sidebar-nav {
  padding: 18px 12px;
  flex: 1;
}

.sidebar-nav .nav-section {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--slate-500);
  padding: 16px 12px 8px;
}

.sidebar-nav .nav-section:first-child { padding-top: 0; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--slate-400);
  transition: all var(--transition);
  margin-bottom: 4px;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,0.05);
  color: #fff;
}

.sidebar-nav a.active {
  background: var(--gradient);
  color: #fff;
  box-shadow: var(--glow-blue);
}

.sidebar-nav a .nav-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
}

.sidebar-nav a .nav-icon svg { width: 17px; height: 17px; }

.sidebar-bottom {
  padding: 14px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-bottom a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--slate-400);
  transition: all var(--transition);
  margin-bottom: 4px;
}

.sidebar-bottom a:hover {
  background: rgba(255,255,255,0.05);
  color: #fff;
}

.sidebar-bottom a .nav-icon { display: inline-flex; width: 18px; height: 18px; align-items: center; justify-content: center; }

/* Main column */
.admin-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  min-width: 0;
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 20px 32px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--slate-200);
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-heading { display: flex; align-items: center; gap: 12px; min-width: 0; }

.admin-topbar h1 {
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-topbar .topbar-sub {
  font-size: 0.875rem;
  color: var(--slate-500);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-topbar .topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.menu-toggle:hover { background: var(--slate-100); }

/* Panels */
.admin-panel { display: none; padding: 32px; }
.admin-panel.active { display: block; }

/* Cards */
.admin-card {
  background: var(--bg-card);
  border: 1px solid var(--slate-100);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
}

.admin-card h2 {
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.admin-card h3 { font-family: var(--display); font-weight: 700; }

/* Stat tiles */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--slate-100);
  border-radius: var(--radius);
  padding: 22px 22px 20px;
  box-shadow: var(--shadow-md);
  transition: box-shadow var(--transition), transform var(--transition);
}

.stat-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.stat-card .stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--gradient);
  color: #fff;
  font-size: 1.1rem;
  margin-bottom: 18px;
  box-shadow: 0 4px 12px rgba(37,99,235,0.25);
}

.stat-card .stat-icon svg { width: 18px; height: 18px; }
.stat-card:nth-child(4n+2) .stat-icon { background: linear-gradient(135deg, #f59e0b, #f97316); box-shadow: 0 4px 12px rgba(245,158,11,0.25); }
.stat-card:nth-child(4n+3) .stat-icon { background: linear-gradient(135deg, #7c3aed, #a855f7); box-shadow: 0 4px 12px rgba(124,58,237,0.25); }
.stat-card:nth-child(4n+4) .stat-icon { background: linear-gradient(135deg, #0d9488, #10b981); box-shadow: 0 4px 12px rgba(13,148,136,0.25); }

.stat-card .stat-value {
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
  letter-spacing: -0.02em;
}

.stat-card .stat-label {
  font-size: 0.86rem;
  color: var(--slate-500);
  margin-top: 6px;
}

/* Tables */
.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate-500);
  border-bottom: 1px solid var(--slate-200);
  white-space: nowrap;
}

.admin-table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--slate-100);
  font-size: 0.875rem;
  vertical-align: middle;
}

.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table tbody tr:hover td { background: var(--slate-50); }

.admin-table .badge,
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--slate-100);
  color: var(--slate-600);
}

.badge-ap { background: var(--blue-50); color: var(--blue-600); }
.badge-ib { background: var(--purple-dim); color: var(--purple); }
.badge-both { background: var(--coral-dim); color: var(--coral); }
.badge-video { background: rgba(245,158,11,0.12); color: #b45309; }
.badge-link { background: var(--teal-50); color: var(--teal-600); }
.badge-pending { background: rgba(245,158,11,0.12); color: #b45309; }
.badge-approved { background: var(--teal-50); color: var(--teal-600); }
.badge-rejected { background: var(--coral-dim); color: var(--coral); }

/* Count on a nav entry (applications, reviews, pending students) */
.nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--coral);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: var(--body);
  line-height: 1.3;
  transition: transform var(--transition), background var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}

.btn:disabled { opacity: 0.6; cursor: default; transform: none !important; }

.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,0.2);
}

.btn-primary:hover { transform: scale(1.02); box-shadow: 0 4px 14px rgba(37,99,235,0.28); }

.btn-outline {
  background: #fff;
  border-color: var(--slate-200);
  color: var(--slate-700);
}

.btn-outline:hover { background: var(--slate-50); border-color: var(--slate-300); }

.btn-danger {
  background: var(--danger-light);
  border-color: #fecaca;
  color: #b91c1c;
}

.btn-danger:hover { background: #fee2e2; }

.btn-success {
  background: var(--success-light);
  border-color: #a7f3d0;
  color: #047857;
}

.btn-success:hover { background: #d1fae5; }

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
  border-radius: 9px;
}

.action-btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* Forms */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group { margin-bottom: 16px; min-width: 0; }

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea,
.student-tools input,
.student-tools select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: var(--body);
  background: #fff;
  color: var(--text);
  transition: box-shadow var(--transition), border-color var(--transition);
}

.form-group input::placeholder, .form-group textarea::placeholder { color: var(--slate-400); }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--blue-500);
}

.form-group input[type="checkbox"], .form-group input[type="radio"] {
  width: 16px;
  height: 16px;
  padding: 0;
  accent-color: var(--blue-600);
  vertical-align: middle;
}

.form-group textarea { resize: vertical; min-height: 80px; }

.form-group .help-text, .help-text {
  font-size: 0.78rem;
  color: var(--slate-500);
  margin-top: 5px;
  font-weight: 400;
}

/* Table inputs (prices grid, meeting links, notes) */
.admin-table input[type="text"], .admin-table input[type="url"], .admin-table input[type="number"], .admin-table select {
  padding: 7px 10px;
  border: 1px solid var(--slate-200);
  border-radius: 9px;
  font: inherit;
  font-size: 0.84rem;
  background: #fff;
  color: var(--text);
}

.admin-table input:focus, .admin-table select:focus { outline: none; box-shadow: 0 0 0 2px var(--blue-500); border-color: transparent; }

/* Modals */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.admin-modal-overlay.open { display: flex; }

.admin-modal {
  background: var(--bg-card);
  border-radius: 20px;
  width: 100%;
  max-width: 580px;
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  padding: 32px;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.admin-modal h2 {
  font-family: var(--display);
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 20px;
}

.admin-modal .admin-card { box-shadow: none; border-color: var(--slate-200); background: var(--slate-50); }

.admin-modal .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--slate-100);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--navy-900);
  color: #fff;
  padding: 14px 22px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 3000;
  opacity: 0;
  transform: translateY(16px);
  transition: all 0.3s ease;
  max-width: min(480px, calc(100vw - 48px));
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-left: 4px solid var(--teal-500); }
.toast.error { border-left: 4px solid var(--danger); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--slate-500);
}

.empty-state .empty-icon { font-size: 2.4rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.95rem; margin-bottom: 16px; }
.empty-state p:last-child { margin-bottom: 0; }

/* Info rows, notes */
.admin-card p, .admin-panel > p { color: var(--slate-600); }
.admin-card a:not(.btn), .admin-panel > p a { color: var(--blue-600); font-weight: 500; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    width: min(var(--sidebar-width), 84vw);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .admin-topbar { padding: 14px 16px; }
  .admin-topbar h1 { font-size: 1.25rem; }
  .menu-toggle { display: inline-flex; }
  .admin-panel { padding: 16px; }
  .admin-card { padding: 18px; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

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

/* ---------- Membership tier controls ---------- */
.tier-select {
  padding: 5px 10px;
  border: 1px solid var(--slate-200);
  border-radius: 999px;
  font-family: var(--body);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}
.tier-select.tier-silver   { color: #64748b; border-color: #94a3b8; }
.tier-select.tier-gold     { color: #b45309; border-color: #d97706; }
.tier-select.tier-platinum { color: #6d28d9; border-color: #8b5cf6; }
/* Curriculum (AP / IB) uses the same pill, in AP blue and IB purple */
.tier-select.curr-select-ap { color: var(--blue-600); border-color: var(--blue-500); }
.tier-select.curr-select-ib { color: var(--purple); border-color: var(--purple); }

.tier-badge-silver   { background: var(--slate-100); color: #64748b; }
.tier-badge-gold     { background: rgba(217,119,6,0.12); color: #b45309; }
.tier-badge-platinum { background: rgba(139,92,246,0.12); color: #6d28d9; }

.invite-result {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  color: var(--slate-600);
}
.invite-result p { margin: 6px 0; }
.invite-link {
  display: block;
  margin-top: 6px;
  padding: 9px 12px;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  font-size: 0.78rem;
  word-break: break-all;
  color: var(--blue-600);
}
.fb-good { color: #047857; }
.fb-bad  { color: #b91c1c; }

/* A price filled in by "Convert from base" and not yet saved */
.price-cell.price-suggested { background: #fffbeb; border-color: var(--amber); }

#question-modal .admin-modal { max-width: 860px; }
.opt-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: start; gap: 12px; margin-bottom: 12px; }
.opt-row input[type="radio"] { width: 20px; height: 20px; padding: 0; margin-top: 12px; }
.opt-row .opt-input { min-width: 0; min-height: 96px; resize: vertical; font-size: 1rem; line-height: 1.5; }
.student-tools { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-bottom: 20px; }
.student-tools .form-group { flex: 1; min-width: 160px; margin: 0; }
@media (max-width: 600px) {
  .admin-modal-overlay { padding: 12px; }
  .admin-modal { padding: 24px 16px; max-height: calc(100dvh - 24px); }
  .opt-row { gap: 8px; }
}

/* Lesson content rows (notes / videos / files) */
.lc-item {
  padding: 14px 16px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  background: var(--slate-50);
}
.lc-item:last-child { margin-bottom: 0; }
.lc-item-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.lc-order { font-size: 0.76rem; color: var(--slate-500); }
.lc-body {
  font-size: 0.87rem;
  color: var(--slate-600);
  line-height: 1.6;
  white-space: pre-wrap;
  margin: 0;
}
.lc-empty {
  color: var(--slate-500);
  font-size: 0.9rem;
  padding: 10px 0;
  margin: 0;
}

/* Notice type badges */
.notice-exam     { background: var(--coral-dim);         color: var(--coral); }
.notice-deadline { background: rgba(245,158,11,0.14);    color: #b45309; }
.notice-syllabus { background: var(--purple-dim);        color: var(--purple); }
.notice-resource { background: var(--teal-50);           color: var(--teal-600); }
.notice-news     { background: var(--blue-50);           color: var(--blue-600); }

/* Membership expiry date in the students table */
.expiry-input {
  padding: 6px 8px;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  font: inherit;
  font-size: 0.82rem;
  background: transparent;
  color: inherit;
}
.expiry-input.expired { border-color: var(--coral); color: var(--coral); }

/* All Pass: Platinum in both curricula */
.tier-badge-all { background: linear-gradient(90deg, rgba(37,99,235,0.14), rgba(13,148,136,0.14)); color: var(--blue-600); }
.tier-badge-course { background: var(--coral-dim); color: #c2410c; }

/* Platform: course workflow and teacher statuses */
.badge.status-draft, .badge.status-unpublished, .badge.status-incomplete { background: var(--slate-100); color: var(--slate-600); }
.badge.status-pending_review, .badge.status-applied, .badge.status-trialing, .badge.status-pending { background: rgba(245,158,11,0.14); color: #b45309; }
.badge.status-changes_requested, .badge.status-past_due, .badge.status-suspended, .badge.status-disputed { background: var(--coral-dim); color: #c2410c; }
.badge.status-approved, .badge.status-available { background: rgba(139,92,246,0.12); color: #6d28d9; }
.badge.status-published, .badge.status-active, .badge.status-paid, .badge.status-processed { background: var(--teal-50); color: var(--teal-600); }
.badge.status-archived, .badge.status-rejected, .badge.status-canceled, .badge.status-expired, .badge.status-reversed, .badge.status-failed { background: var(--slate-100); color: var(--slate-600); }

/* ---------- Bell, notifications, messages ---------- */
.bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid var(--slate-200); border-radius: 12px; background: #fff; color: var(--slate-700); cursor: pointer; }
.bell:hover { background: var(--slate-50); }
.bell-count { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--coral); color: #fff; font-size: 0.66rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.nf-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--slate-100); border-radius: 12px; background: var(--slate-50); margin-bottom: 8px; cursor: pointer; }
.nf-row.is-unread { background: var(--blue-50); border-color: #bfdbfe; }
.nf-row .nf-kind { flex-shrink: 0; }
.nf-row .nf-title { font-weight: 600; }
.nf-row .nf-body { font-size: 0.84rem; color: var(--slate-600); margin-top: 2px; white-space: pre-wrap; }
.nf-row .nf-when { font-size: 0.76rem; color: var(--slate-500); margin-left: auto; white-space: nowrap; }
.msg-layout { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
.msg-threads .admin-card, .msg-thread { min-width: 0; }
.thread-row { padding: 10px 12px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.thread-row:hover { background: var(--slate-50); }
.thread-row.is-active { background: var(--blue-50); border-color: #bfdbfe; }
.thread-row strong { display: block; font-size: 0.9rem; }
.thread-row .help-text { margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-row .unread-dot { float: right; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--blue-600); color: #fff; font-size: 0.66rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.msg-list { display: flex; flex-direction: column; gap: 10px; max-height: 55vh; overflow: auto; padding: 4px 0; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 14px; background: var(--slate-100); font-size: 0.9rem; white-space: pre-wrap; }
.msg.mine { align-self: flex-end; background: var(--blue-600); color: #fff; }
.msg .msg-meta { display: block; font-size: 0.72rem; opacity: 0.75; margin-top: 4px; }
.msg-reply { display: flex; gap: 10px; margin-top: 14px; align-items: flex-end; }
.msg-reply textarea { flex: 1; min-height: 70px; padding: 10px 14px; border: 1px solid var(--slate-200); border-radius: var(--radius-sm); font: inherit; font-size: 0.875rem; color: var(--text); background: #fff; resize: vertical; }
.msg-reply textarea:focus { outline: none; border-color: transparent; box-shadow: 0 0 0 2px var(--blue-500); }
@media (max-width: 900px) { .msg-layout { grid-template-columns: 1fr; } }

/* ---------- Course structure ---------- */
.struct-unit { border: 1px solid var(--slate-200); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: var(--slate-50); }
.struct-unit-head, .struct-topic { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.struct-unit-head strong { font-size: 0.95rem; }
.struct-topic { padding: 8px 0 8px 18px; border-top: 1px solid var(--slate-200); font-size: 0.875rem; }
.struct-topic .help-text { margin: 0 0 0 6px; display: inline; }
.struct-lessons { font-size: 0.8rem; color: var(--slate-500); margin: 2px 0 0 18px; }
.place-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.place-picker select { width: 100%; }

/* ---------- Dashboard: chart, calendar, request lists ---------- */
.dash-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; margin-bottom: 4px; }
.dash-grid .admin-card { margin-bottom: 20px; min-width: 0; }
.dash-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.dash-card-head h2 { margin-bottom: 4px; }
.dash-card-head .help-text { margin-top: 0; }
.stat-link { display: block; color: inherit; }
.stat-link:hover .stat-value { color: var(--blue-600); }
.trend-chart svg { display: block; max-width: 100%; height: auto; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.78rem; color: var(--slate-600); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-item i { display: inline-block; width: 18px; height: 8px; border-radius: 3px; }

.calendar { user-select: none; }
.cal-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 4px; }
.cal-head span { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--slate-500); text-align: center; padding: 4px 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-cell { min-width: 0; min-height: 72px; padding: 6px; border: 1px solid var(--slate-100); border-radius: 10px; background: var(--slate-50); cursor: pointer; display: flex; flex-direction: column; gap: 3px; transition: border-color var(--transition), background var(--transition); }
.cal-cell:hover { border-color: var(--blue-500); background: #fff; }
.cal-cell.cal-empty { background: transparent; border-color: transparent; cursor: default; }
.cal-cell.cal-today { border-color: var(--teal-500); background: var(--teal-50); }
.cal-day { font-size: 0.78rem; font-weight: 700; color: var(--slate-600); }
.cal-today .cal-day { color: var(--teal-600); }
.cal-ev { display: block; font-size: 0.68rem; font-weight: 600; line-height: 1.25; padding: 2px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--slate-200); color: var(--slate-700); }
.cal-ev:hover { filter: brightness(0.95); }
.ev-exam { background: #fee2e2; color: #b91c1c; }
.ev-deadline { background: #fef3c7; color: #b45309; }
.ev-holiday { background: #dcfce7; color: #15803d; }
.ev-class { background: var(--blue-50); color: var(--blue-600); }
.ev-lesson { background: var(--teal-50); color: var(--teal-600); border-left: 3px solid var(--teal-500); }
.cal-more { font-size: 0.66rem; color: var(--slate-500); }

.req-list { display: flex; flex-direction: column; gap: 10px; }
.req-row { display: flex; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid var(--slate-100); border-radius: 12px; background: var(--slate-50); }
.req-main { min-width: 0; flex: 1; font-size: 0.875rem; }
.req-msg { margin-top: 6px; font-size: 0.84rem; color: var(--slate-600); white-space: pre-wrap; }
.req-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; flex-shrink: 0; }
.req-actions select { padding: 6px 10px; border: 1px solid var(--slate-200); border-radius: 9px; font: inherit; font-size: 0.8rem; background: #fff; }

@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .cal-cell { min-height: 54px; padding: 4px; flex-direction: row; flex-wrap: wrap; align-content: flex-start; } .cal-day { width: 100%; } .cal-ev { font-size: 0; width: 8px; height: 8px; padding: 0; border-radius: 50%; } .cal-more { font-size: 0; } .req-row { flex-direction: column; } }
