/* L'atelier v1 : blanc, silence, précision. */

:root {
  color-scheme: light dark;
  --paper: #ffffff;
  --paper-raised: #ffffff;
  --paper-deep: #f5f5f4;
  --ink: #161616;
  --ink-2: #6e6e6e;
  --ink-3: #a6a6a4;
  --hairline: #ebebea;
  --accent: #2251cc;
  --accent-ink: #1c44ab;
  --accent-soft: rgba(34, 81, 204, 0.07);
  --danger: #b23a32;
  /* les voiles des passages annotés : de l'encre, jamais une couleur */
  --note-mark: rgba(22, 22, 22, 0.075);
  --note-mark-active: rgba(22, 22, 22, 0.15);
  --chart-surface: #fcfcfc;
  --chart-grid: #efefee;
  --chart-axis: #d6d6d4;
  /* les figures s'écrivent à l'encre, comme le texte : trait sombre, aire en
     voile, jamais de couleur criarde dans la galerie blanche */
  --fig-line: #21211e;
  --fig-bar: #3b3a35;
  --fig-area: rgba(33, 33, 30, 0.08);
  --fig-area-0: rgba(33, 33, 30, 0);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.09), 0 2px 8px rgba(0, 0, 0, 0.04);
  --sans: "Neue Haas Grotesk Text", "Helvetica Neue", Helvetica, "Inter", -apple-system, "Segoe UI", system-ui, sans-serif;
  --serif: Charter, "Iowan Old Style", Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121212;
    --paper-raised: #171717;
    --paper-deep: #1e1e1e;
    --ink: #ededec;
    --ink-2: #9c9c9a;
    --ink-3: #656563;
    --hairline: #262626;
    --accent: #85a8ee;
    --accent-ink: #9cb8f1;
    --accent-soft: rgba(133, 168, 238, 0.10);
    --danger: #d67c74;
    --note-mark: rgba(237, 237, 236, 0.10);
    --note-mark-active: rgba(237, 237, 236, 0.20);
    --chart-surface: #1b1b1b;
    --chart-grid: #272727;
    --chart-axis: #3e3e3e;
    --fig-line: #dedddb;
    --fig-bar: #a8a7a2;
    --fig-area: rgba(222, 221, 219, 0.13);
    --fig-area-0: rgba(222, 221, 219, 0);
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Un attribut bat un selecteur d'identifiant : sans cette regle, un element
   masque par le code (le tiroir, un panneau, un bouton) restait visible et
   occupait la place de ce qui aurait du disparaitre. */
[hidden] { display: none !important; }

html { height: 100%; }

body {
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }

::selection { background: rgba(34, 81, 204, 0.12); }

/* ---------- barres haute et basse ---------- */

#topbar, #statusbar {
  position: fixed;
  left: 0; right: 0;
  z-index: 30;
  display: grid;
  align-items: center;
  padding: 0 1.6rem;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: opacity 0.8s ease, margin 0.35s ease;
}

#topbar {
  top: 0;
  height: calc(3.6rem + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  grid-template-columns: 1fr auto 1fr;
}

#statusbar {
  bottom: 0;
  height: auto;
  min-height: calc(2.7rem + env(safe-area-inset-bottom));
  padding-top: 0.15rem;
  padding-bottom: calc(0.15rem + env(safe-area-inset-bottom));
  grid-template-columns: 1fr auto;
  border-top: 1px solid var(--hairline);
  font-size: 0.76rem;
  color: var(--ink-2);
  letter-spacing: 0.01em;
}

/* Sur une pièce, le texte défile sous les barres : un fond translucide y
   étale une tache grise, et le passage se devine à travers la barre. La barre
   devient opaque : on lit la pièce, on ne la voit pas à travers. */
body.piece-open #topbar, body.piece-open #statusbar {
  background: var(--paper);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.typing #topbar, body.typing #statusbar { opacity: 0.06; }
#topbar:hover, #statusbar:hover { opacity: 1 !important; }

.top-left {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.brand {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1rem;
  color: var(--ink);
  user-select: none;
  letter-spacing: 0.01em;
}

.top-actions { justify-self: end; display: flex; align-items: center; gap: 1.1rem; }

.topbtn {
  padding: 0.4rem 0.1rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  transition: color 0.2s;
}
.topbtn:hover { color: var(--ink); }
.topbtn.active {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 7px;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--ink-2);
}

/* ---------- sélecteur de mode ---------- */

.mode-switch {
  position: relative;
  display: flex;
  align-items: center;
  padding: 3px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--paper);
}
.mode-glider {
  position: absolute;
  top: 3px; bottom: 3px;
  left: 0;
  border-radius: 999px;
  background: var(--ink);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0.25, 1), width 0.3s cubic-bezier(0.32, 0.72, 0.25, 1);
  will-change: transform, width;
}
.mode-btn {
  position: relative;
  z-index: 1;
  padding: 0.32rem 0.85rem;
  border-radius: 999px;
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--ink-3);
  transition: color 0.25s;
  white-space: nowrap;
}
.mode-btn:hover { color: var(--ink); }
.mode-btn[aria-pressed="true"] { color: var(--paper); }
.mode-btn[aria-pressed="true"]:hover { color: var(--paper); }

/* ---------- la page ---------- */

#page {
  padding: calc(7rem + env(safe-area-inset-top)) 1.5rem calc(7.5rem + env(safe-area-inset-bottom));
  transition: margin-right 0.35s ease;
}

#sheet { max-width: 42rem; margin: 0 auto; }

/* le sourcil d'une page de réponse : au-dessus du titre, une ligne discrète
   qui rouvre la pièce */
.page-reponse {
  display: block;
  width: 100%;
  margin: 0 0 0.4rem;
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
  color: var(--ink-3);
  cursor: pointer;
}
.page-reponse:hover { color: var(--ink); }
.page-reponse i { font-style: italic; text-transform: none; letter-spacing: 0; }

#doc-title {
  width: 100%;
  border: 0;
  background: transparent;
  font-family: var(--sans);
  font-size: 1.85rem;
  line-height: 1.22;
  font-weight: 650;
  letter-spacing: -0.022em;
  color: var(--ink);
  margin-bottom: 2rem;
  outline: none;
}
#doc-title::placeholder { color: var(--ink-3); opacity: 0.65; font-weight: 600; }

#editor {
  width: 100%;
  min-height: 55vh;
  border: 0;
  background: transparent;
  resize: none;
  outline: none;
  font-family: var(--serif);
  font-size: 1.17rem;
  line-height: 1.8;
  color: var(--ink);
  overflow: hidden;
  caret-color: var(--accent);
}
#editor::placeholder { color: var(--ink-3); opacity: 0.8; font-style: italic; }

/* ---------- commandes de délégation clawdio: ---------- */

/* le calque sous l'éditeur : mêmes métriques que le textarea, texte transparent,
   seuls les surlignages des lignes de commande apparaissent */
#editor-wrap { position: relative; }

/* défilement au-delà de la dernière ligne : un vide sous l'éditeur, assez grand pour
   remonter la ligne qu'on écrit au tiers haut de l'écran ; absent en Lecture (le
   bloc est masqué), un clic dans ce vide ramène le curseur en fin de texte */
#editor-wrap { margin-bottom: 60vh; }
#editor-wrap #editor { position: relative; z-index: 1; display: block; }
#cmd-underlay {
  position: absolute;
  inset: 0;
  z-index: 0;
  font-family: var(--serif);
  font-size: 1.17rem;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
  color: transparent;
  pointer-events: none;
  user-select: none;
  overflow: hidden;
}
.cmdline {
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 0.1em 0.3em;
  margin: -0.1em -0.3em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.cmdline.open { background: var(--paper-deep); }

#cmd-badges { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.cmd-badge {
  position: absolute;
  transform: translateY(-50%);
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.cmd-badge .cbi {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font-family: var(--sans);
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.26rem 0.7rem;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  color: var(--ink-2);
  transition: border-color 0.2s, color 0.2s;
}
.cmd-badge.ready .cbi { border-color: var(--ink-3); color: var(--ink); }
button.cmd-badge:hover .cbi { border-color: var(--ink); color: var(--ink); }
.cmd-badge.wait .cbi { background: var(--paper-deep); font-style: italic; text-transform: none; letter-spacing: 0.03em; font-size: 0.68rem; font-weight: 500; }
.cmd-badge.done .cbi { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.cmd-badge.error .cbi { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
@media (pointer: coarse) {
  button.cmd-badge { min-height: 44px; min-width: 44px; justify-content: center; }
}

/* ---------- cartes-figures : blocs graph pliés dans la page ---------- */

/* le rectangle du bloc dans le calque : invisible au repos (la carte le couvre),
   il s'éclaire doucement quand le bloc est ouvert pour l'édition */
.figblock {
  background: transparent;
  border-radius: 10px;
  padding: 0.1em 0.3em;
  margin: -0.1em -0.3em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition: background 0.25s ease;
}
.figblock.editing { background: var(--paper-deep); }

#fig-cards { position: absolute; inset: 0; z-index: 2; pointer-events: none; }

/* la carte : un objet éditorial, pas un widget. Elle recouvre exactement le
   rectangle des lignes brutes, donc plier et ouvrir ne déplacent jamais le texte */
.fig-card {
  position: absolute;
  left: -0.4rem; right: -0.4rem;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 1.6rem;
  text-align: left;
  padding: 0.9rem 1.35rem;
  background: var(--chart-surface);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 10px 32px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  cursor: pointer;
  touch-action: pan-y;
  transition: opacity 0.22s ease, transform 0.22s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.fig-card:hover {
  border-color: var(--ink-3);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 14px 40px rgba(0, 0, 0, 0.08);
}
.fig-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fig-card.lifted {
  opacity: 0;
  transform: scale(0.985);
  pointer-events: none;
}

/* la figure remplit tout l'espace après le texte : la carte est pleine,
   proportionnée, sans creux au milieu */
.fig-card-viz {
  flex: 1 1 4rem;
  align-self: stretch;
  min-width: 3.5rem;
  display: flex;
  align-items: center;
  padding: 0.2rem 0;
}
/* sur un bloc très haut (lignes repliées sur mobile), la figure ne s'étire
   pas à l'infini : elle plafonne et se centre, la proportion reste éditoriale */
.fig-card-viz svg { display: block; width: 100%; height: 100%; max-height: 10.5rem; }

.fig-card-text { flex: 0 1 auto; max-width: 60%; display: flex; flex-direction: column; gap: 0.32rem; min-width: 0; }
.fig-card-eyebrow { display: flex; align-items: center; gap: 0.55rem; }
.fig-card-pill {
  font-family: var(--sans);
  font-size: 0.56rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--paper);
  background: var(--ink);
  border-radius: 999px;
  padding: 0.2rem 0.58rem;
}
.fig-card-kind {
  font-family: var(--sans);
  font-size: 0.68rem;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}
.fig-card-title {
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.35;
  color: var(--ink);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}
.fig-card-hint {
  font-family: var(--sans);
  font-size: 0.68rem;
  color: var(--ink-3);
}
/* bloc court : la carte est basse, la ligne d'aide s'efface */
.fig-card.compact { gap: 1.1rem; padding-top: 0.55rem; padding-bottom: 0.55rem; }
.fig-card.compact .fig-card-hint { display: none; }
.fig-card.compact .fig-card-viz { padding: 0.1rem 0; }

@media (max-width: 700px) {
  .fig-card { gap: 0.9rem; padding: 0.65rem 0.95rem; border-radius: 12px; }
  .fig-card-text { max-width: 66%; }
  .fig-card-title { font-size: 0.98rem; }
}

/* état d'attente et erreur dans la vue tâche */
.task-wait {
  font-size: 0.87rem;
  color: var(--ink-2);
  line-height: 1.6;
  background: var(--paper-deep);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.9rem;
}
.task-since { margin-top: 0.4rem; font-size: 0.74rem; color: var(--ink-3); }
.task-error {
  font-size: 0.87rem;
  color: var(--danger);
  line-height: 1.6;
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.9rem;
}

/* liste des tâches dans l'accueil Collaboration */
.task-list-title { margin-top: 1.2rem; }
.task-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  margin-bottom: 0.45rem;
  transition: border-color 0.2s;
}
.task-row:hover { border-color: var(--ink-3); }
.task-cmd {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-st {
  flex: none;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-3);
}
.task-st.st-done { color: var(--ink); font-weight: 600; }
.task-st.st-error { color: var(--danger); }

/* rendu d'une ligne de commande en mode Lecture */
.cmd-read {
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 0.5em 0.8em;
  font-size: 0.95em;
}
.cmd-read-tag {
  display: block;
  font-family: var(--sans);
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-2);
  margin-bottom: 0.3em;
}

/* ---------- sélection : pastille du panneau, barre tactile ---------- */

.sel-chip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 0.6rem;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: var(--paper-deep);
  padding: 0.55rem 0.75rem;
  margin-bottom: 1.1rem;
  position: relative;
}
.sel-chip-q {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--ink);
  line-height: 1.5;
  flex: 1 1 100%;
  padding-right: 1.8rem;
}
.sel-chip-meta { font-size: 0.72rem; color: var(--ink-3); }
.sel-chip-x {
  position: absolute;
  top: 0.2rem;
  right: 0.2rem;
  min-width: 32px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--ink-3);
  font-size: 0.95rem;
}
.sel-chip-x:hover { color: var(--ink); background: var(--paper); }
@media (pointer: coarse) {
  .sel-chip-x { min-width: 44px; min-height: 44px; top: 0; right: 0; }
  .sel-chip-q { padding-right: 2.6rem; }
}

/* la barre « agir sur la sélection », tactile uniquement */
#selbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(6.4rem + env(safe-area-inset-bottom));
  z-index: 35;
  display: none;
  align-items: center;
  gap: 0.8rem;
  background: var(--paper-raised);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 0.3rem 0.35rem 0.3rem 1.05rem;
  box-shadow: var(--shadow);
  font-size: 0.78rem;
  color: var(--ink-2);
  max-width: 92vw;
  white-space: nowrap;
  animation: toastin 0.25s ease;
}
@media (pointer: coarse) {
  #selbar:not([hidden]) { display: inline-flex; }
}

/* ---------- lecture ---------- */

.prose { font-family: var(--serif); font-size: 1.17rem; line-height: 1.8; }
.prose > * + * { margin-top: 1.05em; }
.prose h1, .prose h2, .prose h3 { font-family: var(--sans); letter-spacing: -0.015em; }
.prose h1 { font-size: 1.55rem; line-height: 1.28; margin-top: 1.7em; font-weight: 650; }
.prose h2 { font-size: 1.26rem; line-height: 1.3; margin-top: 1.6em; font-weight: 650; }
.prose h3 { font-size: 1.05rem; margin-top: 1.5em; font-weight: 650; }
.prose ul, .prose ol { padding-left: 1.5em; }
.prose li + li { margin-top: 0.3em; }
.prose blockquote {
  border-left: 2px solid var(--ink);
  padding-left: 1.2em;
  color: var(--ink-2);
  font-style: italic;
}
.prose code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.85em;
  background: var(--paper-deep);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}
.prose pre {
  background: var(--paper-deep);
  border-radius: 10px;
  padding: 1em 1.2em;
  overflow-x: auto;
}
.prose pre code { background: none; padding: 0; }
.prose hr { border: 0; border-top: 1px solid var(--hairline); margin: 2.2em auto; width: 34%; }
.prose a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose sup { font-size: 0.7em; color: var(--accent-ink); }
.prose table {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--sans);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.prose th, .prose td {
  text-align: left;
  padding: 0.55em 0.8em;
  border-bottom: 1px solid var(--hairline);
}
.prose th {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--ink-2);
  border-bottom: 1px solid var(--chart-axis);
}

/* la figure en mode Lecture : le même objet éditorial que la carte, en grand.
   Pastille noire, titre en Charter, dessin à l'encre sur surface calme */
.figure {
  background: var(--chart-surface);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 1.25rem 1.4rem 1.05rem;
  font-family: var(--sans);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 10px 32px rgba(0, 0, 0, 0.04);
}
.fig-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; }
.fig-pill {
  font-size: 0.56rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--paper);
  background: var(--ink);
  border-radius: 999px;
  padding: 0.22rem 0.6rem;
}
.fig-kind { font-size: 0.7rem; color: var(--ink-3); letter-spacing: 0.02em; }
.figure figcaption {
  margin-top: 0.75rem;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--ink-3);
}
.figure .fig-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.14rem;
  line-height: 1.35;
  color: var(--ink);
  margin-bottom: 1rem;
}
.figure svg { display: block; width: 100%; height: auto; }

/* ---------- tiroirs ---------- */

.drawer {
  position: fixed;
  top: 0; bottom: 0;
  width: min(22.5rem, 90vw);
  background: var(--paper-raised);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0.25, 1);
  box-shadow: none;
}
.drawer.left { left: 0; transform: translateX(-102%); border-right: 1px solid var(--hairline); }
.drawer.right { right: 0; transform: translateX(102%); border-left: 1px solid var(--hairline); }
.drawer.open { transform: translateX(0); box-shadow: var(--shadow); }

@media (min-width: 1180px) {
  body.agents-open #page { margin-right: min(22.5rem, 90vw); }
  body.agents-open #topbar, body.agents-open #statusbar { margin-right: min(22.5rem, 90vw); }
  .drawer.right.open { box-shadow: none; }
}

.drawer-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 1.5rem 1.4rem 1rem;
}
.drawer-head h2 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; font-weight: 600; color: var(--ink-2); }
/* les panneaux du tiroir : chacun est le contenu d'un onglet. Ils se
   repartissent la hauteur comme le tiroir le faisait pour ses listes. */
#pages-panel, #revue-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }

#doc-list { flex: 1; overflow-y: auto; list-style: none; padding: 0.2rem 0.7rem; }
#doc-list li { position: relative; }
.doc-row {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.75rem 0.75rem;
  border-radius: 10px;
  transition: background 0.15s;
}
.doc-row:hover, .doc-row.current { background: var(--paper-deep); }
.doc-row .doc-name {
  display: block;
  font-weight: 550;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 1.6rem;
}
.doc-row .doc-meta {
  display: block;
  font-size: 0.74rem;
  color: var(--ink-3);
  margin-top: 0.2rem;
  font-variant-numeric: tabular-nums;
}
.doc-del {
  position: absolute;
  top: 0.6rem; right: 0.5rem;
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--ink-3);
  opacity: 0;
  transition: opacity 0.15s;
}
#doc-list li:hover .doc-del { opacity: 1; }
.doc-del:hover { color: var(--danger); background: var(--paper-deep); }

.drawer-foot {
  padding: 1rem 1.4rem 1.3rem;
  font-size: 0.74rem;
  line-height: 1.55;
  color: var(--ink-3);
  border-top: 1px solid var(--hairline);
}

/* ---------- panneau latéral (dialogue et collaboration) ---------- */

#agents-body { flex: 1; overflow-y: auto; padding: 1.5rem 1.4rem; display: flex; flex-direction: column; }

.pane-title { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; font-weight: 600; color: var(--ink-2); margin: 0 0 0.55rem; }
.pane-sub { font-size: 0.85rem; color: var(--ink-2); line-height: 1.6; margin-bottom: 1.2rem; }
.pane-sub b { color: var(--ink); font-weight: 600; }

.sel-hint { font-size: 0.83rem; color: var(--ink-2); margin-bottom: 1.1rem; line-height: 1.55; min-height: 2.2em; }
.sel-hint b { color: var(--ink); font-weight: 600; }

.action-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.9rem 1rem;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: var(--paper);
  margin-bottom: 0.6rem;
  transition: border-color 0.2s;
}
.action-card:hover { border-color: var(--ink-3); }
.action-card b { display: block; font-size: 0.93rem; font-weight: 600; letter-spacing: -0.01em; }
.action-card span { display: block; font-size: 0.8rem; color: var(--ink-2); margin-top: 0.2rem; line-height: 1.5; }

.agents-foot {
  margin-top: auto;
  padding-top: 1.2rem;
  font-size: 0.74rem;
  color: var(--ink-3);
  line-height: 1.55;
  border-top: 1px solid var(--hairline);
}

/* mode seul, panneau jamais visible ; sécurité si ouvert par erreur */
.pane-off { margin: auto 0; text-align: center; color: var(--ink-3); font-size: 0.85rem; line-height: 1.6; }

/* ---------- dialogue (mode cognitif) ---------- */

.dlg-thread { display: flex; flex-direction: column; gap: 0.8rem; margin-bottom: 1.1rem; }

.dlg-me {
  align-self: flex-end;
  max-width: 92%;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ink-2);
  text-align: right;
}

.dlg-ia {
  align-self: stretch;
  background: var(--paper-deep);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-size: 0.87rem;
  line-height: 1.6;
}
.dlg-ia .prose { font-family: var(--sans); font-size: 0.87rem; line-height: 1.6; }
.dlg-ia .prose > * + * { margin-top: 0.6em; }
.dlg-ia .prose ul { padding-left: 1.2em; }
.dlg-ia .prose li + li { margin-top: 0.45em; }

.dlg-badge {
  display: inline-block;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--ink-2);
  margin-bottom: 0.45rem;
}

/* le sélecteur de regard : une ligne discrète au-dessus des gestes, un petit menu au toucher */
.dlg-regard { position: relative; margin-bottom: 0.45rem; }
.regard-btn { display: inline-flex; align-items: baseline; gap: 0.5rem; padding: 0.3rem 0; min-height: 34px; }
.regard-k { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-3); }
.regard-v {
  font-size: 0.78rem;
  color: var(--ink-2);
  border-bottom: 1px dotted var(--ink-3);
  transition: color 0.2s, border-color 0.2s;
}
.regard-btn:hover .regard-v { color: var(--ink); border-color: var(--ink); }
.regard-pop {
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  z-index: 5;
  width: min(20rem, 100%);
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 0.35rem;
  box-shadow: var(--shadow);
}
.regard-opt {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  transition: background 0.15s;
}
.regard-opt:hover { background: var(--paper-deep); }
.regard-opt.active { background: var(--paper-deep); }
.regard-opt b { display: block; font-size: 0.82rem; font-weight: 600; letter-spacing: -0.01em; }
.regard-opt span { display: block; font-size: 0.72rem; color: var(--ink-2); line-height: 1.45; margin-top: 0.1rem; }

.dlg-gestures { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 0.9rem; }
.chip {
  padding: 0.34rem 0.8rem;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  font-size: 0.76rem;
  color: var(--ink-2);
  transition: border-color 0.2s, color 0.2s;
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }

/* la barre de prompt : une carte, le champ grandit avec la pensée, l'envoi reste discret dans le pied */
.dlg-composer {
  border: 1px solid var(--hairline);
  border-radius: 14px;
  background: var(--paper);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.dlg-composer:focus-within {border-color: var(--accent); box-shadow: 0 0 0 3px var(--paper-deep);}
.dlg-input {
  display: block;
  width: 100%;
  min-height: calc(3 * 1.55em + 1.4rem);
  max-height: min(14em, 32vh);
  border: 0;
  background: transparent;
  padding: 0.7rem 0.9rem 0.2rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--ink);
  resize: none;
    overflow-y: hidden;
}
.dlg-input::placeholder { color: var(--ink-3); }
.dlg-composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.3rem 0.45rem 0.45rem 0.9rem;
}
.dlg-hint { font-size: 0.7rem; color: var(--ink-2); letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dlg-hint kbd { font-family: inherit; font-size: inherit; color: var(--ink-2); }
.dlg-composer .btn { margin-left: auto; flex: none; padding: 0.4rem 0.95rem; font-size: 0.78rem; }

.dlg-clear {
  font-size: 0.72rem;
  color: var(--ink-2);
  padding: 0.2rem 0;
}
.dlg-clear:hover { color: var(--ink); }
.chip:disabled { opacity: 0.4; cursor: default; }
.chip:disabled:hover { border-color: var(--hairline); color: var(--ink-2); }

/* geste réel en cours */
.dlg-pending { color: var(--ink-2); font-style: italic; }
.dots::after {
  content: "";
  display: inline-block;
  width: 1.2em;
  text-align: left;
  animation: dots 1.2s steps(4, end) infinite;
}
@keyframes dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}

.linkish {
  font: inherit;
  color: var(--ink-2);
  text-decoration: underline;
  text-decoration-color: var(--hairline);
  text-underline-offset: 3px;
  padding: 0;
}
.linkish:hover { color: var(--ink); text-decoration-color: var(--ink-3); }

/* ---------- vue geste (mode collaboration) ---------- */

.action-view .back {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  padding: 0.2rem 0;
  margin-bottom: 0.9rem;
}
.action-view .back:hover { color: var(--ink); }
.action-view h2 { font-size: 1.02rem; font-weight: 650; letter-spacing: -0.01em; margin-bottom: 0.8rem; }
.action-view .context {
  font-family: var(--serif);
  font-size: 0.88rem;
  color: var(--ink-2);
  background: var(--paper-deep);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.9rem;
  font-style: italic;
  line-height: 1.6;
  max-height: 7.5em;
  overflow: hidden;
}
.action-view textarea.describe {
  width: 100%;
  min-height: 4.2em;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--paper);
  padding: 0.65rem 0.8rem;
  font-size: 0.88rem;
  line-height: 1.5;
  resize: vertical;
    margin-bottom: 0.9rem;
  transition: border-color 0.2s;
}
.action-view textarea.describe:focus { border-color: var(--ink-3); }

.preview-zone { margin-top: 1rem; }
.sim-badge {
  display: inline-block;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--ink-2);
  background: var(--paper-deep);
  border-radius: 999px;
  padding: 0.22rem 0.65rem;
  margin-bottom: 0.55rem;
}
.preview-card {
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: var(--paper);
  padding: 0.95rem 1.05rem;
  font-size: 0.9rem;
  line-height: 1.6;
  max-height: 21rem;
  overflow-y: auto;
}
.preview-card .prose { font-size: 0.9rem; line-height: 1.6; }
/* un tableau large ne s'écrase pas dans un panneau étroit : il défile dans
   l'aperçu, et retrouve sa pleine largeur une fois inséré dans la page */
.preview-card .prose table { display: block; width: max-content; max-width: none; }
.preview-card .prose th, .preview-card .prose td { min-width: 7.5rem; }
.preview-actions { display: flex; gap: 0.5rem; margin-top: 0.8rem; }
.preview-note { font-size: 0.74rem; color: var(--ink-3); margin-top: 0.7rem; line-height: 1.55; }

/* ---------- statut, pastille ---------- */

.status-left { display: flex; align-items: baseline; gap: 1rem; font-variant-numeric: tabular-nums; }
#saved { color: var(--ink-3); font-style: italic; transition: opacity 0.8s; }
#streakinfo { color: var(--ink-3); }

#hand-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0.55rem;
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
  transition: background 0.2s;
}
#hand-chip:hover { background: var(--paper-deep); }

.minibar {
  width: 80px; height: 3px;
  border-radius: 2px;
  background: var(--hairline);
  overflow: hidden;
}
#minibar-fill {
  display: block; height: 100%;
  width: 0;
  border-radius: 2px;
  background: var(--ink);
  transition: width 0.5s ease;
}

.bigbar {
  height: 4px;
  border-radius: 2px;
  background: var(--hairline);
  overflow: hidden;
  margin: 0.2rem 0 1rem;
}
.bigbar span { display: block; height: 100%; background: var(--ink); border-radius: 2px; transition: width 0.5s ease; }

/* ---------- boutons, dialogues ---------- */

.btn {
  padding: 0.52rem 1rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 550;
  letter-spacing: 0.01em;
  transition: opacity 0.15s, border-color 0.15s, color 0.15s;
}
.btn.solid { background: var(--ink); color: var(--paper); }
.btn.solid:hover { opacity: 0.85; }
.btn.solid:disabled { opacity: 0.35; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--hairline); }
.btn.ghost:hover { color: var(--ink); border-color: var(--ink-3); }
.btn.danger { background: var(--danger); color: #fff; }

/* ---------- menu d'export : deux sorties sous le bouton Exporter ---------- */

#export-menu {
  position: fixed;
  z-index: 60;
  width: min(19.5rem, calc(100vw - 1.6rem));
  background: var(--paper-raised);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 0.4rem;
  animation: menuin 0.18s ease;
}
@keyframes menuin { from { opacity: 0; transform: translateY(-4px); } }
.export-opt {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  transition: background 0.15s;
}
.export-opt:hover, .export-opt:focus-visible { background: var(--paper-deep); }
.export-opt b { display: block; font-size: 0.88rem; font-weight: 600; letter-spacing: -0.01em; }
.export-opt span { display: block; font-size: 0.76rem; color: var(--ink-2); margin-top: 0.18rem; line-height: 1.5; }

.export-sep { height: 1px; background: var(--hairline); margin: 0.4rem 0.85rem; }
.export-toggle {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  min-height: 44px;
  text-align: left;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  transition: background 0.15s;
}
.export-toggle:hover, .export-toggle:focus-visible { background: var(--paper-deep); }
.export-toggle-text { flex: 1; min-width: 0; }
.export-toggle-text b { display: block; font-size: 0.88rem; font-weight: 600; letter-spacing: -0.01em; }
.export-toggle-text span { display: block; font-size: 0.76rem; color: var(--ink-2); margin-top: 0.18rem; line-height: 1.5; }
.export-switch {
  flex: none;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: var(--ink-3);
  position: relative;
  transition: background 0.18s ease;
}
.export-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--paper);
  transition: transform 0.18s ease;
}
.export-toggle[aria-checked="true"] .export-switch { background: var(--ink); }
.export-toggle[aria-checked="true"] .export-switch::after { transform: translateX(14px); }

#scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.18);
  z-index: 40;
  opacity: 0;
  transition: opacity 0.3s;
}
#scrim.show { opacity: 1; }

dialog {
  border: 0;
  /* une boite de dialogue est centree par sa marge : la remise a zero de
     la feuille l'avait supprimee, et la feuille d'envoi partait dans le
     coin de l'ecran. */
  margin: auto;
  border-radius: 16px;
  background: var(--paper-raised);
  color: var(--ink);
  padding: 1.8rem 1.8rem 1.5rem;
  width: min(26rem, 92vw);
  box-shadow: var(--shadow);
  font-family: var(--sans);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.22); }
dialog h2 { font-size: 1.08rem; font-weight: 650; letter-spacing: -0.015em; margin-bottom: 0.5rem; }
dialog .why { font-size: 0.87rem; color: var(--ink-2); line-height: 1.6; margin-bottom: 1.2rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.55rem; margin-top: 1.4rem; }

/* ---------- le seuil : connexion et mise en route ---------- */

#gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(1.5rem + env(safe-area-inset-top)) 1.25rem calc(1.5rem + env(safe-area-inset-bottom));
  background: var(--paper);
  overflow-y: auto;
}
/* un id bat [hidden] : sans cette règle, le seuil resterait devant la page */
#gate[hidden] { display: none; }
body.gated { overflow: hidden; }
/* avant que boot() ait tranché entre le seuil et l'atelier, on ne montre ni l'un ni
   l'autre : mieux vaut un blanc bref que l'éclair d'une page qu'on allait fermer */
body.booting > * { visibility: hidden; }
body.gated #topbar, body.gated #statusbar, body.gated #selbar, body.gated main { visibility: hidden; }

.gate-card { width: min(22rem, 100%); }
.gate-brand {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ink-3);
  margin-bottom: 2.2rem;
}
.gate-card h1 {
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.25;
  margin-bottom: 0.6rem;
}
.gate-why { font-size: 0.87rem; color: var(--ink-2); line-height: 1.6; margin-bottom: 1.8rem; }
.gate-label {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.35rem;
}
.gate-card input {
  width: 100%;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--paper-raised);
  color: var(--ink);
  padding: 0.65rem 0.8rem;
  font-size: 0.95rem;
  margin-bottom: 1.05rem;
    transition: border-color 0.2s;
}
.gate-card input:focus { border-color: var(--ink-3); }
.gate-card .btn { width: 100%; margin-top: 0.3rem; }
.gate-err { font-size: 0.82rem; color: var(--danger); line-height: 1.5; margin: -0.4rem 0 0.9rem; }
.gate-ok { font-size: 0.82rem; color: var(--ink-2); line-height: 1.5; margin: -0.4rem 0 0.9rem; }
.gate-foot { font-size: 0.8rem; color: var(--ink-3); line-height: 1.6; margin-top: 1.6rem; }
.gate-hint { font-size: 0.78rem; color: var(--ink-3); line-height: 1.5; margin: -0.7rem 0 1.1rem; }

#syncinfo { color: var(--ink-3); }

#pratique-stats .cs-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.87rem;
  color: var(--ink-2);
  margin-top: 0.5rem;
  font-variant-numeric: tabular-nums;
}
#pratique-stats .cs-row b { color: var(--ink); font-weight: 600; }

/* la section de la revue dans « Votre pratique » */
#pratique-stats .pr-sect {
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 1.5rem 0 0.1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--hairline);
}

#toast {
  position: fixed;
  bottom: calc(3.8rem + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 0.55rem 1.15rem;
  border-radius: 999px;
  font-size: 0.82rem;
  z-index: 90;
  box-shadow: var(--shadow);
  animation: toastin 0.25s ease;
  max-width: 88vw;
  text-align: center;
}
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- mobile : topbar sur deux rangées, tiroirs en feuille basse ---------- */

@media (max-width: 700px) {
  #topbar {
    height: auto;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    row-gap: 0.05rem;
    padding: calc(0.2rem + env(safe-area-inset-top)) 0.9rem 0.55rem;
  }
  .brand { display: none; }
  .top-left { grid-row: 1; grid-column: 1; gap: 0.6rem; }
  .top-actions { grid-row: 1; grid-column: 2; justify-self: end; gap: 1.05rem; }
  .mode-switch { grid-row: 2; grid-column: 1 / -1; justify-self: center; }
  .mode-btn { letter-spacing: 0.1em; }

  #page { padding: calc(8.2rem + env(safe-area-inset-top)) 1.2rem calc(6.8rem + env(safe-area-inset-bottom)); }

  #statusbar { padding-left: 0.9rem; padding-right: 0.9rem; }
  .status-left { gap: 0.7rem; }
  .minibar { width: 54px; }

  /* les deux tiroirs deviennent des feuilles qui montent du bas */
  .drawer {
    top: auto; bottom: 0; left: 0; right: 0;
    width: auto;
    max-height: 82vh;
    max-height: 82dvh;
    border-radius: 18px 18px 0 0;
  }
  .drawer.left, .drawer.right {
    transform: translateY(105%);
    border-left: 0;
    border-right: 0;
    border-top: 1px solid var(--hairline);
  }
  .drawer.open { transform: translateY(0); box-shadow: 0 -14px 44px rgba(0, 0, 0, 0.12); }
  .drawer::before {
    content: "";
    flex: none;
    width: 2.2rem;
    height: 4px;
    border-radius: 2px;
    background: var(--hairline);
    margin: 0.55rem auto 0;
  }
  .drawer-head { padding-top: 0.7rem; }
  .drawer-foot { padding-bottom: calc(0.9rem + env(safe-area-inset-bottom)); }
  #agents-body { padding: 0.9rem 1.2rem calc(1rem + env(safe-area-inset-bottom)); }
}

@media (max-width: 480px) {
  #streakinfo { display: none; }
}

/* ---------- tactile : tout doit être atteignable au doigt (44px) ---------- */

@media (pointer: coarse) {
  .topbtn { padding: 1rem 0.25rem; }
  .mode-btn { min-height: 44px; padding: 0 0.95rem; display: inline-flex; align-items: center; }
  .chip { min-height: 44px; padding: 0 1.05rem; display: inline-flex; align-items: center; }
  .btn { min-height: 44px; padding: 0.55rem 1.2rem; display: inline-flex; align-items: center; justify-content: center; }
  .back, .dlg-clear { min-height: 44px; display: inline-flex; align-items: center; }
  #hand-chip { min-height: 44px; }
  .doc-del {
    opacity: 1;
    top: 50%;
    transform: translateY(-50%);
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .doc-row { padding-right: 3rem; }
  .doc-row .doc-name { padding-right: 0; }
  .dlg-input { font-size: 16px; }
  .dlg-hint { display: none; }
  .dlg-composer .btn { min-height: 40px; padding: 0.4rem 1.1rem; }
  .action-view textarea.describe { font-size: 16px; }
  .task-row { min-height: 44px; }
  .export-opt { min-height: 44px; }
  .gate-card input { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ===== la revue =====

   Les composants de la revue : l'onglet Revue et la pile, puis la pièce, le
   panneau des notes, la feuille d'envoi, les questions. Tout vient de
   docs/revue/maquettes/revue.css, aux trois adaptations près :
   : les jetons --note-mark sont dans le :root d'en haut (avec leur valeur
     sombre) ;
   : .pile-title se coupe en deux lignes, mais sans jamais déborder ;
   : le repli « Lues récemment » a sa propre zone. */

/* ---------- tiroir des pages : onglets Pages · Revue ---------- */

.drawer-tabs { display: flex; align-items: baseline; gap: 1.3rem; }
.drawer-tab,
.pane-tab {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
  color: var(--ink-2);
  padding: 0.2rem 0;
  transition: color 0.2s;
}
.drawer-tab:hover, .pane-tab:hover { color: var(--ink); }
.drawer-tab[aria-selected="true"],
.pane-tab[aria-selected="true"] { color: var(--ink); }
/* seul le libellé est souligné, jamais le chiffre de l'onglet */
.drawer-tab[aria-selected="true"] .t,
.pane-tab[aria-selected="true"] {
  text-decoration: underline;
  text-underline-offset: 7px;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--ink-2);
}
.drawer-tab .n { margin-left: 0.4em; font-weight: 500; letter-spacing: 0.02em; color: var(--ink-2); }

/* ---------- la pile ---------- */

#revue-list { flex: 1; overflow-y: auto; list-style: none; padding: 0.2rem 0.7rem; }
#revue-list-folded {
  max-height: 40%;
  overflow-y: auto;
  list-style: none;
  padding: 0 0.7rem 0.2rem;
}
.pile-row {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.8rem 0.75rem;
  border-radius: 10px;
  transition: background 0.15s;
}
.pile-row:hover { background: var(--paper-deep); }
.pile-title {
  font-weight: 550;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  line-height: 1.35;
  overflow: hidden;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}
.pile-meta {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.74rem;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.pile-meta b { color: var(--ink); font-weight: 600; }
.pile-attente {
  margin-top: 0.3rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--ink-2);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}
.pile-row.closed .pile-title { color: var(--ink-2); font-weight: 500; }
.pile-fold { display: block; margin: 0.8rem 1.45rem 0.6rem; text-align: left; font-size: 0.74rem; color: var(--ink-2); }
.pile-fold:hover { color: var(--ink); }
/* la pile hors ligne : elle vient du cache, et elle le dit */
.pile-offline {
  font-family: var(--sans); font-size: .72rem; color: var(--ink-2);
  margin: .4rem 0 .2rem; line-height: 1.45;
}

.pile-empty {
  flex: 1;
  margin: 2rem 0.75rem 0.8rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--ink-2);
}
.pile-offline { margin: 0.1rem 1.45rem 0.6rem; font-size: 0.74rem; color: var(--ink-2); line-height: 1.5; }

/* ---------- une pièce dans la feuille ---------- */

body.piece-open #doc-title,
body.piece-open #editor-wrap,
body.piece-open #reader { display: none; }

#piece { position: relative; }

.piece-eyebrow { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem 1rem; margin-bottom: 1.1rem; }
.piece-eyebrow .k { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-2); }
.piece-eyebrow .back {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--ink-2);
  text-decoration: underline;
  text-decoration-color: var(--hairline);
  text-underline-offset: 3px;
}
.piece-eyebrow .back:hover { color: var(--ink); text-decoration-color: var(--ink-3); }
.piece-title {
  font-family: var(--sans);
  font-size: 1.85rem;
  line-height: 1.22;
  font-weight: 650;
  letter-spacing: -0.022em;
  margin-bottom: 1rem;
}
.piece-attente { font-family: var(--serif); font-style: italic; font-size: 1.04rem; line-height: 1.6; color: var(--ink-2); }
.piece-sensible { margin: -0.2rem 0 1.05rem; font-size: 0.86rem; line-height: 1.55; color: var(--ink-2); }
.piece-attente .k,
.piece-sensible .k,
.decision-label,
.avis-fold .k,
.note-section {
  font-family: var(--sans);
  font-style: normal;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-2);
}
.piece-attente .k { margin-right: 0.6rem; }
.piece-change { margin-top: 0.55rem; font-size: 0.8rem; line-height: 1.55; color: var(--ink-2); }
.piece-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  margin-top: 1.1rem;
  font-size: 0.78rem;
  color: var(--ink-2);
}
.piece-tools .linkish { font-size: 0.78rem; }
.piece-rule { border: 0; border-top: 1px solid var(--hairline); margin: 1.4rem 0 2.2rem; }
.piece-body { overflow-wrap: anywhere; }
.piece-body .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.piece-body .table-wrap table { min-width: 100%; width: max-content; }
.piece-body .piece-image { font-style: italic; color: var(--ink-3); }
.piece-end {
  margin-top: 3rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1.2rem;
}
.piece-end .linkish { font-size: 0.82rem; }
.piece-banner {
  margin-bottom: 1.4rem;
  padding: 0.7rem 0.95rem;
  border-radius: 12px;
  background: var(--paper-deep);
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--ink-2);
}

/* les voiles des passages annotés : posés par CSS.highlights, sans toucher au texte */
::highlight(revue-note) { background-color: var(--note-mark); }
::highlight(revue-note-active) { background-color: var(--note-mark-active); }

/* les numéros de marge : un calque au-dessus du texte, comme les badges clawdio: */
#revue-marks { position: absolute; inset: 0; pointer-events: none; }
.revue-mark {
  position: absolute;
  left: -2.3rem;
  width: 1.5rem;
  height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  pointer-events: auto;
  transition: background 0.15s, color 0.15s;
}
.revue-mark:hover { color: var(--ink); background: var(--paper-deep); }
.revue-mark.active { color: var(--paper); background: var(--ink); }

/* ---------- le compositeur de note : la voix de l'auteur, en serif ---------- */

.revue-composer {
  border: 1px solid var(--hairline);
  border-radius: 14px;
  background: var(--paper);
  padding: 0.85rem 0.95rem 0.6rem;
  margin-bottom: 1.2rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.revue-composer:focus-within {border-color: var(--accent); box-shadow: 0 0 0 3px var(--paper-deep);}
.rc-title {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  color: var(--ink-2);
  letter-spacing: 0.02em;
}
.rc-input {
  display: block;
  width: 100%;
  min-height: calc(3 * 1.6em);
  max-height: min(14em, 32vh);
  border: 0;
  background: transparent;
  padding: 0;
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  resize: none;
    overflow-y: hidden;
}
.rc-input::placeholder { color: var(--ink-3); font-style: italic; }
.rc-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 0.55rem; }
.rc-hint { font-size: 0.7rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-hint kbd { font-family: inherit; font-size: inherit; color: var(--ink-2); }
.rc-foot .btn { flex: none; padding: 0.4rem 0.95rem; font-size: 0.78rem; }
.rc-foot .btn[disabled] { opacity: 0.45; cursor: default; }

/* les notes gardées, dans la pièce */
.revue-notes { display: flex; flex-direction: column; gap: 0.8rem; margin-top: 0.4rem; }
.revue-note { border-left: 2px solid var(--hairline); padding: 0.1rem 0 0.1rem 0.8rem; }
.revue-note.active { border-left-color: var(--ink); }
.rn-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  background: var(--paper-deep);
  color: var(--ink-2);
  font-size: 0.6rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.rn-quote {
  margin: 0.35rem 0 0.25rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--ink-2);
}
.rn-body {
  margin: 0;
  font-family: var(--serif);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--ink);
  white-space: pre-wrap;
}
.rn-state { margin: 0.35rem 0 0; font-size: 0.68rem; color: var(--ink-2); }

/* au doigt, le panneau d'une pièce est une feuille basse : le clavier monte
   par-dessus, le texte de l'auteur reste lisible */
@media (pointer: coarse) {
  body.piece-open #drawer-agents {
    top: auto; bottom: 0; left: 0; right: 0;
    width: auto;
    max-height: 82vh;
    max-height: 82dvh;
    border-radius: 18px 18px 0 0;
    border-left: 0;
    border-right: 0;
    border-top: 1px solid var(--hairline);
    transform: translateY(105%);
  }
  body.piece-open #drawer-agents.open { transform: translateY(0); box-shadow: 0 -14px 44px rgba(0, 0, 0, 0.12); }
  body.piece-open #drawer-agents::before {
    content: "";
    flex: none;
    width: 2.2rem;
    height: 4px;
    border-radius: 2px;
    background: var(--hairline);
    margin: 0.55rem auto 0;
  }
  body.piece-open.agents-open #page,
  body.piece-open.agents-open #topbar,
  body.piece-open.agents-open #statusbar { margin-right: 0; }
}

/* ---------- la pilule sur une pièce ---------- */

.mode-btn[aria-disabled="true"] { opacity: 0.35; cursor: default; }
.mode-btn[aria-disabled="true"]:hover { color: var(--ink-3); }

/* ---------- le panneau des notes ---------- */

.pane-tabs { display: flex; align-items: baseline; gap: 1.3rem; margin-bottom: 0.9rem; }

.note-input { font-family: var(--serif); font-size: 0.98rem; line-height: 1.6; }
.note-input::placeholder { font-style: italic; }
.mirror-warn { margin-top: 0.55rem; font-size: 0.74rem; line-height: 1.5; color: var(--ink-2); }

.note-list { display: flex; flex-direction: column; margin-top: 1.2rem; }
.note-section { margin: 1.2rem 0 0.2rem; }
.note-card {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr);
  column-gap: 0.45rem;
  padding: 0.95rem 0;
  border-top: 1px solid var(--hairline);
}
.note-num {
  width: 1.3rem;
  height: 1.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--ink-3);
  margin-top: 0.05rem;
}
.note-card.active .note-num { color: var(--paper); background: var(--ink); }
.note-quote { font-family: var(--serif); font-style: italic; font-size: 0.84rem; line-height: 1.5; color: var(--ink-2); }
.note-body {
  margin-top: 0.4rem;
  font-family: var(--serif);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.note-quote + .note-body { margin-top: 0.4rem; }
.note-state { margin-top: 0.45rem; font-size: 0.7rem; color: var(--ink-3); letter-spacing: 0.01em; }
.note-state b { color: var(--ink); font-weight: 600; }
.note-state .linkish { font-size: 0.7rem; }
.note-reply {
  margin-top: 0.75rem;
  background: var(--paper-deep);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
}
.note-reply .who,
.avis-open .who {
  display: block;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--ink-2);
  margin-bottom: 0.35rem;
}
.note-reply .prose { font-family: var(--sans); font-size: 0.86rem; line-height: 1.6; }
.note-mine { margin-top: 0.75rem; font-family: var(--serif); font-size: 0.9rem; line-height: 1.55; color: var(--ink); }
.note-mine .note-state { margin-top: 0.25rem; }
.note-followup {
  display: block;
  margin-top: 0.65rem;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  background: transparent;
  font-family: var(--serif);
  font-size: 0.9rem;
  line-height: 1.55;
  padding: 0.35rem 0;
  resize: none;
    color: var(--ink);
}
.note-followup::placeholder { color: var(--ink-3); font-style: italic; }
.note-followup:focus { border-bottom-color: var(--ink-3); }

.send-bar {
  position: sticky;
  bottom: -1.5rem;
  margin: 1.1rem -1.4rem -1.5rem;
  padding: 0.95rem 1.4rem 1.4rem;
  background: var(--paper-raised);
  border-top: 1px solid var(--hairline);
}
.send-bar .btn { width: 100%; }
.send-bar .linkish { display: block; width: 100%; margin-top: 0.75rem; font-size: 0.8rem; text-align: center; }
.send-bar .agents-foot { margin-top: 0.9rem; padding-top: 0; border-top: 0; text-align: center; }

/* ---------- la feuille d'envoi ---------- */

#modal-send { width: min(34rem, 94vw); }
.send-list { list-style: none; margin: 1rem 0 0.4rem; border-top: 1px solid var(--hairline); max-height: 46vh; overflow-y: auto; }
.send-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--hairline);
}
.send-item input { margin-top: 0.25rem; width: 1rem; height: 1rem; accent-color: var(--ink); }
.send-item .k { display: block; font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3); }
.send-item .q {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.8rem;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.send-item .b {
  font-family: var(--serif);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}
.send-mirror { margin-top: 0.9rem; font-size: 0.8rem; color: var(--ink-2); line-height: 1.55; }

/* ---------- les questions ---------- */

.q-options { list-style: none; margin: 1.8rem 0 1.6rem; border-top: 1px solid var(--hairline); }
.q-options li {
  display: grid;
  grid-template-columns: 1.8rem minmax(0, 1fr);
  gap: 0.4rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--hairline);
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.6;
}
.q-options .k { font-family: var(--sans); font-size: 0.74rem; font-weight: 600; color: var(--ink-2); padding-top: 0.32rem; letter-spacing: 0.04em; }
.avis-fold {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.9rem;
  margin: 0 0 2.4rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--hairline);
  border-radius: 12px;
}
.avis-fold .k { color: var(--ink-2); }
.avis-fold .why { font-size: 0.8rem; color: var(--ink-2); }
.avis-fold .linkish { margin-left: auto; font-size: 0.8rem; }
.avis-open { margin: 0 0 2.4rem; background: var(--paper-deep); border-radius: 12px; padding: 0.9rem 1.05rem; }
.avis-open .prose { font-family: var(--sans); font-size: 0.9rem; line-height: 1.6; }
.decision-label { color: var(--ink-2); margin-bottom: 0.7rem; }
.decision-input {
  display: block;
  width: 100%;
  min-height: 5.4em;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  background: transparent;
  font-family: var(--serif);
  font-size: 1.17rem;
  line-height: 1.8;
  color: var(--ink);
  resize: none;
    caret-color: var(--accent);
  padding: 0 0 0.6rem;
}
.decision-input:focus { border-bottom-color: var(--ink-3); }
.decision-input::placeholder { color: var(--ink-3); font-style: italic; opacity: 0.8; }
.decision-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.9rem; }

/* ---------- barre d'état, page de réponse ---------- */

#hand-chip.on-piece .minibar { display: none; }
/* à 390 px, la barre d'état d'une pièce tient sur une ligne : le genre de la pièce s'efface */
@media (max-width: 480px) { .sb-kind { display: none; } }
.page-eyebrow { display: block; margin-bottom: 0.9rem; font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-3); }
.page-eyebrow .linkish { text-transform: none; letter-spacing: 0.01em; font-size: 0.78rem; margin-left: 0.4rem; }

/* ---------- mobile et doigt ---------- */

@media (max-width: 700px) {
  .revue-mark { left: -1.2rem; width: 1.05rem; height: 1.05rem; font-size: 0.56rem; }
  .piece-title { font-size: 1.55rem; }
  .piece-eyebrow .back { margin-left: 0; flex-basis: 100%; }
  .send-bar { margin: 1.1rem -1.2rem -1rem; padding: 0.9rem 1.2rem calc(1rem + env(safe-area-inset-bottom)); bottom: -1rem; }
  .q-options li { font-size: 1rem; }
}

@media (pointer: coarse) {
  .revue-mark::after { content: ""; position: absolute; inset: -0.7rem; }
  .drawer-tab, .pane-tab { min-height: 44px; display: inline-flex; align-items: center; }
  .pile-row { min-height: 44px; }
  .note-input, .note-followup, .decision-input { font-size: 16px; }
  .send-item input { width: 1.4rem; height: 1.4rem; }
}

/* ----- le panneau des notes : la ligne d'envoi, les fils, la suite ----- */

.rs-line { font-size: .78rem; color: var(--ink-2); margin: .35rem 0 .6rem; }
.rs-line.err { color: var(--ink); }
.rn-state { font-size: .74rem; color: var(--ink-2); margin: .15rem 0 0; }
.rn-state.err { color: var(--ink); }
.rn-state .linkish { font-size: .74rem; }
.rn-reply { margin: .55rem 0 0; padding: .5rem .65rem; background: var(--paper-deep);
            border-radius: 7px; }
.rn-who { font-size: .62rem; letter-spacing: .1em; color: var(--ink-2);
          font-family: var(--sans); margin: 0 0 .25rem; }
.rn-reply-body { font-family: var(--sans); font-size: .88rem; color: var(--ink); }
.rn-reply-body p { margin: .2rem 0; }
.rn-suite { margin: .45rem 0 0; padding-left: .6rem; border-left: 2px solid var(--hairline); }
.rn-compose { margin-top: .5rem; }
.rn-suite-keep { margin-top: .35rem; }
.rs-send { display: block; width: 100%; margin-top: .8rem; }
/* ---------------------------------------------------- la revue : l'onglet du panneau */

.rv-tabs {
  display: flex;
  gap: 0.1rem;
  margin: 0 0 0.9rem;
  border-bottom: 1px solid var(--hairline);
}
.rv-tab {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0.4rem 0.7rem;
  margin-bottom: -1px;
  font-family: var(--sans);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-2);
  border-bottom: 2px solid transparent;
}
.rv-tab.on { color: var(--ink); border-bottom-color: var(--ink); }
.rv-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* le miroir de recopie : il dit, il ne bloque pas */
.rc-mirror {
  margin: 0.5rem 0 0;
  padding: 0.55rem 0.7rem;
  border-left: 2px solid var(--ink-3);
  background: var(--paper-deep);
  font-family: var(--sans);
  font-size: 0.74rem;
  line-height: 1.5;
  color: var(--ink-2);
}

/* le Dialogue d'une piece : l'attente, l'honnetete, l'etat hors ligne */
.dlg-pending-bubble {
  align-self: stretch;
  background: var(--paper-deep);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-size: 0.87rem;
  line-height: 1.6;
  color: var(--ink-2);
  font-style: italic;
}
.dlg-honest { margin: 0.9rem 0 0; font-size: 0.7rem; line-height: 1.5; color: var(--ink-2); }
.dlg-offline { margin: 0 0 0.8rem; font-size: 0.78rem; font-style: italic; color: var(--ink-2); }

/* les versions : on lit la dernière, on peut en relire une ancienne */
.piece-versions { display: inline-flex; gap: .5rem; align-items: baseline; }
.pv.on { font-weight: 600; }
.piece-ancienne {
  margin: .6rem 0 0; padding: .5rem .7rem;
  border-left: 2px solid var(--ink-3); background: var(--paper-deep);
  font-size: .8rem; color: var(--ink-2);
}

/* les notes d'une version anterieure : repliees sous leur version */
.notes-fold { margin-top: .7rem; padding-top: .5rem; border-top: 1px solid var(--hairline); }
.notes-fold-label {
  font-family: var(--sans); font-size: .62rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .14em; color: var(--ink-2); margin: 0;
}
.notes-fold-toggle { margin: .15rem 0 .35rem; }
.notes-fold-toggle .linkish { font-size: .72rem; }

.rs-honest { font-size: .72rem; color: var(--ink-2); margin: .5rem 0 0; line-height: 1.45; }
.piece-end { display: flex; gap: .55rem; align-items: center; flex-wrap: wrap; margin-top: 1.1rem; }

/* ----- la feuille d'envoi ----- */

/* La maquette : la case a sa colonne, le libelle, le passage et le corps
   s'empilent dans la colonne large. Cote a cote, le texte se serre dans
   une colonne etroite, et sur un petit ecran il ne se lit plus. */
.rs-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .15rem .6rem;
  align-items: start;
  padding: .55rem 0;
  border-top: 1px solid var(--hairline);
}
.rs-item input { grid-column: 1; grid-row: 1; margin-top: .2rem; accent-color: var(--ink); }
.rs-item-label { grid-column: 2; display: block; font-size: .76rem; color: var(--ink-2); }
/* le passage cite : il precede le texte de la note, comme dans le design */
.rs-item-p { grid-column: 2; display: block; font-family: var(--serif); font-style: italic;
             font-size: .9rem; color: var(--ink-2); }
.rs-item-q { grid-column: 2; display: block; font-family: var(--serif); font-size: .92rem;
             color: var(--ink); }
.send-mirror { font-size: .8rem; color: var(--ink-2); margin: .7rem 0 0; }

/* ----- les questions : les options en texte, l'avis replié, la décision ----- */

.q-block { margin-top: 2rem; }
.q-options { list-style: none; margin: 0 0 1.6rem; padding: 0; }
.q-options li {
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--ink);
  /* la lettre occupe sa colonne (grille de la maquette) : pas de retrait
     suspendu, le texte suit la lettre dans la colonne large. */
  padding: .6rem 0;
  text-indent: 0;
  border-top: 1px solid var(--hairline);
}
.q-options li:last-child { border-bottom: 1px solid var(--hairline); }
.avis-fold { margin: 0 0 1.8rem; }
.avis-label {
  margin: 0;
  font-family: var(--sans);
  font-size: .66rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-2);
}
/* l'avis : le geste « Déplier » au bord droit de la boite, comme dans la
   maquette. Le paragraphe devient une rangee : le texte garde sa place et
   le geste s'y colle. */
.avis-why {
  margin: .25rem 0 0;
  font-size: .84rem;
  color: var(--ink-2);
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex: 1 1 auto;
}
.avis-why .linkish { margin-left: auto; font-size: .8rem; }
/* L'avis de clawdio parle dans la voix de clawdio : le sans, comme ses
   reponses dans le panneau (`.rn-reply-body`) et comme la maquette
   (`.avis-open .prose`). En serif, il se confondrait avec les mots de
   l'auteur : une phrase de l'avis recopiée dans une decision serait alors
   comptée comme de lui. */
.avis-body {
  margin-top: .7rem;
  padding: .9rem 1.05rem;
  background: var(--paper-deep);
  border-radius: 12px;
  font-family: var(--sans);
  font-size: .9rem;
  line-height: 1.6;
  color: var(--ink);
}
.avis-body p { margin: 0 0 .5rem; }
.avis-body p:last-child { margin: 0; }
.avis-who {
  font-family: var(--sans) !important;
  font-size: .62rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 0 0 .4rem !important;
}
#piece-question {
  margin: 0 0 2.4rem;
  padding-top: 1.2rem;
  border-top: 2px solid var(--ink);
}
.q-dec-label {
  margin: 0 0 .4rem;
  font-family: var(--sans);
  font-size: .66rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.q-dec-input {
  display: block;
  width: 100%;
  min-height: calc(2.6 * 1.6em);
  border: 0;
  border-bottom: 1px solid var(--hairline);
  background: transparent;
  padding: .2rem 0 .5rem;
  font-family: var(--serif);
  font-size: 1.17rem;
  line-height: 1.6;
  color: var(--ink);
  resize: vertical;
  }
.q-dec-input::placeholder { color: var(--ink-3); font-style: italic; }
.q-dec-input:focus { border-bottom-color: var(--ink-3); }
/* les deux gestes a droite, comme dans la maquette */
.q-dec-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .55rem; margin-top: .8rem; }
.q-dec-state { margin: .7rem 0 0; font-size: .78rem; color: var(--ink-2); }
.q-dec-state.sent { color: var(--ink); }

/* ---------- le focus se voit ----------

   Un anneau d'accent, 2 px, 2 px d'ecart. Sans lui, l'auteur qui navigue au
   clavier ne sait jamais ou il est : un fond change a peine (1,09:1 sur le
   papier), et le contour du navigateur disparait sur les champs sans
   bordure. La regle est unique et en fin de feuille : elle l'emporte sur
   les `outline: none` des memes elements.

   Deux exceptions, assumees : le titre de la page et l'editeur. Ce sont des
   champs de texte pleine page : le curseur y est l'indication de focus, et
   un anneau autour de toute la page nuirait a la lecture. */
:where(button, a[href], input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
