:root {
  /* TeachSmarts family tokens (App Design Constitution §3). Colours are the
     one category PaperPeer customises; everything else is fixed across the
     family and must not be re-derived here. */
  --primary-color: #EA580C;
  --primary-hover: #C2410C;
  --secondary-color: #95a5a6;
  --secondary-hover: #7f8c8d;
  --success-color: #34A853;
  --success-hover: #2e8a4a;
  --danger-color: #e74c3c;
  --danger-hover: #c0392b;
  --text-dark: #2c3e50;
  --text-light: #34495e;
  --text-muted: #8b929a;
  --input-bg: #ecf0f1;
  --container-bg-color: #ffffff;
  --main-bg-color: #f0f2f5;
  --gradient-start: #fdf0e6;
  --gradient-end: #fdfefe;
  --border-soft: #d5deec;
  --border-input: #ccc;
  --font-sans: 'Google Sans', 'Roboto Flex', 'Inter', 'Roboto', 'Segoe UI', sans-serif;

  /* Radius */
  --radius-input: 8px;
  --radius-button: 8px;
  --radius-card: 16px;
  --radius-modal: 18px;
  --radius-pill: 999px;

  /* Spacing scale — the only spacing values allowed anywhere in the app */
  --space-xs: 6px;
  --space-sm: 10px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Sizing */
  --control-height: 44px;
  --width-app-max: 960px;
  --width-wizard-max: 900px;
  --width-landing-max: 1320px;
  --width-legal-max: 860px;

  /* Shadows */
  --shadow-card: 0 12px 36px rgba(0, 0, 0, .08);
  --shadow-card-soft: 0 4px 20px rgba(0, 0, 0, .06);
  --shadow-hover-lift: 0 6px 14px rgba(0, 0, 0, .08);
  --shadow-modal: 0 28px 80px rgba(15, 23, 42, .28);

  /* Typography */
  --font-size-page-title: 2rem;
  --font-size-section: 1.5rem;
  --font-size-card-title: 1.125rem;
  --font-size-body: 1rem;
  --font-size-control: 1em;
  --font-size-helper: 0.875rem;

  /* Motion */
  --transition-fast: 0.2s ease;
  --transition-lift: 0.15s ease;

  /* Z-index scale */
  --z-dropdown: 10;
  --z-sticky-nav: 100;
  --z-modal: 9999;

  /* Legacy aliases so existing selectors below keep working while they're
     migrated to the tokens above one at a time. */
  --ink: var(--text-dark);
  --muted: var(--text-light);
  --line: var(--border-soft);
  --panel: var(--container-bg-color);
}

* { box-sizing: border-box; }
.hidden { display: none !important; }

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--text-dark);
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }

.site-header {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.5rem;
  font-weight: 700;
  color: #000;
  letter-spacing: 1px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.16);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.landing-main {
  position: relative;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

.landing-content {
  position: relative;
  z-index: 2;
  min-height: calc(100vh - 128px);
  padding: 10vh 24px 40px;
  display: grid;
  place-items: center;
}

.landing-panel {
  width: min(560px, 92vw);
  display: grid;
  justify-items: center;
}

.hero-logo {
  width: 176px;
  height: 176px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 18px 38px rgba(124, 45, 18, 0.35);
}

.app-container {
  width: min(var(--width-app-max), 95vw);
  margin: 30px auto;
  padding: var(--space-lg);
}

.dashboard-main {
  width: min(var(--width-app-max), 94vw);
  margin: 0 auto 30px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dashboard-main .dashboard-shell {
  width: 100%;
}
.dashboard-main.canvas-wide {
  width: min(1300px, 96vw);
}

.dashboard-shell,
.panel {
  background: var(--container-bg-color);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-lg);
}

.card {
  max-width: 480px;
  text-align: center;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(2px);
}

.badge {
  display: inline-block;
  margin-bottom: 10px;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-pill);
  background: var(--gradient-start);
  border: 1px solid var(--primary-color);
  color: var(--primary-hover);
  font-size: var(--font-size-helper);
  font-weight: 700;
}

h1, h2, h3 { color: var(--text-dark); }
.landing-panel h1 {
  margin: 24px 0 22px;
  font-size: clamp(4.4rem, 8vw, 7rem);
  line-height: 0.95;
  color: #111;
  text-align: center;
}

h1 { margin: 0 0 14px; font-size: 2.2rem; }
h2 { margin: 0 0 12px; font-size: var(--font-size-page-title); }
h3 { margin-top: 0; font-size: var(--font-size-card-title); }
p { color: var(--text-light); line-height: 1.5; }

.muted { color: var(--muted); }

.join-box {
  display: flex;
  gap: 0.55rem;
  margin: 1rem 0;
}

.join-card {
  width: min(496px, 100%);
  display: grid;
  gap: 14px;
  padding: 20px 22px 22px;
  border-radius: 8px;
  background: #fff;
}

.join-card input {
  height: 76px;
  border: 2px solid #c7c7c7;
  border-radius: 8px;
  background: #fff;
  text-align: center;
  color: #6b7280;
  font-size: 1.65rem;
  font-weight: 700;
}

.join-card input::placeholder {
  color: #6b7280;
  opacity: 1;
}

.join-card button {
  height: 74px;
  border-radius: 6px;
  font-size: 1.35rem;
}

input[type="text"], input[type="number"], input[type="email"], input[type="date"],
input[type="time"], input:not([type]), textarea, select {
  width: 100%;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-input);
  padding: 15px;
  font-size: var(--font-size-body);
  background: var(--input-bg);
  font-family: var(--font-sans);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

button {
  font: inherit;
  border: 0;
  border-radius: var(--radius-button);
  padding: 0.75rem 1.2rem;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.header-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 106px;
  min-height: var(--control-height);
  border-radius: var(--radius-button);
}

.primary, .secondary, .btn, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-height);
  padding: 15px 30px;
  font-size: var(--font-size-control);
  font-weight: bold;
  border-radius: var(--radius-button);
  transition: background-color var(--transition-fast);
}
.primary, .btn { background: var(--primary-color); color: #fff; }
.secondary, .btn-secondary { background: var(--secondary-color); color: #fff; }

.primary:hover:not([disabled]), .btn:hover:not([disabled]) { background: var(--primary-hover); }
.secondary:hover:not([disabled]), .btn-secondary:hover:not([disabled]) { background: var(--secondary-hover); }
.primary[disabled], .btn[disabled], .secondary[disabled], .btn-secondary[disabled] {
  background: #bdc3c7; cursor: not-allowed;
}

.wizard-steps {
  margin: 0 0 20px;
  padding-left: 20px;
  color: #203247;
}
.wizard-grid {
  display: grid;
  gap: var(--space-md);
}
/* .wizard-page is the canonical TeachSmarts class (App Design Constitution
   §5); .wizard-step is kept as an alias so existing markup keeps working.
   Deliberately no card styling here — the single outer .dashboard-shell is
   the one visual card per page; nesting a second card/border/shadow inside
   it is exactly the "clunky" double-card look this fixes. */
.wizard-page, .wizard-step {
  width: 100%;
  max-width: var(--width-wizard-max);
  margin: 0 auto;
  padding: var(--space-md) var(--space-sm);
  animation: paperpeer-fade-in .4s ease;
}
@keyframes paperpeer-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
.wizard-step-title {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-sm);
  text-align: center;
}
.wizard-step h3 {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  text-align: center;
}
.step-body {
  display: grid;
  gap: var(--space-md);
}
.step-body label {
  display: grid;
  gap: var(--space-xs);
  font-weight: 700;
  color: var(--text-light);
}
.step-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}
/* Short, single-value fields (a mark out of N, a page count) shouldn't
   stretch to the full wizard column width — width:100% is meant for fields
   a teacher is actually typing free text into. */
.field-compact {
  max-width: 220px;
  margin: 0 auto;
  text-align: center;
}
.field-compact input {
  text-align: center;
}
.step-ok {
  color: #166534;
  background: #dcfce7;
  border: 1px solid #86efac;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.8rem;
}
.step-pending {
  color: #92400e;
  background: #ffedd5;
  border: 1px solid #fdba74;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.8rem;
}
.step-disabled {
  opacity: 0.72;
}
.scan-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.sample-nav-position {
  font-weight: 700;
  color: var(--text-dark);
}
.sample-nav-file {
  font-size: var(--font-size-helper);
}
.sample-pill {
  padding: 8px 14px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-button);
  background: var(--input-bg);
  font-weight: 700;
  cursor: pointer;
}
.sample-pill.active {
  border-color: var(--primary-color);
  background: var(--gradient-start);
}
.scan-toolbar-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.scan-toolbar-buttons {
  display: flex;
  align-items: stretch;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}
.tb {
  border: 1px solid var(--border-input);
  background: var(--container-bg-color);
  border-radius: var(--radius-button);
  padding: 6px 14px;
  min-height: 64px;
  min-width: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
}
.tb:hover:not([disabled]) { background: var(--input-bg); }
.tb[disabled] { opacity: 0.5; cursor: not-allowed; }
.tb .ico {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: var(--input-bg);
}
.tb .lbl { font-size: 0.8rem; font-weight: 700; line-height: 1; }
.tb .key { font-size: 0.7rem; color: var(--muted); line-height: 1; }
.tb.active {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}
.tb.active .ico { background: rgba(255, 255, 255, 0.2); border-color: rgba(255, 255, 255, 0.35); }
.tb.active .key { color: rgba(255, 255, 255, 0.8); }
.tb.tb-primary {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}
.tb.tb-primary:hover:not([disabled]) { background: var(--primary-hover); }
.tb.tb-primary .ico { background: rgba(255, 255, 255, 0.2); border-color: rgba(255, 255, 255, 0.35); }
.tb.tb-primary .key { color: rgba(255, 255, 255, 0.8); }
.tools {
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  gap: 8px;
  flex: 1;
}
.scan-toolbar-meta {
  display: grid;
  gap: 2px;
  align-content: center;
  text-align: center;
  min-width: 200px;
}
.quizz-nav {
  justify-content: start;
}
.drive-browser {
  width: min(760px, 100%);
  margin: 0.75rem auto 0;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #ffffff;
  overflow: hidden;
}
.drive-browser-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: #f5f5f5;
  border-bottom: 1px solid #ccc;
}
.drive-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  min-width: 0;
}
.crumb-btn {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}
.drive-browser-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
}
.drive-selection-status {
  color: #777;
  font-size: 0.9rem;
}
.drive-selection-status.selected {
  color: #27ae60;
  font-weight: 700;
}
.drive-back-button {
  padding: 5px 10px;
}
.drive-browser-list {
  display: grid;
  gap: 0;
  max-height: 250px;
  overflow: auto;
  padding: 10px;
  text-align: left;
}
.drive-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 8px;
  background: transparent;
  color: #111;
  text-align: left;
  cursor: pointer;
}
.drive-item:hover,
.drive-item:focus-visible {
  background: #eee;
}
.drive-item-icon {
  flex: 0 0 auto;
  width: 1.25rem;
  text-align: center;
}
.drive-item-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-item.selected {
  background: #f3f8f3;
  border-color: #bfe5bf;
}
.load-more-btn {
  justify-self: start;
  margin-top: 0.35rem;
}
.region-choice {
  width: 100%;
  display: grid;
  gap: 10px;
  border: 1px solid #d8dee8;
  border-radius: 14px;
  background: #f8fafc;
  padding: 14px;
}
.region-choice h4,
.region-choice p {
  margin: 0;
}
.region-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.region-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  padding: 10px 12px;
}
.region-list span {
  color: var(--muted);
  font-weight: 700;
}
.region-grid {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 12px;
}
.region-clipper {
  width: 100%;
  display: grid;
  gap: 8px;
}
.region-clip-stage {
  position: relative;
  width: 100%;
  min-height: 280px;
  display: grid;
  place-items: center;
  overflow: auto;
  border: 1px solid #d8dee8;
  border-radius: 14px;
  background: #f8fbff;
  padding: 12px;
  user-select: none;
}
.region-clip-stage img {
  display: block;
  max-width: 100%;
  height: auto;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
  cursor: crosshair;
  -webkit-user-drag: none;
  user-select: none;
}
.region-preview-empty {
  min-height: 240px;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.region-selection-box {
  position: absolute;
  pointer-events: none;
  border: 3px solid #111;
  background: rgba(249, 115, 22, 0.22);
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.18);
}
.region-selection-box.dragging {
  border-color: #0f172a;
  background: rgba(255, 237, 213, 0.52);
  outline: 1px solid rgba(255, 255, 255, 0.85);
  outline-offset: -5px;
}
.region-redaction-box {
  position: absolute;
  pointer-events: none;
  background: #000;
  border: 1px solid #000;
}
.region-redaction-box.redaction-draft {
  background: rgba(0, 0, 0, 0.55);
  border: 2px dashed #fff;
}
.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 24, 39, 0.42);
  backdrop-filter: blur(4px);
}
.busy-card {
  width: min(360px, 92vw);
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 24px;
  border: 1px solid #f6c27d;
  border-radius: 14px;
  background: #fff;
  color: #111;
  text-align: center;
  box-shadow: 0 20px 70px rgba(15, 23, 42, 0.24);
}
.busy-card span {
  color: var(--muted);
}
.busy-spinner {
  width: 42px;
  height: 42px;
  border: 5px solid #d7d9df;
  border-top-color: #111;
  border-radius: 50%;
  animation: paperpeer-spin 0.8s linear infinite;
}
@keyframes paperpeer-spin {
  to { transform: rotate(360deg); }
}
.file-chip {
  border: 1px solid #fdba74;
  background: #fff7ed;
  color: #7c2d12;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.85rem;
}
.check {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 10px;
  color: #1f2937 !important;
  cursor: pointer;
}
.check input {
  width: auto;
  accent-color: #111;
}
.classroom-options {
  width: 100%;
  display: grid;
  gap: 12px;
  border: 1px solid #d8dee8;
  border-radius: 14px;
  background: #f8fafc;
  padding: 14px;
}
/* Button group / selectable button (App Design Constitution §5) — for
   repeated single-choice decisions like the marking Mode toggle. */
.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: stretch;
  width: 100%;
}
.button-group-label {
  display: block;
  margin-bottom: var(--space-xs);
  font-weight: 700;
  color: var(--text-light);
  text-align: center;
}
.selectable-btn {
  flex: 1;
  min-width: 140px;
  background: var(--input-bg);
  color: var(--text-light);
  border: 2px solid #bdc3c7;
  border-radius: var(--radius-button);
  padding: var(--space-lg);
  text-align: center;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.selectable-btn.checked {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-hover);
}

/* Increment control (App Design Constitution §5) — bounded numeric pickers
   like scans-per-room. */
.increment-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: min(320px, 100%);
  margin: 0 auto;
}
.increment-btn {
  min-width: 44px;
  min-height: var(--control-height);
  border-radius: var(--radius-button);
  background: var(--primary-color);
  color: #fff;
  font-size: 1.15rem;
  font-weight: bold;
}
.increment-btn:hover:not([disabled]) { background: var(--primary-hover); }
.increment-btn[disabled] { background: #bdc3c7; cursor: not-allowed; }
.increment-value {
  min-width: 44px;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-dark);
}
.group-mode-note {
  width: min(680px, 100%);
  border: 1px solid #f6c27d;
  background: #fff7ed;
  color: #7c2d12;
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 700;
}
.lesson-controls {
  width: min(680px, 100%);
  border: 1px solid #d8dee8;
  border-radius: 14px;
  background: #f8fafc;
  padding: 14px;
}
.room-assignment-panel {
  width: min(760px, 100%);
  border: 1px solid #d8dee8;
  border-radius: 14px;
  background: #f8fafc;
  padding: 14px;
  display: grid;
  gap: 12px;
}
.room-assignment-panel h4 {
  margin: 0;
}
.room-assignment-summary {
  list-style: none;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
}
.room-assignment-summary li {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border: 1px solid #d8dee8;
  border-radius: 10px;
  background: #fff;
  padding: 10px 12px;
}
.room-assignment-summary span {
  color: var(--muted);
}
.room-assignment-editor {
  display: grid;
  gap: 10px;
}
.room-assignment-editor summary {
  cursor: pointer;
  font-weight: 800;
}
.room-assignment-editor[open] {
  margin-top: 4px;
}
.room-assignment-card {
  border: 1px solid #d8dee8;
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 8px;
}
.student-check-list {
  display: grid;
  gap: 6px;
  max-height: 180px;
  overflow: auto;
}
.student-check {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 8px;
  font-weight: 600 !important;
}
.student-check input {
  width: auto;
}
.lesson-controls h4 {
  margin: 0 0 10px;
  color: #1f2937;
}
.date-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.page { min-height: calc(100vh - 88px); }

.create-main {
  width: 100%;
  flex: 1;
  display: grid;
  place-items: center;
  padding: 18vh 24px 80px;
}

.create-panel {
  width: min(1156px, 100%);
  min-height: 414px;
  display: grid;
  justify-items: center;
  align-content: center;
  padding: 34px 38px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.08);
  text-align: center;
}

.create-panel .badge {
  background: #d7dce6;
  border: 0;
  color: #203247;
  font-size: 1rem;
}

.create-panel h1 {
  margin: 8px 0 26px;
  font-size: 2.55rem;
}

.create-actions {
  width: min(542px, 100%);
  display: grid;
  gap: 13px;
}

.create-actions button {
  min-height: 51px;
  border-radius: 12px;
  font-size: 1.05rem;
}

.create-back-row {
  width: 100%;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid #e5e5e5;
}

.create-back-row .secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  min-width: 92px;
  border-radius: 14px;
}

.site-footer {
  width: 100%;
  padding: 8px 16px 10px;
  text-align: center;
  color: #34495e;
  font-size: 0.88rem;
}

.site-footer a {
  text-decoration: underline;
}

.task-main {
  width: min(1920px, 98vw);
  margin: 0 auto 30px;
}

.student-auth-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 255, 255, .78), transparent 28%),
    rgba(20, 24, 31, .42);
  backdrop-filter: blur(8px);
}

.student-auth-card {
  width: min(440px, 92vw);
  display: grid;
  gap: 14px;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, .82);
  border-radius: 24px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 24px 80px rgba(15, 23, 42, .24);
}

.student-auth-card h2 {
  margin: 0;
}

.form-error {
  min-height: 1.2em;
  margin: 0;
  color: #b91c1c;
  font-weight: 800;
}

.task-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

.scan-placeholder {
  height: 260px;
  background: #fff;
  border: 2px dashed var(--line);
  display: grid;
  place-items: center;
  border-radius: 10px;
}

.annotation-room {
  display: grid;
  gap: 24px;
  align-items: start;
}
.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .75rem;
  font-weight: 800;
  color: #9a3412;
}
.task-meta-bar {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
}
.task-meta-bar h2 {
  margin: 0;
}
.discussion-list {
  display: grid;
  gap: 8px;
  max-height: 45vh;
  overflow-y: auto;
  margin-bottom: 10px;
}
.discussion-entry {
  border: 1px solid #d8dee8;
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}
.discussion-entry p {
  margin: 6px 0 0;
  white-space: pre-wrap;
}
.annotation-workspace {
  min-width: 0;
}
.annotation-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-card);
  background: var(--input-bg);
  padding: 10px;
  margin-bottom: 10px;
}
.autosave-status {
  margin-left: auto;
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
}
@media (max-width: 1120px) {
  .tools { grid-template-columns: repeat(7, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .tools { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.annotation-stage {
  min-height: 520px;
  overflow: auto;
  border: 1px solid #d8dee8;
  border-radius: 14px;
  background: #f8fbff;
  padding: 14px;
  display: grid;
  place-items: start center;
}
#annotation-canvas {
  display: block;
  max-width: none;
  height: auto;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .12);
  cursor: crosshair;
}
.empty-scan {
  width: 100%;
  min-height: 420px;
  border: 2px dashed #fdba74;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #34495e;
  background: #fff;
}
.criteria-max-mark {
  text-align: center;
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--text-dark);
  margin: 4px 0 16px;
}
.criteria-notes {
  white-space: pre-wrap;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.6;
}
.mark-number-input {
  text-align: center;
  font-size: 16pt;
  font-weight: 700;
}
.discussion-modal-content label {
  display: block;
  margin-top: 4px;
}
.comment-entry {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid #d8dee8;
  background: #fff;
  color: #1f2937;
  border-radius: 10px;
  text-align: left;
}
.comment-entry span {
  color: #475569;
  font-weight: 500;
  white-space: pre-wrap;
}

.table-wrap { overflow-x: auto; margin-top: 0.8rem; }
table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { border: 1px solid var(--line); padding: 0.65rem; text-align: left; }

/* Status box (App Design Constitution §5) */
.status-box {
  margin-top: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-input);
  text-align: center;
  font-size: 1.1em;
}
.status-box.error {
  background: #fdedec;
  border: 1px solid #fadbd8;
  color: var(--danger-hover);
}

/* Confirmation page (App Design Constitution §5) — the review step
   immediately before Publish. */
.confirmation-grid {
  overflow-y: auto;
  max-height: 80vh;
  padding: 0 var(--space-sm);
  margin: 0 calc(var(--space-sm) * -1);
  scrollbar-width: none;
}
.confirmation-grid::-webkit-scrollbar { display: none; }
.confirm-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 5px;
  border-bottom: 1px solid var(--border-soft);
}
.confirm-row:last-child { border-bottom: none; }
.confirm-row p {
  margin: 0;
  font-size: 1.1em;
  color: var(--text-dark);
  flex: 1;
  text-align: left;
}
.confirm-row strong { color: var(--text-light); }
.edit-btn {
  background: none;
  border: none;
  color: var(--primary-color);
  font-weight: bold;
  font-size: 0.9em;
  text-decoration: underline;
  padding: 5px;
  cursor: pointer;
}

/* Logout confirmation modal (App Design Constitution §5) */
.logout-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(17, 24, 39, .42);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}
.logout-modal-content {
  position: relative;
  width: min(480px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: #fff;
  border-top: 6px solid var(--primary-color);
  border-radius: var(--radius-modal);
  box-shadow: var(--shadow-modal);
  padding: var(--space-lg);
}
.modal-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-light);
  font-size: 1.3rem;
  line-height: 1;
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.modal-close-btn:hover { background: var(--input-bg); }
.logout-confirmation-title {
  margin: var(--space-sm) 0 10px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-dark);
  text-align: center;
}
.logout-confirmation-copy {
  margin: 0;
  color: var(--text-light);
  font-size: 1.05rem;
  line-height: 1.6;
  text-align: center;
}
.logout-confirmation-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}
.logout-confirmation-actions button { min-width: 160px; }

@media (max-width: 980px) {
  .app-container, .dashboard-shell, .panel { padding: var(--space-md); }
  .site-header { padding: 16px 18px; }
  .brand-logo { width: 32px; height: 32px; }
  .landing-content { min-height: calc(100vh - 126px); padding-top: 7vh; }
  .hero-logo { width: 132px; height: 132px; }
  .landing-panel h1 { font-size: clamp(3.2rem, 16vw, 5rem); }
  .join-card input, .join-card button { height: 64px; font-size: 1.2rem; }
  .create-main { padding: 12vh 20px 60px; }
  .create-panel { min-height: 360px; padding: 28px 20px; }
  .create-panel h1 { font-size: 2rem; }
  .task-grid { grid-template-columns: 1fr; }
  .scan-toolbar { grid-template-columns: 1fr 1fr; }
  .region-grid { grid-template-columns: 1fr; }
  .region-list li { align-items: flex-start; flex-direction: column; }
  .date-grid { grid-template-columns: 1fr; }
}
