@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(assets/fonts/ibm-plex-mono-400.ttf) format('truetype');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(assets/fonts/ibm-plex-mono-500.ttf) format('truetype');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-stretch: normal;
  font-display: swap;
  src: url(assets/fonts/ibm-plex-sans-400.ttf) format('truetype');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 500;
  font-stretch: normal;
  font-display: swap;
  src: url(assets/fonts/ibm-plex-sans-500.ttf) format('truetype');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 600;
  font-stretch: normal;
  font-display: swap;
  src: url(assets/fonts/ibm-plex-sans-600.ttf) format('truetype');
}


.privacy-suspended .app { visibility: hidden; }

:root {
  color-scheme: light;
  --bg: #f5f5f2;
  --surface: #fff;
  --surface-strong: #fff;
  --surface-muted: #f7f7f4;
  --border: #dedfda;
  --border-strong: #bfc2bc;
  --ink: #202926;
  --muted: #626b66;
  --accent: #8f233b;
  --accent-dark: #70172b;
  --accent-soft: #f6edef;
  --teal: #3b6156;
  --assignment: #5b5875;
  --danger: #a13232;
  --danger-soft: #fbefed;
  --success: #286147;
  --number-font: "IBM Plex Mono", "Courier New", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Sans", "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.25; }
button, input, select { font: inherit; }
button {
  min-height: 42px;
  padding: 0.55rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}
button:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible,
[tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.ghost { background: transparent; border-color: var(--border-strong); color: var(--ink); }
.ghost:hover { background: #eeefeb; border-color: #909990; }
input, select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
}
input::placeholder { color: #737b75; opacity: 1; }
input:focus, select:focus { border-color: var(--accent); }
input[type="checkbox"] { min-height: 18px; width: 18px; height: 18px; accent-color: var(--accent); }
.field { display: grid; gap: 0.4rem; min-width: 0; font-size: 0.85rem; font-weight: 500; }
.field-hint { font-size: 0.78rem; font-weight: 400; color: var(--muted); }
.field-invalid { border-color: var(--danger); background: #fffafa; }
.muted, .hint { color: var(--muted); line-height: 1.5; }
.muted { font-size: 0.85rem; }
.hint { font-size: 0.78rem; }
.hidden { display: none !important; }

.app { width: min(1280px, 100%); margin: 0 auto; padding: 0 2rem 4rem; }
.hero {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) auto;
  grid-template-areas: "brand identity controls";
  align-items: center;
  gap: 1.6rem;
  padding: 1.6rem 0;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-strong);
}
.hero-brand { grid-area: brand; min-width: 0; }
.hero-identity { grid-area: identity; min-width: 0; }
.uni-logo { display: block; width: 160px; max-width: 100%; max-height: 55px; object-fit: contain; object-position: left; }
#courseTitle { font-size: 1.2rem; letter-spacing: -0.025em; overflow-wrap: anywhere; }
.subhead { margin-top: 0.35rem; font-size: 0.75rem; line-height: 1.5; color: var(--muted); }
.student-name { display: block; margin-top: 0.45rem; font-size: 0.85rem; font-weight: 500; }
.controls { grid-area: controls; display: flex; gap: 0.75rem; align-items: end; }
.cohort-control { display: grid; gap: 0.25rem; min-width: 0; font-size: 0.68rem; color: var(--muted); }
.cohort-control select { width: 155px; font-size: 0.8rem; }
.session-controls { display: flex; gap: 0.5rem; }
.session-controls button { min-height: 44px; font-size: 0.78rem; padding-inline: 0.75rem; }
.eyebrow { margin-bottom: 0.7rem; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }

.access-shell { max-width: 430px; margin: 3.8rem auto 2rem; animation: reveal 180ms ease-out; }
.access-layout { display: grid; min-width: 0; }
.login-card { display: grid; gap: 1rem; padding: 2rem; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; }
.login-card h2 { font-size: 1.9rem; letter-spacing: -0.035em; }
.login-card .eyebrow { margin-bottom: 0.1rem; }
.login-card .muted { margin-top: -0.45rem; }
.login-card .field { margin-top: 0.3rem; }
.login-card .field-hint { font-size: 0.74rem; }
.primary-button { width: 100%; min-height: 46px; }
.access-actions .ghost { width: 100%; border: 0; border-top: 1px solid var(--border); border-radius: 0; padding-top: 0.9rem; color: var(--accent); }
.access-actions .ghost:hover { background: var(--surface-muted); }
.code-input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.5rem; }
.code-input-row button { font-size: 0.75rem; }
.text-button { justify-self: start; min-height: 36px; padding: 0.25rem 0; border: 0; background: transparent; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; font-size: 0.8rem; }
.text-button:hover { background: transparent; color: var(--accent-dark); }
.claimed-code, .recovery-help { display: grid; gap: 0.7rem; padding: 0.85rem; border: 1px solid var(--border); background: var(--surface-muted); font-size: 0.8rem; }
.claimed-code input { font-family: var(--number-font); }
.recovery-help p:first-child { font-weight: 600; }
.history-heading { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.history-list { display: grid; gap: 0.5rem; }
.history-entry { border-bottom: 1px solid var(--border); padding-bottom: 0.7rem; }
.history-entry summary { cursor: pointer; font-size: 0.82rem; padding: 0.4rem 0; overflow-wrap: anywhere; }
.history-change { display: grid; gap: 0.5rem; margin-top: 0.75rem; font-size: 0.8rem; overflow-wrap: anywhere; }
.history-change button { justify-self: start; font-size: 0.75rem; }
.save-conflict { display: grid; gap: 0.75rem; padding: 1rem; background: #fcf4df; border: 1px solid #ad873a; font-size: 0.85rem; }
.save-conflict button { justify-self: start; white-space: normal; }
.login-context { margin-top: 1.1rem; color: var(--muted); font-size: 0.74rem; line-height: 1.6; text-align: center; padding: 0 0.5rem; }

.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 1.5rem; background: var(--surface); border: 1px solid var(--border); }
.card { min-width: 0; padding: 1.25rem 1.4rem; }
.card + .card { border-left: 1px solid var(--border); }
.card h3 { color: var(--muted); font-size: 0.8rem; font-weight: 500; }
.metric { margin-top: 0.6rem; font-family: var(--number-font); font-size: 1.9rem; font-weight: 500; line-height: 1.2; letter-spacing: -0.06em; overflow-wrap: anywhere; }
.metric.compact { font-size: 1.3rem; }
.metric.tiny { font-size: 1.1rem; }
.metric.status-value { font-family: inherit; font-size: 1.1rem; font-weight: 500; letter-spacing: -0.02em; }
.card .muted { margin-top: 0.65rem; font-size: 0.74rem; }
.engagement-banner { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1.5rem; padding: 0.9rem 0; margin: 0 0 1.25rem; border-block: 1px solid var(--border); }
.engagement-banner .eyebrow { margin-bottom: 0.2rem; font-size: 0.62rem; }
.engagement-banner h2 { font-size: 0.9rem; }
.engagement-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.engagement-chip { color: var(--muted); font-size: 0.78rem; }
.engagement-chip + .engagement-chip { border-left: 1px solid var(--border-strong); padding-left: 0.6rem; }
.grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(290px, 1fr); gap: 1.5rem; align-items: start; }
.panel { min-width: 0; padding: 1.3rem; background: var(--surface); border: 1px solid var(--border); }
.sidebar-stack { display: grid; gap: 1.5rem; align-content: start; min-width: 0; }
.panel-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: start; gap: 0.75rem; margin-bottom: 0.9rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.panel-header > div { min-width: 0; }
.panel-header h2 { font-size: 1rem; letter-spacing: -0.02em; }
.panel-header .muted { margin-top: 0.3rem; font-size: 0.75rem; }
.legend { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.pill { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--muted); font-size: 0.7rem; }
.pill::before { content: ""; width: 5px; height: 5px; background: currentColor; border-radius: 50%; }
.pill.pending { color: #386274; }
.pill.missing { color: var(--danger); }
.empty-state { padding: 1.25rem 0; color: var(--muted); font-size: 0.85rem; }
.item-table-head, .item { display: grid; grid-template-columns: 92px minmax(0, 1fr) 125px; gap: 0.9rem; align-items: center; }
.item-table-head { padding: 0 0 0.6rem; color: var(--muted); font-size: 0.65rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; }
.item-table-head > :last-child { text-align: right; }
.item { padding: 1rem 0; border-top: 1px solid var(--border); }
.item-main { min-width: 0; }
.item-title { display: block; font-size: 0.88rem; font-weight: 500; overflow-wrap: anywhere; }
.item-meta { display: block; margin-top: 0.25rem; color: var(--muted); font-size: 0.75rem; }
.badge { justify-self: start; color: var(--muted); font-size: 0.68rem; text-transform: uppercase; font-weight: 500; letter-spacing: 0.04em; }
.badge.quiz { color: var(--teal); }
.badge.assignment { color: var(--assignment); }
.score { font-family: var(--number-font); font-size: 0.85rem; font-weight: 500; white-space: nowrap; }
.item-score { justify-self: end; text-align: right; min-width: 0; }
.item-score.pending, .item-score.missing { font-family: inherit; font-size: 0.75rem; white-space: normal; }
.item-score.pending { color: #386274; }
.item-score.missing { color: var(--danger); }
.bar { position: relative; width: 100%; height: 3px; margin-top: 0.65rem; background: #eceee9; overflow: hidden; }
.bar span { display: block; position: absolute; inset: 0; background: #8d9f94; }
.bar.missing span { display: none; }
.leaderboard-meta { display: flex; flex-wrap: wrap; gap: 0.4rem 0.85rem; align-items: baseline; color: var(--accent); font-size: 0.8rem; }
#leaderboardRank, #leaderboardScore { white-space: nowrap; }
#leaderboardScore { font-family: var(--number-font); font-size: 0.75rem; }
.leaderboard-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 0.5rem; min-height: 45px; padding: 0.5rem 0.4rem; border-bottom: 1px solid var(--border); font-size: 0.8rem; }
.leaderboard-row:last-child { border-bottom: 0; }
.leaderboard-row.me { background: var(--accent-soft); }
.leaderboard-row .rank { color: var(--muted); font-family: var(--number-font); font-size: 0.72rem; }
.leaderboard-row.me .name { font-weight: 600; color: var(--accent); }
.leaderboard-row .score { font-size: 0.76rem; }
.leaderboard-divider { padding: 0.6rem 0; font-size: 0.72rem; color: var(--muted); }
.milestone-list { display: grid; }
.milestone-chip { display: grid; gap: 0.2rem; padding: 0.8rem 0; border-bottom: 1px solid var(--border); }
.milestone-chip:first-child { padding-top: 0; }
.milestone-chip:last-child { border-bottom: 0; }
.milestone-chip strong { font-size: 0.7rem; font-weight: 500; color: var(--muted); }
.milestone-chip span { font-size: 0.88rem; font-weight: 500; }
.milestone-chip.unlocked span { color: var(--success); }
.milestone-chip small { font-size: 0.72rem; color: var(--muted); }
.timeline-block { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.timeline-head h3 { font-size: 0.8rem; }
.timeline-head .muted { font-size: 0.72rem; margin-top: 0.2rem; }
.timeline-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(30px, 1fr)); gap: 0.5rem; margin-top: 1rem; }
.timeline-list > .empty-state { grid-column: 1 / -1; }
.timeline-point { display: grid; gap: 0.3rem; justify-items: center; }
.timeline-bar { width: min(24px, 100%); height: 55px; display: flex; align-items: end; background: #eff0ec; }
.timeline-fill { width: 100%; min-height: 3px; background: #8d9f94; }
.timeline-point.muted-point .timeline-fill { background: #c5c9c2; }
.timeline-label { color: var(--muted); font-size: 0.6rem; }
.timeline-value { font-family: var(--number-font); color: var(--muted); font-size: 0.6rem; }

.admin-workspace { margin-bottom: 2rem; }
.admin-card { background: var(--surface); border: 1px solid var(--border); padding: 1.5rem; }
.admin-header { display: flex; justify-content: space-between; align-items: start; gap: 1rem; padding-bottom: 1rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--border); }
.admin-header h2 { font-size: 1.3rem; letter-spacing: -0.025em; }
.admin-header .eyebrow { margin-bottom: 0.3rem; }
.admin-login { max-width: 410px; display: grid; gap: 1rem; }
.admin-panel { display: grid; gap: 1.5rem; }
.admin-section { display: grid; gap: 0.9rem; min-width: 0; padding-block: 1.4rem; border-top: 1px solid var(--border); }
.admin-section h3 { font-size: 1rem; }
.admin-search-section { padding-top: 0; border: 0; max-width: 540px; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.85rem; }
.admin-section > button { justify-self: start; }
.checkbox { display: flex; align-items: center; gap: 0.65rem; font-size: 0.8rem; color: var(--muted); }
.checkbox input { flex: 0 0 18px; }
.bulk-table { display: grid; gap: 0; }
.bulk-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(75px, 0.4fr) minmax(135px, 0.6fr) minmax(75px, 0.6fr); gap: 0.85rem; align-items: center; padding: 0.75rem 0; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.overview-row { grid-template-columns: minmax(0, 1.35fr) repeat(4, minmax(0, 0.6fr)); }
.bulk-row > span { min-width: 0; overflow-wrap: anywhere; }
.bulk-row.header { padding: 0.5rem 0; color: var(--muted); font-size: 0.65rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.bulk-field { display: grid; gap: 0.3rem; min-width: 0; }
.bulk-field > span { font-size: 0.72rem; color: var(--muted); }
@media (min-width: 601px) {
  .bulk-field > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}
.bulk-row input { font-size: 0.82rem; }
.admin-actions { display: grid; gap: 0.4rem; }
.bulk-review { display: grid; gap: 0.85rem; min-width: 0; padding: 1.15rem; background: var(--surface-muted); border: 1px solid var(--border-strong); border-radius: 4px; }
.bulk-review h4 { font-size: 1rem; }
#bulkReviewContext { font-size: 0.9rem; font-weight: 600; color: var(--accent); }
#bulkReviewSummary { font-size: 0.85rem; }
.bulk-review-scroll { max-width: 100%; overflow-x: auto; }
.bulk-review-table { width: 100%; min-width: 480px; border-collapse: collapse; text-align: left; font-size: 0.82rem; }
.bulk-review-table th, .bulk-review-table td { padding: 0.65rem 0.5rem; vertical-align: top; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.bulk-review-table th { color: var(--muted); font-weight: 500; font-size: 0.72rem; }
.bulk-review-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.error { color: var(--danger); font-size: 0.82rem; }
.success { color: var(--success); font-size: 0.82rem; }
.error:empty, .success:empty, .hint:empty { display: none; }
.error:not(:empty), .success:not(:empty) { padding: 0.8rem; border: 1px solid currentColor; border-radius: 3px; line-height: 1.5; }
.error:not(:empty) { background: var(--danger-soft); }
.success:not(:empty) { background: #f1f7f2; }

@keyframes reveal { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 1050px) {
  .hero { grid-template-columns: 160px minmax(0, 1fr); grid-template-areas: "brand controls" "identity identity"; gap: 1rem; }
  .controls { justify-content: end; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .sidebar-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
@media (max-width: 720px) {
  .app { padding-inline: 1.25rem; }
  .hero { margin-bottom: 1.4rem; }
  .sidebar-stack { grid-template-columns: minmax(0, 1fr); }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 1rem; }
  .card:nth-child(3) { border-left: 0; }
  .card:nth-child(n+3) { border-top: 1px solid var(--border); }
  .card h3 { font-size: 0.74rem; }
  .metric { font-size: 1.6rem; }
  .metric.status-value { font-size: 0.95rem; }
  .card .muted { font-size: 0.72rem; }
  .panel { padding: 1rem; }
  .item-table-head { display: none; }
  .item { grid-template-columns: minmax(0, 1fr) auto; gap: 0.45rem 0.5rem; padding-block: 0.95rem; }
  .badge { grid-column: 1; grid-row: 1; }
  .item-score { grid-column: 2; grid-row: 1; font-size: 0.78rem; }
  .item-main { grid-column: 1 / -1; grid-row: 2; }
  .item-score.pending, .item-score.missing { font-size: 0.7rem; }
  .item-title { font-size: 0.85rem; }
  .item-meta { font-size: 0.72rem; }
  .bulk-review-table { min-width: 0; }
  .bulk-review-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .bulk-review-table tbody { display: grid; gap: 0.7rem; }
  .bulk-review-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding-block: 0.35rem; border-bottom: 1px solid var(--border-strong); }
  .bulk-review-table td { min-width: 0; border: 0; padding: 0.5rem 0.2rem; }
  .bulk-review-table td:first-child, .bulk-review-table td:last-child { grid-column: 1 / -1; }
  .bulk-review-table td:first-child { font-weight: 600; }
  .bulk-review-table td:not(:first-child)::before { content: attr(data-label); display: block; margin-bottom: 0.2rem; color: var(--muted); font-size: 0.68rem; }
}
@media (max-width: 600px) {
  .app { padding: 0 1rem 2.5rem; }
  .hero { grid-template-columns: minmax(0, 1fr); grid-template-areas: "brand" "identity" "controls"; padding-block: 1.1rem; gap: 0.9rem; }
  .uni-logo { width: 142px; max-height: 45px; }
  #courseTitle { font-size: 1.12rem; }
  .subhead { font-size: 0.7rem; }
  .controls { justify-content: space-between; align-items: end; gap: 0.5rem; }
  .cohort-control select { width: 142px; }
  .session-controls { gap: 0.4rem; flex-wrap: wrap; justify-content: end; }
  .session-controls button { padding-inline: 0.6rem; font-size: 0.7rem; }
  .access-shell { margin-top: 1.75rem; max-width: 430px; }
  .login-card { padding: 1.4rem; gap: 0.9rem; }
  .login-card h2 { font-size: 1.65rem; }
  .login-context { font-size: 0.7rem; }
  .admin-card { padding: 1rem; }
  .admin-grid { grid-template-columns: minmax(0, 1fr); }
  .bulk-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; padding-block: 1rem; }
  .bulk-row.header { display: none; }
  .bulk-row:not(.overview-row) > span:first-child { grid-column: 1 / -1; font-weight: 500; }
  .bulk-row:not(.overview-row) > .bulk-field:nth-child(3) { grid-column: 1 / -1; }
  .bulk-row:not(.overview-row) > .bulk-status { grid-column: 2; grid-row: 2; text-align: right; }
  .overview-row > span:first-child { grid-column: 1 / -1; font-weight: 500; }
  .overview-row > span:not(:first-child)::before { content: attr(data-label); display: block; margin-bottom: 0.15rem; color: var(--muted); font-size: 0.65rem; }
  .bulk-review { padding: 0.85rem; }
  .bulk-review-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
}
