/* ==========================================================================
   Yachty — système de design
   Mobile d'abord. Marine / mer / sable. Polices du système.
   Sommaire : 1 variables · 2 base · 3 mise en page · 4 boutons · 5 formulaires
   6 composants · 7 tableau · 8 en-tête / pied · 9 dialogue / toast · 10 animations
   ========================================================================== */

/* ---------- 1. Variables ---------- */
:root {
  --navy: #0f2a44;
  --navy-700: #16395c;
  --sea: #1d5c8c;
  --sea-700: #174a72;
  --sea-100: #e6f0f7;
  --sand: #f6f1e7;
  --sand-200: #ece4d3;
  --ink: #1f2933;
  --muted: #5f6b76;
  --line: #dfe3e8;
  --surface: #ffffff;
  --bg: #fbfaf7;
  --success: #1f7a4d;
  --success-bg: #e5f4ec;
  --warning: #8a5a00;
  --warning-bg: #fdf3dc;
  --danger: #b3261e;
  --danger-bg: #fbe9e7;
  --info-bg: var(--sea-100);
  --gold: #b88a44;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* Ombres en couches, très discrètes */
  --shadow-sm: 0 0 0 1px rgb(15 42 68 / 0.06), 0 1px 2px rgb(15 42 68 / 0.06);
  --shadow-md: 0 0 0 1px rgb(15 42 68 / 0.05), 0 2px 4px rgb(15 42 68 / 0.05), 0 8px 20px -6px rgb(15 42 68 / 0.12);
  --shadow-xs: 0 1px 2px rgb(15 42 68 / 0.08);
  --shadow-lg: 0 0 0 1px rgb(15 42 68 / 0.05), 0 4px 8px rgb(15 42 68 / 0.06), 0 24px 48px -12px rgb(15 42 68 / 0.22);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --dur-fast: 120ms;
  --dur-base: 180ms;
  --dur-slow: 320ms;

  --ring: 0 0 0 3px rgb(29 92 140 / 0.25);
  --header-h: 64px;
  --container: 1120px;
  --gutter: 1.25rem;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }
body.no-scroll { overflow: hidden; }

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  color: var(--navy);
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-3);
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 1.5rem + 2.4vw, 3.25rem); letter-spacing: -0.02em; line-height: 1.12; }
h2 { font-size: clamp(1.5rem, 1.25rem + 1.2vw, 2.25rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.0625rem; }
p { margin: 0 0 var(--space-4); text-wrap: pretty; }
a { color: var(--sea); text-underline-offset: 3px; text-decoration-thickness: 1px; transition: color var(--dur-fast) ease; }
a:hover { color: var(--navy); }
[hidden] { display: none !important; }
img, svg, video { max-width: 100%; height: auto; }
img { display: block; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--space-5) 0; }
small, .small { font-size: 0.875rem; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
section > .container > h2 + .lead, .section .container > h2 + p { margin-top: calc(var(--space-2) * -1); }
.muted { color: var(--muted); }
.num, .kpi__value, .table td, .stepper__num { font-variant-numeric: tabular-nums; }
:target { scroll-margin-top: calc(var(--header-h) + 12px); }
::selection { background: var(--sea-100); color: var(--navy); }

/* Focus clavier bien visible */
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--sea); outline-offset: 2px; border-radius: var(--radius-sm); }
.section--navy :focus-visible, .site-footer :focus-visible { outline-color: #fff; }

.icon { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.25em; }
.icon--fill { fill: currentColor; stroke: none; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--space-3); top: -100px; z-index: 1000;
  background: var(--navy); color: #fff; padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md); text-decoration: none; font-weight: 600;
  transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus { top: var(--space-3); color: #fff; }

/* ---------- 3. Mise en page ---------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: var(--space-7); }
.section--sand { background: var(--sand); }
.section--navy { background: var(--navy); color: #e8eef4; }
.section--navy h1, .section--navy h2, .section--navy h3 { color: #fff; }
.section--navy a:not(.btn) { color: #cfe3f3; }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack--lg { gap: var(--space-6); }
.stack > * { margin-block: 0; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.cluster--between { justify-content: space-between; }
.grid { display: grid; gap: var(--space-5); grid-template-columns: 1fr; }
.eyebrow {
  display: inline-block; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--sea); margin-bottom: var(--space-3);
}
.section--navy .eyebrow { color: var(--gold); }
.lead { font-size: 1.125rem; line-height: 1.6; color: var(--muted); max-width: 62ch; }
.section--navy .lead { color: #c3d1de; }

.page-header { padding-block: var(--space-6) var(--space-5); border-bottom: 1px solid var(--line); background: var(--surface); }
.page-header h1 { font-size: clamp(1.625rem, 1.3rem + 1.4vw, 2.25rem); margin-bottom: var(--space-2); }
.page-header p { margin: 0; color: var(--muted); }
.page-header__actions { margin-top: var(--space-4); display: flex; flex-wrap: wrap; gap: var(--space-3); }

.hero { position: relative; padding-block: var(--space-7) var(--space-8); background: linear-gradient(180deg, var(--sand) 0%, var(--bg) 100%); overflow: hidden; }
.hero--navy { background: radial-gradient(120% 90% at 85% 0%, var(--navy-700) 0%, var(--navy) 60%); color: #e8eef4; }
.hero--navy h1 { color: #fff; }
.hero__inner { position: relative; }
.hero__inner > * { max-width: 46rem; }
.hero .lead { margin-bottom: var(--space-5); }

/* Espace connecté : barre latérale en grand écran, contenu seul sur mobile */
.app-shell { display: grid; grid-template-columns: 1fr; gap: var(--space-5); padding-block: var(--space-5) var(--space-7); }
.app-shell__main { min-width: 0; }
.app-shell__aside { min-width: 0; }

@media (min-width: 640px) {
  :root { --gutter: 1.75rem; }
  .grid--2, .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .section { padding-block: var(--space-8); }
}
@media (min-width: 900px) {
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .grid--4 { grid-template-columns: repeat(4, 1fr); }
  .app-shell--aside { grid-template-columns: 17rem 1fr; gap: var(--space-6); }
}

/* ---------- 4. Boutons ---------- */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--navy); --btn-bd: var(--line);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 44px; padding: 0.625rem 1.25rem;
  font: inherit; font-weight: 600; font-size: 0.9375rem; line-height: 1.2; text-align: center; text-decoration: none;
  color: var(--btn-fg); background: var(--btn-bg);
  border: 1px solid var(--btn-bd); border-radius: var(--radius-md);
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-base) ease, border-color var(--dur-base) ease, color var(--dur-base) ease, box-shadow var(--dur-base) ease;
}
.btn:active:not(:disabled) { transform: scale(0.96); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn--primary { --btn-bg: var(--sea); --btn-fg: #fff; --btn-bd: var(--sea); box-shadow: 0 1px 2px rgb(15 42 68 / 0.2), inset 0 1px 0 rgb(255 255 255 / 0.12); }
.btn--secondary { --btn-bg: var(--surface); --btn-fg: var(--navy); --btn-bd: #c9d1d9; box-shadow: var(--shadow-sm); border-color: transparent; }
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--sea); --btn-bd: transparent; }
.btn--danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-bd: var(--danger); }
.btn--sm { min-height: 44px; padding: 0.4375rem 0.875rem; font-size: 0.875rem; }
.btn--block { display: flex; width: 100%; }
.btn .icon { width: 1.125em; height: 1.125em; }
/* Zone tactile ≥ 44 px même pour les petits boutons */
.btn--sm::after { content: ""; position: absolute; inset: -2px 0; }
@media (hover: hover) and (pointer: fine) {
  .btn--primary:hover:not(:disabled) { --btn-bg: var(--sea-700); --btn-bd: var(--sea-700); color: #fff; }
  .btn--secondary:hover:not(:disabled) { --btn-bg: var(--sand); color: var(--navy); }
  .btn--ghost:hover:not(:disabled) { --btn-bg: var(--sea-100); color: var(--navy); }
  .btn--danger:hover:not(:disabled) { --btn-bg: #8f1d17; --btn-bd: #8f1d17; color: #fff; }
}
.section--navy .btn--secondary, .hero--navy .btn--secondary { --btn-bg: #fff; }
.section--navy .btn--ghost, .hero--navy .btn--ghost { --btn-fg: #fff; }

/* Chargement : le texte reste, un cercle apparaît */
.btn.is-loading { color: transparent; pointer-events: none; }
.btn.is-loading::before {
  content: ""; position: absolute; width: 1.1em; height: 1.1em; border-radius: 50%;
  border: 2px solid var(--btn-fg); border-right-color: transparent; animation: spin 0.6s linear infinite;
}
.btn--primary.is-loading::before, .btn--danger.is-loading::before { border-color: #fff; border-right-color: transparent; }
.btn--primary.is-loading, .btn--danger.is-loading { color: transparent; }
.btn--primary.is-loading, .btn--danger.is-loading { opacity: 0.85; }

/* ---------- 5. Formulaires ---------- */
.field { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-4); min-width: 0; }
.field__label { font-weight: 600; font-size: 0.9375rem; color: var(--navy); }
.field__hint { font-size: 0.875rem; color: var(--muted); margin: 0; }
.field__error { font-size: 0.875rem; color: var(--danger); font-weight: 500; margin: 0; }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 0.625rem 0.875rem;
  font: inherit; font-size: 1rem; /* 16 px : pas de zoom sur iPhone */
  color: var(--ink); background: var(--surface);
  border: 1px solid #c4ccd4; border-radius: var(--radius-md);
  box-shadow: inset 0 1px 1px rgb(15 42 68 / 0.04);
  transition: border-color var(--dur-base) ease, box-shadow var(--dur-base) ease, background-color var(--dur-base) ease;
  appearance: none; -webkit-appearance: none;
}
.input::placeholder, .textarea::placeholder { color: #6b7682; opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: #9aa6b2; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible {
  outline: none; border-color: var(--sea); box-shadow: 0 0 0 3px rgb(29 92 140 / 0.25);
}
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.input[aria-invalid="true"]:focus-visible, .select[aria-invalid="true"]:focus-visible, .textarea[aria-invalid="true"]:focus-visible { box-shadow: 0 0 0 3px rgb(179 38 30 / 0.2); }
.input:disabled, .select:disabled, .textarea:disabled { background: #f1f3f5; color: var(--muted); cursor: not-allowed; }
.textarea { min-height: 7.5rem; resize: vertical; line-height: 1.5; }
.select {
  padding-right: 2.5rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%235f6b76' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 8 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 1.25rem;
}
.input[type="file"] { padding: 0.5rem; min-height: 46px; }
.input[type="date"], .input[type="number"] { font-variant-numeric: tabular-nums; }

.checkbox { display: flex; align-items: flex-start; gap: var(--space-3); min-height: 44px; padding-block: 0.5rem; cursor: pointer; font-size: 0.9375rem; }
.checkbox input { appearance: none; -webkit-appearance: none; flex: none; width: 1.375rem; height: 1.375rem; margin: 0.0625rem 0 0; border: 1.5px solid #9aa6b2; border-radius: 6px; background: var(--surface) center / 0.875rem no-repeat; cursor: pointer; transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease; }
.checkbox input[type="radio"] { border-radius: 50%; }
.checkbox input:checked { background-color: var(--sea); border-color: var(--sea); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3.5 8.5 3 3 6-7'/%3E%3C/svg%3E"); }
.checkbox input[type="radio"]:checked { background-image: radial-gradient(circle, #fff 0 32%, transparent 36%); }
.checkbox input:focus-visible { outline: 3px solid var(--sea); outline-offset: 2px; }

/* Carte à choisir (radio ou case) : <label class="radio-card"><input …><span>…</span></label> */
.radio-card { position: relative; display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); cursor: pointer; transition: border-color var(--dur-base) ease, box-shadow var(--dur-base) ease, background-color var(--dur-base) ease; }
.radio-card input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--sea); background: var(--sea-100); box-shadow: 0 0 0 1px var(--sea); }
.radio-card:has(input:focus-visible) { outline: 3px solid var(--sea); outline-offset: 2px; }
.radio-card__title { font-weight: 600; color: var(--navy); display: block; }
.radio-card__text { font-size: 0.875rem; color: var(--muted); display: block; }
@media (hover: hover) and (pointer: fine) { .radio-card:hover { border-color: #9aa6b2; } }

.form-grid { display: grid; gap: 0 var(--space-5); grid-template-columns: 1fr; }
.form-grid .field--full { grid-column: 1 / -1; }
@media (min-width: 640px) { .form-grid { grid-template-columns: repeat(2, 1fr); } }
fieldset { border: 0; padding: 0; margin: 0 0 var(--space-4); min-width: 0; }
legend { font-weight: 600; color: var(--navy); padding: 0; margin-bottom: var(--space-2); }
.site-header__tools { display: flex; align-items: center; gap: var(--space-1); }
.honeypot { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- 6. Composants ---------- */
.card {
  background: var(--surface); border-radius: var(--radius-lg); padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}
.card > :last-child { margin-bottom: 0; }
.card__title { font-size: 1.125rem; margin-bottom: var(--space-2); }
.card--interactive { display: block; color: inherit; text-decoration: none; transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) ease; }
.card--interactive:active { transform: scale(0.98); }
@media (hover: hover) and (pointer: fine) {
  .card--interactive:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); color: inherit; }
}

.badge {
  display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.1875rem 0.625rem;
  font-size: 0.8125rem; font-weight: 600; line-height: 1.4; white-space: nowrap;
  border-radius: var(--radius-pill); background: #eef1f4; color: #3b4651;
}
.badge--info { background: var(--info-bg); color: var(--sea-700); }
.badge--success { background: var(--success-bg); color: var(--success); }
.badge--warning { background: var(--warning-bg); color: var(--warning); }
.badge--danger { background: var(--danger-bg); color: var(--danger); }
.badge--neutral { background: #eef1f4; color: #3b4651; }

.alert { display: flex; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius-md); border-left: 4px solid currentColor; font-size: 0.9375rem; }
.alert > :last-child { margin-bottom: 0; }
.alert--info { background: var(--info-bg); color: var(--sea-700); }
.alert--success { background: var(--success-bg); color: var(--success); }
.alert--warning { background: var(--warning-bg); color: var(--warning); }
.alert--danger { background: var(--danger-bg); color: var(--danger); }
.alert p { color: var(--ink); }

/* Étapes d'un formulaire */
.stepper { display: flex; gap: var(--space-2); list-style: none; margin: 0 0 var(--space-5); padding: 0; counter-reset: step; }
.stepper__step { flex: 1; display: flex; flex-direction: column; gap: var(--space-2); font-size: 0.8125rem; font-weight: 600; color: var(--muted); }
.stepper__step::before { content: ""; height: 4px; border-radius: 2px; background: var(--line); transition: background-color var(--dur-slow) ease; }
.stepper__step.is-done::before, .stepper__step.is-active::before { background: var(--sea); }
.stepper__step.is-active { color: var(--navy); }
.stepper__num { display: none; }
@media (max-width: 639px) { .stepper__label { display: none; } .stepper__step.is-active .stepper__label { display: inline; } }

.tabs { display: flex; gap: var(--space-1); overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: var(--space-5); scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; position: relative; min-height: 44px; padding: 0.5rem 1rem; font: inherit; font-weight: 600; font-size: 0.9375rem; color: var(--muted); background: none; border: 0; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: var(--space-2); transition: color var(--dur-base) ease; }
.tab::after { content: ""; position: absolute; left: 0.5rem; right: 0.5rem; bottom: -1px; height: 2px; background: var(--sea); transform: scaleX(0); transition: transform var(--dur-base) var(--ease-out); }
.tab[aria-selected="true"], .tab.is-active, .tab[aria-current="page"] { color: var(--navy); }
.tab[aria-selected="true"]::after, .tab.is-active::after, .tab[aria-current="page"]::after { transform: scaleX(1); }
@media (hover: hover) and (pointer: fine) { .tab:hover { color: var(--navy); } }

.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.list > li, .list__item { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-4) var(--space-5); }
.list > li + li { border-top: 1px solid var(--line); }
a.list__item, .list > li > a { color: inherit; text-decoration: none; }

.kpi { background: var(--surface); border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: var(--space-1); }
.kpi__label { font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.kpi__value { font-family: var(--font-serif); font-size: 2rem; line-height: 1.1; color: var(--navy); font-weight: 600; }
.kpi__hint { font-size: 0.875rem; color: var(--muted); }

.progress { height: 8px; border-radius: var(--radius-pill); background: var(--sand-200); overflow: hidden; }
.progress__bar { display: block; height: 100%; width: 100%; background: var(--sea); border-radius: inherit; transform-origin: left; transform: scaleX(var(--value, 0)); transition: transform var(--dur-slow) var(--ease-out); }

.timeline { list-style: none; margin: 0; padding: 0 0 0 1.5rem; position: relative; }
.timeline::before { content: ""; position: absolute; left: 0.4375rem; top: 0.5rem; bottom: 0.5rem; width: 2px; background: var(--line); }
.timeline > li { position: relative; padding: 0 0 var(--space-5) var(--space-3); }
.timeline > li:last-child { padding-bottom: 0; }
.timeline > li::before { content: ""; position: absolute; left: -1.5rem; top: 0.35rem; width: 0.9375rem; height: 0.9375rem; border-radius: 50%; background: var(--surface); border: 2px solid #b8c2cc; }
.timeline > li.is-done::before { background: var(--sea); border-color: var(--sea); }
.timeline > li.is-current::before { border-color: var(--sea); box-shadow: 0 0 0 4px rgb(29 92 140 / 0.18); }
.timeline__title { font-weight: 600; color: var(--navy); margin: 0; }
.timeline__meta { font-size: 0.875rem; color: var(--muted); margin: 0; }

.empty { text-align: center; padding: var(--space-7) var(--space-5); background: var(--surface); border-radius: var(--radius-lg); border: 1px dashed #c4ccd4; display: flex; flex-direction: column; align-items: center; gap: var(--space-2); }
.empty__icon { display: inline-grid; place-items: center; width: 3.25rem; height: 3.25rem; border-radius: 50%; background: var(--sea-100); color: var(--sea); margin-bottom: var(--space-2); }
.empty__icon .icon { width: 1.5rem; height: 1.5rem; }
.empty__title { margin: 0; font-size: 1.125rem; }
.empty__text { margin: 0 0 var(--space-3); color: var(--muted); max-width: 40ch; }

.skeleton-group { display: flex; flex-direction: column; gap: var(--space-3); }
.skeleton { height: 1rem; border-radius: var(--radius-sm); background: linear-gradient(90deg, #e9edf1 25%, #f4f6f8 50%, #e9edf1 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton:nth-child(2) { width: 85%; }
.skeleton:nth-child(3) { width: 65%; }

/* Images : fin contour pur noir (clair) pour la profondeur */
img:not([src$=".svg"]) { outline: 1px solid oklch(0 0 0 / 0.1); outline-offset: -1px; }

/* ---------- 7. Tableaux : cartes sous 640 px ---------- */
.table-wrap { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.table th { text-align: left; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap; }
.table td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
@media (hover: hover) and (pointer: fine) { .table tbody tr:hover { background: #fafbfc; } }
.table .num, .table .table__num { text-align: right; }
@media (max-width: 639px) {
  .table-wrap { background: none; box-shadow: none; overflow: visible; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table tbody { display: flex; flex-direction: column; gap: var(--space-3); }
  .table tr { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: var(--space-2) var(--space-4); }
  .table td { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); padding: var(--space-2) 0; border-bottom: 1px solid var(--line); text-align: right; }
  .table td:last-child { border-bottom: 0; }
  /* Chaque cellule porte data-label="Nom de colonne" */
  .table td[data-label]::before { content: attr(data-label); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); text-align: left; flex: none; }
}

/* ---------- 8. En-tête et pied de page ---------- */
.site-header--app { background: rgb(255 255 255 / 0.96); }
.site-header { position: sticky; top: 0; z-index: 50; background: rgb(255 255 255 / 0.92); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); box-shadow: 0 1px 0 var(--line); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; min-height: var(--header-h); gap: var(--space-4); position: relative; }
.brand { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.brand__logo { height: 30px; width: auto; }
.burger { display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; color: var(--navy); background: none; border: 0; border-radius: var(--radius-md); cursor: pointer; position: relative; }
.burger .icon { grid-area: 1 / 1; width: 1.5rem; height: 1.5rem; transition: opacity var(--dur-base) ease, transform var(--dur-base) var(--ease-out), filter var(--dur-base) ease; }
.burger__close { opacity: 0; transform: scale(0.25); filter: blur(4px); }
.site-header.is-open .burger__open { opacity: 0; transform: scale(0.25); filter: blur(4px); }
.site-header.is-open .burger__close { opacity: 1; transform: none; filter: none; }

/* Mobile : panneau sous l'en-tête */
.site-nav {
  position: absolute; top: 100%; left: 0; right: 0; background: var(--surface);
  display: flex; flex-direction: column; padding: var(--space-3) var(--gutter) var(--space-5);
  box-shadow: var(--shadow-lg); border-top: 1px solid var(--line);
  max-height: calc(100dvh - var(--header-h)); overflow-y: auto;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out), visibility 0s linear var(--dur-base);
}
.site-header.is-open .site-nav { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.site-nav__link { display: flex; align-items: center; min-height: 48px; padding-inline: var(--space-2); font-weight: 600; color: var(--navy); text-decoration: none; border-bottom: 1px solid var(--line); }
.site-nav__link[aria-current="page"] { color: var(--sea); box-shadow: inset 3px 0 0 var(--sea); padding-left: calc(var(--space-2) + 0.5rem); background: var(--sea-100); border-radius: var(--radius-sm); }
@media (hover: hover) and (pointer: fine) { .site-nav__link:hover { color: var(--sea); } }
.site-nav__actions { display: flex; gap: var(--space-3); padding-top: var(--space-4); }
.site-nav__actions .btn { flex: 1; }
.lang-toggle { min-width: 3rem; letter-spacing: 0.06em; flex: none !important; border: 1px solid var(--line); }
.lang-toggle__current { opacity: 0.55; font-weight: 500; }
.burger:focus-visible { outline-offset: 0; }
/* Voile sous le menu mobile : un clic dessus ferme le menu */
.site-header.is-open::before { content: ""; position: absolute; top: 100%; left: 0; right: 0; height: 100dvh; background: rgb(15 42 68 / 0.35); z-index: -1; animation: fade-in var(--dur-base) var(--ease-out); }

@media (min-width: 860px) {
  .burger { display: none; }
  .site-header__tools { margin-left: calc(var(--space-2) * -1); }
  .site-nav { position: static; flex-direction: row; align-items: center; gap: var(--space-5); padding: 0; background: none; box-shadow: none; border: 0; opacity: 1; visibility: visible; transform: none; max-height: none; overflow: visible; }
  .site-header.is-open::before { display: none; }
  .site-nav__link { min-height: 44px; padding: 0; border: 0; font-size: 0.9375rem; font-weight: 500; position: relative; }
  .site-nav__link[aria-current="page"] { box-shadow: none; padding-left: 0; background: none; border-radius: 0; }
  .site-nav__link::after { content: ""; position: absolute; left: 0; right: 0; bottom: 6px; height: 2px; background: var(--sea); transform: scaleX(0); transform-origin: left; transition: transform var(--dur-base) var(--ease-out); }
  .site-nav__link[aria-current="page"]::after { transform: scaleX(1); }
  @media (hover: hover) and (pointer: fine) { .site-nav__link:hover::after { transform: scaleX(1); } }
  .site-nav__actions { padding: 0; margin-left: var(--space-3); }
  .site-nav__actions .btn { flex: none; }
}

.site-footer { background: var(--navy); color: #c3d1de; margin-top: auto; font-size: 0.9375rem; }
.site-footer a { color: #e2ebf3; text-decoration: none; display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; transition: color var(--dur-fast) ease; }
@media (hover: hover) and (pointer: fine) { .site-footer a:hover { color: #fff; text-decoration: underline; } }
.footer__grid { display: grid; gap: var(--space-6); padding-block: var(--space-7) var(--space-6); grid-template-columns: 1fr; }
.footer__brand p { max-width: 32ch; margin: 0; }
.footer__logo { height: 30px; width: auto; margin-bottom: var(--space-3); filter: brightness(0) invert(1); }
.footer__title { font-family: var(--font-sans); font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); margin-bottom: var(--space-3); }
.footer__list { list-style: none; margin: 0; padding: 0; }
.footer__bottom { padding-block: 0 var(--space-4); font-size: 0.8125rem; color: #98aabb; }
.footer__bottom p { margin: 0; padding-top: var(--space-4); border-top: 1px solid rgb(255 255 255 / 0.12); }
@media (min-width: 760px) { .footer__grid { grid-template-columns: 1.4fr 1fr 1fr; } }

/* ---------- 9. Dialogue et toast ---------- */
.dialog-backdrop { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: var(--space-4); background: rgb(15 42 68 / 0.5); opacity: 0; transition: opacity var(--dur-base) var(--ease-out); }
.dialog-backdrop.is-in { opacity: 1; }
.dialog { width: min(100%, 26rem); background: var(--surface); border-radius: var(--radius-lg); padding: var(--space-5); box-shadow: var(--shadow-lg); }
.dialog-backdrop .dialog { transform: scale(0.96); opacity: 0; transition: transform var(--dur-base) var(--ease-out), opacity var(--dur-base) var(--ease-out); }
.dialog-backdrop.is-in .dialog { transform: none; opacity: 1; }
.dialog__title { font-size: 1.25rem; margin-bottom: var(--space-2); }
.dialog__text { color: var(--muted); }
.dialog__actions { display: flex; flex-direction: column-reverse; gap: var(--space-3); margin-top: var(--space-5); }
@media (min-width: 480px) { .dialog__actions { flex-direction: row; justify-content: flex-end; } }

/* <dialog> natif de formulaire (à préférer aux boîtes maison) :
   <dialog class="dialog--form" aria-labelledby="t1">
     <form method="dialog" class="dialog__form">
       <div class="dialog__head"><h2 class="dialog__title" id="t1">…</h2>
         <button class="dialog__close" type="submit" formnovalidate aria-label="Fermer"><svg class="icon">…</svg></button></div>
       <div class="dialog__body"> …champs… </div>
       <div class="dialog__actions"> boutons </div>
     </form>
   </dialog>
   Ouvrir avec dialog.showModal() ; Échap, focus et fond sont gérés par le navigateur. */
:where(dialog) { color: var(--ink); }
dialog.dialog--form {
  width: min(36rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); padding: 0; border: 0; overflow: hidden;
  border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(8px) scale(0.98);
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out), overlay var(--dur-base) allow-discrete, display var(--dur-base) allow-discrete;
}
dialog.dialog--form[open] { opacity: 1; transform: none; }
@starting-style { dialog.dialog--form[open] { opacity: 0; transform: translateY(8px) scale(0.98); } }
dialog.dialog--form::backdrop { background: rgb(15 42 68 / 0.5); opacity: 0; transition: opacity var(--dur-base) var(--ease-out), overlay var(--dur-base) allow-discrete, display var(--dur-base) allow-discrete; }
dialog.dialog--form[open]::backdrop { opacity: 1; }
@starting-style { dialog.dialog--form[open]::backdrop { opacity: 0; } }
dialog.dialog--form.dialog--sm { width: min(26rem, calc(100vw - 2rem)); }
.dialog__form { display: flex; flex-direction: column; max-height: calc(100dvh - 2rem); margin: 0; }
.dialog__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); padding: var(--space-5) var(--space-5) var(--space-3); }
.dialog__head .dialog__title { margin: 0; }
.dialog__close { flex: none; display: grid; place-items: center; width: 44px; height: 44px; margin: -0.5rem -0.75rem 0 0; color: var(--muted); background: none; border: 0; border-radius: var(--radius-md); cursor: pointer; transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease; }
@media (hover: hover) and (pointer: fine) { .dialog__close:hover { background: var(--sand); color: var(--navy); } }
.dialog__body { padding: var(--space-2) var(--space-5) var(--space-4); overflow-y: auto; }
.dialog--form .dialog__actions { margin: 0; padding: var(--space-4) var(--space-5) var(--space-5); border-top: 1px solid var(--line); background: #fafbfc; }
body:has(dialog[open]) { overflow: hidden; }
/* Mobile : la boîte se pose en bas de l'écran, comme une feuille */
@media (max-width: 639px) {
  dialog.dialog--form { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; transform: translateY(24px); max-height: 92dvh; }
  .dialog__form { max-height: 92dvh; }
  .dialog__actions { padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom)); }
}

/* Page ou zone en erreur (session expirée, profil introuvable, réseau coupé) */
.page-error { max-width: 34rem; margin: var(--space-8) auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }
.page-error .cluster { justify-content: center; }

.toast-region { position: fixed; z-index: 300; left: var(--space-4); right: var(--space-4); bottom: calc(var(--space-4) + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: var(--space-3); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: var(--space-3); width: min(100%, 26rem); padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4); background: var(--navy); color: #fff; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(8px); transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out); }
.toast.is-in { opacity: 1; transform: none; }
.toast.is-leaving { opacity: 0; transform: translateY(4px); transition-duration: 120ms; }
.toast > .icon { margin-top: 0.125rem; }
.toast__text { margin: 0; flex: 1; font-size: 0.9375rem; line-height: 1.45; padding-block: 0.125rem; }
.toast__close { flex: none; width: 32px; height: 32px; display: grid; place-items: center; color: inherit; background: none; border: 0; border-radius: var(--radius-sm); cursor: pointer; opacity: 0.7; position: relative; }
.toast__close::after { content: ""; position: absolute; inset: -6px; }
.toast__close:hover { opacity: 1; }
.toast--success > .icon { color: #7fd6a8; }
.toast--danger { background: #7a1c16; }
.toast--danger > .icon { color: #ffb4ab; }
@media (min-width: 640px) { .toast-region { left: auto; right: var(--space-5); align-items: flex-end; } }

/* ---------- 10. Animations ---------- */
@keyframes fade-in { from { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }

/* .reveal : visible par défaut ; masqué seulement si motion.js est actif */
.js-motion .reveal { opacity: 0; transform: translateY(12px); transition: opacity 420ms var(--ease-out), transform 420ms var(--ease-out); transition-delay: var(--reveal-delay, 0ms); }
.js-motion .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; transition-delay: 0ms !important; scroll-behavior: auto !important; }
  .js-motion .reveal { opacity: 1; transform: none; }
  .skeleton { animation: none; }
  dialog.dialog--form { transform: none !important; }
  .btn.is-loading::before { animation-duration: 1.2s !important; animation-iteration-count: infinite !important; }
}

@media (prefers-contrast: more) {
  :root { --line: #aab4be; --muted: #404a54; }
}

@media print {
  .site-header, .site-footer, .toast-region, .skip-link { display: none !important; }
  body { background: #fff; }
}
