/* Carnet — feuille de style. Esthétique « cahier technique » : papier chaud, encre, numéros en chasse fixe. */
:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --sidebar: #efebe3;
  --text: #1c2326;
  --text-2: #3c474d;
  --muted: #6a757b;
  --line: #e1dcd1;
  --line-2: #d3ccbe;
  --accent: #1f5f6b;
  --accent-ink: #154650;
  --accent-soft: #dfecec;
  --code-bg: #f0ece4;
  --code-inline: #ece7dd;
  --mark: #fbe38a;
  --danger: #b4322a;
  --shadow: 0 1px 2px rgba(30, 30, 20, .06), 0 8px 24px rgba(30, 30, 20, .08);
  --c-note: #2f6fbd; --c-note-bg: #eaf2fb;
  --c-tip: #2c8a57; --c-tip-bg: #e7f5ec;
  --c-imp: #7a4cc2; --c-imp-bg: #f1ebfb;
  --c-warn: #a86a05; --c-warn-bg: #fdf3df;
  --c-caut: #c0392b; --c-caut-bg: #fcebe9;
  --c-quote: #6a757b; --c-quote-bg: #f1eee8;
  --top: 56px;
  --side: 284px;
  --toc: 232px;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Code", "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121619; --surface: #171c20; --sidebar: #0e1215; --text: #e2e6e8; --text-2: #c3cace; --muted: #8a959b;
    --line: #252d33; --line-2: #313b42; --accent: #62b6c2; --accent-ink: #8fd0d9; --accent-soft: #16313a;
    --code-bg: #1a2126; --code-inline: #222a30; --mark: #6b5a12; --danger: #ef6b5f;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.45);
    --c-note: #6ea8ec; --c-note-bg: #15233a; --c-tip: #5cc28b; --c-tip-bg: #13291e; --c-imp: #b393ef; --c-imp-bg: #241c37;
    --c-warn: #e2a640; --c-warn-bg: #2f2410; --c-caut: #ef7468; --c-caut-bg: #351a18; --c-quote: #8a959b; --c-quote-bg: #1b2126;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121619; --surface: #171c20; --sidebar: #0e1215; --text: #e2e6e8; --text-2: #c3cace; --muted: #8a959b;
  --line: #252d33; --line-2: #313b42; --accent: #62b6c2; --accent-ink: #8fd0d9; --accent-soft: #16313a;
  --code-bg: #1a2126; --code-inline: #222a30; --mark: #6b5a12; --danger: #ef6b5f;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.45);
  --c-note: #6ea8ec; --c-note-bg: #15233a; --c-tip: #5cc28b; --c-tip-bg: #13291e; --c-imp: #b393ef; --c-imp-bg: #241c37;
  --c-warn: #e2a640; --c-warn-bg: #2f2410; --c-caut: #ef7468; --c-caut-bg: #351a18; --c-quote: #8a959b; --c-quote-bg: #1b2126;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top) + 16px); }
body { margin: 0; background: var(--bg); color: var(--text); font: 15.5px/1.65 var(--sans); }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
button { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
code, kbd, pre { font-family: var(--mono); }
.num { white-space: nowrap; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: .82em; color: var(--muted); margin-right: .55em; letter-spacing: -.02em; }
.muted { color: var(--muted); }
.small { font-size: .88em; }
[hidden] { display: none !important; }
body.readonly .rw { display: none !important; }

/* ---------------------------------------------------------------- barre du haut */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--top);
  display: flex; align-items: center; gap: 14px; padding: 0 16px 0 18px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); min-width: 0; width: calc(var(--side) - 32px); }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--bg); font: 22px/1 var(--serif); flex: none; }
.brand-title { font: 600 17px/1.2 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .005em; }
.search { position: relative; flex: 1; max-width: 520px; }
.search input {
  width: 100%; height: 36px; padding: 0 36px 0 36px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; outline: none; transition: border-color .15s, box-shadow .15s;
}
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-ico { position: absolute; left: 11px; top: 9px; color: var(--muted); }
.search-kbd { position: absolute; right: 9px; top: 7px; }
.search input:focus ~ .search-kbd { display: none; }
kbd { display: inline-block; padding: 0 6px; min-width: 20px; text-align: center; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; font-size: .78em; line-height: 1.6; color: var(--text-2); background: var(--surface); }
.search-pop {
  position: absolute; top: 42px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); overflow: hidden; max-height: 70vh; overflow-y: auto; padding: 6px;
}
.search-pop a { display: block; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--text); }
.search-pop a:hover, .search-pop a.on { background: var(--accent-soft); }
.sp-title { display: block; font-weight: 600; }
.sp-snip { display: block; color: var(--muted); font-size: .88em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-all { color: var(--accent) !important; font-size: .9em; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px !important; margin-top: 4px; }
.sp-empty { margin: 8px 10px; color: var(--muted); }
mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }
.top-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

/* ---------------------------------------------------------------- boutons, menus */
.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none;
  font-size: 14px; font-weight: 500; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.btn:disabled { opacity: .6; cursor: progress; }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 0; background: transparent; cursor: pointer; color: var(--text-2); }
.icon-btn:hover { background: var(--accent-soft); color: var(--accent-ink); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: 40px; z-index: 40; min-width: 270px; padding: 6px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.menu > button, .menu > a {
  display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 0; border-radius: 7px;
  background: none; text-align: left; cursor: pointer; color: var(--text); text-decoration: none; font-size: 14px;
}
.menu > button:hover, .menu > a:hover { background: var(--accent-soft); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.menu .danger { color: var(--danger); }
.check { color: var(--accent); font-weight: 700; }
.only-mobile { display: none; }

/* ---------------------------------------------------------------- mise en page */
.layout { display: grid; grid-template-columns: var(--side) minmax(0, 1fr) var(--toc); min-height: calc(100vh - var(--top)); }
body.editing .layout { grid-template-columns: var(--side) minmax(0, 1fr); }
body.editing .toc { display: none; }
.sidebar {
  position: sticky; top: var(--top); height: calc(100vh - var(--top)); overflow-y: auto; display: flex; flex-direction: column;
  background: var(--sidebar); border-right: 1px solid var(--line); padding: 14px 10px 0;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
#tree { flex: 1; padding-bottom: 20px; border-radius: 8px; }
#tree.drop-inside { outline: 2px dashed var(--accent); outline-offset: -2px; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { margin-left: 13px; padding-left: 6px; border-left: 1px solid var(--line-2); }
li.closed > ul { display: none; }
.row { position: relative; display: flex; align-items: center; border-radius: 7px; min-height: 31px; }
.row > a { flex: 1; display: flex; align-items: baseline; min-width: 0; padding: 5px 6px 5px 2px; color: var(--text-2); text-decoration: none; font-size: 14.2px; line-height: 1.35; }
.row > a .t { overflow: hidden; text-overflow: ellipsis; }
.row > a .num { flex: none; min-width: 1.6em; }
.row:hover { background: color-mix(in srgb, var(--accent-soft) 70%, transparent); }
.row.active { background: var(--accent-soft); }
.row.active > a { color: var(--accent-ink); font-weight: 600; }
.row.active > a .num { color: var(--accent); }
.li-dir > .row > a, li.dir > .row > a { font-weight: 550; color: var(--text); }
.row-home > a { padding-left: 8px; font-weight: 600; color: var(--text); }
.row-home { margin-bottom: 6px; }
.twisty { display: grid; place-items: center; width: 22px; height: 26px; border: 0; background: none; padding: 0; cursor: pointer; color: var(--muted); flex: none; }
.twisty svg { width: 14px; height: 14px; transition: transform .15s; transform: rotate(90deg); }
li.closed > .row .twisty svg { transform: rotate(0deg); }
.twisty-space { width: 22px; flex: none; }
.row-add { display: none; place-items: center; width: 24px; height: 24px; margin-right: 3px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.row-add svg { width: 15px; height: 15px; }
.row:hover .row-add { display: grid; }
.row-add:hover { background: var(--surface); color: var(--accent); }
.row.dragging { opacity: .45; }
.row.drop-before::before, .row.drop-after::after { content: ""; position: absolute; left: 8px; right: 4px; height: 2px; background: var(--accent); border-radius: 2px; }
.row.drop-before::before { top: -1px; }
.row.drop-after::after { bottom: -1px; }
.row.drop-inside { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--accent-soft); }
li.is-hidden > .row { opacity: .55; }
.tree-empty { color: var(--muted); font-size: 14px; padding: 6px 10px; }
.sidebar-foot { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; white-space: nowrap; padding: 10px 8px 14px; background: linear-gradient(transparent, var(--sidebar) 30%); font-size: 13.5px; }
.sidebar-foot .link-btn { text-decoration: none; color: var(--muted); }
.sidebar-foot .link-btn:hover { color: var(--accent); }

main { min-width: 0; outline: none; }
.toc { position: sticky; top: var(--top); height: calc(100vh - var(--top)); overflow-y: auto; padding: 34px 18px 20px 6px; font-size: 13.2px; }
.toc-title { margin: 0 0 8px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc ul ul { padding-left: 12px; }
.toc a { display: block; padding: 3px 0 3px 10px; border-left: 2px solid var(--line); color: var(--muted); text-decoration: none; line-height: 1.4; }
.toc a:hover { color: var(--text); }
.toc a.active { color: var(--accent-ink); border-left-color: var(--accent); font-weight: 600; }

/* ---------------------------------------------------------------- document */
.doc { max-width: 860px; margin: 0 auto; padding: 22px 44px 60px; }
.doc.wide { max-width: 1180px; }
.doc-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; margin-bottom: 8px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: 13.5px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs .num { font-size: .9em; margin-right: .35em; }
.crumbs .sep { color: var(--line-2); }
.doc-actions { display: flex; align-items: center; gap: 4px; }

.md { font-size: 16px; line-height: 1.7; color: var(--text); overflow-wrap: break-word; }
.md > :first-child { margin-top: 0; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { position: relative; font-family: var(--serif); color: var(--text); line-height: 1.25; letter-spacing: -.005em; }
.md h1 { font-size: 2.15em; font-weight: 600; margin: .3em 0 .55em; padding-bottom: .35em; border-bottom: 1px solid var(--line); }
.md h2 { font-size: 1.5em; font-weight: 600; margin: 1.9em 0 .6em; }
.md h3 { font-size: 1.2em; font-weight: 600; margin: 1.6em 0 .5em; }
.md h4 { font-size: 1.05em; font-weight: 700; margin: 1.4em 0 .4em; font-family: var(--sans); }
.md h5, .md h6 { font-size: .95em; font-family: var(--sans); color: var(--text-2); }
.hnum { font-family: var(--mono); font-weight: 500; font-size: .7em; color: var(--accent); margin-right: .6em; vertical-align: .08em; letter-spacing: -.02em; }
.md h1 .hnum { font-size: .55em; vertical-align: .25em; }
.anchor { position: absolute; left: -1em; top: 0; padding-right: .3em; opacity: 0; color: var(--line-2); text-decoration: none; font-weight: 400; transition: opacity .15s; }
.md :is(h1, h2, h3, h4, h5, h6):hover .anchor { opacity: 1; }
.anchor:hover { color: var(--accent); }
.md p, .md ul, .md ol, .md dl, .md blockquote, .md .table-wrap, .md pre, .md details, .md .admonition, .md .code-block { margin: 0 0 1.05em; }
.md ul, .md ol { padding-left: 1.6em; }
.md li { margin: .22em 0; }
.md li > p { margin: .3em 0; }
.md li::marker { color: var(--muted); }
.md ol > li::marker { font-family: var(--mono); font-size: .9em; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 2.2em 0; }
.md img, .md video { max-width: 100%; height: auto; border-radius: 6px; }
.md p > img:only-child, .md p > a > img:only-child { display: block; margin: .4em auto; cursor: zoom-in; box-shadow: 0 0 0 1px var(--line), var(--shadow); }
.md a.missing { color: var(--danger); text-decoration-style: dashed; }
.md a.wiki { text-decoration-style: dotted; }
.md blockquote { padding: .2em 1.1em; border-left: 3px solid var(--line-2); color: var(--text-2); }
.md :not(pre) > code { padding: .12em .38em; border-radius: 5px; background: var(--code-inline); font-size: .86em; color: var(--text); }
.md kbd { font-size: .8em; }
.md details { border: 1px solid var(--line); border-radius: 10px; padding: .5em 1em; background: var(--surface); }
.md details > summary { cursor: pointer; font-weight: 600; }
.md details[open] > summary { margin-bottom: .5em; }

/* front matter */
.md dl.fm { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: -.3em 0 1.6em; font-size: 13px; }
.md dl.fm > div { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.md dl.fm dt { padding: 1px 9px; background: var(--code-inline); color: var(--muted); }
.md dl.fm dd { margin: 0; padding: 1px 10px; }

/* tableaux */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.md table { border-collapse: collapse; width: 100%; font-size: .93em; }
.md th, .md td { padding: .5em .85em; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.md th { background: var(--code-inline); font-weight: 600; font-size: .92em; white-space: nowrap; }
.md tr:last-child td { border-bottom: 0; }
.md tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 40%, transparent); }

/* code */
.code-block { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--code-bg); }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 3px 6px 3px 12px; border-bottom: 1px solid var(--line); font: 11.5px/1.8 var(--mono); color: var(--muted); text-transform: lowercase; }
.copy { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px 7px; border-radius: 6px; font: 12px var(--sans); }
.copy svg { width: 14px; height: 14px; }
.copy:hover { background: var(--surface); color: var(--text); }
.copy.done { color: var(--c-tip); }
.md pre { margin: 0; padding: 12px 14px; overflow-x: auto; font-size: 13.4px; line-height: 1.55; tab-size: 4; }
.md pre code.hljs { background: none; padding: 0; color: var(--text); }
.md pre.mermaid { display: block; text-align: center; font-family: var(--sans); line-height: 1.5; padding: 18px 10px; margin: 0 0 1.05em; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; color: var(--muted); white-space: pre-wrap; font-size: 12.5px; }
.md pre.mermaid.rendered { white-space: normal; }
.md pre.mermaid svg { display: block; margin: 0 auto; width: 100%; height: auto; }
.md pre.mermaid.mermaid-error { display: block; color: var(--danger); background: var(--c-caut-bg); border-color: color-mix(in srgb, var(--c-caut) 40%, transparent); }
.mermaid-err-title { display: block; font: 600 13px var(--sans); margin-bottom: 4px; }

/* encadrés / alertes */
.admonition { --c: var(--c-note); --cb: var(--c-note-bg); border: 1px solid color-mix(in srgb, var(--c) 28%, transparent); border-left: 4px solid var(--c); background: var(--cb); border-radius: 8px; padding: .65em 1.05em .2em; }
.admonition > :last-child { margin-bottom: .5em; }
.md .admonition-title, .md details.admonition > summary { display: flex; align-items: center; gap: .45em; margin: 0 0 .35em; font: 650 .9em/1.5 var(--sans); color: var(--c); letter-spacing: .01em; }
.md .admonition-title::before, .md details.admonition > summary::before { content: var(--ico, "ℹ"); display: inline-grid; place-items: center; width: 1.25em; height: 1.25em; border-radius: 50%; background: var(--c); color: var(--cb); font-size: .78em; font-weight: 800; }
.md details.admonition { padding: .55em 1.05em; }
.md details.admonition > summary { list-style: none; cursor: pointer; margin: 0; }
.md details.admonition > summary::-webkit-details-marker { display: none; }
.md details.admonition > summary::after { content: "▸"; margin-left: auto; transition: transform .15s; }
.md details.admonition[open] > summary::after { transform: rotate(90deg); }
.md details.admonition[open] > summary { margin-bottom: .45em; }
.admonition.note, .admonition.info, .admonition.abstract, .admonition.summary { --c: var(--c-note); --cb: var(--c-note-bg); --ico: "i"; }
.admonition.tip, .admonition.hint, .admonition.success, .admonition.check, .admonition.done { --c: var(--c-tip); --cb: var(--c-tip-bg); --ico: "✓"; }
.admonition.important, .admonition.question, .admonition.help, .admonition.faq, .admonition.example { --c: var(--c-imp); --cb: var(--c-imp-bg); --ico: "!"; }
.admonition.question, .admonition.help, .admonition.faq { --ico: "?"; }
.admonition.example { --ico: "▸"; }
.admonition.warning, .admonition.attention { --c: var(--c-warn); --cb: var(--c-warn-bg); --ico: "!"; }
.admonition.caution, .admonition.danger, .admonition.error, .admonition.failure, .admonition.fail, .admonition.bug, .admonition.missing { --c: var(--c-caut); --cb: var(--c-caut-bg); --ico: "✕"; }
.admonition.quote, .admonition.cite { --c: var(--c-quote); --cb: var(--c-quote-bg); --ico: "❝"; }

/* cases à cocher */
.md ul.tasks { list-style: none; padding-left: .3em; }
.md li.task { display: block; position: relative; padding-left: 1.75em; }
.md li.task > input, .md li.task > p > input:first-child { position: absolute; left: 0; top: .32em; width: 1.05em; height: 1.05em; margin: 0; accent-color: var(--accent); cursor: pointer; }
.md li.task > p { margin: 0; }
.md li.task.done { color: var(--muted); }
.md li.task.done > p, .md li.task.done { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.md li.task.done li { text-decoration: none; }
body.readonly .md li.task input { pointer-events: none; }

/* sommaires */
.sommaire, .toc-inline { margin: 0 0 1.4em; padding: 1em 1.3em; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.sommaire ul, .toc-inline ul { list-style: none; margin: 0; padding: 0; }
.sommaire > ul > li { margin: .15em 0; }
.sommaire > ul > li > a { font-weight: 600; }
.sommaire ul ul, .toc-inline ul ul { margin: .1em 0 .35em 1.15em; padding-left: .8em; border-left: 1px solid var(--line); }
.sommaire a, .toc-inline a { display: inline-flex; align-items: baseline; padding: 1px 0; color: var(--text); text-decoration: none; }
.sommaire a:hover, .toc-inline a:hover { color: var(--accent); text-decoration: underline; }
.sommaire .num, .toc-inline .num { flex: none; min-width: 2.2em; }
.toc-inline-title { margin: 0 0 .4em !important; font: 700 11.5px var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.dir-hint { margin-top: 1.5em; }

/* pied de page */
.doc-foot { margin-top: 3em; padding-top: 1.2em; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
.doc-foot code { font-size: .92em; }
.modified { margin: 0 0 1.2em; }
#backlinks .bl-title { margin: 0 0 .3em; font-weight: 600; color: var(--text-2); }
#backlinks ul { margin: 0 0 1.4em; padding-left: 1.2em; }
.prev-next { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pn { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-decoration: none; transition: border-color .15s, transform .15s; }
.pn:hover { border-color: var(--accent); }
.pn.next { text-align: right; align-items: flex-end; }
.pn-label { font-size: 12px; color: var(--muted); }
.pn-title { color: var(--text); font-weight: 600; font-size: 14.5px; }

/* recherche */
.results { list-style: none; padding: 0; }
.results > li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.r-title { font: 600 1.12em var(--serif); text-decoration: none; }
.r-path { display: block; font: 12px var(--mono); color: var(--muted); margin: 2px 0 6px; }
.r-snip { display: block; color: var(--text-2); text-decoration: none; font-size: .92em; padding: 3px 8px; border-left: 2px solid var(--line); margin: 3px 0; }
.r-snip:hover { border-left-color: var(--accent); background: var(--surface); }
.r-snip b { color: var(--text); font-weight: 600; }

/* ---------------------------------------------------------------- historique */
.history { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: start; }
.versions { list-style: none; margin: 0; padding: 0; position: sticky; top: calc(var(--top) + 14px); max-height: calc(100vh - var(--top) - 40px); overflow-y: auto; }
.versions button { display: flex; flex-direction: column; width: 100%; text-align: left; padding: 8px 12px; border: 0; border-left: 2px solid var(--line); background: none; cursor: pointer; font-size: 14px; }
.versions button small { color: var(--muted); font-size: 12px; }
.versions button:hover { background: var(--surface); }
.versions button.active { border-left-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.version-view { min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.version-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
.spacer { flex: 1; }
#v-body { padding: 14px; }
#v-body > .md { padding: 6px 12px; }
.diff { font: 12.8px/1.55 var(--mono); border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; }
.diff > div { white-space: pre-wrap; padding: 0 12px 0 0; display: flex; }
.diff > div > span { flex: none; width: 26px; text-align: center; color: var(--muted); user-select: none; }
.d-add { background: var(--c-tip-bg); } .d-add > span { color: var(--c-tip) !important; }
.d-del { background: var(--c-caut-bg); } .d-del > span { color: var(--c-caut) !important; }
.d-skip { color: var(--muted); background: var(--code-inline); padding: 2px 12px !important; font-style: italic; }
.d-legend { margin: 0 0 10px; font-size: 12.5px; }
.d-legend span { padding: 1px 8px; border-radius: 5px; margin-right: 6px; }
.d-del-l { background: var(--c-caut-bg); color: var(--c-caut); } .d-add-l { background: var(--c-tip-bg); color: var(--c-tip); }

/* segments */
.seg { display: inline-flex; padding: 2px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--bg); }
.seg button { border: 0; background: none; padding: 4px 11px; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--muted); white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.12); font-weight: 600; }

/* ---------------------------------------------------------------- éditeur */
.editor { display: flex; flex-direction: column; height: calc(100vh - var(--top)); }
.ed-top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); flex-wrap: wrap; }
.ed-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex: 1; }
.ed-title strong { flex: 0 1 auto; min-width: 0; font: 600 16px var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-title code { flex: 0 3 auto; min-width: 0; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-right { display: flex; align-items: center; gap: 8px; }
.ed-status { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.ed-status.dirty { color: var(--c-warn); }
.ed-status.dirty::before { content: "● "; }
.ed-tools { display: flex; align-items: center; gap: 2px; padding: 5px 12px; border-bottom: 1px solid var(--line); background: var(--bg); overflow-x: auto; scrollbar-width: none; }
.ed-tools button { min-width: 32px; height: 30px; padding: 0 7px; border: 0; border-radius: 6px; background: none; cursor: pointer; font-size: 13.5px; color: var(--text-2); white-space: nowrap; }
.ed-tools button:hover { background: var(--accent-soft); color: var(--accent-ink); }
.ed-tools button code { font-size: 11.5px; background: none; }
.ed-tools .sep { width: 1px; height: 18px; background: var(--line-2); margin: 0 6px; flex: none; }
.ed-hint { margin-left: auto; padding-left: 14px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.draft-bar { padding: 7px 16px; background: var(--c-warn-bg); color: var(--text); font-size: 13.5px; border-bottom: 1px solid var(--line); }
.ed-panes { flex: 1; display: grid; grid-template-columns: 1fr 1fr; min-height: 0; }
.editor[data-mode="write"] .ed-panes { grid-template-columns: 1fr; }
.editor[data-mode="write"] .ed-preview { display: none; }
.editor[data-mode="preview"] .ed-panes { grid-template-columns: 1fr; }
.editor[data-mode="preview"] .ed-src-wrap { display: none; }
.ed-src-wrap { position: relative; min-height: 0; border-right: 1px solid var(--line); }
#ed-src {
  width: 100%; height: 100%; resize: none; border: 0; outline: none; padding: 22px 26px 40vh; background: var(--surface); color: var(--text);
  font: 14px/1.7 var(--mono); tab-size: 4; caret-color: var(--accent);
}
.editor[data-mode="write"] #ed-src { padding-left: max(26px, calc(50% - 420px)); padding-right: max(26px, calc(50% - 420px)); }
.drop-hint { display: none; position: absolute; inset: 10px; border: 2px dashed var(--accent); border-radius: 12px; background: color-mix(in srgb, var(--accent-soft) 70%, transparent); place-items: center; font-weight: 600; color: var(--accent-ink); pointer-events: none; }
.ed-src-wrap.drop .drop-hint { display: grid; }
.ed-preview { overflow-y: auto; padding: 22px 36px 40vh; min-height: 0; }
.editor[data-mode="preview"] .ed-preview > .md { max-width: 820px; margin: 0 auto; }
.ac { position: fixed; z-index: 50; width: 330px; max-height: 270px; overflow-y: auto; padding: 5px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.ac button { display: block; width: 100%; text-align: left; padding: 6px 9px; border: 0; border-radius: 6px; background: none; cursor: pointer; font-size: 13.5px; }
.ac button small { display: block; color: var(--muted); font: 11px var(--mono); }
.ac button.on, .ac button:hover { background: var(--accent-soft); }

/* ---------------------------------------------------------------- dialogues */
dialog { width: min(520px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
dialog.wide { width: min(680px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(15, 20, 22, .38); backdrop-filter: blur(2px); }
dialog form { padding: 20px 22px 18px; }
dialog h2 { margin: 0 0 14px; font: 600 1.25em var(--serif); }
.dlg-body label { display: block; margin-bottom: 13px; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.dlg-body input:not([type=checkbox]):not([type=radio]), .dlg-body select {
  display: block; width: 100%; margin-top: 5px; height: 38px; padding: 0 11px; border: 1px solid var(--line-2); border-radius: 8px;
  background: var(--bg); color: var(--text); font: 15px var(--sans); outline: none;
}
.dlg-body input:focus, .dlg-body select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dlg-body p { margin: 0 0 10px; }
.dlg-error { color: var(--danger); font-size: 14px; margin: 4px 0 0; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
fieldset.tpl { border: 0; padding: 0; margin: 4px 0 0; }
fieldset.tpl legend { font-size: 13.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
label.radio { display: flex !important; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 9px; margin-bottom: 7px !important; cursor: pointer; font-weight: 400 !important; }
label.radio:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
label.radio input { margin-top: 4px; accent-color: var(--accent); }
label.radio b { display: block; color: var(--text); }
label.radio small { color: var(--muted); }
.check-line { display: flex !important; gap: 8px; align-items: center; font-weight: 400 !important; }
.pick { display: grid; gap: 6px; }
.pick-list { max-height: 340px; overflow-y: auto; margin-top: 8px; }
.pick-item { text-align: left; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); cursor: pointer; font-size: 14.5px; }
.pick-item small { display: block; color: var(--muted); font: 11.5px var(--mono); }
.pick-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone { border: 2px dashed var(--line-2); border-radius: 12px; padding: 16px; text-align: center; color: var(--text-2); font-size: 14px; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.imp-list { list-style: none; margin: 10px 0; padding: 0; max-height: 200px; overflow-y: auto; font: 12.5px var(--mono); }
.imp-list li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 8px; border-radius: 5px; }
.imp-list li small { color: var(--muted); }
.imp-list li.busy { background: var(--accent-soft); }
.imp-list li.ok small { color: var(--c-tip); }
.imp-list li.err small { color: var(--danger); }

/* ---------------------------------------------------------------- divers */
.lightbox { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 3vh 3vw; background: rgba(10, 14, 16, .82); cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; background: #fff; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 9px 16px; border-radius: 10px; background: var(--text); color: var(--bg); font-size: 14px; box-shadow: var(--shadow); animation: tin .2s ease-out; transition: opacity .4s, transform .4s; }
.toast.error { background: var(--danger); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }
.scrim { display: none; }

/* livre complet */
.book-bar { position: sticky; top: var(--top); z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 10px; max-width: 860px; margin: 0 auto; padding: 12px 44px; background: color-mix(in srgb, var(--bg) 92%, transparent); color: var(--muted); font-size: 14px; }
.cover { padding: 8vh 0 4vh; }
.cover-kicker { font: 600 12px var(--sans); text-transform: uppercase; letter-spacing: .14em; color: var(--accent); margin: 0; }
.cover-title { font: 600 3em/1.1 var(--serif); margin: .2em 0 .3em; }
.cover-date { color: var(--muted); margin: 0 0 3em; }
.cover-toc-title { font: 600 1.3em var(--serif); }
.book-page { padding-top: 2.5em; margin-top: 2.5em; border-top: 1px dashed var(--line-2); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1200px) {
  .layout { grid-template-columns: var(--side) minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 900px) {
  :root { --side: 290px; }
  .only-mobile { display: grid; }
  .brand { width: auto; }
  .brand-title { display: none; }
  .search-kbd { display: none; }
  .btn-primary span { display: none; }
  .btn-primary { padding: 0 9px; }
  .layout, body.editing .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 25; top: var(--top); left: 0; width: var(--side); transform: translateX(-102%); transition: transform .2s; box-shadow: var(--shadow); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: var(--top) 0 0; z-index: 20; background: rgba(0,0,0,.3); }
  .doc { padding: 14px 18px 50px; }
  .md h1 { font-size: 1.75em; }
  .anchor { display: none; }
  .history { grid-template-columns: 1fr; }
  .versions { position: static; max-height: 200px; }
  .seg button[data-mode="split"] { display: none; }
  .ed-hint, .ed-title code { display: none; }
  .ed-preview { padding: 16px 18px 40vh; }
  #ed-src { padding: 16px 18px 40vh !important; }
  .prev-next { grid-template-columns: 1fr; }
  .book-bar { padding: 10px 18px; }
}

/* ---------------------------------------------------------------- impression */
@media print {
  :root { --bg: #fff; --surface: #fff; --text: #111; }
  body { background: #fff; font-size: 11pt; }
  .topbar, .sidebar, .toc, .doc-bar, .doc-foot, .no-print, .anchor, .copy, .toasts, .scrim { display: none !important; }
  .layout { display: block; }
  .doc { max-width: none; padding: 0; }
  .md { font-size: 11pt; }
  .md a { color: inherit; text-decoration: none; }
  .md pre { white-space: pre-wrap; font-size: 9pt; }
  .code-block, .admonition, .table-wrap, .md pre.mermaid, .md img, .sommaire { break-inside: avoid; }
  .md h1, .md h2, .md h3 { break-after: avoid; }
  .cover { break-after: page; padding-top: 25vh; }
  .book-page { border: 0; margin: 0; padding: 0; }
  .book-page + .book-page { margin-top: 2em; }
  .book-page.chapter-start { break-before: page; margin-top: 0; }
  @page { margin: 18mm 16mm; }
}

/* ---------------------------------------------------------------- projets & sections */
.menu > button small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
#menu-new > button { flex-direction: column; align-items: flex-start; gap: 0; }
#menu-new { min-width: 250px; }
.scope-ico {
  display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 7px;
  background: var(--surface); border: 1px solid var(--line); font-size: 15px; line-height: 1;
}
.scope-ico.letter { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); font: 700 13px var(--serif); }
.scope-back { display: inline-block; margin: 0 0 8px 8px; font-size: 12.5px; color: var(--muted); text-decoration: none; }
.scope-back:hover { color: var(--accent); }
.row-head { gap: 9px; padding: 6px 4px 6px 8px; margin-bottom: 10px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; }
.row-head .scope-ico { width: 34px; height: 34px; font-size: 19px; border-radius: 9px; }
.row-head > a { flex-direction: column; align-items: flex-start; padding: 0; }
.row-head .kind { font: 600 10.5px var(--sans); text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.row-head .t { font: 600 15.5px/1.25 var(--serif); color: var(--text); white-space: normal; }
.row-head.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.row-head.active .t { color: var(--accent-ink); }
.row-head .row-add { display: grid; }
.group-label { margin: 16px 8px 5px; font: 700 10.5px var(--sans); text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.group-label a { color: inherit; text-decoration: none; }
.group-label a:hover { color: var(--accent); }
.scope-list { display: flex; flex-direction: column; gap: 1px; }
.row-scope { gap: 9px; padding-left: 6px; }
.row-scope > a { font-weight: 550; color: var(--text); }
.row-scope .count { flex: none; margin-right: 8px; padding: 0 6px; border-radius: 999px; background: var(--bg); color: var(--muted); font: 11px/1.6 var(--mono); }
.row-scope.empty { padding: 4px 10px; min-height: 28px; }
.row-scope.drop-inside .count { background: var(--surface); }
.crumb-ico { margin-right: .3em; }
.crumbs a.crumb-scope { color: var(--text-2); font-weight: 550; }
.proj-tag { display: inline-block; padding: 0 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font: 600 11px/1.7 var(--sans); vertical-align: .1em; white-space: nowrap; }

.md .h-kind, .h-kind { margin: 0 0 -.2em; font: 700 11.5px var(--sans); text-transform: uppercase; letter-spacing: .12em; color: var(--accent); }
.md h1.scope-h1 { display: flex; align-items: center; gap: .35em; }
.h-ico { font-size: .85em; line-height: 1; }
.md p.lead { margin: -.2em 0 1.6em; font-size: 1.12em; color: var(--text-2); }

.projets { margin: 0 0 1.6em; }
.proj-group { margin: 0 0 1.8em; }
.proj-group-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin: 0 0 .7em; padding-bottom: .4em; border-bottom: 1px solid var(--line); }
.md .proj-group-title { font: 600 1.25em var(--serif); color: var(--text); text-decoration: none; }
.md a.proj-group-title:hover { color: var(--accent); }
.proj-group-desc { color: var(--muted); font-size: .9em; }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.md .proj-card {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 15px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--text); text-decoration: none; text-align: left; font: inherit; cursor: pointer;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.md .proj-card:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); }
.proj-card .scope-ico { width: 40px; height: 40px; font-size: 21px; border-radius: 10px; }
.proj-card .scope-ico.letter { font-size: 17px; }
.proj-body { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.proj-title { font: 600 1.05em/1.3 var(--serif); }
.proj-desc { font-size: .88em; line-height: 1.45; color: var(--text-2); }
.proj-meta { font-size: .78em; color: var(--muted); margin-top: 3px; }
.md .proj-add { border-style: dashed; background: transparent; color: var(--muted); align-items: center; padding: 10px 14px; }
.md .proj-add .scope-ico { width: 30px; height: 30px; font-size: 14px; }
.md .proj-add .proj-title { font: 500 .95em var(--sans); }
.md .proj-add:hover { color: var(--accent-ink); box-shadow: none; }
.emoji-pick { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.emoji-pick button { width: 32px; height: 30px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); cursor: pointer; font-size: 16px; }
.emoji-pick button:hover { border-color: var(--accent); }
.book .subproject-start { border-top: 2px solid var(--accent); }
@media print {
  .proj-card { break-inside: avoid; box-shadow: none !important; }
  .proj-add { display: none !important; }
  .book .subproject-start { border-top: 0; }
}

/* ---------------------------------------------------------------- MkDocs : onglets, attributs */
.tabset { margin: 0 0 1.05em; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
.tab-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--line); background: var(--code-inline); }
.tab-bar button { padding: 8px 12px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; cursor: pointer; font-size: 14px; color: var(--muted); }
.tab-bar button:hover { color: var(--text); }
.tab-bar button.on { color: var(--accent-ink); border-bottom-color: var(--accent); font-weight: 600; }
.tabset > .tab { padding: 12px 16px .1px; }
.tabset > .tab > .code-block:first-child { margin-top: 2px; }
.md .md-center { text-align: center; display: block; margin-left: auto; margin-right: auto; }
.md img[align=right] { float: right; margin: 0 0 1em 1em; }
.md img[align=left] { float: left; margin: 0 1em 1em 0; }

/* ---------------------------------------------------------------- sauvegardes */
.bk-card { margin: 0 0 1.4em; padding: 1.1em 1.4em .4em; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.md .bk-card h2 { margin: 0 0 .4em; font-size: 1.2em; }
.bk-card.danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.bk-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.bk-actions select { height: 34px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; max-width: 100%; }
.bk-actions .check-line { margin: 0; font-size: 14px; color: var(--text-2); }
.btn svg { width: 16px; height: 16px; }
@media print {
  .tab-bar { display: none; }
  .tabset > .tab { display: block !important; }
  .tabset > .tab::before { content: attr(data-title); display: block; font-weight: 700; margin-bottom: .3em; }
}

/* ---------------------------------------------------------------- suppression, corbeille */
.row-more { display: none; place-items: center; width: 24px; height: 24px; margin-right: 3px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; flex: none; }
.row-more svg { width: 15px; height: 15px; }
.row:hover .row-more, .row:focus-within .row-more { display: grid; }
.row-more:hover { background: var(--surface); color: var(--text); }
.row-scope:hover .count { display: none; }
.row-head .row-more { display: none !important; }
.menu.row-menu { position: fixed; right: auto; top: 0; min-width: 260px; z-index: 45; }
.toast.has-action { display: flex; align-items: center; gap: 14px; pointer-events: auto; }
.toast button { border: 0; background: none; color: var(--mark); font: 600 14px var(--sans); cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 2px; }
.toast.error button { color: #fff; }
.pick-item.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.pick-item.danger:hover { background: var(--c-caut-bg); border-color: var(--danger); }
.btn.danger-text { color: var(--danger); }
.trash td { vertical-align: middle; }
.trash-actions { text-align: right; white-space: nowrap; }
@media (hover: none) { .row-more { display: grid; } }

/* projets dépliables dans le menu latéral */
.scope-list { list-style: none; margin: 0; padding: 0; }
.scope-list li.scope > .row-scope { gap: 7px; padding-left: 0; }
.scope-list li.scope > ul { margin-left: 13px; padding-left: 6px; border-left: 1px solid var(--line-2); }
.scope-list li.scope.closed > ul { display: none; }
.scope-list li.scope > ul > li.scope > .row-scope .scope-ico { width: 22px; height: 22px; font-size: 13px; }
.empty-note { padding: 3px 10px 6px; font-size: 13px; color: var(--muted); }

/* cartes de projets dépliables (bibliothèque, sections) */
.proj-grid { align-items: start; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.md .proj-card-x { flex-direction: column; align-items: stretch; gap: 0; padding: 0; cursor: default; }
.md .proj-card-x:hover { transform: none; }
.md .proj-card-x .proj-head { display: flex; gap: 12px; align-items: flex-start; padding: 14px 15px 10px; color: var(--text); text-decoration: none; border-radius: 12px 12px 0 0; }
.md .proj-card-x .proj-head:hover .proj-title { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
.proj-toggle { display: flex; align-items: center; gap: 6px; width: 100%; padding: 6px 15px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--muted); font: 500 13px var(--sans); cursor: pointer; text-align: left; }
.proj-toggle:hover { color: var(--accent-ink); background: var(--accent-soft); }
.proj-toggle svg { width: 13px; height: 13px; transition: transform .15s; }
.proj-card-x.open .proj-toggle svg { transform: rotate(90deg); }
.proj-card-x:not(.open) .proj-toggle { border-radius: 0 0 12px 12px; }
.proj-pages { display: none; padding: 4px 12px 12px; border-top: 1px solid var(--line); }
.proj-card-x.open .proj-pages { display: block; }
.md ul.pt, .md ul.pt ul { list-style: none; margin: 0; padding: 0; }
.md ul.pt ul { margin-left: 1.05em; padding-left: .7em; border-left: 1px solid var(--line); }
.md ul.pt li { margin: 0; }
.md ul.pt a { display: flex; align-items: baseline; gap: 0; padding: 2px 4px; border-radius: 5px; color: var(--text-2); text-decoration: none; font-size: 14px; line-height: 1.45; }
.md ul.pt a:hover { background: var(--accent-soft); color: var(--accent-ink); }
.md ul.pt .num { flex: none; min-width: 2.1em; }
.md ul.pt li.pt-sub { margin-top: 6px; }
.md ul.pt li.pt-sub > a { align-items: center; gap: 7px; font-weight: 600; color: var(--text); }
.md ul.pt li.pt-sub > a .scope-ico { width: 20px; height: 20px; font-size: 12px; border-radius: 5px; }
.proj-tools { display: flex; justify-content: flex-end; gap: 8px; margin: -.4em 0 .6em; font-size: 13px; }
.proj-tools .link-btn { text-decoration: none; color: var(--muted); }
.proj-tools .link-btn:hover { color: var(--accent); }
.proj-tools .sep { color: var(--line-2); }

/* groupe « Pages » d'une section */
.pages-ico { color: var(--muted); }
.pages-ico svg { width: 15px; height: 15px; }
.row-pages > a .t { font-weight: 550; }
.proj-card-pages .pages-ico { width: 40px; height: 40px; }
.proj-card-pages .pages-ico svg { width: 20px; height: 20px; }

/* ---------------------------------------------------------------- connexion & compte */
body.auth-mode .topbar, body.auth-mode .layout, body.auth-mode .scrim { display: none !important; }
#auth { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px;
  background: radial-gradient(1200px 600px at 10% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.auth-card { width: min(420px, 100%); padding: 30px 30px 26px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.auth-card.wide { width: min(660px, 100%); }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; font: 600 16px var(--serif); color: var(--text-2); }
.auth-card h1 { margin: 0 0 6px; font: 600 1.6em/1.2 var(--serif); }
.auth-sub { margin: 0 0 18px; color: var(--text-2); font-size: 14.5px; }
.auth-form label, .acc-form label { display: block; margin-bottom: 13px; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.auth-form label small, .acc-form label small { font-weight: 400; color: var(--muted); }
.auth-form input:not([type=checkbox]), .acc-form input:not([type=checkbox]), .acc-form select, .otp-input {
  display: block; width: 100%; margin-top: 5px; height: 40px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 9px;
  background: var(--bg); color: var(--text); font: 15px var(--sans); outline: none; }
.auth-form input:focus, .acc-form input:focus, .acc-form select:focus, .otp-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mono { font-family: var(--mono) !important; letter-spacing: .06em; }
.otp-input { height: 52px !important; font: 600 26px var(--mono) !important; letter-spacing: .3em; text-align: center; margin: 0 0 14px !important; }
.otp-row { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.otp-row .otp-input { margin: 0 !important; max-width: 220px; height: 46px !important; font-size: 22px !important; }
.hint { margin: -6px 0 14px; font-size: 12.5px; color: var(--muted); }
.auth-error { margin: 4px 0 12px; padding: 8px 12px; border-radius: 8px; background: var(--c-caut-bg); color: var(--danger); font-size: 14px; }
.auth-alt { margin: 14px 0 0; text-align: center; font-size: 13.5px; }
.auth-alt .link-btn { color: var(--muted); }
.btn-block { width: 100%; justify-content: center; height: 42px; font-size: 15px; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.enroll-steps { margin: 0; padding-left: 1.3em; }
.enroll-steps > li { margin: 0 0 16px; padding-left: 4px; font-size: 14.5px; }
.enroll-steps > li::marker { font-weight: 700; color: var(--accent); }
.enroll-steps small { color: var(--muted); }
.qr-box { width: 220px; margin: 10px 0 6px; padding: 8px; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
.qr-box svg { display: block; width: 100%; height: auto; stroke: none; }
.qr-box svg * { stroke: none !important; }
.manual { font-size: 13.5px; margin-top: 6px; }
.manual summary { cursor: pointer; color: var(--accent); }
.manual p { margin: 6px 0; }
.secret code { font: 600 14px var(--mono); letter-spacing: .05em; padding: 4px 8px; background: var(--code-inline); border-radius: 6px; word-break: break-all; }
.recovery { margin: 0 0 12px; padding: 14px 16px; border: 1px dashed var(--line-2); border-radius: 12px; background: var(--bg); }
.recovery-title { margin: 0 0 4px; font-weight: 700; }
.recovery .small { color: var(--text-2); margin: 0 0 10px; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px; margin: 0 0 10px; padding: 0; list-style: none; }
.codes code { font: 600 15px var(--mono); letter-spacing: .05em; }
.recovery-actions { margin: 0; }
.user-btn { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--accent-soft); color: var(--accent-ink); font: 700 14px var(--sans); cursor: pointer; }
.user-btn:hover { border-color: var(--accent); }
.menu-head { padding: 8px 10px 6px; display: flex; flex-direction: column; }
.menu-head small { color: var(--muted); font-size: 12px; }
.acc-form { max-width: 420px; }
.acc-form.inline { max-width: none; display: grid; grid-template-columns: 1fr 1fr 160px; gap: 0 12px; align-items: end; margin-top: 14px; }
.acc-form.inline p { grid-column: 1 / -1; margin: 0 0 8px; }
.md td select { height: 30px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--bg); color: var(--text); font: inherit; font-size: 13.5px; }
.pw-show { font: 600 18px var(--mono) !important; letter-spacing: .04em; padding: 6px 10px !important; }
@media (max-width: 700px) { .acc-form.inline { grid-template-columns: 1fr; } .codes { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- aide intégrée */
.help-ico { font: 700 16px var(--serif) !important; }
.help-filter { width: 100%; height: 34px; margin: 0 0 10px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); color: var(--text); font: 14px var(--sans); outline: none; }
.help-filter:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.help-list .row > a { padding-left: 4px; }
.help-hit { display: block; padding: 7px 8px; border-radius: 7px; text-decoration: none; color: var(--text-2); font-size: 13px; line-height: 1.4; }
.help-hit:hover { background: var(--accent-soft); }
.help-hit b { display: block; color: var(--text); font-size: 13.5px; }
.help-hit small { display: block; color: var(--accent); font-size: 12px; }
.help-hit span { display: block; color: var(--muted); }

/* enrôlement OTP : QR code et clé secrète côte à côte */
.enroll-pair { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 14px; align-items: start; margin: 10px 0 2px; }
.pair-opt { min-width: 0; }
.pair-label { display: flex; align-items: center; gap: 7px; margin: 0 0 8px; font-weight: 600; font-size: 13.5px; }
.pair-tag { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: var(--bg); font: 700 11px var(--sans); }
.enroll-pair .qr-box { width: 190px; margin: 0; }
.pair-or { align-self: center; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.pair-or::before, .pair-or::after { content: ""; width: 1px; height: 48px; background: var(--line-2); }
.secret-box { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px 14px; border: 2px solid var(--accent); border-radius: 12px; background: var(--accent-soft); }
.secret-label { font: 700 11px var(--sans); text-transform: uppercase; letter-spacing: .1em; color: var(--accent-ink); }
.secret-box code { font: 700 17px/1.55 var(--mono); letter-spacing: .06em; color: var(--text); background: none; padding: 0; word-break: break-word; }
.secret-meta { margin: 10px 0 0; font-size: 12.5px; }
.secret-meta div { display: flex; gap: 8px; padding: 2px 0; }
.secret-meta dt { min-width: 100px; color: var(--muted); }
.secret-meta dd { margin: 0; color: var(--text-2); }
@media (max-width: 560px) {
  .enroll-pair { grid-template-columns: 1fr; }
  .pair-or { flex-direction: row; }
  .pair-or::before, .pair-or::after { width: 48px; height: 1px; }
}
