:root {
  --bg: #0f1216;
  --panel: #161b22;
  --panel-2: #1c232c;
  --panel-3: #232b36;
  --border: #262e38;
  --text: #e6edf3;
  --muted: #8b98a7;
  /* Bleu-violet Natice (couleur de marque du projet côté dashboard). */
  --accent: #647adb;
  --accent-2: #7d90e6;
  --accent-soft: #647adb22;
  --accent-contrast: #ffffff;

  --sc-critique: #ff5d5d;
  --sc-fort: #ff9f43;
  --sc-moyen: #ffd166;
  --sc-faible: #5ec98a;
  --sc-aucun: #3fb27f;
  --sc-creation: #b57bff;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 16px rgb(0 0 0 / 35%);
  --shadow-lg: 0 12px 36px rgb(0 0 0 / 45%);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --gradient: linear-gradient(135deg, var(--accent), var(--accent-2));
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6f9;
    --panel: #ffffff;
    --panel-2: #f0f3f7;
    --panel-3: #e7ecf3;
    --border: #dde3ea;
    --text: #1a2029;
    --muted: #64748b;
    --accent: #5468c9;
    --accent-2: #647adb;
    --accent-soft: #5468c914;
    --shadow: 0 2px 10px rgb(15 23 42 / 8%);
    --shadow-lg: 0 16px 40px rgb(15 23 42 / 14%);
  }
}

* { box-sizing: border-box; }

/* `display: block` des utilitaires prendrait sinon le pas sur [hidden]. */
[hidden] { display: none !important; }

html { scrollbar-color: var(--border) transparent; scrollbar-width: thin; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); }

body {
  margin: 0;
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  /* Fond légèrement teinté par la marque plutôt qu'un gris plat. */
  background: radial-gradient(1100px 620px at 12% -8%, var(--accent-soft), transparent 55%), var(--bg);
  background-attachment: fixed;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Barre supérieure --- */

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 20px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(10px) saturate(1.4);
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 var(--border), 0 8px 24px -16px rgb(0 0 0 / 25%);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo { height: 24px; width: auto; display: block; }
/* Le mot-symbole fourni est en clair (#F8FAFB) : on l'inverse en thème clair
   plutôt que de maintenir un second fichier, la marque reste illisible sinon. */
@media (prefers-color-scheme: light) {
  .brand-logo { filter: invert(1); }
}
.brand-sep { width: 1px; height: 24px; background: var(--border); }
.brand h1 { margin: 0; font-size: 16px; letter-spacing: -0.01em; font-weight: 700; }
.brand p { margin: 0; font-size: 11.5px; color: var(--muted); }

.topbar-stats { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.stat {
  text-align: right;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  transition: background-color .15s var(--ease);
}
.stat:hover { background: var(--panel-2); }
.stat b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* --- Bascule Prospection / CRM --- */

.view-switch { display: flex; gap: 2px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; }
.view-tab {
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.view-tab:hover { color: var(--text); }
.view-tab.active { background: var(--panel); color: var(--accent-2); box-shadow: var(--shadow); }
.badge-count {
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700;
  border-radius: 999px; padding: 1px 6px;
  min-width: 16px; text-align: center;
}

/* --- Mise en page 3 colonnes --- */

.layout {
  display: grid;
  grid-template-columns: 290px minmax(380px, 1fr) minmax(340px, 420px);
  gap: 14px;
  padding: 14px;
  align-items: start;
  height: calc(100vh - 61px);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  height: 100%;
  overflow-y: auto;
}

.filters { padding: 16px; }
.results { display: flex; flex-direction: column; overflow: hidden; }
.detail { padding: 0; }

@media (max-width: 1200px) {
  .layout { grid-template-columns: 260px 1fr; height: auto; }
  .detail { grid-column: 1 / -1; height: 70vh; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .panel { height: auto; max-height: none; }
}

/* --- Formulaire --- */

.field { margin-bottom: 16px; position: relative; }
.field > label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="search"], input[type="text"], select, textarea {
  width: 100%;
  padding: 8px 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%238b98a7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 7.5L10 12.5L15 7.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 15px;
  cursor: pointer;
}
select[multiple] { padding: 4px; appearance: auto; -webkit-appearance: auto; background-image: none; }
select option { background: var(--panel-2); color: var(--text); }

.hint { font-size: 11px; color: var(--muted); margin: 4px 0 0; }

.autocomplete {
  position: absolute;
  z-index: 30;
  left: 0; right: 0;
  margin-top: 4px;
  max-height: 260px;
  overflow-y: auto;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  box-shadow: var(--shadow);
}
.autocomplete button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.autocomplete button:last-child { border-bottom: 0; }
.autocomplete button:hover { background: var(--accent-soft); }
.autocomplete .code { font-family: ui-monospace, monospace; color: var(--accent-2); margin-right: 6px; }
.autocomplete .sub { display: block; font-size: 11px; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px 3px 8px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 999px;
  font-size: 11.5px;
}
.chip button { background: none; border: 0; color: inherit; cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; }

.toggles { display: flex; flex-direction: column; gap: 8px; }
.switch { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.switch input { accent-color: var(--accent); width: 15px; height: 15px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s var(--ease), background-color .15s var(--ease),
    transform .1s var(--ease), box-shadow .15s var(--ease);
}
.btn:hover { border-color: var(--accent); background: var(--panel-3); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--gradient); border-color: var(--accent); color: var(--accent-contrast, #fff); font-weight: 600; box-shadow: 0 2px 10px -2px var(--accent-soft); }
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 6px 18px -4px color-mix(in srgb, var(--accent) 55%, transparent); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-block { display: flex; width: 100%; margin-bottom: 8px; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }

.sources { font-size: 11px; color: var(--muted); margin-top: 18px; line-height: 1.6; }

/* --- Recherche unitaire (nom, carte de visite) --- */

/* Sépare la recherche d'une société précise de la prospection en volume. */
.filters-sep {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 16px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}
.filters-sep::before, .filters-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Deux entrées de même poids : caméra de l'appareil, ou fichier image. */
.card-scan-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.card-scan-actions .btn { padding: 8px 6px; font-size: 12.5px; }

/* Pas de format imposé : la scène épouse celui de la caméra, sinon des
   bandes noires rognent la place utile pour cadrer la carte. */
.camera-stage {
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  min-height: 200px;
  display: grid;
  place-items: center;
}
.camera-stage video { width: 100%; max-height: 62vh; object-fit: contain; display: block; }

.camera-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.camera-actions select { width: auto; flex: 1; min-width: 0; font-size: 12px; padding: 6px 28px 6px 8px; }
.camera-actions .btn:first-of-type { margin-left: auto; }
.camera-actions select:not([hidden]) ~ .btn:first-of-type { margin-left: 0; }
#camera-status:not(:empty) { margin-top: 12px; }
#camera-status .notice { margin-bottom: 0; }

.card-scan { margin-top: 8px; }
.card-scan .notice { margin-bottom: 8px; }
.card-scan-read {
  padding: 8px 10px;
  margin-bottom: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
  word-break: break-word;
}
.card-scan-read div:first-child { color: var(--text); font-weight: 600; }
/* La provenance reste une note de bas de ligne, même sur la première. */
.card-scan-read .src { font-weight: 400; color: var(--muted); }

.card-scan-candidates { display: flex; flex-direction: column; gap: 6px; }
.card-candidate {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
.card-candidate:hover { border-color: var(--accent); background: var(--accent-soft); }
.card-candidate .sub { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

/* --- Résultats --- */

.results-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.results-summary { font-size: 13px; color: var(--muted); flex: 1; }
.sort { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.sort select { width: auto; padding: 4px 8px; font-size: 12px; }

.progress { height: 3px; background: var(--panel-2); flex-shrink: 0; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .25s; }

/* Le conteneur défile, pas la liste : le bouton reste sous la dernière carte. */
.cards-scroll { overflow-y: auto; flex: 1; }
.cards { list-style: none; margin: 0; padding: 8px; }

.load-more-wrap { padding: 0 8px 14px; }
#load-more { width: 100%; }
#load-more:disabled { opacity: .6; cursor: progress; }

.card {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
  background: var(--panel);
  transition: border-color .15s var(--ease), background-color .15s var(--ease),
    box-shadow .15s var(--ease), transform .1s var(--ease);
}
.card:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateX(1px); }
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset, var(--shadow); background: var(--accent-soft); }
.card.pending { opacity: .55; }
/* Déjà consultée : discret, pour ne pas rivaliser avec le score/tags. */
.card.viewed:not(.selected) { opacity: .72; }
.viewed-mark { color: var(--sc-aucun); font-weight: 700; }

.score-badge {
  width: 54px; height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #0f1216;
  align-self: start;
  box-shadow: inset 0 0 0 3px rgb(255 255 255 / 18%);
}
.score-badge small { display: block; font-size: 8px; font-weight: 600; letter-spacing: .06em; opacity: .75; }

.sc-critique { background: var(--sc-critique); }
.sc-fort     { background: var(--sc-fort); }
.sc-moyen    { background: var(--sc-moyen); }
.sc-faible   { background: var(--sc-faible); }
.sc-aucun    { background: var(--sc-aucun); }
.sc-creation { background: var(--sc-creation); }
.sc-pending  { background: var(--panel-2); color: var(--muted); font-size: 12px; box-shadow: none; }

.card-title { font-weight: 600; margin: 0 0 2px; font-size: 14px; }
.card-meta { font-size: 12px; color: var(--muted); margin: 0 0 5px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; }

.tag {
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted);
}
.tag-warn { color: var(--sc-fort); border-color: var(--sc-fort); }
.tag-bad { color: var(--sc-critique); border-color: var(--sc-critique); }
.tag-ok { color: var(--sc-aucun); border-color: var(--sc-aucun); }
.tag-mail { color: var(--accent-2); border-color: var(--accent-2); }
.tag-pipeline { font-weight: 600; border-width: 1px; }

/* --- Panneau de détail --- */

.detail-empty { padding: 40px 24px; color: var(--muted); text-align: center; }

.detail-head { padding: 16px; border-bottom: 1px solid var(--border); }
.detail-head h2 { margin: 0 0 4px; font-size: 16px; }
.detail-head .sub { font-size: 12px; color: var(--muted); }

.preview-frame {
  position: relative;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.preview-frame img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.preview-frame iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.preview-loading, .preview-error {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding: 20px;
}
.preview-actions {
  display: flex; gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  flex-wrap: wrap;
}

.detail-section { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.detail-section h3 {
  margin: 0 0 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}
.contact-row:last-child { border-bottom: 0; }
/* Coordonnée relevée sur la carte de visite : la plus directe des trois. */
.contact-row.from-card { border-left: 2px solid var(--accent); padding-left: 8px; margin-left: -10px; }
.contact-row.from-card .src { color: var(--accent-2); }
.contact-row .val { flex: 1; font-family: ui-monospace, monospace; font-size: 12.5px; word-break: break-all; }
.contact-row .src { font-size: 10px; color: var(--muted); }
.copy-btn { background: none; border: 1px solid var(--border); border-radius: 5px; color: var(--muted); cursor: pointer; font-size: 11px; padding: 2px 6px; }
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }

.criteria { display: flex; flex-direction: column; gap: 9px; }
.criterion-row { font-size: 12px; }
.criterion-head { display: flex; justify-content: space-between; margin-bottom: 3px; }
.criterion-head b { font-weight: 600; }
.criterion-head span { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 5px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.bar > div { height: 100%; border-radius: 3px; }

.signals { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.signals li { display: flex; gap: 7px; font-size: 12px; align-items: baseline; }
.sev {
  flex-shrink: 0;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 700;
}
.sev-critique { background: var(--sc-critique); color: #1a0505; }
.sev-élevé { background: var(--sc-fort); color: #1a0f00; }
.sev-moyen { background: var(--sc-moyen); color: #1a1500; }
.sev-faible { background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); }

.pitch { background: var(--accent-soft); border-left: 3px solid var(--accent); padding: 10px 12px; border-radius: 0 6px 6px 0; }
.pitch ul { margin: 0; padding-left: 18px; }
.pitch li { margin-bottom: 3px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

.notice {
  padding: 9px 11px;
  border-radius: 7px;
  font-size: 12px;
  margin-bottom: 10px;
  border: 1px solid;
}
.notice-warn { background: #ff9f4315; border-color: var(--sc-fort); }
.notice-info { background: var(--accent-soft); border-color: var(--accent); }

.inline-form { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 140px; }

.link-btn {
  background: none; border: 0; padding: 6px 0 0; margin: 0;
  color: var(--accent-2); font-size: 11.5px; cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

/* --- Nomenclature NAF (modale de navigation) --- */

#naf-browse-filter { margin-bottom: 10px; }

.naf-tree {
  max-height: 60vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
}
.naf-node { border-bottom: 1px solid var(--border); }
.naf-node:last-child { border-bottom: 0; }
.naf-node > summary {
  padding: 8px 10px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.naf-node > summary::-webkit-details-marker { display: none; }
.naf-node > summary:hover { background: var(--panel-3); }
.naf-node > summary::before { content: '▸'; margin-right: 6px; color: var(--muted); flex-shrink: 0; }
.naf-node[open] > summary::before { content: '▾'; }
.naf-division > summary { font-weight: 500; padding-left: 22px; }
.naf-children { background: var(--panel); }
.naf-leaf-list { padding: 2px 0; }
.naf-leaf {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 10px 6px 40px;
  background: none;
  border: 0;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.naf-leaf:hover { background: var(--accent-soft); }
.naf-leaf .code { font-family: ui-monospace, monospace; color: var(--accent-2); margin-right: 6px; }
.naf-leaf.added { color: var(--accent-2); }
.naf-leaf.added::after { content: ' ✓'; }
.naf-add-all { flex-shrink: 0; font-weight: 400; }
.naf-node.naf-hidden { display: none; }

/* Légende toujours visible sous chaque champ — le placeholder seul disparaît dès qu'on tape une valeur. */
.sitegen-limit-field { flex: 1; min-width: 140px; display: flex; flex-direction: column; gap: 3px; }
.sitegen-limit-field input { width: 100%; }
.sitegen-limit-caption { font-size: 10.5px; color: var(--muted); text-align: center; }

.empty { padding: 30px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.empty-start {
  padding: 80px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.empty-start .empty-icon {
  font-size: 30px;
  width: 64px; height: 64px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
}
.empty-start p { margin: 0; max-width: 260px; }
.spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  display: inline-block;
  animation: spin .7s linear infinite;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Statut Natice (bouton topbar) --- */

.status-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--muted);
  margin-right: 5px;
}
.status-dot.on { background: var(--sc-aucun); }
.status-dot.off { background: var(--muted); }
.status-dot.error { background: var(--sc-critique); animation: pulse-dot 1.6s ease-in-out infinite; }
@keyframes pulse-dot { 50% { opacity: .35; } }

/* --- Modale --- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 55%);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  z-index: 200;
  padding: 20px;
  animation: fade-in .15s var(--ease);
}
.modal {
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  animation: modal-in .18s var(--ease);
}
.modal.modal-wide { max-width: 760px; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 15px; }
.modal-close {
  background: none; border: 0; color: var(--muted);
  font-size: 20px; line-height: 1; cursor: pointer; padding: 2px 6px;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 16px; }
.modal-body code {
  font-family: ui-monospace, monospace;
  background: var(--panel-2);
  padding: 1px 4px;
  border-radius: 3px;
}
.modal-body textarea { width: 100%; min-height: 260px; resize: vertical; line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

.natice-status-box { margin-top: 12px; font-size: 12.5px; }
.natice-status-box .notice { margin-bottom: 0; }
.natice-status-box .columns-preview { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; }

/* --- Export vers Natice (panneau de détail) --- */

.natice-export-row { display: flex; gap: 6px; align-items: center; }
.natice-export-row select { flex: 1; }
.natice-export-status { margin-top: 8px; font-size: 12px; color: var(--muted); }

/* Statut pipeline (colonne Natice courante d'une société déjà exportée). */
.tag-pipeline-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; }

/* --- Onglets (scripts d'appel / email / LinkedIn) --- */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.tab-btn {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 7px 4px;
  margin-bottom: -1px;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color .15s var(--ease), border-color .15s var(--ease);
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent-2); border-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade-in .15s var(--ease); }

/* --- Script de prise de contact --- */

.script-block { margin-bottom: 12px; }
.script-block:last-child { margin-bottom: 0; }
.script-block h4 {
  margin: 0 0 5px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.script-text {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 11px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.objections { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.objection summary {
  cursor: pointer;
  padding: 7px 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  list-style: none;
}
.objection summary::-webkit-details-marker { display: none; }
.objection summary::before { content: "▸ "; color: var(--accent-2); }
.objection[open] summary::before { content: "▾ "; }
.objection[open] summary { border-radius: var(--radius-sm) var(--radius-sm) 0 0; border-bottom: 0; }
.objection .script-text { border-radius: 0 0 var(--radius-sm) var(--radius-sm); margin: 0; }

.copy-icon-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--muted);
  cursor: pointer;
  font-size: 10.5px;
  padding: 2px 7px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}
.copy-icon-btn:hover { color: var(--accent-2); border-color: var(--accent-2); }

/* --- Bloc de code (script de refonte) --- */

.code-toolbar { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.code-toolbar .hint { margin: 0; flex: 1; }
.code-block {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  max-height: 340px;
  overflow: auto;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.55;
  color: #c9d1d9;
  white-space: pre;
}
.code-block::-webkit-scrollbar-thumb { background: #30363d; }
.asset-thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.asset-thumbs img {
  width: 44px; height: 44px;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--panel-2);
}

.toast {
  position: fixed;
  bottom: 18px; left: 50%;
  transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid var(--accent);
  border-radius: 7px;
  padding: 9px 16px;
  box-shadow: var(--shadow);
  font-size: 13px;
  z-index: 100;
}

/* --- Vue CRM : tableau Natice groupé par colonne --- */

.crm-layout { padding: 14px; height: calc(100vh - 61px); display: flex; flex-direction: column; }

.crm-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
  flex-shrink: 0;
}
.crm-head h2 { margin: 0 0 3px; font-size: 17px; }
.crm-head .hint { margin: 0; }
.crm-controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.crm-controls input[type="search"] { width: 220px; }
.crm-controls .switch { font-size: 12.5px; white-space: nowrap; }

.crm-empty { padding: 60px 20px; text-align: center; color: var(--muted); }

.crm-board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
  padding-bottom: 6px;
  align-items: flex-start;
}

.crm-column {
  flex: 0 0 270px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: 100%;
}
.crm-column-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  border-radius: var(--radius) var(--radius) 0 0;
}
.crm-column-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.crm-column-title { font-weight: 700; font-size: 12.5px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-column-count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

.crm-column-body { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.crm-column-empty { padding: 16px 8px; text-align: center; color: var(--muted); font-size: 12px; }

.crm-task {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color .15s var(--ease), transform .1s var(--ease);
}
.crm-task:hover { border-color: var(--accent); transform: translateX(1px); }
.crm-task.finished { opacity: .55; }
.crm-task-title { font-weight: 600; margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.crm-task-meta { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.crm-score {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  font-size: 9.5px; font-weight: 700; color: #0f1216; flex-shrink: 0;
}
.crm-task-unmatched { font-style: italic; opacity: .8; }
/* Intervenants passés sur la carte, poussés à droite de la ligne de méta. */
.crm-whos { display: inline-flex; margin-left: auto; padding-left: 6px; }
.crm-who {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  margin-left: -5px; /* chevauchement léger : la pile reste courte à 4+ */
  background: var(--panel-3); border: 1px solid var(--panel-2);
  color: var(--text); font-size: 8.5px; font-weight: 700; flex-shrink: 0;
}
.crm-task-actions { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.crm-move { margin: 0; min-width: 0; flex: 1; font-size: 11px; padding: 3px 22px 3px 6px; background-position: right 5px center; background-size: 11px; }
.crm-move:disabled { opacity: .5; }
.crm-delete {
  width: 24px; height: 24px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: transparent; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer;
}
.crm-delete:hover { color: var(--sc-critique); border-color: var(--sc-critique); }
.crm-delete:disabled { opacity: .5; cursor: wait; }
.crm-finish {
  width: 24px; height: 24px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: transparent; color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer;
}
.crm-finish:hover { color: var(--sc-aucun); border-color: var(--sc-aucun); }
.crm-finish.reopen:hover { color: var(--accent); border-color: var(--accent); }
.crm-finish:disabled { opacity: .5; cursor: wait; }

/* --- Génération de site par IA --- */

.sitegen-progress-bar-wrap { margin-top: 10px; }
.sitegen-progress-phase {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11.5px; color: var(--muted); margin-bottom: 5px;
}
.sitegen-progress-track {
  height: 6px; border-radius: 4px; background: var(--panel-2); overflow: hidden;
}
.sitegen-progress-fill {
  height: 100%; width: 0; background: var(--accent);
  transition: width .35s ease; border-radius: 4px;
}
.sitegen-progress-fill.indeterminate {
  width: 30% !important;
  animation: sitegen-indeterminate 1.3s ease-in-out infinite;
}
@keyframes sitegen-indeterminate {
  0% { margin-left: -30%; }
  100% { margin-left: 100%; }
}

.sitegen-progress {
  margin-top: 10px;
  padding: 9px 11px;
  background: #0d1117;
  color: #9fb0c3;
  border-radius: var(--radius-sm);
  font-family: ui-monospace, monospace;
  font-size: 11px;
  line-height: 1.6;
  max-height: 220px;
  overflow-y: auto;
}
.sitegen-history { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.sitegen-run {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12.5px;
}
.sitegen-run.sitegen-success { border-left: 3px solid var(--sc-aucun); }
.sitegen-run.sitegen-error { border-left: 3px solid var(--sc-critique); }
.sitegen-run.sitegen-running { border-left: 3px solid var(--sc-moyen); }
.sitegen-run-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sitegen-shots { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.sitegen-shots img {
  width: 130px; height: 90px;
  object-fit: cover; object-position: top;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel-2);
}
