:root {
  --bg: #f8f9fb;
  --panel: #ffffff;
  --border: #e4e7ec;
  --text: #1a1d23;
  --muted: #6b7280;
  --accent: #4f7f9d;
  --accent-soft: #eef3f7;
  --ok: #16a34a;
  --ok-soft: #ecfdf3;
  --warn: #d9873a;
  --warn-soft: #fdf3e7;
  --fail: #dc2626;
  --fail-soft: #fef2f2;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: var(--panel); border-bottom: 1px solid var(--border);
  padding: 14px 24px; display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 10;
}
.topbar .logo { font-weight: 700; font-size: 16px; color: var(--text); }
.topbar .logo span { color: var(--accent); }
.topbar nav { display: flex; gap: 4px; margin-left: 12px; }
.topbar nav a {
  padding: 6px 12px; border-radius: 8px; color: var(--muted); font-size: 14px; font-weight: 500;
}
.topbar nav a:hover { background: var(--accent-soft); color: var(--text); text-decoration: none; }
.topbar nav a.active { background: var(--accent-soft); color: var(--accent); }
.topbar .spacer { flex: 1; }

.container { max-width: 960px; margin: 0 auto; padding: 24px 20px 60px; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px;
}
.card h2 { margin: 0 0 4px; font-size: 16px; }
.card .sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

h1 { font-size: 20px; margin: 0 0 4px; }
.page-sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
input[type=text], input[type=password], input[type=email], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,127,157,.12);
}
.field { margin-bottom: 14px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px;
  border-radius: 8px; border: 1px solid transparent; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: all .12s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #42698277; background: #446e88; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-sm { padding: 5px 10px; font-size: 13px; }

.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.badge-active { background: var(--ok-soft); color: var(--ok); }
.badge-incomplete { background: var(--warn-soft); color: var(--warn); }
.badge-paused { background: var(--accent-soft); color: var(--accent); }
.badge-fail { background: var(--fail-soft); color: var(--fail); }

/* Fiche client (phase 2) */
.checklist { display: flex; flex-direction: column; gap: 2px; }
.checkrow { display: flex; gap: 10px; align-items: baseline; padding: 7px 0;
  border-bottom: 1px dashed var(--border); font-size: 14px; }
.checkrow:last-child { border-bottom: none; }
.checklabel { font-weight: 600; min-width: 220px; }
.checkdetail { color: var(--muted); }
.histrow { display: flex; gap: 10px; align-items: baseline; padding: 6px 0;
  border-bottom: 1px dashed var(--border); font-size: 13px; }
.histrow:last-child { border-bottom: none; }
.histdate { color: var(--muted); min-width: 120px; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .checkrow { flex-wrap: wrap; }
  .checklabel { min-width: 0; }
  .histrow { flex-wrap: wrap; }
  .histdate { min-width: 0; }
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
     color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }

/* Timeline des étapes */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border);
  font-size: 14px; align-items: baseline;
}
.timeline li:last-child { border-bottom: none; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; position: relative; top: 0; }
.dot-info { background: var(--accent); }
.dot-ok { background: var(--ok); }
.dot-fail { background: var(--fail); }
.dot-waiting { background: var(--warn); animation: pulse 1.4s infinite; }
.dot-done { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.step-name { font-weight: 600; min-width: 96px; color: var(--muted); font-size: 12px;
  text-transform: uppercase; letter-spacing: .03em; }

.alert { padding: 10px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 14px; }
.alert-error { background: var(--fail-soft); color: var(--fail); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-warn { background: var(--warn-soft); color: #9a6326; }

.msg-box {
  background: #fafbfc; border: 1px solid var(--border); border-radius: 8px;
  padding: 14px; font-size: 14px; white-space: pre-wrap; font-family: inherit;
  max-height: 300px; overflow-y: auto;
}

.center-narrow { max-width: 420px; margin: 80px auto; }
@media (max-width: 640px) {
  .topbar { padding: 12px 14px; flex-wrap: wrap; }
  .container { padding: 16px 12px 40px; }
  table thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  tr { border-bottom: 1px solid var(--border); padding: 8px 0; }
  td { border: none; padding: 4px 10px; }
  td::before { content: attr(data-label); font-size: 11px; text-transform: uppercase;
    color: var(--muted); display: block; }
}
