:root {
  /* Terracotta clair : fond des boutons, accents et éléments actifs. */
  --terracotta: #c27a60;
  --terracotta-dark: #a25e46; /* survol, et texte sur fond clair */
  --terracotta-tint: rgba(194, 122, 96, 0.12);
  --ground: #faf5f1;
  --sidebar: #fdfbfa; /* blanc cassé de la colonne de gauche */
  --ink: #2b2118;
  --muted: #8f8179;
  --line: #ece1da;
  --danger: #9b1c1c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Page de connexion */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.login {
  width: 100%;
  max-width: 340px;
}

/* Deux classes : la règle doit l'emporter sur .brand, définie plus bas.
   Le logotype occupe toute la largeur de la carte de connexion, bords alignés. */
.brand.login-brand {
  margin: 0 auto 1.75rem;
  max-width: none;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.5rem;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(80, 50, 40, 0.08);
}

.login-form .button { width: 100%; }

.login-footer {
  margin-top: 2.5rem;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
}

.login-footer p { margin: 0.4rem 0; }

/* Structure : colonne de gauche + contenu */

.app {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.25rem 0.75rem;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
}

/* Le mot « Gasparine » n'est plus du texte mais un dessin (voir shared/_logotype).
   Sa couleur suit currentColor, sa hauteur suit sa largeur. */
.brand {
  max-width: 170px;
  margin: 0 auto;
  color: var(--terracotta);
}

.logotype {
  display: block;
  width: 100%;
  height: auto;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.nav-link {
  display: block;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
}

.nav-link:hover { border-color: var(--terracotta); }

.nav-link.active {
  border-color: var(--terracotta);
  background: var(--terracotta-tint);
  color: var(--terracotta-dark);
  font-weight: 600;
}

.content {
  min-width: 0;
  padding: 1.5rem;
}

@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; flex-wrap: wrap; }
}

.workspace {
  display: grid;
  /* Formulaire plus étroit, page du compte rendu plus large (plus proche d'une page Word). */
  grid-template-columns: minmax(280px, 2fr) minmax(0, 3fr);
  gap: 1.5rem;
  max-width: 1400px;
}

@media (max-width: 1000px) {
  .workspace { grid-template-columns: 1fr; }
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 900px;
  margin-bottom: 1rem;
}

.page-header h1 {
  margin: 0;
  font-size: 1.4rem;
}

.card {
  background: #fff;
  border-radius: 10px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(80, 50, 40, 0.08);
}

/* Deux cadres empilés respirent au lieu de se toucher. */
.card + .card {
  margin-top: 1.5rem;
}

/* Un titre en tête de cadre ne rajoute pas de bande vide au-dessus de lui. */
.card > h2:first-child {
  margin-top: 0;
}

/* Réglage sans cadre (« Personnalisez Gasparine ») : posé sur le fond, séparé du suivant par l'espace. */
.reglage-entete { display: flex; align-items: baseline; gap: 0.75rem; margin-bottom: 0.5rem; }
.reglage-entete h2 { margin: 0; }
.reglage textarea { width: 100%; }
.etat-enregistrement { font-size: 0.7rem; color: var(--muted); }
/* Lexique posé comme les autres réglages : même écart sous le titre, et la liste repliée juste en dessous. */
.reglage .lexique-form { margin: 0; }
.reglage .lexique-form input[type="submit"] { margin-top: 0; }
.reglage .lexique-deroulant { margin-top: 0.25rem; }
.reglage + .reglage,
.reglage + .card { margin-top: 1.75rem; }

.titre-reglage { font-size: 1.1rem; }

/* Formulaires */

.report-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

label, .eyebrow {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  font-weight: 600;
}

select, textarea, input[type="text"], input[type="password"] {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  color: inherit;
}

select:focus, textarea:focus, input[type="text"]:focus, input[type="password"]:focus {
  outline: 2px solid var(--terracotta);
  border-color: transparent;
}

/* Menu des CR types bloqué après une génération. */
select:disabled {
  background: #f6f1ec;
  color: var(--muted);
  cursor: not-allowed;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Un peu d'air entre le choix du CR type et la boîte de dictée. */
.cr-type-field { margin-bottom: 1rem; }

.label-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.label-row label { margin: 0; }

/* Boutons carrés : micro de dictée, flèche d'envoi du chat. */
.icon-button {
  display: inline-flex;
  flex: 0 0 34px;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--terracotta-dark);
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--terracotta);
  background: var(--terracotta-tint);
}

.icon-button:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Dictée en cours. */
.icon-button.is-recording {
  border-color: var(--danger);
  background: #fdecec;
  color: var(--danger);
  animation: recording 1.2s ease-in-out infinite;
}

@keyframes recording {
  50% { opacity: 0.55; }
}

.icon-button-send {
  border-color: var(--terracotta);
  background: var(--terracotta);
  color: #fff;
}

.icon-button-send:hover {
  border-color: var(--terracotta-dark);
  background: var(--terracotta-dark);
}

/* « Générer / Compléter » et, en dessous, « Nouveau compte rendu ». */
.generate-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.generate-actions .button {
  margin-top: 0;
  text-align: center;
}

textarea { resize: vertical; }

.form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.button {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: 6px;
  background: var(--terracotta);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.button:hover { background: var(--terracotta-dark); }
.button:disabled { opacity: 0.6; cursor: progress; }

.button.secondary {
  margin-top: 0;
  border: 1px solid var(--terracotta);
  background: var(--terracotta-tint);
  color: var(--terracotta-dark);
}

.button.danger {
  border: 1px solid #e3b4b4;
  background: #fff;
  color: var(--danger);
}

.button.danger:hover { background: #fdecec; }

.page-header .button { margin-top: 0; }

/* Phrase d'accueil sous le titre d'une page. */
.page-header + .page-intro { margin: -0.5rem 0 1rem; max-width: 900px; }

.link {
  color: var(--terracotta-dark);
  font-weight: 500;
}

/* Éditeur Quill */

.editor .ql-toolbar.ql-snow,
.editor .ql-container.ql-snow {
  border-color: var(--line);
}

.editor .ql-toolbar.ql-snow { border-radius: 6px 6px 0 0; }
.editor .ql-container.ql-snow { border-radius: 0 0 6px 6px; background: #fff; }

.editor .ql-editor {
  min-height: 320px;
}

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

.generation-status:not(:empty) {
  margin-top: 0.75rem;
}

/* Chat « Gasparine » : panneau dépliable en bas à gauche, façon messagerie. */
.chat {
  position: fixed;
  bottom: 0;
  left: 1rem;
  z-index: 20;
  display: flex;
  flex-direction: column;
  width: max-content;
  max-width: calc(100vw - 2rem);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-width: 320px;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--terracotta);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  background: var(--terracotta);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.chat-header:hover { background: var(--terracotta-dark); }

/* Taille d'ouverture fixe ; la poignée peut l'agrandir (voir chat_controller.js). */

/* Sans cette règle, le display ci-dessous l'emporterait sur l'attribut hidden : le chat ne se replierait plus. */
.chat-panel[hidden] { display: none; }

.chat-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: var(--chat-width, 320px);
  max-width: calc(100vw - 2rem);
  border: 1px solid var(--line);
  border-bottom: none;
  background: #fff;
}

.chat-messages {
  height: var(--chat-height, 320px);
  max-height: calc(100vh - 9rem);
  overflow-y: auto;
  padding: 0.75rem;
}

/* Poubelle : posée sur la barre orange, à gauche de la poignée d'agrandissement. */
.chat-clear-form {
  position: absolute;
  top: -31px;
  right: 40px;
  z-index: 1;
  margin: 0;
}

.chat-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: #fff;
  cursor: pointer;
}

.chat-clear:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Poignée d'agrandissement : posée sur la barre orange, à droite. */
.chat-resize {
  position: absolute;
  top: -30px;
  right: 8px;
  z-index: 1;
  width: 24px;
  height: 24px;
  cursor: ne-resize;
  background:
    linear-gradient(45deg, transparent 38%, #111 38%, #111 50%, transparent 50%),
    linear-gradient(45deg, transparent 60%, #111 60%, #111 72%, transparent 72%);
}

.chat-bubble {
  margin-bottom: 0.6rem;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.05);
}

.chat-bubble-user { background: var(--terracotta-tint); }
.chat-bubble-error { background: #fdecec; }

.chat-bubble p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.4;
  white-space: pre-line;
}

.chat-author {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
}

.chat-bubble-model .chat-author { color: var(--terracotta-dark); }

.chat-form {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.6rem;
  border-top: 1px solid var(--line);
}

/* Zone de saisie qui grandit avec le texte dicté, puis défile au-delà de cinq lignes environ. */
.chat-form textarea {
  flex: 1;
  min-width: 0;
  max-height: 7.5rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  line-height: 1.35;
  resize: none;
  overflow-y: auto;
}

.chat-form textarea:focus {
  outline: 2px solid var(--terracotta);
  border-color: transparent;
}

.chat-form .icon-button {
  flex: 0 0 34px;
}

/* « Qu'en pense Gasparine ? » */
.gasparine-review {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.gasparine-review h2 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
  color: var(--terracotta-dark);
}

.gasparine-review p {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-line;
}

.gasparine-review-status { color: var(--muted); }

.gasparine-review-details {
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}

.gasparine-review-error {
  color: var(--danger);
  font-size: 0.8rem;
}

.gasparine-review-more .button {
  margin-top: 0.25rem;
  font-size: 0.85rem;
}

/* Page A4 de l'aperçu et du compte rendu : une seule feuille blanche, barre d'outils en haut
   séparée du texte par un trait fin. Times New Roman 12, interligne simple. */

.editor.word-page {
  max-width: 21cm;
  margin: 0 auto;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 6px 16px rgba(0, 0, 0, 0.08);
}

.editor.word-page .ql-toolbar.ql-snow {
  margin: 0 1.75rem;
  padding: 0.5rem 0;
  border: 0;
  border-bottom: 1px solid #e7e2dc;
  background: #fff;
}

.editor.word-page .ql-container.ql-snow {
  border: 0;
}

.editor.word-page .ql-editor {
  /* La page s'arrête à la fin du texte (hauteur minimale modeste pour un CR très court). */
  height: auto;
  min-height: 12rem;
  padding: 2rem 2.25rem 2.25rem;
  overflow: visible;
  color: #000;
  font-family: "Times New Roman", Times, serif;
  font-size: 12pt;
  /* Interligne simple de Word (1,0) : hauteur de ligne naturelle de la police. */
  line-height: normal;
}

.editor.word-page .ql-editor.ql-blank::before {
  left: 2.25rem;
  right: 2.25rem;
  font-family: "Times New Roman", Times, serif;
}

.word-page-hint {
  max-width: 21cm;
  margin: 0 auto 0.5rem;
}

/* « Modifications par rapport au CR type » : en haut à droite de la page, sur la ligne de la barre d'outils. */
.editor.word-page {
  position: relative;
}

.editor.word-page .diff-toggle {
  position: absolute;
  top: 0.4rem;
  right: 1.75rem;
  margin: 0;
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
}

.editor.word-page .diff-toggle[aria-pressed="true"] {
  background: var(--terracotta);
  color: #fff;
}

.diff-view {
  min-height: 12rem;
  padding: 3rem 2.25rem 2.25rem;
  color: #000;
  font-family: "Times New Roman", Times, serif;
  font-size: 12pt;
  line-height: normal;
}

.diff-summary {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.8rem;
}

/* Même typographie que la page : Times New Roman 12, interligne simple, texte aligné sur ses marges. */
.diff-line {
  margin: 0 -0.35rem;
  padding: 0 0.35rem;
  border-radius: 2px;
  font-family: "Times New Roman", Times, serif;
  font-size: 12pt;
  line-height: normal;
}

.diff-removed {
  background: #fde2e2;
  color: #8a1c1c;
  text-decoration: line-through;
}

.diff-added {
  background: #dcf5dc;
  color: #1e5b24;
}

/* Pendant l'écriture en direct, la page est verrouillée : barre d'outils grisée. */
.editor.word-page:has(.ql-disabled) .ql-toolbar {
  opacity: 0.35;
  pointer-events: none;
}

/* Liste des CR types */

.template-group { max-width: 900px; }

.template-group h2 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1rem;
  color: var(--terracotta-dark);
}

.template-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(80, 50, 40, 0.08);
}

.template-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--line);
}

.template-list li:last-child { border-bottom: none; }

.narrow { max-width: 900px; }

.danger-zone {
  max-width: 900px;
  margin-top: 1rem;
}

/* Compte rendu */

/* Le bouton de copie reste visible en bas de l'écran quand le compte rendu est long. */
.report-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  max-width: 21cm;
  margin: 0.25rem auto 0;
  padding: 0.5rem 0;
  /* Même fond que l'app : le texte reste lisible quand la barre passe au-dessus d'un long compte rendu. */
  background: var(--ground);
}

/* La phrase d'aide sur sa propre ligne, au-dessus des boutons : entre deux boutons, elle serait trop étroite. */
.report-actions {
  flex-wrap: wrap;
  row-gap: 0.35rem;
}

.report-actions .hint {
  flex: 1 1 100%;
  order: -1;
  margin: 0;
  text-align: right;
}

/* « Nouveau compte rendu » à gauche de la barre, la phrase d'aide et « Copier » à droite. */
.report-actions .report-actions-new {
  margin-right: auto;
}

/* Le texte d'aide peut passer sur deux lignes, pas le bouton. */
.report-actions .button {
  flex-shrink: 0;
  white-space: nowrap;
}

/* Fond opaque : le bouton reste lisible quand il passe au-dessus de la page. */
.report-actions .button.secondary {
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.report-actions .button.secondary:hover { background: var(--terracotta-tint); }

/* Colonne de droite, avant toute génération. */
.report-intro {
  max-width: 21cm;
  margin: 0 auto;
  padding: 2.5rem 1rem;
  text-align: center;
}

.report-intro-title {
  margin: 0 0 1.25rem;
  color: #000;
  font-size: 1.3rem;
  font-weight: 600;
}

.report-intro-text {
  max-width: 34rem;
  margin: 0 auto;
  font-size: 0.95rem;
  line-height: 1.55;
  white-space: pre-line;
}

/* Messages */

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

.notice {
  max-width: 900px;
  margin: 0 0 1rem;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  background: #eaf6ea;
  color: #1e5b24;
}

.alert {
  margin: 0;
  padding: 0.75rem;
  border-radius: 6px;
  background: #fdecec;
  color: var(--danger);
}

.alert ul {
  margin: 0;
  padding-left: 1.2rem;
}

/* Compteurs d'usage, sous le bouton de déconnexion, dans le compte de base uniquement. */
.usage {
  margin-top: 0.9rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.usage-reports {
  margin: 0 0 0.8rem;
  text-align: center;
  font-size: 0.76rem;
  line-height: 1.25;
  color: var(--muted);
}

.usage-reports strong {
  display: block;
  font-size: 1.35rem;
  color: var(--terracotta-dark);
}

.usage-title {
  margin: 0 0 0.4rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.usage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.7rem;
  color: var(--muted);
}

.usage-table th {
  padding-bottom: 0.25rem;
  font-weight: 600;
  text-align: right;
}

.usage-table th:first-child {
  text-align: left;
}

.usage-table td {
  padding: 0.18rem 0;
  vertical-align: top;
  line-height: 1.2;
}

.usage-table td + td {
  padding-left: 0.35rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  /* L'espace des milliers ne doit pas couper « 128 450 » en deux lignes. */
  white-space: nowrap;
}

.usage-total td {
  padding-top: 0.35rem;
  border-top: 1px solid var(--line);
  font-weight: 700;
  color: var(--ink);
}

.usage-cost {
  margin: 0.5rem 0 0;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.7rem;
  line-height: 1.4;
  color: var(--muted);
}

.usage-cost strong {
  font-size: 0.85rem;
  color: var(--ink);
  white-space: nowrap;
}

/* Précision « (10 % de …) » sous le libellé des lignes de cache. */
.usage-note {
  display: block;
  font-size: 0.62rem;
  opacity: 0.85;
}

/* Avertissement avant de quitter un compte rendu qui n'a pas été copié.
   Fenêtre native <dialog> : fond assombri et touche Échap gérés par le navigateur. */
.leave-guard {
  position: relative;
  max-width: 27rem;
  padding: 1.6rem 1.5rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 18px 40px rgba(43, 33, 24, 0.18);
}

.leave-guard::backdrop {
  background: rgba(43, 33, 24, 0.35);
}

.leave-guard-close {
  position: absolute;
  top: 0.4rem;
  right: 0.6rem;
  padding: 0.2rem 0.4rem;
  border: 0;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

.leave-guard-close:hover {
  color: var(--ink);
}

.leave-guard-message {
  margin: 0.3rem 0 1.3rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

.leave-guard-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* Filtres des compteurs : compte et période, dans une colonne de 220 px. */
.usage-filters {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}

.usage-filters select,
.usage-filters input[type="date"] {
  width: 100%;
  padding: 0.28rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 0.72rem;
  color: var(--ink);
}

.usage-filters label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  color: var(--muted);
}

.usage-filters input[type="submit"] {
  margin-top: 0.15rem;
  padding: 0.32rem;
  font-size: 0.72rem;
}

/* « Mes fichiers » : dépôt et liste des documents personnels. */
.document-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.document-name {
  flex: 1 1 12rem;
  font-weight: 600;
  word-break: break-word;
}

.document-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.document-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-left: auto;
}

.document-actions form {
  display: inline;
  margin: 0;
}

.link.danger {
  color: var(--danger);
}

/* Jauge d'espace occupé dans « Mes fichiers ». */
.quota {
  margin: 0 0 0.9rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.quota-bar {
  display: block;
  height: 6px;
  margin-top: 0.4rem;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}

.quota-bar span {
  display: block;
  height: 100%;
  background: var(--terracotta);
}

/* Menu « déplacer vers », sur chaque ligne de fichier. */
.document-move {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
}

.document-move select {
  max-width: 9rem;
  padding: 0.15rem 0.3rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  font-size: 0.8rem;
  color: var(--ink);
}

.document-move input[type="submit"] {
  padding: 0;
  border: 0;
  background: none;
  font-size: 0.9rem;
  color: var(--terracotta-dark);
  text-decoration: underline;
  cursor: pointer;
}

/* Arborescence de « Mes fichiers » : dossiers dépliables sur place. */
.tree {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tree-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.8rem;
  padding: 0.55rem 0.4rem;
  padding-left: calc(0.4rem + var(--profondeur, 0) * 1.4rem);
  border-bottom: 1px solid var(--line);
  border-radius: 6px;
}

.tree-racine > li:last-child .tree-row {
  border-bottom: none;
}

.tree-toggle {
  width: 1.2rem;
  padding: 0;
  border: 0;
  background: none;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
}

.tree-name {
  flex: 1 1 10rem;
  font-weight: 600;
  word-break: break-word;
}

.tree-actions,
.document-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-left: auto;
}

.tree-actions form,
.document-actions form {
  display: inline;
  margin: 0;
}

/* Les actions d'un dossier n'apparaissent qu'au survol : l'arbre reste lisible. */
.tree-actions {
  opacity: 0;
  transition: opacity 0.12s;
}

.tree-row:hover .tree-actions,
.tree-row:focus-within .tree-actions {
  opacity: 1;
}

.tree-rename {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  flex: 1 1 10rem;
}

.tree-rename input[type="text"] {
  flex: 1 1 auto;
  max-width: 16rem;
  padding: 0.25rem 0.4rem;
  border: 1px solid var(--terracotta);
  border-radius: 5px;
  font-size: 0.9rem;
}

.tree-vide {
  padding: 0.5rem 0.4rem;
  padding-left: calc(0.4rem + var(--profondeur, 0) * 1.4rem);
  font-size: 0.8rem;
  font-style: italic;
  color: var(--muted);
}

.tree-nouveau {
  padding-top: 0.7rem;
}

.tree-nouveau form,
.tree-actions form {
  margin: 0;
}

/* Une zone d'accueil un peu généreuse : on vise l'arbre, pas une ligne précise. */
.tree-racine {
  min-height: 6rem;
  padding: 0.2rem;
  border: 1px dashed transparent;
  border-radius: 8px;
}

.tree-racine.tree-accueille {
  border-color: var(--terracotta);
  background: var(--terracotta-tint);
}

/* Glisser-déposer : le dossier visé s'éclaire, la barre indique le niveau d'arrivée. */
.tree-row[draggable="true"] {
  cursor: grab;
}

.tree-porte {
  opacity: 0.4;
}

.tree-row.tree-cible {
  background: var(--terracotta-tint);
  outline: 2px solid var(--terracotta);
  outline-offset: -2px;
}

.tree-barre {
  height: 0;
  border-top: 2px solid var(--terracotta);
  margin-left: calc(0.4rem + var(--profondeur, 0) * 1.4rem);
  list-style: none;
}

/* Consigne attachée à un CR type : le champ, son compteur, et la pastille dans la liste. */
.report-form .hint {
  margin: 0;
}

.compteur {
  text-align: right;
  font-size: 0.75rem;
}

.consigne {
  margin-left: 0.4rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: var(--terracotta-tint);
  font-size: 0.72rem;
  color: var(--terracotta-dark);
  cursor: help;
}

/* Dictée : message d'erreur du micro, jusqu'ici caché dans l'infobulle du bouton. */
.dictation-status {
  margin: 0.3rem 0 0;
  font-size: 0.78rem;
  color: var(--danger);
}

/* Liste du lexique dans « Préférences » : une ligne par correction. */
.lexique-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.lexique-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
}

.lexique-list li:last-child {
  border-bottom: none;
}

.fixes-pair {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  flex: 1 1 12rem;
}

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

span.fixes-heard {
  font-style: italic;
  color: var(--muted);
}

span.fixes-written {
  font-weight: 600;
}

/* Lexique dans « Personnalisez Gasparine ». */
.lexique-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.8rem 0;
}

.lexique-form input[type="text"] {
  flex: 1 1 9rem;
  width: auto;
}

.lexique-form input[type="submit"] {
  flex: 0 0 auto;
}

.lexique-list li form {
  margin: 0;
}

/* Liste du lexique repliée par défaut. */
.lexique-deroulant {
  margin-top: 0.4rem;
}

.lexique-deroulant summary {
  padding: 0.4rem 0;
  font-weight: 600;
  color: var(--terracotta-dark);
  cursor: pointer;
}

/* Confirmation d'ajout au lexique : visible un instant, puis elle s'efface. */
.pastille {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: #e6f2ea;
  color: #2f7a4d;
  font-size: 0.8rem;
  font-weight: 600;
  animation: pastille-fondu 3s ease forwards;
}

@keyframes pastille-fondu {
  0%, 75% { opacity: 1; }
  100% { opacity: 0; }
}

.lexique-erreur {
  flex-basis: 100%;
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--danger);
}

.lexique-form .dictation-status {
  flex-basis: 100%;
}

/* Une entrée du lexique commun : présente, mais pas modifiable ici. */
.lexique-base .fixes-heard,
.lexique-base .fixes-written {
  color: var(--muted);
  font-weight: 400;
  font-style: italic;
}

/* Pense-bête de la page « Générer un CR » : une note jaune pâle, un peu transparente. */
.pense-bete {
  margin-top: 1rem;
  padding: 0.65rem 0.8rem 0.45rem;
  border: 1px solid rgba(214, 178, 52, 0.35);
  border-radius: 8px;
  background: rgba(255, 234, 128, 0.35);
}

.pense-bete-entete {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

.pense-bete-titre {
  font-size: 0.8rem;
  font-weight: 600;
  color: #8a6d12;
}

.pense-bete-choix {
  max-width: 12rem;
  padding: 0.1rem 0.3rem;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.6);
}

.pense-bete-etat {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--muted);
}

.pense-bete-contenu {
  width: 100%;
  min-height: 5rem;
  padding: 0.2rem 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 0.85rem;
  line-height: 1.45;
}

.pense-bete-contenu:focus {
  border: 0;
  outline: none;
  box-shadow: none;
}

.pense-bete-contenu[readonly] {
  cursor: default;
}

/* CR type : titre à gauche, nom au milieu de la ligne, modalité dans le coin. */
.entete-cr-type { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-bottom: 0.5rem; }
.champ-cr-type { display: flex; align-items: center; gap: 0.5rem; }
.champ-cr-type-coin { justify-self: end; }
.champ-cr-type label { margin: 0; }
.champ-cr-type select,
.copier-cr-type { width: auto; padding: 0.35rem 0.5rem; }
.champ-cr-type input[type="text"] { width: 14rem; padding: 0.35rem 0.5rem; }
.label-row .copier-cr-type { margin-top: 0.5rem; font-size: 0.85rem; }

@media (max-width: 800px) {
  .entete-cr-type { grid-template-columns: 1fr; justify-items: start; }
  .champ-cr-type-coin { justify-self: start; }
}

/* Liste des CR types : titre au milieu de la page, bouton dans le coin. */
.entete-cr-types { display: grid; grid-template-columns: 1fr auto 1fr; }
.entete-cr-types h1 { grid-column: 2; }
.entete-cr-types .button { justify-self: end; }
