/* Habillage commun des pages du site (en-tête, pied de page, éléments récurrents). */
:root {
  --brand: #059669; --brand-dark: #047857; --brand-soft: #ecfdf5; --brand-line: #a7f3d0;
  --ink: #0f172a; --text: #334155; --muted: #64748b; --line: #e2e8f0; --bg: #f8fafc;
  --header-h: 64px;
}
@media (max-width: 767px) { :root { --header-h: 56px; } }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body.site { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; display: flex; flex-direction: column;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
body.site > main { flex: 1 0 auto; }
:target { scroll-margin-top: 88px; }

/* ---------- En-tête ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.86);
  backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line); }
.site-header .bar { max-width: 72rem; margin: 0 auto; padding: 0 1.25rem; height: var(--header-h); box-sizing: border-box;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.logo { font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; color: var(--ink); text-decoration: none; line-height: 1; }
.logo span { color: var(--brand); }
.app-page .site-header .bar { max-width: none; padding: 0 1.5rem; }
.app-page .site-header { background: #fff; }
.site-nav { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
.site-tools { display: flex; align-items: center; gap: .5rem; }
.lang-switch { display: inline-flex; padding: 3px; border-radius: .7rem; background: #f1f5f9; border: 1px solid var(--line); }
.lang-switch button { font-size: .75rem; font-weight: 700; letter-spacing: .03em; color: var(--muted); padding: .3rem .55rem;
  border-radius: .5rem; border: 0; background: transparent; cursor: pointer; line-height: 1; }
.lang-switch button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15,23,42,.15); }
.theme-toggle { width: 38px; height: 38px; border-radius: .7rem; border: 1px solid var(--line); background: #fff; color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: background .15s, color .15s; }
.theme-toggle:hover { background: #f1f5f9; color: var(--ink); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .sun { display: none; }
html[data-theme="dark"] .theme-toggle .sun { display: block; }
html[data-theme="dark"] .theme-toggle .moon { display: none; }
.site-nav a { padding: .5rem .8rem; border-radius: .6rem; font-size: .9rem; font-weight: 600; color: var(--text); text-decoration: none; }
.site-nav a:hover { background: #f1f5f9; color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--brand-dark); background: var(--brand-soft); }
.btn-cta { display: inline-flex; align-items: center; gap: .4rem; padding: .6rem 1rem; border-radius: .75rem;
  background: var(--brand); color: #fff !important; font-weight: 700; font-size: .9rem; text-decoration: none;
  box-shadow: 0 6px 16px -6px rgba(5,150,105,.6); transition: background .15s, transform .15s; }
.btn-cta:hover { background: var(--brand-dark) !important; transform: translateY(-1px); }
.menu-toggle { display: none; width: 38px; height: 38px; border-radius: .7rem; border: 1px solid var(--line);
  background: #fff; align-items: center; justify-content: center; cursor: pointer; }
.menu-toggle svg { width: 20px; height: 20px; }
@media (min-width: 768px) { .site-tools { margin-left: .5rem; } }
@media (max-width: 767px) {
  .site-header .bar { gap: .5rem; padding: 0 1rem; }
  .site-tools { margin-left: auto; gap: .4rem; }
  .menu-toggle { display: inline-flex; }
  .site-nav { position: absolute; top: var(--header-h); left: 0; right: 0; flex-direction: column; align-items: stretch;
    gap: .15rem; padding: .75rem 1rem 1rem; background: #fff; border-bottom: 1px solid var(--line);
    box-shadow: 0 16px 30px -12px rgba(15,23,42,.18); display: none; }
  .site-nav.open { display: flex; }
  .site-nav a { padding: .8rem .9rem; font-size: 1rem; }
  .site-nav .btn-cta { justify-content: center; margin-top: .5rem; padding: .85rem 1rem; }
}

/* ---------- Pied de page ---------- */
.site-footer { background: #0b1220; color: #94a3b8; margin-top: 4rem; }
.site-footer .inner { max-width: 72rem; margin: 0 auto; padding: 3.5rem 1.25rem 2rem; }
.site-footer .grid { display: grid; gap: 2.5rem; grid-template-columns: 1.4fr repeat(3, 1fr); }
.site-footer .logo { color: #fff; }
.site-footer .tagline { margin-top: .75rem; font-size: .9rem; line-height: 1.6; max-width: 20rem; }
.site-footer h3 { color: #fff; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin: 0 0 1rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .65rem; }
.site-footer a { color: #cbd5e1; text-decoration: none; font-size: .92rem; }
.site-footer a:hover { color: #fff; }
.site-footer .bottom { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid #1e293b; display: flex;
  flex-wrap: wrap; gap: .75rem 1.5rem; justify-content: space-between; font-size: .8rem; }
.site-footer .bottom a { font-size: .8rem; color: #94a3b8; text-decoration: underline; text-underline-offset: 2px; }
@media (max-width: 900px) { .site-footer .grid { grid-template-columns: 1fr 1fr; } .site-footer .brand { grid-column: 1 / -1; } }
@media (max-width: 480px) { .site-footer .inner { padding-top: 2.75rem; } .site-footer .grid { gap: 2rem 1.25rem; } }

/* ---------- Éléments de page ---------- */
.eyebrow { display: inline-flex; align-items: center; gap: .4rem; font-size: .75rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--brand-dark); background: var(--brand-soft);
  border: 1px solid var(--brand-line); padding: .3rem .7rem; border-radius: 9999px; }
.hero-bg { background:
  radial-gradient(60rem 30rem at 85% -10%, rgba(16,185,129,.16), transparent 60%),
  radial-gradient(40rem 24rem at -10% 10%, rgba(14,165,233,.10), transparent 60%), #fff;
  border-bottom: 1px solid var(--line); }
.card { background: #fff; border: 1px solid var(--line); border-radius: 1.25rem; }
.check { display: flex; gap: .65rem; align-items: flex-start; }
.check::before { content: ""; flex: none; width: 1.15rem; height: 1.15rem; margin-top: .15rem; border-radius: 9999px;
  background: var(--brand-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23059669'%3E%3Cpath fill-rule='evenodd' d='M16.7 5.3a1 1 0 010 1.4l-8 8a1 1 0 01-1.4 0l-4-4a1 1 0 111.4-1.4L8 12.6l7.3-7.3a1 1 0 011.4 0z' clip-rule='evenodd'/%3E%3C/svg%3E") center / 70% no-repeat; }
.check.off { color: #94a3b8; }
.check.off::before { background: #f1f5f9 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2394a3b8'%3E%3Cpath d='M5 9h10v2H5z'/%3E%3C/svg%3E") center / 70% no-repeat; }
.todo { background: #fef3c7; color: #92400e; padding: 0 .3rem; border-radius: .25rem; font-weight: 600; }

/* Blocs de code (documentation) */
.code { position: relative; background: #0b1220; color: #e2e8f0; border-radius: 1rem; font-size: .82rem; line-height: 1.6; }
.code pre { margin: 0; padding: 1.1rem 1.2rem; overflow-x: auto; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.code .copy { position: absolute; top: .55rem; right: .55rem; font-size: .72rem; font-weight: 600; color: #cbd5e1;
  background: #1e293b; border: 1px solid #334155; border-radius: .5rem; padding: .25rem .55rem; cursor: pointer; }
.code .copy:hover { color: #fff; }
.tok-k { color: #7dd3fc; } .tok-s { color: #86efac; } .tok-c { color: #64748b; } .tok-n { color: #fca5a5; }
code.inline { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em;
  background: #f1f5f9; border: 1px solid var(--line); border-radius: .35rem; padding: .05rem .35rem; color: var(--ink); }
.method { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .72rem; font-weight: 800;
  padding: .2rem .5rem; border-radius: .4rem; letter-spacing: .03em; }
.method.post { background: #dcfce7; color: #166534; } .method.get { background: #dbeafe; color: #1e40af; }
.tabs button { font-size: .8rem; font-weight: 600; padding: .4rem .8rem; border-radius: .55rem; color: var(--muted); }
.tabs button[aria-selected="true"] { background: #0b1220; color: #fff; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 1rem; background: #fff; }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: .875rem; min-width: 34rem; }
.table-wrap th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  background: #f8fafc; padding: .7rem 1rem; border-bottom: 1px solid var(--line); }
.table-wrap td { padding: .75rem 1rem; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.table-wrap tr:last-child td { border-bottom: 0; }

/* Formulaires */
.field label { display: block; font-size: .85rem; font-weight: 600; color: var(--ink); margin-bottom: .4rem; }
.field input, .field select, .field textarea { width: 100%; box-sizing: border-box; border: 1px solid #cbd5e1; border-radius: .8rem;
  padding: .75rem .9rem; font-size: 1rem; background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(16,185,129,.2); }
.field .hint { font-size: .78rem; color: var(--muted); margin-top: .35rem; }
.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

/* Pages légales */
.legal h2 { font-size: 1.25rem; font-weight: 800; color: var(--ink); margin: 2.5rem 0 .75rem; letter-spacing: -.01em; }
.legal h3 { font-size: 1rem; font-weight: 700; color: var(--ink); margin: 1.5rem 0 .5rem; }
.legal p, .legal li { line-height: 1.75; }
.legal p { margin: .75rem 0; }
.legal ul { list-style: disc; padding-left: 1.25rem; margin: .75rem 0; }
.legal li { margin: .3rem 0; }
.legal a { color: var(--brand-dark); text-decoration: underline; text-underline-offset: 2px; }
/* Tableaux de référence : une fiche par ligne sur téléphone */
@media (max-width: 640px) {
  .table-wrap.stack table { min-width: 0; }
  .table-wrap.stack thead { display: none; }
  .table-wrap.stack tr { display: block; padding: .9rem 1rem; border-bottom: 1px solid #f1f5f9; }
  .table-wrap.stack tr:last-child { border-bottom: 0; }
  .table-wrap.stack td { display: block; padding: .1rem 0; border: 0; }
  .table-wrap.stack td:first-child { margin-bottom: .25rem; }
  .table-wrap.stack td:nth-child(2) { font-size: .8rem; color: var(--muted); }
}
.logo-tag { margin-left: .85rem; padding-left: .85rem; border-left: 1px solid var(--line); font-size: .85rem;
  font-weight: 500; letter-spacing: 0; color: var(--muted); vertical-align: middle; }
@media (max-width: 480px) { .logo-tag { display: none; } }

/* ---------- Langue : blocs de contenu bilingues ---------- */
html[lang="en"] [data-lang="fr"], html:not([lang="en"]) [data-lang="en"] { display: none !important; }

/* ---------- Mode nuit ---------- */
html[data-theme="dark"] {
  color-scheme: dark;
  --brand-soft: rgba(16,185,129,.14); --brand-line: rgba(52,211,153,.35); --brand-dark: #34d399;
  --ink: #f1f5f9; --text: #cbd5e1; --muted: #94a3b8; --line: #263449; --bg: #0b1220;
  --surface: #111a2b; --surface-2: #17233a; --surface-3: #22314b;
}
html[data-theme="dark"] body { background: var(--bg); color: var(--text); }
/* En-tête, outils */
html[data-theme="dark"] .site-header { background: rgba(11,18,32,.86); }
html[data-theme="dark"] .app-page .site-header { background: var(--surface); }
html[data-theme="dark"] .site-nav a:hover, html[data-theme="dark"] .theme-toggle:hover { background: var(--surface-2); }
html[data-theme="dark"] .lang-switch { background: var(--surface-2); }
html[data-theme="dark"] .lang-switch button[aria-pressed="true"] { background: var(--surface-3); color: var(--ink); box-shadow: none; }
html[data-theme="dark"] .theme-toggle, html[data-theme="dark"] .menu-toggle { background: var(--surface); color: var(--text); }
@media (max-width: 767px) { html[data-theme="dark"] .site-nav { background: var(--surface); } }
html[data-theme="dark"] .site-footer { background: #070c16; }
html[data-theme="dark"] .site-footer .bottom { border-top-color: #1a2436; }
/* Éléments de page */
html[data-theme="dark"] .hero-bg { background:
  radial-gradient(60rem 30rem at 85% -10%, rgba(16,185,129,.14), transparent 60%),
  radial-gradient(40rem 24rem at -10% 10%, rgba(14,165,233,.08), transparent 60%), var(--surface); }
html[data-theme="dark"] .card, html[data-theme="dark"] .table-wrap { background: var(--surface); }
html[data-theme="dark"] .table-wrap th { background: var(--surface-2); }
html[data-theme="dark"] .table-wrap td { border-bottom-color: var(--line); }
html[data-theme="dark"] .check.off::before { background-color: var(--surface-2); }
html[data-theme="dark"] .todo { background: rgba(245,158,11,.2); color: #fcd34d; }
html[data-theme="dark"] .code { background: #0d1626; border: 1px solid var(--line); }
html[data-theme="dark"] .tabs button[aria-selected="true"] { background: var(--surface-3); }
html[data-theme="dark"] code.inline { background: var(--surface-2); color: var(--ink); }
html[data-theme="dark"] .method.post { background: rgba(34,197,94,.18); color: #86efac; }
html[data-theme="dark"] .method.get { background: rgba(59,130,246,.2); color: #93c5fd; }
html[data-theme="dark"] .field input, html[data-theme="dark"] .field select, html[data-theme="dark"] .field textarea {
  background: var(--surface-2); border-color: var(--line); color: var(--ink); }
html[data-theme="dark"] .legal a { color: #34d399; }

/* Classes utilitaires Tailwind : fonds, textes et bordures neutres */
html[data-theme="dark"] .bg-white { background-color: var(--surface); }
html[data-theme="dark"] :is(.bg-slate-50, .bg-slate-100) { background-color: var(--surface-2); }
html[data-theme="dark"] .bg-slate-50\/60 { background-color: rgba(23,35,58,.6); }
html[data-theme="dark"] :is(.bg-slate-200, .bg-slate-300) { background-color: var(--surface-3); }
html[data-theme="dark"] .bg-slate-800 { background-color: #334155; }
html[data-theme="dark"] .bg-slate-900 { background-color: #1b2a44; }
html[data-theme="dark"] .bg-white\/70 { background-color: rgba(11,18,32,.72); }
html[data-theme="dark"] :is(.text-slate-900, .text-slate-800) { color: var(--ink); }
html[data-theme="dark"] :is(.text-slate-700, .text-slate-600) { color: var(--text); }
html[data-theme="dark"] .text-slate-500 { color: var(--muted); }
html[data-theme="dark"] .text-slate-400 { color: #7d8ba1; }
html[data-theme="dark"] :is(.border-slate-200, .border-slate-300) { border-color: var(--line); }
html[data-theme="dark"] .border-slate-900 { border-color: var(--ink); }
html[data-theme="dark"] .text-brand-700, html[data-theme="dark"] .text-brand-600 { color: #34d399; }
html[data-theme="dark"] :is(.bg-brand-50, .hover\:bg-brand-50:hover, .hover\:bg-brand-100:hover) { background-color: rgba(16,185,129,.14); }
html[data-theme="dark"] .text-orange-600 { color: #fb923c; }
html[data-theme="dark"] .bg-amber-50 { background-color: rgba(245,158,11,.12); }
html[data-theme="dark"] .bg-amber-100 { background-color: rgba(245,158,11,.2); }
html[data-theme="dark"] :is(.text-amber-700, .text-amber-800, .text-amber-900) { color: #fcd34d; }
html[data-theme="dark"] .border-amber-200 { border-color: rgba(245,158,11,.35); }
html[data-theme="dark"] .bg-red-50 { background-color: rgba(239,68,68,.12); }
html[data-theme="dark"] .text-red-700 { color: #fca5a5; }
html[data-theme="dark"] :is(.shadow-emerald-100, .shadow-emerald-200, .shadow-slate-200\/60) { --tw-shadow-color: rgba(0,0,0,.35); }
/* Bordures sans couleur explicite (couleur par défaut de Tailwind) */
html[data-theme="dark"] :is(.border, .border-b, .border-t, .border-y, .border-2):not([class*="border-brand"]):not([class*="border-amber"]):not([class*="border-orange"]):not([class*="border-slate-9"]):not([class*="!border"]) { border-color: var(--line); }
/* Survols */
html[data-theme="dark"] .hover\:bg-white:hover { background-color: var(--surface-2); }
html[data-theme="dark"] :is(.hover\:bg-slate-800:hover, .hover\:bg-slate-900:hover) { background-color: var(--surface-3); }
html[data-theme="dark"] .hover\:border-slate-300:hover, html[data-theme="dark"] .hover\:border-slate-400:hover { border-color: #3b4d6a; }
html[data-theme="dark"] .border-slate-900.hover\:bg-slate-900:hover { background-color: var(--ink); color: var(--bg); }
