/* Charte graphique OPAC36 */
:root {
  --violet: #7B3F8D;
  --bleu: #4A9FD8;
  --rose: #D64B8A;
  --vert: #7CB342;
  --orange: #F89D3B;
  --noir: #1A1A1A;
  --gris-fonce: #4A4A4A;
  --gris-clair: #F5F5F5;
  --blanc: #FFFFFF;
  --ombre: 0 2px 12px rgba(0, 0, 0, 0.08);
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  font-family: 'Montserrat', 'Segoe UI', system-ui, sans-serif;
  color: var(--noir);
  margin: 0;
  background: var(--gris-clair);
  line-height: 1.5;
}

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

/* En-tête */
.site-header {
  background: var(--blanc);
  border-bottom: 3px solid var(--violet);
  box-shadow: var(--ombre);
}
.site-header .inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.site-header img { height: 46px; }
.site-header .title { font-weight: 700; color: var(--violet); font-size: 1.15rem; }
.site-header .subtitle { color: var(--gris-fonce); font-size: 0.85rem; }
.site-header .spacer { flex: 1; }

main { max-width: 1100px; margin: 28px auto; padding: 0 24px; }

h1 { font-weight: 900; color: var(--violet); font-size: 2rem; margin: 0 0 6px; }
h2 { font-weight: 700; color: var(--bleu); font-size: 1.4rem; }
h3 { font-weight: 700; color: var(--gris-fonce); font-size: 1.05rem; }

/* Cartes */
.card {
  background: var(--blanc);
  border-radius: var(--radius);
  box-shadow: var(--ombre);
  padding: 22px 24px;
  margin-bottom: 22px;
}

/* Boutons */
.btn {
  display: inline-block;
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  color: var(--blanc);
  background: var(--bleu);
  transition: filter .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn-primary { background: var(--violet); }
.btn-action { background: var(--rose); }
.btn-success { background: var(--vert); }
.btn-warning { background: var(--orange); }
.btn-ghost { background: transparent; color: var(--gris-fonce); border: 1px solid #ddd; }
.btn-sm { padding: 5px 11px; font-size: 0.8rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Formulaires */
label { display: block; font-weight: 600; font-size: 0.85rem; margin: 10px 0 4px; color: var(--gris-fonce); }
input[type=text], input[type=password], input[type=email], textarea, select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #d5d5d5;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.92rem;
}
textarea { min-height: 90px; resize: vertical; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row > div { flex: 1; min-width: 200px; }

/* Tableaux */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #eee; font-size: 0.9rem; }
th { color: var(--gris-fonce); font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: .03em; }
tr:hover td { background: #fafafa; }

/* Badges de statut */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--blanc);
}
.badge-pending { background: var(--gris-fonce); }
.badge-running { background: var(--orange); }
.badge-success { background: var(--vert); }
.badge-error { background: var(--rose); }
.badge-skipped { background: #aaa; }
.badge-draft { background: var(--bleu); }

/* Suivi des étapes du pipeline */
.steps { list-style: none; padding: 0; margin: 0; }
.steps li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px dashed #eee;
}
.step-icon {
  width: 26px; height: 26px; border-radius: 50%;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; color: var(--blanc); background: #ccc;
}
.step-pending .step-icon { background: #ccc; }
.step-running .step-icon { background: var(--orange); }
.step-success .step-icon { background: var(--vert); }
.step-error .step-icon { background: var(--rose); }
.step-label { font-weight: 600; }
.step-detail { color: var(--gris-fonce); font-size: 0.85rem; }

.muted { color: var(--gris-fonce); font-size: 0.85rem; }
.erp-address { color: var(--bleu); font-weight: 600; font-size: 1.1rem; margin: 2px 0 12px; }
.flex { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: 2fr 1fr; }
@media (max-width: 780px) { .grid-2 { grid-template-columns: 1fr; } }

.stat { text-align: center; padding: 8px 14px; }
.stat .num { font-size: 1.8rem; font-weight: 900; color: var(--violet); }
.stat .lbl { font-size: 0.78rem; color: var(--gris-fonce); }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 0.9rem; }
.alert-info { background: #eaf4fb; border-left: 4px solid var(--bleu); }
.alert-warn { background: #fef3e6; border-left: 4px solid var(--orange); }

footer.site-footer { text-align: center; color: var(--gris-fonce); font-size: 0.8rem; padding: 24px; }

/* Bouton de suppression (contour rouge, discret mais identifiable) */
.btn-danger { background: transparent; color: #c0392b; border: 1px solid #e3b4b4; }
.btn-danger:hover { background: #fceaea; filter: none; }

/* Chip utilisateur connecté + déconnexion */
.user-chip {
  font-size: 0.82rem; color: var(--gris-fonce);
  background: var(--gris-clair); border: 1px solid #e2e2e2;
  border-radius: 20px; padding: 5px 12px; display: inline-flex; gap: 10px; align-items: center;
}
.user-chip a { color: var(--violet); font-weight: 700; text-decoration: none; }
.user-chip a:hover { text-decoration: underline; }

td.nowrap, .nowrap { white-space: nowrap; }

/* Page de connexion */
.login-wrap { display: flex; justify-content: center; padding: 20px 0; }
.login-card { max-width: 440px; width: 100%; }
.alert-info strong { color: var(--violet); }
.login-links { margin-top: 16px; text-align: center; }
.login-links .sep { color: #d0d0d0; margin: 0 10px; }
.btn-link {
  background: none; border: none; padding: 0; cursor: pointer;
  font-family: inherit; font-size: 0.85rem; font-weight: 600;
  color: var(--violet); text-decoration: none;
}
.btn-link:hover { text-decoration: underline; }
