/* ============================================================
   EduPlatform — main.css
   Premium dark-slate education SaaS design
   Font: Syne (display) + DM Sans (body)
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  /* Brand */
  --brand: #4f7ef8;
  --brand-light: #6b92f9;
  --brand-dark: #3560d4;
  --brand-glow: rgba(79, 126, 248, 0.25);

  /* Surfaces */
  --bg: #0c1120;
  --bg-2: #111827;
  --bg-3: #1a2440;
  --surface: #141e30;
  --surface-2: #1c2a42;
  --surface-3: #243350;

  /* Borders */
  --border: rgba(255, 255, 255, 0.07);
  --border-med: rgba(255, 255, 255, 0.12);

  /* Text */
  --text: #e8eef8;
  --text-muted: #7a8fad;
  --text-dim: #4a5f7a;

  /* Status */
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --purple: #a78bfa;
  --rose: #fb7185;
  --cyan: #22d3ee;

  /* Semantic */
  --success-bg: rgba(34, 197, 94, 0.1);
  --success-border: rgba(34, 197, 94, 0.3);
  --warning-bg: rgba(245, 158, 11, 0.1);
  --warning-border: rgba(245, 158, 11, 0.3);
  --danger-bg: rgba(239, 68, 68, 0.1);
  --danger-border: rgba(239, 68, 68, 0.3);
  --info-bg: rgba(34, 211, 238, 0.1);
  --info-border: rgba(34, 211, 238, 0.3);

  /* Layout */
  --sidebar-w: 260px;
  --sidebar-collapsed: 68px;
  --topbar-h: 60px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  /* Shadows */
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
  --shadow-brand: 0 4px 20px rgba(79, 126, 248, 0.3);

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  line-height: 1.2;
}

a { color: var(--brand-light); text-decoration: none; }
a:hover { color: var(--brand); }

img { max-width: 100%; }

/* ── App Shell ──────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-left: var(--sidebar-w);
  transition: margin-left 0.3s var(--ease);
}

.main-col.sidebar-collapsed { margin-left: var(--sidebar-collapsed); }

.page-content {
  flex: 1;
  padding: 2rem 2rem 3rem;
  max-width: 1400px;
  width: 100%;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width 0.3s var(--ease);
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .user-info { display: none; }
.sidebar.collapsed .brand-logo { margin: 0 auto; }
.sidebar.collapsed .sidebar-toggle-btn { transform: rotate(180deg); }

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.25rem 1.1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.brand-logo {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-brand);
}

.brand-name {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text);
  display: block;
  white-space: nowrap;
}

.brand-role {
  font-size: .72rem;
  color: var(--text-muted);
  letter-spacing: .04em;
  white-space: nowrap;
}

.sidebar-toggle-btn {
  margin-left: auto;
  width: 28px; height: 28px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  transition: all .2s;
  flex-shrink: 0;
}
.sidebar-toggle-btn:hover { background: var(--surface-3); color: var(--text); }

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: .75rem .75rem;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}

.nav-section-label {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: .9rem .6rem .35rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem .85rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .875rem;
  font-weight: 500;
  transition: all .18s var(--ease);
  white-space: nowrap;
  position: relative;
}

.nav-link i { width: 18px; text-align: center; font-size: .95rem; flex-shrink: 0; }
.nav-link span { display: flex; align-items: center; gap: .5rem; }

.nav-link:hover { background: var(--surface-2); color: var(--text); }

.nav-link.active {
  background: rgba(79, 126, 248, 0.12);
  color: var(--brand-light);
  border: 1px solid rgba(79, 126, 248, 0.2);
}
.nav-link.active i { color: var(--brand); }

/* Sidebar footer */
.sidebar-footer {
  padding: .85rem .85rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-shrink: 0;
}

.user-pill { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 0; }
.user-name { font-size: .825rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role-label { font-size: .72rem; color: var(--text-muted); }

.logout-btn {
  width: 34px; height: 34px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all .18s;
  flex-shrink: 0;
}
.logout-btn:hover { background: var(--danger-bg); color: var(--red); border-color: var(--danger-border); }

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
}

.topbar-left { display: flex; align-items: center; gap: 1rem; }
.topbar-right { display: flex; align-items: center; gap: .75rem; }

.mobile-menu-btn {
  display: none;
  width: 36px; height: 36px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 1rem;
}

.topbar-btn {
  width: 38px; height: 38px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  transition: all .18s;
}
.topbar-btn:hover { background: var(--surface-3); color: var(--text); }

/* Notification dropdown */
.notif-wrapper { position: relative; }

.notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 18px; height: 18px;
  background: var(--red);
  border-radius: 999px;
  font-size: .65rem;
  font-weight: 700;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--surface);
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all .2s var(--ease);
  z-index: 200;
  overflow: hidden;
}
.notif-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }

.notif-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 1.1rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: .875rem;
}
.notif-count-label { font-size: .75rem; color: var(--brand-light); font-weight: 500; }

.notif-list { max-height: 320px; overflow-y: auto; }

.notif-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  transition: background .15s;
  position: relative;
}
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: rgba(79, 126, 248, 0.05); }

.notif-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .875rem;
  flex-shrink: 0;
}
.notif-icon-new_lesson { background: rgba(79,126,248,.15); color: var(--brand); }
.notif-icon-new_assignment { background: rgba(167,139,250,.15); color: var(--purple); }
.notif-icon-new_test { background: rgba(245,158,11,.15); color: var(--amber); }
.notif-icon-graded { background: rgba(34,197,94,.15); color: var(--green); }
.notif-icon-general { background: var(--surface-3); color: var(--text-muted); }

.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: .825rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-time { font-size: .72rem; color: var(--text-muted); margin-top: 2px; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex-shrink: 0; }

.notif-empty { padding: 2rem 1rem; text-align: center; color: var(--text-muted); }
.notif-empty i { font-size: 1.75rem; margin-bottom: .5rem; display: block; }
.notif-empty p { font-size: .85rem; }

.notif-footer-link {
  display: block;
  padding: .7rem 1rem;
  text-align: center;
  font-size: .82rem;
  color: var(--brand-light);
  border-top: 1px solid var(--border);
  transition: background .15s;
}
.notif-footer-link:hover { background: var(--surface-2); color: var(--brand); }

/* Topbar user */
.topbar-user { display: flex; align-items: center; gap: .6rem; }
.topbar-username { font-size: .85rem; font-weight: 500; }
.user-avatar-sm {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* ── Flash messages ─────────────────────────────────────────── */
.flash-zone { padding: .75rem 2rem 0; }

.flash {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  margin-bottom: .5rem;
  animation: slideDown .25s var(--ease);
  border-left: 3px solid;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.flash-success { background: var(--success-bg); border-color: var(--green); color: var(--green); }
.flash-danger  { background: var(--danger-bg);  border-color: var(--red);   color: var(--red); }
.flash-warning { background: var(--warning-bg); border-color: var(--amber); color: var(--amber); }
.flash-info    { background: var(--info-bg);    border-color: var(--cyan);  color: var(--cyan); }

.flash span { flex: 1; }
.flash-close {
  background: none; border: none; cursor: pointer;
  color: inherit; opacity: .6; font-size: .875rem;
  padding: 0 4px;
  transition: opacity .15s;
}
.flash-close:hover { opacity: 1; }

/* ── Page header ────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}
.page-title { font-size: 1.65rem; color: var(--text); margin-bottom: .2rem; }
.page-sub { font-size: .9rem; color: var(--text-muted); }

/* ── Stat cards ─────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: relative;
  overflow: hidden;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-icon {
  width: 46px; height: 46px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.stat-value { font-family: 'Syne', sans-serif; font-size: 1.75rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: .78rem; color: var(--text-muted); margin-top: .25rem; }

.stat-glow {
  position: absolute;
  top: -20px; right: -20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: .15;
}

/* Variants */
.stat-blue  .stat-icon { background: rgba(79,126,248,.18); color: var(--brand); }
.stat-blue  .stat-value { color: var(--brand-light); }
.stat-blue  .stat-glow { background: var(--brand); }

.stat-green .stat-icon { background: rgba(34,197,94,.15); color: var(--green); }
.stat-green .stat-value { color: var(--green); }
.stat-green .stat-glow { background: var(--green); }

.stat-amber .stat-icon { background: rgba(245,158,11,.15); color: var(--amber); }
.stat-amber .stat-value { color: var(--amber); }
.stat-amber .stat-glow { background: var(--amber); }

.stat-purple .stat-icon { background: rgba(167,139,250,.15); color: var(--purple); }
.stat-purple .stat-value { color: var(--purple); }
.stat-purple .stat-glow { background: var(--purple); }

.stat-rose  .stat-icon { background: rgba(251,113,133,.15); color: var(--rose); }
.stat-rose  .stat-value { color: var(--rose); }
.stat-rose  .stat-glow { background: var(--rose); }

/* ── Dashboard grid ─────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }

/* ── Dash card ──────────────────────────────────────────────── */
.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.dash-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.dash-card-header h3 {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.dash-card-header h3 i { color: var(--brand); }

/* ── Card (generic wrapper) ─────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-toolbar {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.card-footer {
  padding: .75rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
}

/* ── Data table ─────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.data-table thead tr { border-bottom: 1px solid var(--border); }
.data-table th {
  padding: .75rem 1.25rem;
  text-align: left;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.data-table td { padding: .875rem 1.25rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(255,255,255,.025); }
.data-table tbody tr.lb-gold { background: rgba(234,179,8,.05); }
.data-table tbody tr.lb-silver { background: rgba(148,163,184,.04); }
.data-table tbody tr.lb-bronze { background: rgba(180,83,9,.04); }
.data-table tbody tr.lb-me { background: rgba(79,126,248,.06); }
.empty-cell { text-align: center; color: var(--text-muted); padding: 3rem; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .18s var(--ease);
  white-space: nowrap;
  text-decoration: none;
}
.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand-dark);
  box-shadow: 0 2px 8px rgba(79,126,248,.3);
}
.btn-primary:hover { background: var(--brand-light); color: #fff; box-shadow: 0 4px 16px rgba(79,126,248,.4); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-med);
}
.btn-secondary:hover { background: var(--surface-3); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-danger-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-danger-ghost:hover { background: var(--danger-bg); color: var(--red); border-color: var(--danger-border); }

.btn-sm  { padding: .4rem .85rem; font-size: .825rem; }
.btn-xs  { padding: .28rem .65rem; font-size: .78rem; }
.btn-lg  { padding: .75rem 1.5rem; font-size: .95rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
}
.form-section-title {
  font-family: 'Syne', sans-serif;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding-bottom: .75rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.col-span-2 { grid-column: span 2; }
.align-self-end { align-self: flex-end; }

.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-label { font-size: .825rem; font-weight: 500; color: var(--text-muted); }
.form-hint { font-size: .75rem; color: var(--text-dim); margin-top: .2rem; }

.form-input, .form-select, .form-textarea {
  background: var(--bg-2);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-sm);
  padding: .6rem .9rem;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: .875rem;
  transition: border-color .18s, box-shadow .18s;
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.form-textarea { resize: vertical; min-height: 90px; }
.form-select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%237a8fad' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .65rem center; background-size: 16px; padding-right: 2.2rem; }
.form-select-sm { padding: .35rem .7rem; font-size: .8rem; }
.form-color { padding: .3rem .4rem; height: 42px; cursor: pointer; }
.form-file { padding: .4rem .9rem; }

.input-wrap { position: relative; }
.input-icon { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--text-dim); font-size: .875rem; pointer-events: none; }
.input-wrap .form-input { padding-left: 2.5rem; }

.pw-toggle { position: absolute; right: .75rem; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: .875rem; }

.check-label { display: flex; align-items: center; gap: .6rem; cursor: pointer; font-size: .875rem; color: var(--text-muted); }
.check-input { width: 16px; height: 16px; accent-color: var(--brand); }
.form-check-row { margin-bottom: .25rem; }

.form-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }

/* ── Badges & tags ──────────────────────────────────────────── */
.pts-badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  background: rgba(79,126,248,.15);
  color: var(--brand-light);
}
.pts-badge-lg { padding: .3rem .85rem; font-size: .9rem; }

.badge-pill {
  display: inline-flex; align-items: center;
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  background: rgba(239,68,68,.15);
  color: var(--red);
}

.status-badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .2rem .65rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
}
.status-active   { background: rgba(34,197,94,.12); color: var(--green); }
.status-inactive { background: rgba(148,163,184,.1); color: var(--text-muted); }
.status-pending  { background: rgba(245,158,11,.12); color: var(--amber); }
.status-warn     { background: rgba(251,113,133,.12); color: var(--rose); }

.tag {
  display: inline-flex;
  padding: .15rem .55rem;
  border-radius: 5px;
  font-size: .75rem;
  font-weight: 500;
  background: var(--surface-3);
  color: var(--text-muted);
}
.tag-new_lesson     { background: rgba(79,126,248,.12); color: var(--brand-light); }
.tag-new_assignment { background: rgba(167,139,250,.12); color: var(--purple); }
.tag-new_test       { background: rgba(245,158,11,.12); color: var(--amber); }
.tag-general        { background: var(--surface-3); color: var(--text-muted); }

.team-badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .2rem .65rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--tc, var(--brand)) 15%, transparent);
  color: var(--tc, var(--brand));
}
.team-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

.badge-tag { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .55rem; border-radius: 6px; font-size: .72rem; font-weight: 500; }
.badge-quiz       { background: rgba(79,126,248,.12); color: var(--brand-light); }
.badge-assignment { background: rgba(167,139,250,.12); color: var(--purple); }
.badge-video      { background: rgba(251,113,133,.12); color: var(--rose); }
.badge-file       { background: rgba(34,197,94,.12); color: var(--green); }

.you-badge { background: rgba(79,126,248,.2); color: var(--brand-light); padding: .1rem .45rem; border-radius: 4px; font-size: .7rem; font-weight: 600; }

/* ── User avatars ───────────────────────────────────────────── */
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.user-avatar-xs {
  width: 28px; height: 28px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem; font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.user-cell { display: flex; align-items: center; gap: .65rem; }

/* ── Leaderboard mini ───────────────────────────────────────── */
.leaderboard-mini { padding: .5rem 1.25rem 1rem; }
.lb-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem .5rem;
  border-radius: var(--radius-sm);
  transition: background .15s;
}
.lb-row:hover { background: var(--surface-2); }
.lb-rank { font-size: .8rem; font-weight: 700; color: var(--text-dim); min-width: 22px; text-align: center; }
.lb-name { flex: 1; font-size: .875rem; font-weight: 500; }
.lb-pts { font-family: 'Syne', sans-serif; font-weight: 700; font-size: .9rem; color: var(--brand-light); }
.lb-gold   { background: rgba(234,179,8,.06); }
.lb-silver { background: rgba(148,163,184,.04); }
.lb-bronze { background: rgba(180,83,9,.04); }

/* ── Item lists ─────────────────────────────────────────────── */
.item-list { list-style: none; }
.item-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.item-row:last-child { border-bottom: none; }
.item-row:hover { background: rgba(255,255,255,.025); }
.item-unread { background: rgba(79,126,248,.04); }
.item-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .875rem;
  flex-shrink: 0;
  background: var(--surface-2);
  color: var(--brand);
}
.item-body { flex: 1; min-width: 0; }
.item-title { font-size: .875rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-sub { font-size: .75rem; color: var(--text-muted); margin-top: 1px; }

/* ── Search form ────────────────────────────────────────────── */
.search-form { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.tab-filter { display: flex; gap: .35rem; }
.tab-btn {
  padding: .35rem .85rem;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all .15s;
}
.tab-btn.active { background: rgba(79,126,248,.15); color: var(--brand-light); border-color: rgba(79,126,248,.3); }
.tab-btn:hover:not(.active) { background: var(--surface-3); color: var(--text); }

/* ── Action buttons group ───────────────────────────────────── */
.action-btns { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }

/* ── Modals ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  animation: modalIn .2s var(--ease);
}
.modal-lg { max-width: 600px; }
@keyframes modalIn { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: scale(1); } }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1rem; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.1rem; padding: .2rem; transition: color .15s; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; gap: .75rem; justify-content: flex-end; }

/* ── Pagination ─────────────────────────────────────────────── */
.pagination-nav { display: flex; align-items: center; gap: .35rem; }
.page-btn {
  min-width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 500;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all .15s;
  cursor: pointer;
}
.page-btn:hover:not(.disabled):not(.dots) { background: var(--surface-3); color: var(--text); }
.page-btn.active { background: var(--brand); color: #fff; border-color: var(--brand-dark); }
.page-btn.disabled { opacity: .4; cursor: not-allowed; }
.page-btn.dots { cursor: default; }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  display: flex;
  gap: .6rem;
  align-items: flex-start;
  border: 1px solid;
}
.alert-success { background: var(--success-bg); border-color: var(--success-border); color: var(--green); }
.alert-warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--amber); }
.alert-danger  { background: var(--danger-bg);  border-color: var(--danger-border);  color: var(--red); }
.alert-info    { background: var(--info-bg);    border-color: var(--info-border);    color: var(--cyan); }
.alert-header  { font-weight: 600; margin-bottom: .5rem; }
.error-list    { list-style: disc; padding-left: 1.25rem; }
.error-list li { margin-top: .25rem; }
.alert-inline { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .7rem; border-radius: 6px; font-size: .8rem; }

/* ── Empty states ───────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  padding: 4rem 2rem; text-align: center; color: var(--text-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: 1rem; color: var(--text-dim); }
.empty-state h3 { color: var(--text-muted); margin-bottom: .5rem; }
.empty-state p { font-size: .9rem; }

.empty-state-sm {
  display: flex; align-items: center; justify-content: center; gap: .75rem;
  padding: 1.5rem; color: var(--text-muted); font-size: .875rem;
}
.empty-state-sm i { font-size: 1.25rem; }

/* ── Teams grid ─────────────────────────────────────────────── */
.teams-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; }
.team-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.team-card-top { padding: 1.5rem; display: flex; align-items: center; justify-content: space-between; position: relative; }
.team-avatar { width: 52px; height: 52px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; font-weight: 800; color: #fff; font-family: 'Syne', sans-serif; }
.team-rank-badge { font-size: 1.5rem; }
.team-card-body { padding: 1rem 1.25rem; flex: 1; }
.team-name { font-size: 1.05rem; margin-bottom: .3rem; }
.team-desc { font-size: .825rem; color: var(--text-muted); margin-bottom: 1rem; }
.team-stats { display: flex; gap: 1.5rem; margin-bottom: 1rem; }
.team-stat { text-align: center; }
.ts-value { font-family: 'Syne', sans-serif; font-size: 1.25rem; font-weight: 700; color: var(--text); }
.ts-label { font-size: .72rem; color: var(--text-muted); }
.team-members-mini { display: flex; gap: .3rem; flex-wrap: wrap; }
.team-card-footer { padding: .85rem 1.25rem; border-top: 1px solid var(--border); display: flex; gap: .6rem; }

/* ── Sections grid ──────────────────────────────────────────── */
.sections-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; }
.section-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; display: flex; align-items: center; gap: 1.1rem;
  color: var(--text); transition: all .2s var(--ease);
}
.section-card:hover { background: var(--surface-2); border-color: var(--border-med); transform: translateY(-1px); box-shadow: var(--shadow); color: var(--text); }
.section-card-icon { width: 52px; height: 52px; background: rgba(79,126,248,.12); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 1.25rem; color: var(--brand); flex-shrink: 0; }
.section-card-body { flex: 1; min-width: 0; }
.section-card-title { font-size: 1rem; margin-bottom: .25rem; }
.section-card-desc { font-size: .825rem; color: var(--text-muted); margin-bottom: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.section-card-meta { display: flex; gap: .5rem; flex-wrap: wrap; }
.meta-pill { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 5px; font-size: .72rem; font-weight: 500; background: var(--surface-3); color: var(--text-muted); }
.meta-pill.meta-warn { background: rgba(245,158,11,.12); color: var(--amber); }
.section-card-arrow { color: var(--text-dim); }

/* ── Lessons list ───────────────────────────────────────────── */
.lessons-list { display: flex; flex-direction: column; gap: .75rem; }
.lesson-row {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem 1.5rem; display: flex; align-items: center; gap: 1.25rem;
  transition: all .2s;
}
.lesson-row:hover { border-color: var(--border-med); box-shadow: var(--shadow); }
.lesson-row-num { width: 32px; height: 32px; border-radius: 8px; background: var(--surface-3); display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; color: var(--text-muted); flex-shrink: 0; }
.lesson-row-body { flex: 1; min-width: 0; }
.lesson-row-header { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .4rem; }
.lesson-row-title { font-size: 1rem; }
.lesson-row-title a { color: var(--text); }
.lesson-row-title a:hover { color: var(--brand-light); }
.lesson-badges { display: flex; gap: .35rem; flex-wrap: wrap; }
.lesson-row-preview { font-size: .825rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lesson-row-status { display: flex; align-items: center; gap: .75rem; flex-shrink: 0; }

/* ── Lesson detail ──────────────────────────────────────────── */
.lesson-layout { display: grid; grid-template-columns: 1fr 280px; gap: 1.5rem; }
.lesson-main { display: flex; flex-direction: column; gap: 1.5rem; }
.lesson-sidebar { display: flex; flex-direction: column; gap: 1.25rem; }
.lesson-status-pills { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.lesson-section-card { }

.lesson-video-wrap { position: relative; padding-bottom: 56.25%; height: 0; border-radius: var(--radius); overflow: hidden; background: #000; }
.lesson-video { position: absolute; inset: 0; width: 100%; height: 100%; }

.lesson-content-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.75rem; }
.lesson-content.prose { font-size: .925rem; line-height: 1.8; color: var(--text); }
.lesson-content.prose h1,.lesson-content.prose h2,.lesson-content.prose h3 { font-family: 'Syne', sans-serif; margin: 1.25rem 0 .5rem; }
.lesson-content.prose p { margin-bottom: 1rem; }
.lesson-content.prose pre { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; overflow-x: auto; margin: 1rem 0; }
.lesson-content.prose code { font-size: .85em; background: var(--bg-3); padding: .1rem .4rem; border-radius: 4px; }
.lesson-content.prose ul,
.lesson-content.prose ol { padding-left: 1.5rem; margin-bottom: 1rem; }

/* Lesson section nav */
.section-nav-list { list-style: none; display: flex; flex-direction: column; gap: .2rem; }
.section-nav-item a { display: flex; align-items: center; gap: .6rem; padding: .45rem .6rem; border-radius: 6px; font-size: .825rem; color: var(--text-muted); transition: all .15s; }
.section-nav-item a:hover { background: var(--surface-2); color: var(--text); }
.section-nav-item.active a { background: rgba(79,126,248,.1); color: var(--brand-light); font-weight: 500; }
.snl-num { width: 22px; height: 22px; border-radius: 5px; background: var(--surface-3); display: flex; align-items: center; justify-content: center; font-size: .7rem; flex-shrink: 0; }

/* Attachments */
.attachment-list-sm { list-style: none; padding: .5rem 1.25rem 1rem; display: flex; flex-direction: column; gap: .5rem; }
.attachment-link { display: flex; align-items: center; gap: .65rem; padding: .6rem .75rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-2); color: var(--text); transition: all .15s; }
.attachment-link:hover { border-color: var(--border-med); background: var(--surface-2); color: var(--text); }
.att-icon { width: 32px; height: 32px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: .9rem; flex-shrink: 0; background: rgba(79,126,248,.12); color: var(--brand); }
.att-info { flex: 1; min-width: 0; }
.att-name { display: block; font-size: .825rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-size { font-size: .72rem; color: var(--text-muted); }
.att-dl { color: var(--text-dim); flex-shrink: 0; }

/* ── Result banners ─────────────────────────────────────────── */
.result-banner {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  margin-top: 1rem;
}
.result-perfect { background: linear-gradient(90deg, rgba(234,179,8,.12), rgba(234,179,8,.05)); border: 1px solid rgba(234,179,8,.3); }
.result-pass    { background: var(--success-bg); border: 1px solid var(--success-border); }
.result-fail    { background: var(--info-bg); border: 1px solid var(--info-border); }
.result-icon { font-size: 1.5rem; }
.result-score { font-family: 'Syne', sans-serif; font-size: 1.1rem; font-weight: 700; }
.result-label { font-size: .8rem; color: var(--text-muted); }

/* ── Result hero ────────────────────────────────────────────── */
.result-hero {
  display: flex; align-items: center; gap: 2.5rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem 2.5rem;
}
.result-circle { position: relative; width: 160px; height: 160px; flex-shrink: 0; }
.result-svg { width: 100%; height: 100%; }
.result-arc { transition: stroke-dasharray 1s var(--ease); }
.rc-great { color: var(--green); }
.rc-ok    { color: var(--amber); }
.rc-low   { color: var(--rose); }
.result-inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ri-score { font-family: 'Syne', sans-serif; font-size: 1.75rem; font-weight: 800; line-height: 1; }
.ri-score span { font-size: 1rem; font-weight: 500; color: var(--text-muted); }
.ri-pct { font-size: .85rem; color: var(--text-muted); margin-top: .25rem; }
.result-summary { flex: 1; }
.rs-grade { font-family: 'Syne', sans-serif; font-size: 1.4rem; font-weight: 700; margin-bottom: .75rem; }
.rs-great { color: var(--green); }
.rs-ok    { color: var(--amber); }
.rs-low   { color: var(--rose); }
.rs-desc  { font-size: .925rem; color: var(--text-muted); margin-bottom: .5rem; }

/* Answer review */
.answer-review-list { padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: .85rem; }
.ar-item { border-radius: var(--radius-sm); padding: 1rem 1.25rem; border: 1px solid var(--border); }
.ar-correct { background: rgba(34,197,94,.05); border-color: rgba(34,197,94,.2); }
.ar-wrong   { background: rgba(239,68,68,.04); border-color: rgba(239,68,68,.15); }
.ar-header  { display: flex; align-items: center; gap: .75rem; margin-bottom: .6rem; }
.ar-qnum    { font-size: .75rem; font-weight: 700; color: var(--text-dim); }
.ar-result  { font-size: .8rem; font-weight: 600; display: flex; align-items: center; gap: .35rem; }
.ar-correct .ar-result { color: var(--green); }
.ar-wrong   .ar-result { color: var(--red); }
.ar-question { font-size: .9rem; font-weight: 500; margin-bottom: .75rem; }
.ar-answers { display: flex; flex-direction: column; gap: .35rem; }
.ar-ans     { display: flex; align-items: center; gap: .5rem; font-size: .825rem; }
.ar-ans-label { color: var(--text-muted); min-width: 100px; }
.ar-ans-val { font-weight: 500; padding: .15rem .55rem; border-radius: 5px; }
.ans-correct { background: rgba(34,197,94,.12); color: var(--green); }
.ans-wrong   { background: rgba(239,68,68,.1);  color: var(--red); }

/* ── Quiz shell ─────────────────────────────────────────────── */
.quiz-shell { display: flex; flex-direction: column; gap: 1.25rem; max-width: 760px; }
.quiz-meta-pills { display: flex; gap: .5rem; flex-wrap: wrap; }
.quiz-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  transition: border-color .2s;
}
.quiz-card.qcard-answered { border-color: rgba(79,126,248,.3); }
.quiz-card-header { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.qc-num { font-size: .75rem; font-weight: 700; color: var(--brand-light); text-transform: uppercase; letter-spacing: .08em; }
.qc-pts { margin-left: auto; font-size: .78rem; color: var(--text-muted); }
.qc-text { font-size: 1rem; font-weight: 500; margin-bottom: 1.25rem; line-height: 1.5; }
.qc-options { display: flex; flex-direction: column; gap: .65rem; }

.qc-option { cursor: pointer; }
.qc-option input[type="radio"] { display: none; }
.qc-option-box {
  display: flex; align-items: center; gap: .85rem;
  padding: .75rem 1rem;
  border: 1px solid var(--border-med);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  transition: all .18s;
  background: var(--bg-2);
}
.qc-option input:checked + .qc-option-box {
  border-color: var(--brand);
  background: rgba(79,126,248,.1);
  color: var(--brand-light);
}
.qc-option:hover .qc-option-box { border-color: var(--border-med); background: var(--surface-2); }
.qc-option-letter {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: var(--surface-3);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}
.qc-option input:checked + .qc-option-box .qc-option-letter {
  background: var(--brand);
  color: #fff;
}

.quiz-submit-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.quiz-progress-info { font-size: .875rem; color: var(--text-muted); }

/* Timer */
.timer-badge {
  display: flex; align-items: center; gap: .5rem;
  padding: .45rem 1rem;
  border-radius: 999px;
  background: rgba(245,158,11,.12);
  border: 1px solid rgba(245,158,11,.25);
  color: var(--amber);
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1rem;
}
.timer-warn     { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.3); color: var(--red); animation: timerPulse 1s ease-in-out infinite; }
.timer-critical { animation: timerPulse .5s ease-in-out infinite; }
@keyframes timerPulse { 0%,100% { opacity: 1; } 50% { opacity: .7; } }

/* ── Tests grid ─────────────────────────────────────────────── */
.tests-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; }
.test-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: all .2s; }
.test-card:hover { border-color: var(--border-med); box-shadow: var(--shadow); }
.test-card.test-completed { border-color: rgba(34,197,94,.2); }
.test-card-header { padding: 1.25rem 1.25rem .5rem; display: flex; align-items: center; justify-content: space-between; }
.test-card-icon { width: 44px; height: 44px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; background: rgba(79,126,248,.1); color: var(--brand); }
.test-completed .test-card-icon { background: rgba(34,197,94,.1); color: var(--green); }
.test-score-pill { padding: .2rem .65rem; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.tsp-great { background: rgba(34,197,94,.12); color: var(--green); }
.tsp-ok    { background: rgba(245,158,11,.12); color: var(--amber); }
.tsp-low   { background: rgba(239,68,68,.1);  color: var(--red); }
.test-card-body { padding: .75rem 1.25rem 1rem; flex: 1; }
.test-card-title { font-size: 1rem; margin-bottom: .35rem; }
.test-card-desc  { font-size: .825rem; color: var(--text-muted); margin-bottom: .75rem; }
.test-card-meta  { display: flex; gap: .4rem; flex-wrap: wrap; }
.test-card-footer { padding: .85rem 1.25rem; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: .6rem; }

/* ── Assignment editor ──────────────────────────────────────── */
.submit-layout { display: grid; grid-template-columns: 1fr 300px; gap: 1.5rem; }
.submit-editor-col { display: flex; flex-direction: column; }
.submit-sidebar { display: flex; flex-direction: column; gap: 1.25rem; }

.editor-toolbar {
  display: flex; align-items: center; gap: .4rem;
  padding: .6rem 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.editor-tool-btn {
  width: 30px; height: 30px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem;
  transition: all .15s;
}
.editor-tool-btn:hover { background: var(--surface-3); color: var(--text); }
.editor-lang-label { margin-left: auto; font-size: .7rem; font-weight: 700; color: var(--text-dim); letter-spacing: .1em; text-transform: uppercase; }

.editor-footer {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .75rem 1rem;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.char-count { font-size: .75rem; color: var(--text-dim); }

/* Override CodeMirror */
.CodeMirror { background: #1a1f2e !important; color: #cdd6f4 !important; font-family: 'JetBrains Mono', 'Fira Code', monospace !important; font-size: 13.5px !important; }
.CodeMirror-gutters { background: #141820 !important; border-right: 1px solid #2a3248 !important; }
.CodeMirror-linenumber { color: #4a5f7a !important; }
.code-view-area { display: none; }

/* Admin review */
.review-grid { display: grid; grid-template-columns: 1fr 380px; gap: 1.5rem; }
.student-info-bar { display: flex; align-items: center; gap: .65rem; padding: .75rem 1.25rem; border-bottom: 1px solid var(--border); background: var(--bg-2); }
.assignment-desc { padding: .5rem; }
.feedback-box { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; margin-top: 1rem; }
.feedback-label { font-size: .8rem; font-weight: 600; color: var(--text-muted); margin-bottom: .5rem; display: flex; align-items: center; gap: .35rem; }
.feedback-box-sm { padding: .75rem; font-size: .875rem; color: var(--text-muted); }
.assignment-desc-preview { font-size: .85rem; color: var(--text-muted); background: var(--bg-2); padding: .75rem; border-radius: var(--radius-sm); margin-top: .5rem; }
.assignment-desc-full { font-size: .9rem; color: var(--text-muted); line-height: 1.65; }
.tips-list { list-style: none; display: flex; flex-direction: column; gap: .5rem; }
.tips-list li { font-size: .825rem; color: var(--text-muted); display: flex; gap: .5rem; }
.tips-list li::before { content: "→"; color: var(--brand); flex-shrink: 0; }

/* Deadline */
.deadline-pill { display: inline-flex; align-items: center; gap: .45rem; padding: .3rem .75rem; border-radius: 6px; font-size: .8rem; background: rgba(245,158,11,.1); color: var(--amber); border: 1px solid rgba(245,158,11,.2); margin-top: .75rem; }
.deadline-past { background: rgba(239,68,68,.1); color: var(--red); border-color: rgba(239,68,68,.2); }

/* ── Leaderboard page ───────────────────────────────────────── */
.my-rank-banner {
  display: flex; align-items: center; gap: 2rem;
  background: linear-gradient(90deg, rgba(79,126,248,.12), rgba(79,126,248,.04));
  border: 1px solid rgba(79,126,248,.25);
  border-radius: var(--radius);
  padding: 1.25rem 1.75rem;
  margin-bottom: 1.75rem;
}
.mrb-label { font-size: .75rem; color: var(--text-muted); margin-bottom: .2rem; }
.mrb-rank { font-family: 'Syne', sans-serif; font-size: 2rem; font-weight: 800; color: var(--brand-light); }
.mrb-sep { width: 1px; height: 40px; background: var(--border-med); }
.mrb-stat { text-align: center; }
.mrb-val { font-family: 'Syne', sans-serif; font-size: 1.25rem; font-weight: 700; }

.leaderboard-layout { display: grid; grid-template-columns: 1fr 380px; gap: 1.5rem; align-items: start; }
.lb-card { }
.lb-table { }
.lb-rank-cell { font-size: 1.2rem; }
.lb-rank-num { font-family: 'Syne', sans-serif; font-size: .9rem; font-weight: 700; color: var(--text-muted); }

/* Podium */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: .5rem; padding: 1.5rem; }
.podium-place { display: flex; flex-direction: column; align-items: center; gap: .4rem; flex: 1; }
.podium-avatar { width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: .875rem; font-weight: 700; color: #fff; }
.podium-avatar-lg { width: 58px; height: 58px; font-size: 1rem; }
.podium-crown { font-size: 1.4rem; }
.podium-name { font-size: .75rem; font-weight: 500; }
.podium-pts { font-size: .72rem; color: var(--text-muted); }
.podium-block { padding: .35rem 1rem; border-radius: 6px; font-size: .78rem; font-weight: 700; text-align: center; width: 100%; }
.p1-block { background: rgba(234,179,8,.18); color: #eab308; }
.p2-block { background: rgba(148,163,184,.12); color: #94a3b8; }
.p3-block { background: rgba(180,83,9,.15); color: #b45309; }

/* Team lb */
.team-lb-list { padding: 1rem; display: flex; flex-direction: column; gap: .6rem; }
.team-lb-row { display: flex; align-items: center; gap: .75rem; padding: .85rem 1rem; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--border); }
.team-lb-row.tlr-mine { border-color: rgba(79,126,248,.3); background: rgba(79,126,248,.05); }
.tlr-rank { font-size: 1.1rem; min-width: 30px; text-align: center; }
.tlr-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.tlr-info { flex: 1; }
.tlr-name { font-weight: 600; font-size: .9rem; display: flex; align-items: center; gap: .5rem; }
.tlr-pts { text-align: right; }
.team-detail-block { margin-bottom: 1rem; }
.team-detail-header { display: flex; align-items: center; gap: .5rem; font-size: .85rem; font-weight: 600; margin-bottom: .5rem; }
.team-member-row { display: flex; align-items: center; gap: .5rem; padding: .3rem .5rem; border-radius: 5px; font-size: .825rem; color: var(--text-muted); }

/* ── Notifications page ─────────────────────────────────────── */
.notifications-list { display: flex; flex-direction: column; gap: .75rem; }
.notif-full-item { display: flex; align-items: flex-start; gap: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.5rem; }
.notif-full-item.notif-unread { border-color: rgba(79,126,248,.2); background: rgba(79,126,248,.04); }
.nfi-icon { width: 44px; height: 44px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.nfi-body { flex: 1; }
.nfi-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .35rem; }
.nfi-title { font-weight: 600; font-size: .925rem; }
.nfi-time { font-size: .75rem; color: var(--text-muted); white-space: nowrap; }
.nfi-message { font-size: .875rem; color: var(--text-muted); margin-bottom: .6rem; }
.nfi-meta { display: flex; align-items: center; gap: .5rem; }
.badge-new { background: rgba(79,126,248,.2); color: var(--brand-light); padding: .1rem .45rem; border-radius: 4px; font-size: .7rem; font-weight: 700; }

/* ── Profile page ───────────────────────────────────────────── */
.profile-layout { display: grid; grid-template-columns: 300px 1fr; gap: 1.75rem; align-items: start; }
.profile-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; text-align: center; }
.profile-avatar-lg { width: 80px; height: 80px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: 800; color: #fff; font-family: 'Syne', sans-serif; margin: 0 auto 1rem; }
.profile-name { font-family: 'Syne', sans-serif; font-size: 1.2rem; font-weight: 700; }
.profile-email { font-size: .85rem; margin-bottom: .75rem; }
.profile-team { margin-bottom: 1rem; }
.profile-stats { display: flex; gap: 1rem; justify-content: center; margin: 1.25rem 0 1rem; }
.ps-stat { text-align: center; }
.ps-val { font-family: 'Syne', sans-serif; font-size: 1.4rem; font-weight: 700; }
.ps-label { font-size: .72rem; color: var(--text-muted); }
.profile-since { font-size: .75rem; }

.score-log-list { list-style: none; padding: .5rem 1.25rem 1rem; display: flex; flex-direction: column; gap: .5rem; }
.sl-item { display: flex; align-items: center; gap: .75rem; padding: .5rem; }
.sl-pts { font-family: 'Syne', sans-serif; font-size: 1rem; font-weight: 700; min-width: 50px; text-align: right; }
.sl-pos { color: var(--green); }
.sl-neg { color: var(--red); }
.sl-body { flex: 1; }
.sl-reason { font-size: .85rem; }

/* ── Quiz question admin list ───────────────────────────────── */
.quiz-question-list { padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: .75rem; }
.quiz-q-item { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; }
.quiz-q-header { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.quiz-q-num { font-size: .75rem; font-weight: 700; color: var(--brand-light); }
.quiz-q-type { }
.quiz-q-text { font-size: .9rem; font-weight: 500; margin-bottom: .65rem; }
.quiz-q-options { display: flex; flex-wrap: wrap; gap: .4rem; }
.quiz-opt { padding: .2rem .65rem; border-radius: 5px; font-size: .8rem; background: var(--surface-3); color: var(--text-muted); border: 1px solid var(--border); }
.opt-correct { background: rgba(34,197,94,.12); color: var(--green); border-color: rgba(34,197,94,.25); }

/* ── Import page ────────────────────────────────────────────── */
.import-grid { display: grid; grid-template-columns: 1fr 360px; gap: 1.5rem; align-items: start; }
.code-textarea { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: .82rem; background: var(--bg); }
.schema-block { padding: 1rem 1.25rem; }
.schema-block pre { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; font-size: .78rem; overflow-x: auto; }
.schema-block code { color: var(--cyan); }
.rule-list { list-style: none; padding: .5rem 1.25rem 1rem; display: flex; flex-direction: column; gap: .5rem; }
.rule-list li { font-size: .82rem; color: var(--text-muted); display: flex; align-items: flex-start; gap: .5rem; }

/* ── Sections admin ─────────────────────────────────────────── */
.section-cell { display: flex; align-items: center; gap: .65rem; }
.section-icon { width: 32px; height: 32px; border-radius: 7px; background: rgba(79,126,248,.12); color: var(--brand); display: flex; align-items: center; justify-content: center; font-size: .875rem; }
.attachment-list { display: flex; flex-direction: column; gap: .5rem; padding: .5rem 0; }
.attachment-item { display: flex; align-items: center; gap: .65rem; padding: .5rem .75rem; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .85rem; }
.attachment-item i { color: var(--red); }

/* ── Login page ─────────────────────────────────────────────── */
.login-body { background: var(--bg); min-height: 100vh; }
.login-page { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }

.login-panel-left {
  background: linear-gradient(145deg, #0d1829, #111f3a, #0d1829);
  padding: 3rem;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  overflow: hidden;
}
.lp-content { position: relative; z-index: 2; max-width: 400px; }
.lp-logo { width: 64px; height: 64px; background: linear-gradient(135deg, var(--brand), var(--brand-dark)); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; color: #fff; margin-bottom: 1.5rem; box-shadow: var(--shadow-brand); }
.lp-title { font-size: 2.5rem; font-weight: 800; color: var(--text); margin-bottom: .75rem; }
.lp-tagline { font-size: 1.05rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 2rem; }
.lp-features { display: flex; flex-direction: column; gap: .6rem; }
.lp-feat { display: flex; align-items: center; gap: .75rem; font-size: .9rem; color: var(--text-muted); }
.lp-feat i { color: var(--green); }
.lp-grid-bg {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(79,126,248,.04) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(79,126,248,.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.login-panel-right { display: flex; align-items: center; justify-content: center; padding: 3rem; background: var(--bg-2); }
.login-card { width: 100%; max-width: 400px; }
.login-card-header { margin-bottom: 2rem; }
.login-card-header h2 { font-size: 1.75rem; margin-bottom: .35rem; }
.login-card-header p { color: var(--text-muted); }

.login-form { display: flex; flex-direction: column; gap: 1.1rem; }
.login-note { text-align: center; font-size: .825rem; color: var(--text-muted); margin-top: 1.5rem; }

/* ── Performance rings ──────────────────────────────────────── */
.perf-grid { display: flex; justify-content: center; gap: 3rem; padding: 1.5rem; }
.perf-ring-wrap { position: relative; width: 120px; height: 120px; }
.perf-ring { width: 100%; height: 100%; }
.ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-val { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 1.3rem; }
.ring-sub { font-size: .7rem; color: var(--text-muted); }

/* ── Error page ─────────────────────────────────────────────── */
.error-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.error-page { text-align: center; padding: 2rem; }
.error-code { font-family: 'Syne', sans-serif; font-size: 7rem; font-weight: 800; color: var(--surface-3); line-height: 1; }
.error-icon { font-size: 3rem; color: var(--brand); margin: .5rem 0; }
.error-title { font-size: 1.75rem; margin-bottom: .5rem; }
.error-desc { color: var(--text-muted); margin-bottom: 2rem; }
.error-actions { display: flex; justify-content: center; gap: .75rem; }

/* ── Utility ────────────────────────────────────────────────── */
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: .8rem; }
.text-green { color: var(--green); }
.text-amber { color: var(--amber); }
.hidden-xs { }
.row-pinned { background: rgba(245,158,11,.04) !important; }

.link-sm { font-size: .82rem; color: var(--brand-light); }
.link-sm:hover { color: var(--brand); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .col-span-2 { grid-column: span 2; }
  .leaderboard-layout { grid-template-columns: 1fr; }
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-sidebar { grid-row: 1; }
  .submit-layout { grid-template-columns: 1fr; }
  .review-grid { grid-template-columns: 1fr; }
  .import-grid { grid-template-columns: 1fr; }
  .profile-layout { grid-template-columns: 1fr; }
  .login-panel-left { display: none; }
  .login-page { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .3s var(--ease); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-col { margin-left: 0 !important; }
  .mobile-menu-btn { display: flex; }
  .hidden-xs { display: none; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .col-span-2 { grid-column: span 1; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid-2 { grid-template-columns: 1fr; }
  .form-grid-2 .col-span-2 { grid-column: span 1; }
  .page-content { padding: 1.25rem; }
  .podium { gap: .25rem; }
  .result-hero { flex-direction: column; text-align: center; padding: 1.5rem; }
  .my-rank-banner { flex-wrap: wrap; gap: 1rem; }
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-med); }

/* ── Additional polish styles ───────────────────────────────── */

/* Score log list used in profile */
.score-log-list .sl-item { border-bottom: 1px solid var(--border); }
.score-log-list .sl-item:last-child { border-bottom: none; }

/* Badge new pulse */
.badge-new { animation: newPulse 2s ease-in-out 3; }
@keyframes newPulse { 0%,100% { opacity:1; } 50% { opacity:.5; } }

/* Form file input styling */
input[type="file"].form-file {
  background: var(--bg-2);
  cursor: pointer;
}
input[type="file"].form-file::file-selector-button {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border-med);
  border-radius: 6px;
  padding: .3rem .75rem;
  margin-right: .75rem;
  font-family: 'DM Sans', sans-serif;
  font-size: .825rem;
  cursor: pointer;
  transition: all .15s;
}
input[type="file"].form-file::file-selector-button:hover {
  background: var(--surface-3);
  color: var(--text);
}

/* Code textarea for JSON import */
.code-textarea {
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: .82rem;
  line-height: 1.6;
  background: var(--bg);
  color: var(--cyan);
  min-height: 420px;
  resize: vertical;
  tab-size: 2;
}

/* Lesson content card prose improvements */
.lesson-content.prose blockquote {
  border-left: 3px solid var(--brand);
  padding-left: 1rem;
  margin: 1rem 0;
  color: var(--text-muted);
  font-style: italic;
}
.lesson-content.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: .875rem;
}
.lesson-content.prose th,
.lesson-content.prose td {
  padding: .5rem .75rem;
  border: 1px solid var(--border-med);
  text-align: left;
}
.lesson-content.prose th { background: var(--surface-2); font-weight: 600; }
.lesson-content.prose a { color: var(--brand-light); text-decoration: underline; }
.lesson-content.prose strong { color: var(--text); font-weight: 600; }
.lesson-content.prose em { color: var(--text-muted); }
.lesson-content.prose hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* Progress bar for section/lesson completion */
.progress-bar-wrap { background: var(--surface-3); border-radius: 999px; height: 6px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--brand-light)); transition: width .6s var(--ease); }

/* Mobile overlay for sidebar */
.sidebar-mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
  backdrop-filter: blur(2px);
}
.sidebar-mobile-overlay.active { display: block; }

/* Admin table row hover actions reveal */
.data-table tbody tr .action-btns { opacity: .6; transition: opacity .15s; }
.data-table tbody tr:hover .action-btns { opacity: 1; }

/* Quiz card entrance animation */
.quiz-card {
  animation: cardSlide .3s var(--ease) both;
}
.quiz-card:nth-child(1)  { animation-delay: .04s; }
.quiz-card:nth-child(2)  { animation-delay: .08s; }
.quiz-card:nth-child(3)  { animation-delay: .12s; }
.quiz-card:nth-child(4)  { animation-delay: .16s; }
.quiz-card:nth-child(5)  { animation-delay: .20s; }
@keyframes cardSlide {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Stat card entrance */
.stat-card {
  animation: statIn .4s var(--ease) both;
}
.stat-card:nth-child(1) { animation-delay: .04s; }
.stat-card:nth-child(2) { animation-delay: .08s; }
.stat-card:nth-child(3) { animation-delay: .12s; }
.stat-card:nth-child(4) { animation-delay: .16s; }
.stat-card:nth-child(5) { animation-delay: .20s; }
@keyframes statIn {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Topbar breadcrumb */
.page-breadcrumb { font-size: .875rem; color: var(--text-muted); font-weight: 500; }

/* Tag variants */
.tag-python      { background: rgba(59,130,246,.12); color: #60a5fa; }
.tag-javascript  { background: rgba(234,179,8,.12);  color: #fbbf24; }
.tag-java        { background: rgba(239,68,68,.12);  color: #f87171; }
.tag-sql         { background: rgba(34,197,94,.12);  color: #4ade80; }

/* Graded row highlight */
.data-table tr.row-graded td { color: var(--text-muted); }

/* Login page animated gradient bg */
.login-panel-left::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(79,126,248,.12) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(167,139,250,.08) 0%, transparent 50%);
  pointer-events: none;
  z-index: 1;
}

/* Floating orbs on login left panel */
.lp-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
  animation: orbFloat 8s ease-in-out infinite;
}
.lp-orb-1 { width:200px;height:200px; background:rgba(79,126,248,.15); top:10%;left:10%; animation-delay:0s; }
.lp-orb-2 { width:160px;height:160px; background:rgba(167,139,250,.1); bottom:15%;right:5%; animation-delay:3s; }
@keyframes orbFloat {
  0%,100% { transform: translateY(0) scale(1); }
  50%     { transform: translateY(-20px) scale(1.05); }
}

/* Smooth page transitions */
.page-content { animation: pageIn .25s var(--ease); }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Result arc animation on load */
.result-arc {
  stroke-dasharray: 0 314.16;
  animation: arcDraw 1.2s var(--ease) forwards .3s;
}
@keyframes arcDraw {
  to { stroke-dasharray: var(--target-dash, 314.16) 314.16; }
}

/* Tooltip on hover for avatar */
.user-avatar-xs[title] { cursor: default; }

/* Mobile responsive fixes */
@media (max-width: 640px) {
  .page-title { font-size: 1.35rem; }
  .stat-grid  { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 1.4rem; }
  .quiz-shell { gap: .75rem; }
  .qc-text    { font-size: .9rem; }
  .result-hero { gap: 1.25rem; }
  .result-circle { width: 130px; height: 130px; }
  .podium     { gap: .15rem; }
  .podium-name { font-size: .7rem; }
  .topbar     { padding: 0 1rem; }
  .page-content { padding: 1rem; }
  .modal-box  { margin: 0 .5rem; }
  .my-rank-banner { padding: 1rem; }
  .submit-layout { grid-template-columns: 1fr; }
  .lesson-layout { grid-template-columns: 1fr; }
}



/* ===== 2026 UI refresh overrides ===== */
:root {
  --brand: #2563eb;
  --brand-light: #3b82f6;
  --brand-dark: #1d4ed8;
  --brand-glow: rgba(37, 99, 235, 0.16);

  --bg: #f3f6fb;
  --bg-2: #eef3f9;
  --bg-3: #e2e8f0;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #edf2f7;

  --border: rgba(148, 163, 184, 0.28);
  --border-med: rgba(148, 163, 184, 0.42);

  --text: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  --success-bg: #effaf3;
  --success-border: #bbf7d0;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  --danger-bg: #fff1f2;
  --danger-border: #fecdd3;
  --info-bg: #eff6ff;
  --info-border: #bfdbfe;

  --shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 20px 45px rgba(15, 23, 42, 0.08);
  --shadow-brand: 0 14px 30px rgba(37, 99, 235, 0.15);
}

html, body {
  background: linear-gradient(180deg, #f8fbff 0%, #f3f6fb 100%) !important;
  color: var(--text) !important;
}

body, input, textarea, select, button {
  font-family: "DM Sans", system-ui, sans-serif !important;
}

h1, h2, h3, h4, h5, .page-title, .brand-name {
  font-family: "DM Sans", system-ui, sans-serif !important;
  letter-spacing: -0.02em;
}

a { color: var(--brand); }
a:hover { color: var(--brand-dark); }

.app-shell, .main-col, .page-content {
  background: transparent !important;
}

.page-content {
  max-width: 1440px;
  padding: 1.35rem !important;
}

.flash-zone {
  padding: 1rem 1.35rem 0;
}

.page-header {
  margin-bottom: 1.25rem !important;
}

.page-title {
  font-size: 1.8rem !important;
  color: var(--text) !important;
}

.page-sub,
.text-muted,
.muted,
.subtle,
.form-hint,
.stat-label,
.brand-role,
.user-role-label,
.topbar-username,
.notif-time,
.notif-count-label,
.item-sub,
.empty-state p {
  color: var(--text-muted) !important;
}

.sidebar {
  background: rgba(255,255,255,0.92) !important;
  border-right: 1px solid var(--border) !important;
  box-shadow: 12px 0 30px rgba(15, 23, 42, 0.04);
  backdrop-filter: blur(14px);
}

.sidebar-brand,
.sidebar-footer,
.topbar,
.notif-header,
.notif-footer-link,
.notif-item,
.data-table th,
.data-table td,
.card,
.dash-card,
.form-card,
.stat-card,
.login-card,
.team-card,
.test-card,
.section-card,
.profile-card,
.lb-card,
.empty-state,
.alert,
.flash,
.quiz-q-item,
.modal-box,
.sidebar-card,
.content-card,
.lesson-panel,
.table-card {
  border-color: var(--border) !important;
}

.topbar {
  background: rgba(255,255,255,0.9) !important;
  border-bottom: 1px solid var(--border) !important;
  backdrop-filter: blur(14px);
}

.sidebar,
.topbar,
.dash-card,
.form-card,
.stat-card,
.login-card,
.team-card,
.test-card,
.section-card,
.profile-card,
.lb-card,
.empty-state,
.modal-box,
.table-card,
.card {
  box-shadow: var(--shadow) !important;
}

.topbar-btn,
.mobile-menu-btn,
.sidebar-toggle-btn,
.logout-btn {
  background: var(--surface-2) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-muted) !important;
}
.topbar-btn:hover,
.mobile-menu-btn:hover,
.sidebar-toggle-btn:hover,
.logout-btn:hover {
  background: #eef4ff !important;
  color: var(--brand) !important;
}

.nav-link {
  color: #475569 !important;
  border: 1px solid transparent;
}
.nav-link:hover {
  background: #f8fbff !important;
  color: var(--brand) !important;
  border-color: #dbeafe;
}
.nav-link.active {
  background: #eff6ff !important;
  border-color: #bfdbfe !important;
  color: var(--brand) !important;
}
.nav-section-label { color: #94a3b8 !important; }
.brand-logo,
.user-avatar,
.user-avatar-sm,
.user-avatar-xs,
.team-avatar,
.podium-avatar,
.podium-avatar-lg,
.profile-avatar-lg {
  background: linear-gradient(135deg, var(--brand), var(--brand-light)) !important;
  box-shadow: var(--shadow-brand);
}

.notif-dropdown {
  background: rgba(255,255,255,0.98) !important;
  border: 1px solid var(--border-med) !important;
}
.notif-item:hover,
.notif-item.unread {
  background: #f8fbff !important;
}
.notif-footer-link:hover {
  background: #f8fbff !important;
}
.notif-dot { background: var(--brand) !important; }

.card,
.dash-card,
.form-card,
.stat-card,
.team-card,
.section-card,
.test-card,
.profile-card,
.lb-card,
.empty-state,
.alert,
.flash,
.modal-box,
.table-card {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 20px !important;
}

.form-card,
.dash-card,
.card,
.table-card,
.profile-card,
.lb-card,
.empty-state {
  padding: 1.2rem;
}

.btn {
  border-radius: 12px !important;
  font-weight: 700 !important;
  box-shadow: none !important;
}
.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-light)) !important;
  border: none !important;
  color: #fff !important;
}
.btn-primary:hover {
  filter: brightness(0.98);
  transform: translateY(-1px);
}
.btn-ghost,
.btn-secondary,
.btn-danger-ghost {
  background: var(--surface-2) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
}
.btn-danger-ghost {
  color: #dc2626 !important;
  background: #fff5f5 !important;
  border-color: #fecaca !important;
}

.form-label,
.form-section-title,
.ps-label,
.ts-label,
.mrb-label,
.ring-label,
.feedback-label,
.item-title,
.nfi-title,
.profile-name,
.team-name,
.section-card-title,
.test-card-title,
.lesson-row-title,
.page-title,
.page-breadcrumb,
.ar-question,
.ar-qnum,
.lb-name,
.podium-name,
.podium-place,
.error-title,
.assignment-title,
.result-score,
.qc-text,
.tc-text {
  color: var(--text) !important;
}

.form-input,
.form-select,
.form-textarea,
.form-file,
.input-wrap,
.code-textarea {
  background: #fff !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
}

.code-textarea {
  min-height: 360px;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
.code-textarea:focus {
  outline: none !important;
  border-color: #93c5fd !important;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12) !important;
}

.data-table,
.lb-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}
.data-table th,
.lb-table th {
  background: #f8fafc !important;
  color: #334155 !important;
  font-weight: 800;
  border-bottom: 1px solid var(--border) !important;
}
.data-table td,
.lb-table td {
  background: #fff !important;
  color: #334155 !important;
}
.data-table tbody tr:hover td,
.lb-table tbody tr:hover td {
  background: #f8fbff !important;
}

.stat-grid {
  gap: 1rem;
}
.stat-card {
  min-height: 120px;
}
.stat-icon {
  border-radius: 14px !important;
}
.stat-body,
.stat-value,
.stat-label {
  position: relative;
  z-index: 1;
}
.stat-blue .stat-icon { background: #dbeafe !important; color: #2563eb !important; }
.stat-green .stat-icon { background: #dcfce7 !important; color: #16a34a !important; }
.stat-amber .stat-icon { background: #fef3c7 !important; color: #d97706 !important; }
.stat-purple .stat-icon { background: #ede9fe !important; color: #7c3aed !important; }
.stat-rose .stat-icon { background: #ffe4e6 !important; color: #e11d48 !important; }
.stat-glow { opacity: .4 !important; }

.section-card,
.test-card,
.team-card,
.lesson-row,
.notif-full-item,
.item-row {
  background: #fff !important;
  border: 1px solid var(--border) !important;
  border-radius: 18px !important;
}
.section-card:hover,
.test-card:hover,
.team-card:hover,
.lesson-row:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow) !important;
}

.lesson-row {
  padding: 16px 18px;
}
.lesson-row-preview,
.assignment-desc,
.assignment-desc-full,
.assignment-desc-preview,
.rs-desc,
.nfi-message,
.error-desc,
.team-desc {
  color: var(--text-muted) !important;
}

.badge-pill,
.badge-tag,
.badge-video,
.badge-file,
.badge-new,
.badge-assignment,
.badge-quiz,
.pts-badge,
.pts-badge-lg,
.meta-pill,
.status-badge,
.deadline-pill,
.team-rank-badge,
.test-score-pill,
.you-badge,
.tag {
  border-radius: 999px !important;
}

.quiz-shell,
.quiz-question-list,
.answer-review-list,
.review-grid,
.leaderboard-layout,
.profile-layout,
.submit-layout {
  gap: 1.25rem;
}

.quiz-card,
.quiz-q-item,
.answer-review-list .ar-item,
.result-summary,
.feedback-box,
.feedback-box-sm,
.result-banner,
.my-rank-banner,
.team-detail-block,
.student-info-bar {
  background: #fff !important;
  border: 1px solid var(--border) !important;
  border-radius: 18px !important;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.quiz-opt,
.quiz-q-options label,
.check-label,
.ar-ans,
.opt-correct,
.opt-wrong,
.ans-correct,
.ans-wrong {
  border-radius: 14px !important;
}

.result-perfect { background: linear-gradient(135deg, #ecfeff 0%, #ecfdf5 100%) !important; }
.result-pass { background: #f0fdf4 !important; }
.result-fail { background: #fff7ed !important; }

.flash-success, .alert-success { background: #effaf3 !important; border-color: #bbf7d0 !important; color: #166534 !important; }
.flash-danger, .alert-danger { background: #fff1f2 !important; border-color: #fecdd3 !important; color: #be123c !important; }
.flash-warning, .alert-warning { background: #fffbeb !important; border-color: #fde68a !important; color: #b45309 !important; }
.flash-info, .alert-info { background: #eff6ff !important; border-color: #bfdbfe !important; color: #1d4ed8 !important; }

.pagination-nav {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}
.page-btn {
  background: #fff !important;
  color: #334155 !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
}
.page-btn:hover,
.page-btn.active {
  background: #eff6ff !important;
  color: var(--brand) !important;
  border-color: #bfdbfe !important;
}

.login-body {
  min-height: 100vh;
  background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%) !important;
}
.login-page {
  max-width: 1120px !important;
  margin: 0 auto !important;
  min-height: 100vh;
  padding: 2rem !important;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 1.25rem;
}
.login-panel-left {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 100%) !important;
  border-radius: 28px !important;
  box-shadow: 0 20px 50px rgba(37,99,235,.22) !important;
}
.login-panel-right {
  background: transparent !important;
  padding: 0 !important;
}
.login-card {
  border-radius: 24px !important;
  padding: 2rem !important;
}
.lp-tagline, .lp-features, .login-note, .lp-title { color: rgba(255,255,255,.92) !important; }
.lp-logo {
  background: rgba(255,255,255,.14) !important;
  border: 1px solid rgba(255,255,255,.22) !important;
}
.lp-feat { color: rgba(255,255,255,.88) !important; }

.modal-overlay {
  background: rgba(15,23,42,.45) !important;
  backdrop-filter: blur(4px);
}

::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }

@media (max-width: 1100px) {
  .dashboard-grid,
  .leaderboard-layout,
  .profile-layout,
  .submit-layout,
  .review-grid,
  .import-grid,
  .lesson-layout {
    grid-template-columns: 1fr !important;
  }

  .lesson-sidebar {
    position: static !important;
  }

  .login-page {
    grid-template-columns: 1fr !important;
  }

  .login-panel-left {
    min-height: 260px;
  }
}

@media (max-width: 900px) {
  .page-content { padding: 1rem !important; }
  .flash-zone { padding: .9rem 1rem 0; }
  .data-table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .topbar { padding: 0 1rem; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: min(86vw, 320px);
    box-shadow: 18px 0 40px rgba(15, 23, 42, 0.18);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-col { margin-left: 0 !important; }
  .page-title { font-size: 1.45rem !important; }
  .page-header,
  .test-top,
  .quiz-top,
  .lesson-topbar {
    align-items: stretch;
  }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-grid,
  .form-grid-2,
  .teams-grid,
  .tests-grid,
  .sections-grid {
    grid-template-columns: 1fr !important;
  }
  .topbar-right { gap: .5rem; }
  .topbar-username { display: none; }
  .login-page {
    padding: 1rem !important;
    gap: 1rem;
  }
  .login-panel-left { display: none !important; }
  .login-card { padding: 1.25rem !important; }
  .section-card,
  .test-card,
  .team-card,
  .lesson-row,
  .dash-card,
  .form-card,
  .card,
  .table-card,
  .empty-state {
    border-radius: 18px !important;
  }
}

@media (max-width: 560px) {
  .page-content { padding: .85rem !important; }
  .flash-zone { padding: .75rem .85rem 0; }
  .stat-grid { grid-template-columns: 1fr; }
  .topbar {
    padding: 0 .75rem;
    gap: .5rem;
  }
  .topbar-right {
    gap: .35rem;
  }
  .notif-dropdown {
    width: min(92vw, 360px);
    right: -10px;
  }
  .page-header,
  .panel-header,
  .quiz-submit-bar,
  .test-submit-bar,
  .lesson-topbar {
    gap: .75rem;
  }
}
