/* ── VARIABLES ─────────────────────────────────────────────────────── */
:root{
  --bg:#0e0f14;--bg2:#141620;--bg3:#1a1d2e;--bg4:#20243a;
  --surface:#23283d;--surface2:#2a3050;
  --border:rgba(255,255,255,.07);--border2:rgba(255,255,255,.12);
  --accent:#5b6af0;--accent2:#7b8bff;--accent-glow:rgba(91,106,240,.2);
  --teal:#2dd4bf;--teal-dim:rgba(45,212,191,.15);
  --amber:#f59e0b;--amber-dim:rgba(245,158,11,.15);
  --rose:#f43f5e;--rose-dim:rgba(244,63,94,.15);
  --green:#10b981;--green-dim:rgba(16,185,129,.15);
  --text:#e8eaf5;--text2:#9499b8;--text3:#5a6080;
  --font-serif:'DM Serif Display',serif;--font-sans:'DM Sans',sans-serif;
  --radius:10px;--radius-lg:16px;--sidebar-w:260px;--header-h:60px;
}
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
body{font-family:var(--font-sans);background:var(--bg);color:var(--text);min-height:100vh;overflow-x:hidden}
a{color:inherit;text-decoration:none}
button{cursor:pointer;font-family:inherit}
input,select,textarea{font-family:inherit}

/* ── SCREENS ───────────────────────────────────────────────────────── */
.screen{display:none;min-height:100vh}
.screen.active{display:flex}

/* ── LOGIN ─────────────────────────────────────────────────────────── */
#screen-login{flex-direction:column;align-items:center;justify-content:center;
  background:radial-gradient(ellipse 80% 60% at 50% 0%,rgba(91,106,240,.12) 0%,transparent 70%),var(--bg);padding:2rem}
.login-card{background:var(--bg2);border:1px solid var(--border2);border-radius:var(--radius-lg);
  width:100%;max-width:420px;padding:2.5rem}
.login-logo{display:flex;align-items:center;gap:10px;margin-bottom:2rem}
.login-logo .icon-mark{width:38px;height:38px;background:var(--accent);border-radius:10px;
  display:flex;align-items:center;justify-content:center;font-size:18px}
.login-logo h1{font-family:var(--font-serif);font-size:1.5rem;font-weight:400}
.login-title{font-size:1.15rem;font-weight:500;margin-bottom:.3rem}
.login-sub{color:var(--text2);font-size:.85rem;margin-bottom:2rem}
.auth-methods{display:flex;flex-direction:column;gap:10px;margin-bottom:1.5rem}
.btn-auth{display:flex;align-items:center;gap:12px;padding:.75rem 1.1rem;background:var(--surface);
  border:1px solid var(--border2);border-radius:var(--radius);color:var(--text);font-size:.88rem;
  font-weight:500;transition:all .2s;width:100%}
.btn-auth:hover{background:var(--surface2);border-color:var(--accent)}
.btn-auth .auth-icon{width:28px;height:28px;border-radius:6px;display:flex;align-items:center;justify-content:center;font-size:14px}
.btn-auth .auth-tag{margin-left:auto;font-size:10px;padding:2px 8px;border-radius:20px;font-weight:600;letter-spacing:.04em}
.tag-ldap{background:rgba(91,106,240,.2);color:var(--accent2)}
.tag-oidc{background:rgba(45,212,191,.2);color:var(--teal)}
.divider{display:flex;align-items:center;gap:12px;color:var(--text3);font-size:.8rem;margin-bottom:1.5rem}
.divider::before,.divider::after{content:'';flex:1;height:1px;background:var(--border)}
.form-field{margin-bottom:1rem}
.form-field label{display:block;font-size:.8rem;color:var(--text2);margin-bottom:6px}
.form-field input{width:100%;padding:.7rem .9rem;background:var(--bg3);border:1px solid var(--border2);
  border-radius:var(--radius);color:var(--text);font-size:.88rem;transition:border-color .2s}
.form-field input:focus{outline:none;border-color:var(--accent)}
.btn-primary{width:100%;padding:.75rem;background:var(--accent);border:none;border-radius:var(--radius);
  color:#fff;font-weight:600;font-size:.92rem;transition:opacity .2s;margin-top:.5rem;display:flex;
  align-items:center;justify-content:center;gap:8px}
.btn-primary:hover{opacity:.88}
.btn-primary:disabled{opacity:.5;cursor:not-allowed}
.mfa-hint{margin-top:1rem;text-align:center;font-size:.78rem;color:var(--text3);
  display:flex;align-items:center;justify-content:center;gap:6px}
.login-error{color:var(--rose);font-size:.82rem;margin-top:.75rem;text-align:center;display:none}

/* ── LANGUAGE SWITCHER ─────────────────────────────────────── */
.lang-switcher{display:flex;align-items:center;gap:2px;background:var(--bg3);
  border:1px solid var(--border2);border-radius:20px;padding:2px;height:30px}
.lang-btn{background:none;border:none;color:var(--text3);font-size:.72rem;font-weight:600;
  padding:2px 8px;border-radius:16px;cursor:pointer;letter-spacing:.04em;transition:all .15s;height:24px}
.lang-btn:hover{color:var(--text)}
.lang-btn-active{background:var(--accent)!important;color:#fff!important}
.login-lang-bar{display:flex;justify-content:center;margin-top:1.25rem}
.topbar-lang{margin-left:2px}
/* ── BIBLIOTHÈQUE EXPLORATEUR ───────────────────────────────────── */
.lib-layout{display:flex;gap:0;min-height:calc(100vh - var(--header-h) - 4rem);margin:0;padding:0;position:relative}
.lib-main{flex:1;padding:0;min-width:0;position:relative}
/* Onglets vue bibliothèque */
.lib-view-tabs{display:flex;gap:.2rem;margin-bottom:.85rem;border-bottom:1px solid var(--border);padding-bottom:0}
.lib-view-tab{background:none;border:none;border-bottom:2px solid transparent;cursor:pointer;padding:.4rem .85rem .55rem;
  font-size:.82rem;color:var(--text3);transition:all .15s;border-radius:var(--radius) var(--radius) 0 0;margin-bottom:-1px}
.lib-view-tab:hover{background:var(--bg3);color:var(--text2)}
.lib-view-tab.active{color:var(--accent2);font-weight:500;border-bottom-color:var(--accent2)}
/* Grille imports récents */
#lib-activity-feed{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:.75rem;align-items:start}
.lib-icard{background:var(--bg2);border:1px solid var(--border);border-radius:var(--radius);
  display:flex;flex-direction:column;overflow:hidden;transition:border-color .15s,box-shadow .15s}
.lib-icard:hover{border-color:var(--border2);box-shadow:0 2px 12px rgba(0,0,0,.12)}
.lib-icard-top{padding:.9rem 1rem .65rem;flex:1;display:flex;flex-direction:column;gap:.45rem}
.lib-icard-head{display:flex;align-items:flex-start;gap:.7rem}
.lib-icard-icon{width:38px;height:38px;border-radius:8px;background:var(--bg3);display:flex;
  align-items:center;justify-content:center;font-size:1.25rem;flex-shrink:0}
.lib-icard-title-wrap{flex:1;min-width:0}
.lib-icard-name{font-size:.84rem;font-weight:500;color:var(--text);overflow:hidden;text-overflow:ellipsis;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;line-height:1.35;margin-bottom:.2rem}
.lib-icard-loc{font-size:.72rem;color:var(--text3);display:flex;align-items:center;gap:4px;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.lib-icard-divider{height:1px;background:var(--border);margin:0 -.0rem}
.lib-icard-meta-row{display:flex;align-items:center;gap:.6rem}
.lib-icard-avatar{width:24px;height:24px;border-radius:50%;background:var(--accent);
  display:flex;align-items:center;justify-content:center;font-size:.6rem;font-weight:700;
  color:#fff;flex-shrink:0;letter-spacing:.02em}
.lib-icard-meta-text{font-size:.74rem;color:var(--text3);flex:1;min-width:0}
.lib-icard-meta-text strong{color:var(--text2);font-weight:500}
.lib-icard-badges{display:flex;gap:.35rem;flex-wrap:wrap;align-items:center}
.lib-icard-badge-latest{font-size:.63rem;font-weight:700;padding:2px 7px;border-radius:3px;
  background:rgba(91,106,240,.15);color:var(--accent2);letter-spacing:.04em}
.lib-icard-badge-ver{font-size:.63rem;font-weight:600;padding:2px 7px;border-radius:3px;
  background:var(--bg4);color:var(--text3);display:flex;align-items:center;gap:3px;cursor:pointer;
  border:none;transition:background .12s}
.lib-icard-badge-ver:hover{background:var(--bg3);color:var(--text2)}
.lib-icard-actions{display:flex;border-top:1px solid var(--border)}
.lib-icard-act-btn{flex:1;background:none;border:none;cursor:pointer;padding:.5rem .4rem;
  font-size:.76rem;color:var(--text3);display:flex;align-items:center;justify-content:center;
  gap:5px;transition:background .12s,color .12s;text-decoration:none}
.lib-icard-act-btn:not(:last-child){border-right:1px solid var(--border)}
.lib-icard-act-btn:hover{background:var(--bg3);color:var(--text)}
.lib-icard-act-btn.primary{color:var(--accent2)}.lib-icard-act-btn.primary:hover{background:rgba(91,106,240,.08)}
.lib-tree-item{display:flex;align-items:center;gap:7px;padding:.38rem .85rem;
  font-size:.82rem;cursor:pointer;color:var(--text2);transition:background .1s;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.lib-tree-item:hover{background:var(--bg3);color:var(--text)}
.lib-tree-item.active{background:rgba(91,106,240,.1);color:var(--accent2);font-weight:500}
.lib-tree-item.lib-drop-over{background:rgba(91,106,240,.18)!important;outline:1px dashed var(--accent2);color:var(--accent2)}
.lib-folder-chip{display:inline-flex;align-items:center;gap:5px;padding:.3rem .65rem;
  background:var(--bg3);border:1px solid var(--border);border-radius:20px;
  font-size:.78rem;cursor:pointer;color:var(--text2);transition:all .15s;position:relative}
.lib-folder-chip:hover{border-color:var(--accent2);color:var(--accent2)}
.lib-folder-chip.lib-drop-over{border-color:var(--accent)!important;background:rgba(91,106,240,.12)!important}
.lib-folder-chip-back{color:var(--text3)}.lib-folder-chip-add{border-style:dashed;color:var(--text3)}
.lib-chip-del{background:none;border:none;cursor:pointer;color:var(--text3);font-size:9px;padding:0 0 0 3px;line-height:1;display:none;transition:color .15s}
.lib-folder-chip:hover .lib-chip-del{display:inline}
.lib-chip-del:hover{color:var(--rose)!important}
.lib-tree-chev{font-size:8px;width:9px;flex-shrink:0;transition:transform .15s}
/* ── EXPLORATEUR DE FICHIERS ────────────────────────────────────── */
#explorer-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(148px,1fr));gap:.65rem}
.ec{position:relative;background:var(--bg2);border:1px solid var(--border);border-radius:var(--radius);
  padding:.9rem .85rem .75rem;cursor:pointer;transition:border-color .15s,background .15s;
  display:flex;flex-direction:column;gap:.25rem;min-height:110px;user-select:none}
.ec:hover{border-color:var(--border2);background:var(--bg3)}
.ec.ec-back{opacity:.65}.ec.ec-back:hover{opacity:1}
.ec.ec-add{border-style:dashed;border-color:var(--border)}.ec.ec-add:hover{border-color:var(--accent2);background:rgba(91,106,240,.05)}
.ec-icon{font-size:2rem;line-height:1.2;margin-bottom:.15rem}
.ec-name{font-size:.82rem;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1.3}
.ec-meta{font-size:.7rem;color:var(--text3);line-height:1.3}
.ec-badge{display:inline-block;font-size:.62rem;font-weight:700;padding:1px 5px;border-radius:3px;margin-bottom:.25rem;letter-spacing:.04em;align-self:flex-start}
.ec-actions{position:absolute;top:5px;right:5px;display:none;gap:3px}
.ec:hover .ec-actions{display:flex}
.ec-actions button,.ec-actions a{background:var(--bg4);border:none;border-radius:4px;
  color:var(--text2);font-size:10px;cursor:pointer;padding:3px 5px;display:flex;align-items:center;line-height:1;text-decoration:none}
.ec-actions button:hover,.ec-actions a:hover{background:var(--surface);color:var(--text)}
.ec-actions .del:hover{color:var(--rose)}
/* Drag & drop overlay */
.ec-folder-target.drag-over{border-color:var(--accent)!important;background:rgba(91,106,240,.12)!important;box-shadow:0 0 0 2px rgba(91,106,240,.3)}
.ec[draggable="true"]{cursor:grab}.ec[draggable="true"]:active{cursor:grabbing;opacity:.7}
/* ── Dossier card redesign ──────────────────────────────────────── */
.ec-folder{border-top:3px solid var(--fcol,#f59e0b);padding-top:.7rem;min-height:118px;gap:.2rem}
.ec-folder:hover{border-top-color:var(--fcol,#f59e0b)!important}
.ec-folder-icon{font-size:2.4rem;line-height:1;color:var(--fcol,#f59e0b);margin-bottom:.3rem;transition:transform .15s}
.ec-folder:hover .ec-folder-icon{transform:scale(1.08)}
.ec-folder-count{position:absolute;top:7px;right:7px;font-size:.62rem;font-weight:600;
  background:var(--bg3);color:var(--text3);border-radius:10px;padding:.1rem .45rem;
  border:1px solid var(--border);transition:opacity .12s;pointer-events:none}
.ec-folder-dots{position:absolute;top:5px;right:5px;background:var(--bg4);border:none;
  border-radius:5px;color:var(--text2);font-size:.78rem;padding:3px 6px;
  cursor:pointer;opacity:0;pointer-events:none;transition:opacity .12s;
  display:flex;align-items:center;z-index:2;line-height:1}
.ec-folder:hover .ec-folder-count{opacity:0}
.ec-folder:hover .ec-folder-dots{opacity:1;pointer-events:auto}
.ec-folder-dots:hover{color:var(--text);background:var(--surface)}
/* ── Folder context menu ─────────────────────────────────────── */
#folder-ctx-menu{min-width:180px}
/* ── Color picker ─────────────────────────────────────────────── */
.folder-color-picker{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:.85rem}
.fcp-swatch{width:22px;height:22px;border-radius:50%;cursor:pointer;
  border:2px solid transparent;transition:transform .12s,border-color .12s;flex-shrink:0}
.fcp-swatch:hover{transform:scale(1.2)}
.fcp-swatch.selected{border-color:#fff;box-shadow:0 0 0 2px rgba(255,255,255,.35);transform:scale(1.15)}
#explorer-drop-overlay{position:fixed;inset:0;z-index:500;display:none;flex-direction:column;
  align-items:center;justify-content:center;gap:1rem;
  background:rgba(14,15,20,.85);backdrop-filter:blur(4px);pointer-events:none}
#explorer-drop-overlay i{font-size:3.5rem;color:var(--accent2)}
#explorer-drop-overlay p{font-size:1.1rem;font-weight:500;color:var(--text)}
#explorer-drop-overlay small{font-size:.82rem;color:var(--text3)}
.page-documents-wrap.drag-active #explorer-drop-overlay{display:flex}
/* Legacy folder-card (kept for spaces overview) */
.folder-card{position:relative;background:var(--bg2);border:1px solid var(--border);border-radius:var(--radius);
  padding:1rem;cursor:pointer;transition:border-color .2s,background .2s;display:flex;flex-direction:column;gap:.3rem}
.folder-card:hover{border-color:var(--border2);background:var(--bg3)}
.folder-card-back{opacity:.7}.folder-card-back:hover{opacity:1}
.folder-card-add{border-style:dashed;opacity:.6}.folder-card-add:hover{opacity:1;border-color:var(--accent)}
.folder-icon{font-size:1.6rem;line-height:1}
.folder-name{font-weight:500;font-size:.9rem}
.folder-count{font-size:.75rem;color:var(--text3)}
.folder-del-btn{position:absolute;top:6px;right:6px;background:none;border:none;
  color:var(--text3);font-size:11px;cursor:pointer;padding:3px 5px;border-radius:4px;display:none}
.folder-card:hover .folder-del-btn{display:block}
.folder-del-btn:hover{color:var(--rose);background:var(--bg4)}
#folder-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:.75rem;margin-bottom:1.25rem}
/* ── Wiki Bookshelf ────────────────────────────────────────────── */
/* Category filter chips */
.cat-chips{display:flex;gap:.4rem;flex-wrap:wrap;margin-bottom:1rem;grid-column:1/-1;align-items:center}
button.cat-chip,div.cat-chip{display:inline-flex;align-items:center;gap:.35rem;background:var(--bg3);border:1px solid var(--border2);border-radius:20px;padding:.25rem .75rem;font-size:.75rem;color:var(--text2);cursor:pointer;transition:all .15s;line-height:1.5;user-select:none}
button.cat-chip:hover,div.cat-chip:hover{border-color:var(--accent2);color:var(--accent2)}
button.cat-chip.active,div.cat-chip.active{background:var(--accent2);border-color:var(--accent2);color:#fff}
.cat-chip-actions{display:inline-flex;gap:1px;margin-left:2px}
.cat-chip-btn{display:inline-flex;align-items:center;justify-content:center;padding:0 3px;cursor:pointer;font-size:.62rem;color:inherit;opacity:.55;line-height:1;border-radius:3px;transition:opacity .15s,color .15s}
.cat-chip-btn:hover{opacity:1}
.cat-chip-btn.del:hover{color:var(--rose)}
.cat-chip-btn.edit:hover{color:var(--accent2)}
/* Sidebar category labels */
.nav-cat-label{display:flex;align-items:center;gap:4px;font-size:.62rem;font-weight:700;color:var(--text3);text-transform:uppercase;letter-spacing:.06em;padding:.55rem 1.2rem .2rem;margin-top:.15rem}
.nav-cat-label .nav-cat-name{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.nav-cat-actions{display:none;gap:1px;flex-shrink:0}
.nav-cat-label:hover .nav-cat-actions{display:inline-flex}
.nav-cat-btn{background:none;border:none;padding:2px 4px;cursor:pointer;font-size:.6rem;color:var(--text3);border-radius:3px;line-height:1;transition:color .15s}
.nav-cat-btn:hover{color:var(--text)}
.nav-cat-btn.del:hover{color:var(--rose)}
.shelf-section{margin-bottom:2rem}
.shelf-label{display:flex;align-items:center;gap:.6rem;font-size:.68rem;font-weight:700;
  letter-spacing:.09em;text-transform:uppercase;color:var(--text3);margin-bottom:.85rem}
.shelf-label::after{content:'';flex:1;height:1px;background:var(--border)}
.shelf-label i{font-size:.75rem}
.shelf-del,.shelf-rename{display:none}
.book-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:1rem;margin-bottom:.25rem}
.book-card{position:relative;background:var(--bg2);border-radius:var(--radius);
  border:1px solid var(--border);border-left:4px solid var(--bcol,#5b6af0);
  padding:1rem .95rem .85rem;min-height:158px;cursor:pointer;
  display:flex;flex-direction:column;transition:transform .15s,box-shadow .15s,border-color .15s}
.book-card:hover{transform:translateY(-3px);box-shadow:0 8px 24px rgba(0,0,0,.16);border-color:var(--border2)}
.book-icon{font-size:1.65rem;color:var(--bcol,#5b6af0);margin-bottom:.4rem;line-height:1}
.book-name{font-weight:600;font-size:.88rem;line-height:1.3;color:var(--text)}
.book-desc{font-size:.72rem;color:var(--text3);margin-top:.25rem;overflow:hidden;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;flex:1}
.book-meta{font-size:.64rem;color:var(--text3);margin-top:.6rem;display:flex;align-items:center;gap:.35rem}
.book-actions{position:absolute;top:5px;right:5px;display:none;gap:3px}
.book-card:hover .book-actions{display:flex}
.book-actions button{background:var(--bg4);border:none;border-radius:4px;
  color:var(--text2);font-size:10px;cursor:pointer;padding:3px 5px;display:flex;align-items:center;line-height:1}
.book-actions button:hover{background:var(--surface);color:var(--text)}
.book-actions button.del:hover{color:var(--rose)}
/* Type toggle in create-space modal */
.type-toggle{display:flex;gap:.5rem;margin-bottom:.1rem}
.type-toggle label{flex:1;display:flex;align-items:center;gap:.5rem;padding:.55rem .75rem;
  border:1px solid var(--border2);border-radius:var(--radius);cursor:pointer;
  font-size:.8rem;color:var(--text2);transition:border-color .15s,background .15s}
.type-toggle label:hover{border-color:var(--accent2);background:rgba(91,106,240,.05)}
.type-toggle input[type=radio]{display:none}
.type-toggle input[type=radio]:checked + span{color:var(--text)}
.type-toggle label:has(input:checked){border-color:var(--accent2);background:rgba(91,106,240,.07)}
/* ── SIDEBAR TREE ───────────────────────────────────────────────── */
.nav-space-row{gap:6px}
.nav-add-sm{opacity:.6}
.nav-add-sm:hover{opacity:1}
/* ── METHOD BADGE ───────────────────────────────────────────────── */
.method-badge{display:none;align-items:center;gap:8px;padding:.5rem .85rem;
  background:rgba(91,106,240,.1);border:1px solid rgba(91,106,240,.3);border-radius:var(--radius);
  font-size:.8rem;color:var(--accent2);margin-bottom:1rem}
.method-badge button{margin-left:auto;background:none;border:none;color:var(--text3);font-size:.75rem;
  cursor:pointer;padding:.2rem .5rem;border-radius:4px}
.method-badge button:hover{color:var(--text);background:var(--surface)}
.mfa-error{color:var(--rose);font-size:.82rem;margin-top:.5rem;text-align:center;display:none}

/* ── MODALS ─────────────────────────────────────────────────────────── */
.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.65);display:none;
  align-items:center;justify-content:center;z-index:2000;padding:1rem}
.modal-overlay.open{display:flex}
.modal-box{background:var(--bg2);border:1px solid var(--border2);border-radius:var(--radius-lg);
  width:100%;max-width:480px;padding:2rem;position:relative}
.modal-box.wide{max-width:680px}
.modal-close{position:absolute;top:1rem;right:1rem;width:28px;height:28px;background:transparent;
  border:none;color:var(--text3);font-size:16px;border-radius:6px;display:flex;align-items:center;justify-content:center}
.modal-close:hover{background:var(--bg3);color:var(--text)}
.modal-title{font-size:1.1rem;font-weight:500;margin-bottom:.4rem}
.modal-sub{font-size:.82rem;color:var(--text2);margin-bottom:1.5rem}

/* MFA */
.mfa-card{text-align:center}
.mfa-card .otp-inputs{display:flex;gap:8px;justify-content:center;margin:1.5rem 0}
.otp-inputs input{width:46px;height:54px;text-align:center;font-size:1.4rem;font-weight:600;
  background:var(--bg3);border:1px solid var(--border2);border-radius:var(--radius);
  color:var(--text);font-family:monospace}
.otp-inputs input:focus{outline:none;border-color:var(--accent);background:var(--bg4)}

/* Share */
.share-url-row{display:flex;gap:8px;margin-bottom:1rem}
.share-url-row input{flex:1;padding:.55rem .85rem;background:var(--bg3);border:1px solid var(--border2);
  border-radius:var(--radius);color:var(--text2);font-size:.84rem}
.share-options{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.share-opt{display:flex;align-items:center;gap:8px;padding:.6rem .85rem;background:var(--bg3);
  border:1px solid var(--border);border-radius:8px;font-size:.82rem;color:var(--text2);cursor:pointer;transition:all .15s}
.share-opt:hover{border-color:var(--accent);color:var(--text)}
.share-opt i{color:var(--accent2)}

/* Search */
.search-input-wrap{position:relative;margin-bottom:1rem}
.search-input-wrap input{width:100%;padding:.75rem 1rem .75rem 2.75rem;background:var(--bg3);
  border:1px solid var(--border2);border-radius:var(--radius);color:var(--text);font-size:1rem}
.search-input-wrap input:focus{outline:none;border-color:var(--accent)}
.search-input-wrap i{position:absolute;left:1rem;top:50%;transform:translateY(-50%);color:var(--text3);font-size:16px}
.search-results{max-height:440px;overflow-y:auto}
.search-result-item{display:flex;align-items:flex-start;gap:10px;padding:.7rem .85rem;border-radius:8px;
  cursor:pointer;transition:background .15s}
.search-result-item:hover{background:var(--bg3)}
.search-result-item .sr-icon{width:32px;height:32px;border-radius:7px;display:flex;align-items:center;
  justify-content:center;font-size:13px;flex-shrink:0;margin-top:2px}
.search-result-item .sr-info{flex:1;min-width:0}
.search-result-item .sr-title{font-size:.88rem;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.search-result-item .sr-meta{font-size:.72rem;color:var(--text3)}
.search-result-item .sr-snippet{font-size:.75rem;color:var(--text2);margin-top:.25rem;
  line-height:1.5;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.search-result-item .sr-snippet mark{background:rgba(91,106,240,.25);color:var(--text);
  border-radius:2px;padding:0 2px;font-style:normal}
.search-hint{font-size:.75rem;color:var(--text3);text-align:center;padding:.5rem;display:flex;align-items:center;justify-content:center;gap:8px}
.search-hint kbd{background:var(--bg4);border:1px solid var(--border2);border-radius:4px;padding:1px 6px;font-family:monospace;font-size:.72rem}

/* Upload */
.drop-zone{border:2px dashed var(--border2);border-radius:var(--radius-lg);padding:2rem;text-align:center;
  cursor:pointer;transition:all .2s;margin-bottom:1rem}
.drop-zone:hover,.drop-zone.drag-over{border-color:var(--accent);background:rgba(91,106,240,.04)}
.drop-zone i{font-size:2rem;color:var(--text3);margin-bottom:.75rem;display:block}
.drop-zone p{font-size:.88rem;color:var(--text2);margin-bottom:.3rem}
.drop-zone small{font-size:.75rem;color:var(--text3)}
.file-list{display:flex;flex-direction:column;gap:6px;max-height:200px;overflow-y:auto}
.file-item{display:flex;align-items:center;gap:10px;padding:.5rem .75rem;background:var(--bg3);
  border-radius:8px;font-size:.82rem}
.file-item .fi-icon{font-size:1.1rem;flex-shrink:0}
.file-item .fi-name{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.file-item .fi-size{font-size:.72rem;color:var(--text3);white-space:nowrap}
.file-item .fi-rm{background:transparent;border:none;color:var(--text3);padding:2px 5px;border-radius:4px}
.file-item .fi-rm:hover{color:var(--rose);background:var(--rose-dim)}
.upload-progress{height:3px;background:var(--bg4);border-radius:3px;margin-top:4px;overflow:hidden}
.upload-progress-bar{height:100%;background:var(--accent);border-radius:3px;width:0;transition:width .3s}

/* Confirm */
.confirm-actions{display:flex;gap:8px;margin-top:1.5rem;justify-content:flex-end}

/* Notifications panel */
#panel-notif{position:fixed;top:var(--header-h);right:1rem;width:320px;background:var(--bg2);
  border:1px solid var(--border2);border-radius:var(--radius-lg);z-index:500;
  box-shadow:0 8px 32px rgba(0,0,0,.4);display:none;overflow:hidden}
#panel-notif.open{display:block}
.notif-header{padding:.85rem 1rem;border-bottom:1px solid var(--border);
  display:flex;align-items:center;justify-content:space-between;font-size:.88rem;font-weight:500}
.notif-item{display:flex;gap:10px;padding:.75rem 1rem;border-bottom:1px solid var(--border);
  font-size:.82rem;cursor:pointer;transition:background .15s}
.notif-item:hover{background:var(--bg3)}
.notif-item:last-child{border-bottom:none}
.notif-item.unread{background:rgba(91,106,240,.05)}
.notif-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0;margin-top:4px}
.notif-text{flex:1;line-height:1.5;color:var(--text2)}
.notif-text b{color:var(--text);font-weight:500}
.notif-time{font-size:.7rem;color:var(--text3);white-space:nowrap;margin-top:2px}
.notif-badge{position:absolute;top:6px;right:6px;width:16px;height:16px;background:var(--rose);
  border-radius:50%;font-size:.6rem;color:#fff;display:flex;align-items:center;justify-content:center;
  font-weight:700;line-height:1}

/* ── APP LAYOUT ─────────────────────────────────────────────────────── */
#screen-app{flex-direction:row}
.sidebar{width:var(--sidebar-w);background:var(--bg2);border-right:1px solid var(--border);
  display:flex;flex-direction:column;height:100vh;position:fixed;top:0;left:0;overflow:hidden;z-index:100}
.sidebar-header{height:var(--header-h);display:flex;align-items:center;gap:10px;
  padding:0 1rem;border-bottom:1px solid var(--border);flex-shrink:0}
.sidebar-logo{width:30px;height:30px;background:var(--accent);border-radius:8px;
  display:flex;align-items:center;justify-content:center;font-size:14px;flex-shrink:0}
.sidebar-logo-text{font-family:var(--font-serif);font-size:1.1rem;white-space:nowrap}
.sidebar-search{padding:.75rem;flex-shrink:0}
.sidebar-search input{width:100%;padding:.5rem .75rem .5rem 2.2rem;background:var(--bg3);
  border:1px solid var(--border);border-radius:8px;color:var(--text);font-size:.82rem;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%235a6080' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.868-3.834zm-5.242 1.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:8px center}
.sidebar-search input:focus{outline:none;border-color:var(--accent)}
.sidebar-nav{flex:1;overflow-y:auto;padding:.5rem 0}
.sidebar-nav::-webkit-scrollbar{width:3px}
.sidebar-nav::-webkit-scrollbar-thumb{background:var(--border2);border-radius:3px}
.nav-section-label{font-size:.68rem;font-weight:600;letter-spacing:.08em;color:var(--text3);
  text-transform:uppercase;padding:.75rem 1rem .3rem}
.nav-item{display:flex;align-items:center;gap:8px;padding:.42rem 1rem;font-size:.84rem;
  color:var(--text2);cursor:pointer;transition:all .15s;position:relative}
.nav-item:hover{color:var(--text);background:var(--bg3)}
.nav-item.active{color:var(--accent2);background:rgba(91,106,240,.1)}
.nav-item.active::before{content:'';position:absolute;left:0;top:4px;bottom:4px;width:3px;
  background:var(--accent);border-radius:0 2px 2px 0}
.nav-item i{width:16px;font-size:13px;flex-shrink:0}
.nav-item .badge{margin-left:auto;font-size:10px;background:var(--accent);color:#fff;
  border-radius:10px;padding:1px 6px;font-weight:600}
.nav-tree-item{display:flex;align-items:center;gap:6px;padding:.35rem 1rem .35rem 2rem;
  font-size:.8rem;color:var(--text3);cursor:pointer;transition:all .15s;border-radius:var(--radius)}
.nav-tree-item:hover{color:var(--text2)}
.nav-tree-item.active{color:var(--accent2)}
.nav-tree-item.selected{background:rgba(91,106,240,.14);color:var(--text)}
/* Sous-niveaux (dossiers/documents) : indentation + ligne de guidage façon explorateur de fichiers */
.nav-tree-children{margin-left:13px;padding-left:9px;border-left:1px solid var(--border)}
.nav-tree-item.nav-tree-sub{padding:.32rem .6rem .32rem .5rem}
.nav-space-opts{display:none;background:none;border:none;padding:2px 4px;border-radius:3px;cursor:pointer;color:var(--text3);font-size:10px;flex-shrink:0;line-height:1}
.nav-space-row:hover .nav-space-opts{display:flex;align-items:center}
.nav-space-opts:hover{color:var(--text);background:var(--bg4)}
.space-ctx-menu{position:fixed;background:var(--bg2);border:1px solid var(--border2);border-radius:var(--radius);box-shadow:0 4px 16px rgba(0,0,0,.25);z-index:9999;min-width:150px;padding:4px 0;display:none}
.space-ctx-menu.open{display:block}
.space-ctx-item{display:flex;align-items:center;gap:8px;padding:.45rem .85rem;font-size:.8rem;cursor:pointer;color:var(--text2);transition:background .1s}
.space-ctx-item:hover{background:var(--bg3);color:var(--text)}
.space-ctx-item.danger:hover{background:rgba(251,113,133,.1);color:var(--rose)}
.space-ctx-item i{width:13px;font-size:11px;text-align:center}
.nav-tree-item i{font-size:11px}
.sidebar-footer{padding:.75rem;border-top:1px solid var(--border);flex-shrink:0}
.user-pill{display:flex;align-items:center;gap:8px;padding:.5rem .75rem;background:var(--bg3);
  border-radius:var(--radius)}
.user-pill .user-info{flex:1;min-width:0;cursor:pointer}
.user-info .name{font-size:.82rem;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.user-info .role{font-size:.7rem;color:var(--text3)}
.avatar{width:28px;height:28px;border-radius:50%;background:linear-gradient(135deg,var(--accent),var(--teal));
  display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:600;flex-shrink:0}

/* ── TOPBAR ─────────────────────────────────────────────────────────── */
.main-wrap{margin-left:var(--sidebar-w);flex:1;display:flex;flex-direction:column;min-height:100vh}
.topbar{height:var(--header-h);background:var(--bg2);border-bottom:1px solid var(--border);
  display:flex;align-items:center;padding:0 1.5rem;gap:1rem;position:sticky;top:0;z-index:50}
.topbar-breadcrumb{flex:1;display:flex;align-items:center;gap:6px;font-size:.84rem;color:var(--text2)}
.topbar-breadcrumb span:last-child{color:var(--text)}
.topbar-breadcrumb .sep{color:var(--text3)}
.topbar-actions{display:flex;align-items:center;gap:8px}
.btn-icon{width:34px;height:34px;background:transparent;border:1px solid var(--border2);border-radius:8px;
  color:var(--text2);display:flex;align-items:center;justify-content:center;font-size:14px;
  transition:all .15s;position:relative}
.btn-icon:hover{background:var(--surface);color:var(--text)}
.btn-sm{display:flex;align-items:center;gap:6px;padding:.4rem .9rem;background:var(--accent);
  border:none;border-radius:8px;color:#fff;font-size:.82rem;font-weight:500;transition:opacity .15s;cursor:pointer}
.btn-sm:hover{opacity:.85}
.btn-sm-outline{display:flex;align-items:center;gap:6px;padding:.4rem .9rem;background:transparent;
  border:1px solid var(--border2);border-radius:8px;color:var(--text2);font-size:.82rem;
  font-weight:500;transition:all .15s;cursor:pointer}
.btn-sm-outline:hover{background:var(--surface);color:var(--text)}
.btn-danger-sm{display:flex;align-items:center;gap:6px;padding:.4rem .9rem;background:var(--rose-dim);
  border:1px solid rgba(244,63,94,.3);border-radius:8px;color:var(--rose);font-size:.82rem;
  font-weight:500;transition:all .15s;cursor:pointer}
.btn-danger-sm:hover{background:var(--rose);color:#fff}
.main-content{flex:1;padding:2rem;overflow-y:auto}

/* ── PAGES ──────────────────────────────────────────────────────────── */
.page{display:none}
.page.active{display:block}
.page-title{font-family:var(--font-serif);font-size:2rem;font-weight:400;margin-bottom:.3rem}
.page-sub{color:var(--text2);font-size:.88rem;margin-bottom:2rem}

/* ── COMMON COMPONENTS ──────────────────────────────────────────────── */
.card{background:var(--bg2);border:1px solid var(--border);border-radius:var(--radius-lg);padding:1.25rem;overflow:hidden}
.card-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:1.25rem}
.card-title{font-size:.88rem;font-weight:500;display:flex;align-items:center;gap:8px}
.card-title i{color:var(--text3)}
.stat-card{background:var(--bg2);border:1px solid var(--border);border-radius:var(--radius-lg);padding:1.25rem}
.stat-label{font-size:.75rem;color:var(--text3);text-transform:uppercase;letter-spacing:.06em;margin-bottom:.5rem}
.stat-val{font-size:1.8rem;font-weight:600;margin-bottom:.2rem}
.stat-delta{font-size:.75rem;color:var(--green);display:flex;align-items:center;gap:4px}
.doc-item{display:flex;align-items:center;gap:10px;padding:.6rem .75rem;border-radius:8px;cursor:pointer;transition:background .15s}
.doc-item:hover{background:var(--bg3)}
.doc-icon{width:30px;height:30px;border-radius:7px;display:flex;align-items:center;justify-content:center;font-size:13px;flex-shrink:0}
.doc-info{flex:1;min-width:0}
.doc-name{font-size:.84rem;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.doc-meta{font-size:.72rem;color:var(--text3)}
.doc-badge{font-size:.7rem;padding:2px 8px;border-radius:10px;font-weight:500;flex-shrink:0;white-space:nowrap}
.badge-draft{background:var(--amber-dim);color:var(--amber)}
.badge-published{background:var(--green-dim);color:var(--green)}
.badge-review{background:rgba(91,106,240,.2);color:var(--accent2)}
.version-tag{font-size:.7rem;padding:2px 7px;background:var(--bg4);border:1px solid var(--border2);
  border-radius:6px;color:var(--text2);font-family:monospace}
.mention{color:var(--accent2);font-weight:500}
.activity-item{display:flex;gap:10px;padding:.6rem 0;border-bottom:1px solid var(--border);font-size:.8rem}
.activity-item:last-child{border-bottom:none}
.activity-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0;margin-top:4px}
.activity-text{color:var(--text2);line-height:1.4}
.activity-text b{color:var(--text);font-weight:500}
.activity-time{color:var(--text3);font-size:.72rem;margin-top:2px}
.empty-state{text-align:center;padding:3rem 1rem;color:var(--text3)}
.empty-state i{font-size:2rem;margin-bottom:.75rem;display:block}
.spinner{width:22px;height:22px;border:2px solid var(--border2);border-top-color:var(--accent);
  border-radius:50%;animation:spin .7s linear infinite;display:inline-block;flex-shrink:0}
@keyframes spin{to{transform:rotate(360deg)}}

/* ── DASHBOARD ──────────────────────────────────────────────────────── */
.stats-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:1rem;margin-bottom:2rem}
.dashboard-grid{display:grid;grid-template-columns:2fr 1fr;gap:1.5rem}
.user-hero{background:linear-gradient(135deg,rgba(91,106,240,.15) 0%,rgba(45,212,191,.08) 100%);
  border:1px solid rgba(91,106,240,.2);border-radius:var(--radius-lg);padding:1.75rem;
  margin-bottom:1.5rem;display:flex;align-items:center;gap:1.5rem}
.user-hero-avatar{width:56px;height:56px;border-radius:50%;background:linear-gradient(135deg,var(--accent),var(--teal));
  display:flex;align-items:center;justify-content:center;font-size:1.3rem;font-weight:600;flex-shrink:0}
.user-hero-text{min-width:0;flex:1}
.user-hero-text h2{font-family:var(--font-serif);font-size:1.5rem;font-weight:400;margin-bottom:.2rem}
.user-hero-text p{font-size:.85rem;color:var(--text2)}
.user-quick-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:.75rem;margin-left:auto;flex-shrink:0;min-width:240px}
.uqs-item{background:rgba(255,255,255,.04);border-radius:var(--radius);padding:.75rem 1rem;text-align:center}
.uqs-val{font-size:1.4rem;font-weight:600}
.uqs-label{font-size:.7rem;color:var(--text3);margin-top:2px}
.fav-card{display:flex;align-items:center;gap:10px;padding:.75rem .9rem;background:var(--bg3);
  border:1px solid var(--border);border-radius:var(--radius);cursor:pointer;transition:all .2s;position:relative}
.fav-card:hover{border-color:var(--accent);background:rgba(91,106,240,.06)}
.fav-icon{width:34px;height:34px;border-radius:8px;display:flex;align-items:center;justify-content:center;font-size:14px;flex-shrink:0}
.fav-body{flex:1;min-width:0}
.fav-name{font-size:.84rem;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.fav-space{font-size:.72rem;color:var(--text3);margin-top:1px}
.fav-unpin{width:22px;height:22px;background:transparent;border:none;color:var(--text3);border-radius:4px;
  display:flex;align-items:center;justify-content:center;font-size:11px;opacity:0;transition:opacity .15s;flex-shrink:0}
.fav-card:hover .fav-unpin{opacity:1}
.fav-unpin:hover{color:var(--rose);background:var(--rose-dim)}
.fav-add{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;
  padding:.75rem;background:transparent;border:1px dashed var(--border2);border-radius:var(--radius);
  cursor:pointer;transition:all .2s;min-height:64px}
.fav-add:hover{border-color:var(--accent);background:rgba(91,106,240,.04)}

/* ── DOCUMENTS ──────────────────────────────────────────────────────── */
.toolbar{display:flex;align-items:center;gap:10px;margin-bottom:1.5rem}
.toolbar-search{flex:1;position:relative}
.toolbar-search input{width:100%;padding:.55rem .85rem .55rem 2.4rem;background:var(--bg2);
  border:1px solid var(--border2);border-radius:var(--radius);color:var(--text);font-size:.85rem}
.toolbar-search input:focus{outline:none;border-color:var(--accent)}
.toolbar-search i{position:absolute;left:10px;top:50%;transform:translateY(-50%);color:var(--text3);font-size:13px}
.filters{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:1.5rem}
.filter-chip{padding:.3rem .75rem;background:var(--bg2);border:1px solid var(--border2);border-radius:20px;
  font-size:.78rem;color:var(--text2);cursor:pointer;transition:all .15s}
.filter-chip:hover{border-color:var(--accent);color:var(--accent2)}
.filter-chip.active{background:rgba(91,106,240,.15);border-color:var(--accent);color:var(--accent2)}
.folder-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:1rem;margin-bottom:2rem}
.folder-card{background:var(--bg2);border:1px solid var(--border);border-radius:var(--radius-lg);
  padding:1rem;cursor:pointer;transition:all .2s}
.folder-card:hover{border-color:var(--border2);background:var(--bg3);transform:translateY(-1px)}
.folder-card .folder-icon{font-size:1.5rem;margin-bottom:.75rem}
.folder-card .folder-name{font-size:.88rem;font-weight:500;margin-bottom:.2rem}
.folder-card .folder-count{font-size:.75rem;color:var(--text3)}
.docs-table{width:100%;border-collapse:collapse}
.docs-table th{text-align:left;font-size:.73rem;color:var(--text3);text-transform:uppercase;
  letter-spacing:.06em;padding:0 1rem .75rem;font-weight:500;border-bottom:1px solid var(--border)}
.docs-table td{padding:.85rem 1rem;font-size:.84rem;border-bottom:1px solid var(--border)}
.docs-table tr:last-child td{border-bottom:none}
.docs-table tr:hover td{background:var(--bg3);cursor:pointer}
.docs-table .doc-title-cell{display:flex;align-items:center;gap:10px}

/* ── DOC VIEW ───────────────────────────────────────────────────────── */
.doc-view-layout{display:grid;grid-template-columns:1fr 280px;gap:2rem}
.doc-body{background:var(--bg2);border:1px solid var(--border);border-radius:var(--radius-lg);padding:2.5rem}
.doc-heading{font-family:var(--font-serif);font-size:2.2rem;font-weight:400;margin-bottom:.5rem;line-height:1.2}
.doc-meta-row{display:flex;align-items:center;gap:1rem;padding:1rem 0;
  border-top:1px solid var(--border);border-bottom:1px solid var(--border);
  margin-bottom:2rem;font-size:.8rem;color:var(--text2);flex-wrap:wrap}
.doc-meta-row .meta-item{display:flex;align-items:center;gap:5px}
.doc-content p{font-size:.92rem;line-height:1.75;color:var(--text);margin-bottom:1.2rem}
.doc-content h2{font-family:var(--font-serif);font-size:1.4rem;font-weight:400;margin:2rem 0 .75rem}
.doc-content h3{font-size:1rem;font-weight:600;margin:1.5rem 0 .5rem}
.doc-content h4{font-size:.9rem;font-weight:600;margin:1.2rem 0 .4rem;color:var(--text2)}
.doc-content code{font-family:monospace;background:var(--bg3);padding:2px 6px;border-radius:4px;font-size:.85em;color:var(--teal)}
.doc-content pre{background:var(--bg3);border:1px solid var(--border);border-radius:var(--radius);padding:1.25rem;margin:1.25rem 0;overflow-x:auto}
.doc-content pre code{background:none;padding:0;font-size:.84rem;color:var(--text)}
.doc-content blockquote{background:rgba(91,106,240,.08);border-left:3px solid var(--accent);
  border-radius:0 var(--radius) var(--radius) 0;padding:1rem 1.25rem;margin:1.25rem 0;font-size:.88rem}
.doc-content ul,.doc-content ol{padding-left:1.5rem;margin-bottom:1.2rem}
.doc-content li{font-size:.92rem;line-height:1.75;margin-bottom:.3rem}
.doc-content strong{font-weight:600}
.doc-content table{width:100%;border-collapse:collapse;margin:1.2rem 0;font-size:.85rem}
.doc-content th{background:var(--bg3);padding:.5rem .75rem;text-align:left;font-weight:500;border:1px solid var(--border2)}
.doc-content td{padding:.5rem .75rem;border:1px solid var(--border)}
.doc-content hr{border:none;border-top:1px solid var(--border);margin:1.5rem 0}
.doc-sidebar-panel{display:flex;flex-direction:column;gap:1rem}
.side-card{background:var(--bg2);border:1px solid var(--border);border-radius:var(--radius-lg);padding:1rem}
.side-card-title{font-size:.75rem;font-weight:600;color:var(--text3);text-transform:uppercase;
  letter-spacing:.06em;margin-bottom:.75rem;display:flex;align-items:center;gap:6px}
.version-list{display:flex;flex-direction:column;gap:2px}
.ver-item{display:flex;align-items:center;gap:8px;padding:.5rem .6rem;border-radius:7px;cursor:pointer;transition:background .15s}
.ver-item:hover{background:var(--bg3)}
.ver-item.current{background:rgba(91,106,240,.1)}
.ver-num{font-family:monospace;font-size:.8rem;font-weight:600;color:var(--accent2)}
.ver-info{flex:1;min-width:0}
.ver-msg{font-size:.78rem;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ver-date{font-size:.7rem;color:var(--text3)}
.toc-list{list-style:none}
.toc-list li{padding:.3rem 0;font-size:.8rem;color:var(--text2);cursor:pointer;
  border-left:2px solid transparent;padding-left:.5rem;transition:all .15s}
.toc-list li:hover{color:var(--accent2);border-left-color:var(--accent)}
.toc-list li.sub{padding-left:1.25rem;font-size:.75rem}
.contrib-list{display:flex;gap:4px;flex-wrap:wrap}
.contrib-avatar{width:28px;height:28px;border-radius:50%;background:linear-gradient(135deg,var(--accent),var(--teal));
  display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:600;
  cursor:pointer;position:relative}
.contrib-avatar::after{content:attr(data-name);position:absolute;bottom:calc(100% + 4px);left:50%;
  transform:translateX(-50%);background:var(--bg4);color:var(--text);font-size:.7rem;padding:3px 7px;
  border-radius:5px;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .15s}
.contrib-avatar:hover::after{opacity:1}

/* ── DIAGRAMS ───────────────────────────────────────────────────────── */
.drawio-topbar{display:flex;align-items:center;gap:10px;margin-bottom:1rem;flex-wrap:wrap}
.drawio-topbar h1{font-family:var(--font-serif);font-size:1.6rem;font-weight:400;flex:1}
.drawio-wrapper{border-radius:var(--radius-lg);overflow:hidden;border:1px solid var(--border);
  display:flex;flex-direction:column;min-height:580px}
.drawio-info-bar{display:flex;align-items:center;gap:10px;padding:.5rem 1rem;
  background:var(--bg3);border-bottom:1px solid var(--border);font-size:.78rem;color:var(--text2);flex-shrink:0}
.di-badge{padding:2px 8px;border-radius:6px;font-size:.72rem;font-weight:600}
.drawio-iframe-wrap{flex:1;position:relative;background:var(--bg);min-height:540px}
.drawio-iframe-wrap iframe{width:100%;height:100%;border:none;display:block;min-height:540px}
.drawio-loading{position:absolute;inset:0;display:flex;flex-direction:column;
  align-items:center;justify-content:center;gap:.75rem;background:var(--bg2);
  font-size:.88rem;color:var(--text2);transition:opacity .4s}
.drawio-loading.hidden{opacity:0;pointer-events:none}
.drawio-bottom{display:grid;grid-template-columns:1fr 1fr;gap:1rem;margin-top:1rem}
.legend-item{display:flex;align-items:center;gap:8px;padding:.3rem 0;font-size:.82rem;color:var(--text2)}
.legend-dot{width:14px;height:14px;border-radius:4px;flex-shrink:0}

/* ── SETTINGS ───────────────────────────────────────────────────────── */
.settings-layout{display:grid;grid-template-columns:200px 1fr;gap:2rem}
.settings-nav{display:flex;flex-direction:column;gap:2px}
.settings-nav-item{padding:.5rem .75rem;border-radius:8px;font-size:.84rem;color:var(--text2);
  cursor:pointer;display:flex;align-items:center;gap:8px;transition:all .15s}
.settings-nav-item:hover{color:var(--text);background:var(--bg3)}
.settings-nav-item.active{color:var(--accent2);background:rgba(91,106,240,.1)}
.settings-section{background:var(--bg2);border:1px solid var(--border);border-radius:var(--radius-lg);padding:1.5rem;margin-bottom:1rem}
.settings-section h3{font-size:.95rem;font-weight:500;margin-bottom:.3rem}
.settings-section p.desc{font-size:.8rem;color:var(--text2);margin-bottom:1.5rem}
.setting-row{display:flex;align-items:flex-start;justify-content:space-between;gap:1.5rem;
  padding:1rem 0;border-top:1px solid var(--border)}
.setting-row:first-of-type{border-top:none;padding-top:0}
.setting-info label{font-size:.84rem;font-weight:500;display:block;margin-bottom:.2rem}
.setting-info span{font-size:.78rem;color:var(--text2)}
.toggle{position:relative;width:44px;height:24px;flex-shrink:0}
.toggle input{opacity:0;width:0;height:0;position:absolute}
.toggle-slider{position:absolute;inset:0;background:var(--bg4);border-radius:24px;cursor:pointer;transition:background .2s}
.toggle-slider::before{content:'';position:absolute;width:18px;height:18px;left:3px;top:3px;
  background:white;border-radius:50%;transition:transform .2s}
.toggle input:checked+.toggle-slider{background:var(--accent)}
.toggle input:checked+.toggle-slider::before{transform:translateX(20px)}
.ldap-config{display:grid;grid-template-columns:1fr 1fr;gap:1rem;margin-top:1rem}
.config-field label{display:block;font-size:.78rem;color:var(--text2);margin-bottom:5px}
.config-field input,.config-field select{width:100%;padding:.5rem .7rem;background:var(--bg3);
  border:1px solid var(--border2);border-radius:8px;color:var(--text);font-size:.84rem}
.config-field input:focus{outline:none;border-color:var(--accent)}
.provider-cards{display:grid;grid-template-columns:repeat(3,1fr);gap:1rem;margin-top:1rem}
.provider-card{background:var(--bg3);border:1px solid var(--border2);border-radius:var(--radius);
  padding:1rem;display:flex;flex-direction:column;align-items:center;gap:8px;cursor:pointer;
  transition:all .2s;text-align:center}
.provider-card:hover{border-color:var(--accent)}
.provider-card.connected{border-color:var(--green);background:var(--green-dim)}
.provider-card .p-icon{font-size:1.6rem}
.provider-card .p-name{font-size:.82rem;font-weight:500}
.provider-card .p-status{font-size:.72rem}

/* ── THEME PANEL ────────────────────────────────────────────────────── */
.theme-layout{display:grid;grid-template-columns:1fr 360px;gap:1.5rem;align-items:start}
.theme-grid{display:grid;grid-template-columns:1fr 1fr;gap:1rem}
/* Grille palettes */
.palette-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:1rem}
@media(max-width:1000px){.palette-grid{grid-template-columns:repeat(2,1fr)}}
@media(max-width:500px){.palette-grid{grid-template-columns:1fr 1fr}}
.palette-card{border-radius:var(--radius-lg);border:2px solid var(--border);overflow:hidden;
  cursor:pointer;transition:all .22s;user-select:none;position:relative}
.palette-card:hover{transform:translateY(-3px);box-shadow:0 10px 28px rgba(0,0,0,.3)}
.palette-card.active{border-color:var(--accent)!important;box-shadow:0 0 0 3px var(--accent-glow),0 10px 28px rgba(0,0,0,.3)}
.pal-preview{height:100px;position:relative;overflow:hidden}
.pal-info{padding:.65rem .9rem;display:flex;align-items:center;justify-content:space-between;gap:.5rem}
.pal-name{font-size:.84rem;font-weight:600}
.pal-mode{font-size:.58rem;font-weight:700;padding:2px 8px;border-radius:3px;letter-spacing:.07em;text-transform:uppercase}
.pal-check{position:absolute;top:.5rem;right:.5rem;width:22px;height:22px;
  background:var(--accent);color:#fff;border-radius:50%;font-size:.72rem;font-weight:700;
  display:grid;place-items:center;opacity:0;transition:opacity .2s}
.palette-card.active .pal-check{opacity:1}
.pal-add-slot{display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:.5rem;height:100px;background:var(--bg3);border:2px dashed var(--border2);
  transition:border-color .2s,background .2s}
.palette-card:hover .pal-add-slot{border-color:var(--accent2);background:var(--bg4)}
.pal-add-icon{width:32px;height:32px;border-radius:50%;background:var(--bg4);
  display:grid;place-items:center;font-size:.9rem;color:var(--text3);transition:all .2s}
.palette-card:hover .pal-add-icon{background:var(--accent-glow);color:var(--accent2)}
/* Éditeur palette personnalisée */
.cpe-panel{background:var(--bg2);border:1px solid var(--border2);border-radius:var(--radius-lg);
  padding:1.25rem 1.5rem;margin-top:1rem;display:none}
.cpe-panel.open{display:block}
.cpe-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:1.1rem}
.cpe-head-title{font-size:.9rem;font-weight:500;display:flex;align-items:center;gap:.5rem}
.cpe-body{display:grid;grid-template-columns:1fr 190px;gap:1.5rem;align-items:start}
@media(max-width:700px){.cpe-body{grid-template-columns:1fr}}
.cpe-fields{display:flex;flex-direction:column;gap:.9rem}
.cpe-field label{display:block;font-size:.76rem;color:var(--text2);font-weight:500;margin-bottom:.4rem}
.cpe-name-input{width:100%;padding:.45rem .7rem;background:var(--bg3);border:1px solid var(--border2);
  border-radius:var(--radius);color:var(--text);font-size:.84rem}
.cpe-name-input:focus{outline:none;border-color:var(--accent)}
.cpe-mode-row{display:flex;gap:.4rem}
.cpe-mode-btn{flex:1;padding:.4rem .6rem;border-radius:var(--radius);font-size:.78rem;font-weight:500;
  border:1px solid var(--border2);background:var(--bg3);color:var(--text2);cursor:pointer;transition:all .15s}
.cpe-mode-btn.active{background:var(--accent);color:#fff;border-color:var(--accent)}
.cpe-color-row{display:flex;align-items:center;gap:.6rem}
.cpe-color-row input[type=color]{width:36px;height:32px;border:1px solid var(--border2);
  border-radius:6px;background:var(--bg3);padding:2px;cursor:pointer;flex-shrink:0}
.cpe-color-row input[type=text]{flex:1;padding:.4rem .6rem;background:var(--bg3);
  border:1px solid var(--border2);border-radius:var(--radius);color:var(--text);font-size:.82rem}
.cpe-color-row input[type=text]:focus{outline:none;border-color:var(--accent)}
.cpe-preview-card{border-radius:var(--radius);overflow:hidden;border:2px solid var(--border2);
  height:100%;min-height:155px}
.cpe-footer{display:flex;justify-content:flex-end;gap:.5rem;margin-top:1.1rem;
  padding-top:1rem;border-top:1px solid var(--border)}
.theme-field label{display:block;font-size:.78rem;color:var(--text2);margin-bottom:6px;font-weight:500}
.color-row{display:flex;align-items:center;gap:8px}
.color-row input[type=color]{width:38px;height:32px;border:1px solid var(--border2);
  border-radius:6px;background:var(--bg3);padding:2px;cursor:pointer}
.color-row input[type=text]{flex:1;padding:.4rem .6rem;background:var(--bg3);border:1px solid var(--border2);
  border-radius:6px;color:var(--text);font-family:monospace;font-size:.82rem}
.color-row input[type=text]:focus{outline:none;border-color:var(--accent)}
.color-preview{width:24px;height:24px;border-radius:5px;border:1px solid var(--border2);flex-shrink:0}
.theme-preview-box{border:1px solid var(--border2);border-radius:var(--radius-lg);overflow:hidden;font-size:.8rem}
.css-preview-block{margin-top:1rem;background:var(--bg3);border:1px solid var(--border);
  border-radius:var(--radius);padding:.75rem;max-height:160px;overflow-y:auto}

/* ── BODY MODAL LOCK ─────────────────────────────────────────────────── */
body.modal-open{overflow:hidden}

/* ── TOAST ──────────────────────────────────────────────────────────── */
#toast{position:fixed;bottom:1.5rem;right:1.5rem;background:var(--bg2);border:1px solid var(--border2);
  border-radius:var(--radius);padding:.75rem 1.25rem;font-size:.85rem;z-index:9999;
  display:none;align-items:center;gap:10px;max-width:340px;box-shadow:0 8px 32px rgba(0,0,0,.4);
  animation:slideup .2s ease}
#toast.show{display:flex}
#toast.t-success{border-color:var(--green)}
#toast.t-error{border-color:var(--rose)}
#toast.t-info{border-color:var(--accent)}
@keyframes slideup{from{transform:translateY(10px);opacity:0}to{transform:translateY(0);opacity:1}}

/* ── MISC ───────────────────────────────────────────────────────────── */
.tag-pill{font-size:.72rem;padding:2px 8px;border-radius:20px;font-weight:500}
.progress-bar{height:6px;background:var(--bg4);border-radius:4px}
.progress-fill{height:100%;border-radius:4px;transition:width .3s}
.sep-h{height:1px;background:var(--border);margin:1rem 0}

/* ── PROFIL UTILISATEUR ─────────────────────────────────────────── */
.profile-hero{background:var(--bg2);border:1px solid var(--border);border-radius:var(--radius-lg);
  padding:1.75rem 2rem;display:flex;align-items:center;gap:1.5rem;margin-bottom:1.25rem;position:relative}
.profile-avatar-wrap{position:relative;cursor:pointer;flex-shrink:0}
.profile-avatar-ring{width:86px;height:86px;border-radius:50%;
  background:linear-gradient(135deg,var(--accent),var(--teal));
  display:flex;align-items:center;justify-content:center;
  font-size:1.9rem;font-weight:700;color:#fff;overflow:hidden;
  border:3px solid var(--border2);transition:border-color .2s}
.profile-avatar-wrap:hover .profile-avatar-ring{border-color:var(--accent2)}
.profile-avatar-lens{position:absolute;inset:0;border-radius:50%;background:rgba(0,0,0,.45);
  display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .2s}
.profile-avatar-wrap:hover .profile-avatar-lens{opacity:1}
.profile-hero-info{flex:1;min-width:0}
.profile-hero-name{font-size:1.25rem;font-weight:600;margin-bottom:.35rem;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.profile-hero-badges{display:flex;gap:.4rem;align-items:center;flex-wrap:wrap}
.profile-role-tag{font-size:.65rem;font-weight:700;padding:3px 9px;border-radius:20px;
  background:var(--accent-glow);color:var(--accent2);letter-spacing:.05em;text-transform:uppercase}
.profile-source-tag{font-size:.65rem;font-weight:700;padding:3px 9px;border-radius:20px;
  letter-spacing:.05em;text-transform:uppercase}
.profile-grid{display:grid;grid-template-columns:1fr 1fr;gap:1rem;margin-bottom:1rem}
@media(max-width:720px){.profile-grid{grid-template-columns:1fr}}
/* CPE modal overlay */
.cpe-overlay{position:fixed;inset:0;background:rgba(0,0,0,.6);z-index:2000;
  display:none;align-items:center;justify-content:center;backdrop-filter:blur(4px);padding:1rem}
.cpe-overlay.open{display:flex}
.cpe-box{background:var(--bg2);border:1px solid var(--border2);border-radius:var(--radius-lg);
  width:min(780px,100%);max-height:calc(100vh - 2rem);overflow-y:auto;padding:1.5rem}
.cpe-colors-grid{display:grid;grid-template-columns:1fr 1fr;gap:.55rem}
.cpe-group-label{grid-column:1/-1;font-size:.7rem;font-weight:700;color:var(--text3);
  text-transform:uppercase;letter-spacing:.08em;padding:.6rem 0 .3rem;
  border-top:1px solid var(--border);margin-top:.3rem}
.cpe-group-label:first-child{border-top:none;margin-top:0;padding-top:0}
.cpe-color-field label{display:block;font-size:.74rem;color:var(--text2);font-weight:500;margin-bottom:.3rem}
/* ── FILE CARDS (Bibliothèque) ──────────────────────────────────── */
.file-card{background:var(--bg2);border:1px solid var(--border);border-radius:var(--radius-lg);
  overflow:hidden;cursor:pointer;transition:all .2s;display:flex;flex-direction:column}
.file-card:hover{border-color:var(--border2);transform:translateY(-1px);box-shadow:0 4px 16px rgba(0,0,0,.25)}
/* ── Multi-sélection ── */
.file-card.selected{border-color:var(--accent)!important;background:rgba(91,106,240,.06)!important;transform:none}
.fc-cb{position:absolute;top:6px;left:6px;width:16px;height:16px;border-radius:4px;
  border:1.5px solid rgba(255,255,255,.5);background:rgba(0,0,0,.35);
  display:none;align-items:center;justify-content:center;z-index:3;cursor:pointer;
  color:#fff;font-size:9px;transition:all .12s}
.file-card:hover .fc-cb,.file-card.selected .fc-cb{display:flex}
.file-card.selected .fc-cb{background:var(--accent);border-color:var(--accent)}
/* Toolbar sélection (remplace les filtres quand sélection active) */
#lib-sel-toolbar{display:none;align-items:center;gap:.5rem;animation:fadeIn .15s}
#lib-sel-toolbar.active{display:flex}
.sel-count{font-size:.82rem;font-weight:600;color:var(--accent2);white-space:nowrap}
.sel-action{display:inline-flex;align-items:center;gap:4px;padding:.3rem .7rem;
  border-radius:6px;border:1px solid var(--border2);background:var(--bg3);
  font-size:.76rem;font-weight:500;color:var(--text2);cursor:pointer;transition:all .12s}
.sel-action:hover{border-color:var(--accent2);color:var(--accent2);background:var(--bg4)}
.sel-action.red:hover{border-color:var(--rose);color:var(--rose)}
.sel-cancel{background:none;border:none;cursor:pointer;color:var(--text3);padding:.25rem .4rem;
  border-radius:4px;font-size:.78rem;transition:color .12s}
.sel-cancel:hover{color:var(--text)}
/* ── Grille favoris dashboard ── */
.fav-items{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:.6rem;padding:.1rem 0}
.fav-item{display:flex;align-items:center;gap:.8rem;padding:.9rem 1rem;
  background:var(--bg3);border:1px solid var(--border);border-radius:var(--radius);
  cursor:pointer;transition:all .18s;position:relative}
.fav-item:hover{background:rgba(91,106,240,.07);border-color:var(--accent);box-shadow:0 2px 10px var(--accent-glow)}
.fav-item-icon{width:38px;height:38px;border-radius:10px;display:flex;align-items:center;
  justify-content:center;font-size:1.05rem;flex-shrink:0}
.fav-item-body{flex:1;min-width:0}
.fav-item-name{font-size:.84rem;font-weight:500;color:var(--text);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.fav-item-loc{font-size:.7rem;color:var(--text3);margin-top:2px;display:flex;align-items:center;gap:4px}
.fav-item-rm{opacity:0;background:none;border:none;cursor:pointer;color:var(--text3);
  padding:4px;border-radius:4px;transition:all .12s;flex-shrink:0}
.fav-item:hover .fav-item-rm{opacity:1}
.fav-item-rm:hover{color:var(--rose);background:var(--rose-dim)}
.fav-empty{display:flex;flex-direction:column;align-items:center;gap:.6rem;padding:2.5rem 1rem;
  color:var(--text3);font-size:.82rem;text-align:center}
.fav-empty i{font-size:2rem;opacity:.3}
.fav-footer{padding:.5rem .25rem .1rem;border-top:1px solid var(--border);margin-top:.5rem}
@keyframes fadeIn{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}
.file-card-thumb{height:100px;display:flex;align-items:center;justify-content:center;
  font-size:2.8rem;position:relative;overflow:hidden;background:var(--bg3)}
.file-card-thumb iframe,.file-card-thumb embed{width:100%;height:100%;border:none;pointer-events:none}
.file-card-body{padding:.6rem .75rem;flex:1}
.file-card-name{font-size:.82rem;font-weight:500;margin-bottom:.2rem;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.file-card-meta{font-size:.7rem;color:var(--text3);line-height:1.4}
.file-card-actions{display:flex;gap:0;border-top:1px solid var(--border);background:var(--bg3);height:32px}
.file-card-actions button,.file-card-actions a{
  flex:1;display:flex;align-items:center;justify-content:center;gap:3px;
  padding:0;font-size:.75rem;font-weight:500;transition:all .15s;
  background:transparent;border:none;color:var(--text3);cursor:pointer;text-decoration:none;
  border-right:1px solid var(--border);white-space:nowrap;overflow:hidden}
.file-card-actions button:last-child,.file-card-actions a:last-child{border-right:none}
.file-card-actions button:hover,.file-card-actions a:hover{background:var(--bg4);color:var(--text)}
.file-card-actions .fca-del:hover{background:var(--rose-dim);color:var(--rose)}
.file-card-actions .fca-ver:hover{background:var(--accent-glow);color:var(--accent2)}
.file-card-actions .fca-dots{font-size:1rem;letter-spacing:.1em;color:var(--text3)}
.file-card-actions .fca-dots:hover{color:var(--text);background:var(--bg4)}
.fca-badge{font-size:.6rem;background:var(--accent);color:#fff;border-radius:8px;
  padding:0 4px;line-height:1.5;font-weight:700;margin-left:1px}
.file-type-badge{position:absolute;top:8px;right:8px;font-size:.62rem;padding:2px 7px;
  border-radius:5px;font-weight:700;letter-spacing:.05em;text-transform:uppercase}
.file-ver-badge{position:absolute;top:8px;left:8px;background:var(--accent);color:#fff;
  font-size:.6rem;font-weight:700;padding:2px 7px;border-radius:5px;letter-spacing:.04em;cursor:pointer}
.file-ver-badge:hover{background:var(--accent2)}
/* Panneau versions style GitHub */
.ver-timeline{display:flex;flex-direction:column;gap:0}
.ver-entry{display:flex;gap:.85rem;padding:.9rem 1rem;border-bottom:1px solid var(--border);
  position:relative;transition:background .15s}
.ver-entry:last-child{border-bottom:none}
.ver-entry:hover{background:var(--bg3)}
.ver-entry.ver-latest{background:rgba(91,106,240,.06);border-left:3px solid var(--accent)}
.ver-dot{width:10px;height:10px;border-radius:50%;background:var(--border2);border:2px solid var(--bg2);
  flex-shrink:0;margin-top:5px}
.ver-entry.ver-latest .ver-dot{background:var(--accent)}
.ver-tag{display:inline-block;font-size:.65rem;font-weight:700;padding:1px 7px;
  border-radius:10px;letter-spacing:.04em;margin-bottom:.25rem}
.ver-tag-latest{background:rgba(16,185,129,.2);color:var(--green);border:1px solid rgba(16,185,129,.3)}
.ver-tag-old{background:var(--bg4);color:var(--text3);border:1px solid var(--border)}

/* ── WORD EDITOR toolbar buttons ────────────────────────────── */
.wbtn{background:transparent;border:1px solid transparent;border-radius:3px;color:#bbb;
  padding:.2rem .4rem;cursor:pointer;font-size:12px;display:flex;align-items:center;
  justify-content:center;min-width:26px;height:26px;transition:all .1s;font-family:inherit;flex-shrink:0}
.wbtn:hover{background:#3a3a3a;border-color:#666;color:#fff}
.wbtn:active{background:#4472c4;color:#fff}
#word-toolbar{overflow-x:auto;overflow-y:hidden;scrollbar-width:thin;scrollbar-color:#444 transparent;flex-wrap:nowrap!important}
#word-toolbar::-webkit-scrollbar{height:4px}
#word-toolbar::-webkit-scrollbar-thumb{background:#555;border-radius:2px}
#word-scroll-zone{flex:1;overflow-y:auto;min-height:0}
#modal-word{height:100vh}
/* Word document content styles (inside editor) */
#word-content h1{font-size:24pt;font-weight:bold;margin:.5em 0 .2em;color:#2e74b5!important}
#word-content h2{font-size:18pt;font-weight:bold;margin:.5em 0 .2em;color:#2e74b5!important}
#word-content h3{font-size:14pt;font-weight:bold;margin:.4em 0 .15em;color:#1f4e79!important}
#word-content h4{font-size:12pt;font-weight:bold;font-style:italic;margin:.3em 0 .1em;color:#1f4e79!important}
#word-content p{margin:0 0 .5em;color:#000!important}
#word-content ul,#word-content ol{margin:.3em 0 .5em 1.5em;padding:0}
#word-content li{margin:.1em 0;color:#000!important}
#word-content table{border-collapse:collapse!important;margin:.5em 0;width:100%}
#word-content td,#word-content th{border:1px solid #999!important;padding:.3em .5em!important;font-size:11pt;color:#000!important;background-color:#fff}
#word-content th{background:#d9e1f2!important;font-weight:bold}
#word-content tr:nth-child(even) td{background:#f8f9fa!important}
#word-content pre,#word-content code{font-family:Consolas,'Courier New',monospace;font-size:10pt;background:#f2f2f2!important;color:#000!important;border-radius:2px}
#word-content pre{padding:.5em;margin:.5em 0}
#word-content code{padding:1px 3px}
#word-content a{color:#0563c1!important;text-decoration:underline}
#word-content img{max-width:100%;height:auto}
#word-content blockquote{margin:.5em 1.5em;padding:.3em .7em;border-left:3px solid #4472c4;color:#555!important}
#word-content span{color:inherit}
/* Page règle (simulation) */
#word-page::before{content:'';position:absolute;top:0;left:0;right:0;height:2px;background:linear-gradient(to bottom,#e0e0e0,transparent)}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE — bouton hamburger (toujours dans le DOM, visible mobile)
══════════════════════════════════════════════════════════════ */
#btn-hamburger{display:none;background:none;border:none;color:var(--text2);cursor:pointer;
  font-size:1.1rem;padding:6px 8px;border-radius:6px;flex-shrink:0}
#btn-hamburger:hover{color:var(--text);background:var(--bg3)}
#sidebar-backdrop{display:none;position:fixed;inset:0;background:rgba(0,0,0,.55);z-index:199}

/* ══════════════════════════════════════════════════════════════
   ≤ 1200 px  — compresser sidebar et grilles larges
══════════════════════════════════════════════════════════════ */
@media(max-width:1200px){
  :root{--sidebar-w:220px}
  .stats-grid{grid-template-columns:repeat(2,1fr)}
  .theme-layout{grid-template-columns:1fr}
  .theme-layout > div:last-child{position:static}
}

/* ══════════════════════════════════════════════════════════════
   ≤ 900 px  — tablette
══════════════════════════════════════════════════════════════ */
@media(max-width:900px){
  :root{--sidebar-w:200px}

  /* Sidebar principale */
  .sidebar{position:fixed;left:0;top:0;bottom:0;z-index:200;
    transform:translateX(-100%);transition:transform .25s;box-shadow:4px 0 24px rgba(0,0,0,.4)}
  .sidebar.open{transform:translateX(0)}
  #sidebar-backdrop.open{display:block}
  .main-wrap{margin-left:0}
  #btn-hamburger{display:flex}

  /* Topbar : masquer les boutons non essentiels */
  .topbar-breadcrumb{font-size:.78rem}
  button.admin-only.btn-icon{display:none!important}

  /* Dashboard hero */
  .user-hero{flex-wrap:wrap}
  .user-quick-stats{width:100%;margin-left:0;min-width:0}

  /* Grilles */
  .dashboard-grid{grid-template-columns:1fr}
  .fav-items{grid-template-columns:1fr!important}
  .drawio-bottom{grid-template-columns:1fr}
  .doc-view-layout{grid-template-columns:1fr}
  .doc-sidebar-panel{display:none}
  .doc-sidebar-panel.mobile-open{display:flex;flex-direction:column;gap:1rem;margin-top:1rem}
  .settings-layout{grid-template-columns:1fr;gap:1rem}
  #settings-nav{flex-direction:row;flex-wrap:nowrap;gap:4px;margin-bottom:.5rem;
    overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none;padding-bottom:2px}
  #settings-nav::-webkit-scrollbar{display:none}
  .settings-nav-item{padding:.35rem .65rem;font-size:.78rem;white-space:nowrap;flex-shrink:0}

  .lib-main{padding:0}
  .lib-layout{margin:0}

  /* Contenu principal */
  .main-content{padding:1.25rem}
}

/* ══════════════════════════════════════════════════════════════
   ≤ 640 px  — mobile
══════════════════════════════════════════════════════════════ */
@media(max-width:640px){
  /* Dashboard KPI cards */
  .stats-grid{grid-template-columns:repeat(2,1fr);gap:.6rem;margin-bottom:1rem}
  .stat-card{padding:.75rem}
  .stat-val{font-size:1.5rem}
  .card-header{flex-wrap:wrap;gap:.4rem}
  .dashboard-grid{gap:1rem}
  .fav-items{grid-template-columns:1fr!important}
  #explorer-grid{grid-template-columns:repeat(auto-fill,minmax(130px,1fr));gap:.5rem}
  #lib-grid{grid-template-columns:repeat(auto-fill,minmax(140px,1fr))!important;gap:.5rem!important}
  .lib-main{padding:0}

  /* Cartes fichiers */
  .file-card-thumb{height:80px;font-size:2.2rem}
  .file-card-body{padding:.45rem .6rem}
  .file-card-actions{height:30px}
  .file-card-actions button,.file-card-actions a{font-size:.7rem}

  /* Topbar */
  .topbar{padding:0 .75rem}
  .topbar-breadcrumb{font-size:.72rem;max-width:160px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
  .topbar-actions{gap:4px}

  /* Contenu principal */
  .main-content{padding:.85rem}
  .page-title{font-size:1.2rem}
  .page-sub{font-size:.8rem;margin-bottom:1rem}

  /* Cards */
  .card{padding:1rem}
  .stats-card{padding:.75rem}

  /* Modals */
  .modal-overlay{align-items:flex-start;padding-top:env(safe-area-inset-top,1rem);overflow-y:auto}
  .modal-box{margin:.75rem;max-width:calc(100vw - 1.5rem)!important;width:calc(100vw - 1.5rem)}
  .modal-box.wide{max-width:calc(100vw - 1.5rem)!important}

  /* Profil */
  #page-profile > div{padding:0}
  .theme-grid{grid-template-columns:1fr}

  /* Settings */
  .settings-section{padding:1rem}


  /* Login */
  .login-card{padding:1.5rem}

  /* Topbar – alléger les actions (search/settings/upload dans bottom nav) */
  .topbar-actions [data-i18n-title="topbar_upload"]{display:none}
  .topbar-actions [data-i18n-title="topbar_search"]{display:none}
  .topbar-actions [data-i18n-title="topbar_settings"]{display:none}
  .lang-switcher.topbar-lang{display:none}
  .btn-sm span[data-i18n="topbar_new_doc"]{display:none}
  .btn-sm{padding:.4rem .55rem}
  /* Bottom nav : cacher sur l'écran de login */
  body:not(.app-ready) #mobile-bottom-nav{display:none!important}

  /* Hero utilisateur – avatar + texte côte à côte, quick-stats dessous */
  .user-hero{padding:1rem;gap:.75rem;margin-bottom:1rem}
  .user-hero-text h2{font-size:1.2rem}
  .user-quick-stats{margin-left:0;width:100%}

  /* Vue document – header titre + boutons */
  .doc-body{padding:1.25rem}
  .doc-heading{font-size:1.5rem}
  .doc-body > div:first-child{flex-wrap:wrap;gap:.75rem}

  /* Tables – scroll horizontal */
  .docs-table{display:block;overflow-x:auto;-webkit-overflow-scrolling:touch}

  /* Settings – grilles en 1 colonne */
  .ldap-config{grid-template-columns:1fr!important}
  .provider-cards{grid-template-columns:1fr 1fr!important}
  .setting-row{flex-wrap:wrap;gap:.75rem}

  /* Panneau notifications – largeur adaptée */
  #panel-notif{right:.5rem;width:calc(100vw - 1rem);max-width:360px}

  /* OTP – inputs un peu plus petits */
  .otp-inputs input{width:40px;height:48px;font-size:1.2rem}
  .otp-inputs{gap:5px}

  /* Profil hero – empiler verticalement */
  .profile-hero{flex-direction:column;align-items:flex-start;gap:1rem;padding:1.25rem}
  .profile-avatar-ring{width:72px;height:72px;font-size:1.6rem}

  /* Tableaux admin (scroll horizontal) */
  #users-list,#permissions-matrix,#audit-log-table{overflow-x:auto;-webkit-overflow-scrolling:touch}
  #users-list .docs-table,#permissions-matrix .docs-table,#audit-log-table .docs-table{min-width:480px}

  /* iOS – empêcher le zoom automatique sur focus des inputs */
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),
  select,textarea{font-size:16px!important}
  .otp-inputs input{font-size:1.15rem!important;width:38px;height:46px}

  /* Modal destination upload – 1 colonne */
  .upload-dest-grid{grid-template-columns:1fr!important}

  /* Page documents – boutons en-tête */
  .docs-header-actions{flex-wrap:wrap;flex-shrink:1!important;width:100%}
  .docs-header-actions .btn-sm-outline,.docs-header-actions .btn-sm{flex:1;min-width:0;justify-content:center}
}

/* ══════════════════════════════════════════════════════════════
   ≤ 400 px  — très petits écrans
══════════════════════════════════════════════════════════════ */
@media(max-width:400px){
  .stats-grid{grid-template-columns:1fr 1fr}
  .stat-card{padding:.6rem}
  .stat-val{font-size:1.25rem}
  .topbar-breadcrumb{display:none}
  #explorer-grid{grid-template-columns:1fr 1fr}
  .uqs-item{padding:.5rem .6rem}
  .uqs-val{font-size:1.1rem}
  .otp-inputs input{width:34px;height:42px;font-size:1.05rem!important}
  .otp-inputs{gap:3px}
  .fav-items{grid-template-columns:1fr!important}
}

/* ══════════════════════════════════════════════════════════════
   BOTTOM NAVIGATION MOBILE
══════════════════════════════════════════════════════════════ */
#mobile-bottom-nav{
  display:none;position:fixed;bottom:0;left:0;right:0;
  height:56px;background:var(--bg2);border-top:1px solid var(--border);
  z-index:150;-webkit-tap-highlight-color:transparent;
  padding-bottom:env(safe-area-inset-bottom,0px)
}
.mbn-btn{
  flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:2px;background:none;border:none;color:var(--text3);font-size:.6rem;font-weight:500;
  font-family:var(--font-sans);cursor:pointer;padding:6px 0;
  transition:color .15s;-webkit-tap-highlight-color:transparent
}
.mbn-btn i{font-size:1.15rem;line-height:1}
.mbn-btn span{font-size:.58rem;line-height:1;margin-top:1px}
.mbn-btn.active{color:var(--accent2)}
.mbn-btn:active{opacity:.7}

/* ══════════════════════════════════════════════════════════════
   AMÉLIORATIONS TACTILES — ≤ 900 px
══════════════════════════════════════════════════════════════ */
@media(max-width:900px){
  /* Actions explorateur (espaces/dossiers) toujours visibles au toucher */
  .ec-actions{display:flex!important}
  .ec-actions button,.ec-actions a{
    background:rgba(0,0,0,.45);backdrop-filter:blur(3px);
    font-size:10px;padding:4px 7px;border-radius:5px}
  /* Bouton suppression favoris toujours visible sur mobile */
  .fav-item-rm{opacity:1}
  /* Taille minimale des boutons icônes */
  .btn-icon{min-width:38px;min-height:38px}
}

/* ══════════════════════════════════════════════════════════════
   MOBILE COMPLET — ≤ 640 px
══════════════════════════════════════════════════════════════ */
@media(max-width:640px){
  /* Empêche le zoom auto de Safari iOS au focus (déclenché si font-size < 16px) */
  input,select,textarea{font-size:16px!important}

  /* Bottom nav visible + espace en bas */
  #mobile-bottom-nav{display:flex}
  .main-wrap{padding-bottom:calc(56px + env(safe-area-inset-bottom,0px));height:100vh;height:100dvh;min-height:0}
  .main-content{min-height:0}
  .lib-layout{margin:0!important}
  .lib-main{touch-action:pan-y}

  /* Chips filtres bibliothèque : scroll horizontal */
  #lib-filters{
    overflow-x:auto;flex-wrap:nowrap!important;
    -webkit-overflow-scrolling:touch;scrollbar-width:none;padding-bottom:2px
  }
  #lib-filters::-webkit-scrollbar{display:none}
  #lib-normal-toolbar{flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch}

  /* Barre d'actions des cartes fichiers : plus haute pour faciliter le tap */
  .file-card-actions{height:42px!important}
  .file-card-actions button,.file-card-actions a{font-size:.73rem!important;gap:3px!important}

  /* Entête visionneuse PDF/image : compact */
  #modal-pdf > div:first-child{
    gap:.5rem;padding:.55rem .75rem;flex-wrap:wrap
  }
  #modal-pdf > div:first-child a,
  #modal-pdf > div:first-child button{font-size:.78rem;padding:.35rem .65rem}

  /* Masquer le texte du bouton télécharger dans la visionneuse PDF */
  #pdf-download-link .dl-label{display:none}

  /* Topbar : bouton notifications et profil plus grands */
  #notif-btn,#btn-hamburger{width:38px;height:38px;font-size:1rem}

  /* Bulkbar explorer : compact */
  #bulk-bar{padding:.5rem .6rem;gap:5px}
  #bulk-bar .btn-sm-outline{padding:.3rem .5rem;font-size:.73rem}

  /* Sélection lib : compact */
  .sel-action{padding:.3rem .55rem;font-size:.73rem}

  /* Toast au-dessus de la barre de navigation mobile */
  #toast{right:.75rem;left:.75rem;max-width:none;
    bottom:calc(56px + .85rem + env(safe-area-inset-bottom,0px))}

  /* Bouton infos doc visible sur mobile */
  #dv-info-toggle{display:flex!important}

  /* FAB visible sur mobile */
  #mobile-fab{display:flex}

  /* Onglets bibliothèque – scroll horizontal */
  .lib-view-tabs{overflow-x:auto;flex-wrap:nowrap;-webkit-overflow-scrolling:touch;scrollbar-width:none}
  .lib-view-tabs::-webkit-scrollbar{display:none}

  /* Bibliothèque – barre d'actions pleine largeur */
  .lib-header-actions{flex-shrink:1!important;width:100%}

  /* Visionneuse Word – header compact */
  #modal-word > div:first-child > div:first-child{flex-wrap:wrap;gap:.35rem;padding:.4rem .6rem}
  #modal-word > div:first-child > div:first-child > div:last-child{flex-wrap:wrap;gap:4px}
  #modal-word > div:first-child > div:first-child > div:last-child > button:first-child{flex:1}
  #modal-word > div:first-child > div:first-child > div:last-child > a{display:none}

  /* Visionneuse Word – page A4 → plein écran sur mobile */
  #word-scroll-zone{padding:.5rem .25rem}
  #word-page{width:100%!important;min-height:unset!important;border-radius:0}
  #word-content{padding:1rem!important;min-height:60dvh!important}
  /* Zoom masqué sur mobile (inutilisable sans souris) */
  #word-scroll-zone + * > *:last-child .wbtn:has(.fa-magnifying-glass-minus),
  #word-scroll-zone + * > *:last-child .wbtn:has(.fa-magnifying-glass-plus),
  #word-scroll-zone + * > *:last-child span#word-zoom-val{display:none}

  /* PDF – masquer iframe, montrer le bouton d'ouverture plein écran */
  #pdf-iframe{display:none!important}
  #pdf-mobile-open{display:flex!important}

  /* Bouton infos doc – masqué sur desktop */
  #dv-info-toggle{display:none}

  /* Tap highlight supprimé + manipulation tactile sur les éléments interactifs */
  .nav-item,.nav-tree-item,.doc-item,.fav-item,.fav-card,.file-card,
  .filter-chip,.lib-view-tab,.ec,.folder-card,.lib-tree-item{
    -webkit-tap-highlight-color:transparent
  }
  /* Empêche le glissement d'intercepter le tap sur les cartes fichiers (iOS) */
  .file-card{touch-action:manipulation}
  .file-card-actions{touch-action:manipulation}
}

/* ══════════════════════════════════════════════════════════════
   FAB MOBILE — Nouveau doc / Upload
══════════════════════════════════════════════════════════════ */
#mobile-fab{
  display:none;position:fixed;
  right:1rem;bottom:calc(56px + .75rem + env(safe-area-inset-bottom,0px));
  z-index:140;flex-direction:column;align-items:flex-end;gap:8px;
  pointer-events:none
}
#mobile-fab.visible{pointer-events:auto}
.mobile-fab-menu{
  display:none;flex-direction:column;gap:6px;align-items:flex-end;
  transform:translateY(8px);opacity:0;
  transition:transform .2s,opacity .2s
}
.mobile-fab-menu.visible{
  display:flex;transform:translateY(0);opacity:1
}
.mobile-fab-item{
  display:flex;align-items:center;gap:8px;
  padding:.5rem 1rem;
  background:var(--bg2);border:1px solid var(--border2);
  border-radius:20px;color:var(--text);font-size:.84rem;
  cursor:pointer;white-space:nowrap;
  box-shadow:0 2px 12px rgba(0,0,0,.35);
  -webkit-tap-highlight-color:transparent
}
.mobile-fab-item i{width:16px;text-align:center;color:var(--accent2)}
.mobile-fab-trigger{
  width:52px;height:52px;border-radius:50%;
  background:var(--accent);color:#fff;border:none;
  font-size:1.3rem;cursor:pointer;
  box-shadow:0 4px 18px rgba(91,106,240,.5);
  display:flex;align-items:center;justify-content:center;
  transition:transform .25s,box-shadow .25s;
  -webkit-tap-highlight-color:transparent
}
.mobile-fab-trigger:active{transform:scale(.93)}
.mobile-fab-trigger.open{transform:rotate(45deg);box-shadow:0 4px 12px rgba(0,0,0,.4)}

/* ══ BARRE DE PROGRESSION DE LECTURE ════════════════════════════════ */
#reading-progress{
  position:fixed;top:0;left:0;height:2px;z-index:9999;width:0%;
  background:linear-gradient(90deg,var(--accent),var(--accent2));
  opacity:0;transition:width .08s linear,opacity .3s;
  pointer-events:none;border-radius:0 2px 2px 0;
  box-shadow:0 0 8px var(--accent-glow)
}
#reading-progress.visible{opacity:1}

/* ══ MODE LECTURE / FOCUS ════════════════════════════════════════════ */
body.focus-mode .sidebar,
body.focus-mode .topbar,
body.focus-mode .doc-sidebar-panel{display:none!important}
body.focus-mode .main-wrap{margin-left:0!important}
body.focus-mode .main-content{padding:3rem 1.5rem}
body.focus-mode .doc-view-layout{grid-template-columns:1fr}
body.focus-mode .doc-body{max-width:820px;margin:0 auto;border:none;background:transparent;padding:0}
body.focus-mode #dv-focus-btn i{color:var(--accent2)}
#focus-exit-hint{
  position:fixed;bottom:1.75rem;left:50%;transform:translateX(-50%);
  background:var(--bg2);border:1px solid var(--border2);border-radius:20px;
  padding:.4rem 1.1rem;font-size:.74rem;color:var(--text3);z-index:9990;
  display:none;white-space:nowrap;box-shadow:0 4px 16px rgba(0,0,0,.3);
  animation:fadeIn .3s ease
}
body.focus-mode #focus-exit-hint{display:block}
#focus-exit-hint kbd{background:var(--bg4);border:1px solid var(--border2);border-radius:4px;
  padding:1px 6px;font-family:monospace;font-size:.7rem;margin:0 2px}

/* ══ SCROLLSPY TOC ═══════════════════════════════════════════════════ */
.toc-list li.toc-active{
  color:var(--accent2)!important;border-left-color:var(--accent)!important;font-weight:500
}

/* ══ SKELETONS ════════════════════════════════════════════════════════ */
@keyframes sk-shimmer{
  0%{background-position:-800px 0}100%{background-position:800px 0}
}
.sk{
  display:block;border-radius:5px;
  background:linear-gradient(90deg,var(--bg3) 25%,var(--bg4) 50%,var(--bg3) 75%);
  background-size:1600px 100%;animation:sk-shimmer 1.6s infinite linear
}

/* ══ SIDEBAR GAUCHE BIBLIOTHÈQUE ════════════════════════════════════ */
.lib-sidebar{
  width:195px;flex-shrink:0;border-right:1px solid var(--border);
  overflow-y:auto;padding:.5rem 0;background:var(--bg2)
}
.lib-sidebar::-webkit-scrollbar{width:3px}
.lib-sidebar::-webkit-scrollbar-thumb{background:var(--border2);border-radius:3px}
.lib-tree-section{font-size:.66rem;font-weight:700;letter-spacing:.08em;color:var(--text3);
  text-transform:uppercase;padding:.65rem .85rem .2rem}
@media(max-width:900px){.lib-sidebar{display:none}}

/* ══ MENU CONTEXTUEL FICHIER (3 points) ══════════════════════════════ */
#file-ctx-menu{min-width:174px}

/* ══ RECHERCHES RÉCENTES ═════════════════════════════════════════════ */
#search-recents{margin-bottom:.1rem}
.sr-recent-row{display:flex;align-items:center;gap:10px;padding:.6rem .85rem;
  border-radius:8px;cursor:pointer;transition:background .15s;font-size:.84rem;color:var(--text2)}
.sr-recent-row:hover{background:var(--bg3);color:var(--text)}
.sr-recent-row i{color:var(--text3);font-size:.8rem;width:14px;text-align:center;flex-shrink:0}
.sr-recent-row span{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
/* ══ CORBEILLE ═══════════════════════════════════════════════ */
.trash-hero{background:linear-gradient(135deg,rgba(239,68,68,.08) 0%,rgba(239,68,68,.03) 100%);
  border:1px solid rgba(239,68,68,.18);border-radius:var(--radius-lg);
  padding:1.5rem 1.75rem;margin-bottom:1.75rem;display:flex;align-items:center;gap:1.5rem;flex-wrap:wrap}
.trash-hero-icon{width:56px;height:56px;background:rgba(239,68,68,.12);border-radius:14px;
  display:flex;align-items:center;justify-content:center;font-size:1.6rem;color:#ef4444;flex-shrink:0}
.trash-hero-text h2{font-size:1.15rem;font-weight:600;margin:0 0 .2rem;color:var(--text)}
.trash-hero-text p{font-size:.82rem;color:var(--text3);margin:0}
.trash-stats{display:flex;gap:1rem;margin-left:auto;flex-wrap:wrap}
.trash-stat{text-align:center;background:var(--bg2);border:1px solid var(--border);border-radius:10px;padding:.6rem 1rem;min-width:72px}
.trash-stat-n{font-size:1.4rem;font-weight:700;line-height:1;color:var(--text)}
.trash-stat-l{font-size:.7rem;color:var(--text3);margin-top:.2rem;text-transform:uppercase;letter-spacing:.04em}
.trash-tabs{display:flex;gap:2px;background:var(--bg2);border:1px solid var(--border);border-radius:10px;padding:3px;margin-bottom:1.25rem;width:fit-content}
.trash-tab{padding:.35rem .9rem;border-radius:7px;font-size:.82rem;font-weight:500;color:var(--text2);cursor:pointer;border:none;background:none;transition:all .15s;display:flex;align-items:center;gap:.4rem;white-space:nowrap}
.trash-tab:hover{color:var(--text);background:var(--bg3)}
.trash-tab.active{background:var(--bg4);color:var(--text);box-shadow:0 1px 4px rgba(0,0,0,.2)}
.trash-tab .tab-count{font-size:.7rem;background:var(--border2);color:var(--text2);border-radius:10px;padding:.05rem .4rem;min-width:18px;text-align:center;transition:all .15s}
.trash-tab.active .tab-count{background:rgba(239,68,68,.2);color:#ef4444}
.trash-list{display:flex;flex-direction:column;gap:.5rem}
.trash-row{background:var(--bg2);border:1px solid var(--border);border-radius:12px;
  display:flex;align-items:center;gap:1rem;padding:.75rem 1rem;
  transition:border-color .15s,box-shadow .15s}
.trash-row:hover{border-color:var(--border2);box-shadow:0 2px 10px rgba(0,0,0,.18)}
.trash-row-icon{width:38px;height:38px;border-radius:9px;display:flex;align-items:center;
  justify-content:center;font-size:1.05rem;flex-shrink:0}
.trash-row-icon.doc{background:rgba(91,106,240,.12);color:var(--accent2)}
.trash-row-icon.file{background:rgba(45,212,191,.1);color:var(--teal)}
.trash-row-info{flex:1;min-width:0}
.trash-row-name{font-size:.87rem;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--text)}
.trash-row-meta{font-size:.73rem;color:var(--text3);margin-top:.15rem;display:flex;align-items:center;gap:.5rem;flex-wrap:wrap}
.trash-row-meta span{display:inline-flex;align-items:center;gap:.25rem}
.trash-expiry{display:flex;align-items:center;gap:.35rem;flex-shrink:0}
.expiry-badge{font-size:.72rem;font-weight:600;border-radius:20px;padding:.2rem .6rem;
  border:1px solid;white-space:nowrap}
.expiry-badge.ok{background:rgba(34,197,94,.1);color:#22c55e;border-color:rgba(34,197,94,.25)}
.expiry-badge.warn{background:rgba(245,158,11,.12);color:#f59e0b;border-color:rgba(245,158,11,.25)}
.expiry-badge.danger{background:rgba(239,68,68,.12);color:#ef4444;border-color:rgba(239,68,68,.25)}
.trash-row-actions{display:flex;gap:.35rem;flex-shrink:0}
.trash-btn-restore{background:rgba(91,106,240,.12);color:var(--accent2);border:1px solid rgba(91,106,240,.25);
  border-radius:7px;padding:.3rem .7rem;font-size:.78rem;cursor:pointer;display:inline-flex;align-items:center;
  gap:.3rem;white-space:nowrap;transition:all .15s}
.trash-btn-restore:hover{background:rgba(91,106,240,.22);border-color:rgba(91,106,240,.5)}
.trash-btn-del{background:rgba(239,68,68,.08);color:#ef4444;border:1px solid rgba(239,68,68,.2);
  border-radius:7px;padding:.3rem .7rem;font-size:.78rem;cursor:pointer;display:inline-flex;align-items:center;
  gap:.3rem;white-space:nowrap;transition:all .15s}
.trash-btn-del:hover{background:rgba(239,68,68,.18);border-color:rgba(239,68,68,.45)}
.trash-empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;
  padding:4rem 2rem;color:var(--text3);text-align:center;gap:.75rem}
.trash-empty-state i{font-size:3.5rem;opacity:.18}
.trash-empty-state h3{font-size:1.05rem;font-weight:500;color:var(--text2);margin:0}
.trash-empty-state p{font-size:.83rem;margin:0;max-width:280px;line-height:1.5}
.trash-purge-bar{display:flex;align-items:center;justify-content:flex-end;margin-bottom:1rem}
.btn-purge{background:rgba(239,68,68,.1);color:#ef4444;border:1px solid rgba(239,68,68,.25);
  border-radius:8px;padding:.4rem 1rem;font-size:.82rem;cursor:pointer;display:inline-flex;
  align-items:center;gap:.4rem;font-weight:500;transition:all .15s}
.btn-purge:hover{background:rgba(239,68,68,.2);border-color:rgba(239,68,68,.5)}
@media(max-width:640px){
  .trash-hero{padding:1rem;gap:.85rem}
  .trash-hero-icon{width:44px;height:44px;font-size:1.25rem;border-radius:10px}
  .trash-hero-text h2{font-size:1rem}
  .trash-stats{gap:.5rem;margin-left:0;width:100%}
  .trash-stat{flex:1;min-width:60px;padding:.5rem .5rem}
  .trash-stat-n{font-size:1.2rem}
  .trash-row{flex-wrap:wrap;gap:.5rem;padding:.6rem .75rem}
  .trash-expiry{margin-left:auto}
  .trash-row-actions{width:100%;justify-content:stretch;padding-top:.4rem;border-top:1px solid var(--border);margin-top:.1rem}
  .trash-btn-restore,.trash-btn-del{flex:1;justify-content:center}
}
@media(max-width:420px){
  .trash-tabs{width:100%}
  .trash-tab{flex:1;justify-content:center;padding:.32rem .5rem}
  .trash-btn-label{display:none}
}
/* ── Inline comments ─────────────────────────────────── */
.ic-panel{display:flex;flex-direction:column;gap:.75rem;padding:.25rem 0}
.ic-thread{background:var(--bg2);border:1px solid var(--border);border-radius:10px;overflow:hidden}
.ic-thread.ic-resolved{opacity:.6}
.ic-anchor{font-size:.73rem;color:var(--text3);padding:.4rem .65rem;background:var(--bg3);border-bottom:1px solid var(--border);cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ic-anchor:hover{color:var(--accent2)}
.ic-body{padding:.55rem .65rem}
.ic-mark{background:rgba(91,106,240,.25);border-radius:2px;cursor:pointer}
.ic-mark:hover{background:rgba(91,106,240,.45)}
/* ── Doc view inline panel ───────────────────────────── */
.dv-layout{display:flex;gap:1.5rem;align-items:flex-start}
.dv-main{flex:1;min-width:0}
.dv-ic-aside{width:260px;flex-shrink:0;position:sticky;top:1rem}
@media(max-width:900px){.dv-layout{flex-direction:column}.dv-ic-aside{width:100%;position:static}}

/* ── Gestion catégories (modal-manage-categories) ──────── */
.mmc-item{display:flex;align-items:center;gap:.5rem;padding:.45rem .6rem;border-radius:var(--radius);background:var(--bg3);border:1px solid var(--border2);margin-bottom:.35rem;cursor:grab;transition:background .15s}
.mmc-item.dragging{opacity:.4}
.mmc-item.drag-over{border-color:var(--accent2);background:var(--bg2)}
.mmc-grip{color:var(--text3);font-size:.75rem;cursor:grab;flex-shrink:0}
.mmc-name{flex:1;font-size:.85rem;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mmc-count{font-size:.7rem;color:var(--text3);background:var(--bg2);border:1px solid var(--border);border-radius:20px;padding:.1rem .45rem;flex-shrink:0}

/* ── Assigner catégorie (modal-assign-category) ─────────── */
.mac-cat-item{display:flex;align-items:center;gap:.6rem;padding:.5rem .75rem;border-radius:var(--radius);border:1px solid var(--border2);cursor:pointer;font-size:.85rem;transition:all .15s}
.mac-cat-item:hover{border-color:var(--accent2);color:var(--accent2)}
.mac-cat-item.active{background:var(--accent2);border-color:var(--accent2);color:#fff}

/* ── Drag-drop sidebar ──────────────────────────────────── */
.nav-cat-label.drop-target{background:var(--accent2);color:#fff;border-radius:var(--radius);opacity:.9}
.nav-cat-label.drop-target .nav-cat-actions{display:none}

/* ── Word modal : isolation thème (la page A4 est toujours blanche) */
#word-page{color-scheme:light;background:#fff!important;color:#000!important}
#word-content{font-family:Calibri,'Segoe UI',Arial,sans-serif!important;font-size:11pt;line-height:1.5;color:#000!important;background:#fff}

/* ── Liens wiki [[...]] ─────────────────────────────────── */
.wiki-link{color:var(--primary,#5b6af0);text-decoration:none;border-bottom:1px dashed currentColor;cursor:pointer;padding-bottom:1px}
.wiki-link:hover{border-bottom-style:solid}
.wiki-link-missing{color:#ef4444;border-bottom:1px dashed #ef4444;cursor:default;opacity:.75}

/* ── Page Membres ───────────────────────────────────────────── */
.members-filter-btn{padding:.35rem .85rem;border-radius:20px;font-size:.78rem;font-weight:600;
  border:1px solid var(--border2);background:var(--bg3);color:var(--text2);cursor:pointer;
  transition:all .15s;display:inline-flex;align-items:center}
.members-filter-btn:hover{background:var(--bg4);color:var(--text)}
.members-filter-btn.active{background:var(--accent);color:#fff;border-color:var(--accent)}
.member-card{background:var(--bg2);border:1px solid var(--border);border-radius:var(--radius-lg);
  padding:1.25rem 1rem;display:flex;flex-direction:column;align-items:center;text-align:center;
  cursor:pointer;transition:all .18s;position:relative}
.member-card:hover{transform:translateY(-3px);box-shadow:0 10px 24px rgba(0,0,0,.25);border-color:var(--border2)}
.member-card .avatar{width:56px;height:56px;font-size:1.15rem;margin:0 auto .75rem;flex-shrink:0}
.member-card-name{font-size:.9rem;font-weight:600;color:var(--text);margin-bottom:.2rem;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
.member-card-username{font-size:.75rem;color:var(--text3);margin-bottom:.65rem}
.member-card-role{font-size:.68rem;font-weight:700;padding:2px 10px;border-radius:10px;
  background:var(--bg4);border:1px solid var(--border2);letter-spacing:.04em}
.member-online-dot{position:absolute;top:.65rem;right:.65rem;width:10px;height:10px;
  border-radius:50%;background:var(--green);border:2px solid var(--bg2)}
