/* ── Tableau Blanc · Design System ── */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --font: 'Space Grotesk', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --bg: #f8f7f4;
  --surface: #ffffff;
  --surface2: #f1f0ec;
  --border: rgba(0,0,0,0.08);
  --border2: rgba(0,0,0,0.14);
  --text: #1a1a18;
  --text2: #5a5a56;
  --text3: #9a9a94;
  --accent: #2563EB;
  --accent-light: #EFF6FF;
  --accent-text: #1D4ED8;
  --green: #059669;
  --green-light: #ECFDF5;
  --amber: #D97706;
  --amber-light: #FFFBEB;
  --red: #DC2626;
  --red-light: #FEF2F2;
  --purple: #7C3AED;
  --purple-light: #F5F3FF;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --sidebar-w: 230px;
  --topbar-h: 52px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111110;
    --surface: #1c1c1a;
    --surface2: #242422;
    --border: rgba(255,255,255,0.08);
    --border2: rgba(255,255,255,0.14);
    --text: #f0efe9;
    --text2: #a0a09a;
    --text3: #606059;
    --accent-light: #1e3a5f;
    --green-light: #0a2e1e;
    --amber-light: #2a1c05;
    --red-light: #2a1010;
    --purple-light: #1e1535;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; overflow: hidden; height: 100dvh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; border-radius: var(--radius); }
button { cursor: pointer; font-family: var(--font); }
input, textarea, select { font-family: var(--font); font-size: 14px; }
::placeholder { color: var(--text3); }

/* ── Layout ── */
.app-layout { display: flex; height: 100dvh; }

/* ── Zone Tableau Blanc (zone centrale principale) ── */
.whiteboard-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  background: var(--bg);
}

/* Canvas wrap principal – prend tout l'espace restant */
.wb-canvas-wrap {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-conic-gradient(var(--surface2) 0% 25%, var(--surface) 0% 50%) 0 0 / 20px 20px;
}
#draw-canvas {
  display: block;
  cursor: crosshair;
  touch-action: none;
}
#draw-canvas.tool-eraser { cursor: cell; }
#draw-canvas.tool-text   { cursor: text; }

/* Hint flottant en bas du canvas */
.wb-hint-bar {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.55);
  color: rgba(255,255,255,0.9);
  font-size: 12px;
  padding: 4px 14px;
  border-radius: 20px;
  pointer-events: none;
  white-space: nowrap;
  backdrop-filter: blur(4px);
}

/* Barre d'outils dessin inline dans la topbar */
.wb-toolbar {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 6px;
}
.wb-toolbar::-webkit-scrollbar { display: none; }

/* Panneau latéral droit : Fil de partages */
.feed-panel {
  width: 320px;
  min-width: 260px;
  max-width: 380px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--surface);
  height: 100dvh;
  overflow: hidden;
  transition: width 0.25s ease, opacity 0.2s ease;
}
.feed-panel.hidden {
  width: 0;
  min-width: 0;
  opacity: 0;
  pointer-events: none;
  border-left: none;
}

.panel-header {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 8px;
}
.panel-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text);
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  transition: transform 0.25s ease;
  z-index: 100;
}
.sidebar-logo {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.logo-mark {
  width: 28px; height: 28px;
  background: var(--accent);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
}
.logo-mark svg { width: 16px; height: 16px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 8px; }
.nav-group { margin-bottom: 20px; }
.nav-group-label {
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text3);
  padding: 0 8px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--radius);
  font-size: 13.5px;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.12s;
  margin-bottom: 2px;
  user-select: none;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--accent-light); color: var(--accent-text); font-weight: 500; }
.nav-item .icon { width: 16px; height: 16px; opacity: 0.75; flex-shrink: 0; }
.nav-item.active .icon { opacity: 1; }
.nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-family: var(--mono);
  background: var(--accent);
  color: white;
  padding: 1px 6px;
  border-radius: 10px;
  line-height: 1.6;
}
.nav-badge.green { background: var(--green); }

.sidebar-online {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.online-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.online-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text3); font-weight: 500; }
.online-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.avatars-row { display: flex; }
.avatar-sm {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600;
  color: white;
  border: 2px solid var(--surface);
  margin-right: -5px;
  flex-shrink: 0;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 12px 0 16px;
  gap: 8px;
  background: var(--surface);
  flex-shrink: 0;
  overflow: hidden;
}
.topbar-title-wrap { flex-shrink: 0; min-width: 0; }
.topbar-title { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title small { font-size: 12px; font-weight: 400; color: var(--text3); margin-left: 8px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text);
  transition: all 0.12s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface2); }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn.primary:hover { background: #1D4ED8; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.ghost { border-color: transparent; }
.btn.ghost:hover { background: var(--surface2); border-color: var(--border); }
.btn.danger { color: var(--red); border-color: var(--red); }
.btn.danger:hover { background: var(--red-light); }
.btn svg { width: 14px; height: 14px; }

/* ── Status badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-weight: 500;
}
.badge.offline { background: var(--amber-light); color: var(--amber); border: 1px solid color-mix(in srgb, var(--amber) 20%, transparent); }
.badge.online { background: var(--green-light); color: var(--green); }
.badge.syncing { background: var(--accent-light); color: var(--accent-text); }

/* ── Feed ── */
.feed {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}
.feed::-webkit-scrollbar { width: 5px; }
.feed::-webkit-scrollbar-track { background: transparent; }
.feed::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── Post card ── */
.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
  position: relative;
  animation: fadeIn 0.2s ease;
}
.post-card:hover { border-color: var(--border2); box-shadow: var(--shadow); }
.post-card.pinned { border-left: 3px solid var(--accent); }
.post-card.thread-reply { background: var(--surface2); margin-left: 24px; border-left: 2px solid var(--border2); }

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.post-header { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.post-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  color: white;
  flex-shrink: 0;
}
.post-meta { flex: 1; min-width: 0; }
.post-author { font-size: 13.5px; font-weight: 500; }
.post-time { font-size: 11.5px; color: var(--text3); }
.post-actions-menu { display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s; }
.post-card:hover .post-actions-menu { opacity: 1; }

.post-content {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  margin-bottom: 10px;
  word-break: break-word;
  white-space: pre-wrap;
}
.post-content.edited::after { content: ' (modifié)'; font-size: 11px; color: var(--text3); }

/* ── File attachment ── */
.file-attachment {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 10px;
  transition: border-color 0.12s;
}
.file-attachment:hover { border-color: var(--border2); }
.file-icon-wrap {
  width: 36px; height: 36px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  color: white;
  flex-shrink: 0;
}
.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 11px; color: var(--text3); }

/* ── Image preview ── */
.img-preview {
  max-height: 320px;
  width: 100%;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 10px;
  cursor: zoom-in;
}

/* ── Reactions ── */
.reactions-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.reaction-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 13px;
  background: var(--surface2);
  border: 1px solid transparent;
  color: var(--text2);
  transition: all 0.12s;
  user-select: none;
}
.reaction-btn:hover { border-color: var(--border2); background: var(--surface); }
.reaction-btn.mine { background: var(--accent-light); border-color: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--accent-text); }
.reaction-btn.mine:hover { background: var(--accent-light); }
.reaction-btn .count { font-size: 12px; font-family: var(--mono); font-weight: 500; }
.add-reaction-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: transparent;
  border: 1px dashed var(--border2);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  color: var(--text3);
  transition: all 0.12s;
}
.add-reaction-btn:hover { background: var(--surface2); border-style: solid; color: var(--text2); }

.reply-btn {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px;
  color: var(--text3);
  background: none;
  border: none;
  padding: 3px 8px;
  border-radius: var(--radius);
  transition: all 0.12s;
}
.reply-btn:hover { background: var(--surface2); color: var(--text2); }
.reply-btn svg { width: 13px; height: 13px; }

/* ── Thread view ── */
.thread-container { display: none; margin-top: 8px; border-top: 1px solid var(--border); padding-top: 10px; }
.thread-container.open { display: block; }

/* ── Emoji picker ── */
.emoji-picker {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 10px;
  display: flex; flex-wrap: wrap; gap: 4px;
  width: 220px;
  box-shadow: var(--shadow-md);
  z-index: 200;
}
.emoji-option {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  font-size: 18px;
  cursor: pointer;
  transition: background 0.1s;
  border: none; background: none;
}
.emoji-option:hover { background: var(--surface2); }

/* ── Compose ── */
.compose-area {
  border-top: 1px solid var(--border);
  padding: 10px 12px;
  background: var(--surface);
  flex-shrink: 0;
}
.compose-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.compose-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.compose-textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  padding: 12px 14px 6px;
  font-size: 14px;
  color: var(--text);
  resize: none;
  min-height: 60px;
  max-height: 200px;
  line-height: 1.6;
}
.compose-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-top: 1px solid var(--border);
}
.compose-tool-btn {
  width: 30px; height: 30px;
  border-radius: var(--radius);
  background: none;
  border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  color: var(--text2);
  transition: all 0.12s;
}
.compose-tool-btn:hover { background: var(--border); color: var(--text); }
.compose-submit { margin-left: auto; }
.char-count { font-size: 11px; color: var(--text3); font-family: var(--mono); }

/* ── File upload preview ── */
.upload-preview {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 6px 10px;
  margin: 0 14px 8px;
  font-size: 12px;
  color: var(--text2);
}
.upload-preview .remove-file { margin-left: auto; background: none; border: none; color: var(--text3); font-size: 14px; cursor: pointer; }

/* ── Poll ── */
.poll-container { margin-bottom: 10px; }
.poll-question { font-size: 14px; font-weight: 500; margin-bottom: 8px; }
.poll-option {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.12s;
  position: relative;
  overflow: hidden;
}
.poll-option:hover { border-color: var(--border2); }
.poll-option.voted { border-color: var(--accent); }
.poll-option.my-vote { background: var(--accent-light); border-color: var(--accent); }
.poll-bar {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  transition: width 0.4s ease;
  pointer-events: none;
}
.poll-option-text { font-size: 13.5px; position: relative; flex: 1; }
.poll-pct { font-size: 12px; color: var(--text3); font-family: var(--mono); position: relative; }
.poll-total { font-size: 12px; color: var(--text3); margin-top: 4px; }

/* ── View: Grid ── */
.view-grid {
  display: none;
  padding: 10px 12px;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  overflow-y: auto;
  flex: 1;
}
.view-grid.active { display: grid; }
.feed.active { display: flex; }
.feed { display: none; }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 440px;
  max-height: 90dvh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  animation: slideUp 0.2s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-title { font-size: 17px; font-weight: 600; margin-bottom: 16px; }
.modal-close { position: absolute; top: 16px; right: 16px; background: none; border: none; font-size: 18px; color: var(--text3); cursor: pointer; }

/* ── Form elements ── */
.form-group { margin-bottom: 14px; }
.form-label { font-size: 13px; font-weight: 500; color: var(--text2); margin-bottom: 5px; display: block; }
.form-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.form-error { font-size: 12px; color: var(--red); margin-top: 4px; }

/* ── Toast ── */
.toast-container { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; pointer-events: none; }
.toast {
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  pointer-events: auto;
  animation: toastIn 0.2s ease;
  max-width: 300px;
  display: flex; align-items: center; gap: 8px;
}
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
.toast.warning { background: var(--amber); }
@keyframes toastIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastOut { to { transform: translateX(20px); opacity: 0; } }

/* ── Image lightbox ── */
.lightbox {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 600;
  align-items: center; justify-content: center;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 90vw; max-height: 90dvh; border-radius: var(--radius); }
.lightbox-close { position: absolute; top: 16px; right: 16px; background: none; border: none; color: white; font-size: 24px; cursor: pointer; }

/* ── Auth screen ── */
.auth-screen {
  display: none;
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 900;
  align-items: center; justify-content: center;
}
.auth-screen.show { display: flex; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px; width: 360px; box-shadow: var(--shadow-md); }
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; font-size: 17px; font-weight: 600; }
.auth-hint { font-size: 13px; color: var(--text2); margin-bottom: 20px; line-height: 1.5; }
.auth-divider { text-align: center; color: var(--text3); font-size: 12px; margin: 12px 0; position: relative; }
.auth-divider::before, .auth-divider::after { content: ''; position: absolute; top: 50%; width: 42%; height: 1px; background: var(--border); }
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }

/* ── Pinned indicator ── */
.pin-label { font-size: 11px; color: var(--accent-text); background: var(--accent-light); padding: 2px 8px; border-radius: 4px; display: inline-flex; align-items: center; gap: 4px; margin-bottom: 6px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); z-index: 200; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-md); }
  :root { --sidebar-w: 260px; }
  .mobile-menu-btn { display: flex !important; }
  .feed-panel { width: 280px; min-width: 240px; }
  .wb-toolbar { display: none; }
}
@media (max-width: 540px) {
  .feed-panel { position: fixed; right: 0; top: 0; bottom: 0; z-index: 150; box-shadow: var(--shadow-md); }
  .feed-panel.hidden { width: 0; box-shadow: none; }
}
.mobile-menu-btn { display: none; }

/* ── Loading ── */
.skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--border) 50%, var(--surface2) 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; } }
.skeleton-post { height: 110px; margin-bottom: 10px; }

/* ── Search bar ── */
.search-bar {
  flex: 1;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 10px;
  font-size: 13px;
  color: var(--text2);
  transition: border-color 0.12s;
  min-width: 0;
}
.search-bar:focus-within { border-color: var(--accent); }
.search-bar input { background: none; border: none; outline: none; color: var(--text); font-size: 12px; width: 100%; }
.search-bar svg { width: 13px; height: 13px; flex-shrink: 0; color: var(--text3); }

/* ── Sort/filter ── */
.filter-bar { display: flex; gap: 5px; padding: 0 12px 8px; flex-shrink: 0; overflow-x: auto; scrollbar-width: none; }
.filter-bar::-webkit-scrollbar { display: none; }
.filter-chip {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s;
}
.filter-chip.active { background: var(--accent-light); color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.filter-chip:hover:not(.active) { border-color: var(--border2); }

/* ── Empty state ── */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 200px; gap: 8px; color: var(--text3); }
.empty-state svg { width: 40px; height: 40px; opacity: 0.4; }
.empty-state p { font-size: 14px; }

/* ── Scrollbar ── */
* { scrollbar-width: thin; scrollbar-color: var(--border2) transparent; }

/* ── Dessin à main levée ──────────────────────────────────── */
.draw-modal-inner {
  background: var(--surface);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  width: min(96vw, 900px);
  height: min(92dvh, 680px);
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.28);
}
.draw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.draw-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  font-size: 15px;
}
.draw-header-actions { display: flex; align-items: center; gap: 4px; }

.draw-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
  background: var(--surface2);
}
.draw-tool-group { display: flex; align-items: center; gap: 3px; }
.draw-sep { width: 1px; height: 22px; background: var(--border2); margin: 0 4px; }

.draw-tool {
  width: 30px; height: 30px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  color: var(--text2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.1s;
}
.draw-tool:hover { background: var(--border); color: var(--text); }
.draw-tool.active { background: var(--accent-light); color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }

.draw-color {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.1s;
}
.draw-color:hover { transform: scale(1.15); }
.draw-color.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }

.draw-size {
  width: 30px; height: 30px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.1s;
  color: var(--text);
}
.draw-size:hover { background: var(--border); }
.draw-size.active { background: var(--accent-light); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }

.draw-bg {
  width: 22px; height: 22px;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
}
.draw-bg.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }

.draw-canvas-wrap {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-conic-gradient(var(--surface2) 0% 25%, var(--surface) 0% 50%) 0 0 / 16px 16px;
}
#draw-canvas {
  display: block;
  cursor: crosshair;
  touch-action: none;
}
#draw-canvas.tool-eraser { cursor: cell; }
#draw-canvas.tool-text { cursor: text; }

.draw-text-input {
  position: absolute;
  background: rgba(255,255,255,0.9);
  border: 2px dashed var(--accent);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 16px;
  font-family: var(--font);
  outline: none;
  min-width: 120px;
  color: #1a1a18;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  z-index: 10;
}

.draw-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  gap: 8px;
}
.draw-hint { font-size: 12px; color: var(--text3); }

/* Preview du dessin dans la zone de compose */
.draw-preview-wrap {
  margin: 6px 14px 0;
  position: relative;
  display: inline-block;
}
.draw-preview-wrap img {
  max-height: 160px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: block;
}
.draw-preview-wrap .remove-file {
  position: absolute;
  top: -6px; right: -6px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--text);
  color: var(--surface);
  border: none;
  cursor: pointer;
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
}

/* ══ Collaboration Temps Réel ══════════════════════════════ */

/* Badge "Live" dans la topbar */
.collab-live-badge {
  display: none;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #16a34a;
  background: #dcfce7;
  border: 1px solid #86efac;
  border-radius: 20px;
  padding: 3px 9px 3px 7px;
  flex-shrink: 0;
  user-select: none;
  letter-spacing: 0.03em;
}
.collab-live-badge.active {
  display: flex;
}
.collab-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16a34a;
  animation: collab-pulse 1.8s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes collab-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.75); }
}

/* Mode sombre */
@media (prefers-color-scheme: dark) {
  .collab-live-badge {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.12);
    border-color: rgba(74, 222, 128, 0.3);
  }
  .collab-live-dot { background: #4ade80; }
}

/* Couche curseurs distants */
#collab-cursor-layer {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 10;
}

/* Curseur distant individuel */
.collab-cursor {
  position: absolute;
  pointer-events: none;
  /* transition définie inline pour perf */
}
.collab-cursor svg {
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.35));
}
.collab-cursor-label {
  position: absolute;
  top: 16px;
  left: 4px;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  padding: 2px 6px;
  border-radius: 8px;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  letter-spacing: 0.02em;
}

/* ══════════════════════════════════════════════════════════════
   STICKY NOTES + ZOOM/PAN
   ══════════════════════════════════════════════════════════════ */

/* Curseurs outil */
#draw-canvas.tool-sticky { cursor: crosshair; }
#draw-canvas-wrap.tool-sticky { cursor: crosshair; }
#draw-canvas-wrap.tool-hand   { cursor: grab; }
#draw-canvas-wrap.tool-hand:active { cursor: grabbing; }

/* Layer sticky (pointer-events géré via JS) */
#sticky-layer {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 20;
  overflow: hidden;
}

/* Note post-it */
.sticky-note {
  position: absolute;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.13), 0 1px 3px rgba(0,0,0,0.09);
  display: flex;
  flex-direction: column;
  font-family: var(--font, inherit);
  transition: box-shadow 0.15s;
  animation: sticky-pop-in 0.18s cubic-bezier(.34,1.56,.64,1) both;
}
.sticky-note:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.1);
  z-index: 100;
}

@keyframes sticky-pop-in {
  from { transform: scale(0.6) rotate(-3deg); opacity: 0; }
  to   { transform: scale(1)   rotate(0deg);  opacity: 1; }
}
@keyframes sticky-pop-out {
  from { transform: scale(1);   opacity: 1; }
  to   { transform: scale(0.5); opacity: 0; }
}

/* En-tête draggable */
.sticky-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 4px;
  gap: 4px;
  flex-shrink: 0;
  cursor: grab;
  border-radius: 8px 8px 0 0;
}
.sticky-header:active { cursor: grabbing; }

/* Palette couleurs dans header */
.sticky-color-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: transform 0.12s;
}
.sticky-color-dot:hover { transform: scale(1.3); }

/* Auteur */
.sticky-author {
  font-size: 10px;
  opacity: 0.65;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 64px;
  font-weight: 500;
}

/* Bouton supprimer */
.sticky-delete {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  opacity: 0.4;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.12s, background 0.12s;
}
.sticky-delete:hover {
  opacity: 1;
  background: rgba(0,0,0,0.08);
}

/* Textarea */
.sticky-textarea {
  flex: 1;
  border: none;
  background: transparent;
  resize: none;
  padding: 4px 10px 10px;
  font-size: 13px;
  line-height: 1.55;
  font-family: inherit;
  outline: none;
  min-height: 80px;
  cursor: text;
}
.sticky-textarea::placeholder { opacity: 0.45; }

/* Contrôles zoom dans la toolbar */
#zoom-controls {
  align-items: center;
  gap: 3px;
}
#sticky-zoom-display {
  font-size: 10px;
  color: var(--text3);
  min-width: 34px;
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Responsive : masquer le label zoom sur mobile */
@media (max-width: 700px) {
  #sticky-zoom-display { display: none; }
}
