/* Espace client Kadouk - mobile d'abord, clair uniquement */
:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --ink: #16141f;
  --muted: #5b5868;
  --line: #e3e0d8;
  --line-soft: #eeece6;
  --accent: #5b21b6;
  --accent-ink: #ffffff;
  --accent-soft: #efe9fb;
  --ok: #1d6b47;
  --ok-soft: #e3f3ea;
  --warn: #8a5600;
  --warn-soft: #fbf0d9;
  --bad: #a3262a;
  --bad-soft: #fbe7e7;
  --dev: #b45309;
  --pre: #1d5fa8;
  --prod: #1d6b47;
  --radius: 16px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --gutter: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased; overflow-wrap: break-word;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--accent); text-underline-offset: 3px; }
img, svg, video { max-width: 100%; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Structure ---------- */
.entete { background: var(--surface); border-bottom: 1px solid var(--line); }
.entete-in, .principal, .pied {
  width: 100%; max-width: 1080px; margin: 0 auto; padding-inline: var(--gutter);
}
.entete-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.marque { font: 500 1.35rem/1 var(--serif); letter-spacing: -.01em; color: var(--ink); text-decoration: none; display: inline-flex; align-items: baseline; gap: 10px; }
.marque b { font-weight: 500; }
.marque i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; transform: translateY(-1px); }
.marque small { display: none; font: 500 .78rem/1 var(--font); color: var(--muted); letter-spacing: .02em; }
.compte { display: flex; align-items: center; gap: 4px; min-width: 0; }
.compte-nom { font-size: .875rem; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 34vw; }

.onglets { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.onglets ul { display: grid; grid-template-columns: repeat(4, 1fr); max-width: 1080px; margin: 0 auto; padding-inline: calc(var(--gutter) - 6px); }
.onglets a {
  display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 6px;
  font-size: .875rem; font-weight: 500; color: var(--muted); text-decoration: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: opacity .12s, transform .12s;
}
.onglets a:active { transform: scale(.97); opacity: .7; }
.onglets a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

.principal { padding-block: 28px 56px; }
.pied { padding-block: 0 40px; color: var(--muted); font-size: .8125rem; }
.pied a { color: inherit; }

.titre { margin-bottom: 24px; }
.titre h1 { font: 400 clamp(1.75rem, 6vw, 2.5rem)/1.12 var(--serif); letter-spacing: -.02em; }
.titre p { color: var(--muted); margin-top: 8px; max-width: 56ch; }
.retour { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: 4px; font-size: .9rem; text-decoration: none; }

/* ---------- Boutons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px; border: 0; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink);
  font: 600 1rem/1 var(--font); text-decoration: none; cursor: pointer;
  transition: transform .12s ease-out, opacity .12s ease-out;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { opacity: .92; }
.btn:active { transform: scale(.97); opacity: .85; }
.btn.bloc { width: 100%; }
.btn[aria-busy="true"], .btn:disabled { opacity: .7; cursor: progress; pointer-events: none; }
.btn[aria-busy="true"]::before {
  content: ''; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: tourne .7s linear infinite;
}
.btn.sobre { background: var(--accent-soft); color: var(--accent); }
.lien {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; border: 0; background: none;
  font: 500 .9rem/1 var(--font); color: var(--accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
  transition: transform .12s, opacity .12s; white-space: nowrap;
}
.lien:active { transform: scale(.97); opacity: .6; }
.lien[aria-busy="true"] { opacity: .6; pointer-events: none; }
.lien.discret { color: var(--muted); text-decoration: none; font-weight: 500; }
@keyframes tourne { to { transform: rotate(360deg); } }

/* ---------- Cartes, pastilles ---------- */
.carte { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.pile { display: grid; gap: 20px; }
.pastille {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 600; line-height: 1.2; background: var(--line-soft); color: var(--muted); white-space: nowrap;
}
.pastille::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pastille.ok { background: var(--ok-soft); color: var(--ok); }
.pastille.warn { background: var(--warn-soft); color: var(--warn); }
.pastille.acc { background: var(--accent-soft); color: var(--accent); }
.vide { text-align: center; padding: 48px 24px; }
.vide h2 { font: 400 1.5rem/1.2 var(--serif); margin-bottom: 8px; }
.vide p { color: var(--muted); max-width: 44ch; margin: 0 auto; }
.vide .trait { width: 44px; height: 44px; margin: 0 auto 16px; border-radius: 12px; background: var(--accent-soft); display: grid; place-items: center; color: var(--accent); }

/* ---------- Projets ---------- */
.projet-tete { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 12px; }
.projet h2 { font: 400 1.5rem/1.2 var(--serif); letter-spacing: -.01em; }
.maj { color: var(--muted); font-size: .8125rem; margin-top: 4px; }
.resume { margin-top: 14px; color: #34323f; max-width: 70ch; }
.frise { display: grid; grid-template-columns: repeat(4, 1fr); margin: 24px 0 4px; counter-reset: e; }
.frise li { position: relative; text-align: center; font-size: .75rem; font-weight: 500; color: var(--muted); padding-top: 26px; }
.frise li::before { /* point */
  content: ''; position: absolute; top: 3px; left: 50%; width: 12px; height: 12px; margin-left: -6px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--line); z-index: 1;
}
.frise li::after { /* trait vers le point précédent */
  content: ''; position: absolute; top: 8px; right: 50%; width: 100%; height: 2px; background: var(--line);
}
.frise li:first-child::after { display: none; }
.frise li.fait { color: var(--ink); }
.frise li.fait::before { background: var(--accent); border-color: var(--accent); }
.frise li.fait::after { background: var(--accent); }
.frise li.actuel { color: var(--accent); font-weight: 700; }
.frise li.actuel::before { box-shadow: 0 0 0 4px var(--accent-soft); }
.frise .court { display: inline; } .frise .long { display: none; }
.progression { display: flex; align-items: center; gap: 12px; margin-top: 16px; font-size: .8125rem; color: var(--muted); }
.barre { flex: 1; height: 8px; border-radius: 99px; background: var(--line-soft); overflow: hidden; }
.barre span { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.liens { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 10px; }
.liens a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 500; font-size: .9375rem; }
.colonnes { display: grid; gap: 12px; margin-top: 20px; }
.col { background: var(--bg); border-radius: 12px; padding: 14px 14px 6px; }
.col h3 { display: flex; align-items: center; gap: 8px; font-size: .8125rem; font-weight: 600; letter-spacing: .01em; margin-bottom: 8px; }
.col h3::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.col h3 span { margin-left: auto; color: var(--muted); font-weight: 500; }
.col.dev { --c: var(--dev); } .col.pre { --c: var(--pre); } .col.prod { --c: var(--prod); }
.fonc { padding: 10px 0; border-top: 1px solid var(--line); }
.fonc:first-of-type { border-top: 0; }
.fonc b { display: block; font-size: .9375rem; font-weight: 600; }
.fonc p { font-size: .8125rem; color: var(--muted); margin-top: 2px; }
.rien { font-size: .8125rem; color: var(--muted); padding: 4px 0 10px; }
.avenir { margin-top: 12px; font-size: .875rem; }
.avenir summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--muted); font-weight: 500; }
.avenir ul { padding-bottom: 6px; }
.avenir li { padding: 8px 0; border-top: 1px solid var(--line-soft); }
.avenir li span { display: block; color: var(--muted); font-size: .8125rem; }

/* ---------- Contrats ---------- */
.liste { display: grid; gap: 12px; }
.ligne-contrat { display: grid; gap: 14px; align-items: center; }
.ligne-contrat h2 { font: 400 1.25rem/1.25 var(--serif); }
.ligne-contrat p { color: var(--muted); font-size: .875rem; margin-top: 6px; }
.ligne-contrat .btn { width: 100%; }

.signature-page { display: grid; gap: 20px; }
.pdf { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.pdf iframe, .pdf object { display: block; width: 100%; height: 58vh; min-height: 380px; border: 0; background: #ece9e1; }
.pdf-pied { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 16px; padding: 4px 16px; border-top: 1px solid var(--line); font-size: .8125rem; color: var(--muted); }
.empreinte { font: 400 .72rem/1.4 ui-monospace, 'SF Mono', Menlo, monospace; word-break: break-all; padding: 0 16px 12px; color: var(--muted); }
.empreinte b { font-family: var(--font); font-weight: 600; }
.form-sign h2 { font: 400 1.5rem/1.2 var(--serif); margin-bottom: 4px; }
.etape { display: flex; gap: 12px; padding-top: 20px; }
.etape + .etape { margin-top: 20px; border-top: 1px solid var(--line-soft); }
.etape-n { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .85rem; display: grid; place-items: center; margin-top: 2px; }
.etape-corps { flex: 1; min-width: 0; display: grid; gap: 14px; }
.etape h3 { font-size: 1rem; font-weight: 600; }
.champ { display: grid; gap: 6px; }
.champ label, .champ .lib { font-size: .875rem; font-weight: 600; }
.champ input[type=text], .champ input[type=email], .champ input[inputmode=numeric] {
  width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid #b9b5a9; border-radius: 12px;
  background: var(--surface); color: var(--ink); font: 400 1rem/1 var(--font);
}
.champ input:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.champ input[aria-invalid="true"] { border-color: var(--bad); }
.champ input.code { letter-spacing: .5em; font-size: 1.35rem; text-align: center; font-variant-numeric: tabular-nums; }
.aide { font-size: .8125rem; color: var(--muted); }
.erreur { color: var(--bad); font-size: .875rem; font-weight: 500; }
.coche { display: flex; gap: 12px; align-items: flex-start; min-height: 44px; font-size: .9375rem; cursor: pointer; }
.coche input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.zone-sig { position: relative; }
.zone-sig canvas {
  display: block; width: 100%; aspect-ratio: 3 / 1; background: #fff; border: 1px dashed #8d897b; border-radius: 12px;
  touch-action: none; cursor: crosshair;
}
.zone-sig canvas.actif { border-style: solid; border-color: var(--accent); }
.zone-sig .invite { position: absolute; inset: 0; display: grid; place-items: center; color: #7a7686; font-size: .875rem; pointer-events: none; }
.zone-sig-pied { display: flex; justify-content: space-between; align-items: center; }
.message { padding: 10px 14px; border-radius: 12px; font-size: .9rem; font-weight: 500; background: var(--ok-soft); color: var(--ok); }
.message.ko { background: var(--bad-soft); color: var(--bad); }
.message.info { background: var(--accent-soft); color: var(--accent); }
.signe-ok { display: grid; gap: 14px; }

/* ---------- Factures ---------- */
.facture-tete { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 8px 12px; }
.facture h2 { font: 400 1.5rem/1.2 var(--serif); }
.periode { color: var(--muted); font-size: .875rem; margin-top: 4px; }
.lignes { margin-top: 18px; border-top: 1px solid var(--line); }
.lignes li { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.lignes b { font-weight: 600; display: block; }
.lignes span.d { display: block; font-size: .8125rem; color: var(--muted); margin-top: 2px; }
.lignes .m { white-space: nowrap; font-weight: 500; }
.totaux { margin-top: 14px; display: grid; gap: 4px; margin-left: auto; max-width: 320px; }
.totaux div { display: flex; justify-content: space-between; gap: 16px; font-size: .9375rem; color: var(--muted); }
.totaux .ttc { color: var(--ink); font: 400 1.5rem/1.3 var(--serif); padding-top: 8px; border-top: 1px solid var(--line); margin-top: 4px; }
.calcul { margin-top: 20px; background: var(--bg); border-radius: 12px; padding: 14px 16px; }
.calcul summary { cursor: pointer; font-weight: 600; font-size: .9375rem; min-height: 44px; display: flex; align-items: center; }
.calcul ul { display: grid; gap: 8px; padding: 2px 0 8px; color: #34323f; font-size: .9375rem; }
.calcul li { padding-left: 16px; position: relative; }
.calcul li::before { content: ''; position: absolute; left: 0; top: .6em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.facture-pied { margin-top: 8px; margin-left: -6px; }

/* ---------- Résultats ---------- */
.kpis { display: grid; gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.kpi dt { font-size: .8125rem; font-weight: 500; color: var(--muted); }
.kpi dd { font: 400 2.25rem/1.15 var(--serif); letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi.principal-kpi { border-color: var(--accent); }
.kpi.principal-kpi dd { color: var(--accent); }
.bloc-titre { font: 400 1.35rem/1.25 var(--serif); margin-bottom: 4px; }
.sous { color: var(--muted); font-size: .875rem; margin-bottom: 16px; }
.graph svg { display: block; width: 100%; max-width: 560px; height: auto; margin: 0 auto; }
.graph .barre-g { fill: var(--accent); }
.graph .axe { stroke: var(--line); stroke-width: 1; }
.graph .axe-b { stroke: #b9b5a9; stroke-width: 1; }
.graph text { font-family: var(--font); fill: var(--muted); font-size: 11px; }
.graph text.val { fill: var(--ink); font-weight: 600; }
.donnees { margin-top: 12px; font-size: .875rem; }
.donnees summary { cursor: pointer; color: var(--accent); font-weight: 500; min-height: 44px; display: flex; align-items: center; }
.donnees table { width: 100%; border-collapse: collapse; margin-top: 4px; }
.donnees th, .donnees td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line-soft); }
.donnees th { font-weight: 600; color: var(--muted); font-size: .8125rem; }
.donnees td.r, .donnees th.r { text-align: right; font-variant-numeric: tabular-nums; }
.types { display: grid; gap: 16px; }
.types li > div:first-child { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; font-size: .9375rem; }
.types b { font-weight: 600; }
.types small { color: var(--muted); font-size: .8125rem; }
.types .piste { height: 8px; border-radius: 99px; background: var(--line-soft); margin-top: 6px; overflow: hidden; }
.types .piste span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.deux { display: grid; gap: 20px; }

/* ---------- Connexion, erreur, VSL ---------- */
.centre { min-height: 100dvh; display: grid; align-content: center; justify-items: center; padding: 32px var(--gutter); gap: 24px; }
.centre .marque { font-size: 1.6rem; }
.boite { width: 100%; max-width: 440px; }
.boite h1 { font: 400 1.75rem/1.2 var(--serif); letter-spacing: -.01em; }
.boite > p, .boite form > p { color: var(--muted); margin-top: 8px; }
.boite form { margin-top: 20px; display: grid; gap: 16px; }
.renvoi { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; }
.renvoi form { margin: 0; display: block; }

.vsl { max-width: 880px; margin: 0 auto; padding: 24px var(--gutter) 64px; display: grid; gap: 24px; }
.vsl h1 { font: 400 clamp(1.9rem, 7vw, 3rem)/1.1 var(--serif); letter-spacing: -.02em; }
.cadre-video { aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #0f0d18; display: grid; place-items: center; color: #e7e4f0; position: relative; }
.cadre-video video { width: 100%; height: 100%; display: block; background: #0f0d18; }
.preparation { text-align: center; padding: 24px; display: grid; gap: 12px; justify-items: center; }
.preparation b { font: 400 1.35rem/1.25 var(--serif); }
.preparation p { color: #b8b3c9; font-size: .9rem; }
.pulse { width: 44px; height: 4px; border-radius: 4px; background: #3a3550; overflow: hidden; position: relative; }
.pulse::after { content: ''; position: absolute; inset: 0; width: 40%; background: #fff; border-radius: 4px; animation: glisse 1.4s ease-in-out infinite; }
@keyframes glisse { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.cta { display: grid; gap: 8px; justify-items: start; }
.cta .btn { width: 100%; }

@media (min-width: 640px) {
  :root { --gutter: 28px; }
  .marque small { display: inline; }
  .compte-nom { max-width: none; font-size: .9375rem; }
  .onglets ul { display: flex; gap: 8px; }
  .onglets a { padding: 0 16px; }
  .principal { padding-block: 44px 72px; }
  .frise .court { display: none; } .frise .long { display: inline; }
  .frise li { font-size: .8125rem; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .ligne-contrat { grid-template-columns: 1fr auto; }
  .ligne-contrat .btn { width: auto; }
  .cta .btn { width: auto; }
  .carte { padding: 28px; }
}
@media (min-width: 960px) {
  .colonnes { grid-template-columns: repeat(3, 1fr); }
  .signature-page { grid-template-columns: minmax(0, 1.35fr) minmax(340px, 1fr); align-items: start; }
  .signature-page .form-sign { position: sticky; top: 76px; }
  .pdf iframe, .pdf object { height: 78vh; }
  .deux { grid-template-columns: 1.4fr 1fr; align-items: start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .btn:active, .lien:active, .onglets a:active { transform: none; }
  .btn[aria-busy="true"]::before { animation: none; border-right-color: currentColor; opacity: .5; }
  .pulse::after { animation: none; width: 100%; opacity: .5; }
}
