/* IBM Plex — SIL Open Font License 1.1 (fonts/LICENSE-OFL.txt), servi localement : aucune ressource tierce. */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("/fonts/plex-sans-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("/fonts/plex-sans-500.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("/fonts/plex-sans-600.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 700; font-display: swap; src: url("/fonts/plex-sans-700.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("/fonts/plex-mono-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("/fonts/plex-mono-500.woff2") format("woff2"); }

:root {
  --ground: #f3f4f1;
  --surface: #ffffff;
  --surface-sunk: #f8f9f7;
  --track: #f0f1ee;
  --ink: #10151c;
  --ink-2: #4a525e;
  --muted: #59616d;
  --line: #dadde2;
  --line-soft: #eceeea;
  --field: #c9ced6;
  --dash: #b8bec7;
  --accent: #0b6e4f;
  --accent-soft: #e7f2ee;
  --on-accent: #ffffff;
  --empty: #e6e8e4;
  --danger: #a0271b;
  --danger-line: #e8c3be;
  --warn-bg: #fbf3e6;
  --warn-ink: #7a4508;
  --panel: #10151c;
  --panel-ink: #c9d1db;
  --panel-muted: #8b96a5;
  --panel-ok: #7fd1ae;
  --shadow: 0 1px 2px rgba(16, 21, 28, .04), 0 12px 32px rgba(16, 21, 28, .06);
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0e1116;
    --surface: #171b21;
    --surface-sunk: #12161b;
    --track: #1f242c;
    --ink: #e8ebef;
    --ink-2: #b4bcc7;
    --muted: #9aa3af;
    --line: #2a3039;
    --line-soft: #232830;
    --field: #3a414c;
    --dash: #48505c;
    --accent: #3fbf8f;
    --accent-soft: #15302a;
    --on-accent: #08130f;
    --empty: #262c34;
    --danger: #ff8a7e;
    --danger-line: #5a2a25;
    --warn-bg: #2e2412;
    --warn-ink: #f2c47a;
    --panel: #0a0d11;
    --panel-ink: #c9d1db;
    --panel-muted: #7d8897;
    --panel-ok: #7fd1ae;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .25);
  }
}

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

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ground);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon { width: 20px; height: 20px; flex: none; }
.icon-sm { width: 16px; height: 16px; }
.icon-accent { color: var(--accent); }

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1, h2, p, ol, ul, dl, dd, fieldset { margin: 0; }
fieldset { border: 0; padding: 0; min-width: 0; }

/* ------------------------------------------------------------------ Structure */

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 32px; }
main.wrap { flex: 1; padding-top: 32px; padding-bottom: 64px; display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  main.wrap { padding-top: 8px; padding-bottom: 32px; }
}

.topbar .wrap { padding-top: 24px; padding-bottom: 8px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.account-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; font-size: 15px; }
.account-nav a { color: var(--ink-2); text-decoration: none; padding: 10px 0; }
.account-nav a:hover, .account-nav a[aria-current="page"] { color: var(--ink); }
.account-nav a[aria-current="page"] { font-weight: 600; }
.account-email { color: var(--muted); font-size: 14px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-btn { padding: 10px 0; border: 0; background: none; color: var(--ink-2); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--ink); }
@media (max-width: 640px) { .account-email { display: none; } }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 36px; height: 36px; border-radius: 9px; background: var(--ink); color: var(--ground); display: grid; place-items: center; }

.footer { border-top: 1px solid var(--line); }
.footer-inner { padding-top: 20px; padding-bottom: 20px; display: flex; flex-wrap: wrap; gap: 8px 24px; font: 12px/1.5 var(--mono); color: var(--muted); }

.view { width: 100%; }
.narrow { max-width: 760px; margin: 0 auto; }
.narrow-sm { max-width: 600px; margin: 0 auto; }
.split { display: flex; flex-wrap: wrap; gap: 56px; align-items: flex-start; }
.split > .intro { flex: 1 1 420px; min-width: 0; padding-top: 24px; }
.split > .card { flex: 1 1 460px; min-width: 0; }
/* Écran étroit : le formulaire remonte juste sous l'accroche, les garanties passent dessous. */
@media (max-width: 900px) {
  .split { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 24px; }
  .split > .intro { display: contents; }
  .split > .card { order: 1; flex: none; }
  .intro > .guarantees, .intro > .server-view { order: 2; max-width: none; }
  .intro > .guarantees { margin-top: 8px; }
}

.stack, .stack-sm, .stack-lg { display: flex; flex-direction: column; }
.stack-sm { gap: 10px; }
.stack { gap: 20px; }
.stack-lg { gap: 24px; }
.row-between { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.wrap-row { flex-wrap: wrap; align-items: center; }
.min0 { min-width: 0; }
.grow { flex: 1; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.wrap-anywhere { overflow-wrap: anywhere; }
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ------------------------------------------------------------------ Typographie */

.eyebrow { font: 500 13px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.display { font-size: clamp(36px, 5vw, 52px); line-height: 1.05; letter-spacing: -.03em; font-weight: 700; }
.display-sm { font-size: clamp(26px, 4vw, 32px); line-height: 1.15; letter-spacing: -.02em; font-weight: 700; }
.lead { font-size: 18px; color: var(--ink-2); max-width: 460px; }
.title { font-size: 22px; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
.card-title { font-size: 20px; line-height: 1.3; font-weight: 600; }
.subtitle { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.label, .field > label, .field > legend { font-size: 14px; font-weight: 600; }
.muted { color: var(--muted); }
.normal { font-weight: 400; }
.strong { font-weight: 600; }
.small { font-size: 14px; }
.help { font-size: 13px; color: var(--muted); }
.mono-label { font: 13px/1.4 var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.big-num { font: 500 28px/1 var(--mono); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ Accueil */

.intro { display: flex; flex-direction: column; gap: 28px; }
.guarantees { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.guarantees li { display: flex; gap: 14px; align-items: flex-start; }
.guarantees .icon { width: 22px; height: 22px; margin-top: 1px; }
.guarantees strong { display: block; font-weight: 600; }

.server-view { background: var(--panel); color: var(--panel-ink); border-radius: 12px; padding: 20px 22px; font: 13px/1.8 var(--mono); max-width: 460px; }
.server-view-title { color: var(--panel-muted); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 8px; }
.server-view-row { display: flex; gap: 12px; min-width: 0; }
.server-view-row > span:first-child { color: var(--panel-muted); width: 88px; flex: none; }
.server-view .ok { color: var(--panel-ok); }

/* ------------------------------------------------------------------ Cartes */

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.card-outline { border: 1px solid var(--line); border-radius: 16px; padding: 24px 28px; }
@media (max-width: 640px) { .card { padding: 22px; } .card-outline { padding: 20px 22px; } }

/* ------------------------------------------------------------------ Formulaire */

.drop {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 40px 20px;
  border: 1.5px dashed var(--dash); border-radius: 12px;
  background: var(--surface-sunk);
  text-align: center; cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.drop:hover, .drop.over, .drop:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.drop.has-file { border-style: solid; border-color: var(--accent); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop-icon { width: 48px; height: 48px; border-radius: 50%; background: var(--accent-soft); display: grid; place-items: center; }
.drop-icon .icon { width: 22px; height: 22px; }
.drop-title { font-weight: 600; overflow-wrap: anywhere; }
.drop-hint { font-size: 14px; color: var(--muted); }
.drop-link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field > legend { padding: 0; margin-bottom: 10px; }

.segmented { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 4px; background: var(--track); border-radius: 10px; }
.segmented label { position: relative; }
.segmented input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.segmented span {
  display: grid; place-items: center; height: 40px; border-radius: 7px;
  font-size: 15px; font-weight: 500; color: var(--ink-2);
  transition: background-color .15s, color .15s, box-shadow .15s;
}
.segmented input:hover + span { color: var(--ink); }
.segmented input:checked + span { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(16, 21, 28, .14); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

input[type="password"], input[type="text"], input[type="email"] {
  width: 100%; min-width: 0; height: 48px; padding: 0 14px;
  font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--field); border-radius: 10px;
}
input[type="password"]:focus, input[type="text"]:focus, input[type="email"]:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
input::placeholder { color: var(--muted); }
.input-row { display: flex; gap: 8px; }

/* ------------------------------------------------------------------ Boutons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 44px; padding: 0 18px;
  font: 500 15px/1 var(--sans); color: var(--ink);
  background: var(--surface); border: 1px solid var(--field); border-radius: 10px;
  cursor: pointer; text-decoration: none;
  transition: background-color .15s, border-color .15s, opacity .15s;
}
.btn:disabled { opacity: .6; cursor: wait; }
.btn-lg { min-height: 52px; font-size: 16px; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-secondary:hover:not(:disabled) { border-color: var(--ink-2); }
.btn-danger { color: var(--danger); border-color: var(--danger-line); }
.btn-danger:hover:not(:disabled) { border-color: var(--danger); }
.icon-btn {
  width: 48px; height: 48px; flex: none; display: grid; place-items: center;
  color: var(--ink); background: var(--surface); border: 1px solid var(--field); border-radius: 10px; cursor: pointer;
}
.icon-btn[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.actions-between { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; }

/* ------------------------------------------------------------------ Progression */

.file-head { display: flex; gap: 16px; align-items: center; }
.file-icon { width: 52px; height: 52px; flex: none; border-radius: 12px; background: var(--track); display: grid; place-items: center; }
.file-icon .icon { width: 24px; height: 24px; }
.file-icon-accent { background: var(--accent-soft); color: var(--accent); }

.bar { height: 8px; border-radius: 4px; background: var(--empty); overflow: hidden; }
.bar-fill { width: 0; height: 100%; border-radius: 4px; background: var(--accent); transition: width .2s ease-out; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend .cell { width: 10px; height: 10px; border-radius: 2px; }

.blocks { display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); gap: 5px; }
.cell { display: block; aspect-ratio: 1; border-radius: 3px; background: var(--empty); transition: background-color .2s; }
.cell.is-active { background: var(--surface); box-shadow: inset 0 0 0 2px var(--accent); }
.cell.is-done { background: var(--accent); }
@media (max-width: 480px) { .blocks { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; } }

.steps { list-style: none; padding: 0; border-top: 1px solid var(--line-soft); }
.step { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); color: var(--muted); }
.step:last-child { border-bottom: 0; }
.step-label { flex: 1; }
.step-meta { font: 12px/1.4 var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.step-dot { width: 24px; height: 24px; flex: none; border-radius: 50%; border: 2px solid var(--field); display: grid; place-items: center; position: relative; }
.step-dot svg { width: 14px; height: 14px; stroke-width: 3; color: var(--on-accent); opacity: 0; }
.step.is-active { color: var(--ink); }
.step.is-active .step-label { font-weight: 600; }
.step.is-active .step-dot { border-color: var(--accent); }
.step.is-active .step-dot::after { content: ""; position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.step.is-done { color: var(--ink); }
.step.is-done .step-dot { border-color: var(--accent); background: var(--accent); }
.step.is-done .step-dot svg { opacity: 1; }

.checklist { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 15px; color: var(--muted); }
.checklist li { display: flex; align-items: center; gap: 10px; }
.checklist svg { width: 18px; height: 18px; stroke-width: 2.5; color: var(--field); }
.checklist .is-done { color: var(--ink); }
.checklist .is-done svg { color: var(--accent); }

/* ------------------------------------------------------------------ Résultat */

.status-head { display: flex; gap: 14px; align-items: flex-start; }
.status-dot { width: 40px; height: 40px; flex: none; margin-top: 2px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; }
.status-dot svg { width: 20px; height: 20px; stroke-width: 3; }
.status-dot.is-neutral { background: var(--track); color: var(--muted); }

.link-row { display: flex; flex-wrap: wrap; gap: 8px; }
.link-row .btn { min-height: 52px; font-size: 16px; }
.link-box {
  flex: 1 1 360px; min-width: 0; padding: 14px 16px;
  border: 1px solid var(--field); border-radius: 10px; background: var(--surface-sunk);
  font: 14px/1.6 var(--mono); overflow-wrap: anywhere; user-select: all;
}
.link-box.is-revoked { text-decoration: line-through; color: var(--muted); }
.link-key { color: var(--accent); font-weight: 500; }
.note { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.note .icon { margin-top: 2px; }

.facts { display: grid; gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: 10px; overflow: hidden; }
.facts-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.facts-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.facts > div { background: var(--surface); padding: 14px 16px; min-width: 0; }
.facts dt { font: 12px/1.4 var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.facts dd { font-weight: 600; }
@media (max-width: 560px) { .facts-3 { grid-template-columns: 1fr; } }

.two-step { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.two-step > div { display: flex; gap: 12px; align-items: flex-start; }
.two-step strong { display: block; font-weight: 600; }
.two-step .muted { font-size: 15px; }
.num { width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--ink); color: var(--ground); font: 13px/1 var(--mono); display: grid; place-items: center; }
@media (max-width: 560px) { .two-step { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ Réception */

.locked-head { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.locked-head .muted { max-width: 400px; }
.lock-badge { width: 64px; height: 64px; border-radius: 16px; background: var(--ink); color: var(--ground); display: grid; place-items: center; }
.lock-badge svg { width: 28px; height: 28px; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; font-size: 14px; }
.alert .icon { margin-top: 2px; }
.alert-warn { background: var(--warn-bg); color: var(--warn-ink); }
.alert-error { width: 100%; max-width: 760px; margin: 0 auto; border: 1px solid var(--danger-line); color: var(--danger); background: var(--surface); font-weight: 500; }

.unavailable { display: flex; flex-direction: column; align-items: center; gap: 20px; text-align: center; padding-top: 40px; }
.clock-badge { width: 72px; height: 72px; border-radius: 50%; border: 2px dashed var(--dash); color: var(--muted); display: grid; place-items: center; }
.clock-badge svg { width: 30px; height: 30px; }
.reasons { list-style: none; width: 100%; margin-top: 8px; padding: 20px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; gap: 12px; text-align: left; }
.reasons li { display: flex; gap: 12px; align-items: flex-start; }
.reasons li > span { font: 13px/1.5 var(--mono); color: var(--muted); margin-top: 2px; }
.reasons li.is-likely { font-weight: 600; }
.reasons li.is-likely > span { color: var(--accent); }

/* ------------------------------------------------------------------ Comptes */

.code-input { font-family: var(--mono); font-size: 20px !important; letter-spacing: .3em; text-align: center; }
.totp-setup { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-sunk); }
.qr { width: 172px; height: 172px; flex: none; padding: 10px; background: #ffffff; border-radius: 8px; }
.qr svg { display: block; width: 100%; height: 100%; }
.qr svg rect { fill: #10151c; stroke: none; }
.totp-setup > .stack-sm { flex: 1 1 200px; }
.secret-code { display: block; padding: 10px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); font: 500 14px/1.6 var(--mono); letter-spacing: .08em; overflow-wrap: anywhere; user-select: all; }

.manage-block { padding: 16px; border-radius: 12px; background: var(--surface-sunk); border: 1px solid var(--line-soft); }
.link-box-sm { font-size: 12px; color: var(--ink-2); flex-basis: 300px; }

/* ------------------------------------------------------------------ Mes envois */

.transfer-list { padding: 8px 28px; }
.transfers { list-style: none; padding: 0; }
.transfer { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 8px 20px; padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.transfer:last-child { border-bottom: 0; }
.transfer-main { display: flex; flex-direction: column; }
.transfer-name { font-weight: 600; color: var(--ink); text-decoration: none; }
a.transfer-name:hover { color: var(--accent); }
.transfer-name.is-unknown { color: var(--muted); font-weight: 500; }
.transfer-downloads { color: var(--muted); min-width: 64px; text-align: right; }
.empty { padding: 32px 0; }
@media (max-width: 640px) {
  .transfer-list { padding: 4px 22px; }
  .transfer { grid-template-columns: minmax(0, 1fr) auto; }
  .transfer-downloads { text-align: left; }
}

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 500; white-space: nowrap; background: var(--track); color: var(--ink-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-active { background: var(--accent-soft); color: var(--accent); }
.badge-progress { background: var(--warn-bg); color: var(--warn-ink); }
.badge-done { background: var(--ink); color: var(--ground); }

.timeline { list-style: none; padding: 0; display: flex; flex-direction: column; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li { position: relative; padding: 0 0 14px 20px; font-size: 15px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--field); }
.timeline li.is-accent::before { background: var(--accent); border-color: var(--accent); }
.timeline time { display: block; font: 12px/1.5 var(--mono); color: var(--muted); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
