/* style.css — Espace Arthur (lhoste.org/Arthur) */
:root {
  --bg: #ffffff; --bg-side: #f7f7f5; --bg-hover: rgba(55,53,47,.08); --bg-active: rgba(55,53,47,.12); --bg-soft: #fbfbfa;
  --fg: #37352f; --fg-2: #787774; --fg-3: #a8a6a1; --line: rgba(55,53,47,.12); --line-2: rgba(55,53,47,.08);
  --accent: #2383e2; --danger: #e03e3e; --code-bg: #f7f6f3; --callout-bg: #f1f1ef;
  --shadow: 0 8px 24px rgba(15,15,15,.12), 0 0 0 1px rgba(15,15,15,.06);
  --sidebar-w: 260px; --radius: 6px; --sel: rgba(35,131,226,.18); --sel-strong: rgba(35,131,226,.28);
  /* couleurs des options et du texte */
  --c-gray: #787774; --c-brown: #9f6b53; --c-orange: #d9730d; --c-yellow: #cb912f; --c-green: #448361; --c-blue: #337ea9; --c-purple: #9065b0; --c-pink: #c14c8a; --c-red: #d44c47;
  --b-gray: #f1f1ef; --b-brown: #f4eeee; --b-orange: #fbecdd; --b-yellow: #fbf3db; --b-green: #edf3ec; --b-blue: #e7f3f8; --b-purple: #f6f3f9; --b-pink: #faf1f5; --b-red: #fdebec;
  --t-gray: #e3e2e0; --t-brown: #eee0da; --t-orange: #fadec9; --t-yellow: #fdecc8; --t-green: #dbeddb; --t-blue: #d3e5ef; --t-purple: #e8deee; --t-pink: #f5e0e9; --t-red: #ffe2dd;
}
html[data-theme="dark"] {
  --bg: #191919; --bg-side: #202020; --bg-hover: rgba(255,255,255,.06); --bg-active: rgba(255,255,255,.1); --bg-soft: #1e1e1e;
  --fg: #e6e6e4; --fg-2: #9b9b98; --fg-3: #6b6b68; --line: rgba(255,255,255,.1); --line-2: rgba(255,255,255,.06);
  --code-bg: #262626; --callout-bg: #262626; --shadow: 0 8px 24px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.08);
  --c-gray: #9b9b9b; --c-brown: #ba856f; --c-orange: #c77d48; --c-yellow: #ca9849; --c-green: #529e72; --c-blue: #5e87c9; --c-purple: #9d68d3; --c-pink: #d15796; --c-red: #df5452;
  --b-gray: #2f2f2f; --b-brown: #4a3228; --b-orange: #5c3b23; --b-yellow: #564328; --b-green: #243d30; --b-blue: #143a4e; --b-purple: #3c2d49; --b-pink: #4e2c3c; --b-red: #522e2a;
  --t-gray: #373737; --t-brown: #5a3c2e; --t-orange: #6b4524; --t-yellow: #6b5528; --t-green: #2b5940; --t-blue: #28456c; --t-purple: #4b3366; --t-pink: #69314c; --t-red: #6e3630;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: Inter, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif; color: var(--fg); background: var(--bg); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--fg-3); }
.pad { padding: 14px 4px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
kbd { font: 11px/1 Inter, sans-serif; color: var(--fg-3); border: 1px solid var(--line); border-radius: 3px; padding: 2px 5px; margin-left: auto; white-space: nowrap; }
::selection { background: var(--sel-strong); }
.inp, .sel { width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); outline: none; font-size: 14px; }
.inp:focus, .sel:focus { border-color: var(--accent); }
.inp.sm, .sel.sm { padding: 4px 8px; font-size: 13px; width: auto; }
.inp.mono, .mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 13px; }
.inp-bare { border: 0; outline: none; background: transparent; flex: 1; min-width: 80px; font-size: 14px; padding: 4px; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 8px 0; cursor: pointer; color: var(--fg); }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 12px; background: var(--bg-hover); margin: 2px; }
.chip:hover, .chip.on { background: var(--bg-active); color: var(--fg); }
.link { color: var(--accent); cursor: pointer; }
.switch { position: relative; width: 34px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--bg-active); border-radius: 20px; cursor: pointer; transition: .15s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(14px); }
.dim { opacity: .45; pointer-events: none; }

/* avatars */
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: 10px; font-weight: 600; flex: none; background: #888; vertical-align: middle; }
.avatar.xs { width: 18px; height: 18px; font-size: 9px; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.viewers { display: flex; margin-right: 6px; }
.viewers .avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--bg); }

/* ---------- connexion ---------- */
.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg-side); padding: 16px; }
.login-card { background: var(--bg); padding: 36px 32px; border-radius: 12px; box-shadow: var(--shadow); width: min(360px, 100%); display: flex; flex-direction: column; gap: 10px; text-align: center; }
.login-card h1 { margin: 0; font-size: 22px; }
.login-card p { margin: 0 0 8px; color: var(--fg-2); font-size: 14px; }
.login-card input { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); outline: none; }
.login-card input:focus { border-color: var(--accent); }
.login-logo, .empty-logo { display: inline-flex; align-items: center; justify-content: center; background: #111; color: #fff; font-family: Georgia, serif; font-weight: 700; border-radius: 8px; }
.login-logo { width: 48px; height: 48px; font-size: 26px; margin: 0 auto; }
.login-err { color: var(--danger); font-size: 13px; min-height: 18px; }
.btn { padding: 8px 14px; border-radius: var(--radius); font-weight: 500; font-size: 14px; background: var(--bg-hover); white-space: nowrap; }
.btn:hover { background: var(--bg-active); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--danger); color: #fff; }
.ghost { color: var(--fg-2); font-size: 14px; padding: 4px 8px; border-radius: var(--radius); }
.ghost:hover { background: var(--bg-hover); color: var(--fg); }
.ghost.sm { font-size: 13px; padding: 3px 8px; }
.ghost.xs { font-size: 12px; padding: 1px 6px; }
.ghost.danger { color: var(--danger); }
.ghost.on { color: var(--accent); }
.icon-btn { width: 32px; height: 32px; border-radius: var(--radius); color: var(--fg-2); font-size: 16px; display: inline-flex; align-items: center; justify-content: center; position: relative; flex: none; }
.icon-btn:hover { background: var(--bg-hover); color: var(--fg); }
.badge { position: absolute; top: 2px; right: 0; font-size: 9px; background: var(--accent); color: #fff; border-radius: 8px; padding: 0 4px; line-height: 14px; }
.badge:empty { display: none; }

/* ---------- squelette ---------- */
.app { display: flex; height: 100%; }
.sidebar { width: var(--sidebar-w); flex: none; background: var(--bg-side); border-right: 1px solid var(--line); display: flex; flex-direction: column; font-size: 14px; transition: margin .2s ease; overflow: hidden; }
.app.sb-hidden .sidebar { margin-left: calc(-1 * var(--sidebar-w)); }
.sb-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 4px 8px; }
.sb-user { display: flex; align-items: center; gap: 8px; font-weight: 600; padding: 4px 6px; border-radius: var(--radius); min-width: 0; }
.sb-user:hover { background: var(--bg-hover); }
.sb-user span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-actions { padding: 2px 8px 6px; }
.sb-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 4px 8px; border-radius: var(--radius); color: var(--fg-2); font-weight: 500; text-align: left; min-height: 28px; }
.sb-item:hover { background: var(--bg-hover); color: var(--fg); }
.sb-item.muted { font-weight: 400; color: var(--fg-3); }
.sb-ico { width: 18px; text-align: center; }
.sb-section { padding: 4px 8px; overflow: auto; }
.sb-section.grow { flex: 1; }
.sb-section-title { font-size: 11px; font-weight: 600; color: var(--fg-3); text-transform: uppercase; letter-spacing: .04em; padding: 8px 8px 2px; }
.sb-foot { border-top: 1px solid var(--line); padding: 6px 8px; }
.pill { margin-left: auto; font-size: 11px; background: var(--bg-active); border-radius: 10px; padding: 0 7px; color: var(--fg-2); }
.pill:empty { display: none; }
.tree-row { display: flex; align-items: center; gap: 4px; padding: 2px 4px 2px 4px; border-radius: var(--radius); color: var(--fg-2); cursor: pointer; user-select: none; min-height: 28px; }
.tree-row:hover { background: var(--bg-hover); color: var(--fg); }
.tree-row.active { background: var(--bg-active); color: var(--fg); font-weight: 500; }
.tree-row.drop-into { outline: 2px solid var(--accent); outline-offset: -2px; }
.tree-row.drop-before { box-shadow: 0 -2px 0 var(--accent); }
.tree-row.drop-after { box-shadow: 0 2px 0 var(--accent); }
.tree-arrow { width: 20px; height: 20px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; color: var(--fg-3); font-size: 9px; transition: transform .12s; }
.tree-arrow:hover { background: var(--bg-active); color: var(--fg); }
.tree-arrow.open { transform: rotate(90deg); }
.tree-arrow.none { visibility: hidden; }
.tree-ico { width: 20px; text-align: center; flex: none; font-size: 15px; }
.tree-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-tag { font-size: 10px; color: var(--fg-3); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.tree-tools { display: none; gap: 2px; }
.tree-row:hover .tree-tools { display: inline-flex; }
.tree-tool { width: 22px; height: 22px; border-radius: 4px; color: var(--fg-3); display: inline-flex; align-items: center; justify-content: center; font-size: 14px; }
.tree-tool:hover { background: var(--bg-active); color: var(--fg); }
.tree-children { margin-left: 12px; }
.tree-empty { color: var(--fg-3); font-size: 13px; padding: 4px 24px; font-style: italic; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.topbar { display: flex; align-items: center; gap: 4px; padding: 6px 10px; min-height: 46px; position: sticky; top: 0; background: var(--bg); z-index: 5; }
.app:not(.sb-hidden) #sbOpen { display: none; }
.crumbs { display: flex; align-items: center; gap: 2px; font-size: 14px; color: var(--fg-2); overflow: hidden; white-space: nowrap; min-width: 0; flex: 1; }
.crumbs a { text-decoration: none; padding: 3px 6px; border-radius: 4px; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.crumbs a:hover { background: var(--bg-hover); color: var(--fg); }
.crumbs .sep { color: var(--fg-3); }
.crumbs .cur { color: var(--fg); padding: 3px 6px; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 0; }
.save-state { font-size: 12px; color: var(--fg-3); margin-right: 6px; white-space: nowrap; }
body.offline .save-state::before { content: "⚡ hors ligne · "; color: var(--c-orange); }
.page-view { flex: 1; overflow: auto; position: relative; }
.cover { height: 0; transition: height .2s; background-size: cover; background-position: center; cursor: pointer; }
.cover.has { height: 200px; }
.page-body { max-width: 760px; margin: 0 auto; padding: 0 48px 30vh; transition: max-width .2s; }
.page-body.wide { max-width: 1400px; }
.page-head { position: relative; padding-top: 56px; }
.cover.has + .page-body .page-head { padding-top: 10px; }
.page-head-tools { display: flex; gap: 2px; margin-bottom: 4px; opacity: 0; transition: opacity .15s; min-height: 28px; flex-wrap: wrap; }
.page-head:hover .page-head-tools { opacity: 1; }
.page-icon { font-size: 64px; line-height: 1; border-radius: 8px; padding: 4px; margin-bottom: 4px; display: block; min-width: 10px; }
.page-icon:empty { display: none; }
.page-icon:hover { background: var(--bg-hover); }
.cover.has + .page-body .page-icon { margin-top: -50px; }
.page-title { font-size: 40px; font-weight: 700; line-height: 1.2; margin: 0 0 12px; outline: none; word-break: break-word; }
[contenteditable][data-placeholder]:empty::before { content: attr(data-placeholder); color: var(--fg-3); pointer-events: none; }
.block[data-type="text"] .b-text:not(:focus):empty::before, .block[data-type="bullet"] .b-text:not(:focus):empty::before, .block[data-type="number"] .b-text:not(:focus):empty::before, .block[data-type="quote"] .b-text:not(:focus):empty::before { content: none; }
.b-col .block[data-type="text"]:only-of-type .b-text:empty::before { content: attr(data-placeholder); }
.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--fg-2); text-align: center; padding: 16px; }
.empty-logo { width: 64px; height: 64px; font-size: 34px; border-radius: 14px; }

/* propriétés d'une fiche */
.row-props { border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 14px; font-size: 14px; }
.rp-db { font-size: 12px; color: var(--fg-3); margin-bottom: 6px; }
.rp-db a { text-decoration: none; color: var(--fg-2); }
.rp-db a:hover { text-decoration: underline; }
.rp-row { display: flex; align-items: flex-start; min-height: 32px; }
.rp-name { width: 170px; flex: none; color: var(--fg-2); display: flex; gap: 6px; align-items: center; padding: 5px 6px; border-radius: 4px; cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rp-name span { width: 18px; text-align: center; color: var(--fg-3); }
.rp-name:hover { background: var(--bg-hover); }
.rp-val { flex: 1; padding: 5px 8px; border-radius: 4px; cursor: pointer; min-height: 30px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; word-break: break-word; }
.rp-val:hover { background: var(--bg-hover); }
.rp-add { margin-top: 4px; }

/* ---------- éditeur ---------- */
.editor { min-height: 60px; outline: none; }
.block { position: relative; display: flex; align-items: flex-start; padding: 1px 0; margin-left: -44px; border-radius: 4px; }
.block > .b-body { margin-left: calc(var(--ind, 0) * 26px); }
.block.collapsed { display: none; }
.block.drop-before { box-shadow: 0 -2px 0 var(--accent); }
.block.drop-after { box-shadow: 0 2px 0 var(--accent); }
.block.drop-right { box-shadow: 3px 0 0 var(--accent); }
.block.flash > .b-body { animation: flash 1.4s ease; }
@keyframes flash { 0%, 40% { background: rgba(255, 212, 0, .35); } 100% { background: transparent; } }
.block.has-comment > .b-body { border-bottom: 2px solid rgba(255, 196, 0, .55); }
.b-handle { width: 44px; flex: none; display: flex; justify-content: flex-end; padding-right: 4px; opacity: 0; transition: opacity .1s; padding-top: 4px; }
.block:hover > .b-handle { opacity: 1; }
.b-add, .b-grip { width: 18px; height: 22px; border-radius: 4px; color: var(--fg-3); display: inline-flex; align-items: center; justify-content: center; font-size: 15px; }
.b-add:hover, .b-grip:hover { background: var(--bg-hover); color: var(--fg); }
.b-grip { cursor: grab; font-size: 12px; letter-spacing: -2px; }
.b-body { flex: 1; min-width: 0; border-radius: 4px; }
.block.selected > .b-body { background: var(--sel); box-shadow: 0 0 0 2px var(--sel); }
.b-text { outline: none; min-height: 1.5em; word-break: break-word; white-space: pre-wrap; padding: 3px 2px; }
.b-text a { color: inherit; text-decoration: underline; text-decoration-color: var(--fg-3); text-underline-offset: 2px; }
.b-text a.pl { text-decoration: none; background: var(--bg-hover); border-radius: 4px; padding: 0 4px; font-weight: 500; cursor: pointer; }
.b-text a.pl:hover { background: var(--bg-active); }
.mention { color: var(--accent); font-weight: 500; background: rgba(35,131,226,.08); border-radius: 4px; padding: 0 3px; }
.mention.date { color: var(--fg); background: var(--bg-hover); cursor: pointer; }
.mention.date[data-remind]::after { content: " ⏰"; font-size: .85em; }
.b-text code, td code { font-family: "JetBrains Mono", ui-monospace, Menlo, monospace; font-size: .85em; background: var(--code-bg); color: #eb5757; padding: 1px 4px; border-radius: 3px; }
.b-text mark, td mark { background: var(--t-yellow); color: inherit; border-radius: 2px; padding: 0 1px; }
.tex { cursor: pointer; padding: 0 2px; border-radius: 3px; }
.tex:hover { background: var(--bg-hover); }
[data-color="gray"] { color: var(--c-gray); } [data-color="brown"] { color: var(--c-brown); } [data-color="orange"] { color: var(--c-orange); } [data-color="yellow"] { color: var(--c-yellow); } [data-color="green"] { color: var(--c-green); } [data-color="blue"] { color: var(--c-blue); } [data-color="purple"] { color: var(--c-purple); } [data-color="pink"] { color: var(--c-pink); } [data-color="red"] { color: var(--c-red); }
[data-color="bggray"] { background: var(--b-gray); } [data-color="bgbrown"] { background: var(--b-brown); } [data-color="bgorange"] { background: var(--b-orange); } [data-color="bgyellow"] { background: var(--b-yellow); } [data-color="bggreen"] { background: var(--b-green); } [data-color="bgblue"] { background: var(--b-blue); } [data-color="bgpurple"] { background: var(--b-purple); } [data-color="bgpink"] { background: var(--b-pink); } [data-color="bgred"] { background: var(--b-red); }
.block.col-gray > .b-body { color: var(--c-gray); } .block.col-brown > .b-body { color: var(--c-brown); } .block.col-orange > .b-body { color: var(--c-orange); } .block.col-yellow > .b-body { color: var(--c-yellow); } .block.col-green > .b-body { color: var(--c-green); } .block.col-blue > .b-body { color: var(--c-blue); } .block.col-purple > .b-body { color: var(--c-purple); } .block.col-pink > .b-body { color: var(--c-pink); } .block.col-red > .b-body { color: var(--c-red); }
.block.col-bggray > .b-body { background: var(--b-gray); } .block.col-bgbrown > .b-body { background: var(--b-brown); } .block.col-bgorange > .b-body { background: var(--b-orange); } .block.col-bgyellow > .b-body { background: var(--b-yellow); } .block.col-bggreen > .b-body { background: var(--b-green); } .block.col-bgblue > .b-body { background: var(--b-blue); } .block.col-bgpurple > .b-body { background: var(--b-purple); } .block.col-bgpink > .b-body { background: var(--b-pink); } .block.col-bgred > .b-body { background: var(--b-red); }
.block.col-bggray .b-callout, .block[class*="col-bg"] .b-callout { background: transparent; }
.col-dot { display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center; border-radius: 4px; border: 1px solid var(--line); font-weight: 600; font-size: 12px; }
.col-dot.c-gray { color: var(--c-gray); } .col-dot.c-brown { color: var(--c-brown); } .col-dot.c-orange { color: var(--c-orange); } .col-dot.c-yellow { color: var(--c-yellow); } .col-dot.c-green { color: var(--c-green); } .col-dot.c-blue { color: var(--c-blue); } .col-dot.c-purple { color: var(--c-purple); } .col-dot.c-pink { color: var(--c-pink); } .col-dot.c-red { color: var(--c-red); }
.col-dot.bg-gray { background: var(--b-gray); } .col-dot.bg-brown { background: var(--b-brown); } .col-dot.bg-orange { background: var(--b-orange); } .col-dot.bg-yellow { background: var(--b-yellow); } .col-dot.bg-green { background: var(--b-green); } .col-dot.bg-blue { background: var(--b-blue); } .col-dot.bg-purple { background: var(--b-purple); } .col-dot.bg-pink { background: var(--b-pink); } .col-dot.bg-red { background: var(--b-red); }
.block[data-type="h1"] .b-text { font-size: 30px; font-weight: 700; line-height: 1.3; margin-top: 22px; }
.block[data-type="h2"] .b-text { font-size: 24px; font-weight: 600; line-height: 1.3; margin-top: 16px; }
.block[data-type="h3"] .b-text { font-size: 20px; font-weight: 600; line-height: 1.3; margin-top: 10px; }
.block[data-type="h1"] > .b-handle { padding-top: 30px; } .block[data-type="h2"] > .b-handle { padding-top: 22px; } .block[data-type="h3"] > .b-handle { padding-top: 14px; }
.b-list { display: flex; gap: 2px; align-items: flex-start; }
.b-marker { flex: none; min-width: 24px; text-align: center; padding-top: 3px; user-select: none; font-variant-numeric: tabular-nums; }
.block[data-type="bullet"] .b-marker { font-size: 20px; line-height: 1.15; }
.b-check { width: 16px; height: 16px; margin: 6px 6px 0 4px; accent-color: var(--accent); cursor: pointer; flex: none; }
.b-text.done { color: var(--fg-3); text-decoration: line-through; }
.block[data-type="quote"] .b-text { border-left: 3px solid currentColor; padding-left: 14px; margin: 2px 0; font-size: 1.05em; }
.b-callout { display: flex; gap: 10px; background: var(--callout-bg); border-radius: var(--radius); padding: 12px 14px; margin: 2px 0; }
.b-callout .b-text { flex: 1; }
.b-callout-ico { font-size: 20px; line-height: 1.3; cursor: pointer; border-radius: 4px; padding: 0 2px; height: fit-content; }
.b-callout-ico:hover { background: var(--bg-active); }
.b-toggle-head { display: flex; gap: 2px; align-items: flex-start; }
.b-toggle-arrow { width: 24px; height: 24px; margin-top: 2px; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; color: var(--fg-2); border-radius: 4px; transition: transform .12s; }
.b-toggle-arrow:hover { background: var(--bg-hover); }
.b-toggle-arrow.open { transform: rotate(90deg); }
.b-toggle-empty { margin-left: 26px; color: var(--fg-3); font-size: 14px; padding: 3px 6px; cursor: pointer; border-radius: 4px; }
.b-toggle-empty:hover { background: var(--bg-hover); }
.b-code { background: var(--code-bg); border-radius: var(--radius); margin: 4px 0; position: relative; }
.b-code textarea { width: 100%; display: block; background: transparent; border: 0; outline: none; resize: none; font-family: "JetBrains Mono", ui-monospace, Menlo, monospace; font-size: 13.5px; line-height: 1.55; padding: 30px 16px 14px; tab-size: 2; overflow: hidden; color: var(--fg); }
.b-code-lang { position: absolute; top: 6px; left: 10px; font-size: 11px; color: var(--fg-3); background: transparent; border: 0; outline: none; width: 120px; font-family: "JetBrains Mono", monospace; }
.b-code-copy { position: absolute; top: 4px; right: 8px; font-size: 11px; color: var(--fg-3); padding: 2px 6px; border-radius: 4px; }
.b-code-copy:hover { background: var(--bg-hover); color: var(--fg); }
.b-divider { height: 1px; background: var(--line); margin: 10px 0; width: 100%; }
.block[data-type="divider"] > .b-body { padding: 6px 0; outline: none; }
.block[data-type="divider"] > .b-body:focus, .block[data-type="page"] > .b-body:focus, .block[data-type="toc"] > .b-body:focus { background: var(--sel); }
.b-image { margin: 6px 0; }
.b-image-fig { position: relative; max-width: 100%; margin: 0 auto; }
.b-image-fig img { width: 100%; border-radius: var(--radius); display: block; cursor: zoom-in; }
.b-image-rz { position: absolute; right: -4px; top: 50%; transform: translateY(-50%); width: 8px; height: 44px; border-radius: 4px; background: rgba(0,0,0,.5); cursor: ew-resize; opacity: 0; transition: opacity .15s; }
.b-image-fig:hover .b-image-rz { opacity: 1; }
.b-empty-media { display: flex; gap: 8px; align-items: center; background: var(--callout-bg); border-radius: var(--radius); padding: 10px 14px; color: var(--fg-2); font-size: 14px; flex-wrap: wrap; }
.b-empty-media input[type=text] { flex: 1; min-width: 180px; border: 1px solid var(--line); border-radius: 4px; padding: 5px 8px; background: var(--bg); outline: none; font-size: 13px; }
.b-empty-media label { cursor: pointer; color: var(--accent); }
.b-caption { font-size: 13px; color: var(--fg-2); text-align: center; outline: none; padding: 4px; }
.b-caption:empty::before { content: "Ajouter une légende"; color: var(--fg-3); }
.b-caption:not(:focus):empty { opacity: 0; } .b-image:hover .b-caption:empty { opacity: 1; }
.b-file-link { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius); text-decoration: none; }
.b-file-link:hover { background: var(--bg-hover); }
.b-file-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-file-ext { font-size: 11px; color: var(--fg-3); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; }
.bm { display: flex; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; overflow: hidden; margin: 4px 0; }
.bm:hover { background: var(--bg-hover); }
.bm-txt { padding: 12px 14px; min-width: 0; }
.bm-title { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-desc { font-size: 12px; color: var(--fg-2); margin: 2px 0 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bm-url { font-size: 12px; color: var(--fg-2); display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bm-url img { width: 14px; height: 14px; }
.b-page { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: var(--radius); cursor: pointer; margin: 1px 0; }
.b-page:hover { background: var(--bg-hover); }
.b-page .t { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; font-weight: 500; }
.b-page .t.untitled { color: var(--fg-3); }
.b-page-arrow { color: var(--fg-3); font-size: 12px; }
.b-embed iframe { width: 100%; height: 380px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; display: block; margin: 4px 0; }
.b-equation .eq-view { padding: 10px; border-radius: var(--radius); cursor: pointer; text-align: center; overflow-x: auto; outline: none; min-height: 40px; }
.b-equation .eq-view:hover, .b-equation .eq-view:focus { background: var(--bg-hover); }
.eq-edit { background: var(--bg); box-shadow: var(--shadow); border-radius: 8px; padding: 8px; margin: 4px 0; }
.eq-edit textarea { width: 100%; border: 1px solid var(--line); border-radius: 4px; background: var(--code-bg); font-family: "JetBrains Mono", monospace; font-size: 13px; padding: 8px; outline: none; resize: vertical; min-height: 60px; }
.eq-tools { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 12px; }
.eq-prev { min-height: 30px; padding: 6px; text-align: center; }
.b-table-wrap { overflow-x: auto; margin: 6px 0; padding-bottom: 4px; }
.b-table-inner { display: flex; align-items: stretch; }
.b-table { border-collapse: collapse; font-size: 14px; }
.b-table td { border: 1px solid var(--line); padding: 6px 9px; min-width: 110px; vertical-align: top; outline: none; word-break: break-word; }
.b-table td:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.b-table.has-header tr:first-child td { background: var(--bg-soft); font-weight: 600; }
.b-table.has-colheader td:first-child { background: var(--bg-soft); font-weight: 600; }
.tbl-add-col, .tbl-add-row { color: var(--fg-3); background: var(--bg-hover); border-radius: 4px; opacity: 0; transition: opacity .15s; font-size: 13px; }
.tbl-add-col { width: 18px; margin-left: 4px; }
.tbl-add-row { width: 100%; height: 18px; margin-top: 4px; display: block; }
.b-table-wrap:hover .tbl-add-col, .b-table-wrap:hover .tbl-add-row { opacity: 1; }
.tbl-add-col:hover, .tbl-add-row:hover { background: var(--bg-active); color: var(--fg); }
.b-columns { display: flex; gap: 28px; margin: 2px 0; }
.b-col { flex: 1; min-width: 0; padding-left: 44px; margin-left: -44px; }
.b-col + .b-col { margin-left: -16px; }
.col-add { min-height: 26px; color: var(--fg-3); font-size: 13px; padding: 4px; border-radius: 4px; cursor: text; }
.col-add.over { background: var(--sel); }
.b-toc { padding: 4px 0; }
.toc-item { display: block; padding: 3px 6px; border-radius: 4px; color: var(--fg-2); font-size: 14px; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.toc-item:hover { background: var(--bg-hover); color: var(--fg); }
.toc-h2 { padding-left: 24px; } .toc-h3 { padding-left: 44px; }
.b-synced { border: 2px solid rgba(235, 87, 87, .35); border-radius: var(--radius); padding: 4px 4px 4px 0; margin: 4px 0; position: relative; }
.b-synced:hover { border-color: rgba(235, 87, 87, .7); }
.synced-label { position: absolute; top: -11px; right: 8px; font-size: 11px; background: var(--bg); color: #eb5757; padding: 0 6px; cursor: pointer; border-radius: 4px; }
.synced-inner { padding-left: 44px; }
.b-button { display: flex; gap: 4px; align-items: center; padding: 3px 0; }
.b-button .btn { border: 1px solid var(--line); background: var(--bg); }
.b-button .btn:hover { background: var(--bg-hover); }
.b-button .ghost { opacity: 0; } .block:hover .b-button .ghost { opacity: 1; }
.b-database { margin: 8px 0; }
.editor .ph { color: var(--fg-3); cursor: text; padding: 4px 2px; }
.lasso { position: fixed; background: rgba(35,131,226,.12); border: 1px solid rgba(35,131,226,.5); z-index: 30; pointer-events: none; }
.subpages { margin-top: 24px; }
.subpages-title { font-size: 12px; font-weight: 600; color: var(--fg-3); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }

/* barre de mise en forme */
.fmt-bar { position: fixed; z-index: 45; background: var(--bg); box-shadow: var(--shadow); border-radius: 6px; display: flex; padding: 3px; gap: 1px; }
.fmt-bar button { min-width: 28px; height: 28px; border-radius: 4px; font-size: 14px; color: var(--fg); padding: 0 6px; }
.fmt-bar button:hover { background: var(--bg-hover); }

/* ---------- menus ---------- */
.menu { position: fixed; z-index: 50; background: var(--bg); box-shadow: var(--shadow); border-radius: 8px; padding: 5px; min-width: 230px; max-width: 330px; max-height: min(440px, 70vh); overflow: auto; font-size: 14px; }
.menu-title { font-size: 11px; font-weight: 600; color: var(--fg-3); text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px 2px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 5px 8px; border-radius: var(--radius); text-align: left; cursor: pointer; }
.menu-item:hover, .menu-item.hl { background: var(--bg-hover); }
.menu-item.danger { color: var(--danger); }
.menu-item.checked::after { content: "✓"; margin-left: auto; color: var(--accent); }
.menu-item .mi-ico { width: 38px; height: 38px; flex: none; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); font-size: 16px; font-weight: 600; color: var(--fg-2); }
.menu-item .mi-ico.sm { width: 22px; height: 22px; border: 0; font-size: 14px; background: none; font-weight: 400; }
.menu-item .mi-txt { flex: 1; min-width: 0; }
.menu-item .mi-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item .mi-desc { font-size: 12px; color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-item .mi-arrow { color: var(--fg-3); }
.menu-sep { height: 1px; background: var(--line); margin: 4px 0; }
.menu-empty { padding: 8px; color: var(--fg-3); font-size: 13px; }
.popover { position: fixed; z-index: 55; background: var(--bg); box-shadow: var(--shadow); border-radius: 8px; padding: 6px; min-width: 220px; max-width: min(420px, 95vw); max-height: 70vh; overflow: auto; font-size: 14px; }
.pop-pad { padding: 4px; display: flex; flex-direction: column; gap: 6px; }
.pop-pad .row { justify-content: space-between; }
#emojiPicker { width: 340px; padding: 10px; }
#emojiPicker input[type=text] { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg); outline: none; margin-bottom: 8px; }
.emoji-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; max-height: 220px; overflow: auto; }
.emoji-grid button { font-size: 20px; height: 30px; border-radius: 4px; }
.emoji-grid button:hover { background: var(--bg-hover); }
#coverPicker { width: 340px; padding: 10px; }
.cover-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.cover-grid button { height: 44px; border-radius: 4px; border: 2px solid transparent; }
.cover-grid button:hover { border-color: var(--accent); }
.cell-edit .inp { min-width: 100%; }
.cell-edit textarea.inp { resize: vertical; }
.pick { display: flex; flex-direction: column; gap: 2px; }
.pick-cur { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 4px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.pick-cur b { cursor: pointer; margin-left: 2px; opacity: .6; }
.pick-list { max-height: 260px; overflow: auto; }
.pick-item { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 4px; cursor: pointer; font-size: 14px; }
.pick-item:hover { background: var(--bg-hover); }
.pick-item .ok { margin-left: auto; color: var(--accent); }
.pick-item .ghost { margin-left: auto; opacity: 0; } .pick-item:hover .ghost { opacity: 1; }
.pick-item .ok + .ghost { margin-left: 4px; }
.pick-item.new { color: var(--fg-2); }
.drag { color: var(--fg-3); cursor: grab; font-size: 11px; letter-spacing: -2px; }

/* modale */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(15,15,15,.45); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 12px 12px; }
.modal-box { background: var(--bg); border-radius: 10px; box-shadow: var(--shadow); width: min(680px, 100%); max-height: 84vh; display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 600; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 12px 16px; overflow: auto; font-size: 14px; }
.modal-body > input[type=text], .modal-body > input[type=password], .modal-body > input[type=color], .modal-body details input[type=text], .modal-body > select { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); outline: none; font-size: 15px; }
.modal-body input[type=color] { height: 40px; padding: 4px; }
.modal-body input:focus { border-color: var(--accent); }
.modal-body label { display: block; font-size: 13px; color: var(--fg-2); margin: 10px 0 4px; }
.modal-body label.chk { display: flex; color: var(--fg); }
.modal-body label.pick-item { display: flex; margin: 0; color: var(--fg); }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 10px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.res { display: flex; gap: 10px; padding: 8px; border-radius: var(--radius); cursor: pointer; align-items: flex-start; }
.res:hover, .res.hl { background: var(--bg-hover); }
.res .r-ico { width: 24px; text-align: center; font-size: 18px; flex: none; }
.res .r-title { font-weight: 500; }
.res .r-snip { font-size: 12.5px; color: var(--fg-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.res .r-date { margin-left: auto; font-size: 12px; color: var(--fg-3); white-space: nowrap; }
.res .r-tools { display: flex; gap: 4px; margin-left: auto; }
.search-filters { margin-top: 6px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 2px; border-bottom: 1px solid var(--line-2); gap: 12px; }
.setting-row .s-desc { font-size: 12.5px; color: var(--fg-2); }
.err { color: var(--danger); font-size: 13px; margin-top: 6px; min-height: 16px; }
.add-user { margin-top: 10px; } .add-user summary { list-style: none; display: inline-block; } .add-user[open] summary { margin-bottom: 4px; }
.shortcuts { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; font-size: 13px; color: var(--fg-2); }
.shortcuts kbd { margin: 0 6px 0 0; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin: 6px 0 12px; }
.tpl { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; text-align: left; font-size: 14px; }
.tpl:hover { background: var(--bg-hover); }
.tpl .tpl-ico { font-size: 24px; } .tpl .muted { font-size: 12px; }
.drop { border: 2px dashed var(--line); border-radius: 8px; padding: 28px; text-align: center; color: var(--fg-2); margin: 10px 0; }
.drop.over { border-color: var(--accent); background: var(--sel); }
.version-preview { font-size: 15px; }
.version-preview h1 { font-size: 26px; margin-top: 0; }
.version-preview img { max-width: 100%; }
.version-preview table { border-collapse: collapse; } .version-preview td, .version-preview th { border: 1px solid var(--line); padding: 4px 8px; }
.version-preview pre { background: var(--code-bg); padding: 10px; border-radius: 6px; overflow: auto; }
.version-preview .callout { background: var(--callout-bg); padding: 10px; border-radius: 6px; }
.version-preview blockquote { border-left: 3px solid var(--fg); margin: 0; padding-left: 12px; }
.version-preview .cols { display: flex; gap: 20px; } .version-preview .col { flex: 1; }
.version-preview ul.todo { list-style: none; padding-left: 4px; }
.ai-out { min-height: 60px; }

/* panneau latéral */
.panel { width: 360px; flex: none; border-left: 1px solid var(--line); display: flex; flex-direction: column; background: var(--bg); }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 8px 16px; border-bottom: 1px solid var(--line); font-weight: 600; min-height: 46px; }
.panel-body { padding: 12px 14px; overflow: auto; font-size: 14px; flex: 1; }
.panel-body .inp { margin-bottom: 6px; }
.panel-body .row { justify-content: space-between; }
.cm-new { background: var(--bg-soft); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px; margin-bottom: 8px; }
.cm-target { font-size: 12px; color: var(--fg-2); margin-bottom: 6px; }
.cm-target q { font-style: italic; }
.cm-thread { border-bottom: 1px solid var(--line-2); padding: 10px 0; }
.cm { padding: 4px 0; } .cm.resolved { opacity: .55; }
.cm-head { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.cm-head .ghost { margin-left: auto; opacity: 0; } .cm:hover .cm-head .ghost { opacity: 1; }
.cm-text { margin: 2px 0 0 24px; white-space: pre-wrap; word-break: break-word; }
.cm-actions { margin-left: 18px; }
.cm-reply { margin: 4px 0 0 24px; }
.cm-goto { margin-bottom: 2px; }
.ag-day { margin-bottom: 10px; }
.ag-date { font-size: 12px; font-weight: 600; color: var(--fg-2); text-transform: capitalize; padding: 4px 8px; }
.ag-day.today .ag-date { color: var(--accent); } .ag-day.past { opacity: .6; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #37352f; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; z-index: 70; box-shadow: var(--shadow); display: flex; gap: 12px; align-items: center; max-width: calc(100vw - 32px); }
.toast button { color: #8fc1ff; font-weight: 500; white-space: nowrap; }

/* ---------- bases de données ---------- */
.db-view { margin-top: 4px; }
.page-body:has(.db-view:not(.hidden)) { max-width: 1400px; }
.db-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.db-title { font-size: 18px; font-weight: 600; text-decoration: none; padding: 4px 2px; width: 100%; }
.db-title:hover { text-decoration: underline; }
.db-tabs { display: flex; gap: 2px; overflow-x: auto; max-width: 100%; }
.db-tab { padding: 6px 8px; font-size: 14px; color: var(--fg-2); border-bottom: 2px solid transparent; white-space: nowrap; border-radius: 4px 4px 0 0; }
.db-tab:hover { background: var(--bg-hover); }
.db-tab.active { color: var(--fg); border-bottom-color: var(--fg); font-weight: 500; }
.db-tab.add { color: var(--fg-3); }
.db-tools { display: flex; gap: 2px; align-items: center; flex-wrap: wrap; padding: 4px 0; }
.db-search { border: 0; background: transparent; outline: none; font-size: 13px; padding: 4px 6px; width: 130px; border-radius: 4px; }
.db-search:focus { background: var(--bg-hover); width: 180px; }
.db-filters-bar { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 0 6px; align-items: center; }
.fchip { font-size: 12.5px; padding: 2px 10px; border-radius: 12px; background: rgba(35,131,226,.08); color: var(--accent); border: 1px solid rgba(35,131,226,.25); }
.fchip .muted { color: var(--fg-2); }
.db-body { position: relative; }
.db-table-wrap { overflow-x: auto; }
.db-table { border-collapse: collapse; font-size: 14px; min-width: 100%; table-layout: fixed; }
.db-table th, .db-table td { border-bottom: 1px solid var(--line-2); border-right: 1px solid var(--line-2); text-align: left; }
.db-table th { font-weight: 400; color: var(--fg-2); padding: 6px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; cursor: pointer; user-select: none; }
.db-table th:hover { background: var(--bg-hover); }
.db-table th.sel-col, .db-table td.sel-col { width: 44px; border-right: 0; padding: 0 4px; text-align: right; }
.db-table th.add-col { width: 44px; text-align: center; color: var(--fg-3); }
.db-table th:last-child, .db-table td:last-child { border-right: 0; }
.th-ico { color: var(--fg-3); margin-right: 6px; font-size: 12px; }
.th-rz { position: absolute; right: 0; top: 0; bottom: 0; width: 5px; cursor: col-resize; }
.th-rz:hover { background: var(--accent); }
.db-table td { padding: 5px 8px; vertical-align: top; cursor: pointer; overflow: hidden; height: 33px; }
.db-table td.db-cell:hover, .db-table td.db-title-cell:hover { background: var(--bg-hover); }
.db-table tbody tr:hover .row-grip, .db-table tbody tr:hover .sel-row, .db-table tr.sel .sel-row { opacity: 1; }
.row-grip { opacity: 0; color: var(--fg-3); cursor: grab; font-size: 11px; letter-spacing: -2px; margin-right: 4px; }
.sel-row, .sel-all { opacity: 0; cursor: pointer; vertical-align: middle; accent-color: var(--accent); }
.db-table thead:hover .sel-all, .sel-all:checked { opacity: 1; }
.db-table tr.sel td { background: var(--sel); }
.db-table tr.drop-before td { box-shadow: inset 0 2px 0 var(--accent); }
.db-title-cell { font-weight: 500; position: relative; white-space: nowrap; }
.db-title-cell .ttl-ico { margin-right: 6px; }
.db-title-cell .ttl.untitled { color: var(--fg-3); }
.open-btn { position: absolute; right: 6px; top: 5px; font-size: 11px; color: var(--fg-2); background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; opacity: 0; font-weight: 400; }
tr:hover .open-btn { opacity: 1; }
.db-cell { white-space: nowrap; text-overflow: ellipsis; }
.db-cell.c-text { white-space: normal; display: table-cell; }
.db-cell.c-multi_select, .db-cell.c-person, .db-cell.c-relation { white-space: normal; }
.num { font-variant-numeric: tabular-nums; display: block; text-align: right; }
.late { color: var(--c-red); }
.cell-check { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.cell-link { color: inherit; text-decoration: underline; text-decoration-color: var(--fg-3); }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; padding: 0 7px; border-radius: 4px; line-height: 21px; margin: 1px 2px 1px 0; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.tag .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; opacity: .8; }
.t-gray { background: var(--t-gray); } .t-brown { background: var(--t-brown); } .t-orange { background: var(--t-orange); } .t-yellow { background: var(--t-yellow); } .t-green { background: var(--t-green); } .t-blue { background: var(--t-blue); } .t-purple { background: var(--t-purple); } .t-pink { background: var(--t-pink); } .t-red { background: var(--t-red); }
.tag.t-gray .dot { color: var(--c-gray); } .tag.t-blue .dot { color: var(--c-blue); } .tag.t-green .dot { color: var(--c-green); } .tag.t-orange .dot { color: var(--c-orange); } .tag.t-yellow .dot { color: var(--c-yellow); } .tag.t-red .dot { color: var(--c-red); } .tag.t-purple .dot { color: var(--c-purple); } .tag.t-pink .dot { color: var(--c-pink); } .tag.t-brown .dot { color: var(--c-brown); }
.person { display: inline-flex; align-items: center; gap: 5px; margin-right: 6px; font-size: 13px; }
.rel-chip { display: inline-flex; gap: 4px; font-size: 13px; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; margin-right: 8px; cursor: pointer; }
.calc { color: var(--fg-3); font-size: 12px; text-align: right !important; cursor: pointer; border-bottom: 0 !important; height: 30px; }
.calc:hover { background: var(--bg-hover); }
.calc-ph { opacity: 0; } .db-table tfoot:hover .calc-ph { opacity: 1; }
.calc-lab { color: var(--fg-3); margin-right: 4px; }
.db-table tfoot td { color: var(--fg); }
.db-add-row { display: block; width: 100%; text-align: left; padding: 6px 8px 6px 52px; color: var(--fg-3); font-size: 14px; border-bottom: 1px solid var(--line-2); }
.db-add-row:hover { background: var(--bg-hover); color: var(--fg); }
.db-bulk { display: flex; gap: 6px; align-items: center; background: var(--bg); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 8px; padding: 4px 8px; font-size: 13px; position: sticky; top: 0; z-index: 3; margin-bottom: 6px; flex-wrap: wrap; }
.db-bulk span { color: var(--accent); font-weight: 500; margin-right: 6px; }
.board { display: flex; gap: 12px; overflow-x: auto; padding: 6px 0 16px; align-items: flex-start; }
.board-col { width: 260px; flex: none; border-radius: 8px; padding: 4px; }
.board-col.over { background: var(--sel); }
.board-head { display: flex; align-items: center; gap: 6px; padding: 4px 4px 8px; font-size: 14px; }
.board-head .cnt { color: var(--fg-3); font-size: 13px; }
.board-head .ghost { margin-left: auto; opacity: 0; } .board-col:hover .board-head .ghost { opacity: 1; }
.board-cards { display: flex; flex-direction: column; gap: 6px; min-height: 10px; }
.board-new { width: 100%; text-align: left; padding: 6px 8px; color: var(--fg-3); font-size: 14px; border-radius: 6px; margin-top: 4px; }
.board-new:hover { background: var(--bg-hover); color: var(--fg); }
.board-add-group { flex: none; color: var(--fg-3); padding: 8px 12px; font-size: 14px; border-radius: 6px; white-space: nowrap; }
.board-add-group:hover { background: var(--bg-hover); }
.card { background: var(--bg); border-radius: 6px; box-shadow: 0 0 0 1px var(--line), 0 2px 4px rgba(15,15,15,.06); cursor: pointer; overflow: hidden; font-size: 14px; text-align: left; }
.card:hover { background: var(--bg-soft); }
.card.dragging { opacity: .4; }
.card.drop-before { box-shadow: 0 -3px 0 var(--accent), 0 0 0 1px var(--line); }
.card-body { padding: 8px 10px; }
.card-title { font-weight: 500; margin-bottom: 4px; word-break: break-word; }
.card-prop { font-size: 12.5px; color: var(--fg-2); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 2px; overflow: hidden; }
.card-prop .num { text-align: left; display: inline; }
.card-cover { height: 140px; background-size: cover; background-position: center; border-bottom: 1px solid var(--line-2); }
.card-cover.empty { display: flex; align-items: center; justify-content: center; background: var(--bg-soft); font-size: 40px; }
.card-new { display: flex; align-items: center; justify-content: center; color: var(--fg-3); min-height: 120px; box-shadow: 0 0 0 1px var(--line) inset; background: transparent; }
.gallery { display: grid; gap: 14px; padding: 8px 0; }
.gallery-s { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); } .gallery-s .card-cover { height: 90px; }
.gallery-m { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.gallery-l { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); } .gallery-l .card-cover { height: 200px; }
.db-list { padding: 4px 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line-2); cursor: pointer; border-radius: 4px; flex-wrap: wrap; }
.list-row:hover { background: var(--bg-hover); }
.lr-title { font-weight: 500; flex: 1; min-width: 160px; }
.lr-props { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--fg-2); align-items: center; }
.lr-prop .num { display: inline; }
.cal-nav { display: flex; align-items: center; gap: 8px; padding: 6px 0; flex-wrap: wrap; }
.cal-nav b { text-transform: capitalize; font-size: 16px; }
.cal-nav .sp { flex: 1; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-dow { font-size: 12px; color: var(--fg-3); padding: 4px 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: right; }
.cal-day { min-height: 110px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; position: relative; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day.other { background: var(--bg-soft); } .cal-day.other .cal-num { color: var(--fg-3); }
.cal-day.over { background: var(--sel); }
.cal-num { font-size: 12px; text-align: right; color: var(--fg-2); }
.cal-day.today .cal-num { color: #fff; background: #eb5757; border-radius: 10px; padding: 0 6px; margin-left: auto; width: fit-content; }
.cal-add { position: absolute; left: 4px; top: 3px; width: 20px; height: 20px; border-radius: 4px; color: var(--fg-3); opacity: 0; }
.cal-day:hover .cal-add { opacity: 1; } .cal-add:hover { background: var(--bg-hover); }
.cal-ev { font-size: 12.5px; background: var(--bg); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(15,15,15,.06); border-radius: 4px; padding: 2px 6px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ev:hover { background: var(--bg-soft); }
.cal-ev[class*="t-"] { box-shadow: none; }
.cal-sub { color: var(--fg-2); margin-left: 6px; font-size: 11px; }
.cal-undated { margin-top: 10px; font-size: 14px; } .cal-undated summary { cursor: pointer; color: var(--fg-2); } .cal-undated .cal-ev { display: inline-block; margin: 4px 4px 0 0; }
.tl-wrap { overflow-x: auto; border-top: 1px solid var(--line); position: relative; }
.tl-scale { height: 26px; position: relative; border-bottom: 1px solid var(--line); }
.tl-tick { position: absolute; top: 4px; font-size: 11px; color: var(--fg-3); white-space: nowrap; border-left: 1px solid var(--line); padding-left: 4px; height: 22px; }
.tl-tick.month { color: var(--fg); font-weight: 500; }
.tl-area { position: relative; background-image: linear-gradient(to right, var(--line-2) 1px, transparent 1px); }
.tl-today { position: absolute; top: 0; bottom: 0; width: 2px; background: #eb5757; opacity: .6; }
.tl-bar { position: absolute; height: 28px; border-radius: 6px; background: var(--bg); box-shadow: 0 0 0 1px var(--line), 0 1px 3px rgba(15,15,15,.1); font-size: 13px; display: flex; align-items: center; cursor: grab; user-select: none; overflow: hidden; }
.tl-bar[class*="t-"] { box-shadow: none; }
.tl-lab { padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.tl-h { width: 6px; align-self: stretch; cursor: ew-resize; flex: none; }
.tl-h:hover { background: rgba(0,0,0,.15); }
.opt-row { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.opt-row .inp { flex: 1; } .opt-row .sel { width: 110px; }
.fx-prev { font-size: 13px; padding: 6px 8px; background: var(--bg-soft); border-radius: 4px; margin: 6px 0; font-family: "JetBrains Mono", monospace; }
.fx-prev.err { color: var(--danger); }
.fx-help { font-size: 12px; display: flex; flex-direction: column; gap: 6px; }
.fx-help .chip { font-family: "JetBrains Mono", monospace; font-size: 11px; }
.sorts .row { justify-content: flex-start; flex-wrap: nowrap; }

/* ---------- mobile ---------- */
@media (max-width: 800px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; box-shadow: var(--shadow); width: min(300px, 86vw); }
  .app.sb-hidden .sidebar { margin-left: calc(-1 * min(300px, 86vw) - 20px); box-shadow: none; }
  .page-body, .page-body.wide { padding: 0 16px 30vh; }
  .page-head { padding-top: 24px; }
  .block { margin-left: -6px; }
  .b-handle { width: 22px; opacity: .5; padding-right: 2px; }
  .b-add { display: none; }
  .block > .b-body { margin-left: calc(var(--ind, 0) * 18px); }
  .page-title { font-size: 30px; }
  .page-head-tools { opacity: 1; }
  .save-state, #btnShare { display: none; }
  .panel { position: fixed; inset: 0; width: 100%; z-index: 45; }
  .b-columns { flex-direction: column; gap: 0; }
  .b-col, .b-col + .b-col { margin-left: 0; padding-left: 0; }
  .synced-inner { padding-left: 22px; }
  .rp-name { width: 120px; }
  .cal-day { min-height: 64px; } .cal-ev { font-size: 11px; padding: 1px 3px; } .cal-sub { display: none; }
  .board-col { width: 240px; }
  .shortcuts { grid-template-columns: 1fr; }
  .fmt-bar button { min-width: 26px; padding: 0 4px; }
  .db-search { width: 100px; }
}
@media print { .sidebar, .topbar, .b-handle, .page-head-tools, .panel { display: none !important; } .page-view { overflow: visible; } }
