/* ==========================================================================
   StoryForge — thème « proposition de design »
   À charger APRÈS style.css. Pour revenir à l'ancien look : retirer le <link>.
   Typo : Inter (interface) + Lora (texte des pages), déjà dans fonts.css.
   ========================================================================== */

:root {
  --bg: #f3f4f8;
  --panel: #fff;
  --line: #e2e4ec;
  --text: #1e2130;
  --muted: #636a7c;
  --btn: #fff;
  --btnh: #eef0f6;
  --on: #fdeeaa;
  --paper: #fff;
  --paper-text: #1e2130;
  --accent: #f1c40f;
  --accent-blue: #026fae;
  /* nouveaux jetons */
  --soft: #eceef4;
  --yellow-soft: #fdeeaa;
  --yellow-text: #5f4a00;
  --ok: #1f9d55;
  --warn: #a15c00;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(20, 22, 40, .06), 0 1px 8px rgba(20, 22, 40, .04);
  --shadow-hover: 0 8px 24px rgba(20, 22, 40, .10);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14151b; --panel: #1f2029; --line: #34364a; --text: #e6e6ef; --muted: #9a9cb5;
    --btn: #1f2029; --btnh: #2a2c3b; --on: #4a4220; --paper: #1a1b22; --paper-text: #e6e6ef;
    --soft: #2a2c3b; --yellow-soft: #4a4220; --yellow-text: #f6e08a; --ok: #5ddc93; --warn: #f0b429;
    --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-hover: 0 8px 24px rgba(0,0,0,.45);
  }
}
:root[data-theme="dark"] {
  --bg: #14151b; --panel: #1f2029; --line: #34364a; --text: #e6e6ef; --muted: #9a9cb5;
  --btn: #1f2029; --btnh: #2a2c3b; --on: #4a4220; --paper: #1a1b22; --paper-text: #e6e6ef;
  --soft: #2a2c3b; --yellow-soft: #4a4220; --yellow-text: #f6e08a; --ok: #5ddc93; --warn: #f0b429;
  --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-hover: 0 8px 24px rgba(0,0,0,.45);
}

/* ---------- Typographie ---------- */
* { font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
body { -webkit-font-smoothing: antialiased; }

/* ---------- Boutons génériques ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; white-space: nowrap; cursor: pointer;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius);
  font-size: .95rem; font-weight: 400; text-decoration: none;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--btnh); }
.btn.strong { font-weight: 700; }
.btn.small { height: 36px; padding: 0 14px; font-size: .88rem; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #1e1e2d; font-weight: 700; }
.btn.accent:hover { filter: brightness(.96); }
.btn svg, .ib svg { width: 18px; height: 18px; flex: none; }

.ib {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: 0; border-radius: 10px;
  background: transparent; color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s;
}
.ib:hover { background: var(--soft); color: var(--text); }
.ib svg { width: 22px; height: 22px; stroke-width: 1.7; }

/* ---------- Page « Mes projets » ---------- */
#dashboard-screen { background: var(--bg); }
.dash-head {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 6px;
  width: 100%; max-width: 1200px; margin: 0 auto; padding: 24px 20px 0;
  background: var(--bg);
}
.brand { display: inline-flex; align-items: center; gap: 14px; font-size: 1.4rem; font-weight: 700; color: var(--text); }
.brand img { width: 40px; height: 40px; border-radius: 10px; display: block; }
.dash-head .spacer { flex: 1; }
.dash-email { color: var(--muted); font-size: .85rem; margin-right: 8px; }

.dash-main { max-width: 1200px; margin: 0 auto; padding: 28px 20px 60px; width: 100%; }
.dash-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px 24px; flex-wrap: wrap; margin-bottom: 28px; }
.dash-top h1 { font-size: 2rem; line-height: 1.15; letter-spacing: -.01em; color: var(--text); margin: 0; }
.dash-sub { color: var(--muted); margin: 6px 0 0; font-size: .98rem; }
.dash-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.search-field { position: relative; display: inline-flex; align-items: center; }
.search-field svg { position: absolute; left: 14px; width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.search-field input {
  width: 280px; max-width: 100%; height: 44px; padding: 0 14px 0 40px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius); font-size: .95rem;
}
.search-field input::placeholder { color: var(--muted); }

.dash-banner {
  margin-bottom: 20px; padding: 12px 16px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); color: var(--text);
  font-size: .9rem; align-items: center; gap: 12px; flex-wrap: wrap;
}
.dash-banner span { flex: 1; min-width: 200px; }

#dash-docs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }

.dash-empty { text-align: center; padding: 80px 20px; color: var(--muted); }
.dash-empty svg { width: 48px; height: 48px; margin-bottom: 16px; stroke-width: 1.4; }
.dash-empty h2 { margin-bottom: 8px; color: var(--text); }

.dash-helpbox {
  margin-top: 56px; padding: 24px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
}
.dash-helpbox h2 { font-size: 1.15rem; color: var(--text); margin-bottom: 6px; }
.dash-helpbox p { color: var(--muted); font-size: .95rem; line-height: 1.55; margin-bottom: 16px; }
.dash-helpbox .links { display: flex; gap: 10px; flex-wrap: wrap; }

/* Cartes de projet */
.doc-card {
  height: auto; min-height: 150px; padding: 22px 24px;
  border-radius: var(--radius-lg); border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.doc-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: #c9ccd8; }
.doc-card { display: flex; flex-direction: column; gap: 10px; }
.doc-card .doc-icon { display: none; }
.doc-head { display: flex; align-items: flex-start; gap: 10px; }
.doc-card .doc-title { flex: 1; min-width: 0; font-size: 1.1rem; margin: 0; }
.doc-card .doc-role-badge {
  position: static; flex: none; font-size: .78rem; padding: 4px 12px; border-radius: 999px;
  background: var(--soft); color: var(--text); font-weight: 400; white-space: nowrap;
}
.doc-card .doc-role-badge.domain { background: var(--yellow-soft); color: var(--yellow-text); }
.doc-excerpt {
  color: var(--muted); font-size: .95rem; line-height: 1.55; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.doc-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 4px; }
.doc-card .doc-meta { margin: 0; font-size: .85rem; color: var(--muted); }
.doc-shared { flex: none; font-size: .78rem; padding: 4px 12px; border-radius: 999px; background: var(--soft); color: var(--text); }
/* Bouton ⋮ : place réservée (la pastille ne bouge pas), visible au survol / clavier / tactile */
.doc-card .doc-menu-btn { position: static; display: block; visibility: hidden; flex: none; width: 28px; padding: 2px 0; text-align: center; }
.doc-card:hover .doc-menu-btn, .doc-card:focus-within .doc-menu-btn { visibility: visible; }
@media (hover: none) { .doc-card .doc-menu-btn { visibility: visible; } }
.doc-context-menu { border-radius: var(--radius); box-shadow: var(--shadow-hover); top: 46px; right: 14px; }

/* ---------- Éditeur : barre du haut ---------- */
.nav {
  background: var(--panel); color: var(--text);
  border-bottom: 1px solid var(--line); padding: 12px 20px; gap: 6px;
}
.nav b { display: inline-flex; align-items: center; gap: 10px; font-size: 1.05rem; }
.nav b img { width: 28px; height: 28px; border-radius: 8px; }
.nb { background: transparent; color: var(--text); border-radius: 10px; font-weight: 600; }
.nb:hover { background: var(--soft); }
.nb.icon { padding: 7px 10px; }
#crumb { color: var(--muted); }
#crumb strong { color: var(--text); }
#crumb button { color: var(--muted); }
#crumb button:hover { color: var(--text); }
#crumb i { color: var(--line); }
#st { color: var(--ok); }

/* ---------- Éditeur : barre d'outils ---------- */
.bar { background: var(--panel); padding: 8px 20px; gap: 4px 6px; border-bottom: 1px solid var(--line); }
@media (min-width: 900px) { .bar { flex-wrap: wrap; overflow-x: visible; } }
.g { padding-right: 10px; margin-right: 4px; }
.bar button, .bar select, .col, .row button {
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  min-height: 36px; padding: 4px 10px; font-size: .9rem; color: var(--text);
}
.bar select { border-color: var(--line); background: var(--panel); }
.bar button:hover, .bar select:hover, .col:hover, .row button:hover { background: var(--soft); }
.bar button.on { background: var(--on); border-color: transparent; color: var(--yellow-text); }
.bar .mn { background: var(--yellow-soft); color: var(--yellow-text); border: 0; font-weight: 700; }
.bar .mz { background: #dfeefa; color: #0b4f7a; border: 0; font-weight: 700; }
.bar .mx { font-weight: 600; }
.row { border-bottom: 1px solid var(--line); }
.row input { border-radius: 8px; }

/* ---------- Éditeur : feuille d'écriture ---------- */
.scroll { background: var(--bg); padding: 32px 20px; }
#page {
  max-width: 820px; padding: 56px 64px; min-height: 600px;
  background: var(--paper); color: var(--paper-text);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  font-family: 'Lora', Georgia, 'Times New Roman', serif;
  font-size: 18px; line-height: 1.8;
}
#page h1, #page h2, #page h3 { font-weight: 700; letter-spacing: -.005em; }
#page blockquote { border-left: 4px solid var(--accent); color: var(--muted); }
#page:empty::before { color: var(--muted); }
@media (max-width: 720px) { #page { padding: 32px 22px; border-radius: 12px; } .scroll { padding: 16px 10px; } }

/* ---------- Panneaux latéraux (bibliothèque, sommaire, recherche, tiroir) ---------- */
#lib, #toc, #search, #drawer { box-shadow: 0 0 40px rgba(20, 22, 40, .12); border-color: var(--line); }
#lib { width: 290px; }
.dh { padding: 16px 18px; }
.dh h3 { font-size: 1rem; }
.dh > button, .dh div button { background: var(--soft); border-radius: 8px; }
.lib-list { padding: 10px 8px; }
.lib-item { margin: 2px 0; padding: 9px 12px; border-left: 0; border-radius: 8px; color: var(--text); }
.lib-item:hover { background: var(--soft); }
.lib-item.active { background: var(--soft); font-weight: 700; }
.toc-page { border-radius: 8px; }

/* ---------- Fenêtres modales ---------- */
.modal { background: rgba(20, 22, 40, .45); }
.modal-content { border-radius: var(--radius-lg); box-shadow: 0 24px 70px rgba(20, 22, 40, .3); }
.modal-header { padding: 18px 22px; }

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  .dash-head { padding-top: 16px; }
  .dash-top { align-items: stretch; }
  .dash-tools { width: 100%; }
  .search-field { width: 100%; }
  .search-field input { width: 100%; }
  .dash-email { display: none; }
  .nav b span { display: none; }
}

/* ---------- Icônes cliquables : le clic doit viser le bouton (le JS teste e.target.id) ---------- */
.ib svg, .ib * { pointer-events: none; }
.ib { position: relative; }
.ib[data-count]:not([data-count=""])::after {
  content: attr(data-count); position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--accent); color: #1e1e2d; font-size: .7rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Éditeur : bouton Édition / Lecture, statut, e-mail ---------- */
#mode-toggle { background: var(--soft); color: var(--text); border-radius: 10px; min-width: 96px; }
#mode-toggle.is-edit { background: var(--yellow-soft); color: var(--yellow-text); }
.nav-email { color: var(--muted); font-size: .85rem; margin-left: 8px; }
#st { font-size: .82rem; }

/* ---------- Bibliothèque : panneau « PAGES » fixe sur grand écran ---------- */
.lib-home { text-align: left; background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 1rem; padding: 20px 22px 4px; }
.lib-home:hover { color: var(--text); }
.lib-label { font-size: .75rem !important; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 400; }
.lib-title { font-size: .98rem; }
@media (min-width: 1100px) {
  body:not(.focus-mode):not(.lib-collapsed) #app-screen { padding-left: 252px; }
  body:not(.focus-mode):not(.lib-collapsed) #lib {
    visibility: visible; transform: none; width: 252px; z-index: 5;
    box-shadow: none; border: 0; border-right: 1px solid var(--line);
  }
  body:not(.focus-mode):not(.lib-collapsed) #libClose, body:not(.focus-mode):not(.lib-collapsed) .dh { border-bottom: 0; }
  #libClose, .nav > b { display: none; }
  body:not(.lib-collapsed) #homeBtn { display: none; }          /* « ← Mes projets » est dans le panneau Pages ; replié, le bouton Accueil prend le relais */
}
}
@media (max-width: 1099px) { .lib-home { display: none; } }

/* ---------- Bibliothèque : « Nouvelle page » en haut, arborescence, objectif en bas ---------- */
.lib-newwrap { padding: 4px 14px 10px; }
.lib-new {
  width: 100%; height: 40px; cursor: pointer; font-weight: 700; font-size: .95rem;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius);
}
.lib-new:hover { background: var(--btnh); }
.lib-foot { padding: 14px 16px; border-top: 1px solid var(--line); }
.lib-foot .goal-empty .goal-bar { display: none; }
.lib-foot #goal-widget { max-width: none; margin: 0; padding: 0; border: 0; background: none; border-radius: 0; }
.lib-foot .goal-label { font-weight: 700; color: var(--text); }
.lib-foot .goal-edit-btn { border-radius: 8px; }

.lib-item { display: flex; align-items: center; gap: 2px; padding: 5px 8px 5px 2px; }
.lib-toggle {
  flex: none; width: 26px; height: 26px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: 6px; color: var(--muted); cursor: pointer;
}
.lib-toggle:hover { background: var(--line); color: var(--text); }
.lib-toggle svg { width: 14px; height: 14px; transition: transform .15s; }
.lib-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.lib-toggle-space { flex: none; width: 26px; }
.lib-children { margin-left: 14px; padding-left: 2px; border-left: 1px solid var(--line); }
.lib-children.collapsed { display: none; }
.lib-item:not(.is-child) .lib-title { font-weight: 700; }
.lib-item.is-child .lib-title { font-size: .92rem; }
.lib-item.active .lib-title { font-weight: 700; }
.lib-count { flex: none; font-size: .72rem; padding: 1px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.lib-item.active .lib-count { background: var(--panel); }

/* ---------- Accueil : filtres par rôle ---------- */
.dash-filters { display: flex; gap: 8px; flex-wrap: wrap; margin: -8px 0 24px; }
.dash-filters[hidden] { display: none; }
.chip {
  height: 36px; padding: 0 14px; cursor: pointer; font-size: .9rem;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 999px;
}
.chip[hidden] { display: none; }
.chip:hover { background: var(--btnh); }
.chip.is-on { background: var(--text); color: var(--panel); border-color: var(--text); font-weight: 700; }
.chip .n { opacity: .65; margin-left: 4px; font-size: .82rem; }

/* ---------- Barre du haut rangée : groupes, séparateurs, menu « ⋯ » ---------- */
.nav { gap: 4px; }
.nav-grp { display: inline-flex; align-items: center; gap: 2px; }
.nav-sep { flex: none; width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
#st { margin-right: 6px; }
.more-wrap { position: relative; display: inline-flex; }
.more-menu {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 60; min-width: 260px;
  display: flex; flex-direction: column; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-hover);
}
.more-menu[hidden] { display: none; }
.more-menu .nb { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 9px 12px; font-weight: 400; border-radius: 8px; font-size: 1.05rem; }
.more-menu .nb::after { content: attr(title); font-size: .92rem; color: var(--text); }
@media (max-width: 1279px) { .nav-email { display: none; } }

/* ---------- Tableaux dans la page ---------- */
#page table { width: 100%; border-collapse: collapse; table-layout: fixed; margin: 1.2em 0; font-size: .95em; line-height: 1.5; }
#page th, #page td { border: 1px solid var(--line); padding: 8px 12px; vertical-align: top; text-align: left; overflow-wrap: anywhere; }
#page th { background: var(--soft); font-weight: 700; }
#page td:focus-within, #page th:focus-within { outline: 2px solid var(--accent); outline-offset: -2px; }
#page pre { font-family: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', monospace; font-size: .88em; line-height: 1.55; background: var(--soft); padding: 12px 16px; border-radius: 8px; white-space: pre-wrap; }
#page h4 { font-size: 1.05em; }

/* Barre flottante d'édition du tableau */
.tbl-bar {
  position: fixed; z-index: 45; display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; max-width: calc(100vw - 16px);
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-hover);
}
.tbl-bar[hidden] { display: none; }
.tbl-bar button { padding: 5px 9px; font-size: .8rem; border: 0; border-radius: 7px; background: transparent; color: var(--text); cursor: pointer; white-space: nowrap; }
.tbl-bar button:hover { background: var(--soft); }
.tbl-bar button.danger { color: #c0392b; }

/* Fenêtre « Insérer un tableau » */
.tbl-pop {
  position: fixed; z-index: 60; width: 248px; padding: 14px; display: flex; flex-direction: column; gap: 10px;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-hover);
}
.tbl-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; }
.tbl-grid span { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 3px; cursor: pointer; }
.tbl-grid span.on { background: var(--yellow-soft); border-color: var(--accent); }
.tbl-size { text-align: center; font-size: .85rem; color: var(--muted); }
.tbl-fields { display: flex; gap: 10px; }
.tbl-fields label { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--muted); }
.tbl-fields input { height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); font-size: .95rem; }
.tbl-head { display: flex; align-items: center; gap: 8px; font-size: .85rem; }
.tbl-go { height: 38px; border: 0; border-radius: 10px; background: var(--accent); color: #1e1e2d; font-weight: 700; cursor: pointer; }

/* ---------- Historique : aperçu d'une version ---------- */
.vp-overlay { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(20, 22, 40, .5); }
.vp-box { width: min(1100px, 100%); height: min(760px, 100%); display: flex; flex-direction: column; background: var(--panel); color: var(--text); border-radius: var(--radius-lg); box-shadow: 0 24px 70px rgba(20, 22, 40, .35); overflow: hidden; }
.vp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.vp-titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vp-title { font-size: 1.1rem; }
.vp-sub { font-size: .85rem; color: var(--muted); }
.vp-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.vp-restore { height: 38px; padding: 0 16px; border: 0; border-radius: 10px; background: var(--accent); color: #1e1e2d; font-weight: 700; cursor: pointer; }
.vp-close { width: 38px; height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 1.1rem; cursor: pointer; }
.vp-close:hover { background: var(--soft); color: var(--text); }
.vp-banner { padding: 8px 20px; font-size: .85rem; background: var(--yellow-soft); color: var(--yellow-text); }
.vp-main { flex: 1; min-height: 0; display: grid; grid-template-columns: 250px 1fr; }
.vp-pages { overflow-y: auto; padding: 10px 8px; border-right: 1px solid var(--line); background: var(--bg); }
.vp-page { display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%; text-align: left; padding: 8px 10px 8px calc(10px + var(--d, 0) * 14px); border: 0; border-radius: 8px; background: transparent; color: var(--text); cursor: pointer; font-size: .92rem; }
.vp-page:hover { background: var(--soft); }
.vp-page[aria-current="true"] { background: var(--soft); font-weight: 700; }
.vp-page-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vp-pill { flex: none; font-size: .68rem; padding: 1px 8px; border-radius: 999px; background: var(--yellow-soft); color: var(--yellow-text); font-weight: 400; }
.vp-lost { margin: 12px 6px 4px; padding: 10px; font-size: .8rem; line-height: 1.45; color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; }
.vp-view { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.vp-tools { display: flex; align-items: center; gap: 6px; padding: 10px 20px; border-bottom: 1px solid var(--line); background: var(--panel); }
.vp-mode { height: 32px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--text); cursor: pointer; font-size: .88rem; }
.vp-mode.is-on { background: var(--text); color: var(--panel); border-color: var(--text); font-weight: 700; }
.vp-legend { margin-left: auto; font-size: .8rem; color: var(--muted); }
.vp-sheet { flex: 1; overflow-y: auto; margin: 20px; padding: 36px 44px; background: var(--paper); color: var(--paper-text); border: 1px solid var(--line); border-radius: var(--radius-lg); font-family: 'Lora', Georgia, serif; font-size: 17px; line-height: 1.75; }
.vp-sheet * { font-family: inherit; }
.vp-empty { color: var(--muted); font-style: italic; }
.vp-diff .vp-difftext { line-height: 1.9; }
.vp-add { background: rgba(31, 157, 85, .2); color: inherit; text-decoration: none; border-radius: 3px; padding: 0 2px; }
.vp-del { background: rgba(214, 60, 60, .18); color: inherit; text-decoration: line-through; border-radius: 3px; padding: 0 2px; }
@media (max-width: 720px) {
  .vp-overlay { padding: 0; }
  .vp-box { height: 100%; border-radius: 0; }
  .vp-main { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .vp-pages { max-height: 30vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .vp-sheet { margin: 10px; padding: 22px 18px; }
}

/* ---------- Tableaux : aussi dans l'aperçu de l'assemblage, l'impression / PDF et l'aperçu de version ---------- */
.asm-sheet table, .vp-sheet table { width: 100%; border-collapse: collapse; table-layout: fixed; margin: 1.2em 0; font-size: .95em; line-height: 1.5; }
.asm-sheet th, .asm-sheet td, .vp-sheet th, .vp-sheet td { border: 1px solid var(--line); padding: 8px 12px; vertical-align: top; text-align: left; overflow-wrap: anywhere; }
.asm-sheet th, .vp-sheet th { background: var(--soft); font-weight: 700; }
.asm-sheet pre, .vp-sheet pre { font-family: ui-monospace, 'SF Mono', Consolas, monospace; font-size: .88em; background: var(--soft); padding: 12px 16px; border-radius: 8px; white-space: pre-wrap; }
@media print {
  body.printing-assembly .asm-sheet table { page-break-inside: auto; }
  body.printing-assembly .asm-sheet tr { page-break-inside: avoid; }
  body.printing-assembly .asm-sheet th, body.printing-assembly .asm-sheet td { border: 1px solid #555; }
  body.printing-assembly .asm-sheet th { background: #eee; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Commutateur Liens / Tâches (carte des relations et vues des tâches) ---------- */
.view-switch { display: inline-flex; padding: 3px; gap: 2px; background: var(--soft); border-radius: 12px; }
.view-switch button { border: 0 !important; background: transparent !important; color: var(--text); border-radius: 9px !important; padding: 6px 14px !important; font-size: .9rem; cursor: pointer; }
.view-switch button.is-on { background: var(--yellow-soft) !important; color: var(--yellow-text); font-weight: 700; }
.view-switch button[hidden] { display: none; }
.relmap-bar .view-switch { margin-right: 6px; }
#task-views { padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); cursor: pointer; }

/* ---------- Vues des tâches (plein écran) ---------- */
.tv { position: fixed; inset: 0; z-index: 92; display: flex; flex-direction: column; background: var(--bg); color: var(--text); }
.tv[hidden] { display: none; }
.tv-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.tv-views, .tv-scopes { display: inline-flex; gap: 4px; }
.tv-view, .tv-scope { height: 34px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--text); font-size: .9rem; cursor: pointer; }
.tv-view:hover, .tv-scope:hover { background: var(--btnh); }
.tv-view.is-on { background: var(--text); color: var(--panel); border-color: var(--text); font-weight: 700; }
.tv-scope.is-on { background: var(--soft); font-weight: 700; }
.tv-search { height: 34px; width: 200px; max-width: 100%; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); }
.tv-spacer { flex: 1; }
.tv-new { height: 38px; padding: 0 16px; border: 0; border-radius: 10px; background: var(--accent); color: #1e1e2d; font-weight: 700; cursor: pointer; }
.tv-close { width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 1.1rem; cursor: pointer; }
.tv-close:hover { background: var(--soft); color: var(--text); }
.tv-sum { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 20px; font-size: .88rem; color: var(--muted); }
.tv-sumbar { display: inline-flex; width: 180px; height: 8px; border-radius: 999px; overflow: hidden; background: var(--line); }
.tv-sumbar .seg.done { background: #1f9d55; } .tv-sumbar .seg.doing { background: var(--accent); }
.tv-error { color: #c0392b; }
.tv-body { flex: 1; min-height: 0; overflow: auto; padding: 4px 20px 28px; }

/* cartes */
.tv-card { position: relative; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.tv-card.dragging { opacity: .4; }
.tv-card.tv-st-done .tv-title { text-decoration: line-through; color: var(--muted); }
.tv-title { font-weight: 700; font-size: .95rem; line-height: 1.35; }
.tv-desc { margin-top: 4px; font-size: .85rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tv-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tv-chip, .tv-pill { font-size: .75rem; padding: 2px 10px; border-radius: 999px; background: var(--soft); color: var(--text); border: 0; }
.tv-chip.me { background: var(--accent); color: #1e1e2d; font-weight: 700; }
.tv-chip.link { cursor: pointer; color: var(--accent-blue); }
.tv-chip.missing { color: var(--muted); font-style: italic; }
.tv-pill-doing { background: var(--yellow-soft); color: var(--yellow-text); }
.tv-pill-done { background: rgba(31, 157, 85, .18); }
.tv-actions { display: flex; gap: 4px; margin-top: 8px; }
.tv-actions button { padding: 3px 9px; font-size: .8rem; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--text); cursor: pointer; }
.tv-actions button:hover:not(:disabled) { background: var(--soft); }
.tv-actions button:disabled { opacity: .35; cursor: default; }
.tv-add { width: 28px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--muted); cursor: pointer; flex: none; }
.tv-add:hover { background: var(--soft); color: var(--text); }
.tv-empty { padding: 14px; text-align: center; color: var(--muted); font-size: .88rem; }
.tv-empty-big { padding: 60px 14px; }

/* Avancement */
.tv-cols { display: grid; grid-template-columns: repeat(3, minmax(240px, 1fr)); gap: 16px; align-items: start; }
.tv-col { padding: 10px; border-radius: 16px; background: var(--soft); transition: background .15s; }
.tv-col.drop { outline: 2px dashed var(--accent); background: var(--yellow-soft); }
.tv-col-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 10px; }
.tv-col-name { font-weight: 700; margin-right: auto; }
.tv-count { font-size: .78rem; padding: 1px 9px; border-radius: 999px; background: var(--panel); color: var(--muted); }
.tv-col-list { display: flex; flex-direction: column; gap: 10px; }

/* Par page */
.tv-plan { max-width: 900px; margin: 0 auto; }
.tv-opt { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0 14px; font-size: .88rem; color: var(--muted); }
.tv-page { margin-left: calc(var(--d, 0) * 22px); margin-bottom: 8px; }
.tv-page-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.tv-toggle { width: 26px; height: 26px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.tv-toggle:hover { background: var(--soft); }
.tv-toggle-space { width: 26px; flex: none; }
.tv-page-name { flex: 1; min-width: 0; text-align: left; border: 0; background: transparent; color: var(--text); font-weight: 700; font-size: .98rem; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-page-name:hover:not(.tv-static) { text-decoration: underline; }
.tv-static { cursor: default; font-style: italic; }
.tv-prog { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.tv-prog-bar { width: 90px; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; display: inline-block; }
.tv-prog-fill { display: block; height: 100%; background: #1f9d55; }
.tv-prog-txt { font-size: .78rem; color: var(--muted); min-width: 34px; text-align: right; }
.tv-page-tasks { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin: 8px 0 4px 36px; }

/* Par personne */
.tv-people { min-width: 760px; }
.tv-lane { display: grid; grid-template-columns: 200px repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; padding: 10px; background: var(--soft); border-radius: 16px; align-items: start; }
.tv-lane-heads { background: transparent; padding: 0 10px; margin-bottom: 4px; }
.tv-lane-colhead { font-weight: 700; font-size: .88rem; color: var(--muted); }
.tv-lane-who { display: flex; align-items: center; gap: 10px; }
.tv-lane-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.tv-lane-txt strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-lane-sum { font-size: .78rem; color: var(--muted); }
.tv-avatar { width: 34px; height: 34px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--text); color: var(--panel); font-weight: 700; }
.tv-avatar.none { background: var(--line); color: var(--muted); }
.tv-lane-cell { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }

/* Fenêtre d'édition d'une tâche (le formulaire du panneau y est déplacé) */
.tv-editor { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(20, 22, 40, .45); }
.tv-editor[hidden] { display: none; }
.tv-editor-box { width: min(480px, 100%); max-height: 100%; overflow-y: auto; background: var(--panel); border-radius: var(--radius-lg); box-shadow: 0 24px 70px rgba(20, 22, 40, .35); }
.tv-editor-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px 0 18px; }
.tv-editor-host .task-form { border-bottom: 0; background: transparent; padding: 10px 18px 18px; }
@media (max-width: 900px) {
  .tv-cols { grid-template-columns: 1fr; }
  .tv-people { min-width: 0; }
  .tv-lane { grid-template-columns: 1fr; }
  .tv-lane-heads { display: none; }
}

/* ---------- Échéances et vue Chronologie ---------- */
.tv-chip.due, .task-chip.due { background: var(--soft); color: var(--text); }
.tv-chip.due.soon, .task-chip.due.soon { background: var(--yellow-soft); color: var(--yellow-text); font-weight: 700; }
.tv-chip.due.late, .task-chip.due.late { background: rgba(214, 60, 60, .2); color: #c0392b; font-weight: 700; }
.tv-chip.due.done, .task-chip.due.done { opacity: .6; }
#task-due { height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); }

.tv-time { max-width: 860px; margin: 0 auto; }
.tv-rail { position: relative; padding-left: 28px; }
.tv-rail::before { content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line); border-radius: 2px; }
.tv-week { margin: 22px 0 10px -28px; padding: 3px 12px; display: inline-block; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--bg); position: relative; }
.tv-node { position: relative; margin-bottom: 16px; }
.tv-node-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tv-dot { position: absolute; left: -27px; top: 5px; width: 14px; height: 14px; border-radius: 50%; background: var(--panel); border: 3px solid var(--muted); box-sizing: border-box; }
.tv-node-date { text-transform: capitalize; }
.tv-node-rel { font-size: .82rem; color: var(--muted); margin-right: auto; }
.tv-node-tasks { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.tv-node.is-today .tv-dot { border-color: var(--accent); background: var(--accent); }
.tv-node.is-late .tv-dot { border-color: #c0392b; }
.tv-node.is-late .tv-node-date { color: #c0392b; }
.tv-node.is-past { opacity: .75; }
.tv-node.is-undated .tv-dot { border-style: dashed; }
.tv-today { position: relative; margin: 14px 0 18px; padding: 4px 14px; width: fit-content; border-radius: 999px; background: var(--accent); color: #1e1e2d; font-weight: 700; font-size: .85rem; }
.tv-today::before { content: ''; position: absolute; left: -26px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: var(--accent); }

/* ---------- Icônes (sprite défini au début de index.html et guide.html) ---------- */
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
.nb.icon .i { width: 19px; height: 19px; }
.nb .i, .bar button .i { pointer-events: none; }
.bar button .i { width: 17px; height: 17px; }
.bar button:has(.i):not(.icon) { display: inline-flex; align-items: center; gap: 6px; }
.more-menu .nb .i { width: 19px; height: 19px; }
.lib-actions .i { width: 15px; height: 15px; }
.nb { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.more-menu .nb { justify-content: flex-start; }
#chatBtn { position: relative; }

.doc-pills { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Préparer pour mon IA ---------- */
.ai { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(20, 22, 40, .5); }
.ai[hidden] { display: none; }
.ai-box { width: min(760px, 100%); max-height: 100%; display: flex; flex-direction: column; background: var(--panel); color: var(--text); border-radius: var(--radius-lg); box-shadow: 0 24px 70px rgba(20, 22, 40, .35); overflow: hidden; }
.ai-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line); font-size: 1.05rem; }
.ai-x { width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 1.1rem; cursor: pointer; }
.ai-x:hover { background: var(--soft); color: var(--text); }
.ai-body { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 22px 16px; }
.ai-body h3 { margin: 18px 0 8px; font-size: .85rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.ai-intro { margin: 14px 0 0; padding: 10px 14px; background: var(--yellow-soft); color: var(--yellow-text); border-radius: 10px; font-size: .9rem; line-height: 1.5; }
.ai-tpls { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-tpl { height: 38px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--text); cursor: pointer; font-size: .92rem; }
.ai-tpl:hover { background: var(--btnh); }
.ai-tpl.is-on { background: var(--text); color: var(--panel); border-color: var(--text); font-weight: 700; }
.ai-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; }
.ai-field { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; }
.ai-field select { height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); }
.ai-chk { display: inline-flex; align-items: center; gap: 4px; font-size: .9rem; }
.ai-chk[hidden] { display: none; }
.ai-prompt, .ai-preview { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); font: inherit; font-size: .92rem; line-height: 1.5; resize: vertical; }
.ai-preview { font-family: ui-monospace, 'SF Mono', Consolas, monospace; font-size: .8rem; background: var(--bg); }
.ai-details { margin-top: 14px; }
.ai-details summary { cursor: pointer; font-size: .9rem; color: var(--muted); padding: 4px 0; }
.ai-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 22px; border-top: 1px solid var(--line); background: var(--panel); }
.ai-info { display: flex; flex-direction: column; gap: 2px; font-size: .82rem; color: var(--muted); min-width: 0; flex: 1; }
.ai-warn { color: #b9770e; }
.ai-btns { display: flex; gap: 8px; }
.ai-dl, .ai-copy { height: 40px; padding: 0 18px; border-radius: 10px; cursor: pointer; font-weight: 700; }
.ai-dl { border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.ai-copy { border: 0; background: var(--accent); color: #1e1e2d; }
.ai-dl:disabled, .ai-copy:disabled { opacity: .4; cursor: default; }
.ai-after { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: .88rem; }
.ai-after[hidden] { display: none; }
.ai-link { padding: 4px 12px; border-radius: 999px; background: var(--soft); color: var(--accent-blue); text-decoration: none; font-weight: 700; }
.ai-link:hover { text-decoration: underline; }
@media (max-width: 600px) { .ai { padding: 0; } .ai-box { border-radius: 0; height: 100%; } }

/* ============================================================
   BARRES : flèches ‹ › de la barre du haut, barre d'outils sur deux lignes
   ============================================================ */
.nav { padding: 10px 18px; }
.nav-grp { display: inline-flex; align-items: center; gap: 2px; }
.layout-arrow { width: 30px; height: 34px; padding: 0 !important; color: var(--muted); }
.layout-arrow:hover { color: var(--text); }
.layout-arrow .i { width: 18px; height: 18px; }
.layout-dots { display: inline-flex; align-items: center; gap: 4px; margin: 0 8px 0 2px; }
.layout-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); display: block; transition: background .15s, transform .15s; }
.layout-dots i.on { background: var(--text); transform: scale(1.25); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* barre d'outils : ligne 1 = mise en forme, ligne 2 = insertion et annotations (identique pour tout le monde) */
.bar { display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 6px 20px; }
.bar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; min-width: 0; }
@media (max-width: 899px) { .bar { overflow-x: auto; } .bar-row { flex-wrap: nowrap; flex: none; } }

/* boutons d'annotation : plus de couleurs criardes, une petite pastille de couleur sur l'icône */
.bar .mn, .bar .mz, .bar .ml, .bar .mb, .bar .mx { background: transparent; color: var(--text); border: 1px solid var(--line); font-weight: 400; }
.bar .mn .i { color: #b7791f; } .bar .mz .i { color: #2b6cb0; } .bar .ml .i { color: #8e44ad; } .bar .mb .i { color: #2e8b57; } .bar .mx .i { color: var(--muted); }
.bar .mn:hover, .bar .mz:hover, .bar .ml:hover, .bar .mb:hover, .bar .mx:hover { background: var(--soft); }
.bar .mn.active { background: var(--yellow-soft); border-color: #e0b400; color: var(--yellow-text); font-weight: 700; }
.bar .mz.active { background: #dfeefa; border-color: #2b6cb0; color: #0b4f7a; font-weight: 700; }
.bar .ml.active { background: #efe3f6; border-color: #8e44ad; color: #5b2a73; font-weight: 700; }
.bar .mb.active { background: #dff3e6; border-color: #2e8b57; color: #1d5c3a; font-weight: 700; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .bar .mz.active { background: #1d3550; color: #bcdcf7; }
  :root:not([data-theme="light"]) .bar .ml.active { background: #3a2848; color: #e3c9f0; }
  :root:not([data-theme="light"]) .bar .mb.active { background: #1f3d2c; color: #bfe8cf; }
}
:root[data-theme="dark"] .bar .mz.active { background: #1d3550; color: #bcdcf7; }
:root[data-theme="dark"] .bar .ml.active { background: #3a2848; color: #e3c9f0; }
:root[data-theme="dark"] .bar .mb.active { background: #1f3d2c; color: #bfe8cf; }



/* écrans moyens et petits : la barre du haut ne déborde plus */
@media (max-width: 1099px) {
  .nav b { display: none; }
  .nav { flex-wrap: wrap; row-gap: 4px; }
}
@media (max-width: 720px) {
  #st { display: none; }
}

/* ligne de mise en forme : tout tient sur une seule ligne sur un écran d'ordinateur */
.bar .g { padding-right: 6px; margin-right: 2px; }
.bar #sb { max-width: 124px; }
.bar #sf { max-width: 150px; }
.bar #sz { max-width: 62px; }
.bar-row { gap: 4px 4px; }
.bar-row button { padding-left: 8px; padding-right: 8px; }
.bar .g { padding-right: 4px; margin-right: 0; }
.bar { padding-left: 14px; padding-right: 14px; }
.bar #sf { max-width: 140px; }
.bar #sb { max-width: 112px; }
.bar #sf { max-width: 128px; }
.bar-row { gap: 4px 2px; }
.bar #sb { max-width: 128px; }
.bar #sf { max-width: 118px; }
.layout-arrow[hidden], .layout-dots[hidden] { display: none; }

/* ============================================================
   LIENS : citations, types de relations, vue Apparitions
   ============================================================ */
/* « Citée dans… » sur la fiche */
.entry-cites { margin: 8px 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.entry-cites-head { font-size: .82rem; font-weight: 700; margin-bottom: 4px; }
.entry-cites-hint { font-size: .8rem; color: var(--muted); line-height: 1.45; }
.cite-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 5px 8px; border: 0; border-radius: 7px; background: transparent; color: var(--text); cursor: pointer; text-align: left; font-size: .85rem; }
.cite-row:hover { background: var(--soft); }
.cite-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cite-n { flex: none; font-size: .75rem; color: var(--muted); }
.cite-more { margin-top: 2px; padding: 4px 8px; border: 0; background: none; color: var(--accent-blue); cursor: pointer; font-size: .8rem; }
.text-link-entry.link-flash { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; animation: linkflash 1.8s ease-out; }
@keyframes linkflash { 0% { background: var(--yellow-soft); } 100% { background: transparent; } }

/* « Fiches de cette page » (panneau Pages) */
.lib-cites { padding: 10px 14px; border-top: 1px solid var(--line); }
.lib-cites[hidden] { display: none; }
.lib-cites-title { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.lib-cites-list { display: flex; flex-wrap: wrap; gap: 5px; max-height: 120px; overflow-y: auto; }
.cite-chip { padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--text); cursor: pointer; font-size: .8rem; }
.cite-chip:hover { background: var(--soft); border-color: var(--accent); }

/* types de relations */
.rel-types { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }
.rel-type { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--text); cursor: pointer; font-size: .82rem; }
.rel-type i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.rel-type:hover { background: var(--soft); }
.rel-type.is-on { background: var(--text); color: var(--panel); border-color: var(--text); font-weight: 700; }
.rel-presets { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.rel-presets:empty { display: none; }
.rel-preset { padding: 2px 10px; border: 1px dashed var(--line); border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; font-size: .78rem; }
.rel-preset:hover { color: var(--text); border-color: var(--text); }
#rel-type-hint { color: var(--muted); font-weight: 400; margin-left: 4px; }
.rel-row.rel-typed { border-left: 3px solid var(--rc, var(--line)); padding-left: 8px; }
.rm-link[data-rtype] .rm-edge { stroke: var(--rc); }
.rm-link[data-rtype]:hover .rm-edge, .rm-link[data-rtype].on .rm-edge { stroke: var(--rc); stroke-width: 3px; }
#relmap-legend .rm-line { display: inline-block; width: 20px; height: 0; margin-right: 6px; vertical-align: middle; border-top: 3px solid var(--rc); }
#relmap-legend .rm-line[data-dash] { border-top-style: dashed; }

/* vue Apparitions */
.ap { position: fixed; inset: 0; z-index: 92; display: flex; flex-direction: column; background: var(--bg); color: var(--text); }
.ap[hidden] { display: none; }
.ap-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.ap-sel, .ap-search { height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); font-size: .9rem; }
.ap-search { width: 190px; max-width: 100%; }
.ap-opt { display: inline-flex; align-items: center; gap: 4px; font-size: .86rem; color: var(--muted); }
.ap-spacer { flex: 1; }
.ap-x { width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 1.1rem; cursor: pointer; }
.ap-x:hover { background: var(--soft); color: var(--text); }
.ap-sum { padding: 10px 20px; font-size: .88rem; color: var(--muted); }
.ap-body { flex: 1; min-height: 0; overflow: auto; padding: 0 20px 28px; }
.ap-empty, .ap-hint { padding: 48px 16px; text-align: center; color: var(--muted); max-width: 560px; margin: 0 auto; line-height: 1.5; }
.ap-hint { padding: 0 0 14px; text-align: left; max-width: none; font-size: .9rem; }
.ap-table { border-collapse: separate; border-spacing: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.ap-table th, .ap-table td { border-bottom: 1px solid var(--line); }
.ap-table tbody tr:last-child th, .ap-table tbody tr:last-child td { border-bottom: 0; }
.ap-corner, .ap-row { position: sticky; left: 0; z-index: 3; background: var(--panel); text-align: left; min-width: 190px; max-width: 260px; padding: 8px 14px; border-right: 1px solid var(--line); white-space: nowrap; }
.ap-corner { top: 0; z-index: 4; font-size: .78rem; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; vertical-align: bottom; }
.ap-col { position: sticky; top: 0; z-index: 2; width: 36px; min-width: 36px; height: 150px; padding: 6px 0; background: var(--panel); vertical-align: bottom; text-align: center; }
.ap-ph { writing-mode: vertical-rl; transform: rotate(180deg); max-height: 136px; padding: 0; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: .78rem; text-align: left; }
.ap-ph:hover { color: var(--text); }
.ap-ph span { display: block; max-height: 136px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-col.is-cur .ap-ph { color: var(--text); font-weight: 700; }
.ap-col.is-cur, .ap-cell.is-cur { background: rgba(241, 196, 15, .1); }
.ap-cell { width: 36px; min-width: 36px; height: 42px; text-align: center; }
.ap-dot { display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 50%; color: #fff; font-size: .7rem; font-weight: 700; cursor: pointer; vertical-align: middle; }
.ap-dot.n1 { width: 11px; height: 11px; } .ap-dot.n2 { width: 20px; height: 20px; } .ap-dot.n3 { width: 26px; height: 26px; }
.ap-dot:hover { outline: 3px solid var(--accent); }
.ap-end, .ap-total { position: sticky; right: 0; z-index: 3; min-width: 150px; padding: 8px 14px; background: var(--panel); border-left: 1px solid var(--line); text-align: left; white-space: nowrap; }
.ap-end { top: 0; z-index: 4; font-size: .78rem; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; vertical-align: bottom; }
.ap-silent { margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--yellow-soft); color: var(--yellow-text); font-size: .72rem; }
.ap-silent.muted { background: var(--soft); color: var(--muted); }
.ap-bdot { display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; }
.ap-name { padding: 0; border: 0; background: none; color: var(--text); cursor: pointer; font-weight: 700; font-size: .92rem; text-align: left; }
.ap-name:hover { text-decoration: underline; }
tr.is-uncited .ap-name { font-weight: 400; color: var(--muted); }

/* ---------- Import de documents ---------- */
.imp { position: fixed; inset: 0; z-index: 210; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(20, 22, 40, .5); }
.imp-box { width: min(640px, 100%); max-height: 100%; display: flex; flex-direction: column; background: var(--panel); color: var(--text); border-radius: var(--radius-lg); box-shadow: 0 24px 70px rgba(20, 22, 40, .35); overflow: hidden; }
.imp-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line); font-size: 1.05rem; }
.imp-x { width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 1.1rem; cursor: pointer; }
.imp-x:hover { background: var(--soft); color: var(--text); }
.imp-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 22px 8px; display: flex; flex-direction: column; gap: 12px; }
.imp-file { font-size: .95rem; word-break: break-word; }
.imp-file span { color: var(--muted); }
.imp-note { font-size: .84rem; color: var(--muted); line-height: 1.45; }
.imp-info { padding: 8px 12px; background: var(--soft); border-radius: 10px; }
.imp-set { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px 10px; margin: 0; }
.imp-set legend { padding: 0 6px; font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.imp-radio { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; cursor: pointer; }
.imp-radio.is-off { opacity: .45; cursor: default; }
.imp-radio input { margin-top: 4px; }
.imp-radio span { display: flex; flex-direction: column; gap: 1px; }
.imp-radio small { color: var(--muted); font-size: .8rem; }
.imp-field { display: flex; flex-direction: column; gap: 4px; font-size: .84rem; color: var(--muted); }
.imp-input { height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); font-size: .95rem; }
.imp-preview { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; background: var(--bg); }
.imp-prev-title { font-weight: 700; font-size: .88rem; margin-bottom: 4px; }
.imp-prev-row { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: .88rem; }
.imp-prev-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-prev-row small, .imp-prev-more { color: var(--muted); font-size: .8rem; }
.imp-size { font-size: .84rem; color: var(--muted); }
.imp-size.is-over { color: #c0392b; font-weight: 700; }
.imp-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 22px; border-top: 1px solid var(--line); }
.imp-cancel, .imp-go { height: 40px; padding: 0 18px; border-radius: 10px; cursor: pointer; font-weight: 700; }
.imp-cancel { border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.imp-go { border: 0; background: var(--accent); color: #1e1e2d; }
.imp-go:disabled { opacity: .4; cursor: default; }
@media (max-width: 600px) { .imp { padding: 0; } .imp-box { border-radius: 0; height: 100%; } }

/* ---------- Mentions : « Mots non liés » ---------- */
.cite-find { margin-top: 6px; padding: 5px 10px; border: 1px dashed var(--line); border-radius: 8px; background: transparent; color: var(--accent-blue); cursor: pointer; font-size: .8rem; }
.cite-find:hover { background: var(--soft); border-color: var(--accent-blue); }
.mt { position: fixed; inset: 0; z-index: 210; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(20, 22, 40, .5); }
.mt-box { width: min(720px, 100%); max-height: 100%; display: flex; flex-direction: column; background: var(--panel); color: var(--text); border-radius: var(--radius-lg); box-shadow: 0 24px 70px rgba(20, 22, 40, .35); overflow: hidden; }
.mt-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); font-size: 1.05rem; }
.mt-x { width: 36px; height: 36px; flex: none; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 1.1rem; cursor: pointer; }
.mt-x:hover { background: var(--soft); color: var(--text); }
.mt-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 22px 8px; display: flex; flex-direction: column; gap: 12px; }
.mt-intro { margin: 0; font-size: .88rem; color: var(--muted); line-height: 1.5; }
.mt-opts { display: flex; flex-direction: column; gap: 8px; }
.mt-opt { display: flex; align-items: center; gap: 6px; font-size: .88rem; }
.mt-extra { gap: 10px; }
.mt-extra span { color: var(--muted); white-space: nowrap; }
.mt-input { flex: 1; min-width: 0; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); font-size: .88rem; }
.mt-list { display: flex; flex-direction: column; gap: 8px; }
.mt-empty { padding: 36px 12px; text-align: center; color: var(--muted); line-height: 1.5; }
.mt-group { border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.mt-ghead { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.mt-dot { width: 10px; height: 10px; flex: none; border-radius: 50%; }
.mt-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-count { flex: 1; color: var(--muted); font-size: .84rem; white-space: nowrap; }
.mt-toggle, .mt-more { padding: 3px 10px; border: 0; background: none; color: var(--accent-blue); cursor: pointer; font-size: .84rem; }
.mt-rows { border-top: 1px solid var(--line); padding: 4px 10px 8px; display: flex; flex-direction: column; }
.mt-row { display: flex; align-items: flex-start; gap: 10px; padding: 6px 2px; cursor: pointer; border-bottom: 1px solid var(--line); }
.mt-row:last-of-type { border-bottom: 0; }
.mt-row.is-off { opacity: .5; cursor: default; }
.mt-row input { margin-top: 4px; }
.mt-rowtxt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mt-ctx { font-size: .9rem; line-height: 1.45; overflow-wrap: anywhere; }
.mt-ctx mark { background: var(--yellow-soft); color: var(--yellow-text); padding: 0 2px; border-radius: 3px; font-weight: 700; }
.mt-where { color: var(--muted); font-size: .76rem; }
.mt-notes { font-size: .8rem; color: var(--muted); line-height: 1.45; }
.mt-foot { display: flex; align-items: center; gap: 8px; padding: 12px 22px; border-top: 1px solid var(--line); }
.mt-sum { flex: 1; font-size: .88rem; color: var(--muted); }
.mt-cancel, .mt-go { height: 40px; padding: 0 18px; border-radius: 10px; cursor: pointer; font-weight: 700; }
.mt-cancel { border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.mt-go { border: 0; background: var(--accent); color: #1e1e2d; }
.mt-go:disabled { opacity: .4; cursor: default; }
@media (max-width: 600px) { .mt { padding: 0; } .mt-box { border-radius: 0; height: 100%; } }

/* ---------- Notifications et @mentions ---------- */
.notif-bell { position: relative; }
.notif-badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent, #007a7b); color: #fff; font: 700 .68rem/16px system-ui, sans-serif; text-align: center; pointer-events: none; }
.notif-badge[hidden] { display: none; }
.notif-panel { position: fixed; z-index: 9000; max-height: min(70vh, 560px); display: flex; flex-direction: column; background: var(--panel, var(--bg)); color: var(--text); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 14px 40px rgba(0,0,0,.22); overflow: hidden; }
.notif-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notif-all { border: 0; background: none; color: var(--accent, #007a7b); font: inherit; font-size: .82rem; cursor: pointer; padding: 2px 4px; }
.notif-all:disabled { opacity: .4; cursor: default; }
.notif-list { overflow-y: auto; flex: 1; }
.notif-empty { padding: 22px 16px; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.notif-item { display: block; width: 100%; text-align: left; padding: 11px 14px 11px 18px; border: 0; border-bottom: 1px solid var(--line); background: none; color: inherit; font: inherit; cursor: pointer; position: relative; }
.notif-item:hover { background: var(--soft); }
.notif-item.unread::before { content: ''; position: absolute; left: 6px; top: 18px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent, #007a7b); }
.notif-head { font-size: .88rem; }
.notif-text { margin-top: 3px; font-size: .84rem; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notif-meta { margin-top: 3px; font-size: .75rem; color: var(--muted); }
.notif-foot { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: .83rem; cursor: pointer; }
.people-pop { position: absolute; left: 0; right: 0; bottom: 100%; margin-bottom: 4px; z-index: 50; background: var(--panel, var(--bg)); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.2); overflow: hidden; }
.people-pop[hidden] { display: none; }
.people-item { display: flex; align-items: baseline; gap: 8px; width: 100%; padding: 8px 12px; border: 0; background: none; color: var(--text); font: inherit; font-size: .88rem; text-align: left; cursor: pointer; }
.people-item span { color: var(--muted); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people-item:hover, .people-item.on { background: var(--soft); }
.mention { color: var(--accent, #007a7b); font-weight: 600; background: color-mix(in srgb, var(--accent, #007a7b) 12%, transparent); border-radius: 4px; padding: 0 3px; }
.mention-me { background: color-mix(in srgb, #f1c40f 40%, transparent); color: inherit; }

/* ---------- Donner mon avis ---------- */
.fb-ov { position: fixed; inset: 0; z-index: 9500; background: rgba(15, 17, 30, .5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.fb-ov[hidden] { display: none; }
.fb-box { position: relative; width: min(520px, 100%); max-height: 92vh; overflow-y: auto; background: var(--panel, var(--bg)); color: var(--text); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 50px rgba(0,0,0,.3); padding: 22px 22px 18px; }
.fb-box h2 { margin: 0 0 4px; font-size: 1.2rem; }
.fb-sub { margin: 0 0 14px; color: var(--muted); font-size: .92rem; line-height: 1.45; }
.fb-x { position: absolute; top: 10px; right: 10px; border: 0; background: transparent; color: var(--muted); font-size: 1.1rem; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.fb-x:hover { background: var(--btnh); }
.fb-kinds { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.fb-lbl { display: block; font-size: .9rem; margin-bottom: 6px; color: var(--muted); }
#fb-msg { width: 100%; box-sizing: border-box; resize: vertical; min-height: 120px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; line-height: 1.5; }
.fb-reply { display: flex; gap: 8px; align-items: center; margin: 12px 0 4px; font-size: .88rem; color: var(--muted); }
.fb-err { margin: 8px 0 0; color: #c0392b; font-size: .9rem; }
.fb-err[hidden], .fb-ok[hidden] { display: none; }
.fb-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

/* ---------- Visite guidée ---------- */
.tour-ov { position: fixed; inset: 0; z-index: 9800; }
.tour-ov.tour-plain { background: rgba(15, 17, 30, .55); }
.tour-spot { position: fixed; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(15, 17, 30, .55); border: 2px solid var(--accent); pointer-events: none; transition: left .2s, top .2s, width .2s, height .2s; }
.tour-spot[hidden] { display: none; }
.tour-bub { position: fixed; box-sizing: border-box; background: var(--panel, var(--bg)); color: var(--text); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 14px 40px rgba(0,0,0,.35); padding: 14px 16px 12px; }
.tour-count { font-size: .75rem; color: var(--muted); margin-bottom: 2px; }
.tour-bub h3 { margin: 0 0 6px; font-size: 1.05rem; }
.tour-txt { margin: 0 0 12px; font-size: .93rem; line-height: 1.5; }
.tour-nav { display: flex; align-items: center; gap: 8px; }
.tour-nav .sp { flex: 1; }
.tour-nav [hidden] { display: none; }
.dash-empty .btn { margin-top: 12px; }

/* Taille du projet */
.size-widget { margin-top: 12px; }
.size-widget[hidden] { display: none; }

/* Glisser-déposer un fichier */
.drop-hint { position: fixed; inset: 0; z-index: 9900; background: rgba(0, 122, 123, .18); display: flex; align-items: center; justify-content: center; pointer-events: none; }
.drop-hint[hidden] { display: none; }
.drop-hint > div { background: var(--panel, var(--bg)); color: var(--text); border: 2px dashed var(--accent); border-radius: 18px; padding: 28px 36px; text-align: center; box-shadow: 0 18px 50px rgba(0,0,0,.25); }
.drop-hint b { display: block; font-size: 1.15rem; margin-bottom: 6px; }
.drop-hint span { color: var(--muted); font-size: .92rem; }

/* Tableau de bord : une action principale, le reste plus discret */
.btn.primary { background: var(--accent); color: #1e1e2d; border-color: transparent; }
.btn.primary:hover { filter: brightness(.96); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn.quiet:hover { background: var(--btnh); color: var(--text); }
.layout-dots i[data-go] { cursor: pointer; }
.layout-dots i[data-go] { position: relative; }
.layout-dots i[data-go]::after { content: ''; position: absolute; inset: -9px -3px; }

/* Écrire sur téléphone : le menu du haut s'efface tant que le curseur est dans le texte (voir modes.js, initWritingFocus) */
.nav-peek-g { display: none; }
@media (max-width: 720px) and (pointer: coarse) {
  body.m-writing .nav { display: none; }
  body.m-writing.m-nav-open .nav { display: flex; }
  body.m-writing .nav-peek-g { display: inline-flex; }
  body.m-writing.m-nav-open #navPeek { background: var(--on); }
}

/* Feuille fantôme (Alt+I) */
.ghost { position: fixed; right: 24px; bottom: 24px; width: min(360px, calc(100vw - 32px)); z-index: 90; display: none; flex-direction: column;
  background: #fffbe6; color: #3a3320; border: 1px solid #e6d98a; border-radius: 10px; transform: rotate(-1.2deg);
  box-shadow: 0 18px 40px rgba(0,0,0,.28), 0 2px 6px rgba(0,0,0,.15); }
.ghost.open { display: flex; animation: ghost-in .18s ease-out; }
@keyframes ghost-in { from { opacity: 0; transform: translateY(10px) rotate(-3deg); } to { opacity: 1; transform: rotate(-1.2deg); } }
.ghost-head { padding: 8px 14px 0; font: 600 12px/1 var(--font, system-ui); letter-spacing: .08em; text-transform: uppercase; opacity: .55; }
.ghost textarea { height: min(260px, 40vh); margin: 6px 6px 0; padding: 8px 10px; border: 0; outline: 0; resize: none; background: transparent; color: inherit;
  font: 16px/1.55 Georgia, 'Lora', serif; background-image: repeating-linear-gradient(transparent 0 23px, rgba(120,100,20,.15) 23px 24px); background-attachment: local; line-height: 24px; }
.ghost-foot { padding: 4px 14px 8px; font-size: 11px; opacity: .5; }
@media (prefers-reduced-motion: reduce) { .ghost.open { animation: none; } }
@media (max-width: 720px) { .ghost { right: 16px; left: 16px; width: auto; bottom: 12px; } }

/* Mode focus : seule la page reste (voir script.js, setFocus) */
body.focus-mode { background: var(--bg); }
body.focus-mode .scroll { padding-top: 0; padding-bottom: 0; }
body.focus-mode #page { border-color: transparent; box-shadow: none; background: transparent; color: var(--text); font-size: 19px; line-height: 1.9;
  max-width: 700px; margin-top: 12vh; padding-bottom: 45vh; min-height: 100vh; }
body.focus-mode #stats { position: fixed; right: 18px; bottom: 12px; z-index: 12; opacity: .3; transition: opacity .3s; background: none; border: 0; }
body.focus-mode #stats:hover { opacity: .9; }
body.focus-mode #size-widget { display: none; }
body.focus-mode #exitFocus { opacity: .35; }
@media (prefers-reduced-motion: reduce) { body.focus-mode .nav, body.focus-mode .bar { transition: none; } }

body.focus-mode .nav, body.focus-mode .bar { top: 0; pointer-events: none; }
body.focus-mode .bar { top: 56px; transform: translateY(calc(-100% - 60px)); }
body.focus-mode.fm-peek .nav, body.focus-mode.fm-peek .bar,
body.focus-mode .nav:focus-within, body.focus-mode .bar:focus-within { transform: none; opacity: 1; pointer-events: auto; }
body.focus-mode::before { height: 36px; }

/* Accents mathématiques dessinés (vecteur, barre, chapeau, tilde, points) : voir math.js. Aucune police requise. */
.mx-vec, .mx-bar, .mx-hat, .mx-tilde, .mx-dot, .mx-ddot { position: relative; display: inline-block; vertical-align: baseline; padding-top: .36em; margin: 0 .1em; line-height: 1.15; }
.mx.mx-vec, .mx.mx-bar, .mx.mx-hat, .mx.mx-tilde, .mx.mx-dot, .mx.mx-ddot { display: inline-block; vertical-align: baseline; }
.mx-vec > [data-slot], .mx-bar > [data-slot], .mx-hat > [data-slot], .mx-tilde > [data-slot], .mx-dot > [data-slot], .mx-ddot > [data-slot] { min-width: .5em; }
.mx-vec::before, .mx-bar::before { content: ''; position: absolute; left: .1em; right: .1em; top: .16em; border-top: .07em solid currentColor; }
.mx-vec::after { content: ''; position: absolute; right: .08em; top: .16em; width: .22em; height: .22em; border-top: .07em solid currentColor; border-right: .07em solid currentColor; transform: translate(-.04em, -.115em) rotate(45deg); }
.mx-hat::before { content: ''; position: absolute; left: 50%; top: .2em; width: .22em; height: .22em; border-top: .07em solid currentColor; border-left: .07em solid currentColor; transform: translate(-50%, 0) rotate(45deg); }
.mx-tilde::before { content: '~'; position: absolute; left: 50%; top: -.04em; transform: translateX(-50%); line-height: 1; }
.mx-dot::before, .mx-ddot::before, .mx-ddot::after { content: ''; position: absolute; top: .14em; width: .1em; height: .1em; border-radius: 50%; background: currentColor; }
.mx-dot::before { left: 50%; transform: translateX(-50%); }
.mx-ddot::before { left: calc(50% - .17em); } .mx-ddot::after { left: calc(50% + .07em); }
.acc-demo { font-size: 1.15rem; padding-top: .4em; }

/* Roue des symboles (Alt+X) : voir symbol-wheel.js */
.sw { position: fixed; inset: 0; z-index: 95; display: none; pointer-events: none; }
.sw.open { display: block; }
.sw-stage { position: absolute; pointer-events: auto; border-radius: 50%; background: color-mix(in srgb, var(--panel) 94%, transparent); border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(0,0,0,.28); animation: sw-in .14s ease-out; }
@keyframes sw-in { from { opacity: 0; } to { opacity: 1; } }
.sw-stage::after { content: attr(data-hint); position: absolute; left: 50%; bottom: -30px; transform: translateX(-50%); font-size: 12px; color: var(--muted); white-space: nowrap; max-width: 90vw; overflow: hidden; text-overflow: ellipsis; }
.sw-btn { position: absolute; transform: translate(-50%, -50%); display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; cursor: pointer;
  border: 1px solid var(--line); background: var(--btn, var(--panel)); color: var(--text); border-radius: 50%; padding: 0; font-family: inherit; }
.sw-btn:hover, .sw-btn.sw-active { background: var(--accent); border-color: var(--accent); color: #1e1e2d; }
.sw-sym { width: 40px; height: 40px; font-size: 1.15rem; line-height: 1; }
.sw-sym.wide { width: 50px; border-radius: 20px; font-size: .85rem; }
.sw-cat { width: 74px; height: 56px; border-radius: 16px; }
.sw-cat .sw-g { font-size: 1.35rem; line-height: 1.1; }
.sw-n { font-size: .62rem; line-height: 1; opacity: .8; }
.sw-center { width: 58px; height: 58px; font-size: 1.1rem; background: var(--soft); }
@media (prefers-reduced-motion: reduce) { .sw-stage { animation: none; } }

.sw-btn.sw-off { opacity: .4; }
