:root {
  --bg-base: #090b12;
  --bg-surface: #111524;
  --bg-elevated: #171c30;
  --bg-hover: #1f2642;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.55);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-indigo: #6366f1;
  --accent-indigo-glow: rgba(99, 102, 241, 0.25);
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-cyan: #06b6d4;
  --accent-violet: #a855f7;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

/* ========================================================================= */
/* BOUTONS & BADGES                                                          */
/* ========================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
  text-decoration: none;
  color: var(--text-primary);
}

.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8125rem; }
.btn-xs { padding: 0.28rem 0.6rem; font-size: 0.76rem; border-radius: 8px; }
.btn-lg { padding: 0.8rem 1.4rem; font-size: 0.95rem; }
.btn-block { width: 100%; }

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-elevated);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: rgba(255, 255, 255, 0.18);
}

.btn-ai {
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  color: #fff;
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
}
.btn-ai:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-voice {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
}
.btn-voice:hover, .btn-voice.recording {
  background: #10b981;
  color: #fff;
}

.icon-btn, .icon-btn-sm {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.icon-btn { width: 34px; height: 34px; font-size: 0.95rem; }
.icon-btn-sm { width: 26px; height: 26px; font-size: 0.8rem; }
.icon-btn:hover, .icon-btn-sm:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.icon-btn.danger:hover {
  background: rgba(244, 63, 94, 0.18);
  border-color: rgba(244, 63, 94, 0.4);
  color: #fb7185;
}
.icon-btn.active {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fbbf24;
}

/* ========================================================================= */
/* ÉCRAN D'AUTHENTIFICATION SSO                                              */
/* ========================================================================= */
.auth-wall {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: radial-gradient(circle at 50% 20%, rgba(99, 102, 241, 0.16), transparent 60%), var(--bg-base);
}

.auth-card {
  position: relative;
  max-width: 580px;
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 2.5rem;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.auth-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

.auth-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #818cf8;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
}

.auth-card h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-bottom: 1.5rem;
}

.auth-features-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  text-align: left;
  margin-bottom: 1.75rem;
}

.auth-feat {
  display: flex;
  gap: 0.65rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  padding: 0.75rem;
  border-radius: 12px;
}
.auth-feat span { font-size: 1.3rem; }
.auth-feat strong { display: block; font-size: 0.82rem; color: var(--text-primary); }
.auth-feat small { font-size: 0.74rem; color: var(--text-secondary); }

.auth-error {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fda4af;
  padding: 0.65rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.auth-footer {
  margin-top: 1.25rem;
}
.auth-footer a {
  color: var(--text-secondary);
  font-size: 0.82rem;
  text-decoration: none;
}
.auth-footer a:hover { color: var(--text-primary); }

/* ========================================================================= */
/* STRUCTURE PRINCIPALE (TOPBAR + WORKSPACE)                                 */
/* ========================================================================= */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.topbar {
  height: 60px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  gap: 1rem;
  flex-shrink: 0;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.ecosystem-pill {
  font-size: 0.75rem;
  font-weight: 600;
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.28);
  padding: 0.25rem 0.6rem;
  border-radius: 99px;
  text-decoration: none;
}
.ecosystem-pill:hover {
  background: rgba(99, 102, 241, 0.24);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.app-brand-icon { font-size: 1.35rem; }
.app-brand-title { font-weight: 800; font-size: 0.98rem; display: block; line-height: 1.1; }
.app-brand-sub { font-size: 0.68rem; color: var(--text-secondary); }

.topbar-center {
  flex: 1;
  max-width: 540px;
}

.search-bar {
  display: flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0.2rem 0.3rem 0.2rem 0.7rem;
  gap: 0.4rem;
}
.search-bar:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18);
}
.search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
}

.btn-ai-pill {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(236, 72, 153, 0.25));
  border: 1px solid rgba(168, 85, 247, 0.45);
  color: #e9d5ff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.28rem 0.65rem;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-ai-pill:hover {
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  color: #fff;
}

.view-switcher {
  display: flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0.18rem;
  gap: 0.15rem;
}

.view-tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.32rem 0.65rem;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.view-tab.active {
  background: var(--accent-indigo);
  color: #fff;
}

.user-profile-pill {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  padding: 0.25rem 0.6rem;
  border-radius: 99px;
  font-size: 0.8rem;
}
.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-indigo);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
}
.logout-link {
  color: var(--text-secondary);
  text-decoration: none;
  margin-left: 0.2rem;
}
.logout-link:hover { color: #fb7185; }

/* ========================================================================= */
/* BANNIÈRE RECHERCHE SÉMANTIQUE IA                                          */
/* ========================================================================= */
.ai-search-banner {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.15));
  border-bottom: 1px solid rgba(168, 85, 247, 0.35);
  padding: 0.75rem 1.25rem;
}
.ai-search-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
  color: #e9d5ff;
  font-size: 0.85rem;
}
#ai-search-direct-answer {
  font-size: 0.88rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}
.ai-search-matches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.ai-match-chip {
  background: var(--bg-elevated);
  border: 1px solid rgba(168, 85, 247, 0.4);
  padding: 0.3rem 0.65rem;
  border-radius: 8px;
  font-size: 0.78rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.ai-match-chip:hover {
  background: var(--bg-hover);
}

/* ========================================================================= */
/* CORPS WORKSPACE (SIDEBAR + MAIN + CHAT DRAWER)                            */
/* ========================================================================= */
.workspace-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.left-sidebar {
  width: 240px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 0.9rem;
  gap: 1.1rem;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.sidebar-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  display: block;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  font-size: 0.84rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.nav-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}
.nav-item.active {
  background: rgba(99, 102, 241, 0.16);
  color: #a5b4fc;
  font-weight: 600;
}

.nav-count {
  font-size: 0.72rem;
  background: var(--bg-elevated);
  padding: 0.1rem 0.45rem;
  border-radius: 99px;
  color: var(--text-muted);
}

.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.tag-pill {
  font-size: 0.73rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
}
.tag-pill:hover, .tag-pill.active {
  border-color: var(--accent-indigo);
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.14);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}
.ai-status-indicator {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.74rem;
  color: var(--text-secondary);
}
.dot-online {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
}

/* ========================================================================= */
/* ZONE PRINCIPALE & VUES                                                    */
/* ========================================================================= */
.main-stage {
  flex: 1;
  display: flex;
  overflow: hidden;
  background: var(--bg-base);
}

.stage-view {
  display: none;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.stage-view.active {
  display: flex;
}

/* ========================================================================= */
/* VUE 1 : ÉDITEUR MARKDOWN & LISTE DE NOTES                                 */
/* ========================================================================= */
.notes-list-pane {
  width: 300px;
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.pane-header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pane-header h2 {
  font-size: 0.92rem;
  font-weight: 700;
}
.badge-count {
  background: var(--bg-elevated);
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  color: var(--text-secondary);
}

.notes-list-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.note-list-item {
  padding: 0.75rem;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.15s;
}
.note-list-item:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: var(--bg-hover);
}
.note-list-item.active {
  border-color: var(--accent-indigo);
  background: rgba(99, 102, 241, 0.12);
}

.note-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
}
.note-item-title {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.note-item-excerpt {
  font-size: 0.76rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.45rem;
}
.note-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* Panneau détail de la note */
.note-detail-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.active-note-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.note-meta-bar {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--bg-surface);
}

.note-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.emoji-input {
  width: 42px;
  height: 38px;
  font-size: 1.35rem;
  text-align: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-primary);
}

.title-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 700;
  outline: none;
}

.note-actions-top {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.save-indicator {
  font-size: 0.74rem;
  color: var(--accent-emerald);
  margin-right: 0.35rem;
}

.note-properties-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1.25rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.prop-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.76rem;
  color: var(--text-secondary);
}
.prop-item select, .prop-item input {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 0.2rem 0.45rem;
  font-size: 0.76rem;
  outline: none;
}

.note-tags-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.4rem 1.25rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}
.note-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.note-tag-badge {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
  font-size: 0.72rem;
  padding: 0.12rem 0.5rem;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.note-tag-badge button {
  background: none;
  border: none;
  color: #a5b4fc;
  cursor: pointer;
  font-size: 0.7rem;
}
.tag-input-inline {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.76rem;
  outline: none;
  min-width: 170px;
}

/* Barre d'outils Markdown */
.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 1.25rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
}
.md-tools {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}
.tool-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.76rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
}
.tool-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}
.tool-sep {
  width: 1px;
  height: 16px;
  background: var(--border-subtle);
  margin: 0 0.25rem;
}

.editor-mode-tabs {
  display: flex;
  background: var(--bg-surface);
  border-radius: 7px;
  padding: 0.15rem;
  border: 1px solid var(--border-subtle);
}
.mode-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.74rem;
  padding: 0.22rem 0.55rem;
  border-radius: 5px;
  cursor: pointer;
}
.mode-btn.active {
  background: var(--accent-indigo);
  color: #fff;
}

/* Barre d'actions IA d'écriture */
.ai-writing-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1.25rem;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.08), rgba(168, 85, 247, 0.08));
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
}
.ai-bar-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: #c084fc;
  white-space: nowrap;
}
.ai-action-chip {
  background: var(--bg-elevated);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: #e9d5ff;
  font-size: 0.73rem;
  padding: 0.24rem 0.6rem;
  border-radius: 99px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.ai-action-chip:hover {
  background: rgba(168, 85, 247, 0.25);
  border-color: #a855f7;
}
.ai-lang-select {
  background: var(--bg-elevated);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: #e9d5ff;
  font-size: 0.73rem;
  padding: 0.22rem 0.5rem;
  border-radius: 99px;
  outline: none;
}

/* Zone Split Édition / Aperçu */
.editor-split-area {
  flex: 1;
  display: grid;
  overflow: hidden;
  min-height: 220px;
}
.editor-split-area.mode-split {
  grid-template-columns: 1fr 1fr;
}
.editor-split-area.mode-write {
  grid-template-columns: 1fr;
}
.editor-split-area.mode-write .editor-pane-preview {
  display: none;
}
.editor-split-area.mode-preview {
  grid-template-columns: 1fr;
}
.editor-split-area.mode-preview .editor-pane-write {
  display: none;
}

.editor-pane-write {
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
}

#note-content-textarea {
  width: 100%;
  height: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  border: none;
  padding: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.65;
  resize: none;
  outline: none;
}

.editor-pane-preview {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  background: rgba(17, 21, 36, 0.5);
}

/* Style du rendu Markdown */
.markdown-body h1 { font-size: 1.45rem; margin-bottom: 0.75rem; border-bottom: 1px solid var(--border-subtle); padding-bottom: 0.35rem; }
.markdown-body h2 { font-size: 1.18rem; margin: 1.1rem 0 0.5rem; color: #a5b4fc; }
.markdown-body h3 { font-size: 1.02rem; margin: 0.9rem 0 0.4rem; }
.markdown-body p { margin-bottom: 0.75rem; font-size: 0.9rem; color: var(--text-primary); }
.markdown-body ul, .markdown-body ol { margin: 0.5rem 0 0.85rem 1.35rem; font-size: 0.9rem; }
.markdown-body li { margin-bottom: 0.25rem; }
.markdown-body code {
  font-family: var(--font-mono);
  background: var(--bg-elevated);
  padding: 0.15rem 0.38rem;
  border-radius: 5px;
  font-size: 0.82rem;
  color: #f472b6;
}
.markdown-body pre {
  background: #06080e;
  border: 1px solid var(--border-subtle);
  padding: 0.85rem;
  border-radius: 10px;
  overflow-x: auto;
  margin-bottom: 0.9rem;
}
.markdown-body pre code {
  background: none;
  padding: 0;
  color: #e2e8f0;
}
.markdown-body blockquote {
  border-left: 3px solid var(--accent-indigo);
  background: rgba(99, 102, 241, 0.08);
  padding: 0.6rem 0.9rem;
  border-radius: 0 8px 8px 0;
  margin-bottom: 0.85rem;
  color: var(--text-secondary);
}
.wikilink-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
  padding: 0.08rem 0.45rem;
  border-radius: 6px;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.wikilink-pill:hover {
  background: var(--accent-indigo);
  color: #fff;
}

/* Panneaux bas : Checklist & WikiLinks */
.note-bottom-panels {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  max-height: 210px;
  overflow: hidden;
}

.checklist-panel, .backlinks-panel {
  padding: 0.75rem 1.1rem;
  overflow-y: auto;
}
.checklist-panel {
  border-right: 1px solid var(--border-subtle);
}

.panel-sub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.panel-sub-header h4 {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-mini {
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  padding: 0.1rem 0.4rem;
  border-radius: 99px;
  font-size: 0.7rem;
}

.checklist-items {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
}
.chk-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
  background: var(--bg-elevated);
  font-size: 0.8rem;
}
.chk-row label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  flex: 1;
}
.chk-row.done span {
  text-decoration: line-through;
  color: var(--text-muted);
}
.checklist-add-row {
  display: flex;
  gap: 0.4rem;
}
.checklist-add-row input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 0.28rem 0.55rem;
  font-size: 0.78rem;
  outline: none;
}

.note-links-container {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.78rem;
}
.stats-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ========================================================================= */
/* VUE 2 : CARTES VISUELLES & POST-ITS (STYLE GOOGLE KEEP)                   */
/* ========================================================================= */
.keep-container {
  width: 100%;
  padding: 1.5rem;
  overflow-y: auto;
}

.keep-quick-capture {
  max-width: 680px;
  margin: 0 auto 2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1rem 1.25rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}
.keep-capture-header {
  display: flex;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
}
.keep-capture-header input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 700;
  outline: none;
}
.keep-color-picker {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 0.25rem 0.5rem;
  font-size: 0.78rem;
}
.keep-quick-capture textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  resize: vertical;
  outline: none;
  margin-bottom: 0.6rem;
}
.keep-capture-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.6rem;
}
.keep-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
}
.keep-capture-btns {
  display: flex;
  gap: 0.5rem;
}

.keep-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.keep-card {
  border-radius: 14px;
  padding: 1rem;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.16s, box-shadow 0.16s;
  position: relative;
}
.keep-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}

/* Variantes de couleurs de cartes */
.keep-card.color-indigo { border-top: 4px solid var(--accent-indigo); background: linear-gradient(180deg, rgba(99, 102, 241, 0.1), var(--bg-surface) 45%); }
.keep-card.color-emerald { border-top: 4px solid var(--accent-emerald); background: linear-gradient(180deg, rgba(16, 185, 129, 0.1), var(--bg-surface) 45%); }
.keep-card.color-amber { border-top: 4px solid var(--accent-amber); background: linear-gradient(180deg, rgba(245, 158, 11, 0.1), var(--bg-surface) 45%); }
.keep-card.color-rose { border-top: 4px solid var(--accent-rose); background: linear-gradient(180deg, rgba(244, 63, 94, 0.1), var(--bg-surface) 45%); }
.keep-card.color-cyan { border-top: 4px solid var(--accent-cyan); background: linear-gradient(180deg, rgba(6, 182, 212, 0.1), var(--bg-surface) 45%); }
.keep-card.color-violet { border-top: 4px solid var(--accent-violet); background: linear-gradient(180deg, rgba(168, 85, 247, 0.1), var(--bg-surface) 45%); }

.keep-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}
.keep-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}
.keep-card-body {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  max-height: 150px;
  overflow: hidden;
}
.keep-card-checklist {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}
.keep-chk-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
}
.keep-chk-item.done span {
  text-decoration: line-through;
  color: var(--text-muted);
}
.keep-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.55rem;
  margin-top: auto;
}

/* ========================================================================= */
/* VUE 3 : TABLEAUX KANBAN                                                   */
/* ========================================================================= */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(260px, 1fr));
  gap: 1rem;
  padding: 1.25rem;
  width: 100%;
  overflow-x: auto;
  height: 100%;
}

.kanban-column {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  max-height: 100%;
  overflow: hidden;
}

.kanban-col-header {
  padding: 0.8rem 1rem;
  font-size: 0.86rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}
.kanban-col-header.status-todo { border-top: 3px solid #6366f1; }
.kanban-col-header.status-progress { border-top: 3px solid #f59e0b; }
.kanban-col-header.status-review { border-top: 3px solid #06b6d4; }
.kanban-col-header.status-done { border-top: 3px solid #10b981; }

.kanban-count {
  background: var(--bg-elevated);
  padding: 0.1rem 0.45rem;
  border-radius: 99px;
  font-size: 0.74rem;
}

.kanban-cards-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.kanban-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0.8rem;
  cursor: grab;
  transition: all 0.15s;
}
.kanban-card:hover {
  border-color: var(--accent-indigo);
  transform: translateY(-2px);
}

.priority-badge {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
}
.priority-urgent { background: rgba(244, 63, 94, 0.2); color: #fb7185; }
.priority-high { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.priority-medium { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.priority-low { background: rgba(16, 185, 129, 0.2); color: #34d399; }

.kanban-add-btn {
  margin: 0.6rem;
  padding: 0.5rem;
  background: transparent;
  border: 1px dashed var(--border-subtle);
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
}
.kanban-add-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* ========================================================================= */
/* VOLET LATÉRAL DROIT : CORTEX IA (CHAT AVEC MES NOTES)                     */
/* ========================================================================= */
.chat-drawer {
  width: 360px;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.chat-drawer-header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-agent-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.chat-avatar {
  font-size: 1.5rem;
}
.chat-agent-title h3 { font-size: 0.92rem; font-weight: 700; }
.chat-agent-title small { font-size: 0.72rem; color: var(--text-secondary); display: block; }

.chat-quick-prompts {
  display: flex;
  gap: 0.35rem;
  padding: 0.55rem 0.75rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-subtle);
}
.chat-chip {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.7rem;
  padding: 0.25rem 0.55rem;
  border-radius: 99px;
  white-space: nowrap;
  cursor: pointer;
}
.chat-chip:hover {
  border-color: var(--accent-indigo);
  color: #a5b4fc;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-bubble {
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  font-size: 0.82rem;
  line-height: 1.5;
  max-width: 92%;
}
.chat-bubble.ai {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  align-self: flex-start;
}
.chat-bubble.user {
  background: var(--accent-indigo);
  color: #fff;
  align-self: flex-end;
}

.chat-input-bar {
  padding: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 0.45rem;
}
.chat-input-bar input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  font-size: 0.82rem;
  outline: none;
}

/* ========================================================================= */
/* MODALS & OVERLAY PARTAGE PUBLIC                                           */
/* ========================================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 13, 0.75);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  max-width: 560px;
  width: 100%;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-body {
  padding: 1.25rem;
}
.modal-desc {
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}
.modal-body textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-primary);
  padding: 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  outline: none;
}
.modal-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

.voice-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}
.input-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
}
.voice-status {
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.ai-template-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.75rem;
}
.chip-suggest {
  font-size: 0.74rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
}
.chip-suggest:hover {
  border-color: var(--accent-indigo);
  color: #a5b4fc;
}

.share-url-box {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.65rem;
}
.share-url-box input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: #a5b4fc;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  font-size: 0.82rem;
}
.modal-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 1.1rem 0;
}
.export-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-top: 0.65rem;
}

/* Vue Partage Public */
.public-share-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-base);
  overflow-y: auto;
  z-index: 2000;
  padding: 2rem 1rem;
}
.public-share-card {
  max-width: 820px;
  margin: 0 auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 2rem;
}
.public-share-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--accent-indigo);
  color: var(--text-primary);
  padding: 0.65rem 1rem;
  border-radius: 10px;
  font-size: 0.84rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.empty-state {
  margin: auto;
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
}
.empty-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }

@media (max-width: 960px) {
  .notes-list-pane { width: 220px; }
  .editor-split-area.mode-split { grid-template-columns: 1fr; }
  .note-bottom-panels { grid-template-columns: 1fr; }
}
