/* Capergo - styles communs */
:root {
  --brand: #63308a;
  --brand-dark: #4e2470;
  --brand-tint: #f3ecfa;
  --ink: #1f1933;
  --muted: #6b6480;
  --line: #dcd7e6;
  --field: #f8f7fb;
  --white: #fff;
  --danger: #c0264b;
  --danger-tint: #fdecef;
  --ok: #17803d;
  --ok-tint: #e8f6ee;
  --radius: 12px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--brand); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 20px; height: 20px; flex: none; }

/* ---------- Pages de connexion ---------- */
.auth-body {
  min-height: 100vh;
  background: #f5f6fb url("/assets/img/fond.jpg") center / cover no-repeat fixed;
  display: flex; flex-direction: column;
}
.auth-header { padding: 28px 40px 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.hds-badge {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px 8px 10px;
  background: rgba(255, 255, 255, .92); border: 1px solid #b9e0cc; border-radius: 999px;
  box-shadow: 0 4px 14px rgba(31, 138, 91, .12); color: #14583b; line-height: 1.2;
}
.hds-badge svg { flex: none; }
.hds-badge strong { display: block; font-size: 14px; }
.hds-badge small { display: block; font-size: 12.5px; color: #3d7a5e; }
.logo { width: 360px; max-width: 70vw; height: auto; display: block; }
.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 16px 48px; }
.auth-card {
  width: 100%; max-width: 520px; background: var(--white); border-radius: 20px;
  box-shadow: 0 20px 60px rgba(60, 40, 110, .10); padding: 44px 48px 32px;
}
.auth-card h1 { margin: 0; text-align: center; font-size: 36px; letter-spacing: -.5px; }
.auth-sub { margin: 12px 0 0; text-align: center; color: var(--muted); font-weight: 600; font-size: 16px; }
.auth-lead { margin: 6px 0 24px; text-align: center; color: var(--muted); }
.auth-foot { margin: 28px 0 0; text-align: center; color: var(--muted); font-size: 13px; }
.auth-test { margin: 10px 0 0; text-align: center; font-size: 13px; }
.auth-test--top { margin: 10px 0 16px; }
.auth-test a { color: var(--brand); font-weight: 600; text-decoration: none; }
.auth-test a:hover { text-decoration: underline; }
.auth-test-tag { display: inline-block; margin: 0 2px; padding: 1px 8px; border-radius: 999px; background: #fdf3d6; color: #7a5a00; font-size: 12px; font-weight: 700; }

.field-label { display: block; font-weight: 600; font-size: 14px; margin: 18px 0 8px; }
.field {
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: var(--field); border: 1px solid var(--line); border-radius: 10px;
}
.field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); background: var(--white); }
.field .icon { color: var(--muted); }
.field input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 15px 0; font: inherit; color: var(--ink); outline: none; }
.toggle-pass { border: 0; background: none; padding: 4px; cursor: pointer; color: var(--muted); display: flex; }
.toggle-pass.is-on { color: var(--brand); }
.field-after { text-align: right; margin-top: 10px; font-size: 13px; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.field-row .field input { width: 100%; }

.colors { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.colors legend { padding: 0; margin: 0 0 10px; }
.colors { margin-top: 20px !important; }
.swatch { cursor: pointer; }
.swatch input { position: absolute; opacity: 0; }
.swatch span:not(.sr-only) { display: block; width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--white); box-shadow: 0 0 0 1px var(--line); }
.swatch input:checked + span { box-shadow: 0 0 0 3px var(--ink); }
.swatch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 3px; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  padding: 16px; margin-top: 24px; border-radius: 10px; font: inherit; font-weight: 600; font-size: 16px;
  cursor: pointer; text-decoration: none; border: 1.5px solid transparent;
}
.btn-primary { background: var(--brand); color: var(--white); box-shadow: 0 6px 16px rgba(99, 48, 138, .25); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-outline { background: var(--white); color: var(--brand); border-color: var(--brand); margin-top: 0; }
.btn-outline:hover { background: var(--brand-tint); }
.divider { display: flex; align-items: center; gap: 16px; color: var(--muted); margin: 22px 0; font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.link-back { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 20px; font-size: 13px; text-decoration: none; }

.alert { padding: 12px 14px; border-radius: 10px; font-size: 13px; margin: 0 0 8px; line-height: 1.45; }
.alert-error { background: var(--danger-tint); color: var(--danger); }
.alert-success { background: var(--ok-tint); color: var(--ok); }

@media (max-width: 560px) {
  .auth-header { padding: 20px 16px 0; }
  .auth-card { padding: 32px 22px 24px; }
  .auth-card h1 { font-size: 28px; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
}

/* ---------- Pages connectees ---------- */
.app-body { min-height: 100vh; background: #f5f6fb url("/assets/img/fond.jpg") center / cover no-repeat fixed; }
.topbar {
  display: flex; align-items: center; gap: 24px; padding: 12px 28px;
  background: rgba(255, 255, 255, .85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.logo-small { width: 200px; height: auto; display: block; }
.topbar-search { flex: 1; max-width: 420px; }
.topbar-search input { width: 100%; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--field); font: inherit; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-user form { margin: 0; }
.topbar-name { font-weight: 600; }
.bubble { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--white); font-weight: 600; font-size: 13px; }
.btn-link { border: 0; background: none; color: var(--muted); cursor: pointer; font: inherit; font-size: 13px; text-decoration: underline; }
.app-main { max-width: 1200px; margin: 0 auto; padding: 40px 28px; }
.app-main h1 { font-size: 38px; margin: 0; }
.muted { color: var(--muted); }
.placeholder { margin-top: 32px; padding: 32px; background: var(--white); border-radius: 16px; box-shadow: 0 10px 30px rgba(60, 40, 110, .08); }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; padding: 12px 16px; gap: 12px; }
  .topbar-search { order: 3; max-width: none; flex-basis: 100%; }
  .topbar-name { display: none; }
  .app-main { padding: 24px 16px; }
}

/* ---------- Elements communs (pages connectees) ---------- */
.btn-inline { width: auto; margin-top: 0; padding: 12px 22px; font-size: 15px; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-ghost { background: none; color: var(--muted); border-color: var(--line); margin-top: 0; }
.btn-ghost:hover { background: var(--field); }
.bubble-sm { width: 30px; height: 30px; font-size: 12px; border: 2px solid var(--white); }
.bubble-more { background: var(--muted); }
.small { font-size: 12px; }
.empty { color: var(--muted); font-style: italic; }
.icon-btn { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 16px; padding: 4px 6px; border-radius: 6px; }
.icon-btn:hover { background: var(--field); color: var(--brand); }
.bicon { width: 22px; height: 22px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head p { margin: 6px 0 0; font-size: 16px; }

/* ---------- Etagere ---------- */
.shelf {
  padding: 18px 18px 0; border-radius: 10px;
  background: linear-gradient(180deg, #c99a62, #b9874e);
  box-shadow: inset 0 0 0 6px #a9743d, 0 18px 40px rgba(80, 50, 20, .18);
}
.shelf-row {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px;
  padding: 26px 26px 0; position: relative;
  background: linear-gradient(180deg, #e7c896, #dcb57c);
  margin-bottom: 22px;
}
.shelf-row::after {
  content: ""; position: absolute; left: -18px; right: -18px; bottom: -22px; height: 22px;
  background: linear-gradient(180deg, #d6a868, #b07c42); box-shadow: 0 4px 6px rgba(80, 50, 20, .25);
}
.binder {
  --dark: color-mix(in srgb, var(--c) 72%, black);
  position: relative; display: flex; flex-direction: column; cursor: pointer;
  border-radius: 12px 12px 4px 4px; padding: 20px 20px 0 34px; min-height: 300px;
  background: linear-gradient(90deg, var(--dark) 0 16px, color-mix(in srgb, var(--c) 88%, white) 16px 20px, var(--c) 20px);
  box-shadow: 0 10px 18px rgba(0, 0, 0, .18), inset 0 -10px 18px rgba(0, 0, 0, .12);
  transition: transform .15s ease;
}
.binder:hover { transform: translateY(-4px); }
.binder-label { background: var(--white); border-radius: 6px; padding: 16px; box-shadow: 0 2px 6px rgba(0, 0, 0, .12); }
.binder-head { display: flex; align-items: flex-start; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.binder-icon { color: var(--c); flex: none; }
.binder-icon .bicon { width: 34px; height: 34px; }
.binder-title { flex: 1; min-width: 0; }
.binder-title h2 { margin: 0; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.binder-title h2 a { color: var(--ink); text-decoration: none; }
.binder-title span { color: var(--muted); font-size: 13px; }
.binder-edit { border: 0; background: none; cursor: pointer; font-size: 18px; line-height: 1; color: var(--muted); padding: 2px 6px; border-radius: 6px; }
.binder-edit:hover { background: var(--field); }
.binder-recent { list-style: none; margin: 8px 0 0; padding: 0; }
.binder-recent a { display: flex; align-items: center; gap: 10px; padding: 7px 4px; color: var(--ink); text-decoration: none; border-radius: 6px; }
.binder-recent a:hover { background: var(--field); }
.doc-ic { color: #5b6fa8; display: flex; }
.doc-ic .bicon { width: 20px; height: 20px; }
.rc-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rc-title { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-text small { color: var(--muted); font-size: 12px; }
.chev { color: var(--muted); font-size: 18px; }
.rc-empty { color: var(--muted); font-size: 13px; font-style: italic; padding: 8px 4px; }
.binder-foot { flex: 1; display: flex; align-items: center; justify-content: center; gap: 40px; min-height: 76px; position: relative; }
.ring { width: 40px; height: 40px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #555, #0d0d0d 60%); box-shadow: 0 0 0 4px #d9d9d9, 0 0 0 5px #9a9a9a; }
.bubbles { display: flex; position: relative; }
.bubbles .bubble { width: 36px; height: 36px; margin-left: -6px; font-size: 12px; }
.badge {
  position: absolute; top: -8px; right: -10px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: #e5243b; color: var(--white); font-size: 12px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--white);
}
@media (max-width: 1000px) { .shelf-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .shelf { padding: 10px 10px 0; }
  .shelf-row { grid-template-columns: minmax(0, 1fr); padding: 18px 14px 0; gap: 18px; }
  .shelf-row::after { left: -10px; right: -10px; }
}

/* ---------- Classeur ouvert ---------- */
.binder-page .app-main { max-width: none; }
.workspace { display: grid; grid-template-columns: 280px minmax(0, 1fr) 340px; gap: 20px; padding: 20px; max-width: 1600px; margin: 0 auto; align-items: start; }
.tree, .sheet, .panel { background: rgba(255, 255, 255, .92); border-radius: 14px; box-shadow: 0 6px 24px rgba(60, 40, 110, .07); }
.tree { padding: 18px 12px; position: sticky; top: 20px; }
.btn-new { margin: 0 0 18px; padding: 12px; font-size: 15px; }
.tree-head { font-weight: 700; padding: 0 8px 8px; }
.tree-head a { color: var(--ink); text-decoration: none; }
.tree ul { list-style: none; margin: 0; padding: 0; }
.tree-binder { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 600; }
.tree-binder:hover { background: var(--field); }
.is-open > .tree-binder { background: color-mix(in srgb, var(--bc) 14%, white); }
.tree-binder.is-current { box-shadow: inset 0 0 0 2px var(--bc); }
.folder { width: 24px; height: 18px; border-radius: 3px; background: var(--bc); position: relative; flex: none; }
.folder::before { content: ""; position: absolute; left: 0; top: -4px; width: 10px; height: 5px; border-radius: 2px 2px 0 0; background: var(--bc); }
.tb-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-notes { margin: 4px 0 8px 12px !important; }
.tree-row { display: flex; align-items: center; }
.twisty { border: 0; background: none; cursor: pointer; width: 22px; color: var(--muted); font-size: 12px; transition: transform .15s; flex: none; }
.is-open > .tree-row .twisty { transform: rotate(90deg); }
.twisty-space { width: 22px; flex: none; }
.tree-note { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 14px; }
.tree-note span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-note .bicon { width: 18px; height: 18px; color: var(--muted); flex: none; }
.tree-note:hover { background: var(--field); }
.tree-note.is-current { background: var(--brand-tint); color: var(--brand); font-weight: 600; }
.tree-subs { display: none; margin-left: 30px !important; border-left: 1px solid var(--line); padding-left: 6px !important; }
.is-open > .tree-subs { display: block; }
.tree-empty { color: var(--muted); font-size: 13px; font-style: italic; padding: 6px 30px; }

.sheet { padding: 22px 32px 36px; min-height: 70vh; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--brand); }
.crumbs strong { color: var(--ink); }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.sheet-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sheet-title h1 { margin: 0; font-size: 30px; line-height: 1.15; }
.sheet-icon { color: var(--c); display: flex; }
.sheet-icon .bicon { width: 32px; height: 32px; }
.participants { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; max-width: 300px; }
.byline { display: flex; align-items: center; gap: 12px; margin: 14px 0 24px; padding-bottom: 18px; border-bottom: 1px solid var(--line); font-size: 14px; }
.byline .bubble { width: 38px; height: 38px; font-size: 13px; }
.readonly-tag { margin-left: auto; font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--field); color: var(--muted); border: 1px solid var(--line); }
.content { font-size: 16px; line-height: 1.6; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.note-card { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); text-decoration: none; background: var(--white); }
.note-card:hover { border-color: var(--brand); box-shadow: 0 4px 12px rgba(60, 40, 110, .08); }
.note-card .doc-ic { grid-row: span 2; }
.nc-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-card small { color: var(--muted); }
.subnotes { margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.subnotes-head { display: flex; justify-content: space-between; align-items: center; }
.subnotes-head h2 { margin: 0; font-size: 16px; }

.side { display: grid; gap: 16px; }
.panel { padding: 18px 20px; }
.panel-head h2 { margin: 0 0 10px; font-size: 16px; }
.info { display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; margin: 0; font-size: 13px; }
.info dt { color: var(--muted); }
.info dd { margin: 0; text-align: right; }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; font-size: 13px; }
.history li { display: flex; gap: 10px; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; margin-top: 4px; }

@media (max-width: 1200px) {
  .workspace { grid-template-columns: 250px minmax(0, 1fr); }
  .side { grid-column: 2; }
}
@media (max-width: 800px) {
  .workspace { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .tree { position: static; }
  .side { grid-column: auto; }
  .sheet { padding: 18px; }
  .sheet-head { flex-direction: column; }
  .participants { justify-content: flex-start; }
}

/* ---------- Fenetre modale ---------- */
.dialog { border: 0; border-radius: 16px; padding: 28px 30px; width: min(520px, calc(100vw - 32px)); box-shadow: 0 24px 60px rgba(30, 20, 60, .25); }
.dialog::backdrop { background: rgba(30, 20, 50, .35); }
.dialog h2 { margin: 0 0 4px; font-size: 22px; }
.dialog .colors { margin-top: 18px !important; }
.icons { border: 0; padding: 0; margin: 18px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.icons legend { padding: 0; margin: 0 0 10px; }
.icon-choice input { position: absolute; opacity: 0; }
.icon-choice span:not(.sr-only) { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); color: var(--ink); cursor: pointer; }
.icon-choice input:checked + span { border-color: var(--brand); background: var(--brand-tint); color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.icon-choice input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.dialog-actions .btn { width: auto; margin-top: 0; padding: 12px 22px; font-size: 15px; }
.dialog .alert { margin-top: 14px; }

/* ---------- Edition du texte ---------- */
.head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.lock-status {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px;
  background: var(--brand-tint); color: var(--brand); font-size: 13px; font-weight: 600;
  animation: pulse 1.6s ease-in-out infinite;
}
.lock-status[hidden] { display: none; }
@keyframes pulse { 50% { opacity: .65; } }
.editor-toolbar { position: sticky; top: 0; z-index: 5; }
.editor-toolbar.is-on { margin: -6px 0 14px; }
.editor-toolbar .tox-tinymce-inline { position: static !important; visibility: visible !important; }
.editor-toolbar .tox .tox-editor-header { border: 1px solid var(--line) !important; border-radius: 10px; box-shadow: 0 4px 12px rgba(60, 40, 110, .06) !important; }
.editor-msg { font-size: 13px; margin: 0 0 12px; padding: 8px 12px; border-radius: 8px; background: var(--field); color: var(--muted); }
.editor-msg.is-ok { background: var(--ok-tint); color: var(--ok); display: inline-block; }
.editor-msg.is-warn { background: #fff6e0; color: #8a5a00; }
.editor-msg.is-error { background: var(--danger-tint); color: var(--danger); }

.content { min-height: 240px; border-radius: 10px; padding: 6px 10px; margin: 0 -10px; outline: none; overflow-wrap: anywhere; }
.content:empty::before { content: attr(data-empty); color: var(--muted); font-style: italic; }
.content.is-editable { cursor: text; }
.content.is-editable:not(.is-editing):not(.is-locked):hover { background: rgba(99, 48, 138, .035); }
.content.is-editing { box-shadow: inset 0 0 0 2px var(--brand-tint); background: var(--white); }
.content.is-locked { cursor: not-allowed; }
.content h1 { font-size: 28px; margin: 24px 0 10px; }
.content h2 { font-size: 22px; margin: 22px 0 8px; color: var(--brand); }
.content h3 { font-size: 18px; margin: 18px 0 6px; }
.content p { margin: 0 0 12px; }
.content img { max-width: 100%; height: auto; border-radius: 6px; }
.content table { border-collapse: collapse; max-width: 100%; margin: 12px 0; }
.content td, .content th { border: 1px solid var(--line); padding: 6px 10px; vertical-align: top; }
.content th { background: var(--field); }
.content blockquote { margin: 12px 0; padding: 4px 16px; border-left: 4px solid var(--brand-tint); color: var(--muted); }
.content a { color: var(--brand); }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }

/* ---------- Historique des versions ---------- */
.history-main { max-width: 1300px; }
.history-main h1 { font-size: 32px; }
.history-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; margin-top: 20px; }
.version-list { list-style: none; margin: 0; padding: 10px; display: grid; gap: 4px; background: rgba(255, 255, 255, .92); border-radius: 14px; box-shadow: 0 6px 24px rgba(60, 40, 110, .07); max-height: 75vh; overflow: auto; }
.version-list a { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.version-list a > span:last-child { display: flex; flex-direction: column; }
.version-list a:hover { background: var(--field); }
.version-list a.is-current { background: var(--brand-tint); }
.version-view { min-height: 0; }
.version-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.tabs { display: inline-flex; background: var(--field); border-radius: 10px; padding: 4px; }
.tabs a { padding: 8px 16px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 13px; }
.tabs a.is-on { background: var(--white); color: var(--brand); box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }
.version-title { margin: 20px 0 2px; font-size: 24px; }
.diff p { margin: 0; padding: 6px 10px; border-radius: 6px; line-height: 1.5; }
.d-add { background: #e3f6e9; color: #135c2c; }
.d-del { background: #fde8eb; color: #9b1c33; text-decoration: line-through; }
.d-same { color: var(--muted); }
.diff-key span { padding: 1px 6px; border-radius: 4px; margin-left: 6px; }
@media (max-width: 800px) { .history-grid { grid-template-columns: minmax(0, 1fr); } .version-list { max-height: 260px; } }
.content.is-locked:empty::before { content: ""; }
.panel-head a { white-space: nowrap; }

/* ---------- Fichiers joints ---------- */
.btn-add { border: 1px solid var(--line); background: var(--white); color: var(--brand); font: inherit; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.btn-add:hover { border-color: var(--brand); background: var(--brand-tint); }
.files { list-style: none; margin: 4px 0 0; padding: 0; }
.file { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.file:last-child { border-bottom: 0; }
.file-kind { flex: none; width: 38px; height: 38px; border-radius: 8px; color: var(--white); font-size: 11px; font-weight: 700; display: grid; place-items: center; letter-spacing: .3px; }
.file-main { flex: 1; min-width: 0; }
.file-name { display: block; max-width: 100%; border: 0; background: none; padding: 0; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-name:hover { color: var(--brand); text-decoration: underline; }
.file-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.file-meta .dot { width: 9px; height: 9px; margin: 0; }
.file-act { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 16px; cursor: pointer; text-decoration: none; }
.file-act:hover { background: var(--field); color: var(--brand); }
.files-empty { color: var(--muted); font-size: 13px; font-style: italic; padding: 6px 0; }
.dropzone { margin-top: 10px; padding: 14px; border: 1.5px dashed var(--line); border-radius: 10px; text-align: center; color: var(--muted); font-size: 12px; }
.upload { padding: 8px 0; border-top: 1px solid var(--line); font-size: 12px; }
.upload-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-bar { height: 6px; border-radius: 3px; background: var(--field); margin: 6px 0 4px; overflow: hidden; }
.upload-bar span { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s; }
.upload-state { color: var(--muted); }
.upload.is-error .upload-state { color: var(--danger); }
.menu { position: absolute; z-index: 50; min-width: 240px; padding: 6px; background: var(--white); border-radius: 10px; box-shadow: 0 12px 32px rgba(30, 20, 60, .18); border: 1px solid var(--line); }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 6px; font: inherit; font-size: 13px; cursor: pointer; color: var(--ink); }
.menu button:hover { background: var(--field); }
.menu button.is-danger { color: var(--danger); }
.drop-overlay {
  position: fixed; inset: 0; z-index: 60; display: none; place-items: center; pointer-events: none;
  background: rgba(99, 48, 138, .12); border: 4px dashed var(--brand); color: var(--brand); font-size: 24px; font-weight: 700;
}
.drop-overlay.is-on { display: grid; }

/* Apercu */
.preview { border: 0; padding: 0; width: min(1100px, calc(100vw - 32px)); height: min(860px, calc(100vh - 32px)); border-radius: 16px; overflow: hidden; box-shadow: 0 24px 60px rgba(30, 20, 60, .3); }
.preview[open] { display: flex; flex-direction: column; }
.preview::backdrop { background: rgba(20, 14, 35, .55); }
.preview-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.preview-head strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-body { flex: 1; min-height: 0; display: grid; place-items: center; background: #f1f0f5; }
.preview-body img, .preview-body video { max-width: 100%; max-height: 100%; }
.preview-body iframe { width: 100%; height: 100%; border: 0; background: var(--white); }
.preview-none { color: var(--muted); }
.content a[href*="fichier.php?id="] { padding: 1px 6px; border-radius: 6px; background: var(--brand-tint); text-decoration: none; }
.content a[href*="fichier.php?id="]::before { content: "📎 "; }

/* ---------- Droits d'ecriture (bulles des participants) ---------- */
.participants { align-items: center; }
.participant { position: relative; display: inline-flex; }
.participant.is-extra { display: none; }
.participants.is-editing .participant.is-extra { display: inline-flex; }
.participants.is-editing .bubble-more { display: none; }
.participant.is-readonly .bubble { filter: grayscale(1); opacity: .45; }
.rt-toggle {
  display: none; position: absolute; top: -7px; right: -7px; width: 18px; height: 18px; padding: 0;
  border-radius: 50%; border: 1.5px solid var(--white); font-size: 10px; line-height: 1; cursor: pointer;
  background: var(--danger); color: var(--white); place-items: center;
}
.participant.is-readonly .rt-toggle { background: var(--brand); font-size: 11px; }
.participants.is-editing .rt-toggle { display: grid; }
.participants.is-editing { gap: 10px; padding: 6px 2px; }
.rt-edit { margin-left: 6px; padding: 4px 10px; font-size: 12px; }
.participants.is-editing .rt-edit { background: var(--brand); color: var(--white); border-color: var(--brand); }

/* ---------- Barre du haut : recherche, administration ---------- */
.topbar-search { margin: 0; }
.topbar-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); background: var(--white); }
.topbar-admin { font-weight: 600; font-size: 13px; text-decoration: none; padding: 6px 12px; border-radius: 8px; background: var(--brand-tint); margin-right: 6px; }

/* ---------- Glisser-deposer ---------- */
.dnd-row { position: relative; }
.dnd-row.is-dragging { opacity: .4; }
.dnd-row.drop-before { box-shadow: 0 -3px 0 var(--brand); }
.dnd-row.drop-after { box-shadow: 0 3px 0 var(--brand); }
.dnd-row.drop-inside { background: var(--brand-tint) !important; outline: 2px dashed var(--brand); outline-offset: -2px; border-radius: 8px; }
.binder.drop-before { box-shadow: -6px 0 0 var(--brand), 0 10px 18px rgba(0, 0, 0, .18); }
.binder.drop-after { box-shadow: 6px 0 0 var(--brand), 0 10px 18px rgba(0, 0, 0, .18); }
.tree .dnd-row { cursor: grab; }

/* ---------- Recherche ---------- */
.search-main { max-width: 960px; }
.results { margin-top: 28px; display: grid; gap: 10px; }
.results h2 { font-size: 16px; margin: 0 0 4px; }
.result { display: grid; gap: 4px; padding: 16px 18px; background: rgba(255, 255, 255, .95); border-radius: 12px; border-left: 4px solid var(--c, var(--brand)); color: var(--ink); text-decoration: none; box-shadow: 0 4px 16px rgba(60, 40, 110, .06); }
a.result:hover { box-shadow: 0 6px 20px rgba(60, 40, 110, .12); }
.result-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; }
.result-title .bicon { color: var(--c, var(--brand)); width: 20px; height: 20px; }
.result-path { color: var(--muted); font-size: 12px; }
.result-snippet { font-size: 13px; color: #3d3650; }
.result-file { border-left-color: var(--line); }
mark { background: #fff1a8; color: inherit; border-radius: 3px; padding: 0 2px; }

/* ---------- Administration ---------- */
.admin-main { max-width: 1300px; }
.admin-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; flex-wrap: wrap; }
.admin-top h1 { font-size: 38px; margin: 0; }
.stats { display: flex; gap: 0; background: var(--white); border-radius: 16px; box-shadow: 0 8px 28px rgba(60, 40, 110, .08); padding: 18px 8px; }
.stats > div { display: flex; flex-direction: column; padding: 0 22px; border-left: 1px solid var(--line); min-width: 120px; }
.stats > div:first-child { border-left: 0; }
.stats strong { font-size: 26px; }
.stats span { color: var(--muted); font-size: 13px; }
.disk { display: block; height: 6px; border-radius: 3px; background: var(--field); margin-top: 8px; overflow: hidden; }
.disk span { display: block; height: 100%; background: var(--brand); }
.admin-tabs { display: flex; gap: 8px; margin: 28px 0 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.admin-tabs a { padding: 12px 16px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.admin-tabs a.is-on { color: var(--brand); border-bottom-color: var(--brand); }
.admin-card { background: rgba(255, 255, 255, .96); border-radius: 16px; padding: 20px 24px; box-shadow: 0 8px 28px rgba(60, 40, 110, .07); }
.admin-card h2 { font-size: 17px; margin: 8px 0 12px; }
.admin-card h2 + .admin-table { margin-bottom: 26px; }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th { text-align: left; font-weight: 600; color: var(--muted); padding: 10px 10px; background: var(--field); }
.admin-table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table tr.is-off td { opacity: .6; }
.admin-table .bubble { width: 38px; height: 38px; }
.admin-table .actions { text-align: right; white-space: nowrap; }
.admin-table .actions form { display: inline-block; margin-left: 6px; }
.btn-mini { border: 1.5px solid var(--brand); background: var(--white); color: var(--brand); font: inherit; font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.btn-mini:hover { background: var(--brand-tint); }
.btn-mini:disabled { opacity: .4; cursor: default; }
.btn-mini-danger { border-color: var(--danger); color: var(--danger); }
.btn-mini-danger:hover { background: var(--danger-tint); }
.tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--field); color: var(--muted); }
.tag-ok { background: var(--ok-tint); color: var(--ok); }
.tag-off { background: var(--danger-tint); color: var(--danger); }
.tag-admin { background: var(--brand-tint); color: var(--brand); }
.wl-form { margin-bottom: 18px; }
.wl-row { display: flex; gap: 10px; }
.wl-row .field { flex: 1; }
.journal { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; font-size: 13px; }
.journal li { display: flex; gap: 10px; }
.pager { display: flex; gap: 18px; align-items: center; justify-content: center; margin-top: 20px; }
.admin-page .alert { margin-bottom: 14px; }
@media (max-width: 720px) { .stats { width: 100%; } .stats > div { padding: 0 12px; min-width: 0; } .wl-row { flex-direction: column; } }

/* ---------- Lot 8 : finitions ---------- */
/* Profil */
.topbar-me { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; padding: 3px 10px 3px 3px; border-radius: 999px; }
.topbar-me:hover { background: var(--field); }
.profile-main { max-width: 1100px; }
.profile-head { display: flex; align-items: center; gap: 20px; margin-bottom: 26px; }
.profile-head h1 { margin: 0; font-size: 32px; }
.profile-head p { margin: 4px 0 0; }
.bubble-lg { width: 72px; height: 72px; font-size: 24px; }
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.profile-grid .btn-inline { margin-top: 22px; }
.profile-grid .alert { margin-bottom: 8px; }
.field.is-disabled { opacity: .6; }
@media (max-width: 860px) { .profile-grid { grid-template-columns: minmax(0, 1fr); } }

/* Style « classeur » : feuille de papier et onglets d'intercalaires */
.sheet {
  background:
    linear-gradient(90deg, transparent 22px, rgba(229, 72, 77, .18) 22px 24px, transparent 24px),
    #fffefb;
  border: 1px solid #efe9df;
}
.tree-notes .tree-note, .tree-subs .tree-note { border-left: 4px solid transparent; }
.tree-notes > li > .tree-row > .tree-note { border-left-color: color-mix(in srgb, var(--c) 70%, white); border-radius: 0 8px 8px 0; }
.tree-subs .tree-note { border-left-color: color-mix(in srgb, var(--c) 35%, white); border-radius: 0 8px 8px 0; }
.note-card { border-left: 6px solid var(--c); }
.sheet-head h1 { letter-spacing: -.3px; }

/* Telephone : arborescence repliable */
.tree-toggle { display: none; width: 100%; text-align: left; border: 0; background: var(--brand-tint); color: var(--brand); font: inherit; font-weight: 600; padding: 12px 14px; border-radius: 10px; cursor: pointer; }
@media (max-width: 800px) {
  .tree-toggle { display: block; }
  .tree:not(.is-open) .tree-body { display: none; }
  .tree.is-open .tree-body { margin-top: 14px; }
  .sheet { background: #fffefb; }
}

/* ---------- Classeur : texte, notes et grille des documents ---------- */
.binder-page .content { min-height: 80px; }
.binder-notes .cards { margin-top: 4px; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.doc-tile { display: flex; flex-direction: column; gap: 6px; padding: 0; border: 0; background: none; cursor: pointer; text-align: left; font: inherit; color: var(--ink); min-width: 0; }
.doc-thumb {
  position: relative; display: grid; place-items: center; aspect-ratio: 1 / 1; overflow: hidden;
  border-radius: 12px; border: 1px solid var(--line); background: #f4f2f8; transition: transform .15s, box-shadow .15s;
}
.doc-tile:hover .doc-thumb, .doc-tile:focus-visible .doc-thumb { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(60, 40, 110, .14); border-color: var(--brand); }
.doc-thumb img, .doc-thumb canvas, .doc-thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; background: var(--white); }
.doc-ext { font-weight: 800; font-size: 18px; letter-spacing: .5px; color: var(--white); padding: 10px 14px; border-radius: 10px; background: #94A3B8; }
.has-thumb .doc-ext { position: absolute; left: 8px; bottom: 8px; font-size: 11px; padding: 3px 7px; border-radius: 6px; z-index: 1; }
.doc-thumb-pdf .doc-ext { background: #E5484D; }
.doc-thumb-image .doc-ext { background: #3B82F6; }
.doc-thumb-video .doc-ext { background: #8B5CF6; }
.doc-thumb-audio .doc-ext { background: #14B8A6; }
.doc-thumb-sheet .doc-ext { background: #16A34A; }
.doc-thumb-doc .doc-ext { background: #2563EB; }
.doc-thumb-slides .doc-ext { background: #F97316; }
.doc-thumb-archive .doc-ext { background: #6B7280; }
.doc-name { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-page { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: -4px; }
@media (max-width: 560px) { .doc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.preview-office { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: stretch; justify-content: center; }
.preview-office iframe { flex: 1; width: 100%; border: 0; background: var(--white); }
.preview-office .preview-none { text-align: center; }
.preview-note { margin: 0; padding: 6px 12px; font-size: 12px; color: var(--muted); text-align: right; background: var(--white); border-top: 1px solid var(--line); }
/* Miniatures dans la liste des fichiers joints */
.file-kind { position: relative; overflow: hidden; border: 0; padding: 0; cursor: pointer; font-family: inherit; }
.file-kind img, .file-kind video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; background: var(--white); }
.file-kind.has-thumb { box-shadow: inset 0 0 0 1px var(--line); }
.file { gap: 12px; }
.file .file-kind { width: 48px; height: 48px; }
/* Fichiers des sous-notes (lecture seule, sur la note) */
.file-kind-pdf { background: #E5484D; } .file-kind-image { background: #3B82F6; } .file-kind-video { background: #8B5CF6; }
.file-kind-audio { background: #14B8A6; } .file-kind-sheet { background: #16A34A; } .file-kind-doc { background: #2563EB; }
.file-kind-slides { background: #F97316; } .file-kind-archive { background: #6B7280; } .file-kind-text { background: #64748B; } .file-kind-other { background: #94A3B8; }
.sub-files-panel .file-meta a { color: var(--brand); text-decoration: none; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.sub-files-panel .file-meta a:hover { text-decoration: underline; }
/* La colonne de droite ne s'elargit jamais a cause d'un nom de fichier long */
.side { grid-template-columns: minmax(0, 1fr); min-width: 0; }
.panel { min-width: 0; }
/* « + » de creation dans l'arborescence */
.tree-add { display: block; width: 100%; text-align: left; border: 0; background: none; font: inherit; font-size: 13px; color: var(--muted); padding: 6px 8px 6px 12px; border-radius: 8px; cursor: pointer; }
.tree-add:hover { background: var(--brand-tint); color: var(--brand); }
.tree-add-note { padding-left: 30px; margin-top: 2px; }
.tree-head { padding-top: 4px; }
/* Bouton + « Nouveau classeur » dans l'arborescence */
.tree-head { display: flex; align-items: center; justify-content: space-between; }
.tree-plus { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: var(--white); color: var(--brand); font-size: 16px; font-weight: 700; line-height: 1; cursor: pointer; }
.tree-plus:hover { background: var(--brand-tint); border-color: var(--brand); }
/* Fenetre classeur : 20 couleurs, 16 icones */
.dialog .colors, .dialog .icons { gap: 8px; }
.dialog .colors .swatch span:not(.sr-only) { width: 30px; height: 30px; }
.dialog .icon-choice span:not(.sr-only) { width: 42px; height: 42px; }
.dialog { max-height: calc(100vh - 32px); overflow: auto; }
/* Le texte ne depasse jamais du cadre, meme colle depuis Word */
.content { max-width: 100%; overflow-x: auto; }
.content * { max-width: 100%; box-sizing: border-box; }
.content p, .content li, .content div, .content span { white-space: normal !important; }
.content table { table-layout: auto; }
/* Apercu : une grande image tient toujours entiere dans la fenetre */
.preview-body { position: relative; overflow: hidden; }
.preview-body > img, .preview-body > video {
  position: absolute; inset: 12px; width: calc(100% - 24px); height: calc(100% - 24px);
  max-width: none; max-height: none; object-fit: contain; background: transparent; cursor: zoom-in;
}
.preview-body > video { cursor: auto; }
.preview-body > iframe, .preview-body > .preview-office { position: absolute; inset: 0; width: 100%; height: 100%; }
/* Fenetre « Documents du site » (editeur) */
.site-files { width: min(640px, calc(100vw - 32px)); }
.site-files .field { margin-top: 12px; }
.sf-list { max-height: 50vh; overflow: auto; margin-top: 10px !important; }
.sf-item { cursor: pointer; border-radius: 8px; padding: 8px 6px; }
.sf-item:hover { background: var(--brand-tint); }
.sf-item .file-kind { cursor: pointer; }
.sf-item .file-name { cursor: pointer; }

/* Icone du classeur dans son dossier (arborescence) */
.folder { width: 30px; height: 23px; display: grid; place-items: center; color: var(--white); }
.folder .bicon { width: 15px; height: 15px; stroke-width: 2.2; position: relative; top: 1px; }

/* Couleurs et icones deja prises : barrees */
.swatch.is-taken, .icon-choice.is-taken { position: relative; cursor: not-allowed; opacity: .35; }
.swatch.is-taken::after, .icon-choice.is-taken::after {
  content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; background: var(--ink);
  transform: translateX(-50%) rotate(45deg); pointer-events: none; border-radius: 1px;
}
.swatch, .icon-choice { position: relative; }

/* Liens vers un site externe : petite fleche apres le texte */
.content a[href^="http"]:not([href*="cap-ergo.fr"])::after {
  content: ""; display: inline-block; width: .8em; height: .8em; margin-left: .25em; vertical-align: -.05em;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* Connexion : « Rester connecté » */
.field-after-split { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.remember { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); cursor: pointer; }
.remember input { width: 17px; height: 17px; accent-color: var(--brand); margin: 0; }

/* ---------- Barre du haut : Notice et FAQ ---------- */
.topbar-help { display: flex; gap: 4px; margin-right: 6px; }
.topbar-help a { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; text-decoration: none; color: var(--muted); padding: 6px 10px; border-radius: 8px; }
.topbar-help svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.topbar-help a:hover, .topbar-help a.is-on { background: var(--field); color: var(--brand); }
.faq-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #e5243b; color: var(--white); font-size: 11px; font-weight: 700; margin-left: 2px; }
@media (max-width: 720px) { .topbar-help a { padding: 6px 6px; } }

/* ---------- Notice ---------- */
.notice-main { max-width: 980px; }
.notice-actions { display: flex; gap: 8px; }
.notice-sheet { min-height: 0; padding: 32px 40px; }
.notice-sheet .content h2 { margin-top: 34px; padding-bottom: 6px; border-bottom: 2px solid var(--brand-tint); }
.notice-sheet .content h2:first-child { margin-top: 0; }
.notice-sheet .content figure { margin: 18px 0 26px; }
.notice-sheet .content figure img { display: block; width: 100%; border-radius: 12px; border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(60, 40, 110, .10); }
.notice-sheet .content figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); text-align: center; font-style: italic; }
.notice-sheet .content ul ul { margin-top: 4px; }
.notice-page .editor-toolbar.is-on { margin: 0 0 12px; }
@media (max-width: 720px) { .notice-sheet { padding: 20px; } }

/* ---------- FAQ ---------- */
.faq-main { max-width: 980px; }
.faq-ask textarea, .faq-form textarea {
  width: 100%; font: inherit; font-size: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--field); resize: vertical; color: var(--ink);
}
.faq-ask textarea:focus, .faq-form textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); background: var(--white); }
.faq-ask-foot, .faq-form-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; }
.faq-form-foot { justify-content: flex-end; }
.faq-filters { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin: 24px 0 14px; flex-wrap: wrap; }
.faq-filters .field { flex: 0 1 320px; }
.faq-filters .field input { padding: 10px 0; }
.faq-list { display: grid; gap: 14px; }
.faq-item { background: rgba(255, 255, 255, .96); border-radius: 14px; padding: 18px 20px; box-shadow: 0 6px 20px rgba(60, 40, 110, .07); border-left: 5px solid var(--ok); }
.faq-item.is-waiting { border-left-color: #F59E0B; }
.faq-q { display: flex; gap: 12px; align-items: flex-start; }
.faq-q-body { flex: 1; min-width: 0; }
.faq-q-text { font-weight: 600; font-size: 15px; margin-bottom: 4px; overflow-wrap: anywhere; }
.faq-tools { display: flex; gap: 6px; flex: none; }
.faq-tools form { margin: 0; }
.faq-a { margin: 14px 0 0 42px; padding: 12px 16px; border-radius: 10px; background: var(--ok-tint); }
.faq-a-label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--ok); margin-bottom: 4px; }
.faq-a-text { overflow-wrap: anywhere; margin-bottom: 4px; }
.faq-answer-btn { margin: 12px 0 0 42px; }
.faq-form { margin: 10px 0 0 42px; }
.tag-wait { background: #fff4dc; color: #8a5a00; margin-left: 6px; }
@media (max-width: 640px) { .faq-a, .faq-form, .faq-answer-btn { margin-left: 0; } .faq-q { flex-wrap: wrap; } }

/* ---------- Selecteur d'espaces (Doc / RDV / Interoception) ---------- */
.space-switch { position: relative; flex: none; }
.space-switch > summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 10px; }
.space-switch > summary::-webkit-details-marker { display: none; }
.space-switch > summary:hover, .space-switch[open] > summary { background: var(--field); }
.space-name { font-weight: 700; font-size: 13px; color: var(--brand); background: var(--brand-tint); padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.space-chevron { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.space-switch[open] .space-chevron { transform: rotate(180deg); }
.space-menu { position: absolute; top: calc(100% + 8px); left: 0; z-index: 60; width: 360px; max-width: calc(100vw - 24px); background: var(--white); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 40px rgba(30, 20, 60, .18); padding: 8px; }
.space-menu-title { margin: 6px 10px 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.space-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; text-decoration: none; color: var(--ink); }
.space-item:hover { background: var(--field); }
.space-item.is-on { background: var(--brand-tint); }
.space-item img { width: 64px; height: 56px; object-fit: contain; flex: none; background: #fff; border-radius: 8px; }
.space-item > span:not(.tag) { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.space-item small { color: var(--muted); font-size: 12px; }
.tag-soon { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #f3e8ff; color: #6b21a8; white-space: nowrap; }
.topbar-spacer { flex: 1; }
@media (max-width: 720px) { .space-name { display: none; } }

/* ---------- Pages des espaces en preparation ---------- */
.space-main { max-width: 1240px; }
.space-hero { display: flex; align-items: center; gap: 24px; background: rgba(255, 255, 255, .92); border: 1px solid var(--line); border-radius: 18px; padding: 20px 28px; margin-bottom: 24px; }
.space-hero img { width: 140px; height: auto; border-radius: 12px; }
.space-hero h1 { margin: 0 0 6px; }
.space-hero p { margin: 0 0 10px; }
.space-preview { margin: 0; background: rgba(255, 255, 255, .92); border: 1px solid var(--line); border-radius: 18px; padding: 16px; }
.space-preview figcaption { font-weight: 600; color: var(--muted); margin: 0 4px 12px; }
.space-preview img { display: block; width: 100%; height: auto; border-radius: 12px; box-shadow: 0 6px 24px rgba(30, 20, 60, .12); }
@media (max-width: 720px) { .space-hero { flex-direction: column; text-align: center; } }
.topbar { position: relative; z-index: 50; }

/* ---------- Choix de l'espace a la connexion ---------- */
.space-pick { position: relative; }
.space-pick > summary { list-style: none; display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 6px 14px 6px 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--field); }
.space-pick > summary::-webkit-details-marker { display: none; }
.space-pick[open] > summary, .space-pick > summary:focus-visible { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); background: var(--white); outline: none; }
.space-pick > summary img, .space-pick .space-item img { width: 52px; height: 46px; object-fit: contain; flex: none; background: #fff; border-radius: 8px; }
.space-pick > summary > span { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; text-align: left; }
.space-pick small { color: var(--muted); font-size: 12px; }
.space-pick[open] .space-chevron { transform: rotate(180deg); }
.space-pick-list { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 20; background: var(--white); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(30, 20, 60, .18); padding: 6px; }
.space-pick .space-item { cursor: pointer; }
.space-pick .space-item input { position: absolute; opacity: 0; pointer-events: none; }
.space-pick .space-item:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: -2px; }

/* Barre du haut sur telephone : Notice et FAQ en icones, tout tient dans la largeur */
@media (max-width: 720px) {
  .topbar-user { flex-wrap: wrap; justify-content: flex-end; gap: 6px; min-width: 0; }
  .topbar-help { margin-right: 0; gap: 2px; }
  .topbar-help a { font-size: 0; gap: 0; padding: 7px; }
  .topbar-help a .faq-badge { font-size: 11px; margin-left: 4px; }
  .topbar-admin { font-size: 12px; padding: 6px 8px; margin-right: 0; }
  .topbar-user .btn-link { font-size: 12px; }
}

/* ---------- Ordre personnel des classeurs (profil) ---------- */
.profile-order { grid-column: 1 / -1; }
.order-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; max-width: 640px; }
.order-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--white); border: 1px solid var(--line); border-left: 6px solid var(--c); border-radius: 10px; cursor: grab; transition: background .2s; }
.order-item.is-dragging { opacity: .5; }
.order-item.is-moved { background: var(--brand-tint); }
.order-grip { color: var(--muted); letter-spacing: -3px; font-size: 13px; }
.order-icon { color: var(--c); display: flex; }
.order-icon .bicon { width: 22px; height: 22px; }
.order-title { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.order-move { border: 1px solid var(--line); background: var(--field); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; color: var(--brand); font-size: 12px; }
.order-move:hover:not(:disabled) { background: var(--brand-tint); }
.order-move:disabled { opacity: .35; cursor: default; }
.order-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

/* Retour aux classeurs (notice, FAQ) */
.back-link { display: inline-flex; align-items: center; gap: 4px; margin: 0 0 8px -4px; padding: 4px 10px 4px 4px; border-radius: 8px; color: var(--brand); font-weight: 600; font-size: 14px; text-decoration: none; }
.back-link:hover { background: var(--brand-tint); }
.back-link svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* Un element marque « hidden » reste toujours cache (sinon .btn et autres le reaffichaient) */
[hidden] { display: none !important; }

/* Barre d'outils du texte toujours affichee (grisee tant qu'on n'ecrit pas) ; messages dans la ligne d'auteur */
.page-body .editor-toolbar.is-on, .editor-toolbar.is-on { margin: -6px 0 14px; min-height: 52px; }
.editor-toolbar.is-on:not(.is-writing) .tox .tox-editor-header { box-shadow: none !important; background: var(--field) !important; }
.editor-toolbar.is-on:not(.is-writing) .tox .tox-toolbar, .editor-toolbar.is-on:not(.is-writing) .tox .tox-toolbar__primary,
.editor-toolbar.is-on:not(.is-writing) .tox .tox-toolbar__overflow { background: transparent !important; }
.byline .editor-msg { margin: 0 0 0 auto; padding: 6px 12px; }
.byline .readonly-tag + .editor-msg { margin-left: 12px; }

/* ---------- Colonne de droite repliable ---------- */
.side-toggle { justify-self: end; display: inline-flex; align-items: center; gap: 4px; margin-bottom: -6px; padding: 4px 12px 4px 6px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 255, 255, .92); color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.side-toggle:hover { color: var(--brand); background: var(--white); border-color: var(--brand); }
.side-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.workspace.is-side-hidden { grid-template-columns: 280px minmax(0, 1fr) 44px; }
.workspace.is-side-hidden .side > :not(.side-toggle) { display: none; }
.workspace.is-side-hidden .side-toggle { justify-self: center; writing-mode: vertical-rl; padding: 14px 8px 12px; border-radius: 14px; gap: 8px; margin: 0; }
.workspace.is-side-hidden .side-toggle svg { transform: rotate(180deg); }
@media (max-width: 1200px) {
  .workspace.is-side-hidden { grid-template-columns: 250px minmax(0, 1fr); }
  .workspace.is-side-hidden .side-toggle { writing-mode: horizontal-tb; justify-self: end; padding: 4px 12px 4px 6px; border-radius: 999px; }
  .workspace.is-side-hidden .side-toggle svg { transform: rotate(90deg); }
  .side-toggle svg { transform: rotate(-90deg); }
}
@media (max-width: 800px) {
  .workspace.is-side-hidden { grid-template-columns: minmax(0, 1fr); }
}
