/*
 * MTs Assalam Learning
 * Palette comes from the school crest: forest green and crest yellow on a sage ground.
 * Elevation comes from surface contrast (white on sage), not shadow.
 * Shape: controls 14px, inner items 20px, containers 24px, badges and avatars full.
 */

:root {
  --canvas: #e7ece3;
  --surface: #ffffff;
  --ink: #0f2a17;
  --action: #9fe870;
  --action-hover: #b4f08f;

  --forest-50: #eef6ea;
  --forest-100: #dcebd4;
  --forest-200: #bcd9ad;
  --forest-600: #25772f;
  --forest-700: #1c6b2f;
  --forest-800: #14522a;
  --forest-900: #0f3b20;
  --forest-950: #0a2616;

  --yellow-50: #fffbe0;
  --yellow-100: #fff4ab;
  --yellow-300: #fbe132;
  --yellow-800: #5c4d00;
  --yellow-900: #3f3400;

  --red-50: #fdeeee;
  --red-700: #b3261e;
  --red-900: #6b1410;

  --n-50: #f4f7f2;
  --n-100: #e9eee6;
  --n-200: #d6ded2;
  --n-300: #b7c2b2;
  --n-400: #8e9b88;
  --n-500: #66735f;
  --n-600: #525f4c;
  --n-700: #303a2d;
  --n-900: #121b13;

  --font-body: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Bricolage Grotesque', 'Figtree', system-ui, sans-serif;
  --font-arabic: 'Amiri', 'Noto Naskh Arabic', serif;

  --r-control: 14px;
  --r-inner: 20px;
  --r-card: 24px;
  --shadow-pop: 0 16px 32px -12px rgb(15 42 23 / 0.28);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--n-900);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--forest-700);
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  width: 100%;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-wrap: balance;
  color: var(--ink);
}
h1 { font-size: clamp(2rem, 4.5vw, 3.25rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.125rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.0625rem; letter-spacing: -0.01em; }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: var(--forest-800); text-underline-offset: 0.2em; }

::selection { background: var(--action); color: var(--ink); }

:focus-visible {
  outline: 3px solid var(--forest-700);
  outline-offset: 3px;
  border-radius: 8px;
}
.on-dark :focus-visible { outline-color: var(--action); }
[tabindex='-1']:focus-visible { outline: none; }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--ink);
  color: #fff;
  border-radius: var(--r-control);
}
.skip-link:focus { top: 1rem; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ic { width: 1.125rem; height: 1.125rem; flex: none; vertical-align: -0.2em; }
svg.lucide { width: 1.125rem; height: 1.125rem; flex: none; stroke-width: 2; }

/* ---------- layout ---------- */
.container { width: 100%; max-width: 80rem; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 640px) { .container { padding: 0 1.5rem; } }
@media (min-width: 1024px) { .container { padding: 0 2rem; } }
.page { padding-top: 2rem; padding-bottom: 1rem; }
.narrow { max-width: 64rem; margin: 0 auto; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.stack-lg { display: flex; flex-direction: column; gap: 2.5rem; }
.row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: 1rem; }
.cols-2 { grid-template-columns: 1fr; }
.cols-3 { grid-template-columns: 1fr; }
.cols-4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .cols-2 { grid-template-columns: repeat(2, 1fr); } .cols-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .cols-3 { grid-template-columns: repeat(3, 1fr); } .cols-4 { grid-template-columns: repeat(4, 1fr); } }
.split { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
@media (min-width: 1024px) { .split { grid-template-columns: 2fr 1fr; align-items: start; } }

.muted { color: var(--n-600); }
.small { font-size: 0.875rem; }
.tiny { font-size: 0.8125rem; }
.strong { font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.arabic { font-family: var(--font-arabic); direction: rtl; line-height: 2; }
.pre { white-space: pre-line; }
.hidden { display: none !important; }
.measure { max-width: 65ch; }

/* ---------- buttons & fields ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.5rem 1.125rem;
  border: 1px solid transparent;
  border-radius: var(--r-control);
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.2;
  text-decoration: none;
  text-align: center;
  transition: background-color 150ms, border-color 150ms, color 150ms, transform 150ms;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; }
.btn-primary { background: var(--action); color: var(--ink); }
.btn-primary:hover:not(:disabled) { background: var(--action-hover); }
.btn-solid { background: var(--forest-800); color: #fff; }
.btn-solid:hover:not(:disabled) { background: var(--forest-900); }
.btn-quiet { background: var(--n-100); color: var(--n-900); }
.btn-quiet:hover:not(:disabled) { background: var(--n-200); }
.btn-outline { background: var(--surface); border-color: var(--n-300); color: var(--n-900); }
.btn-outline:hover:not(:disabled) { border-color: var(--forest-700); color: var(--forest-800); }
.btn-danger { background: var(--red-700); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--red-900); }
.btn-ghost-light { background: rgb(255 255 255 / 0.12); color: #fff; border-color: rgb(255 255 255 / 0.3); }
.btn-ghost-light:hover { background: rgb(255 255 255 / 0.22); }
.btn-sm { min-height: 2.25rem; padding: 0.35rem 0.8rem; font-size: 0.875rem; }
.btn-block { width: 100%; }
.link-btn {
  background: none; border: 0; padding: 0; color: var(--forest-800);
  font-weight: 600; text-decoration: underline; text-underline-offset: 0.2em;
}
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.75rem; height: 2.75rem; border-radius: var(--r-control);
  border: 1px solid var(--n-200); background: var(--surface);
}
.icon-btn:hover { background: var(--n-100); }

.field-group { display: flex; flex-direction: column; gap: 0.375rem; }
.label { font-weight: 600; font-size: 0.9375rem; color: var(--n-900); }
.help { font-size: 0.8125rem; color: var(--n-600); }
.error-text { font-size: 0.875rem; color: var(--red-900); background: var(--red-50); padding: 0.75rem; border-radius: var(--r-control); display: flex; gap: 0.5rem; }
.ok-text { font-size: 0.875rem; color: var(--forest-900); background: var(--forest-50); padding: 0.75rem; border-radius: var(--r-control); display: flex; gap: 0.5rem; }
.notice { font-size: 0.875rem; background: var(--yellow-50); color: var(--yellow-900); padding: 0.75rem 1rem; border-radius: var(--r-control); display: flex; gap: 0.625rem; align-items: flex-start; }
.field {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.875rem;
  background: var(--surface);
  border: 1px solid var(--n-500);
  border-radius: var(--r-control);
  font-size: 1rem;
}
textarea.field { min-height: 6rem; resize: vertical; }
.field:hover { border-color: var(--n-700); }
.field:focus { border-color: var(--forest-700); }
.field[aria-invalid='true'] { border-color: var(--red-700); }
::placeholder { color: var(--n-600); opacity: 1; }
input[type='checkbox'], input[type='radio'], input[type='range'] { accent-color: var(--forest-700); }
.check { display: flex; gap: 0.625rem; align-items: flex-start; font-size: 0.9375rem; }
.check input { width: 1.125rem; height: 1.125rem; margin-top: 0.2rem; flex: none; }
.form-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .form-grid.two { grid-template-columns: 1fr 1fr; } }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border-radius: var(--r-card); padding: 1.25rem; }
@media (min-width: 640px) { .card { padding: 1.75rem; } }
.card-flat { background: var(--n-50); border-radius: var(--r-inner); padding: 1rem; }
.card-sage { background: var(--forest-100); border-radius: var(--r-card); padding: 1.5rem; }

.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.15rem 0.6rem; border-radius: 999px;
  font-size: 0.8125rem; font-weight: 600; line-height: 1.5; white-space: nowrap;
  background: var(--n-100); color: var(--n-700);
}
.badge-green { background: var(--forest-100); color: var(--forest-900); }
.badge-yellow { background: var(--yellow-100); color: var(--yellow-900); }
.badge-red { background: var(--red-50); color: var(--red-900); }
.badge-dark { background: var(--forest-900); color: #fff; }

.progress { width: 100%; height: 0.5rem; border-radius: 999px; background: var(--n-200); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--forest-700); border-radius: inherit; transition: width 400ms var(--ease-out); }
progress.progress { appearance: none; -webkit-appearance: none; border: 0; }
progress.progress::-webkit-progress-bar { background: var(--n-200); border-radius: 999px; }
progress.progress::-webkit-progress-value { background: var(--forest-700); border-radius: 999px; }
progress.progress::-moz-progress-bar { background: var(--forest-700); border-radius: 999px; }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--surface); border-bottom: 1px solid var(--n-200); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 4rem; }
.brand { display: flex; align-items: center; gap: 0.75rem; min-width: 0; background: none; border: 0; padding: 0.25rem; text-align: left; }
.brand-logos { display: flex; align-items: center; gap: .35rem; flex: none; }
.brand img { width: 2.5rem; height: 2.5rem; border-radius: 0; object-fit: contain; flex: none; }
.brand-copy { min-width: 0; }
.brand-support { display: none; font-size: .75rem; line-height: 1.2; color: var(--n-600); }
@media (min-width: 1280px) { .brand-support { display: block; } }
@media (max-width: 639px) { .brand-logos { gap: .15rem; } .brand img { width: 2rem; height: 2rem; } }
.brand-name { display: block; font-family: var(--font-display); font-weight: 800; font-size: 1.125rem; color: var(--forest-900); line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { display: none; font-size: 0.8125rem; color: var(--n-600); }
@media (min-width: 640px) { .brand-sub { display: block; } }
.nav-links { display: none; align-items: center; gap: 0.25rem; }
@media (min-width: 1024px) { .nav-links { display: flex; } .menu-toggle { display: none !important; } }
.nav-link { background: none; border: 0; padding: 0.5rem 0.75rem; border-radius: var(--r-control); font-weight: 600; font-size: 0.9375rem; color: var(--n-700); white-space: nowrap; }
.nav-link:hover { background: var(--n-100); color: var(--n-900); }
.nav-link[aria-current='page'] { background: var(--forest-100); color: var(--forest-900); }
.nav-actions { display: flex; align-items: center; gap: 0.5rem; flex: none; }
.account-btn { display: flex; align-items: center; gap: 0.5rem; min-height: 2.75rem; padding: 0.25rem 0.75rem 0.25rem 0.25rem; border: 1px solid var(--n-200); border-radius: 999px; background: var(--surface); text-align: left; }
.account-btn:hover { border-color: var(--forest-700); }
.avatar { width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--forest-800); color: #fff; font-weight: 700; font-size: 0.8125rem; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.account-text { display: none; line-height: 1.2; max-width: 10rem; }
.account-text b { display: block; font-size: 0.9375rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-text span { display: block; font-size: 0.8125rem; color: var(--n-600); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 640px) { .account-text { display: block; } }
@media (max-width: 479px) { .brand-name { font-size: 1rem; } .account-btn svg { display: none; } .account-btn { padding-right: 0.25rem; } }
.menu { position: absolute; right: 0; top: calc(100% + 0.5rem); width: 18rem; background: var(--surface); border: 1px solid var(--n-200); border-radius: var(--r-inner); box-shadow: var(--shadow-pop); padding: 0.5rem 0; z-index: 60; animation: rise 200ms var(--ease-out) both; }
.menu-head { padding: 0.5rem 1rem 0.75rem; border-bottom: 1px solid var(--n-100); }
.menu-item { display: flex; gap: 0.75rem; align-items: flex-start; width: 100%; padding: 0.625rem 1rem; background: none; border: 0; text-align: left; font-size: 0.9375rem; }
.menu-item:hover { background: var(--n-50); }
.menu-item.danger { color: var(--red-900); }
.menu-item small { display: block; color: var(--n-600); font-size: 0.8125rem; }
.relative { position: relative; }
.mobile-nav { border-top: 1px solid var(--n-200); padding: 0.5rem 1rem 1rem; }
.mobile-nav .nav-link { display: flex; width: 100%; min-height: 2.75rem; align-items: center; font-size: 1rem; }
@media (min-width: 1024px) { .mobile-nav { display: none; } }

/* ---------- hero & dashboard ---------- */
.hero { display: grid; gap: 1.5rem; grid-template-columns: 1fr; align-items: stretch; }
@media (min-width: 1024px) { .hero { grid-template-columns: 1.1fr 0.9fr; } }
.hero-copy { background: var(--forest-900); color: #fff; border-radius: var(--r-card); padding: 2rem 1.5rem; display: flex; flex-direction: column; gap: 1.25rem; justify-content: center; }
@media (min-width: 640px) { .hero-copy { padding: 3rem; } }
.hero-copy h1 { color: #fff; }
.hero-copy p { color: var(--forest-100); font-size: 1.0625rem; max-width: 34rem; }
.hero-photo { position: relative; border-radius: var(--r-card); overflow: hidden; min-height: 16rem; background: var(--forest-800); }
.hero-photo > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.next-card { position: absolute; left: 1rem; right: 1rem; bottom: 1rem; background: var(--surface); border-radius: var(--r-inner); padding: 1rem; display: flex; gap: 0.875rem; align-items: center; }
.next-card img { width: 4.5rem; height: 4.5rem; border-radius: 14px; object-fit: cover; flex: none; }
.summary-line { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; padding-top: 0.5rem; }
.summary-line div { font-size: 0.9375rem; color: var(--forest-100); }
.summary-line b { color: #fff; font-variant-numeric: tabular-nums; }

.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.chips { display: flex; gap: 0.5rem; overflow-x: auto; padding: 0.25rem 0; scrollbar-width: none; max-width: 100%; }
.chips::-webkit-scrollbar { display: none; }
.chip { min-height: 2.5rem; padding: 0.35rem 1rem; border-radius: 999px; border: 1px solid var(--n-300); background: var(--surface); font-weight: 600; font-size: 0.9375rem; white-space: nowrap; }
.chip:hover { border-color: var(--forest-700); }
.chip[aria-pressed='true'] { background: var(--forest-800); border-color: var(--forest-800); color: #fff; }

.module-grid { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .module-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .module-grid { grid-template-columns: repeat(3, 1fr); } }
.module-card { background: var(--surface); border-radius: var(--r-card); overflow: hidden; display: flex; flex-direction: column; }
.module-card .thumb { aspect-ratio: 16 / 10; overflow: hidden; background: var(--n-100); }
.module-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 500ms var(--ease-out); }
.module-card:hover .thumb img { transform: scale(1.04); }
.module-card .body { padding: 1.25rem; display: flex; flex-direction: column; gap: 0.625rem; flex: 1; }
.module-card .body p.summary { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--n-600); font-size: 0.9375rem; }
.module-card .foot { padding: 0 1.25rem 1.25rem; }
.module-card .stages { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: auto; padding-top: 0.5rem; }

.progress-list { display: flex; flex-direction: column; }
.progress-row { display: grid; gap: 0.75rem; grid-template-columns: 1fr; align-items: center; padding: 0.875rem 0; border-top: 1px solid var(--n-100); }
.progress-row:first-child { border-top: 0; }
@media (min-width: 768px) { .progress-row { grid-template-columns: 1.4fr 1fr auto; } }
.stage-pills { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.band { background: var(--forest-900); color: #fff; border-radius: var(--r-card); padding: 2rem 1.5rem; display: grid; gap: 1.5rem; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 768px) { .band { padding: 2.5rem 3rem; grid-template-columns: 1.4fr 1fr; } }
.band h2 { color: #fff; }
.band p { color: var(--forest-100); }
.band .glyph { font-family: var(--font-arabic); font-size: clamp(3rem, 8vw, 5rem); color: var(--action); line-height: 1.4; direction: rtl; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 0.25rem; overflow-x: auto; border-bottom: 1px solid var(--n-300); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.75rem; padding: 0.5rem 1rem; background: none; border: 0; border-bottom: 3px solid transparent; font-weight: 600; font-size: 0.9375rem; color: var(--n-600); white-space: nowrap; margin-bottom: -1px; }
.tab:hover { color: var(--n-900); }
.tab[aria-selected='true'] { color: var(--forest-900); border-bottom-color: var(--forest-700); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--r-inner); }
table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; background: var(--surface); }
th { text-align: left; font-weight: 600; color: var(--n-600); font-size: 0.8125rem; padding: 0.75rem 1rem; background: var(--n-50); white-space: nowrap; }
td { padding: 0.75rem 1rem; border-top: 1px solid var(--n-100); vertical-align: middle; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--n-50); }

/* ---------- quiz & practice ---------- */
.option { display: flex; width: 100%; gap: 0.75rem; align-items: flex-start; text-align: left; padding: 0.875rem 1rem; background: var(--surface); border: 1.5px solid var(--n-300); border-radius: var(--r-inner); font-size: 1rem; line-height: 1.45; transition: border-color 120ms, background-color 120ms; }
.option:hover:not(:disabled) { border-color: var(--forest-700); background: var(--forest-50); }
.option[aria-pressed='true'] { border-color: var(--forest-700); background: var(--forest-50); }
.option .letter { font-weight: 700; color: var(--forest-800); flex: none; }
.option.is-correct { border-color: var(--forest-700); background: var(--forest-100); }
.option.is-wrong { border-color: var(--red-700); background: var(--red-50); }
.feedback { padding: 1rem; border-radius: var(--r-inner); background: var(--forest-50); }
.feedback.bad { background: var(--red-50); }
.score-big { font-family: var(--font-display); font-weight: 800; font-size: clamp(2.5rem, 7vw, 4rem); line-height: 1; font-variant-numeric: tabular-nums; }
.pair { width: 100%; text-align: left; padding: 0.875rem 1rem; border: 1.5px solid var(--n-300); background: var(--surface); border-radius: var(--r-inner); }
.pair:hover:not(:disabled) { border-color: var(--forest-700); }
.pair.is-selected { border-color: var(--forest-700); background: var(--forest-50); }
.pair.is-done { background: var(--forest-100); border-color: var(--forest-200); color: var(--forest-900); }
.pair:disabled:not(.is-done) { opacity: 0.55; }
.step { display: flex; gap: 0.75rem; align-items: center; padding: 0.75rem 1rem; background: var(--n-50); border-radius: var(--r-inner); }
.step-no { width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--forest-100); color: var(--forest-900); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }

/* ---------- lesson ---------- */
.reading section + section { margin-top: 2rem; padding-top: 2rem; border-top: 1px solid var(--n-100); }
.reading .body { font-size: 1.0625rem; line-height: 1.75; max-width: 65ch; margin-top: 0.75rem; white-space: pre-line; }
.ayah { background: var(--forest-900); color: #fff; border-radius: var(--r-inner); padding: 1.5rem; text-align: center; }
.ayah .arabic { font-size: clamp(1.75rem, 5vw, 2.75rem); }
.reflect { background: var(--yellow-50); color: var(--yellow-900); border-radius: var(--r-inner); padding: 1rem; margin-top: 1rem; font-size: 0.9375rem; }
.player { aspect-ratio: 16 / 9; background: var(--forest-950); border-radius: var(--r-inner); overflow: hidden; position: relative; display: flex; align-items: center; justify-content: center; }
.player iframe, .player video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.range { width: 100%; }

/* ---------- tools ---------- */
.letter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr)); gap: 0.5rem; }
.letter-btn { padding: 0.625rem 0.25rem; border: 1.5px solid var(--n-300); border-radius: var(--r-control); background: var(--surface); text-align: center; }
.letter-btn:hover, .letter-btn.is-active { border-color: var(--forest-700); background: var(--forest-50); }
.letter-btn .arabic { display: block; font-size: 1.75rem; line-height: 1.5; }
.letter-btn small { display: block; font-size: 0.8125rem; color: var(--n-600); }
.list-check { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.875rem; border: 1.5px solid var(--n-300); border-radius: var(--r-inner); background: var(--surface); cursor: pointer; }
.list-check.is-on { border-color: var(--forest-700); background: var(--forest-50); }

/* ---------- modal & toast ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgb(10 38 22 / 0.6); display: flex; align-items: flex-start; justify-content: center; padding: 1rem; overflow-y: auto; animation: fade 200ms both; }
.modal { background: var(--surface); border-radius: var(--r-card); width: 100%; max-width: 40rem; margin: 2rem 0; box-shadow: var(--shadow-pop); animation: rise 280ms var(--ease-out) both; }
.modal.wide { max-width: 56rem; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--n-100); }
.modal-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
#toast-root { position: fixed; top: 4.75rem; right: 1rem; z-index: 90; display: flex; flex-direction: column; gap: 0.5rem; max-width: min(28rem, calc(100vw - 2rem)); }
.toast { background: var(--forest-900); color: #fff; padding: 0.875rem 1rem; border-radius: var(--r-inner); box-shadow: var(--shadow-pop); display: flex; gap: 0.75rem; align-items: flex-start; font-size: 0.9375rem; animation: rise 280ms var(--ease-out) both; }
.toast button { background: none; border: 0; color: #fff; padding: 0.125rem; margin-left: auto; }

/* ---------- login ---------- */
.login { display: grid; background: var(--surface); border-radius: var(--r-card); overflow: hidden; max-width: 64rem; margin: 0 auto; }
@media (min-width: 1024px) { .login { grid-template-columns: 0.9fr 1.1fr; } }
.login aside { position: relative; background: var(--forest-950); color: #fff; padding: 2rem; display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; min-height: 16rem; overflow: hidden; }
.login aside > img.bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.3; }
.login aside::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, var(--forest-950), rgb(10 38 22 / 0.4)); }
.login aside > * { position: relative; z-index: 1; }
.login aside h1 { color: #fff; font-size: clamp(2rem, 4vw, 2.75rem); }
.login aside p { color: var(--forest-100); }
.auth-brand { display: flex; flex-direction: column; align-items: flex-start; gap: .75rem; }
.auth-brand-row { display: flex; align-items: center; gap: .65rem; }
.auth-brand-row img { width: 3.25rem; height: 3.25rem; object-fit: contain; }
.auth-brand-row .brand-name { color: #fff; font-size: 1.25rem; white-space: normal; }
.auth-brand-row div > span:last-child { display: block; font-size: .875rem; color: #fff; }
.login aside .auth-tag { display: inline-block; margin: 0; padding: .3rem .65rem; border-radius: .4rem; background: var(--forest-800); color: #fff; font-size: .8125rem; }
.auth-intro { display: flex; flex-direction: column; gap: .75rem; }
.auth-intro > p { max-width: 24rem; }
.auth-research { display: flex; align-items: center; gap: .875rem; border: 1px solid rgb(255 255 255 / .45); background: rgb(5 35 21 / .85); padding: .75rem; border-radius: .75rem; }
.auth-research img { width: 3.75rem; height: 3.75rem; object-fit: contain; flex: none; }
.login aside .auth-research p { color: #fff; font-size: .8125rem; line-height: 1.45; margin: 0; }
.login .panel { padding: 1.5rem; display: flex; flex-direction: column; gap: 1.25rem; }
@media (min-width: 640px) { .login .panel { padding: 2rem; } }
@media (max-width: 639px) {
  .nav-inner { gap: .35rem; }
  .brand { gap: .3rem; flex: 1 1 0; }
  .brand-name { font-size: .9rem; }
  .nav-actions { gap: .25rem; }
  .nav-actions .btn { padding-inline: .45rem; font-size: .75rem; }
  .login { min-width: 0; }
  .login aside { padding: 1.25rem; }
  .auth-brand-row { min-width: 0; gap: .4rem; }
  .auth-brand-row img { width: 2.5rem; height: 2.5rem; flex: none; }
  .auth-brand-row div { min-width: 0; }
  .auth-brand-row .brand-name { font-size: 1rem; }
  .auth-brand-row div > span:last-child { font-size: .75rem; }
}
.segmented { display: flex; gap: 0.25rem; background: var(--n-100); padding: 0.25rem; border-radius: var(--r-inner); }
.segmented button { flex: 1; min-height: 2.75rem; border: 0; background: none; border-radius: var(--r-control); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; color: var(--n-700); }
.segmented button[aria-selected='true'] { background: var(--surface); color: var(--forest-900); box-shadow: 0 1px 2px rgb(15 42 23 / 0.1); }
.pick { padding: 0.75rem; text-align: left; border: 1px solid var(--n-200); background: var(--surface); border-radius: var(--r-inner); }
.pick:hover { border-color: var(--forest-700); }
.pick[aria-pressed='true'] { border-color: var(--forest-700); background: var(--forest-50); }

/* Teacher peer ratings */
.rating-category { border: 0; border-top: 1px solid var(--n-200); margin: 0; padding: .85rem 0 0; }
.rating-category legend { font-weight: 700; padding: 0 .35rem 0 0; }
.rating-options { display: flex; flex-wrap: wrap; gap: .4rem; }
.rating-option { display: flex; align-items: center; cursor: pointer; }
.rating-option input { position: absolute; opacity: 0; }
.rating-option span { display: inline-flex; align-items: center; gap: .2rem; min-height: 2.75rem; padding: .4rem .65rem; border: 1px solid var(--n-200); border-radius: .5rem; }
.rating-option span span { display: inline; border: 0; min-height: 0; padding: 0; color: #815e00; }
.rating-option input:checked + span { border-color: var(--forest-700); background: var(--forest-100); color: var(--forest-900); font-weight: 700; }
.rating-option input:focus-visible + span { outline: 3px solid var(--forest-700); outline-offset: 2px; }
.rating-response { border-top: 1px solid var(--n-200); padding-top: 1rem; }
.rating-values { display: grid; grid-template-columns: repeat(auto-fit,minmax(10rem,1fr)); gap: .5rem; margin: .75rem 0; }
.rating-values dt { font-size: .8125rem; color: var(--n-600); }
.rating-values dd { margin: 0; font-weight: 700; }

/* ---------- footer ---------- */
.site-footer { background: var(--forest-950); color: var(--forest-100); margin-top: 5rem; }
.site-footer a, .site-footer .link-btn { color: var(--forest-100); }
.site-footer .link-btn:hover { color: #fff; }
.footer-grid { display: grid; gap: 2.5rem; padding-top: 3rem; padding-bottom: 3rem; grid-template-columns: 1fr; }
@media (min-width: 768px) { .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .footer-grid { grid-template-columns: 1.4fr 1.35fr .7fr 1.2fr; } }
.footer-support { display: flex; align-items: flex-start; gap: 1rem; font-size: .875rem; }
.footer-support img { width: 4.5rem; height: 4.5rem; object-fit: contain; flex: none; }
.footer-support p + p { margin-top: .5rem; }
.footer-support strong { color: #fff; font-weight: 600; }
.site-footer h2 { color: #fff; font-size: 1.25rem; }
.site-footer h3 { color: #fff; font-size: 1rem; font-family: var(--font-body); font-weight: 700; letter-spacing: 0; }
.footer-base { border-top: 1px solid rgb(255 255 255 / 0.2); font-size: 0.8125rem; color: var(--forest-100); padding: 1.25rem 0; text-align: center; line-height: 1.6; }

/* ---------- certificate ---------- */
.certificate { border: 8px double rgb(15 59 32 / 0.35); border-radius: var(--r-inner); padding: 2rem; text-align: center; background: var(--surface); }
.signature { border-top: 1px solid var(--n-400); padding-top: 0.5rem; margin-top: 3rem; font-size: 0.875rem; color: var(--n-700); }
@media print {
  body * { visibility: hidden; }
  #printable-certificate, #printable-certificate * { visibility: visible; }
  #printable-certificate { position: absolute; left: 0; top: 0; width: 100%; }
}

/* ---------- motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.enter > * { animation: rise 520ms var(--ease-out) both; }
.enter > *:nth-child(2) { animation-delay: 70ms; }
.enter > *:nth-child(3) { animation-delay: 140ms; }
.enter > *:nth-child(4) { animation-delay: 210ms; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--n-300); border-radius: 999px; }
* { scrollbar-color: var(--n-300) transparent; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Profile & security additions */
.profile-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.25rem;
  align-items: center;
}
.profile-card .profile-photo {
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile-card .profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
}
@media (max-width: 540px) {
  .profile-card { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .profile-card .profile-actions { justify-content: center; }
}
.avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.avatar.bg-teal-600 { background: #0d9488; }
.avatar.bg-emerald-700 { background: #047857; }
.avatar.bg-amber-600 { background: #d97706; }
.avatar.bg-rose-600 { background: #e11d48; }
.avatar.bg-indigo-600 { background: #4f46e5; }
.avatar.bg-slate-700 { background: #334155; }
.notice {
  display: flex;
  gap: .5rem;
  align-items: center;
  background: var(--yellow-50);
  border: 1px solid var(--yellow-100);
  color: var(--yellow-900);
  padding: .625rem .875rem;
  border-radius: var(--r-inner);
  font-size: .9375rem;
}
