/* ==========================================================================
   Owly — design system
   Palette tirée du logo : marine #003784, turquoise #008CB4, orange #FB9B28.
   Concept : la chouette qui veille — nuit marine, lune lumineuse, accents orange.
   ========================================================================== */

@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('../fonts/plus-jakarta-sans-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('../fonts/plus-jakarta-sans-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --navy-950: #00163a;
  --navy-900: #001f54;
  --navy: #003784;
  --navy-600: #0a4aa8;
  --teal: #0a93b8;
  --orange: #fb9b28;
  --orange-600: #e8860f;

  --bg: #f2f6fc;
  --surface: #ffffff;
  --surface-2: #f6f9fe;
  --line: #e1e8f3;
  --text: #0b1b33;
  --muted: #5b6a82;

  --primary: #003784;
  --primary-hover: #0a4aa8;
  --on-primary: #ffffff;
  --link: #0a4aa8;
  --focus: #0a93b8;
  --accent: #fb9b28;
  --accent-hover: #f08a0c;
  --on-accent: #2a1600;
  --danger: #d1344b;
  --success: #12935a;

  --soft-primary: #e6eefb;
  --soft-accent: #fff1dc;
  --soft-teal: #dff4f9;

  --st-nouveau: #2f6fde;
  --st-contacte: #0a93b8;
  --st-mandat: #f08a0c;
  --st-en_vente: #7a56e0;
  --st-compromis: #e0612b;
  --st-vendu: #17a35f;
  --st-sans_suite: #7a889e;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 2px rgba(10, 30, 70, .06);
  --shadow: 0 1px 2px rgba(10, 30, 70, .05), 0 10px 28px -6px rgba(10, 30, 70, .10);
  --shadow-lg: 0 20px 50px -12px rgba(0, 30, 80, .28);

  --font: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --tabbar-h: 64px;
  color-scheme: light dark;
}

/* Thème sombre : automatique (réglage de l'appareil) sauf si l'utilisateur a choisi « clair »,
   ou forcé quand il a choisi « sombre » (attribut data-theme posé par theme.js). Même jeu de valeurs dans les deux blocs. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #071225;
    --surface: #0d2040;
    --surface-2: #112850;
    --line: #1d3862;
    --text: #e9f0ff;
    --muted: #95a8c8;
    --primary: #2f80ed;
    --primary-hover: #4a92f5;
    --link: #7db8ff;
    --soft-primary: #12305e;
    --soft-accent: #3a2a10;
    --soft-teal: #0d3a4a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -6px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #071225;
  --surface: #0d2040;
  --surface-2: #112850;
  --line: #1d3862;
  --text: #e9f0ff;
  --muted: #95a8c8;
  --primary: #2f80ed;
  --primary-hover: #4a92f5;
  --link: #7db8ff;
  --soft-primary: #12305e;
  --soft-accent: #3a2a10;
  --soft-teal: #0d3a4a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -6px rgba(0, 0, 0, .45);
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

/* Bouton soleil / lune (en-têtes) : visible seulement quand theme.js a pu s'exécuter */
.theme-toggle { display: none; }
html[data-theme-effective] .theme-toggle { display: inline-flex; }
.theme-toggle .ic-sun, .theme-toggle .ic-moon { display: none; }
html[data-theme-effective="light"] .theme-toggle .ic-sun { display: inline-block; }
html[data-theme-effective="dark"] .theme-toggle .ic-moon { display: inline-block; }
.theme-float { position: fixed; top: calc(12px + env(safe-area-inset-top)); right: 12px; z-index: 40; background: var(--surface); box-shadow: var(--shadow); }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.02em; font-weight: 800; }
h1 { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p { margin: 0; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.strong { font-weight: 700; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden, [hidden] { display: none !important; } /* l'attribut hidden doit gagner contre tout display: flex/grid */

.icon { width: 20px; height: 20px; flex: none; vertical-align: -4px; }
.icon.sm { width: 16px; height: 16px; vertical-align: -3px; }
.icon.lg { width: 26px; height: 26px; }

.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.sm { gap: 8px; }
.stack.lg { gap: 22px; }
.grow { flex: 1; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
.fade-up { animation: fade-up .35s ease both; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  min-height: 46px; padding: 0 20px;
  border: 0; border-radius: 14px;
  font-weight: 700; font-size: 15px; line-height: 1;
  background: var(--soft-primary); color: var(--link);
  cursor: pointer; text-decoration: none !important;
  transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn:disabled, .btn[aria-busy="true"] { opacity: .6; pointer-events: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 6px 16px -6px rgba(0, 55, 132, .55); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-accent { background: var(--accent); color: var(--on-accent); box-shadow: 0 8px 20px -8px rgba(251, 155, 40, .8); }
.btn-accent:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-outline { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-danger { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13.5px; border-radius: 11px; }
.btn-lg { min-height: 54px; font-size: 16px; border-radius: 16px; }
.btn-block { display: flex; width: 100%; }
.btn-icon { min-height: 40px; width: 40px; padding: 0; border-radius: 12px; }

/* ---------- Cartes ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 0; }
.card-title { font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.card-sub { color: var(--muted); font-size: 13px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 6px 2px -2px; }
.section-title h2 { font-size: 17px; }
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---------- Formulaires ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-weight: 700; font-size: 13.5px; }
.field .opt { color: var(--muted); font-weight: 500; }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 11px 14px;
  background: var(--surface); color: var(--text);
  border: 1.5px solid var(--line); border-radius: 13px;
  transition: border-color .15s, box-shadow .15s;
  appearance: none; -webkit-appearance: none;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a98b0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 18%, transparent); }
.input::placeholder, .textarea::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 13px; font-weight: 600; }
.hint { color: var(--muted); font-size: 12.5px; }
.input-group { position: relative; }
.input-group .btn { position: absolute; right: 6px; top: 6px; min-height: 36px; }
.input-group .input { padding-right: 120px; }

/* Champ mot de passe : bouton « œil » (afficher / masquer) */
.input-pw { position: relative; }
.input-pw .input { padding-right: 52px; }
.pw-toggle {
  position: absolute; top: 0; right: 0; width: 50px; height: 100%;
  display: grid; place-items: center; padding: 0;
  background: none; border: 0; border-radius: 0 13px 13px 0;
  color: var(--muted); cursor: pointer;
}
.pw-toggle:hover { color: var(--text); }
.pw-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: -5px; }
.pw-toggle .icon { vertical-align: 0; }
.pw-toggle .pw-hide, .pw-toggle[aria-pressed="true"] .pw-show { display: none; }
.pw-toggle[aria-pressed="true"] .pw-hide { display: block; }
/* Edge/IE ajoutent leur propre œil : on garde le nôtre, identique partout */
input[type="password"]::-ms-reveal, input[type="password"]::-ms-clear { display: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.chip span {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px;
  border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line);
  font-weight: 700; font-size: 14px; transition: all .15s;
}
.chip input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: 0 6px 14px -6px rgba(0, 55, 132, .6); }
.chip input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.chips.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chips.tiles .chip span { flex-direction: column; justify-content: center; text-align: center; border-radius: 16px; padding: 14px 6px 12px; gap: 6px; width: 100%; font-size: 13px; }
.chips.tiles .chip .icon { width: 24px; height: 24px; }

.check { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1.5px solid var(--line); cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--primary); flex: none; }
.check span { font-size: 13.5px; line-height: 1.45; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; white-space: nowrap;
  --st: var(--muted);
  background: color-mix(in srgb, var(--st) 14%, var(--surface));
  color: color-mix(in srgb, var(--st) 78%, var(--text));
}
.badge .icon { width: 14px; height: 14px; vertical-align: -2px; }
.badge.st-nouveau { --st: var(--st-nouveau); }
.badge.st-contacte { --st: var(--st-contacte); }
.badge.st-mandat { --st: var(--st-mandat); }
.badge.st-en_vente { --st: var(--st-en_vente); }
.badge.st-compromis { --st: var(--st-compromis); }
.badge.st-vendu { --st: var(--st-vendu); }
.badge.st-sans_suite { --st: var(--st-sans_suite); }
.badge.ok { --st: var(--success); }
.badge.warn { --st: var(--st-mandat); }
.badge.off { --st: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }

.avatar {
  width: 44px; height: 44px; border-radius: 14px; flex: none; display: grid; place-items: center;
  font-weight: 800; font-size: 15px; color: var(--link);
  background: linear-gradient(145deg, var(--soft-primary), var(--soft-teal));
}
.avatar.sm { width: 34px; height: 34px; border-radius: 11px; font-size: 12.5px; }
.avatar.lg { width: 64px; height: 64px; border-radius: 20px; font-size: 22px; }
.avatar.xl { width: 96px; height: 96px; border-radius: 28px; font-size: 32px; }
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-empty { background: var(--surface-2); color: var(--muted); border: 2px dashed var(--line); }

/* ---------- Listes ---------- */
.list { display: flex; flex-direction: column; }
.item {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px;
  color: inherit; text-decoration: none !important;
  border-top: 1px solid var(--line); transition: background .12s;
}
.list > .item:first-child { border-top: 0; }
a.item:hover { background: var(--surface-2); }
.item-lead { width: 46px; height: 46px; border-radius: 14px; flex: none; display: grid; place-items: center; background: var(--soft-primary); color: var(--link); overflow: hidden; }
.item-lead img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item-body { flex: 1; min-width: 0; }
.item-title { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-meta { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.item .chev { color: var(--muted); opacity: .6; }

/* Dernières nouvelles (accueil de l'apporteur) : on touche une nouvelle pour la lire en entier */
.news { scroll-margin-bottom: 100px; } /* la barre du bas ne masque pas une nouvelle dépliée */
.news > summary { cursor: pointer; list-style: none; }
.news > summary::-webkit-details-marker { display: none; }
.news > summary:hover { background: var(--surface-2); }
.list > .news:first-child > summary { border-top: 0; }
.news > summary .chev { transition: transform .15s; }
.news[open] > summary .chev { transform: rotate(180deg); }
.news[open] > summary { align-items: flex-start; }
.news[open] > summary .item-title, .news[open] > summary .item-meta { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
.news-more { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 0 18px 16px 78px; }

/* ---------- Fiche contact : carte d'identité numérique, logo de l'entreprise, vidéo ---------- */
.contact-link { color: inherit; text-decoration: none !important; min-width: 0; }
.idcard { overflow: hidden; }
.idcard-band { height: 76px; background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 55%, #4aa3ff)); }
.idcard-body { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 0 20px 22px; margin-top: -52px; }
.idcard-body .avatar.xl { width: 108px; height: 108px; border-radius: 32px; border: 4px solid var(--surface); box-shadow: var(--shadow); font-size: 34px; }
.idcard-eyebrow { margin-top: 10px; font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.idcard-body h1 { margin: 0; }
.idcard-job { color: var(--muted); font-weight: 600; }
.idcard-company { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 6px; font-size: 14px; color: var(--muted); }
.idcard-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }

/* Logo : carré par défaut, il s'élargit pour un logo horizontal (jusqu'à 2,5 fois sa hauteur) */
.company-logo { height: 64px; min-width: 64px; max-width: 160px; flex: none; border-radius: 16px; background: #fff; border: 1.5px solid var(--line); display: grid; place-items: center; overflow: hidden; padding: 6px; }
.company-logo img { height: 100%; width: auto; max-width: 100%; object-fit: contain; display: block; }
.company-logo-empty { width: 64px; }
.company-logo.sm { height: 28px; min-width: 28px; max-width: 72px; border-radius: 8px; padding: 2px; border-width: 1px; }
.company-logo.lg { height: 96px; min-width: 96px; max-width: 220px; border-radius: 22px; }
.company-logo-empty.lg { width: 96px; }
.company-logo-empty.sm { width: 28px; }
.company-logo-empty { background: var(--surface-2); color: var(--muted); border-style: dashed; }

.video { width: 100%; max-height: 420px; border-radius: 14px; background: #000; display: block; }
.prose { margin: 0; line-height: 1.6; overflow-wrap: anywhere; }
.item-link { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-radius: 12px; background: var(--surface-2); color: inherit; text-decoration: none !important; font-weight: 600; font-size: 14px; }
.item-link span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.item-link .icon:first-child { color: var(--link); }

/* Messages directs envoyés à un apporteur (fiche apporteur) */
.sent-list { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.sent-item { display: flex; flex-direction: column; gap: 4px; padding: 9px 12px; border-radius: 12px; background: var(--surface-2); }
.sent-body { font-size: 13.5px; overflow-wrap: anywhere; }
.sent-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* Petit bouton icône (ex. supprimer un message) */
.icon-btn { width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; transition: background .12s, color .12s; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger { color: var(--danger); }
.icon-btn.danger:hover { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); }
.icon-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.icon-btn .icon { vertical-align: 0; }
.item-end.corner { align-self: stretch; justify-content: space-between; margin: -4px 0; }   /* l'icône en haut à droite, l'heure en bas */

/* ---------- Statistiques ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat { padding: 16px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); position: relative; overflow: hidden; }
.stat-icon { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 12px; background: var(--soft-primary); color: var(--link); }
.stat-icon.accent { background: var(--soft-accent); color: var(--orange-600); }
.stat-icon.teal { background: var(--soft-teal); color: var(--teal); }
.stat-icon.green { background: color-mix(in srgb, var(--success) 14%, var(--surface)); color: var(--success); }
.stat-value { font-size: 27px; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 600; margin-top: 3px; }
.stat-sub { color: var(--muted); font-size: 12px; margin-top: 6px; }

.progress { height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--line) 80%, transparent); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--orange)); }

/* ---------- Héros « nuit + lune » ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: var(--radius-lg); color: #fff;
  padding: 22px 20px;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(30, 150, 215, .5), transparent 55%),
    linear-gradient(160deg, #0a4aa8 0%, #003784 48%, #001b47 100%);
  box-shadow: var(--shadow-lg);
}
.hero-art { /* la lune, avec la chouette devant : toujours centrée */
  position: absolute !important; right: 14px; top: 14px; z-index: 1;
  width: var(--art, 128px); aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 40% 36%, #ffffff 0%, #e6f0ff 55%, #bcd5fb 100%);
  box-shadow: 0 0 0 9px rgba(190, 218, 255, .10), 0 0 56px 8px rgba(170, 205, 255, .38);
}
.hero::after { /* étoiles */
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .7;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 22%, #fff, transparent),
    radial-gradient(1px 1px at 30% 70%, #cfe3ff, transparent),
    radial-gradient(1.5px 1.5px at 52% 14%, #fff, transparent),
    radial-gradient(1px 1px at 8% 80%, #cfe3ff, transparent),
    radial-gradient(1px 1px at 64% 58%, #fff, transparent);
}
.hero > * { position: relative; z-index: 1; }
.hero-owl { width: 76%; height: auto; margin-top: 6%; animation: float 5.5s ease-in-out infinite; filter: drop-shadow(0 6px 8px rgba(0, 30, 80, .25)); }
.hero h1 { font-size: 25px; max-width: 62%; margin-bottom: 8px; }
.hero p { color: #cfe0ff; font-size: 14px; max-width: 78%; margin-bottom: 16px; }
.hero .btn-accent { box-shadow: 0 10px 24px -8px rgba(251, 155, 40, .9); }
.hero .eyebrow { color: #9fc2f5; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 6px; max-width: 60%; }
.hero { min-height: 190px; }

.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--soft-accent); color: color-mix(in srgb, var(--orange-600) 55%, var(--text)); font-size: 13.5px; line-height: 1.45; }
.callout .icon { color: var(--orange-600); margin-top: 1px; }
.callout.info { background: var(--soft-primary); color: var(--text); }
.callout.info .icon { color: var(--link); }

/* ---------- Parcours (stepper) & historique ---------- */
.stepper { display: flex; align-items: flex-start; }
.step { flex: 1; text-align: center; position: relative; font-size: 11px; font-weight: 700; color: var(--muted); padding-top: 34px; line-height: 1.2; }
.step::before { /* pastille */
  content: ''; position: absolute; top: 4px; left: 50%; width: 22px; height: 22px; margin-left: -11px; border-radius: 50%;
  background: var(--surface); border: 2.5px solid var(--line); z-index: 1;
}
.step::after { /* trait */
  content: ''; position: absolute; top: 14px; left: -50%; width: 100%; height: 3px; background: var(--line);
}
.step:first-child::after { display: none; }
@media (max-width: 420px) { .step { font-size: 10px; letter-spacing: -.01em; } }
.step.is-done { color: var(--text); }
.step.is-done::before { background: var(--teal); border-color: var(--teal); }
.step.is-done::after { background: var(--teal); }
.step.is-current { color: var(--text); }
.step.is-current::before { background: var(--orange); border-color: var(--orange); box-shadow: 0 0 0 5px color-mix(in srgb, var(--orange) 25%, transparent); }
.step.is-current::after { background: var(--teal); }
.stepper.lost .step.is-done::before { background: var(--muted); border-color: var(--muted); }
.stepper.lost .step.is-done::after { background: var(--muted); }

.timeline { position: relative; padding-left: 26px; display: flex; flex-direction: column; gap: 18px; }
.timeline::before { content: ''; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; }
.tl-item::before { content: ''; position: absolute; left: -23px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px var(--surface); }
.tl-item.note::before { background: var(--muted); }
.tl-item.private::before { background: var(--orange); }
.tl-title { font-weight: 700; font-size: 14px; }
.tl-msg { font-size: 14px; margin-top: 2px; white-space: pre-line; }
.tl-time { color: var(--muted); font-size: 12px; }

.kv { display: flex; flex-direction: column; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-top: 1px solid var(--line); }
.kv > div:first-child { border-top: 0; }
.kv dt { color: var(--muted); font-size: 13.5px; flex: none; }
.kv dd { margin: 0; font-weight: 600; text-align: right; font-size: 14px; word-break: break-word; }

.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-grid a, .photo-slot { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--surface-2); display: block; }
.photo-grid img, .photo-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-slot button { position: absolute; top: 5px; right: 5px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0, 20, 50, .7); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.photo-add { aspect-ratio: 1; border-radius: 14px; border: 2px dashed color-mix(in srgb, var(--link) 40%, var(--line)); background: var(--soft-primary); color: var(--link); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 12px; font-weight: 700; cursor: pointer; position: relative; }
.photo-add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }

/* ---------- Messages ---------- */
.flashes { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.flash { display: flex; align-items: flex-start; gap: 10px; padding: 13px 15px; border-radius: 14px; font-weight: 600; font-size: 14px; animation: fade-up .3s ease both; }
.flash.success { background: color-mix(in srgb, var(--success) 13%, var(--surface)); color: color-mix(in srgb, var(--success) 75%, var(--text)); }
.flash.error { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: color-mix(in srgb, var(--danger) 80%, var(--text)); }
.flash.info { background: var(--soft-primary); color: var(--text); }

.empty { text-align: center; padding: 34px 22px; }
.empty img { width: 92px; margin: 0 auto 12px; display: block; opacity: .95; }
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 320px; margin: 0 auto 16px; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; background: #0b1b33; color: #fff; padding: 12px 18px; border-radius: 16px; font-weight: 700; font-size: 14px; line-height: 1.35; text-align: center; width: max-content; max-width: min(88vw, 340px); z-index: 100; transition: all .25s; pointer-events: none; box-shadow: var(--shadow-lg); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Dialogue / feuille ---------- */
dialog.sheet { border: 0; padding: 0; width: min(480px, 100%); max-height: 88dvh; margin: auto auto 0; border-radius: 26px 26px 0 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); overflow: auto; }
dialog.sheet::backdrop { background: rgba(0, 15, 40, .55); backdrop-filter: blur(3px); }
dialog.sheet[open] { animation: fade-up .25s ease both; }
.sheet-body { padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); }
.sheet-handle { width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: 10px auto 0; }
@media (min-width: 640px) { dialog.sheet { margin: auto; border-radius: 26px; } }

/* ---------- QR / partage ---------- */
.qr { width: 190px; margin: 0 auto; padding: 14px; border-radius: 20px; background: #fff; box-shadow: var(--shadow); }
.qr svg { display: block; width: 100%; height: auto; }
.qr svg path { fill: #003784 !important; }
.linkbox { display: flex; gap: 8px; align-items: center; padding: 10px 10px 10px 14px; border-radius: 14px; background: var(--surface-2); border: 1.5px solid var(--line); }
.linkbox code { flex: 1; min-width: 0; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; }
.share-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }

/* ---------- Filtres ---------- */
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; margin: 0 -2px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.fchip { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line); font-weight: 700; font-size: 13.5px; color: var(--text); text-decoration: none !important; }
.fchip .n { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.fchip.is-active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.fchip.is-active .n { color: color-mix(in srgb, var(--on-primary) 75%, transparent); }
.search { position: relative; }
.search .icon { position: absolute; left: 14px; top: 14px; color: var(--muted); }
.search .input { padding-left: 42px; }

.funnel { display: flex; flex-direction: column; gap: 4px; padding: 8px 18px 16px; }
.funnel-row { display: grid; grid-template-columns: 128px 1fr 34px; align-items: center; gap: 12px; padding: 7px 0; color: inherit; text-decoration: none !important; border-radius: 10px; }
a.funnel-row:hover { background: var(--surface-2); }
.funnel-label { font-size: 13.5px; font-weight: 700; white-space: nowrap; }
.funnel-track { height: 10px; border-radius: 6px; background: color-mix(in srgb, var(--line) 70%, transparent); overflow: hidden; }
.funnel-track i { display: block; height: 100%; border-radius: 6px; background: var(--st, var(--link)); min-width: 0; }
.funnel-n { text-align: right; font-weight: 800; font-size: 14px; }
.dot-new { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); display: inline-block; margin-right: 6px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }

.bars { display: flex; align-items: flex-end; gap: 8px; height: 110px; padding-top: 8px; }
.bars > div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.bars i { display: block; width: 100%; max-width: 34px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, var(--teal), var(--navy-600)); min-height: 4px; }
.bars span { font-size: 11px; color: var(--muted); font-weight: 600; }
.bars b { font-size: 11px; font-weight: 800; }

/* ---------- Barre d'application (apporteur) ---------- */
.app-shell { max-width: 560px; margin: 0 auto; min-height: 100dvh; padding-bottom: calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); position: relative; }
.appbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -.03em; color: var(--text); text-decoration: none !important; }
.brand-chip { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: #fff; box-shadow: 0 2px 8px rgba(0, 40, 100, .14); }
.brand-chip img { width: 28px; height: auto; display: block; }
.bell { position: relative; }
.bell .dot { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--bg); }
.page { padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 18px; animation: fade-up .3s ease both; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.page-sub { color: var(--muted); margin-top: 4px; }
.back { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--muted); font-size: 14px; margin: 4px 0 -4px; }

.tabbar {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 40;
  width: 100%; max-width: 560px; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 0 8px env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid var(--line); border-radius: 22px 22px 0 0; box-shadow: 0 -8px 30px -12px rgba(0, 30, 80, .18);
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px; font-size: 11px; font-weight: 700; color: var(--muted); text-decoration: none !important; position: relative; -webkit-tap-highlight-color: transparent; }
.tab .icon { width: 23px; height: 23px; }
.tab.is-active { color: var(--link); }
.tab.is-active::before { content: ''; position: absolute; top: 0; width: 26px; height: 3px; border-radius: 0 0 4px 4px; background: var(--link); }
.tab-fab { margin-top: -26px; color: var(--text); }
.tab-fab i { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(145deg, #ffb04a, var(--orange)); color: #2a1600; box-shadow: 0 10px 22px -6px rgba(251, 155, 40, .85), 0 0 0 5px var(--bg); transition: transform .15s; }
.tab-fab:active i { transform: scale(.92); }
.tab-fab .icon { width: 28px; height: 28px; }
.tab .badge-dot { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-size: 10.5px; font-weight: 800; display: grid; place-items: center; }

body.app { background: radial-gradient(90% 40% at 50% -10%, color-mix(in srgb, var(--primary) 9%, transparent), transparent), var(--bg); }

.install { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1.5px dashed color-mix(in srgb, var(--link) 45%, var(--line)); }
.install .item-lead { background: var(--soft-accent); color: var(--orange-600); }
.install-steps { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14px; display: flex; flex-direction: column; gap: 8px; }
.install-steps li::marker { color: var(--orange-600); font-weight: 800; }

.level { display: flex; align-items: center; gap: 14px; }
.level-badge { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(145deg, #ffb04a, var(--orange)); color: #2a1600; flex: none; box-shadow: 0 8px 18px -8px rgba(251, 155, 40, .9); }

/* ---------- Back-office mandataire ---------- */
.admin-shell { min-height: 100dvh; }
.sidebar { display: none; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); }
.admin-main { padding-bottom: calc(var(--tabbar-h) + 30px + env(safe-area-inset-bottom)); }
.admin-main .page { max-width: 1120px; margin: 0 auto; }
.admin-shell .tabbar { max-width: none; border-radius: 0; grid-template-columns: repeat(5, 1fr); }
.admin-shell .tabbar .tab.is-active::before { top: 0; }

@media (min-width: 1024px) {
  .sidebar {
    display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: 268px; padding: 22px 16px; z-index: 40; color: #dce8ff;
    background: radial-gradient(120% 60% at 0% 0%, rgba(30, 150, 215, .28), transparent 60%), linear-gradient(180deg, #002a66, #00163a);
  }
  .sidebar .brand { color: #fff; margin: 4px 8px 26px; }
  .sidebar nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
  .side-link { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; font-weight: 700; font-size: 14.5px; color: #b9cdf0; text-decoration: none !important; transition: background .15s, color .15s; position: relative; }
  .side-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
  .side-link.is-active { background: rgba(255, 255, 255, .13); color: #fff; box-shadow: inset 3px 0 0 var(--orange); }
  .side-link .count { margin-left: auto; background: var(--orange); color: #2a1600; font-size: 12px; font-weight: 800; padding: 1px 8px; border-radius: 999px; }
  .side-foot { border-top: 1px solid rgba(255, 255, 255, .12); padding-top: 14px; display: flex; align-items: center; gap: 10px; }
  .side-foot .avatar { background: rgba(255, 255, 255, .14); color: #fff; }
  .side-foot .who { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 700; color: #fff; }
  .side-foot .who span { display: block; font-weight: 500; color: #9fb7e3; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side-foot button { background: rgba(255, 255, 255, .1); border: 0; color: #fff; width: 38px; height: 38px; border-radius: 12px; cursor: pointer; display: grid; place-items: center; }
  .side-foot button:hover { background: rgba(255, 255, 255, .2); }
  .admin-shell { padding-left: 268px; }
  .admin-shell .tabbar, .topbar .brand { display: none; }
  .topbar { padding: 18px 32px 6px; background: transparent; backdrop-filter: none; justify-content: flex-end; }
  .admin-main { padding-bottom: 40px; }
  .admin-main .page { padding: 8px 32px 24px; }
  .stats.cols-4 { grid-template-columns: repeat(4, 1fr); }
  .split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
  .split.even { grid-template-columns: 1fr 1fr; }
  .hide-desktop { display: none !important; }
  .page h1 { font-size: 30px; }
}
@media (max-width: 1023px) { .hide-mobile { display: none !important; } .split { display: flex; flex-direction: column; gap: 18px; } }
@media (min-width: 700px) and (max-width: 1023px) { .stats.cols-4 { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Pages publiques & authentification ---------- */
body.public { background: radial-gradient(70% 50% at 50% 0%, color-mix(in srgb, var(--primary) 14%, transparent), transparent 70%), var(--bg); }
.public-shell { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; padding: 28px 18px 40px; }
.auth-card { width: 100%; max-width: 430px; margin: auto; }
.auth-logo { display: block; width: 190px; margin: 0 auto 26px; }
.auth-card .card { padding: 26px 22px; }
.auth-card h1 { font-size: 24px; margin-bottom: 6px; }
/* Le logo à texte marine est dessiné pour fond clair : en sombre, on le pose sur une plaque blanche */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .auth-logo { background: #fff; border-radius: 22px; padding: 10px 16px; width: 210px; } }
:root[data-theme="dark"] .auth-logo { background: #fff; border-radius: 22px; padding: 10px 16px; width: 210px; }

.landing { width: 100%; max-width: 1040px; margin: 0 auto; display: flex; flex-direction: column; gap: 28px; }
.landing-nav { display: flex; align-items: center; justify-content: space-between; }
.landing-hero { padding: 40px 28px; border-radius: 32px; }
.landing-hero h1 { font-size: clamp(30px, 6vw, 48px); max-width: 560px; }
.landing-hero p { font-size: 16.5px; max-width: 520px; }
.landing-hero { --art: clamp(140px, 26vw, 280px); }
.landing-hero .hero-art { right: clamp(14px, 4vw, 48px); top: 50%; transform: translateY(-50%); }
.landing-hero .eyebrow, .landing-hero h1, .landing-hero p { max-width: min(560px, 70%); }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.feature { padding: 22px; }
.feature .stat-icon { margin-bottom: 14px; }
.feature h3 { margin-bottom: 6px; }
.feature p { color: var(--muted); font-size: 14.5px; }
.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 14px 0 6px; }

/* Écran d'accueil d'un apporteur invité */
.welcome { text-align: center; padding: 8px 4px; }
.welcome-owl { width: 130px; margin: 0 auto 6px; display: block; animation: float 5s ease-in-out infinite; filter: drop-shadow(0 10px 18px rgba(0, 40, 100, .25)); }
.celebrate-owl { width: 120px; margin: 0 auto; display: block; animation: pop .6s cubic-bezier(.2, 1.4, .4, 1) both; }

@media (display-mode: standalone) { .pwa-hide-standalone { display: none !important; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print { .tabbar, .sidebar, .topbar, .appbar { display: none !important; } }
