/* ══════════════════════════════════════════════════════════
   Endrix — Styles
   Design sobre et professionnel
═══════════════════════════════════════════════════════════ */

/* ── Variables ────────────────────────────────────────────────────────────── */
:root {
  --bg:           #f8fafc;
  --surface:      #ffffff;
  --surface-2:    #f1f5f9;
  --border:       #e2e8f0;
  --border-focus: #94a3b8;
  --text:         #0f172a;
  --text-muted:   #64748b;
  --text-faint:   #94a3b8;
  --primary:      #2563eb;
  --primary-bg:   #eff6ff;
  --primary-dim:  #93c5fd;
  --success:      #16a34a;
  --success-bg:   #f0fdf4;
  --error:        #dc2626;
  --error-bg:     #fef2f2;
  --radius:       8px;
  --radius-sm:    5px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:       0 4px 12px rgba(0,0,0,.07);
  --font:         -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono:    'SF Mono', 'Fira Code', 'Cascadia Code', Menlo, monospace;
  --header-h:     52px;
}

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { cursor: pointer; font-family: inherit; }
input, textarea {
  font-family: inherit;
  font-size: inherit;
  color: var(--text);
}

.hidden { display: none !important; }
.view   { height: 100vh; display: flex; flex-direction: column; }

/* ── Logo (partagé) ───────────────────────────────────────────────────────── */
.logo { display: flex; align-items: center; gap: 8px; }
.logo-icon       { font-size: 20px; color: var(--primary); }
.logo-icon.small { font-size: 15px; }
.logo-text       { font-size: 18px; font-weight: 700; letter-spacing: -.4px; }

/* ── Bouton retour (partagé) ──────────────────────────────────────────────── */
.btn-back {
  font-size: 13px;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  transition: all .15s;
  white-space: nowrap;
}
.btn-back:hover { color: var(--text); border-color: var(--border-focus); }


/* ══════════════════════════════════════════════════════════
   VUE ACCUEIL
═══════════════════════════════════════════════════════════ */

.home-view {
  align-items: center;
  justify-content: center;
  background: var(--bg);
  gap: 0;
}

.home-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 52px;
}
.home-brand-icon { font-size: 36px; color: var(--primary); }
.home-brand-name { font-size: 32px; font-weight: 700; letter-spacing: -.7px; }
.home-brand-tagline {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 2px;
}

.home-cards {
  display: flex;
  gap: 16px;
}

.home-card {
  width: 264px;
  padding: 28px 26px 26px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color .15s, box-shadow .15s, transform .12s;
  user-select: none;
}
.home-card:hover {
  border-color: var(--primary-dim);
  box-shadow: 0 6px 24px rgba(37,99,235,.09);
  transform: translateY(-2px);
}
.home-card:active { transform: translateY(0); box-shadow: var(--shadow-sm); }

.home-card-icon {
  font-size: 22px;
  color: var(--primary);
  line-height: 1;
}
.home-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.2px;
}
.home-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}


/* ══════════════════════════════════════════════════════════
   VUE FORMULAIRE — Nouvelle mission
═══════════════════════════════════════════════════════════ */

.form-view { overflow: hidden; }

/* ── Header ───────────────────────────────────────────────────────────────── */
.form-header {
  height: var(--header-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.form-header-sep   { flex: 1; }
.form-header-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }

.btn-demo-header {
  font-size: 13px;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 13px;
  transition: all .15s;
}
.btn-demo-header:hover { color: var(--text); border-color: var(--border-focus); background: var(--surface-2); }

/* ── Split principal ──────────────────────────────────────────────────────── */
.form-split {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

.split-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.split-divider {
  width: 1px;
  background: var(--border);
  flex-shrink: 0;
}

/* ── Label de zone ────────────────────────────────────────────────────────── */
.pane-label {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 12px 20px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.pane-icon { font-size: 14px; }
.pane-hint { font-size: 12px; font-weight: 400; color: var(--text-faint); }

/* ── Textarea brute ───────────────────────────────────────────────────────── */
.raw-input {
  flex: 1;
  width: 100%;
  padding: 18px 22px;
  border: none;
  outline: none;
  resize: none;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  background: var(--surface);
  transition: background .15s;
}
.raw-input::placeholder { color: var(--text-faint); line-height: 1.7; }
.raw-input:focus { background: #fefefe; }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.form-footer {
  height: 60px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  gap: 16px;
}
.footer-left  { display: flex; align-items: center; gap: 10px; }
.footer-right { display: flex; align-items: center; gap: 12px; }

.footer-field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}
.footer-ref-input {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 13px;
  width: 220px;
  background: var(--surface);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.footer-ref-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.footer-ref-input::placeholder { color: var(--text-faint); }

/* ── Bouton lancer ────────────────────────────────────────────────────────── */
.btn-launch {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 24px;
  transition: background .15s, transform .1s;
  box-shadow: 0 2px 8px rgba(37,99,235,.22);
  white-space: nowrap;
}
.btn-launch:hover  { background: #1d4ed8; }
.btn-launch:active { transform: scale(.98); }
.btn-launch:disabled { background: var(--text-faint); cursor: not-allowed; box-shadow: none; }
.btn-icon { font-size: 15px; }

.form-error {
  font-size: 13px;
  color: var(--error);
  padding: 6px 12px;
  background: var(--error-bg);
  border: 1px solid #fca5a5;
  border-radius: var(--radius-sm);
}

@media (max-width: 700px) {
  .form-split    { flex-direction: column; }
  .split-divider { width: 100%; height: 1px; }
  .form-footer   { flex-wrap: wrap; height: auto; padding: 12px 16px; }
  .footer-ref-input { width: 160px; }
}


/* ══════════════════════════════════════════════════════════
   VUE MISSIONS SAUVEGARDÉES
═══════════════════════════════════════════════════════════ */

.missions-view { overflow: hidden; }

.missions-view-header {
  height: var(--header-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.missions-view-sep   { flex: 1; }
.missions-view-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}
.missions-count-badge {
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2px 8px;
  color: var(--text-muted);
  line-height: 1.5;
}
.btn-mes-missions {
  font-size: 12.5px;
  font-weight: 500;
  padding: 4px 13px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, color .15s, background .15s;
}
.btn-mes-missions:hover { border-color: var(--primary); color: var(--primary); }
.btn-mes-missions.active {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.missions-view-body {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  min-height: 0;
}
.missions-view-list-inner {
  max-width: 720px;
  margin: 0 auto;
}

/* ── Carte mission (entièrement cliquable) ────────────────────────────────── */
.mission-card-full {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  user-select: none;
}
.mission-card-full:last-child { margin-bottom: 0; }
.mission-card-full:hover {
  border-color: var(--primary-dim);
  box-shadow: var(--shadow-sm);
}
.mission-card-full:active { border-color: var(--primary); }

.mission-card-full .mission-card-info { flex: 1; min-width: 0; }
.mission-card-full .mission-card-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mission-card-full .mission-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}
.mission-card-team {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
  flex-wrap: wrap;
}
.mission-card-resp-star { font-size: 11px; }
.mission-card-resp      { font-size: 12px; font-weight: 500; color: var(--text); }
.mission-card-members   { font-size: 11.5px; color: var(--text-muted); }

/* ── Bouton supprimer sur la carte ────────────────────────────────────────── */
.btn-delete-card {
  flex-shrink: 0;
  font-size: 14px;
  padding: 6px 10px;
  color: var(--text-faint);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  transition: all .15s;
}
.btn-delete-card:hover {
  color: var(--error);
  border-color: #fca5a5;
  background: var(--error-bg);
}
.btn-delete-card.armed {
  color: var(--error);
  border-color: #fca5a5;
  background: var(--error-bg);
  font-size: 12px;
  padding: 6px 10px;
}

/* ── État vide ────────────────────────────────────────────────────────────── */
.missions-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 0;
  gap: 12px;
  color: var(--text-faint);
}
.missions-empty-icon { font-size: 36px; opacity: .4; }
.missions-empty p { font-size: 14px; }
.missions-empty .btn-tool { margin-top: 4px; }


/* ══════════════════════════════════════════════════════════
   VUE DASHBOARD
═══════════════════════════════════════════════════════════ */

#view-dashboard { overflow: hidden; }

/* ── Header ───────────────────────────────────────────────────────────────── */
.dash-header {
  min-height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 0 20px;
  gap: 6px 16px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  z-index: 10;
}
.dash-header-left { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }

/* ── Section Équipe (header dashboard) ────────────────────────────────────── */
.dash-team {
  position: relative;
  flex-shrink: 0;
}
.team-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.team-pill:hover { background: var(--primary-bg); border-color: var(--primary-dim); }
.team-others-badge {
  font-size: 11px;
  background: var(--primary-bg);
  color: var(--primary);
  border-radius: 10px;
  padding: 1px 6px;
  font-weight: 600;
}
.team-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 230px;
  z-index: 150;
  padding: 6px 0 8px;
}
.team-dropdown-title {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 2px 14px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.team-member-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 13px;
  transition: background .1s;
}
.team-member-row:hover { background: var(--surface-2); }
.team-member-star {
  font-size: 13px;
  cursor: pointer;
  opacity: 0.3;
  transition: opacity .15s;
  flex-shrink: 0;
  line-height: 1;
}
.team-member-star.active  { opacity: 1; cursor: default; }
.team-member-star:not(.active):hover { opacity: 0.65; }
.team-member-name { font-weight: 500; flex: 1; min-width: 0; }
.team-member-tri  { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); flex-shrink: 0; }
.btn-team-remove {
  background: none; border: none;
  color: var(--text-faint); font-size: 12px; cursor: pointer;
  padding: 2px 4px; border-radius: 4px; flex-shrink: 0; line-height: 1;
}
.btn-team-remove:hover { color: var(--error); background: var(--error-bg); }
.btn-team-remove-ph { width: 20px; flex-shrink: 0; display: inline-block; }
.team-empty { padding: 6px 14px; font-size: 13px; color: var(--text-muted); font-style: italic; }
.team-add-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px 2px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.team-add-select {
  flex: 1;
  font-size: 12.5px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
  color: var(--text);
  outline: none;
}
.btn-team-add {
  font-size: 12px;
  padding: 4px 10px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  flex-shrink: 0;
}
.btn-team-add:hover { opacity: .85; }

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

/* ── Champs éditables inline (titre + référence) ──────────────────────────── */
.dash-editable {
  background: transparent;
  border: 1px solid transparent;
  outline: none;
  font-family: inherit;
  color: var(--text);
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.dash-editable:hover {
  background: var(--surface-2);
  border-color: var(--border);
  cursor: text;
}
.dash-editable:focus {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.08);
  cursor: auto;
}
.dash-title-input {
  font-size: 14px;
  font-weight: 600;
  width: 240px;
  max-width: 32vw;
}
.dash-ref-input {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
  width: 130px;
}
.dash-meta-sep {
  color: var(--text-faint);
  font-size: 13px;
  user-select: none;
  flex-shrink: 0;
}

/* ── Barre de progression ─────────────────────────────────────────────────── */
.dash-progress { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.agent-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 9px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  transition: all .2s;
  white-space: nowrap;
}
.agent-indicator.streaming { border-color: var(--primary-dim); background: var(--primary-bg); color: var(--primary); }
.agent-indicator.done      { border-color: #bbf7d0; background: var(--success-bg); color: var(--success); }
.agent-indicator.error     { border-color: #fca5a5; background: var(--error-bg); color: var(--error); }

.agent-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
}
.agent-indicator.streaming .agent-dot { background: var(--primary); animation: pulse-dot 1.2s ease-in-out infinite; }
.agent-indicator.done  .agent-dot { background: var(--success); }
.agent-indicator.error .agent-dot { background: var(--error); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .5; transform: scale(.7); }
}

/* ── Pastilles de statut éditorial (groupes uniquement) ──────────────────── */
.group-edit-dot {
  border-radius: 50%;
  flex-shrink: 0;
  width: 7px; height: 7px; margin-left: 5px;
  transition: background .2s;
}
.status-none      { display: none; }
.status-generated { background: #f97316; }
.status-edited    { background: var(--success); }

/* ── Mode compact des indicateurs (basculé par ResizeObserver) ───────────── */
.dash-progress.compact .ind-label  { display: none; }
.dash-progress.compact .agent-indicator { gap: 4px; }

/* ── Corps dashboard ──────────────────────────────────────────────────────── */
.dash-body { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }

/* ── Tab bar — niveau 1 (groupes) ─────────────────────────────────────────── */
.tab-bar-groups {
  display: flex;
  align-items: flex-end;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tab-group-btn {
  display: flex;
  align-items: center;
  padding: 13px 18px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
  cursor: pointer;
}
.tab-group-btn:hover:not(.active) { color: var(--text); }
.tab-group-btn.active { color: var(--text); border-bottom-color: var(--text); }

/* ── Tab bar — niveau 2 (sous-onglets) ────────────────────────────────────── */
.tab-bar-sub {
  display: flex;
  align-items: flex-end;
  padding: 0 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
}
.tab-bar-sub::-webkit-scrollbar { height: 0; }

.tab-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover:not(.active) { color: var(--text); background: var(--surface); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-status { width: 7px; height: 7px; border-radius: 50%; background: var(--border); flex-shrink: 0; transition: background .2s; }
.tab-status.generated { background: #f97316; }
.tab-status.edited    { background: var(--success); }
.tab-btn.streaming .tab-status { background: var(--primary); animation: pulse-dot 1.2s ease-in-out infinite; }
.tab-btn.error     .tab-status { background: var(--error); }

/* ── Panneaux ─────────────────────────────────────────────────────────────── */
.tab-content { flex: 1; overflow: hidden; position: relative; min-height: 0; }
.tab-pane { display: none; height: 100%; overflow: hidden; }
.tab-pane.active { display: flex; flex-direction: column; }

.pane-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.btn-tool {
  font-size: 12.5px;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  transition: all .15s;
}
.btn-tool:hover { color: var(--text); border-color: var(--border-focus); }
.btn-tool.copied { color: var(--success); border-color: #bbf7d0; background: var(--success-bg); }
.btn-tool:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-tool-word { color: #1d6f42; border-color: #a7d7b0; background: #f0faf3; }
.btn-tool-word:hover:not(:disabled) { color: #155734; border-color: #1d6f42; background: #d6f0de; }

/* ── Bouton Valider / Modifier ───────────────────────────────────────────── */
.btn-validate {
  margin-left: auto;
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  background: var(--success);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 5px 14px;
  cursor: pointer;
  transition: background .15s;
}
.btn-validate:hover:not(:disabled) { background: #15803d; }
.btn-validate:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-validate-done {
  margin-left: auto;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 14px;
  cursor: pointer;
  transition: all .15s;
}
.btn-validate-done:hover { color: var(--text); border-color: var(--border-focus); }

.agent-edit-layout.edit-hidden .agent-edit-col { display: none; }
.agent-edit-layout.edit-hidden .agent-output-col { flex: 1; border-right: none; }

/* ── Panneau Informations de mission (onglet Contexte) ────────────────────── */
.mission-info-panel {
  display: flex;
  gap: 12px;
  padding: 12px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.info-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.info-field label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.info-field input {
  height: 30px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13px;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.info-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.08);
}
.info-field input::placeholder { color: var(--text-faint); }

.pane-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  scroll-behavior: smooth;
}

/* ── Markdown ─────────────────────────────────────────────────────────────── */
.md-body { max-width: 740px; }
.md-body h1 { font-size: 1.45em; font-weight: 700; margin: 0 0 16px; }
.md-body h2 { font-size: 1.15em; font-weight: 700; margin: 28px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.md-body h3 { font-size: 1.02em; font-weight: 600; margin: 18px 0 7px; }
.md-body h4 { font-size: .93em; font-weight: 600; margin: 14px 0 5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; }
.md-body p  { margin: 0 0 11px; }
.md-body ul, .md-body ol { margin: 0 0 11px 20px; }
.md-body li { margin-bottom: 3px; }
.md-body strong { font-weight: 600; }
.md-body em { color: var(--text-muted); }
.md-body code {
  font-family: var(--font-mono);
  font-size: .87em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}
.md-body pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 13px;
}
.md-body pre code { background: none; border: none; padding: 0; font-size: .84em; }
.md-body blockquote {
  border-left: 3px solid var(--primary);
  padding: 2px 0 2px 16px;
  margin: 0 0 11px;
  color: var(--text-muted);
}
.md-body hr { border: none; border-top: 1px solid var(--border); margin: 22px 0; }
.md-body table { width: 100%; border-collapse: collapse; margin-bottom: 13px; font-size: 13.5px; }
.md-body th { text-align: left; padding: 7px 11px; background: var(--surface-2); border: 1px solid var(--border); font-weight: 600; }
.md-body td { padding: 7px 11px; border: 1px solid var(--border); }
.md-body tr:hover td { background: var(--surface-2); }

.streaming-cursor::after {
  content: '▋';
  color: var(--primary);
  animation: blink .9s step-end infinite;
  margin-left: 1px;
}
@keyframes blink { 50% { opacity: 0; } }

.pane-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-faint);
  gap: 10px;
}
.pane-placeholder .icon { font-size: 30px; opacity: .45; }
.pane-placeholder p { font-size: 14px; }

.pane-generate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  gap: 14px;
}

.pane-generate-error {
  font-size: 13px;
  color: var(--error);
  margin: 0;
}

.btn-generate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 44px;
  background: transparent;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-faint);
  font-family: inherit;
  transition: border-color .15s, color .15s, background .15s;
}
.btn-generate:hover {
  border-color: var(--primary-dim);
  color: var(--primary);
  background: rgba(37, 99, 235, .04);
}
.btn-generate-icon { font-size: 28px; line-height: 1; }
.btn-generate-label { font-size: 14px; font-weight: 500; }


/* ══════════════════════════════════════════════════════════
   ONGLETS AGENT — output (70 %) + chat édition (30 %)
═══════════════════════════════════════════════════════════ */

.agent-edit-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

.agent-output-col {
  flex: 0 0 70%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border);
}

.agent-output-col .pane-scroll {
  flex: 1;
  min-height: 0;
}

.agent-edit-col {
  flex: 0 0 30%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
}

.edit-chat-header {
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.agent-edit-col .chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.agent-edit-col .chat-input-area { flex-shrink: 0; }

.edit-apply-msg { font-size: 12px; color: var(--success); font-weight: 500; }
.edit-error-msg { font-size: 12px; color: var(--error); }


/* ══════════════════════════════════════════════════════════
   ONGLET SOURCING — guide + chat
═══════════════════════════════════════════════════════════ */

.sourcing-layout { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }

.sourcing-guide {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  border-bottom: 1px solid var(--border);
  min-height: 0;
}

/* ── Chat ─────────────────────────────────────────────────────────────────── */
.chat-panel { flex-shrink: 0; display: flex; flex-direction: column; background: var(--surface); height: 310px; }

.chat-header {
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.chat-msg { display: flex; gap: 10px; max-width: 92%; align-items: flex-start; }
.chat-msg.user      { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg.assistant { align-self: flex-start; }
.chat-avatar {
  width: 27px; height: 27px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}
.chat-msg.user .chat-avatar      { background: var(--primary); color: #fff; }
.chat-msg.assistant .chat-avatar { background: var(--surface-2); border: 1px solid var(--border); }
.chat-bubble {
  padding: 9px 13px;
  border-radius: var(--radius);
  font-size: 13.5px;
  line-height: 1.55;
}
.chat-msg.user .chat-bubble {
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius) var(--radius) 4px var(--radius);
}
.chat-msg.assistant .chat-bubble {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) var(--radius) 4px;
}
.chat-msg.assistant .chat-bubble .md-body { font-size: 13.5px; }
.chat-msg.assistant .chat-bubble .md-body p:last-child { margin-bottom: 0; }
.chat-msg.assistant .chat-bubble .md-body h2,
.chat-msg.assistant .chat-bubble .md-body h3 { border: none; margin: 10px 0 5px; }

.chat-input-area {
  padding: 10px 16px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-shrink: 0;
}
.chat-input-area textarea {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13.5px;
  line-height: 1.5;
  resize: none;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  max-height: 110px;
  background: var(--surface);
}
.chat-input-area textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.btn-send {
  padding: 8px 18px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  transition: background .15s;
  white-space: nowrap;
}
.btn-send:hover    { background: #1d4ed8; }
.btn-send:disabled { background: var(--text-faint); cursor: not-allowed; }


/* ── Fatal error ──────────────────────────────────────────────────────────── */
.fatal-error-banner {
  margin: 24px 32px;
  padding: 14px 18px;
  background: var(--error-bg);
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  color: var(--error);
  font-size: 14px;
}
.fatal-error-banner strong { display: block; margin-bottom: 4px; }

/* ── Toast ────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: var(--text);
  color: #fff;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  z-index: 100;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateY(0); }


/* ── Bouton Jarvis ────────────────────────────────────────────────────────── */
.btn-tool-jarvis {
  background: #4f46e5;
  color: #fff;
  border-color: #4f46e5;
}
.btn-tool-jarvis:hover:not(:disabled) { background: #4338ca; border-color: #4338ca; }
.btn-tool-jarvis:disabled             { opacity: .4; cursor: not-allowed; }
.btn-jarvis-done {
  background: var(--success);
  border-color: var(--success);
}
.btn-jarvis-done:hover:not(:disabled) { background: #15803d; border-color: #15803d; }


/* ── Modale Jarvis ────────────────────────────────────────────────────────── */
.jarvis-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.jarvis-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 460px;
  max-width: calc(100vw - 32px);
}
.jarvis-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14.5px;
}
.jarvis-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  line-height: 1;
  padding: 0 4px;
}
.jarvis-modal-close:hover { color: var(--text); }
.jarvis-modal-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.jarvis-modal-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.jarvis-modal-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.jarvis-modal-input:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.jarvis-modal-check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  cursor: pointer;
  user-select: none;
}
.jarvis-modal-existing {
  background: var(--primary-bg);
  border: 1px solid var(--primary-dim);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.jarvis-existing-badge { font-weight: 600; color: var(--primary); }
.jarvis-existing-hint  { color: var(--text-muted); font-size: 12px; }
.jarvis-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}
.btn-jarvis-submit {
  padding: 8px 18px;
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  transition: background .15s;
}
.btn-jarvis-submit:hover:not(:disabled) { background: #4338ca; }
.btn-jarvis-submit:disabled { opacity: .5; cursor: not-allowed; }
.jarvis-modal-result {
  margin: 0 18px 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  line-height: 1.5;
}
.jarvis-modal-result.success {
  background: var(--success-bg);
  border: 1px solid #86efac;
  color: #166534;
}
.jarvis-modal-result.error {
  background: var(--error-bg);
  border: 1px solid #fca5a5;
  color: var(--error);
}
.jarvis-result-link {
  color: #166534;
  font-weight: 600;
  text-decoration: underline;
}
.jarvis-modal-result.warn {
  background: #fefce8;
  border: 1px solid #fde047;
  color: #713f12;
}
.jarvis-duplicate-warn {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.jarvis-duplicate-actions {
  display: flex;
  gap: 8px;
}
.btn-jarvis-rename {
  padding: 5px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
}
.btn-jarvis-rename:hover { background: var(--border); }
.btn-jarvis-force {
  padding: 5px 12px;
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn-jarvis-force:hover { background: #4338ca; }

/* ── Historique Jarvis (sous la toolbar) ──────────────────────────────────── */
.jarvis-history-panel {
  padding: 0 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.jarvis-history-header {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 6px 0 4px;
}
.jarvis-history-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.jarvis-history-item:last-of-type { border-bottom: none; }
.jarvis-history-item-row {
  display: contents;
}
.jarvis-history-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.jarvis-history-date {
  color: var(--text-muted);
  white-space: nowrap;
  font-size: 12px;
}
.jarvis-history-link {
  color: #4f46e5;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.jarvis-history-link:hover { text-decoration: underline; }
.jarvis-history-more {
  margin-top: 4px;
  background: none;
  border: none;
  color: var(--primary);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  text-align: left;
}
.jarvis-history-more:hover { text-decoration: underline; }
.jarvis-history-reopen {
  padding: 2px 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.jarvis-history-reopen:hover { background: var(--border); }
.jarvis-del-btn {
  padding: 2px 6px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.jarvis-del-btn:hover { background: var(--surface-2); color: var(--error); border-color: var(--error); }
.jarvis-del-btn.armed { background: var(--error); color: #fff; border-color: var(--error); font-size: 10.5px; }

/* ══════════════════════════════════════════════════════════
   Modale pré-lancement
═══════════════════════════════════════════════════════════ */
.launch-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.launch-modal-overlay.hidden { display: none; }

.launch-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 420px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
}

.launch-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.launch-modal-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}
.launch-modal-close {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  line-height: 1;
}
.launch-modal-close:hover { background: var(--surface-2); color: var(--text); }

.launch-modal-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.launch-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.launch-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.launch-emoji-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.launch-emoji-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
}
.launch-emoji-btn {
  font-size: 18px;
  padding: 4px 6px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  line-height: 1.2;
}
.launch-emoji-btn:hover { background: var(--border); }
.launch-emoji-btn.selected { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); }

.launch-emoji-input {
  width: 72px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
  text-align: center;
  flex-shrink: 0;
}
.launch-emoji-input:focus { outline: none; border-color: var(--primary); }

.launch-input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
.launch-input:focus { outline: none; border-color: var(--primary); }
.launch-input::placeholder { color: var(--text-muted); }

.launch-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
}

.btn-launch-skip {
  padding: 7px 14px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.btn-launch-skip:hover { background: var(--surface-2); color: var(--text); }

.btn-launch-confirm {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
}
.btn-launch-confirm:hover { opacity: 0.88; }

/* ══════════════════════════════════════════════════════════
   Séparateur de sous-onglets
═══════════════════════════════════════════════════════════ */
.tab-sub-sep {
  width: 1px;
  background: var(--border);
  margin: 4px 6px;
  align-self: stretch;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════
   Suivi de mission — styles communs
═══════════════════════════════════════════════════════════ */
.tracking-empty {
  color: var(--text-muted);
  font-size: 13px;
  padding: 16px 0;
  font-style: italic;
  text-align: center;
}
.tracking-del {
  flex-shrink: 0;
  padding: 2px 7px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  line-height: 1.4;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.tracking-del:hover { background: var(--surface-2); color: var(--error); border-color: var(--error); }
.tracking-del.armed { background: color-mix(in srgb, var(--error) 10%, transparent); color: var(--error); border-color: var(--error); }
.btn-add-item {
  padding: 6px 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
  white-space: nowrap;
}
.btn-add-item:hover { opacity: 0.88; }
.tab-all-done .tab-label { display: none; }

/* ══════════════════════════════════════════════════════════
   To-do de lancement
═══════════════════════════════════════════════════════════ */
.todo-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 16px;
}
.todo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
  font-size: 14px;
}
.todo-item:hover { background: var(--surface-2); }
.todo-item.todo-locked { cursor: default; opacity: 0.75; }
.todo-item.todo-locked:hover { background: transparent; }
.todo-icon { font-size: 15px; flex-shrink: 0; width: 20px; text-align: center; }
.todo-label { flex: 1; color: var(--text); }
.todo-done .todo-label { text-decoration: line-through; color: var(--text-muted); }
.todo-auto-badge {
  display: inline-block;
  margin-left: 6px;
  font-size: 10px;
  padding: 1px 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  vertical-align: middle;
}

/* ══════════════════════════════════════════════════════════
   Gestionnaire de tâches
═══════════════════════════════════════════════════════════ */
.tasks-panel { padding: 12px 16px; display: flex; flex-direction: column; }
.tasks-center { max-width: 700px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; gap: 0; }
.tasks-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-bottom: 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.tasks-add-input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}
.tasks-add-input:focus { outline: none; border-color: var(--primary); }
.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  transition: background 0.1s;
}
.task-item:last-child { border-bottom: none; }
.task-text { flex: 1; color: var(--text); }
.task-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.task-badge-wrap { position: relative; flex-shrink: 0; }
.task-badge {
  display: block;
  width: 13px;
  height: 13px;
  border-radius: 3px;
  border: 1px solid #D1D5DB;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.1s, transform 0.1s;
}
.task-badge:hover { opacity: 0.75; transform: scale(1.15); }
.task-badge-todo        { background: #D1D5DB; }
.task-badge-next        { background: #BFDBFE; }
.task-badge-in_progress { background: #FEF08A; }
.task-badge-done        { background: #86EFAC; }
.task-item.task-row-todo        { background: transparent; }
.task-item.task-row-next        { background: #BFDBFE; }
.task-item.task-row-in_progress { background: #FEF08A; }
.task-item.task-row-done        { background: transparent; }
.task-status-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 100;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: row;
  gap: 5px;
  padding: 6px;
}
.task-swatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s;
}
.task-swatch:hover { transform: scale(1.2); }
.task-swatch-todo        { background: #D1D5DB; }
.task-swatch-next        { background: #BFDBFE; }
.task-swatch-in_progress { background: #FEF08A; }
.task-swatch-done        { background: #86EFAC; }
.tasks-done-sep {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 6px;
  color: var(--text-muted);
  font-size: 11.5px;
}
.tasks-done-sep::before, .tasks-done-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.btn-task-journal {
  flex-shrink: 0;
  padding: 3px 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 11.5px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: color 0.1s, border-color 0.1s;
}
.btn-task-journal:hover, .btn-task-journal.open { color: var(--primary); border-color: var(--primary); }
.task-journal-form {
  margin: 0 10px 6px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.task-journal-select,
.task-journal-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  box-sizing: border-box;
}
.task-journal-select:focus, .task-journal-input:focus { outline: none; border-color: var(--primary); }
.task-journal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.btn-task-journal-add {
  padding: 5px 12px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.btn-task-journal-add:hover { opacity: 0.88; }
.btn-task-journal-cancel {
  padding: 5px 12px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.btn-task-journal-cancel:hover { background: var(--surface); color: var(--text); }

/* ══════════════════════════════════════════════════════════
   Journal stratégie
═══════════════════════════════════════════════════════════ */
.journal-panel { padding: 12px 16px; display: flex; flex-direction: column; gap: 24px; }
.journal-section { display: flex; flex-direction: column; gap: 10px; }
.journal-section-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}
.journal-entries { display: flex; flex-direction: column; gap: 6px; }
.journal-entry {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.journal-entry-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.journal-meta { color: var(--text-muted); font-size: 11.5px; }
.journal-text { color: var(--text); font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.inline-edit-trigger { cursor: text; border-radius: 3px; padding: 2px 4px; white-space: pre-wrap; word-break: break-word; }
.inline-edit-trigger:hover { background: rgba(0,0,0,0.04); }
.inline-edit-ta {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 2px 4px;
  border: 1px solid var(--primary-dim);
  border-radius: 3px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  resize: none;
  outline: none;
  overflow: hidden;
  line-height: 1.5;
}
.journal-add-row { display: flex; gap: 8px; align-items: flex-start; margin-top: 2px; }
.journal-add-input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 36px;
}
.journal-add-input:focus { outline: none; border-color: var(--primary); }

/* ══════════════════════════════════════════════════════════
   Questions client
═══════════════════════════════════════════════════════════ */
.questions-panel { padding: 12px 16px; display: flex; flex-direction: column; }
.questions-center { max-width: 700px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; gap: 0; }
.questions-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-bottom: 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.questions-add-input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}
.questions-add-input:focus { outline: none; border-color: var(--primary); }
.question-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
}
.question-item:last-child { border-bottom: none; }
.question-header { display: flex; align-items: flex-start; gap: 8px; }
.question-text { flex: 1; font-size: 14px; color: var(--text); font-weight: 500; line-height: 1.4; }
.question-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.question-status {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11.5px;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.1s;
}
.q-status-0 { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }
.q-status-1 { background: color-mix(in srgb, #f59e0b 15%, transparent); color: #92400e; border-color: #f59e0b; }
.q-status-2 { background: color-mix(in srgb, var(--success) 15%, transparent); color: #166534; border-color: var(--success); }
.question-fields { display: flex; flex-direction: column; gap: 6px; }
.question-field-row { display: flex; gap: 8px; align-items: flex-start; }
.question-field-label {
  font-size: 11.5px;
  color: var(--text-muted);
  width: 54px;
  flex-shrink: 0;
  padding-top: 7px;
  font-weight: 500;
}
.question-textarea {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 50px;
  box-sizing: border-box;
}
.question-textarea:focus { outline: none; border-color: var(--primary); }
.question-impact { border-style: dashed; }
.question-impact::placeholder { font-style: italic; }

/* ══════════════════════════════════════════════════════════
   Notes & doutes
═══════════════════════════════════════════════════════════ */
.notes-mission-panel { padding: 12px 16px; display: flex; flex-direction: column; }
.notes-mission-center { max-width: 700px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; gap: 0; }
.notes-mission-add {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding-bottom: 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.notes-mission-input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 48px;
}
.notes-mission-input:focus { outline: none; border-color: var(--primary); }
.note-mission-entry {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.note-mission-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.note-mission-date { color: var(--text-muted); font-size: 11.5px; }
.note-mission-text { color: var(--text); font-size: 13px; white-space: pre-wrap; word-break: break-word; }


/* ══════════════════════════════════════════════════════════
   VUE VEILLE OFFRES
═══════════════════════════════════════════════════════════ */

.veille-view { display: flex; flex-direction: column; height: 100vh; background: var(--bg); }

.veille-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.veille-header-sep   { flex: 1; }
.veille-header-title { font-size: 14px; font-weight: 600; color: var(--text); }
.btn-veille-run {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 16px;
  cursor: pointer;
  transition: background .15s;
}
.btn-veille-run:hover:not(:disabled) { background: var(--primary-hover, #1d4ed8); }
.btn-veille-run:disabled { opacity: .5; cursor: not-allowed; }

.veille-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar clients */
.veille-sidebar {
  width: 280px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.veille-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.veille-section-title { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.btn-veille-add {
  font-size: 12px;
  color: var(--primary);
  background: none;
  border: 1px solid var(--primary-dim);
  border-radius: var(--radius-sm);
  padding: 3px 9px;
  cursor: pointer;
}
.btn-veille-add:hover { background: var(--primary-bg, #eff6ff); }

.veille-client-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.veille-client-top { display: flex; align-items: center; gap: 6px; }
.veille-toggle-cb { flex-shrink: 0; accent-color: var(--primary); cursor: pointer; }
.veille-client-filter-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  padding: 2px 5px;
  border-radius: 5px;
  overflow: hidden;
}
.veille-client-filter-btn:hover { background: var(--surface-2); }
.veille-client-filter-btn.active { background: var(--primary-bg, #eff6ff); }
.veille-client-filter-btn.active .veille-client-nom { color: var(--primary); }
.veille-client-favicon { flex-shrink: 0; border-radius: 2px; vertical-align: middle; }
.veille-client-favicon-fallback { flex-shrink: 0; font-size: 13px; line-height: 1; }
.veille-client-nom { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.veille-client-count {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}
.veille-count-new {
  color: #1d4ed8;
  background: #dbeafe;
  border: 1px solid #93c5fd;
  border-radius: 99px;
  padding: 1px 6px;
}
.veille-count-total {
  color: var(--text-muted);
  font-weight: 500;
}
.veille-client-del {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  border-radius: 4px;
}
.veille-client-del:hover { background: #fee2e2; color: var(--error); }
.veille-client-urls { display: flex; flex-direction: column; gap: 3px; }

/* Labels colorés (Page carrières / APEC / HelloWork) */
.veille-url-labels-row { display: flex; gap: 4px; flex-wrap: wrap; }
.veille-url-label {
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 99px;
  border: 1px solid;
  cursor: pointer;
  letter-spacing: .15px;
  line-height: 1.7;
  transition: opacity .1s;
}
.veille-url-label.status-empty   { color: var(--text-muted); background: var(--surface-2); border-color: var(--border); }
.veille-url-label.status-empty:hover { border-color: var(--text-muted); }
.veille-url-label.status-valid   { color: #15803d; background: #dcfce7; border-color: #86efac; }
.veille-url-label.status-valid:hover { background: #bbf7d0; }
.veille-url-label.status-invalid { color: var(--error, #dc2626); background: #fee2e2; border-color: #fca5a5; }
.veille-url-label.status-invalid:hover { background: #fecaca; }
.veille-url-label.editing { outline: 2px solid var(--primary); outline-offset: 1px; }

/* Edit inline */
.veille-url-edit-row {
  display: flex;
  gap: 4px;
  align-items: center;
}
.veille-url-edit-input {
  flex: 1;
  font-size: 11px;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  min-width: 0;
  outline: none;
  transition: border-color .15s;
}
.veille-url-edit-input:focus { border-color: var(--border-focus); }
.veille-url-edit-input::placeholder { color: var(--text-muted); font-size: 10.5px; }
.veille-url-edit-confirm,
.veille-url-edit-cancel {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-size: 11px;
}
.veille-url-edit-confirm { background: #dcfce7; color: #15803d; }
.veille-url-edit-confirm:hover { background: #bbf7d0; }
.veille-url-edit-cancel  { background: var(--surface-2); color: var(--text-muted); }
.veille-url-edit-cancel:hover  { background: var(--border); }

.veille-client-unsupported-msg {
  font-size: 11px;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: var(--radius-sm);
  padding: 3px 8px;
}
.client-unsupported .veille-client-nom { color: var(--text-muted); }

/* Colonne principale offres */
.veille-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
.veille-scanning-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 10;
}
.veille-scanning-overlay.hidden { display: none; }
.veille-scanning-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: veilleSpinAnim 0.75s linear infinite;
}
@keyframes veilleSpinAnim {
  to { transform: rotate(360deg); }
}
.veille-scanning-text {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
.veille-main-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.veille-count-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 1px 9px;
}
.veille-count-badge.has-new { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
.btn-veille-tout-vu {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 11.5px;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  cursor: pointer;
}
.btn-veille-tout-vu:hover { border-color: var(--border-focus); color: var(--text); }

.veille-status-bar {
  padding: 8px 24px;
  font-size: 12.5px;
  color: var(--text-muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.veille-status-bar.hidden { display: none; }

.veille-offres-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 0 16px;
  display: flex;
  flex-direction: column;
}

.veille-offre-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  transition: border-color .15s;
}
.veille-offre-item.nouvelle { border-color: #93c5fd; background: #f0f7ff; }
.veille-offre-item.vu { opacity: .65; }
.veille-offre-item.vu:hover { opacity: 1; }

.veille-offre-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.veille-offre-header { display: flex; align-items: center; gap: 8px; }
.veille-offre-badge {
  font-size: 11px;
  font-weight: 600;
  border-radius: 99px;
  padding: 1px 8px;
}
.badge-new { background: #dbeafe; color: #1d4ed8; }
.badge-vu  { background: var(--surface-2); color: var(--text-muted); }
.veille-source-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .3px;
  border-radius: 4px;
  padding: 1px 5px;
  text-transform: uppercase;
  flex-shrink: 0;
}
.source-apec      { background: #e8eaf6; color: #3730a3; }
.source-hellowork { background: #ecfdf5; color: #065f46; }
.source-indeed    { background: #fff7ed; color: #92400e; }

.veille-offre-client { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.veille-offre-date   { font-size: 11.5px; color: var(--text-muted); margin-left: auto; }
.veille-offre-titre  {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.veille-offre-titre:hover { color: var(--primary); text-decoration: underline; }

.btn-veille-vu {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-veille-vu:hover { color: var(--success); border-color: #bbf7d0; background: var(--success-bg); }

.btn-veille-non-vu {
  flex-shrink: 0;
  font-size: 11.5px;
  color: var(--text-muted);
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .15s;
}
.veille-offre-item:hover .btn-veille-non-vu { opacity: 1; }
.btn-veille-non-vu:hover { border-color: var(--border); color: var(--text); background: var(--surface-2); }

.veille-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
}

/* Sections nouvelles / déjà vues */
.veille-offres-section { display: flex; flex-direction: column; }
.veille-offres-section:not(:last-child) { margin-bottom: 4px; }

.veille-offres-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px 6px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
  flex-shrink: 0;
}
.veille-offres-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
}
.veille-section-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 0px 7px;
  line-height: 18px;
}
.veille-section-count.muted { color: var(--text-muted); }

.veille-section-chevron { font-size: 11px; color: var(--text-muted); line-height: 1; flex-shrink: 0; }

.veille-section-vues-header {
  cursor: pointer;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.veille-section-vues-header:hover { background: var(--surface-2); }

.veille-vues-content { display: flex; flex-direction: column; }

/* Items dans les sections — margin horizontal au lieu du padding de la liste */
.veille-offres-section .veille-offre-item { margin: 0 24px 8px; }

.veille-empty-section {
  padding: 10px 24px 14px;
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
}

/* ── Badge utilisateur (pied de page accueil) ───────────────────────────── */
.user-badge {
  margin-top: 32px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.user-badge-name {
  font-weight: 600;
  color: var(--text);
}
.user-badge-sep {
  color: var(--border-focus);
}
.btn-logout {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12.5px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color .15s;
}
.btn-logout:hover { color: var(--error); }
