/* ============================================================================
   Design system — thème clair, lisible, bon contraste
   La couleur --profile-color est injectée dynamiquement par state.js
   --profile-color-contrast est calculée pour que le texte reste lisible
   ============================================================================ */

:root {
  /* Couleurs de marque (profile) — valeurs par défaut */
  --profile-color: #2563eb;
  --profile-color-contrast: #ffffff;
  --profile-color-soft: rgba(37, 99, 235, 0.08);
  --profile-color-border: rgba(37, 99, 235, 0.25);

  /* Palette neutre claire */
  --bg: #f5f7fa;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-hover: #f1f4f8;
  --bg-muted: #f8fafc;

  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.14);

  --sidebar-width: 260px;
}

/* ============================================================================
   THÈME SOMBRE
   ----------------------------------------------------------------------------
   Activé via [data-theme="dark"] sur <html>. Les variables sont
   recalculées : tous les composants qui utilisent var(--bg), var(--text-...),
   etc. s'adaptent automatiquement.
   ============================================================================ */
[data-theme="dark"] {
  /* Fond légèrement bleuté pour matcher l'iridescence du logo,
     pas du noir pur (fatigant pour les yeux) */
  --bg:         #0b0d12;
  --bg-sidebar: #14171f;
  --bg-card:    #14171f;
  --bg-input:   #1a1e28;
  --bg-hover:   #1f2330;
  --bg-muted:   #10131a;

  --border:        #232733;
  --border-strong: #2e3340;

  --text-primary:   #e8eaf0;  /* pas blanc pur, repos visuel */
  --text-secondary: #a8aebd;
  --text-muted:     #6c7488;

  /* Légèrement plus pâles pour rester lisibles sur fond sombre */
  --success: #34d399;
  --warning: #fbbf24;
  --danger:  #f87171;

  /* Soft / border profil : on remonte l'opacité parce qu'un alpha 0.08
     sur fond sombre devient quasi invisible */
  --profile-color-soft:   rgba(99, 142, 245, 0.18);
  --profile-color-border: rgba(99, 142, 245, 0.40);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow:    0 4px 12px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
}

/* ============================================================================
   Reset & base
   ============================================================================ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, textarea, select {
  font: inherit;
  color: var(--text-primary);
}

a { color: var(--profile-color); }

/* ============================================================================
   Layout général
   ============================================================================ */
body {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 32px 40px;
  overflow-y: auto;
  height: 100vh;
}

/* ============================================================================
   Sidebar — logo + gestion profils intégrée
   ============================================================================ */
.sidebar-logo {
  position: relative;
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-mark {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--profile-color);
  color: var(--profile-color-contrast);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.logo-mark:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.logo-name {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Dropdown — affiché au hover ou au focus */
.profile-dropdown {
  position: absolute;
  top: calc(100% - 4px);
  left: 12px;
  right: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  overflow: hidden;
}

.sidebar-logo:hover .profile-dropdown,
.sidebar-logo:focus-within .profile-dropdown,
.sidebar-logo.open .profile-dropdown {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.profile-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.profile-action {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--profile-color-soft);
  color: var(--profile-color);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.12s ease;
}

.profile-action:hover {
  background: var(--profile-color);
  color: var(--profile-color-contrast);
}

.profile-list {
  max-height: 280px;
  overflow-y: auto;
  padding: 4px 0;
}

.profile-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  text-align: left;
  transition: background 0.1s ease;
  color: var(--text-primary);
}

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

.profile-item.active {
  background: var(--profile-color-soft);
  color: var(--profile-color);
  font-weight: 600;
}

.profile-item-swatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.profile-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.profile-item.active::after {
  content: "●";
  color: var(--profile-color);
  font-size: 10px;
}

.profile-dropdown-footer {
  padding: 6px;
  border-top: 1px solid var(--border);
  background: var(--bg-muted);
}

.profile-edit-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  transition: background 0.12s ease, color 0.12s ease;
}

.profile-edit-btn:hover {
  background: var(--profile-color-soft);
  color: var(--profile-color);
}

.pencil { font-size: 14px; }

/* ============================================================================
   Sidebar — navigation
   ============================================================================ */
.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: background 0.12s ease, color 0.12s ease;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--profile-color-soft);
  color: var(--profile-color);
  font-weight: 600;
}

.nav-icon {
  width: 22px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--profile-color);
  color: var(--profile-color-contrast);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  min-width: 20px;
  text-align: center;
}

.nav-badge[data-count="0"] { display: none; }

/* ============================================================================
   Sidebar — footer (indicateurs de connexion)
   ============================================================================ */
.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: center;
}

.connection-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  position: relative;
  cursor: help;
}

.connection-dot.ok { background: var(--success); }
.connection-dot.ko { background: var(--danger); }

/* ============================================================================
   Vues — en-tête commun
   ============================================================================ */
.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.view-header > div:first-child {
  flex: 1;
  min-width: 0;
}

.view-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.view-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 4px 0 0;
}

/* ============================================================================
   Cartes & formulaires
   ============================================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 16px;
  color: var(--text-primary);
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-row-inline {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.form-row-inline > .form-row { flex: 1; min-width: 180px; }

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.input, .textarea, .select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
  font-size: 14px;
}

.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--profile-color);
  box-shadow: 0 0 0 3px var(--profile-color-soft);
}

.textarea { resize: vertical; min-height: 80px; font-family: inherit; }

.input-with-action {
  display: flex;
  gap: 8px;
}
.input-with-action .input { flex: 1; }

/* ============================================================================
   Boutons
   ============================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background 0.12s ease, border-color 0.12s ease, opacity 0.12s ease;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--profile-color);
  color: var(--profile-color-contrast);
}
.btn-primary:hover:not(:disabled) { filter: brightness(0.92); }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) { filter: brightness(0.92); }

.btn-sm { padding: 6px 10px; font-size: 12px; }

/* ============================================================================
   Checkbox / Radio / Multi-select custom
   ============================================================================ */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  padding: 6px 0;
  font-size: 14px;
}

.checkbox-row input { accent-color: var(--profile-color); }

.chip-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
}

.chip:hover { border-color: var(--profile-color); color: var(--profile-color); }

.chip.selected {
  background: var(--profile-color);
  border-color: var(--profile-color);
  color: var(--profile-color-contrast);
}

/* ============================================================================
   Listes de posts (À valider / Validés)
   ============================================================================ */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.12s ease, border-color 0.12s ease;
}

.post-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--profile-color-border);
}

.post-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.badge-facebook { background: #1877F2; color: #ffffff; }
.badge-linkedin { background: #0A66C2; color: #ffffff; }
.badge-twitter  { background: #000000; color: #ffffff; }
.badge-neutral  { background: var(--bg-muted); color: var(--text-secondary); }
.badge-success  { background: #f0fdf4; color: var(--success); }
.badge-warning  { background: #fffbeb; color: var(--warning); }

.post-subject {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
}

.post-body {
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  color: var(--text-primary);
  background: var(--bg-muted);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  max-height: 180px;
  overflow-y: auto;
}

.post-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.post-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* ============================================================================
   Filtres
   ============================================================================ */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.filter-bar .form-row { margin-bottom: 0; min-width: 160px; flex: 1; }
.filter-bar .form-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }

/* ============================================================================
   État vide
   ============================================================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* ============================================================================
   Modal
   ============================================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

.modal-overlay[hidden] { display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.modal-close {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 18px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.modal-body { padding: 22px 24px; }

.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-muted);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ============================================================================
   Toasts
   ============================================================================ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  pointer-events: none;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 13.5px;
  font-weight: 500;
  min-width: 240px;
  max-width: 420px;
  pointer-events: auto;
  animation: slideIn 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-info    { border-left: 3px solid var(--profile-color); }

@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============================================================================
   Divers
   ============================================================================ */
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

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

.color-picker-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.color-picker-row input[type="color"] {
  width: 44px;
  height: 38px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--bg-input);
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
}

.muted { color: var(--text-muted); }
.text-small { font-size: 12px; }

/* ============================================================================
   Dropzone (imagescript.js)
   ============================================================================ */
.dz {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-muted);
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  outline: none;
}

.dz:hover, .dz:focus {
  border-color: var(--profile-color);
  background: var(--profile-color-soft);
}

.dz.dz-drag {
  border-color: var(--profile-color);
  border-style: solid;
  background: var(--profile-color-soft);
}

.dz-prompt {
  text-align: center;
  color: var(--text-secondary);
  pointer-events: none;
  padding: 12px 8px;
}

.dz-prompt button {
  pointer-events: auto;
}

.dz-icon {
  font-size: 28px;
  margin-bottom: 6px;
}

.dz-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.dz-browse {
  color: var(--profile-color);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dz-input { display: none; }

.dz-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dz-list:empty { margin: 0; }

.dz-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.dz-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--bg-muted);
}

.dz-thumb-doc {
  object-fit: contain;
  padding: 4px;
}

.dz-item-info {
  flex: 1;
  min-width: 0;
}

.dz-item-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dz-item-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.dz-remove {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s ease, color 0.12s ease;
}

.dz-remove:hover {
  background: #fee2e2;
  color: var(--danger);
}

/* ============================================================================
   Cartes compactes uniformes (modes cartes pending / published)
   ============================================================================ */
.post-card-compact {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: box-shadow 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}

.post-card-compact:hover {
  box-shadow: var(--shadow);
  border-color: var(--profile-color-border);
  transform: translateY(-2px);
}

/* Image OU placeholder — toujours présente, même hauteur partout */
.post-card-image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.post-card-image-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
  font-style: italic;
  background: repeating-linear-gradient(
    45deg,
    var(--bg-muted),
    var(--bg-muted) 8px,
    var(--bg-card) 8px,
    var(--bg-card) 16px
  );
}

.post-card-compact-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
}

.post-card-header {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.post-card-id {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

.post-card-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.post-card-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.post-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-start;   /* en bas à gauche comme demandé */
  margin-top: 4px;
}

/* ============================================================================
   Liste compacte — une ligne par post, séparateurs fins
   ============================================================================ */
.post-compact-list {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.post-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s ease;
}

.post-row:last-child { border-bottom: none; }

.post-row:hover { background: var(--bg-hover); }

.post-row-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: var(--bg-muted);
  border: 1px solid var(--border);
}

.post-row-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 18px;
  background: repeating-linear-gradient(
    45deg,
    var(--bg-muted),
    var(--bg-muted) 6px,
    var(--bg-card) 6px,
    var(--bg-card) 12px
  );
}

.post-row-network, .post-row-status {
  flex-shrink: 0;
}

.post-row-id {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  flex-shrink: 0;
  min-width: 36px;
}

.post-row-excerpt {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-row-date {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  white-space: nowrap;
}

/* ============================================================================
   Modal d'édition — image edge-to-edge avec boutons en overlay
   ============================================================================ */
.edit-modal-dropzone {
  position: relative;
}

.edit-drop-overlay {
  position: absolute;
  inset: -22px -24px;             /* couvre les paddings du modal-body */
  background: var(--profile-color-soft);
  border: 2px dashed var(--profile-color);
  border-radius: var(--radius);
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
  backdrop-filter: blur(2px);
}

.edit-drop-overlay.active { display: flex; }

.edit-drop-overlay-content {
  text-align: center;
  color: var(--profile-color);
  font-weight: 600;
}

/* ---------- Image pleine largeur, edge-to-edge ---------- */
.edit-image-fullwidth {
  position: relative;
  margin: -22px -24px 20px;       /* annule le padding du modal-body */
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.edit-image-fullwidth img {
  display: block;
  width: 100%;
  max-height: 340px;
  object-fit: cover;
  background: var(--bg-muted);
}

.edit-image-fullwidth-actions {
  position: absolute;
  top: 12px;
  right: 14px;
  display: flex;
  gap: 8px;
  z-index: 2;
}

/* Boutons overlay : fond semi-transparent avec blur pour lisibilité sur image */
.btn-overlay {
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-primary);
  border: 1px solid rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: background 0.12s ease, transform 0.12s ease;
}

.btn-overlay:hover:not(:disabled) {
  background: rgba(255, 255, 255, 1);
  transform: translateY(-1px);
}

.btn-overlay-danger {
  background: rgba(220, 38, 38, 0.92);
  color: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
}

.btn-overlay-danger:hover:not(:disabled) {
  background: rgba(220, 38, 38, 1);
}

/* ---------- Version compacte : juste un bouton "Ajouter" ---------- */
.edit-image-compact {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

/* ---------- Section IA intégrée (<details>) ---------- */
.ai-details {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  overflow: hidden;
  transition: border-color 0.12s ease;
}

.ai-details[open] {
  border-color: var(--profile-color-border);
}

.ai-details summary {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.12s ease;
}

.ai-details summary::-webkit-details-marker { display: none; }

.ai-details summary::after {
  content: "▸";
  font-size: 10px;
  transition: transform 0.15s ease;
  color: var(--text-muted);
}

.ai-details[open] summary::after { transform: rotate(90deg); }

.ai-details summary:hover {
  background: var(--profile-color-soft);
  color: var(--profile-color);
}

.ai-details-body {
  padding: 10px 14px 14px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}

/* ============================================================================
   Header d'une vue — zone d'actions alignée
   ============================================================================ */
.view-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;       /* les 3 éléments restent sur la même ligne */
  flex-shrink: 0;          /* pas de rétrécissement involontaire */
  align-self: flex-start;
  margin-top: 4px;         /* petit alignement visuel avec le bas du titre */
}

.view-header-select {
  height: 36px;
  max-width: 220px;
  padding: 0 12px;
}

.view-icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 16px;
  transition: background 0.12s ease, color 0.12s ease, transform 0.2s ease;
}

.view-icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.view-icon-btn:active {
  transform: rotate(180deg);
}

/* ============================================================================
   Toggle liste/cartes — règle de base
   ============================================================================ */
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.view-toggle-btn {
  padding: 0 12px;
  font-size: 15px;
  color: var(--text-secondary);
  background: var(--bg-card);
  transition: background 0.12s ease, color 0.12s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.view-toggle-btn:not(:last-child) { border-right: 1px solid var(--border-strong); }

.view-toggle-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.view-toggle-btn.active {
  background: var(--profile-color);
  color: var(--profile-color-contrast);
}

/* Aligner le toggle liste/cartes sur la même hauteur que les autres actions */
.view-header-actions .view-toggle {
  height: 36px;
}

.view-header-actions .view-toggle-btn {
  height: 100%;
  padding: 0 12px;
}

/* ============================================================================
   Breadcrumb (drill-down navigation)
   ============================================================================ */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 13px;
  flex-wrap: wrap;
}

.breadcrumb-link {
  color: var(--profile-color);
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.12s ease;
}

.breadcrumb-link:hover { background: var(--profile-color-soft); }

.breadcrumb-current {
  color: var(--text-primary);
  font-weight: 600;
  padding: 4px 8px;
}

.breadcrumb-sep {
  color: var(--text-muted);
  font-size: 14px;
}

/* ============================================================================
   Groupes (publication/campagne dans les vues pending/published)
   ============================================================================ */
.group-row {
  cursor: pointer;
  background: var(--bg-muted);
}

.group-row:hover { background: var(--profile-color-soft); }

.group-row-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 18px;
  flex-shrink: 0;
}

.group-row-chevron {
  color: var(--text-muted);
  font-size: 20px;
  flex-shrink: 0;
  font-weight: 300;
}

.group-networks {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.group-count {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.group-card {
  cursor: pointer;
}

.group-card-cover {
  width: 100%;
  height: 120px;
  background: linear-gradient(135deg, var(--profile-color-soft) 0%, var(--bg-muted) 100%);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.group-card-icon {
  font-size: 36px;
  opacity: 0.85;
}

.group-card-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--profile-color);
  background: var(--bg-card);
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--profile-color-border);
}

/* ============================================================================
   Stratégies — cartes à hauteur uniforme
   ============================================================================ */
.strategy-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  height: 200px;                     /* hauteur fixe pour homogénéité */
  transition: box-shadow 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}

.strategy-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--profile-color-border);
  transform: translateY(-2px);
}

.strategy-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.strategy-card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strategy-card-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================================
   Vue Création — layout 2 colonnes
   ============================================================================ */
.create-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  align-items: stretch;             /* étire les deux colonnes à la même hauteur */
  min-height: calc(100vh - 240px);  /* occupe au minimum la hauteur de viewport */
}

@media (max-width: 900px) {
  .create-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }
}

.create-main { min-width: 0; display: flex; }

.create-sidebar {
  position: sticky;
  top: 20px;
  display: flex;
  align-self: start;
  height: fit-content;
}

.create-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* La carte principale prend toute la hauteur disponible */
.create-main .create-card { flex: 1; }

/* Le textarea du sujet/prompt s'étire verticalement pour remplir l'espace */
.create-main textarea.textarea {
  flex: 1;
  min-height: 140px;
  resize: vertical;
}

.create-card .form-row:not(:last-child) {
  margin-bottom: 16px;
}

/* La form-row qui contient le textarea principal s'étire pour pousser
   les pièces jointes vers le bas naturellement */
.create-main .form-row.form-row-grow {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.create-sidebar-card {
  padding: 18px;
}

.create-sidebar-title {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.create-sidebar-cta {
  width: 100%;
  margin-top: 8px;
  justify-content: center;
}

/* ============================================================================
   Sélecteur de stratégies compact (custom multi-select dropdown)
   ============================================================================ */
.strategy-selector {
  position: relative;
}

.strategy-selector-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s ease;
}

.strategy-selector-button:hover { border-color: var(--profile-color-border); }

.strategy-selector-button.open {
  border-color: var(--profile-color);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.strategy-selector-summary {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.strategy-selector-summary.placeholder {
  color: var(--text-muted);
}

.strategy-selector-count {
  display: inline-block;
  background: var(--profile-color);
  color: var(--profile-color-contrast);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  margin-right: 6px;
  min-width: 18px;
  text-align: center;
}

.strategy-selector-chevron {
  color: var(--text-muted);
  font-size: 10px;
  margin-left: 8px;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.strategy-selector-button.open .strategy-selector-chevron {
  transform: rotate(180deg);
}

.strategy-selector-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--bg-card);
  border: 1px solid var(--profile-color);
  border-top: none;
  border-bottom-left-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
  max-height: 280px;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.strategy-selector-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s ease;
}

.strategy-selector-option:last-child { border-bottom: none; }

.strategy-selector-option:hover { background: var(--bg-hover); }

.strategy-selector-option.selected {
  background: var(--profile-color-soft);
  color: var(--text-primary);
  font-weight: 500;
}

.strategy-selector-check {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: transparent;
  transition: all 0.12s ease;
}

.strategy-selector-option.selected .strategy-selector-check {
  background: var(--profile-color);
  border-color: var(--profile-color);
  color: var(--profile-color-contrast);
}

.strategy-selector-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strategy-selector-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  background: var(--bg-muted);
  color: var(--text-secondary);
  border-radius: 999px;
  flex-shrink: 0;
}

/* ============================================================================
   Chip-toggle — chips cliquables sans checkbox, couleur profil quand actives
   ============================================================================ */
.chip-group-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-toggle {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-secondary);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
  white-space: nowrap;
}

.chip-toggle small {
  opacity: 0.7;
  font-size: 11px;
  margin-left: 4px;
  font-weight: 400;
}

.chip-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--profile-color-border);
}

.chip-toggle.active {
  background: var(--profile-color);
  border-color: var(--profile-color);
  color: var(--profile-color-contrast);
}

.chip-toggle.active small { opacity: 0.85; }

/* ============================================================================
   Modale de confirmation cascade — preview + bouton hold-to-confirm
   ============================================================================ */
.cascade-items {
  list-style: none;
  margin: 0;
  padding: 12px 14px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.cascade-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-primary);
}

.cascade-item:not(:last-child) {
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
}

.cascade-item-icon { font-size: 15px; flex-shrink: 0; }

.cascade-item-label { flex: 1; min-width: 0; }

.cascade-item-count {
  background: var(--profile-color);
  color: var(--profile-color-contrast);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  min-width: 22px;
  text-align: center;
  flex-shrink: 0;
}

/* Bouton hold-to-confirm */
.btn-hold {
  position: relative;
  overflow: hidden;
  user-select: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.btn-hold .btn-hold-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 0;
  background: rgba(255, 255, 255, 0.28);
  transition: width 0s linear;
  pointer-events: none;
  z-index: 0;
}

.btn-hold .btn-hold-label {
  position: relative;
  z-index: 1;
}

/* Quand on hold : le fill se remplit en var(--hold-duration) */
.btn-hold.holding .btn-hold-fill {
  width: 100%;
  transition: width var(--hold-duration, 1500ms) linear;
}

.btn-hold.complete .btn-hold-fill {
  background: rgba(255, 255, 255, 0.45);
  width: 100%;
}

/* ============================================================================
   Boutons de lancement campagne (sidebar)
   ============================================================================ */
.create-sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.create-sidebar-actions .create-sidebar-cta {
  margin-top: 0;
}

/* ============================================================================
   Overlay de chargement (proposition de sujets)
   ============================================================================ */
.propose-loader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.propose-loader-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 36px 44px;
  text-align: center;
  max-width: 420px;
}

.propose-loader-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--bg-muted);
  border-top-color: var(--profile-color);
  border-radius: 50%;
  margin: 0 auto 18px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.propose-loader-title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.propose-loader-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* ============================================================================
   Vue de revue des sujets proposés
   ============================================================================ */
.proposal-review {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}

.proposal-review-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.proposal-review-title {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.proposal-review-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 520px;
}

.proposal-review-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.proposal-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.proposal-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.proposal-item:hover {
  border-color: var(--profile-color-border);
  box-shadow: var(--shadow-sm);
}

.proposal-item-rank {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.proposal-item-body {
  flex: 1;
  min-width: 0;
}

.proposal-item-subject {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
}

.proposal-item-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.proposal-meta-pill {
  font-size: 11px;
  padding: 2px 8px;
  background: var(--bg-muted);
  border-radius: 999px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.proposal-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-items: center;
}

/* ============================================================================
   Barre de progression (lancement final)
   ============================================================================ */
.proposal-progress {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 36px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  max-width: 600px;
  margin: 40px auto;
}

.proposal-progress-title {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
}

.proposal-progress-text {
  margin: 0 0 24px;
  font-size: 13px;
  color: var(--text-secondary);
}

.proposal-progress-bar {
  height: 8px;
  background: var(--bg-muted);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 16px;
}

.proposal-progress-fill {
  height: 100%;
  background: var(--profile-color);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.proposal-progress-status {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
  font-family: monospace;
}

/* Bouton icône seule (carré, pour la corbeille) */
.btn-icon-only {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

/* ============================================================================
   Bouton Supprimer — croix blanche sur fond rouge
   ----------------------------------------------------------------------------
   Utilisé sur les cards/lignes de Posts, Publications et Campagnes dans la
   vue "À valider" uniquement. Plus serieux qu'une emoji poubelle.
   ============================================================================ */
.btn-delete-x {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--danger);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease;
  box-shadow: 0 1px 2px rgba(220, 38, 38, 0.25);
}
.btn-delete-x:hover:not(:disabled) {
  filter: brightness(0.92);
}
.btn-delete-x:active:not(:disabled) {
  transform: scale(0.94);
}
.btn-delete-x:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Scrollbars discrètes */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================================================
   SIDEBAR BRAND — Identité Prismart en bas de la nav, juste au-dessus de
   la ligne de séparation du footer.
   ----------------------------------------------------------------------------
   Placé comme dernier enfant de <nav class="sidebar-nav">. Pas de border :
   c'est le footer en-dessous qui apporte le séparateur via son border-top.
   `margin-top: auto` pousse le bandeau en bas de la nav si la nav a un
   layout flex-column (ce qui est normalement le cas). Si la nav n'est pas
   en flex, le bandeau suit simplement les items de nav sans espace.
   ============================================================================ */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  margin-top: auto;
}
.sidebar-brand-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(180, 165, 255, 0.4))
          drop-shadow(0 0 4px rgba(140, 220, 240, 0.3));
}
[data-theme="light"] .sidebar-brand-logo {
  filter: drop-shadow(0 1px 2px rgba(15, 23, 42, 0.2))
          drop-shadow(0 0 5px rgba(180, 165, 255, 0.5));
}
.sidebar-brand-name {
  font-family: "Orbitron", "Inter", system-ui, sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.18em;
  color: var(--text-primary);
  /* Léger gradient iridescent — subtil pour ne pas crier */
  background: linear-gradient(110deg,
    var(--text-primary) 0%,
    var(--text-primary) 50%,
    #9d8eff 70%,
    #6cc5d9 90%,
    var(--text-primary) 100%);
  background-size: 200% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ============================================================================
   PAGE DE LOGIN
   ============================================================================ */
body.login-body {
  margin: 0;
  display: block;
  background: var(--bg);
  min-height: 100vh;
  font-family: "Inter", system-ui, sans-serif;
}
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

/* Halos iridescents en arrière-plan */
.login-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  opacity: 0.5;
  z-index: 0;
}
.login-glow-1 {
  top: -120px;
  left: -120px;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, #b3a4ff 0%, transparent 70%);
}
.login-glow-2 {
  bottom: -160px;
  right: -160px;
  width: 560px;
  height: 560px;
  background: radial-gradient(circle, #88d8e8 0%, transparent 70%);
}
[data-theme="light"] .login-glow { opacity: 0.35; }

/* Carte de login — verre dépoli */
.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 44px 36px 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.login-card-success {
  opacity: 0;
  transform: translateY(-8px);
}

.login-brand {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 24px rgba(180, 165, 255, 0.5))
          drop-shadow(0 0 12px rgba(140, 220, 240, 0.4));
  animation: login-logo-float 4s ease-in-out infinite;
}
@keyframes login-logo-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
.login-wordmark {
  font-family: "Orbitron", "Inter", system-ui, sans-serif;
  font-weight: 900;
  font-size: 38px;
  letter-spacing: 0.25em;
  margin: 0 0 6px;
  color: var(--text-primary);
  background: linear-gradient(120deg,
    var(--text-primary) 0%,
    var(--text-primary) 30%,
    #b3a4ff 50%,
    #88d8e8 70%,
    var(--text-primary) 100%);
  background-size: 200% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: login-shimmer 6s linear infinite;
}
@keyframes login-shimmer {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}
.login-tagline {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.login-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-primary);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.login-input:focus {
  outline: none;
  border-color: #b3a4ff;
  box-shadow: 0 0 0 3px rgba(179, 164, 255, 0.2);
}

.login-submit {
  margin-top: 8px;
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.04em;
  color: #ffffff;
  background: linear-gradient(120deg, #6c63ff 0%, #5b8def 50%, #5fc3d6 100%);
  background-size: 200% 100%;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-position 0.4s ease, transform 0.1s ease, opacity 0.15s ease;
  box-shadow: 0 4px 16px rgba(108, 99, 255, 0.35);
}
.login-submit:hover:not(:disabled) {
  background-position: 100% 50%;
}
.login-submit:active:not(:disabled) {
  transform: scale(0.98);
}
.login-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-error {
  margin: 4px 0 0;
  padding: 10px 12px;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.25);
  border-radius: var(--radius);
  color: var(--danger);
  font-size: 13px;
  text-align: center;
}
[data-theme="dark"] .login-error {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.35);
}

.login-footer {
  position: relative;
  z-index: 1;
  margin-top: 32px;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* ============================================================================
   SETTINGS — Toggle thème (3 boutons : Auto / Clair / Sombre)
   ============================================================================ */
.theme-toggle {
  display: inline-flex;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  gap: 2px;
}
.theme-toggle-btn {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  background: transparent;
  border: none;
  border-radius: calc(var(--radius) - 4px);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}
.theme-toggle-btn:hover:not(.active) {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.theme-toggle-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}
.theme-toggle-icon { font-size: 14px; line-height: 1; }

/* ============================================================================
   Modale de progression batch (envoi groupé Metricool, etc.)
   ============================================================================ */
.progress-modal-overlay { z-index: 9000; }
.progress-modal-overlay.is-closing { opacity: 0; transition: opacity 0.15s ease; }

.modal-progress { max-width: 480px; }

.progress-modal-summary {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 16px;
  font-variant-numeric: tabular-nums;
}
.progress-modal-done {
  font-size: 32px;
  font-weight: 700;
  color: var(--profile-color);
  line-height: 1;
}
.progress-modal-sep {
  font-size: 24px;
  color: var(--text-muted);
}
.progress-modal-total {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-secondary);
}
.progress-modal-label {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.progress-modal-label.has-failed { color: var(--color-danger, #dc2626); }

.progress-modal-bar {
  height: 8px;
  background: var(--bg-muted);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 12px;
}
.progress-modal-fill {
  height: 100%;
  background: var(--profile-color);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.progress-modal-fill.is-success { background: var(--color-success, #16a34a); }
.progress-modal-fill.is-warning { background: var(--color-warning, #f59e0b); }

.progress-modal-current {
  font-size: 13px;
  color: var(--text-secondary);
  font-family: monospace;
  background: var(--bg-muted);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  word-break: break-word;
}

.progress-modal-results { font-size: 12px; }