/* Documents (étape 1, maquette validée par Dylan le 03/10/2026). Arborescence et page (Mac), liste et page (iPhone),
   contenu de l'éditeur (Tiptap créé avec injectCSS: false : la CSP refuse les styles injectés, ses règles de base sont ici),
   menu « / », barre de mise en forme, barre du clavier, fenêtres. */

/* --- Mac : arborescence | page --- */
.docs-desk { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: var(--s-6); align-items: start; }
.dt { position: sticky; top: 0; max-height: calc(100vh - 130px); overflow-y: auto; display: flex; flex-direction: column; gap: 1px; padding-bottom: var(--s-4); }
.dt-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px 6px 8px; }
.dt-home { font-size: 17px; font-weight: 700; color: var(--text); text-decoration: none; letter-spacing: -0.01em; }
.dt-sec { display: flex; flex-direction: column; gap: 1px; margin-top: 12px; }
.dt-col { display: flex; align-items: center; gap: 8px; min-height: 26px; padding: 0 4px 0 8px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.dt-col .dot, .dp-col .dot, .dm-ch .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dt-cn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt-add { opacity: 0; border: 0; background: transparent; color: var(--text-3); width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; cursor: pointer; padding: 0; }
.dt-col:hover .dt-add, .dt-add:focus-visible { opacity: 1; }
.dt-add:hover { background: var(--fill); color: var(--text); }
.dt-i { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; text-align: left; padding: 6px 8px 6px calc(8px + var(--d, 0) * 16px); border-radius: 8px; color: var(--text); font: inherit; font-size: 13.5px; cursor: pointer; }
.dt-i:hover { background: var(--fill); }
.dt-i.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.dt-em { width: 18px; text-align: center; flex: none; }
.dt-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt-n { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.dt-empty { margin: 0; padding: 2px 8px 4px 34px; font-size: 12.5px; color: var(--text-3); }
.dt-foot { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 1px; }
.dt-foot .dt-i { color: var(--text-2); }
.docs-main { min-width: 0; }

/* Accueil (Mac, aucune page ouverte) */
.dhome { max-width: 920px; margin: 0 auto; padding: 4px 8px 60px; display: grid; gap: 10px; }
.dhome .title-1 { margin: 0; }
.dhome-lead { color: var(--text-2); max-width: 62ch; margin: 0 0 10px; }
.dhome-recent, .dhome-tpl { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 16px; }
.dhome-card { display: grid; gap: 4px; align-content: start; text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: var(--r-card); padding: 14px; font: inherit; color: var(--text); cursor: pointer; box-shadow: var(--shadow); }
.dhome-card:hover { border-color: var(--line-strong); }
.dhome-em { font-size: 24px; line-height: 1.2; }
.dhome-card b { font-size: 15px; }

/* --- La page --- */
.dp { max-width: 760px; margin: 0 auto; padding: 4px 8px 80px; }
.dp-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 13px; color: var(--text-3); margin-bottom: 6px; }
.dp-crumbs button { border: 0; background: transparent; color: var(--text-2); padding: 2px 6px; border-radius: 6px; cursor: pointer; font: inherit; }
.dp-crumbs button:hover { background: var(--fill); }
.dp-top { display: flex; align-items: center; min-height: 44px; }
.dp-emoji { border: 0; background: transparent; font-size: 40px; line-height: 1; padding: 2px 4px; border-radius: 10px; cursor: pointer; color: var(--text); }
.dp-emoji:hover { background: var(--fill); }
.dp-emoji.none { font-size: 13px; color: var(--text-3); display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; }
.dp-more { border: 0; background: transparent; width: 36px; height: 36px; border-radius: 50%; color: var(--text-2); display: grid; place-items: center; cursor: pointer; margin-left: auto; }
.dp-more:hover { background: var(--fill); }
.dp-title { display: block; width: 100%; margin: 6px 0 0; padding: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 34px; line-height: 1.15; font-weight: 750; letter-spacing: -0.02em; resize: none; overflow: hidden; outline: none; text-wrap: balance; overflow-wrap: anywhere; }
.dp-title::placeholder { color: var(--text-3); }
.dp-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 10px; font-size: 13px; color: var(--text-3); }
.dp-col { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-pill); background: var(--fill); color: var(--text-2); font-weight: 600; }
.dp-cem { font-size: 13px; }
.dp-kids { margin-top: 28px; display: flex; flex-direction: column; gap: 2px; }
.dp-kids .eyebrow { margin: 0 0 4px; }
.dp-kid { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 8px 10px; border-radius: 10px; text-align: left; font: inherit; font-size: 15px; color: var(--text); cursor: pointer; }
.dp-kid:hover { background: var(--fill); }
.dp-kt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-add { color: var(--text-3); }
.dp-phone { padding: 0 0 40px; }
.dp-phone .dp-emoji { font-size: 34px; }
.dp-phone .dp-title { font-size: 28px; }
.dp-phone.dp-editing .doc-ed { padding-bottom: 45vh; } /* le texte peut remonter au-dessus du clavier */

/* --- Contenu de l'éditeur : règles de base de ProseMirror et Tiptap --- */
.ProseMirror { position: relative; word-wrap: break-word; white-space: pre-wrap; white-space: break-spaces; -webkit-font-variant-ligatures: none; font-variant-ligatures: none; font-feature-settings: "liga" 0; }
.ProseMirror [contenteditable="false"] { white-space: normal; }
.ProseMirror [contenteditable="false"] [contenteditable="true"] { white-space: pre-wrap; }
img.ProseMirror-separator { display: inline !important; border: none !important; margin: 0 !important; width: 0 !important; height: 0 !important; }
.ProseMirror-gapcursor { display: none; pointer-events: none; position: absolute; }
.ProseMirror-gapcursor::after { content: ""; display: block; position: absolute; top: -2px; width: 20px; border-top: 1px solid var(--text); animation: pm-blink 1.1s steps(2, start) infinite; }
@keyframes pm-blink { to { visibility: hidden; } }
.ProseMirror-focused .ProseMirror-gapcursor { display: block; }
.ProseMirror-hideselection *::selection { background: transparent; }
.ProseMirror-hideselection { caret-color: transparent; }
.ProseMirror-selectednode { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.doc-ed-host { margin-top: 22px; position: relative; }
.de-wait { margin: 8px 0; }
.doc-ed { outline: none; font-size: 16px; line-height: 1.65; color: var(--text); min-height: 180px; padding-bottom: 40px; caret-color: var(--accent); -webkit-user-select: text; user-select: text; }
.doc-ed > * + * { margin-top: 6px; }
.doc-ed > :first-child { margin-top: 0; }
.doc-ed p { margin: 0; }
.doc-ed h1 { font-size: 22px; line-height: 1.3; font-weight: 700; letter-spacing: -0.01em; margin: 26px 0 4px; }
.doc-ed h2 { font-size: 18px; line-height: 1.35; font-weight: 650; margin: 18px 0 2px; }
.doc-ed ul, .doc-ed ol { margin: 0; padding-left: 24px; }
.doc-ed li > p { margin: 0; }
.doc-ed li + li { margin-top: 2px; }
.doc-ed li::marker { color: var(--text-3); font-variant-numeric: tabular-nums; }
.doc-ed blockquote { margin: 0; border-left: 3px solid var(--line-strong); padding: 2px 0 2px 14px; color: var(--text-2); }
.doc-ed hr { border: 0; height: 1px; background: var(--line-strong); margin: 18px 0; }
.doc-ed a { color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent-soft); text-underline-offset: 3px; }
.doc-ed strong { font-weight: 700; }
/* Cases à cocher : vertes une fois cochées (fait = positif) */
.doc-ed ul[data-type="taskList"] { list-style: none; padding-left: 2px; }
.doc-ed ul[data-type="taskList"] > li { display: flex; gap: 10px; align-items: flex-start; }
.doc-ed ul[data-type="taskList"] > li > label { flex: none; margin-top: 3px; -webkit-user-select: none; user-select: none; }
.doc-ed ul[data-type="taskList"] > li > div { flex: 1; min-width: 0; }
.doc-ed ul[data-type="taskList"] > li input[type="checkbox"] { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; margin: 0; border-radius: 6px; border: 1.6px solid var(--line-strong); background: transparent; display: grid; place-items: center; cursor: pointer; transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease); }
.doc-ed ul[data-type="taskList"] > li input[type="checkbox"]:checked { background: var(--green); border-color: var(--green); }
.doc-ed ul[data-type="taskList"] > li input[type="checkbox"]:checked::after { content: ""; width: 9px; height: 5px; border: 2.4px solid #fff; border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.doc-ed li[data-checked="true"] > div { color: var(--text-3); text-decoration: line-through; }
/* Bascule : la question, la réponse cachée dessous */
.doc-ed div[data-type="details"] { display: flex; gap: 4px; align-items: flex-start; }
.doc-ed div[data-type="details"] > button { flex: none; width: 24px; height: 26px; border: 0; background: transparent; color: var(--text-3); display: grid; place-items: center; cursor: pointer; border-radius: 6px; padding: 0; transition: transform var(--dur-2) var(--ease); }
.doc-ed div[data-type="details"] > button:hover { background: var(--fill); color: var(--text); }
.doc-ed div[data-type="details"].is-open > button { transform: rotate(90deg); }
.doc-ed div[data-type="details"] > div { flex: 1; min-width: 0; }
.doc-ed summary { display: block; list-style: none; font-weight: 650; }
.doc-ed summary::-webkit-details-marker { display: none; }
.doc-ed div[data-type="detailsContent"] { color: var(--text-2); padding: 2px 0 6px; }
.doc-ed div[data-type="detailsContent"][hidden] { display: none; }
/* Encadré */
.doc-ed div[data-type="callout"] { position: relative; padding: 12px 14px 12px 44px; border-radius: 12px; background: var(--accent-soft); margin: 10px 0; }
.doc-ed div[data-type="callout"]::before { content: attr(data-emoji); position: absolute; left: 14px; top: 11px; font-size: 18px; line-height: 1.4; }
/* Texte d'aide des lignes vides (seulement en écriture) */
.doc-ed .is-empty::before, .doc-ed .is-editor-empty:first-child::before { content: attr(data-placeholder); float: left; height: 0; color: var(--text-3); pointer-events: none; }

/* --- Menu « / », barre de mise en forme, lien (Mac) --- */
.de-slash { position: fixed; z-index: 60; width: 280px; max-height: 340px; overflow-y: auto; padding: 6px; border-radius: 12px; background: var(--card); box-shadow: var(--shadow-pop); }
.de-sl-h { margin: 0; padding: 4px 8px 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.de-slash button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; padding: 6px 8px; border-radius: 8px; text-align: left; font: inherit; font-size: 14px; color: var(--text); cursor: pointer; }
.de-slash button.on, .de-slash button:hover { background: var(--accent-soft); }
.de-gl { width: 26px; height: 26px; border-radius: 7px; background: var(--fill); display: grid; place-items: center; font-size: 12.5px; font-weight: 700; color: var(--text-2); flex: none; }
.de-slash kbd { margin-left: auto; font: 600 11.5px var(--font); color: var(--text-3); }
.de-fmt { position: fixed; z-index: 60; display: flex; gap: 2px; padding: 4px; border-radius: 10px; background: var(--card); box-shadow: var(--shadow-pop); }
.de-fmt button { border: 0; background: transparent; min-width: 32px; height: 30px; border-radius: 7px; color: var(--text); font: inherit; font-size: 14px; cursor: pointer; display: grid; place-items: center; }
.de-fmt button:hover { background: var(--fill); }
.de-fmt button.on { background: var(--accent-soft); color: var(--accent); }
.de-link { position: fixed; z-index: 61; display: flex; gap: 6px; align-items: center; padding: 6px; border-radius: 12px; background: var(--card); box-shadow: var(--shadow-pop); width: min(380px, calc(100vw - 24px)); }
.de-link .input { flex: 1; min-width: 0; height: 36px; font-size: 16px; }

/* --- Barre au-dessus du clavier (iPhone) --- */
.de-kbar-wrap { position: fixed; left: 0; right: 0; z-index: 90; } /* au-dessus de la barre d'onglets (20), sous les menus (96) */
.de-kbar { display: flex; justify-content: space-between; align-items: center; gap: 2px; padding: 6px 10px; background: var(--card); border-top: 1px solid var(--line); }
.de-kb { min-width: 40px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: var(--text); font-size: 16px; padding: 0 6px; cursor: pointer; -webkit-user-select: none; user-select: none; }
.de-kb.on { background: var(--accent-soft); color: var(--accent); }
.de-aa { font-weight: 700; font-size: 15px; }
.de-styles { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px; background: var(--card-2); border-top: 1px solid var(--line); scrollbar-width: none; }
.de-styles::-webkit-scrollbar { display: none; }
.de-st { flex: none; background: var(--card); color: var(--text); border-radius: 10px; padding: 7px 12px; font-size: 14px; white-space: nowrap; cursor: pointer; -webkit-user-select: none; user-select: none; }
.de-st.on { background: var(--accent-soft); color: var(--accent); }
.de-styles .de-st-h1 { font-weight: 750; }
.de-styles .de-st-h2 { font-weight: 650; }
.de-styles .de-st-quote { font-style: italic; }

/* --- iPhone : liste --- */
.dm-search { margin: 0 0 var(--s-4); }
.dm-ch { display: flex; align-items: center; gap: 8px; }
.dm-none { margin: var(--s-2) var(--s-1); }

/* --- Fenêtres --- */
.ds-g { margin: var(--s-4) 0 var(--s-2); }
.ds-emojis { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.ds-em { height: 44px; border: 0; border-radius: 12px; background: var(--fill); font-size: 22px; cursor: pointer; }
.ds-em.on { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.ds-row { margin-top: var(--s-4); }
.ds-acts { display: flex; gap: 6px; }
@media (prefers-reduced-motion: reduce) { .doc-ed div[data-type="details"] > button, .doc-ed ul[data-type="taskList"] > li input[type="checkbox"] { transition: none; } }
