/* Fenkra Preuves — charte Fenkra : bleu nuit #0E1A24, blanc cassé #F4F2EE, ocre #C27A2C
   Archivo (titres) · IBM Plex Sans (interface) · IBM Plex Mono (saisie) */

@font-face { font-family: "Archivo"; font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; src: url(../fonts/archivo-latin-wdth-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url(../fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: italic; font-display: swap; src: url(../fonts/ibm-plex-sans-latin-400-italic.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url(../fonts/ibm-plex-sans-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url(../fonts/ibm-plex-sans-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url(../fonts/ibm-plex-mono-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url(../fonts/ibm-plex-mono-latin-500-normal.woff2) format("woff2"); }

:root {
  /* Charte Fenkra (l'Assise V1.0), comme la plateforme Fenkra Formations */
  --nuit: #0E1A24; --creme: #F4F2EE; --blanc: #FFFFFF; --gris: #4A5763; --ocre: #C27A2C; --ocre-fonce: #8F5518; --trait: #D5D9DD; --papier: #E7E5E1;
  --bg: var(--creme); --surface: var(--blanc); --surface-2: #FAF9F7; --surface-3: var(--papier);
  --fg: var(--nuit); --muted: var(--gris); --border: var(--trait); --border-2: #C3C9CE;
  --accent: var(--ocre); --accent-ink: var(--ocre-fonce); --accent-soft: rgba(194,122,44,.10);
  --focus: var(--ocre);
  --paper: #FFFFFF; --ink: var(--nuit); --ink-soft: rgba(14,26,36,.045);
  --line: rgba(14,26,36,.055); --line-strong: rgba(14,26,36,.13); --margin: var(--ocre); --grid: rgba(14,26,36,.075);
  --st-todo: var(--gris); --st-doing: var(--ocre); --st-redo: var(--ocre-fonce); --st-done: var(--nuit);
  --erreur: #B3412E; /* seul rouge : vraie erreur (règle Fenkra, nov. 2026) */
  --warn: var(--ocre-fonce); --info: var(--gris);
  --shadow: 0 1px 0 rgba(14,26,36,.04);
  --ui: "IBM Plex Sans", "Segoe UI", Arial, sans-serif;
  --title: "Archivo", "Segoe UI", Arial, sans-serif;
  --mono: "IBM Plex Mono", Consolas, "Cambria Math", ui-monospace, monospace;
  --math: "Cambria Math", "Cambria", "STIX Two Text", "Latin Modern Roman", "Times New Roman", serif;
  --paper-size: 19px; --paper-lh: 32px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0B1218; --surface: #111B23; --surface-2: #16212A; --surface-3: #1E2A33;
  --fg: #F4F2EE; --muted: #A9B4BE; --border: #25313B; --border-2: #33414C;
  --accent: #D08A3E; --accent-ink: #E0A35F; --accent-soft: rgba(208,138,62,.12);
  --paper: #131D25; --ink: #EDEAE4; --ink-soft: rgba(244,242,238,.05);
  --line: rgba(244,242,238,.045); --line-strong: rgba(244,242,238,.11); --margin: #D08A3E; --grid: rgba(244,242,238,.06);
  --st-todo: #7C8791; --st-doing: #D08A3E; --st-redo: #E0A35F; --st-done: #F4F2EE;
  --erreur: #F09A80;
  --warn: #E0A35F; --info: #A9B4BE;
  color-scheme: dark;
}
:root[data-size="s"] { --paper-size: 17px; --paper-lh: 28px; }
:root[data-size="l"] { --paper-size: 22px; --paper-lh: 36px; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--ui); font-size: 14px; display: flex; flex-direction: column; overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.grow { flex: 1; }
kbd, code { font-family: var(--mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; }

/* ---------- Barre du haut (toujours bleu nuit) ---------- */
.top { display: flex; align-items: center; gap: 14px; padding: 8px 14px; background: #0E1A24; color: #F4F2EE; border-bottom: 1px solid #1d2c38; min-height: 54px; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; padding-right: 6px; }
.brand img { display: block; }
.brand-txt { display: flex; flex-direction: column; line-height: 1; }
.brand-kicker { font-family: var(--title); font-weight: 600; font-size: 9.5px; letter-spacing: .24em; text-transform: uppercase; color: #C27A2C; }
.brand-name { font-family: var(--title); font-stretch: 112%; font-weight: 600; font-size: 19px; letter-spacing: .14em; margin-top: 3px; }
.doc-name { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 0 1 460px; padding-left: 14px; border-left: 1px solid #263644; }
.doc-kind { font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #9AA4AD; white-space: nowrap; }
.doc-name input { border: 1px solid transparent; background: transparent; padding: 5px 8px; border-radius: 6px; min-width: 0; width: 100%; font-family: var(--title); font-weight: 700; font-size: 16px; color: #F4F2EE; }
.doc-name input:hover { border-color: #2c3f4e; }
.doc-name input:focus { border-color: #C27A2C; background: #13222E; outline: none; }
.save { font-size: 12px; color: #9AA4AD; white-space: nowrap; }
.save.ok { color: var(--muted); }
.save.bad { color: var(--erreur); }
.actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.top .seg { border-color: #2c3f4e; }
.top .seg button { background: transparent; color: #C9D0D6; }
.top .seg button[aria-pressed="true"] { background: #F4F2EE; color: #0E1A24; }
.btn.ghost { background: transparent; color: #E6E2DA; border-color: #2c3f4e; }
.btn.ghost:hover { border-color: #C27A2C; color: #fff; }

/* ---------- Boutons, segments ---------- */
.btn { border: 1px solid var(--border-2); background: var(--surface); padding: 6px 12px; border-radius: 8px; font-weight: 500; white-space: nowrap; line-height: 1.2; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--erreur); }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
.btn.icon { padding-left: 10px; padding-right: 10px; font-weight: 700; }
.seg { display: inline-flex; border: 1px solid var(--border-2); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 5px 10px; font-size: 12.5px; font-weight: 500; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button[aria-pressed="true"] { background: var(--nuit); color: var(--creme); }
.seg.wide { display: flex; width: 100%; }
.seg.wide button { flex: 1; padding: 7px 6px; }

.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); color: var(--fg); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 5px; z-index: 30; min-width: 250px; display: flex; flex-direction: column; }
.menu.up { top: auto; bottom: calc(100% + 6px); left: 0; right: auto; }
.menu button { border: 0; background: transparent; text-align: left; padding: 8px 10px; border-radius: 6px; }
.menu button:hover { background: var(--surface-2); }

/* ---------- Mise en page ---------- */
.app { flex: 1; min-height: 0; display: grid; grid-template-columns: 268px minmax(0, 1fr); }
.side { border-right: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.side-head { padding: 12px; display: flex; flex-direction: column; gap: 9px; border-bottom: 1px solid var(--border); }
.search { width: 100%; border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px; padding: 7px 10px; font-size: 13px; }
.search:focus { border-color: var(--accent); outline: none; }
.filters { display: flex; gap: 4px; flex-wrap: wrap; }
.filters:empty { display: none; }
.fchip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 2px 9px; font-size: 11.5px; display: inline-flex; align-items: center; gap: 5px; color: var(--muted); }
.fchip[aria-pressed="true"] { border-color: var(--fg); color: var(--fg); background: var(--surface-2); font-weight: 600; }
.fchip .n { font-variant-numeric: tabular-nums; opacity: .8; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: 0 0 auto; background: var(--st-todo); }
.dot.todo { background: transparent; box-shadow: inset 0 0 0 1.5px var(--st-todo); }
.dot.doing { background: var(--st-doing); }
.dot.redo { background: var(--st-redo); }
.dot.done { background: var(--st-done); }

.tree { flex: 1; overflow: auto; padding: 8px; }
.folder > summary { list-style: none; cursor: pointer; padding: 7px 8px; border-radius: 6px; font-family: var(--title); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.folder > summary::-webkit-details-marker { display: none; }
.folder > summary::before { content: "▸"; font-size: 10px; width: 10px; }
.folder[open] > summary::before { content: "▾"; }
.folder > summary .fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder > summary .cnt { font-family: var(--ui); letter-spacing: 0; font-weight: 500; font-size: 11px; }
.folder > summary:hover { background: var(--surface-2); }
.prog { height: 3px; border-radius: 3px; background: var(--surface-3); margin: 0 8px 4px 24px; overflow: hidden; display: flex; }
.prog i { display: block; height: 100%; }
.doc-btn { width: 100%; text-align: left; border: 0; background: transparent; padding: 6px 10px 6px 24px; border-radius: 6px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.doc-btn .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.doc-btn .typ { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.doc-btn:hover { background: var(--surface-2); }
.doc-btn[aria-current="true"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.doc-btn.root { padding-left: 10px; }
.hits-title { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 12px 8px 4px; }
.hit { width: 100%; text-align: left; border: 0; background: transparent; padding: 6px 8px; border-radius: 6px; display: block; }
.hit:hover { background: var(--surface-2); }
.hit b { display: block; font-weight: 600; font-size: 13px; }
.hit span { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hit mark { background: var(--accent-soft); color: inherit; border-radius: 2px; }
.side-foot { padding: 10px 12px; border-top: 1px solid var(--border); display: flex; gap: 6px; align-items: center; }
.empty { color: var(--muted); padding: 14px 10px; line-height: 1.55; font-size: 13px; }

/* ---------- Accueil ---------- */
.welcome { display: grid; place-items: center; padding: 30px; overflow: auto; background:
  radial-gradient(circle at 1px 1px, var(--grid) 1px, transparent 1.5px) 0 0 / 22px 22px, var(--bg); }
.welcome-in { text-align: center; max-width: 560px; }
.welcome h1 { font-family: var(--title); font-weight: 800; font-size: 40px; letter-spacing: -.02em; margin: 18px 0 6px; }
.welcome h1 span { color: var(--accent); }
.welcome .tag { color: var(--muted); font-size: 16px; margin: 0 0 24px; }
.welcome-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.welcome-actions .btn { padding: 9px 16px; }
.welcome-keys { margin-top: 30px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; text-align: left; }
.welcome-keys div { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; align-items: center; gap: 6px; }
.welcome-keys span { color: var(--muted); margin-left: 6px; font-size: 13px; }

/* ---------- Espace document ---------- */
.work { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.meta-bar { display: flex; align-items: center; gap: 14px; padding: 8px 14px; border-bottom: 1px solid var(--border); background: var(--surface); flex-wrap: wrap; }
.mf { display: flex; align-items: center; gap: 6px; }
.mf > .lab { font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.mf select, .mf input { border: 1px solid var(--border); background: var(--surface-2); border-radius: 7px; padding: 4px 8px; font-size: 13px; max-width: 220px; }
.mf input { width: 170px; }
.mf select:focus, .mf input:focus { border-color: var(--accent); outline: none; }
.stat { display: inline-flex; gap: 3px; }
.stat button { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 3px 10px 3px 8px; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.stat button[aria-pressed="true"] { color: var(--fg); font-weight: 600; border-color: currentColor; background: var(--surface-2); }
.stat button[aria-pressed="true"].done { color: var(--st-done); }
.stat button[aria-pressed="true"].redo { color: var(--st-redo); }
.stat button[aria-pressed="true"].doing { color: var(--st-doing); }
.stars { display: inline-flex; }
.stars button { border: 0; background: transparent; padding: 0 1px; font-size: 16px; color: var(--border-2); line-height: 1; }
.stars button.on { color: var(--accent); }

.split { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.app.v-edit .split { grid-template-columns: minmax(0, 1fr) 0; }
.app.v-edit .copy { display: none; }
.app.v-copy .split { grid-template-columns: 0 minmax(0, 1fr); }
.app.v-copy .draft { display: none; }

.pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.draft { border-right: 1px solid var(--border); background: var(--surface); }
.tabs { display: flex; gap: 2px; padding: 8px 12px 0; border-bottom: 1px solid var(--border); background: var(--surface); }
.tab { border: 0; background: transparent; padding: 8px 14px 9px; font-weight: 600; font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 7px; align-items: center; }
.tab[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); }
.tab .k { font-family: var(--mono); font-size: 10px; color: var(--muted); font-weight: 400; }
.tab .fill { width: 6px; height: 6px; border-radius: 50%; background: var(--border-2); }
.tab .fill.on { background: var(--accent); }

.blocks, .palette { display: flex; gap: 4px; flex-wrap: wrap; padding: 6px 12px; border-bottom: 1px solid var(--border); }
.blk { border: 1px solid var(--border); background: var(--surface-2); border-radius: 6px; padding: 3px 8px; font-size: 12px; }
.blk:hover { border-color: var(--accent); color: var(--accent-ink); }
.blk i { font-family: var(--math); font-style: normal; font-weight: 700; color: var(--accent-ink); }
.chip { border: 1px solid var(--border); background: var(--surface-2); border-radius: 6px; padding: 2px 7px; display: inline-flex; align-items: baseline; gap: 5px; }
.chip kbd { border: 0; background: transparent; padding: 0; font-size: 10px; color: var(--muted); }
.chip b { font-family: var(--math); font-weight: 400; font-size: 15px; }
.chip:hover, .chip.on { border-color: var(--accent); color: var(--accent-ink); }
.strip { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 6px 12px; background: var(--accent-soft); border-bottom: 1px solid var(--border); }
.strip .hint { color: var(--muted); font-size: 12px; margin-right: 6px; }
.sym { border: 1px solid transparent; background: var(--surface); border-radius: 6px; padding: 2px 8px; display: inline-flex; align-items: baseline; gap: 4px; }
.sym small { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.sym span { font-family: var(--math); font-size: 18px; }
.sym.cite-pick span { font-family: var(--ui); font-size: 13px; }
.sym.cur { border-color: var(--accent); color: var(--accent-ink); }
.editors { flex: 1; min-height: 0; display: flex; }
.editors textarea { flex: 1; width: 100%; resize: none; border: 0; padding: 16px 18px; background: var(--surface); color: var(--fg); font-family: var(--mono); font-size: 15px; line-height: 1.75; tab-size: 2; }
.editors textarea:focus { outline: none; }
.editors textarea::placeholder { color: var(--muted); opacity: .7; }

.copy { background: var(--bg); position: relative; }
.copy-head { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-bottom: 1px solid var(--border); background: var(--surface); min-height: 41px; }
.label { font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--surface-3); font-size: 11px; text-align: center; margin-left: 4px; font-variant-numeric: tabular-nums; }
.badge.warn { background: var(--warn); color: #fff; }
.badge.ok { background: var(--st-done); color: #fff; }
.copy-scroll { flex: 1; overflow: auto; padding: 20px; }

/* ---------- La copie ---------- */
.paper {
  max-width: 840px; margin: 0 auto; min-height: 100%; border-radius: 3px; padding: var(--paper-lh) 26px 64px 76px; box-shadow: var(--shadow);
  background-color: var(--paper);
  background-image:
    linear-gradient(90deg, transparent 55px, var(--margin) 55px, var(--margin) 56px, transparent 56px),
    repeating-linear-gradient(180deg, transparent 0 calc(var(--paper-lh) - 1px), var(--line-strong) calc(var(--paper-lh) - 1px) var(--paper-lh)),
    repeating-linear-gradient(180deg, transparent 0 calc(var(--paper-lh) / 4 - 1px), var(--line) calc(var(--paper-lh) / 4 - 1px) calc(var(--paper-lh) / 4));
  font-family: var(--math); font-size: var(--paper-size); line-height: var(--paper-lh); color: var(--ink);
}
.paper.grid {
  background-image:
    repeating-linear-gradient(90deg, transparent 0 19px, var(--grid) 19px 20px),
    repeating-linear-gradient(180deg, transparent 0 19px, var(--grid) 19px 20px);
  padding-left: 40px;
}
.paper.card { background-image: none; padding: 34px 40px 56px; }
.paper .ln { white-space: pre-wrap; min-height: var(--paper-lh); overflow-wrap: anywhere; }
.paper [data-line] { cursor: text; border-radius: 2px; }
.paper [data-line]:hover { background: var(--ink-soft); }
.paper [data-line].flash { background: var(--accent-soft); }
.paper .li::before { content: "–"; margin-left: -1em; display: inline-block; width: 1em; }
.paper .disp { text-align: center; }
.paper h2 { margin: 0; font-size: 1.1em; line-height: var(--paper-lh); font-weight: 700; text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }
.paper h3 { margin: 0; font-size: 1em; line-height: var(--paper-lh); font-weight: 700; }
.paper .kw { font-style: italic; font-weight: 700; }
.paper .boxed { border: 1.5px solid currentColor; padding: 1px 10px; border-radius: 2px; }
.paper .note { color: var(--muted); font-style: italic; }
.paper sub, .paper sup { font-size: .68em; line-height: 0; }
.paper .katex { font-size: 1.04em; }
.paper .katex-display { margin: 0; }
.paper .math-err { color: var(--erreur); text-decoration: underline wavy; }
.paper .cite { font: inherit; font-size: .82em; font-family: var(--ui); font-weight: 600; border: 1px solid var(--accent); color: var(--accent-ink); background: var(--accent-soft); border-radius: 4px; padding: 0 6px; line-height: 1.5; vertical-align: 1px; }
.paper .cite::before { content: "▸ "; font-size: .8em; }
.paper .cite.missing { border-style: dashed; background: transparent; }
.ph { margin-bottom: var(--paper-lh); }
.ph-kicker { font-family: var(--ui); font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-ink); line-height: var(--paper-lh); height: var(--paper-lh); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ph h1 { font-family: var(--title); font-weight: 800; font-size: 1.45em; line-height: calc(var(--paper-lh) * 2); margin: 0; color: var(--ink); letter-spacing: -.01em; }
.ph-stars { color: var(--accent); font-family: var(--ui); font-size: 13px; margin-left: 10px; letter-spacing: 2px; }
.box-enonce { border-left: 3px solid var(--ink); background: var(--ink-soft); padding: 0 14px; margin: 0 0 var(--paper-lh) -14px; }
.paper.card .box-enonce { margin-left: 0; }
.sec-lbl { font-family: var(--ui); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); line-height: var(--paper-lh); height: var(--paper-lh); }
.ph-empty { color: var(--muted); font-style: italic; }
.fiche-type { display: inline-block; font-family: var(--ui); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #fff; background: var(--accent); padding: 2px 8px; border-radius: 4px; line-height: 1.6; }
.backlinks { margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--border); font-family: var(--ui); font-size: 13px; line-height: 1.6; color: var(--muted); }
.backlinks button { border: 1px solid var(--border); background: var(--surface-2); border-radius: 6px; padding: 2px 8px; margin: 3px 4px 0 0; color: var(--fg); }

/* ---------- Relecture ---------- */
.lint { position: absolute; left: 12px; right: 12px; bottom: 12px; max-height: 46%; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); z-index: 5; }
.lint-head { display: flex; align-items: baseline; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.lint-head .sub { color: var(--muted); font-size: 12px; flex: 1; }
.lint-list { list-style: none; margin: 0; padding: 6px; }
.lint-list li button { width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; display: grid; grid-template-columns: 74px 1fr; gap: 8px; line-height: 1.45; }
.lint-list li button:hover { background: var(--surface-2); }
.lint-list .lv { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding-top: 2px; }
.lint-list .lv.warn { color: var(--warn); }
.lint-list .lv.info { color: var(--info); }
.lint-list .where { color: var(--muted); font-size: 11.5px; display: block; }
.lint-ok { padding: 14px; color: var(--st-done); font-weight: 500; }

/* ---------- Révision ---------- */
.review { overflow: auto; padding: 28px 32px 40px; }
.review h1 { font-family: var(--title); font-weight: 800; font-size: 28px; margin: 0 0 4px; letter-spacing: -.01em; }
.review .lead { color: var(--muted); margin: 0 0 22px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 26px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.kpi b { display: block; font-family: var(--title); font-size: 30px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi span { color: var(--muted); font-size: 12.5px; }
.kpi.redo b { color: var(--st-redo); }
.kpi.done b { color: var(--st-done); }
.rv-cols { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.card-box { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.card-box h2 { font-family: var(--title); font-size: 15px; font-weight: 700; margin: 0; padding: 14px 16px 10px; display: flex; align-items: center; gap: 8px; }
.card-box .none { padding: 0 16px 16px; color: var(--muted); }
.rv-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--border); }
.rv-row .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-row .sb { color: var(--muted); font-size: 12px; }
.rv-row .acts { display: flex; gap: 6px; }
.ch-row { padding: 10px 16px; border-top: 1px solid var(--border); }
.ch-row .top-line { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 6px; }
.ch-row .top-line b { font-weight: 600; }
.ch-row .top-line span { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { display: flex; height: 8px; border-radius: 6px; overflow: hidden; background: var(--surface-3); }
.bar i { display: block; height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 10px 16px 14px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Panneaux, dialogues ---------- */
.panel { position: fixed; inset: 62px 16px auto auto; width: min(1000px, calc(100vw - 32px)); max-height: calc(100vh - 80px); overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 16px 50px rgba(0,0,0,.25); z-index: 20; }
.panel .head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.panel h2 { margin: 0; font-family: var(--title); font-size: 17px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; padding: 16px; }
.cols h3, .help h3 { margin: 0 0 4px; font-size: 14px; font-family: var(--title); }
.cols p.sub { margin: 0 0 8px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.cols > div > .btn { margin-top: 8px; }
.rows { display: flex; flex-direction: column; gap: 4px; max-height: 360px; overflow: auto; padding-right: 4px; }
.row { display: grid; grid-template-columns: 78px minmax(0, 1fr) 26px; gap: 4px; align-items: center; }
.row input { width: 100%; min-width: 0; border: 1px solid var(--border); background: var(--surface-2); border-radius: 6px; padding: 5px 7px; font-family: var(--mono); font-size: 13px; }
.row .del { border: 0; background: transparent; color: var(--muted); }
.row .del:hover { color: var(--erreur); }
.panel .foot { display: flex; gap: 10px; flex-wrap: wrap; padding: 0 16px 16px; align-items: center; }
.help { padding: 16px; line-height: 1.6; }
.help-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.help table { border-collapse: collapse; margin-top: 4px; font-size: 13px; }
.help td { padding: 4px 12px 4px 0; vertical-align: top; }
.help td:first-child { white-space: nowrap; }

.dialog { position: fixed; inset: 0; background: rgba(8,14,20,.45); display: grid; place-items: center; z-index: 40; padding: 16px; }
.dialog .box { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; width: min(480px, 100%); display: flex; flex-direction: column; gap: 12px; box-shadow: 0 16px 50px rgba(0,0,0,.3); max-height: calc(100vh - 32px); overflow: auto; }
.dialog h3 { margin: 0; font-family: var(--title); font-size: 18px; }
.dialog p { margin: 0; color: var(--muted); line-height: 1.5; }
.dialog p:empty { display: none; }
.fields { display: flex; flex-direction: column; gap: 10px; }
.fields:empty { display: none; }
.fields label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.fields input, .fields select { border: 1px solid var(--border-2); background: var(--surface-2); border-radius: 8px; padding: 8px 10px; font-size: 14px; font-weight: 400; color: var(--fg); }
.fields input:focus, .fields select:focus { border-color: var(--accent); outline: none; }
.verlist { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; max-height: 320px; overflow: auto; }
.verlist div { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--border); }
.verlist div:first-child { border-top: 0; }
.dialog .btns { display: flex; justify-content: flex-end; gap: 8px; }
.dialog .error { color: var(--erreur); font-size: 13px; min-height: 1em; }

.pop { position: fixed; z-index: 35; width: min(460px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.25); overflow: hidden; }
.pop .pop-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.pop .pop-head b { flex: 1; font-family: var(--title); }
.pop .pop-body { padding: 10px 16px 14px; max-height: 300px; overflow: auto; font-family: var(--math); font-size: 17px; line-height: 28px; color: var(--ink); }
.pop .pop-body .ln { white-space: pre-wrap; }
.pop .pop-body .kw { font-style: italic; font-weight: 700; }
.pop .pop-body .boxed { border: 1.5px solid currentColor; padding: 1px 8px; }
.pop .pop-body .note { color: var(--muted); font-style: italic; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--nuit); color: var(--creme); padding: 9px 16px; border-radius: 10px; font-weight: 500; z-index: 50; max-width: calc(100vw - 32px); box-shadow: var(--shadow); border-left: 3px solid var(--ocre); }

@media (max-width: 1100px) {
  .brand-txt { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rv-cols { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  body { overflow: auto; }
  .app { grid-template-columns: 1fr; }
  .side { max-height: 300px; border-right: 0; border-bottom: 1px solid var(--border); }
  .editors textarea { min-height: 50vh; }
}

@media print {
  @page { margin: 16mm 16mm; }
  html, body { height: auto; overflow: visible; background: #fff; display: block; }
  .top, .side, .draft, .panel, .toast, .dialog, .meta-bar, .copy-head, .lint, .pop, .welcome, .review { display: none !important; }
  .app, .work, .split, .copy, .copy-scroll { display: block !important; overflow: visible !important; height: auto !important; padding: 0 !important; background: #fff !important; }
  .paper, .paper.grid, .paper.card { box-shadow: none; max-width: none; padding: 0; background: none !important; color: #000; --ink: #000; --ink-soft: #f2f2f2; --paper-size: 12.5pt; --paper-lh: 1.7em; }
  .paper [data-line]:hover { background: none; }
  .paper .cite { border: 0; background: none; padding: 0; color: #000; font-style: italic; }
  .paper .cite::before { content: ""; }
}

/* =====================================================================
   Charte Fenkra Formations : blanc cassé, bleu nuit en accent, ocre pour les repères,
   angles droits, Archivo élargi (112 %), IBM Plex Sans / Mono.
   ===================================================================== */
*, *::before, *::after { border-radius: 0 !important; }
.top { min-height: 64px; background: var(--nuit); border-bottom: 0; padding: 0 18px; }
.brand { gap: 12px; }
.brand .brand-sym { width: 24px; height: 24px; fill: var(--creme); flex: none; }
.brand .brand-sym .bloc { fill: var(--ocre); }
.brand .mot { font-family: var(--title); font-stretch: 112%; font-weight: 600; font-size: 17px; letter-spacing: .14em; }
.brand .sous { font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; padding-left: 12px; border-left: 1px solid var(--gris); color: var(--ocre); }
.doc-name { border-left-color: var(--gris); }
.doc-kind { font-family: var(--mono); font-weight: 500; letter-spacing: .14em; color: #A9B4BE; }
.doc-name input { font-family: var(--title); font-stretch: 112%; font-weight: 600; font-size: 16px; }
.doc-name input:focus { background: #16242F; border-color: var(--ocre); }
.save, .save.ok { color: #A9B4BE; font-family: var(--mono); font-size: 11.5px; }
.top .seg { border-color: var(--gris); }
.top .seg button { color: #D7DCE0; }
.top .seg button + button { border-left-color: var(--gris); }
.top .seg button[aria-pressed="true"] { background: var(--creme); color: var(--nuit); }
.btn.ghost { color: var(--creme); border-color: var(--gris); background: transparent; }
.btn.ghost:hover { border-color: var(--creme); color: var(--creme); }

.btn { border-color: var(--border-2); font-weight: 600; }
.btn:hover { border-color: var(--fg); }
.btn.primary { background: var(--nuit); border-color: var(--nuit); color: var(--creme); }
.btn.primary:hover { filter: none; background: #1A2A37; }
:root[data-theme="dark"] .btn.primary { background: var(--creme); border-color: var(--creme); color: var(--nuit); }
.btn.danger { color: var(--ocre-fonce); }
:root[data-theme="dark"] .btn.danger { color: var(--accent-ink); }
.seg button[aria-pressed="true"] { background: var(--nuit); color: var(--creme); }
:root[data-theme="dark"] .seg button[aria-pressed="true"] { background: var(--creme); color: var(--nuit); }

.welcome h1, .review h1, .ph h1, .panel h2, .dialog h3, .card-box h2, .kpi b, .cols h3, .help h3, .rc-head h1 {
  font-family: var(--title); font-stretch: 112%; font-weight: 600; letter-spacing: 0; }
.welcome h1 { font-size: 44px; }
.welcome h1 span { color: var(--fg); }
.label, .mf > .lab, .folder > summary, .hits-title, .sec-lbl, .ph-kicker, .lint-list .lv, .tab .k, .fiche-type, .repere {
  font-family: var(--mono); font-weight: 500; letter-spacing: .14em; }
.ph-kicker, .repere { color: var(--accent-ink); text-transform: uppercase; font-size: 12px; }
.folder > summary { font-size: 11.5px; }

.side-head .seg.wide button { font-size: 12px; padding: 7px 2px; }
.search:focus, .mf select:focus, .mf input:focus, .fields input:focus, .fields select:focus { border-color: var(--fg); }
.doc-btn[aria-current="true"] { background: var(--bg); color: var(--fg); box-shadow: inset 3px 0 0 var(--fg); }
.fchip[aria-pressed="true"] { background: var(--nuit); color: var(--creme); border-color: var(--nuit); }
:root[data-theme="dark"] .fchip[aria-pressed="true"] { background: var(--creme); color: var(--nuit); }
.stat button[aria-pressed="true"], .stat button[aria-pressed="true"].done, .stat button[aria-pressed="true"].redo, .stat button[aria-pressed="true"].doing {
  background: var(--nuit); color: var(--creme); border-color: var(--nuit); }
.stat button[aria-pressed="true"].redo { background: var(--ocre); border-color: var(--ocre); }
.stat button[aria-pressed="true"] .dot { background: var(--creme); box-shadow: none; }
.tab[aria-selected="true"] { border-bottom-color: var(--fg); }
.tab .fill.on { background: var(--fg); }
.blk:hover, .chip:hover, .chip.on { border-color: var(--fg); color: var(--fg); }
.blk i { color: var(--accent-ink); }
.box-enonce { border-left-color: var(--fg); background: var(--ink-soft); }
.fiche-type { background: var(--nuit); color: var(--creme); }
:root[data-theme="dark"] .fiche-type { background: var(--creme); color: var(--nuit); }
.paper { box-shadow: 0 0 0 1px var(--border); }
.kpis { gap: 1px; background: var(--border); border: 1px solid var(--border); }
.kpi { border: 0; }
.kpi.done b { color: var(--fg); }
.kpi.redo b { color: var(--ocre); }
.card-box, .dialog .box, .panel, .pop, .menu, .lint { box-shadow: 0 10px 30px rgba(14,26,36,.12); }
.card-box { box-shadow: none; }
.bar, .prog { background: var(--border); }
.badge.ok { background: var(--fg); color: var(--bg); }
.badge.warn { background: var(--ocre); }
.lint-ok { color: var(--fg); }
.welcome .assise-geante { width: 112px; height: 112px; }
.welcome .assise-geante rect, .welcome .assise-geante path { fill: var(--fg); }
.welcome .assise-geante .bloc { fill: var(--ocre); }
.toast { background: var(--nuit); color: var(--creme); }

/* ---------- Recueils ---------- */
.recueil { overflow: auto; padding: 32px 36px 48px; }
.rc-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.rc-head h1 { font-size: 34px; margin: 8px 0 4px; }
.rc-head .lead { color: var(--muted); margin: 0; }
.rc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.rc-actions .btn { min-height: 40px; padding: 0 16px; }
.rc-opts { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 0 16px; border-top: 2px solid var(--fg); }
.rc-list { overflow: hidden; }
.rc-row { display: grid; grid-template-columns: 34px 10px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--border); }
.rc-row:first-child { border-top: 0; }
.rc-row .num { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.rc-row .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-row .sb { color: var(--muted); font-size: 12.5px; }
.rc-row .acts { display: flex; gap: 6px; }
.rc-row .btn[disabled] { opacity: .35; cursor: default; }
.checks { display: flex; flex-direction: column; gap: 2px; }
.checks.scroll { max-height: 46vh; overflow: auto; border: 1px solid var(--border); padding: 6px; margin-top: 8px; }
.checks > .btn { align-self: flex-start; margin-top: 8px; }
.chk { display: flex; align-items: center; gap: 9px; padding: 6px 8px; cursor: pointer; font-size: 14px; font-weight: 400 !important; color: var(--fg) !important; flex-direction: row !important; }
.chk:hover { background: var(--surface-2); }
.chk input { accent-color: var(--nuit); width: 16px; height: 16px; margin: 0; }
.chk.inline { padding: 0; }
.chk.inline:hover { background: none; }
.chk-group { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-ink); padding: 10px 8px 4px; }
.chk-group:first-child { padding-top: 4px; }
.print-area { display: none; }
.pr-cover { min-height: 0 !important; background-image: none !important; padding: 28px 40px !important; }
.pr-title { font-family: var(--title); font-stretch: 112%; font-weight: 600; font-size: 30px; margin: 6px 0 4px; }
.pr-sub { font-family: var(--ui); color: var(--muted); margin: 0; font-size: 14px; }

@media print {
  body.printing-recueil .top, body.printing-recueil .app { display: none !important; }
  body.printing-recueil .print-area { display: block !important; }
  .print-area .paper { box-shadow: none; max-width: none; padding: 0 !important; background: none !important; color: #000; --ink: #000; --ink-soft: #f3f3f3; --paper-size: 12.5pt; --paper-lh: 1.7em; min-height: 0; margin: 0 0 22pt; break-inside: auto; }
  .print-area .pr-ex .ph { break-after: avoid; margin-bottom: 6pt; }
  .print-area .pr-ex .ph h1 { font-size: 15pt; line-height: 1.4; }
  .print-area .box-enonce { break-inside: avoid; margin-left: 0; padding: 4pt 10pt; }
  .print-area .pr-break { break-before: page; }
  .print-area .pr-cover { border-bottom: 2px solid #000; padding: 0 0 10pt !important; margin-bottom: 18pt; }
  .print-area .cite { border: 0; background: none; padding: 0; color: #000; font-style: italic; }
  .print-area .cite::before { content: ""; }
}
.btn.ghost.install { border-color: var(--ocre); color: var(--creme); }
.btn.ghost.install:hover { background: var(--ocre); border-color: var(--ocre); }

/* =====================================================================
   Navigation et mise en page réglable : bibliothèque repliable, séparateurs à glisser,
   zoom, outils repliables, disposition côte à côte / dessus-dessous, mode immersion.
   ===================================================================== */
.app { grid-template-columns: var(--side-w, 268px) minmax(0, 1fr); }
.app.side-off { grid-template-columns: minmax(0, 1fr); }
.app.side-off .side { display: none; }
.side { position: relative; }
.side-gutter { position: absolute; top: 0; right: -4px; bottom: 0; width: 8px; cursor: col-resize; z-index: 6; }
.side-gutter:hover, .side-gutter.drag { background: rgba(194,122,44,.35); }
.side-toggle { padding: 6px 10px; font-size: 15px; }

.split { grid-template-columns: minmax(0, var(--fa, 1fr)) 8px minmax(0, var(--fb, 1fr)); grid-template-rows: minmax(0, 1fr); }
.split.vert { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, var(--fa, 1fr)) 8px minmax(0, var(--fb, 1fr)); }
.app.v-edit .split, .app.v-copy .split { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.app.v-edit .copy, .app.v-edit .gutter { display: none; }
.app.v-copy .draft, .app.v-copy .gutter { display: none; }
.app.v-copy .copy { display: flex; }
.draft { border-right: 0; }
.gutter { background: var(--border); cursor: col-resize; position: relative; z-index: 4; }
.split.vert .gutter { cursor: row-resize; }
.gutter::after { content: ""; position: absolute; left: 50%; top: 50%; width: 2px; height: 34px; transform: translate(-50%, -50%); background: var(--muted); opacity: .5; }
.split.vert .gutter::after { width: 34px; height: 2px; }
.gutter:hover, .gutter.drag { background: var(--ocre); }
body.dragging, body.dragging * { user-select: none !important; }
body.dragging.col { cursor: col-resize !important; }
body.dragging.row { cursor: row-resize !important; }

.draft-head { display: flex; align-items: flex-end; gap: 8px; border-bottom: 1px solid var(--border); background: var(--surface); padding-right: 10px; }
.draft-head .tabs { border-bottom: 0; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.head-tools { display: flex; gap: 4px; padding-bottom: 6px; flex: none; }
.mini { border: 1px solid var(--border-2); background: var(--surface); padding: 3px 8px; font-size: 12px; font-weight: 600; line-height: 1.3; color: var(--fg); }
.mini:hover { border-color: var(--fg); }
.mini[aria-pressed="true"] { background: var(--nuit); color: var(--creme); border-color: var(--nuit); }
.tab { white-space: nowrap; }
.tools { flex: 0 1 auto; max-height: 38%; overflow: auto; border-bottom: 1px solid var(--border); }
.tools .blocks, .tools .palette { border-bottom: 0; }
.tools .palette { border-top: 1px dashed var(--border); }
.tools.off { display: none; }
.editors { min-height: 140px; }
.editors textarea { font-size: var(--ed-size, 15px); }
.copy-head .mini { margin-right: 2px; }

/* ---------- Mode immersion ---------- */
.focus-bar { display: none; align-items: center; gap: 8px; padding: 6px 12px; background: var(--nuit); color: var(--creme); flex-wrap: wrap; }
.focus-bar .fb-name { font-family: var(--title); font-stretch: 112%; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30vw; }
.focus-bar .save { margin-left: 4px; }
.focus-bar .btn { background: transparent; color: var(--creme); border-color: var(--gris); }
.focus-bar .btn:hover { border-color: var(--creme); }
.focus-bar .btn.primary { background: var(--ocre); border-color: var(--ocre); color: #fff; }
.focus-bar .seg { border-color: var(--gris); }
.focus-bar .seg button { background: transparent; color: #D7DCE0; }
.focus-bar .seg button + button { border-left-color: var(--gris); }
.focus-bar .seg button[aria-pressed="true"] { background: var(--creme); color: var(--nuit); }
body.focus .top, body.focus .side, body.focus .meta-bar { display: none !important; }
body.focus .app { grid-template-columns: minmax(0, 1fr); }
body.focus .focus-bar { display: flex; }
body.focus .copy-scroll { padding: 14px; }

@media print {
  .gutter, .focus-bar, .draft-head, .tools { display: none !important; }
  .split, .split.vert { display: block !important; }
}
.copy-head { flex-wrap: wrap; row-gap: 4px; }

/* ---------- Questions (§ D1, § D2…) ---------- */
.qnav { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; padding: 6px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.qnav .label { margin-right: 4px; }
.qchip { border: 1px solid var(--fg); background: var(--surface); color: var(--fg); padding: 2px 10px; font-family: var(--mono); font-size: 12.5px; font-weight: 500; }
.qchip:hover { background: var(--nuit); color: var(--creme); }
.qchip.todo { border-style: dashed; color: var(--muted); border-color: var(--border-2); }
.qchip.add { border-color: var(--ocre); color: var(--accent-ink); font-family: var(--ui); font-weight: 600; }
.qchip.add:hover { background: var(--ocre); color: #fff; }
.qhint { color: var(--muted); font-size: 12px; margin-left: 6px; }
.paper .q-block { margin-top: var(--paper-lh); }
.paper .q-tag { min-height: var(--paper-lh); line-height: var(--paper-lh); }
.paper .q-tag span { font-family: var(--mono); font-weight: 600; font-size: .78em; letter-spacing: .06em; background: var(--nuit); color: var(--creme); padding: 2px 10px; }
.paper .box-enonce.q { margin-bottom: 0; padding-top: 0; }
.paper .q-missing { color: var(--accent-ink); font-style: italic; font-size: .85em; }
.paper .q-add { cursor: pointer; }
.paper .q-add u { color: var(--accent-ink); }

/* ---------- Page de chapitre ---------- */
.chapitre { overflow: auto; padding: 32px 36px 48px; }
.ch-prog { display: flex; align-items: center; gap: 14px; padding: 14px 0 20px; border-top: 2px solid var(--fg); }
.ch-prog .bar { flex: 1; height: 8px; }
.ch-prog span { color: var(--muted); font-size: 13px; font-family: var(--mono); white-space: nowrap; }
.ch-cols { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.chapitre .card-box .none { padding: 0 16px 16px; }
@media (max-width: 1100px) { .ch-cols { grid-template-columns: 1fr; } }
.fopen { margin-left: 6px; border: 1px solid var(--border-2); background: var(--surface); font-family: var(--ui); font-size: 10.5px; letter-spacing: 0; text-transform: none; padding: 0 6px; color: var(--fg); visibility: hidden; }
.folder > summary:hover .fopen, .fopen:focus-visible { visibility: visible; }
.fopen:hover { background: var(--nuit); color: var(--creme); border-color: var(--nuit); }
.rc-sel { border: 1px solid var(--border-2); background: var(--surface); padding: 4px 8px; font-size: 13px; }
@media print { .paper .q-add, .paper .q-missing { display: none !important; } .paper .q-tag span { background: none; color: #000; border: 1px solid #000; } }

/* ---------- Parcours du chapitre (blocs « Pour ») ---------- */
.parcours { display: flex; flex-direction: column; gap: 14px; }
.bloc-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 14px 16px 10px; flex-wrap: wrap; }
.bloc-head h2 { padding: 0; margin: 4px 0 0; font-size: 18px; }
.bloc-side { display: flex; align-items: center; gap: 8px; }
.bloc-side .bar { width: 90px; height: 6px; }
.bloc-side span { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.pc-row { display: grid; grid-template-columns: 92px 10px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--border); }
.pc-row .ty { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-ink); }
.pc-row .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-row .sb { color: var(--muted); font-size: 12.5px; }
.doc-btn .typ { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; color: var(--accent-ink); }

/* ---------- Carnet d'erreurs ---------- */
.err-btn.has { border-color: var(--ocre); color: var(--accent-ink); }
.sub-help { margin: 0 0 8px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.err-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 6px; }
.echip { border: 1px dashed var(--border-2); background: var(--surface); padding: 4px 10px; font-size: 13px; color: var(--muted); }
.echip.on { border-style: solid; border-color: var(--ocre); background: var(--accent-soft); color: var(--fg); font-weight: 600; }
.err-row { padding: 10px 16px; border-top: 1px solid var(--border); }
.err-t { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.err-n { font-family: var(--mono); font-size: 12px; color: var(--accent-ink); }
.err-ex { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.echip-link { border: 1px solid var(--border); background: var(--surface-2); padding: 1px 8px; font-size: 12px; color: var(--fg); }
.echip-link:hover { border-color: var(--fg); }

/* ---------- Restitution ---------- */
.resti-last { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.paper .resti-hidden { margin-top: var(--paper-lh); border: 1.5px dashed var(--border-2); color: var(--muted); font-family: var(--ui); font-size: 13px; text-align: center; line-height: calc(var(--paper-lh) * 2); letter-spacing: .1em; text-transform: uppercase; }
.paper .resti-cmp { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.paper .resti-cmp > div + div { border-left: 2px solid var(--ocre); padding-left: 14px; }
.qchip.ok { border-color: var(--nuit); background: var(--nuit); color: var(--creme); font-family: var(--ui); }
.qchip.ko { border-color: var(--ocre); color: var(--accent-ink); font-family: var(--ui); }
.qchip.ko:hover { background: var(--ocre); color: #fff; }

/* ---------- Clics fiables (texte en haut, copie en bas) ---------- */
/* La barre de symboles flotte au-dessus du bas du texte : elle ne pousse plus les lignes. */
.editors { position: relative; }
.editors .strip { position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 6; border: 1px solid var(--border-2); background: var(--surface); box-shadow: 0 6px 20px rgba(14,26,36,.15); }
.editors .strip .sym { background: var(--surface-2); }
/* Le séparateur : zone de prise nette, plus large en mode texte/copie empilés */
.split.vert { grid-template-rows: minmax(0, var(--fa, 1fr)) 12px minmax(0, var(--fb, 1fr)); }
.split:not(.vert) { grid-template-columns: minmax(0, var(--fa, 1fr)) 12px minmax(0, var(--fb, 1fr)); }
.app.v-edit .split, .app.v-copy .split { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.gutter { background: var(--surface-3); border: solid var(--border); border-width: 0 1px; touch-action: none; }
.split.vert .gutter { border-width: 1px 0; }
/* La partie active est signalée : on sait toujours où l'on écrit */
.pane.draft:focus-within { box-shadow: inset 3px 0 0 var(--ocre); }
.pane.draft:focus-within .draft-head { background: var(--surface); }
/* Les messages ne captent plus les clics */
.toast { pointer-events: none; }
.paper [data-line] { cursor: default; }


/* ---------- Glisser-déposer : seulement dans les zones d'écriture ---------- */
.paper { -webkit-user-drag: none; }

/* =====================================================================
   Téléphone : une colonne, bibliothèque en tiroir, lecture d'abord.
   ===================================================================== */
body.remote:not(.cloud) .pc-only, body.cloud .pc-only:not(.cloud-ok) { display: none !important; }
.side-backdrop { display: none; }
.mob-grid { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 18px; align-items: start; }
.mob-qr svg { width: 180px; height: 180px; display: block; background: #fff; }
.mob-url { font-family: var(--mono); font-size: 14px; font-weight: 500; word-break: break-all; }
.mob-code { font-family: var(--mono); font-size: 34px; font-weight: 600; letter-spacing: .25em; margin: 4px 0 10px; }
.mob-row { display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; margin-top: 8px; }
.mob p { margin: 0 0 8px; }

@media (max-width: 760px) {
  body { overflow: hidden; }
  .top { min-height: 52px; padding: 0 8px; gap: 6px; }
  .brand .mot { font-size: 14px; letter-spacing: .14em; }
  .brand .sous, .brand .brand-sym { display: none; }
  .doc-name { padding-left: 8px; flex: 1 1 auto; }
  .doc-kind, .save { display: none; }
  .doc-name input { font-size: 14px; padding: 4px 6px; }
  .actions { gap: 4px; flex-wrap: nowrap; }
  .actions .btn.ghost:not(.side-toggle), .actions .menu-wrap { display: none; }
  .top .seg button { padding: 5px 7px; font-size: 12px; }
  #viewSeg button[data-view="both"] { display: none; }
  .grow { flex: 1 1 0; min-width: 0; }

  .app, .app.side-off { grid-template-columns: minmax(0, 1fr) !important; }
  .side { display: flex !important; position: fixed; z-index: 35; left: 0; top: 52px; bottom: 0; width: min(86vw, 340px); transform: translateX(-102%); transition: transform .22s ease; box-shadow: 6px 0 30px rgba(14,26,36,.25); max-height: none; border-bottom: 0; }
  body.side-open .side { transform: none; }
  body.side-open .side-backdrop { display: block; position: fixed; inset: 52px 0 0 0; background: rgba(14,26,36,.35); z-index: 34; }
  .side-gutter { display: none; }
  .doc-btn { padding-top: 10px; padding-bottom: 10px; }

  .meta-bar { flex-wrap: nowrap; overflow-x: auto; gap: 10px; padding: 6px 10px; scrollbar-width: none; }
  .meta-bar > * { flex: none; }
  .mf input { width: 130px; }
  .draft-head { padding-right: 6px; }
  .head-tools .mini[data-zoom] { display: none; }
  .tab { padding: 8px 10px; }
  .tab .k { display: none; }
  .editors textarea { padding: 12px; font-size: 16px; min-height: 0; }
  .copy-scroll { padding: 8px; }
  .copy-head .mini[data-orient] { display: none; }
  .paper { padding: 22px 12px 40px 34px; background-image:
    linear-gradient(90deg, transparent 23px, var(--margin) 23px, var(--margin) 24px, transparent 24px),
    repeating-linear-gradient(180deg, transparent 0 calc(var(--paper-lh) - 1px), var(--line-strong) calc(var(--paper-lh) - 1px) var(--paper-lh)); }
  .paper.grid { padding-left: 14px; }
  .paper.card { padding: 20px 16px 40px; }
  .box-enonce { margin-left: -6px; padding: 0 8px; }
  .paper .resti-cmp { grid-template-columns: minmax(0, 1fr); }
  .paper .resti-cmp > div + div { border-left: 0; border-top: 2px solid var(--ocre); padding-left: 0; padding-top: 8px; }
  .lint { left: 6px; right: 6px; bottom: 6px; max-height: 60%; }

  .welcome { padding: 20px; }
  .welcome h1 { font-size: 30px; }
  .welcome-keys { display: none; }
  .review, .recueil, .chapitre { padding: 18px 12px 40px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rv-cols, .ch-cols { grid-template-columns: minmax(0, 1fr); }
  .rc-head h1 { font-size: 26px; }
  .rc-actions .btn { min-height: 38px; padding: 0 10px; font-size: 13px; }
  .pc-row { grid-template-columns: 64px 10px minmax(0, 1fr) auto; gap: 8px; padding: 10px 12px; }
  .pc-row .ty { font-size: 10px; letter-spacing: .04em; }
  .bloc-side .bar { width: 50px; }
  .panel { inset: 56px 6px auto 6px; width: auto; }
  .dialog .box { padding: 16px; }
  .mob-grid { grid-template-columns: 1fr; }
  .toast { bottom: 12px; }
}

/* ---- Barre du haut sur écran étroit (portrait 1080 px, petites fenêtres) : une seule ligne ---- */
.top { flex: none; }
@media (max-width: 1400px) and (min-width: 761px) {
  .top { gap: 10px; padding: 0 12px; }
  .brand { gap: 9px; }
  .brand .mot { font-size: 15px; }
  .brand .sous { font-size: 10.5px; padding-left: 9px; }
  .doc-name { flex: 1 1 0; min-width: 140px; padding-left: 10px; }
  .doc-kind { display: none; }
  .actions { flex-wrap: nowrap; gap: 4px; }
  .top .btn, .top .seg button { padding: 5px 8px; font-size: 12.5px; white-space: nowrap; }
  .grow { flex: 0 0 0; }
}
@media (max-width: 1180px) and (min-width: 761px) {
  .brand .mot { display: none; }
  .brand .sous { border-left: 0; padding-left: 0; }
  #btnKeys, #btnHelp { display: none; }
  .save { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
}

/* ---------- Bandeau d'infos replié ---------- */
.meta-bar.folded { gap: 10px; padding: 5px 14px; flex-wrap: nowrap; }
.meta-sum { display: inline-flex; align-items: center; gap: 7px; min-width: 0; flex: 0 1 auto; overflow: hidden; white-space: nowrap; border: 0; background: transparent; padding: 4px 8px; border-radius: 6px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.meta-sum:hover { background: var(--surface-2); color: var(--fg); }
.meta-sum b { color: var(--fg); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.meta-sum .sep { font-style: normal; opacity: .5; }
.meta-sum .st { color: var(--accent); letter-spacing: 1px; }
.meta-sum .er { color: var(--erreur); }
.stat-pill { position: relative; display: inline-flex; align-items: center; gap: 6px; flex: none; border: 1px solid currentColor; border-radius: 999px; padding: 2px 4px 2px 9px; background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--fg); }
.stat-pill.done { color: var(--st-done); } .stat-pill.redo { color: var(--st-redo); } .stat-pill.doing { color: var(--st-doing); } .stat-pill.todo { color: var(--muted); }
.stat-pill select { border: 0; background: transparent; color: inherit; font: inherit; padding: 1px 2px; cursor: pointer; }
.stat-pill select:focus { outline: none; }
.stat-pill:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.meta-bar .ghost-l { background: transparent; border-color: transparent; color: var(--muted); flex: none; }
.meta-bar .ghost-l:hover { border-color: var(--border); color: var(--fg); }

/* ---------- Précédent / suivant ---------- */
.docnav { display: inline-flex; align-items: center; flex: none; gap: 2px; margin-left: 4px; }
.docnav[hidden] { display: none; }
.docnav button { border: 1px solid #2c3f4e; background: transparent; color: #F4F2EE; width: 26px; height: 26px; border-radius: 6px; font-size: 17px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; padding: 0 0 2px; cursor: pointer; }
.docnav button:hover:not(:disabled) { border-color: var(--ocre); color: #fff; }
.docnav button:disabled { opacity: .3; cursor: default; }
.docnav .pos { font-size: 11px; color: #9AA7B1; min-width: 30px; text-align: center; font-variant-numeric: tabular-nums; }
.focus-bar .docnav { margin: 0 6px 0 0; }
@media (max-width: 1180px) and (min-width: 761px) { .docnav .pos { display: none; } }
@media (max-width: 760px) { .docnav .pos { display: none; } .docnav button { width: 30px; height: 30px; } }
.meta-sum .pt { display: inline-flex; gap: 7px; flex: none; }
.meta-sum b { min-width: 60px; }
@media (max-width: 760px) {
  .meta-bar.folded { padding: 5px 10px; gap: 6px; }
  .meta-sum .pt { display: none; }
  .meta-sum { flex: 1 1 0; }
  .brand .mot { display: none; }
}

/* indicateur de synchronisation (à côté de « Enregistré ») */
.sync-dot { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 2px 4px; font: 11.5px var(--mono); color: #A9B4BE; white-space: nowrap; cursor: pointer; }
.sync-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--st-done); flex: none; }
.sync-dot.wait::before { background: var(--ocre); }
.sync-dot.off::before { background: transparent; box-shadow: inset 0 0 0 1.5px #A9B4BE; }
.sync-dot.bad { color: var(--erreur); }
.sync-dot.bad::before { background: var(--erreur); }
.cm-st .sync-dot { padding: 0; cursor: default; }
@media (max-width: 1180px) { .top .sync-dot { font-size: 0; gap: 0; } }

.sync-panel p { line-height: 1.55; margin: 0 0 12px; }
.sync-panel label { display: flex; flex-direction: column; gap: 5px; margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.sync-panel input { font: 15px var(--ui); padding: 8px 10px; border: 1px solid var(--border-2); border-radius: 7px; background: var(--surface-2); color: var(--fg); }
.sync-panel .sy-err { color: var(--warn); min-height: 1em; font-size: 13px; }
.sync-panel .sy-mail { font-weight: 600; margin-bottom: 4px; }
.sync-panel .sy-st, .sync-panel .sy-note { color: var(--muted); font-size: 13.5px; }
.sync-panel .sy-st .sync-dot { padding: 0; cursor: default; }
.sync-panel .sy-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Barre des questions : une ligne, défilante, repliable ---------- */
.qnav { flex-wrap: nowrap; min-width: 0; }
.qnav .qtoggle { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 2px 4px; cursor: pointer; color: inherit; }
.qnav .qtoggle .label { margin: 0; }
.qnav .qcount { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.qnav .qtoggle .chev { font-size: 11px; color: var(--muted); }
.qnav .qtoggle:hover .chev, .qnav .qtoggle:hover .qcount { color: var(--fg); }
.qnav .qrail { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; align-content: flex-start; max-height: 86px; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; padding: 1px 4px 1px 0; }
.qnav { align-items: flex-start; }
.qnav .qtoggle, .qnav > .qchip.add { margin-top: 1px; }
.qnav .qrail > * { flex: none; }
.qnav > .qchip.add, .qnav > .qhint { flex: none; }
.qnav.plie .qrail, .qnav.plie > .qchip, .qnav.plie > .qhint { display: none; }
.qnav.plie { padding-top: 3px; padding-bottom: 3px; }

/* ---------- Écran étroit (portrait) : la bibliothèque garde toute sa hauteur ---------- */
@media (max-width: 860px) and (min-width: 761px) {
  .side { max-height: none; border-right: 1px solid var(--border); border-bottom: 0; }
  .editors textarea { min-height: 0; }
}
/* Questions au titre long : puce raccourcie, titre complet au survol */
.qnav .qrail .qchip { max-width: 16em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
