:root {
  --ink: #1c110a;
  --ink-soft: #463127;
  --paper: #fffaf0;
  --cream: #e4d6a7;
  --cream-strong: #d8c387;
  --ochre: #e9b44c;
  --rust: #9b2915;
  --teal: #50a2a7;
  --bg: #f8f0db;
  --surface: rgba(255, 248, 236, 0.9);
  --surface-strong: rgba(255, 251, 243, 0.98);
  --surface-muted: rgba(244, 234, 204, 0.74);
  --muted: #6c5647;
  --line: rgba(28, 17, 10, 0.14);
  --line-strong: rgba(28, 17, 10, 0.22);
  --teal-soft: rgba(80, 162, 167, 0.16);
  --rust-soft: rgba(155, 41, 21, 0.12);
  --ochre-soft: rgba(233, 180, 76, 0.22);
  --shadow: 0 18px 40px rgba(28, 17, 10, 0.12);
  --shadow-strong: 0 28px 62px rgba(28, 17, 10, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: 'Segoe UI', 'Trebuchet MS', sans-serif;
  background:
    radial-gradient(circle at top left, rgba(233, 180, 76, 0.24), transparent 34%),
    radial-gradient(circle at top right, rgba(80, 162, 167, 0.24), transparent 28%),
    radial-gradient(circle at 15% 82%, rgba(155, 41, 21, 0.12), transparent 22%),
    linear-gradient(180deg, #fff9ec 0%, var(--bg) 100%);
}

body {
  padding: 24px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

input:not([type='checkbox']):not([type='radio']),
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

input:not([type='checkbox']):not([type='radio']):focus,
textarea:focus {
  outline: none;
  border-color: rgba(80, 162, 167, 0.62);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 0 0 4px rgba(80, 162, 167, 0.16);
}

button:focus-visible {
  outline: 3px solid rgba(80, 162, 167, 0.32);
  outline-offset: 2px;
}

textarea {
  resize: vertical;
}

.page-shell {
  max-width: 1440px;
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: 1.65fr 0.85fr;
  gap: 24px;
  align-items: start;
  margin-bottom: 24px;
}

.hero-copy,
.hero-actions,
.panel,
.modal-card {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero-copy {
  position: relative;
  overflow: hidden;
  padding: 32px 32px 48px;
  border-radius: 32px;
  background: linear-gradient(140deg, #1c110a 0%, #2b1a12 55%, #43251b 100%);
  color: var(--paper);
}

.hero-copy::after,
.workbook-panel::before,
.quiz-panel::before {
  content: '';
  position: absolute;
  left: 24px;
  right: 24px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    #1c110a 0%,
    #1c110a 20%,
    #e4d6a7 20%,
    #e4d6a7 40%,
    #e9b44c 40%,
    #e9b44c 60%,
    #9b2915 60%,
    #9b2915 80%,
    #50a2a7 80%,
    #50a2a7 100%
  );
}

.hero-copy::after {
  bottom: 18px;
}

.hero-copy .eyebrow {
  color: var(--ochre);
}

.hero-copy h1,
.hero-copy .hero-text {
  color: var(--paper);
}

.hero-actions {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border-radius: 32px;
  display: grid;
  gap: 14px;
  background:
    radial-gradient(circle at top right, rgba(80, 162, 167, 0.2), transparent 34%),
    linear-gradient(180deg, rgba(228, 214, 167, 0.82), rgba(255, 249, 235, 0.96));
}

.hero-actions::before {
  content: '';
  position: absolute;
  inset: auto -14% -30% auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(80, 162, 167, 0.12);
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.76rem;
  color: var(--teal);
  font-weight: 800;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.2rem, 3.3vw, 3.8rem);
  line-height: 0.98;
  margin-bottom: 14px;
  max-width: 11ch;
}

.hero-text {
  margin: 0;
  max-width: 60ch;
  font-size: 1.04rem;
  line-height: 1.6;
  color: var(--muted);
}

.student-card {
  display: grid;
  gap: 8px;
}

.field-label {
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  border-radius: 14px;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease,
    border-color 160ms ease;
}

.primary-button {
  border: 1px solid rgba(155, 41, 21, 0.18);
  background: linear-gradient(135deg, #9b2915, #c84e2f);
  color: var(--paper);
  padding: 12px 16px;
  font-weight: 800;
  box-shadow: 0 12px 22px rgba(155, 41, 21, 0.22);
}

.secondary-button {
  border: 1px solid rgba(80, 162, 167, 0.24);
  background: rgba(80, 162, 167, 0.12);
  color: #255a5e;
  padding: 12px 16px;
  font-weight: 800;
}

.ghost-button {
  border: 1px solid transparent;
  background: rgba(28, 17, 10, 0.04);
  color: var(--ink-soft);
  padding: 8px 10px;
  font-weight: 800;
}

.icon-button {
  border: 1px solid rgba(28, 17, 10, 0.08);
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink-soft);
  width: 42px;
  height: 42px;
  font-weight: 800;
}

.primary-button:hover:not(:disabled),
.secondary-button:hover:not(:disabled),
.ghost-button:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(28, 17, 10, 0.1);
}

.app-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 24px;
}

.sidebar,
.content {
  display: grid;
  gap: 24px;
  align-content: start;
}

.panel {
  position: relative;
  overflow: hidden;
  border-radius: 26px;
  padding: 22px;
  background: var(--surface);
}

.panel::before {
  content: '';
  position: absolute;
  left: 18px;
  right: 18px;
  top: 0;
  height: 4px;
  border-radius: 0 0 999px 999px;
  background: linear-gradient(90deg, var(--teal), var(--ochre), var(--rust));
  opacity: 0.82;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 800;
  background: var(--ochre-soft);
  color: #7f4f0a;
  border: 1px solid rgba(233, 180, 76, 0.22);
}

.course-tabs,
.module-list {
  display: grid;
  gap: 12px;
}

.course-tab,
.module-card {
  position: relative;
  overflow: hidden;
  width: 100%;
  border: 1px solid rgba(28, 17, 10, 0.1);
  background: linear-gradient(180deg, rgba(255, 251, 243, 0.98), rgba(245, 235, 211, 0.92));
  border-radius: 20px;
  padding: 16px 16px 16px 20px;
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.course-tab::before,
.module-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  background: linear-gradient(180deg, var(--ochre), var(--rust));
}

.course-tab:hover:not(.disabled),
.module-card:hover:not(.disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(28, 17, 10, 0.08);
}

.course-tab.active,
.module-card.active {
  border-color: rgba(80, 162, 167, 0.38);
  box-shadow:
    inset 0 0 0 1px rgba(80, 162, 167, 0.16),
    0 16px 30px rgba(28, 17, 10, 0.1);
  background:
    radial-gradient(circle at top right, rgba(80, 162, 167, 0.14), transparent 34%),
    linear-gradient(180deg, rgba(255, 251, 243, 0.98), rgba(236, 244, 244, 0.94));
}

.course-tab.disabled,
.module-card.disabled {
  opacity: 0.64;
}

.course-tab strong,
.module-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.98rem;
}

.mini-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.course-summary {
  min-height: 144px;
}

.course-summary p {
  margin: 10px 0 0;
  color: var(--muted);
}

.module-detail {
  min-height: 560px;
}

.module-grid {
  display: grid;
  gap: 18px;
}

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

.module-head h2 {
  font-size: clamp(1.7rem, 2.2vw, 2.55rem);
}

.theme-chip {
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(80, 162, 167, 0.12);
  color: #2a6468;
  border: 1px solid rgba(80, 162, 167, 0.2);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.summary-text {
  margin: 12px 0 0;
  color: var(--muted);
  max-width: 75ch;
  line-height: 1.65;
}

.detail-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.detail-card,
.workbook-card,
.resource-card,
.protocol-panel,
.data-panel,
.data-template-card,
.metadata-panel,
.template-group {
  border: 1px solid var(--line);
  background: rgba(255, 252, 246, 0.9);
  border-radius: 22px;
  padding: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.52);
}

.detail-card {
  background: linear-gradient(180deg, rgba(255, 251, 243, 0.94), rgba(249, 240, 220, 0.88));
}

.detail-card ul,
.resource-card ul {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.detail-card li + li,
.resource-card li + li {
  margin-top: 8px;
}

.workbook-panel {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 20px;
  border: 1px solid rgba(155, 41, 21, 0.18);
  background:
    radial-gradient(circle at top right, rgba(80, 162, 167, 0.1), transparent 28%),
    linear-gradient(180deg, rgba(255, 249, 238, 0.98), rgba(245, 235, 209, 0.92));
  border-radius: 30px;
  padding: 24px;
  box-shadow: var(--shadow-strong);
}

.workbook-panel::before {
  top: 18px;
}

.workbook-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  padding-top: 18px;
}

.workbook-actions {
  display: grid;
  gap: 10px;
  justify-items: end;
}

.save-badge {
  max-width: 280px;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(228, 214, 167, 0.76);
  color: var(--ink);
  border: 1px solid rgba(228, 214, 167, 0.24);
  font-size: 0.84rem;
  font-weight: 800;
  text-align: center;
}

.save-badge[data-status='saved'] {
  background: rgba(80, 162, 167, 0.16);
  border-color: rgba(80, 162, 167, 0.24);
  color: #23585c;
}

.save-badge[data-status='saving'],
.save-badge[data-status='loading'] {
  background: rgba(233, 180, 76, 0.22);
  border-color: rgba(233, 180, 76, 0.24);
  color: #85550c;
}

.save-badge[data-status='dirty'] {
  background: rgba(233, 180, 76, 0.18);
  border-color: rgba(233, 180, 76, 0.2);
  color: #86560a;
}

.save-badge[data-status='error'] {
  background: rgba(155, 41, 21, 0.12);
  border-color: rgba(155, 41, 21, 0.18);
  color: var(--rust);
}

.background-grid,
.resource-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.metadata-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metadata-field {
  display: grid;
  gap: 8px;
}

.resource-card h4,
.data-template-card h4,
.template-group h4,
.protocol-section h4 {
  color: var(--ink);
}

.protocol-panel,
.data-panel {
  background: rgba(255, 252, 246, 0.86);
}

.protocol-sections,
.data-template-list {
  display: grid;
  gap: 16px;
}

.protocol-section {
  display: grid;
  gap: 12px;
  padding-left: 14px;
  border-left: 4px solid rgba(80, 162, 167, 0.3);
}

.protocol-step-list {
  display: grid;
  gap: 12px;
}

.protocol-step {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(28, 17, 10, 0.1);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(244, 234, 204, 0.72), rgba(255, 250, 242, 0.92));
}

.protocol-step-complete {
  background: linear-gradient(180deg, rgba(80, 162, 167, 0.14), rgba(255, 250, 242, 0.94));
  border-color: rgba(80, 162, 167, 0.22);
}

.protocol-check {
  display: flex;
  gap: 10px;
  align-items: center;
  align-self: start;
  font-weight: 800;
  color: #2a6468;
}

.protocol-check input,
.data-table td input[type='checkbox'],
.option-row input[type='radio'] {
  width: 18px;
  height: 18px;
  accent-color: var(--rust);
}

.protocol-copy {
  display: grid;
  gap: 8px;
}

.step-note,
.template-textarea {
  min-height: 92px;
  background: rgba(255, 255, 255, 0.92);
}

.template-group {
  display: grid;
  gap: 14px;
  background: rgba(255, 247, 231, 0.62);
}

.table-wrap {
  overflow-x: auto;
  margin-top: 12px;
  border-radius: 16px;
  border: 1px solid rgba(28, 17, 10, 0.08);
}

.data-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.86);
}

.data-table th,
.data-table td {
  border: 1px solid rgba(28, 17, 10, 0.08);
  padding: 10px;
  vertical-align: top;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table th {
  background: rgba(80, 162, 167, 0.1);
  color: #295f63;
  text-align: left;
  font-size: 0.86rem;
  font-weight: 800;
}

.data-table tbody tr:nth-child(even) {
  background: rgba(244, 234, 204, 0.26);
}

.data-table td input[type='text'],
.data-table td input[type='number'] {
  min-width: 120px;
}

.quiz-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(80, 162, 167, 0.22);
  background:
    radial-gradient(circle at top right, rgba(80, 162, 167, 0.14), transparent 30%),
    linear-gradient(180deg, rgba(255, 251, 244, 0.98), rgba(228, 214, 167, 0.36));
  border-radius: 26px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.quiz-panel::before {
  top: 16px;
}

.quiz-panel > *:first-child,
.quiz-panel h3,
.quiz-panel .quiz-note {
  position: relative;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 12px 0 0;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 800;
  border: 1px solid transparent;
}

.status-open {
  background: rgba(80, 162, 167, 0.16);
  border-color: rgba(80, 162, 167, 0.2);
  color: #255a5e;
}

.status-closed {
  background: rgba(155, 41, 21, 0.12);
  border-color: rgba(155, 41, 21, 0.16);
  color: var(--rust);
}

.quiz-note {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.quiz-form {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.question-card {
  border: 1px solid rgba(28, 17, 10, 0.1);
  border-radius: 20px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.86);
}

.question-card h4 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.option-list {
  display: grid;
  gap: 10px;
}

.option-row {
  display: flex;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid rgba(28, 17, 10, 0.1);
  border-radius: 14px;
  background: rgba(244, 234, 204, 0.5);
}

.result-card {
  margin-top: 18px;
  border: 1px solid rgba(80, 162, 167, 0.2);
  border-radius: 18px;
  background: rgba(80, 162, 167, 0.12);
  padding: 18px;
}

.helper-text,
.empty-state {
  color: var(--muted);
  line-height: 1.55;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  /* Above the auth gate (z-index 1000) so the TA login modal is usable
     before anyone is signed in as a student. */
  z-index: 1100;
}

.hidden {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 17, 10, 0.48);
  backdrop-filter: blur(7px);
}

.modal-card {
  position: relative;
  width: min(1200px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  border-radius: 30px;
  padding: 24px;
  z-index: 2;
  background:
    radial-gradient(circle at top right, rgba(80, 162, 167, 0.12), transparent 26%),
    linear-gradient(180deg, rgba(255, 248, 236, 0.98), rgba(244, 234, 204, 0.84));
}

.dialog-card {
  width: min(560px, calc(100vw - 32px));
}

.dialog-description {
  margin: 16px 0 0;
}

.dialog-form {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.dialog-fields {
  display: grid;
  gap: 14px;
}

.dialog-field {
  display: grid;
  gap: 8px;
}

.dialog-field-note {
  margin: 0;
}

.dialog-input,
.dialog-textarea {
  width: 100%;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.dialog-actions > button {
  min-width: 150px;
}

.modal-header,
.dashboard-actions {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.inline-form {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
}

.dashboard-actions {
  margin: 20px 0 18px;
}

.dashboard-chip {
  display: inline-grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(228, 214, 167, 0.62);
  border: 1px solid rgba(228, 214, 167, 0.2);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
}

.inset-panel {
  box-shadow: none;
  background: rgba(255, 252, 246, 0.74);
}

.admin-status-list,
.attempts-list {
  display: grid;
  gap: 12px;
}

.admin-row,
.attempt-row {
  border: 1px solid rgba(28, 17, 10, 0.1);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.88);
}

.admin-row-top,
.attempt-row-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.admin-row p,
.attempt-row p {
  margin: 8px 0 0;
  color: var(--muted);
}

.admin-row-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1200;
  border-radius: 18px;
  padding: 14px 18px;
  background: rgba(28, 17, 10, 0.94);
  color: var(--paper);
  box-shadow: var(--shadow-strong);
}

code {
  padding: 0.1rem 0.3rem;
  border-radius: 6px;
  background: rgba(28, 17, 10, 0.06);
  font-family: 'Consolas', 'Courier New', monospace;
}

/* ============================================================
   COLLAPSIBLE SECTIONS
   ============================================================ */

.section-collapsed {
  display: none !important;
}

/* ============================================================
   RESOURCES PANEL
   ============================================================ */

.resources-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(80, 162, 167, 0.22);
  background:
    radial-gradient(circle at top right, rgba(80, 162, 167, 0.08), transparent 40%),
    linear-gradient(180deg, rgba(255, 252, 245, 0.98), rgba(240, 248, 248, 0.92));
  border-radius: 26px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
}

.resources-panel::before {
  content: '';
  position: absolute;
  left: 18px;
  right: 18px;
  top: 0;
  height: 4px;
  border-radius: 0 0 999px 999px;
  background: linear-gradient(90deg, var(--teal), #2a8a90, var(--teal));
  opacity: 0.7;
}

.resources-overview {
  margin-bottom: 18px;
}

.resources-overview p {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.7;
  max-width: 90ch;
}

.resources-overview p:last-child {
  margin-bottom: 0;
}

.resources-subsection {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.resources-subheading {
  margin: 0 0 12px;
  font-size: 0.9rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--teal);
}

.concept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.concept-card {
  border: 1px solid rgba(80, 162, 167, 0.18);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.concept-term {
  display: block;
  margin-bottom: 5px;
  color: #1a5558;
  font-size: 0.96rem;
}

.concept-def {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.55;
}

.formula-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.formula-card {
  border: 1px solid rgba(233, 180, 76, 0.28);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255, 252, 236, 0.9);
}

.formula-name {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: #6b4a08;
}

.formula-expr {
  display: block;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(233, 180, 76, 0.22);
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.93rem;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-all;
}

.formula-notes {
  margin: 8px 0 0;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.5;
}

.resources-safety {
  background: rgba(155, 41, 21, 0.04);
  border: 1px solid rgba(155, 41, 21, 0.12);
  border-radius: 16px;
  padding: 14px 16px;
  margin-top: 20px;
}

.resources-safety .resources-subheading {
  color: var(--rust);
}

.resources-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.6;
}

.resources-list li + li {
  margin-top: 6px;
}

.safety-list li {
  color: #6b1e10;
}

.hints-list li {
  color: #2a4a2a;
}

.eq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.muted-note {
  font-size: 0.82em;
  color: var(--muted);
  font-weight: normal;
}

/* ============================================================
   ANALYSIS PANEL
   ============================================================ */

.analysis-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(28, 17, 10, 0.12);
  background:
    radial-gradient(circle at top left, rgba(155, 41, 21, 0.06), transparent 35%),
    linear-gradient(180deg, rgba(255, 251, 245, 0.98), rgba(249, 240, 226, 0.9));
  border-radius: 26px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
}

.analysis-panel::before {
  content: '';
  position: absolute;
  left: 18px;
  right: 18px;
  top: 0;
  height: 4px;
  border-radius: 0 0 999px 999px;
  background: linear-gradient(90deg, var(--rust), #c04e34, var(--rust));
  opacity: 0.7;
}

.analysis-tools-list {
  display: grid;
  gap: 16px;
}

.analysis-tool {
  border: 1px solid rgba(28, 17, 10, 0.1);
  border-radius: 20px;
  background: rgba(255, 252, 246, 0.92);
  overflow: hidden;
}

.analysis-tool-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(28, 17, 10, 0.08);
  background: rgba(244, 234, 208, 0.5);
}

.analysis-tool-title {
  font-size: 0.96rem;
  color: var(--ink);
  display: block;
  margin-bottom: 4px;
}

.analysis-tool-body {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.analysis-field-label {
  display: grid;
  gap: 6px;
}

.analysis-input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  transition: border-color 180ms ease;
}

.analysis-textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.88rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 96px;
  transition: border-color 180ms ease;
}

.analysis-input:focus,
.analysis-textarea:focus {
  outline: none;
  border-color: rgba(155, 41, 21, 0.45);
  box-shadow: 0 0 0 3px rgba(155, 41, 21, 0.1);
}

.analysis-run-btn {
  justify-self: start;
}

.analysis-result {
  min-height: 0;
}

.analysis-result-inner {
  border: 1px solid rgba(80, 162, 167, 0.22);
  border-radius: 14px;
  background: rgba(240, 250, 250, 0.82);
  overflow: hidden;
}

.analysis-result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.analysis-result-table th,
.analysis-result-table td {
  padding: 8px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(80, 162, 167, 0.14);
}

.analysis-result-table th {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
  width: 55%;
  background: rgba(80, 162, 167, 0.06);
}

.analysis-result-table td {
  font-family: 'Consolas', 'Courier New', monospace;
  color: #1a5558;
  font-size: 0.92rem;
}

.analysis-result-table tr:last-child th,
.analysis-result-table tr:last-child td {
  border-bottom: none;
}

.analysis-details {
  padding: 10px 14px;
  border-top: 1px solid rgba(80, 162, 167, 0.14);
  background: rgba(255, 255, 255, 0.6);
}

.analysis-details pre {
  margin: 0;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.82rem;
  color: var(--muted);
  white-space: pre-wrap;
  line-height: 1.5;
}

.analysis-error {
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(155, 41, 21, 0.1);
  color: var(--rust);
  font-size: 0.9rem;
  border: 1px solid rgba(155, 41, 21, 0.18);
}

/* ============================================================
   LAB SUMMARY PANEL
   ============================================================ */

.summary-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(28, 17, 10, 0.12);
  background:
    radial-gradient(circle at bottom left, rgba(233, 180, 76, 0.1), transparent 35%),
    linear-gradient(180deg, rgba(255, 252, 243, 0.98), rgba(250, 242, 220, 0.9));
  border-radius: 26px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
}

.summary-panel::before {
  content: '';
  position: absolute;
  left: 18px;
  right: 18px;
  top: 0;
  height: 4px;
  border-radius: 0 0 999px 999px;
  background: linear-gradient(90deg, var(--ochre), var(--rust), var(--teal));
  opacity: 0.6;
}

.summary-prompt {
  color: var(--muted);
  font-style: italic;
}

.summary-textarea {
  min-height: 180px;
  border: 1px solid rgba(233, 180, 76, 0.3);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  padding: 14px 16px;
  line-height: 1.7;
  font-size: 0.97rem;
}

.summary-textarea:focus {
  border-color: rgba(233, 180, 76, 0.65);
  box-shadow: 0 0 0 4px rgba(233, 180, 76, 0.14);
}

/* ============================================================
   RESPONSIVE OVERRIDES FOR NEW PANELS
   ============================================================ */

@media (max-width: 1200px) {
  .detail-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metadata-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  .hero,
  .app-layout,
  .dashboard-grid,
  .detail-columns,
  .background-grid,
  .resource-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body {
    padding: 14px;
  }

  .hero-copy,
  .hero-actions,
  .panel,
  .modal-card,
  .workbook-panel,
  .quiz-panel {
    border-radius: 24px;
  }

  .inline-form,
  .modal-header,
  .dashboard-actions,
  .module-head,
  .workbook-header,
  .admin-row-top,
  .attempt-row-top {
    flex-direction: column;
    align-items: stretch;
  }

  .dialog-actions {
    justify-content: stretch;
  }

  .hero-copy {
    padding: 28px 22px 44px;
  }

  .workbook-actions {
    justify-items: stretch;
  }

  .metadata-grid,
  .protocol-step {
    grid-template-columns: 1fr;
  }

  .concept-grid,
  .formula-grid,
  .eq-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy::after,
  .workbook-panel::before,
  .quiz-panel::before {
    left: 18px;
    right: 18px;
  }

  .gel-toolbar {
    flex-wrap: wrap;
  }

  .gel-canvas-container {
    max-width: 100%;
  }
}

/* ── Gel Analyzer Panel ─────────────────────────────────────── */

.gel-analyzer-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(59, 130, 246, 0.28);
  background:
    radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.08), transparent 40%),
    linear-gradient(180deg, rgba(255, 253, 242, 0.98), rgba(240, 248, 255, 0.92));
  border-radius: 26px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
}

.gel-analyzer-panel::before {
  content: '';
  position: absolute;
  left: 18px;
  right: 18px;
  top: 0;
  height: 4px;
  border-radius: 0 0 999px 999px;
  background: linear-gradient(90deg, #3b82f6, #6366f1, #3b82f6);
  opacity: 0.7;
}

.gel-upload-zone {
  border: 2px dashed rgba(59, 130, 246, 0.4);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 0.95rem;
  transition: border-color 0.2s, background 0.2s, transform 0.2s, box-shadow 0.2s;
  margin-bottom: 1rem;
  display: grid;
  gap: 6px;
  justify-items: center;
}

.gel-upload-zone:hover:not(.is-disabled),
.gel-upload-zone:focus-visible:not(.is-disabled) {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.05);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(59, 130, 246, 0.08);
  outline: none;
}

.gel-upload-zone.is-dragover {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.gel-upload-zone.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.gel-upload-title {
  font-size: 1rem;
  color: #1d4f91;
}

.gel-upload-hint {
  max-width: 34rem;
  line-height: 1.5;
  color: var(--muted);
  font-size: 0.88rem;
}

.gel-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.gel-mode-btn.active {
  background: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
}

.gel-mode-indicator {
  font-size: 0.82rem;
  color: var(--ink-soft);
  padding: 4px 10px;
  background: rgba(59, 130, 246, 0.08);
  border-radius: 999px;
  margin-left: auto;
}

.gel-canvas-container {
  position: relative;
  max-width: 100%;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 1rem;
  background: #1a1a2e;
}

.gel-image {
  display: block;
  width: 100%;
  height: auto;
}

.gel-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.gel-lanes-display {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.88rem;
}

.gel-lane-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.82rem;
}

.gel-calibration-info {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: 12px;
  padding: 8px 14px;
  margin-bottom: 0.75rem;
}

.gel-band-table {
  margin-bottom: 1rem;
}

.gel-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.btn-xs {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: transparent;
  cursor: pointer;
}

.btn-xs:hover {
  background: rgba(0, 0, 0, 0.05);
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.form-select {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 10px;
  font-size: 0.9rem;
  background: #fff;
  color: var(--ink);
}

/* ============================================================
   POST-LAB QUESTIONS PANEL
   ============================================================ */

.postlab-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(233, 180, 76, 0.36);
  background:
    radial-gradient(circle at top left, rgba(233, 180, 76, 0.1), transparent 42%),
    linear-gradient(180deg, rgba(255, 252, 245, 0.98), rgba(250, 244, 226, 0.92));
  border-radius: 26px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
}

.postlab-panel > .helper-text {
  margin: 4px 0 16px;
}

.postlab-question-list {
  display: grid;
  gap: 16px;
}

.postlab-question {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.postlab-q-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.postlab-q-number {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--ochre-soft);
  color: var(--rust);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.postlab-q-prompt {
  margin: 2px 0 0;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.5;
}

.postlab-q-guidance {
  margin: 10px 0 0 46px;
  padding-left: 12px;
  border-left: 3px solid var(--teal-soft);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.postlab-answer {
  width: 100%;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.5;
  resize: vertical;
}

.postlab-answer:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}

.postlab-answer:disabled {
  background: rgba(244, 234, 204, 0.5);
  cursor: not-allowed;
}

/* ============================================================
   REFERENCES PANEL
   ============================================================ */

.references-panel {
  border: 1px solid var(--line);
  background: var(--surface-muted);
  border-radius: 26px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
}

.reference-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.reference-item {
  display: block;
  padding-left: 18px;
  position: relative;
  line-height: 1.5;
}

.reference-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--teal);
}

.reference-label {
  display: block;
  color: var(--ink);
  font-size: 0.92rem;
}

.reference-detail {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ============================================================
   GUIDED BACKGROUND + COMPREHENSION CHECKS
   ============================================================ */

.guided-background {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(80, 162, 167, 0.28);
  background:
    radial-gradient(circle at top left, rgba(80, 162, 167, 0.08), transparent 42%),
    linear-gradient(180deg, rgba(255, 252, 245, 0.98), rgba(240, 248, 248, 0.92));
  border-radius: 26px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
}

.gb-body {
  display: grid;
  gap: 18px;
  margin-top: 6px;
}

.gb-section {
  border-left: 3px solid var(--teal-soft);
  padding-left: 16px;
}

.gb-section h4 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  color: var(--ink);
}

.gb-paragraph {
  margin: 0 0 10px;
  color: var(--ink-soft);
  line-height: 1.65;
  max-width: 78ch;
}

.gb-paragraph:last-child {
  margin-bottom: 0;
}

.cyu-card {
  border: 1px solid rgba(233, 180, 76, 0.45);
  border-radius: 18px;
  padding: 18px 20px;
  background:
    radial-gradient(circle at top right, rgba(233, 180, 76, 0.1), transparent 45%),
    rgba(255, 251, 240, 0.96);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.cyu-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.cyu-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--ochre-soft);
  color: var(--rust);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.cyu-prompt {
  margin: 1px 0 0;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.5;
}

.cyu-options {
  display: grid;
  gap: 10px;
}

.cyu-option {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  border-radius: 12px;
  padding: 11px 14px;
  font: inherit;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 80ms ease;
}

.cyu-option:hover:not(.cyu-locked) {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.cyu-option:active:not(.cyu-locked) {
  transform: translateY(1px);
}

.cyu-letter {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.82rem;
}

.cyu-option-text {
  line-height: 1.45;
}

.cyu-locked {
  cursor: default;
}

.cyu-correct {
  border-color: #3f9d6d;
  background: rgba(63, 157, 109, 0.14);
}

.cyu-correct .cyu-letter {
  background: #3f9d6d;
  color: #fff;
}

.cyu-wrong {
  border-color: var(--rust);
  background: var(--rust-soft);
}

.cyu-wrong .cyu-letter {
  background: var(--rust);
  color: #fff;
}

.cyu-feedback {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  line-height: 1.55;
  font-size: 0.92rem;
}

.cyu-feedback strong {
  margin-right: 4px;
}

.cyu-feedback-correct {
  background: rgba(63, 157, 109, 0.12);
  border: 1px solid rgba(63, 157, 109, 0.4);
  color: #276849;
}

.cyu-feedback-wrong {
  background: var(--rust-soft);
  border: 1px solid rgba(155, 41, 21, 0.35);
  color: var(--rust);
}

/* ============================================================
   ANALYSIS DATA-ENTRY GRID (column entry, non-programmer friendly)
   ============================================================ */

.analysis-grid {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  overflow: hidden;
}

.analysis-grid th,
.analysis-grid td {
  border: 1px solid var(--line);
  padding: 0;
}

.analysis-grid thead th {
  background: var(--surface-muted);
  padding: 7px 10px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
  text-align: left;
}

.analysis-grid .analysis-grid-rownum {
  width: 34px;
  text-align: center;
  background: var(--surface-muted);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
}

.analysis-grid-cell {
  width: 100%;
  border: none;
  background: transparent;
  padding: 9px 11px;
  font: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  box-sizing: border-box;
}

.analysis-grid-cell:focus {
  outline: 2px solid var(--teal);
  outline-offset: -2px;
  background: #fff;
  border-radius: 4px;
}

.analysis-grid-cell:disabled {
  background: rgba(244, 234, 204, 0.4);
  cursor: not-allowed;
}

/* ============================================================
   AUTH GATE (sign up / log in)
   ============================================================ */

body.gated {
  overflow: hidden;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  background:
    radial-gradient(circle at top right, rgba(80, 162, 167, 0.16), transparent 45%),
    linear-gradient(180deg, #fff9ec 0%, var(--bg) 100%);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 30px 30px 24px;
  box-shadow: var(--shadow-strong);
}

.auth-title {
  margin: 6px 0 6px;
  font-size: 1.5rem;
  line-height: 1.2;
  color: var(--ink);
}

.auth-sub {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.5;
}

.auth-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: var(--surface-muted);
  border-radius: 999px;
  margin-bottom: 18px;
}

.auth-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 12px;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

.auth-tab.active {
  background: var(--surface-strong);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(28, 17, 10, 0.1);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-field {
  display: grid;
  gap: 5px;
}

.auth-field > span {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.auth-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  font: inherit;
  background: #fff;
  color: var(--ink);
  box-sizing: border-box;
}

.auth-field input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}

.auth-hint {
  font-size: 0.78rem;
  color: var(--muted);
}

.auth-submit {
  margin-top: 4px;
  width: 100%;
}

.auth-error {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--rust-soft);
  border: 1px solid rgba(155, 41, 21, 0.35);
  color: var(--rust);
  font-size: 0.9rem;
}

.link-button {
  display: block;
  margin: 16px auto 0;
  border: none;
  background: transparent;
  color: var(--teal);
  font: inherit;
  font-size: 0.88rem;
  text-decoration: underline;
  cursor: pointer;
}

/* Signed-in identity in the hero */
.student-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.identity-copy {
  display: grid;
  gap: 2px;
}

.identity-copy strong {
  color: var(--paper);
  font-size: 1rem;
}

/* ============================================================
   MY DATA
   ============================================================ */

.mydata-body {
  display: grid;
  gap: 22px;
}

.mydata-section h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  color: var(--ink);
}

.mydata-table {
  width: 100%;
  border-collapse: collapse;
}

.mydata-table th,
.mydata-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  font-size: 0.9rem;
}

.mydata-table thead th {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.mydata-labs {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* ============================================================
   GRADEBOOK
   ============================================================ */

.gradebook-panel {
  margin-top: 18px;
}

.gradebook-table {
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 100%;
}

.gradebook-table th,
.gradebook-table td {
  border: 1px solid var(--line);
  padding: 7px 9px;
  text-align: center;
  white-space: nowrap;
}

.gradebook-table thead th {
  background: var(--surface-muted);
  color: var(--ink-soft);
  font-weight: 700;
  position: sticky;
  top: 0;
}

.gradebook-table .gb-name {
  text-align: left;
  background: var(--surface-muted);
  color: var(--ink);
  font-weight: 600;
  position: sticky;
  left: 0;
  z-index: 1;
}

.gradebook-table .gb-empty {
  color: var(--muted);
}

.gradebook-table .gb-high {
  background: rgba(63, 157, 109, 0.18);
  color: #276849;
  font-weight: 600;
}

.gradebook-table .gb-mid {
  background: rgba(233, 180, 76, 0.22);
  color: #8a5a12;
  font-weight: 600;
}

.gradebook-table .gb-low {
  background: var(--rust-soft);
  color: var(--rust);
  font-weight: 600;
}

/* ============================================================
   TA PORTAL TABS, ATTENDANCE, GRADING
   ============================================================ */

#ta-modal .modal-card {
  max-width: 980px;
}

.ta-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 4px;
  background: var(--surface-muted);
  border-radius: 14px;
  margin-bottom: 16px;
}

.ta-tab {
  border: none;
  background: transparent;
  padding: 9px 14px;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

.ta-tab.active {
  background: var(--surface-strong);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(28, 17, 10, 0.1);
}

.ta-tab-panel.hidden {
  display: none;
}

.gb-subhead {
  margin: 4px 0 10px;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.gb-summary th.gb-name,
.gb-summary td {
  text-align: left;
  padding: 8px 12px;
}

/* Attendance */
.att-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  font-size: 0.78rem;
}

.att-key {
  padding: 3px 12px;
  border-radius: 999px;
  font-weight: 600;
}

.att-key.att-present,
.pill.att-present,
.att-cell.att-present {
  background: rgba(63, 157, 109, 0.18);
  color: #276849;
  border-color: rgba(63, 157, 109, 0.5);
}

.att-key.att-absent,
.pill.att-absent,
.att-cell.att-absent {
  background: var(--rust-soft);
  color: var(--rust);
  border-color: rgba(155, 41, 21, 0.4);
}

.att-key.att-late,
.pill.att-late,
.att-cell.att-late {
  background: rgba(233, 180, 76, 0.28);
  color: #8a5a12;
  border-color: rgba(233, 180, 76, 0.6);
}

.att-key.att-excused,
.pill.att-excused,
.att-cell.att-excused {
  background: var(--teal-soft);
  color: #2b6f73;
  border-color: rgba(80, 162, 167, 0.5);
}

.attendance-table td.att-td {
  padding: 2px;
}

.att-cell {
  width: 34px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--muted);
  cursor: pointer;
  transition: transform 80ms ease;
}

.att-cell:active {
  transform: scale(0.92);
}

/* Grade post-lab */
.grade-selectors {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.grade-select-label {
  display: grid;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  flex: 1;
  min-width: 180px;
}

.grade-select-label input,
.grade-select-label textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  font: inherit;
  font-weight: 400;
  background: #fff;
  color: var(--ink);
  box-sizing: border-box;
  width: 100%;
}

.grade-select-label input:focus,
.grade-select-label textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}

.grade-detail {
  display: grid;
  gap: 16px;
}

.grade-answers {
  display: grid;
  gap: 12px;
}

.grade-answer {
  border-left: 3px solid var(--teal-soft);
  padding-left: 14px;
}

.grade-q {
  margin: 0 0 4px;
  color: var(--ink);
  line-height: 1.45;
}

.grade-a {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.55;
  white-space: pre-wrap;
}

.grade-form {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: grid;
  gap: 12px;
}

.grade-form-row {
  display: flex;
  gap: 12px;
}

.grade-form-row .grade-select-label {
  min-width: 110px;
}

.grade-form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.grade-qcomment {
  width: 100%;
  margin-top: 8px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 0.88rem;
  background: rgba(80, 162, 167, 0.06);
  color: var(--ink);
  box-sizing: border-box;
  resize: vertical;
}

.grade-qcomment:focus {
  outline: none;
  border-color: var(--teal);
  border-style: solid;
  box-shadow: 0 0 0 3px var(--teal-soft);
}

/* Student-facing TA comment on a post-lab question */
.postlab-ta-comment {
  margin-top: 10px;
  padding: 10px 12px;
  border-left: 3px solid var(--teal);
  background: var(--teal-soft);
  border-radius: 0 10px 10px 0;
}

.postlab-ta-comment p {
  margin: 4px 0 0;
  color: var(--ink);
  line-height: 1.5;
  white-space: pre-wrap;
}

.ta-comment-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #2b6f73;
}

/* ============================================================
   TA LAB PREP
   ============================================================ */

.prep-week-label {
  min-width: 240px;
  flex: 0 0 auto;
}

.prep-container {
  display: grid;
  gap: 18px;
}

.prep-overview {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.6;
  padding: 12px 14px;
  background: var(--surface-muted);
  border-radius: 12px;
}

.prep-section h4 {
  margin: 0 0 10px;
  font-size: 0.98rem;
  color: var(--ink);
}

.prep-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  line-height: 1.55;
}

.prep-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.prep-table th,
.prep-table td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.prep-table thead th {
  background: var(--surface-muted);
  color: var(--ink-soft);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.prep-table td:first-child {
  min-width: 150px;
}

.panel-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.boot-error {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(180deg, #fff9ec 0%, var(--bg) 100%);
}

.boot-error-card {
  text-align: center;
  max-width: 420px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 32px;
  box-shadow: var(--shadow);
}

.boot-error-card h2 {
  margin: 0 0 8px;
  color: var(--ink);
}

.boot-error-card p {
  margin: 0 0 18px;
  color: var(--muted);
}

.pw-reset-banner {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px 16px;
  border: 1px solid rgba(63, 157, 109, 0.4);
  background: rgba(63, 157, 109, 0.12);
  border-radius: 12px;
}

.pw-reset-code {
  display: inline-block;
  margin: 0 8px;
  padding: 2px 10px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--line);
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  user-select: all;
}

.gb-reset-btn {
  font-size: 0.8rem;
  padding: 4px 10px;
  white-space: nowrap;
}
