/* ============================================================
   Smart4 KB Hub — Styles spécifiques de l'application
   Basés sur les tokens et composants du Smart4 Theme
   ============================================================ */

/* --- Login screen --- */
#loginScreen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}
.login-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 4px 24px rgba(0,0,0,.2);
}
.login-title {
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text);
}
.login-form .form-group {
  margin-bottom: 16px;
}
.login-form label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-secondary);
}
.login-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  box-sizing: border-box;
}
.login-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}
.login-error {
  background: var(--danger-light, rgba(239,68,68,.1));
  color: var(--danger, #ef4444);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
}
.login-btn {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
/* Séparateur "ou" entre Google SSO et login classique */
.login-separator {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--text-secondary);
  font-size: 13px;
}
.login-separator::before,
.login-separator::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border);
}
/* Centrer le bouton Google */
#googleLoginBtn {
  display: flex;
  justify-content: center;
}

/* --- Feedback chat --- */
.chat-fb-btn { opacity: 0.5; transition: opacity 0.2s; }
.chat-fb-btn:hover { opacity: 1; }
.chat-fb-btn.active { opacity: 1; }
.chat-feedback-form {
  margin-top: 8px;
  padding: 12px;
  background: var(--bg-card-alt);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.chat-feedback-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.feedback-cat {
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.feedback-cat:hover { border-color: var(--accent); color: var(--accent); }
.feedback-cat.selected { background: var(--accent); color: white; border-color: var(--accent); }
.feedback-text {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  resize: vertical;
  margin-bottom: 8px;
  box-sizing: border-box;
}
.feedback-submit { font-size: 12px; }
.chat-feedback-info {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}
.chat-feedback-info a { color: var(--accent); }
.chat-ticket-btn { margin-top: 8px; }
.chat-ticket-form {
  margin-top: 8px;
  padding: 12px;
  background: var(--bg-card-alt);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.chat-ticket-form textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  resize: vertical;
  margin-bottom: 8px;
  box-sizing: border-box;
}
.chat-ticket-info {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}
.chat-ticket-info a { color: var(--accent); }

/* --- Insights dashboard --- */
.insights-period { display: flex; gap: 4px; }
.insights-period .btn { padding: 4px 10px; font-size: 12px; }
.insights-card {
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg-card-alt);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.insights-card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.insight-stat {
  text-align: center;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius);
}
.insight-value { display: block; font-size: 20px; font-weight: 700; color: var(--text); }
.insight-label { display: block; font-size: 11px; color: var(--text-secondary); margin-top: 4px; }
.insights-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.insights-table th, .insights-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
.insights-table th { font-weight: 600; color: var(--text-secondary); font-size: 11px; text-transform: uppercase; }

/* --- Form rows (user management) --- */
.form-row { display: flex; gap: 16px; margin-bottom: 12px; }
.form-row .form-group { flex: 1; }
.form-row input, .form-row select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  box-sizing: border-box;
}
.form-row input:focus, .form-row select:focus {
  outline: none;
  border-color: var(--accent);
}
.form-row label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text-secondary);
}

/* --- Zone de drag & drop --- */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-card-alt);
}
.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.dropzone-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.5;
}
.dropzone-text {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.dropzone-hint {
  font-size: 12px;
  color: var(--text-muted);
}
.dropzone-file {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 16px;
}
.dropzone-file-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}
.dropzone-file-size {
  font-size: 12px;
  color: var(--text-muted);
}
.dropzone-file-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  border-radius: 4px;
}
.dropzone-file-remove:hover {
  color: var(--error);
  background: var(--error-light);
}
.dropzone-file-multi {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}
.dropzone-file-multi strong {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
}
.dropzone-file-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}
.dropzone-file-item {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 2px 0;
}

/* --- Preview du nom --- */
.filename-preview {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  background: var(--bg-card-alt);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-top: 12px;
  word-break: break-all;
}

/* --- Barre de progression pipeline --- */
.pipeline-images-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 4px;
}
.pipeline-image-tag {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pipeline-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
}
.pipeline-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: background 0.2s;
}
.pipeline-step-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  border: 2px solid var(--border);
  color: var(--text-muted);
  background: var(--bg-card);
}
.pipeline-step.pending .pipeline-step-icon {
  border-color: var(--border);
  color: var(--text-muted);
}
.pipeline-step.running .pipeline-step-icon {
  border-color: var(--warning);
  color: var(--warning);
  background: var(--warning-light);
  animation: pulse 1.5s infinite;
}
.pipeline-step.completed .pipeline-step-icon {
  border-color: var(--success);
  color: var(--success);
  background: var(--success-light);
}
.pipeline-step.error .pipeline-step-icon {
  border-color: var(--error);
  color: var(--error);
  background: var(--error-light);
}
.pipeline-step.skipped .pipeline-step-icon {
  border-color: var(--text-muted);
  color: var(--text-muted);
  opacity: 0.5;
}
.pipeline-step-name {
  flex: 1;
  color: var(--text-primary);
}
.pipeline-step.pending .pipeline-step-name {
  color: var(--text-muted);
}
.pipeline-step-status {
  font-size: 12px;
  color: var(--text-muted);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes progressStripe {
  0% { background-position: 0 0; }
  100% { background-position: 40px 0; }
}
.pipeline-step.running .pipeline-step-icon {
  animation: none;
}
.pipeline-step.running .pipeline-step-icon .spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--warning);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.pipeline-step-timer {
  font-size: 11px;
  color: var(--warning);
  font-variant-numeric: tabular-nums;
  min-width: 36px;
  text-align: right;
}
.pipeline-step.completed .pipeline-step-timer {
  color: var(--text-muted);
}

/* --- Barre de progression globale --- */
.progress-bar-container {
  background: var(--bg-card-alt);
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
  margin-top: 12px;
}
.progress-bar {
  height: 100%;
  background: var(--success);
  border-radius: 4px;
  transition: width 0.5s ease;
  width: 0%;
}
.progress-bar.active {
  background-image: linear-gradient(
    -45deg,
    rgba(255,255,255,0.15) 25%, transparent 25%,
    transparent 50%, rgba(255,255,255,0.15) 50%,
    rgba(255,255,255,0.15) 75%, transparent 75%
  );
  background-size: 40px 40px;
  animation: progressStripe 1s linear infinite;
}
.progress-bar.error {
  background: var(--error);
}

/* --- Section active pipeline (visible quand un job tourne) --- */
.pipeline-active {
  display: none;
}
.pipeline-active.visible {
  display: block;
}

/* --- Tableau historique --- */
.history-filters {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.history-filters select {
  padding: 6px 10px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-input);
  font-size: 13px;
  font-family: var(--font-body);
  background: var(--bg-input);
  color: var(--text-primary);
}
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.status-dot.completed { background: var(--success); }
.status-dot.running { background: var(--warning); }
.status-dot.error { background: var(--error); }
.status-dot.pending { background: var(--text-muted); }

/* --- Tabs navigation sections --- */
.sections {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.section-btn {
  padding: 10px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
}
.section-btn:hover { color: var(--text-secondary); }
.section-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.section-content {
  display: none;
}
.section-content.active {
  display: block;
}

/* --- Bouton IA auto-remplissage --- */
.ai-suggest-btn {
  margin-top: 12px;
  width: 100%;
  border-style: dashed;
  border-color: var(--accent);
  color: var(--accent);
}
.ai-suggest-btn:hover {
  background: var(--accent-light);
}
.ai-suggest-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}
.ai-suggest-btn.ai-done {
  border-style: solid;
  background: var(--success-light);
  border-color: var(--success);
  color: var(--success);
}

/* --- Alerte obsolescence --- */
.obsolete-alert {
  margin-top: 16px;
  padding: 16px;
  background: var(--warning-light);
  border: 1px solid var(--warning);
  border-radius: var(--radius);
}
.obsolete-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.obsolete-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.obsolete-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.obsolete-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.obsolete-item-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.obsolete-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}
.obsolete-diff {
  margin-top: 6px;
  padding: 8px 12px;
  background: var(--bg-card-alt);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--warning);
}
.diff-list {
  margin: 0;
  padding-left: 16px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.diff-list li {
  margin-bottom: 4px;
}

/* --- Release Notes --- */
.releases-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.releases-header h2 {
  margin: 0;
}
.release-note {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.release-note-meta {
  display: flex;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-card-alt);
  border-bottom: 1px solid var(--border);
}
.release-note-content {
  padding: 16px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-primary);
}
.release-note-content h2 {
  font-size: 16px;
  margin: 0 0 8px 0;
  color: var(--accent);
}
.release-note-content h3 {
  font-size: 14px;
  margin: 8px 0 4px 0;
  color: var(--text-primary);
}
.release-note-content h4 {
  font-size: 13px;
  margin: 6px 0 2px 0;
}
.release-note-content p {
  margin: 3px 0;
}
.release-note-content p:first-child { margin-top: 0; }
.release-note-content p:last-child  { margin-bottom: 0; }
.release-note-content ul,
.release-note-content ol {
  margin: 2px 0 4px 0;
  padding-left: 20px;
}
.release-note-content li {
  margin-bottom: 2px;
}
.release-note-content li > p { margin: 0; }
.release-note-content hr {
  margin: 8px 0;
  border: none;
  border-top: 1px solid var(--border);
}
.release-note-content table {
  margin: 6px 0;
  border-collapse: collapse;
  font-size: 12px;
}
.release-note-content th,
.release-note-content td {
  padding: 3px 7px;
  border: 1px solid var(--border);
  line-height: 1.3;
}
.release-note-content blockquote {
  margin: 6px 0;
  padding: 6px 10px;
  border-left: 3px solid var(--accent);
  background: var(--bg-card-alt);
  border-radius: var(--radius-sm);
  font-style: italic;
}

/* --- Chat IA --- */
.chat-card {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 220px);
  min-height: 500px;
}
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.chat-header h2 {
  margin: 0;
}
.chat-stats {
  font-size: 12px;
  color: var(--text-muted);
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 4px 16px 4px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.chat-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
  font-size: 14px;
  line-height: 1.8;
}
.chat-message {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 85%;
}
.chat-message.user {
  align-self: flex-end;
  align-items: flex-end;
}
.chat-message.assistant {
  align-self: flex-start;
  align-items: flex-start;
  max-width: 95%;
}
.chat-bubble {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
}
/* Élément markdown rendu dans la bulle : marges resserrées pour densité de lecture */
.chat-message.assistant .chat-bubble p {
  margin: 2px 0;
}
.chat-message.assistant .chat-bubble p:first-child { margin-top: 0; }
.chat-message.assistant .chat-bubble p:last-child  { margin-bottom: 0; }
.chat-message.assistant .chat-bubble br + br { display: none; }
.chat-message.assistant .chat-bubble hr {
  margin: 6px 0;
  border: none;
  border-top: 1px solid var(--border);
}
.chat-message.assistant .chat-bubble table {
  margin: 4px 0;
  border-collapse: collapse;
  font-size: 13px;
}
.chat-message.assistant .chat-bubble th,
.chat-message.assistant .chat-bubble td {
  padding: 3px 7px;
  border: 1px solid var(--border);
  line-height: 1.3;
}
.chat-message.assistant .chat-bubble blockquote {
  margin: 4px 0;
  padding-left: 10px;
  border-left: 2px solid var(--border);
  color: var(--text-secondary);
}
.chat-message.user .chat-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-message.assistant .chat-bubble {
  background: var(--bg-card-alt);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.chat-message.assistant .chat-bubble h2,
.chat-message.assistant .chat-bubble h3,
.chat-message.assistant .chat-bubble h4 {
  margin: 6px 0 2px 0;
  color: var(--accent);
  font-size: 15px;
  line-height: 1.25;
}
.chat-message.assistant .chat-bubble h2:first-child,
.chat-message.assistant .chat-bubble h3:first-child,
.chat-message.assistant .chat-bubble h4:first-child {
  margin-top: 0;
}
.chat-message.assistant .chat-bubble ul,
.chat-message.assistant .chat-bubble ol {
  margin: 2px 0 2px 4px;
  padding-left: 20px;
}
.chat-message.assistant .chat-bubble li {
  margin-bottom: 1px;
  line-height: 1.4;
}
.chat-message.assistant .chat-bubble li > p {
  margin: 0;
}
.chat-message.assistant .chat-bubble code {
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.chat-message.assistant .chat-bubble pre {
  background: var(--bg-input);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 12px;
  margin: 8px 0;
}
.chat-message.assistant .chat-bubble a.chat-citation {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid var(--accent);
  padding: 0 5px;
  border-radius: 4px;
  margin: 0 2px;
  text-decoration: none;
  vertical-align: baseline;
}
.chat-message.assistant .chat-bubble a.chat-citation:hover {
  background: var(--accent);
  color: #fff;
}
.chat-sources {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.chat-sources-title {
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 2px;
}
.chat-source-item {
  display: flex;
  gap: 6px;
  padding: 4px 8px;
  background: var(--bg-card-alt);
  border-left: 2px solid var(--accent);
  border-radius: 2px;
}
.chat-source-num {
  font-weight: 600;
  color: var(--accent);
  min-width: 22px;
}
.chat-source-title {
  flex: 1;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-source-meta {
  color: var(--text-muted);
  font-size: 11px;
}
.chat-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.chat-action-btn {
  font-size: 11px;
  padding: 3px 8px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
}
.chat-action-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}
/* Indicateur "streaming" : curseur clignotant + hint pendant la sélection */
.chat-streaming {
  position: relative;
}
.chat-cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  vertical-align: text-bottom;
  margin-left: 2px;
  background: var(--accent);
  animation: chat-blink 1s steps(2) infinite;
}
@keyframes chat-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}
.chat-stream-hint {
  color: var(--text-muted);
  font-size: 12px;
  font-style: italic;
  margin-bottom: 4px;
}
.chat-input-row {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.chat-input-row textarea {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-input);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  resize: vertical;
  min-height: 44px;
}
.chat-input-row textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.chat-input-row button {
  align-self: flex-end;
  height: 44px;
}
.chat-error {
  align-self: flex-start;
  padding: 10px 14px;
  background: var(--error-light);
  border: 1px solid var(--error);
  color: var(--error);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

/* --- Divers --- */
.empty-state {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-muted);
  font-size: 14px;
}
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-12 { margin-bottom: 12px; }
.hidden { display: none !important; }

/* === Chat IA — améliorations Lot 4 === */

/* Badge de confiance (au-dessus de la bulle assistant) */
.chat-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 10px;
  margin-bottom: 6px;
  border: 1px solid transparent;
}
.chat-badge--high {
  color: #0a6b30;
  background: #e7f7ec;
  border-color: #b8e4c6;
}
.chat-badge--medium {
  color: #8a4b00;
  background: #fff3e0;
  border-color: #ffd9a8;
}
.chat-badge--low {
  color: #9b1d1d;
  background: #fdecec;
  border-color: #f3b4b4;
}

/* Dropdown d'export (.md + 3 templates) */
.chat-export-dropdown {
  display: inline-block;
  position: relative;
}
.chat-export-dropdown > summary {
  cursor: pointer;
  list-style: none;
}
.chat-export-dropdown > summary::-webkit-details-marker {
  display: none;
}
.chat-export-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 200px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  z-index: 20;
  padding: 4px 0;
  display: flex;
  flex-direction: column;
}
.chat-export-item {
  text-align: left;
  padding: 8px 14px;
  background: transparent;
  border: none;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.chat-export-item:hover {
  background: var(--accent-light, #f0f4ff);
}

/* Recherche directe (au-dessus de la zone messages) */
.chat-direct-search {
  background: #fafbfc;
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.chat-direct-search-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-style: italic;
}
.chat-direct-search-row {
  display: flex;
  gap: 8px;
}
.chat-direct-search-row input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}
.chat-direct-search-results {
  margin-top: 10px;
  max-height: 280px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.chat-dsr-count {
  font-size: 11px;
  color: var(--text-muted);
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
.chat-dsr-item {
  padding: 8px 10px;
  border-bottom: 1px solid #f0f0f0;
  cursor: default;
}
.chat-dsr-item:last-child {
  border-bottom: none;
}
.chat-dsr-item:hover {
  background: #f7f9fc;
}
.chat-dsr-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.chat-dsr-type {
  font-size: 14px;
}
.chat-dsr-title {
  font-weight: 600;
  flex: 1;
}
.chat-dsr-match {
  font-size: 10px;
  color: var(--text-muted);
  background: #eef1f6;
  padding: 2px 6px;
  border-radius: 4px;
}
.chat-dsr-meta {
  display: flex;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.chat-direct-search-empty,
.chat-direct-search-error {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.chat-direct-search-error {
  color: #9b1d1d;
}

/* Bouton d'attachement image (📎) */
.chat-attach-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

/* Prévisualisation de l'image jointe (au-dessus du formulaire) */
.chat-image-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--accent-light, #f0f4ff);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
}
/* Respecte l'attribut HTML [hidden] (sans cette règle, display:flex le surcharge) */
.chat-image-preview[hidden] {
  display: none;
}
.chat-image-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.chat-image-name {
  font-size: 12px;
  color: var(--text-muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-image-remove {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}
.chat-image-remove:hover {
  color: #9b1d1d;
  background: #fdecec;
}

/* Miniature dans la bulle utilisateur (session courante uniquement) */
.chat-user-image {
  margin-bottom: 6px;
  display: flex;
  justify-content: flex-end;
}
.chat-user-thumb {
  max-width: 200px;
  max-height: 150px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: zoom-in;
}
.chat-user-thumb:hover {
  opacity: 0.9;
}

/* --- Modal générique --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}
.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card-hover);
  padding: 24px;
  width: 640px;
  max-width: 95vw;
  max-height: 85vh;
  overflow-y: auto;
}
.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-card-alt);
}

/* --- Base de connaissances --- */
.kb-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}
.kb-header h2 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.kb-total-badge {
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 2px 10px;
  border-radius: 12px;
}
.kb-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.kb-search-input {
  flex: 1;
  min-width: 180px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13px;
}
.kb-search-input:focus {
  outline: none;
  border-color: var(--accent);
}
.kb-filters select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
}
.kb-index-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.kb-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kb-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.kb-item:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.kb-item-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.kb-item-body {
  flex: 1;
  min-width: 0;
}
.kb-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kb-item-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.kb-item-date {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.kb-item--compiled {
  border-color: var(--accent);
  background: var(--accent-light);
}
.kb-item--compiled:hover {
  border-color: var(--accent);
  filter: brightness(0.97);
}
.kb-compiled-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  padding: 1px 7px;
  border-radius: 10px;
  vertical-align: middle;
  margin-left: 6px;
  letter-spacing: 0.03em;
}
.kb-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* Modal KB */
.kb-modal {
  width: 800px;
  max-width: 95vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.kb-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.kb-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.kb-title-edit-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}
.kb-title-edit-btn:hover {
  background: var(--bg-hover, #f3f4f6);
  color: var(--text-primary);
}
.kb-title-edit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  flex-wrap: wrap;
  width: 100%;
}
.kb-title-edit-input {
  flex: 1;
  min-width: 240px;
  font-size: 15px;
  font-weight: 600;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  background: var(--bg-input, #fff);
}
.kb-title-edit-input:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.kb-modal-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.6;
}
.kb-modal-body {
  flex: 1;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-primary);
}
.kb-modal-body h1, .kb-modal-body h2, .kb-modal-body h3 {
  color: var(--text-primary);
  margin: 8px 0 4px;
  font-weight: 700;
}
.kb-modal-body h1:first-child,
.kb-modal-body h2:first-child,
.kb-modal-body h3:first-child { margin-top: 0; }
.kb-modal-body h1 { font-size: 16px; }
.kb-modal-body h2 { font-size: 14px; }
.kb-modal-body h3 { font-size: 13px; }
.kb-modal-body p { margin: 3px 0; }
.kb-modal-body p:first-child { margin-top: 0; }
.kb-modal-body p:last-child  { margin-bottom: 0; }
.kb-modal-body ul, .kb-modal-body ol { padding-left: 20px; margin: 4px 0; }
.kb-modal-body li { margin: 2px 0; }
.kb-modal-body li > p { margin: 0; }
.kb-modal-body hr {
  margin: 8px 0;
  border: none;
  border-top: 1px solid var(--border);
}
.kb-modal-body table {
  margin: 6px 0;
  border-collapse: collapse;
  font-size: 12px;
}
.kb-modal-body th,
.kb-modal-body td {
  padding: 3px 7px;
  border: 1px solid var(--border);
  line-height: 1.3;
}
.kb-modal-body blockquote {
  margin: 6px 0;
  padding: 6px 10px;
  border-left: 3px solid var(--accent);
  color: var(--text-secondary);
}
.kb-modal-body strong { font-weight: 700; }
.kb-modal-body em { font-style: italic; }
.kb-modal-body code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-card-alt);
  padding: 1px 5px;
  border-radius: 3px;
}
.kb-modal-body pre {
  background: var(--bg-card-alt);
  padding: 12px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 12px;
}
.kb-modal-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}
.kb-modal-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.kb-edit-textarea {
  width: 100%;
  min-height: 400px;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  resize: vertical;
  box-sizing: border-box;
}
.kb-edit-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}
.kb-empty-content {
  color: var(--text-muted);
  font-style: italic;
  padding: 20px 0;
  text-align: center;
}

/* --- Badge doublons dans le menu --- */
.badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--error);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 5px;
  margin-left: 4px;
  vertical-align: middle;
}

/* --- Carte doublon --- */
.duplicate-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.duplicate-pair:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.duplicate-item {
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.duplicate-item.is-new {
  border-color: var(--accent);
}
.duplicate-item-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.duplicate-item.is-new .duplicate-item-label {
  color: var(--accent);
}
.duplicate-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.duplicate-item-meta {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.duplicate-diff {
  grid-column: 1 / -1;
  background: var(--bg-card-alt);
  border-left: 3px solid var(--warning);
  padding: 12px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.duplicate-diff strong {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--warning);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.duplicate-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.text-muted {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 20px;
}


/* ============================================================
   REFONTE UX — Navigation 5 zones + Dashboard d'accueil
   ============================================================ */

/* --- Main nav : 5 zones (Accueil, Alimenter, Consulter, Réviser, Admin) --- */
.main-nav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
  flex-wrap: wrap;
}
.main-nav-btn {
  background: transparent;
  border: none;
  padding: 14px 20px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.15s, border-color 0.15s;
}
.main-nav-btn:hover { color: var(--text-secondary); }
.main-nav-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.main-nav-icon { font-size: 16px; line-height: 1; }
.main-nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--warning);
  color: #1a1a1e;
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
}

/* --- Sub-nav : sous-onglets de la zone active --- */
.sub-nav {
  display: flex;
  gap: 4px;
  padding: 12px 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
/* Les .section-btn à l'intérieur de .sub-nav gardent leur style existant */

/* --- Dashboard d'accueil --- */
.dash-hero {
  margin-bottom: 28px;
}
.dash-greeting {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}
.dash-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
}

.dash-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}
.dash-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
}
.dash-stat.clickable { cursor: pointer; }
.dash-stat.clickable:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}
.dash-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 10px;
}
.dash-stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.dash-stat-detail {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
  min-height: 16px;
}
.dash-stat-detail.warn { color: var(--warning); font-weight: 600; }
.dash-stat-detail.ok { color: var(--success); font-weight: 600; }

/* --- Quick actions (3 cards) --- */
.dash-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dash-section-link {
  font-size: 13px;
  color: var(--link-color);
  text-decoration: none;
  font-weight: 500;
}
.dash-section-link:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.dash-quick {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}
.dash-quick-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  text-align: left;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  color: inherit;
}
.dash-quick-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-hover);
}
.dash-quick-icon {
  font-size: 28px;
  margin-bottom: 12px;
  line-height: 1;
}
.dash-quick-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.dash-quick-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* --- Activity feed --- */
.activity-feed {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  flex-shrink: 0;
  font-size: 14px;
}
.activity-icon.add { background: var(--success-light); color: var(--success); }
.activity-icon.review { background: var(--warning-light); color: var(--warning); }
.activity-icon.delete { background: var(--error-light); color: var(--error); }
.activity-icon.info { background: var(--accent-light); color: var(--text-primary); }
.activity-body { flex: 1; min-width: 0; }
.activity-title {
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 2px;
  line-height: 1.4;
}
.activity-title strong { font-weight: 600; }
.activity-meta {
  font-size: 12px;
  color: var(--text-muted);
}
.activity-time {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* --- Responsive --- */
@media (max-width: 720px) {
  .main-nav { overflow-x: auto; }
  .main-nav-btn { padding: 12px 14px; font-size: 13px; white-space: nowrap; }
  .sub-nav { overflow-x: auto; }
  .dash-stat-value { font-size: 26px; }
}


/* ============================================================
   V4 — Sélecteur de Domaine + Sélecteur de Visibilité
   Utilisé dans le formulaire d'import (zone Alimenter > Nouveau contenu)
   ============================================================ */

/* Couleurs sémantiques par domaine */
:root {
  --d-produit:   #4F8FCB;
  --d-prevente:  #C58B4A;
  --d-legal:     #8B7BB8;
  --d-interne:   #C0656A;
  --d-glossaire: #5FA37E;
}

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.field-required {
  color: var(--error);
  font-size: 13px;
}
.field-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.5;
}
.field-hint strong { color: var(--text-secondary); }

/* --- Chips de domaine --- */
.domain-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.domain-chip {
  padding: 8px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}
.domain-chip:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
}
.chip-icon { font-size: 14px; line-height: 1; }

/* Active state — couleurs sémantiques par domaine */
.domain-chip.d-produit.active {
  background: rgba(79,143,203,0.12);
  border-color: var(--d-produit);
  color: var(--d-produit);
}
.domain-chip.d-prevente.active {
  background: rgba(197,139,74,0.12);
  border-color: var(--d-prevente);
  color: var(--d-prevente);
}
.domain-chip.d-legal.active {
  background: rgba(139,123,184,0.12);
  border-color: var(--d-legal);
  color: var(--d-legal);
}
.domain-chip.d-interne.active {
  background: rgba(192,101,106,0.12);
  border-color: var(--d-interne);
  color: var(--d-interne);
}
.domain-chip.d-glossaire.active {
  background: rgba(95,163,126,0.12);
  border-color: var(--d-glossaire);
  color: var(--d-glossaire);
}

/* --- Pills de visibilité --- */
.visibility-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.visibility-pill {
  flex: 1;
  min-width: 180px;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
  transition: all 0.15s;
}
.visibility-pill:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
}
.visibility-pill.locked {
  opacity: 0.45;
  cursor: not-allowed;
}
.visibility-pill.locked:hover {
  color: var(--text-secondary);
  border-color: var(--border);
}
.vis-pill-hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}
.visibility-pill.active.v-public {
  background: rgba(34,197,94,0.10);
  border-color: var(--success);
  color: var(--success);
}
.visibility-pill.active.v-commercial {
  background: rgba(245,158,11,0.10);
  border-color: var(--warning);
  color: var(--warning);
}
.visibility-pill.active.v-interne {
  background: rgba(239,68,68,0.10);
  border-color: var(--error);
  color: var(--error);
}
.visibility-pill.active .vis-pill-hint {
  color: inherit;
  opacity: 0.85;
}

.visibility-lock-note {
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(239,68,68,0.06);
  border-left: 3px solid var(--error);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* === V4 / Phase 3 — Modale d'alerte cohérence IA === */
.coherence-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
  animation: fadeInBackdrop 0.15s ease-out;
}
@keyframes fadeInBackdrop {
  from { opacity: 0; }
  to { opacity: 1; }
}
.coherence-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 540px;
  width: 100%;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.coherence-modal-icon {
  font-size: 40px;
  text-align: center;
  margin-bottom: 12px;
}
.coherence-modal-title {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 10px;
  color: var(--error);
}
.coherence-modal-text {
  color: var(--text-secondary);
  font-size: 13px;
  text-align: center;
  margin-bottom: 16px;
  line-height: 1.5;
}
.coherence-detected {
  background: rgba(239, 68, 68, 0.08);
  border-left: 3px solid var(--error);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}
.coherence-detected-title {
  font-size: 11px;
  color: var(--error);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}
.coherence-detected ul {
  font-size: 13px;
  color: var(--text-primary);
  list-style: none;
  padding: 0;
  margin: 0;
}
.coherence-detected li {
  padding: 2px 0 2px 18px;
  position: relative;
}
.coherence-detected li::before {
  content: '⚠️';
  position: absolute;
  left: 0;
}
.coherence-suggestion {
  background: rgba(95, 163, 126, 0.08);
  border-left: 3px solid var(--success);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
}
.coherence-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* Encart d'avertissement quand l'utilisateur veut publier en Public malgré nom client détecté */
.pc-public-warning {
  background: rgba(239, 68, 68, 0.10);
  border: 1px solid var(--error);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
}


/* === V4 / Phase 4A — Page admin Clients protégés === */
.pc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.pc-header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.pc-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--text-secondary);
}
.pc-stat strong { color: var(--text-primary); font-weight: 700; }
.pc-stat-sep { color: var(--text-muted); }

.pc-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.pc-search {
  flex: 1;
  min-width: 240px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-primary);
}
.pc-toolbar select {
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-primary);
}

.pc-pill-source,
.pc-pill-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.pc-pill-source.auto   { background: rgba(79,143,203,0.15); color: var(--d-produit); }
.pc-pill-source.manual { background: rgba(160,160,171,0.15); color: var(--text-secondary); }
.pc-pill-status.active   { background: rgba(34,197,94,0.15); color: var(--success); }
.pc-pill-status.inactive { background: rgba(160,160,171,0.15); color: var(--text-muted); }

.pc-row-inactive td { opacity: 0.6; }

/* Modal */
.pc-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 20px;
}
.pc-modal-backdrop.hidden { display: none; }
.pc-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.pc-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.pc-modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.pc-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}
.pc-modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-card-alt);
}


/* === V4 : badges Domaine + Visibilité affichés dans la liste KB et la modale === */
.kb-item-badges {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.kb-modal-badges {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.kb-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  border: 1px solid transparent;
}
/* Domaines */
.kb-badge-d-produit   { background: rgba(79,143,203,0.12);  color: var(--d-produit);   border-color: rgba(79,143,203,0.3); }
.kb-badge-d-prevente  { background: rgba(197,139,74,0.12);  color: var(--d-prevente);  border-color: rgba(197,139,74,0.3); }
.kb-badge-d-legal     { background: rgba(139,123,184,0.12); color: var(--d-legal);     border-color: rgba(139,123,184,0.3); }
.kb-badge-d-interne   { background: rgba(192,101,106,0.12); color: var(--d-interne);   border-color: rgba(192,101,106,0.3); }
.kb-badge-d-glossaire { background: rgba(95,163,126,0.12);  color: var(--d-glossaire); border-color: rgba(95,163,126,0.3); }
/* Visibilités */
.kb-badge-v-public     { background: rgba(34,197,94,0.12);  color: var(--success); border-color: rgba(34,197,94,0.3); }
.kb-badge-v-commercial { background: rgba(245,158,11,0.12); color: var(--warning); border-color: rgba(245,158,11,0.3); }
.kb-badge-v-interne    { background: rgba(239,68,68,0.12);  color: var(--error);   border-color: rgba(239,68,68,0.3); }
/* Post-V4 : badge « Partielle » sur une fiche KB avec questions encore à compléter */
.kb-badge-partial {
  background: rgba(245,158,11,0.15);
  color: var(--warning);
  border-color: rgba(245,158,11,0.4);
  margin-left: 6px;
}
.kb-item--partial {
  border-left: 3px solid var(--warning);
}
/* Badge « Bloqué depuis N jours » sur les anciens pipelines en pending_completion */
.pending-card-stale-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(239,68,68,0.12);
  color: var(--error);
  border: 1px solid rgba(239,68,68,0.3);
  margin-left: 6px;
}
/* Badge « Déjà en KB » sur une card pending quand une fiche partielle a été créée */
.pending-card-inkb-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(34,197,94,0.12);
  color: var(--success);
  border: 1px solid rgba(34,197,94,0.3);
  margin-left: 6px;
}

/* Éditeur inline de classification (modale KB) */
.kb-modal-classification {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.kb-reclassify-block {
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  width: 100%;
  margin-bottom: 10px;
}
.kb-reclassify-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.kb-reclassify-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  min-width: 80px;
  padding-top: 8px;
}
.kb-reclassify-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.kb-reclassify-divider {
  border-top: 1px solid var(--border);
  margin: 10px 0;
}
.kb-reclassify-input {
  flex: 1;
  min-width: 200px;
  padding: 6px 10px;
  background: var(--bg-input);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--text-primary);
}
.kb-reclassify-input:focus {
  outline: none;
  border-color: var(--input-focus);
}

/* Multiselect (checkbox list) pour les verticales et autres champs multi */
.kb-multiselect {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 200px;
}
.kb-multiselect-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--bg-input);
  border: 1px solid var(--input-border);
  border-radius: 14px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.kb-multiselect-option:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}
.kb-multiselect-option input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
}
.kb-multiselect-option:has(input:checked) {
  background: rgba(95,163,126,0.12);
  border-color: var(--success);
  color: var(--text-primary);
}
