/* ─────────────────────────────────────────────────────────────────────────────
   Cerveau — style « façon Notion » validé le 7 octobre 2026
   (design/maquettes/Cerveau-*.dc.html, jetons de design/cerveau/build.py).
   Exception assumée au design d'Hypatie OS : police système, page blanche,
   tags pastel. Gardés : accent framboise (logo, badges), étincelle violette
   sur tout ce que l'IA a fait, icônes trait, jamais d'emoji.
   ───────────────────────────────────────────────────────────────────────────── */
:root {
  --bg: #FFFFFF; --side: #F7F6F3; --text: #37352F; --muted: #787774; --faint: #A5A29C;
  --line: rgba(55,53,47,.09); --line2: rgba(55,53,47,.16); --hover: rgba(55,53,47,.06); --press: rgba(55,53,47,.1);
  --code: rgba(135,131,120,.15); --code-text: #EB5757;
  --acc: #B0336E; --acc-soft: #F4DDE8; --ai: #6A4BD8; --ai-soft: #EFEBFB; --blue: #2383E2; --sel: rgba(35,131,226,.14);
  --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; --tx-tag: #32302C;
  --late: #C23B2A; --warn: #B86A17; --wait: #1F7A8C; --perso: #2E7D5B; --pro: #2E5BB5;
  --callout: #F1F1EF; --pop: 0 0 0 1px var(--line2), 0 3px 6px rgba(15,15,15,.1), 0 9px 24px rgba(15,15,15,.2);
  --cover: linear-gradient(120deg, #F3E3EA 0%, #EDE7F6 55%, #E2EEF2 100%);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #191919; --side: #202020; --text: #E6E5E1; --muted: #9B9A97; --faint: #6F6E6A;
    --line: rgba(255,255,255,.08); --line2: rgba(255,255,255,.14); --hover: rgba(255,255,255,.055); --press: rgba(255,255,255,.09);
    --code: rgba(135,131,120,.25); --acc: #E07AAE; --acc-soft: #3B2230; --ai: #A48CF2; --ai-soft: #2B2640; --sel: rgba(35,131,226,.28);
    --t-gray: #373737; --t-brown: #4A3A31; --t-orange: #5C3B23; --t-yellow: #564328; --t-green: #2B4433;
    --t-blue: #28405A; --t-purple: #40304F; --t-pink: #4F2C3D; --t-red: #5A2F2B; --tx-tag: #E6E5E1;
    --late: #F08A7B; --warn: #E7A64E; --wait: #6CC2D4; --perso: #5CB88E; --pro: #7FA3EE; --callout: #252525;
    --pop: 0 0 0 1px var(--line2), 0 3px 6px rgba(0,0,0,.3), 0 9px 24px rgba(0,0,0,.45);
    --cover: linear-gradient(120deg, #3A2430 0%, #2C2640 55%, #22343A 100%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #191919; --side: #202020; --text: #E6E5E1; --muted: #9B9A97; --faint: #6F6E6A;
  --line: rgba(255,255,255,.08); --line2: rgba(255,255,255,.14); --hover: rgba(255,255,255,.055); --press: rgba(255,255,255,.09);
  --code: rgba(135,131,120,.25); --acc: #E07AAE; --acc-soft: #3B2230; --ai: #A48CF2; --ai-soft: #2B2640; --sel: rgba(35,131,226,.28);
  --t-gray: #373737; --t-brown: #4A3A31; --t-orange: #5C3B23; --t-yellow: #564328; --t-green: #2B4433;
  --t-blue: #28405A; --t-purple: #40304F; --t-pink: #4F2C3D; --t-red: #5A2F2B; --tx-tag: #E6E5E1;
  --late: #F08A7B; --warn: #E7A64E; --wait: #6CC2D4; --perso: #5CB88E; --pro: #7FA3EE; --callout: #252525;
  --pop: 0 0 0 1px var(--line2), 0 3px 6px rgba(0,0,0,.3), 0 9px 24px rgba(0,0,0,.45);
  --cover: linear-gradient(120deg, #3A2430 0%, #2C2640 55%, #22343A 100%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
.ico { flex: none; vertical-align: middle; }
::selection { background: var(--sel); }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 13.5px; }
.spacer { flex: 1; }

/* ── Coque ─────────────────────────────────────────────────────────────────── */
#app { display: flex; min-height: 100vh; min-height: 100dvh; }
.sb { position: sticky; top: 0; height: 100vh; height: 100dvh; width: 248px; flex: none; overflow-y: auto; background: var(--side);
  display: flex; flex-direction: column; padding: 8px 6px 10px; gap: 1px; font-size: 14px; color: var(--muted); }
.sb a, .sb .it { display: flex; align-items: center; gap: 8px; min-height: 28px; padding: 0 8px; border-radius: 5px; color: var(--muted);
  text-decoration: none; font-weight: 500; white-space: nowrap; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; }
.sb a:hover, .sb .it:hover { background: var(--hover); }
.sb a.on { background: var(--press); color: var(--text); font-weight: 600; }
.sb .lbl { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sb .ws { height: 38px; color: var(--text); font-weight: 600; margin-bottom: 4px; }
.lg { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; background: var(--acc); color: #fff; font-size: 12px; font-weight: 700; flex: none; }
.sb .hd { font-size: 12px; font-weight: 600; color: var(--faint); padding: 14px 8px 4px; display: flex; align-items: center; }
.sb .hd button { margin-left: auto; border: 0; background: none; color: var(--faint); cursor: pointer; border-radius: 4px; display: grid; place-items: center; width: 20px; height: 20px; }
.sb .hd button:hover { background: var(--hover); color: var(--text); }
.sb .n { margin-left: auto; font-size: 12px; color: var(--faint); padding-left: 6px; }
.sb .car { color: var(--faint); display: inline-grid; place-items: center; width: 18px; height: 18px; flex: none; border-radius: 4px; margin-left: -4px; }
.sb .car:hover { background: var(--press); }
.sb .badge, .badge { margin-left: auto; font-size: 11px; font-weight: 600; color: #fff; background: var(--acc); border-radius: 999px; padding: 0 6px; line-height: 16px; }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.dot.pro { background: var(--pro); } .dot.perso { background: var(--perso); }
.sb .foot { margin-top: auto; padding-top: 10px; }
main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 4px; height: 45px; padding: 0 12px; font-size: 14px; color: var(--muted); background: var(--bg); }
.top .cr { display: flex; align-items: center; gap: 2px; min-width: 0; overflow: hidden; }
.top .cr a, .top .cr span { padding: 2px 6px; border-radius: 4px; display: inline-flex; align-items: center; gap: 6px; color: var(--text); text-decoration: none; white-space: nowrap; }
.top .cr a:hover { background: var(--hover); }
.top .cr i { color: var(--faint); font-style: normal; }
.top .cr .last { overflow: hidden; text-overflow: ellipsis; max-width: 360px; }
.qb { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border: 0; background: transparent; border-radius: 5px; font-size: 14px; color: var(--muted); cursor: pointer; white-space: nowrap; text-decoration: none; }
.qb:hover { background: var(--hover); color: var(--text); }
.qb.line { border: 1px solid var(--line2); color: var(--text); }
.qb.ai { color: var(--ai); }
.qb.blue { background: var(--blue); color: #fff; font-weight: 500; }
.qb.blue:hover { background: #0B6BCB; }
.qb.primary { background: var(--text); color: var(--bg); font-weight: 500; }
.qb:disabled { opacity: .5; cursor: default; }
.menu-btn { display: none; }
#view { flex: 1; }
.tabbar { display: none; }

/* ── Éléments communs ─────────────────────────────────────────────────────── */
.tag { display: inline-flex; align-items: center; gap: 4px; height: 21px; padding: 0 6px; border-radius: 3px; font-size: 13.5px; color: var(--tx-tag); white-space: nowrap; line-height: 1; text-decoration: none; max-width: 240px; }
.tag > span { overflow: hidden; text-overflow: ellipsis; }
.tag .ai-mark { color: var(--ai); display: inline-flex; }
.tag button { border: 0; background: none; padding: 0; margin-left: 2px; color: inherit; opacity: .55; cursor: pointer; display: inline-grid; place-items: center; }
.tag button:hover { opacity: 1; }
.c0 { background: var(--t-gray); } .c1 { background: var(--t-brown); } .c2 { background: var(--t-orange); } .c3 { background: var(--t-yellow); }
.c4 { background: var(--t-green); } .c5 { background: var(--t-blue); } .c6 { background: var(--t-purple); } .c7 { background: var(--t-pink); } .c8 { background: var(--t-red); }
.st { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px 0 7px; border-radius: 999px; font-size: 13px; white-space: nowrap; }
.st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
.st.w { background: var(--t-blue); color: var(--wait); } .st.v { background: var(--t-orange); color: var(--warn); }
.st.l { background: var(--t-red); color: var(--late); } .st.o { background: var(--t-gray); color: var(--muted); } .st.d { background: var(--t-green); color: var(--perso); }
.ai { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--ai); }
.av { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: 10px; font-weight: 600; background: var(--t-blue); color: var(--tx-tag); flex: none; }
.chip { display: inline-flex; align-items: center; gap: 4px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line2); line-height: 1.3; cursor: pointer; white-space: normal; }
.chip:hover { background: var(--hover); border-radius: 3px; }
.chip .ico { color: var(--muted); position: relative; top: -1px; }
.chip.person .at { color: var(--muted); }
.chip.broken { color: var(--faint); text-decoration: line-through; }
.hashtag { color: var(--muted); }
.ref { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 4px; font-size: 14px; text-decoration: none; color: var(--text); min-width: 0; }
.ref:hover { background: var(--hover); }
.ref .ico { color: var(--muted); }
.ref .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; max-width: 55%; }
.ref small { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ref mark { background: var(--t-yellow); color: inherit; border-radius: 2px; }
.empty { padding: 28px 8px; color: var(--faint); font-size: 14.5px; text-align: center; }
.sec-h { margin: 22px 0 6px; font-size: 14px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.callout { display: flex; gap: 10px; padding: 14px 16px 14px 12px; border-radius: 4px; background: var(--callout); }
.callout.agent { background: var(--ai-soft); }
.input { font: inherit; font-size: 14px; color: var(--text); background: var(--bg); border: 1px solid var(--line2); border-radius: 5px; padding: 5px 8px; min-width: 0; }
.input:focus { outline: 0; box-shadow: 0 0 0 2px var(--sel); border-color: var(--blue); }
.icon-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 5px; border: 0; background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--hover); color: var(--text); }

/* ── Page ──────────────────────────────────────────────────────────────────── */
.cover { height: 200px; background: var(--cover); flex: none; }
.cover.c-rose { background: linear-gradient(120deg, #F3E3EA, #F7EDE4); } .cover.c-bleu { background: linear-gradient(120deg, #E2EEF2, #E3E8F6); }
.cover.c-vert { background: linear-gradient(120deg, #E1EEE3, #EEF3E2); } .cover.c-sable { background: linear-gradient(120deg, #F3EDE2, #EEE9E1); }
.pg { width: 100%; max-width: 900px; margin: 0 auto; padding: 0 96px 30vh; }
.pg.full { max-width: none; }
.pg-icon { display: grid; place-items: center; width: 78px; height: 78px; margin-top: -40px; border-radius: 12px; background: var(--bg); color: var(--text); }
.pg-icon.round { border-radius: 50%; background: var(--t-blue); font-size: 28px; font-weight: 600; color: var(--tx-tag); margin-top: 0; }
.pg.nocover { padding-top: 64px; }
.pg.nocover .pg-icon { margin-top: 0; }
.pg-title { font-size: 40px; line-height: 1.2; font-weight: 700; margin: 14px 0 6px; outline: 0; word-break: break-word; }
.pg-title:empty::before { content: attr(data-placeholder); color: var(--faint); }
.pg-hover { display: flex; gap: 2px; height: 28px; margin-top: 8px; opacity: 0; transition: opacity .15s; }
.pg-head:hover .pg-hover, .pg-hover:focus-within { opacity: 1; }
.props { display: flex; flex-direction: column; font-size: 14px; margin: 8px 0 4px; }
.pr { display: flex; align-items: flex-start; min-height: 34px; }
.pr .k { flex: 0 0 160px; display: flex; align-items: center; gap: 6px; height: 34px; color: var(--muted); }
.pr .v { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 34px; padding: 4px 6px; border-radius: 4px; min-width: 0; }
.pr .v.edit:hover { background: var(--hover); cursor: pointer; }
.pr .v.empty { color: var(--faint); }
.pr .v input, .pr .v select { font: inherit; font-size: 14px; color: var(--text); background: transparent; border: 0; padding: 0; min-width: 0; }
.pr .v input:focus, .pr .v select:focus { outline: 0; }
.pr .v input[type=text], .pr .v input[type=email], .pr .v input[type=tel] { width: 100%; }
.pr.add .k { color: var(--faint); cursor: pointer; }
.bl-row { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); padding: 6px 2px; border-bottom: 1px solid var(--line); margin-top: 8px; cursor: pointer; user-select: none; }
.bl-list { padding: 4px 0 8px; border-bottom: 1px solid var(--line); }
.foot-sec { margin-top: 40px; padding-top: 8px; border-top: 1px solid var(--line2); }
.toc { position: fixed; right: 18px; top: 120px; width: 170px; font-size: 13px; display: flex; flex-direction: column; }
.toc a { display: block; padding: 4px 10px; border-left: 2px solid var(--line2); color: var(--muted); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toc a:hover { color: var(--text); }
.toc a.h3 { padding-left: 20px; }
@media (max-width: 1350px) { .toc { display: none; } }
audio { width: 100%; height: 40px; margin: 6px 0; }

/* ── Éditeur par blocs ─────────────────────────────────────────────────────── */
.ed { font-size: 16px; line-height: 1.6; padding-bottom: 20px; }
.blk { position: relative; display: flex; align-items: flex-start; margin: 1px 0; padding: 2px 0; border-radius: 3px; }
.blk.drop-before { box-shadow: 0 -3px 0 var(--blue); } .blk.drop-after { box-shadow: 0 3px 0 var(--blue); }
.blk .grip { position: absolute; left: -46px; top: 3px; display: flex; gap: 0; opacity: 0; transition: opacity .1s; }
.blk:hover .grip, .blk:focus-within .grip { opacity: 1; }
.grip button { width: 22px; height: 24px; display: grid; place-items: center; border: 0; background: none; color: var(--faint); border-radius: 4px; cursor: pointer; padding: 0; }
.grip button:hover { background: var(--hover); color: var(--muted); }
.grip .drag { cursor: grab; }
.blk .tx { flex: 1; min-width: 0; outline: 0; white-space: pre-wrap; word-break: break-word; min-height: 1.6em; }
.blk .tx:empty::before { content: attr(data-ph); color: var(--faint); pointer-events: none; }
.blk:not(:focus-within) .tx.ph-focus:empty::before { content: ""; }
.blk.h1 .tx { font-size: 30px; font-weight: 700; line-height: 1.3; margin-top: 22px; }
.blk.h2 .tx { font-size: 24px; font-weight: 600; line-height: 1.3; margin-top: 18px; }
.blk.h3 .tx { font-size: 20px; font-weight: 600; line-height: 1.3; margin-top: 12px; }
.blk.h1 .grip { top: 26px; } .blk.h2 .grip { top: 22px; } .blk.h3 .grip { top: 15px; }
.blk .mk { flex: none; width: 26px; display: grid; place-items: start center; padding-top: 0; color: var(--text); user-select: none; }
.blk.bullet .mk::before { content: "•"; font-size: 22px; line-height: 1.15; }
.blk.number .mk { font-variant-numeric: tabular-nums; padding-right: 4px; place-items: start end; }
.blk.todo .mk { padding-top: 5px; }
.blk.todo .mk input { width: 16px; height: 16px; margin: 0; accent-color: var(--blue); cursor: pointer; }
.blk.todo.checked .tx { color: var(--faint); text-decoration: line-through; }
.blk.quote .tx { border-left: 3px solid currentColor; padding-left: 14px; }
.blk.callout { background: var(--callout); border-radius: 4px; padding: 12px 14px 12px 10px; margin: 6px 0; }
.blk.callout .mk { color: var(--muted); padding-top: 3px; width: 30px; }
.blk.divider .tx { display: none; }
.blk.divider .hr { flex: 1; height: 1px; background: var(--line2); margin: 12px 0; }
.blk.code .tx { font-family: var(--mono); font-size: 14px; background: var(--callout); padding: 14px 16px; border-radius: 4px; line-height: 1.5; white-space: pre; overflow-x: auto; }
.blk.view { display: block; padding: 0; margin: 10px 0; }
.blk.view .grip { top: 8px; }
.ed .tx code { font-family: var(--mono); font-size: 85%; background: var(--code); color: var(--code-text); border-radius: 4px; padding: 1px 4px; }
.ed .tx a[href^="http"] { color: inherit; text-decoration: underline; text-decoration-color: var(--line2); }
.ed.readonly .grip { display: none; }
.ed .add-line { min-height: 60px; cursor: text; }

/* Menus flottants : « / », [[ et @, tags, choix */
.pop { position: fixed; z-index: 50; width: 320px; max-height: 360px; overflow-y: auto; background: var(--bg); border-radius: 8px; box-shadow: var(--pop); padding: 6px; font-size: 14px; }
.pop .ph { font-size: 12px; color: var(--muted); padding: 6px 10px 4px; }
.pop .op { display: flex; align-items: center; gap: 10px; padding: 5px 10px; border-radius: 5px; cursor: pointer; }
.pop .op.on { background: var(--hover); }
.pop .op .bx { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line2); border-radius: 5px; background: var(--bg); flex: none; }
.pop .op small { display: block; font-size: 12px; color: var(--muted); }
.pop .op .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop .sep { height: 1px; background: var(--line); margin: 4px 0; }
.pop .none { padding: 8px 10px; color: var(--faint); }
.pop input.input { width: 100%; margin-bottom: 4px; }
.toolbar { position: fixed; z-index: 45; display: flex; gap: 0; background: var(--bg); border-radius: 6px; box-shadow: var(--pop); padding: 3px; }
.toolbar button { border: 0; background: none; height: 28px; min-width: 30px; padding: 0 7px; border-radius: 4px; cursor: pointer; font-size: 14px; color: var(--text); }
.toolbar button:hover { background: var(--hover); }

/* ── Bases : tableau, par état, calendrier, liste ──────────────────────────── */
.db { margin: 14px 0; }
.dbt { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 8px; margin: 6px 0 4px; flex-wrap: wrap; }
.dbt small { font-size: 12.5px; font-weight: 500; color: var(--faint); }
.dbh { display: flex; align-items: center; gap: 2px; height: 38px; border-bottom: 1px solid var(--line2); overflow-x: auto; scrollbar-width: none; }
.dbh .vw { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; font-size: 14px; color: var(--muted); border-radius: 5px; border: 0; background: none; cursor: pointer; white-space: nowrap; }
.dbh .vw:hover { background: var(--hover); }
.dbh .vw.on { color: var(--text); font-weight: 500; box-shadow: inset 0 -2px 0 var(--text); border-radius: 0; height: 38px; }
.filters { display: flex; gap: 6px; padding: 8px 0; flex-wrap: wrap; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 999px; border: 0; font-size: 13px; cursor: pointer; background: var(--t-gray); color: var(--tx-tag); }
.pill.off { background: transparent; color: var(--muted); }
.pill.off:hover { background: var(--hover); }
.pill.on-pro { background: var(--t-blue); } .pill.on-perso { background: var(--t-green); }
.tbl-wrap { overflow-x: auto; }
.grid { font-size: 14px; width: 100%; border-collapse: collapse; }
.grid th { font-weight: 400; color: var(--muted); text-align: left; height: 33px; padding: 0 8px; border-bottom: 1px solid var(--line2); border-right: 1px solid var(--line); white-space: nowrap; }
.grid th .ico { margin-right: 4px; position: relative; top: -1px; }
.grid td { height: 36px; padding: 0 8px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }
.grid th:last-child, .grid td:last-child { border-right: 0; }
.grid tr:hover td { background: var(--hover); }
.grid td.t { font-weight: 500; }
.grid td.t a { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; border-bottom: 1px solid var(--line2); max-width: 100%; }
.grid td.t a span { overflow: hidden; text-overflow: ellipsis; }
.grid td.t .ico { color: var(--muted); }
.grid .tags-cell { display: flex; gap: 4px; overflow: hidden; }
.grid tr.new td { color: var(--faint); cursor: pointer; }
.board { display: flex; gap: 12px; overflow-x: auto; padding: 10px 0; align-items: flex-start; }
.col { flex: 0 0 260px; display: flex; flex-direction: column; gap: 6px; border-radius: 6px; padding: 4px; min-height: 60px; }
.col.over { background: var(--hover); }
.col-h { display: flex; align-items: center; gap: 8px; padding: 4px 4px 6px; font-size: 14px; color: var(--muted); }
.card { display: block; background: var(--bg); border-radius: 6px; box-shadow: 0 0 0 1px var(--line2), 0 2px 4px var(--line); padding: 8px 10px; text-decoration: none; color: var(--text); font-size: 14px; cursor: pointer; }
.card:hover { background: var(--hover); }
.card .m { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.card[draggable=true] { cursor: grab; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-left: 1px solid var(--line); border-top: 1px solid var(--line); margin-top: 10px; }
.cal .dw { font-size: 12px; color: var(--muted); padding: 4px 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal .day { min-height: 110px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; font-size: 12.5px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal .day.out { background: var(--side); }
.cal .day .num { font-size: 12px; color: var(--muted); align-self: flex-end; padding: 0 4px; }
.cal .day.today .num { background: var(--late); color: #fff; border-radius: 999px; }
.cal .day a { display: block; padding: 2px 6px; border-radius: 4px; background: var(--bg); box-shadow: 0 0 0 1px var(--line2); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-head { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-weight: 600; }
.lst a { display: flex; align-items: center; gap: 10px; padding: 7px 6px; border-bottom: 1px solid var(--line); text-decoration: none; font-size: 14.5px; }
.lst a:hover { background: var(--hover); }
.lst a .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lst a .ico { color: var(--muted); }
.lst small { color: var(--faint); font-size: 12.5px; white-space: nowrap; }

/* ── Accueil, À classer, Rangement ─────────────────────────────────────────── */
.home { max-width: 920px; margin: 0 auto; padding: 40px 48px 120px; width: 100%; }
.capture { margin: 22px 0 28px; border: 1px solid var(--line2); border-radius: 10px; box-shadow: 0 4px 18px rgba(15,15,15,.06); padding: 12px 14px; }
.capture textarea { width: 100%; border: 0; outline: 0; resize: none; font: inherit; font-size: 18px; background: transparent; color: var(--text); min-height: 30px; }
.capture textarea::placeholder { color: var(--faint); }
.capture .row { display: flex; align-items: center; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.pcard { display: flex; flex-direction: column; border: 1px solid var(--line2); border-radius: 10px; overflow: hidden; text-decoration: none; color: var(--text); min-width: 0; }
.pcard:hover { background: var(--hover); }
.pcard .band { height: 44px; background: var(--cover); }
.pcard .bd { padding: 0 12px 12px; }
.pcard .ic { margin-top: -16px; width: 32px; height: 32px; display: grid; place-items: center; background: var(--bg); border-radius: 6px; }
.pcard .t { font-size: 14px; font-weight: 600; margin-top: 6px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard small { font-size: 12.5px; color: var(--faint); }
.irow { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.irow .bd { flex: 1; min-width: 0; }
.irow .bd > a { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.irow .acts { display: flex; gap: 4px; flex: none; }
.rg-h { display: flex; align-items: center; gap: 10px; margin-top: 30px; padding-bottom: 6px; border-bottom: 1px solid var(--line2); flex-wrap: wrap; }
.rg-h h2 { font-size: 20px; font-weight: 600; }
.rg-l { display: flex; align-items: flex-start; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.rg-l .ico { margin-top: 3px; color: var(--muted); }
.rg-l .bd { flex: 1; min-width: 0; }
.rg-l .bd small { display: block; font-size: 13px; color: var(--muted); }
.rg-l.undone { color: var(--faint); }
.rg-l.undone .bd > span { text-decoration: line-through; }

/* ── Fenêtres, recherche, notifications ────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(15,15,15,.4); display: grid; place-items: start center; padding: 12vh 16px 16px; }
.modal { width: 100%; max-width: 620px; max-height: 76vh; overflow-y: auto; background: var(--bg); border-radius: 10px; box-shadow: var(--pop); padding: 16px; }
.modal h3 { font-size: 16px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.modal .foot { display: flex; gap: 6px; align-items: center; margin-top: 14px; }
.search-box { padding: 0; }
.search-box .in { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.search-box .in input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; font-size: 17px; height: 50px; color: var(--text); }
.search-box .res { padding: 6px; max-height: 60vh; overflow-y: auto; }
.search-box .op { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 5px; text-decoration: none; font-size: 14.5px; cursor: pointer; }
.search-box .op.on { background: var(--hover); }
.search-box .op .t { flex: none; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-box .op small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { display: flex; align-items: center; gap: 12px; background: var(--text); color: var(--bg); border-radius: 6px; padding: 8px 14px; font-size: 14px; box-shadow: var(--pop); max-width: 92vw; }
.toast button { border: 0; background: none; color: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; padding: 0; }
.agent-answer { font-size: 15px; line-height: 1.6; }
.agent-answer .steps { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.agent-answer .step { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); background: var(--hover); border-radius: 4px; padding: 1px 6px; }
.agent-answer p { margin: 6px 0; }
.typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
.drawer-bg { display: none; }

/* ── Téléphone ─────────────────────────────────────────────────────────────── */
@media (max-width: 800px) {
  body { font-size: 16px; }
  .sb { position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; width: 290px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--pop); padding-top: max(8px, env(safe-area-inset-top)); }
  body.drawer .sb { transform: none; }
  body.drawer .drawer-bg { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(15,15,15,.35); }
  .sb a, .sb .it { min-height: 36px; font-size: 15px; }
  .menu-btn { display: inline-grid; }
  .top { padding-top: env(safe-area-inset-top); height: calc(48px + env(safe-area-inset-top)); }
  .top .cr .last { max-width: 46vw; }
  .top .wide, .capture .wide { display: none; }
  .pg { padding: 0 20px 140px; }
  .pg.nocover { padding-top: 20px; }
  .cover { height: 110px; }
  .pg-icon { width: 56px; height: 56px; margin-top: -28px; }
  .pg-icon.round { font-size: 20px; }
  .pg-title { font-size: 28px; margin-top: 8px; }
  .pr .k { flex-basis: 112px; }
  .props.folded .pr.extra { display: none; }
  .blk .grip { display: none; }
  .home { padding: 20px 20px 140px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tabbar { display: grid; position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line2); align-items: end; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; font-weight: 500; color: var(--muted); text-decoration: none; position: relative; min-height: 44px; justify-content: flex-end; }
  .tabbar a.on { color: var(--text); font-weight: 600; }
  .tabbar .add { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--text); color: var(--bg); margin-top: -26px; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
  .tabbar .badge { position: absolute; top: -2px; right: calc(50% - 22px); }
  .modal-overlay { place-items: end center; padding: 0; }
  .modal { max-width: none; border-radius: 14px 14px 0 0; max-height: 88vh; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .pop { width: min(320px, calc(100vw - 16px)); }
  .grid td { max-width: 200px; }
  #toasts { bottom: calc(80px + env(safe-area-inset-bottom)); }
}
@media (min-width: 801px) and (max-width: 1100px) { .pg { padding-left: 56px; padding-right: 56px; } }
[contenteditable][data-ph]:empty::before { content: attr(data-ph); color: var(--faint); }
.pr .v .add { color: var(--faint); border: 0; background: none; cursor: pointer; padding: 0 4px; border-radius: 3px; font-size: 13.5px; }
.pr .v .add:hover { background: var(--hover); color: var(--text); }
.scope-t { cursor: pointer; border: 0; }
.prop-more { color: var(--faint); font-size: 14px; border: 0; background: none; cursor: pointer; padding: 6px 0; display: none; align-items: center; gap: 6px; }
@media (max-width: 800px) { .prop-more { display: inline-flex; } }
.day-nav { display: inline-flex; gap: 2px; margin-left: 8px; vertical-align: middle; }
.summary-box { margin: 10px 0 4px; }

/* Fichiers : dépôt et aperçu */
.drop-zone { position: fixed; inset: 0; z-index: 90; display: none; place-items: center; background: rgba(35,131,226,.12); border: 3px dashed var(--blue); }
.drop-zone.on { display: grid; }
.drop-zone > div { display: flex; flex-direction: column; align-items: center; gap: 8px; background: var(--bg); padding: 26px 34px; border-radius: 12px; box-shadow: var(--pop); text-align: center; }
.drop-zone b { font-size: 18px; } .drop-zone span { color: var(--muted); font-size: 14px; max-width: 320px; }
.file-prev { margin: 14px 0 6px; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; background: var(--side); }
.file-prev img { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto; }
.file-prev iframe { display: block; width: 100%; height: 72vh; border: 0; background: #fff; }
.file-prev.tbl { max-height: 60vh; overflow: auto; background: var(--bg); }
.file-prev.tbl td { max-width: 220px; height: 30px; font-size: 13px; }
.file-prev.txt { padding: 12px 14px; max-height: 60vh; overflow: auto; font: 13px/1.5 var(--mono); white-space: pre-wrap; margin: 14px 0; }
