#orthographeBtn, #suggestionBtn {
  display: none;
}
#exportBtn, #importBtn, #resetBtn {
  display: none;
}
#suggestKeepBtn {
  background: rgba(0, 170, 119, 0.12) !important;
  color: #0a7 !important;
  border: 1px solid #0a7 !important;
  border-radius: 8px !important;
  font-weight: 600 !important;
  transition: background 0.2s, border-color 0.2s !important;
}
#suggestKeepBtn:hover {
  background: rgba(0, 170, 119, 0.22) !important;
  border-color: #0a7 !important;
}
#suggestUndoBtn {
  background: rgba(220, 38, 38, 0.12) !important;
  color: #dc2626 !important;
  border: 1px solid #dc2626 !important;
  border-radius: 8px !important;
  font-weight: 600 !important;
  transition: background 0.2s, border-color 0.2s !important;
}
#suggestUndoBtn:hover {
  background: rgba(220, 38, 38, 0.22) !important;
  border-color: #dc2626 !important;
}
#iconPickerBtn i {
  font-size: 14px;
}
.toolbar-btns {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 14px;
  overflow-x: auto;
}

body.editing #editToolbar {
  display: block;
}
body.editing #editToolbar #suggestion-block {
  display: block;
  width: 100%;
  text-align: center;
  margin-bottom: 12px;
  font-style: italic;
  font-size: 0.92em;
  color: #888;
}
body.editing #editToolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
body.editing #editToolbar #suggestion-block {
  display: block;
  width: 100%;
  text-align: center;
  margin-bottom: 12px;
  font-style: italic;
  font-size: 0.92em;
  color: #888;
  order: -1;
}
/* Suggestion Gemini dans la barre d'outils */
body.editing #editToolbar #suggestion-block {
  display: block;
  width: 100%;
  text-align: center;
  margin-bottom: 12px;
  font-style: italic;
  font-size: 0.92em;
  color: #888;
  clear: both;
  line-height: 1.6;
}

.icon-picker {
  position: fixed;
  right: 20px;
  bottom: 84px;
  width: min(560px, calc(100vw - 24px));
  max-height: 60vh;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  padding: 12px;
  z-index: 1200;
  display: none;
}
.icon-picker.open { display: block; }
.icon-picker.dragging {
  width: 180px;
  max-height: 64px;
  overflow: hidden;
  opacity: 0.72;
  padding: 8px;
}
.icon-picker.dragging .icon-picker-header strong,
.icon-picker.dragging #iconSearchInput,
.icon-picker.dragging .icon-picker-grid {
  display: none;
}
.icon-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.icon-picker input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
}
.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  overflow: auto;
  max-height: calc(60vh - 96px);
}
.icon-picker-item {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-radius: 8px;
  min-height: 76px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  transition: var(--transition);
}
.icon-picker-item:hover {
  border-color: var(--accent);
  color: var(--text-primary);
  background: var(--accent-subtle);
}
.icon-picker-item i {
  font-size: 18px;
}
.icon-picker-item span {
  font-size: 11px;
  line-height: 1.2;
  word-break: break-word;
}

.icon-context-menu {
  position: fixed;
  z-index: 2500;
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
  padding: 10px;
  min-width: 270px;
}

.nav-context-menu {
  position: fixed;
  min-width: 260px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: 0 18px 45px rgba(0,0,0,0.45);
  padding: 10px;
  z-index: 3100;
  display: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.nav-context-title {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding: 0 2px;
}
.nav-context-input {
  width: 100%;
  height: 34px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 13px;
  outline: none;
  margin-bottom: 8px;
}
.nav-context-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}
.nav-context-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-context-btn {
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 0 10px;
  transition: var(--transition);
}
.nav-context-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
}
.nav-context-btn.danger:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-subtle);
}

.block-context-menu {
  position: fixed;
  min-width: 180px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  box-shadow: 0 16px 38px rgba(0,0,0,0.45);
  padding: 8px;
  z-index: 3200;
  display: none;
}
.block-context-btn {
  width: 100%;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 0 10px;
  text-align: left;
  transition: var(--transition);
}
.block-context-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
}
.block-context-btn.danger:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-subtle);
}
.icm-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.icm-group { margin-bottom: 10px; }
.icm-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.icm-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
}
#icmSizeRange { width: 100%; }
#icmSizeInput,
#icmColorInput,
#icmColorPicker {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 6px 8px;
}
#icmSizeInput { width: 70px; }
#icmColorInput { width: 100%; }
#icmColorPicker {
  width: 44px;
  padding: 2px;
  height: 34px;
}
.icm-unit {
  font-size: 11px;
  color: var(--text-muted);
}
.icm-palette {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}
.icm-swatch {
  width: 100%;
  height: 20px;
  border-radius: 6px;
  border: 1px solid var(--border-light);
}
.icm-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.icm-actions .toolbar-btn {
  justify-content: center;
  font-size: 12px;
  padding: 6px 8px;
}
/* ══════════════════════════════════════════════
   DOCUMENTATION WIKI - Dark Modern Theme
   ══════════════════════════════════════════════ */

*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}

:root {
  --bg-deep: #08090d;
  --bg-base: #0c0d12;
  --bg-surface: #13141b;
  --bg-elevated: #1a1b24;
  --bg-hover: #22232e;
  --border: #1e2030;
  --border-light: #2a2c3e;
  --text-primary: #e8eaed;
  --text-secondary: #9aa0b0;
  --text-muted: #5c6178;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-subtle: rgba(99,102,241,0.12);
  --accent-glow: rgba(99,102,241,0.25);
  --cyan: #22d3ee;
  --cyan-subtle: rgba(34,211,238,0.1);
  --green: #34d399;
  --green-subtle: rgba(52,211,153,0.1);
  --amber: #fbbf24;
  --amber-subtle: rgba(251,191,36,0.1);
  --red: #f87171;
  --red-subtle: rgba(248,113,113,0.1);
  --radius: 8px;
  --sidebar-w: 280px;
  --header-h: 60px;
  --transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

::selection { background: var(--accent); color: #fff; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }
a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; height: auto; }

/* ── HEADER ── */
.doc-header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h);
  background: rgba(8,9,13,0.85);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; z-index: 1000;
}
.header-left { display: flex; align-items: center; gap: 16px; }
.menu-toggle {
  display: none; background: none; border: none; color: var(--text-secondary);
  padding: 8px; border-radius: var(--radius); transition: var(--transition);
}
.menu-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }
.menu-toggle svg { width: 20px; height: 20px; }
.doc-logo {
  font-size: 18px; font-weight: 700; color: var(--text-primary);
  display: flex; align-items: center; gap: 10px;
  letter-spacing: -0.02em;
}
.doc-logo-icon {
  width: 32px; height: 32px; background: var(--accent); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; color: #fff;
}
.header-search {
  position: relative; max-width: 400px; flex: 1; margin: 0 24px;
}
.header-search input {
  width: 100%; padding: 8px 16px 8px 40px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-primary);
  height: 36px;
  font-size: 14px; outline: none; transition: var(--transition);
}
.header-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }
.header-search input::placeholder { color: var(--text-muted); }
.header-search svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-muted); pointer-events: none;
}
.header-search .search-shortcut {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-size: 11px; color: var(--text-muted); background: var(--bg-elevated);
  padding: 2px 6px; border-radius: 4px; border: 1px solid var(--border);
  pointer-events: none;
}
.header-actions { display: flex; align-items: center; gap: 8px; }
.header-actions .header-search {
  margin: 0;
  flex: 0 0 360px;
  max-width: 360px;
}
.header-btn {
  display: flex; align-items: center; gap: 6px; padding: 7px 14px;
  border: 1px solid var(--border); background: var(--bg-surface);
  color: var(--text-secondary); font-size: 13px; font-weight: 500;
  border-radius: var(--radius); transition: var(--transition);
}
.header-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-light); }
.header-btn svg { width: 14px; height: 14px; }
.header-btn.primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.header-btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
#editToggle {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-primary);
  border-radius: 10px;
  transition: transform 0.2s ease, color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
#editToggle:hover {
  background: var(--accent-subtle);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(99, 102, 241, 0.25);
}
#editToggle span {
  display: none;
}
#editToggle svg {
  width: 18px;
  height: 18px;
}
.edit-indicator {
  display: none; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
  background: var(--green-subtle); color: var(--green); border: 1px solid rgba(52,211,153,0.2);
}
.edit-indicator.active { display: flex; }
.edit-indicator .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green); animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{ opacity:1 } 50%{ opacity:.4 } }

/* ── SIDEBAR ── */
.doc-sidebar {
  position: fixed; left: 0; top: var(--header-h); bottom: 0;
  width: var(--sidebar-w); background: var(--bg-base);
  border-right: 1px solid var(--border);
  overflow-y: auto; padding: 20px 0; z-index: 900;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.sidebar-section { padding: 0 16px; margin-bottom: 24px; }
.sidebar-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 0 8px; margin-bottom: 8px;
}
.sidebar-nav { list-style: none; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 6px; font-size: 14px;
  color: var(--text-secondary); transition: var(--transition);
  text-decoration: none; position: relative;
}
.sidebar-nav a:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-nav a.active {
  background: var(--accent-subtle); color: var(--accent-hover); font-weight: 500;
}
.sidebar-nav a.has-children {
  font-weight: 600;
  color: var(--text-primary);
}
.sidebar-nav a.is-submenu {
  gap: 10px;
}
.sidebar-nav a .nav-sub-arrow {
  display: inline-block;
  position: relative;
  width: 18px;
  min-width: 18px;
  height: 14px;
  background:
    radial-gradient(circle at 4px 9px, var(--accent) 1.5px, transparent 2px),
    linear-gradient(var(--border-light), var(--border-light)) 4px 1px / 1px 8px no-repeat,
    linear-gradient(90deg, var(--border-light), var(--accent)) 4px 9px / 12px 1px no-repeat;
  opacity: 0.9;
  transform: translateY(-1px);
  filter: drop-shadow(0 0 2px rgba(99,102,241,0.25));
}
.sidebar-nav a .nav-expand-caret {
  width: 16px;
  min-width: 16px;
  height: 16px;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-radius: 6px;
  background: rgba(255,255,255,0.03);
  transition: transform 0.22s ease, color 0.22s ease, background 0.22s ease;
}
.sidebar-nav a .nav-expand-caret::before {
  content: '';
  width: 6px;
  height: 6px;
  border-right: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  transform: rotate(-45deg);
  margin-left: -2px;
  transition: transform 0.22s ease;
}
.sidebar-nav a.has-children.expanded .nav-expand-caret {
  background: var(--accent-subtle);
  color: var(--accent);
}
.sidebar-nav a.has-children.expanded .nav-expand-caret::before {
  transform: rotate(45deg);
  margin-left: 0;
}
.sidebar-nav a .nav-icon { width: 16px; height: 16px; opacity: 0.6; }
.sidebar-add-btn {
  display: none; margin: 8px 16px; padding: 8px 12px;
  background: var(--bg-surface); border: 1px dashed var(--border-light);
  color: var(--text-muted); font-size: 13px; border-radius: var(--radius);
  width: calc(100% - 32px); transition: var(--transition); text-align: center;
}
.sidebar-add-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-subtle); }
.sidebar-add-btn.visible { display: block; }

/* ── EMPTY STATE ── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 80px 24px; gap: 16px;
  color: var(--text-muted); text-align: center;
}
.empty-state svg { width: 64px; height: 64px; opacity: 0.25; }
.empty-state h2 {
  font-size: 22px; font-weight: 700; color: var(--text-secondary);
  letter-spacing: -0.02em;
}
.empty-state p {
  font-size: 15px; max-width: 400px; line-height: 1.6;
}

/* ── MAIN ── */
.doc-main {
  margin-left: var(--sidebar-w); margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h)); padding: 0;
}
.doc-content {
  max-width: 860px; margin: 0 auto; padding: 40px 48px 80px;
}

/* ── BANNER ── */
.doc-banner {
  position: relative; width: 100%; min-height: 200px;
  background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-elevated) 100%);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.doc-banner img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.doc-banner .banner-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, var(--bg-deep) 0%, transparent 60%);
}
.doc-banner.empty { min-height: 120px; cursor: default; }
.doc-banner.empty.editable { cursor: pointer; }
.doc-banner .banner-placeholder {
  display: none; flex-direction: column; align-items: center; gap: 8px;
  color: var(--text-muted); font-size: 14px; z-index: 1;
}
.doc-banner.empty.editable .banner-placeholder { display: flex; }
.banner-placeholder svg { width: 32px; height: 32px; opacity: 0.4; }
.banner-remove {
  display: none; position: absolute; top: 12px; right: 12px; z-index: 2;
  background: rgba(0,0,0,0.6); border: none; color: #fff;
  width: 32px; height: 32px; border-radius: 50%;
  align-items: center; justify-content: center;
  font-size: 18px; transition: var(--transition);
}
.banner-remove:hover { background: var(--red); }
.doc-banner.editable .banner-remove { display: flex; }

/* ── TITLE ── */
.doc-title {
  font-size: 38px; font-weight: 800; line-height: 1.15;
  letter-spacing: -0.03em; color: var(--text-primary);
  margin-bottom: 8px; outline: none; padding: 2px 0;
  border-radius: 4px;
}
.doc-title:empty::before { content: attr(data-placeholder); color: var(--text-muted); }
.doc-subtitle {
  font-size: 16px; color: var(--text-secondary); line-height: 1.6;
  margin-bottom: 32px; outline: none; padding: 2px 0;
}
.doc-subtitle:empty::before { content: attr(data-placeholder); color: var(--text-muted); }

/* ── BLOCKS ── */
.block {
  position: relative; margin-bottom: 24px;
  border-radius: var(--radius); transition: var(--transition);
}
.block.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
}
.block.block-dragging {
  opacity: 0.55;
}
.block:hover .block-actions { opacity: 1; pointer-events: auto; }
.block-actions {
  position: absolute; top: 4px; right: 4px; z-index: 10;
  display: flex; gap: 4px; opacity: 0; pointer-events: none;
  transition: var(--transition);
}
.block-actions.always { opacity: 1; pointer-events: auto; }
.block-action-btn {
  width: 28px; height: 28px; border-radius: 6px; border: none;
  background: var(--bg-elevated); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition); font-size: 14px;
}
.block-action-btn:hover { background: var(--accent); color: #fff; }
.block-action-btn.danger:hover { background: var(--red); color: #fff; }

/* Text Block */
.block-text {
  font-size: 15px; line-height: 1.7; color: var(--text-secondary);
  outline: none; padding: 2px 0; min-height: 24px;
}
.block-text:empty::before { content: attr(data-placeholder); color: var(--text-muted); font-style: italic; }
.block-text h2 { font-size: 24px; font-weight: 700; color: var(--text-primary); margin: 32px 0 12px; letter-spacing: -0.02em; line-height: 1.3; }
.block-text h3 { font-size: 18px; font-weight: 600; color: var(--text-primary); margin: 24px 0 8px; }
.block-text p { margin-bottom: 12px; }
.block-text strong { color: var(--text-primary); font-weight: 600; }
.block-text em { font-style: italic; }
.block-text ul, .block-text ol { padding-left: 24px; margin-bottom: 12px; }
.block-text li { margin-bottom: 4px; }
.block-text code {
  font-family: 'JetBrains Mono', monospace; font-size: 13px;
  background: var(--bg-elevated); padding: 2px 6px; border-radius: 4px;
  color: var(--cyan); border: 1px solid var(--border);
}
.block-text a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.block-text blockquote {
  border-left: 3px solid var(--accent); padding: 8px 16px;
  margin: 12px 0; background: var(--accent-subtle);
  border-radius: 0 var(--radius) var(--radius) 0; color: var(--text-secondary);
}

/* Code Block */
.block-code {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.block-code-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted); font-weight: 500;
}
.block-code pre {
  padding: 16px; margin: 0; overflow-x: auto;
  font-family: 'JetBrains Mono', monospace; font-size: 13px; line-height: 1.7;
  color: var(--text-secondary);
}
.block-code code { font-family: inherit; background: none; border: none; padding: 0; color: inherit; }

/* Table Block */
.block-table-wrap { overflow-x: auto; margin-bottom: 4px; }
.block-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.block-table th {
  background: var(--bg-elevated); font-size: 12px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em;
  padding: 10px 16px; text-align: left; border-bottom: 1px solid var(--border);
}
.block-table td {
  padding: 10px 16px; font-size: 14px; color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.block-table tr:last-child td { border-bottom: none; }
.block-table tr:hover td { background: var(--bg-hover); }
.block-table th[contenteditable="true"],
.block-table td[contenteditable="true"] { outline: none; cursor: text; }
.block-table th[contenteditable="true"]:focus,
.block-table td[contenteditable="true"]:focus {
  box-shadow: inset 0 0 0 2px var(--accent); border-radius: 2px;
}
.table-controls { display: none; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.table-controls.visible { display: flex; }
.table-ctrl-btn {
  padding: 4px 10px; background: var(--bg-surface); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 12px; border-radius: 6px;
  transition: var(--transition); display: flex; align-items: center; gap: 4px;
}
.table-ctrl-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-subtle); }
.table-ctrl-btn.danger:hover { border-color: var(--red); color: var(--red); background: var(--red-subtle); }

/* Image Block */
.block-image {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: var(--bg-surface); border: 1px solid var(--border);
}
.block-image img { display: block; }
.block-image.align-center { text-align: center; }
.block-image.align-center img { margin: 0 auto; max-width: 100%; }
.block-image.align-left { float: none; }
.block-image.align-left img { max-width: 50%; float: left; margin: 0 20px 12px 0; border-radius: var(--radius); }
.block-image.align-right { float: none; }
.block-image.align-right img { max-width: 50%; float: right; margin: 0 0 12px 20px; border-radius: var(--radius); }
.block-image.align-full img { width: 100%; }
.block-image .img-caption {
  padding: 8px 12px; font-size: 13px; color: var(--text-muted);
  text-align: center; font-style: italic; outline: none;
}
.block-image .img-caption:empty::before { content: 'Ajouter une legende...'; color: var(--text-muted); opacity: .5; }
.image-placeholder {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 48px 24px; gap: 8px;
  color: var(--text-muted); cursor: pointer; transition: var(--transition);
}
.image-placeholder:hover { background: var(--bg-hover); color: var(--accent); }
.image-placeholder svg { width: 36px; height: 36px; opacity: 0.4; }
.image-align-controls {
  display: none; position: absolute; bottom: 40px; left: 50%;
  transform: translateX(-50%); background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 4px; gap: 2px; z-index: 5;
}
.block-image.editable .image-align-controls { display: flex; }
.align-btn {
  padding: 4px 8px; background: none; border: none; color: var(--text-muted);
  border-radius: 4px; font-size: 11px; transition: var(--transition); font-weight: 500;
}
.align-btn:hover, .align-btn.active { background: var(--accent); color: #fff; }

/* Callout Block */
.block-callout {
  padding: 16px 20px; border-radius: var(--radius);
  display: flex; gap: 12px; align-items: flex-start;
}
.block-callout.info { background: var(--accent-subtle); border: 1px solid rgba(99,102,241,0.2); }
.block-callout.warning { background: var(--amber-subtle); border: 1px solid rgba(251,191,36,0.2); }
.block-callout.tip { background: var(--green-subtle); border: 1px solid rgba(52,211,153,0.2); }
.block-callout.danger { background: var(--red-subtle); border: 1px solid rgba(248,113,113,0.2); }
.callout-icon { font-size: 18px; flex-shrink: 0; margin-top: 2px; }
.callout-content {
  flex: 1; font-size: 14px; color: var(--text-secondary);
  outline: none; line-height: 1.6;
}
.callout-content:empty::before { content: attr(data-placeholder); color: var(--text-muted); }

/* Divider */
.block-divider { border: none; border-top: 1px solid var(--border); margin: 32px 0; }

/* ── ADD BLOCK MENU ── */
.add-block-bar { display: none; padding: 16px 0; }
.add-block-bar.visible { display: block; }
.add-block-trigger {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; background: var(--bg-surface);
  border: 1px dashed var(--border-light); color: var(--text-muted);
  font-size: 13px; border-radius: var(--radius); width: 100%;
  transition: var(--transition); font-weight: 500;
}
.add-block-trigger:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-subtle); }
.add-block-trigger svg { width: 16px; height: 16px; }
.block-menu,
.add-block-menu {
  display: none; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px; margin-top: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4); gap: 4px; flex-wrap: wrap;
}
.block-menu.open,
.add-block-menu.open { display: flex; }
.block-menu-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  background: none; border: none; color: var(--text-secondary);
  font-size: 13px; border-radius: 6px; transition: var(--transition);
  font-weight: 500; white-space: nowrap;
}
.block-menu-item:hover { background: var(--accent); color: #fff; }
.block-menu-item svg { width: 16px; height: 16px; opacity: 0.6; }

/* ── EDIT TOOLBAR (floating) ── */
.edit-toolbar {
  display: none; position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 12px; padding: 8px 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px var(--border);
  z-index: 2000; gap: 6px; align-items: center;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.edit-toolbar.visible { display: flex; }
.toolbar-btn {
  padding: 6px 10px; background: none; border: none;
  color: var(--text-secondary); border-radius: 6px;
  font-size: 13px; font-weight: 600; transition: var(--transition);
  display: flex; align-items: center; gap: 4px;
}
.toolbar-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.toolbar-btn.active { background: var(--accent-subtle); color: var(--accent); }
.toolbar-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.toolbar-btn svg { width: 14px; height: 14px; }

/* ── MODALS ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.7); z-index: 5000;
  align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 12px; padding: 32px; max-width: 420px; width: 90%;
  box-shadow: 0 40px 80px rgba(0,0,0,0.5);
}
.modal h3 { font-size: 20px; font-weight: 700; margin-bottom: 6px; color: var(--text-primary); }
.modal p { font-size: 14px; color: var(--text-muted); margin-bottom: 20px; }
.modal input[type="password"], .modal input[type="text"] {
  width: 100%; padding: 10px 16px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-primary); font-size: 14px; outline: none;
  transition: var(--transition); margin-bottom: 16px;
}
.modal input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.modal-btn {
  padding: 8px 20px; border-radius: var(--radius); font-size: 14px;
  font-weight: 500; border: none; transition: var(--transition);
}
.modal-btn.cancel { background: var(--bg-surface); color: var(--text-secondary); border: 1px solid var(--border); }
.modal-btn.cancel:hover { background: var(--bg-hover); }
.modal-btn.confirm { background: var(--accent); color: #fff; }
.modal-btn.confirm:hover { background: var(--accent-hover); }
.modal .error-msg { color: var(--red); font-size: 13px; margin: -8px 0 12px; display: none; }
.modal .error-msg.show { display: block; }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  padding: 12px 20px; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-primary); font-size: 14px; font-weight: 500;
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
  transform: translateY(120%); opacity: 0;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }

/* ── DRAG HANDLE ── */
.drag-handle {
  position: absolute; right: 10px; top: 10px; left: auto; transform: none;
  width: 28px; height: 28px; display: none; align-items: center; justify-content: center;
  color: var(--text-muted); cursor: grab; opacity: 0; transition: var(--transition);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg-surface) 100%);
  border: 1px solid var(--border-light);
  box-shadow: 0 8px 18px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.04);
  z-index: 6;
  pointer-events: auto;
  user-select: none;
}
.drag-handle::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  box-shadow:
    0 6px 0 currentColor,
    0 12px 0 currentColor,
    7px 0 0 currentColor,
    7px 6px 0 currentColor,
    7px 12px 0 currentColor;
  opacity: 0.95;
}
.block:hover .drag-handle { opacity: 1; }
.drag-handle:hover {
  opacity: 1 !important;
  background: linear-gradient(180deg, var(--bg-hover) 0%, var(--bg-elevated) 100%);
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle), 0 10px 24px rgba(0,0,0,0.32);
  transform: translateY(-1px);
}
.drag-handle:active {
  cursor: grabbing;
  transform: translateY(0);
  box-shadow: 0 0 0 2px var(--accent-subtle), 0 6px 14px rgba(0,0,0,0.24);
}
.editing .drag-handle { display: flex; opacity: 1; }

/* ── SECTION BLOCK ── */
.section-block { margin-bottom: 48px; }
.section-block.section-subcontent {
  margin-top: 24px;
  padding-top: 24px;
  position: relative;
}
.section-block.section-subcontent::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--border-light) 18%, var(--accent-subtle) 50%, var(--border-light) 82%, transparent 100%);
  opacity: 0.95;
}
.section-title {
  font-size: 24px; font-weight: 700; color: var(--text-primary);
  margin-bottom: 16px; outline: none; padding: 2px 0;
  letter-spacing: -0.02em; line-height: 1.3;
  border-bottom: 1px solid var(--border); padding-bottom: 12px;
}
.section-title:empty::before { content: attr(data-placeholder); color: var(--text-muted); }
.section-block::after { content: ''; display: table; clear: both; }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-elevated) 50%, var(--bg-surface) 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer { 0%{ background-position:200% 0 } 100%{ background-position:-200% 0 } }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .doc-sidebar { transform: translateX(-100%); }
  .doc-sidebar.open { transform: translateX(0); box-shadow: 20px 0 60px rgba(0,0,0,0.5); }
  .doc-main { margin-left: 0; }
  .doc-content { padding: 24px 20px 80px; }
  .menu-toggle { display: flex; }
  .header-search { display: none; }
  .header-search.mobile-open {
    display: block; position: fixed; top: var(--header-h);
    left: 0; right: 0; padding: 12px; background: var(--bg-base);
    border-bottom: 1px solid var(--border); margin: 0;
    max-width: none; z-index: 999;
  }
  .doc-title { font-size: 28px; }
  .block-image.align-left img,
  .block-image.align-right img { max-width: 100%; float: none; margin: 0; }
  .edit-toolbar { left: 12px; right: 12px; transform: none; border-radius: var(--radius); }
}
@media (max-width: 480px) {
  .header-actions .header-btn span { display: none; }
}

/* ── PRINT ── */
@media print {
  .doc-header, .doc-sidebar, .edit-toolbar, .add-block-bar,
  .block-actions, .banner-remove, .image-align-controls,
  .table-controls { display: none !important; }
  .doc-main { margin-left: 0; }
  body { background: #fff; color: #000; }
  .block-table, .block-code { break-inside: avoid; }
}
