/* ==========================================================================
   Composants : fenêtres, panneaux, recherche, QCM, statistiques, visite
   ========================================================================== */

/* ───────────── Fenêtres (<dialog>) ───────────── */

dialog {
  padding: 0;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: var(--backdrop); }

.dialog-inner {
  display: flex;
  flex-direction: column;
  max-height: inherit;
  height: 100%;
}

.modal {
  width: min(40rem, calc(100vw - 2rem));
  max-height: min(90vh, 52rem);
  border-radius: 16px;
}
.modal.small { width: min(28rem, calc(100vw - 2rem)); }
.modal.small .dialog-inner { gap: .9rem; padding: 1.6rem; }
.modal.small h2 { font-size: var(--step-1); }
.modal.small p { color: var(--text-muted); }

.modal[open] { animation: pop .18s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.stack-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-top: .4rem;
}
.stack-actions .btn { flex: 1 1 auto; }

/* Panneau latéral */
.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(46rem, 100vw);
  height: 100vh;
  height: 100dvh;
  max-width: 100vw;
  max-height: 100vh;
  max-height: 100dvh;
  margin: 0;
  border-width: 0 0 0 1px;
  border-radius: 0;
}
.drawer[open] { animation: slide-in .25s var(--ease); }
.drawer.wide { width: 100vw; }
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1rem 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
}
.drawer-head h2 { font-size: var(--step-1); }
.drawer-head-actions { display: flex; gap: .25rem; }

/* ───────────── Lecteur de fiches ───────────── */

.viewer-head {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: 1rem 1rem 1rem 1.5rem;
  background: radial-gradient(80% 160% at 0% 0%, color-mix(in srgb, var(--c, var(--accent)) 16%, transparent), transparent 70%);
}
.viewer-heading { flex: 1; min-width: 0; }
.viewer-title { font-size: 1.2rem; font-weight: 700; line-height: 1.25; }
.viewer-sub { display: flex; align-items: center; gap: .6rem; margin-top: .15rem; }
.viewer-code { font: 700 .95rem/1 var(--font-display); color: var(--c, var(--accent)); letter-spacing: .03em; }
.viewer-foot {
  padding: .85rem 1.5rem calc(.85rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.viewer-foot .btn { gap: .6rem; }
.btn-sub { font-weight: 500; opacity: .75; font-size: .9em; }
.filter { position: relative; display: block; }
.filter .icon { position: absolute; left: .7rem; top: 50%; translate: 0 -50%; width: 1rem; height: 1rem; color: var(--text-muted); pointer-events: none; }
.filter input { padding-left: 2.1rem; }

.level-tabs {
  display: flex;
  gap: .25rem;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.level-tab {
  position: relative;
  padding: .75rem .9rem;
  border: 0;
  background: none;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}
.level-tab[aria-selected="true"] { color: var(--text); }
.level-tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset: auto .5rem -1px;
  height: 3px;
  background: var(--accent);
}
.level-tab:disabled { opacity: .55; }
.level-soon { font: 500 .8rem var(--font-body); }

.viewer-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem 1rem;
  padding: .8rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.viewer-tools .filter { flex: 1 1 12rem; }
.viewer-tools input[type="search"] { min-height: 2.4rem; }

.viewer-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.5rem 1.5rem 4rem;
}
.viewer-body:focus { outline: none; }

/* ───────────── Recherche ───────────── */

.search {
  width: min(42rem, calc(100vw - 2rem));
  margin-top: 10vh;
  max-height: 75vh;
}
.search-field {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .7rem .7rem .7rem 1rem;
  border-bottom: 1px solid var(--line);
}
.search-field svg { color: var(--text-muted); }
.search-field input {
  border: 0;
  background: transparent;
  font-size: var(--step-1);
  padding-left: 0;
}
.search-field input:focus { box-shadow: none; }
.search-hint { padding: .9rem 1.1rem; color: var(--text-muted); }
.search-hint:empty { display: none; }

.search-results {
  overflow-y: auto;
  list-style: none;
  padding: .4rem;
}
.search-results li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .1rem 1rem;
  padding: .6rem .8rem;
  border-radius: var(--radius);
  cursor: pointer;
}
.search-results li[aria-selected="true"] { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }
.result-term { font-weight: 700; }
.result-def { grid-column: 1; color: var(--text-muted); font-size: .92rem; }
.result-where {
  grid-column: 2; grid-row: 1 / span 2;
  align-self: center;
  font: 700 .9rem/1 var(--font-display);
  color: var(--text-muted);
}

/* ───────────── Composer un QCM ───────────── */

.builder-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
}

.builder-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .6rem;
}

.builder-label {
  font-size: 1rem;
  font-weight: 700;
}

.pick-list { display: grid; gap: 1.1rem; margin-bottom: 1.5rem; }
.pick-group { margin: 0; padding: 0; border: 0; display: grid; gap: .4rem; }
.pick-group legend { padding: 0 0 .3rem; font-size: .9rem; color: var(--text-muted); }

.pick {
  display: grid;
  grid-template-columns: auto auto 4.5rem 1fr auto;
  align-items: center;
  gap: .75rem;
  padding: .65rem .85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-deep);
  cursor: pointer;
}
.pick:hover { border-color: var(--line-strong); }
.pick:has(input:checked) { border-color: var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 10%, var(--surface)); }
.pick-code { font: 700 1.15rem/1 var(--font-display); }
.pick-name { color: var(--text-muted); font-size: .95rem; }
.pick-count { font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: .9rem; }
.pick-count::after { content: " q."; }

.count-picker { margin: 0; padding: 0; border: 0; }
.count-picker legend { margin-bottom: .6rem; }
.segmented {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
}
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; }
.segmented span {
  display: block;
  min-width: 3.5rem;
  padding: .55rem .9rem;
  text-align: center;
  font-weight: 700;
  cursor: pointer;
}
.segmented label + label span { border-left: 1px solid var(--line-strong); }
.segmented input:checked + span { background: var(--accent); color: var(--on-accent); }
.segmented input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: -3px; }

.builder-foot {
  display: grid;
  gap: .7rem;
  padding: 1rem 1.5rem 1.25rem;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.builder-info { color: var(--text-muted); font-size: .95rem; }
.builder-secondary { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }

/* ───────────── Passage du QCM ───────────── */

.play {
  width: min(46rem, calc(100vw - 1.5rem));
  max-height: min(94vh, 50rem);
}
.play-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem .75rem .5rem 1.5rem;
}
.play-counter { display: flex; flex-wrap: wrap; gap: .25rem .9rem; font-weight: 600; }
.play-source { color: var(--text-muted); font-weight: 500; }

.play-progress { height: 4px; background: var(--line); }
.play-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s var(--ease); }

.play-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.75rem 1.5rem 1rem;
}
.play-question {
  max-width: 34ch;
  margin-bottom: 1.5rem;
  font-size: clamp(1.3rem, 2.6vw, var(--step-2));
  font-weight: 700;
  line-height: 1.3;
}

.answers { display: grid; gap: .6rem; }
.answer {
  display: flex;
  align-items: center;
  gap: .9rem;
  width: 100%;
  padding: .8rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg-deep);
  text-align: left;
  line-height: 1.35;
}
.answer:hover { border-color: var(--text-muted); }
.answer-key {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2rem; height: 2rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-s);
  font-weight: 700;
}
.answer[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.answer[aria-pressed="true"] .answer-key { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.play-keys { margin-top: 1.25rem; font-size: .85rem; color: var(--text-muted); }
@media (hover: none) { .play-keys { display: none; } }

.dots {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  padding: .75rem 1.5rem;
}
.dot {
  width: 1.1rem; height: 1.1rem;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: transparent;
}
.dot.answered { background: var(--text-muted); border-color: var(--text-muted); }
.dot[aria-current="step"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

.play-foot {
  display: flex;
  gap: .6rem;
  padding: 1rem 1.5rem 1.25rem;
  border-top: 1px solid var(--line);
}
#qcmFinish { margin-left: auto; }

/* ───────────── Résultats ───────────── */

.results { width: min(44rem, calc(100vw - 1.5rem)); }
.results-body { flex: 1; overflow-y: auto; padding: 1.5rem; }

.score {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: .5rem 1.5rem;
  margin-bottom: 2rem;
}
[data-tone="high"] { --tone: var(--done); }
[data-tone="mid"] { --tone: var(--verif); }
[data-tone="low"] { --tone: var(--danger); }

.score-value {
  font: 700 clamp(3.5rem, 10vw, 4.75rem)/.9 var(--font-display);
  color: var(--tone);
  font-variant-numeric: tabular-nums;
}
.score-max { font-size: .4em; color: var(--text-muted); margin-left: .1em; }
.score-verdict { font-size: var(--step-1); font-weight: 600; }
.score-meta { color: var(--text-muted); font-size: .95rem; }
.score-bar {
  grid-column: 1 / -1;
  height: .5rem;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.score-bar span {
  display: block;
  height: 100%;
  width: var(--value, 0%);
  background: var(--tone);
  transition: width .6s var(--ease);
}

.corrections { list-style: none; display: grid; gap: .6rem; }
.correction {
  padding: .8rem 1rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: var(--radius-s);
}
.correction.is-right { border-left-color: var(--done); }
.correction.is-wrong { border-left-color: var(--danger); background: var(--bad-bg); }
.errors-only .is-right { display: none; }
.correction-q { font-weight: 600; margin-bottom: .3rem; }
.correction-n { color: var(--text-muted); }
.correction-a { font-size: .95rem; }
.correction-label { display: inline-block; min-width: 8.5rem; color: var(--text-muted); }
.correction-good { color: var(--done); font-weight: 600; }

.results-foot {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  padding: 1rem 1.5rem 1.25rem;
  border-top: 1px solid var(--line);
}
.results-foot .btn-quiet { margin-left: auto; }

/* ───────────── Statistiques ───────────── */

.stats { width: min(50rem, calc(100vw - 1.5rem)); }
.stats-body { flex: 1; overflow-y: auto; padding: 1.5rem; }
.stats-body .builder-label { margin: 2rem 0 .75rem; }

.empty { display: grid; justify-items: start; gap: 1rem; padding: 1rem 0; color: var(--text-muted); }

.figures {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  overflow: hidden;
}
.figures div { display: flex; flex-direction: column-reverse; gap: .2rem; padding: 1rem; background: var(--surface); }
.figures dt { color: var(--text-muted); font-size: .9rem; }
.figures dd { margin: 0; font: 700 var(--step-4)/1 var(--font-display); font-variant-numeric: tabular-nums; }

.chart { margin: 1.75rem 0 0; }
.chart figcaption { margin-bottom: .6rem; font-weight: 700; }
.chart-box { position: relative; height: 14rem; }

.theme-rows { list-style: none; display: grid; gap: .5rem; }
.theme-row {
  display: grid;
  grid-template-columns: 8rem 1fr 3.5rem 4.5rem;
  align-items: center;
  gap: .9rem;
}
.theme-row-name { font-weight: 600; }
.theme-row-bar { height: .5rem; background: var(--line); border-radius: 1px; position: relative; overflow: hidden; }
.theme-row-bar::before { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--value); background: var(--tone); }
.theme-row-score { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.theme-row-count { color: var(--text-muted); font-size: .9rem; }
.theme-row-empty { color: var(--text-muted); }

.recent-list { list-style: none; display: grid; gap: .4rem; }
.recent {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .1rem 1rem;
  width: 100%;
  padding: .7rem .9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-deep);
  text-align: left;
}
.recent:hover { border-color: var(--line-strong); }
.recent-themes { font-weight: 600; }
.recent-date { grid-column: 1; color: var(--text-muted); font-size: .9rem; }
.recent-score {
  grid-column: 2; grid-row: 1 / span 2;
  align-self: center;
  font: 700 var(--step-2)/1 var(--font-display);
  color: var(--tone);
}
.stats-note { margin-top: 1.25rem; color: var(--text-muted); font-size: .85rem; }

@media (max-width: 640px) {
  .figures { grid-template-columns: 1fr 1fr; }
  .theme-row { grid-template-columns: 5.5rem 1fr 3rem; }
  .theme-row-count { display: none; }
  .score { grid-template-columns: 1fr; }
  .correction-label { display: block; min-width: 0; font-size: .85rem; }
  .pick { grid-template-columns: auto auto 1fr auto; row-gap: 0; }
  .pick input { grid-row: 1 / span 2; }
  .pick .theme-icon { grid-row: 1 / span 2; }
  .pick-name { grid-column: 3; grid-row: 2; font-size: .85rem; }
  .pick-count { grid-row: 1 / span 2; grid-column: 4; }
  .builder-secondary { grid-template-columns: 1fr; }
  .play-foot .btn { padding-inline: .7rem; }
}

/* ───────────── Code d'accès, prénom, formulaires courts ───────────── */

.access .dialog-inner { align-items: stretch; text-align: left; }
.access .brand-mark { margin-bottom: .4rem; }
.field { display: flex; gap: .4rem; }
.field-error { min-height: 1.2em; color: var(--danger) !important; font-size: .92rem; }
.field-error:empty { min-height: 0; margin-top: -.5rem; }

/* Nouveautés (deux étapes) */
.news .dialog-inner { gap: 1rem; }
.news-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.news-badge {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .75rem; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent);
  font-size: .8rem; font-weight: 700;
}
.news-badge .icon { width: 1rem; height: 1rem; }
.news-dots { display: flex; gap: .35rem; }
.news-dots span { width: .45rem; height: .45rem; border-radius: 999px; background: var(--line-strong); transition: width .25s var(--ease), background .25s; }
.news-dots span.is-on { width: 1.3rem; background: var(--accent); }
.modal.news h2 { font-size: 1.5rem; }
.news-body { max-height: min(62vh, 30rem); overflow-y: auto; margin-inline: -.25rem; padding-inline: .25rem; outline: none; }
.news-list { list-style: none; display: grid; gap: .55rem; }
.news-item { display: flex; align-items: center; gap: .8rem; padding: .6rem .75rem; border-radius: 14px; background: var(--bg-deep); }
.news-icon {
  display: grid; place-items: center; flex: none;
  width: 2.3rem; height: 2.3rem; border-radius: 11px;
  background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--c);
}
.news-icon .icon { width: 1.25rem; height: 1.25rem; }
.news-text { display: grid; gap: .1rem; min-width: 0; }
.news-text strong { font-weight: 700; }
.news-text span { font-size: .85rem; color: var(--text-muted); line-height: 1.3; }
.news-actions { display: flex; gap: .6rem; }
.news-actions .btn-primary { flex: 1; }
.news-actions .btn .icon { width: 1.1rem; height: 1.1rem; }
@media (prefers-reduced-motion: no-preference) {
  .news-body.is-in .news-item { animation: news-in .35s var(--ease) both; }
  .news-body.is-in .news-item:nth-child(2) { animation-delay: .04s; }
  .news-body.is-in .news-item:nth-child(3) { animation-delay: .08s; }
  .news-body.is-in .news-item:nth-child(4) { animation-delay: .12s; }
  .news-body.is-in .news-item:nth-child(5) { animation-delay: .16s; }
  .news-body.is-in .news-item:nth-child(n+6) { animation-delay: .2s; }
}
@keyframes news-in { from { opacity: 0; transform: translateY(8px); } }

/* ───────────── Visite guidée ───────────── */

.tour { position: fixed; inset: 0; z-index: 1000; }
.tour-ring {
  position: fixed;
  border: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 0 0 100vmax var(--backdrop);
  pointer-events: none;
}
.tour-card {
  position: fixed;
  display: grid;
  gap: .5rem;
  padding: 1.1rem 1.2rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.tour-card h2 { font-size: var(--step-1); }
.tour-card p { color: var(--text-muted); }
.tour-count { font-size: .85rem; }
.tour-actions { display: flex; gap: .5rem; margin-top: .4rem; }
.tour-actions .btn-quiet { margin-right: auto; padding-inline: .4rem; }

/* ───────────── Notification ───────────── */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(5.5rem + env(safe-area-inset-bottom));
  z-index: 2000;
  max-width: calc(100vw - 2rem);
  padding: .8rem 1.1rem;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  transform: translate(-50%, 1rem);
  opacity: 0;
  visibility: hidden;
  transition: transform .25s var(--ease), opacity .25s, visibility .25s;
}
.toast.visible { transform: translate(-50%, 0); opacity: 1; visibility: visible; }

/* ───────────── Mobile : fenêtres plein écran ───────────── */

@media (max-width: 640px) {
  .modal:not(.small):not(.search) {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
    border: 0;
  }
  .search { margin-top: .75rem; max-height: 85vh; }
  .drawer-head { padding-left: 1rem; }
  .level-tabs, .viewer-tools, .viewer-body, .builder-body, .builder-foot,
  .play-body, .dots, .play-foot, .results-body, .results-foot, .stats-body { padding-inline: 1rem; }
  .viewer-code { font-size: var(--step-3); }
  #viewerExpand { display: none; }
}

/* ───────────── Profil et réglages ───────────── */

.profile-head { display: flex; align-items: center; gap: .9rem; }
.profile-head h2 { font-size: 1.2rem; }
.profile-sub { font-size: .85rem; }
.menu-list {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: .8rem;
  min-height: 3.1rem;
  padding: .6rem .95rem;
  border: 0;
  background: var(--bg-deep);
  color: var(--text);
  font-weight: 600;
  font-size: .95rem;
  text-align: left;
}
.menu-item + .menu-item { border-top: 1px solid var(--line); }
.menu-item:hover { background: var(--surface-2); }
.menu-item > .icon:first-child { color: var(--text-muted); }
.menu-item.danger, .menu-item.danger > .icon:first-child { color: var(--danger); }
.menu-chevron { margin-left: auto; color: var(--text-muted); width: 1.1rem; height: 1.1rem; }

.switch {
  position: relative;
  margin-left: auto;
  width: 2.6rem; height: 1.5rem;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background-color .2s;
}
.switch::after {
  content: "";
  position: absolute;
  top: .2rem; left: .2rem;
  width: 1.1rem; height: 1.1rem;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s var(--ease);
}
[aria-checked="true"] > .switch { background: var(--accent); }
[aria-checked="true"] > .switch::after { transform: translateX(1.1rem); }

@media (min-width: 1000px) {
  .toast { bottom: 1.5rem; }
}

/* Fenêtres courtes : panneau qui monte du bas sur mobile */
@media (max-width: 640px) {
  /* Ancré explicitement en bas : certains navigateurs mobiles (moteurs plus anciens) calculent mal
     la hauteur d'un <dialog> centré par « margin: auto » et n'en montraient qu'une bande de 1 à 2 cm. */
  .modal.small {
    position: fixed;
    inset: auto 0 0 0;
    top: auto;
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    height: auto;
    min-height: 0;
    max-height: 92vh;
    max-height: 92dvh;
    margin: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 20px 20px 0 0;
    border-width: 1px 0 0;
  }
  .modal.small .dialog-inner {
    height: auto;
    max-height: none;
    padding-bottom: calc(1.6rem + env(safe-area-inset-bottom));
  }
  .modal.small[open] { animation: sheet-up .25s var(--ease); }
  .viewer-head { padding-left: 1rem; }
  .viewer-tools { display: grid; grid-template-columns: 1fr auto; gap: .5rem .75rem; }
  .viewer-tools .filter { grid-column: 1 / -1; }
  #viewerToggleAll { justify-self: end; min-height: 2rem; padding-block: .25rem; }
  .viewer-foot { padding-inline: 1rem; }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: .4; } }

/* ───────────── Écran d'accès ───────────── */

body.locked .app-nav,
body.locked .home,
body.locked .tabbar { display: none; }

.auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--bg);
}

/* Présentation (ordinateur) */
.auth-aside {
  position: relative;
  display: none;
  overflow: hidden;
  padding: 3rem;
  background:
    radial-gradient(70% 60% at 0% 0%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 70%),
    radial-gradient(60% 60% at 100% 100%, rgba(56, 189, 248, .16), transparent 70%),
    #0B1728;
  color: #EAF0F7;
}
.auth-aside-inner {
  position: static;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  height: 100%;
  max-width: 30rem;
}
.auth-pitch {
  position: relative;
  margin-top: auto;
  font-size: clamp(1.9rem, 2.6vw, 2.6rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.02em;
}
.auth-points { list-style: none; display: grid; gap: .9rem; color: #B6C4D6; }
.auth-points li { display: flex; align-items: center; gap: .75rem; }
.auth-points .icon {
  flex: none;
  width: 2.25rem; height: 2.25rem;
  padding: .5rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, .07);
  color: #FFB066;
}
.auth-tiles {
  position: absolute;
  right: 4rem;
  top: 4.5rem;
  display: grid;
  grid-template-columns: repeat(2, 4.5rem);
  gap: 1rem;
  rotate: -12deg;
  opacity: .9;
}
.auth-tiles > span {
  display: grid;
  place-items: center;
  width: 4.5rem; height: 4.5rem;
  border-radius: 20px;
  background: color-mix(in srgb, var(--c) 22%, #12223A);
  border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
  color: var(--c);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .35);
}
.auth-tiles > span:nth-child(even) { translate: 0 2.25rem; }
.auth-tiles .icon { width: 1.8rem; height: 1.8rem; }

/* Formulaire */
.auth-main {
  display: grid;
  place-items: center;
  padding: 2.5rem 1.25rem;
}
.auth-card { width: min(25rem, 100%); }
.auth-card form, .auth-card [data-view] { display: grid; gap: 1.15rem; }
.auth-card [data-view][hidden], .auth-card [data-tabs][hidden] { display: none; }

.auth-brand { display: flex; align-items: center; gap: .75rem; }
.auth-brand-name { display: grid; font-weight: 700; font-size: 1.15rem; letter-spacing: -.01em; line-height: 1.2; }
.auth-brand-name small { font-size: .78rem; font-weight: 600; letter-spacing: .02em; opacity: .65; }
.auth-aside .brand-logo { box-shadow: 0 0 0 1px rgba(255, 255, 255, .16), 0 10px 30px rgba(0, 0, 0, .4); }
.auth-brand-mobile { margin-bottom: 2rem; }

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .25rem;
  margin-bottom: 1.5rem;
  padding: .3rem;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.auth-tabs button {
  min-height: 2.5rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  transition: background-color .2s, color .2s;
}
.auth-tabs button[aria-selected="true"] {
  background: var(--bg-deep);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25), inset 0 0 0 1px var(--line);
}

.auth-head { display: grid; gap: .25rem; }
.auth-title { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.auth-text { color: var(--text-muted); font-size: .95rem; line-height: 1.5; }
.auth-text strong { color: var(--text); font-weight: 600; }
.auth-wait { display: flex; align-items: center; justify-content: center; gap: .6rem; color: var(--text-muted); padding: 2rem 0; }

.auth-or {
  display: flex;
  align-items: center;
  gap: .85rem;
  color: var(--text-muted);
  font-size: .8rem;
}
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.auth-link { color: var(--accent); font-weight: 600; text-decoration: none; }
.auth-link:hover { text-decoration: underline; }
.auth-forgot { justify-self: end; font-size: .85rem; margin-top: -.6rem; }
.auth-notice {
  padding: .7rem .85rem;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--text);
  font-size: .88rem;
  line-height: 1.4;
}
.auth-switch { text-align: center; color: var(--text-muted); font-size: .9rem; }
.auth-back {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  justify-self: start;
  padding: .3rem 0;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
}
.auth-back:hover { color: var(--text); }
.auth-back .icon { width: 1rem; height: 1rem; }
.auth-account {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .7rem .9rem;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: .92rem;
  overflow-wrap: anywhere;
}
.auth-account .icon { width: 1.1rem; height: 1.1rem; color: var(--text-muted); flex: none; }

.auth-error {
  display: flex;
  gap: .5rem;
  padding: .7rem .9rem;
  border-radius: 12px;
  background: var(--bad-bg);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  color: var(--text);
  font-size: .9rem;
}
.auth-error:empty { display: none; }
.auth-success {
  padding: .75rem .9rem;
  border-radius: 12px;
  background: var(--good-bg);
  border: 1px solid color-mix(in srgb, var(--done) 35%, transparent);
  color: var(--text);
  font-size: .92rem;
}
.auth-status {
  display: grid;
  place-items: center;
  width: 3.5rem; height: 3.5rem;
  border-radius: 16px;
  background: color-mix(in srgb, var(--tone, var(--accent)) 16%, transparent);
  color: var(--tone, var(--accent));
}
.auth-status[data-tone="wait"] { --tone: var(--wait); }
.auth-status .icon { width: 1.6rem; height: 1.6rem; }

/* Champs avec icône et libellé posé sur la bordure */
.input-group { position: relative; display: grid; gap: .35rem; }
.input-box { position: relative; display: block; }
.input-label {
  position: absolute;
  top: 0;
  left: .8rem;
  translate: 0 -50%;
  padding: 0 .4rem;
  background: var(--bg);
  font-size: .78rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-muted);
  pointer-events: none;
  transition: color .15s;
}
.input-icon {
  position: absolute;
  left: .95rem;
  top: 50%;
  translate: 0 -50%;
  width: 1.1rem; height: 1.1rem;
  color: var(--text-muted);
  pointer-events: none;
  transition: color .15s;
}
/* Petit trait vertical entre l'icône et la saisie */
.input-box::before {
  content: "";
  position: absolute;
  left: 2.65rem;
  top: 50%;
  translate: 0 -50%;
  width: 1px;
  height: 1.25rem;
  background: var(--line-strong);
  pointer-events: none;
}
.input-box input {
  min-height: 3.1rem;
  padding: .7rem .9rem .7rem 3.25rem;
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  background: transparent;
  font-size: 1rem;
  transition: border-color .15s, box-shadow .15s;
}
.input-box input::placeholder { color: color-mix(in srgb, var(--text-muted) 65%, transparent); }
.input-box input:hover { border-color: var(--text-muted); }
.input-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}
.input-group:focus-within .input-label,
.input-group:focus-within .input-icon { color: var(--accent); }
.input-box input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 100px var(--bg) inset;
  caret-color: var(--text);
}
.input-box input#signinPassword, .input-box input#signupPassword { padding-right: 3rem; }

/* États : erreur (rouge) et valide (vert) */
.input-ok {
  position: absolute;
  right: .95rem;
  top: 50%;
  translate: 0 -50%;
  width: 1.1rem; height: 1.1rem;
  color: var(--done);
  opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
}
.input-group[data-state="valid"] .input-ok { opacity: 1; }
.input-box:has(.eye-btn) .input-ok { right: 2.9rem; }
.input-group[data-state="valid"] input { border-color: color-mix(in srgb, var(--done) 75%, transparent); }
.input-group[data-state="valid"] .input-label,
.input-group[data-state="valid"] .input-icon { color: var(--done); }
.input-group[data-state="error"] input { border-color: var(--danger); }
.input-group[data-state="error"] input:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 16%, transparent); }
.input-group[data-state="error"] .input-label,
.input-group[data-state="error"] .input-icon { color: var(--danger); }

.input-msg {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding-left: .4rem;
  font-size: .8rem;
  font-weight: 500;
  color: var(--danger);
}
.input-msg:empty { display: none; }
.input-msg .icon { width: .95rem; height: .95rem; flex: none; }

.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; align-items: start; }
.field .btn { flex: none; }

/* Bouton œil */
.eye-btn {
  position: absolute;
  top: 50%;
  right: .4rem;
  translate: 0 -50%;
  display: grid;
  place-items: center;
  width: 2.25rem; height: 2.25rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
}
.eye-btn:hover { color: var(--text); background: var(--surface-2); }
.eye-btn .icon { width: 1.15rem; height: 1.15rem; }

/* Jauge de mot de passe : barres et libellé sur une seule ligne */
.pw-row { display: flex; align-items: center; gap: .75rem; margin-top: -.45rem; padding: 0 .4rem; }
.pw-strength { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: .3rem; }
.pw-strength span { height: .25rem; border-radius: 999px; background: var(--line); transition: background-color .2s; }
.pw-strength[data-level="1"] span:nth-child(-n+1) { background: var(--danger); }
.pw-strength[data-level="2"] span:nth-child(-n+2) { background: var(--verif); }
.pw-strength[data-level="3"] span:nth-child(-n+3) { background: var(--done); }
.pw-strength[data-level="4"] span { background: var(--done); }
.pw-strength-text { flex: none; min-width: 4.5rem; text-align: right; font-size: .78rem; color: var(--text-muted); }

/* Boutons de l'écran d'accès */
.auth .btn-large { min-height: 3rem; border-radius: 12px; font-size: 1rem; gap: .5rem; }
.auth .btn-large .icon { width: 1.1rem; height: 1.1rem; transition: translate .2s var(--ease); }
.auth .btn-large:hover .icon { translate: 3px 0; }
.btn-google {
  min-height: 3rem;
  border-radius: 12px;
  background: #fff;
  border-color: #DADCE0;
  color: #1F1F1F;
  font-weight: 600;
  gap: .6rem;
}
.btn-google:hover:not(:disabled) { background: #F6F8FB; border-color: #C4C7CC; }
.google-g { width: 1.2rem; height: 1.2rem; }

.btn[aria-busy="true"] { opacity: .75; pointer-events: none; }
.btn[aria-busy="true"] .icon { display: none; }
.btn[aria-busy="true"]::after, .spinner {
  content: "";
  display: inline-block;
  width: 1rem; height: 1rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 960px) {
  .auth { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .auth-aside { display: block; }
  .auth-brand-mobile { display: none; }
}
@media (max-width: 480px) {
  .auth-main { place-items: start center; padding-top: 1.5rem; }
  .auth-brand-mobile { margin-bottom: 1.25rem; }
  .auth-title { font-size: 1.35rem; }
  .field-pair { gap: .6rem; }
  .field-pair .input-box input { padding-left: 2.6rem; }
  .field-pair .input-box::before { display: none; }
  .field-pair .input-icon { left: .8rem; }
}

/* ───────────── Gestion des comptes ───────────── */

.admin-tabs { margin: 0; padding: 1rem 1.5rem .5rem; }
.admin-list { list-style: none; flex: 1; overflow-y: auto; padding: .5rem 1.5rem 2rem; display: grid; grid-auto-rows: max-content; align-content: start; gap: .6rem; }
.admin-row {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: .3rem .9rem;
  align-items: center;
  padding: .85rem .9rem .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-deep);
  transition: border-color .15s;
}
.admin-row:hover { border-color: var(--line-strong); }
.admin-row > .avatar {
  width: 2.75rem; height: 2.75rem;
  background: color-mix(in srgb, var(--av, var(--accent)) 22%, var(--surface));
  color: var(--av, var(--accent));
  font-size: .95rem;
  letter-spacing: .02em;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--av, var(--accent)) 45%, transparent);
}
.admin-who { min-width: 0; display: grid; gap: .1rem; }
.admin-name { display: flex; align-items: center; gap: .45rem; font-weight: 700; font-size: 1rem; line-height: 1.25; }
.admin-meta { font-size: .85rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-sub { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem; font-size: .78rem; color: var(--text-muted); }
.admin-sub .presence { margin: 0; font-size: .78rem; }
.admin-provider { display: inline-flex; align-items: center; gap: .35rem; }
.admin-provider::before { content: ""; width: 3px; height: 3px; border-radius: 50%; background: var(--line-strong); }
.admin-role {
  flex: none;
  padding: .12rem .5rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  font-size: .7rem;
  font-weight: 700;
}
.admin-role[data-role-tag="trainer"] { background: color-mix(in srgb, #A855F7 18%, transparent); color: #C084FC; }
.admin-results { grid-column: 2 / -1; font-size: .88rem; color: var(--text-muted); }
.admin-results strong { color: var(--text); }
.admin-actions { display: flex; align-items: center; justify-content: flex-end; gap: .4rem; }
.admin-actions .btn { min-height: 2.3rem; padding: .3rem .85rem; font-size: .9rem; gap: .35rem; }
.admin-actions .btn .icon { width: 1rem; height: 1rem; }
.admin-empty { display: grid; justify-items: center; gap: .5rem; padding: 3rem 1rem; color: var(--text-muted); text-align: center; }
.admin-empty .icon { width: 2rem; height: 2rem; opacity: .6; }

/* Menu « Plus d'actions » d'une ligne */
.row-menu-wrap { position: relative; }
.row-menu-btn { width: 2.3rem; height: 2.3rem; }
.row-menu {
  position: absolute;
  top: calc(100% + .35rem);
  right: 0;
  z-index: 5;
  display: grid;
  min-width: 13.5rem;
  padding: .35rem;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: pop .15s var(--ease);
}
.row-menu-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem .7rem;
  border: 0; border-radius: 8px;
  background: none; color: var(--text);
  font: inherit; font-size: .9rem; font-weight: 600; text-align: left;
  cursor: pointer;
}
.row-menu-item:hover, .row-menu-item:focus-visible { background: var(--surface-2); outline: none; }
.row-menu-item .icon { width: 1.05rem; height: 1.05rem; color: var(--text-muted); }
.row-menu-item.danger, .row-menu-item.danger .icon { color: var(--danger); }
.drawer-sub { font-size: .85rem; color: var(--text-muted); }

.count-badge {
  margin-left: auto;
  min-width: 1.4rem;
  padding: .1rem .4rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: .75rem;
  font-weight: 700;
  text-align: center;
}
.count-badge + .menu-chevron { margin-left: .4rem; }
.has-badge { position: relative; }
.has-badge::after {
  content: "";
  position: absolute;
  top: .55rem;
  right: calc(50% - 1.1rem);
  width: .55rem; height: .55rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--bg-deep);
}
.nav-profile.has-badge::after { top: .5rem; right: .6rem; }

@media (max-width: 640px) {
  .admin-tabs, .admin-list { padding-inline: 1rem; }
  .admin-row { grid-template-columns: auto minmax(0, 1fr); }
  .admin-actions { grid-column: 1 / -1; justify-content: flex-start; padding-top: .35rem; }
  .admin-actions .row-menu-wrap { margin-left: auto; }
  .admin-results { grid-column: 1 / -1; }
}

/* ───────────── Présence et rôles (gestion des comptes) ───────────── */

.presence { display: inline-flex; align-items: center; gap: .4rem; margin-top: .25rem; font-size: .8rem; color: var(--text-muted); }
.presence-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--line-strong); }
.presence.is-online { color: var(--done); font-weight: 600; }
.presence.is-online .presence-dot { background: var(--done); box-shadow: 0 0 0 3px color-mix(in srgb, var(--done) 25%, transparent); }
.avatar.is-online { position: relative; }
.avatar.is-online::after {
  content: "";
  position: absolute;
  right: -1px; bottom: -1px;
  width: .65rem; height: .65rem;
  border-radius: 50%;
  background: var(--done);
  box-shadow: 0 0 0 2px var(--bg-deep);
}
.role-select select {
  min-height: 2.2rem;
  padding: .3rem 2rem .3rem .7rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239AAEC6' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right .5rem center / 1rem;
  font-size: .9rem;
  font-weight: 600;
  appearance: none;
}

/* ───────────── Sélection des fiches « par cœur » (admin) ───────────── */

.pc-intro { display: grid; gap: .75rem; color: var(--text-muted); font-size: .92rem; }
.pc-intro strong { color: var(--text); }
.pc-theme { border: 1px solid var(--line); border-radius: 14px; background: var(--bg-deep); overflow: hidden; }
.pc-theme-head {
  display: flex;
  cursor: pointer;
  list-style: none;
  align-items: center;
  gap: .7rem;
  padding: .7rem .9rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.pc-theme-head::-webkit-details-marker { display: none; }
details:not([open]) > .pc-theme-head { border-bottom: 0; }
.pc-chevron { width: 1.1rem; height: 1.1rem; color: var(--text-muted); transition: transform .2s var(--ease); }
details[open] > .pc-theme-head .pc-chevron { transform: rotate(180deg); }
.pc-theme-name { flex: 1; font-weight: 700; }
.pc-theme-name span { font-weight: 500; color: var(--text-muted); font-size: .88rem; }
.pc-count { font-size: .82rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.pc-list { list-style: none; }
.pc-item { display: flex; align-items: center; gap: .75rem; padding: .6rem .9rem; }
.pc-item + .pc-item { border-top: 1px solid var(--line); }
.pc-text { flex: 1; min-width: 0; display: grid; }
.pc-term { font-weight: 600; }
.pc-def { font-size: .85rem; color: var(--text-muted); }
.pc-topic { font-size: .75rem; color: var(--text-muted); opacity: .8; }
.pc-toggle {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 2.1rem;
  padding: .3rem .75rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: .82rem;
  font-weight: 600;
}
.pc-toggle .icon { width: .95rem; height: .95rem; opacity: 0; margin-left: -.5rem; transition: opacity .15s, margin .15s; }
.pc-toggle[aria-pressed="true"] { background: var(--c, var(--accent)); border-color: var(--c, var(--accent)); color: #fff; }
.pc-toggle[aria-pressed="true"] .icon { opacity: 1; margin-left: 0; }

/* Vue membre */
.pc-section { margin-bottom: 1.75rem; }
.pc-section-title { display: flex; align-items: center; gap: .6rem; margin-bottom: .25rem; padding-bottom: .6rem; border-bottom: 1px solid var(--line-strong); font-size: 1.05rem; }
.pc-section-title > span:not(.theme-icon):not(.pc-section-count) { font-weight: 500; color: var(--text-muted); font-size: .9rem; }
.pc-section-count { margin-left: auto; font-size: .8rem; color: var(--text-muted); font-weight: 600; }
.study-banner {
  display: flex;
  align-items: center;
  gap: .9rem;
  width: 100%;
  margin-bottom: 1.5rem;
  padding: .9rem 1rem;
  border: 1px solid color-mix(in srgb, #38BDF8 40%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, #38BDF8 10%, var(--surface));
  color: var(--text);
  text-align: left;
}
.study-banner > span:nth-child(2) { flex: 1; display: grid; gap: .1rem; }
.study-banner > span:nth-child(2) span { font-size: .85rem; color: var(--text-muted); }
.study-banner-icon { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 10px; background: color-mix(in srgb, #38BDF8 20%, transparent); color: #38BDF8; flex: none; }
.empty-state { display: grid; justify-items: center; gap: .5rem; padding: 3rem 1rem; text-align: center; color: var(--text-muted); }
.empty-state > .icon { width: 2.5rem; height: 2.5rem; margin-bottom: .5rem; }
.empty-state strong { color: var(--text); }

/* ───────────── Cartes mémo ───────────── */

.srs { width: min(40rem, calc(100vw - 1.5rem)); }
.srs-progress { height: 4px; background: var(--line); }
.srs-progress span { display: block; height: 100%; width: 0; background: #38BDF8; transition: width .3s var(--ease); }
.srs-body { flex: 1; overflow-y: auto; padding: 1.25rem 1.5rem 1.5rem; }
.srs-scope { display: grid; gap: .5rem; }
.srs-main {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid color-mix(in srgb, #38BDF8 45%, var(--line));
  border-radius: 16px;
  background: color-mix(in srgb, #38BDF8 10%, var(--surface));
  color: var(--text);
  text-align: left;
}
.srs-main:disabled { opacity: .7; cursor: default; border-color: var(--line); background: var(--surface); }
.srs-main > span:nth-child(2) { flex: 1; display: grid; gap: .15rem; }
.srs-main > span:nth-child(2) span { font-size: .85rem; color: var(--text-muted); }
.srs-main-count { font: 700 2.4rem/1 var(--font-display); color: #38BDF8; min-width: 2.5rem; text-align: center; }
.srs-hint { margin: .75rem 0 .25rem; font-size: .85rem; color: var(--text-muted); }
.srs-group { margin-top: .75rem; font-size: .8rem; font-weight: 600; color: var(--text-muted); }
.srs-theme {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-deep);
  color: var(--text);
  text-align: left;
}
.srs-theme:hover { border-color: color-mix(in srgb, var(--c) 55%, var(--line)); }
.srs-theme-text { flex: 1; min-width: 0; }
.srs-theme-text span { color: var(--text-muted); font-size: .88rem; }
.srs-theme-meta { display: flex; align-items: center; gap: .6rem; font-size: .8rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.srs-due { padding: .1rem .5rem; border-radius: 999px; background: color-mix(in srgb, #38BDF8 18%, transparent); color: #38BDF8; font-weight: 700; }

.srs-play { display: grid; gap: 1rem; }
.srs-meta { display: flex; justify-content: space-between; font-size: .85rem; color: var(--text-muted); font-weight: 600; }
.srs-kind[data-kind="new"] { color: #38BDF8; }
.srs-kind[data-kind="review"] { color: var(--verif); }
.srs-card {
  display: grid;
  gap: 1rem;
  min-height: 16rem;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-top: 4px solid var(--c);
  border-radius: 18px;
  background: var(--surface);
  align-content: start;
}
.srs-card-theme { display: flex; align-items: center; gap: .5rem; font-size: .82rem; color: var(--text-muted); font-weight: 600; }
.srs-card-term { font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
.srs-card-back { display: grid; gap: .75rem; padding-top: 1rem; border-top: 1px dashed var(--line-strong); animation: pop .2s var(--ease); }
.srs-card-def { font-size: 1.1rem; font-weight: 600; color: var(--c); }
.srs-flip { margin-top: auto; }
.srs-grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.srs-grade {
  display: grid;
  gap: .15rem;
  padding: .7rem .4rem;
  border: 1px solid color-mix(in srgb, var(--g) 45%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--g) 10%, var(--surface));
  color: var(--text);
  font-weight: 700;
  font-size: .92rem;
}
.srs-grade:hover, .srs-grade:focus-visible { background: color-mix(in srgb, var(--g) 22%, var(--surface)); }
.srs-next { font-size: .75rem; font-weight: 500; color: var(--text-muted); }
.srs-keys { text-align: center; font-size: .78rem; color: var(--text-muted); }
@media (hover: none) { .srs-keys { display: none; } }
.srs-end { display: grid; justify-items: center; gap: .75rem; padding: 2rem 0; text-align: center; }
.srs-end p { color: var(--text-muted); max-width: 32rem; }
.auth-status[data-tone="high"] { --tone: var(--done); }

/* ───────────── Quiz en direct ───────────── */

.live { width: min(60rem, calc(100vw - 1.5rem)); max-height: min(94vh, 54rem); }
.live-head { display: flex; justify-content: flex-end; padding: .6rem .6rem 0; }
.live-view { flex: 1; overflow-y: auto; padding: 0 1.5rem 1.75rem; }
.live-center { display: grid; justify-items: center; gap: .9rem; max-width: 24rem; margin: 0 auto; padding: 1rem 0 2rem; text-align: center; }
.live-badge {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .75rem; border-radius: 999px;
  background: color-mix(in srgb, #A855F7 18%, transparent); color: #C084FC;
  font-size: .82rem; font-weight: 700;
}
.live-badge .icon { width: 1rem; height: 1rem; }
.live-title { font-size: 1.6rem; font-weight: 700; letter-spacing: -.01em; }
.live-title-sm { font-size: .95rem; color: var(--text-muted); }
.live-text { color: var(--text-muted); }
.live-text strong { color: var(--text); }
.live-join { display: grid; gap: .8rem; width: 100%; }
.live-code-input {
  width: 100%;
  padding: .7rem 1rem;
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  background: transparent;
  text-align: center;
  font: 700 2.2rem/1 var(--font-display);
  letter-spacing: .3em;
}
.live-code-input:focus { outline: none; border-color: #A855F7; box-shadow: 0 0 0 4px color-mix(in srgb, #A855F7 20%, transparent); }
.live-error { color: var(--danger); font-size: .9rem; }
.live-error:empty { display: none; }
.live-or { display: flex; align-items: center; gap: .8rem; width: 100%; color: var(--text-muted); font-size: .8rem; }
.live-or::before, .live-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.live .btn-large { border-radius: 12px; gap: .5rem; }
.live .btn-large .icon { width: 1.1rem; height: 1.1rem; }

.live-create { display: grid; gap: 1rem; max-width: 36rem; margin: 0 auto; }
.live-settings { display: flex; flex-wrap: wrap; gap: 1.25rem; }

.live-lobby { display: grid; justify-items: center; gap: 1rem; text-align: center; padding-top: .5rem; }
.live-pin {
  padding: .5rem 1.5rem;
  border-radius: 18px;
  background: var(--text);
  color: var(--bg);
  font: 700 clamp(3rem, 10vw, 5.5rem)/1.1 var(--font-display);
  letter-spacing: .08em;
}
.live-players { width: 100%; max-width: 40rem; }
.live-players-count { font-weight: 700; margin-bottom: .6rem; }
.live-players ul { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
.live-players li { padding: .4rem .85rem; border-radius: 999px; background: var(--surface-2); font-weight: 600; animation: pop .25s var(--ease); }
.live-players .live-waiting { background: none; color: var(--text-muted); font-weight: 500; }

.live-stage { display: grid; gap: 1.25rem; }
.live-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; font-weight: 600; color: var(--text-muted); }
.live-timer {
  display: grid; place-items: center;
  width: 3.5rem; height: 3.5rem; border-radius: 50%;
  background: radial-gradient(closest-side, var(--surface) 78%, transparent 80%), conic-gradient(#A855F7 calc(var(--p) * 100%), var(--line) 0);
  color: var(--text);
  font: 700 1.4rem/1 var(--font-display);
}
.live-question { font-size: clamp(1.3rem, 3vw, 2rem); font-weight: 700; line-height: 1.25; text-align: center; }
.live-answers { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.live-answer {
  display: flex; align-items: center; gap: .85rem;
  min-height: 5rem;
  padding: 1rem 1.1rem;
  border: 0;
  border-radius: 14px;
  background: var(--col);
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  text-align: left;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .2);
}
button.live-answer:active { transform: translateY(2px); box-shadow: none; }
button.live-answer:disabled { opacity: .5; }
.live-shape { font-size: 1.5rem; line-height: 1; opacity: .9; }
.live-answered { font-variant-numeric: tabular-nums; }

.live-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; height: 11rem; align-items: end; }
.live-bar { position: relative; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.live-bar-fill { display: block; min-height: .5rem; border-radius: 10px 10px 0 0; background: var(--col); opacity: .35; transition: height .5s var(--ease); }
.live-bar.is-correct .live-bar-fill { opacity: 1; }
.live-bar-count { text-align: center; font: 700 1.3rem/1.4 var(--font-display); }
.live-bar-label { display: flex; align-items: center; justify-content: center; gap: .3rem; padding: .35rem; border-radius: 0 0 10px 10px; background: var(--col); color: #fff; font-weight: 700; }
.live-bar-label .icon { width: 1rem; height: 1rem; }
.live-correct { display: flex; align-items: center; justify-content: center; gap: .5rem; font-weight: 700; color: var(--done); font-size: 1.1rem; text-align: center; }
.live-correct .icon { width: 1.2rem; height: 1.2rem; flex: none; }
.live-board { list-style: none; display: grid; gap: .4rem; width: 100%; max-width: 32rem; margin: 0 auto; text-align: left; }
.live-board li { display: flex; align-items: center; gap: .7rem; padding: .55rem .9rem; border-radius: 10px; background: var(--surface-2); }
.live-board .board-pos { width: 1.6rem; flex: none; font-weight: 700; color: var(--text-muted); }
.live-board li:nth-child(1) .board-pos { color: #E0A100; }
.live-board .board-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-board .board-good { display: inline-flex; align-items: center; gap: .2rem; flex: none; font-size: .82rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.live-board .board-good .icon { width: .85rem; height: .85rem; color: var(--done); }
.live-board .board-score { flex: none; min-width: 3.2rem; text-align: right; font-style: normal; font-weight: 700; font-variant-numeric: tabular-nums; }
.live-board li.is-me { outline: 2px solid #A855F7; background: color-mix(in srgb, #A855F7 14%, var(--surface-2)); }
.live-board .board-gap { justify-content: center; padding: 0; background: none; color: var(--text-muted); }
.live-board-title { width: 100%; max-width: 32rem; margin: .4rem auto -.3rem; font-size: .9rem; font-weight: 700; color: var(--text-muted); text-align: left; }
.live-stage > .btn { justify-self: center; }

.live-player .live-answers { grid-template-columns: 1fr; }
.live-pulse { width: 4rem; height: 4rem; border-radius: 50%; background: #A855F7; opacity: .7; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.7); opacity: .3; } }
.live-feedback-icon { display: grid; place-items: center; width: 5rem; height: 5rem; border-radius: 50%; color: #fff; }
.live-feedback-icon .icon { width: 2.6rem; height: 2.6rem; }
.live-feedback.is-ok .live-feedback-icon { background: var(--done); }
.live-feedback.is-ko .live-feedback-icon { background: var(--danger); }
.live-points { font: 700 1.6rem/1.2 var(--font-display); }

.live-end { display: grid; justify-items: center; gap: 1.25rem; padding-top: .5rem; }
.live-podium { display: grid; grid-template-columns: repeat(3, minmax(0, 9rem)); gap: .75rem; align-items: end; min-height: 15rem; }
.podium-step { position: relative; display: grid; justify-items: center; gap: .3rem; text-align: center; min-width: 0; }
.podium-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.podium-score { font-size: .8rem; color: var(--text-muted); }
.podium-block { display: grid; place-items: center; width: 100%; border-radius: 12px 12px 0 0; font: 700 2rem/1 var(--font-display); color: #1B0B00; transform-origin: bottom; }
.step-1 .podium-block { height: 9rem; background: linear-gradient(#FFD34D, #E0A100); }
.step-2 .podium-block { height: 6.5rem; background: linear-gradient(#E2E8F0, #A8B3C2); }
.step-3 .podium-block { height: 5rem; background: linear-gradient(#F2B27A, #C77A3A); }
.podium-crown { color: #FFD34D; }
.podium-crown .icon { width: 2.2rem; height: 2.2rem; filter: drop-shadow(0 4px 10px rgba(255, 211, 77, .45)); }
.step-1 .podium-name { font-size: 1.1rem; }
.live-winner { display: flex; align-items: center; gap: .8rem; padding: .7rem 1.3rem; border-radius: 16px; background: linear-gradient(135deg, color-mix(in srgb, #FFD34D 22%, transparent), color-mix(in srgb, #A855F7 18%, transparent)); }
.live-winner > .icon { width: 2rem; height: 2rem; color: #FFD34D; flex: none; }
.live-winner span { display: grid; text-align: left; font: 700 1.5rem/1.1 var(--font-display); }
.live-winner small { font: 600 .75rem/1.3 var(--font-body, inherit); color: var(--text-muted); }
.live-win-me { display: flex; align-items: center; gap: .5rem; font: 700 1.3rem/1.2 var(--font-display); color: #FFD34D; }
.live-win-me .icon { width: 1.5rem; height: 1.5rem; }
.live-end-rest { display: grid; justify-items: center; gap: 1rem; width: 100%; text-align: center; }
.live-confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 10; }

/* Podium : le 3e, puis le 2e, puis le vainqueur montent ; la couronne tombe, puis le reste apparaît */
@media (prefers-reduced-motion: no-preference) {
  .podium-step .podium-block { animation: podium-rise .6s var(--ease) both; }
  .podium-step .podium-name, .podium-step .podium-score { animation: fade-up .4s var(--ease) both; }
  .step-3 .podium-block { animation-delay: .3s; }
  .step-3 .podium-name, .step-3 .podium-score { animation-delay: .8s; }
  .step-2 .podium-block { animation-delay: 1s; }
  .step-2 .podium-name, .step-2 .podium-score { animation-delay: 1.5s; }
  .step-1 .podium-block { animation-delay: 1.7s; }
  .step-1 .podium-name, .step-1 .podium-score { animation-delay: 2.2s; }
  .podium-crown { animation: crown-drop .7s cubic-bezier(.3, 1.6, .5, 1) 2.3s both; }
  .live-winner { animation: winner-pop .6s cubic-bezier(.3, 1.6, .5, 1) 2.5s both; }
  .live-end-rest { animation: fade-up .5s var(--ease) 3.1s both; }
}
@keyframes podium-rise { from { transform: scaleY(0); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } }
@keyframes crown-drop { from { opacity: 0; transform: translateY(-40px) rotate(-20deg) scale(.6); } }
@keyframes winner-pop { from { opacity: 0; transform: scale(.6); } }

/* Pseudo et résultats après chaque question */
.live-nick-input {
  width: 100%;
  padding: .8rem 1rem;
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  background: transparent;
  text-align: center;
  font: 700 1.5rem/1.2 var(--font-display);
}
.live-nick-input:focus { outline: none; border-color: #A855F7; box-shadow: 0 0 0 4px color-mix(in srgb, #A855F7 20%, transparent); }
.live-hint { margin-top: -.4rem; font-size: .8rem; color: var(--text-muted); }
.live-me { color: var(--text-muted); }
.live-me strong { color: var(--text); }
.link-btn { padding: 0 .2rem; border: 0; background: none; color: #C084FC; font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.live-players li.is-me { background: color-mix(in srgb, #A855F7 25%, var(--surface-2)); }
.live-feedback { max-width: 32rem; }
.live-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; width: 100%; }
.live-stats > div { position: relative; display: grid; gap: .15rem; padding: .7rem .4rem; border-radius: 12px; background: var(--surface-2); }
.live-stat-value { font: 700 1.5rem/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.live-stat-value small { font-size: .8rem; color: var(--text-muted); }
.live-stat-label { font-size: .75rem; color: var(--text-muted); }
.live-move { position: absolute; top: .35rem; right: .4rem; display: inline-flex; align-items: center; gap: .1rem; font-size: .75rem; font-weight: 700; }
.live-move .icon { width: .8rem; height: .8rem; }
.live-move.up { color: var(--done); }
.live-move.down { color: var(--danger); }
.live-next { font-size: .85rem; }
.live-center .auth-back { justify-self: center; }

@media (max-width: 640px) {
  .srs-body, .live-view { padding-inline: 1rem; }
  .srs-grades { grid-template-columns: repeat(2, 1fr); }
  .live-answers { grid-template-columns: 1fr; }
  .live-answer { min-height: 4rem; }
  .live-bars { height: 8rem; }
}

/* Choix du mode de QCM (barre du bas) */
#qcmModeSheet h2 { font-size: 1.2rem; }
.mode-list { display: grid; gap: .6rem; }
.mode-card {
  display: flex;
  align-items: center;
  gap: .9rem;
  width: 100%;
  padding: .9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-deep);
  color: var(--text);
  text-align: left;
  transition: border-color .15s, transform .15s;
}
.mode-card:active { transform: scale(.98); }
.mode-card:hover { border-color: color-mix(in srgb, var(--c) 55%, var(--line)); }
.mode-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--c) 16%, transparent);
  color: var(--c);
}
.mode-icon .icon { width: 1.3rem; height: 1.3rem; }
.mode-body { display: grid; gap: .15rem; flex: 1; min-width: 0; }
.mode-title { font-weight: 700; }
.mode-text { font-size: .85rem; color: var(--text-muted); line-height: 1.35; }
.mode-chevron { flex: none; color: var(--text-muted); }

/* Quiz en direct : thème de la question, réponse choisie, récapitulatif */
.live-theme {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  max-width: 100%;
  padding: .25rem .7rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 18%, transparent);
  color: color-mix(in srgb, var(--c) 70%, var(--text));
  font-size: .78rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live-theme::before { content: ""; flex: none; width: .5rem; height: .5rem; border-radius: 50%; background: var(--c); }
.live-stage > .live-theme { margin-bottom: -.6rem; }
.live-recap-q { display: grid; gap: .5rem; width: 100%; padding: .9rem; border-radius: 14px; background: var(--surface-2); text-align: left; }
.live-recap-q .live-theme { justify-self: start; }
.live-recap-question { font-weight: 600; }
.live-choice { display: flex; align-items: center; gap: .6rem; padding: .5rem .7rem; border-radius: 10px; border: 1.5px solid transparent; }
.live-choice > .icon { flex: none; width: 1.1rem; height: 1.1rem; }
.live-choice span { display: grid; font-weight: 700; }
.live-choice small { font-size: .72rem; font-weight: 600; color: var(--text-muted); }
.live-choice.is-ok { border-color: color-mix(in srgb, var(--done) 60%, transparent); background: color-mix(in srgb, var(--done) 12%, transparent); }
.live-choice.is-ok > .icon { color: var(--done); }
.live-choice.is-ko { border-color: color-mix(in srgb, var(--danger) 60%, transparent); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.live-choice.is-ko > .icon { color: var(--danger); }
.live-choice.is-none > .icon { color: var(--text-muted); }
.live-corrections { width: 100%; max-width: 32rem; text-align: left; }
.live-corrections .live-theme { justify-self: start; margin-bottom: .35rem; }

/* Cartes mémo : thème au hasard, mode « par cœur » */
.srs-quick { display: grid; gap: .6rem; }
.srs-main.is-random { --c: #F59E0B; border-color: color-mix(in srgb, var(--c) 45%, var(--line)); background: color-mix(in srgb, var(--c) 10%, var(--surface)); }
.srs-main-icon {
  display: grid; place-items: center; flex: none;
  width: 2.5rem; height: 2.5rem; border-radius: 12px;
  background: color-mix(in srgb, var(--c, #F59E0B) 20%, transparent); color: var(--c, #F59E0B);
}
.srs-main-icon .icon { width: 1.3rem; height: 1.3rem; }
.srs-list-link {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  width: 100%; margin-top: 1rem; padding: .8rem; border: 1px dashed var(--line-strong); border-radius: 12px;
  background: none; color: var(--text-muted); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer;
}
.srs-list-link:hover { color: var(--text); border-color: var(--text-muted); }
.srs-list-link .icon { width: 1.1rem; height: 1.1rem; }

/* Fiche d'un thème : « Mémo par cœur » à côté de « S'entraîner » (empilés sur téléphone) */
.viewer-foot { display: flex; gap: .6rem; }
.viewer-foot .btn-block { flex: 1; width: auto; min-width: 0; }
.viewer-pc { flex: none; color: #F59E0B; border-color: color-mix(in srgb, #F59E0B 50%, var(--line)); }
.viewer-pc .icon { width: 1.15rem; height: 1.15rem; }
.viewer-foot > .btn[hidden] { display: none; }
@media (max-width: 560px) {
  .viewer-foot { flex-direction: column; gap: .5rem; }
  .viewer-pc { min-height: 2.6rem; font-size: .95rem; }
}

/* Carte mémo : consigne et indice au recto */
.srs-card-ask { margin-top: .9rem; font-size: .85rem; font-weight: 600; color: var(--text-muted); }
.srs-card-ask + .srs-card-term { margin-top: .2rem; }
.srs-hint-btn {
  justify-self: start;
  display: inline-flex; align-items: center; gap: .4rem;
  margin-top: .6rem; padding: .35rem .75rem;
  border: 1px dashed var(--line-strong); border-radius: 999px;
  background: none; color: var(--text-muted);
  font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer;
}
.srs-hint-btn:hover { color: var(--text); border-color: var(--text-muted); }
.srs-hint-btn .icon { width: 1rem; height: 1rem; color: var(--c, var(--accent)); }
.srs-card-hint {
  margin-top: .6rem; padding: .55rem .8rem;
  border-left: 3px solid var(--c, var(--accent)); border-radius: 0 8px 8px 0;
  background: color-mix(in srgb, var(--c, var(--accent)) 10%, transparent);
  font-weight: 600;
}
/* Sur téléphone, pas de clavier : on masque l'aide aux raccourcis */
@media (hover: none) { .srs-keys { display: none; } }

/* ───────────── Remise à zéro de la progression (admin) ───────────── */
.reset-intro { margin: .25rem 0 1rem; color: var(--text-muted); }
.reset-intro strong { color: var(--text); }
.reset-options { display: grid; gap: .6rem; margin: 0; padding: 0; border: 0; }
.reset-option {
  display: flex; gap: .8rem; align-items: flex-start;
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.reset-option:hover { border-color: var(--line-strong); }
.reset-option:has(input:checked) { border-color: var(--danger); background: var(--bad-bg); }
.reset-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.reset-option input { flex: none; margin-top: .15rem; accent-color: var(--danger); }
.reset-option-text { display: grid; gap: .15rem; min-width: 0; }
.reset-option-text strong { font-weight: 600; }
.reset-option-text span { color: var(--text-muted); font-size: .9rem; }
.reset-option-text .reset-count { color: var(--text); font-variant-numeric: tabular-nums; }
.reset-option-text .reset-count:empty { display: none; }
.reset-warn { display: flex; gap: .45rem; align-items: center; margin: 1rem 0 0; color: var(--text-muted); font-size: .9rem; }
.reset-warn svg { width: 1rem; height: 1rem; color: var(--danger); flex: none; }

/* ───────────── Proposer une correction ───────────── */
/* Bouton discret « Signaler une erreur » (corrections, récapitulatifs, notions) */
.suggest-btn {
  display: inline-flex; align-items: center; gap: .35rem;
  margin-top: .45rem; padding: .2rem .1rem;
  border: 0; background: none;
  color: var(--text-muted);
  font: inherit; font-size: .8rem; font-weight: 600;
  cursor: pointer;
}
.suggest-btn .icon { width: .9rem; height: .9rem; }
.suggest-btn:hover { color: var(--accent); }
.suggest-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.correction .suggest-btn { display: flex; margin-left: auto; }
.live-recap-q .suggest-btn { justify-self: end; margin-top: 0; }
.entry-suggest { display: flex; justify-content: flex-end; margin-top: .6rem; padding-top: .5rem; border-top: 1px dashed var(--line); }
.entry-suggest .suggest-btn { margin-top: 0; }
.play-flag { margin-left: auto; }
.play-flag:hover { color: var(--accent); }
.srs-card-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: -.5rem -.6rem 0 0; }
.srs-flag { width: 2.2rem; height: 2.2rem; flex: none; }
.srs-flag .icon { width: 1rem; height: 1rem; }
.srs-flag:hover { color: var(--accent); }

/* Fenêtre */
@media (min-width: 641px) { .modal.small.suggest { width: min(32rem, calc(100vw - 2rem)); } }
.suggest-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: -.5rem -.6rem -.2rem 0; }
.suggest-item {
  display: grid; gap: .45rem;
  max-height: 14rem; overflow-y: auto;
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  background: var(--surface-2);
}
.modal.small .suggest-where { font-size: .78rem; font-weight: 600; color: var(--text-muted); }
.modal.small .suggest-where:empty { display: none; }
.modal.small .suggest-q { color: var(--text); font-weight: 600; line-height: 1.35; }
.modal.small .suggest-def { color: var(--text); font-size: .92rem; }
.modal.small .suggest-text { font-size: .88rem; white-space: pre-line; }
.suggest-answers { list-style: none; display: grid; gap: .3rem; margin: 0; padding: 0; font-size: .92rem; }
.suggest-answers li { display: flex; align-items: baseline; gap: .45rem; color: var(--text-muted); }
.suggest-answers li .icon { flex: none; width: .95rem; height: .95rem; align-self: center; }
.suggest-answers li.is-good { color: var(--done); font-weight: 600; }
.suggest-answers em.is-mine { color: var(--accent); }
.suggest-answers em { margin-left: auto; padding-left: .5rem; font-size: .75rem; font-style: normal; color: var(--danger); white-space: nowrap; }
.suggest-cats { margin: 0; padding: 0; border: 0; }
.suggest-cats legend, .suggest-label { margin-bottom: .45rem; padding: 0; font-weight: 600; font-size: .92rem; }
.suggest-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.suggest-chip { position: relative; cursor: pointer; }
.suggest-chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.suggest-chip span {
  display: inline-flex; align-items: center; min-height: 2.1rem;
  padding: .3rem .8rem;
  border: 1px solid var(--line-strong); border-radius: 999px;
  font-size: .86rem; font-weight: 600; color: var(--text-muted);
  transition: background-color .15s, color .15s, border-color .15s;
}
.suggest-chip:hover span { color: var(--text); }
.suggest-chip input:checked + span { background: var(--text); border-color: var(--text); color: var(--bg); }
.suggest-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.suggest-field { display: grid; }
.suggest-field textarea {
  width: 100%; min-height: 6.5rem; resize: vertical;
  padding: .65rem .8rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--bg-deep); color: var(--text);
  font: inherit; line-height: 1.45;
}
.suggest-field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.suggest-field textarea[aria-invalid="true"] { border-color: var(--danger); }
.suggest-foot { display: flex; justify-content: space-between; gap: 1rem; margin-top: .3rem; }
.suggest-foot .input-msg { margin: 0; color: var(--danger); }
.suggest-counter { margin-left: auto; font-size: .75rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.modal.small .suggest-note { font-size: .82rem; }

/* ───────────── Administration : rubriques et corrections ───────────── */
.admin-sections {
  display: flex; gap: .25rem;
  margin: .9rem 1.5rem 0; padding: .25rem;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--bg-deep);
}
.admin-section {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 2.6rem; padding: .4rem .8rem;
  border: 0; border-radius: 10px;
  background: none; color: var(--text-muted);
  font: inherit; font-weight: 700; font-size: .95rem;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.admin-section .icon { width: 1.05rem; height: 1.05rem; }
.admin-section:hover { color: var(--text); }
.admin-section[aria-selected="true"] { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.admin-section[aria-selected="true"] .icon { color: var(--accent); }
.admin-section .count-badge { margin-left: .1rem; }
.admin-section:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.admin-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.admin-panel[hidden] { display: none; }

.fix-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .25rem 1rem; padding-right: 1.5rem; }
.fix-bar .admin-tabs { flex: 1 1 auto; }
.fix-sort { display: inline-flex; align-items: center; gap: .3rem; padding-top: .5rem; }
.fix-sort-label { margin-right: .2rem; font-size: .82rem; font-weight: 600; color: var(--text-muted); }
.fix-sort label { position: relative; cursor: pointer; }
.fix-sort input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.fix-sort span:not(.fix-sort-label) {
  display: inline-flex; align-items: center; min-height: 2rem; padding: .2rem .75rem;
  border: 1px solid var(--line); border-radius: 999px;
  font-size: .85rem; font-weight: 600; color: var(--text-muted);
}
.fix-sort input:checked + span { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.fix-sort input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.fix-list { flex: 1; overflow-y: auto; padding: .5rem 1.5rem 1.5rem; display: grid; align-content: start; gap: 1.25rem; }
.fix-group { display: grid; gap: .55rem; }
.fix-group-head { display: flex; align-items: center; gap: .55rem; padding: 0 .2rem; }
.fix-group-head h3 { font-size: .95rem; font-weight: 700; }
.fix-group-n { padding: .05rem .5rem; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); font-size: .75rem; font-weight: 700; }
.fix-group-icon { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 8px; background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--c); }
.fix-group-icon .icon { width: .95rem; height: .95rem; }
.fix-group-pick, .fix-pick { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; cursor: pointer; }
.fix-items { list-style: none; display: grid; gap: .55rem; margin: 0; padding: 0; }

.fix {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .2rem .6rem; align-items: start;
  padding: .85rem .6rem .85rem .55rem;
  border: 1px solid var(--line); border-radius: 16px;
  background: var(--bg-deep);
  transition: border-color .15s, background-color .15s;
}
.fix:hover { border-color: var(--line-strong); }
.fix.is-picked { border-color: color-mix(in srgb, var(--accent) 70%, transparent); background: color-mix(in srgb, var(--accent) 7%, var(--bg-deep)); }
.fix-main { display: grid; gap: .45rem; min-width: 0; }
.fix-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .55rem; font-size: .78rem; font-weight: 600; color: var(--text-muted); }
.fix-kind { padding: .1rem .5rem; border-radius: 6px; background: color-mix(in srgb, var(--wait) 18%, transparent); color: var(--wait); font-weight: 700; }
.fix-kind[data-kind="notion"] { background: color-mix(in srgb, var(--done) 18%, transparent); color: var(--done); }
.fix-cat { color: var(--danger); }
.fix-q { font-weight: 700; line-height: 1.35; }
.fix-def { font-size: .9rem; color: var(--text-muted); }
.fix-answers { list-style: none; display: grid; gap: .2rem; margin: 0; padding: 0; font-size: .88rem; }
.fix-answers li { display: flex; align-items: baseline; gap: .4rem; color: var(--text-muted); }
.fix-answers li .icon { flex: none; width: .9rem; height: .9rem; align-self: center; }
.fix-answers li.is-good { color: var(--done); font-weight: 600; }
.fix-answers em { margin-left: .3rem; padding: 0 .4rem; border-radius: 999px; background: var(--bad-bg); color: var(--danger); font-size: .72rem; font-style: normal; font-weight: 700; }
.fix-text summary { font-size: .82rem; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.fix-text p { margin-top: .35rem; font-size: .85rem; color: var(--text-muted); white-space: pre-line; }
.fix-msg {
  margin: .1rem 0 0; padding: .6rem .8rem;
  border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0;
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  color: var(--text); font-size: .92rem; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere;
}
.fix-by { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; font-size: .8rem; }
.fix-author { font-weight: 700; }
.fix-when { color: var(--text-muted); }
.admin-role[data-role-tag="member"] { background: var(--surface-2); color: var(--text-muted); }

.fix-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem;
  padding: .8rem 1.5rem calc(.8rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.fix-all { display: inline-flex; align-items: center; gap: .55rem; font-size: .9rem; font-weight: 600; cursor: pointer; }
.fix-foot-actions { display: flex; gap: .5rem; margin-left: auto; }
.fix-foot-actions .btn { min-height: 2.5rem; padding: .35rem .9rem; font-size: .92rem; gap: .4rem; }
.fix-foot-actions .btn .icon { width: 1rem; height: 1rem; }
.btn-count { min-width: 1.4rem; padding: .05rem .4rem; border-radius: 999px; background: color-mix(in srgb, var(--on-accent) 16%, transparent); font-size: .78rem; font-weight: 700; }

@media (max-width: 640px) {
  .admin-sections { margin-inline: 1rem; }
  .fix-bar { padding-right: 1rem; }
  .fix-sort { padding: 0 0 .25rem 1rem; }
  .fix-list { padding-inline: 1rem; }
  .fix-foot { padding-inline: 1rem; }
  .fix-foot-actions { width: 100%; }
  .fix-foot-actions .btn { flex: 1; }
}

/* ───────────── Application installable ───────────── */
.install-banner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: .4rem .8rem;
  margin-bottom: 1.25rem;
  padding: .75rem .5rem .75rem .8rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}
.install-banner[hidden] { display: none; }
.install-banner img { width: 2.75rem; height: 2.75rem; border-radius: 12px; }
.install-banner-title { font-weight: 700; line-height: 1.2; }
.install-banner-sub { font-size: .82rem; color: var(--text-muted); }
.install-banner .btn { min-height: 2.3rem; padding: .3rem .9rem; font-size: .9rem; }
.install-close { width: 2rem; height: 2rem; }
.install-close .icon { width: 1rem; height: 1rem; }

.install-head { display: flex; align-items: center; gap: 1rem; }
.install-head img { flex: none; width: 3.5rem; height: 3.5rem; border-radius: 14px; box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }
.install-head p { margin-top: .2rem; font-size: .9rem; }
.install-steps { list-style: none; display: grid; gap: .55rem; margin: .2rem 0 0; padding: 0; }
.install-step {
  display: flex; align-items: center; gap: .8rem;
  padding: .75rem .9rem;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface-2);
  line-height: 1.4;
}
.install-step strong { color: var(--text); }
.install-n {
  flex: none; display: grid; place-items: center;
  width: 1.7rem; height: 1.7rem; border-radius: 50%;
  background: var(--accent); color: var(--on-accent);
  font-weight: 700; font-size: .85rem;
}
.install-glyph { display: inline-block; width: 1.15rem; height: 1.15rem; margin: 0 .1rem; vertical-align: -.2rem; color: var(--wait); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.modal.small .install-note { font-size: .82rem; }

/* ───────────── Échelon : fiches état véhicule ───────────── */
/* Avec Échelon, la barre garde 5 boutons pour que QCM reste au centre :
   Statistiques reste dans le menu Profil (« Mes statistiques ») et sur ordinateur dans le menu latéral. */
body.has-echelon .tabbar .tab[data-open="stats"] { display: none; }
.admin-role[data-role-tag="echelon"] { display: inline-flex; align-items: center; gap: .25rem; background: color-mix(in srgb, var(--wait) 16%, transparent); color: var(--wait); }
.admin-role[data-role-tag="echelon"] .icon { width: .8rem; height: .8rem; }

.modal.echelon {
  width: min(48rem, calc(100vw - 2rem));
  height: min(94vh, 60rem);
  max-height: none;
  overflow: hidden;
}
.ech { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.ech-head {
  display: flex; align-items: center; gap: .35rem;
  padding: .75rem .75rem .75rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.ech-head .icon-btn[hidden] { display: none; }
#echBack { margin-left: -.6rem; }
.ech-heading { flex: 1; min-width: 0; }
.ech-heading h2 { font-size: var(--step-1); line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ech-heading p { margin-top: .1rem; color: var(--text-muted); font-size: .85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ech-tabs { display: flex; gap: .35rem; padding: .6rem 1.25rem; border-bottom: 1px solid var(--line); overflow-x: auto; }
.ech-tabs[hidden] { display: none; }
.ech-tabs button {
  flex: 1 0 auto; min-height: 2.4rem; padding: .3rem 1rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: none; color: var(--text-muted); font: inherit; font-weight: 700; cursor: pointer;
}
.ech-tabs button[aria-selected="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.ech-main { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 1rem 1.25rem 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.ech-main > * { flex-shrink: 0; }
.ech-loading { display: grid; place-items: center; min-height: 12rem; color: var(--accent); }
.ech-loading .spinner { width: 1.8rem; height: 1.8rem; border-width: 3px; }
.ech-empty { display: grid; justify-items: center; gap: .8rem; padding: 3rem 1rem; text-align: center; color: var(--text-muted); }
.ech-empty > .icon { width: 2rem; height: 2rem; }

/* Véhicules */
.ech-group { display: grid; gap: .5rem; }
.ech-group-title { font-size: .85rem; font-weight: 700; color: var(--text-muted); }
.ech-vehs { display: grid; gap: .5rem; }
@media (min-width: 720px) { .ech-vehs { grid-template-columns: 1fr 1fr; } }
.ech-veh {
  display: flex; align-items: center; gap: .9rem;
  min-height: 4.4rem; padding: .7rem .8rem .7rem .7rem;
  border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface-2); color: inherit; font: inherit; text-align: left; cursor: pointer;
  transition: border-color .15s, transform .1s;
}
.ech-veh:hover { border-color: var(--line-strong); }
.ech-veh:active { transform: scale(.99); }
.ech-veh:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Plaque d'immatriculation : bandes bleues comme une plaque française */
.ech-plate {
  flex: none; min-width: 6.6rem; padding: .35rem .55rem;
  border: 2px solid #101826; border-radius: 6px;
  background: linear-gradient(90deg, #1F4FBF 0 .45rem, #fff .45rem calc(100% - .45rem), #1F4FBF calc(100% - .45rem));
  color: #101826; font-family: var(--font-display, inherit); font-weight: 800; font-size: 1rem; letter-spacing: .04em; text-align: center;
}
.ech-plate.is-name { background: #fff; letter-spacing: 0; }
.ech-veh-info { flex: 1; min-width: 0; display: grid; gap: .3rem; }
.ech-veh-name { font-weight: 700; }
.ech-veh-state { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; }
.ech-when { font-size: .8rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ech-chev { flex: none; width: 1.1rem; height: 1.1rem; color: var(--text-muted); }
.ech-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .12rem .55rem; border-radius: 999px;
  font-size: .78rem; font-weight: 700; white-space: nowrap;
}
.ech-chip .icon { width: .85rem; height: .85rem; }
.ech-chip.is-good { background: color-mix(in srgb, var(--done) 16%, transparent); color: var(--done); }
.ech-chip.is-bad { background: var(--bad-bg); color: var(--danger); }
.ech-chip.is-none { background: var(--surface); color: var(--text-muted); border: 1px solid var(--line); }
.ech-chip.is-draft { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }

/* Bandeau en haut de fiche */
.ech-banner {
  display: flex; align-items: center; gap: .8rem 1rem; flex-wrap: wrap;
  padding: .8rem 1rem;
  border: 1px solid color-mix(in srgb, var(--wait) 40%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--wait) 9%, var(--surface));
}
.ech-banner > div { flex: 1 1 14rem; display: grid; gap: .15rem; }
.ech-banner span { font-size: .88rem; color: var(--text-muted); }
.ech-banner.is-draft { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
.ech-banner .btn { min-height: 2.3rem; padding: .3rem .9rem; font-size: .88rem; }
.ech-banner .btn .icon { width: 1rem; height: 1rem; }

/* Sections de la fiche */
.ech-card { border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); overflow: hidden; }
.ech-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: .75rem 1rem; border-bottom: 1px solid var(--line); }
.ech-card-head h3 { font-size: 1rem; font-weight: 700; }
.ech-count { font-size: .8rem; font-weight: 700; color: var(--danger); }
.ech-fields { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; padding: .9rem 1rem 1rem; }
.ech-field { display: grid; gap: .3rem; min-width: 0; }
.ech-field.is-wide { grid-column: 1 / -1; }
.ech-field > span { font-size: .82rem; font-weight: 600; color: var(--text-muted); }
.ech input, .ech textarea {
  width: 100%; min-height: 2.6rem; padding: .5rem .7rem;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--bg-deep); color: var(--text);
  font: inherit; font-size: 16px;
}
.ech textarea { resize: vertical; line-height: 1.4; }
.ech input:focus, .ech textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }
.ech-subgroup { padding: .55rem 1rem .25rem; font-size: .78rem; font-weight: 700; color: var(--text-muted); }
.ech-item { padding: .55rem 1rem; border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.ech-card-head + .ech-item, .ech-subgroup + .ech-item { border-top: 0; }
.ech-item.is-bad { background: color-mix(in srgb, var(--danger) 8%, transparent); }
.ech-item-row { display: flex; align-items: center; gap: .5rem; min-height: 2.6rem; }
.ech-lbl { flex: 1; min-width: 0; line-height: 1.3; }
.ech-lbl.is-block { display: block; margin-bottom: .35rem; }
.ech-item-row input.is-num { width: 7.5rem; flex: none; text-align: right; }
.ech-item-row input[type="date"] { width: auto; flex: none; }
.ech-note { width: 2.3rem; height: 2.3rem; color: var(--text-muted); }
.ech-note .icon { width: 1rem; height: 1rem; }
.ech-tog {
  flex: none; display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  min-width: 8.2rem; min-height: 2.5rem; padding: .3rem .75rem;
  border: 1.5px solid; border-radius: 999px;
  font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer;
  transition: background-color .12s, color .12s, transform .08s;
}
.ech-tog .icon { width: 1rem; height: 1rem; }
.ech-tog.is-good { border-color: color-mix(in srgb, var(--done) 55%, transparent); background: color-mix(in srgb, var(--done) 13%, transparent); color: var(--done); }
.ech-tog.is-bad { border-color: var(--danger); background: var(--danger); color: #fff; }
.ech-tog:active { transform: scale(.96); }
.ech-tog:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ech-obs { margin-top: .4rem; min-height: 2.6rem; }
.ech-item.is-full { padding-block: .8rem; }

/* Barre du bas */
.ech-foot {
  display: flex; align-items: center; gap: 1rem;
  padding: .75rem 1.25rem calc(.75rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.ech-foot[hidden] { display: none; }
.ech-status { flex: 1; display: inline-flex; align-items: center; gap: .4rem; font-weight: 700; }
.ech-status .icon { width: 1.15rem; height: 1.15rem; }
.ech-status.is-good { color: var(--done); }
.ech-status.is-bad { color: var(--danger); }
.ech-foot .btn { gap: .45rem; }

/* Historique */
.ech-hist { list-style: none; display: grid; gap: .6rem; margin: 0; padding: 0; }
.ech-rec { display: grid; gap: .35rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); }
.ech-rec-top { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.ech-rec-when { font-weight: 700; }
.ech-rec-who { font-size: .88rem; color: var(--text-muted); }
.ech-rec-nc { font-size: .85rem; color: var(--danger); }
.ech-rec-acts { display: flex; gap: .5rem; margin-top: .3rem; }
.ech-rec-acts .btn { min-height: 2.4rem; padding: .3rem .9rem; font-size: .9rem; gap: .4rem; }
.ech-rec-acts .btn .icon { width: 1rem; height: 1rem; }
.ech-del { margin-left: auto; color: var(--text-muted); }
.ech-del:hover { color: var(--danger); }

/* Fenêtre de validation */
.ech-alert { display: grid; gap: .25rem; padding: .75rem .9rem; border-radius: 12px; font-size: .9rem; }
.ech-alert strong { font-size: .95rem; }
.ech-alert ul { margin: .2rem 0 0; padding-left: 1.1rem; }
.ech-alert.is-good { background: color-mix(in srgb, var(--done) 13%, transparent); color: var(--done); }
.ech-alert.is-bad { background: var(--bad-bg); color: var(--danger); }
.ech-alert.is-warn { background: color-mix(in srgb, var(--wait) 14%, transparent); color: var(--wait); }
.ech-sheet .stack-actions { flex-direction: column; }
.ech-sheet .stack-actions .btn { gap: .45rem; }
.ech-done { display: grid; place-items: center; width: 3.4rem; height: 3.4rem; border-radius: 50%; background: color-mix(in srgb, var(--done) 16%, transparent); color: var(--done); }
.ech-done .icon { width: 1.9rem; height: 1.9rem; }

@media (max-width: 640px) {
  .modal.echelon {
    position: fixed; inset: 0;
    width: 100vw; max-width: 100vw;
    height: 100vh; height: 100dvh; max-height: none;
    margin: 0; border: 0; border-radius: 0;
  }
  .ech-head { padding: calc(.5rem + env(safe-area-inset-top)) .5rem .5rem 1rem; }
  .ech-tabs, .ech-main { padding-inline: .85rem; }
  .ech-fields { grid-template-columns: 1fr; }
  .ech-tog { min-width: 7.4rem; }
  .ech-foot { padding-inline: 1rem; }
}

/* Grade (accès à Échelon) */
.grade-groups { display: grid; gap: .9rem; }
.grade-group { margin: 0; padding: 0; border: 0; }
.grade-group legend { margin-bottom: .45rem; padding: 0; font-size: .85rem; font-weight: 700; color: var(--text-muted); }
.grade-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.grade-chip { position: relative; cursor: pointer; }
.grade-chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.grade-chip span {
  display: inline-grid; place-items: center;
  min-width: 3.6rem; min-height: 2.6rem; padding: .3rem .7rem;
  border: 1px solid var(--line-strong); border-radius: 12px;
  font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; letter-spacing: .03em;
  color: var(--text-muted);
  transition: background-color .15s, color .15s, border-color .15s;
}
.grade-chip:hover span { color: var(--text); border-color: var(--text-muted); }
.grade-chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.grade-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.admin-role[data-role-tag="grade"] { background: var(--surface-2); color: var(--text); font-family: var(--font-display); letter-spacing: .03em; }
.grade-groups[hidden], .grade-group[hidden], .section-other[hidden] { display: none; }
.grade-chip span { white-space: nowrap; }
.modal.small .section-hint { margin-top: .45rem; font-size: .85rem; }
.modal.small .section-hint:empty { display: none; }
.section-other { display: grid; gap: .3rem; margin-top: .6rem; font-size: .88rem; font-weight: 600; }
.section-other small { font-weight: 500; color: var(--text-muted); }
.section-other input {
  min-height: 2.6rem; padding: .5rem .7rem;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--bg-deep); color: var(--text); font: inherit; font-size: 16px;
}
.section-other input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }
.admin-role[data-role-tag="section"] { background: var(--surface-2); color: var(--text-muted); }
