/* ═══════════════════════════════════════════════════════
   DARK PRO DASHBOARD — Variables & Reset
═══════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&family=Inter:wght@300;400;500&display=swap');

:root {
  --bg:           #0d0f14;
  --bg-2:         #141720;
  --bg-3:         #1c2030;
  --bg-4:         #232840;
  --border:       #2a2f45;
  --border-hi:    #3d4460;
  --accent:       #00c8f0;
  --accent-dim:   rgba(0,200,240,.15);
  --accent-glow:  rgba(0,200,240,.35);
  --text:         #c8d0e0;
  --text-dim:     #5a6280;
  --text-bright:  #eef1f8;
  --red:          #f0455a;
  --amber:        #f0a045;
  --green:        #45f0a0;
  --mono:         'JetBrains Mono', monospace;
  --sans:         'Inter', sans-serif;
  --radius:       8px;
  --radius-sm:    5px;
  --shadow:       0 4px 24px rgba(0,0,0,.5);
  --shadow-hi:    0 8px 40px rgba(0,200,240,.12);
}

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

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

/* ═══════════════════════════════════════════════════════
   TOOLBAR — compacte 40px
═══════════════════════════════════════════════════════ */
.toolbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: 40px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  z-index: 9000;
  backdrop-filter: blur(12px);
}

.toolbar-logo {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
  color: var(--accent);
  letter-spacing: .08em;
  opacity: .9;
  flex-shrink: 0;
}

.toolbar-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 2px;
  flex-shrink: 0;
}

/* ── Onglets de pages ── */
.page-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  max-width: 50vw;
  scrollbar-width: none;
  flex-shrink: 1;
  min-width: 0;
}
.page-tabs::-webkit-scrollbar { display: none; }

.page-tab {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px;
  height: 28px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
  user-select: none;
  flex-shrink: 0;
}
.page-tab:hover {
  background: var(--bg-3);
  border-color: var(--border);
  color: var(--text);
}
.page-tab.active {
  background: var(--bg-4);
  border-color: var(--accent);
  color: var(--accent);
}
.page-tab-name {
  cursor: pointer;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.page-tab-del {
  display: none;
  width: 14px;
  height: 14px;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: var(--text-dim);
  font-size: 10px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  transition: color .15s, background .15s;
}
.page-tab:hover .page-tab-del { display: flex; align-items: center; justify-content: center; }
.page-tab-del:hover { color: var(--red); background: rgba(240,69,90,.15); }

.btn-page-add {
  width: 24px;
  height: 24px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, color .15s, background .15s;
  flex-shrink: 0;
  line-height: 1;
}
.btn-page-add:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* ── Bouton principal Ajouter ── */
.toolbar-add-wrap { position: relative; flex-shrink: 0; }

.btn-toolbar {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  height: 28px;
}

.btn-toolbar:hover,
.btn-add-main:hover {
  background: var(--bg-4);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

/* Dropdown Ajouter */
.add-dropdown {
  display: none;
  position: fixed;
  flex-direction: column;
  background: var(--bg-3);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 2147483647;
  min-width: 180px;
  padding: 4px;
  top: 44px;
}
.add-dropdown.open { display: flex; }

.add-item {
  padding: 7px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background .12s, color .12s;
}
.add-item:hover { background: var(--accent-dim); color: var(--accent); }

.add-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* Status — poussé à droite */
.status {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .05em;
  padding: 3px 9px;
  border-radius: 20px;
  border: 1px solid transparent;
  transition: all .3s;
  flex-shrink: 0;
}
.status-ok      { color: var(--green);  border-color: rgba(69,240,160,.2); background: rgba(69,240,160,.06); }
.status-loading { color: var(--accent); border-color: var(--accent-dim);   background: var(--accent-dim); }
.status-saving  { color: var(--amber);  border-color: rgba(240,160,69,.2); background: rgba(240,160,69,.06); }
.status-error   { color: var(--red);    border-color: rgba(240,69,90,.2);  background: rgba(240,69,90,.06); }

/* Boutons icône à droite */
.btn-icon-toolbar {
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s, color .15s;
  flex-shrink: 0;
}
.btn-icon-toolbar:hover { background: var(--bg-4); border-color: var(--border-hi); color: var(--text); }

#canvas {
  position: absolute;
  inset: 40px 0 0 0;
  
  /* ═══════════════════════════════════════════════════
     GRILLE DE FOND (DÉSACTIVÉE)
     Décommente les 4 lignes ci-dessous pour la réactiver :
     • radial-gradient(...) dessine un point de 1px, puis du vide
     • background-size: 22px 22px définit l'espacement (taille des "carreaux")
     • rgba(42,47,69,.6) contrôle la couleur et l'opacité des points
  ═══════════════════════════════════════════════════ */
  /*
  background:
    radial-gradient(circle, rgba(42,47,69,.6) 1px, transparent 1px),
    var(--bg);
  background-size: 22px 22px;
  */
  
  background: var(--bg); /* Fond uni par défaut */
  overflow: auto;
  z-index: 1;
}

/* ═══════════════════════════════════════════════════════
   BLOC — base commune
═══════════════════════════════════════════════════════ */
.block {
    position: absolute;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    /* overflow: hidden;  ← supprimé */
    transition: border-color .2s, box-shadow .2s;
  }

.block:hover {
  border-color: var(--border-hi);
  box-shadow: var(--shadow-hi);
}

.block.collapsed { overflow: hidden; }

/* ── Header ── */
.block-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  height: 24px;
  background: var(--bg-3);
  border-bottom: 1px solid var(--border);
  cursor: move;
  flex-shrink: 0;
  user-select: none;
}

.block-badge {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--accent);
  opacity: .7;
  flex-shrink: 0;
}

.block-type-accordion .block-badge { color: var(--amber); }

.block-title-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-bright);
  letter-spacing: .03em;
  padding: 3px 6px;
  border-radius: 4px;
  transition: background .15s;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.block-title-input:hover  { background: rgba(255,255,255,.04); }
.block-title-input:focus  { background: rgba(255,255,255,.07); box-shadow: 0 0 0 1px var(--accent); }

.block-actions { display: flex; gap: 4px; margin-left: auto; }

.block-actions button {
  width: 26px; height: 26px;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
}
.btn-edit  { background: rgba(240,160,69,.12); color: var(--amber); }
.btn-edit:hover  { background: rgba(240,160,69,.25); border-color: var(--amber); }
.btn-del   { background: rgba(240,69,90,.1);  color: var(--red);   }
.btn-del:hover   { background: rgba(240,69,90,.25);  border-color: var(--red);   }

/* ── Body ── */
.block-content {
  flex: 1;
  min-height: 0;            /* ← force le conteneur à pouvoir rétrécir */
  overflow: auto;
  padding: 14px 16px;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.65;
  color: var(--text);
  min-height: 0;
}

.block.collapsed .block-content { display: none; }

.block-content p      { margin: 6px 0; }
.block-content a      { color: var(--accent); text-decoration: none; }
.block-content a:hover{ text-decoration: underline; }
.block-content h1,
.block-content h2,
.block-content h3 { color: var(--text-bright); font-family: var(--mono); margin: 10px 0 4px; }
.block-content ul,
.block-content ol { padding-left: 18px; margin: 6px 0; }
.block-content code { background: var(--bg-4); padding: 1px 5px; border-radius: 3px; font-family: var(--mono); font-size: 12px; }
.block-content blockquote { border-left: 2px solid var(--accent); padding-left: 10px; color: var(--text-dim); margin: 8px 0; }
.block-content strong { color: var(--text-bright); }

.loading-hint { color: var(--text-dim); font-style: italic; }

/* ── Resize handle ── */
.block-resize {
  position: absolute;
  bottom: 0; right: 0;
  width: 18px; height: 18px;
  cursor: se-resize;
  opacity: 0;
  transition: opacity .2s;
  background: linear-gradient(135deg, transparent 50%, var(--accent) 50%);
  border-radius: 0 0 var(--radius) 0;
}
.block:hover .block-resize       { opacity: .4; }
.block-resize:hover              { opacity: 1 !important; }

/* ═══════════════════════════════════════════════════════
   ACCORDÉON
═══════════════════════════════════════════════════════ */
.acc-wrapper {
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 8px 10px;
    gap: 4px;
  }

.acc-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  transition: border-color .2s;
}

.acc-section.open { border-color: var(--border-hi); }

.acc-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  transition: background .15s, color .15s;
  user-select: none;
}

.acc-header:hover { background: var(--bg-4); color: var(--text-bright); }

.acc-chevron {
  font-size: 16px;
  color: var(--accent);
  transition: transform .25s ease;
  flex-shrink: 0;
  line-height: 1;
  display: inline-block;
}

.acc-section.open .acc-chevron { transform: rotate(90deg); }

.acc-label { flex: 1; }





.acc-section.open .acc-body::-webkit-scrollbar {
  width: 6px;
}
.acc-section.open .acc-body::-webkit-scrollbar-track {
  background: var(--bg-4);
  border-radius: 3px;
}
.acc-section.open .acc-body::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 3px;
}
.acc-section.open .acc-body::-webkit-scrollbar-thumb:hover {
  background: #00e0ff;
}

.acc-inner {
  padding: 10px 14px 12px;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.65;
  color: var(--text);
  border-top: 1px solid var(--border);
}

.acc-inner p      { margin: 5px 0; }
.acc-inner a      { color: var(--accent); text-decoration: none; }
.acc-inner a:hover{ text-decoration: underline; }
.acc-inner strong { color: var(--text-bright); }
.acc-inner code   { background: var(--bg); padding: 1px 5px; border-radius: 3px; font-family: var(--mono); font-size: 12px; }
.acc-inner h1, .acc-inner h2, .acc-inner h3 { color: var(--text-bright); font-family: var(--mono); margin: 8px 0 4px; }
.acc-inner ul, .acc-inner ol { padding-left: 18px; margin: 5px 0; }
.acc-inner blockquote { border-left: 2px solid var(--accent); padding-left: 10px; color: var(--text-dim); }

.empty-hint {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  text-align: center;
  padding: 16px 0;
}

/* ═══════════════════════════════════════════════════════
   ONGLETS TEXTE (tab bar)
═══════════════════════════════════════════════════════ */
.tab-bar {
  display: flex;
  gap: 2px;
  padding: 5px 10px 0;
  background: var(--bg-3);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── tab-btn est maintenant un <span> conteneur avec label + ✕ ── */
.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px 4px 13px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 5px 5px 0 0;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: .05em;
  transition: background .15s, color .15s, border-color .15s;
  position: relative;
  bottom: -1px;
  user-select: none;
}

.tab-btn:hover {
  background: var(--bg-4);
  color: var(--text);
}

.tab-btn.active {
  background: var(--bg-2);
  color: var(--accent);
  border-color: var(--border-hi);
  border-bottom-color: var(--bg-2);
}

/* Label cliquable dans l'onglet */
.tab-label {
  cursor: pointer;
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Bouton ✕ suppression d'onglet */
.tab-del {
  font-size: 9px;
  font-weight: 900;
  color: var(--text-dim);
  opacity: 0;
  transition: opacity .15s, color .15s;
  cursor: pointer;
  padding: 1px 2px;
  border-radius: 3px;
  line-height: 1;
}
.tab-btn:hover .tab-del,
.tab-btn.active .tab-del { opacity: .6; }
.tab-del:hover { opacity: 1 !important; color: var(--red, #f06); }

/* Bouton ＋ ajout d'onglet */
.tab-add {
  padding: 2px 8px;
  border: 1px dashed var(--border);
  border-bottom: none;
  border-radius: 5px 5px 0 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  position: relative;
  bottom: -1px;
  transition: background .15s, color .15s, border-color .15s;
  line-height: 1.4;
}
.tab-add:hover {
  background: var(--bg-4);
  color: var(--accent);
  border-color: var(--accent);
}

.block.collapsed .tab-bar { display: none; }

/* ── Snap / Grille ── */
.grid-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}
#btn-snap {
  opacity: .4;
  transition: opacity .2s, color .2s;
}
#btn-snap.snap-on {
  opacity: 1;
  color: var(--accent);
}
.grid-size-sel {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
  font-family: var(--mono);
  border-radius: 4px;
  padding: 2px 4px;
  cursor: pointer;
  height: 24px;
}
.grid-size-sel:focus { outline: none; border-color: var(--accent); }


/* Amélioration des zones éditables */
[contenteditable="true"] {
    outline: none;
    min-height: 20px;
    transition: background 0.2s, box-shadow 0.2s;
    border-radius: 4px;
  }
  
  [contenteditable="true"]:hover {
    background: rgba(255, 255, 255, 0.02);
    cursor: text;
  }
  
  [contenteditable="true"]:focus {
    background: rgba(0, 200, 240, 0.03);
    box-shadow: inset 0 0 0 1px var(--accent-dim);
  }
  
  /* On s'assure que le texte est sélectionnable même si le bloc est draggable */
  .block-content, .acc-inner {
    user-select: text;
    -webkit-user-select: text;
  }
  
  /* Style spécifique pour les paragraphes dans l'éditeur direct */
  .block-content p:last-child { margin-bottom: 0; }

  /* Curseur par défaut pour laisser les liens cliquables */
.block-content, .acc-inner {
    cursor: default;
    user-select: text;
    transition: background 0.2s;
  }
  
  /* Feedback au survol pour indiquer que la zone est interactive */
  .block-content:hover, .acc-inner:hover {
    background: rgba(255, 255, 255, 0.02);
  }
  
  /* Style quand on est en mode édition (activé par JS) */
  [contenteditable="true"] {
    cursor: text !important;
    outline: 1px solid var(--accent);
    background: rgba(0, 200, 240, 0.05) !important;
    border-radius: 4px;
  }
  
  /* S'assurer que les liens dans les blocs restent visibles */
  .block-content a, .acc-inner a {
    color: var(--accent);
    text-decoration: underline;
  }

/* ═══════════════════════════════════════════════════════
   BOUTONS HEADER — collapse & ctx
═══════════════════════════════════════════════════════ */
.btn-collapse, .btn-ctx {
  width: 26px; height: 26px;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s, color .15s;
  background: transparent;
  color: var(--text-dim);
}

.btn-collapse:hover {
  background: rgba(0,200,240,.12);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-cfg {
  width: 26px; height: 26px;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s, color .15s;
  background: transparent;
  color: var(--text-dim);
}
.btn-cfg:hover {
  background: rgba(100,160,240,.12);
  border-color: #64a0f0;
  color: #64a0f0;
}

.btn-ctx {
  font-size: 16px;
  letter-spacing: 0;
}

.btn-ctx:hover {
  background: rgba(255,255,255,.07);
  border-color: var(--border-hi);
  color: var(--text-bright);
}

/* Bloc collapsed : juste le header, pas de resize */
.block.collapsed {
  overflow: hidden;
  resize: none;
}

.block.collapsed .block-resize { display: none; }

/* ═══════════════════════════════════════════════════════
   MENU CONTEXTUEL
═══════════════════════════════════════════════════════ */
#ctx-menu {
  position: fixed;
  display: none;
  flex-direction: column;
  min-width: 200px;
  background: var(--bg-3);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.04);
  z-index: 2147483646;
  padding: 4px;
  animation: ctx-appear .1s ease;
}

#ctx-menu.visible { display: flex; }

@keyframes ctx-appear {
  from { opacity: 0; transform: scale(.96) translateY(-4px); }
  to   { opacity: 1; transform: scale(1)  translateY(0); }
}

.ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background .12s, color .12s;
  width: 100%;
}

.ctx-item .ctx-icon {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  opacity: .7;
}

.ctx-item:hover { background: var(--bg-4); color: var(--text-bright); }

.ctx-delete:hover { background: rgba(240,69,90,.15); color: var(--red); }
.ctx-delete:hover .ctx-icon { opacity: 1; }

.ctx-sep {
  height: 1px;
  background: var(--border);
  margin: 2px 4px;
}

/* ═══════════════════════════════════════════════════════
   TOOLBAR — bouton widget + dropdown
═══════════════════════════════════════════════════════ */
/* widget-dropdown remplacé par add-dropdown */

/* ═══════════════════════════════════════════════════════
   WIDGETS — styles communs
═══════════════════════════════════════════════════════ */
.block-widget .block-badge { color: #64a0f0; }

.widget-body {
  padding: 0 !important;
  display: flex;
  flex-direction: column;
}

/* — Horloge — */
.widget-clock {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 16px;
  gap: 6px;
}

.clock-time {
  font-family: var(--mono);
  font-size: 2.4em;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .06em;
  line-height: 1;
}

.clock-date {
  font-size: 12px;
  color: var(--text);
  font-family: var(--sans);
}

.clock-tz {
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--mono);
  letter-spacing: .05em;
}

/* — Météo — */
.widget-weather {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 16px;
  gap: 4px;
  text-align: center;
}

.weather-loading {
  color: var(--text-dim);
  font-size: 12px;
  font-style: italic;
}

.weather-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.weather-icon { font-size: 2.8em; line-height: 1; }

.weather-temp {
  font-family: var(--mono);
  font-size: 2.4em;
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1;
}

.weather-city {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: .04em;
}

.weather-desc {
  font-size: 12px;
  color: var(--text-dim);
}

.weather-details {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

/* — Actualités RSS — */
.widget-news {
  height: 100%;
  overflow: auto;
  padding: 8px 10px;
}

.news-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.news-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}

.news-item:hover { background: var(--bg-3); }

.news-item a {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
  text-decoration: none !important;
  transition: color .15s;
}

.news-item a:hover { color: var(--accent); }

.news-date {
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--mono);
}

/* — Iframe — */
.widget-iframe {
  height: 100%;
  overflow: hidden;
}

/* — Compte à rebours — */
.widget-countdown {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 16px;
  gap: 10px;
  text-align: center;
}

.cd-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.cd-display {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cd-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.cd-num {
  font-family: var(--mono);
  font-size: 2em;
  font-weight: 700;
  color: var(--accent);
  min-width: 2ch;
  text-align: center;
  line-height: 1;
}

.cd-lbl {
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.cd-sep {
  font-family: var(--mono);
  font-size: 1.8em;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.cd-target {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--mono);
}

/* ═══════════════════════════════════════════════════════
   IMAGES RESPONSIVES
═══════════════════════════════════════════════════════ */
.dash-img {
  max-width: 100%;
  max-height: 150px;
  height: auto;
  border-radius: var(--radius-sm);
  display: block;
  margin: 6px auto;
  cursor: zoom-in;
  transition: opacity .2s, box-shadow .2s;
  border: 1px solid var(--border);
  object-fit: contain;
}

.dash-img:hover {
  opacity: .85;
  box-shadow: 0 0 0 2px var(--accent-dim);
}

/* ═══════════════════════════════════════════════════════
   LIGHTBOX
═══════════════════════════════════════════════════════ */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
}

#lightbox.open {
  display: flex !important;
}

#lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
}

#lightbox-img {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 8px 60px rgba(0,0,0,.8);
  border-radius: var(--radius);
  cursor: zoom-out;
  z-index: 10;
}

#lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-hi);
  background: var(--bg-3);
  color: var(--text);
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 11;
}

#lightbox-close:hover {
  background: var(--red);
  border-color: var(--red);
  color: white;
  transform: scale(1.05);
}

/* Spinner lightbox */
.lb-spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(0,200,240,.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: lb-spin .7s linear infinite;
  display: block;
}
@keyframes lb-spin { to { transform: rotate(360deg); } }


/* --- Scrollbars bien visibles dans les blocs --- */
.block-content {
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--bg-4);   /* curseur cyan sur fond légèrement plus clair */
  }
  
  .block-content::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }
  .block-content::-webkit-scrollbar-track {
    background: var(--bg-4);          /* contraste mieux avec le fond du bloc */
    border-radius: 4px;
  }
  .block-content::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 4px;
    /* optionnel : ajouter un petit halo */
    box-shadow: inset 0 0 4px rgba(0,0,0,.4);
  }
  .block-content::-webkit-scrollbar-thumb:hover {
    background: #00e0ff;              /* plus clair au survol */
  }

/* ═══════════════════════════════════════════════════════
   MODALE CONFIGURATION WIDGET
═══════════════════════════════════════════════════════ */
#widget-config-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  align-items: center;
  justify-content: center;
}

#widget-config-modal.open { display: flex; }

.wcm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
}

.wcm-box {
  position: relative;
  width: 420px;
  max-width: calc(100vw - 32px);
  background: var(--bg-2);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  box-shadow: 0 16px 60px rgba(0,0,0,.7);
  display: flex;
  flex-direction: column;
  animation: ctx-appear .15s ease;
}

.wcm-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-3);
  border-radius: var(--radius) var(--radius) 0 0;
}

.wcm-icon  { font-size: 16px; }
.wcm-title { flex: 1; font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--text-bright); letter-spacing: .03em; }

.wcm-close {
  width: 26px; height: 26px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
}
.wcm-close:hover { background: rgba(240,69,90,.2); color: var(--red); border-color: var(--red); }

.wcm-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 60vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) var(--bg-4);
}

.wcm-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.wcm-toggle-row {
  flex-direction: row !important;
  align-items: center;
  justify-content: space-between;
}

.wcm-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: .05em;
  text-transform: uppercase;
}

.wcm-input {
  background: var(--bg-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-bright);
  font-family: var(--mono);
  font-size: 13px;
  padding: 8px 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.wcm-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim); }
.wcm-input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1) opacity(.5); cursor: pointer; }

select.wcm-input { cursor: pointer; }

.wcm-hint {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--sans);
  line-height: 1.45;
}

/* Toggle switch */
.wcm-toggle { position: relative; display: inline-block; width: 40px; height: 22px; cursor: pointer; flex-shrink: 0; }
.wcm-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.wcm-toggle-track {
  position: absolute;
  inset: 0;
  background: var(--bg-4);
  border: 1px solid var(--border);
  border-radius: 11px;
  transition: background .2s, border-color .2s;
}
.wcm-toggle-track::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 2px; top: 2px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: transform .2s, background .2s;
}
.wcm-toggle input:checked + .wcm-toggle-track { background: var(--accent-dim); border-color: var(--accent); }
.wcm-toggle input:checked + .wcm-toggle-track::before { transform: translateX(18px); background: var(--accent); }

.wcm-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-3);
  border-radius: 0 0 var(--radius) var(--radius);
}

.wcm-btn-cancel, .wcm-btn-save {
  padding: 7px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}

.wcm-btn-cancel {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.wcm-btn-cancel:hover { background: var(--bg-4); color: var(--text); border-color: var(--border-hi); }

.wcm-btn-save {
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  color: var(--accent);
}
.wcm-btn-save:hover { background: rgba(0,200,240,.25); box-shadow: 0 0 12px var(--accent-glow); }

/* Curseur pointer sur les blocs widget pour indiquer qu'ils sont configurables 
.block-widget .widget-body { cursor: pointer; }
.block-widget .widget-body:hover::after {
  content: '⚙ double-clic pour configurer';
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-size: 10px;
  font-family: var(--mono);
  color: var(--text-dim);
  pointer-events: none;
  opacity: .6;
}*/

/* ═══════════════════════════════════════════════════════
   BACKUP MENU
═══════════════════════════════════════════════════════ */
.backup-wrap {
  position: relative;
}

.backup-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  flex-direction: column;
  min-width: 220px;
  background: var(--bg-3);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.6);
  z-index: 2147483647;
  padding: 4px;
  animation: ctx-appear .1s ease;
}
.backup-dropdown.open { display: flex; }

.backup-title {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 6px 10px 3px;
}

.backup-sep { height: 1px; background: var(--border); margin: 4px; }

.backup-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background .12s, color .12s;
  width: 100%;
}
.backup-item:hover { background: var(--bg-4); color: var(--accent); }

/* ═══════════════════════════════════════════════════════
   MODALE RESTAURATION
═══════════════════════════════════════════════════════ */
#restore-confirm-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  align-items: center;
  justify-content: center;
}
#restore-confirm-modal.open { display: flex; }

.rcm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
}

.rcm-box {
  position: relative;
  width: 460px;
  max-width: calc(100vw - 32px);
  background: var(--bg-2);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  box-shadow: 0 16px 60px rgba(0,0,0,.7);
  display: flex;
  flex-direction: column;
  animation: ctx-appear .15s ease;
}

.rcm-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-3);
  border-radius: var(--radius) var(--radius) 0 0;
}
.rcm-icon  { font-size: 15px; color: var(--amber); }
.rcm-title { flex: 1; font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--text-bright); }

.rcm-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rcm-warn {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: rgba(240,160,69,.08);
  border: 1px solid rgba(240,160,69,.25);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}
.rcm-warn-icon { color: var(--amber); font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.rcm-warn strong { color: var(--text-bright); }
.rcm-warn code { background: var(--bg-4); padding: 1px 5px; border-radius: 3px; font-family: var(--mono); font-size: 11px; }

.rcm-note {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.55;
}

.rcm-files {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rcm-file {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  border: 1px solid var(--border);
  transition: background .2s, color .2s, border-color .2s;
}
.rcm-file-downloading { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }
.rcm-file-done        { color: var(--green);  border-color: rgba(69,240,160,.3); }

.rcm-success {
  background: rgba(69,240,160,.08);
  border: 1px solid rgba(69,240,160,.25);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--green);
}
/* — HTML Libre — */
.widget-html {
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}
.widget-html * { max-width: 100%; box-sizing: border-box; }
.widget-html img { border-radius: var(--radius-sm); display: block; margin: 6px 0; }
.widget-html a { color: var(--accent); text-decoration: underline; }
.widget-html table { border-collapse: collapse; width: 100%; margin: 8px 0; }
.widget-html th, .widget-html td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; }

/* Mode immersif pour widget HTML */
.block-immersive {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  overflow: hidden;
}
.block-immersive .widget-body {
  padding: 0 !important;
  background: transparent !important;
  height: 100%;
  width: 100%;
  cursor: default;
  overflow: auto;
}
.block-immersive .block-immersive-controls {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  background: rgba(20, 23, 32, 0.75);
  backdrop-filter: blur(8px);
  border-radius: 20px;
  padding: 2px 4px;
  border: 1px solid rgba(255,255,255,0.1);
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 10;
  pointer-events: none;
}
.block-immersive:hover .block-immersive-controls {
  opacity: 1;
  pointer-events: auto;
}
.block-immersive .drag-handle,
.block-immersive .cfg-handle,
.block-immersive .ctx-handle {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.4);
  border: none;
  border-radius: 12px;
  color: #c8d0e0;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.block-immersive .drag-handle {
  cursor: move;
  font-size: 16px;
  letter-spacing: -2px;
}
.block-immersive .cfg-handle:hover,
.block-immersive .ctx-handle:hover {
  background: #00c8f0;
  color: #0d0f14;
}
.block-immersive .drag-handle:hover {
  background: rgba(255,255,255,0.2);
}
.block-immersive .block-resize {
  opacity: 0;
  transition: opacity 0.15s;
  background: rgba(0,200,240,0.5);
}
.block-immersive:hover .block-resize {
  opacity: 0.6;
}
.block-immersive .block-resize:hover {
  opacity: 1 !important;
}
/* ═══════════════════════════════════════════════════════
   ACCORDÉON — refonte 3 collections
═══════════════════════════════════════════════════════ */
.acc-wrapper {
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  gap: 4px;
}
.acc-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  transition: border-color .2s;
}
.acc-section.open { border-color: var(--border-hi); }

.acc-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px 7px 12px;
  background: transparent;
  border: none;
  cursor: default;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  transition: background .15s;
  user-select: none;
}
.acc-header:hover { background: var(--bg-4); }

.acc-chevron {
  font-size: 16px;
  color: var(--accent);
  transition: transform .25s ease;
  flex-shrink: 0;
  line-height: 1;
  display: inline-block;
  cursor: pointer;
}
.acc-section.open .acc-chevron { transform: rotate(90deg); }

.acc-label {
  flex: 1;
  cursor: pointer;
  border-radius: 3px;
  padding: 1px 4px;
  transition: background .15s;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.acc-label:hover { background: var(--bg-4); }
.acc-label[contenteditable="true"] {
  background: var(--bg);
  outline: 1px solid var(--accent);
  cursor: text;
  white-space: nowrap;
  overflow: visible;
}

.acc-sec-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity .15s;
}
.acc-header:hover .acc-sec-actions { opacity: 1; }

.acc-sec-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.acc-sec-btn:hover { background: var(--bg-3); border-color: var(--border); color: var(--text-bright); }
.acc-sec-del:hover { background: rgba(240,69,90,.15); border-color: var(--red); color: var(--red); }



.acc-section.open .acc-body::-webkit-scrollbar       { width: 6px; }
.acc-section.open .acc-body::-webkit-scrollbar-track { background: var(--bg-4); border-radius: 3px; }
.acc-section.open .acc-body::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }

.acc-tab-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 8px 0;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.acc-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px 3px 10px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 5px 5px 0 0;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  position: relative;
  bottom: -1px;
  user-select: none;
}
.acc-tab-btn:hover  { background: var(--bg-4); color: var(--text); }
.acc-tab-btn.active { background: var(--bg-3); color: var(--accent); border-color: var(--border-hi); border-bottom-color: var(--bg-3); }

/* Label cliquable dans l'onglet accordéon */
.acc-tab-label {
  cursor: pointer;
  white-space: nowrap;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ✕ inline dans l'onglet accordéon */
.acc-tab-del-lbl {
  font-size: 9px;
  font-weight: 900;
  color: var(--text-dim);
  opacity: 0;
  transition: opacity .15s, color .15s;
  cursor: pointer;
  padding: 1px 2px;
  border-radius: 3px;
  line-height: 1;
}
.acc-tab-btn:hover .acc-tab-del-lbl,
.acc-tab-btn.active .acc-tab-del-lbl { opacity: .6; }
.acc-tab-del-lbl:hover { opacity: 1 !important; color: var(--red, #f06); }

.acc-tab-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  transition: background .15s, color .15s, border-color .15s;
  flex-shrink: 0;
}
.acc-tab-add       { color: var(--accent); margin-left: 4px; }
.acc-tab-add:hover { background: var(--accent-dim); border-color: var(--accent); }
.acc-tab-del       { color: var(--text-dim); }
.acc-tab-del:hover { background: rgba(240,69,90,.15); border-color: var(--red); color: var(--red); }

.acc-tab-spacer { flex: 1; }

.acc-pb-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 13px;
  color: var(--text-dim);
  opacity: 0.3;
  text-decoration: none;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: opacity .2s, color .2s, border-color .2s, background .2s;
  flex-shrink: 0;
  margin-bottom: 1px;
}
.acc-pb-btn:hover { opacity: 1; color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }

.acc-tab-bar + .acc-inner { border-top: none; }

.acc-inner {
  padding: 10px 14px 12px;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.65;
  color: var(--text);
  border-top: 1px solid var(--border);
}
.acc-inner p         { margin: 5px 0; }
.acc-inner a         { color: var(--accent); text-decoration: none; }
.acc-inner a:hover   { text-decoration: underline; }
.acc-inner strong    { color: var(--text-bright); }
.acc-inner code      { background: var(--bg); padding: 1px 5px; border-radius: 3px; font-family: var(--mono); font-size: 12px; }
.acc-inner h1,.acc-inner h2,.acc-inner h3 { color: var(--text-bright); font-family: var(--mono); margin: 8px 0 4px; }
.acc-inner ul,.acc-inner ol { padding-left: 18px; margin: 5px 0; }
.acc-inner blockquote { border-left: 2px solid var(--accent); padding-left: 10px; color: var(--text-dim); }
.acc-inner table      { border-collapse: collapse; width: 100%; margin: 6px 0; font-size: 12px; }
.acc-inner th,.acc-inner td { border: 1px solid var(--border); padding: 5px 8px; text-align: left; }
.acc-inner th         { background: var(--bg-4); color: var(--text-bright); font-family: var(--mono); }
.acc-inner img        { max-width: 100%; border-radius: 4px; margin: 4px 0; }

.acc-add-section {
  width: 100%;
  padding: 7px 12px;
  margin-top: 2px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  text-align: center;
  transition: background .15s, border-color .15s, color .15s;
  letter-spacing: .04em;
}
.acc-add-section:hover { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

/* ═══════════════════════════════════════════════════════
   MODALE DE CONFIRMATION + CORBEILLE
═══════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeInOverlay .15s ease;
}
@keyframes fadeInOverlay { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: var(--bg-3);
  border: 1px solid var(--border-hi);
  border-radius: 10px;
  padding: 28px 32px 24px;
  min-width: 340px;
  max-width: 480px;
  width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: slideUpModal .2s ease;
}
@keyframes slideUpModal { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-icon   { font-size: 32px; text-align: center; }
.modal-title  { font-family: var(--mono); font-size: 15px; font-weight: 700; color: var(--text-bright); text-align: center; }
.modal-block-name { font-family: var(--mono); font-size: 13px; color: var(--accent); text-align: center; }
.modal-detail { font-size: 12px; color: var(--text-dim); text-align: center; font-family: var(--mono); }
.modal-warning {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  margin-top: 4px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 8px;
}
.modal-btn {
  padding: 8px 22px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  letter-spacing: .04em;
}
.modal-cancel  { background: var(--bg-4); color: var(--text); }
.modal-cancel:hover { background: var(--bg-2); border-color: var(--border-hi); }
.modal-confirm { background: var(--red, #f0455a); color: #fff; border-color: transparent; }
.modal-confirm:hover { filter: brightness(1.15); }

/* Corbeille — panneau élargi */
.modal-trash {
  max-width: 620px;
  padding: 24px 28px 20px;
}
.trash-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 55vh;
  overflow-y: auto;
  margin: 4px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) var(--bg-4);
}
.trash-empty {
  text-align: center;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
  padding: 24px 0;
}
.trash-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color .15s;
}
.trash-row:hover { border-color: var(--border-hi); }

.trash-type {
  font-size: 16px;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
  color: var(--accent);
  font-family: var(--mono);
}
.trash-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.trash-title {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trash-date {
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--mono);
}
.trash-actions { display: flex; gap: 6px; flex-shrink: 0; }

.trash-btn {
  padding: 4px 12px;
  border-radius: 5px;
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.trash-restore       { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.trash-restore:hover { background: var(--accent); color: var(--bg); }
.trash-purge         { background: transparent; color: var(--text-dim); }
.trash-purge:hover   { background: rgba(240,69,90,.15); border-color: var(--red); color: var(--red); }

/* Bouton 🗑 dans la toolbar — remplacé par .btn-icon-toolbar */

/* ═══════════════════════════════════════════════════════
   FIX ACCORDÉON — Ajustement automatique en hauteur
   ════════════════════════════════════════════════════════ */
   .block.block-accordion {
    height: auto !important;
    resize: none; /* Désactive le resize manuel pour éviter les conflits avec l'auto-height */
  }
  .block.block-accordion .block-content {
    flex: none !important;
    overflow: visible !important;
    min-height: 0;
  }
  
  /* Animation acc-body : display none/block sans transition
     (max-height causait des bugs de mesure de hauteur) */
  .acc-body {
    display: none;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--bg-4);
  }
  .acc-section.open .acc-body {
    display: block;
  }
/* ═══════════════════════════════════════════════════════
   TINYMCE — Modale pleine page
═══════════════════════════════════════════════════════ */
#tme-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0,0,0,.7);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#tme-modal.open { display: flex; }

.tme-box {
  display: flex;
  flex-direction: column;
  width: min(1100px, calc(100vw - 40px));
  height: min(820px, calc(100vh - 40px));
  background: var(--bg-2);
  border: 1px solid var(--border-hi);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
}

.tme-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: 46px;
  background: var(--bg-3);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
#tme-label {
  flex: 1;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: .04em;
}
.tme-top-btns { display: flex; gap: 8px; }

.tme-btn-cancel, .tme-btn-save {
  padding: 5px 16px;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: .04em;
  transition: all .15s;
}
.tme-btn-cancel {
  background: var(--bg-4);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.tme-btn-cancel:hover { background: var(--bg-3); color: var(--text); border-color: var(--border-hi); }
.tme-btn-save {
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  color: var(--accent);
}
.tme-btn-save:hover { background: var(--accent); color: var(--bg); }

.tme-area {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.tme-area .tox-tinymce {
  flex: 1 !important;
  height: 100% !important;
  border: none !important;
  border-radius: 0 !important;
}

/* Bouton ✏ dans le header du bloc */
.btn-edit-tme {
  width: 22px; height: 22px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
  flex-shrink: 0;
}
.btn-edit-tme:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }

/* TinyMCE popups au-dessus de la modale */
.tox.tox-tinymce-aux,
.tox .tox-dialog-wrap,
.tox .tox-dialog,
.tox .tox-menu,
.tox .tox-pop,
.tox .tox-autocompleter { z-index: 9100 !important; }
.tox .tox-dialog-wrap__backdrop { z-index: 9099 !important; }

/* ═══════════════════════════════════════════════════════
   IMAGE PICKER
═══════════════════════════════════════════════════════ */
#imp-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 9200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.imp-box {
  display: flex; flex-direction: column;
  width: min(860px, calc(100vw - 48px));
  height: min(640px, calc(100vh - 48px));
  background: var(--bg-2);
  border: 1px solid var(--border-hi);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
}
.imp-head {
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px; height: 44px;
  background: var(--bg-3); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.imp-head span { flex:1; font-family:var(--mono); font-size:12px; font-weight:700; color:var(--text-bright); }
.imp-head button { width:26px;height:26px;background:transparent;border:1px solid var(--border);border-radius:4px;color:var(--text-dim);cursor:pointer;font-size:12px;transition:all .15s; }
.imp-head button:hover { border-color:var(--red);color:var(--red);background:rgba(240,69,90,.1); }
.imp-search { background:var(--bg-4);border:1px solid var(--border);border-radius:5px;color:var(--text);font-family:var(--mono);font-size:11px;padding:4px 10px;width:150px;outline:none;transition:border-color .15s; }
.imp-search:focus { border-color:var(--accent); }
.imp-grid { flex:1; overflow-y:auto; padding:14px; display:grid; grid-template-columns:repeat(auto-fill,minmax(130px,1fr)); gap:10px; align-content:start; scrollbar-width:thin; scrollbar-color:var(--accent) var(--bg-4); }
.imp-msg { grid-column:1/-1; text-align:center; font-family:var(--mono); font-size:12px; color:var(--text-dim); padding:40px 0; }
.imp-item { display:flex;flex-direction:column;gap:4px;cursor:pointer;border:1px solid var(--border);border-radius:6px;overflow:hidden;background:var(--bg-3);transition:border-color .15s,transform .1s; }
.imp-item:hover { border-color:var(--accent);transform:translateY(-1px); }
.imp-item img { width:100%;aspect-ratio:4/3;object-fit:cover;background:var(--bg-4); }
.imp-lbl { padding:0 6px 6px;font-family:var(--mono);font-size:10px;color:var(--text-dim);white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
.imp-foot { display:flex;align-items:center;gap:10px;padding:10px 14px;background:var(--bg-3);border-top:1px solid var(--border);flex-shrink:0; }
.imp-foot span { flex:1;font-family:var(--mono);font-size:10px;color:var(--text-dim); }
.imp-upload-btn { padding:5px 14px;background:var(--accent-dim);border:1px solid var(--accent);border-radius:5px;color:var(--accent);font-family:var(--mono);font-size:11px;font-weight:700;cursor:pointer;transition:all .15s; }
.imp-upload-btn:hover { background:var(--accent);color:var(--bg); }

/* ═══════════════════════════════════════════════════════
   BLOC BOOKMARKS v2 — À COLLER À LA FIN DE style.css
   ═══════════════════════════════════════════════════ */

/* ── Conteneur du contenu ── */
.bk-content {
  display:        flex;
  flex-direction: column;
  height:         100%;
  overflow:       hidden;
  padding:        0;
}

/* ── Barre d'outils interne ── */
.bk-toolbar {
  display:       flex;
  align-items:   center;
  gap:           5px;
  padding:       5px 8px;
  background:    var(--bg-3);
  border-bottom: 1px solid var(--border);
  flex-shrink:   0;
}

.bk-search {
  flex:          1;
  min-width:     0;
  padding:       3px 8px;
  background:    var(--bg-2);
  border:        1px solid var(--border);
  border-radius: var(--radius-sm);
  color:         var(--text);
  font-family:   var(--sans);
  font-size:     11px;
  outline:       none;
  transition:    border-color .15s;
}
.bk-search:focus { border-color: var(--accent); }

.bk-view-btns { display: flex; gap: 2px; }

.bk-vbtn {
  padding:       3px 7px;
  background:    transparent;
  border:        1px solid var(--border);
  border-radius: var(--radius-sm);
  color:         var(--text-dim);
  font-size:     13px;
  cursor:        pointer;
  line-height:   1;
  transition:    background .15s, color .15s, border-color .15s;
  flex-shrink:   0;
}
.bk-vbtn:hover  { background: var(--bg-4); color: var(--text); }
.bk-vbtn.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.bk-cfg-btn     { font-size: 11px; padding: 3px 6px; }

/* Message vide */
.empty-hint {
  margin:      20px auto;
  text-align:  center;
  color:       var(--text-dim);
  font-size:   11px;
  font-family: var(--mono);
  padding:     0 12px;
}


/* ══════════════════════════════════════════════════════
   BOUTONS D'ACTION DISCRETS (✏ ✕) — communs aux 3 vues
   ══════════════════════════════════════════════════ */
.bk-item-actions {
  display:    flex;
  gap:        2px;
  opacity:    0;
  flex-shrink: 0;
  transition: opacity .15s;
}
/* Apparaît au survol du parent (cell, row, detail-row) */
.bk-cell:hover       .bk-item-actions,
.bk-row:hover        .bk-item-actions,
.bk-detail-row:hover .bk-item-actions { opacity: 1; }

.bk-ia-btn {
  background:    none;
  border:        1px solid transparent;
  border-radius: 4px;
  color:         var(--text-dim);
  font-size:     10px;
  cursor:        pointer;
  padding:       2px 5px;
  line-height:   1;
  transition:    background .12s, color .12s, border-color .12s;
}
.bk-ia-btn:hover     { background: var(--bg-4); color: var(--text); border-color: var(--border); }
.bk-ia-del:hover     { background: rgba(240,69,90,.12); color: var(--red); border-color: rgba(240,69,90,.3); }


/* ══════════════════════════════════════════════════════
   TAILLE DES ICÔNES — gérée en inline style px via bkIconPx
   .bk-cell-icon reçoit width/height en style direct depuis JS
   ══════════════════════════════════════════════════ */
.bk-cell-icon {
  display:         flex;
  align-items:     center;
  justify-content: center;
  border-radius:   var(--radius-sm);
  background:      var(--bg-2);
  border:          1px solid var(--border);
  overflow:        hidden;
  flex-shrink:     0;
  transition:      border-color .15s;
  /* Empêche tout débordement — l'img et le span sont contraints par le parent */
  box-sizing:      border-box;
}
.bk-cell-icon > img  { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.bk-cell-icon > span { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.bk-cell:hover .bk-cell-icon { border-color: var(--accent); }

/* bk-row-icon et bk-detail-icon : même logique */
.bk-row-icon,
.bk-detail-icon {
  display:         flex;
  align-items:     center;
  justify-content: center;
  overflow:        hidden;
  flex-shrink:     0;
}
.bk-row-icon > img, .bk-detail-icon > img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.bk-row-icon > span, .bk-detail-icon > span { display: flex; align-items: center; justify-content: center; }

/* Taille du texte : gérée en inline style px via bkFontPx — pas de classes S/M/L */


/* ══════════════════════════════════════════════════════
   VUE ICÔNES
   ══════════════════════════════════════════════════ */
.bk-grid {
  display:               grid;
  grid-template-columns: repeat(auto-fit, minmax(75px, 1fr));
  /*grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));*/
  gap:                   10px;
  padding:               20px;
  /*overflow-y:            auto;   original*/
  overflow-y:            auto;
  overflow-x:            hidden; /*  Sécurité anti-débordement sub-pixel */
  flex:                  1;
  align-content:         start;
  min-width:             0;      /* 👈 CRUCIAL : autorise la grille à rétrécir dans son parent flex */
}
.bk-grid::-webkit-scrollbar       { width: 4px; }
.bk-grid::-webkit-scrollbar-track { background: transparent; }
.bk-grid::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 2px; }

.bk-cell {
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  gap:             4px;
  border-radius:   var(--radius-sm);
  border:          1px solid transparent;
  cursor:          pointer;
  position:        relative;
  transition:      background .15s, border-color .15s;
  user-select:     none;
  min-width:       0;      /* 👈 Autorise la cellule à rétrécir dans sa piste grid */
  max-width:       100%;   /* 👈 Empêche tout débordement horizontal */
}
.bk-cell:hover {
  background:   var(--bg-4);
  border-color: var(--border);
}

/* Les boutons d'action se positionnent en haut à droite de la cell */
.bk-cell .bk-item-actions {
  position: absolute;
  top:      2px;
  right:    2px;
}

.bk-cell-link {
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  gap:             inherit;
  text-decoration: none;
  color:           inherit;
  width:           100%;
}
/*-------------original
.bk-cell-lbl {
  font-family:   var(--sans);
  color:         var(--text-dim);
  text-align:    center;
  max-width:     100%;
  overflow:      hidden;
  text-overflow: ellipsis;
  white-space:   nowrap;
  line-height:   1.3;
  padding:       0 2px;  
}
*/
.bk-cell .bk-cell-link,
.bk-cell .bk-cell-link:link,
.bk-cell .bk-cell-link:visited {
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  gap:             inherit;
  text-decoration: none;
  border-bottom:   none;
  color:           var(--text-dim);
  width:           100%;
}
.bk-cell:hover .bk-cell-lbl { color: var(--text); }


/* ══════════════════════════════════════════════════════
   VUE LISTE
   ══════════════════════════════════════════════════ */
.bk-list {
  display:        flex;
  flex-direction: column;
  gap:            1px;
  padding:        4px 6px;
  overflow-y:     auto;
  flex:           1;
}
.bk-list::-webkit-scrollbar       { width: 4px; }
.bk-list::-webkit-scrollbar-track { background: transparent; }
.bk-list::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 2px; }

.bk-row {
  display:     flex;
  align-items: center;
  gap:         6px;
  padding:     4px 5px;
  border-radius: var(--radius-sm);
  transition:  background .12s;
  cursor:      pointer;
}
.bk-row:hover { background: var(--bg-4); }

.bk-row-link {
  display:         flex;
  align-items:     center;
  gap:             6px;
  text-decoration: none;
  color:           inherit;
  flex:            1;
  min-width:       0;
}

.bk-row-icon {
  display:         flex;
  align-items:     center;
  justify-content: center;
  flex-shrink:     0;
}

.bk-row-title {
  flex:          1;
  font-family:   var(--sans);
  color:         var(--text);
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
}

.bk-row-domain {
  font-family:   var(--mono);
  color:         var(--text-dim);
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
  max-width:     100px;
  flex-shrink:   0;
}


/* ══════════════════════════════════════════════════════
   VUE DÉTAIL
   ══════════════════════════════════════════════════ */
.bk-detail-list {
  display:        flex;
  flex-direction: column;
  gap:            2px;
  padding:        4px 6px;
  overflow-y:     auto;
  flex:           1;
}
.bk-detail-list::-webkit-scrollbar       { width: 4px; }
.bk-detail-list::-webkit-scrollbar-track { background: transparent; }
.bk-detail-list::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 2px; }

.bk-detail-row {
  display:       flex;
  align-items:   center;
  gap:           8px;
  padding:       5px 5px;
  border-radius: var(--radius-sm);
  transition:    background .12s;
  cursor:        pointer;
}
.bk-detail-row:hover { background: var(--bg-4); }

.bk-detail-link {
  display:         flex;
  align-items:     center;
  gap:             8px;
  text-decoration: none;
  color:           inherit;
  flex:            1;
  min-width:       0;
}

.bk-detail-icon {
  display:         flex;
  align-items:     center;
  justify-content: center;
  flex-shrink:     0;
}

.bk-detail-info {
  display:        flex;
  flex-direction: column;
  gap:            1px;
  min-width:      0;
}

.bk-detail-title {
  font-family:   var(--sans);
  color:         var(--text);
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
}

.bk-detail-url {
  font-family:   var(--mono);
  color:         var(--text-dim);
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
}

.bk-detail-tags {
  display:   flex;
  gap:       3px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.bk-tag {
  font-size:     9px;
  font-family:   var(--mono);
  padding:       1px 6px;
  border-radius: 99px;
  background:    var(--bg-4);
  border:        1px solid var(--border);
  color:         var(--text-dim);
  cursor:        pointer;
  transition:    background .12s, color .12s, border-color .12s;
}
.bk-tag:hover {
  background:   var(--accent-dim);
  color:        var(--accent);
  border-color: var(--accent);
}


/* ══════════════════════════════════════════════════════
   PANNEAU CONFIG AFFICHAGE
   ══════════════════════════════════════════════════ */
#bk-cfg-panel {
  display:  none;
  position: fixed;
  inset:    0;
  z-index:  9050;
  align-items: center;
  justify-content: center;
}
#bk-cfg-panel.open { display: flex; }

.bk-cfg-backdrop {
  position:   absolute;
  inset:      0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(3px);
}

.bk-cfg-box {
  position:       relative;
  z-index:        1;
  width:          300px;
  background:     var(--bg-2);
  border:         1px solid var(--border-hi);
  border-radius:  var(--radius);
  box-shadow:     var(--shadow-hi);
  overflow:       hidden;
}

.bk-cfg-header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding:         10px 14px;
  background:      var(--bg-3);
  border-bottom:   1px solid var(--border);
  font-family:     var(--mono);
  font-size:       11px;
  font-weight:     700;
  color:           var(--accent);
  letter-spacing:  .04em;
}

.bk-cfg-close {
  background:  none;
  border:      none;
  color:       var(--text-dim);
  font-size:   13px;
  cursor:      pointer;
  padding:     2px 5px;
  border-radius: 4px;
}
.bk-cfg-close:hover { color: var(--red); background: rgba(240,69,90,.1); }

.bk-cfg-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bk-cfg-row {
  display:     flex;
  align-items: center;
  justify-content: space-between;
  gap:         12px;
}

.bk-cfg-label {
  font-family: var(--sans);
  font-size:   12px;
  color:       var(--text-dim);
  flex-shrink: 0;
}

.bk-cfg-btns {
  display: flex;
  gap:     4px;
}

.bk-cfg-opt {
  width:         32px;
  height:        28px;
  border:        1px solid var(--border);
  border-radius: var(--radius-sm);
  background:    var(--bg-3);
  color:         var(--text-dim);
  font-family:   var(--mono);
  font-size:     13px;
  cursor:        pointer;
  transition:    background .15s, color .15s, border-color .15s;
}
.bk-cfg-opt:hover  { background: var(--bg-4); color: var(--text); }
.bk-cfg-opt.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }

/* Slider taille icône/texte */
.bk-cfg-slider-wrap {
  display:     flex;
  align-items: center;
  gap:         8px;
  flex:        1;
}
.bk-cfg-slider-wrap input[type="range"] {
  flex:              1;
  accent-color:      var(--accent);
  cursor:            pointer;
  height:            4px;
}
.bk-cfg-val {
  font-family:   var(--mono);
  font-size:     11px;
  color:         var(--accent);
  min-width:     32px;
  text-align:    right;
}


/* ══════════════════════════════════════════════════════
   MODALE AJOUT / ÉDITION
   ══════════════════════════════════════════════════ */
#bk-modal {
  display:         none;
  position:        fixed;
  inset:           0;
  z-index:         9100;
  align-items:     center;
  justify-content: center;
}
#bk-modal.open { display: flex; }

.bk-modal-backdrop {
  position:   absolute;
  inset:      0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
}

.bk-modal-box {
  position:       relative;
  z-index:        1;
  width:          400px;
  max-width:      calc(100vw - 32px);
  background:     var(--bg-2);
  border:         1px solid var(--border-hi);
  border-radius:  var(--radius);
  box-shadow:     var(--shadow-hi);
  display:        flex;
  flex-direction: column;
  overflow:       hidden;
}

.bk-modal-header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding:         11px 15px;
  background:      var(--bg-3);
  border-bottom:   1px solid var(--border);
  font-family:     var(--mono);
  font-size:       12px;
  font-weight:     700;
  color:           var(--accent);
  letter-spacing:  .04em;
}

.bk-modal-close {
  background:  none;
  border:      none;
  color:       var(--text-dim);
  font-size:   14px;
  cursor:      pointer;
  padding:     2px 6px;
  border-radius: var(--radius-sm);
  transition:  color .12s, background .12s;
}
.bk-modal-close:hover { color: var(--red); background: rgba(240,69,90,.1); }

.bk-modal-body {
  display:        flex;
  flex-direction: column;
  gap:            11px;
  padding:        14px 15px;
}

.bk-modal-url-row,
.bk-modal-row {
  display:     flex;
  gap:         10px;
  align-items: flex-end;
}

.bk-modal-field {
  display:        flex;
  flex-direction: column;
  gap:            4px;
}

.bk-modal-field label {
  font-family:   var(--mono);
  font-size:     10px;
  color:         var(--text-dim);
  letter-spacing: .03em;
  text-transform: uppercase;
}

.bk-modal-field input {
  background:    var(--bg-3);
  border:        1px solid var(--border);
  border-radius: var(--radius-sm);
  padding:       6px 10px;
  color:         var(--text);
  font-family:   var(--sans);
  font-size:     12px;
  outline:       none;
  transition:    border-color .15s;
}
.bk-modal-field input:focus { border-color: var(--accent); }

.bk-required   { color: var(--accent); }
.bk-hint-label { color: var(--text-dim); font-size: 9px; font-weight: 400; text-transform: none; }

.bk-icon-preview {
  width:           40px;
  height:          40px;
  border-radius:   var(--radius-sm);
  background:      var(--bg-3);
  border:          1px solid var(--border);
  display:         flex;
  align-items:     center;
  justify-content: center;
  font-size:       22px;
  flex-shrink:     0;
}

.bk-modal-err {
  font-size:     12px;
  color:         var(--red);
  padding:       6px 10px;
  background:    rgba(240,69,90,.08);
  border:        1px solid rgba(240,69,90,.25);
  border-radius: var(--radius-sm);
}

.bk-modal-footer {
  display:         flex;
  justify-content: flex-end;
  gap:             8px;
  padding:         11px 15px;
  background:      var(--bg-3);
  border-top:      1px solid var(--border);
}

.bk-modal-btn-cancel,
.bk-modal-btn-save {
  padding:       6px 15px;
  border-radius: var(--radius-sm);
  font-family:   var(--mono);
  font-size:     11px;
  font-weight:   700;
  letter-spacing: .04em;
  cursor:        pointer;
  transition:    background .15s, border-color .15s;
}
.bk-modal-btn-cancel {
  background: transparent;
  border:     1px solid var(--border);
  color:      var(--text-dim);
}
.bk-modal-btn-cancel:hover { background: var(--bg-4); color: var(--text); }
.bk-modal-btn-save {
  background: var(--accent-dim);
  border:     1px solid var(--accent);
  color:      var(--accent);
}
.bk-modal-btn-save:hover { background: rgba(0,200,240,.25); }


/* ══════════════════════════════════════════════════════
   MENU CONTEXTUEL CLIC DROIT SUR UN FAVORI
   ══════════════════════════════════════════════════ */
#bk-ctx {
  position:       fixed;
  z-index:        9200;
  background:     var(--bg-2);
  border:         1px solid var(--border-hi);
  border-radius:  var(--radius);
  box-shadow:     var(--shadow);
  padding:        4px;
  min-width:      155px;
  display:        flex;
  flex-direction: column;
  gap:            2px;
}
#bk-ctx button {
  width:         100%;
  text-align:    left;
  background:    none;
  border:        none;
  padding:       6px 11px;
  font-family:   var(--sans);
  font-size:     12px;
  color:         var(--text);
  border-radius: var(--radius-sm);
  cursor:        pointer;
  transition:    background .12s;
}
#bk-ctx button:hover { background: var(--bg-4); }




/* ══════════════════════════════════════════════════════
   GALERIE ICÔNES dash_images — INLINE dans la modale
   Pas de position fixed/absolute : s'affiche dans le flux
   normal juste sous le champ icône. Aucun problème de z-index.
   ══════════════════════════════════════════════════ */

/* Ligne champ icône + bouton galerie */
.bk-icon-field-row {
  display:     flex;
  gap:         6px;
  align-items: stretch;
}
.bk-icon-field-row input {
  flex: 1;
}

/* Bouton 🖼 compact */
.bk-gallery-btn {
  background:    var(--bg-3);
  border:        1px solid var(--border);
  border-radius: var(--radius-sm);
  color:         var(--text-dim);
  font-size:     15px;
  padding:       0 8px;
  cursor:        pointer;
  flex-shrink:   0;
  transition:    background .15s, border-color .15s, color .15s;
}
.bk-gallery-btn:hover { background: var(--bg-4); color: var(--accent); border-color: var(--accent); }

/* Conteneur galerie inline */
#bk-gallery {
  display:        none;   /* togglé via style.display en JS */
  margin-top:     8px;
  border:         1px solid var(--border);
  border-radius:  var(--radius-sm);
  overflow:       hidden;
  background:     var(--bg-3);
}

.bk-gal-header {
  display:     flex;
  align-items: center;
  gap:         6px;
  padding:     6px 8px;
  background:  var(--bg-4);
  border-bottom: 1px solid var(--border);
  flex-wrap:   wrap;
}

.bk-gal-search {
  flex:          1;
  min-width:     80px;
  padding:       3px 7px;
  background:    var(--bg-2);
  border:        1px solid var(--border);
  border-radius: var(--radius-sm);
  color:         var(--text);
  font-family:   var(--sans);
  font-size:     11px;
  outline:       none;
}
.bk-gal-search:focus { border-color: var(--accent); }

.bk-gal-upload-btn {
  padding:       3px 8px;
  background:    var(--accent-dim);
  border:        1px solid var(--accent);
  border-radius: var(--radius-sm);
  color:         var(--accent);
  font-family:   var(--mono);
  font-size:     10px;
  font-weight:   700;
  cursor:        pointer;
  white-space:   nowrap;
  flex-shrink:   0;
}
.bk-gal-upload-btn:hover { background: rgba(0,200,240,.2); }

.bk-gal-close {
  background:    none;
  border:        none;
  color:         var(--text-dim);
  font-size:     14px;
  cursor:        pointer;
  padding:       2px 4px;
  border-radius: 3px;
  flex-shrink:   0;
  line-height:   1;
}
.bk-gal-close:hover { color: var(--red); background: rgba(240,69,90,.12); }

.bk-gal-grid {
  display:               grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap:                   4px;
  padding:               8px;
  max-height:            200px;   /* hauteur max pour ne pas exploser la modale */
  overflow-y:            auto;
  align-content:         start;
}
.bk-gal-grid::-webkit-scrollbar       { width: 4px; }
.bk-gal-grid::-webkit-scrollbar-track { background: transparent; }
.bk-gal-grid::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 2px; }

.bk-gal-loading {
  grid-column:  1 / -1;
  text-align:   center;
  padding:      16px 8px;
  color:        var(--text-dim);
  font-family:  var(--mono);
  font-size:    11px;
}
.bk-gal-err { color: var(--red); }

.bk-gal-item {
  display:        flex;
  flex-direction: column;
  align-items:    center;
  gap:            3px;
  padding:        5px 3px 4px;
  border-radius:  var(--radius-sm);
  border:         1px solid transparent;
  cursor:         pointer;
  transition:     background .12s, border-color .12s;
}
.bk-gal-item:hover {
  background:   var(--bg-2);
  border-color: var(--accent);
}

.bk-gal-thumb {
  width:           48px;
  height:          48px;
  display:         flex;
  align-items:     center;
  justify-content: center;
  overflow:        hidden;
  border-radius:   4px;
  background:      var(--bg-2);
}
.bk-gal-thumb img {
  max-width:  100%;
  max-height: 100%;
  object-fit: contain;
  display:    block;
}

.bk-gal-lbl {
  font-size:     9px;
  font-family:   var(--sans);
  color:         var(--text-dim);
  text-align:    center;
  max-width:     58px;
  overflow:      hidden;
  text-overflow: ellipsis;
  white-space:   nowrap;
}
.bk-gal-item:hover .bk-gal-lbl { color: var(--text); }

/*TEST ------------------------------------------------------------------------------
/* Force la suppression du soulignement natif des liens bookmarks
.bk-cell-link,
.bk-cell-link .bk-cell-lbl {
  text-decoration: none !important;
  border-bottom:   none !important;
  color:           var(--text-dim) !important; /* ou var(--text) selon ton thème 
}*/

/* Au survol, on garde juste le changement de couleur prévu 
.bk-cell:hover .bk-cell-link,
.bk-cell:hover .bk-cell-link .bk-cell-lbl {
  text-decoration: none !important;
  border-bottom:   none !important;
  color:           var(--text) !important;
}
*/

/* ═══════════════════════════════════════════════════════
   COPY-SNIPPET — bloc copiable créé via bouton TinyMCE
═══════════════════════════════════════════════════════ */
.copy-snippet {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  background: #0d1117;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 8px 36px 8px 12px;
  margin: 6px 0;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  max-width: 100%;
  box-sizing: border-box;
}

.snippet-copy-btn {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  flex-shrink: 0;
  line-height: 1;
  padding: 0;
}
.snippet-copy-btn:hover  { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }
.snippet-copy-btn.copied { color: var(--green);  border-color: var(--green);  background: rgba(69,240,160,.12); }

/* ═══════════════════════════════════════════════════════

/* ═══════════════════════════════════════════════════════
   BOOKMARKS — DRAG & DROP (SortableJS)
═══════════════════════════════════════════════════════ */

/* Handle drag — visible au hover sur l'item */
.bk-drag-handle {
  position: absolute;
  top: 0;
  left: 0;
  width: 18px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  cursor: grab !important;
  opacity: 0;
  transition: opacity .15s;
  z-index: 2;
  user-select: none;
  border-radius: 4px 0 0 4px;
}
.bk-cell:hover    .bk-drag-handle,
.bk-row:hover     .bk-drag-handle,
.bk-detail-row:hover .bk-drag-handle {
  opacity: 1;
  background: rgba(255,255,255,0.05);
}
.bk-drag-handle:hover {
  color: rgba(255,255,255,0.9) !important;
  background: rgba(100,160,255,0.15) !important;
  opacity: 1 !important;
}
.bk-drag-handle:active { cursor: grabbing !important; }

/* Les items doivent être en position relative pour le handle absolu */
.bk-cell, .bk-row, .bk-detail-row { position: relative; }

/* Ghost et chosen SortableJS */
.bk-sortable-ghost {
  opacity: 0.2;
  background: rgba(100,160,255,0.1) !important;
  outline: 2px dashed rgba(100,160,255,0.5);
  border-radius: 6px;
}
.bk-sortable-chosen {
  box-shadow: 0 6px 24px rgba(0,0,0,0.5);
  outline: 2px solid rgba(100,160,255,0.7);
  border-radius: 6px;
}
