/* ─── Google Fonts ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Nunito+Sans:ital,opsz,wght@0,6..12,300;0,6..12,400;0,6..12,600;0,6..12,700;1,6..12,400&display=swap');

/* ─── Design Tokens ────────────────────────────────────────────────────────── */
:root {
  --bg:            #eef1f7;
  --surface:       #ffffff;
  --surface-2:     #f6f8fc;
  --surface-3:     #eef1f8;
  --border:        #dde3ee;

  --text:          #111827;
  --text-mid:      #374151;
  --muted:         #6b7280;
  --muted-light:   #9ca3af;

  --navy:          #0e1e3d;
  --navy-mid:      #1a3260;
  --accent:        #2563eb;
  --accent-2:      #0ea5e9;
  --accent-light:  #dbeafe;
  --accent-glow:   rgba(37,99,235,.18);

  --success:       #059669;
  --success-bg:    #d1fae5;
  --success-text:  #065f46;

  --warn:          #d97706;
  --warn-bg:       #fef3c7;
  --warn-text:     #78350f;

  --danger:        #dc2626;
  --danger-bg:     #fee2e2;
  --danger-text:   #7f1d1d;

  --shadow-xs:     0 1px 2px rgba(0,0,0,.04);
  --shadow-sm:     0 2px 6px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:        0 4px 16px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,.04);
  --shadow-lg:     0 12px 32px rgba(14,30,61,.12), 0 2px 8px rgba(0,0,0,.04);
  --shadow-xl:     0 24px 48px rgba(14,30,61,.16);

  --r-sm:   8px;
  --r:      14px;
  --r-lg:   20px;
  --r-xl:   28px;

  --header-h: 70px;
}

/* ─── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Nunito Sans', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

button, input, textarea, select { font: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }

h1, h2, h3, h4 {
  font-family: 'Outfit', system-ui, sans-serif;
  line-height: 1.25;
  color: var(--navy);
}

/* ─── Background ambience ──────────────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 15% 15%, rgba(37,99,235,.07) 0%, transparent 50%),
    radial-gradient(circle at 85% 85%, rgba(14,165,233,.06) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

#app { position: relative; z-index: 1; }

/* ─── Header / Topbar ──────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  gap: 20px;
  box-shadow: 0 2px 24px rgba(14,30,61,.4);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.site-logo {
  height: 40px;
  width: auto;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: .92;
}

.brand-divider {
  width: 1px;
  height: 32px;
  background: rgba(255,255,255,.18);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.01em;
  line-height: 1.2;
}

.brand-sub {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.45);
  line-height: 1;
}

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

/* ─── Layout ───────────────────────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 296px 1fr;
  gap: 24px;
  padding: 24px;
  max-width: 1440px;
  margin: 0 auto;
}

/* ─── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: calc(var(--header-h) + 20px);
  height: fit-content;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 18px;
  display: grid;
  gap: 0;
}

.section-title {
  font-family: 'Outfit', sans-serif;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted-light);
  padding: 8px 8px 6px;
}

/* ─── Nav ──────────────────────────────────────────────────────────────────── */
.navlist { display: grid; gap: 3px; margin-bottom: 4px; }

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-mid);
  font-size: .88rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all .15s ease;
  text-decoration: none;
}

.nav-btn:hover {
  background: var(--surface-3);
  color: var(--navy);
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: .65;
}

.nav-btn.active .nav-icon,
.nav-btn:hover .nav-icon { opacity: 1; }

.nav-btn.active {
  background: var(--accent-light);
  color: var(--accent);
  border-color: rgba(37,99,235,.2);
}

/* ─── Divider ──────────────────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 10px 0;
}

/* ─── Auth Panel ───────────────────────────────────────────────────────────── */
.auth-panel { display: grid; gap: 10px; }

/* ─── Form Fields ──────────────────────────────────────────────────────────── */
.field-label {
  display: block;
  font-size: .8rem;
  font-weight: 700;
  color: var(--text-mid);
  margin-bottom: 5px;
}

.input, textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: .88rem;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

.input:focus, textarea:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input::placeholder, textarea::placeholder { color: var(--muted-light); }
textarea { min-height: 90px; resize: vertical; }

/* ─── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-mid);
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
  font-family: 'Nunito Sans', sans-serif;
}

.btn:hover {
  background: var(--surface-3);
  border-color: #c0cad8;
  color: var(--navy);
  box-shadow: var(--shadow-xs);
}

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

.btn.primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
  box-shadow: 0 4px 16px rgba(37,99,235,.38);
  transform: translateY(-1px);
}

.btn.ghost {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.25);
  color: rgba(255,255,255,.88);
}

.btn.ghost:hover {
  background: rgba(255,255,255,.15);
  border-color: rgba(255,255,255,.45);
  color: #fff;
  transform: none;
  box-shadow: none;
}

.stack-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ─── Content area ─────────────────────────────────────────────────────────── */
.content { display: grid; gap: 20px; align-content: start; }
.view { display: none; }
.view.active { display: grid; gap: 20px; }

/* ─── Alert ────────────────────────────────────────────────────────────────── */
#alert { min-height: 0; }

.alert {
  padding: 12px 16px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-size: .88rem;
  font-weight: 600;
  animation: slideDown .2s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.alert.good  { background: var(--success-bg);  color: var(--success-text); border-color: rgba(5,150,105,.25); }
.alert.warn  { background: var(--warn-bg);     color: var(--warn-text);    border-color: rgba(217,119,6,.25); }
.alert.error { background: var(--danger-bg);   color: var(--danger-text);  border-color: rgba(220,38,38,.25); }

/* ─── Hero Card ────────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(140deg, var(--navy) 0%, var(--navy-mid) 55%, #1e40af 100%);
  border-radius: var(--r-xl);
  padding: 32px 36px;
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 28px;
  align-items: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  border: 1px solid rgba(255,255,255,.06);
}

.hero::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 320px; height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(14,165,233,.22) 0%, transparent 70%);
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -80px; left: 35%;
  width: 240px; height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,235,.18) 0%, transparent 70%);
  pointer-events: none;
}

.hero .eyebrow { color: #93c5fd; }

.hero h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  margin: 8px 0 12px;
  line-height: 1.25;
}

.hero .subtle {
  color: rgba(255,255,255,.62);
  font-size: .9rem;
  line-height: 1.65;
}

.hero-metrics {
  display: grid;
  gap: 10px;
  position: relative;
  z-index: 1;
}

/* ─── Metric Cards ─────────────────────────────────────────────────────────── */
.metric-card {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.11);
  backdrop-filter: blur(6px);
  border-radius: var(--r);
  padding: 16px 20px;
}

.metric-card span {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(255,255,255,.5);
  margin-bottom: 4px;
}

.metric-card strong {
  font-family: 'Outfit', sans-serif;
  font-size: 1.9rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

/* Teacher metrics – on light bg */
.teacher-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 14px;
}

.teacher-metrics .metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  border-radius: var(--r-lg);
}

.teacher-metrics .metric-card span { color: var(--muted); }
.teacher-metrics .metric-card strong { color: var(--navy); font-size: 2rem; }

/* ─── Eyebrow ──────────────────────────────────────────────────────────────── */
.eyebrow {
  font-family: 'Outfit', sans-serif;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent-2);
  display: block;
  margin-bottom: 4px;
}

/* ─── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

/* ─── Strand Grid ──────────────────────────────────────────────────────────── */
.strand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(274px, 1fr));
  gap: 16px;
}

.strand-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  display: grid;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}

.strand-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: rgba(37,99,235,.3);
}

.strand-card h3 {
  font-size: .95rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.3;
}

.strand-card .subtle {
  font-size: .84rem;
  color: var(--muted);
  line-height: 1.55;
}

/* ─── Badges & Chips ───────────────────────────────────────────────────────── */
.badge-row, .chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  font-size: .72rem;
  font-weight: 700;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  border: 1px solid var(--border);
}

.badge.good   { background: var(--success-bg); color: var(--success-text); border-color: rgba(5,150,105,.2); }
.badge.warn   { background: var(--warn-bg);    color: var(--warn-text);    border-color: rgba(217,119,6,.2); }
.badge.danger { background: var(--danger-bg);  color: var(--danger-text);  border-color: rgba(220,38,38,.2); }

.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: .72rem;
  font-weight: 700;
  border-radius: 999px;
  background: var(--accent-light);
  color: #1d4ed8;
  border: 1px solid rgba(37,99,235,.2);
}

/* ─── Progress Bar ─────────────────────────────────────────────────────────── */
.progressbar {
  height: 6px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.progressbar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 999px;
  transition: width .4s ease;
}

.small  { font-size: .82rem; }
.subtle { color: var(--muted); }

/* ─── Worksheet ────────────────────────────────────────────────────────────── */
.worksheet-shell { display: grid; gap: 20px; }

.worksheet-header, .worksheet-body { padding: 28px 30px; }

.split-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.split-head h2 { font-size: 1.4rem; margin: 8px 0 10px; }

.split-head > div:last-child .metric-card {
  background: var(--navy);
  min-width: 130px;
  text-align: center;
  flex-shrink: 0;
}

/* Metric cards on light backgrounds (worksheet feedback, etc.) */
.worksheet-body .metric-card,
.worksheet-body .hero-metrics .metric-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  backdrop-filter: none;
}

.worksheet-body .metric-card span {
  color: var(--muted);
}

.worksheet-body .metric-card strong {
  color: var(--navy);
  font-size: 1.6rem;
}

.reading-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 22px;
  margin-top: 16px;
}

.reading-block h4 {
  font-size: .95rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}

.reading-block p { color: var(--text-mid); font-size: .9rem; line-height: 1.7; }
.reading-block ul { padding-left: 20px; margin-top: 8px; }
.reading-block li { font-size: .9rem; color: var(--text-mid); line-height: 1.7; }

.question-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 22px;
  display: grid;
  gap: 12px;
  margin-top: 16px;
  transition: border-color .15s;
}

.question-block:hover { border-color: rgba(37,99,235,.28); }
.question-block strong { font-size: .95rem; color: var(--navy); }

/* ─── Options (radio / checkbox) ───────────────────────────────────────────── */
.option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  font-size: .9rem;
  color: var(--text-mid);
}

.option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--navy);
  font-weight: 600;
}

.option input { margin-top: 2px; accent-color: var(--accent); flex-shrink: 0; }

/* ─── Teacher Dashboard ────────────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 20px;
}

.dashboard-grid .card { padding: 24px 26px; }

.dashboard-grid h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.teacher-row {
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}

.teacher-row:last-child { border-bottom: none; }
.teacher-row strong { font-size: .9rem; color: var(--navy); }
.teacher-row .small { color: var(--muted); margin-top: 2px; }
.teacher-row .badge-row { margin-top: 8px; }


.teacher-class-list {
  display: grid;
  gap: 12px;
}

.teacher-class-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.teacher-class-card:first-child {
  padding-top: 0;
}

.teacher-class-card:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.teacher-class-card__main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.teacher-class-card__title {
  display: block;
  font-size: .95rem;
  color: var(--navy);
  line-height: 1.3;
}

.teacher-class-card__meta {
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.4;
  word-break: break-word;
}

.teacher-class-card__side {
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .teacher-class-card {
    flex-direction: column;
    align-items: flex-start;
  }
}


.teacher-shell-card {
  border-left: 4px solid rgba(37,99,235,.28);
}

.teacher-toolbar {
  display: grid;
  gap: 12px;
}

.teacher-toolbar__create,
.teacher-toolbar__filters,
.teacher-rag-tools {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.teacher-toolbar__filters .input,
.teacher-rag-tools .input {
  flex: 0 0 auto;
}

.teacher-panel-card {
  min-width: 0;
}

.teacher-panel-card > div:last-child {
  min-width: 0;
}

.teacher-class-card {
  align-items: flex-start;
}

.teacher-class-card__side {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.teacher-class-card .btn {
  padding: 6px 12px;
}

.rag-table td,
.rag-table th {
  white-space: nowrap;
}

@media (max-width: 860px) {
  .teacher-toolbar__create,
  .teacher-toolbar__filters,
  .teacher-rag-tools {
    flex-direction: column;
    align-items: stretch;
  }

  .teacher-toolbar__filters .input,
  .teacher-rag-tools .input,
  .teacher-toolbar__create .input {
    width: 100% !important;
  }
}

/* ─── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 1060px) {
  .layout { grid-template-columns: 265px 1fr; gap: 18px; padding: 18px; }
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; padding: 14px; }
  .sidebar { position: static; }
  .hero { grid-template-columns: 1fr; padding: 24px; }
  .split-head { flex-direction: column; }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  .topbar { padding: 0 16px; }
  .brand-text { display: none; }
  .brand-divider { display: none; }
  .strand-grid { grid-template-columns: 1fr; }
  .hero h2 { font-size: 1.25rem; }
}

/* ─── Role badges ──────────────────────────────────────────────────────────── */
.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.badge-admin {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  box-shadow: 0 2px 8px rgba(124,58,237,.35);
}

.badge-teacher {
  background: linear-gradient(135deg, #0d9488, #0ea5e9);
  color: #fff;
  box-shadow: 0 2px 8px rgba(13,148,136,.3);
}

.badge-student {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
}

/* ─── Admin nav button ─────────────────────────────────────────────────────── */
.nav-btn-admin.active,
.nav-btn-admin:hover {
  background: rgba(124,58,237,.12);
  color: #7c3aed;
  border-color: rgba(124,58,237,.25);
}

/* ─── Admin grid ───────────────────────────────────────────────────────────── */
.admin-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
}

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

/* ─── Admin user rows ──────────────────────────────────────────────────────── */
.admin-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.admin-user-row:last-child { border-bottom: none; }

.admin-user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.admin-user-info strong {
  font-size: .92rem;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-user-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ─── Domain rows ──────────────────────────────────────────────────────────── */
.domain-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.domain-row:last-child { border-bottom: none; }

/* ─── Admin header card ────────────────────────────────────────────────────── */
.admin-header-card {
  border-left: 4px solid #7c3aed;
}

/* ─── Email verification notice ────────────────────────────────────────────── */
.verify-notice {
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--warn-bg);
  border: 1px solid rgba(217,119,6,.25);
  border-radius: var(--r-sm);
  display: grid;
  gap: 8px;
}

.verify-notice p { color: var(--warn-text); margin: 0; }

/* ─── Auth panel mode switch link ──────────────────────────────────────────── */
#btnSwitchToRegister:hover,
#btnSwitchToLogin:hover { text-decoration: underline; }

.assignment-stack { display: grid; gap: 14px; }
.assignment-card {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
}
.assignment-students {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.chip-good { background: var(--success-bg); color: var(--success-text); }
.chip-warn { background: var(--warn-bg); color: var(--warn-text); }
.dashboard-span-2 { grid-column: 1 / -1; }
.teacher-dashboard-grid { align-items: start; }
@media (max-width: 960px) {
  .assignment-card { flex-direction: column; }
}


.rag-card { padding: 24px 26px; margin-top: 20px; overflow: hidden; }
.rag-table-wrap { width: 100%; max-width: 100%; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
.rag-table { width: max-content; min-width: 100%; border-collapse: collapse; min-width: 980px; font-size: .84rem; }
.rag-table th, .rag-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: center; vertical-align: middle; }
.rag-table th { position: sticky; top: 0; background: var(--surface); z-index: 1; font-family: "Outfit", system-ui, sans-serif; font-size: .76rem; letter-spacing: .03em; color: var(--navy); white-space: nowrap; }
.rag-table tbody tr:nth-child(even) { background: rgba(255,255,255,.45); }
.rag-table td:first-child, .rag-table th:first-child { position: sticky; left: 0; background: inherit; text-align: left; min-width: 210px; }
.rag-table th:first-child { background: var(--surface); z-index: 2; }
.rag-table td:nth-child(2), .rag-table th:nth-child(2) { min-width: 140px; text-align: left; }
.rag-student-cell strong { display: block; }
.rag-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 54px; padding: 5px 8px; border-radius: 999px; font-weight: 700; border: 1px solid transparent; }
.rag-pill.good { background: var(--success-bg); color: var(--success-text); border-color: rgba(5,150,105,.18); }
.rag-pill.warn { background: var(--warn-bg); color: var(--warn-text); border-color: rgba(217,119,6,.18); }
.rag-pill.danger { background: var(--danger-bg); color: var(--danger-text); border-color: rgba(220,38,38,.18); }
.rag-pill.muted { background: var(--surface); color: var(--muted); border-color: var(--border); }


.logged-in-links { margin-bottom: 20px; }
.logged-in-links {
  padding: 24px 24px 26px;
  border: 1px solid rgba(16, 24, 40, 0.08);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}
.logged-in-links .split-head {
  margin-bottom: 4px;
}
.logged-in-links h3 {
  margin: 8px 0 10px !important;
}
.logged-in-links .small.subtle {
  margin: 0;
}
.resource-links-grid {
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 10px;
}
.resource-link-card {
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:18px 18px 16px;
  border:1px solid rgba(20, 45, 92, 0.10);
  border-radius:20px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  color:inherit;
  text-decoration:none;
  min-width:0;
  min-height: 170px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.resource-link-card:hover {
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, 0.28);
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.10);
}
.resource-link-kicker {
  display:inline-flex;
  align-self:flex-start;
  padding:5px 10px;
  border-radius:999px;
  background: rgba(37, 99, 235, 0.08);
  color: #2563eb;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.resource-link-card strong {
  color: var(--navy);
  font-size: 1.02rem;
  line-height: 1.35;
}
.resource-link-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.resource-link-meta {
  margin-top: auto;
  display:inline-flex;
  align-items:center;
  gap:8px;
  color: #0f5ad8;
  font-size: 13px;
  font-weight: 700;
}
@media (max-width: 720px) {
  .logged-in-links { padding: 20px 18px 22px; }
  .resource-links-grid { grid-template-columns: 1fr; }
  .resource-link-card { min-height: 0; }
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* IMPROVEMENT PATCHES                                                         */
/* ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Logged-out landing hero ──────────────────────────────────────────────── */
.logged-out-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}

@media (max-width: 860px) {
  .logged-out-hero { grid-template-columns: 1fr; }
  .preview-grid    { display: none; }
}

.logged-out-hero-content {
  background: linear-gradient(140deg, var(--navy) 0%, var(--navy-mid) 55%, #1e40af 100%);
  border-radius: var(--r-xl);
  padding: 36px 38px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  border: 1px solid rgba(255,255,255,.06);
}

.logged-out-hero-content::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 320px; height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(14,165,233,.22) 0%, transparent 70%);
  pointer-events: none;
}

.logged-out-hero-content .eyebrow { color: #93c5fd; margin-bottom: 8px; }

.logged-out-hero-content h2 {
  font-size: 1.55rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 12px;
  line-height: 1.25;
  position: relative;
  z-index: 1;
}

.logged-out-hero-content .subtle {
  color: rgba(255,255,255,.62);
  font-size: .92rem;
  line-height: 1.65;
  position: relative;
  z-index: 1;
}

.logged-out-features {
  display: grid;
  gap: 10px;
  margin: 20px 0 24px;
  position: relative;
  z-index: 1;
}

.lof-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .88rem;
  color: rgba(255,255,255,.8);
  font-weight: 600;
}

.lof-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #93c5fd;
}

.logged-out-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.btn-lg {
  padding: 12px 24px;
  font-size: .95rem;
  border-radius: var(--r);
}

.btn.btn-lg.primary {
  box-shadow: 0 4px 16px rgba(37,99,235,.45);
}

.btn.btn-lg:not(.primary) {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.3);
  color: rgba(255,255,255,.9);
}

.btn.btn-lg:not(.primary):hover {
  background: rgba(255,255,255,.18);
  border-color: rgba(255,255,255,.5);
  color: #fff;
}

/* ─── Preview locked strand cards ──────────────────────────────────────────── */
.preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-content: start;
}

.preview-strand-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  display: grid;
  gap: 10px;
  position: relative;
  overflow: hidden;
  filter: blur(1.5px);
  opacity: .65;
  pointer-events: none;
  user-select: none;
}

.preview-lock {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  background: var(--surface-3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}

.preview-lock svg {
  width: 13px;
  height: 13px;
  color: var(--muted);
}

.preview-content h3 {
  font-size: .88rem;
  font-weight: 700;
  color: var(--navy);
  margin: 6px 0 4px;
}

.preview-content .subtle {
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─── Onboarding nudge ──────────────────────────────────────────────────────── */
.onboarding-nudge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: var(--accent-light);
  border: 1px solid rgba(37,99,235,.2);
  border-radius: var(--r);
  flex-wrap: wrap;
}

.onboarding-nudge strong {
  font-size: .92rem;
  color: var(--navy);
  display: block;
}

/* ─── Progress summary bar ──────────────────────────────────────────────────── */
.progress-bar-row {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.progress-bar-track {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,.15);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  border-radius: 999px;
  transition: width .5s ease;
}

.progress-bar-started {
  background: rgba(255,255,255,.3);
}

.progress-bar-done {
  background: linear-gradient(90deg, #22d3ee, #3b82f6);
}

.progress-bar-row .small {
  color: rgba(255,255,255,.6);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ─── "Not started" badge — neutral, not red ───────────────────────────────── */
/* (badge with no modifier class = neutral grey, already styled that way) */

/* ─── Domain empty warning ──────────────────────────────────────────────────── */
.domain-empty-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  background: var(--warn-bg);
  border: 1px solid rgba(217,119,6,.25);
  border-radius: var(--r-sm);
  margin-bottom: 10px;
  font-size: .82rem;
  color: var(--warn-text);
  font-weight: 600;
  line-height: 1.45;
}

.domain-empty-warning svg { margin-top: 1px; color: var(--warn); }

/* ─── Forgot password link ──────────────────────────────────────────────────── */
#btnForgotPassword { font-size: .8rem; }
#btnForgotPassword:hover { text-decoration: underline; }


.segmented-toggle{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:6px;}
.segmented-option{border:1px solid var(--line);background:#f1f5f9;color:var(--text);border-radius:12px;padding:10px 12px;font-weight:700;cursor:pointer;transition:.18s ease;}
.segmented-option.active{background:#dbeafe;border-color:#60a5fa;color:#0f172a;box-shadow:0 0 0 1px rgba(88,166,255,.18) inset;}
.segmented-option:hover{background:#e2e8f0;}
.segmented-option.active:hover{background:#dbeafe;}
.btn-danger{background:#fee2e2;border-color:#fecaca;color:#991b1b;}
.btn-danger:hover{background:#fecaca;border-color:#fca5a5;}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* TIDY-UP PATCHES                                                             */
/* ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Sidebar assigned worksheet links ─────────────────────────────────────── */
.sidebar-assigned-links {
  display: grid;
  gap: 2px;
}

.sidebar-ws-link {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-mid);
  font-size: .82rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all .15s ease;
  min-width: 0;
}

.sidebar-ws-link:hover {
  background: var(--surface-3);
  color: var(--navy);
}

.sidebar-ws-link.active {
  background: var(--accent-light);
  color: var(--accent);
  border-color: rgba(37,99,235,.2);
}

.sidebar-ws-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.sidebar-ws-code {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted-light);
  line-height: 1;
}

.sidebar-ws-link.active .sidebar-ws-code { color: rgba(37,99,235,.65); }

.sidebar-ws-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
  line-height: 1.3;
}

/* ─── Teacher dashboard two-column layout ───────────────────────────────────── */
.td-two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}

/* ─── Assign task form (stacked vertically inside card) ─────────────────────── */
.td-assign-form {
  display: grid;
  gap: 12px;
}

/* ─── Student filter bar in Students card ───────────────────────────────────── */
.td-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.td-filters .input {
  flex: 1;
  min-width: 120px;
}

/* ─── RAG controls ───────────────────────────────────────────────────────────── */
.td-rag-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ─── Card h3 inside teacher cards — remove double bottom border ─────────────── */
.td-two-col .card h3,
.td-two-col .card h4 {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.td-two-col .card h4 {
  font-size: .88rem;
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.badge-summary-grid {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(140px,1fr));
  gap:12px;
  margin-bottom:14px;
}

.student-badge-grid {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:12px;
}

.student-badge-card {
  display:flex;
  gap:12px;
  align-items:flex-start;
  padding:12px;
  border:1px solid rgba(255,255,255,.08);
  border-radius:14px;
  background:rgba(255,255,255,.03);
}

.student-badge-icon {
  width:40px;
  height:40px;
  border-radius:12px;
  display:grid;
  place-items:center;
  font-size:20px;
  background:rgba(255,215,0,.14);
  flex:0 0 40px;
}

.badge-next-list {
  margin-top:14px;
  padding-top:10px;
  border-top:1px solid rgba(13,27,63,.08);
}

#studentBadges .metric-card,
.student-home #studentBadges .metric-card,
.badge-summary-grid .metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

#studentBadges .metric-card span,
.student-home #studentBadges .metric-card span,
.badge-summary-grid .metric-card span {
  color: var(--muted);
}

#studentBadges .metric-card strong,
.student-home #studentBadges .metric-card strong,
.badge-summary-grid .metric-card strong {
  color: var(--navy);
}

#studentBadges .student-badge-card,
.student-home #studentBadges .student-badge-card {
  border: 1px solid var(--border);
  background: var(--surface-soft, rgba(13,27,63,.03));
}

#studentBadges .badge-next-list,
.student-home #studentBadges .badge-next-list {
  border-top: 1px solid var(--border);
}


.teacher-badge-student-card {
  padding: 12px 14px;
  margin-bottom: 10px;
}


.teacher-badge-student-toolbar {
  display:grid;
  grid-template-columns: minmax(180px, 220px) minmax(220px, 1fr) auto;
  gap:12px;
  align-items:center;
  margin-bottom:12px;
}

.teacher-badge-student-toolbar input,
.teacher-badge-student-toolbar select {
  width:100%;
}

@media (max-width: 820px) {
  .teacher-badge-student-toolbar {
    grid-template-columns: 1fr;
  }
}


/* ─── Task notification panel ───────────────────────────────────────────────── */

.task-notif-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.task-notif-heading {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
}

.task-notif-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-notif-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 14px 16px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

/* Overdue — red left accent */
.task-notif-overdue {
  border-left: 3px solid var(--danger);
  background: var(--danger-bg);
  border-color: rgba(220, 38, 38, 0.25);
}

/* Due today — amber left accent */
.task-notif-due_today {
  border-left: 3px solid var(--warn);
  background: var(--warn-bg);
  border-color: rgba(217, 119, 6, 0.25);
}

/* Due soon — amber/neutral */
.task-notif-due_soon {
  border-left: 3px solid var(--warn);
}

/* In progress — neutral */
.task-notif-in_progress {
  border-left: 3px solid var(--accent);
}

.task-notif-body {
  flex: 1;
  min-width: 0;
}

.task-notif-title {
  display: block;
  font-size: 0.94rem;
  color: var(--navy);
  margin-bottom: 4px;
}

.task-notif-msg {
  font-size: 0.82rem;
  color: var(--subtle);
  margin: 0;
}

@media (max-width: 600px) {
  .task-notif-card { flex-direction: column; }
}

/* ─── Nav task badge ────────────────────────────────────────────────────────── */

.nav-task-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  margin-left: auto;
  flex-shrink: 0;
}

/* ─── Teacher: in-progress chip ─────────────────────────────────────────────── */

.chip-progress {
  background: #dbeafe;
  color: #1e3a8a;
}
