/* EAP Qualification — V1.5 */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e4e7ec;
  --text: #1a1d24;
  --text-muted: #5b6473;
  --primary: #1f4ed8;
  --primary-hover: #1a3eb8;

  --vert: #16a34a;
  --vert-bg: #dcfce7;
  --orange: #ea580c;
  --orange-bg: #ffedd5;
  --rouge: #dc2626;
  --rouge-bg: #fee2e2;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.06);
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ─── Login overlay ──────────────────────────────────────────────────── */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.login-card {
  background: white;
  border-radius: 16px;
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  gap: 0;
}
.login-eyebrow {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: #94a3b8;
}
.login-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #0f172a;
  margin: 4px 0 0;
}
.login-sub {
  font-size: 14px;
  color: #64748b;
  margin: 8px 0 20px;
}
.login-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-top: 12px;
}
.login-input {
  width: 100%;
  border: 1px solid #e2e8f0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #f8fafc;
  margin-top: 6px;
  transition: all 0.15s;
}
.login-input:focus {
  outline: none;
  border-color: #0f172a;
  background: white;
  box-shadow: 0 0 0 4px rgba(15,23,42,0.06);
}
.login-err {
  color: #be123c;
  font-size: 12px;
  font-weight: 600;
  min-height: 18px;
  margin-top: 10px;
}
.login-btn {
  width: 100%;
  background: #0f172a;
  color: white;
  padding: 11px 22px;
  border-radius: 10px;
  border: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
  transition: background 0.15s;
}
.login-btn:hover:not(:disabled) { background: #1e293b; }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.login-foot {
  font-size: 10px;
  color: #94a3b8;
  text-align: center;
  margin-top: 18px;
}

/* Bouton logout */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.btn-logout {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}
.btn-logout:hover {
  background: var(--bg);
  color: var(--text);
}
#logout-email { font-family: var(--font-mono); font-size: 10px; }

/* ─── Topbar ─────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  box-shadow: 0 0 0 3px rgba(31, 78, 216, 0.12);
}

.muted { color: var(--text-muted); font-weight: 400; }
.version { color: var(--text-muted); font-size: 12px; font-family: var(--font-mono); }

/* ─── Layout ─────────────────────────────────────────────────────────── */
.container {
  max-width: 880px;
  margin: 32px auto;
  padding: 0 20px 80px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: var(--shadow-sm);
}

.card h1 { margin: 0 0 4px; font-size: 22px; font-weight: 600; }
.card h2 { margin: 0 0 4px; font-size: 18px; font-weight: 600; }
.card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.card h4 { margin: 0 0 6px; font-size: 12px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.sub { margin: 0 0 18px; color: var(--text-muted); font-size: 14px; }

.center-card {
  text-align: center;
  padding: 48px 28px;
}

/* ─── Search form ────────────────────────────────────────────────────── */
.search-form {
  display: grid;
  grid-template-columns: 1fr 140px auto;
  gap: 10px;
}

input[type="text"] {
  font: inherit;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 78, 216, 0.14);
}

button {
  font: inherit;
  font-weight: 500;
  padding: 11px 22px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s, transform 0.05s;
}

button:hover:not(:disabled) { background: var(--primary-hover); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg);
}

/* ─── Spinner ────────────────────────────────────────────────────────── */
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ─── Stepper de progression ─────────────────────────────────────────── */
.stepper {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stepper li {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  position: relative;
  opacity: 0.5;
  transition: opacity 0.25s;
}

.stepper li::before {
  /* trait vertical reliant les étapes */
  content: "";
  position: absolute;
  left: 13px;
  top: 32px;
  bottom: -4px;
  width: 2px;
  background: var(--border);
}
.stepper li:last-child::before { display: none; }

.step-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  z-index: 1;
}

.step-text { line-height: 1.4; }
.step-title { font-weight: 500; font-size: 14px; }
.step-msg { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; }
.step-time { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }

/* États */
.stepper li[data-status="running"] { opacity: 1; }
.stepper li[data-status="running"] .step-icon {
  border-color: var(--primary);
  background: var(--primary);
  color: transparent;
  position: relative;
}
.stepper li[data-status="running"] .step-icon::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  animation: spin 0.7s linear infinite;
}
.stepper li[data-status="running"] .step-title { color: var(--primary); }

.stepper li[data-status="done"] { opacity: 1; }
.stepper li[data-status="done"] .step-icon {
  border-color: var(--vert);
  background: var(--vert);
  color: white;
}
.stepper li[data-status="done"] .step-icon::after { content: "✓"; }

.stepper li[data-status="skipped"] { opacity: 0.6; }
.stepper li[data-status="skipped"] .step-icon {
  border-color: var(--border);
  background: var(--bg);
  color: var(--text-muted);
}
.stepper li[data-status="skipped"] .step-icon::after { content: "–"; }

.stepper li[data-status="error"] { opacity: 1; }
.stepper li[data-status="error"] .step-icon {
  border-color: var(--rouge);
  background: var(--rouge);
  color: white;
}
.stepper li[data-status="error"] .step-icon::after { content: "✕"; }
.stepper li[data-status="error"] .step-title { color: var(--rouge); }

.big-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 18px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error {
  color: var(--rouge);
  margin: 14px 0 0;
  font-size: 14px;
}

/* ─── Results list ───────────────────────────────────────────────────── */
.results-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.result-item:hover {
  border-color: var(--primary);
  background: rgba(31, 78, 216, 0.03);
  transform: translateY(-1px);
}

.result-name { font-weight: 500; }
.result-meta { color: var(--text-muted); font-size: 13px; }
.result-siret { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }

/* ─── Verdict banner ─────────────────────────────────────────────────── */
.verdict-banner {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px 28px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  box-shadow: var(--shadow-md);
}

.verdict-banner.vert {
  background: var(--vert-bg);
  border-color: var(--vert);
  color: #14532d;
}

.verdict-banner.orange {
  background: var(--orange-bg);
  border-color: var(--orange);
  color: #7c2d12;
}

.verdict-banner.rouge {
  background: var(--rouge-bg);
  border-color: var(--rouge);
  color: #7f1d1d;
}

.verdict-icon {
  font-size: 32px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
}

.verdict-text { flex: 1; }
.verdict-color {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}

.verdict-name {
  font-size: 22px;
  font-weight: 600;
  margin-top: 2px;
}

.verdict-banner .btn-secondary {
  background: rgba(255, 255, 255, 0.7);
  color: inherit;
  border-color: rgba(0, 0, 0, 0.1);
}

/* ─── Signaux ────────────────────────────────────────────────────────── */
.category-block { margin-bottom: 18px; }
.category-block:last-child { margin-bottom: 0; }

.category-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.signal {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  border-left: 4px solid;
  margin-bottom: 6px;
  background: var(--bg);
}

.signal:last-child { margin-bottom: 0; }
.signal.vert { border-color: var(--vert); }
.signal.orange { border-color: var(--orange); }
.signal.rouge { border-color: var(--rouge); }

.signal-content { flex: 1; }
.signal-code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.signal-detail { font-size: 14px; }

/* ─── Notes ──────────────────────────────────────────────────────────── */
.notes-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.notes-list li {
  padding: 10px 14px;
  background: rgba(31, 78, 216, 0.06);
  border-left: 3px solid var(--primary);
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 14px;
}

/* ─── Enrichment ─────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-left: 6px;
  vertical-align: middle;
}
.badge-llm { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: white; }
.badge-confidence { background: var(--bg); color: var(--text-muted); }
.badge-confidence.high { background: var(--vert-bg); color: #14532d; }
.badge-confidence.medium { background: var(--orange-bg); color: #7c2d12; }
.badge-confidence.low { background: var(--rouge-bg); color: #7f1d1d; }

.kv {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px 16px;
  font-size: 14px;
}
.kv dt { color: var(--text-muted); font-weight: 500; }
.kv dd { margin: 0; word-break: break-word; }
.kv dd code { font-family: var(--font-mono); font-size: 13px; }
.kv dd a { color: var(--primary); text-decoration: none; }
.kv dd a:hover { text-decoration: underline; }

.kv-section {
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 14px;
}
.kv-section:first-child {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}
.kv-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}
.pill.ok { background: var(--vert-bg); color: #14532d; border-color: var(--vert); }
.pill.warn { background: var(--orange-bg); color: #7c2d12; border-color: var(--orange); }
.pill.bad { background: var(--rouge-bg); color: #7f1d1d; border-color: var(--rouge); }
.pill.muted { color: var(--text-muted); }

.enriched-marker {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
}

@media (max-width: 640px) {
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-top: 8px; font-size: 12px; }
}

.url-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 13px;
}
.url-list li {
  font-family: var(--font-mono);
  color: var(--text-muted);
  word-break: break-all;
  padding: 2px 0;
}

/* ─── Raw data ───────────────────────────────────────────────────────── */
.collapsible details summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.collapsible details summary::before {
  content: "▸";
  color: var(--text-muted);
  transition: transform 0.15s;
}
.collapsible details[open] summary::before { transform: rotate(90deg); }
.collapsible details summary h3 { display: inline; margin: 0; }

.raw-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 14px;
}

pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.55;
  overflow: auto;
  max-height: 320px;
  margin: 0;
}

/* ─── Footer ─────────────────────────────────────────────────────────── */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 28px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}
.footer code { font-family: var(--font-mono); }
.status.ok { color: var(--vert); }
.status.ko { color: var(--rouge); }

/* ─── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .search-form { grid-template-columns: 1fr; }
  .raw-grid { grid-template-columns: 1fr; }
  .verdict-banner { flex-wrap: wrap; }
  .container { padding: 0 12px 80px; margin-top: 16px; }
  .card { padding: 18px; }
}
