/* Crates 2 — système visuel. Sombre par défaut, clair disponible. */
:root {
  --bg: #0b0a12;
  --bg-2: #100e19;
  --panel: #15131f;
  --panel-2: #1b1828;
  --hover: #221f31;
  --line: #262236;
  --line-2: #363049;
  --text: #ecebf5;
  --text-2: #b4b0c8;
  --muted: #7f7a96;
  --accent: #8b7bff;
  --accent-2: #a79bff;
  --accent-bg: rgba(139, 123, 255, .14);
  --cyan: #4fd8eb;
  --green: #5be39b;
  --yellow: #ffcf5c;
  --orange: #ff8a5c;
  --red: #ff5c7a;
  --pink: #ff6fae;
  --shadow: 0 18px 50px rgba(0, 0, 0, .45);
  --radius: 12px;
  --radius-s: 8px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  --side: 240px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f6f5fb;
  --bg-2: #efedf7;
  --panel: #ffffff;
  --panel-2: #f7f6fc;
  --hover: #efedf8;
  --line: #e4e1ef;
  --line-2: #d3cfe3;
  --text: #17141f;
  --text-2: #4a4560;
  --muted: #827d97;
  --accent: #6c5ce7;
  --accent-2: #5a4ad6;
  --accent-bg: rgba(108, 92, 231, .1);
  --shadow: 0 18px 50px rgba(30, 20, 60, .16);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; overflow: hidden; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent-bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
svg.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.wrap { flex-wrap: wrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
kbd { font: 11px var(--mono); padding: 1px 5px; border-radius: 5px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text-2); }

/* ---------- Coquille ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; height: 100vh; height: 100dvh; }
.side { background: var(--bg-2); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 10px; font-weight: 700; letter-spacing: .2px; }
.brand img { width: 26px; height: 26px; }
.brand small { font-weight: 500; color: var(--muted); font-size: 11px; margin-left: auto; }
.search-btn { margin: 4px 12px 10px; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--panel); color: var(--muted); cursor: pointer; text-align: left; }
.search-btn:hover { border-color: var(--line-2); color: var(--text-2); }
.search-btn kbd { margin-left: auto; }
.nav { padding: 4px 8px; display: flex; flex-direction: column; gap: 1px; overflow-y: auto; min-height: 0; flex: 1; }
.nav a, .nav button.navlink { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-s); color: var(--text-2); border: 0; background: none; cursor: pointer; text-align: left; width: 100%; }
.nav a:hover, .nav button.navlink:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--accent-bg); color: var(--text); }
.nav a.on svg.i { color: var(--accent-2); }
.nav .badge { margin-left: auto; }
.nav-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 10px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.nav-h button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px; border-radius: 5px; display: flex; }
.nav-h button:hover { color: var(--text); background: var(--hover); }
.dot { width: 9px; height: 9px; border-radius: 3px; flex: none; background: var(--c, var(--accent)); }
.side-foot { padding: 10px 12px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 6px; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.live.on::before { background: var(--green); box-shadow: 0 0 8px var(--green); }
.main { min-width: 0; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.page { padding: 26px 34px 60px; max-width: 1280px; width: 100%; margin: 0 auto; }
.page.wide { max-width: none; }
.head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.head h1 { font-size: 22px; margin: 0; letter-spacing: -.2px; display: flex; align-items: center; gap: 10px; }
.head .sub { color: var(--muted); font-size: 13px; width: 100%; margin-top: -8px; }
.head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--text); border-color: var(--accent); }

/* Barre mobile */
.mobile-bar { display: none; }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 50; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .shell.menu .side { transform: none; }
  .shell.menu::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 40; }
  .mobile-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
  .mobile-bar b { flex: 1; }
  .page { padding: 18px 16px 80px; }
}

/* ---------- Éléments ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: var(--radius-s); border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); cursor: pointer; white-space: nowrap; font-weight: 500; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--hover); border-color: var(--muted); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: none; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.danger { color: var(--red); }
.btn.danger.solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn.small { height: 28px; padding: 0 9px; font-size: 13px; }
.btn.icon { width: 34px; padding: 0; }
.btn.icon.small { width: 28px; }
.btn.on { background: var(--accent-bg); border-color: var(--accent); }
input.in, textarea.in, select.in { width: 100%; padding: 8px 10px; border-radius: var(--radius-s); border: 1px solid var(--line-2); background: var(--bg); outline: none; transition: border-color .12s; }
input.in:focus, textarea.in:focus, select.in:focus { border-color: var(--accent); }
textarea.in { resize: vertical; min-height: 90px; line-height: 1.55; }
textarea.code, .code { font: 13px/1.55 var(--mono); }
label.f, div.f { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 500; }
label.f > span, div.f > span { display: flex; justify-content: space-between; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 500; background: color-mix(in srgb, var(--c, var(--accent)) 16%, transparent); color: color-mix(in srgb, var(--c, var(--accent)) 80%, var(--text)); white-space: nowrap; }
button.chip { border: 1px solid transparent; cursor: pointer; }
button.chip.off { background: none; color: var(--muted); border-color: var(--line); }
button.chip:hover { border-color: var(--c, var(--accent)); }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; background: var(--c, var(--accent)); color: #fff; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card.pad { padding: 16px; }
.card > h3, .card > .pad > h3 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(var(--min, 280px), 1fr)); }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty svg.i { width: 34px; height: 34px; margin-bottom: 8px; opacity: .6; }
.empty h3 { color: var(--text); margin: 0 0 6px; font-size: 16px; }
.list { display: flex; flex-direction: column; }
.list > .item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.list > .item:last-child { border-bottom: 0; }
.list > .item.link { cursor: pointer; }
.list > .item.link:hover { background: var(--hover); }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--c, var(--accent)); border-radius: 3px; transition: width .3s; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { color: var(--muted); padding: 40px; display: flex; gap: 10px; align-items: center; justify-content: center; }

/* ---------- Superpositions ---------- */
.overlay { position: fixed; inset: 0; background: rgba(5, 4, 12, .62); backdrop-filter: blur(3px); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow); width: 100%; max-width: 560px; max-height: 84vh; max-height: 84dvh; display: flex; flex-direction: column; animation: pop .14s; }
.modal.lg { max-width: 860px; }
.modal.xl { max-width: 1100px; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-h h2 { margin: 0; font-size: 16px; flex: 1; min-width: 0; }
.modal-b { padding: 16px; overflow-y: auto; min-height: 0; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 14px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.modal-f .left { margin-right: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100%); background: var(--panel); border-left: 1px solid var(--line-2); box-shadow: var(--shadow); z-index: 90; display: flex; flex-direction: column; animation: slide .16s; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; background: var(--panel-2); border: 1px solid var(--line-2); box-shadow: var(--shadow); border-radius: 10px; padding: 9px 12px 9px 14px; display: flex; align-items: center; gap: 12px; animation: pop .15s; max-width: 90vw; }
.toast.err { border-color: var(--red); }
.toast button { border: 0; background: none; color: var(--accent-2); font-weight: 600; cursor: pointer; padding: 2px 4px; }
.menu-pop { position: fixed; z-index: 150; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; min-width: 180px; animation: fade .1s; }
.menu-pop button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; text-align: left; color: var(--text); }
.menu-pop button:hover { background: var(--hover); }
.menu-pop button.danger { color: var(--red); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* Palette */
.palette { max-width: 640px; }
.palette input { border: 0; background: none; padding: 16px 18px; font-size: 16px; outline: none; width: 100%; border-bottom: 1px solid var(--line); }
.palette .results { overflow-y: auto; padding: 6px; max-height: 60vh; }
.palette .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); padding: 8px 10px 4px; }
.palette .res { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.palette .res.sel { background: var(--accent-bg); }
.palette .res .t { flex: 1; min-width: 0; }
.palette .res .t b { font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette .res .t small { color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette mark { background: none; color: var(--accent-2); font-weight: 600; }
.palette .hint { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

/* ---------- Markdown ---------- */
.md { line-height: 1.65; word-wrap: break-word; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 { margin: 1.3em 0 .5em; line-height: 1.3; }
.md h1 { font-size: 1.5em; } .md h2 { font-size: 1.25em; } .md h3 { font-size: 1.08em; }
.md p, .md ul, .md ol, .md pre, .md blockquote, .md table { margin: .6em 0; }
.md ul, .md ol { padding-left: 1.4em; }
.md li.task { list-style: none; margin-left: -1.3em; }
.md li.task input { margin-right: 7px; }
.md code { font: .9em var(--mono); background: var(--panel-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; }
.md pre { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px 14px; overflow-x: auto; }
.md pre code { background: none; border: 0; padding: 0; font-size: 13px; }
.md blockquote { border-left: 3px solid var(--accent); padding: 2px 12px; color: var(--text-2); margin-left: 0; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1.4em 0; }
.md table { border-collapse: collapse; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: 5px 10px; text-align: left; }
.md img { max-width: 100%; border-radius: 8px; }

/* Éditeur Markdown (écriture / aperçu) */
.editor { display: flex; flex-direction: column; border: 1px solid var(--line-2); border-radius: var(--radius-s); background: var(--bg); min-height: 0; }
.editor:focus-within { border-color: var(--accent); }
.editor .tb { display: flex; gap: 2px; padding: 4px; border-bottom: 1px solid var(--line); align-items: center; }
.editor .tb button { border: 0; background: none; padding: 4px 8px; border-radius: 6px; color: var(--muted); cursor: pointer; font-size: 12px; }
.editor .tb button.on { color: var(--text); background: var(--hover); }
.editor .tb .state { margin-left: auto; font-size: 12px; color: var(--muted); padding-right: 6px; }
.editor textarea { border: 0; background: none; outline: none; resize: none; padding: 12px 14px; min-height: 240px; flex: 1; font: 14px/1.65 var(--sans); }
.editor textarea.code { font: 13px/1.6 var(--mono); }
.editor .md { padding: 12px 14px; min-height: 240px; overflow-y: auto; flex: 1; }

/* ---------- Rendu Markdown enrichi ---------- */
.md mark, .nb-c mark, .nb-cell mark { background: rgba(255, 207, 92, .32); color: inherit; border-radius: 3px; padding: 0 2px; }
.md a.mention, .nb-c a.mention { background: var(--accent-bg); padding: 1px 6px; border-radius: 6px; font-weight: 500; }
.md li.task.done { color: var(--muted); text-decoration: line-through; }
.md ul ul, .md ol ol, .md ul ol, .md ol ul { margin: .2em 0; }
.md .callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius-s); background: var(--co-bg, var(--accent-bg)); border: 1px solid var(--co-line, transparent); margin: .7em 0; }
.md .callout .ci { font-size: 1.15em; line-height: 1.5; }
.md .callout .cb { flex: 1; min-width: 0; }
.c-tip { --co-bg: rgba(91, 227, 155, .12); } .c-warning { --co-bg: rgba(255, 207, 92, .14); } .c-caution { --co-bg: rgba(255, 92, 122, .13); } .c-important { --co-bg: rgba(79, 216, 235, .12); }
.md details.tg { margin: .5em 0; }
.md details.tg summary { cursor: pointer; font-weight: 500; }
.md details.tg .tg-b { padding: 2px 0 2px 1.3em; }
.md figure { margin: .8em 0; }
.md figcaption { color: var(--muted); font-size: .88em; text-align: center; margin-top: 4px; }
.md .al-center { text-align: center; } .md .al-right { text-align: right; }

/* ---------- Page d'idée façon Notion ---------- */
.ideas { grid-template-columns: 270px minmax(0, 1fr); }
@media (max-width: 820px) { .ideas { grid-template-columns: minmax(0, 1fr); } }
.np-search { margin-bottom: 0; }
.np-sh { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 10px 10px 4px; }
.np-sh .i { width: 12px; height: 12px; }
.np-li { width: 18px; text-align: center; flex: none; }
.np-st { color: var(--c); font-weight: 500; }
.np-tg { background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; font-size: 10.5px; }
.ideas .side-list small.row { gap: 6px; }
.np-host { min-width: 0; }
.np { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); min-height: 70vh; position: relative; }
.np-top { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 3; border-radius: var(--radius) var(--radius) 0 0; flex-wrap: wrap; }
.np-crumb { gap: 6px; min-width: 0; max-width: 40%; font-size: 13px; }
.np-crumb a { color: var(--muted); }
.np-save, .np-stats { font-size: 12px; color: var(--muted); white-space: nowrap; }
.np-pin.on { color: var(--accent-2); background: var(--accent-bg); }
.np-scroll { position: relative; display: flex; justify-content: center; column-gap: 24px; flex-wrap: wrap; }
.np-cover { position: relative; height: 190px; width: 100%; flex: none; }
.np-cover-bar { position: absolute; right: 14px; bottom: 10px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.np-cover:hover .np-cover-bar { opacity: 1; }
.np-cover-bar button { border: 0; background: rgba(0, 0, 0, .55); color: #fff; padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.np-in { width: min(760px, 100%); padding: 28px 54px 40px; min-width: 0; flex: 0 1 760px; }
.np.wide .np-in { width: 100%; flex-basis: 100%; max-width: none; }
.np-in.has-cover .np-icon { margin-top: -62px; }
.np-icon { font-size: 64px; line-height: 1; border: 0; background: none; cursor: pointer; padding: 4px; border-radius: 10px; position: relative; display: block; }
.np-icon:hover { background: var(--hover); }
.np-adds { display: flex; gap: 4px; min-height: 28px; margin: 6px 0 2px; opacity: 0; transition: opacity .15s; }
.np-in:hover .np-adds, .np-adds:focus-within { opacity: 1; }
.np-adds button { display: flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--muted); padding: 4px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.np-adds button:hover { background: var(--hover); color: var(--text-2); }
.np-adds .i { width: 14px; height: 14px; }
.np-title { font-size: 38px; font-weight: 750; line-height: 1.2; letter-spacing: -.5px; outline: none; padding: 4px 0 10px; word-break: break-word; }
.np-title:empty::before { content: attr(data-ph); color: var(--muted); opacity: .6; }
.np-props { display: flex; flex-direction: column; gap: 2px; padding-bottom: 14px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.np-prop { display: flex; align-items: flex-start; gap: 8px; min-height: 32px; }
.np-prop-k { width: 120px; flex: none; color: var(--muted); font-size: 13px; padding-top: 6px; }
.np-prop-v { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; flex: 1; min-height: 32px; font-size: 13px; }
.np-chip { border: 1px solid var(--line); background: none; color: var(--text-2); border-radius: 999px; padding: 2px 10px; cursor: pointer; font-size: 12.5px; }
.np-chip:hover { border-color: var(--c); }
.np-chip.on { background: color-mix(in srgb, var(--c) 18%, transparent); border-color: color-mix(in srgb, var(--c) 50%, transparent); color: var(--text); font-weight: 500; }
.np-tag { display: inline-flex; align-items: center; gap: 2px; background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--text); border-radius: 5px; padding: 1px 4px 1px 8px; font-size: 12.5px; }
.np-tag button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 3px; font-size: 14px; line-height: 1; }
.np-tag button:hover { color: var(--text); }
.np-tag-in { border: 0; background: none; outline: none; color: var(--text); font-size: 13px; min-width: 60px; flex: 1; padding: 4px 2px; }
.np-toc { position: sticky; top: 64px; align-self: flex-start; width: 190px; padding: 30px 0; font-size: 12.5px; display: flex; flex-direction: column; gap: 2px; flex: none; max-height: calc(100vh - 120px); overflow-y: auto; }
.np-toc-h { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.np-toc a { color: var(--text-2); padding: 3px 8px; border-radius: 5px; border-left: 2px solid var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-toc a:hover { color: var(--text); background: var(--hover); text-decoration: none; }
.np-toc a.l2 { padding-left: 18px; } .np-toc a.l3 { padding-left: 28px; font-size: 12px; }
.np.wide .np-toc { display: none; }
.np { container-type: inline-size; }
@container (max-width: 1040px) { .np-toc { display: none; } }
@media (max-width: 820px) {
  .np-in { padding: 18px 16px 30px; }
  .np-title { font-size: 28px; }
  .np-prop-k { width: 92px; }
  .np-hide, .np-stats, .np-save { display: none; }
  .np-top { flex-wrap: nowrap; }
  .np-crumb { max-width: 50%; }
  .np-cover { height: 130px; }
  .np-adds { opacity: 1; }
}
.np-pick { padding: 8px; max-width: 340px; }
.np-pick .row { gap: 4px; margin-bottom: 6px; }
.np-pick .in { flex: 1; min-width: 0; }
.np-covers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.np-covers button { height: 40px; border-radius: 6px; border: 1px solid var(--line); cursor: pointer; }
.np-covers button:hover { outline: 2px solid var(--accent); }

/* ---------- Éditeur par blocs ---------- */
.nb-ed { outline: none; padding-bottom: 140px; font-size: 15.5px; line-height: 1.65; position: relative; }
.nb-ed.nested { padding-bottom: 0; font-size: inherit; }
.nb { position: relative; display: flex; border-radius: 4px; margin: 1px 0; }
.nb-b { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 6px; position: relative; }
.nb-g { position: absolute; left: -48px; top: 2px; display: flex; gap: 0; opacity: 0; transition: opacity .1s; }
.nb.nested-hide .nb-g { display: none; }
.nb:hover > .nb-g, .nb.focus > .nb-g { opacity: 1; }
.nb-g button { width: 22px; height: 24px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 4px; display: grid; place-items: center; font-size: 13px; letter-spacing: -2px; padding: 0; }
.nb-g button:hover { background: var(--hover); color: var(--text); }
.nb-g .i { width: 15px; height: 15px; }
.nb-drag { cursor: grab !important; touch-action: none; }
.nb-c { flex: 1; min-width: 0; outline: none; padding: 3px 2px; word-break: break-word; white-space: pre-wrap; }
.nb-c:empty::before, .nb-cell:empty::before { content: attr(data-ph); color: var(--muted); opacity: 0; pointer-events: none; }
.nb.focus > .nb-b > .nb-c:empty::before, .nb.focus .nb-row > .nb-c:empty::before,
.nb:is([data-t^="h"], [data-t="ul"], [data-t="ol"], [data-t="todo"], [data-t="quote"], [data-t="toggle"]) .nb-c:empty::before,
.nb-ed.nb-empty:not(.nested) .nb-c:empty::before, .nb-cap:empty::before { opacity: .55; }
.nb.nb-sel { background: var(--accent-bg); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); }
.nb.nb-dragging { opacity: .35; }
.nb-c a { color: var(--accent-2); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent-2) 40%, transparent); text-underline-offset: 2px; cursor: text; }
.nb-c a.mention { text-decoration: none; cursor: pointer; }
.nb-c code, .nb-cell code { font: .88em var(--mono); background: var(--panel-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; color: var(--pink); }
.nb-c img { max-width: 100%; }
.nb[data-t="h1"] { margin-top: 1.1em; } .nb[data-t="h1"] .nb-c { font-size: 1.85em; font-weight: 700; line-height: 1.25; }
.nb[data-t="h2"] { margin-top: .9em; } .nb[data-t="h2"] .nb-c { font-size: 1.45em; font-weight: 650; line-height: 1.3; }
.nb[data-t="h3"] { margin-top: .6em; } .nb[data-t="h3"] .nb-c { font-size: 1.2em; font-weight: 600; }
.nb[data-t^="h"] > .nb-g { top: calc(.35em + 2px); }
.nb[data-i="1"] { margin-left: 26px; } .nb[data-i="2"] { margin-left: 52px; } .nb[data-i="3"] { margin-left: 78px; } .nb[data-i="4"] { margin-left: 104px; }
.nb[data-t="ul"] .nb-b::before { content: "•"; width: 20px; text-align: center; flex: none; padding-top: 3px; font-size: 1.2em; line-height: 1.4; color: var(--text-2); }
.nb[data-t="ul"][data-i="1"] .nb-b::before, .nb[data-t="ul"][data-i="3"] .nb-b::before { content: "◦"; }
.nb[data-t="ul"][data-i="2"] .nb-b::before, .nb[data-t="ul"][data-i="4"] .nb-b::before { content: "▪"; font-size: .9em; padding-top: 5px; }
.nb[data-t="ol"] .nb-b::before { content: attr(data-n) "."; min-width: 20px; text-align: right; flex: none; padding: 3px 2px 0 0; color: var(--text-2); font-variant-numeric: tabular-nums; }
.nb[data-t="ol"] .nb-b { counter-reset: none; }
.nb-chk { margin: 7px 4px 0 2px; width: 16px; height: 16px; accent-color: var(--accent); flex: none; cursor: pointer; }
.nb.done > .nb-b > .nb-c { color: var(--muted); text-decoration: line-through; }
.nb[data-t="quote"] .nb-c { border-left: 3px solid var(--text-2); padding-left: 14px; font-size: 1.05em; }
.nb[data-t="callout"] .nb-b { background: var(--co-bg, var(--accent-bg)); border-radius: var(--radius-s); padding: 10px 14px 10px 10px; gap: 8px; }
.nb[data-k="tip"] { --co-bg: rgba(91, 227, 155, .12); } .nb[data-k="warning"] { --co-bg: rgba(255, 207, 92, .14); } .nb[data-k="caution"] { --co-bg: rgba(255, 92, 122, .13); } .nb[data-k="important"] { --co-bg: rgba(79, 216, 235, .12); }
.nb-emoji { border: 0; background: none; font-size: 20px; line-height: 1.3; cursor: pointer; border-radius: 6px; padding: 2px 4px; flex: none; }
.nb-emoji:hover { background: var(--hover); }
.nb-cb { flex: 1; min-width: 0; }
.nb-ed.nested .nb-g { left: -44px; }
.nb[data-t="toggle"] .nb-b { flex-direction: column; gap: 0; }
.nb-row { display: flex; align-items: flex-start; width: 100%; gap: 2px; }
.nb-tw { border: 0; background: none; color: var(--text-2); cursor: pointer; width: 22px; height: 28px; flex: none; border-radius: 4px; transition: transform .15s; font-size: 12px; }
.nb-tw:hover { background: var(--hover); }
.nb.open > .nb-b .nb-tw { transform: rotate(90deg); }
.nb-tb { padding-left: 24px; width: 100%; display: none; }
.nb.open > .nb-b > .nb-tb { display: block; }
.nb[data-t="code"] .nb-b { flex-direction: column; gap: 0; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; }
.nb-codebar { display: flex; align-items: center; gap: 6px; width: 100%; padding: 4px 6px; border-bottom: 1px solid var(--line); opacity: .7; transition: opacity .15s; }
.nb:hover .nb-codebar, .nb.focus .nb-codebar { opacity: 1; }
.nb-codebar button, .nb-lang { display: flex; align-items: center; gap: 5px; border: 0; background: none; color: var(--muted); font-size: 12px; cursor: pointer; padding: 3px 6px; border-radius: 5px; font-family: inherit; }
.nb-codebar button:hover, .nb-lang:hover { background: var(--hover); color: var(--text); }
.nb-codebar .i { width: 13px; height: 13px; }
.nb-code { font: 13px/1.6 var(--mono) !important; padding: 12px 14px !important; margin: 0; width: 100%; white-space: pre; overflow-x: auto; tab-size: 2; color: var(--text); }
.nb[data-t="hr"] .nb-b { padding: 10px 0; cursor: default; }
.nb[data-t="hr"] hr { border: 0; border-top: 1px solid var(--line-2); width: 100%; margin: 0; }
.nb[data-t="img"] .nb-b { flex-direction: column; align-items: stretch; gap: 2px; }
.nb-fig { margin: 4px 0 0; position: relative; }
.nb-fig img { max-width: 100%; border-radius: 6px; display: block; margin: 0 auto; }
.nb-imgbar { position: absolute; right: 8px; top: 8px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.nb-fig:hover .nb-imgbar { opacity: 1; }
.nb-imgbar > * { border: 0; background: rgba(0, 0, 0, .6); color: #fff !important; font-size: 12px; padding: 4px 9px; border-radius: 6px; cursor: pointer; }
.nb-imgph { display: flex; align-items: center; gap: 10px; padding: 18px; border: 1px dashed var(--line-2); border-radius: var(--radius-s); color: var(--muted); background: var(--panel-2); flex-wrap: wrap; }
.nb-cap { text-align: center; color: var(--muted); font-size: .88em; }
.nb[data-t="table"] .nb-b { display: block; }
.nb-tblw { position: relative; overflow-x: auto; padding: 4px 26px 26px 0; }
.nb-tbl { border-collapse: collapse; min-width: 50%; font-size: 14px; }
.nb-cell { border: 1px solid var(--line-2); padding: 6px 10px; min-width: 90px; outline: none; vertical-align: top; }
.nb-tbl tr:first-child .nb-cell { background: var(--panel-2); font-weight: 600; }
.nb-cell:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.nb-tadd { position: absolute; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); border-radius: 5px; cursor: pointer; opacity: 0; transition: opacity .15s; font-size: 14px; }
.nb:hover .nb-tadd, .nb.focus .nb-tadd, .nb:focus-within .nb-tadd { opacity: 1; }
.nb-tadd:hover { color: var(--text); border-color: var(--accent); }
.nb-tadd.col { right: 2px; top: 4px; bottom: 26px; width: 20px; }
.nb-tadd.row { left: 0; right: 26px; bottom: 2px; height: 20px; }
.nb-ed.nb-drop { outline: 2px dashed var(--accent); outline-offset: 6px; border-radius: 6px; }
.nb-dropline { position: fixed; height: 3px; background: var(--accent); border-radius: 2px; z-index: 200; pointer-events: none; box-shadow: 0 0 8px var(--accent); }
.nb-ghost { position: fixed; z-index: 201; pointer-events: none; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 6px; padding: 4px 10px; font-size: 12.5px; box-shadow: var(--shadow); max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .92; }
.nb-ai-wait { animation: nbpulse 1.2s ease-in-out infinite; }
@keyframes nbpulse { 50% { opacity: .45; } }
@media (max-width: 820px) {
  .nb-g { position: static; opacity: 1; display: none; }
  .nb.focus > .nb-g { display: flex; flex-direction: column; margin-left: -6px; }
  .nb[data-i="1"] { margin-left: 18px; } .nb[data-i="2"] { margin-left: 36px; } .nb[data-i="3"] { margin-left: 54px; } .nb[data-i="4"] { margin-left: 72px; }
}

/* Fenêtres : menu « / », mentions, barre de mise en forme */
.nb-pop { position: fixed; z-index: 160; width: 300px; max-height: 340px; overflow-y: auto; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; animation: fade .1s; }
.nb-pop-h { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 8px 8px 4px; }
.nb-pop button, .nb-menu button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; color: var(--text); padding: 6px 8px; border-radius: 6px; cursor: pointer; text-align: left; }
.nb-pop button.on, .nb-menu button:hover { background: var(--hover); }
.nb-pop-i { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); font-size: 13px; font-weight: 600; color: var(--text-2); }
.nb-menu .nb-pop-i { width: 22px; height: 22px; border: 0; background: none; }
.nb-pop-t { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.nb-pop-t b { font-weight: 500; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-pop-t small { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-pop-e { padding: 10px; color: var(--muted); font-size: 13px; }
.nb-menu { max-height: 70vh; overflow-y: auto; min-width: 230px; }
.nb-menu kbd { margin-left: auto; }
.nb-emojis { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 4px; }
.nb-emojis button { border: 0; background: none; font-size: 18px; padding: 4px; border-radius: 6px; cursor: pointer; justify-content: center; }
.nb-emojis button:hover { background: var(--hover); }
.nb-emojis.big { grid-template-columns: repeat(8, 36px); }
.nb-emojis.big button { font-size: 22px; }
.nb-bar { position: fixed; z-index: 170; display: flex; align-items: center; gap: 1px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: var(--shadow); padding: 3px; animation: fade .08s; }
.nb-bar button { border: 0; background: none; color: var(--text-2); min-width: 30px; height: 28px; border-radius: 5px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 5px; font-size: 13.5px; padding: 0 6px; }
.nb-bar button:hover, .nb-bar button.on { background: var(--hover); color: var(--text); }
.nb-bar button.on { color: var(--accent-2); }
.nb-bar code { font: 11.5px var(--mono); }
.nb-bar mark { background: rgba(255, 207, 92, .4); color: inherit; padding: 0 4px; border-radius: 3px; }
.nb-bar .i { width: 15px; height: 15px; }
.nb-bar-sep { width: 1px; height: 18px; background: var(--line-2); margin: 0 3px; }
.nb-bar-ai { color: var(--accent-2) !important; font-weight: 500; }
.nb-link { position: fixed; z-index: 180; display: flex; gap: 6px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: var(--shadow); padding: 6px; width: 330px; }
.nb-link .in { flex: 1; }

