/* ============================================================================
   Auraz Academy — development client
   ----------------------------------------------------------------------------
   Built on the Auraz shared foundation (ERP css/tokens.css): the formal palette
   is red and white, and black and red in dark mode. Never gold — an early
   landing draft used a gold accent and was corrected by the owner.

   Carried across verbatim so the Academy reads as the same product:
     · --az-red #C7312E, deep #A22323, soft #E2574E (accent TEXT on dark, for AA)
     · black surfaces #08090C / #101318 in dark, white in light
     · interactive corners = 6px, inputs = 6px, cards = 14px
     · one motion bezier, cubic-bezier(.32,.72,0,1), at functional speed
     · the shared top bar uses the active theme and stays stable across views

   The brand families (Cabinet Grotesk / Satoshi) are not installed here and
   this build fetches nothing, so the stack falls through to the brand's own
   declared fallbacks rather than substituting a different personality.
   ========================================================================== */

:root {
  /* ── Brand primitives ─────────────────────────────────────────────────── */
  --az-void:      #050505;
  --az-obsidian:  #0B0E13;
  --az-bone:      #F4F5F7;
  --az-steel:     #9BA3AF;
  --az-red:       #C7312E;
  --az-red-deep:  #A22323;
  --az-red-soft:  #E2574E;
  --az-green:     #3FB984;
  --az-purple:    #8B7BD8;

  --accent:       var(--az-red);
  --accent-deep:  var(--az-red-deep);
  --accent-ink:   #FFFFFF;
  --accent-tint:  rgba(199, 49, 46, .12);
  --accent-ring:  rgba(199, 49, 46, .20);

  /* ── Light surfaces ───────────────────────────────────────────────────── */
  --bg:        #FFFFFF;
  --bg-tint:   #FAFAFB;
  --card:      #FFFFFF;
  --soft:      #F4F5F7;
  --line:      #E4E7EC;
  --ink:       #14181F;   /* near-black, not navy-grey */
  --sub:       #38414E;
  --muted:     #566072;
  /* Accent TEXT uses the deep red on light grounds: the true brand red
     measures about 5.3:1 against white, while deep red adds contrast. Accent
     FILLS keep the real red with white on top, which passes. */
  --accent-text: var(--az-red-deep);

  --ok:        #1B7A54;
  --ok-bg:     #E7F4EE;
  --warn:      #8A5A00;
  --warn-bg:   #FDF3E2;
  --danger:    #B3261E;
  --danger-bg: #FBE9E7;

  /* ── Shape, type, motion (locked) ─────────────────────────────────────── */
  --shape-pill:  6px;
  --shape-button: 6px;
  --shape-input: 6px;
  --shape-card:  14px;
  --font-display: 'Cabinet Grotesk', 'Segoe UI', system-ui, sans-serif;
  --font-body:    'Satoshi', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', Consolas, monospace;
  --ease-brand: cubic-bezier(.32, .72, 0, 1);
  --mo-fast: .14s var(--ease-brand);
  --mo:      .2s var(--ease-brand);

  --shadow-1: 0 1px 2px rgba(10, 12, 16, .06);
  --shadow-2: 0 10px 28px -14px rgba(10, 12, 16, .28);
}

/* ── Dark: black and red, not generic slate ─────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #08090C;
    --bg-tint:   #0B0D11;
    --card:      #101318;
    --soft:      rgba(255, 255, 255, .05);
    --line:      rgba(255, 255, 255, .09);
    --ink:       var(--az-bone);
    --sub:       #B7BDC7;
    --muted:     #8A919D;
    /* Accent TEXT lifts to the soft red so small type passes AA on black;
       accent FILLS stay the true brand red with white on top. */
    --accent-text: #F08076; /* readable brand-red text on tinted dark surfaces */
    --accent-tint: rgba(199, 49, 46, .16);
    --accent-ring: rgba(199, 49, 46, .28);
    --ok: #5FD3A2;  --ok-bg: rgba(63, 185, 132, .14);
    --warn: #E3B261; --warn-bg: rgba(227, 178, 97, .14);
    --danger: #F08076; --danger-bg: rgba(226, 87, 78, .16);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow-2: 0 14px 34px -16px rgba(0, 0, 0, .7);
  }
}
:root[data-theme="dark"] {
  --bg: #08090C; --bg-tint: #0B0D11; --card: #101318;
  --soft: rgba(255,255,255,.05); --line: rgba(255,255,255,.09);
  --ink: var(--az-bone); --sub: #B7BDC7; --muted: #8A919D;
  --accent-text: #F08076;
  --accent-tint: rgba(199,49,46,.16); --accent-ring: rgba(199,49,46,.28);
  --ok: #5FD3A2; --ok-bg: rgba(63,185,132,.14);
  --warn: #E3B261; --warn-bg: rgba(227,178,97,.14);
  --danger: #F08076; --danger-bg: rgba(226,87,78,.16);
  --shadow-1: 0 1px 2px rgba(0,0,0,.5);
  --shadow-2: 0 14px 34px -16px rgba(0,0,0,.7);
}

* { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
[hidden] { display: none !important; }

body {
  margin: 0;
  color: var(--ink);
  font: 15px/1.55 var(--font-body);
  background: var(--bg);
}

a { color: var(--accent-text); }

/* ── Shared top bar: route-independent geometry in both themes ─────────── */
header.top {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-display);
  font-weight: 700; letter-spacing: -.03em; font-size: 19px;
  color: var(--ink);
}
.brand { text-decoration: none; white-space: nowrap; }
.academy-section { background: transparent; border: 0; color: var(--accent-text); padding: 8px 0;
  border-inline-start: 1px solid var(--line); padding-inline-start: 14px; flex-shrink: 0;
  font-size: 14px; border-radius: 0; min-height: 44px; }
.academy-context { display: flex; align-items: center; gap: 10px; padding: 10px 24px;
  font-size: 12px; border-bottom: 1px solid var(--line); background: var(--card); color: var(--muted); }
.academy-context a { color: var(--ink); text-decoration: none; }
.header-search { display: flex; align-items: center; flex: 1; gap: 10px; border: 1px solid var(--line);
  background: var(--card); border-radius: var(--shape-pill); padding: 3px 5px 3px 16px; min-width: 220px; }
.header-search svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--ink); stroke-width: 1.5; }
.header-search input { border: 0; background: transparent; min-width: 0; padding: 8px 0; }
.header-search .search-submit { padding: 8px 16px; background: var(--soft); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
/* The mark: a red angular A with an upward stroke, in a white tile — the
   red-on-white lockup the brand asks for on dark surfaces. */
.brand .mark {
  width: 26px; height: 26px; border-radius: 7px; background: #FFFFFF;
  display: grid; place-items: center; flex: none;
}
.brand .mark svg { width: 17px; height: 17px; display: block; }
.top nav { display: flex; gap: 6px; margin-inline-start: auto; flex-wrap: nowrap; flex-shrink: 0; }
.top nav button {
  background: transparent; color: var(--ink); white-space: nowrap; flex-shrink: 0;
  border-color: transparent; min-height: 44px; padding: 6px 13px;
}
.top nav button:hover { background: var(--soft); color: var(--ink); }
.top nav button.primary, .top nav button[aria-current="page"] {
  background: var(--accent); color: #fff; border-color: transparent;
}

.device-strip {
  font-size: 12px; color: var(--muted); padding: 7px 20px;
  background: var(--bg-tint); border-bottom: 1px solid var(--line);
  display: flex; gap: 16px; flex-wrap: wrap;
}
.device-strip code { font-family: var(--font-mono); color: var(--sub); }

/* ── Controls: compact rectangular corners ─────────────────────────────── */
button {
  font: inherit; font-weight: 600; cursor: pointer;
  border-radius: var(--shape-pill); min-height: 38px; padding: 8px 16px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  transition: background var(--mo-fast), border-color var(--mo-fast),
              color var(--mo-fast);
}
button:hover { background: var(--soft); border-color: var(--accent-ring); }
button.primary {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
}
button.primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
button.danger { background: var(--az-red-deep); color: #fff; border-color: var(--az-red-deep); }
button.ghost { background: transparent; }
button[aria-current="true"] { border-color: var(--accent); color: var(--accent-text); }
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, input:focus-visible, textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

main { max-width: 1040px; margin: 0 auto; padding: 26px 20px 72px; }
main:focus { outline: none; }
.skip-link { position: fixed; top: 8px; inset-inline-start: 16px; z-index: 50;
  padding: 12px 18px; background: var(--card); color: var(--ink);
  border: 2px solid var(--accent); border-radius: var(--shape-pill);
  transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
.app-status { max-width: 1040px; margin: auto; padding: 0 20px; color: var(--danger); }
.app-status:not(:empty) { padding-top: 16px; }
.field { flex: 1 1 180px; min-width: 0; }
h1 { font-family: var(--font-display); font-size: 26px; margin: 0 0 4px;
     letter-spacing: -.01em; }
h2 { font-family: var(--font-display); font-size: 18px; margin: 30px 0 10px; }
h3 { font-family: var(--font-display); font-size: 16px; margin: 0 0 4px; }
.sub { color: var(--muted); margin: 0 0 20px; }

label { display: block; font-size: 12.5px; font-weight: 600; color: var(--sub);
        margin: 12px 0 5px; }
input, textarea, select {
  width: 100%; font: inherit; padding: 10px 13px; min-height: 44px;
  border: 1px solid var(--line); border-radius: var(--shape-input);
  background: var(--card); color: var(--ink);
  transition: border-color var(--mo-fast), box-shadow var(--mo-fast);
}
input:focus, textarea:focus { border-color: var(--accent); }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--shape-card); padding: 16px; margin-bottom: 12px;
  box-shadow: var(--shadow-1);
}
.card.accent { border-color: var(--accent); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

.pill {
  font-size: 11.5px; font-weight: 600; padding: 4px 11px;
  border-radius: var(--shape-pill); border: 1px solid var(--line);
  color: var(--muted); white-space: normal; overflow-wrap: anywhere; max-width: 100%;
}
.pill.free, .pill.done { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.pill.locked { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.pill.brand { background: var(--accent-tint); color: var(--accent-text); border-color: transparent; }
.pill.bad { background: var(--danger-bg); color: var(--danger); border-color: transparent; }

.bar { height: 8px; background: var(--soft); border-radius: var(--shape-pill); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(146px, 1fr)); gap: 10px; }
.metric { background: var(--soft); border-radius: var(--shape-input); padding: 11px 13px; }
.metric b { display: block; font-family: var(--font-display); font-size: 20px;
            font-variant-numeric: tabular-nums; }
.metric span { font-size: 12px; color: var(--muted); }

.lesson { display: flex; gap: 10px; align-items: center; padding: 9px 0;
          border-top: 1px solid var(--line); }
.lesson:first-of-type { border-top: 0; }
.lesson .grow { font-size: 14px; }

.notice { padding: 11px 14px; border-radius: var(--shape-input); font-size: 14px;
          margin-bottom: 12px; }
.notice.err { background: var(--danger-bg); color: var(--danger); }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.warn { background: var(--warn-bg); color: var(--warn); }

.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); font-size: 12px; }

/* ── Dialogs ────────────────────────────────────────────────────────────── */
dialog {
  border: 1px solid var(--line); border-radius: var(--shape-card); padding: 0;
  max-width: 470px; width: calc(100% - 32px); color: var(--ink);
  background: var(--card); box-shadow: var(--shadow-2);
}
dialog::backdrop { background: rgba(5, 5, 5, .62); }
.dlg-body { padding: 22px; }
.dlg-id { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em;
          color: var(--accent-text); text-transform: uppercase; }
.dlg-body h3 { margin: 7px 0 9px; font-size: 18px; }
.dlg-body p { margin: 0 0 18px; color: var(--sub); }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* ── Study chat ─────────────────────────────────────────────────────────── */
.chat-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 14px; }
.chat-content { min-width: 0; }
.chan-list { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.chan {
  text-align: start; justify-content: flex-start; border-radius: var(--shape-pill);
  border-color: transparent; background: transparent; min-height: 40px;
  font-weight: 600; width: 100%; padding: 8px 12px;
}
.chan:hover { background: var(--soft); }
.chan[aria-current="true"] { background: var(--accent-tint); color: var(--accent-text); }
.chan small { display: block; font-weight: 500; font-size: 11px; color: var(--muted); }
.chan[aria-current="true"] small { color: var(--sub); }

.msg { padding: 11px 0; border-top: 1px solid var(--line); }
.msg:first-child { border-top: 0; }
.msg-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.msg-who { font-weight: 700; font-size: 13.5px; }
.msg-time { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.msg-body { margin: 5px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.removed .msg-body, .msg.hidden .msg-body { color: var(--muted); font-style: italic; }
.msg.pending { border-inline-start: 3px solid var(--warn); padding-inline-start: 10px; }
.badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 2px 8px; border-radius: var(--shape-pill);
}
.badge.instructor { background: var(--accent); color: #fff; }
.badge.moderator { background: #6251AC; color: #fff; }
.badge.ai { background: var(--soft); color: var(--sub); border: 1px dashed var(--line); }

.composer { margin-top: 14px; }
.composer textarea { min-height: 84px; resize: vertical; }
.composer.blocked textarea { background: var(--soft); color: var(--muted); }

/* ── Admin console ──────────────────────────────────────────────────────── */
.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px;
              border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.switch { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.switch input { width: 42px; height: 24px; appearance: none; border-radius: var(--shape-pill);
                background: var(--line); position: relative; cursor: pointer;
                transition: background var(--mo); border: 0; min-height: 0; }
.switch input::after { content: ""; position: absolute; inset-inline-start: 3px; top: 3px;
                       width: 18px; height: 18px; border-radius: 50%; background: #fff;
                       transition: transform var(--mo); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(18px); }
[dir="rtl"] .switch input:checked::after { transform: translateX(-18px); }

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: start; font-size: 12px; color: var(--muted);
                text-transform: uppercase; letter-spacing: .04em;
                padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.data td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.card h2 { font-size: 16px; margin: 0 0 4px; }

@media (max-width: 760px) {
  main { padding: 16px; }
  .top { flex-wrap: wrap; }
  .top nav { gap: 8px; }
  .chat-heading > .grow { flex-basis: 100%; }
  .lesson { flex-wrap: wrap; }
  .lesson > .grow { flex-basis: 100%; }
  .device-strip { gap: 8px; }
  /* Every control reaches 44px on a phone; navigation keeps this size on desktop. */
  button, .top nav button, .chan { min-height: 44px; }
  select { min-height: 44px; }
  .chat-shell { grid-template-columns: 1fr; }
  .chan-list { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .chan { width: auto; white-space: nowrap; flex-shrink: 0; }
  .top nav { width: 100%; margin-inline-start: 0; overflow-x: auto; padding-bottom: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Public Academy discovery: a section of Auraz, with a marketplace-style layout. */
.academy-discovery { background: var(--bg); }
.academy-discovery main { max-width: 1328px; padding: 0 20px 32px; }
.hero-kicker { margin: 0 0 10px; color: var(--accent-text); font-size: 12px; font-weight: 700; }
.academy-topics { display: grid; grid-template-columns: 1fr repeat(3,minmax(0,1fr)); gap: 16px; align-items: center; margin: 48px 0 54px; }
.topics-intro { padding-inline-end: 16px; }.topics-intro h2 { font-size: 28px; line-height: 1.2; margin: 0 0 14px; letter-spacing: -.025em; }
.topics-intro h2 em { font-style: italic; }.topics-intro p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.8; }
.topic-card { display: block; position: relative; overflow: hidden; padding: 0; border: 0; border-radius: var(--shape-card);
  text-align: start; background: var(--soft); width: 100%; min-width: 0; }
.topic-card svg { display: block; width: 100%; height: 270px; object-fit: cover; }
.topic-card-label { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: -38px 8px 8px;
  position: relative; border-radius: var(--shape-input); padding: 20px 16px; background: var(--card); color: var(--ink); font-weight: 500; font-size: 15px; }
.topic-card-label > [aria-hidden="true"] { color: var(--accent-text); font-size: 22px; }
.academy-courses { scroll-margin-top: 130px; }.academy-courses h2 { font-size: 27px; margin: 0 0 10px; letter-spacing: -.025em; }
.development-note { font-size: 12px; color: var(--muted); padding: 10px 14px; background: var(--soft); border-radius: var(--shape-input); }
#courseSearchState { font-size: 13px; color: var(--muted); }
.home-course-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 22px; }
.home-course-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--shape-card); background: var(--card); }
.catalog-course-cover { height: 172px; overflow: hidden; }.catalog-course-cover svg { width: 100%; height: 100%; display: block; }
.home-course-body { padding: 20px; }.home-course-body h3 { font-size: 20px; margin: 16px 0 8px; }
.home-course-body p { color: var(--sub); font-size: 14px; line-height: 1.65; }.home-course-body p.muted { color: var(--muted); font-size: 12px; }
.academy-method { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; border: 1px solid var(--line); border-radius: var(--shape-card);
  padding: 36px; margin: 48px 0; background: var(--soft); }.academy-method h2 { margin: 0; font-size: 30px; line-height: 1.18; letter-spacing: -.03em; }
.academy-method p { line-height: 1.75; }.academy-method p:first-child { margin-top: 0; }
.academy-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); padding: 28px 0; }
.academy-footer strong { font-size: 22px; }.academy-footer strong span { font-size: 14px; color: var(--accent-text); font-weight: 500; margin-inline-start: 8px; }
.academy-footer p { font-size: 13px; color: var(--muted); margin-bottom: 0; }.academy-footer a { font-size: 14px; }
@media(max-width:1100px) {
  .top { flex-wrap: wrap; gap: 12px; }.header-search { order: 3; flex-basis: 100%; }
  .academy-topics { grid-template-columns: repeat(3,minmax(0,1fr)); }.topics-intro { grid-column: 1/-1; }
  .topics-intro h2 br { display: none; }.topics-intro p { max-width: 560px; }
}
@media(max-width:650px) {
  .top { padding: 12px 16px; }
  .top nav { gap: 4px; }
  .top nav button { padding: 8px 12px; font-size: 13px; }
  .academy-context { padding: 10px 16px; }.academy-context .context-tagline { display: none; }
  .academy-discovery main { padding: 0 16px 20px; }.header-search { min-width: 0; }.header-search .search-submit { font-size: 13px; padding: 8px 12px; }
  .academy-topics { grid-template-columns: 1fr; margin: 32px 0; gap: 16px; }.topic-card svg { height: 200px; }
  .topic-card-label { margin-top: -34px; }.home-course-grid { grid-template-columns: 1fr; }
  .academy-method { grid-template-columns: 1fr; gap: 12px; padding: 24px; margin: 32px 0; }
  .academy-footer { align-items: flex-start; flex-direction: column; }
}
.library-filters { display: grid; grid-template-columns: minmax(0,2fr) repeat(3,minmax(0,1fr)); gap: 16px; }
@media(max-width:650px) { .library-filters { grid-template-columns: 1fr; gap: 8px; } }

/* Assessment controls are real inputs, including in the optional paper sheet. */
.assessment-conditions { display: grid; grid-template-columns: minmax(100px,1fr) 3fr; gap: 10px 20px; }
.assessment-conditions dt { font-weight: 600; }.assessment-conditions dd { margin: 0; overflow-wrap: anywhere; }
.assessment-toolbar,.assessment-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 20px 0; }
.sound-toggle { display: flex; align-items: center; gap: 8px; margin: 0; min-height: 44px; color: var(--ink); }
.sound-toggle input,.answer-choice input { width: 20px; height: 20px; min-height: 0; margin: 0; flex: none; accent-color: var(--accent); }
.sound-volume { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--ink); }.sound-volume input { width: 110px; min-height: 44px; accent-color: var(--accent); }
.attempt-clock { font-weight: 700; font-size: 20px; font-variant-numeric: tabular-nums; }
.question-navigation h2 { font-size: 16px; margin-top: 0; }
#nav-grid button { min-width: 44px; min-height: 44px; }
#nav-grid button[aria-current="step"] { box-shadow: 0 0 0 2px var(--ink); }
#nav-grid .question-flagged { outline: 2px solid var(--warn); outline-offset: 3px; }
#nav-grid .question-unsaved { border-style: dashed; border-color: var(--accent-text); }
#navKey { margin-bottom: 0; font-size: 13px; }
.question-sheet h2 { font-size: 20px; margin: 0; }.question-sheet h2:focus { outline: none; }
.question-prompt { font-size: 18px; line-height: 1.65; }
.answer-options { border: 0; margin: 14px 0; padding: 0; min-width: 0; }
.answer-options legend { font-weight: 600; padding: 0; margin-bottom: 8px; }
/* An answer is read like the question, not like a form caption: the generic
   label rule (12.5px, bold, grey) must not shrink it. */
.answer-choice { display: flex; align-items: center; gap: 12px; margin: 0; padding: 12px 0; min-height: 44px; color: var(--ink); cursor: pointer;
  font-size: 16px; font-weight: 500; line-height: 1.45; }
.question-controls { margin-top: 20px; }.assessment-footer { font-size: 14px; }
.assessment-paper .question-sheet { background: #FFFEFA; color: #242424; border: 1px solid #D9D4C9;
  border-radius: 3px; box-shadow: 0 8px 22px #00000014; padding: 32px 40px;
  font-family: Georgia,'Times New Roman',serif; }
.assessment-paper .question-sheet .muted,.assessment-paper .question-sheet label { color: #4C4C4C; }
.assessment-paper .question-sheet h2 { font-family: Georgia,'Times New Roman',serif; }
.assessment-paper .question-sheet textarea { background: repeating-linear-gradient(#FFFEFA 0,#FFFEFA 31px,#DDD9CF 31px,#DDD9CF 32px);
  color: #242424; line-height: 32px; padding: 8px 12px; border-color: #B8B3AA; font: 17px/32px Georgia,'Times New Roman',serif; }
.assessment-paper .question-sheet .answer-choice { color: #242424; border-bottom: 1px solid #E6E1D8; }
.assessment-paper .question-sheet button { background: #FFFEFA; color: #242424; border-color: #B8B3AA; font-family: var(--font-body); }
.assessment-paper .question-sheet button:hover { background: #F0ECE2; }
@media(max-width:650px) {
  .assessment-conditions { grid-template-columns: 1fr; gap: 4px; }.assessment-conditions dd { margin-bottom: 12px; }
  .assessment-paper .question-sheet { padding: 24px 18px; }
  .question-sheet .row.spread { align-items: flex-start; }
  .question-sheet h2 { font-size: 18px; }.attempt-clock { font-size: 18px; }
  .assessment-footer > .grow { display: none; }.assessment-footer > [role=status] { flex-basis: 100%; }
}

.lesson-breadcrumb { margin-bottom: 18px; color: var(--muted); font-size: 13px; }
.lesson-breadcrumb span { overflow-wrap: anywhere; }
#lessonStatus { font-size: 13px; margin-bottom: 18px; }
.lesson-workspace { display: grid; grid-template-columns: 250px minmax(0,1fr); gap: 24px; align-items: start; }
.lesson-outline { border: 1px solid var(--line); border-radius: var(--shape-card); background: var(--card); padding: 16px; }
.lesson-outline h2 { font-size: 16px; margin: 0 0 14px; }
.lesson-outline summary,.concept-list summary { cursor: pointer; min-height: 44px; padding: 10px 0; font-weight: 600; }
.lesson-outline summary:focus-visible,.concept-list summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.outline-lesson { display: block; text-align: start; width: 100%; border-radius: 8px; margin-bottom: 6px; min-height: 44px; padding: 10px; font-size: 13px; font-weight: 500; }
.outline-lesson small { display: block; color: var(--muted); margin-top: 4px; font-size: 11px; }
.outline-lesson[aria-current=page] { border-color: var(--accent); background: var(--accent-tint); color: var(--accent-text); }
.outline-lesson[aria-current=page] small { color: var(--sub); }
.lesson-main { min-width: 0; }.lesson-mode-controls { display: flex; flex-wrap: wrap; gap: 10px; }
.lesson-mode-controls [aria-pressed=true] { background: var(--accent); color: white; border-color: var(--accent); }
.concept-list { margin: 16px 0; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--shape-input); background: var(--card); }
#conceptNav { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; }
#conceptNav button { text-align: start; border-radius: 8px; min-height: 44px; }
#conceptNav [aria-current=step] { border-color: var(--accent); background: var(--accent-tint); color: var(--accent-text); }
.concept-card h2,.practical-task h2 { font-size: 20px; margin: 0 0 14px; }
.concept-card h2:focus { outline: none; }.concept-explanation { font-size: 17px; line-height: 1.8; }
.practical-task { border-color: var(--accent); }.practical-task h3 { font-size: 16px; }.practical-task textarea { min-height: 90px; }
.concept-controls,.practical-actions { margin-top: 16px; }.lesson-navigation { margin-top: 28px; }
@media(max-width:900px) { .lesson-workspace { grid-template-columns: 1fr; }.lesson-outline { max-height: 300px; overflow-y: auto; } }

.chapter-edit { border-top: 1px solid var(--line); padding: 16px 0; }.chapter-edit h3 { margin: 0; font-size: 18px; }
.lesson-edit { padding: 16px; margin: 16px 0; background: var(--soft); border: 1px solid var(--line); border-radius: var(--shape-input); }
.lesson-edit .muted { color: var(--sub); }
.editor-actions { margin: 18px 0; }.advanced-editor summary { min-height: 44px; cursor: pointer; padding: 10px 0; font-weight: 600; }
.advanced-editor summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.json-editor { min-height: 320px; font-family: var(--font-mono); font-size: 13px; line-height: 1.7; resize: vertical; }
#courseEditor pre { max-width: 100%; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; padding: 12px; background: var(--soft); border-radius: var(--shape-input); }
#editorStatus { color: var(--sub); font-size: 14px; }
.conflict-review { border-color: var(--accent); }.conflict-review summary { cursor: pointer; padding: 12px 0; min-height: 44px; font-weight: 600; }
.history-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }.history-row p { margin-bottom: 0; }

/* ── Marking console ────────────────────────────────────────────────────────
   A learner's answer is evidence the marker has to read, so it gets a quiet
   quoted block rather than the green "ok" notice it used to borrow — green
   said "this went well" about a sentence nobody had judged yet. */
.quote {
  padding: 11px 14px;
  border-inline-start: 3px solid var(--line);
  background: var(--soft);
  border-radius: 0 var(--shape-input) var(--shape-input) 0;
  font-size: 14px;
}
.quote b { display: block; font-size: 12px; color: var(--muted);
           text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.mark-state { margin: 10px 0 0; font-size: 13px; color: var(--danger);
              min-height: 1.3em; }
.mark-state:empty { margin: 0; min-height: 0; }

/* Recovery codes: shown once, so they are made easy to read and copy. */
ul.codes {
  list-style: none; margin: 12px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px;
}
ul.codes li {
  font-family: var(--font-mono); font-size: 14px; letter-spacing: .06em;
  background: var(--soft); border: 1px solid var(--line);
  border-radius: var(--shape-input); padding: 9px 12px; text-align: center;
  font-variant-numeric: tabular-nums;
}

/* The setup key in readable groups. Decorative: the input beside it holds the
   real value, so a screen reader is not made to read the same secret twice. */
.key-groups {
  font-family: var(--font-mono); font-size: 15px; letter-spacing: .08em;
  color: var(--sub); margin: 8px 0 0; word-spacing: .4em;
}

/* Language picker, in the breadcrumb strip beside what the section is. */
.lang-pick {
  width: auto; min-height: 28px; padding: 3px 10px; font-size: 12px;
  border-radius: var(--shape-pill); background: var(--card);
  border: 1px solid var(--line); color: var(--sub); margin-inline-start: 14px;
}
#langNotice:not(:empty) { max-width: 1040px; margin: 10px auto 0; padding: 0 20px; }
/* Arabic needs a little more line height to stay comfortable. */
:root[dir="rtl"] body { line-height: 1.7; }
:root[dir="rtl"] .metric b { text-align: end; }

/* The breadcrumb's parent-site link measured 30x20, under the 24px minimum
   target size. Padding rather than a larger font keeps the strip's proportions
   while giving the link something to hit. */
.academy-context a,
.academy-context .lang-pick {
  display: inline-flex; align-items: center;
  min-height: 28px; padding-block: 4px;   /* clear of the 24px floor, not on it */
}

/* Student course: visual identity, guided continuation and distinct formats. */
.free-preview-text { color:var(--accent-text); font-weight:800; font-size:13px; background:none; border:0; padding:0; }
.course-hero { position:relative; isolation:isolate; min-height:320px; overflow:hidden; border-radius:20px; margin-bottom:18px; background:#1a263b; color:#fff; }
.course-hero-art { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; z-index:-2; }
.course-hero-shade { position:absolute; inset:0; z-index:-1; background:linear-gradient(90deg,rgba(13,20,32,.96) 0%,rgba(13,20,32,.92) 37%,rgba(13,20,32,.35) 74%,rgba(13,20,32,.05)); }
.course-hero-copy { padding:38px; max-width:650px; }
.course-hero h1 { font-size:clamp(26px,3.2vw,40px); line-height:1.18; margin:14px 0; color:#fff; }
.course-hero p { color:#e0e6ef; }
.course-eyebrow { font-size:11px; font-weight:700; letter-spacing:.12em; }
.course-next-title { font-size:13px; margin-bottom:0; }
.course-hero-link { color:#fff; font-weight:600; text-decoration:underline; text-underline-offset:5px; padding:10px 0; }
.course-section-nav { display:flex; gap:12px; flex-wrap:wrap; padding:0 0 18px; border-bottom:1px solid var(--line); margin-bottom:20px; }
.course-section-nav a { color:var(--ink); text-decoration:none; font-weight:650; padding:9px 14px; background:var(--soft); border-radius:var(--shape-pill); }
.course-section-nav button { font-size:inherit; font-weight:650; padding:9px 14px; background:var(--soft); }
#courseAccessDetails { scroll-margin-block-start:125px; }
.course-progress-panel { margin:22px 0 30px; }
.course-progress-panel h2 { margin:0; }
.course-curriculum,.course-assessments,.course-support { scroll-margin-block-start:125px; margin-bottom:30px; }
.course-curriculum h2,.course-assessments h2 { margin:3px 0 12px; }
.course-kicker { color:var(--accent-text); font-weight:750; font-size:11px; letter-spacing:.09em; margin:0; }
.course-chapter { background:var(--card); border:1px solid var(--line); border-radius:var(--shape-card); margin:14px 0; overflow:hidden; }
.course-chapter>summary { display:flex; gap:14px; align-items:center; padding:19px; cursor:pointer; list-style:none; }
.course-chapter>summary::-webkit-details-marker { display:none; }
.course-chapter>summary::after { content:'+'; color:var(--sub); font-size:23px; }
.course-chapter[open]>summary::after { content:'−'; }
.chapter-number { display:grid; place-items:center; width:40px; height:40px; flex-shrink:0; border-radius:12px; font-weight:750; background:var(--soft); color:var(--accent-text); }
.chapter-name { display:block; font-size:16px; font-weight:750; line-height:1.4; }
.chapter-progress { display:block; font-size:12px; color:var(--muted); margin-top:5px; }
.chapter-access { color:var(--muted); font-size:12px; font-weight:650; }
.course-format-group { margin:0 18px 14px; border-top:1px solid var(--line); }
.course-format-group h4 { display:flex; align-items:center; gap:10px; margin:15px 0 5px; font-size:13px; color:var(--sub); }
.format-symbol { display:grid; place-items:center; width:28px; height:28px; border-radius:8px; background:var(--soft); color:var(--accent-text); font-size:16px; }
.course-unit { display:flex; align-items:center; flex-wrap:wrap; gap:14px; padding:15px 0; margin-inline-start:38px; border-bottom:1px solid var(--line); }
.course-unit:last-child { border:0; }
.course-unit h5 { font-size:15px; font-weight:650; margin:0; line-height:1.5; }
.unit-detail { font-size:12px; color:var(--muted); margin:5px 0 0; }
.unit-unavailable { color:var(--muted); font-size:12px; max-width:145px; }
.unit-completed { display:inline-block; color:var(--ok); font-size:12px; font-weight:750; margin-top:6px; }
.unit-reading-progress { display:block; color:var(--accent-text); font-size:12px; font-weight:650; margin-top:6px; }
.course-record { margin-block:24px; color:var(--muted); }
.course-record summary { padding-block:10px; cursor:pointer; }
.course-record p { overflow-wrap:anywhere; }
.reading-journey { background:var(--soft); border-radius:var(--shape-card); padding:15px; margin:16px 0; }
.reading-journey:empty { display:none; }
.reading-journey .bar { background:var(--line); margin:10px 0; }
.reading-journey p { margin:0; font-size:12px; color:var(--muted); }
:root[dir="rtl"] .course-hero-art { transform:scaleX(-1); }
:root[dir="rtl"] .course-hero-shade { background:linear-gradient(270deg,rgba(13,20,32,.96),rgba(13,20,32,.92) 37%,rgba(13,20,32,.35) 74%,rgba(13,20,32,.05)); }
@media(max-width:600px) {
 .course-hero { min-height:340px; border-radius:16px; }
 .course-hero-copy { padding:25px 22px; }
 .course-hero-art { opacity:.55; object-position:62% center; }
 .course-section-nav { gap:7px; }
 .course-section-nav a { font-size:12px; padding:9px 11px; }
 .course-chapter>summary { padding:15px 12px; gap:9px; flex-wrap:wrap; }
 .chapter-name { font-size:14px; }
 .chapter-number { width:32px; height:32px; border-radius:8px; }
 .course-format-group { margin-inline:12px; }
 .course-unit { margin-inline-start:0; }
 .course-unit>.grow { flex-basis:100%; }
 .unit-unavailable { max-width:none; }
}

/* ── Structured assessment editing ──────────────────────────────────────── */
.question-card {
  border: 1px solid var(--line); border-radius: var(--shape-card);
  padding: 14px; margin-top: 12px; background: var(--bg-tint);
}
.choice-set { border: 0; padding: 0; margin: 12px 0 0; }
.choice-set legend {
  font-size: 12.5px; font-weight: 600; color: var(--sub); padding: 0;
  margin-bottom: 6px;
}
.choice-row {
  display: flex; align-items: center; gap: 10px; margin-top: 8px;
  min-height: 44px;             /* the row is the target, not the radio */
}
.choice-row input[type="radio"],
.choice-row input[type="checkbox"] { flex: none; width: 20px; height: 20px; }
.choice-row input[type="text"] { min-height: 40px; }
/* A problem is marked where it happened, not only in the list at the top. */
.has-issue,
.has-issue input, .has-issue textarea, .has-issue select {
  border-color: var(--danger);
}
.choice-set.has-issue legend { color: var(--danger); }
.assessment-card h3 { margin-top: 18px; }
.completion-evidence { scroll-margin-block-start: 140px; }
.completion-evidence .mono { overflow-wrap: anywhere; }
.completion-evidence li { padding-block: 8px; }
.source-repair { scroll-margin-block-start:140px; }
.source-repair .mono,.source-repair li { overflow-wrap:anywhere; }
.source-files-scroll { max-width:100%; overflow-x:auto; }
.source-files-scroll td { overflow-wrap:anywhere; }
.source-files-scroll table { min-width:640px; }
.source-files-scroll td:last-child { min-width:150px; }
.source-files-scroll td button,.source-files-scroll td .pill { white-space:nowrap; }
button,[role="button"],input[type="submit"],.topic-card-label { border-radius:var(--shape-button) !important; }
.topic-visual { display:block;height:270px; }
.topic-visual img { display:block;width:100%;height:270px;object-fit:cover; }
.catalog-image { display:block;width:100%;height:100%;object-fit:cover; }
.course-list-image { width:128px;height:90px;object-fit:cover;border-radius:6px;flex:none; }
html[dir="rtl"] img,html[dir="rtl"] .topic-visual>svg,html[dir="rtl"] .catalog-course-cover>svg { transform:scaleX(-1); }
.image-setting-preview { width:100%;max-height:280px;object-fit:cover;border-radius:8px;display:block;margin-block:12px; }
.directory-admin-grid { display:grid;grid-template-columns:1fr 1fr;gap:20px; }
.university-grid,.department-grid { display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:20px;margin-block:24px; }
.directory-card { text-align:start;display:flex;flex-direction:column;gap:14px;background:var(--card);padding:26px;border:1px solid var(--line);min-height:170px; }
.directory-card strong { font-size:19px;line-height:1.4; }
.directory-college { color:var(--muted);font-size:13px; }
.directory-symbol { font-size:32px;color:var(--accent-text); }
.course-code { display:inline-block;background:var(--soft);font-family:var(--font-mono);font-weight:700;padding:6px 10px; }
@media(max-width:800px){.directory-admin-grid,.university-grid,.department-grid{grid-template-columns:1fr;} }
.profile-heading { display:flex;align-items:center;gap:24px;margin-bottom:30px;padding:28px;background:var(--card);border:1px solid var(--line);border-radius:12px; }
.profile-heading h2 { margin:0;font-size:30px; }.profile-heading p { margin:5px 0; }
.profile-eyebrow { font-size:11px;font-weight:700;letter-spacing:.08em;color:var(--accent-text); }
.profile-avatar { flex:none;width:96px;height:96px;border-radius:50%;background:var(--soft);display:grid;place-items:center;font-size:30px;overflow:hidden; }
.profile-avatar img,.profile-photo-preview img { width:100%;height:100%;object-fit:cover; }
.profile-layout { display:grid;grid-template-columns:220px minmax(0,1fr);gap:28px;align-items:start; }
.profile-sidebar { position:sticky;top:100px;display:flex;flex-direction:column;border:1px solid var(--line);background:var(--card);padding:12px;border-radius:8px; }
.profile-sidebar a { color:var(--ink);padding:12px;text-decoration:none;border-radius:6px; }.profile-sidebar a:hover {background:var(--soft);}
.profile-content { min-width:0; }.profile-content section { scroll-margin-block-start:120px; }.profile-content textarea { min-height:100px; }
.profile-photo-preview { margin-block:20px;width:160px;height:160px;display:grid;place-items:center;background:var(--soft);border:1px solid var(--line);border-radius:8px;overflow:hidden;font-size:44px; }
#pPhotoFile {margin-bottom:16px;}
.language-disclosure { color:var(--muted);font-size:12px;margin-block:8px; }
.language-disclosure summary { cursor:pointer;min-height:28px;padding:6px; }
#unitActive { width:24px;height:24px; }
@media(max-width:800px){.profile-layout{grid-template-columns:1fr;}.profile-sidebar{position:static;display:grid;grid-template-columns:1fr 1fr;}.profile-heading{align-items:start;padding:20px;gap:16px;}.profile-avatar{width:64px;height:64px;font-size:22px;}.profile-heading h2{font-size:24px;}.profile-content section{scroll-margin-block-start:220px;}}
.directory-filters { display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto;gap:16px;align-items:end; }
.directory-filters>div {min-width:0;} .directory-filters button {margin-bottom:0;}
.assignment-entry {padding-block:16px;border-top:1px solid var(--line);overflow-wrap:anywhere;}
.assignment-entry:first-child {border-top:0;} .assignment-entry p {margin:6px 0;}
.academic-course-image {width:100%;height:160px;object-fit:cover;border-radius:6px;display:block;margin-bottom:16px;}
@media(max-width:800px){.directory-filters{grid-template-columns:1fr;}.directory-filters button{justify-self:start;}}
.directory-admin-grid {grid-template-columns:repeat(2,minmax(0,1fr));}
.directory-admin-grid>section {min-width:0;}
@media(max-width:800px){.directory-admin-grid{grid-template-columns:1fr;}}
/* Breadcrumbs describe the current route; ancestors are text links, not action pills. */
#breadcrumbs {min-width:0;flex:1;}
#breadcrumbs ol {list-style:none;display:flex;flex-wrap:wrap;align-items:center;gap:0;margin:0;padding:0;}
#breadcrumbs li {display:flex;align-items:center;min-width:0;max-width:100%;}
#breadcrumbs li+li::before {content:'/';padding-inline:10px;color:var(--muted);}
#breadcrumbs a,#breadcrumbs [aria-current="page"] {padding-block:4px;min-height:28px;line-height:1.5;overflow-wrap:anywhere;}
#breadcrumbs a:hover {text-decoration:underline;text-underline-offset:3px;}
#breadcrumbs a:focus-visible {outline:2px solid var(--accent);outline-offset:2px;}
.academy-context .grow {display:none;}
/* One focus boundary for the composed search box, with no nested rounded ring. */
.header-search:focus-within {outline:2px solid var(--accent);outline-offset:2px;}
.header-search input,.header-search input:focus,.header-search input:focus-visible {outline:0;box-shadow:none;border:0;border-radius:0;}
input:not([type="checkbox"]):not([type="radio"]),textarea,select {border-radius:6px;}
.university-heading {display:flex;align-items:center;gap:22px;margin-bottom:22px;}
.university-heading>div {min-width:0;}
.university-logo {width:86px;height:96px;object-fit:contain;background:#fff;padding:7px;border:1px solid var(--line);border-radius:6px;flex:none;}
.directory-card>.university-logo {align-self:flex-start;}
.admin-logo-preview {display:block;margin-block:12px;}
.university-monogram {display:grid;place-items:center;width:86px;height:86px;background:var(--soft);color:var(--accent-text);font-size:26px;}
html[dir="rtl"] img.university-logo {transform:none;}
#unitLogoFields[hidden],#unitLogoPreview[hidden] {display:none;}
@media(max-width:800px){.university-heading{align-items:flex-start;gap:14px;}.university-logo{width:64px;height:74px;}}
@media(max-width:700px){
 .academy-context{flex-wrap:wrap;gap:6px;}
 #breadcrumbs{flex-basis:100%;max-width:100%;overflow-x:auto;scrollbar-width:thin;}
 #breadcrumbs ol{flex-wrap:nowrap;width:max-content;min-width:100%;}
 #breadcrumbs li{flex:none;max-width:none;}
 #breadcrumbs a,#breadcrumbs [aria-current="page"]{white-space:nowrap;}
 .academy-context .lang-pick{margin-inline-start:auto;}
}
.source-rights {margin-top:8px;max-width:340px;overflow-wrap:anywhere;}
.source-rights summary {min-height:28px;padding-block:4px;cursor:pointer;}
.source-rights summary:focus-visible {outline:2px solid var(--accent);outline-offset:2px;}
