/* ── RESET & BASE ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { overflow: hidden; }

:root {
  /* Colors */
  --ink: #20241F;
  --chalkboard: #2B4238;
  --ledger: #3E5C6B;
  --folder: #D8C9A3;
  --paper: #F7F4EC;
  --grade-red: #B23A2E;
  --correct: #3F6C4E;
  --folder-light: #E8DEC4;
  --paper-light: #FAF8F2;

  /* Typography */
  --display: 'Fraunces', serif;
  --body: 'IBM Plex Sans', sans-serif;
  --mono: 'IBM Plex Mono', monospace;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --screen-pad: 16px;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  /* Touch */
  --min-touch: 44px;

  /* Type scale */
  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-lg: 18px;
  --text-xl: 24px;
  --text-2xl: 30px;
}

body {
  font-family: var(--body);
  font-size: var(--text-base);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

/* ── APP SHELL ─────────────────────────────────────────────────── */
.app-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}

/* ── TOP BAR ───────────────────────────────────────────────────── */
.top-bar {
  background: var(--paper);
  color: var(--ink);
  padding: var(--space-2) var(--screen-pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  flex-shrink: 0;
  z-index: 20;
  border-bottom: 1.5px solid var(--folder);
}
.top-bar-title {
  font-family: var(--body);
  font-weight: 600;
  font-size: var(--text-base);
  letter-spacing: 0.3px;
  color: var(--ink);
  margin-left: auto;
}
.top-bar-back {
  background: none;
  border: none;
  color: var(--ink);
  cursor: pointer;
  padding: var(--space-2) var(--space-3);
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 2px;
  font-family: var(--body);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.top-bar-back:first-child { margin-left: -4px; }
.top-bar-back:hover, .top-bar-back:focus-visible {
  background: rgba(32,36,31,0.06);
}
.top-bar-back:focus-visible {
  outline: 2px solid var(--ledger);
  outline-offset: 2px;
}

/* ── MAIN CONTENT ──────────────────────────────────────────────── */
.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* ── SCREENS (slide horizontally) ──────────────────────────────── */
.screen {
  display: none;
  padding: var(--screen-pad);
  padding-bottom: 80px;
  min-height: 100%;
}
.screen.active {
  display: block;
  animation: slideIn 0.25s ease-out;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
  .screen.active { animation: none; }
}

/* ── AUTH SCREENS (login + change password) ────────────────────── */
.auth-screen {
  padding: 0 !important;
  animation: none !important;
}
.auth-screen.active {
  display: flex !important;
  align-items: center;
  justify-content: center;
  animation: authFadeIn 0.4s ease-out;
}
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--screen-pad);
  background: var(--paper);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: white;
  border: 1px solid var(--folder);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  box-shadow: 0 2px 12px rgba(32,36,31,0.06);
}
.auth-title {
  font-family: var(--display);
  font-size: var(--text-2xl);
  color: var(--ink);
  text-align: center;
  margin-bottom: var(--space-2);
  line-height: 1.15;
}
.auth-subtitle {
  font-family: var(--body);
  font-size: var(--text-sm);
  color: #6B6B5F;
  text-align: center;
  margin-bottom: var(--space-6);
}
.auth-warning {
  font-family: var(--body);
  font-size: var(--text-sm);
  color: var(--grade-red);
  text-align: center;
  margin-bottom: var(--space-5);
  padding: var(--space-2) var(--space-3);
  background: #F7E8E6;
  border-radius: var(--radius-sm);
}
.auth-field {
  margin-bottom: var(--space-4);
}
.auth-label {
  display: block;
  font-family: var(--body);
  font-size: var(--text-xs);
  font-weight: 600;
  color: #6B6B5F;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-2);
}
.auth-input {
  width: 100%;
  padding: var(--space-3) var(--space-3);
  border: 1.5px solid var(--folder);
  border-radius: var(--radius-md);
  background: var(--paper-light);
  font-family: var(--body);
  font-size: var(--text-base);
  color: var(--ink);
  min-height: 48px;
  transition: border-color 0.15s;
}
.auth-input::placeholder { color: #9A8E74; }
.auth-input:focus {
  outline: 2px solid var(--ledger);
  outline-offset: 1px;
  border-color: transparent;
}
.auth-footer {
  text-align: center;
  font-family: var(--body);
  font-size: var(--text-xs);
  color: #C5BFA9;
  margin-top: var(--space-5);
}
@keyframes authFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── SCREEN 1: CLASS PICKER ────────────────────────────────────── */
.class-picker-search {
  width: 100%;
  padding: var(--space-3) var(--space-3);
  border: 1.5px solid var(--folder);
  border-radius: var(--radius-md);
  background: var(--paper-light);
  font-family: var(--body);
  font-size: var(--text-base);
  color: var(--ink);
  min-height: var(--min-touch);
  margin-bottom: var(--space-3);
}
.class-picker-search::placeholder {
  color: #9A8E74;
}
.class-picker-search:focus {
  outline: 2px solid var(--ledger);
  outline-offset: 1px;
  border-color: transparent;
}

.filter-chips {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-3);
  scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: var(--space-1) var(--space-3);
  border: 1.5px solid var(--folder);
  border-radius: 20px;
  background: transparent;
  font-family: var(--body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  min-height: 32px;
  transition: all 0.15s;
  white-space: nowrap;
}
.chip.active {
  background: var(--chalkboard);
  color: var(--paper);
  border-color: var(--chalkboard);
}
.chip:focus-visible {
  outline: 2px solid var(--ledger);
  outline-offset: 2px;
}

.class-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.class-row {
  display: flex;
  align-items: stretch;
  background: white;
  border: 1px solid var(--folder);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  min-height: var(--min-touch);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.class-row:hover, .class-row:focus-within {
  border-color: var(--ledger);
  box-shadow: 0 1px 4px rgba(62,92,107,0.12);
}
.class-row:focus-visible {
  outline: 2px solid var(--ledger);
  outline-offset: 2px;
}
.class-row-border {
  width: 4px;
  flex-shrink: 0;
}
.class-row-body {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}
.class-row-name {
  font-family: var(--display);
  font-size: var(--text-lg);
  color: var(--ink);
  line-height: 1.2;
}
.class-row-meta {
  font-size: var(--text-sm);
  color: #6B6B5F;
  line-height: 1.3;
}
.class-row-id {
  font-family: var(--mono);
  font-size: var(--text-xs);
  color: #9A8E74;
}

/* ── SCREEN 2: CLASS DETAIL ────────────────────────────────────── */
.class-detail-header {
  margin-bottom: var(--space-6);
}
.class-detail-name {
  font-family: var(--display);
  font-size: var(--text-xl);
  line-height: 1.15;
  color: var(--ink);
  margin-bottom: var(--space-2);
}
.class-detail-meta {
  font-size: var(--text-sm);
  color: #6B6B5F;
  margin-bottom: var(--space-4);
}
.class-detail-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  border: 1.5px solid var(--ledger);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ledger);
  font-family: var(--body);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  min-height: var(--min-touch);
  text-decoration: none;
  transition: all 0.15s;
}
.btn-outline:hover {
  background: rgba(62,92,107,0.06);
}
.btn-outline:focus-visible {
  outline: 2px solid var(--ledger);
  outline-offset: 2px;
}
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border: none;
  border-radius: var(--radius-sm);
  background: var(--chalkboard);
  color: var(--paper);
  font-family: var(--body);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  transition: background 0.15s;
}
.btn-primary:hover {
  background: #1E3129;
}
.btn-primary:focus-visible {
  outline: 2px solid var(--ledger);
  outline-offset: 2px;
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── FOLDER TAB TEST SWITCHER ──────────────────────────────────── */
.folder-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 0;
  padding: 2px 0 0 var(--space-2);
  position: relative;
  box-shadow: inset 0 -2px 0 var(--folder);
}
.folder-tab {
  position: relative;
  padding: var(--space-3) var(--space-5);
  font-family: var(--body);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: var(--folder);
  color: #6B6B5F;
  border-radius: 10px 10px 0 0;
  min-height: var(--min-touch);
  margin-right: -8px;
  z-index: 1;
  box-shadow: 2px -1px 3px rgba(0,0,0,0.06);
  transition: background-color .15s ease-out, color .15s ease-out, z-index .15s;
}
.folder-tab:first-child { margin-left: 0; }
.folder-tab.active {
  background: var(--paper);
  color: var(--ink);
  z-index: 10;
  transform: translateY(-3px);
  margin-bottom: -2px;
  box-shadow: 2px -2px 4px rgba(0,0,0,0.10), 0 -1px 0 rgba(0,0,0,0.04);
}
.folder-tab:hover:not(.active) {
  background: var(--folder-light);
}
.folder-tab:focus-visible {
  outline: 2px solid var(--ledger);
  outline-offset: -2px;
  z-index: 20;
}

/* ── STUDENT CARDS ─────────────────────────────────────────────── */
.student-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-top: var(--space-4);
}
.student-card {
  background: white;
  border: 1px solid var(--folder);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.student-card:hover, .student-card:focus-within {
  border-color: var(--ledger);
  box-shadow: 0 1px 4px rgba(62,92,107,0.1);
}
.student-card:focus-visible {
  outline: 2px solid var(--ledger);
  outline-offset: 2px;
}
.student-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}
.student-card-name {
  font-family: var(--body);
  font-weight: 600;
  font-size: var(--text-base);
}
.student-card-id {
  font-family: var(--mono);
  font-size: var(--text-xs);
  color: #C5BFA9;
}
.student-card-stamps {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-2);
}
.grade-stamp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--paper);
  border: 1.5px solid var(--folder);
  font-family: var(--mono);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--ink);
  transition: all 0.15s;
}
.grade-stamp.has-value {
  border-color: var(--correct);
  background: #EAF3EA;
}
.grade-stamp.flagged {
  border-color: var(--grade-red);
  background: #F7E8E6;
  color: var(--grade-red);
}
.student-card-comment {
  font-size: var(--text-sm);
  color: #6B6B5F;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: max-height 0.2s ease;
}
.student-card-comment:empty {
  display: none;
}
.student-card.expanded .student-card-comment {
  -webkit-line-clamp: unset;
  display: block;
}
.student-card-header-arrow {
  font-size: 10px;
  color: #C5BFA9;
  transition: transform 0.15s ease;
  margin-left: var(--space-2);
}
.student-card.expanded .student-card-header-arrow {
  transform: rotate(180deg);
}

/* ── PROGRESS STRIP ────────────────────────────────────────────── */
.progress-strip {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  padding: var(--space-3) var(--screen-pad);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: white;
  border-bottom: 1px solid var(--folder);
  scrollbar-width: none;
}
.progress-strip::-webkit-scrollbar { display: none; }
.progress-dot {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--folder);
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 10px;
  color: #9A8E74;
  cursor: pointer;
  transition: all 0.15s;
}
.progress-dot.scored {
  border-color: var(--correct);
  background: var(--correct);
  color: white;
}
.progress-dot.flagged {
  border-color: var(--grade-red);
  background: var(--grade-red);
  color: white;
}
.progress-dot.skipped {
  border-color: var(--folder);
  background: transparent;
  color: #C5BFA9;
  border-style: dashed;
}
.progress-dot.active {
  transform: scale(1.15);
  box-shadow: 0 0 0 3px rgba(43,66,56,0.25);
}
.progress-dot:focus-visible {
  outline: 2px solid var(--ledger);
  outline-offset: 2px;
}

/* ── SCORE INPUT SESSION ───────────────────────────────────────── */
.session-student-name {
  font-family: var(--body);
  font-weight: 600;
  font-size: var(--text-lg);
  text-align: center;
  margin: var(--space-6) 0 var(--space-2);
}
.session-student-id {
  font-family: var(--mono);
  font-size: var(--text-sm);
  color: #9A8E74;
  text-align: center;
  margin-bottom: var(--space-6);
}
.session-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: center;
}
.session-manual-link {
  background: none;
  border: none;
  color: var(--ledger);
  font-family: var(--body);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  padding: var(--space-2);
  min-height: var(--min-touch);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.session-manual-link:focus-visible {
  outline: 2px solid var(--ledger);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── VALIDATE & CONFIRM ────────────────────────────────────────── */
.validate-photo {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--folder-light);
  margin-bottom: var(--space-4);
  cursor: pointer;
}
.validate-stamps {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  justify-content: center;
  margin: var(--space-6) 0;
}
.validate-stamp-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
}
.validate-stamp-label {
  font-size: var(--text-xs);
  color: #6B6B5F;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.validate-stamp {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--folder);
  background: var(--paper);
  font-family: var(--mono);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  min-height: var(--min-touch);
  min-width: var(--min-touch);
}
.validate-stamp.has-value {
  border-color: var(--correct);
  background: #EAF3EA;
}
.validate-stamp.flagged {
  border-color: var(--grade-red);
  background: #F7E8E6;
  color: var(--grade-red);
  animation: pulse-flag 1.5s ease-in-out infinite;
}
@keyframes pulse-flag {
  0%, 100% { box-shadow: 0 0 0 0 rgba(178,58,46,0.2); }
  50% { box-shadow: 0 0 0 6px rgba(178,58,46,0.1); }
}
@media (prefers-reduced-motion: reduce) {
  .validate-stamp.flagged { animation: none; }
}
.validate-warning {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--grade-red);
  margin-bottom: var(--space-4);
  padding: var(--space-2) var(--space-3);
  background: #F7E8E6;
  border-radius: var(--radius-sm);
}

/* ── LS SKILL ROWS ─────────────────────────────────────────────── */
.skills-section {
  margin: var(--space-4) 0;
  border-top: 1.5px solid var(--folder);
  padding-top: var(--space-4);
}
.skills-heading {
  font-size: var(--text-xs);
  font-weight: 600;
  color: #6B6B5F;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: var(--space-3);
}
.skill-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--folder-light);
  min-height: 44px;
}
.skill-desc {
  font-size: var(--text-sm);
  color: var(--ink);
  flex: 1;
  padding-right: var(--space-3);
}
.skill-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--folder);
  background: var(--paper);
  font-family: var(--mono);
  font-size: var(--text-sm);
  font-weight: 500;
  color: #9A8E74;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.skill-badge.yes {
  border-color: var(--correct);
  background: #EAF3EA;
  color: var(--correct);
}
.skill-badge.no {
  border-color: var(--grade-red);
  background: #F7E8E6;
  color: var(--grade-red);
}

/* ── COMMENT PHASE ─────────────────────────────────────────────── */
.comment-section {
  margin: var(--space-4) 0;
}
.comment-note-field {
  width: 100%;
  padding: var(--space-3);
  border: 1.5px solid var(--folder);
  border-radius: var(--radius-sm);
  background: var(--paper-light);
  font-family: var(--body);
  font-size: var(--text-sm);
  color: var(--ink);
  resize: vertical;
  min-height: var(--min-touch);
  margin-bottom: var(--space-3);
}
.comment-note-field:focus {
  outline: 2px solid var(--ledger);
  outline-offset: 1px;
  border-color: transparent;
}
.comment-result-area {
  width: 100%;
  padding: var(--space-3);
  border: 1.5px solid var(--folder);
  border-radius: var(--radius-sm);
  background: white;
  font-family: var(--body);
  font-size: var(--text-sm);
  color: var(--ink);
  resize: vertical;
  min-height: 80px;
  margin-bottom: var(--space-3);
}
.comment-result-area:focus {
  outline: 2px solid var(--ledger);
  outline-offset: 1px;
  border-color: transparent;
}
.btn-generate {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: 1.5px solid var(--ledger);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ledger);
  font-family: var(--body);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  min-height: var(--min-touch);
  transition: all 0.15s;
}
.btn-generate:hover {
  background: rgba(62,92,107,0.06);
}
.btn-generate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-generate:focus-visible {
  outline: 2px solid var(--ledger);
  outline-offset: 2px;
}

/* ── FINISH & SAVE ─────────────────────────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin: var(--space-6) 0;
}
.summary-card {
  background: white;
  border: 1px solid var(--folder);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  text-align: center;
}
.summary-number {
  font-family: var(--mono);
  font-size: var(--text-2xl);
  font-weight: 500;
  color: var(--ink);
}
.summary-label {
  font-size: var(--text-xs);
  color: #6B6B5F;
  margin-top: var(--space-1);
}
.summary-flagged {
  color: var(--grade-red);
}
.summary-correct {
  color: var(--correct);
}

/* ── STATUS TOAST ──────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-sm);
  font-family: var(--body);
  font-size: var(--text-sm);
  font-weight: 500;
  z-index: 100;
  max-width: calc(100vw - var(--screen-pad) * 2);
  text-align: center;
  animation: toastIn 0.25s ease-out;
  pointer-events: none;
}
.toast.info    { background: rgba(62,92,107,0.92); color: white; }
.toast.success { background: rgba(63,108,78,0.92); color: white; }
.toast.error   { background: rgba(178,58,46,0.92); color: white; }
.toast.warning { background: rgba(180,150,80,0.92); color: white; }

.toast-dismissible {
  display: flex !important;
  align-items: center;
  gap: var(--space-3);
  pointer-events: auto;
}
.toast-message {
  flex: 1;
  text-align: left;
}
.toast-close {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.15);
  color: white;
  font-family: var(--body);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s;
}
.toast-close:hover,
.toast-close:focus-visible {
  background: rgba(255,255,255,0.3);
}
.toast-close:focus-visible {
  outline: 2px solid white;
  outline-offset: 1px;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── UTILITIES ─────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted  { color: #6B6B5F; }
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
.gap-3 { gap: var(--space-3); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.w-full { width: 100%; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px var(--screen-pad);
  color: #9A8E74;
  text-align: center;
  min-height: 40vh;
}
.empty-state-icon {
  font-size: 40px;
  margin-bottom: var(--space-4);
}
.empty-state-text {
  font-size: var(--text-base);
  margin-bottom: var(--space-2);
}
.empty-state-sub {
  font-size: var(--text-sm);
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: var(--space-3);
  color: #9A8E74;
  font-size: var(--text-sm);
}
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--folder);
  border-top-color: var(--chalkboard);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── RESPONSIVE ────────────────────────────────────────────────── */
@media (min-width: 640px) {
  .app-shell {
    flex-direction: row;
  }
  .top-bar { display: none; }
  .desktop-sidebar {
    display: flex !important;
    width: 320px;
    flex-shrink: 0;
    background: white;
    border-right: 1px solid var(--folder);
    flex-direction: column;
    overflow: hidden;
  }
  .desktop-main {
    flex: 1;
    overflow-y: auto;
    background: var(--paper);
  }
  .screen { padding-bottom: var(--screen-pad); }
  .student-card { cursor: default; }

  /* Auth screens take full viewport on desktop (no sidebar) */
  .auth-screen.active ~ .desktop-main,
  .main-content:has(.auth-screen.active) {
    position: relative;
  }
  /* When auth is active, hide sidebar via sibling */
  .auth-screen.active {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    background: var(--paper);
  }
}

.desktop-sidebar { display: none; }
.desktop-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
}