/* ============================================================
   exams.css — Espace Examens & Devoirs (T13)

   Design pillars :
     - Confrontation visuelle : la prochaine echeance domine, le banner
       de realite affiche les chiffres bruts sans habillage decoratif
     - Hierarchie typographique forte (Syne 800/900 sur les moments
       d'impact ; tabular-nums sur tous les chiffres)
     - Color shift progressive selon J-X (4 paliers : far, low, medium,
       high, critique) plutot qu'un toggle 3 etats
     - Mobile first, tactile genereux (>= 44px), low-bandwidth respecte

   Conventions UpTe :
     - Toutes couleurs via variables CSS (jamais d'hex hardcode)
     - Prefixe `.exam-` sur toutes les classes
     - Une seule animation type "pulse" sur le badge critique (1Hz humain)
   ============================================================ */

/* ---------- Shell & layout principal ---------- */

.exam-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 18px 80px;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 768px) {
  .exam-shell {
    padding: 24px 28px 80px;
  }
}

/* ---------- Reality banner : pas une card, juste de la typo dense ---------- */

/* (T28) Reality banner — verdict promu en TITRE de page (h1 visuel) avec
   les chiffres en support en dessous. La stat "dans 7 jours" est le focal
   point (taille +25%, accent couleur selon severity). Les 3 autres
   restent en typographie atténuée. Pattern Vercel Dashboard : 1 metric
   dominante + supports. */
.exam-reality {
  padding: 4px 0 22px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--border);
}

.exam-reality-verdict {
  font-family: 'Syne', system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(20px, 3.6vw, 28px);
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--color-text);
  max-width: 760px;
  margin: 0 0 22px;
  font-style: normal;
}

/* (T29) Stats en cards individuelles : grid 2x2 mobile -> 4 cols desktop.
   Meme langage visuel que .stat-card du dashboard (var(--surface) + border
   + radius). Pas de glassmorphism strict (ne casserait sur mobile bas de
   gamme), juste un container card propre coherent avec le reste de l'app. */
.exam-reality-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 720px) {
  .exam-reality-row {
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
  }
}

.exam-reality-stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  line-height: 1;
  font-feature-settings: 'tnum' 1, 'lnum' 1;
  background: var(--color-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  transition: border-color .18s ease, transform .2s cubic-bezier(.2, .8, .2, 1);
}

.exam-reality-stat:hover {
  border-color: color-mix(in srgb, var(--color-primary) 35%, var(--border));
  transform: translateY(-1px);
}

.exam-reality-num {
  font-family: 'Syne', system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(28px, 5vw, 40px);
  color: var(--color-muted);
  letter-spacing: -0.02em;
  line-height: 1;
  transition: color .2s ease;
}

/* Stat focale (la fenetre 7 jours) : domine visuellement, couleur qui
   suit la severity calculee (urgent >=3 echeances dans 7j, etc.). */
.exam-reality-stat--focal .exam-reality-num {
  font-size: clamp(40px, 7vw, 60px);
  color: var(--color-text);
}

.exam-reality-stat--focal[data-severity="urgent"] .exam-reality-num { color: var(--severity-urgent); }
.exam-reality-stat--focal[data-severity="warn"]   .exam-reality-num { color: var(--severity-warn); }
.exam-reality-stat--focal[data-severity="calm"]   .exam-reality-num { color: var(--color-primary); }

.exam-reality-pct {
  font-size: 0.55em;
  font-weight: 600;
  color: var(--color-muted);
  margin-left: 2px;
}

.exam-reality-label {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
  font-weight: 600;
}

.exam-reality-stat--focal .exam-reality-label {
  font-size: 11px;
  color: var(--color-text);
  font-weight: 700;
}

/* (T29) Toolbar restructuree :
   Ligne 1 : .exam-toolbar-actions — bouton "Nouvelle echeance" seul a droite.
   Ligne 2 : .exam-type-pills — filtres pleine largeur.
   Le titre principal est retire (deja dans la topbar header). */

.exam-toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  margin-bottom: 24px;
}

.exam-toolbar-actions {
  display: flex;
  justify-content: flex-end;
}

.exam-type-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin: -4px -4px 0;
  padding: 4px;
}

.exam-type-pills::-webkit-scrollbar { display: none; }

.exam-type-pill {
  border: none;
  background: var(--surface2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .15s ease,
              color .15s ease,
              transform .18s cubic-bezier(.2, .8, .2, 1);
  font-family: inherit;
}

.exam-type-pill:hover {
  background: var(--green-dim);
  color: var(--green);
  transform: scale(1.04);
}

.exam-type-pill.active {
  background: var(--green3);
  color: #fff;
}

.exam-new-btn {
  flex-shrink: 0;
  min-height: 44px;
  padding: 0 18px;
  font-weight: 600;
  align-self: stretch;
  justify-content: center;
}

@media (min-width: 720px) {
  .exam-new-btn {
    align-self: auto;
  }
}

/* ---------- Timeline horizontale ---------- */

.exam-timeline {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 18px 14px;
  margin-bottom: 28px;
}

.exam-timeline-track {
  position: relative;
  height: 26px;
  background: linear-gradient(
    to right,
    var(--red-dim) 0%,
    var(--orange-dim) 18%,
    var(--green-dim) 50%,
    transparent 100%
  );
  border-radius: 999px;
  margin-bottom: 10px;
  overflow: visible;
}

.exam-timeline-track::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
  transform: translateY(-50%);
}

.exam-timeline-dot {
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.exam-timeline-dot-inner {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--muted);
  border: 2px solid var(--bg2);
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.exam-timeline-dot:hover .exam-timeline-dot-inner {
  transform: scale(1.25);
}

.exam-timeline-dot--far     .exam-timeline-dot-inner { background: var(--muted); }
.exam-timeline-dot--low     .exam-timeline-dot-inner { background: var(--green); }
.exam-timeline-dot--medium  .exam-timeline-dot-inner { background: var(--orange); }
.exam-timeline-dot--high    .exam-timeline-dot-inner { background: var(--red); }

.exam-timeline-dot--critique .exam-timeline-dot-inner {
  background: var(--red);
  width: 16px;
  height: 16px;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 25%, transparent);
}

.exam-timeline-axis {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════════
   (T28) Hero card refondue
   ═══════════════════════════════════════════════════════════════════
   - data-severity="calm|soon|warn|urgent|passed" pilote la border et
     les pulses (au lieu de --low/--medium/--high/--critique)
   - Compteur temps UNIFIE via .exam-hero-time, plus de J-X separe
   - Slider de progression custom dans .exam-hero-progress-track
   - 3 etats progress : default / --empty (CTA) / --done (checkmark)
   - Footer : 3 .exam-action distincts, Supprimer rouge AU HOVER seulement
*/

.exam-hero {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  margin-bottom: 28px;
  overflow: hidden;
  transition: border-color .25s ease,
              box-shadow .25s ease,
              transform .25s cubic-bezier(.2, .8, .2, 1);
}

@media (min-width: 720px) {
  .exam-hero { padding: 32px 32px 26px; }
}

/* Severity drives border accent */
.exam-hero[data-severity="calm"]    { border-color: var(--border); }
.exam-hero[data-severity="soon"]    { border-color: color-mix(in srgb, var(--severity-soon) 35%, var(--border)); }
.exam-hero[data-severity="warn"]    { border-color: color-mix(in srgb, var(--severity-warn) 50%, var(--border)); }
.exam-hero[data-severity="urgent"]  {
  border-color: var(--severity-urgent);
  box-shadow: 0 0 0 1px var(--severity-urgent),
              0 16px 56px -20px color-mix(in srgb, var(--severity-urgent) 55%, transparent);
}
.exam-hero[data-severity="passed"]  { border-color: var(--border); opacity: .75; }

/* Pulse subtil uniquement sur urgent (= critique ou < 24h). Pattern
   Linear : on garde l'animation tres legere pour signaler sans saturer. */
.exam-hero[data-severity="urgent"]::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 70% 50% at 100% 0%,
    color-mix(in srgb, var(--severity-urgent) 14%, transparent) 0%,
    transparent 60%
  );
  pointer-events: none;
  animation: examUrgentBreathe 2.4s ease-in-out infinite;
}

@keyframes examUrgentBreathe {
  0%, 100% { opacity: .7; }
  50%      { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .exam-hero[data-severity="urgent"]::before { animation: none; }
}

/* Header : meta + titre + when a gauche, badge a droite si critique */
.exam-hero-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
  position: relative;
}

.exam-hero-title-block {
  flex: 1;
  min-width: 0;
}

.exam-hero-eyebrow {
  font-family: 'Syne', system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-muted);
  font-weight: 700;
  margin-bottom: 10px;
  /* (T29 fix) Robustesse : meta longue ("Examen · MATH101 · Amphi B · Site sud")
     ne doit pas wrap sur plusieurs lignes. Ellipsis si trop long. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.exam-hero-title {
  font-family: 'Syne', system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(22px, 4.4vw, 32px);
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--color-text);
  margin: 0 0 6px;
  word-break: break-word;
  /* (T29 fix) Robustesse : titre cap a 2 lignes max + ellipsis. Sinon
     un titre tres long pousse le countdown hors viewport sur mobile. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.exam-hero-when {
  font-size: 13px;
  color: var(--color-muted);
  letter-spacing: 0.01em;
}

.exam-hero-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Syne', system-ui, sans-serif;
  font-weight: 800;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

.exam-hero-badge--important {
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.exam-hero-badge--critique {
  background: var(--color-danger);
  color: var(--white);
}

.exam-hero-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: examPulseHeart 1.6s ease-in-out infinite;
}

@keyframes examPulseHeart {
  0%, 60%, 100% { opacity: 1; transform: scale(1); }
  30%           { opacity: 0.55; transform: scale(0.85); }
}

@media (prefers-reduced-motion: reduce) {
  .exam-hero-badge-dot { animation: none; }
}

/* (T28) Compteur temps UNIFIE : un seul libelle adaptatif a la place de
   "J-9" + "9j 14h 32min". Couleur suit data-severity. Display Syne 60-124px. */
.exam-hero-countdown {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 24px;
}

.exam-hero-time {
  font-family: 'Syne', system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(40px, 9vw, 72px);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--color-text);
  font-feature-settings: 'tnum' 1, 'lnum' 1;
  transition: color .3s ease;
  /* (T29 fix) Robustesse : compteur force sur une seule ligne. Si jamais
     un libelle long depasse, ellipsis plutot que wrap (qui casserait
     l'identite visuelle dominante du compteur). */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.exam-hero-time[data-severity="calm"]   { color: var(--color-text); }
.exam-hero-time[data-severity="soon"]   { color: var(--severity-soon); }
.exam-hero-time[data-severity="warn"]   { color: var(--severity-warn); }
.exam-hero-time[data-severity="urgent"] { color: var(--severity-urgent); }
.exam-hero-time[data-severity="passed"] { color: var(--severity-passed); }

.exam-hero-when-sub {
  font-size: 13px;
  color: var(--color-muted);
  letter-spacing: 0.02em;
  font-weight: 500;
}

/* ─── Progression : 3 etats (default / empty / done) ────────────── */

.exam-hero-progress {
  margin-bottom: 22px;
}

.exam-hero-progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
}

.exam-hero-progress-label {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-muted);
  font-weight: 700;
}

.exam-hero-progress-value {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  font-family: 'Syne', system-ui, sans-serif;
  font-weight: 800;
  font-size: 22px;
  color: var(--color-text);
  font-feature-settings: 'tnum' 1, 'lnum' 1;
}

.exam-hero-progress-input {
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  width: 3ch;
  text-align: right;
  padding: 0;
  outline: none;
  border-radius: 4px;
  transition: background-color .15s ease;
  -moz-appearance: textfield;
  appearance: textfield;
}

.exam-hero-progress-input::-webkit-outer-spin-button,
.exam-hero-progress-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.exam-hero-progress-input:focus {
  background: var(--color-surface-soft);
}

.exam-hero-pct {
  font-size: 0.6em;
  color: var(--color-muted);
  margin-left: 1px;
}

/* Track + slider superposes : le fill visuel est dans un div separe,
   l'input range est par-dessus pour capturer les events. */
.exam-hero-progress-track {
  position: relative;
  height: 28px;
  display: flex;
  align-items: center;
}

.exam-hero-progress-track::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  transform: translateY(-50%);
  height: 6px;
  background: var(--color-surface-soft);
  border-radius: 999px;
  pointer-events: none;
}

.exam-hero-progress-fill {
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  height: 6px;
  border-radius: 999px;
  pointer-events: none;
  transition: width .35s cubic-bezier(.2, .8, .2, 1),
              background-color .25s ease;
  background: linear-gradient(90deg, var(--color-primary-strong), var(--color-primary));
}

/* Bucket : couleur du fill suit "es-tu en retard sur ton travail ?".
   Independant de la severity de l'echeance (qui depend du temps). */
.exam-hero-progress[data-bucket="behind"]  .exam-hero-progress-fill {
  background: linear-gradient(90deg, color-mix(in srgb, var(--color-danger) 70%, transparent), var(--color-danger));
}
.exam-hero-progress[data-bucket="mid"] .exam-hero-progress-fill {
  background: linear-gradient(90deg, color-mix(in srgb, var(--color-warning) 70%, transparent), var(--color-warning));
}

/* Slider <input type="range"> stylise — invisible track, juste le thumb. */
.exam-hero-progress-slider {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 28px;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  cursor: pointer;
  margin: 0;
  padding: 0;
}

.exam-hero-progress-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--color-primary);
  border: 3px solid var(--color-surface);
  border-radius: 50%;
  cursor: grab;
  box-shadow: 0 2px 10px var(--green-glow);
  transition: transform .18s cubic-bezier(.2, .8, .2, 1);
}

.exam-hero-progress-slider::-webkit-slider-thumb:hover {
  transform: scale(1.18);
}

.exam-hero-progress-slider:active::-webkit-slider-thumb {
  cursor: grabbing;
  transform: scale(1.28);
}

.exam-hero-progress-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--color-primary);
  border: 3px solid var(--color-surface);
  border-radius: 50%;
  cursor: grab;
  box-shadow: 0 2px 10px var(--green-glow);
  transition: transform .18s cubic-bezier(.2, .8, .2, 1);
}

.exam-hero-progress-slider::-moz-range-thumb:hover {
  transform: scale(1.18);
}

/* Cibles tactiles plus grosses sur mobile (24x24 — recommandation Apple/MD). */
@media (max-width: 600px) {
  .exam-hero-progress-track { height: 36px; }
  .exam-hero-progress-slider { height: 36px; }
  .exam-hero-progress-slider::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
  }
  .exam-hero-progress-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .exam-hero-progress-fill,
  .exam-hero-progress-slider::-webkit-slider-thumb,
  .exam-hero-progress-slider::-moz-range-thumb {
    transition: none;
  }
}

/* ─── Etat 0% : pas de barre vide, CTA ───────────────────────────── */

.exam-hero-progress--empty {
  background: var(--color-surface-soft);
  border: 1px dashed color-mix(in srgb, var(--color-muted) 40%, transparent);
  border-radius: 12px;
  padding: 18px 18px 16px;
  text-align: left;
}

.exam-hero-progress-empty-text {
  font-size: 13.5px;
  color: var(--color-text);
  font-weight: 500;
  line-height: 1.5;
  margin-bottom: 14px;
}

.exam-hero-progress-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.exam-hero-progress-cta {
  flex-shrink: 0;
  min-height: 40px;
}

.exam-hero-progress-plan-link {
  background: transparent;
  border: 0;
  color: var(--color-muted);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 6px 4px;
  font-family: inherit;
  transition: color .15s ease;
}

.exam-hero-progress-plan-link:hover {
  color: var(--color-text);
}

/* ─── Etat 100% : checkmark + libelle ────────────────────────────── */

.exam-hero-progress--done .exam-hero-progress-row {
  align-items: center;
  background: var(--color-primary-soft);
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 0;
}

.exam-hero-progress-done-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--white);
  flex-shrink: 0;
}

.exam-hero-progress-done-label {
  flex: 1;
  font-family: 'Syne', system-ui, sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--color-primary);
  letter-spacing: 0.02em;
}

.exam-hero-progress-reset {
  background: transparent;
  border: 0;
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background-color .15s ease;
}

.exam-hero-progress-reset:hover {
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
}

/* ─── Description ────────────────────────────────────────────────── */

.exam-hero-desc {
  font-size: 13.5px;
  color: var(--color-muted);
  line-height: 1.6;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  margin-bottom: 14px;
  /* (T29 fix) Note utilisateur : cap a 3 lignes + ellipsis. Une note tres
     longue ne doit pas pousser le footer actions hors de la fenetre. */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─── Footer : 3 actions hiérarchisées ──────────────────────────── */

.exam-hero-footer {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

/* Pattern Linear : actions neutres au repos, color-shift au hover.
   Supprimer JAMAIS rouge au repos (anxiete visuelle), seulement hover. */
.exam-action {
  background: transparent;
  border: 0;
  color: var(--color-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 8px 10px;
  cursor: pointer;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  transition: background-color .15s ease, color .15s ease;
}

.exam-action svg {
  flex-shrink: 0;
}

.exam-action:hover {
  background: var(--color-surface-soft);
  color: var(--color-text);
}

.exam-action:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* (T29 fix) Supprimer pousse a droite : Modifier + Archiver groupes a
   gauche, Supprimer seul a droite via margin-left:auto. Pattern reconnu
   pour separer visuellement l'action destructrice des actions neutres.
   La couleur reste neutre au repos (decision T28 : pas de rouge permanent
   pour eviter l'anxiete visuelle), rouge uniquement au hover. */
.exam-action--danger {
  margin-left: auto;
}

.exam-action--danger:hover {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

/* ---------- Section labels ---------- */

.exam-section-label {
  font-family: 'Syne', system-ui, sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
  padding-top: 8px;
}

.exam-section-label--muted {
  margin-top: 28px;
  opacity: 0.7;
}

/* ---------- Grille de cards secondaires ---------- */

.exam-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

@media (min-width: 600px) {
  .exam-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 980px) {
  .exam-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* (T28) Card secondaire — pattern Linear "priority bar".
   - Border-left 3-5px coloree selon data-severity (au lieu de classes
     --low/medium/high/critique).
   - Plus de "flag !" rouge en chip : la severity est portee par la
     border-left + le compteur temps. Critique : un mark SVG (warning
     icon) discret en haut a droite, 12px.
   - Hover : lift 1px + accent border-top/right/bottom (le left reste
     l'indicateur fixe de severity, on ne touche pas).
   - Critique uniquement : pulsation tres legere du border-left. */
.exam-card {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--severity-calm);
  border-radius: 12px;
  padding: 16px 18px 14px;
  cursor: pointer;
  transition: transform .18s cubic-bezier(.2, .8, .2, 1),
              border-color .18s ease,
              box-shadow .22s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 130px;
}

.exam-card:hover {
  transform: translateY(-1px);
  border-top-color: var(--color-primary-strong);
  border-right-color: var(--color-primary-strong);
  border-bottom-color: var(--color-primary-strong);
  box-shadow: 0 8px 24px -12px color-mix(in srgb, var(--color-primary) 30%, transparent);
}

/* Severity drives left border thickness + color. */
.exam-card[data-severity="calm"]    { border-left-color: var(--severity-calm); }
.exam-card[data-severity="soon"]    { border-left-color: var(--severity-soon); }
.exam-card[data-severity="warn"]    { border-left-color: var(--severity-warn); }
.exam-card[data-severity="urgent"]  {
  border-left-color: var(--severity-urgent);
  border-left-width: 4px;
}
.exam-card[data-severity="passed"]  {
  border-left-color: var(--severity-passed);
  opacity: .6;
}

.exam-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.exam-card-meta {
  font-family: 'Syne', system-ui, sans-serif;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
  font-weight: 700;
  /* (T29 fix) Robustesse : meta forcee sur une ligne, ellipsis si trop long. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  min-width: 0;
}

/* (T28) Critique mark : icône warning 12px, pas un chip rouge plein.
   Plus subtle, plus pro (Linear-style). */
.exam-card-critical-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--severity-urgent);
}

.exam-card-title {
  font-family: 'Syne', system-ui, sans-serif;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.25;
  color: var(--color-text);
  letter-spacing: -0.005em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.exam-card-when {
  font-size: 11.5px;
  color: var(--color-muted);
  letter-spacing: 0.02em;
}

.exam-card-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 4px;
}

/* (T28) Compteur temps unifie meme format que le hero. Couleur suit
   data-severity. Plus court (max 2 mots) pour tenir dans la card. */
.exam-card-time {
  font-family: 'Syne', system-ui, sans-serif;
  font-weight: 800;
  font-size: 13.5px;
  color: var(--color-text);
  flex-shrink: 0;
  letter-spacing: -0.01em;
  font-feature-settings: 'tnum' 1, 'lnum' 1;
  white-space: nowrap;
  transition: color .2s ease;
}

.exam-card-time[data-severity="calm"]   { color: var(--color-text); }
.exam-card-time[data-severity="soon"]   { color: var(--severity-soon); }
.exam-card-time[data-severity="warn"]   { color: var(--severity-warn); }
.exam-card-time[data-severity="urgent"] { color: var(--severity-urgent); }
.exam-card-time[data-severity="passed"] { color: var(--severity-passed); }

.exam-card-progress {
  flex: 1;
  height: 4px;
  background: var(--color-surface-soft);
  border-radius: 999px;
  overflow: hidden;
  min-width: 60px;
}

.exam-card-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary-strong), var(--color-primary));
  border-radius: 999px;
  transition: width .45s cubic-bezier(.2, .8, .2, 1),
              background-color .25s ease;
}

/* Bucket : couleur selon "es-tu en retard sur ton travail ?". */
.exam-card-progress[data-bucket="behind"] .exam-card-progress-fill {
  background: linear-gradient(90deg, color-mix(in srgb, var(--color-danger) 70%, transparent), var(--color-danger));
}

.exam-card-progress[data-bucket="mid"] .exam-card-progress-fill {
  background: linear-gradient(90deg, color-mix(in srgb, var(--color-warning) 70%, transparent), var(--color-warning));
}

.exam-card-pct {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text);
  flex-shrink: 0;
  letter-spacing: -0.01em;
  font-feature-settings: 'tnum' 1, 'lnum' 1;
}

.exam-card-pct span {
  font-size: 0.7em;
  color: var(--color-muted);
  font-weight: 600;
}

.exam-card-archive {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--color-surface-soft);
  border: 0;
  color: var(--color-muted);
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: background-color .15s ease, color .15s ease;
}

.exam-card-archive:hover {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

/* Highlight au scrollIntoView depuis la timeline */
.exam-card--flash {
  animation: examFlashIn 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes examFlashIn {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 50%, transparent); }
  30%  { box-shadow: 0 0 0 6px color-mix(in srgb, var(--green) 30%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 0%, transparent); }
}

/* ---------- Empty pinned (filtre actif sans hero) ---------- */

.exam-empty-pinned {
  background: var(--bg2);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px 22px;
  text-align: center;
  margin-bottom: 28px;
}

.exam-empty-pinned-line {
  font-family: 'Syne', system-ui, sans-serif;
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  margin-bottom: 6px;
}

.exam-empty-pinned-sub {
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Empty state global : confrontation, pas decoration ---------- */

.exam-empty {
  text-align: left;
  padding: 32px 0 24px;
  max-width: 540px;
  margin: 0 auto;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 48px 24px;
}

@media (min-width: 720px) {
  .exam-empty {
    padding: 80px 24px;
  }
}

.exam-empty-line {
  font-family: 'Syne', system-ui, sans-serif;
  font-weight: 600;
  font-size: clamp(18px, 3.5vw, 22px);
  line-height: 1.4;
  color: var(--muted);
  margin-bottom: 4px;
}

.exam-empty-line--strong {
  color: var(--text);
  font-weight: 800;
  font-size: clamp(20px, 4vw, 26px);
  margin-top: 8px;
  margin-bottom: 28px;
  letter-spacing: -0.01em;
}

.exam-empty-cta {
  min-height: 48px;
  padding: 0 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* ---------- Modale formulaire ---------- */

/* ═══════════════════════════════════════════════════════════════════
   (T30) Modale création / édition d'échéance — refonte alignée T28.
   ═══════════════════════════════════════════════════════════════════
   Tokens sémantiques (--color-*, --severity-*) au lieu de tokens
   techniques. Typographie 5 rôles (label en uppercase tracking).
   Focus ring + transitions cohérentes avec la page.
   Override scopé sur .exam-modal — n'affecte AUCUNE autre modale. */

.exam-modal {
  max-width: 560px;
  width: 100%;
}

.exam-form-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.exam-form-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.exam-form-row--double {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 540px) {
  .exam-form-row--double {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
}

.exam-form-row--double > div {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

/* Labels en typographie Subtitle T28 : Syne 700 11px uppercase tracking
   — coherent avec .exam-section-label et les eyebrows partout. Plus
   "etiquette de formulaire pro" et moins "champ administratif". */
.exam-modal .form-label {
  font-family: 'Syne', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 0;
}

/* Inputs : 44px tactile, radius doux, fond surface-soft pour creer
   un contraste intentionnel avec le fond de la modale. */
.exam-modal .form-input,
.exam-modal .form-select,
.exam-modal .form-textarea {
  min-height: 44px;
  font-size: 14.5px;
  background: var(--color-surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--color-text);
  padding: 11px 14px;
  transition: border-color .18s ease,
              box-shadow .18s ease,
              background-color .18s ease;
}

.exam-modal .form-input::placeholder,
.exam-modal .form-textarea::placeholder {
  color: color-mix(in srgb, var(--color-muted) 80%, transparent);
}

.exam-modal .form-input:focus,
.exam-modal .form-select:focus,
.exam-modal .form-textarea:focus {
  border-color: var(--color-primary);
  background: var(--color-surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 22%, transparent);
}

.exam-modal .form-textarea {
  min-height: 88px;
  resize: vertical;
  line-height: 1.55;
}

/* Importance : 3 segments tactiles avec icône et couleur sévérité. */
.exam-importance-segments {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.exam-imp-segment {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--color-surface-soft);
  cursor: pointer;
  font-family: 'Syne', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  transition: background-color .15s ease,
              color .15s ease,
              border-color .15s ease,
              transform .18s cubic-bezier(.2, .8, .2, 1);
  text-align: center;
}

.exam-imp-segment:hover {
  border-color: color-mix(in srgb, var(--color-primary) 35%, var(--border));
  color: var(--color-text);
}

.exam-imp-segment input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.exam-imp-segment:focus-within {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Etat checked : segment rempli avec couleur de severite. Normal =
   primary, important = warning, critique = danger. Pattern Linear
   priority picker. */
.exam-imp-segment:has(input:checked) {
  background: var(--color-primary-soft);
  color: var(--color-primary);
  border-color: var(--color-primary);
  transform: scale(1.02);
}

.exam-imp-segment--important:has(input:checked) {
  background: var(--color-warning-soft);
  color: var(--color-warning);
  border-color: var(--color-warning);
}

.exam-imp-segment--critique:has(input:checked) {
  background: var(--color-danger-soft);
  color: var(--color-danger);
  border-color: var(--color-danger);
}

@media (prefers-reduced-motion: reduce) {
  .exam-imp-segment:has(input:checked) { transform: none; }
}

/* Spacing ajusté du body de la modale Examens uniquement, pour donner
   plus de respiration (form aere). N'affecte pas les autres modales. */
.exam-modal .modal-body {
  padding: 22px 24px;
}

@media (max-width: 540px) {
  .exam-modal .modal-body { padding: 18px 18px; }
}

/* ---------- Mini-card dashboard (T13-b 2/2) ---------- */

.exam-dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
  text-decoration: none;
  color: inherit;
}

.exam-dash-card:hover {
  border-color: var(--green3);
  transform: translateY(-1px);
}

.exam-dash-card-num {
  font-family: 'Syne', system-ui, sans-serif;
  font-weight: 800;
  font-size: 32px;
  line-height: 1;
  color: var(--text);
  letter-spacing: -0.02em;
  flex-shrink: 0;
  min-width: 36px;
}

.exam-dash-card-num--alert { color: var(--red); }

.exam-dash-card-body {
  flex: 1;
  min-width: 0;
}

.exam-dash-card-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.exam-dash-card-next {
  font-size: 13px;
  color: var(--text);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.exam-dash-card-empty {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
}

/* ---------- A11y : reduced motion + low bandwidth ---------- */

@media (prefers-reduced-motion: reduce) {
  .exam-hero-badge-dot,
  .exam-card--flash,
  .exam-hero-progress-fill,
  .exam-card-progress-fill {
    animation: none !important;
    transition: none !important;
  }
}

html.low-bandwidth .exam-hero-badge-dot {
  animation: none;
}

/* (T28) Mode bas-debit / appareils faibles : on reduit le bruit visuel
   des urgents. La box-shadow sature reste pour conserver le signal mais
   le glow radial-gradient (le ::before) est coupe. */
html.low-bandwidth .exam-hero[data-severity="urgent"] {
  box-shadow: 0 0 0 1px var(--severity-urgent);
}

html.low-bandwidth .exam-hero[data-severity="urgent"]::before {
  display: none;
}
