/* Darasa: flat, mobile-first, WCAG 2.1 AA. Breakpoints 480 / 768 / 1024.
   Colours: --primary comes from the tenant (layout sets it with a nonce'd <style>). */
:root {
  --primary: #4169E1; --primary-ink: #3558C9; --primary-dark: #375AC0; --on-primary: #fff;
  --ink: #111827; --ink-2: #374151; --muted: #4B5563; --line: #D1D5DB; --line-2: #E5E7EB;
  --bg: #F3F4F6; --surface: #fff;
  --success: #15803D; --success-bg: #DCFCE7; --warning: #92400E; --warning-bg: #FEF3C7;
  --danger: #B91C1C; --danger-bg: #FEE2E2; --info: #1E40AF; --info-bg: #DBEAFE;
  --radius: 8px; --focus: 0 0 0 3px #fff, 0 0 0 5px #1D4ED8;
  --tabbar-h: 64px; --topbar-h: 60px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
body.plain { padding-bottom: 0; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
a { color: var(--primary-ink); text-underline-offset: 2px; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: .5rem 1rem; }
.skip-link:focus { left: 8px; }
.muted { color: var(--muted); } .small { font-size: .875rem; } .nowrap { white-space: nowrap; }
.upper { text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-top: 1rem; }
.hide-sm { display: none; }

/* ---------- icons ---------- */
.icon { width: 20px; height: 20px; flex: none; vertical-align: -4px; }
.icon--sm { width: 16px; height: 16px; } .icon--lg { width: 40px; height: 40px; color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .5rem 1rem; border: 1px solid transparent; border-radius: var(--radius);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; background: none; color: var(--ink);
}
.btn--primary { background: var(--primary); color: var(--on-primary); }
.btn--primary:hover { background: var(--primary-dark); color: var(--on-primary); }
.btn--secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn--secondary:hover { border-color: var(--ink-2); color: var(--ink); }
.btn--ghost { color: var(--ink-2); }
.btn--ghost:hover { background: var(--line-2); color: var(--ink); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--sm { min-height: 40px; padding: .35rem .7rem; font-size: .9rem; }
.btn--lg { min-height: 52px; padding: .75rem 1.5rem; font-size: 1.1rem; }
.btn--block { width: 100%; }
.btn[aria-busy="true"] { opacity: .8; cursor: progress; }
.btn[aria-busy="true"]::before { content: ""; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- forms ---------- */
.field { margin-bottom: 1rem; }
.field label, .search-big label { display: block; font-weight: 600; margin-bottom: .3rem; }
.input {
  width: 100%; min-height: 44px; padding: .55rem .75rem; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid #6B7280; border-radius: var(--radius);
}
.input:focus { outline: none; box-shadow: var(--focus); }
.input[aria-invalid="true"] { border-color: var(--danger); border-width: 2px; }
.input--code { font-size: 1.5rem; letter-spacing: .4em; text-align: center; }
.input-group { display: flex; gap: .5rem; }
.input-group .input { flex: 1; min-width: 0; }
.field__error { color: var(--danger); font-size: .875rem; font-weight: 600; margin: .3rem 0 0; min-height: 0; }
.field__error:empty { display: none; }
.field__error:not(:empty)::before { content: "Error: "; }

/* ---------- cards, pills, notices ---------- */
.card { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 1rem; }
.section { margin-bottom: 1rem; }
.section h2 { display: flex; align-items: center; gap: .4rem; }
.pill {
  display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600;
  border: 1px solid currentColor; white-space: nowrap; vertical-align: middle;
}
.pill--neutral { color: var(--ink-2); background: var(--line-2); }
.pill--success { color: var(--success); background: var(--success-bg); }
.pill--warning { color: var(--warning); background: var(--warning-bg); }
.pill--danger { color: var(--danger); background: var(--danger-bg); }
.pill--info { color: var(--info); background: var(--info-bg); }
.notice { display: flex; gap: .5rem; align-items: flex-start; padding: .75rem; border-radius: var(--radius); margin-bottom: 1rem; border-left: 4px solid; }
.notice p { margin: 0; }
.notice--danger { background: var(--danger-bg); color: var(--danger); }
.notice--info { background: var(--info-bg); color: var(--info); }
.notice--success { background: var(--success-bg); color: var(--success); }
.notice--warning { background: var(--warning-bg); color: var(--warning); }
.badge { background: var(--danger); color: #fff; border-radius: 999px; font-size: .75rem; padding: 0 .4rem; min-width: 1.25rem; text-align: center; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  padding: .5rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line-2);
}
.brand { display: inline-flex; align-items: center; gap: .5rem; color: var(--ink); text-decoration: none; font-weight: 700; }
.brand__mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; background: var(--primary); color: var(--on-primary); font-size: .85rem; }
.brand--center { justify-content: center; margin: 0 auto 1rem; display: flex; }
.topbar__actions { margin-left: auto; display: flex; gap: .25rem; }
.topsearch { order: 3; flex: 1 1 100%; display: flex; gap: .5rem; }
.topsearch .btn { flex: none; }
.avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--line-2); color: var(--ink); font-size: .8rem; font-weight: 700; }
.avatar--lg { width: 48px; height: 48px; font-size: 1rem; }

.menu { position: relative; }
.menu__panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: min(280px, calc(100vw - 2rem));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.menu__panel--wide { width: min(340px, calc(100vw - 2rem)); }
.menu__title { font-weight: 700; margin-bottom: .25rem; }
.alert-list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow: auto; }
.alert-list a { display: flex; flex-direction: column; padding: .5rem; border-radius: 6px; color: var(--ink); text-decoration: none; }
.alert-list a:hover { background: var(--bg); }
.alert-list .is-unread a { border-left: 3px solid var(--primary); }

/* ---------- shell ---------- */
.shell { display: block; }
main { display: block; padding: 1rem; max-width: 1200px; margin: 0 auto; }
main:focus { outline: none; }
.sidebar { display: none; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--ink-2); text-decoration: none; font-size: .78rem; font-weight: 600;
}
.tabbar a[aria-current="page"] { color: var(--primary-ink); box-shadow: inset 0 3px 0 var(--primary); }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem; padding: 0; margin: 0 0 .75rem; font-size: .9rem; }
.breadcrumbs li + li::before { content: "›"; margin-right: .25rem; color: var(--muted); }
.page-head { margin-bottom: 1rem; }

/* ---------- dashboard ---------- */
.dash-grid { display: grid; gap: 1rem; }
.card-grid { display: grid; gap: .75rem; grid-template-columns: 1fr; }
.course-card { display: flex; flex-direction: column; gap: .4rem; }
.course-card__code { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 0; }
/* Full course names, wrapped, never cut off (Rule 8). */
.course-card__title { font-size: 1.05rem; margin: 0; overflow-wrap: anywhere; }
.course-card__title a { color: var(--ink); text-decoration: none; }
.course-card__title a:hover { text-decoration: underline; }
.course-card__actions { margin-top: auto; }
.progress { display: flex; flex-direction: column; gap: .25rem; }
.progress--wide { max-width: 420px; }
progress { width: 100%; height: 10px; appearance: none; border: 0; border-radius: 999px; background: var(--line-2); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--line-2); }
progress::-webkit-progress-value { background: var(--success); }
progress::-moz-progress-bar { background: var(--success); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin-bottom: 1rem; }
.stat { display: flex; flex-direction: column; } .stat__n { font-size: 1.75rem; font-weight: 700; }
.list, .due-list, .results, .items, .contact { list-style: none; margin: 0; padding: 0; }
.list li, .due-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem .75rem; padding: .6rem 0; border-top: 1px solid var(--line-2); }
.list li:first-child, .due-list li:first-child { border-top: 0; }
.list--stacked li, .due-list li { flex-direction: column; }
.due-list a { font-weight: 600; }
.due-list .pill { align-self: flex-start; }

/* ---------- course home ---------- */
.live { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.week { margin-bottom: .5rem; padding: 0; }
.week summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding: .85rem 1rem; cursor: pointer; font-weight: 600; min-height: 44px; }
.week > :not(summary) { margin-left: 1rem; margin-right: 1rem; }
.week[open] { padding-bottom: .75rem; }
.week__meta { display: flex; gap: .5rem; align-items: center; font-weight: 400; }
.items li { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .55rem 0; border-top: 1px solid var(--line-2); }
.items__title { flex: 1 1 200px; }
.profile-card__head { display: flex; gap: .75rem; align-items: center; margin-bottom: .5rem; }
.contact li { display: flex; gap: .5rem; align-items: flex-start; padding: .3rem 0; overflow-wrap: anywhere; }
.announcement + .announcement { border-top: 1px solid var(--line-2); padding-top: .75rem; margin-top: .75rem; }
.prose { overflow-wrap: anywhere; }

/* ---------- search ---------- */
.search-big { margin: 1rem 0; }
.results li { padding: .6rem 0; border-top: 1px solid var(--line-2); }
.results a { font-weight: 600; }
mark { background: #FEF08A; color: inherit; padding: 0 1px; }

/* ---------- tables become stacked cards on phones ---------- */
.table { width: 100%; border-collapse: collapse; }
.table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.table tr { display: block; border-top: 1px solid var(--line-2); padding: .5rem 0; }
/* Label above value: long names and emails wrap instead of pushing the page sideways. */
.table td { display: block; padding: .2rem 0; overflow-wrap: anywhere; }
.table td::before { content: attr(data-label); display: block; font-size: .8rem; font-weight: 600; color: var(--muted); }

/* ---------- empty, error, auth ---------- */
.empty { text-align: center; padding: 2rem 1rem; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty__title { font-weight: 700; margin-top: .5rem; }
.plain__main { max-width: 480px; margin: 0 auto; padding: 2rem 1rem; }
.plain__foot { text-align: center; margin-top: 1.5rem; }
.auth-card h1 { font-size: 1.4rem; }
.auth-card__links { margin-top: 1rem; text-align: center; }
.error-page__code { display: flex; align-items: center; gap: .4rem; color: var(--danger); font-weight: 700; }
.error-page__facts dt { font-weight: 700; margin-top: .5rem; }
.error-page__facts dd { margin: 0 0 .25rem; }
.error-page__report { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; border-top: 1px solid var(--line-2); padding-top: .75rem; }
.debug pre { white-space: pre-wrap; font-size: .75rem; background: var(--bg); padding: .75rem; overflow: auto; }

/* ---------- modal, toasts, loading ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 1rem; background: rgba(17,24,39,.55); }
.modal__box { background: var(--surface); border-radius: var(--radius); padding: 1.25rem; max-width: 440px; width: 100%; }
.modal__actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.toasts { position: fixed; left: 1rem; right: 1rem; bottom: calc(var(--tabbar-h) + 1rem); z-index: 60; display: flex; flex-direction: column; gap: .5rem; pointer-events: none; }
body.plain .toasts { bottom: 1rem; }
.toast {
  pointer-events: auto; display: flex; gap: .5rem; align-items: flex-start; padding: .75rem 1rem; border-radius: var(--radius);
  background: var(--ink); color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.2); border-left: 5px solid var(--info-bg);
}
.toast--success { border-left-color: #4ADE80; } .toast--error { border-left-color: #F87171; } .toast--warning { border-left-color: #FBBF24; }
.toast button { margin-left: auto; color: #fff; min-height: 32px; }
.loadbar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 70; overflow: hidden; }
.loadbar span { display: block; height: 100%; width: 40%; background: var(--primary); animation: load 1.1s ease-in-out infinite; }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.slow-note { position: fixed; top: 8px; left: 50%; transform: translateX(-50%); z-index: 70; background: var(--ink); color: #fff; padding: .4rem .9rem; border-radius: 999px; font-size: .875rem; }
.skeleton { display: block; background: var(--line-2); border-radius: 6px; min-height: 1rem; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }   /* flat, no gradient (UI rule) */

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }

/* ---------- 480+ ---------- */
@media (min-width: 480px) {
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .toasts { left: auto; width: 380px; }
}
/* ---------- 768+ ---------- */
@media (min-width: 768px) {
  body { padding-bottom: 0; }
  .tabbar { display: none; }
  .toasts { bottom: 1rem; }
  .hide-sm { display: inline; }
  .topsearch { order: 0; flex: 0 1 460px; margin-left: 1rem; }
  .shell { display: grid; grid-template-columns: 200px minmax(0, 1fr); }   /* minmax: a wide course menu scrolls instead of widening the page */
  .sidebar { display: block; position: sticky; top: var(--topbar-h); align-self: start; height: calc(100vh - var(--topbar-h)); padding: 1rem .5rem; border-right: 1px solid var(--line-2); background: var(--surface); }
  .sidebar ul { list-style: none; margin: 0; padding: 0; }
  .sidebar a { display: flex; align-items: center; gap: .6rem; padding: .6rem .75rem; border-radius: var(--radius); color: var(--ink-2); text-decoration: none; font-weight: 600; min-height: 44px; }
  .sidebar a:hover { background: var(--bg); color: var(--ink); }
  .sidebar a[aria-current="page"] { background: var(--info-bg); color: var(--primary-ink); }
  main { padding: 1.5rem; width: 100%; }
  h1 { font-size: 1.75rem; }
  .table thead { position: static; width: auto; height: auto; clip: auto; }
  .table tr { display: table-row; padding: 0; }
  .table th, .table td { display: table-cell; text-align: left; padding: .6rem .5rem; border-top: 1px solid var(--line-2); vertical-align: top; }
  .table td::before { display: none; }
}
/* ---------- 1024+ ---------- */
@media (min-width: 1024px) {
  .shell { grid-template-columns: 220px minmax(0, 1fr); }
  .dash-grid { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; }
}
@media print {
  .topbar, .sidebar, .tabbar, .toasts, .skip-link { display: none !important; }
  body { background: #fff; }
}
.account-name { max-width: 6rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Phase 2: admin, billing, signup ===== */
.plain__main--wide { max-width: 760px; }
.narrow { max-width: 640px; }
.fieldset { border: 1px solid var(--line-2); border-radius: var(--radius); padding: 1rem; margin: 0 0 1rem; }
.fieldset legend { font-weight: 700; padding: 0 .4rem; }

.check { display: flex; gap: .6rem; align-items: flex-start; margin: .4rem 0; cursor: pointer; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; }

.banner { display: flex; gap: .5rem; align-items: flex-start; padding: .6rem 1rem; border-bottom: 1px solid; }
.banner p { margin: 0; }
.banner--info { background: var(--info-bg); color: var(--info); }
.banner--warning { background: var(--warning-bg); color: var(--warning); }
.banner--danger { background: var(--danger-bg); color: var(--danger); }
.banner a { color: inherit; font-weight: 700; }
.meter { margin: .6rem 0 .9rem; }
.meter__head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem .75rem; font-size: .9rem; margin-bottom: .25rem; }
.meter--high progress::-webkit-progress-value { background: #D97706; } .meter--high progress::-moz-progress-bar { background: #D97706; }
.meter--full progress::-webkit-progress-value { background: var(--danger); } .meter--full progress::-moz-progress-bar { background: var(--danger); }
.meter--full .meter__head span, .meter--high .meter__head span { font-weight: 700; }

.form-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .5rem; }
.stack-top { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line-2); }
.page-head--actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: .75rem; }
.filters { display: grid; gap: 0 .75rem; grid-template-columns: 1fr; margin-bottom: 1rem; }

.inline-form { display: inline-flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin: .15rem 0; }
.input--sm { min-height: 40px; width: auto; padding: .3rem .5rem; }
.input--color { width: 56px; min-width: 56px; padding: 2px; flex: none !important; }
.pager { display: flex; gap: .75rem; align-items: center; justify-content: center; margin: 1rem 0; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tabs a { padding: .6rem 1rem; text-decoration: none; color: var(--ink-2); font-weight: 600; white-space: nowrap; min-height: 44px; display: inline-flex; align-items: center; }
.tabs a[aria-current="page"] { color: var(--primary-ink); box-shadow: inset 0 -3px 0 var(--primary); }
.defs dt { font-weight: 700; margin-top: .5rem; } .defs dd { margin: 0; overflow-wrap: anywhere; }
.proof-frame { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: var(--radius); }
.proof-img { max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius); }
.brand__logo { height: 36px; width: auto; max-width: 140px; object-fit: contain; }
.logo-preview { max-height: 64px; border: 1px dashed var(--line); padding: 4px; background: var(--surface); }
.brand-preview { display: flex; gap: 1rem; align-items: center; margin-top: .5rem; }
.big-line { font-size: 1.15rem; }
.setup-card { border-left: 4px solid var(--primary); }

code { background: var(--bg); padding: 0 .3rem; border-radius: 4px; }
/* Printable invoice / receipt */
.doc { max-width: 760px; margin: 0 auto; padding: 1rem; }
.doc__tools { display: flex; gap: .5rem; }
.doc__page { background: #fff; border: 1px solid var(--line-2); padding: 1.5rem; }
.doc__head { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 2px solid var(--ink); padding-bottom: .75rem; margin-bottom: 1rem; }
.doc__meta { text-align: right; } .doc__meta p { margin: 0; }
.doc__facts { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; } .doc__facts dt { font-weight: 700; } .doc__facts dd { margin: 0; }
  

@media (min-width: 768px) { .filters { grid-template-columns: 2fr 1fr 1fr auto; align-items: end; } }
@media print { .no-print { display: none !important; } .doc__page { border: 0; padding: 0; } body { background: #fff; } }

/* ===== Phase 3: course menu, lessons, builder, editor ===== */
.course-head { margin-bottom: .25rem; }
.course-head__title { font-size: 1.15rem; font-weight: 700; margin: 0 0 .5rem; overflow-wrap: anywhere; }
/* Rule 2: one short menu. Phones: one row that scrolls sideways, never wrapping into a block of links. */
/* position: relative keeps screen-reader-only text inside the scrolling row (it is absolutely positioned). */
.course-menu { position: relative; display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: thin; border-bottom: 1px solid var(--line); margin: 0 0 1rem; -webkit-overflow-scrolling: touch; }
.course-menu a { display: inline-flex; align-items: center; gap: .35rem; flex: none; min-height: 44px; padding: .5rem .85rem; white-space: nowrap;
  text-decoration: none; color: var(--ink-2); font-weight: 600; border-radius: var(--radius) var(--radius) 0 0; }
.course-menu a:hover { background: var(--surface); color: var(--ink); }
.course-menu a[aria-current="page"] { color: var(--primary-ink); box-shadow: inset 0 -3px 0 var(--primary); background: var(--surface); }
.course-menu__edit { margin-left: auto; }
.course-menu__edit ~ .course-menu__edit { margin-left: 0; }   /* staff links sit together at the end */
.continue .btn { justify-content: flex-start; text-align: left; white-space: normal; }
.lock-reason { display: inline-flex; gap: .3rem; align-items: center; color: var(--warning); font-weight: 600; }
.items li.is-locked .items__title > span:first-child { color: var(--muted); }
.items .lock-reason { display: flex; margin-top: .15rem; }

.prose h2 { margin-top: 1.25rem; } .prose h3 { margin-top: 1rem; } .prose ul, .prose ol { padding-left: 1.4rem; }

.name-list { list-style: none; padding: 0; columns: 2 160px; }
.name-list li { padding: .25rem 0; break-inside: avoid; }

.check-grid { display: grid; gap: .25rem 1rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
/* Page editor: the textarea is the no-JavaScript fallback; JS swaps in the formatted editor. */

@media (min-width: 768px) {
  
  .course-head__title { font-size: 1.35rem; }
}

/* ===== Phase 4: assessments, quizzes, grading ===== */
/* Rule 5: the confirmation is full width and impossible to miss. */

.defs--inline { display: grid; grid-template-columns: max-content 1fr; gap: .2rem 1rem; margin: 0; }
.defs--inline dt { margin: 0; } .defs--inline dd { margin: 0; }

code.wrap { word-break: break-all; }

.question legend { padding: 0; }

.option { padding: .5rem; border: 1px solid var(--line-2); border-radius: var(--radius); margin: .35rem 0; }
.option:has(input:checked) { border-color: var(--primary); background: var(--info-bg); }

@media (min-width: 768px) {
  
  .defs--inline { gap: .3rem 1.5rem; }
}

/* Phase 5, needed on every page: alerts menu footer and unread badges. The rest is in comms.css. */
.actions-row { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin: .75rem 0 0; }
.menu__foot { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; border-top: 1px solid var(--line-2); margin-top: .5rem; padding-top: .5rem; font-size: .875rem; }
.tabbar a { position: relative; }
.badge--dot { position: absolute; top: 4px; left: calc(50% + 6px); }
.sidebar .badge { margin-left: auto; }
.file-card { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; }
.file-card .icon--lg { color: var(--primary-ink); }

/* Phase 6, every page: connection banner, page skeleton (Rule 11), data-saver images. */
.net-status { display: flex; flex-wrap: wrap; gap: .4rem .75rem; align-items: center; padding: .55rem 1rem; background: var(--warning-bg); color: var(--warning); border-bottom: 1px solid #F59E0B; font-size: .9rem; }
.net-status .btn { color: inherit; }
.page-skeleton { display: grid; gap: .75rem; padding: .25rem 0 1rem; }
.skeleton--title { height: 1.8rem; width: 60%; }
.skeleton--line { height: 1rem; width: 90%; }
.skeleton--short { width: 45%; }
.skeleton--card { height: 7rem; }
.is-navigating main > :not(.page-skeleton) { display: none; }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
.tap-media { display: inline-flex; gap: .4rem; align-items: center; padding: .5rem .75rem; border: 1px dashed var(--line); border-radius: var(--radius); margin: .25rem 0; text-decoration: none; }
.saver-form { margin: .5rem 0; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
/* Phase 8: "View as user" support bar. Flat, high-contrast, always visible at the top. */
.viewas-bar { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between;
  padding: .5rem 1rem; background: #fde68a; color: #1f2937; border-bottom: 2px solid #b45309; }
.viewas-bar p { margin: 0; display: flex; gap: .5rem; align-items: center; }
.viewas-bar form { margin: 0; }
.viewas-bar p { font-size: .9rem; }
/* On wide screens it stays in view; on phones it scrolls away so it doesn't eat the screen (it is on every page anyway). */
@media (min-width: 768px) { .viewas-bar { position: sticky; top: 0; z-index: 60; } .viewas-bar p { font-size: 1rem; } }
/* Desktop: staff have up to ten course tabs; wrap them rather than hide some behind a sideways scroll. */
@media (min-width: 1024px) { .course-menu { flex-wrap: wrap; overflow-x: visible; } }
