/* Exam Grading App — static web UI styles (task 15.3).
   Dependency-light, plain CSS. All user-facing copy lives in index.html /
   app.js in Portuguese (Req 6.4). */

:root {
  /* ExamCorrect brand system — aligned with the marketing landing page.
     Deep navy ink, vibrant green accent, primary blue, blue→green gradient. */
  --navy: #0a1a3c;
  --navy-soft: #24345a;
  --green: #1fa64a;
  --green-deep: #178a3d;
  --blue: #1e63ff;
  --blue-deep: #1550db;

  /* Legacy token NAMES kept and remapped to the brand palette, so every
     existing rule that references them is rebranded automatically. */
  --bg: #f4f7fc;
  --panel-bg: #ffffff;
  --ink: #0a1a3c;
  --muted: #4a5878;
  --line: #e6eaf2;
  --brand: #1e63ff;
  --brand-dark: #1550db;
  --ok: #178a3d;
  --warn: #b26a00;
  /* recorrigir-closeout (Spec F) fold F3-1: the Review_Completion_Warning banner
     tint + border from mockup 8B, promoted to tokens (styles-tokens-only guard). */
  --warn-tint: #fff7ea;
  --warn-border: #f0dcae;
  --danger: #c62828;
  --danger-tint: #fdeaea;
  --review: #8a5a00;
  --radius: 16px;

  --ink-dim: #4a5878;
  --ink-faint: #8a94ac;
  --bg-cool: #f5f7fb;
  --bg-mint: #eaf6ee;
  --border-strong: #d3dae8;

  --grad: linear-gradient(135deg, #1e63ff 0%, #1a9fd6 45%, #1fa64a 100%);
  --grad-text: linear-gradient(120deg, #1e63ff 0%, #1fa64a 90%);

  --shadow-sm: 0 2px 8px rgba(10, 26, 60, 0.06);
  --shadow-md: 0 12px 34px rgba(10, 26, 60, 0.1);
  --shadow-lg: 0 30px 70px rgba(10, 26, 60, 0.16);
  --shadow-blue: 0 14px 32px rgba(30, 99, 255, 0.26);

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-pill: 999px;

  --head: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
  --body: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

/* The `hidden` attribute MUST win over every author `display` rule (`.btn {
   display: inline-flex }`, `.project-controls { display: flex }`, …). Without
   this, the UA `[hidden] { display: none }` loses the cascade and a `hidden`
   element renders anyway. Live on 2026-09-09 (535361f): "Iniciar sessão" AND
   "Terminar sessão" both visible, project controls visible with no project,
   the school nav buttons visible regardless of /schools/me. The eleven
   per-element `X[hidden] { display: none }` patches below are the same defect
   class caught one element at a time; this rule closes the class. Pinned by
   web/__tests__/stale-session.test.js (RC-1). */
[hidden] {
  display: none !important;
}

/* Prevent an accidental horizontal swipe (e.g. scrolling a wide table right on
   iOS) from triggering the browser's swipe-back/forward gesture, which would
   navigate away from the SPA and halt in-flight uploads / extraction polling
   (professor feedback, 2026-07-30: a stray right-scroll during extraction
   "halted the whole process"). Vertical scrolling is unaffected. */
html,
body {
  overscroll-behavior-x: contain;
}

body {
  margin: 0;
  font-family: var(--body);
  background:
    radial-gradient(60% 40% at 88% -5%, rgba(30, 99, 255, 0.06), transparent 70%),
    radial-gradient(50% 40% at 4% 2%, rgba(31, 166, 74, 0.06), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-x: contain;
}

h1,
h2,
h3,
h4 {
  font-family: var(--head);
  letter-spacing: -0.015em;
}

::selection {
  background: rgba(31, 166, 74, 0.2);
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Wide tables scroll horizontally within their own box without escaping to a
   browser navigation gesture. */
.status-table,
.results-table {
  overscroll-behavior-x: contain;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap; /* compact-header Req 1: ONE thin row at every width */
  gap: 10px;
  min-height: 48px;
  padding: 4px 14px; /* 40 px button + 8 + 1 border = 49 px (mockup A: 48) */
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: var(--navy);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0; /* the session text is the flex-shrink sink (compact-header C3) */
}

.app-logo-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
}

/* project-header-and-copy Req 1 (UI-6.1): raster brand mark. compact-header C3 pins the width
   (854×200 asset at 36 px = 154 px) so the 390 px bar budget is arithmetic, not a guess. */
.app-logo {
  display: block;
  height: 36px;
  width: 154px;
  flex: 0 0 auto;
  object-fit: contain;
}

.app-header h1 {
  font-family: var(--head);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--navy);
}

.auth-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

/* compact-header Req 2.2: the session state is plain text (no pill), ellipsised before
   anything else in the bar shrinks. The second .auth-status block (below) sets the type. */
.auth-status {
  font-size: 0.8rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel {
  position: relative;
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px 26px;
  margin: 18px auto;
  max-width: 960px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* Hairline gradient accent along the top of every card */
.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--grad);
  opacity: 0.9;
}

.panel h2 {
  font-family: var(--head);
  margin-top: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--navy);
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0;
}

.field {
  margin-bottom: 14px;
}

.field.inline {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.field label,
.score-field label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 4px;
}

input[type="text"],
input[type="url"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}

.field.inline input {
  width: auto;
  flex: 1 1 220px;
}

textarea {
  resize: vertical;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--r-pill);
  padding: 10px 20px;
  font-family: var(--head);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease,
    border-color 0.18s ease, color 0.18s ease;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: var(--shadow-blue);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 20px 42px rgba(30, 99, 255, 0.34);
}

.btn-secondary {
  background: var(--bg-mint);
  color: var(--green-deep);
  box-shadow: inset 0 0 0 1px rgba(23, 138, 61, 0.16);
}

.btn-secondary:hover:not(:disabled) {
  transform: translateY(-2px);
  background: #dff0e6;
}

.btn-ghost {
  background: #fff;
  color: var(--navy);
  border: 1.5px solid var(--border-strong);
}

.btn-ghost:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--blue);
  color: var(--blue);
}

.cognito-config {
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 14px;
}

.cognito-config summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--brand);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  background: #f8fbff;
  transition: background 0.15s ease;
}

.drop-zone:hover,
.drop-zone:focus,
.drop-zone.dragover {
  background: #eaf2fc;
  outline: none;
}

.file-list {
  list-style: none;
  padding: 0;
  margin: 12px 0;
}

.file-list li {
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 0.88rem;
}

.file-list li.rejected {
  border-color: var(--danger);
  color: var(--danger);
  background: #fdecec;
}

.scores-fieldset {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.scores-fieldset legend {
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0 6px;
}

.scores-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

/* Status table */
.status-table,
.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

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

.status-table th,
.results-table th {
  background: var(--bg-cool);
  font-family: var(--head);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.empty-row td {
  color: var(--muted);
  font-style: italic;
}

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge--uploaded { background: #e3eefb; color: var(--brand-dark); }
.badge--extracting,
.badge--grading { background: #fff3df; color: var(--warn); }
.badge--extracted,
.badge--graded,
.badge--calibrated { background: #e4f4e5; color: var(--ok); }
.badge--error,
.badge--no_text { background: #fdecec; color: var(--danger); }

/* Result blocks */
.result-block {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fafcfe;
  font-size: 0.9rem;
}

.result-block.error {
  border-color: var(--danger);
  background: #fdecec;
  color: var(--danger);
}

/* Neutral "in progress / not yet available" state — used when the cohort gate
   is still closed (class being corrected / mean settling into the band). This
   is NOT a failure, so it must never read as the red .error block. */
.result-block.pending {
  color: #1a3c66;
  border-color: #cddcff;
  background: #eef4ff;
}

.result-block.success {
  border-color: var(--ok);
  background: #f0faf1;
}

.result-block ul {
  margin: 6px 0 0;
  padding-left: 20px;
}

/* Per-project chatbot (task 13.4): preserve the model's paragraph/line breaks
   in the Portuguese answer, and flag when the 2000-char guidance is exceeded. */
.chat-answer {
  white-space: pre-wrap;
  line-height: 1.5;
}

.char-count {
  margin-top: 6px;
  text-align: right;
}

.char-count-over {
  color: var(--danger);
  font-weight: 600;
}

/* Results view */
.results-view {
  margin-top: 16px;
}

/* Inline correction report (rendered in an isolated iframe, no pop-up needed) */
.report-frame {
  width: 100%;
  height: 80vh;
  margin-top: 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
}

/* Secondary internal id shown under the examiner-facing exam code */
.muted-id {
  font-size: 0.78em;
  color: #8a8a8a;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Loading spinner (shown in the ID column while an exam is being corrected) */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid #c7d2e0;
  border-top-color: #2f6fed;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Thin per-exam completion bar in the status table */
.progress--row {
  height: 6px;
  margin: 6px 0 0;
}

/* Upload mode switch: two buttons under the title; the active one is filled */
.mode-switch {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 4px 0 16px;
}
.mode-btn {
  flex: 1 1 0;
  min-width: 180px;
}
.bulk-ignored {
  opacity: 0.75;
  border: 1px dashed #d39a9a;
  background: #fdf3f3;
}

/* Calibration trigger row (exam-ui-flow-restructure Req 3.1): anchors the
   "Calibração" button visually beneath the upload panel, aligned with the
   centered panel column. The pop-up itself (#calibrationModal) reuses the
   shared .modal / .modal-content / .modal-close rules unchanged. */
.calibration-trigger-row {
  max-width: 960px;
  margin: -6px auto 18px;
  padding: 0 24px;
  display: flex;
  justify-content: flex-end;
}

/* Per-question result cards: label + score on top, rationale full-width below */
.question-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.question-card {
  border: 1px solid #e2e6ec;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}
.question-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}
.question-label {
  font-weight: 700;
  margin-right: auto;
}
.question-score {
  display: flex;
  align-items: center;
  gap: 8px;
}
.score-value {
  font-weight: 700;
  font-size: 1.05rem;
  color: #1a4fb4;
}
.question-card .rationale {
  display: block;
  width: 100%;
  white-space: pre-wrap;
  line-height: 1.5;
  color: #2a2a2a;
  font-size: 0.95rem;
}
.question-card .source-tag {
  margin-top: 6px;
  font-size: 0.78em;
  color: #8a8a8a;
}

/* Professor-anchor correction transparency: engine raw vs corrected score,
   the signed correction delta and the applied mode (Req 5.1, 5.2, 5.4). */
.question-card .correction-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #e2e6ec;
  font-size: 0.82em;
  color: #4a4a4a;
}
.correction-item {
  white-space: nowrap;
}
.correction-label {
  color: #8a8a8a;
}
.correction-value {
  font-weight: 600;
  color: #1a4fb4;
}

.results-exam {
  margin-bottom: 22px;
}

.results-exam h3 {
  margin-bottom: 6px;
}

.total-score {
  font-weight: 700;
  font-size: 1rem;
  margin: 6px 0 14px;
}

.group-block {
  margin-bottom: 16px;
}

.group-block h4 {
  margin: 0 0 8px;
  color: var(--brand-dark);
}

.score-cell {
  font-weight: 600;
}

.review-flag {
  color: var(--review);
  font-weight: 600;
}

.rationale {
  color: var(--muted);
  white-space: pre-wrap;
}

.source-tag {
  font-size: 0.78rem;
  color: var(--muted);
}

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  max-width: 90%;
  z-index: 1000;
}

.toast.error { background: var(--danger); }
.toast.success { background: var(--ok); }

/* Runtime configuration error banner (portable-secure-deployment, task 3.2,
   Req 2.4): shown when neither config.json nor DEPLOY_DEFAULTS is usable. */
.config-error-banner {
  background: var(--danger);
  color: #fff;
  padding: 12px 20px;
  font-size: 0.9rem;
  text-align: center;
  z-index: 1001;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 900;
}

/* The `hidden` HTML attribute must win over the flex display above, otherwise
   the modal renders on page load and the close (X) button can't dismiss it. */
.modal[hidden] {
  display: none;
}

.modal-content {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: none;
  background: transparent;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.review-photos {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.review-photos .photo-ref {
  font-size: 0.8rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
}

/* Multi-exam upload cards */
.exam-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 12px 0;
}

.exam-card {
  border: 1px solid #d7dce5;
  border-radius: var(--radius);
  padding: 14px 16px;
  background: #fafbfd;
}

.exam-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.exam-card-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.exam-card-remove {
  border: none;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: #8a94a6;
  padding: 0 6px;
  border-radius: 6px;
}

.exam-card-remove:hover {
  color: #c0392b;
  background: #f3e7e7;
}

/* Score suggestion (auto-fill from corrected photo) */
.scores-suggest-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.82rem;
}

.scores-suggest-status {
  font-size: 0.82rem;
  color: #4a5568;
}

/* ---- Wave A: ordering hint, photo thumbnails/rotate, illegible alerts ---- */

.hint--important {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 8px;
  padding: 10px 12px;
  color: #5d4037;
}

/* Per-photo file list: thumbnail + meta + rotate control */
.file-list li {
  display: flex;
  align-items: center;
  gap: 10px;
}
.file-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #d0d7de;
  background: #f6f8fa;
  flex: 0 0 auto;
}
.file-meta {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}
.file-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-note { color: #6e7781; font-size: 0.85em; }
.file-rotate { flex: 0 0 auto; }
.btn-sm { padding: 4px 8px; font-size: 0.85em; }

/* Illegible / low-confidence alerts in results */
.illegible-alert {
  background: #fdecea;
  border: 1px solid #f5c6cb;
  border-left: 4px solid #d93025;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 10px 0;
  color: #611a15;
}
.illegible-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 6px;
  background: #fff3cd;
  border: 1px solid #ffe69c;
  color: #7a5b00;
  font-size: 0.8em;
  white-space: nowrap;
}

/* ---- Bulk upload: proposed exam groups ---- */
.bulk-groups { margin-top: 12px; display: flex; flex-direction: column; gap: 12px; }
.bulk-group {
  border: 1px solid #d0d7de;
  border-left: 4px solid #4f6bed;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fafbff;
}
.bulk-group h4 { margin: 0 0 6px; font-size: 0.95em; }
.bulk-strip { display: flex; flex-wrap: wrap; gap: 10px; }
.bulk-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.78em;
  color: #57606a;
  width: 84px;
  text-align: center;
}
.bulk-cell .file-thumb { width: 72px; height: 72px; }
.bulk-cell .btn-sm { padding: 2px 4px; font-size: 0.72em; }

/* ---- Multi-exam upload: single-action report (task 20.2, Req 10.4/10.5) ---- */
.multi-report-summary { margin: 0 0 6px; font-weight: 700; }
.multi-report-head { margin: 8px 0 4px; font-weight: 600; }
.multi-report-list { margin: 0 0 4px; padding-left: 18px; }
.multi-report-list li { margin: 2px 0; }

/* ---- Delete-photo control (long-press or × button) ---- */
.thumb-wrap { position: relative; display: inline-block; flex: 0 0 auto; }
.thumb-del {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: #d93025;
  color: #fff;
  font-size: 14px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.thumb-del:hover { background: #b3261e; }
.file-thumb { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

/* ---- Progress bar (bulk analysis) ---- */
.progress {
  width: 100%;
  height: 10px;
  background: #e8ebf0;
  border-radius: 6px;
  overflow: hidden;
  margin: 8px 0;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #4f6bed, #6f86f2);
  transition: width 0.3s ease;
}

/* ---- Primary navigation tabs (Correção / Definições) ---- */
.app-nav {
  display: flex;
  gap: 4px;
  max-width: 960px;
  margin: 18px auto -6px;
  padding: 0 24px;
}
.nav-tab {
  border: 1px solid var(--line);
  border-bottom: none;
  background: #e9eef4;
  color: var(--muted);
  padding: 10px 20px;
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.nav-tab:hover {
  color: var(--brand-dark);
}
.nav-tab.is-active {
  background: var(--panel-bg);
  color: var(--brand-dark);
  border-color: var(--line);
}

.view[hidden] {
  display: none;
}

/* ---- Settings: sliders, toggles, advanced block ---- */
.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.slider-row input[type="range"] {
  flex: 1 1 auto;
  width: auto;
  accent-color: var(--brand);
}
.slider-val {
  flex: 0 0 auto;
  min-width: 48px;
  text-align: right;
  font-weight: 700;
  color: var(--brand-dark);
  font-variant-numeric: tabular-nums;
}

.toggle-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.toggle-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
}
.toggle-option input[type="radio"] {
  width: auto;
  margin-top: 2px;
  accent-color: var(--brand);
}

.advanced-block {
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 14px;
}
.advanced-block summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}

/* ---- Projects Sidebar (task 13.1) ---------------------------------------- */

/* App layout: left-hand sidebar column + flexible main content. Keeps the
   existing centered panels/nav (max-width 960px, auto margins) rendering
   within the content column. */



.project-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.project-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 0.9rem;
}
.project-item:hover,
.project-item:focus {
  background: #eef3fa;
  outline: none;
}
.project-item.is-active {
  background: #e3eefb;
  border-color: var(--brand);
  color: var(--brand-dark);
  font-weight: 600;
}

/* Long names truncate to fit; the full name stays available via the title
   attribute on hover/focus (Req 2.8). */
.project-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-badge {
  flex: 0 0 auto;
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 999px;
  background: #eef1f5;
  color: var(--muted);
}
.project-item.is-active .project-badge {
  background: #fff;
}

.project-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Membership list inside the "Partilhar" modal */
.member-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.member-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.85rem;
}
.member-sub {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.member-empty {
  color: var(--muted);
  font-style: italic;
  font-size: 0.85rem;
}

/* Stack the sidebar above the content on narrow screens. */

/* ---- Turma dashboard + batch grading (batch-grading-ux task 20.1) ---------
   Per-status counts, run initiation, cost-estimate modal body, and live
   Run_Progress. Reuses the existing .panel / .badge / .progress / .modal look. */

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-head h2 {
  margin: 0;
}

/* Per-status exam counts (Req 9.1) */
.dashboard-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 4px;
}

.dashboard-count {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 84px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
}

.dashboard-count-num {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
}

/* Run initiation controls (Req 1.1, 1.2) */
.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
/* professional-app-restructure Req 1.7: defensive override so a future
   CSS rule that grants `.dashboard-actions button { display: ... }` cannot
   defeat the HTML `hidden` attribute (ADR-0022 D3a class of bug — a
   `display: flex` on `.review-queue-list` beat `hidden = true`). */
.dashboard-actions button[hidden] {
  display: none !important;
}

/* Subset selector (Req 1.2) */
.subset-selector {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
}

.subset-list {
  list-style: none;
  margin: 8px 0;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.subset-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

/* Live run progress (Req 5, 6) */
.run-progress {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
}

.run-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.run-state {
  font-weight: 600;
}

.run-state--paused_throttled { color: var(--warn); }
.run-state--cancelling { color: var(--danger); }
.run-state--completed { color: var(--ok); }
.run-state--cancelled { color: var(--muted); }
.run-state--failed { color: var(--danger); }

.run-banner {
  margin: 8px 0;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.run-banner--throttled {
  background: #fff3df;
  border: 1px solid #ffe082;
  color: var(--warn);
}

.run-banner--cancelling {
  background: #fdecec;
  border: 1px solid #f5c6c6;
  color: var(--danger);
}

.run-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.run-count-chip {
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 0.85rem;
}

.run-errored {
  margin-top: 10px;
}

.run-errored-title {
  margin: 0 0 4px;
  font-weight: 600;
  color: var(--danger);
}

.run-errored ul {
  margin: 0;
  padding-left: 20px;
}

/* Cross-exam bulk review queue (Req 11, task 20.3) */
.review-queue-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.review-queue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
}

.review-queue-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.review-queue-exam {
  font-weight: 600;
}

.review-queue-reason {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  border: 1px solid var(--line);
  background: #fff;
}

.review-queue-reason--withheld {
  background: #fff3df;
  border-color: #ffe082;
  color: var(--warn);
}

.review-queue-reason--flagged {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #3949ab;
}

/* Cost-estimate modal body (Req 7) */
.estimate-body {
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.estimate-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

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

.estimate-val {
  font-weight: 700;
  font-size: 1.05rem;
}

/* ---- Results panel tri-state containers (exam-ui-flow-restructure Req 4.2,
   4.3) ------------------------------------------------------------------------
   The Results_Panel shows exactly one of four mutually-exclusive states, driven
   by applyResultsState() toggling the `hidden` attribute:
     #resultsEmpty   (NO_RESULTS, class "hint")
     #resultsLoading (LOADING, class "hint")
     #resultsError   (ERROR, class "hint result-block error"; created lazily in
                      app.js and inserted before #resultsView)
     #resultsView    (RESULTS, class "results-view")
   These are plain <p>/<div> elements, so the browser default `[hidden] {
   display:none }` already hides them; no selector above overrides it. But —
   mirroring how .modal[hidden] guards its flex display — we assert it
   explicitly so that if a future `display` rule is ever added to .hint,
   .result-block, or .results-view, two states can never end up visible at
   once. */
#resultsEmpty[hidden],
#resultsLoading[hidden],
#resultsError[hidden],
#resultsView[hidden] {
  display: none;
}

/* Give the no-results / loading messages the same top spacing as the shared
   .result-block (used by the ERROR state) so whichever single state is visible
   reads as its own block beneath the actions toolbar / report frame, keeping
   the three states visually consistent with existing panel styling. */
#resultsEmpty,
#resultsLoading {
  margin-top: 14px;
}

/* flexible-calibration-and-grading: two-part optional calibration modal. */
.cal-part {
  border: 1px solid var(--border, #d9dce1);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
}
.cal-part > legend {
  font-weight: 600;
  padding: 0 0.4rem;
}
.cal-normal-box {
  margin-top: 0.5rem;
  padding-left: 0.75rem;
  border-left: 3px solid var(--brand, #ec7211);
}
/* Gated "Corrigir todos os prontos" — reinforces the native :disabled style. */
.btn-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---- recorrigir-closeout (Spec F) review cohort re-correct affordance -------
   B1 (five-lens LENS 3 MAJOR): the Review_Completion_Warning is the DES-gate-
   binding mockup 8B's amber warn-banner (bg/border below match the mockup's
   .warn-banner). Existing tokens only. Without this rule the banner rendered as
   plain unstyled text, visually identical to the surrounding hints.
   B2 (LENS 3 MINOR): the One_Shot-spent button must be LIGHT GREY (owner
   verbatim), not the faded blue→green gradient. Scoped to #cohortRegradeBtn so
   the global .btn-disabled ("Corrigir todos os prontos") is untouched. */
.review-cohort-banner {
  background: var(--warn-tint);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0;
}
.review-cohort-banner__text {
  flex: 1 1 220px;
  color: var(--warn);
  font-size: 0.88rem;
}
#cohortRegradeBtn.btn-disabled {
  background: var(--line);
  color: var(--muted);
  filter: grayscale(1);
  opacity: 1;
}


/* ---- Corrections list cards (post-correction-clarity D1b) -----------------
   One collapsible card per graded exam in the Resultados > Corrections group.
   Header is a button (toggles expansion, aria-expanded); body is lazy-fetched
   on first expand and contains the shared renderScoreBreakdown output. */

.corrections-card {
  border: 1px solid #d7dce5;
  border-radius: var(--radius);
  margin-bottom: 10px;
  background: #fff;
  overflow: hidden;
}

.corrections-card__header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  background: #f6f8fb;
  border: none;
  border-bottom: 1px solid #eef1f6;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.corrections-card__header:hover { background: #eef2f8; }
.corrections-card__header:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

.corrections-card__label {
  font-weight: 700;
  color: var(--text);
  flex: 0 0 auto;
}

.corrections-card__disambiguator {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  flex: 0 0 auto;
}

.corrections-card__pill {
  margin-left: auto;
  padding: 2px 9px;
  border-radius: 999px;
  background: #e4f4e5;
  color: var(--ok);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.corrections-card__chev {
  flex: 0 0 auto;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

.corrections-card__header[aria-expanded="true"] .corrections-card__chev {
  transform: rotate(180deg);
}

.corrections-card__body {
  padding: 14px;
}

.corrections-card__body[hidden] { display: none; }

.corrections-card__loading {
  color: var(--text-muted);
  font-style: italic;
  margin: 0;
}

.corrections-card__error {
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}


/* ---- Review queue summary + per-exam grouping (post-correction-clarity D7) */

.review-queue-summary {
  font-size: 1.02rem;
  color: var(--text);
  margin: 12px 0 4px;
}

.review-queue-subtitle {
  margin: 0 0 12px;
}

.review-queue-exam-group {
  list-style: none;
  border: 1px solid #d7dce5;
  border-radius: var(--radius);
  margin-bottom: 10px;
  padding: 10px 12px;
  background: #fff;
}

.review-queue-exam-group__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eef1f6;
}

.review-queue-exam-group__questions {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}


/* cohort-insights-and-scope-hygiene D3a — override the `display: flex` above
   so the HTML `hidden` attribute actually collapses the review-queue list.
   Same pattern the app already uses on `.modal[hidden]`. */
.review-queue-list[hidden] { display: none !important; }

/* cohort-insights-and-scope-hygiene D6 — Cohort_Overview block that lives
   above the Corrections list inside the Resultados panel. Deterministic
   stats + three collapsible <details> sections (per-question means,
   best-question rationale, top-1 unique arguments). Visual language is
   consistent with the shipped `.corrections-card`. */

.cohort-overview {
  border: 1px solid #d7dce5;
  border-radius: var(--radius);
  margin-bottom: 14px;
  padding: 14px 16px;
  background: #f8fbff;
}

.cohort-overview[hidden] { display: none !important; }

/* cohort-gated-visibility-and-band-enforcement ADR-0022 D3a discipline:
   the Aguardando placeholder toggles ONLY the `hidden` attribute
   (applyCohortGate in app.js). `!important` guards against any inherited
   `display:` rule from `.panel` or a future selector accidentally
   surfacing a hidden placeholder — the ADR-0022 D3a class of bug
   (CSS `display` beats the HTML `hidden` attribute, so the professor
   sees BOTH the placeholder AND the per-exam surface at once → gate
   violation). Mirrors `.review-queue-list[hidden]` / `.cohort-overview[hidden]`
   above and `.dashboard-actions button[hidden]` in the actions row. */
#cohortGatePlaceholder[hidden] { display: none !important; }

/* cohort-gated-visibility hotfix (ADR-0027 D2): mirror the shipped
   `.modal[hidden]` / `#cohortGatePlaceholder[hidden]` /
   `.review-queue-list[hidden]` / `.dashboard-actions button[hidden]`
   guards for the report toolbar. `.actions { display: flex }` overrides
   the browser UA `[hidden] { display: none }` rule, so
   `<div id="reportToolbar" class="actions" hidden>` renders on page load
   even though every JS caller (`sweepAndReloadForActiveProject`,
   `_setReportState("absent")`) dutifully sets `.hidden = true`. Latent
   since initial commit c58b3d0; only user-visible with Wave 9's
   fresh-empty-project workflow. */
#reportToolbar[hidden] { display: none !important; }

.cohort-overview__header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eef1f6;
}

.cohort-overview__mean {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}

.cohort-overview__mean-suffix {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 500;
}

.cohort-overview__level {
  font-size: 0.82rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: #e4f4e5;
  color: var(--ok);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.cohort-overview__count {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.cohort-overview__row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin: 8px 0;
}

.cohort-overview__row-label {
  font-weight: 600;
  color: var(--text-muted);
  min-width: 130px;
}

.cohort-overview__rank {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cohort-overview__rank-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}

.cohort-overview__rank-row:hover { background: #eef2f8; }

.cohort-overview__rank-row-label { font-weight: 600; }
.cohort-overview__rank-row-score { color: var(--text-muted); font-family: ui-monospace, monospace; }
.cohort-overview__rank-row-disamb { color: var(--text-muted); font-size: 0.82rem; }

.cohort-overview details {
  margin: 8px 0;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #eef1f6;
  border-radius: 8px;
}

.cohort-overview details > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  padding: 4px 0;
  list-style: none;
}

.cohort-overview details > summary::-webkit-details-marker { display: none; }
.cohort-overview details > summary::marker { content: ""; }

.cohort-overview details > summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 0.15s ease;
  color: var(--text-muted);
}

.cohort-overview details[open] > summary::before {
  transform: rotate(90deg);
}

.cohort-overview__per-q-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.cohort-overview__per-q-cell {
  padding: 6px 8px;
  border-radius: 6px;
  background: #f6f8fb;
}

.cohort-overview__per-q-label { font-weight: 600; }
.cohort-overview__per-q-value {
  color: var(--text);
  font-family: ui-monospace, monospace;
  margin-left: 6px;
}

.cohort-overview__bottom-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.cohort-overview__narrative {
  margin-top: 8px;
  color: var(--text);
  line-height: 1.5;
}

.cohort-overview__insight-hint {
  color: var(--text-muted);
  font-style: italic;
  margin-top: 8px;
}


/* ---- eager-upload-on-add D4 — Progress_Badge overlay ---------------------
   Absolute-positioned overlay inside the shipped `.thumb-wrap` (line ~776,
   already `position: relative`), so zero layout shift on any parent. Reuses
   the shipped `.spinner` (line ~363) for the `uploading` state and follows
   the `.badge--*` visual language for the muted / done / failed variants.
   Every user-visible label is pt-PT and rendered by `renderProgressBadge` in
   `web/app.js`; no inline styles anywhere.                                 */

.progress-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  right: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 2px 6px;
  font-size: 12px;
  line-height: 1.25;
  border-radius: 8px;
  pointer-events: none;
  z-index: 2;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  max-width: calc(100% - 8px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress-badge__label {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.progress-badge--queued {
  background: #eef2f8;
  color: var(--text-muted);
  opacity: 0.9;
}

.progress-badge--uploading {
  background: #fff3df;
  color: var(--warn);
}

.progress-badge--uploading .spinner {
  width: 12px;
  height: 12px;
  border-width: 2px;
}

.progress-badge--done {
  background: #e4f4e5;
  color: var(--ok);
  opacity: 0.85;
  font-size: 11px;
}

.progress-badge--failed {
  background: #fdecec;
  color: var(--danger);
  pointer-events: auto;
  font-size: 13px;
  flex-wrap: wrap;
  gap: 4px;
}

.progress-badge__retry {
  pointer-events: auto;
  cursor: pointer;
  border: 1px solid var(--danger);
  background: #fff;
  color: var(--danger);
  padding: 1px 6px;
  font-size: 11px;
  border-radius: 6px;
  line-height: 1.2;
  font-weight: 600;
}

.progress-badge__retry:hover,
.progress-badge__retry:focus {
  background: var(--danger);
  color: #fff;
}


/* =====================================================================
   ExamCorrect brand theme layer
   Layered visual polish keyed to the app's existing class vocabulary.
   Every selector below already exists in the markup / app.js output — this
   only elevates the look (brand palette, Poppins/Plus Jakarta Sans, gradient
   accents, soft depth, motion). No ids, class names, DOM structure, or
   Portuguese copy are changed. The `.modal[hidden]` guard and the
   `.project-name` truncation rule defined earlier are intentionally NOT
   overridden here.
   ===================================================================== */

/* ---- Auth status text (compact-header Req 2.2: was a pill) ---- */
.auth-status {
  font-family: var(--body);
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
}
.auth-status--out { color: var(--muted); }
.auth-status--in { color: var(--navy); }
.auth-status--in::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 6px;
  vertical-align: 1px;
}

/* ---- Primary navigation tabs (Correção / Definições) ---- */
.app-nav {
  display: flex;
  gap: 6px;
  max-width: 960px;
  margin: 20px auto 4px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-sm);
  width: fit-content;
}
.nav-tab {
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: var(--head);
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink-dim);
  padding: 9px 22px;
  border-radius: var(--r-pill);
  transition: color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.nav-tab:hover {
  color: var(--navy);
}
.nav-tab.is-active {
  color: #fff;
  background: var(--grad);
  box-shadow: var(--shadow-blue);
}

/* ---- Layout (app-shell-redesign: sidebar retired; Spaces are .view siblings) ---- */
.project-list {
  list-style: none;
  margin: 8px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.project-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease;
}
.project-item:hover {
  background: var(--bg-cool);
}
.project-item.is-active {
  background: linear-gradient(120deg, rgba(30, 99, 255, 0.1), rgba(31, 166, 74, 0.1));
  border-color: rgba(30, 99, 255, 0.28);
}
.project-item.is-active .project-name {
  color: var(--navy);
  font-weight: 700;
}
.project-badge {
  font-family: var(--head);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--green-deep);
  background: var(--bg-mint);
  padding: 2px 8px;
  border-radius: var(--r-pill);
}

/* ---- Inputs: brand focus ring ---- */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(30, 99, 255, 0.14);
  outline: none;
}

/* ---- Progress bars: gradient fill ---- */
.progress {
  height: 9px;
  background: #e7ecf5;
  border-radius: var(--r-pill);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--grad);
  border-radius: var(--r-pill);
  transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.progress--row {
  height: 6px;
}

/* ---- Status badges: brand-tinted, pill, uppercase ---- */
.badge {
  font-family: var(--head);
  letter-spacing: 0.02em;
}
.badge--uploaded { background: #e6eefc; color: var(--blue-deep); }
.badge--calibrated,
.badge--extracted,
.badge--graded { background: var(--bg-mint); color: var(--green-deep); }

/* ---- Drop zone ---- */
.drop-zone {
  border: 2px dashed var(--border-strong);
  background: var(--bg-cool);
  border-radius: var(--r-md);
  transition: border-color 0.18s ease, background 0.18s ease;
}
.drop-zone:hover,
.drop-zone:focus,
.drop-zone.dragover {
  border-color: var(--blue);
  background: #eef4ff;
}

/* ---- Upload mode switch: active button carries the gradient ---- */
.mode-btn[aria-selected="true"] {
  background: var(--grad);
  color: #fff;
  box-shadow: var(--shadow-blue);
}

/* ---- Result blocks: softer rounding to match cards ---- */
.result-block {
  border-radius: var(--r-sm);
}

/* ---- Dashboard status count chips ---- */
.dashboard-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 6px 0 16px;
}
.dashboard-counts > * {
  font-family: var(--head);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink-dim);
  background: var(--bg-cool);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 7px 14px;
}

/* ---- Cohort overview block ---- */
.cohort-overview {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px 18px 6px;
  margin: 6px 0 18px;
  background:
    radial-gradient(60% 100% at 100% 0%, rgba(30, 99, 255, 0.05), transparent 65%),
    #fff;
  box-shadow: var(--shadow-sm);
}

/* ---- Per-question result cards: gradient rail + brand score ---- */
.question-card {
  position: relative;
  border-radius: var(--r-sm);
  padding-left: 14px;
}
.question-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 3px 0 0 3px;
  background: var(--grad);
  opacity: 0.55;
}
.score-value {
  color: var(--blue-deep);
}

/* ---- Results group headings ---- */
.results-group-heading,
.results-group-subheading {
  font-family: var(--head);
  color: var(--navy);
}

/* ---- Modal card: rounder, softer, gradient top accent ---- */
.modal-content {
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  border-top: 3px solid transparent;
  border-image: var(--grad) 1;
}
.modal-content h3 {
  font-family: var(--head);
  color: var(--navy);
}

/* ---- Toast: brand-navy surface ---- */
.toast {
  background: var(--navy);
  font-family: var(--head);
  border-radius: var(--r-md);
}

/* ---- Responsive: stack the sidebar above content on narrow screens ---- */
@media (max-width: 820px) {
  .app-nav {
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .progress-fill {
    transition: none;
  }
}

/* ---------------------------------------------------------------------------
 * bulk-split-review — swipe-through split review overlay
 * ------------------------------------------------------------------------- */
#splitReview[hidden] { display: none !important; }

.split-review {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 26, 60, 0.55);
  padding: 16px;
}

.split-review__box {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(10, 26, 60, 0.28);
  width: min(640px, 96vw);
  max-height: 92vh;
  overflow-y: auto;
  padding: 18px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}

.split-review__hint {
  margin: 0;
  color: #0a1a3c;
  font-weight: 600;
}

.split-review__tag {
  font-family: "Poppins", system-ui, sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e63ff;
  background: linear-gradient(90deg, rgba(30,99,255,0.10), rgba(31,166,74,0.10));
  border-radius: 10px;
  padding: 8px 12px;
}

.split-review__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f5fb;
  border-radius: 12px;
  min-height: 46vh;
  touch-action: pan-y;
  overflow: hidden;
}

.split-review__canvas {
  max-width: 100%;
  max-height: 60vh;
  height: auto;
  border-radius: 8px;
}

.split-review__counter { margin: 0; color: #5a6785; font-size: 0.9rem; }

.split-review__fix { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.split-review__choices { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; }
.split-review__choices[hidden] { display: none; }
.split-review__choices-label { color: #0a1a3c; font-weight: 600; }

.split-review__nav {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
}
.split-review__nav .btn { flex: 1 1 auto; }
.split-review__nav .btn[hidden] { display: none; }

/* =============================================================================
   app-shell-redesign (Option A) — Spaces, Gate, Landing cards, header strip,
   school menu. Built ONLY from the tokens declared in :root above so the shell
   matches the brand system. Visibility is the `hidden` attribute (global
   [hidden] guard); nothing here toggles display for state.
   ========================================================================== */

/* Gate: the sign-in section as a centred card over a dimmed shell (mockup A1). */
.view-gate .gate-backdrop {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 20px;
  background:
    radial-gradient(60% 40% at 88% -5%, rgba(30, 99, 255, .08), transparent 70%),
    radial-gradient(50% 40% at 4% 2%, rgba(31, 166, 74, .08), transparent 70%);
}
.view-gate .gate-card {
  width: min(560px, 100%);
}
.view-gate .gate-card .panel {
  margin: 0;
  box-shadow: var(--shadow-lg);
}

/* Landing: project cards + the Create_Card (mockup A2). */
.landing-panel { max-width: 1100px; }
.landing-panel .panel-head { flex-wrap: wrap; }
.landing-transparency {
  color: var(--muted);
  font-size: .9rem;
  margin: 4px 0 0;
}
.projects-grid {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}
.project-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  min-height: 120px;
  padding: 20px 20px 16px;
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--ink);
  transition: transform .18s ease, box-shadow .18s ease;
}
.project-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--grad);
  opacity: .9;
}
.project-card:hover,
.project-card:focus-visible { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.project-card.is-active { outline: 2px solid var(--blue); outline-offset: -2px; }
.project-card .project-name {
  display: block;
  font: 600 1rem var(--head);
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-card .project-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge-active { background: #e3eefb; color: var(--brand-dark); }
.project-card.create-card {
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px dashed var(--brand);
  background: #f8fbff;
  color: var(--brand-dark);
  font: 600 .95rem var(--head);
  border-radius: var(--r-lg);
  box-shadow: none;
}
.project-card.create-card::before { display: none; }
.project-card.create-card .plus {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--grad); color: #fff;
  display: grid; place-items: center; font-size: 1.4rem; line-height: 1;
}

/* Spec E task 6 (L-B) — MINIMUM layout so the new markup does not break; tokens
   only, no new colour literals. The full styling pass is task 8. */
.project-card.create-folder-card {
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px dashed var(--green);
  background: var(--bg-mint);
  color: var(--green-deep);
  font: 600 .95rem var(--head);
  border-radius: var(--r-lg);
  box-shadow: none;
}
.project-card.create-folder-card::before { display: none; }
.project-card.create-folder-card .plus {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--grad); color: #fff;
  display: grid; place-items: center; font-size: 1.4rem; line-height: 1;
}
.create-folder-item { grid-column: -2 / -1; }
/* Spec F task 18 (Req 11, mockup 11B): a folder is a compact bg-cool tile that
   opens the full-bleed Folder_Panel. Replaces the inline .folder-group with
   nested cards (superseded — A13). Tokens only, no hex. */
.folder-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 100px;
  padding: 18px;
  border-radius: var(--r-lg);
  cursor: pointer;
}
.folder-tile--cool {
  background: var(--bg-cool);
  border: 1px solid var(--line);
}
.folder-tile__name { font: 600 1rem var(--head); color: var(--navy); }
.folder-tile__meta { color: var(--muted); font-size: .85rem; }

/* Folder_Panel — full-bleed overlay on the .split-review idiom. */
.folder-panel-overlay {
  padding: 0;
}
.folder-panel {
  background: var(--panel-bg, #fff);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  /* B3 (five-lens LENS 3 MINOR): the ruled near-full-viewport panel (R11.4 +
     DES full-bleed overlay), not a content-fit centered card. */
  width: min(1180px, 96vw);
  height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.folder-panel__head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}
.folder-panel__title { font: 600 1.05rem var(--head); color: var(--navy); flex: 1; }
.folder-panel__head .btn { margin-left: auto; }
.folder-panel__head .modal-close { position: static; margin-left: 4px; }
.folder-glyph {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--grad);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: .9rem;
}
.folder-panel__search { padding: 12px 18px 0; }
.folder-panel .search {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-pill);
  font-family: var(--body);
  font-size: .9rem;
}
.folder-panel__body { padding: 12px 18px 16px; overflow-y: auto; }
.folder-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}
.folder-row:hover { background: var(--bg-cool); }
/* The select control fills the row and carries the row's own click target;
   button UA styling is reset so it reads like the old row text (Spec F task 18
   follow-up — split from the nested move button to clear axe nested-interactive). */
.folder-row__select {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 10px;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.folder-row__move {
  order: -1; /* keep the ⇄ affordance on the left as before the split */
  min-width: 44px;
  min-height: 44px;
  margin: 12px 0 12px 10px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}
.folder-row__move::before { content: "\21C4"; }
.folder-row__text { display: flex; flex-direction: column; gap: 2px; }
.folder-row__name { font: 600 .95rem var(--head); color: var(--navy); }
.folder-panel .empty-state { color: var(--muted); font-size: .9rem; padding: 18px 6px; text-align: center; }

/* B3 (Spec F R11.4): at phone width the panel is full-bleed — the whole
   viewport, no rounded corners — so it reads as a screen, not a card. */
@media (max-width: 480px) {
  .folder-panel {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }
}
.project-card__move {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--panel-bg);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}
.project-card__move::before { content: "\21C4"; font-size: .9rem; line-height: 1; }
.move-popover { position: absolute; top: 40px; right: 10px; z-index: 5; padding: 8px; display: grid; gap: 6px; }
/* Five-lens L3-2: the popover's visible caption (a first-time teacher had no
   visible word connecting the move glyph to folders). Tokens only. */
.move-popover__caption { font: 600 .8rem var(--head); color: var(--navy); }
/* Five-lens L3-1: the ruled F-A mint disclosure on the "Outra" free-text field. */
.hint--mint {
  background: var(--bg-mint);
  border-left: 3px solid var(--green);
  color: var(--green-deep);
  padding: 6px 10px;
  border-radius: 6px;
}

/* Header project strip (mockup A3): "· <name> [Os meus projetos] [owner controls]" */
.crumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font: 600 .85rem var(--head);
  color: var(--muted);
}
.crumb b { color: var(--navy); }
.project-controls--inline { display: inline-flex; flex-direction: row; gap: 6px; }

/* compact-header:start */
/* compact-header (owner batch 8, mockup A): Title row below the thin bar, icon-only Main-menu
   button, menu separators/danger item, and the full-width Project page at phone width.
   Tokens only — no colour literals in this block (Req 6.1). */
.project-titlerow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px 4px;
  min-width: 0;
}
.project-title {
  font-family: var(--head);
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--navy);
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-titlerow .project-controls {
  display: inline-flex;
  flex-direction: row;
  gap: 6px;
  flex: 0 0 auto;
}
.menu-btn {
  width: 40px;
  height: 40px;
  display: flex; /* block-level: an inline-flex button adds a 4 px line-box strut to the bar */
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 5px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--navy);
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}
.menu-btn:hover,
.menu-btn:focus-visible { border-color: var(--navy); background: var(--bg-cool); outline: none; }
.menu-btn__bar {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--navy);
}
.topbar-menu__sep {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 6px 4px;
}
/* Two classes on purpose: the .topbar-menu__item rule comes later in the cascade. */
.topbar-menu__panel .topbar-menu__item--danger { color: var(--danger); }
.topbar-menu__panel .topbar-menu__item--danger:hover,
.topbar-menu__panel .topbar-menu__item--danger:focus-visible { color: var(--danger); border-color: var(--danger); }
@media (max-width: 480px) {
  /* Req 5: 390 − 8 (viewCore) − 0 (inner .view) − 8 (panel) − 2 − 8 (result-block) − 2 = 362 px. */
  #viewCore { padding-left: 4px; padding-right: 4px; }
  #viewCore .view { padding-left: 0; padding-right: 0; }
  #viewCore .panel { padding-left: 4px; padding-right: 4px; border-radius: var(--r-sm); }
  #viewCore .result-block { padding-left: 4px; padding-right: 4px; }
  #viewCore .review-window__overview { overflow-x: auto; }
  #viewCore .review-window__table { width: 100%; }
  .project-titlerow { padding: 8px 10px 2px; gap: 8px; }
  .project-title { font-size: 1.15rem; }
  /* Req 4.2: the title keeps the room — the two actions shrink first on a phone. */
  .project-titlerow .project-controls { gap: 4px; }
  .project-titlerow .btn-sm { padding: 4px 8px; font-size: 0.75rem; }
}
@media (max-width: 820px) {
  /* The app-shell 820 px rule anchored the panel left:0 for a header that wrapped the menu to
     the left; the Main-menu button is now top-right at every width, so the panel hangs right. */
  .auth-bar .topbar-menu__panel { left: auto; right: 0; max-width: calc(100vw - 28px); }
}
/* compact-header:end */
/* review-fixes:start */
/* review-fixes (owner batch 10 § B): compact Revisão de exames table — max in the header,
   bare one-decimal cells, "Revisto?" Sim/Não. Tokens only (Req 6 of compact-header carries). */
.review-window__table th { white-space: nowrap; }
.review-window__table td { white-space: nowrap; }
.review-window__table .review-window__reviewed { color: var(--green-deep); font-weight: 600; }
/* Owner batch 10 § B: a reviewed exam's Rever "goes to green"; the others keep the white ghost. */
.review-window__rever--done { background: var(--green); color: var(--panel-bg); box-shadow: none; }
.review-window__rever--done:hover:not(:disabled) { background: var(--green-deep); }
.review-window__legend { margin-top: 8px; }
@media (max-width: 480px) {
  /* The "Sim, dd/mm/yy ✓" cell is the widest; on a phone it wraps onto exactly two lines
     ("Sim," / "dd/mm/yy ✓") so five score columns + Rever still fit 390 px. */
  .review-window__table .review-window__progress { white-space: normal; max-width: 6.4em; line-height: 1.2; }
}
/* review-fixes:end */

/* review-flags:start */
/* Spec 10a: the score of a hard-to-read (flaggedForReview) question sits inside a
   rounded square — RED while undecided, GREEN once decided (green supersedes red).
   Tokens only (no hex literals); Option 1 (outlined square) locked by the DES gate.
   NON-HUE differentiator (DES gate G3 + usability L3): the RED action-needed square
   carries a leading warning glyph; GREEN is fill-only (no check mark — the ✓ is
   reserved for the teacher-reviewed "Revisto?" column, so a decided-cell ✓ would
   read as "already reviewed"). Red-with-glyph vs green-fill differ by more than hue. */
.review-window__flag {
  display: inline-block;
  padding: 2px 5px;
  border-radius: var(--r-sm);
  border: 1.5px solid transparent;
  line-height: 1.3;
}
.review-window__flag--red {
  border-color: var(--danger);
  background: var(--danger-tint);
  color: var(--danger);
  font-weight: 600;
}
.review-window__flag--red::before {
  content: "\26A0 ";
}
.review-window__flag--green {
  border-color: var(--green);
  background: var(--bg-mint);
  color: var(--green-deep);
  font-weight: 600;
}
#reviewFlaggedBar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
#reviewFlaggedNote { margin: 0; }
#reviewFlaggedNote strong { color: var(--danger); }
#reviewFlaggedLegend {
  margin: 0 0 10px;
  font-size: 0.85em;
  color: var(--muted);
}
/* review-flags:end */

/* School menu in the auth bar (mockup A3). */
.topbar-menu { position: relative; }
.topbar-menu__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 250px;
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  padding: 6px;
  z-index: 70;
}
.topbar-menu__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink);
  font: 600 .9rem var(--head);
  cursor: pointer;
}
.topbar-menu__item:hover,
.topbar-menu__item:focus-visible { border-color: var(--blue); color: var(--blue); background: #f5f8ff; }
.topbar-menu__item small { display: block; font: 400 .75rem var(--body); color: var(--muted); margin-top: 2px; }

@media (prefers-reduced-motion: reduce) {
  .project-card, .project-card:hover { transition: none; transform: none; }
}

/* app-shell-redesign: each Space is a full-width .view; panels centre themselves
   (max-width + margin auto), the container supplies the side padding the retired
   .app-layout used to. */
.view {
  padding: 8px 20px 40px;
}
.view-gate { padding: 0; }

/* Responsive shell (design gate rule F): header wraps, strip and menu stay usable. */
@media (max-width: 820px) {
  .view { padding: 8px 14px 32px; }
  .app-header .crumb { width: 100%; order: 3; }
  .topbar-menu__panel { right: auto; left: 0; min-width: 220px; max-width: calc(100vw - 28px); }
}

/* batch-progress-truth Req 3 (UI-9): the headline number and its label were two
   adjacent inline spans with no rule at all, rendering "12Exames por corrigir". */
.dashboard-headline {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35em;
}

/* project-journey:start — #10b (items A, E, F). Tokens only; no new root-level
   token (DES gate G4). */
/* Req 1.1: the Progresso stage tiles sit in a horizontal row (they had no rule
   and stacked vertically). Cells reuse the shipped .dashboard-count / .badge--*
   classes; this only lays them out. */
.dashboard-squares {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
/* Req 2.5/G4: the "Definições avançadas de correção" secondary button is a
   small white button built from tokens (--panel-bg/--line/--ink), not a hex
   literal. Sits with Recalibrar in the two-button post-correction row. */
.btn-advanced-settings {
  background: var(--panel-bg);
  color: var(--ink);
  border: 1px solid var(--line);
  font-size: 0.85rem;
  padding: 7px 14px;
}
/* Req 3.2-3.4 / 4.1: the journey bar (item F). Option 1 (inline green tick
   marks) LOCKED. Done stages green (--green/--ok), pending muted (--muted/--line);
   the glyph on a done tick uses var(--panel-bg) (the white token, not a hex
   literal). At 390 px the four PT-PT labels STACK and the arrows are dropped. */
.journey-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
}
.journey-stage {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}
.journey-stage.is-done {
  color: var(--ok);
  font-weight: 600;
}
.journey-tick {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  border: 1.5px solid var(--line);
  color: transparent;
}
.journey-stage.is-done .journey-tick {
  background: var(--green);
  border-color: var(--green);
  color: var(--panel-bg);
}
.journey-arrow {
  color: var(--line);
}
@media (max-width: 390px) {
  .journey-bar {
    flex-direction: column;
    align-items: flex-start;
  }
  .journey-arrow {
    display: none;
  }
  /* Spec F task 18 (11B) re-scope of the Spec E folder-head rule: the "Apagar
     pasta" control now lives in the Folder_Panel head. At narrow widths keep a
     >= 44px tap target. Tokens only.
       old selector: .folder-group__delete (inline folder head, superseded — A13). */
  .folder-panel__head .btn {
    min-height: 44px;
  }
}
/* project-journey:end */

/* batch-progress-truth Req 1 (mockup Option A, review lens 3 P1-1): the correction
   bar shows its outcome — a red tail while any exam of the intake errored, deep
   green once every exam is graded. The upload bar keeps the default gradient. */
.progress-fill--err {
  background: linear-gradient(90deg, var(--green-deep) 0 78%, var(--danger) 78% 100%);
}
.progress-fill--done {
  background: var(--green-deep);
}

/* ---------------------------------------------------------------------------
   school-portals (SPECS #45): the per-institution door (#viewPortal, Option A
   "Porta da escola") and the branded Gate slots. Same .gate-card as the sign-in
   card so the door and the Gate read as one object; tokens from :root only.
   --------------------------------------------------------------------------- */
body.portal-mode > header.app-header,
body.portal-mode > *:not(#viewPortal):not(#toast):not(script) { display: none !important; }
body.portal-mode > #viewPortal { display: block; }
.portal-card { text-align: center; }
.portal-mark { width: 72px; height: 72px; object-fit: contain; border-radius: 14px; margin: 0 auto 8px; display: block; }

/* project-header-and-copy Req 5 (UI-7.2): the "Rever original" answer image opens
   CENTRED and FIT-TO-VIEW — never at natural size, never pre-zoomed. A tap toggles
   .zoomed (natural width, scrollable), like the Photos app. */
.review-image__body { display: flex; flex-direction: column; align-items: center; gap: 10px; overflow: auto; }
.review-image__photo {
  display: block;
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
  margin: 0 auto;
  cursor: zoom-in;
}
.review-image__photo.zoomed { max-width: none; max-height: none; cursor: zoom-out; }

/* project-header-and-copy Req 4 (mockup 2A): the methodology option cards. These
   classes existed unstyled — the .btn inline-flex row put title and subtitle side by
   side. Stack them, left-aligned, full width at phone size. */
.upload-mode-cards { display: grid; gap: 10px; margin: 6px 0 10px; }
.upload-mode-cards .btn {
  flex-direction: column; align-items: flex-start; text-align: left;
  border-radius: var(--r-sm); padding: 12px 14px; white-space: normal;
}
.upload-mode-title { font-weight: 700; font-size: 0.95rem; line-height: 1.3; }
.upload-mode-sub { font-weight: 400; font-size: 0.82rem; line-height: 1.35; margin-top: 3px; opacity: 0.9; }
@media (min-width: 720px) { .upload-mode-cards { grid-template-columns: 1fr 1fr; } }

/* project-header-and-copy Req 6 (UI-7.6): "Correção em detalhe" grouped list. */
.criteria-list { margin: 10px 0 12px; display: grid; gap: 12px; }
.criteria-group h4 { margin: 0 0 6px; font: 700 0.85rem var(--head); }
.criteria-group.ok h4 { color: var(--green-deep); }
.criteria-group.no h4 { color: var(--danger); }
.criteria-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.criteria-group li {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm);
  font-size: 0.9rem; line-height: 1.4; background: var(--panel-bg);
}
.criteria-tick {
  flex: none; width: 18px; height: 18px; border-radius: 50%; color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px; margin-top: 1px;
}
.criteria-tick.ok { background: var(--green); }
.criteria-tick.no { background: var(--danger); }
.portal-mark--sm { width: 48px; height: 48px; }
.portal-school-name { font-family: Poppins, system-ui, sans-serif; font-weight: 700; font-size: 24px; color: var(--navy); margin: 8px 0 4px; }
.portal-school-name:empty { display: none; }
.portal-descriptor { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.portal-ai-line { margin-top: 18px; }
.portal-product { color: var(--ink-faint); font-size: 13px; margin-top: 22px; }
.gate-school-brand { text-align: center; margin-bottom: 8px; }
.gate-school-brand .portal-school-name { font-size: 20px; }

/* ---------------------------------------------------------------------------
   passwordless-email-signin (spec #11) — the two-state Gate card (option B).
   Minimal additions layered on the shared .panel/.field/.btn/.hint tokens.
   --------------------------------------------------------------------------- */
.btn.btn-block {
  width: 100%;
}

/* The submitted email, shown locked in the code state with a green tick and an
   inline "Alterar" affordance (mockup option B). */
.pwless-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  font-size: 0.9rem;
}
.pwless-chip b {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pwless-chip__tick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  flex: 0 0 auto;
}
.pwless-chip__change {
  border: none;
  background: none;
  color: var(--blue);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  padding: 0 2px;
  white-space: nowrap;
  min-height: 44px;
}

/* Secondary links stacked under the primary code button (resend + status). */
.stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.btn.btn-link {
  background: none;
  border: none;
  color: var(--blue);
  text-decoration: underline;
  padding: 10px 4px;
  font-weight: 600;
  min-height: 44px;
  cursor: pointer;
  align-self: flex-start;
}

/* The single 8-digit code input: spaced monospace-ish digits, generous target. */
#pwlessCode {
  letter-spacing: 0.3em;
  text-align: center;
  font-size: 1.4rem;
}

/* The code error is a live-region alert; colour it with the shared danger token. */
.hint.err {
  color: var(--danger);
}
