/* =====================================================================
 *  Espace Parrainage — Mon Courtier Perso
 *  CSS autonome (sans build) — reprend les tokens du design system du site.
 * ===================================================================== */

:root {
  --radius: 0.5rem;
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --radius-2xl: calc(var(--radius) + 8px);

  --cream:        oklch(0.982 0.006 85);
  --marine:       oklch(0.22 0.04 250);
  --marine-deep:  oklch(0.18 0.045 253);
  --cuivre:       oklch(0.62 0.09 60);
  --cuivre-hover: oklch(0.56 0.10 55);
  --surface:      oklch(0.995 0.002 85);
  --secondary:    oklch(0.955 0.006 85);
  --muted-fg:     oklch(0.48 0.02 250);
  --border:       oklch(0.90 0.008 85);
  --success:      oklch(0.55 0.10 155);
  --success-bg:   oklch(0.95 0.03 155);
  --danger:       oklch(0.55 0.20 25);

  --background: var(--cream);
  --foreground: var(--marine-deep);

  --shadow-soft:     0 1px 2px oklch(0.15 0.03 250 / 0.04), 0 8px 24px oklch(0.15 0.03 250 / 0.06);
  --shadow-elevated: 0 4px 12px oklch(0.15 0.03 250 / 0.08), 0 24px 48px oklch(0.15 0.03 250 / 0.10);

  --font-serif: "Fraunces", ui-serif, Georgia, serif;
  --font-sans:  "Inter", ui-sans-serif, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; border-color: var(--border); }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--marine-deep);
}
h1 { font-size: 2rem; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
a  { color: inherit; text-decoration: none; }
p  { line-height: 1.65; }
::selection { background-color: var(--cuivre); color: #fff; }

/* --- Layout ---------------------------------------------------------- */
.container-page {
  width: 100%;
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: 1.25rem;
}
@media (min-width: 768px) { .container-page { padding-inline: 2rem; } }

.site-main { flex: 1 0 auto; padding-block: 2.5rem 4rem; }
.narrow { max-width: 32rem; margin-inline: auto; }
.stack > * + * { margin-top: 1rem; }

/* --- Header / nav ---------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in oklch, var(--cream) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 4.25rem; }
.brand { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--font-serif); font-weight: 600; font-size: 1.15rem; color: var(--marine-deep); letter-spacing: -0.01em; }
.brand-tag { font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--cuivre); margin-top: 2px; }
.nav { display: flex; align-items: center; gap: 1.25rem; }
.nav-link { font-size: 0.9rem; font-weight: 500; color: var(--marine-deep); transition: color .2s ease; }
.nav-link:hover { color: var(--cuivre); }
.nav-user { font-size: 0.85rem; color: var(--muted-fg); }
.logout-form { display: inline; }
.nav-logout { background: none; border: 0; cursor: pointer; font-family: inherit; padding: 0; }
@media (max-width: 640px) {
  .brand-tag { display: none; }
  .nav { gap: 0.75rem; }
  .nav-user { display: none; }
}

/* --- Boutons --------------------------------------------------------- */
.btn-cuivre, .btn-outline, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: inherit; font-weight: 500; font-size: .95rem; cursor: pointer;
  padding: .8rem 1.4rem; border-radius: var(--radius-md);
  transition: background-color .2s ease, color .2s ease, transform .1s ease;
  border: 1px solid transparent; text-align: center;
}
.btn-cuivre { background: var(--cuivre); color: #fff; }
.btn-cuivre:hover { background: var(--cuivre-hover); }
.btn-cuivre:active { transform: translateY(1px); }
.btn-outline { background: transparent; color: var(--marine-deep); border-color: var(--marine-deep); }
.btn-outline:hover { background: var(--marine-deep); color: var(--cream); }
.btn-ghost { background: transparent; color: var(--marine-deep); padding: .5rem .75rem; }
.btn-ghost:hover { color: var(--cuivre); }
.btn-sm { padding: .55rem 1rem; font-size: .85rem; }
.btn-block { width: 100%; }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger); color: #fff; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--cuivre); outline-offset: 2px;
}

/* --- Cartes ---------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  padding: 1.5rem;
}
.card-lg { padding: 2rem; }
.card + .card { margin-top: 1.25rem; }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }

.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--cuivre);
}
.muted { color: var(--muted-fg); }
.text-sm { font-size: .875rem; }
.text-xs { font-size: .78rem; }
.hairline { border-top: 1px solid var(--border); margin-block: 1.25rem; }

/* --- Formulaires ----------------------------------------------------- */
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: .4rem; color: var(--marine-deep); }
.field .hint { font-size: .78rem; color: var(--muted-fg); margin-top: .35rem; }
.input, .textarea, .select {
  width: 100%; font-family: inherit; font-size: .95rem; color: var(--foreground);
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: .7rem .85rem; transition: border-color .2s ease, box-shadow .2s ease;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--cuivre); box-shadow: 0 0 0 3px oklch(0.62 0.09 60 / 0.15); outline: none;
}
.textarea { min-height: 6rem; resize: vertical; }
.field-row { display: grid; gap: 1rem; }
@media (min-width: 640px) { .field-row.cols-2 { grid-template-columns: 1fr 1fr; } }
.checkbox { display: flex; align-items: flex-start; gap: .6rem; font-size: .88rem; line-height: 1.5; }
.checkbox input { margin-top: .2rem; width: 1.05rem; height: 1.05rem; accent-color: var(--cuivre); flex-shrink: 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* --- Alertes / flash ------------------------------------------------- */
.flash-zone { margin-top: 1.25rem; display: flex; flex-direction: column; gap: .6rem; }
.flash { padding: .85rem 1.1rem; border-radius: var(--radius-md); font-size: .9rem; border: 1px solid; }
.flash-success { background: var(--success-bg); border-color: color-mix(in oklch, var(--success) 40%, var(--border)); color: oklch(0.4 0.09 155); }
.flash-error   { background: oklch(0.96 0.03 25); border-color: color-mix(in oklch, var(--danger) 35%, var(--border)); color: oklch(0.45 0.18 25); }
.flash-info    { background: oklch(0.96 0.02 250); border-color: var(--border); color: var(--marine-deep); }

/* --- Badges de statut ------------------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .74rem; font-weight: 600; letter-spacing: .01em;
  padding: .3rem .7rem; border-radius: 999px; border: 1px solid; white-space: nowrap;
}
.badge::before { content: ""; width: .45rem; height: .45rem; border-radius: 999px; background: currentColor; }
.badge-neutral  { color: var(--muted-fg);   background: var(--secondary); border-color: var(--border); }
.badge-progress { color: oklch(0.42 0.06 250); background: oklch(0.95 0.02 250); border-color: oklch(0.85 0.03 250); }
.badge-accent   { color: var(--cuivre-hover); background: oklch(0.96 0.04 60); border-color: oklch(0.85 0.06 60); }
.badge-success  { color: oklch(0.4 0.1 155); background: var(--success-bg); border-color: color-mix(in oklch, var(--success) 40%, var(--border)); }

/* --- Barre de progression ------------------------------------------- */
.progress { height: .5rem; background: var(--secondary); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--marine), var(--cuivre)); border-radius: 999px; transition: width .4s ease; }
.progress-label { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted-fg); margin-bottom: .45rem; }

/* --- Timeline (suivi étapes) ---------------------------------------- */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 1.5rem 2rem; }
.timeline li::before {
  content: ""; position: absolute; left: .42rem; top: .3rem; width: .7rem; height: .7rem;
  border-radius: 999px; background: var(--surface); border: 2px solid var(--border); z-index: 1;
}
.timeline li::after {
  content: ""; position: absolute; left: .73rem; top: 1rem; bottom: 0; width: 2px; background: var(--border);
}
.timeline li:last-child::after { display: none; }
.timeline li.done::before   { background: var(--cuivre); border-color: var(--cuivre); }
.timeline li.current::before { background: var(--marine-deep); border-color: var(--marine-deep); box-shadow: 0 0 0 4px oklch(0.18 0.045 253 / 0.12); }
.timeline .t-title { font-weight: 600; font-size: .95rem; color: var(--marine-deep); }
.timeline .t-meta  { font-size: .78rem; color: var(--muted-fg); margin-top: .15rem; }
.timeline .t-comment { margin-top: .5rem; font-size: .88rem; background: var(--cream); border-left: 3px solid var(--cuivre); padding: .55rem .75rem; border-radius: 6px; }

/* --- Tableaux -------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow-soft); }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { text-align: left; padding: .85rem 1rem; border-bottom: 1px solid var(--border); }
table.data th { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-fg); font-weight: 600; background: color-mix(in oklch, var(--secondary) 60%, transparent); }
table.data tbody tr { transition: background-color .15s ease; }
table.data tbody tr:hover { background: color-mix(in oklch, var(--cuivre) 5%, transparent); }
table.data tr:last-child td { border-bottom: 0; }
.row-link { cursor: pointer; }

/* --- Grilles / stats ------------------------------------------------- */
.grid { display: grid; gap: 1.25rem; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-2 { grid-template-columns: 1fr; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1.6fr 1fr; } }
.stat { padding: 1.25rem 1.5rem; }
.stat .stat-value { font-family: var(--font-serif); font-size: 2rem; color: var(--marine-deep); line-height: 1; }
.stat .stat-label { font-size: .8rem; color: var(--muted-fg); margin-top: .4rem; }

/* --- Page titre ------------------------------------------------------ */
.page-head { margin-bottom: 1.75rem; }
.page-head h1 { margin-top: .35rem; }
.page-head .sub { color: var(--muted-fg); margin-top: .4rem; }
.back-link { font-size: .85rem; color: var(--muted-fg); display: inline-flex; gap: .35rem; align-items: center; }
.back-link:hover { color: var(--cuivre); }

/* --- Hero (page d'accueil) ------------------------------------------ */
.hero { padding: 3.5rem 0 2rem; text-align: center; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.25rem); max-width: 20ch; margin-inline: auto; }
.hero p.lead { font-size: 1.1rem; color: var(--muted-fg); max-width: 44ch; margin: 1.25rem auto 2rem; }
.hero-actions { display: flex; gap: .85rem; justify-content: center; flex-wrap: wrap; }
.steps-strip { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-top: 3rem; }
.step-chip { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1rem; text-align: left; box-shadow: var(--shadow-soft); }
.step-chip .n { font-family: var(--font-serif); color: var(--cuivre); font-size: 1.1rem; }
.step-chip .t { font-size: .82rem; margin-top: .3rem; color: var(--marine-deep); font-weight: 500; line-height: 1.35; }

/* --- Divers ---------------------------------------------------------- */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1.25rem; font-size: .9rem; }
.dl dt { color: var(--muted-fg); }
.dl dd { color: var(--marine-deep); }
.inline-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.divider-label { display: flex; align-items: center; gap: .75rem; color: var(--muted-fg); font-size: .8rem; margin: 1.25rem 0; }
.divider-label::before, .divider-label::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted-fg); }
.empty .icon { font-size: 2rem; }
.fade-in-up { animation: fadeInUp .6s cubic-bezier(.22,1,.36,1) both; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.site-footer { flex-shrink: 0; border-top: 1px solid var(--border); padding-block: 1.5rem; font-size: .82rem; color: var(--muted-fg); }
