:root {
  --bg: #f5f5f8;
  --surface: #ffffff;
  --surface-2: #f0f0f5;
  --text: #16161d;
  --muted: #64647a;
  --border: #e2e2ea;
  --accent: #5b4cf0;
  --accent-ink: #ffffff;
  --accent-soft: #ecebfe;
  --ok: #137a4b;
  --ok-soft: #e2f5ea;
  --err: #c22f3c;
  --err-soft: #fdecee;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(20 20 40 / 5%), 0 6px 20px rgb(20 20 40 / 5%);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f14;
    --surface: #18181f;
    --surface-2: #20202a;
    --text: #ececf2;
    --muted: #9b9bb0;
    --border: #2b2b38;
    --accent: #8d81ff;
    --accent-ink: #0f0f14;
    --accent-soft: #26234a;
    --ok: #52d08f;
    --ok-soft: #15301f;
    --err: #ff7480;
    --err-soft: #3a1b20;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 880px;
  margin: 0 auto;
  padding: 20px 20px 0;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.logo { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); }
.logo svg { width: 22px; height: 22px; stroke-width: 2.4; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60vw;
}
.badge i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.badge.ok i { background: var(--ok); }
.badge.err i { background: var(--err); }

main { max-width: 880px; margin: 0 auto; padding: 0 20px 64px; }

.intro { padding: 40px 0 28px; }
.intro h1 { margin: 0 0 10px; font-size: clamp(26px, 4.4vw, 38px); line-height: 1.15; letter-spacing: -0.025em; }
.intro p { margin: 0; max-width: 60ch; color: var(--muted); font-size: 16px; }

.pipeline { display: flex; flex-wrap: wrap; gap: 6px; margin: 20px 0 0; padding: 0; list-style: none; counter-reset: step; }
.pipeline li {
  counter-increment: step;
  padding: 4px 12px 4px 6px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}
.pipeline li::before {
  content: counter(step);
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
}

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

.new-job { padding: 20px; display: grid; gap: 20px; }

.drop {
  display: block;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-empty { display: grid; justify-items: center; gap: 4px; padding: 36px 16px; text-align: center; }
.drop-empty svg { width: 32px; height: 32px; color: var(--accent); margin-bottom: 6px; }
.drop-empty span { color: var(--muted); font-size: 14px; }
.drop-file { display: flex; align-items: center; gap: 14px; padding: 18px; }
.drop-file svg { width: 32px; height: 32px; color: var(--accent); flex: none; }
.drop-file div { display: grid; min-width: 0; flex: 1; }
.drop-file strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop-file span { color: var(--muted); font-size: 14px; }
.drop-file .link { color: var(--accent); font-weight: 600; flex: none; }

fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; font-weight: 600; font-size: 14px; }

.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice > span {
  display: grid;
  gap: 2px;
  height: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  transition: border-color .15s, background .15s;
}
.choice small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.choice:hover > span { border-color: var(--muted); }
.choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.submit-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: filter .15s, background .15s;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); padding: 6px 10px; }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.ghost.danger:hover { background: var(--err-soft); color: var(--err); }
#submit { padding: 11px 22px; font-size: 15px; }

.upload { display: grid; gap: 4px; flex: 1; min-width: 180px; }
.upload small { color: var(--muted); }

.bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width .5s ease; }

.error { margin: 0; padding: 10px 14px; border-radius: 10px; background: var(--err-soft); color: var(--err); font-size: 14px; white-space: pre-wrap; }

.jobs-section h2 { margin: 40px 0 12px; font-size: 18px; }
#jobs { display: grid; gap: 12px; }
.empty { color: var(--muted); }

.job { padding: 18px 20px; display: grid; gap: 14px; }
.job-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.job-title { min-width: 0; }
.job-title h3 { margin: 0; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.pill { flex: none; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.running { background: var(--accent-soft); color: var(--accent); }
.pill.done { background: var(--ok-soft); color: var(--ok); }
.pill.error { background: var(--err-soft); color: var(--err); }

.progress { display: grid; gap: 6px; }
.progress-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; }

.steps { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.steps li { display: flex; align-items: center; gap: 6px; }
.steps li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--border); }
.steps li.done { color: var(--text); }
.steps li.done::before { background: var(--ok); border-color: var(--ok); }
.steps li.active { color: var(--accent); font-weight: 600; }
.steps li.active::before { background: var(--accent); border-color: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.steps li.failed { color: var(--err); }
.steps li.failed::before { background: var(--err); border-color: var(--err); }
@keyframes pulse { 50% { opacity: .35; } }

.result { display: grid; gap: 12px; }
.result video { width: 100%; max-height: 460px; border-radius: 10px; background: #000; }
.downloads { display: flex; flex-wrap: wrap; gap: 8px; }
.hint { margin: 0; color: var(--muted); font-size: 13px; }

.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; margin: -6px -8px -8px 0; }

@media (max-width: 520px) {
  .topbar { flex-wrap: wrap; }
  .new-job, .job { padding: 16px; }
  .job-head { flex-direction: column-reverse; }
}

/* ------------------------------------------------------------------ connexion */

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login { width: min(400px, 100%); padding: 28px; display: grid; gap: 16px; }
.login p { margin: 0; color: var(--muted); }
.login .error { color: var(--err); }
.field { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.field input, .share input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 400;
}
.field input:focus, .share input:focus { outline: none; border-color: var(--accent); }

/* ------------------------------------------------------------------ partage */

.topbar-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.share { margin-bottom: 20px; padding: 16px 20px; display: grid; gap: 10px; }
.share h2 { margin: 0; font-size: 15px; }
.share p { margin: 0; color: var(--muted); font-size: 14px; }
.share-row { display: flex; gap: 8px; }
.share-row input { flex: 1; min-width: 0; font-size: 14px; }
