/* ==========================================================================
   PatriFlux — portail commercial et client (prototype visuel)
   Reprend les tokens, la typographie et les composants de css/styles.css.
   ========================================================================== */

:root {
  --red: #ea0613; --red-hover: #c9050f; --ink: #180708; --slate: #6e6a66; --steel: #57534e; --smoke: #a39e97;
  --canvas: #f3f1ee; --white: #ffffff; --mist: #f9f8f6; --frost: #e4e1db;
  --rose-border: #f3b7bb; --rose-lilac: #f8d4d6; --rose-wash: #fdeceb; --deep: #5a0a10;
  --font: 'Inter Tight', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --max: 1320px; --gutter: 24px;
  --ease: cubic-bezier(.2, .7, .2, 1); --ease-io: cubic-bezier(.77, 0, .18, 1); --ease-back: cubic-bezier(.34, 1.56, .64, 1);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-weight: 300; font-size: 16px; line-height: 1.4; letter-spacing: -.01em;
  color: var(--ink); background: var(--canvas); font-feature-settings: "ss01", "tnum";
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; min-height: 100svh;
}
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img, svg { display: block; max-width: 100%; }
em { font-style: normal; color: var(--red); }
strong, b { font-weight: 400; }
::selection { background: var(--rose-lilac); color: var(--ink); }

.container { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Typographie ---------- */
.h1 { font-size: clamp(30px, 3.6vw, 44px); line-height: 1.05; letter-spacing: -.025em; font-weight: 300; }
.h2 { font-size: clamp(24px, 2.6vw, 32px); line-height: 1.08; letter-spacing: -.02em; font-weight: 300; }
.h3 { font-size: 20px; line-height: 1.15; letter-spacing: -.01em; font-weight: 300; }
.lead { font-size: clamp(16px, 1.3vw, 19px); line-height: 1.45; color: var(--slate); max-width: 60ch; }
.eyebrow { display: inline-flex; align-items: center; gap: 12px; font-size: 12px; font-weight: 400; letter-spacing: .08em; text-transform: uppercase; color: var(--smoke); }
.eyebrow::before { content: ""; width: 24px; height: 1px; background: var(--red); }
.small { font-size: 13px; color: var(--slate); line-height: 1.45; }
.tiny { font-size: 12px; color: var(--smoke); line-height: 1.45; }
.muted { color: var(--slate); }
.link { display: inline-flex; align-items: center; gap: 6px; color: var(--red); font-weight: 400; font-size: 14px; }
.link .arrow { display: inline-block; font-size: 18px; line-height: 0; transition: transform .35s var(--ease); }
.link:hover .arrow { transform: translateX(5px); }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; } .mt-5 { margin-top: 48px; }
.rule { border: 0; height: 1px; background: var(--frost); margin: 0; }

/* ---------- Barre supérieure ---------- */
.topbar { position: sticky; top: 0; z-index: 50; height: 64px; background: rgba(243, 241, 238, .9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--frost); }
.topbar-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand img { height: 30px; width: auto; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.space-tag { font-size: 11px; font-weight: 400; letter-spacing: .12em; text-transform: uppercase; color: var(--slate); }
.topnav { display: flex; gap: 2px; }
.topnav a { padding: 8px 12px; font-size: 14px; font-weight: 400; border-radius: 4px; color: var(--steel); transition: color .3s, background-color .3s; }
.topnav a.is-active, .topnav a:hover { color: var(--ink); background: #fff; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 400; padding: 5px 10px; border-radius: 9999px; border: 1px solid var(--frost); background: #fff; color: var(--steel); white-space: nowrap; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.pill svg { width: 12px; height: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 4px 4px 12px; border: 1px solid var(--frost); border-radius: 9999px; background: #fff; font-size: 13px; color: var(--ink); }
.user-chip span { color: var(--slate); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 400; letter-spacing: .04em; }

/* ---------- Coque ---------- */
.shell { padding: 40px 0 96px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head .lead { margin-top: 10px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Boutons (identiques au site) ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 15px 24px; border-radius: 4px; font-size: 14px; font-weight: 400; letter-spacing: -.01em; line-height: 1; white-space: nowrap;
  overflow: hidden; isolation: isolate; transition: color .35s, border-color .35s, background-color .35s, transform .5s var(--ease), opacity .35s;
}
.btn > * { position: relative; z-index: 1; }
.btn .arrow { display: inline-block; font-size: 18px; line-height: 0; transition: transform .35s var(--ease); }
.btn:hover .arrow { transform: translateX(4px); }
.btn::before { content: ""; position: absolute; inset: 0; z-index: 0; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary::before { background: var(--red-hover); transform: translateX(-110%) skewX(-12deg); transition: transform .5s var(--ease-io); }
.btn-primary:hover::before { transform: translateX(0) skewX(0); }
.btn-ghost { background: transparent; color: var(--red); border: 1px solid var(--rose-border); }
.btn-ghost::before { background: var(--rose-wash); transform: scaleY(0); transform-origin: bottom; transition: transform .4s var(--ease); }
.btn-ghost:hover { border-color: var(--red); }
.btn-ghost:hover::before { transform: scaleY(1); }
.btn-light { background: #fff; color: var(--red); border: 1px solid var(--frost); }
.btn-light::before { background: var(--rose-wash); transform: translateX(-110%) skewX(-12deg); transition: transform .5s var(--ease-io); }
.btn-light:hover::before { transform: translateX(0) skewX(0); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark::before { background: #000; transform: translateX(-110%) skewX(-12deg); transition: transform .5s var(--ease-io); }
.btn-dark:hover::before { transform: translateX(0) skewX(0); }
.btn-sm { padding: 11px 16px; font-size: 13px; }
.btn-block { width: 100%; }
.btn.is-locked, .btn[disabled] { background: var(--frost); color: var(--smoke); border-color: var(--frost); cursor: not-allowed; pointer-events: none; }
.btn.is-locked::before, .btn[disabled]::before { display: none; }
.btn svg { width: 15px; height: 15px; }
.ibtn { width: 34px; height: 34px; display: inline-grid; place-items: center; border: 1px solid var(--frost); border-radius: 4px; background: #fff; color: var(--steel); transition: border-color .3s, color .3s; }
.ibtn:hover { border-color: var(--red); color: var(--red); }
.ibtn svg { width: 15px; height: 15px; }

/* ---------- Panneaux ---------- */
.panel { background: #fff; border: 1px solid var(--frost); border-radius: 4px; }
.panel-pad { padding: 28px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 24px; border-bottom: 1px solid var(--frost); flex-wrap: wrap; }
.panel-head h2 { font-size: 18px; font-weight: 300; letter-spacing: -.01em; }
.panel-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.note { padding: 16px 18px; background: var(--rose-wash); border: 1px solid var(--rose-lilac); border-radius: 4px; font-size: 14px; line-height: 1.5; color: var(--ink); }
.note .k { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--red); font-weight: 400; margin-bottom: 6px; }
.note.grey { background: var(--mist); border-color: var(--frost); }
.note.grey .k { color: var(--smoke); }

/* ---------- Indicateurs ---------- */
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; margin-bottom: 28px; }
.kpi { background: #fff; border: 1px solid var(--frost); border-radius: 4px; padding: 20px 22px; position: relative; overflow: hidden; transition: border-color .35s; }
.kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--red); transform: scaleY(0); transform-origin: top; transition: transform .6s var(--ease); }
.kpi:hover { border-color: var(--rose-border); }
.kpi:hover::after { transform: scaleY(1); }
.kpi .k { font-size: 11px; font-weight: 400; letter-spacing: .1em; text-transform: uppercase; color: var(--smoke); }
.kpi .v { font-size: 30px; line-height: 1.1; letter-spacing: -.03em; margin-top: 10px; font-weight: 300; white-space: nowrap; }
.kpi .v small { font-size: 14px; color: var(--slate); letter-spacing: 0; margin-left: 4px; }
.kpi .s { font-size: 12px; color: var(--slate); margin-top: 8px; }
.kpi .s b { font-weight: 400; color: var(--red); }

/* ---------- Table ---------- */
.table-wrap { overflow: auto; }
.tbl { width: 100%; min-width: 1240px; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 400; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--smoke); padding: 12px 16px; border-bottom: 1px solid var(--frost); white-space: nowrap; }
.tbl td { padding: 14px 16px; border-bottom: 1px solid var(--frost); vertical-align: middle; color: var(--steel); }
.tbl tbody tr { transition: background-color .25s; }
.tbl tbody tr:hover { background: var(--mist); }
.tbl td.ref { font-weight: 400; color: var(--ink); white-space: nowrap; }
.tbl td.num { text-align: right; font-weight: 400; color: var(--ink); white-space: nowrap; }
.tbl .cab b { display: block; font-weight: 400; color: var(--ink); white-space: nowrap; }
.tbl td.of { white-space: nowrap; }
.tbl td.who { white-space: nowrap; }
.tbl .cab span { font-size: 12px; color: var(--slate); }
.tbl td.act { white-space: nowrap; text-align: right; min-width: 132px; }
.tbl td.dt { white-space: nowrap; font-size: 13px; }
.row-actions { display: inline-flex; gap: 6px; position: relative; }
.menu { position: absolute; right: 0; top: 40px; min-width: 240px; background: #fff; border: 1px solid var(--frost); border-radius: 4px; padding: 6px; z-index: 20; display: none; text-align: left; }
.menu.is-open { display: block; animation: fadeup .25s var(--ease); }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 3px; font-size: 13px; color: var(--ink); text-align: left; font-weight: 300; }
.menu button:hover, .menu a:hover { background: var(--mist); }
.menu hr { border: 0; border-top: 1px solid var(--frost); margin: 6px 0; }
.menu svg { width: 14px; height: 14px; color: var(--slate); flex: none; }

/* ---------- Statuts ---------- */
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 400; padding: 4px 10px 4px 8px; border-radius: 9999px; border: 1px solid var(--frost); background: #fff; color: var(--steel); white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--smoke); flex: none; }
.status[data-s="brouillon"] { color: var(--slate); }
.status[data-s="brouillon"]::before { background: #fff; border: 1px solid var(--smoke); width: 5px; height: 5px; }
.status[data-s="attente_signature"], .status[data-s="signature_en_cours"], .status[data-s="paiement_attente"], .status[data-s="paiement_en_cours"] { border-color: var(--rose-border); color: var(--red); background: var(--rose-wash); }
.status[data-s="attente_signature"]::before, .status[data-s="signature_en_cours"]::before, .status[data-s="paiement_attente"]::before, .status[data-s="paiement_en_cours"]::before { background: var(--red); }
.status[data-s="signature_en_cours"]::before, .status[data-s="paiement_en_cours"]::before { animation: pulse 1.6s infinite; }
.status[data-s="signee"] { border-color: var(--ink); color: var(--ink); }
.status[data-s="signee"]::before { background: var(--ink); }
.status[data-s="payee"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.status[data-s="payee"]::before { background: #fff; }
.status[data-s="expiree"], .status[data-s="annulee"] { color: var(--smoke); background: var(--mist); }
.status[data-s="expiree"]::before, .status[data-s="annulee"]::before { background: var(--frost); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* ---------- Formulaires ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 20px; }
.form-grid .span2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field label { font-size: 11px; font-weight: 400; letter-spacing: .1em; text-transform: uppercase; color: var(--slate); display: flex; justify-content: space-between; gap: 8px; }
.field label i { color: var(--red); font-style: normal; }
.field label .lk { font-size: 10px; color: var(--smoke); display: inline-flex; align-items: center; gap: 4px; text-transform: none; letter-spacing: 0; }
.field label .lk svg { width: 10px; height: 10px; }
.input, .field input, .field select, .field textarea {
  width: 100%; font: inherit; font-weight: 300; font-size: 15px; color: var(--ink); background: #fff; border: 1px solid var(--frost); border-radius: 4px;
  padding: 12px 14px; outline: none; transition: border-color .3s, box-shadow .3s; appearance: none; -webkit-appearance: none;
}
.field textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.field select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5l3.5 3.5 3.5-3.5' fill='none' stroke='%236e6a66' stroke-width='1.2'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--rose-wash); }
.field input[readonly], .field textarea[readonly] { background: var(--mist); color: var(--steel); }
.field input:disabled, .field textarea:disabled, .field select:disabled { background: var(--mist); color: var(--smoke); }
.field.is-error input, .field.is-error select, .field.is-error textarea { border-color: var(--red); }
.field .err { display: none; font-size: 12px; color: var(--red); }
.field.is-error .err { display: block; }
.field .hint { font-size: 12px; color: var(--smoke); }
.input-row { display: flex; gap: 8px; }
.input-row .input { flex: 1; }
.check-row { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--steel); }
.check-row input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--red); }

/* ---------- Connexion ---------- */
.login { min-height: 100svh; display: grid; grid-template-columns: 1.1fr .9fr; }
.login-left { position: relative; padding: 40px 48px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.login-bg { position: absolute; inset: 0; pointer-events: none; opacity: .75; background-image: linear-gradient(var(--frost) 1px, transparent 1px), linear-gradient(90deg, var(--frost) 1px, transparent 1px); background-size: 80px 80px; -webkit-mask-image: radial-gradient(ellipse 70% 65% at 70% 45%, #000 0%, transparent 70%); mask-image: radial-gradient(ellipse 70% 65% at 70% 45%, #000 0%, transparent 70%); animation: gridmove 28s linear infinite; }
@keyframes gridmove { to { background-position: 80px 80px; } }
.login-left > * { position: relative; }
.login-copy { max-width: 560px; }
.login-copy .h1 { font-size: clamp(34px, 4.2vw, 56px); margin-top: 20px; }
.login-copy .lead { margin-top: 18px; }
.login-points { display: flex; flex-direction: column; gap: 0; margin-top: 36px; max-width: 480px; }
.login-points li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--frost); font-size: 14px; color: var(--steel); }
.login-points li::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--red); margin-top: 7px; }
.login-right { background: #fff; border-left: 1px solid var(--frost); display: flex; align-items: center; justify-content: center; padding: 48px; }
.login-form { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 18px; }
.login-form .h2 { font-size: 26px; }

/* ---------- Assistant (wizard) ---------- */
.wizard { display: grid; grid-template-columns: 260px 1fr; gap: 32px; align-items: start; }
.steps { position: sticky; top: 88px; display: flex; flex-direction: column; }
.stepi { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--frost); color: var(--slate); font-size: 14px; align-items: flex-start; }
.stepi:last-child { border-bottom: 1px solid var(--frost); }
.stepi .n { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--frost); display: grid; place-items: center; font-size: 11px; font-weight: 400; background: #fff; transition: background-color .35s, border-color .35s, color .35s; }
.stepi.is-active { color: var(--ink); }
.stepi.is-active .n { background: var(--red); border-color: var(--red); color: #fff; }
.stepi.is-done .n { background: var(--ink); border-color: var(--ink); color: #fff; }
.stepi b { display: block; font-weight: 400; }
.stepi span { font-size: 12px; color: var(--smoke); }
.pane { display: none; }
.pane.is-active { display: block; animation: fadeup .5s var(--ease); }
@keyframes fadeup { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.pane-head { margin-bottom: 22px; }
.pane-head .h2 { margin-top: 6px; }
.pane-head .small { margin-top: 8px; max-width: 64ch; }
.pane-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--frost); flex-wrap: wrap; }
.pane-foot .grp { display: flex; gap: 8px; flex-wrap: wrap; }

/* Offres */
.fam { display: flex; gap: 6px; margin-bottom: 16px; }
.fam button { padding: 8px 14px; border: 1px solid var(--frost); border-radius: 9999px; font-size: 13px; font-weight: 400; background: #fff; color: var(--steel); transition: all .3s; }
.fam button.is-active { border-color: var(--ink); background: var(--ink); color: #fff; }
.picks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.pick { position: relative; background: #fff; border: 1px solid var(--frost); border-radius: 4px; padding: 20px; cursor: pointer; transition: border-color .3s, transform .25s; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.pick:hover { border-color: var(--rose-border); transform: translateY(-2px); }
.pick.is-selected { border-color: var(--red); }
.pick.is-selected::before { content: ""; position: absolute; top: -1px; left: -1px; right: -1px; height: 2px; background: var(--red); }
.pick .nm { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--smoke); font-weight: 400; }
.pick .pr { font-size: 26px; letter-spacing: -.03em; line-height: 1; }
.pick .pr small { font-size: 12px; color: var(--slate); letter-spacing: 0; margin-left: 4px; }
.pick .qt { font-size: 14px; color: var(--ink); }
.pick ul { font-size: 12px; color: var(--steel); display: flex; flex-direction: column; gap: 5px; border-top: 1px solid var(--frost); padding-top: 10px; margin-top: 2px; line-height: 1.4; }
.pick li { padding-left: 10px; position: relative; }
.pick li::before { content: ""; position: absolute; left: 0; top: 7px; width: 4px; height: 4px; border-radius: 50%; background: var(--red); }
.pick .chk { position: absolute; top: 14px; right: 14px; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--frost); display: grid; place-items: center; background: #fff; transition: all .3s; }
.pick.is-selected .chk { background: var(--red); border-color: var(--red); }
.pick .chk svg { width: 10px; height: 10px; opacity: 0; transition: opacity .3s; }
.pick.is-selected .chk svg { opacity: 1; }
.pick.custom { border-style: dashed; justify-content: center; align-items: flex-start; color: var(--slate); font-size: 14px; }
.pick.custom:hover { transform: none; }

/* Lignes de récapitulatif */
.rows { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: 220px 1fr; gap: 16px; padding: 12px 0; border-top: 1px solid var(--frost); font-size: 14px; }
.row:first-child { border-top: 0; }
.row .k { color: var(--slate); }
.row .v { color: var(--ink); font-weight: 400; line-height: 1.45; }
.row .v.light { font-weight: 300; color: var(--steel); }
.row.total { border-top: 1px solid var(--ink); margin-top: 6px; padding-top: 16px; align-items: baseline; }
.row.total .v { font-size: 28px; letter-spacing: -.03em; line-height: 1; }
.row.total .v small { font-size: 13px; color: var(--slate); letter-spacing: 0; margin-left: 6px; font-weight: 300; }

/* Assistance IA */
.ai { border: 1px solid var(--rose-lilac); background: var(--rose-wash); border-radius: 4px; padding: 18px 20px; }
.ai-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.ai-head h3 { font-size: 15px; font-weight: 400; display: flex; align-items: center; gap: 8px; }
.ai-head h3 svg { width: 14px; height: 14px; color: var(--red); }
.ai textarea { background: #fff; }
.ai-out { background: #fff; border: 1px solid var(--frost); border-radius: 4px; padding: 16px 18px; font-size: 14px; line-height: 1.5; display: none; margin-top: 12px; color: var(--steel); }
.ai-out.is-on { display: block; animation: fadeup .4s var(--ease); }
.ai-out h4 { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--smoke); font-weight: 400; margin: 14px 0 6px; }
.ai-out h4:first-child { margin-top: 0; }
.ai-out p { color: var(--ink); }
.ai-out mark { background: var(--rose-wash); color: var(--red); padding: 0 3px; border-radius: 2px; }
.ai-out ul li { padding: 4px 0 4px 14px; position: relative; }
.ai-out ul li::before { content: ""; position: absolute; left: 0; top: 11px; width: 5px; height: 5px; border-radius: 50%; background: var(--red); }
.ai-out ul li.ok::before { background: var(--ink); }
.ai-out ul li.warn { color: var(--red); }
.ai-foot { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; align-items: center; }
.ai-foot .tiny { flex: 1; }

/* Fenêtre modale */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(24, 7, 8, .45); display: none; align-items: center; justify-content: center; padding: 24px; }
.modal.is-open { display: flex; }
.modal-panel { background: #fff; border-radius: 4px; width: min(960px, 100%); max-height: 90vh; display: flex; flex-direction: column; animation: fadeup .4s var(--ease); }
.modal-panel.narrow { width: min(560px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 24px; border-bottom: 1px solid var(--frost); }
.modal-head h2 { font-size: 16px; font-weight: 400; }
.modal-body { overflow: auto; background: var(--mist); }
.modal-body.plain { background: #fff; padding: 24px; }
.modal-foot { display: flex; justify-content: space-between; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--frost); flex-wrap: wrap; align-items: center; }
.doc { padding: 56px 64px; max-width: 760px; margin: 24px auto; background: #fff; border: 1px solid var(--frost); font-size: 14px; line-height: 1.6; color: var(--ink); }
.doc h1 { font-size: 22px; font-weight: 300; letter-spacing: -.02em; margin-bottom: 4px; }
.doc .docsub { font-size: 12px; color: var(--smoke); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 24px; }
.doc h2 { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; font-weight: 400; color: var(--smoke); margin: 26px 0 8px; }
.doc p { margin: 0 0 10px; color: var(--steel); }
.doc .var { background: var(--rose-wash); color: var(--ink); padding: 0 4px; border-radius: 2px; font-weight: 400; }
.doc .locked { position: relative; padding-left: 14px; border-left: 2px solid var(--frost); margin-top: 22px; }
.doc .locked::before { content: "Clause protégée"; position: absolute; right: 0; top: -16px; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--smoke); }
.doc .sig { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 32px; }
.doc .sig div { border-top: 1px solid var(--ink); padding-top: 10px; font-size: 12px; color: var(--slate); }
.doc .sig .tab { display: inline-block; margin-top: 10px; padding: 8px 12px; border: 1px dashed var(--rose-border); color: var(--red); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }

/* Résultat de création */
.result { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.linkbox { display: flex; gap: 8px; align-items: center; background: var(--mist); border: 1px solid var(--frost); border-radius: 4px; padding: 8px 8px 8px 14px; font-size: 14px; color: var(--ink); font-weight: 400; overflow: hidden; }
.linkbox span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline li { display: grid; grid-template-columns: 14px 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--frost); font-size: 13px; color: var(--steel); }
.timeline li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--rose-border); background: #fff; margin-top: 5px; }
.timeline li.done::before { background: var(--ink); border-color: var(--ink); }
.timeline li.now::before { background: var(--red); border-color: var(--red); }
.timeline b { display: block; color: var(--ink); }

/* Activité */
.activity li { display: grid; grid-template-columns: 110px 1fr; gap: 16px; padding: 12px 0; border-top: 1px solid var(--frost); font-size: 13px; color: var(--steel); }
.activity li:first-child { border-top: 0; }
.activity .t { color: var(--smoke); white-space: nowrap; }
.activity b { color: var(--ink); }

/* ---------- Page client (CGP) ---------- */
.client { max-width: 880px; margin: 0 auto; padding: 40px var(--gutter) 96px; }
.client-head { margin-bottom: 24px; }
.client-head .h1 { margin-top: 10px; }
.client-head .lead { margin-top: 10px; }
.client-meta { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 16px; font-size: 14px; color: var(--slate); }
.client-meta b { font-weight: 400; color: var(--ink); }
.validity { display: flex; justify-content: space-between; align-items: center; gap: 24px; background: #fff; border: 1px solid var(--frost); border-radius: 4px; padding: 18px 24px; margin-bottom: 16px; position: relative; overflow: hidden; transition: border-color .6s, background-color .6s; }
.validity::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--red); transition: background-color .6s; }
.validity .lbl { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--smoke); font-weight: 400; margin-bottom: 6px; }
.validity .cnt { font-size: 34px; letter-spacing: -.03em; line-height: 1; font-weight: 300; white-space: nowrap; transition: color .6s; }
.validity .cnt small { font-size: 16px; color: var(--slate); letter-spacing: 0; }
.validity .exp { font-size: 13px; color: var(--slate); margin-top: 6px; }
.validity.is-soon { border-color: var(--rose-border); }
.validity.is-soon .cnt { color: var(--red); }
.validity.is-expired { background: var(--mist); }
.validity.is-expired::before { background: var(--smoke); }
.validity.is-expired .cnt { color: var(--smoke); font-size: 24px; }
.validity.is-signed::before { background: var(--ink); }
.validity.is-signed .cnt { font-size: 22px; }
.recap { background: #fff; border: 1px solid var(--frost); border-radius: 4px; padding: 28px 32px; margin-bottom: 16px; position: relative; }
.recap::before { content: ""; position: absolute; top: -1px; left: -1px; right: -1px; height: 2px; background: var(--red); border-radius: 4px 4px 0 0; }
.recap-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--frost); margin-bottom: 6px; }
.recap-head .nm { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--smoke); font-weight: 400; }
.recap-head h2 { font-size: 26px; font-weight: 300; letter-spacing: -.02em; margin-top: 4px; }
.recap .row { grid-template-columns: 240px 1fr; }
.stage { background: #fff; border: 1px solid var(--frost); border-radius: 4px; padding: 24px 28px; margin-bottom: 16px; display: grid; grid-template-columns: 44px 1fr; gap: 18px; transition: border-color .5s, opacity .5s; position: relative; }
.stage .n { width: 44px; height: 44px; border-radius: 4px; border: 1px solid var(--frost); display: grid; place-items: center; font-size: 12px; font-weight: 400; letter-spacing: .06em; color: var(--ink); background: var(--mist); transition: all .5s; }
.stage h3 { font-size: 19px; font-weight: 300; letter-spacing: -.01em; }
.stage .sub { font-size: 12px; color: var(--smoke); margin-top: 3px; letter-spacing: .04em; }
.stage p { color: var(--steel); font-size: 14px; line-height: 1.5; margin-top: 10px; }
.stage .act { margin-top: 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stage .prov { font-size: 12px; color: var(--smoke); display: flex; align-items: center; gap: 6px; margin-top: 12px; }
.stage .prov svg { width: 12px; height: 12px; }
.stage .lock { position: absolute; top: 24px; right: 24px; width: 16px; height: 16px; color: var(--smoke); display: none; }
.stage.is-locked { opacity: .62; }
.stage.is-locked .n { color: var(--smoke); }
.stage.is-locked .lock { display: block; }
.stage.is-done { border-color: var(--ink); }
.stage.is-done .n { background: var(--ink); border-color: var(--ink); color: #fff; }
.stage.is-active { border-color: var(--red); }
.stage.is-active .n { background: var(--red); border-color: var(--red); color: #fff; }
.stage.is-unlocking { animation: unlock 1.4s var(--ease); }
@keyframes unlock { 0% { opacity: .62; border-color: var(--frost); } 45% { opacity: 1; border-color: var(--red); transform: translateY(-3px); } 100% { opacity: 1; transform: none; } }
.done-meta { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--slate); margin-top: 10px; }
.done-meta b { font-weight: 400; color: var(--ink); }
.done-meta .ok { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.done-meta .ok svg { width: 14px; height: 14px; color: var(--red); }
.docs { display: flex; flex-direction: column; margin-top: 10px; }
.doc-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--frost); font-size: 14px; }
.doc-row:last-child { border-bottom: 1px solid var(--frost); }
.doc-row b { font-weight: 400; display: block; }
.doc-row span { font-size: 12px; color: var(--slate); display: block; }
.client-foot { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--frost); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--smoke); line-height: 1.5; }
.client-foot b { color: var(--ink); font-weight: 400; }

/* ---------- Confirmation ---------- */
.confirm-hero { text-align: center; padding: 16px 0 36px; }
.bigcheck { width: 72px; height: 72px; margin: 0 auto 22px; border-radius: 50%; border: 1px solid var(--rose-border); display: grid; place-items: center; background: #fff; }
.bigcheck svg { width: 30px; height: 30px; overflow: visible; }
.bigcheck path { fill: none; stroke: var(--red); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw 1s .3s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.confirm-hero .lead { margin: 12px auto 0; }
.next { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.next .panel { padding: 20px; }
.next .k { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--red); font-weight: 400; }
.next h4 { font-size: 16px; font-weight: 300; margin-top: 8px; }
.next p { font-size: 13px; color: var(--steel); margin-top: 6px; line-height: 1.5; }

/* ---------- Toast, démonstration, révélations ---------- */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 4px; font-size: 13px; opacity: 0; transition: opacity .3s, transform .3s; z-index: 200; pointer-events: none; white-space: nowrap; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.demo-bar { position: fixed; left: 16px; bottom: 16px; z-index: 150; display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--frost); border-radius: 9999px; padding: 6px 8px 6px 12px; font-size: 12px; color: var(--steel); flex-wrap: wrap; max-width: calc(100vw - 32px); }
.demo-bar b { font-weight: 400; color: var(--ink); margin-right: 4px; }
.demo-bar a { padding: 4px 9px; border-radius: 9999px; border: 1px solid var(--frost); white-space: nowrap; transition: all .25s; }
.demo-bar a:hover { border-color: var(--red); color: var(--red); }
.demo-bar a.is-on { background: var(--ink); color: #fff; border-color: var(--ink); }
[data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity .9s var(--ease), transform .9s var(--ease); transition-delay: calc(var(--d, 0) * 1ms); }
[data-reveal].is-in { opacity: 1; transform: none; }
.reveal-group > * { opacity: 0; transform: translateY(24px); transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: calc(var(--i, 0) * 80ms); }
.reveal-group.is-in > * { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  [data-reveal], .reveal-group > * { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px) {
  .wizard { grid-template-columns: 1fr; }
  .steps { position: static; flex-direction: row; overflow: auto; gap: 4px; }
  .stepi { border: 0 !important; padding: 8px 12px 8px 0; white-space: nowrap; }
  .stepi span { display: none; }
  .picks { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-left { min-height: 42vh; padding: 28px 24px; }
  .login-right { padding: 32px 24px; border-left: 0; border-top: 1px solid var(--frost); }
  .result { grid-template-columns: 1fr; }
  .next { grid-template-columns: 1fr; }
  .row, .recap .row { grid-template-columns: 1fr; gap: 4px; }
  .topnav { display: none; }
  .activity li { grid-template-columns: 1fr; gap: 2px; }
}
@media (max-width: 640px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .validity { flex-direction: column; align-items: flex-start; }
  .stage { grid-template-columns: 1fr; padding: 20px; }
  .stage .n { display: none; }
  .recap { padding: 20px; }
  .client { padding-top: 24px; }
  .doc { padding: 28px 20px; margin: 12px; }
  .panel-pad { padding: 20px; }
  .user-chip span { display: none; }
}
