/* Programme d'affiliation : page de présentation (affilies.chapteo.education), espace affilié (/espace) et page
   publique d'un affilié (chapteo.education/p/<code>). S'appuie sur landing.css (polices, couleurs, navigation). */
:root { --aff: #9133ea; --aff-ink: #f2e6ff; --aff-soft: #faf5ff; --ok: #15803d; --ok-soft: #ecfdf3; --warn: #b45309; --warn-soft: #fff7ed; --bad: #b91c1c; --bad-soft: #fef2f2; }

/* ---------- présentation du programme ---------- */
.af-hero { padding: 72px 20px 56px; background: radial-gradient(1200px 500px at 50% -10%, #f3e8ff 0%, #fff 60%); }
.af-hero-in { max-width: 1120px; margin: 0 auto; display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }
.af-earn { align-self: center; height: auto; }
.af-kicker { display: inline-flex; gap: 8px; align-items: center; padding: 4px 12px; border-radius: 999px; background: var(--aff-soft); color: var(--aff); font-size: 14px; font-weight: 600; }
.af-hero h1 { font-family: var(--display); font-size: 52px; line-height: 1.06; letter-spacing: -.02em; margin: 18px 0 16px; }
.af-hero h1 em { font-style: normal; color: var(--aff); }
.af-hero p.lead { font-size: 19px; line-height: 1.55; color: var(--muted); max-width: 560px; }
.af-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.af-note { margin-top: 14px; font-size: 14px; color: var(--muted); }
.af-earn { border-radius: 24px; background: #0a0a0a; color: #fff; padding: 28px; box-shadow: 0 30px 60px -30px rgba(145,51,234,.55); }
.af-earn small { color: #a3a3a3; font-size: 13px; }
.af-earn .af-big { font-family: var(--display); font-size: 46px; font-weight: 800; margin: 6px 0 18px; }
.af-earn .af-row { display: flex; justify-content: space-between; padding: 12px 0; border-top: 1px solid #262626; font-size: 15px; }
.af-earn .af-row b { color: #e9d5ff; }
.af-earn .af-tag { display: inline-block; margin-top: 16px; padding: 6px 12px; border-radius: 999px; background: #1f1f1f; color: #d4d4d4; font-size: 13px; }

.af-sec { padding: 72px 20px; }
.af-sec.alt { background: var(--soft); }
.af-in { max-width: 1120px; margin: 0 auto; }
.af-h2 { font-family: var(--display); font-size: 38px; line-height: 1.12; letter-spacing: -.015em; text-align: center; margin-bottom: 12px; }
.af-sub { text-align: center; color: var(--muted); font-size: 18px; line-height: 1.55; max-width: 680px; margin: 0 auto 40px; }
.af-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: s; }
.af-step { background: #fff; border: 2px solid var(--line); border-radius: 20px; padding: 26px; }
.af-step .n { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: var(--aff); color: #fff; font-weight: 700; font-family: var(--display); }
.af-step h3 { font-family: var(--display); font-size: 20px; margin: 16px 0 8px; }
.af-step p { color: var(--muted); font-size: 15.5px; line-height: 1.55; }
.af-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.af-box { background: #fff; border: 2px solid var(--line); border-radius: 20px; padding: 28px; }
.af-box h3 { font-family: var(--display); font-size: 22px; margin-bottom: 14px; }
.af-table { width: 100%; border-collapse: collapse; font-size: 15.5px; }
.af-table th, .af-table td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--line); }
.af-table th { color: var(--muted); font-weight: 500; font-size: 13.5px; }
.af-table td b { color: var(--aff); }
.af-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.af-list li { position: relative; padding-left: 28px; line-height: 1.55; color: #262626; }
.af-list li::before { content: ''; position: absolute; left: 0; top: 4px; width: 18px; height: 18px; border-radius: 6px; background: var(--aff-soft); box-shadow: inset 0 0 0 2px var(--aff); }
.af-sim label { display: block; font-weight: 600; margin-bottom: 10px; }
.af-sim input[type=range] { width: 100%; accent-color: var(--aff); }
.af-sim .out { display: flex; justify-content: space-between; align-items: baseline; margin-top: 18px; }
.af-sim .out b { font-family: var(--display); font-size: 40px; font-weight: 800; color: var(--aff); }
.af-sim .seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--soft); margin-bottom: 18px; }
.af-sim .seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; font-weight: 500; color: var(--muted); }
.af-sim .seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.af-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.af-card { border-radius: 18px; padding: 22px; background: #fff; border: 2px solid var(--line); }
.af-card b { display: block; font-family: var(--display); font-size: 18px; margin-bottom: 6px; }
.af-card span { color: var(--muted); font-size: 15px; line-height: 1.5; }
.af-faq { max-width: 780px; margin: 0 auto; display: grid; gap: 10px; }
.af-faq details { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 16px 20px; }
.af-faq summary { cursor: pointer; font-weight: 600; list-style: none; }
.af-faq summary::-webkit-details-marker { display: none; }
.af-faq summary::after { content: '+'; float: right; color: var(--muted); font-weight: 400; }
.af-faq details[open] summary::after { content: '−'; }
.af-faq p { margin-top: 10px; color: var(--muted); line-height: 1.6; }
.af-final { text-align: center; padding: 80px 20px; background: #0a0a0a; color: #fff; }
.af-final h2 { font-family: var(--display); font-size: 40px; margin-bottom: 14px; }
.af-final p { color: #a3a3a3; font-size: 18px; margin-bottom: 28px; }
.af-terms { font-size: 14px; color: var(--muted); line-height: 1.6; }
.af-terms ol { padding-left: 20px; display: grid; gap: 6px; }
.af-foot { padding: 28px 20px 40px; text-align: center; color: var(--muted); font-size: 14px; }
.af-foot a { margin: 0 8px; }
.af-foot a:hover { color: var(--ink); }

/* ---------- espace affilié ---------- */
.ae { min-height: 100vh; background: #fafafa; }
.ae-top { position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 2px solid var(--line); }
.ae-top-in { max-width: 1180px; margin: 0 auto; height: 60px; padding: 0 20px; display: flex; align-items: center; gap: 16px; }
.ae-top img { height: 26px; }
.ae-top .badge { font-size: 12px; font-weight: 600; color: var(--aff); background: var(--aff-soft); padding: 3px 10px; border-radius: 999px; }
.ae-top .sp { flex: 1; }
.ae-who { font-size: 14px; color: var(--muted); }
.ae-wrap { max-width: 1180px; margin: 0 auto; padding: 24px 20px 64px; display: grid; grid-template-columns: 220px 1fr; gap: 28px; }
.ae-nav { display: grid; gap: 4px; align-content: start; position: sticky; top: 84px; }
.ae-nav a { padding: 10px 14px; border-radius: 12px; color: var(--muted); font-weight: 500; font-size: 15px; }
.ae-nav a:hover { background: #f0f0f0; color: var(--ink); }
.ae-nav a.on { background: var(--aff-soft); color: var(--aff); }
.ae-main { min-width: 0; }
.ae-main h1 { font-family: var(--display); font-size: 28px; letter-spacing: -.01em; margin-bottom: 6px; }
.ae-main .lead { color: var(--muted); margin-bottom: 22px; }
.ae-card { background: #fff; border: 2px solid var(--line); border-radius: 18px; padding: 22px; margin-bottom: 18px; }
.ae-card h2 { font-family: var(--display); font-size: 18px; margin-bottom: 12px; }
.ae-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.ae-stat { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 16px; }
.ae-stat b { display: block; font-family: var(--display); font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ae-stat span { color: var(--muted); font-size: 13.5px; }
.ae-stat.hl { background: var(--aff); border-color: var(--aff); color: #fff; }
.ae-stat.hl span { color: var(--aff-ink); }
.ae-link { display: flex; gap: 8px; align-items: center; background: var(--soft); border-radius: 14px; padding: 6px 6px 6px 14px; }
.ae-link input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 15px; color: var(--ink); outline: none; }
.ae-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 12px; padding: 10px 16px; font-weight: 600; font-size: 14.5px; background: var(--aff); color: #fff; }
.ae-btn:hover { background: #7e22ce; }
.ae-btn.ghost { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 2px var(--border); }
.ae-btn.ghost:hover { background: var(--soft); }
.ae-btn.danger { background: var(--bad); }
.ae-btn[disabled] { opacity: .5; cursor: not-allowed; }
.ae-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ae-muted { color: var(--muted); font-size: 14px; line-height: 1.55; }
.ae-field { display: grid; gap: 6px; margin-bottom: 14px; }
.ae-field label { font-weight: 600; font-size: 14px; }
.ae-field input, .ae-field textarea, .ae-field select { font: inherit; font-size: 15px; padding: 11px 13px; border-radius: 12px; border: 2px solid var(--border); background: #fff; color: var(--ink); width: 100%; }
.ae-field input:focus, .ae-field textarea:focus, .ae-field select:focus { outline: none; border-color: var(--aff); }
.ae-field small { color: var(--muted); font-size: 13px; }
.ae-check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.5; margin-bottom: 14px; }
.ae-check input { margin-top: 3px; accent-color: var(--aff); }
.ae-tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.ae-tbl th { text-align: left; color: var(--muted); font-weight: 500; font-size: 13px; padding: 8px; border-bottom: 2px solid var(--line); }
.ae-tbl td { padding: 11px 8px; border-bottom: 1px solid var(--line); }
.ae-tbl .num { font-variant-numeric: tabular-nums; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pill.grey { background: #f0f0f0; color: #525252; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.aff { background: var(--aff-soft); color: var(--aff); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.ae-empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.ae-bars { display: flex; align-items: flex-end; gap: 3px; height: 90px; margin-top: 8px; }
.ae-bars i { flex: 1; background: #ede9fe; border-radius: 4px 4px 0 0; min-height: 3px; }
.ae-bars i.on { background: var(--aff); }
.ae-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.ae-steps div { background: var(--soft); border-radius: 14px; padding: 14px; font-size: 14px; line-height: 1.45; }
.ae-steps b { display: block; margin-bottom: 4px; }
.ae-msg { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 14.5px; line-height: 1.5; }
.ae-msg.err { background: var(--bad-soft); color: var(--bad); }
.ae-msg.ok { background: var(--ok-soft); color: var(--ok); }
.ae-msg.info { background: var(--aff-soft); color: #581c87; }
.ae-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 20px; letter-spacing: .08em; background: var(--soft); padding: 12px 16px; border-radius: 12px; display: inline-block; }
.ae-auth { max-width: 440px; margin: 48px auto; padding: 0 20px; }
.ae-auth .logo { display: block; margin: 0 auto 22px; height: 30px; }
.ae-auth h1 { font-family: var(--display); font-size: 26px; text-align: center; margin-bottom: 6px; }
.ae-auth .lead { text-align: center; color: var(--muted); margin-bottom: 22px; }
.ae-auth .alt { text-align: center; margin-top: 16px; font-size: 14.5px; color: var(--muted); }
.ae-auth .alt a { color: var(--aff); font-weight: 600; }
.ae-preview { border: 2px dashed var(--border); border-radius: 16px; padding: 18px; background: #fff; }
.ae-preview h3 { font-family: var(--display); font-size: 22px; margin: 10px 0 8px; }
.ae-preview p { color: #404040; line-height: 1.6; margin-bottom: 8px; white-space: pre-wrap; }
.ae-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #0a0a0a; color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 14.5px; z-index: 99; }
.ae-mnav { display: none; }

/* ---------- page publique d'un affilié ---------- */
.ap-main { max-width: 980px; margin: 0 auto; padding: 48px 20px 24px; }
.ap-card { background: #fff; border: 2px solid var(--line); border-radius: 28px; padding: 40px; box-shadow: 0 30px 60px -40px rgba(145,51,234,.45); background-image: radial-gradient(700px 260px at 100% 0%, #f5edff 0%, transparent 70%); }
.ap-who { display: flex; gap: 12px; align-items: center; }
.ap-who b { display: block; font-size: 16px; }
.ap-who span { color: var(--muted); font-size: 14px; }
.ap-avatar { width: 48px; height: 48px; border-radius: 16px; background: var(--aff); color: #fff; display: grid; place-items: center; font-family: var(--display); font-weight: 800; }
.ap-card h1 { font-family: var(--display); font-size: 42px; line-height: 1.1; letter-spacing: -.02em; margin: 22px 0 14px; }
.ap-text p { font-size: 18px; line-height: 1.65; color: #404040; margin-bottom: 12px; }
.ap-cta { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-top: 24px; }
.ap-more { color: var(--aff); font-weight: 600; }
.ap-small { margin-top: 16px; color: var(--muted); font-size: 14px; }
.ap-feats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 28px; }
.ap-feats div { background: var(--soft); border-radius: 18px; padding: 20px; }
.ap-feats b { display: block; font-family: var(--display); margin-bottom: 6px; }
.ap-feats span { color: var(--muted); font-size: 15px; line-height: 1.5; }
.ap-legal { margin-top: 24px; color: var(--muted); font-size: 13px; text-align: center; }
.ap-foot { text-align: center; padding: 20px 20px 40px; color: var(--muted); font-size: 14px; }

@media (max-width: 900px) {
  .af-hero-in, .af-grid2 { grid-template-columns: 1fr; }
  .af-hero h1 { font-size: 38px; }
  .af-h2 { font-size: 30px; }
  .af-steps, .ap-feats { grid-template-columns: 1fr; }
  .af-cards { grid-template-columns: 1fr 1fr; }
  .ae-wrap { grid-template-columns: 1fr; padding-top: 12px; }
  .ae-nav { display: none; }
  .ae-mnav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; }
  .ae-mnav a { flex: none; padding: 8px 12px; border-radius: 10px; background: #fff; border: 2px solid var(--line); font-size: 14px; color: var(--muted); }
  .ae-mnav a.on { color: var(--aff); border-color: var(--aff); }
  .ae-stats, .ae-steps { grid-template-columns: 1fr 1fr; }
  .ap-card { padding: 26px; }
  .ap-card h1 { font-size: 30px; }
  .ae-tbl .hide-m { display: none; }
}
@media (max-width: 520px) { .af-cards { grid-template-columns: 1fr; } }
.aff-public .nav-in { justify-content: space-between; }
.ap-who .ap-avatar { color: #fff; }
@media (max-width: 520px) { .af-cta .hbtn { width: 100%; min-width: 0; } }
