:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --border: #e3e7ef;
  --text: #172033;
  --muted: #5d6779;
  --faint: #8b93a3;
  --brand: #1747d6;
  --brand-hover: #123aae;
  --brand-soft: #e8eefe;
  --ok: #138a4b;
  --ok-soft: #e5f6ec;
  --warn: #b26a00;
  --warn-soft: #fff4df;
  --danger: #c62f2f;
  --danger-soft: #fdeaea;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .06);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1220;
    --surface: #161b2c;
    --surface-2: #1c2236;
    --border: #2a3149;
    --text: #e8ebf3;
    --muted: #a3abbe;
    --faint: #7c859b;
    --brand: #5b84ff;
    --brand-hover: #7a9bff;
    --brand-soft: #1f2b52;
    --ok: #3ccb7f;
    --ok-soft: #12321f;
    --warn: #f0b04a;
    --warn-soft: #3a2b10;
    --danger: #ff6b6b;
    --danger-soft: #3d1717;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
small, .muted { color: var(--muted); }
.faint { color: var(--faint); }
[hidden] { display: none !important; }

/* ---------- En-tête ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 24px; max-width: 1180px; width: 100%; margin: 0 auto;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--text); }
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: #fff;
  display: grid; place-items: center;
}
.nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.nav a, .nav button.linklike {
  color: var(--muted); padding: 8px 12px; border-radius: 8px; font-weight: 500; font-size: .95rem;
}
.nav a:hover, .nav button.linklike:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.nav a.primary { background: var(--brand); color: #fff; }
.nav a.primary:hover { background: var(--brand-hover); }

main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 12px 24px 48px; }
footer { text-align: center; color: var(--faint); font-size: .85rem; padding: 18px; }

/* ---------- Cartes ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px;
}
.stack > * + * { margin-top: 14px; }
.center-wrap { max-width: 560px; margin: 24px auto 0; }

/* ---------- Page d'envoi ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 460px); gap: 40px; align-items: start; margin-top: 16px; }
.hero-text h1 { font-size: 2.3rem; letter-spacing: -.02em; margin-top: 30px; }
.hero-text p { font-size: 1.08rem; color: var(--muted); max-width: 46ch; }
.features { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 12px; }
.features li { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); }
.features svg { flex: 0 0 auto; color: var(--brand); margin-top: 2px; }
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 8px; }
  .hero-text h1 { font-size: 1.8rem; margin-top: 4px; }
  .features { display: none; }
}

.dropzone {
  border: 2px dashed var(--border); border-radius: 12px; padding: 26px 16px; text-align: center;
  cursor: pointer; transition: border-color .15s, background .15s; background: var(--surface-2);
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.dropzone .icon { width: 46px; height: 46px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; margin: 0 auto 10px; }
.dropzone strong { display: block; font-size: 1.02rem; }
.dropzone .links { margin-top: 6px; font-size: .9rem; }
.dropzone .links button { background: none; border: 0; color: var(--brand); cursor: pointer; font: inherit; padding: 0 2px; }

.file-list { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.file-list li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--border); }
.file-list li:first-child { border-top: 0; }
.file-list .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .fsize { color: var(--faint); font-size: .85rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.file-list .ok { color: var(--ok); }
.icon-btn { background: none; border: 0; color: var(--faint); cursor: pointer; padding: 4px; border-radius: 6px; display: grid; place-items: center; }
.icon-btn:hover { color: var(--danger); background: var(--danger-soft); }
.summary-line { display: flex; justify-content: space-between; font-size: .88rem; color: var(--muted); }
.summary-line .over { color: var(--danger); font-weight: 600; }

.tabs { display: flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.tabs button { flex: 1; border: 0; background: none; padding: 8px; border-radius: 8px; font: inherit; color: var(--muted); cursor: pointer; font-weight: 500; }
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ---------- Formulaires ---------- */
label { display: block; font-weight: 500; font-size: .9rem; margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--text); font: inherit;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .row { grid-template-columns: 1fr; } }
.hint { font-size: .82rem; color: var(--faint); margin-top: 4px; }
details.options summary { cursor: pointer; color: var(--muted); font-weight: 500; font-size: .92rem; list-style: none; }
details.options summary::-webkit-details-marker { display: none; }
details.options summary::before { content: "▸ "; }
details.options[open] summary::before { content: "▾ "; }
details.options > div { margin-top: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 600;
  cursor: pointer; background: var(--brand); color: #fff; transition: background .15s;
}
.btn:hover { background: var(--brand-hover); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 6px 11px; font-size: .85rem; border-radius: 8px; }
.btn.ghost { background: none; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

.alert { padding: 11px 14px; border-radius: 10px; font-size: .92rem; }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.info { background: var(--brand-soft); color: var(--brand); }

/* ---------- Progression ---------- */
.progress-ring { display: grid; place-items: center; margin: 8px auto 4px; position: relative; width: 170px; height: 170px; }
.progress-ring svg { transform: rotate(-90deg); }
.progress-ring .pct { position: absolute; font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.progress-bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.progress-bar > div { height: 100%; background: var(--brand); width: 0; transition: width .3s; }
.stats-line { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }

.link-box { display: flex; gap: 8px; }
.link-box input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .88rem; }
.success-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; margin: 0 auto 8px; }

/* ---------- Téléchargement ---------- */
.dl-head { display: flex; gap: 14px; align-items: center; }
.dl-head .badge-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: 0 0 auto; }
.message-box { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; white-space: pre-wrap; word-wrap: break-word; }
.dl-list li a.btn { flex: 0 0 auto; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-weight: 600; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tag.brand { background: var(--brand-soft); color: var(--brand); }
.ellipsis { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.kpi .label { color: var(--muted); font-size: .85rem; }
.kpi .value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0 18px; }

/* ---------- Toast & modale ---------- */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-weight: 500;
  transition: all .25s; z-index: 50; pointer-events: none; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 22px; width: min(440px, calc(100% - 32px)); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(10, 15, 30, .45); }

.spinner { width: 20px; height: 20px; border: 2.5px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 600px) {
  .topbar { padding: 12px 16px; }
  main { padding: 8px 16px 40px; }
  .card { padding: 18px; }
  .nav a, .nav button.linklike { padding: 7px 8px; }
}
#resumeBanner { margin-bottom: 14px; }
@media (max-width: 480px) {
  .nav > a:first-child { display: none; }
  .nav a.primary { padding: 7px 10px; }
  .logo { font-size: 1rem; }
}
.logo, .nav a { white-space: nowrap; }
@media (max-width: 480px) { .nav { flex-wrap: nowrap; gap: 2px; } }
@media (max-width: 480px) { .topbar { gap: 6px; } .nav a { padding: 7px 7px; } .logo-mark { width: 30px; height: 30px; } }
