/* ==========================================================================
   Relance — pages intérieures : confidentialité, mentions légales,
   compte et autorisation de l'assistant IA
   ========================================================================== */

/* États initiaux posés avant le premier rendu */
.motion [data-hero="fade"], .motion [data-float], .motion .nav-inner { opacity: 0; }
.motion [data-split="hero"] { visibility: hidden; }

.hidden { display: none !important; }

/* --- En-tête de page ---------------------------------------------------- */
.page-hero { position: relative; padding: 176px 0 var(--s80); overflow: clip; }
.page-hero .wrap { position: relative; z-index: 2; display: grid; gap: 24px; justify-items: start; }
.page-hero h1 { max-width: 14ch; }
.page-hero .lead { max-width: 38em; }
.page-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.page-meta .chip { background: var(--mist); }
.page-arts { position: absolute; inset: 0; pointer-events: none; max-width: 1400px; margin: 0 auto; }
.page-arts .artifact { position: absolute; }
@media (max-width: 900px) { .page-hero { padding-top: 128px; padding-bottom: var(--s64); } .page-arts { display: none; } }

/* Barre de lecture */
.read-progress { position: fixed; left: 0; right: 0; top: 0; height: 2px; z-index: 60; pointer-events: none; }
.read-progress i { display: block; height: 100%; background: var(--ink); transform: scaleX(0); transform-origin: left; }

/* --- Document long : sommaire + contenu --------------------------------- */
.doc-wrap { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: clamp(40px, 7vw, 112px); align-items: start; padding-bottom: var(--section); }
.toc { position: sticky; top: 112px; }
.toc p { font-size: 14px; color: var(--ash); margin-bottom: 14px; }
.toc ol { counter-reset: toc; display: grid; gap: 2px; border-left: 1px solid var(--hairline); }
.toc li { counter-increment: toc; }
.toc a { position: relative; display: flex; gap: 12px; padding: 7px 0 7px 18px; font-size: 15px; color: var(--slate); line-height: 1.35; transition: color .4s; }
.toc a::before { content: counter(toc, decimal-leading-zero); font-variant-numeric: tabular-nums; color: var(--smoke); font-size: 13px; padding-top: 1px; transition: color .4s; }
.toc a::after { content: ""; position: absolute; left: -1px; top: 6px; bottom: 6px; width: 1px; background: var(--ink); transform: scaleY(0); transition: transform .5s var(--ease-out); }
.toc a:hover { color: var(--ink); }
.toc a.is-active { color: var(--ink); }
.toc a.is-active::before { color: var(--ink); }
.toc a.is-active::after { transform: scaleY(1); }

.doc { max-width: 720px; min-width: 0; }
.doc > section { padding-top: var(--s64); scroll-margin-top: 96px; }
.doc > section:first-child { padding-top: 0; }
.doc h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(30px, 3.2vw, 40px); letter-spacing: -0.015em; line-height: 1.15; margin-bottom: 22px; display: flex; gap: 16px; align-items: baseline; }
.doc h2 .n { font-size: .5em; color: var(--ash); font-variant-numeric: tabular-nums; flex: none; transform: translateY(-.3em); }
.doc h3 { font-size: 19px; font-weight: 500; letter-spacing: -0.01em; margin: 30px 0 10px; }
.doc p, .doc li { font-size: 17px; line-height: 1.65; color: #3d4047; }
.doc p + p, .doc p + ul, .doc ul + p, .doc .table-wrap + p { margin-top: 14px; }
.doc ul { display: grid; gap: 8px; margin-top: 10px; }
.doc ul li { position: relative; padding-left: 24px; }
.doc ul li::before { content: ""; position: absolute; left: 2px; top: .8em; width: 10px; height: 1px; background: var(--ink); }
.doc a:not(.pill) { color: var(--ink); text-decoration: underline; text-decoration-color: rgba(23, 25, 28, .25); text-underline-offset: 3px; transition: text-decoration-color .3s; }
.doc a:not(.pill):hover { text-decoration-color: var(--ink); }
.doc strong { font-weight: 500; color: var(--ink); }
.table-wrap { margin-top: 18px; overflow-x: auto; border-radius: var(--r-small); background: var(--fog); border: 1px solid var(--hairline); }
.doc table { width: 100%; border-collapse: collapse; font-size: 15px; }
.doc th { text-align: left; font-weight: 500; font-size: 13.5px; color: var(--slate); padding: 14px 18px; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
.doc td { padding: 14px 18px; vertical-align: top; line-height: 1.5; color: #3d4047; }
.doc tbody tr + tr td { border-top: 1px solid var(--hairline); }
.doc td:first-child { color: var(--ink); font-weight: 450; }

/* Carte d'accent « L'essentiel » (une seule par page) */
.keypoints { background: var(--peach); color: var(--sienna); border-radius: var(--r-card); padding: clamp(28px, 4vw, 48px); margin-bottom: var(--s16); }
.keypoints .tag { color: var(--sienna); opacity: .75; margin-bottom: 14px; }
.keypoints h2 { color: var(--sienna); margin-bottom: 20px; }
.keypoints ul { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 32px; }
.keypoints li { color: var(--sienna); font-size: 16px; line-height: 1.5; padding-left: 26px; }
.keypoints li::before { background: var(--sienna); }
@media (max-width: 700px) { .keypoints ul { grid-template-columns: 1fr; } }

/* Fiches d'identité (mentions légales) */
.id-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.id-card { background: var(--mist); border-radius: var(--r-card); padding: 24px; display: grid; gap: 4px; align-content: start; }
.id-card .ncard-ic { margin-bottom: 20px; }
.id-card small { font-size: 13.5px; color: var(--ash); }
.id-card b { font-weight: 500; font-size: 17px; }
.id-card p { font-size: 15px !important; line-height: 1.55 !important; color: var(--slate) !important; margin: 0 !important; }
.id-list { margin-top: 18px; border-top: 1px solid var(--hairline); }
.id-list div { display: grid; grid-template-columns: 220px 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--hairline); font-size: 16px; }
.id-list dt { color: var(--slate); }
.id-list dd { margin: 0; color: var(--ink); }
@media (max-width: 700px) { .id-cards { grid-template-columns: 1fr; } .id-list div { grid-template-columns: 1fr; gap: 2px; } }

@media (max-width: 960px) {
  .doc-wrap { grid-template-columns: 1fr; }
  .toc { position: static; background: var(--fog); border-radius: var(--r-card); padding: 20px 20px 14px; }
  .toc ol { border-left: 0; }
  .toc a { padding-left: 0; }
  .toc a::after { display: none; }
}

/* ==========================================================================
   Compte
   ========================================================================== */
.acct-body { background: var(--paper); }
.nav-simple .nav-inner { justify-content: space-between; }
.nav-simple .nav-cta { gap: 18px; }
.back-link { font-size: 15px; color: var(--slate); display: inline-flex; align-items: center; gap: 8px; transition: color .3s; }
.back-link:hover { color: var(--ink); }
.back-link svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transform: rotate(180deg); }

.acct-page { min-height: 100vh; min-height: 100svh; }
.acct-split { min-height: 100vh; min-height: 100svh; display: grid; grid-template-columns: 1.05fr 1fr; }
.acct-aside { position: relative; background: var(--fog); padding: 160px clamp(32px, 5vw, 80px) 64px; overflow: hidden; display: flex; flex-direction: column; gap: 22px; }
.acct-aside h2 { max-width: 15ch; }
.acct-aside .lead { max-width: 26em; }
.aside-arts { position: relative; flex: 1; min-height: 300px; margin-top: 24px; }
.aside-arts .artifact { position: absolute; }
.acct-main { display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 140px var(--gutter) 64px; min-width: 0; }
.acct-main > section { min-width: 0; max-width: 100%; }

.auth { width: 100%; max-width: 440px; display: grid; gap: 22px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--mist); border-radius: var(--r-pill); padding: 4px; position: relative; }
.tabs button { position: relative; z-index: 1; height: 40px; border-radius: var(--r-pill); font-size: 15px; color: var(--slate); transition: color .4s; }
.tabs button[aria-selected="true"] { color: var(--ink); }
.tabs .tab-ink { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: var(--r-pill); background: var(--paper); box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 2px 8px rgba(0, 0, 0, .05); transition: transform .6s var(--ease-out); }
.tabs[data-active="signin"] .tab-ink { transform: translateX(100%); }
.tabs[data-active="reset"] .tab-ink { opacity: 0; }
.auth h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(36px, 3.6vw, 44px); letter-spacing: -0.015em; line-height: 1.12; }
.auth-sub { color: var(--slate); font-size: 16px; margin-top: -10px; }
.form { display: grid; gap: 14px; }
.field-l { display: grid; gap: 6px; font-size: 14px; color: var(--slate); }
.field-l input {
  width: 100%; height: 52px; padding: 0 16px;
  font: inherit; font-size: 16px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--hairline); border-radius: var(--r-input);
  transition: border-color .3s, box-shadow .3s;
}
.field-l input::placeholder { color: var(--smoke); }
.field-l input:hover { border-color: #dcdcdf; }
.field-l input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px rgba(23, 25, 28, .06); }

.acct button:not(.tabs button):not(.menu-btn), .acct .btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: var(--r-pill);
  border: 1px solid var(--ink); background: transparent; color: var(--ink);
  font-size: 15px; white-space: nowrap; overflow: hidden; isolation: isolate;
  transition: color .45s var(--ease-out), background-color .45s, opacity .3s;
}
.acct button:not(.tabs button):not(.menu-btn)::before, .acct .btn::before {
  content: ""; position: absolute; inset: -1px; z-index: -1; border-radius: inherit; background: var(--ink);
  transform: translateY(101%); transition: transform .55s var(--ease-out);
}
.acct button:not(.tabs button):not(.menu-btn):hover:not(:disabled), .acct .btn:hover { color: #fff; }
.acct button:not(.tabs button):not(.menu-btn):hover:not(:disabled)::before, .acct .btn:hover::before { transform: translateY(0); }
.acct .primary { background: var(--ink) !important; color: #fff !important; }
.acct .primary::before { background: #2b2e33 !important; }
.acct .full { width: 100%; height: 52px !important; font-size: 16px !important; margin-top: 6px; }
.acct button:disabled { opacity: .5; cursor: progress; }
.acct button.link { height: auto !important; padding: 0 !important; border: 0 !important; background: none !important; color: var(--slate) !important; font-size: 14.5px !important; overflow: visible; }
.acct button.link::before { display: none; }
.acct button.link:hover { color: var(--ink) !important; }
.forgot-row { text-align: center; }

.message { border-radius: 14px; padding: 12px 16px; font-size: 14.5px; line-height: 1.45; }
.message.error { background: #fbeaea; color: #8a2a1f; }
.message.success { background: var(--mist); color: var(--ink); }
.auth-legal { font-size: 13px; color: var(--ash); text-align: center; line-height: 1.5; }
.auth-legal a { color: var(--slate); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(0, 0, 0, .2); }

/* Espace client */
.account { width: 100%; max-width: 760px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.step-card > div { min-width: 0; }
.account-head { display: grid; gap: 12px; margin-bottom: 10px; }
.account-head h1 { font-family: var(--serif); font-weight: 400; font-size: var(--t-h-lg); letter-spacing: -0.015em; line-height: 1.08; }
.account-head h1 span { font-style: italic; }
.journey { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ash); margin-top: 4px; }
.journey-bar { flex: 1; max-width: 220px; height: 2px; background: var(--mist); border-radius: 2px; overflow: hidden; }
.journey-bar i { display: block; height: 100%; background: var(--ink); transform-origin: left; transition: transform 1s var(--ease-out); }
.steps { display: grid; gap: 10px; }
.step-card { display: grid; grid-template-columns: 48px 1fr auto; gap: 18px; align-items: center; background: var(--mist); border-radius: var(--r-card); padding: 20px 22px; transition: background-color .5s, box-shadow .5s; }
.step-card .num { width: 48px; height: 48px; border-radius: 50%; background: var(--paper); display: grid; place-items: center; font-family: var(--serif); font-size: 20px; box-shadow: 0 0 0 1px var(--hairline); transition: background-color .5s, color .5s; }
.step-card.done .num { background: var(--ink); color: #fff; box-shadow: none; font-family: var(--sans); font-size: 18px; }
.step-card.current { background: var(--paper); box-shadow: var(--sh-float); }
.step-card h2 { font-size: 18px; font-weight: 500; letter-spacing: -0.01em; }
.step-card p { font-size: 15px; color: var(--slate); line-height: 1.45; margin-top: 2px; }
.step-card .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--r-pill); background: var(--paper); color: var(--slate); font-size: 13px; font-weight: 450; margin-left: 4px; vertical-align: 1px; }
.badge.ok { background: var(--ink); color: #fff; }
.step-card.current .badge { background: var(--mist); }

.mcp-card { grid-template-columns: minmax(0, 1fr); min-width: 0; background: var(--peach); color: var(--sienna); border-radius: var(--r-card); padding: clamp(24px, 4vw, 36px); display: grid; gap: 14px; margin-top: 10px; }
.mcp-card .tag { color: var(--sienna); opacity: .75; }
.mcp-card h2 { font-family: var(--serif); font-weight: 400; font-size: 30px; letter-spacing: -0.015em; color: var(--sienna); }
.mcp-card p { font-size: 16px; line-height: 1.5; }
.mcp-url { min-width: 0; display: flex; align-items: center; gap: 12px; background: var(--paper); border-radius: var(--r-input); padding: 8px 8px 8px 16px; box-shadow: var(--sh-float); }
.mcp-url code { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13.5px; color: var(--ink); overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.mcp-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.mcp-card .mcp-actions button:not(.primary) { border-color: var(--sienna) !important; color: var(--sienna); }
.mcp-card .mcp-actions button:not(.primary)::before { background: var(--sienna) !important; }
.mcp-card .mcp-actions button:not(.primary):hover { color: var(--peach) !important; }

.loading { display: grid; place-items: center; gap: 14px; color: var(--slate); font-size: 15px; }
.loader { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--mist); border-top-color: var(--ink); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.acct-split.is-account { grid-template-columns: 1fr; }
.acct-split.is-account .acct-aside { display: none; }
.acct-split.is-account .acct-main { place-items: start center; padding-top: 150px; }

@media (max-width: 960px) {
  .acct-split { grid-template-columns: 1fr; }
  .acct-aside { display: none; }
  .acct-main { padding-top: 112px; place-items: start center; }
}
@media (max-width: 600px) {
  .step-card { grid-template-columns: 40px 1fr; gap: 14px; padding: 18px; }
  .step-card .num { width: 40px; height: 40px; font-size: 17px; }
  .step-card .actions { grid-column: 1 / -1; justify-content: flex-start; }
  .step-card .actions:empty { display: none; }
  .mcp-url { flex-direction: column; align-items: stretch; padding: 12px; }
  .back-link { gap: 0; width: 44px; height: 44px; justify-content: center; }
  .back-link .back-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .back-link svg { width: 20px; height: 20px; }
}

/* Footer minimal (compte, autorisation) */
.mini-foot { padding: 24px var(--gutter) 32px; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 20px; font-size: 13.5px; color: var(--ash); }
.mini-foot a { color: var(--slate); }
.mini-foot a:hover { color: var(--ink); }

/* ==========================================================================
   Autorisation de l'assistant IA (OAuth)
   ========================================================================== */
.consent-page { min-height: 100vh; min-height: 100svh; display: grid; grid-template-rows: 1fr auto; background: var(--fog); }
.consent-main { display: grid; place-items: center; padding: 48px var(--gutter); }
.consent-box { width: 100%; max-width: 480px; display: grid; gap: 22px; }
.consent-box > .logo { justify-self: center; margin-bottom: 6px; }
.consent-card { background: var(--paper); border-radius: var(--r-card); box-shadow: var(--sh-float); padding: clamp(24px, 5vw, 36px); display: grid; gap: 18px; }
.consent-card h1 { font-family: var(--serif); font-weight: 400; font-size: 32px; letter-spacing: -0.015em; line-height: 1.15; }
.consent-card .muted { font-size: 15.5px; line-height: 1.5; color: var(--slate); }
.consent-card .muted strong { color: var(--ink); font-weight: 500; }
.scopes span { display: block; }
.link-visual { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 8px 0 4px; }
.link-visual .end { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--mist); font-size: 18px; font-weight: 500; }
.link-visual .end.relance { background: var(--ink); }
.link-visual .end.relance svg { width: 52px; height: 52px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.link-visual .wire { position: relative; width: 72px; height: 1px; background: repeating-linear-gradient(90deg, var(--smoke) 0 4px, transparent 4px 8px); overflow: visible; }
.link-visual .wire i { position: absolute; top: -3px; left: 0; width: 7px; height: 7px; border-radius: 50%; background: var(--sienna); box-shadow: 0 0 0 3px var(--peach); animation: travel 2.4s var(--ease-out) infinite; }
@keyframes travel { 0% { transform: translateX(0); opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { transform: translateX(65px); opacity: 0; } }
.client { text-align: center; font-size: 15px; color: var(--slate); }
.client b { color: var(--ink); font-weight: 500; }
.scopes { display: grid; gap: 0; border-top: 1px solid var(--hairline); }
.scopes li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--hairline); font-size: 15px; line-height: 1.45; }
.scopes svg { width: 18px; height: 18px; margin-top: 2px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.scopes strong { font-weight: 500; }
.consent-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.consent-actions button { width: 100%; height: 52px !important; font-size: 16px !important; }
.consent-note { font-size: 13px; color: var(--ash); text-align: center; line-height: 1.5; }
.consent-note a { color: var(--slate); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(0, 0, 0, .2); }

/* Petites notifications flottantes */
.mini { display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px 8px 8px; border-radius: var(--r-pill); font-size: 14.5px; font-weight: 450; white-space: nowrap; }


/* --- Tableaux du document : en cartes sur téléphone ------------------------ */
@media (max-width: 640px) {
  .table-wrap { background: none; border: 0; border-radius: 0; overflow: visible; }
  .doc table, .doc tbody, .doc tr, .doc td { display: block; width: 100%; }
  .doc thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .doc tbody { display: grid; gap: 10px; }
  .doc tr { background: var(--fog); border: 1px solid var(--hairline); border-radius: var(--r-small); padding: 14px 16px; }
  .doc tbody tr + tr td { border-top: 0; }
  .doc td { padding: 4px 0; }
  .doc td:first-child { font-size: 16px; padding-bottom: 6px; }
  .doc td[data-label]:not(:first-child)::before { content: attr(data-label); display: block; font-size: 12.5px; color: var(--ash); margin-bottom: 1px; }
}

/* --- Écrans tactiles --------------------------------------------------- */
@media (pointer: coarse) {
  .toc a { min-height: 44px; align-items: center; }
  .back-link { min-height: 44px; }
  .mini-foot a { display: inline-flex; align-items: center; min-height: 44px; }
  .mini-foot { gap: 0 20px; }
  .id-card a, .consent-note a, .auth-legal a { display: inline-block; padding: 6px 0; }
}
@media (hover: none) {
  .acct button:not(.tabs button):not(.menu-btn):not(.primary):hover:not(:disabled) { color: var(--ink); }
  .acct button:not(.tabs button):not(.menu-btn):hover:not(:disabled)::before, .acct .btn:hover::before { transform: translateY(101%); }
  .acct button:not(.tabs button):not(.menu-btn):active:not(:disabled)::before { transform: translateY(0); transition-duration: .2s; }
  .acct button:not(.tabs button):not(.menu-btn):not(.primary):active:not(:disabled) { color: #fff; }
  .mcp-card .mcp-actions button:not(.primary):hover { color: var(--sienna) !important; }
}

/* --- Téléphones en paysage ------------------------------------------------ */
@media (max-height: 520px) and (orientation: landscape) {
  .page-hero { padding-top: 104px; padding-bottom: var(--s40); }
  .acct-main { padding-top: 96px; }
  .consent-main { padding-top: 28px; }
  .read-progress { top: env(safe-area-inset-top); }
}
@media (max-width: 400px) {
  .doc h2 { font-size: 27px; gap: 12px; }
  .doc p, .doc li { font-size: 16px; }
  .keypoints { padding: 24px 20px; }
  .id-card { padding: 20px; }
  .consent-actions { grid-template-columns: 1fr; }
  .consent-actions #approve { order: -1; }
}
