:root {
  --bg: #0a0d12;
  --surface: #12161f;
  --surface-2: #1a2029;
  --border: #262d3a;
  --text: #e8ecf3;
  --text-dim: #8a93a6;
  --accent: #3db9fc;
  --accent-dim: #1f4a63;
  --success: #7cffb2;
  --danger: #ff6b6b;
  --radius: 14px;
  --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
  --font-mono: 'DM Mono', 'SFMono-Regular', Consolas, monospace;
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

html, body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(120% 140% at 50% -10%, #141a24 0%, var(--bg) 55%);
  color: var(--text);
  font-family: var(--font-body);
}

.mono { font-family: var(--font-mono); }

a { color: var(--accent); }

button { font-family: var(--font-body); cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.topbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 48px 20px 20px;
  text-align: center;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.wordmark .accent { color: var(--accent); }
.wordmark .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px 2px var(--accent);
}

.tagline { color: var(--text-dim); font-size: 14px; }

.stage {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

.panel { animation: fadein .35s ease; }
.hidden { display: none !important; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Dropzone ---------- */
.dropzone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 64px 24px;
  text-align: center;
  transition: border-color .15s ease, background .15s ease;
  cursor: pointer;
}
.dropzone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.dz-icon { color: var(--accent); margin-bottom: 6px; }
.dz-title { font-family: var(--font-display); font-size: 19px; margin: 8px 0 4px; }
.dz-sub { color: var(--text-dim); font-size: 13.5px; margin: 0; }

/* ---------- File list ---------- */
.file-list { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.file-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.file-row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.file-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { color: var(--text-dim); font-size: 12.5px; flex-shrink: 0; }
.file-progress-track { height: 4px; border-radius: 2px; background: var(--surface-2); margin-top: 8px; overflow: hidden; }
.file-progress-fill { height: 100%; width: 0%; background: var(--accent); transition: width .15s ease; }
.file-row.complete .file-progress-fill { background: var(--success); }
.file-row.error .file-progress-fill { background: var(--danger); }

/* ---------- Expiry pills ---------- */
.expiry-block { margin-bottom: 18px; }
.expiry-label { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 8px; }
.pill-group { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  transition: all .12s ease;
}
.pill.active { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* ---------- Queue footer / buttons ---------- */
.queue-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.queue-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.total-size { color: var(--text-dim); font-size: 13px; }

.btn {
  border: none;
  border-radius: 999px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  transition: transform .1s ease, opacity .1s ease;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #06131c; }
.btn-ghost { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }

/* ---------- Global progress ---------- */
.global-progress { margin-top: 20px; }
.global-progress-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.global-progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--success)); transition: width .2s ease; }
.global-progress-bar + span, #globalProgressLabel { display: block; margin-top: 8px; color: var(--text-dim); font-size: 12.5px; text-align: right; }

/* ---------- Waybill (lien de partage) ---------- */
.waybill {
  border: 1.5px dashed var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 26px 24px;
  position: relative;
}
.waybill-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.waybill-eyebrow {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--success);
}
.waybill-expiry { font-size: 12.5px; color: var(--text-dim); }
.waybill-link-row { display: flex; gap: 10px; }
.waybill-link {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
}
.waybill-hint { color: var(--text-dim); font-size: 12.5px; margin: 14px 0 0; }
.new-transfer-btn { display: block; margin: 18px auto 0; }

.error-box {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255,107,107,.1);
  border: 1px solid var(--danger);
  color: var(--danger);
  font-size: 13.5px;
}

.footer { text-align: center; color: var(--text-dim); font-size: 12px; padding: 20px; opacity: .6; }

/* ================= Download page ================= */
.receipt {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
}
.receipt-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.receipt-title { font-family: var(--font-display); font-size: 18px; }
.receipt-meta { color: var(--text-dim); font-size: 12.5px; }

.dl-list { list-style: none; margin: 18px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.dl-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.dl-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-meta { color: var(--text-dim); font-size: 12px; flex-shrink: 0; margin-left: 10px; }
.dl-actions { display: flex; gap: 8px; align-items: center; }
.dl-icon-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--accent);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  text-decoration: none;
  display: inline-block;
}

.empty-state, .expired-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}
.expired-state .dz-icon { color: var(--danger); }

@media (max-width: 480px) {
  .queue-footer { flex-direction: column; align-items: stretch; }
  .queue-actions { margin-left: 0; }
  .dropzone { padding: 44px 16px; }
}
