/* Notes : styles de l'éditeur par blocs, repris de Crates. */
:root { --panel: #15131f; --panel-2: #1b1828; --hover: #221f31; --line: #262236; --line-2: #363049; --text-2: #b4b0c8; --accent-bg: rgba(154, 108, 255, .14); --cyan: #5fe8f0; --yellow: #fbbf24; --pink: #ff6fae; --shadow: 0 18px 50px rgba(0, 0, 0, .45); --radius-s: 8px; --sans: var(--font); }
.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.grow { flex: 1; min-width: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 0 12px; border-radius: var(--radius-s); border: 1px solid var(--line-2); background: none; font-size: 14px; font-weight: 800; color: var(--text); }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.small { min-height: 30px; padding: 0 9px; font-size: 13px; }
.btn.bad { color: var(--red); }
.in { width: 100%; min-height: 36px; padding: 4px 8px; font-size: 14px; font-weight: 600; }
.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; }
.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; }

/* Liste et page de note */
.nb-chk { min-height: 0; padding: 0; }
.nb-lang { width: auto; min-height: 0; padding: 2px 6px; font-size: 12px; font-weight: 600; }
.notes-bar { display: flex; gap: 10px; margin: 6px 0 4px; }
.notes-bar .search { flex: 1; min-width: 0; font-weight: 600; font-size: 16px; }
.notes-bar .go { flex: none; }
.note-row { justify-content: flex-start; gap: 12px; }
.note-row .code { font-size: 16px; overflow-wrap: anywhere; }
.note-ico { flex: none; display: grid; place-items: center; width: 38px; height: 38px; background: var(--surface-2); border-radius: var(--radius-sm); font-size: 19px; line-height: 1; }
.note-top { display: flex; align-items: center; gap: 6px; min-height: 44px; }
.note-state { font-size: 13px; color: var(--muted); white-space: nowrap; }
.note-head { display: flex; align-items: flex-start; gap: 6px; margin: 10px 0 12px; }
.note-emoji { flex: none; width: 44px; height: 44px; background: none; border: 0; border-radius: var(--radius-s); font-size: 26px; line-height: 1; }
.note-emoji:hover { background: var(--hover); }
.note-title { flex: 1; min-width: 0; min-height: 44px; padding: 2px 0; background: none; border: 0; font-size: 28px; font-weight: 800; line-height: 1.3; }
.note-title:focus-visible { outline: none; }
.note-picker { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; margin-bottom: 12px; }
.note-picker button { min-height: 40px; background: none; border: 0; border-radius: var(--radius-s); font-size: 20px; }
.note-picker button:hover { background: var(--hover); }
@media (min-width: 821px) { main.wide .note-body { padding-left: 48px; } }
