*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family:
    "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;
  background: #fafaf9;
  color: #292524;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a {
  text-decoration: none;
  color: inherit;
}
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}
input,
select {
  font-family: inherit;
}

/* ── Bouton admin (roue crantée) ── */
.btn-admin {
  position: fixed;
  top: 16px;
  right: 20px;
  z-index: 50;
  font-size: 1.4rem;
  color: #78716c;
  text-decoration: none;
  background: #f5f5f4;
  border: 1px solid #e7e5e4;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s,
    color 0.15s,
    transform 0.3s;
  line-height: 1;
}
.btn-admin:hover {
  background: #292524;
  color: #fff;
  border-color: #292524;
  transform: rotate(60deg);
}

/* ── Layout deux colonnes ── */
.shell {
  display: flex;
  min-height: 100vh;
}
.panel {
  flex: 1;
  padding: 60px 36px 80px;
  overflow-y: auto;
}
.panel-left {
  border-right: 1px solid #e7e5e4;
}
.inner {
  max-width: 520px;
  margin: 0 auto;
}

@media (max-width: 860px) {
  .shell {
    flex-direction: column;
  }
  .panel-left {
    border-right: none;
    border-bottom: 1px solid #e7e5e4;
  }
}

/* ── Typo commune ── */
h1 {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}
.accent {
  color: #f97316;
}
.subtitle {
  font-family: "Cascadia Code", "SF Mono", "Consolas", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #a8a29e;
  margin-top: 4px;
  margin-bottom: 40px;
}
h2 {
  font-family: "Cascadia Code", "SF Mono", "Consolas", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* ══════════════════════════════════
   PANEL GAUCHE — Tâches
   ══════════════════════════════════ */

/* Barre d'ajout */
.add-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
}
.add-bar input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  font-size: 0.875rem;
  border: 1px solid #d6d3d1;
  border-radius: 8px;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}
.add-bar input[type="text"]:focus {
  border-color: #f97316;
}
.add-bar select {
  padding: 10px 10px;
  font-size: 0.75rem;
  border: 1px solid #d6d3d1;
  border-radius: 8px;
  background: #fff;
  color: #78716c;
  outline: none;
}
.add-bar button {
  padding: 10px 18px;
  font-size: 0.8rem;
  font-weight: 600;
  background: #292524;
  color: #fafaf9;
  border-radius: 8px;
  transition: background 0.15s;
}
.add-bar button:hover {
  background: #f97316;
}

/* Filtres */
.filters {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filters button {
  font-family: "Cascadia Code", "SF Mono", "Consolas", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid #e7e5e4;
  color: #a8a29e;
  transition: all 0.15s;
}
.filters button:hover {
  border-color: #292524;
  color: #292524;
}
.filters button.active {
  background: #292524;
  color: #fafaf9;
  border-color: #292524;
}

/* Liste de tâches */
.tasks {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.task {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid;
  transition:
    background 0.15s,
    border-color 0.15s,
    opacity 0.15s;
}
.task.done {
  opacity: 0.5;
}
.task.done .task-text {
  text-decoration: line-through;
  color: #a8a29e;
}

/* Checkbox custom */
.check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  cursor: pointer;
}
.check:hover {
  transform: scale(1.1);
}
.task.done .check {
  background: currentColor;
}
.task.done .check::after {
  content: "✓";
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
}

.task-text {
  flex: 1;
  font-size: 0.875rem;
}
.task-tag {
  font-family: "Cascadia Code", "SF Mono", "Consolas", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 5px;
  flex-shrink: 0;
}
.task-del {
  font-size: 0.8rem;
  color: #d6d3d1;
  transition: color 0.15s;
  padding: 2px 4px;
  flex-shrink: 0;
}
.task-del:hover {
  color: #ef4444;
}

/* Couleurs tâches par catégorie */
.task-urgent {
  border-color: #fecdd3;
  background: rgba(255, 228, 230, 0.3);
  color: #e11d48;
}
.task-urgent .task-tag {
  background: rgba(255, 228, 230, 0.6);
  color: #be123c;
}
.task-normal {
  border-color: #dbeafe;
  background: rgba(219, 234, 254, 0.3);
  color: #2563eb;
}
.task-normal .task-tag {
  background: rgba(219, 234, 254, 0.6);
  color: #1d4ed8;
}
.task-later {
  border-color: #e7e5e4;
  background: rgba(231, 229, 228, 0.3);
  color: #78716c;
}
.task-later .task-tag {
  background: rgba(231, 229, 228, 0.6);
  color: #57534e;
}

.empty-msg {
  text-align: center;
  padding: 40px 0;
  color: #a8a29e;
  font-style: italic;
  font-size: 0.9rem;
}

/* ══════════════════════════════════
   PANEL DROIT — Liens
   ══════════════════════════════════ */
section {
  margin-bottom: 32px;
}
.links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid;
  transition:
    background 0.15s,
    border-color 0.15s;
}
.link:hover .arrow {
  opacity: 1;
}
.link-name {
  font-size: 0.875rem;
  font-weight: 600;
  transition: color 0.15s;
  white-space: pre-wrap;
  word-break: break-all;
}
.link-desc {
  font-size: 0.875rem;
  color: #a8a29e;
  margin-left: 8px;
  white-space: pre-wrap;
  word-break: break-all;
}
.arrow {
  opacity: 0;
  font-size: 0.85rem;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.t-green h2 {
  color: #059669;
}
.t-green .link {
  border-color: #d1fae5;
  background: rgba(209, 250, 229, 0.3);
}
.t-green .link:hover {
  background: rgba(167, 243, 208, 0.35);
}
.t-green .link:hover .link-name {
  color: #047857;
}
.t-green .arrow {
  color: #6ee7b7;
}

.t-violet h2 {
  color: #7c3aed;
}
.t-violet .link {
  border-color: #ede9fe;
  background: rgba(237, 233, 254, 0.3);
}
.t-violet .link:hover {
  background: rgba(221, 214, 254, 0.4);
}
.t-violet .link:hover .link-name {
  color: #6d28d9;
}
.t-violet .arrow {
  color: #c4b5fd;
}

.t-amber h2 {
  color: #d97706;
}
.t-amber .link {
  border-color: #fef3c7;
  background: rgba(254, 243, 199, 0.3);
}
.t-amber .link:hover {
  background: rgba(253, 230, 138, 0.35);
}
.t-amber .link:hover .link-name {
  color: #b45309;
}
.t-amber .arrow {
  color: #fcd34d;
}

.t-sky h2 {
  color: #0284c7;
}
.t-sky .link {
  border-color: #e0f2fe;
  background: rgba(224, 242, 254, 0.3);
}
.t-sky .link:hover {
  background: rgba(186, 230, 253, 0.35);
}
.t-sky .link:hover .link-name {
  color: #0369a1;
}
.t-sky .arrow {
  color: #7dd3fc;
}

.t-rose h2 {
  color: #e11d48;
}
.t-rose .link {
  border-color: #ffe4e6;
  background: rgba(255, 228, 230, 0.3);
}
.t-rose .link:hover {
  background: rgba(254, 205, 211, 0.35);
}
.t-rose .link:hover .link-name {
  color: #be123c;
}
.t-rose .arrow {
  color: #fda4af;
}

.t-teal h2 {
  color: #0d9488;
}
.t-teal .link {
  border-color: #ccfbf1;
  background: rgba(204, 251, 241, 0.3);
}
.t-teal .link:hover {
  background: rgba(153, 246, 228, 0.3);
}
.t-teal .link:hover .link-name {
  color: #0f766e;
}
.t-teal .arrow {
  color: #5eead4;
}

/* ── Toggle collapse section liens ── */
.btn-toggle-cat {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a8a29e;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.btn-toggle-cat:hover {
  color: #292524;
  background: rgba(0, 0, 0, 0.05);
}
.btn-toggle-cat svg {
  transition: transform 0.2s;
}
section.collapsed .btn-toggle-cat svg {
  transform: rotate(-90deg);
}
section.collapsed .links {
  display: none;
}

/* ── Header catégorie avec corbeille ── */
.cat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.cat-header h2 {
  margin-bottom: 0;
}
.cat-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.btn-add-link {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  background: #fff7ed;
  color: #f97316;
  flex-shrink: 0;
  transition:
    background 0.15s,
    color 0.15s;
}
.btn-add-link:hover {
  background: #f97316;
  color: #fff;
}
.btn-del-cat {
  font-size: 0.8rem;
  padding: 3px 6px;
  border-radius: 5px;
  background: #fef2f2;
  color: #ef4444;
  flex-shrink: 0;
  transition:
    background 0.15s,
    color 0.15s;
}
.btn-del-cat:hover {
  background: #ef4444;
  color: #fff;
}
.link-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.link:hover .link-actions {
  opacity: 1;
}
.btn-edit-link,
.btn-del-link {
  font-size: 0.75rem;
  padding: 3px 7px;
  border-radius: 5px;
  font-weight: 600;
  transition:
    background 0.15s,
    color 0.15s;
}
.btn-edit-link {
  background: #fff7ed;
  color: #f97316;
}
.btn-edit-link:hover {
  background: #f97316;
  color: #fff;
}
.btn-del-link {
  background: #fef2f2;
  color: #ef4444;
}
.btn-del-link:hover {
  background: #ef4444;
  color: #fff;
}

/* ── Barre d'actions liens ── */
.liens-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

/* ── Bouton mode édition + bouton ajouter catégorie (styles communs) ── */
.btn-add-cat,
.btn-add-note,
.btn-edit-mode,
.btn-save {
  font-family: "Cascadia Code", "SF Mono", "Consolas", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 7px 14px;
  border-radius: 8px;
  transition:
    border-color 0.15s,
    color 0.15s;
}
.btn-add-cat {
  border: 1px dashed #d6d3d1;
  color: #a8a29e;
  display: none;
}
.inner:has(#linksContainer.edit-mode) .btn-add-cat {
  display: flex;
}
.btn-add-cat:hover {
  background: #f97316;
  border-color: #f97316;
  color: #fff;
}
.btn-edit-mode {
  border: 1px solid #e7e5e4;
  color: #78716c;
}
.btn-edit-mode:hover {
  border-color: #292524;
  color: #292524;
}
.btn-save {
  display: none;
  background: #047857;
  border: 1px solid #047857;
  color: #fff;
}
.btn-save:hover {
  background: #059669;
  border-color: #059669;
  color: #fff;
}

/* ── Mode édition : rendre tous les boutons d'action visibles ── */
.edit-mode .link-actions,
.edit-mode .cat-actions {
  opacity: 1;
  pointer-events: auto;
}
.edit-mode .note-actions,
.edit-mode .bloc-actions {
  pointer-events: auto;
}
/* Masquer le hover hors mode édition */
.link:hover .link-actions {
  opacity: 0;
}
.edit-mode .link:hover .link-actions {
  opacity: 1;
}

/* ── Modale ── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(41, 37, 36, 0.4);
  backdrop-filter: blur(2px);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.modal-backdrop.open {
  display: flex;
}
.modal {
  background: #fff;
  border-radius: 14px;
  padding: 28px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}
.modal h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 20px;
  letter-spacing: -0.01em;
}
.modal label {
  display: block;
  font-family: "Cascadia Code", "SF Mono", "Consolas", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #a8a29e;
  margin-bottom: 5px;
}
.modal input[type="text"],
.modal select {
  width: 100%;
  padding: 9px 12px;
  font-size: 0.875rem;
  border: 1px solid #d6d3d1;
  border-radius: 8px;
  outline: none;
  margin-bottom: 16px;
  transition: border-color 0.15s;
}
.modal input[type="text"]:focus,
.modal select:focus {
  border-color: #f97316;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.modal-actions button {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 8px;
  transition: background 0.15s;
}
.btn-cancel {
  border: 1px solid #e7e5e4;
  color: #78716c;
}
.btn-cancel:hover {
  background: #f5f5f4;
}
.btn-confirm {
  background: #292524;
  color: #fafaf9;
}
.btn-confirm:hover {
  background: #f97316;
}

/* ══════════════════════════════════════
   PANEL MILIEU — Notes
   ══════════════════════════════════════ */

.btn-add-note {
  border: 1px dashed #d6d3d1;
  color: #a8a29e;
  display: none;
}
.inner:has(#notesContainer.edit-mode) .btn-add-note {
  display: flex;
}
.btn-add-note:hover {
  background: #f97316;
  border-color: #f97316;
  color: #fff;
}

.note {
  border-radius: 10px;
  border: 1px solid #e7e5e4;
  margin-bottom: 16px;
}
.note-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #e7e5e4;
}
.note-header h2 {
  margin-bottom: 0;
}
.note-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.edit-mode .note-actions {
  opacity: 1;
}
.note-content {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.note-content b {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: #292524;
  white-space: pre-wrap;
  word-break: break-all;
}
.note-content p {
  font-size: 0.875rem;
  line-height: 1.6;
  color: #292524;
  white-space: pre-wrap;
  word-break: break-all;
}
.note-content pre {
  font-family: "Cascadia Code", "SF Mono", "Consolas", monospace;
  font-size: 0.78rem;
  background: rgba(0, 0, 0, 0.04);
  padding: 10px 12px;
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-all;
  color: #292524;
}
.note-content ul {
  padding-left: 18px;
  font-size: 0.875rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-all;
}
.bloc-wrapper {
  position: relative;
}
.bloc-actions {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.edit-mode .bloc-actions {
  opacity: 1;
}
.edit-mode .bloc-wrapper {
  padding-right: 72px;
}
.note-footer {
  padding: 8px 16px 12px;
  display: none;
}
.edit-mode .note-footer {
  display: block;
}
.btn-add-bloc {
  font-family: "Cascadia Code", "SF Mono", "Consolas", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px dashed #d6d3d1;
  color: #a8a29e;
  transition: all 0.15s;
}
.btn-add-bloc:hover {
  background: #f97316;
  border-color: #f97316;
  color: #fff;
}
.btn-edit-note,
.btn-edit-bloc {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  background: #fff7ed;
  color: #f97316;
  transition:
    background 0.15s,
    color 0.15s;
}
.btn-edit-note:hover,
.btn-edit-bloc:hover {
  background: #f97316;
  color: #fff;
}
.btn-del-note,
.btn-del-bloc {
  font-size: 0.8rem;
  padding: 3px 6px;
  border-radius: 5px;
  background: #fef2f2;
  color: #ef4444;
  transition:
    background 0.15s,
    color 0.15s;
}
.btn-del-note:hover,
.btn-del-bloc:hover {
  background: #ef4444;
  color: #fff;
}

/* ── Toggle collapse note ── */
.btn-toggle-note {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a8a29e;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.btn-toggle-note:hover {
  color: #292524;
  background: rgba(0, 0, 0, 0.05);
}
.btn-toggle-note svg {
  transition: transform 0.2s;
}
.note.collapsed .btn-toggle-note svg {
  transform: rotate(-90deg);
}
.note.collapsed .note-content,
.note.collapsed .note-footer {
  display: none !important;
}

/* Couleurs des notes par thème */
.note.t-green {
  border-color: #d1fae5;
  background: rgba(209, 250, 229, 0.12);
}
.note.t-green .note-header {
  border-bottom-color: #d1fae5;
}
.note.t-violet {
  border-color: #ede9fe;
  background: rgba(237, 233, 254, 0.12);
}
.note.t-violet .note-header {
  border-bottom-color: #ede9fe;
}
.note.t-amber {
  border-color: #fef3c7;
  background: rgba(254, 243, 199, 0.12);
}
.note.t-amber .note-header {
  border-bottom-color: #fef3c7;
}
.note.t-sky {
  border-color: #e0f2fe;
  background: rgba(224, 242, 254, 0.12);
}
.note.t-sky .note-header {
  border-bottom-color: #e0f2fe;
}
.note.t-rose {
  border-color: #ffe4e6;
  background: rgba(255, 228, 230, 0.12);
}
.note.t-rose .note-header {
  border-bottom-color: #ffe4e6;
}
.note.t-teal {
  border-color: #ccfbf1;
  background: rgba(204, 251, 241, 0.12);
}
.note.t-teal .note-header {
  border-bottom-color: #ccfbf1;
}

/* ── Bouton copier dans les blocs pre ── */
.pre-wrapper {
  position: relative;
}
.btn-copy-pre {
  position: absolute;
  top: 6px;
  right: 8px;
  font-family: "Cascadia Code", "SF Mono", "Consolas", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.06);
  color: #78716c;
  opacity: 0;
  transition:
    opacity 0.15s,
    background 0.15s,
    color 0.15s;
}
.pre-wrapper:hover .btn-copy-pre {
  opacity: 1;
}
.btn-copy-pre:hover {
  background: rgba(0, 0, 0, 0.12);
  color: #292524;
}
.btn-copy-pre.copied {
  background: #d1fae5;
  color: #047857;
}

/* ── Blocs tableau dans les notes ── */
.table-wrapper {
  overflow-x: auto;
}
.note-content table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.note-content table th,
.note-content table td {
  padding: 6px 10px;
  border: 1px solid #e7e5e4;
  text-align: left;
  vertical-align: top;
  overflow-wrap: break-word;
  word-break: break-word;
}
.note-content table th {
  font-family: "Cascadia Code", "SF Mono", "Consolas", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.03);
  color: #78716c;
  font-weight: 600;
}
.note-content table tr:hover td {
  background: rgba(0, 0, 0, 0.02);
}

/* Textarea dans les modales */
.modal textarea {
  width: 100%;
  padding: 9px 12px;
  font-size: 0.875rem;
  font-family: inherit;
  border: 1px solid #d6d3d1;
  border-radius: 8px;
  outline: none;
  margin-bottom: 16px;
  transition: border-color 0.15s;
  resize: vertical;
}
.modal textarea:focus {
  border-color: #f97316;
}

/* ══════════════════════════════════════
   PAGE DIAGRAMME
   ══════════════════════════════════════ */

.diagram-page {
  overflow: hidden;
  height: 100vh;
}

/* ── Barre d'outils ── */
.diagram-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: #fff;
  border-bottom: 1px solid #e7e5e4;
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 4px;
  z-index: 20;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.diagram-topbar-back {
  position: fixed;
  top: 8px;
  right: 16px;
  z-index: 50;
  font-size: 1rem;
  color: #78716c;
  text-decoration: none;
  background: #f5f5f4;
  border: 1px solid #e7e5e4;
  border-radius: 7px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s,
    color 0.15s;
  line-height: 1;
}
.diagram-topbar-back:hover {
  background: #292524;
  color: #fff;
  border-color: #292524;
}
.diagram-tool {
  font-size: 0.95rem;
  padding: 5px 9px;
  border-radius: 6px;
  border: 1px solid transparent;
  color: #78716c;
  background: none;
  cursor: pointer;
  transition:
    background 0.1s,
    color 0.1s,
    border-color 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  flex-shrink: 0;
}
.diagram-tool:hover {
  background: #f5f5f4;
  color: #292524;
  border-color: #e7e5e4;
}
.diagram-tool.active {
  background: #292524;
  color: #fff;
  border-color: #292524;
}
.diagram-back-btn {
  color: #f97316;
  border-color: #fed7aa;
  background: #fff7ed;
}
.diagram-back-btn:hover {
  background: #f97316 !important;
  color: #fff !important;
  border-color: #f97316 !important;
}
.diagram-sep {
  color: #d6d3d1;
  font-size: 1rem;
  padding: 0 1px;
  flex-shrink: 0;
}
.diagram-title-input {
  flex: 1;
  min-width: 60px;
  max-width: 260px;
  font-family: "Cascadia Code", "SF Mono", Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 10px;
  background: transparent;
  outline: none;
  text-align: center;
  color: #292524;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.diagram-title-input:hover {
  border-color: #e7e5e4;
}
.diagram-title-input:focus {
  border-color: #f97316;
  background: #fff;
}
.zoom-level {
  font-family: "Cascadia Code", "SF Mono", Consolas, monospace;
  font-size: 0.62rem;
  color: #a8a29e;
  min-width: 38px;
  text-align: center;
}
.diagram-btn-save {
  font-family: "Cascadia Code", "SF Mono", Consolas, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 6px;
  background: #047857;
  border: 1px solid #047857;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
  display: inline-flex;
  align-items: center;
}
.diagram-btn-save:hover {
  background: #059669;
}

/* ── Canvas SVG ── */
.diagram-canvas {
  position: fixed;
  top: 48px;
  left: 0;
  width: 100vw;
  height: calc(100vh - 48px);
  background: #fafaf9;
  background-image: radial-gradient(circle, #d6d3d1 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: 0 48px;
  cursor: default;
}
.diagram-canvas[data-tool="rect"],
.diagram-canvas[data-tool="rounded"],
.diagram-canvas[data-tool="db"],
.diagram-canvas[data-tool="cloud"],
.diagram-canvas[data-tool="text"] {
  cursor: cell;
}
.diagram-canvas[data-tool="arrow"] {
  cursor: crosshair;
}

/* ── Formes ── */
.shape-group {
  cursor: grab;
}
.shape-group:active {
  cursor: grabbing;
}
.conn-dot {
  opacity: 0;
  transition: opacity 0.12s;
  cursor: crosshair;
}
.shape-group:hover .conn-dot {
  opacity: 1;
}
.diagram-canvas[data-tool="arrow"] .conn-dot {
  opacity: 0.4;
}
.diagram-canvas[data-tool="arrow"] .shape-group:hover .conn-dot {
  opacity: 1;
}
.resize-grip {
  cursor: se-resize;
}
.arrow-group {
  cursor: pointer;
}

/* ── Panneau liste des diagrammes ── */
.diagram-list-panel {
  position: fixed;
  top: 48px;
  left: 0;
  width: 220px;
  height: calc(100vh - 48px);
  background: #fff;
  border-right: 1px solid #e7e5e4;
  z-index: 15;
  display: flex;
  flex-direction: column;
  transform: translateX(calc(-100% - 20px));
  transition: transform 0.2s ease, width 0.2s ease;
  box-shadow: 3px 0 10px rgba(0, 0, 0, 0.06);
}
.diagram-list-panel.open {
  transform: translateX(0);
}
.diagram-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #e7e5e4;
  font-family: "Cascadia Code", "SF Mono", Consolas, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #a8a29e;
}
.diagram-list-header button {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 5px;
  background: #fff7ed;
  color: #f97316;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition:
    background 0.1s,
    color 0.1s;
}
.diagram-list-header button:hover {
  background: #f97316;
  color: #fff;
}
#diagramList {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.diagram-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  margin-bottom: 2px;
  transition: background 0.1s;
  border-bottom: 2px solid transparent;
}
.diagram-list-item:hover {
  background: #f5f5f4;
}
.diagram-list-item.active {
  background: #fff7ed;
}
.diagram-list-grip {
  display: none;
}
.diagram-list-group {
  display: block;
}
.diagram-list-children {
  display: block;
}
.diagram-list-expand {
  font-size: 0.65rem;
  color: #a8a29e;
  cursor: pointer;
  flex-shrink: 0;
  user-select: none;
  width: 1em;
  text-align: center;
  transition: color 0.1s;
}
.diagram-list-expand:hover {
  color: #292524;
}
.diagram-list-add {
  opacity: 0;
  font-size: 0.85rem;
  padding: 1px 5px;
  border-radius: 4px;
  color: #f97316;
  background: #fff7ed;
  cursor: pointer;
  border: none;
  flex-shrink: 0;
  transition: opacity 0.1s, background 0.1s;
  font-weight: 600;
  line-height: 1.4;
}
.diagram-list-item:hover .diagram-list-add {
  opacity: 1;
}
.diagram-list-add:hover {
  background: #f97316;
  color: #fff;
}
.diagram-list-name {
  font-size: 0.8rem;
  flex: 1;
  color: #292524;
  word-break: break-word;
}
.diagram-list-del {
  opacity: 0;
  font-size: 0.8rem;
  padding: 2px 5px;
  border-radius: 4px;
  color: #ef4444;
  background: #fef2f2;
  cursor: pointer;
  border: none;
  flex-shrink: 0;
  transition:
    opacity 0.1s,
    background 0.1s;
}
.diagram-list-item:hover .diagram-list-del {
  opacity: 1;
}
.diagram-list-del:hover {
  background: #ef4444;
  color: #fff;
}
.link-picker-item {
  padding: 8px 14px;
  font-size: 0.82rem;
  color: #292524;
  cursor: pointer;
  transition: background 0.1s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.link-picker-item:hover {
  background: #f5f5f4;
}
.link-picker-new {
  padding: 8px 14px;
  font-size: 0.82rem;
  color: #f97316;
  cursor: pointer;
  font-weight: 600;
  border-top: 1px solid #e7e5e4;
  transition: background 0.1s;
}
.link-picker-new:hover {
  background: #fff7ed;
}

/* ── Palette de couleurs ── */
.diagram-color-panel {
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid #e7e5e4;
  border-radius: 10px;
  padding: 7px 12px;
  display: flex;
  gap: 7px;
  z-index: 30;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}
.color-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
  transition: transform 0.1s;
}
.color-dot:hover {
  transform: scale(1.25);
}
.color-dot.t-green {
  background: #059669;
}
.color-dot.t-violet {
  background: #7c3aed;
}
.color-dot.t-amber {
  background: #d97706;
}
.color-dot.t-sky {
  background: #0284c7;
}
.color-dot.t-rose {
  background: #e11d48;
}
.color-dot.t-teal {
  background: #0d9488;
}
.color-dot.t-white {
  background: #fff;
  border: 1.5px solid #d4d4d4;
}
.diagram-color-edit {
  font-size: 1rem;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid #e7e5e4;
  background: #f5f5f4;
  color: #78716c;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.1s,
    color 0.1s;
  flex-shrink: 0;
}
.diagram-color-edit:hover {
  background: #292524;
  color: #fff;
  border-color: #292524;
}
.diagram-color-font {
  width: auto;
  padding: 0 5px;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: -.02em;
}
.diagram-pick-active {
  background: #f97316;
  color: #fff;
  border-color: #f97316;
}

/* ── Bouton diagramme dans index.html ── */
.btn-diagram {
  position: fixed;
  top: 16px;
  right: 68px;
  z-index: 50;
  font-size: 1.1rem;
  color: #78716c;
  text-decoration: none;
  background: #f5f5f4;
  border: 1px solid #e7e5e4;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s,
    color 0.15s;
  line-height: 1;
}
.btn-diagram:hover {
  background: #292524;
  color: #fff;
  border-color: #292524;
}

/* ── Swatch couleur dans le select ── */
.color-preview {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
