:root {
  --accent: #0b3d91;
  --ink: #14181f;
  --muted: #5d6675;
  --line: #e3e6ec;
  --card: rgba(255, 255, 255, 0.94);
  --radius: 16px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #0d1424 var(--bg-image) center / cover no-repeat fixed;
}

.veil {
  position: fixed;
  inset: 0;
  background: linear-gradient(160deg, rgba(8, 14, 28, 0.55), rgba(8, 14, 28, 0.25));
  pointer-events: none;
}

.shell {
  position: relative;
  flex: 1;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
}

/* ---- Barre supérieure ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #fff;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: .02em; }
.logo-sm { height: 30px; width: auto; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 14px; min-width: 0; }
.user-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 13px;
  border: 2px solid rgba(255,255,255,.7);
}
.link { color: #fff; opacity: .85; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.4); }
.link:hover { opacity: 1; }

/* ---- Carte ---- */
.card {
  background: var(--card);
  backdrop-filter: blur(10px);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  border-top: 4px solid var(--accent);
}
.card h1 { margin: 0 0 4px; font-size: 24px; font-weight: 650; letter-spacing: -.01em; }
.tagline { margin: 0 0 24px; color: var(--muted); font-size: 14px; }

.card-login { text-align: center; padding: 44px 32px 32px; }
.card-login .logo { height: 64px; width: auto; margin-bottom: 18px; }
.card-login h1 { font-size: 28px; }
.fineprint { margin: 22px 0 0; font-size: 12px; color: var(--muted); }

/* ---- Boutons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 13px 18px;
  border-radius: 10px; border: 0;
  font: inherit; font-weight: 600; font-size: 15px;
  cursor: pointer; text-decoration: none;
  transition: transform .08s ease, box-shadow .15s ease, opacity .15s;
}
.btn:active { transform: translateY(1px); }
.btn-ms { background: #fff; color: var(--ink); border: 1px solid #c9ced8; }
.btn-ms:hover { box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.btn-ms svg { width: 20px; height: 20px; }
.btn-primary { background: var(--accent); color: #fff; margin-top: 8px; }
.btn-primary:hover:not(:disabled) { box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 45%, transparent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---- Zone de dépôt ---- */
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 36px 16px;
  border: 2px dashed #c4cad6; border-radius: 12px;
  background: #f7f8fb; color: var(--muted);
  cursor: pointer; text-align: center;
  transition: border-color .15s, background .15s;
}
.drop svg { width: 40px; height: 40px; color: var(--accent); margin-bottom: 6px; }
.drop strong { color: var(--ink); font-size: 15px; }
.drop span { font-size: 13px; }
.drop:hover, .drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, #fff); }

/* ---- Fichier choisi ---- */
.picked { margin-top: 20px; display: flex; flex-direction: column; gap: 18px; }
.file-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 6px;
  max-height: 320px; overflow-y: auto;
}
.file-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.fmeta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fstate { font-size: 12px; color: var(--muted); }
.fstate:empty { display: none; }
.file-row[data-state="uploading"], .file-row[data-state="converting"] { border-color: var(--accent); }
.file-row[data-state="converting"] .fstate { color: var(--accent); font-weight: 600; }
.file-row[data-state="done"] .fstate { color: #1e6b3a; font-weight: 600; }
.file-row[data-state="error"], .file-row[data-state="invalid"] { background: #fdf6f7; border-color: #f6c8cd; }
.file-row[data-state="error"] .fstate, .file-row[data-state="invalid"] .fstate { color: #a4161a; }
.fact { display: flex; }
.fact:empty { display: none; }
.badge {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  padding: 3px 8px; border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 12%, #fff); color: var(--accent);
}
.fname { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.fsize { color: var(--muted); font-size: 13px; white-space: nowrap; }
.icon-btn { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px; padding: 4px 6px; border-radius: 6px; }
.icon-btn:hover { background: #eef0f4; color: var(--ink); }

.opts { display: flex; flex-direction: column; gap: 14px; padding-top: 4px; }
.actions { display: flex; gap: 10px; }
.actions .btn-primary { flex: 2; margin-top: 0; }
.btn-ghost { flex: 1; background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn-ghost:hover:not(:disabled) { color: var(--ink); border-color: #c4cad6; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff;
  font: inherit; font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
  cursor: pointer; color: var(--ink);
}
.chip:hover { border-color: var(--accent); }
.chip[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip:disabled { opacity: .35; cursor: not-allowed; }

select {
  font: inherit; font-size: 15px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}

/* ---- Progression ---- */
.progress { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--muted); }
.bar { height: 8px; border-radius: 99px; background: #e8ebf1; overflow: hidden; }
#bar-fill { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .2s; }
.bar.busy #bar-fill {
  width: 35% !important;
  animation: slide 1.2s ease-in-out infinite;
}
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

.alert {
  margin: 0 0 16px; padding: 10px 14px; border-radius: 10px;
  background: #fdecee; color: #a4161a; font-size: 14px; border: 1px solid #f6c8cd;
}
.picked .alert { margin: 0; }
.alert.ok { background: #e9f7ef; color: #1e6b3a; border-color: #bfe5cd; }

/* ---- Signature ---- */
.signature {
  position: relative;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px;
  padding: 14px 16px 18px;
  font-size: 12px; color: rgba(255, 255, 255, .8); letter-spacing: .03em;
}
.signature .brand { font-weight: 700; color: #fff; }
.signature .sep { opacity: .5; }

@media (max-width: 480px) {
  .card { padding: 22px 18px; }
  .user-name { display: none; }
}
