/* MYLLKA. Instinct Protection
   Palette : encre et corail d'Instinct Protection, sur fond ivoire */

:root {
  /* Palette de base. Chaque thème ne redéfinit que ces valeurs :
     tout le reste en découle par color-mix, y compris les fonds teintés,
     qui s'éclaircissent ou s'assombrissent selon la surface du thème. */
  --navy:        #181614;
  --navy-deep:   #0F0E0D;
  --navy-soft:   #3A342F;
  --sienna:      #ED694B;
  --sienna-hover:#C24428;
  --sienna-soft: #F2937C;
  --sage:        #5C8A7A;
  --sage-soft:   #7FAB9B;

  --bg:          #FBF6F2;
  --bg-alt:      #F2EAE3;
  --surface:     #FFFFFF;
  --surface-2:   #FDFAF8;
  --line:        #E9E0D8;
  --line-strong: #D5C9BE;

  --ink:         #1C1917;
  --ink-2:       #4A433E;
  --ink-3:       #756C66;

  --danger:      #B4453A;
  --ok:          #4A7C59;
  --warn:        #C08A2E;
  --info:        #4E5B6B;

  /* Texte posé sur les aplats colorés */
  --sur-accent:  #FFFFFF;
  --sur-primary: #FFFFFF;

  /* Dégradé de l'écran de connexion */
  --hero-1:      #26211D;
  --hero-2:      #181614;
  --hero-3:      #0E0D0C;

  /* Fonds teintés, dérivés : valables sur surface claire comme sombre */
  --ok-bg:       color-mix(in srgb, var(--ok) 14%, var(--surface));
  --ok-bord:     color-mix(in srgb, var(--ok) 30%, var(--surface));
  --ok-fg:       color-mix(in srgb, var(--ok) 76%, var(--ink));
  --warn-bg:     color-mix(in srgb, var(--warn) 16%, var(--surface));
  --warn-bord:   color-mix(in srgb, var(--warn) 34%, var(--surface));
  --warn-fg:     color-mix(in srgb, var(--warn) 72%, var(--ink));
  --danger-bg:   color-mix(in srgb, var(--danger) 13%, var(--surface));
  --danger-bord: color-mix(in srgb, var(--danger) 30%, var(--surface));
  --danger-fg:   color-mix(in srgb, var(--danger) 74%, var(--ink));
  --info-bg:     color-mix(in srgb, var(--info) 12%, var(--surface));
  --info-bord:   color-mix(in srgb, var(--info) 26%, var(--surface));
  --info-fg:     color-mix(in srgb, var(--info) 74%, var(--ink));
  /* Le corail de marque tient 3,1:1 avec du blanc : assez pour un aplat
     ou un trait, pas pour du texte. Les boutons pleins prennent donc une
     version assombrie du même corail, qui passe 4,5:1 sans quitter la
     teinte. Le jeton étant dérivé, il suit chaque thème. */
  --sienna-fort: color-mix(in srgb, var(--sienna) 78%, #000000);
  --accent-bg:   color-mix(in srgb, var(--sienna) 12%, var(--surface));
  --accent-sel:  color-mix(in srgb, var(--sienna) 9%, var(--surface));
  --primary-sel: color-mix(in srgb, var(--navy) 8%, var(--surface));

  --ombre-teinte: 24, 22, 20;

  --r-s: 10px;
  --r-m: 16px;
  --r-l: 24px;
  --r-full: 999px;

  --shadow-s: 0 1px 2px rgba(var(--ombre-teinte),.06), 0 2px 8px rgba(var(--ombre-teinte),.05);
  --shadow-m: 0 2px 6px rgba(var(--ombre-teinte),.08), 0 12px 28px rgba(var(--ombre-teinte),.10);
  --shadow-l: 0 8px 20px rgba(var(--ombre-teinte),.12), 0 24px 60px rgba(var(--ombre-teinte),.16);

  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  --display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* L'attribut hidden doit l'emporter sur tout display posé par une classe.
   Sans cette règle, un élément masqué (barre de navigation, pied d'assistant,
   bouton de partage natif) reste invisible mais continue d'intercepter les
   clics, ce qui rend inopérants les boutons situés dessous. */
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.2; margin: 0; text-wrap: balance; }
p { margin: 0 0 1em; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--sienna); outline-offset: 2px; border-radius: 4px; }

/* ─────────── Structure applicative ─────────── */

#app { height: 100dvh; overflow: hidden; position: relative; }

.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  background: var(--bg);
  opacity: 0; visibility: hidden;
  transform: translateX(24px);
  transition: opacity .28s ease, transform .28s ease, visibility .28s;
}
.screen.active { opacity: 1; visibility: visible; transform: none; }

.scroll {
  flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  padding: 0 20px calc(112px + var(--safe-b));
}
.scroll.no-nav { padding-bottom: calc(32px + var(--safe-b)); }

/* ─────────── Barre de titre ─────────── */

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: calc(14px + var(--safe-t)) 20px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.topbar h2 { font-size: 20px; flex: 1; }
.topbar .sub { font-size: 12px; color: var(--ink-3); display: block; font-family: var(--body); font-weight: 400; letter-spacing: .04em; text-transform: uppercase; }

.icon-btn {
  width: 40px; height: 40px; flex-shrink: 0;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--r-full);
  background: var(--surface); cursor: pointer;
  transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--bg-alt); border-color: var(--line-strong); }
.icon-btn svg { width: 19px; height: 19px; stroke: var(--ink-2); fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ─────────── Boutons ─────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 14px 22px; border: none; border-radius: var(--r-full);
  background: var(--sienna-fort); color: var(--sur-accent);
  font-weight: 500; font-size: 15px; cursor: pointer; width: 100%;
  transition: background .16s, transform .1s, box-shadow .16s;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--sienna) 30%, transparent);
}
.btn:hover { background: var(--sienna-hover); }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.btn-ghost { background: transparent; color: var(--navy); border: 1px solid var(--line-strong); box-shadow: none; }
.btn-ghost:hover { background: var(--bg-alt); }
.btn-navy { background: var(--navy); box-shadow: 0 2px 10px color-mix(in srgb, var(--navy) 26%, transparent); }
.btn-navy:hover { background: var(--navy-deep); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger-bord); box-shadow: none; }
.btn-danger:hover { background: var(--danger-bg); }
.btn-sm { padding: 9px 16px; font-size: 13.5px; width: auto; }

/* ─────────── Tableau de bord ─────────── */

.dash-head { padding: calc(20px + var(--safe-t)) 20px 22px; }
.dash-head .hello { font-size: 13px; color: var(--ink-3); letter-spacing: .04em; }
.dash-head .hello .ref-contrat {
  display: block; margin-top: 2px; font-size: 12px;
  color: var(--ink-3); letter-spacing: .03em; font-variant-numeric: tabular-nums;
}
.dash-head h1 { font-size: 30px; margin-top: 3px; }
.dash-head .count { font-size: 13px; color: var(--ink-2); margin-top: 8px; }
.dash-head .count b { color: var(--sienna); font-weight: 600; }

.animal-grid { display: flex; flex-direction: column; gap: 14px; }

.animal-card {
  display: flex; align-items: stretch; gap: 0;
  background: var(--surface); border-radius: var(--r-m);
  border: 1px solid var(--line);
  overflow: hidden; cursor: pointer; text-align: left; padding: 0; width: 100%;
  box-shadow: var(--shadow-s);
  transition: transform .16s, box-shadow .16s, border-color .16s;
}
.animal-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-m); border-color: var(--line-strong); }
.animal-card .stripe { width: 5px; flex-shrink: 0; }
.animal-card[data-espece="chien"] .stripe { background: var(--navy-soft); }
.animal-card[data-espece="chat"]  .stripe { background: var(--sienna); }
.animal-card[data-espece="nac"]   .stripe { background: var(--sage); }

.animal-card .thumb {
  width: 96px; flex-shrink: 0; background: var(--bg-alt);
  background-size: cover; background-position: center;
  display: grid; place-items: center;
}
.animal-card .thumb .ph { font-size: 30px; opacity: .32; }
.animal-card .body { flex: 1; padding: 15px 16px; min-width: 0; }
.animal-card .name { font-family: var(--display); font-size: 20px; font-weight: 600; margin-bottom: 2px; }
.animal-card .race { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.animal-card .meta { display: flex; gap: 8px; margin-top: 9px; flex-wrap: wrap; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; padding: 3px 9px; border-radius: var(--r-full);
  background: var(--bg-alt); color: var(--ink-2); letter-spacing: .02em;
}
.chip.icad { background: var(--ok-bg); color: var(--ok-fg); font-variant-numeric: tabular-nums; }
.chip.warn { background: var(--warn-bg); color: var(--warn-fg); }

/* Complétude */
.progress-ring { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.progress-bar { flex: 1; height: 4px; background: var(--bg-alt); border-radius: var(--r-full); overflow: hidden; }
.progress-bar span { display: block; height: 100%; background: var(--sage); border-radius: var(--r-full); transition: width .5s ease; }
.progress-ring .pct { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* État vide */
.empty { text-align: center; padding: 56px 24px; }
.empty .glyph { font-size: 52px; margin-bottom: 18px; opacity: .3; }
.empty h3 { font-size: 22px; margin-bottom: 10px; }
.empty p { color: var(--ink-2); font-size: 14.5px; max-width: 320px; margin: 0 auto 26px; }

/* ─────────── Navigation basse ─────────── */

.bottomnav {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(14px + var(--safe-b));
  display: flex; gap: 2px; padding: 6px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  box-shadow: var(--shadow-l);
  backdrop-filter: blur(20px);
  z-index: 40;
}
.bottomnav button {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 18px; border: none; background: none; cursor: pointer;
  border-radius: var(--r-full); color: var(--ink-3);
  font-size: 10.5px; letter-spacing: .02em;
  transition: background .16s, color .16s;
}
.bottomnav button svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bottomnav button.on { color: var(--navy); background: var(--bg-alt); }
.bottomnav button.accent.on { color: var(--sur-accent); background: var(--sienna); }

/* ─────────── Assistant d'ajout ─────────── */

.steps { display: flex; gap: 6px; padding: 0 20px 18px; }
.steps i {
  flex: 1; height: 3px; background: var(--line); border-radius: var(--r-full);
  transition: background .3s;
}
.steps i.done { background: var(--sienna); }

.step-title { font-size: 24px; margin-bottom: 6px; }
.step-help { font-size: 14px; color: var(--ink-2); margin-bottom: 24px; }

.espece-grid { display: grid; gap: 12px; }
.espece-card {
  display: flex; align-items: center; gap: 16px;
  padding: 20px; border: 1.5px solid var(--line); border-radius: var(--r-m);
  background: var(--surface); cursor: pointer; text-align: left; width: 100%;
  transition: border-color .16s, background .16s, transform .12s;
}
.espece-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.espece-card.sel { border-color: var(--sienna); background: var(--accent-sel); }
.espece-card .glyph { font-size: 34px; }
.espece-card .t { font-family: var(--display); font-size: 19px; font-weight: 600; }
.espece-card .d { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }

/* Recherche de race */
.search-wrap { position: relative; margin-bottom: 14px; }
.search-wrap svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; stroke: var(--ink-3); fill: none; stroke-width: 2; }
.search-wrap input { width: 100%; padding: 13px 15px 13px 44px; border: 1px solid var(--line); border-radius: var(--r-full); background: var(--surface); }
.search-wrap input:focus { outline: none; border-color: var(--sienna); }

.race-list { border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); overflow: hidden; max-height: 46vh; overflow-y: auto; }
.race-list button {
  display: block; width: 100%; text-align: left; padding: 13px 16px;
  border: none; border-bottom: 1px solid var(--line); background: none; cursor: pointer; font-size: 14.5px;
}
.race-list button:last-child { border-bottom: none; }
.race-list button:hover { background: var(--surface-2); }
.race-list button.sel { background: var(--accent-sel); color: var(--sienna); font-weight: 500; }
.race-list .grp { padding: 9px 16px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); background: var(--bg-alt); font-weight: 500; }
.race-list .none { padding: 24px 16px; text-align: center; color: var(--ink-3); font-size: 14px; }

/* ─────────── Formulaires ─────────── */

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 7px; font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%; padding: 13px 15px;
  border: 1px solid var(--line); border-radius: var(--r-s);
  background: var(--surface);
}
.field textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--sienna); }
.field .hint { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.field input.mono { font-variant-numeric: tabular-nums; letter-spacing: .06em; }

.tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.tag {
  padding: 7px 13px; border: 1px solid var(--line); border-radius: var(--r-full);
  background: var(--surface); font-size: 13px; cursor: pointer; color: var(--ink-2);
  transition: all .14s;
}
.tag:hover { border-color: var(--line-strong); }
.tag.on { background: var(--navy); border-color: var(--navy); color: var(--sur-primary); }

/* ─────────── Photos ─────────── */

.photo-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.photo-slot {
  aspect-ratio: 1; border-radius: var(--r-m); overflow: hidden;
  border: 1.5px dashed var(--line-strong); background: var(--surface-2);
  display: grid; place-items: center; cursor: pointer; position: relative;
  background-size: cover; background-position: center;
}
.photo-slot.filled { border-style: solid; border-color: var(--line); }
.photo-slot .plus { font-size: 26px; color: var(--ink-3); font-weight: 300; }
.photo-slot .del {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px;
  border-radius: var(--r-full); background: rgba(28,40,53,.75); border: none;
  color: #fff; cursor: pointer; display: grid; place-items: center; font-size: 15px; line-height: 1;
}

/* ─────────── Fiche animal ─────────── */

.hero {
  position: relative; height: 300px; flex-shrink: 0;
  background: var(--navy-deep); background-size: cover; background-position: center;
  transition: height .3s ease;
}
/* Sur les onglets de saisie, la photo cède la place au formulaire. */
.hero.compact { height: 128px; }
.hero.compact .caption { bottom: 14px; }
.hero.compact .caption h1 { font-size: 23px; }
.hero.compact .caption .race,
.hero.compact .caption .ident { display: none; }
.hero.compact .noimg { font-size: 40px; }
.hero::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(26,43,62,.45) 0%, rgba(26,43,62,0) 32%, rgba(26,43,62,.55) 62%, rgba(26,43,62,.94) 100%);
}
.hero .back {
  position: absolute; top: calc(14px + var(--safe-t)); left: 16px; z-index: 3;
  width: 40px; height: 40px; border-radius: var(--r-full);
  background: rgba(255,255,255,.9); border: none; cursor: pointer;
  display: grid; place-items: center; backdrop-filter: blur(10px);
}
.hero .back svg { width: 19px; height: 19px; stroke: var(--navy); fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.hero .caption { position: absolute; bottom: 22px; left: 22px; right: 22px; z-index: 3; }
.hero .caption h1 { font-size: 36px; color: #fff; margin-bottom: 5px; }
.hero .caption .race { color: rgba(255,255,255,.78); font-size: 13.5px; }
.hero .caption .ident {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 11px;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.22);
  padding: 5px 12px; border-radius: var(--r-full);
  color: #fff; font-size: 12px; font-variant-numeric: tabular-nums; letter-spacing: .05em;
  backdrop-filter: blur(8px);
}
.hero .noimg { position: absolute; inset: 0; display: grid; place-items: center; font-size: 76px; opacity: .18; }

.tabs { display: flex; gap: 4px; padding: 12px 16px; overflow-x: auto; background: var(--surface); border-bottom: 1px solid var(--line); flex-shrink: 0; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  padding: 8px 15px; border: none; background: none; cursor: pointer;
  border-radius: var(--r-full); font-size: 13.5px; color: var(--ink-2);
  white-space: nowrap; transition: background .15s, color .15s;
}
.tabs button.on { background: var(--navy); color: var(--sur-primary); }

.pane { display: none; padding-top: 22px; }
.pane.on { display: block; }

.sec-title {
  font-family: var(--display); font-size: 18px; font-weight: 600;
  margin: 26px 0 14px; padding-bottom: 9px; border-bottom: 1px solid var(--line);
}
.sec-title:first-child { margin-top: 0; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-m); padding: 18px; margin-bottom: 14px;
}
.card.tinted { background: var(--surface-2); }

.info-row { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.info-row:last-child { border-bottom: none; }
.info-row .k { color: var(--ink-2); flex-shrink: 0; }
.info-row .v { text-align: right; font-weight: 500; }
.info-row .v.mono { font-variant-numeric: tabular-nums; letter-spacing: .04em; }

.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 20px; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--r-s); border: 1px solid var(--line); }

.save-bar { margin-top: 26px; }

.autosave {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 12.5px; color: var(--ink-3); margin-top: 10px;
}
.autosave .pip { width: 6px; height: 6px; border-radius: 50%; background: var(--sage); }
.autosave.saving .pip { background: var(--warn); }
.autosave.echec { color: var(--danger); }
.autosave.echec .pip { background: var(--danger); }

.entry-list { display: flex; flex-direction: column; gap: 9px; }
.entry {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 15px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-s);
}
.entry .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sage); margin-top: 8px; flex-shrink: 0; }
.entry .txt { flex: 1; min-width: 0; }
.entry .txt .t { font-weight: 500; font-size: 14.5px; }
.entry .txt .d { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.rm {
  background: none; border: none; color: var(--ink-3); cursor: pointer;
  font-size: 18px; padding: 0 4px; line-height: 1; flex-shrink: 0;
}
.rm:hover { color: var(--danger); }

.add-inline { display: flex; gap: 8px; margin-top: 12px; }
.add-inline input { flex: 1; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); }
.add-inline input:focus { outline: none; border-color: var(--sienna); }
.add-inline button { padding: 0 18px; border: none; border-radius: var(--r-s); background: var(--navy); color: var(--sur-primary); cursor: pointer; font-weight: 500; }

/* ─────────── Partage ─────────── */

.qr-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 28px; text-align: center; margin-bottom: 20px; }
.qr-card h3 { font-size: 19px; margin-bottom: 8px; }
.qr-card p { font-size: 14px; color: var(--ink-2); margin-bottom: 22px; }
#qrcode { display: inline-block; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-m); }
#qrcode canvas, #qrcode img { display: block; }

.share-btns { display: grid; gap: 10px; }
.share-btn {
  display: flex; align-items: center; gap: 14px; padding: 15px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m);
  cursor: pointer; text-align: left; width: 100%; transition: border-color .15s, transform .12s;
}
.share-btn:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.share-btn .ic { width: 40px; height: 40px; border-radius: var(--r-full); display: grid; place-items: center; font-size: 19px; flex-shrink: 0; }
.share-btn .t { font-weight: 500; font-size: 15px; }
.share-btn .d { font-size: 12.5px; color: var(--ink-3); }

/* ─────────── Divers ─────────── */

.notice {
  display: flex; gap: 11px; padding: 14px 16px; border-radius: var(--r-m);
  background: var(--warn-bg); border: 1px solid var(--warn-bord); font-size: 13.5px; color: var(--warn-fg);
  margin-bottom: 18px; line-height: 1.5;
}
.notice.info { background: var(--info-bg); border-color: var(--info-bord); color: var(--info-fg); }
.notice .g { font-size: 17px; flex-shrink: 0; }

.legal-body { font-size: 14.5px; color: var(--ink-2); line-height: 1.7; }
.legal-body h3 { font-size: 17px; color: var(--ink); margin: 26px 0 10px; }
.legal-body h3:first-child { margin-top: 0; }
.legal-body ul { padding-left: 20px; margin: 0 0 1em; }
.legal-body li { margin-bottom: 6px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(20px);
  bottom: calc(90px + var(--safe-b)); z-index: 200;
  background: var(--navy); color: var(--sur-primary); padding: 12px 22px; border-radius: var(--r-full);
  font-size: 14px; box-shadow: var(--shadow-l);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

.sheet-back {
  position: fixed; inset: 0; z-index: 100; background: rgba(28,40,53,.5);
  opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s;
  backdrop-filter: blur(2px);
}
.sheet-back.on { opacity: 1; visibility: visible; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 101;
  background: var(--bg); border-radius: var(--r-l) var(--r-l) 0 0;
  padding: 10px 20px calc(24px + var(--safe-b));
  max-height: 88dvh; overflow-y: auto;
  transform: translateY(100%); transition: transform .3s cubic-bezier(.32,.72,0,1);
  box-shadow: var(--shadow-l);
}
.sheet.on { transform: none; }
.sheet .grab { width: 38px; height: 4px; background: var(--line-strong); border-radius: var(--r-full); margin: 0 auto 18px; }
.sheet h3 { font-size: 20px; margin-bottom: 6px; }
.sheet .sub { font-size: 14px; color: var(--ink-2); margin-bottom: 20px; }

.spinner {
  width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.28);
  border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.mode-badge {
  position: fixed; top: calc(8px + var(--safe-t)); right: 12px; z-index: 60;
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  background: var(--warn); color: #fff; padding: 3px 10px; border-radius: var(--r-full);
  font-weight: 600;
  cursor: pointer; border: none; font: inherit; font-size: 11px;
}

@media (min-width: 720px) {
  .scroll { max-width: 620px; margin: 0 auto; width: 100%; }
  .dash-head { max-width: 620px; margin: 0 auto; width: 100%; }
  .steps { max-width: 620px; margin: 0 auto; width: 100%; }
  .hero { height: 340px; }
  .animal-grid { display: grid; grid-template-columns: 1fr 1fr; }
  .photo-slots { max-width: 420px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ═══════════ Offres partenaires ═══════════ */

.offres-intro { padding: 4px 0 20px; }
.offres-intro p { font-size: 14.5px; color: var(--ink-2); margin: 0; }
.offres-saison {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 14px;
  font-size: 12.5px; color: var(--ok-fg); background: var(--ok-bg);
  padding: 6px 13px; border-radius: var(--r-full); font-weight: 500;
}
.offres-saison .pastille {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent);
}

.filtres { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 18px; scrollbar-width: none; }
.filtres::-webkit-scrollbar { display: none; }
.filtre {
  flex-shrink: 0; padding: 8px 15px; border: 1px solid var(--line);
  border-radius: var(--r-full); background: var(--surface); cursor: pointer;
  font-size: 13.5px; color: var(--ink-2); white-space: nowrap; transition: all .14s;
}
.filtre:hover { border-color: var(--line-strong); }
.filtre.on { background: var(--navy); border-color: var(--navy); color: var(--sur-primary); }

.offres-liste { display: flex; flex-direction: column; gap: 14px; }

.offre {
  display: block; width: 100%; text-align: left; cursor: pointer;
  padding: 18px; border-radius: var(--r-m); border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow-s);
  transition: transform .16s, box-shadow .16s, border-color .16s;
}
.offre:hover { transform: translateY(-2px); box-shadow: var(--shadow-m); border-color: var(--line-strong); }

.offre-tete { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.offre-glyphe {
  width: 42px; height: 42px; border-radius: var(--r-s);
  display: grid; place-items: center; font-size: 21px; flex-shrink: 0;
}
.offre-glyphe.grand { width: 56px; height: 56px; font-size: 27px; }

.offre-avantage {
  font-family: var(--display); font-size: 21px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.offre-saison {
  margin-left: auto; font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase;
  background: var(--ok-bg); color: var(--ok-fg); padding: 4px 9px; border-radius: var(--r-full); font-weight: 600;
}

.offre-partenaire {
  font-size: 11px; letter-spacing: .11em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 500; margin-bottom: 4px;
}
.offre-titre { font-family: var(--display); font-size: 19px; font-weight: 600; margin-bottom: 7px; }
.offre-accroche { font-size: 14px; color: var(--ink-2); line-height: 1.55; }

.offre-pied {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line);
}
.offre-validite { font-size: 12px; color: var(--ink-3); }
.offre-fleche { font-size: 13px; font-weight: 500; color: var(--sienna); }

/* Teintes par famille d'offre */
.offre[data-teinte="ambre"]  .offre-glyphe,
[data-teinte="ambre"]  .offre-glyphe { background: var(--warn-bg); }
.offre[data-teinte="navy"]   .offre-glyphe,
[data-teinte="navy"]   .offre-glyphe { background: var(--info-bg); }
.offre[data-teinte="sauge"]  .offre-glyphe,
[data-teinte="sauge"]  .offre-glyphe { background: var(--ok-bg); }
.offre[data-teinte="sienna"] .offre-glyphe,
[data-teinte="sienna"] .offre-glyphe { background: var(--accent-bg); }

.offre[data-teinte="ambre"]  .offre-avantage { color: var(--warn-fg); }
.offre[data-teinte="navy"]   .offre-avantage { color: var(--info-fg); }
.offre[data-teinte="sauge"]  .offre-avantage { color: var(--ok-fg); }
.offre[data-teinte="sienna"] .offre-avantage { color: var(--sienna); }

.offre-sheet-tete { display: flex; align-items: center; gap: 14px; }
.offre-sheet-tete .offre-avantage { font-size: 30px; }

.code-promo {
  display: flex; align-items: center; gap: 12px; margin-top: 20px;
  padding: 15px 17px; border-radius: var(--r-m);
  border: 1.5px dashed var(--line-strong); background: var(--surface-2);
}
.code-label { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); }
.code-valeur {
  font-family: var(--display); font-size: 19px; font-weight: 600; letter-spacing: .04em;
  margin-top: 2px; white-space: nowrap;
}
.code-promo > div:first-child { flex: 1; min-width: 0; }
.code-copier {
  padding: 9px 17px; border: none; border-radius: var(--r-full);
  background: var(--navy); color: var(--sur-primary); cursor: pointer; font-size: 13.5px; font-weight: 500;
  flex-shrink: 0;
}
.code-copier:hover { background: var(--navy-deep); }

.conditions { padding-left: 19px; margin: 0 0 16px; font-size: 14px; color: var(--ink-2); line-height: 1.6; }
.conditions li { margin-bottom: 7px; }

/* Accès au partage depuis le compte */
.lien-partage {
  display: flex; align-items: center; gap: 13px; width: 100%; text-align: left;
  padding: 15px 17px; border: 1px solid var(--line); border-radius: var(--r-m);
  background: var(--surface); cursor: pointer; transition: border-color .15s, transform .12s;
}
.lien-partage:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.lien-partage .ic {
  width: 40px; height: 40px; border-radius: var(--r-full); background: var(--accent-bg);
  display: grid; place-items: center; flex-shrink: 0;
}
.lien-partage .ic svg { width: 19px; height: 19px; stroke: var(--sienna); fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.lien-partage .t { font-weight: 500; font-size: 15px; }
.lien-partage .d { font-size: 12.5px; color: var(--ink-3); }

/* ═══════════ Assistant, pied de page permanent ═══════════ */

.wz-foot {
  flex-shrink: 0; padding: 14px 20px calc(16px + var(--safe-b));
  background: var(--surface); border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(28,40,53,.05);
}
.wz-choix {
  display: flex; align-items: center; gap: 9px; margin-bottom: 11px;
  font-size: 13.5px; min-height: 21px;
}
.wz-choix .coche {
  width: 19px; height: 19px; border-radius: 50%; background: var(--ok);
  color: #fff; display: grid; place-items: center; font-size: 11px; flex-shrink: 0;
}
.wz-choix .val { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wz-choix .vide { color: var(--ink-3); }

/* Sélection franche dans les listes de choix */
.race-list button.sel {
  background: var(--navy); color: var(--sur-primary); font-weight: 500;
  position: relative; padding-right: 42px;
}
.race-list button.sel::after {
  content: '✓'; position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  font-size: 15px; font-weight: 700;
}
.race-list { max-height: none; }

.espece-card.sel { border-color: var(--navy); border-width: 2px; background: var(--primary-sel); }
.espece-card.sel .t { color: var(--navy); }

/* ═══════════ Rappels de vaccination ═══════════ */

.rappels-bloc {
  background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--warn); border-radius: var(--r-m);
  padding: 15px 16px; margin-bottom: 18px; box-shadow: var(--shadow-s);
}
.rappels-bloc.urgent { border-left-color: var(--danger); }
.rappels-tete { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; }
.rappels-glyphe { font-size: 16px; }
.rappels-titre { font-weight: 600; font-size: 14.5px; }
.rappels-liste { display: flex; flex-direction: column; gap: 2px; }

.rappel-ligne {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 9px 0; border: none; background: none; cursor: pointer;
  border-top: 1px solid var(--line);
}
.rappel-ligne:first-child { border-top: none; }
.rappel-pastille { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.rappel-pastille.danger { background: var(--danger); }
.rappel-pastille.warn   { background: var(--warn); }
.rappel-pastille.ok     { background: var(--ok); }
.rappel-texte { flex: 1; min-width: 0; }
.rappel-quoi { display: block; font-size: 14px; font-weight: 500; }
.rappel-qui  { display: block; font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.rappel-fleche { color: var(--ink-3); font-size: 20px; line-height: 1; }
.rappels-reste { font-size: 12px; color: var(--ink-3); padding-top: 9px; border-top: 1px solid var(--line); }

.chip.retard { background: var(--danger-bg); color: var(--danger-fg); }

/* Éditeur */
.rappel-edit-liste { display: flex; flex-direction: column; gap: 10px; }
.rappel-edit {
  border: 1px solid var(--line); border-radius: var(--r-s);
  background: var(--surface); padding: 12px 14px;
}
.rappel-edit-haut { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 9px; }
.rappel-edit-nom { flex: 1; font-weight: 500; font-size: 14.5px; }
.rappel-edit-bas { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rappel-edit-bas input[type="date"] {
  padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--r-s);
  background: var(--surface-2); font-size: 13.5px; min-width: 148px;
}
.rappel-edit-bas input[type="date"]:focus { outline: none; border-color: var(--sienna); }

.rappel-statut {
  font-size: 12px; padding: 4px 10px; border-radius: var(--r-full); font-weight: 500;
}
.rappel-statut.danger { background: var(--danger-bg); color: var(--danger-fg); }
.rappel-statut.warn   { background: var(--warn-bg); color: var(--warn-fg); }
.rappel-statut.ok     { background: var(--ok-bg); color: var(--ok-fg); }
.rappel-statut.vide   { background: var(--bg-alt); color: var(--ink-3); }

.rappel-ics {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 10px;
  padding: 7px 13px; border: 1px solid var(--line); border-radius: var(--r-full);
  background: var(--surface-2); cursor: pointer; font-size: 12.5px; color: var(--ink-2);
}
.rappel-ics:hover { border-color: var(--line-strong); background: var(--bg-alt); }

.notice.ok     { background: var(--ok-bg); border-color: var(--ok-bord); color: var(--ok-fg); }
.notice.danger { background: var(--danger-bg); border-color: var(--danger-bord); color: var(--danger-fg); }

/* ═══════════ Bandeau de mise à jour ═══════════ */

.maj-bandeau {
  position: fixed; left: 12px; right: 12px; z-index: 300;
  bottom: calc(12px + var(--safe-b));
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px 13px 17px;
  background: var(--navy); color: var(--sur-primary);
  border-radius: var(--r-m); box-shadow: var(--shadow-l);
  transform: translateY(140%); opacity: 0;
  transition: transform .34s cubic-bezier(.32,.72,0,1), opacity .3s;
}
.maj-bandeau.on { transform: none; opacity: 1; }
.maj-texte { flex: 1; min-width: 0; line-height: 1.35; }
.maj-texte b { display: block; font-size: 14.5px; font-weight: 600; }
.maj-texte span { display: block; font-size: 12px; color: rgba(255,255,255,.62); margin-top: 2px; }
.maj-oui {
  flex-shrink: 0; padding: 9px 17px; border: none; border-radius: var(--r-full);
  background: var(--sienna); color: var(--sur-accent); font-weight: 500; font-size: 13.5px; cursor: pointer;
}
.maj-oui:hover { background: var(--sienna-hover); }
.maj-non {
  flex-shrink: 0; width: 30px; height: 30px; border: none; border-radius: var(--r-full);
  background: rgba(255,255,255,.11); color: rgba(255,255,255,.7);
  cursor: pointer; font-size: 17px; line-height: 1;
}
.maj-non:hover { background: rgba(255,255,255,.2); color: #fff; }

@media (min-width: 560px) {
  .maj-bandeau { left: auto; right: 20px; max-width: 420px; }
}

/* ═══════════ Crédits ═══════════ */

.credit-pied { text-align: center; margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
.credit-marque {
  font-family: var(--display); font-size: 15px; font-weight: 600;
  letter-spacing: .16em; color: var(--ink-2);
}
.credit-ligne { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.credit-design {
  font-size: 11px; color: var(--ink-3); margin-top: 12px;
  letter-spacing: .1em; text-transform: uppercase;
}


/* ═══════════ Animaux du contrat ═══════════ */

.contrat-bloc {
  background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--sage); border-radius: var(--r-m);
  padding: 16px 17px; margin-bottom: 18px; box-shadow: var(--shadow-s);
}
.contrat-tete { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.contrat-glyphe { font-size: 16px; }
.contrat-titre { font-weight: 600; font-size: 14.5px; }
.contrat-texte { font-size: 13.5px; color: var(--ink-2); margin: 0 0 14px; line-height: 1.5; }

.contrat-liste { display: flex; flex-direction: column; gap: 1px; margin-bottom: 15px; }
.contrat-ligne {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 0; border-top: 1px solid var(--line);
}
.contrat-ligne:first-child { border-top: none; }
.contrat-espece { font-size: 19px; flex-shrink: 0; }
.contrat-info { flex: 1; min-width: 0; }
.contrat-nom { display: block; font-size: 14px; font-weight: 500; }
.contrat-detail {
  display: block; font-size: 12px; color: var(--ink-3); margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.contrat-ref {
  font-size: 11.5px; color: var(--ink-3); text-align: center;
  margin-top: 11px; font-variant-numeric: tabular-nums; letter-spacing: .03em;
}


/* ═══════════ Thèmes de couleur ═══════════
   Chaque thème ne redéfinit que les couleurs de base : les fonds teintés,
   les bordures et les ombres en découlent par color-mix, et s'adaptent
   donc seuls à une surface claire comme à une surface sombre.
   Le thème « instinct » reprend la charte d'Instinct Protection, deux
   valeurs et un blanc : l'encre #181614 et le corail #ED694B relevés sur
   instinct-protection.fr. Il sert de valeur par défaut lorsque aucun choix
   n'a encore été fait, et s'accorde avec l'icône de l'application. */

[data-theme="instinct"] {
  --navy: #181614; --navy-deep: #0F0E0D; --navy-soft: #3A342F;
  --sienna: #ED694B; --sienna-hover: #C24428; --sienna-soft: #F2937C;
  --sage: #5C8A7A; --sage-soft: #7FAB9B;
  --bg: #FBF6F2; --bg-alt: #F2EAE3; --surface: #FFFFFF; --surface-2: #FDFAF8;
  --line: #E9E0D8; --line-strong: #D5C9BE;
  --ink: #1C1917; --ink-2: #4A433E; --ink-3: #756C66;
  --danger: #B4453A; --ok: #4A7C59; --warn: #B07E28; --info: #4E5B6B;
  --sur-accent: #FFFFFF; --sur-primary: #FFFFFF;
  --hero-1: #26211D; --hero-2: #181614; --hero-3: #0E0D0C;
  --ombre-teinte: 24, 22, 20;
}

[data-theme="rose"] {
  --navy: #6E2A4E; --navy-deep: #54203C; --navy-soft: #8F3E68;
  --sienna: #C2306B; --sienna-hover: #A62759; --sienna-soft: #E87FAD;
  --sage: #8A6A87; --sage-soft: #B096AE;
  --bg: #FDF4F7; --bg-alt: #F7E6EE; --surface: #FFFFFF; --surface-2: #FEFAFC;
  --line: #F0D8E3; --line-strong: #DEB9CC;
  --ink: #33192A; --ink-2: #66495A; --ink-3: #A0808F;
  --danger: #B4353F; --ok: #4F7F62; --warn: #B07E28; --info: #8F3E68;
  --sur-accent: #FFFFFF; --sur-primary: #FFFFFF;
  --hero-1: #6E2A4E; --hero-2: #4E1C38; --hero-3: #361226;
  --ombre-teinte: 51, 25, 42;
}

[data-theme="or"] {
  --navy: #C9A227; --navy-deep: #B08D1C; --navy-soft: #8A7020;
  --sienna: #D9B441; --sienna-hover: #C9A227; --sienna-soft: #E3C86E;
  --sage: #A89A5E; --sage-soft: #C0B37C;
  --bg: #16150F; --bg-alt: #211F17; --surface: #211F17; --surface-2: #1B1A13;
  --line: #332F22; --line-strong: #4A442F;
  --ink: #F2EDE0; --ink-2: #C7BEA6; --ink-3: #8D8570;
  --danger: #DE7E6E; --ok: #78B287; --warn: #E0B34E; --info: #9DB8D4;
  --sur-accent: #1A1710; --sur-primary: #1A1710;
  --hero-1: #211F17; --hero-2: #16150F; --hero-3: #0E0D08;
  --ombre-teinte: 0, 0, 0;
}

[data-theme="foret"] {
  --navy: #2C5545; --navy-deep: #1E3B30; --navy-soft: #3F7561;
  --sienna: #A56736; --sienna-hover: #8C572D; --sienna-soft: #CE9059;
  --sage: #5C8A7A; --sage-soft: #7FAB9B;
  --bg: #F4F6F1; --bg-alt: #E6EBE0; --surface: #FFFFFF; --surface-2: #FAFBF8;
  --line: #DBE2D3; --line-strong: #C2CDB8;
  --ink: #1E2B24; --ink-2: #48594F; --ink-3: #7E8E83;
  --danger: #A9463B; --ok: #3F7A55; --warn: #A87C26; --info: #3F7561;
  --sur-accent: #FFFFFF; --sur-primary: #FFFFFF;
  --hero-1: #2C5545; --hero-2: #1E3B30; --hero-3: #132A21;
  --ombre-teinte: 30, 43, 36;
}

[data-theme="lagon"] {
  --navy: #10566B; --navy-deep: #0A3B4A; --navy-soft: #2A7B93;
  --sienna: #CE4A31; --sienna-hover: #B23E28; --sienna-soft: #EE8874;
  --sage: #3E8C8C; --sage-soft: #6FAFAF;
  --bg: #F1F6F8; --bg-alt: #DFEBEF; --surface: #FFFFFF; --surface-2: #F8FBFC;
  --line: #D2E1E7; --line-strong: #B4CBD4;
  --ink: #16272E; --ink-2: #3F5B66; --ink-3: #7795A2;
  --danger: #B4453A; --ok: #3B7F6B; --warn: #B07E28; --info: #2A7B93;
  --sur-accent: #FFFFFF; --sur-primary: #FFFFFF;
  --hero-1: #10566B; --hero-2: #0A3B4A; --hero-3: #062A35;
  --ombre-teinte: 22, 39, 46;
}

[data-theme="nuit"] {
  --navy: #7BA7D6; --navy-deep: #95BAE3; --navy-soft: #5F86AE;
  --sienna: #E0925C; --sienna-hover: #EDA671; --sienna-soft: #F0B98C;
  --sage: #7FAB9B; --sage-soft: #9AC0B3;
  --bg: #12161C; --bg-alt: #1B212A; --surface: #1A2028; --surface-2: #161B22;
  --line: #2A323C; --line-strong: #3E4855;
  --ink: #E8EDF3; --ink-2: #AFBBC8; --ink-3: #77879A;
  --danger: #DE7A6D; --ok: #68B583; --warn: #D9A94A; --info: #7BA7D6;
  --sur-accent: #1A1108; --sur-primary: #0F141A;
  --hero-1: #1B212A; --hero-2: #12161C; --hero-3: #0B0E13;
  --ombre-teinte: 0, 0, 0;
}

/* Les thèmes sombres appellent quelques ajustements que color-mix ne peut
   pas déduire : un voile plus dense sur les photos, un QR toujours blanc. */
[data-theme="or"] .hero::after,
[data-theme="nuit"] .hero::after {
  background: linear-gradient(to bottom,
    rgba(0,0,0,.5) 0%, rgba(0,0,0,0) 32%, rgba(0,0,0,.6) 62%, rgba(0,0,0,.95) 100%);
}
[data-theme="or"] .animal-card .thumb,
[data-theme="nuit"] .animal-card .thumb { background: var(--bg-alt); }
[data-theme="or"] #qrcode,
[data-theme="nuit"] #qrcode { background: #fff; }
[data-theme="or"] .photo-slot .del,
[data-theme="nuit"] .photo-slot .del { background: rgba(0,0,0,.72); }

/* ═══════════ Écran de choix des couleurs ═══════════ */

.theme-intro { padding: 6px 0 22px; }
.theme-intro h2 { font-size: 26px; margin-bottom: 8px; }
.theme-intro p { font-size: 14.5px; color: var(--ink-2); margin: 0; }

.theme-grille { display: flex; flex-direction: column; gap: 11px; }

.theme-carte {
  display: flex; align-items: center; gap: 15px; width: 100%; text-align: left;
  padding: 13px 14px; border: 1.5px solid var(--line); border-radius: var(--r-m);
  background: var(--surface); cursor: pointer;
  transition: border-color .16s, transform .12s, box-shadow .16s;
}
.theme-carte:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.theme-carte.sel { border-color: var(--sienna); box-shadow: 0 0 0 3px var(--accent-sel); }

.theme-apercu {
  width: 58px; height: 58px; flex-shrink: 0; border-radius: var(--r-s);
  border: 1px solid var(--line); position: relative;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  overflow: hidden;
}
.theme-pastille { width: 16px; height: 16px; border-radius: 50%; display: block; }
.theme-pastille.petite { width: 11px; height: 11px; }
.theme-nuit {
  position: absolute; bottom: 3px; left: 0; right: 0; text-align: center;
  font-size: 8px; letter-spacing: .12em; text-transform: uppercase;
  color: rgba(255,255,255,.5);
}

.theme-texte { flex: 1; min-width: 0; }
.theme-nom {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--display); font-size: 17px; font-weight: 600;
}
.theme-coche {
  width: 17px; height: 17px; border-radius: 50%; flex-shrink: 0;
  background: var(--sienna); color: var(--sur-accent);
  font-size: 10px; font-weight: 700; font-family: var(--body);
  display: grid; place-items: center;
  opacity: 0; transform: scale(.6); transition: opacity .18s, transform .18s;
}
.theme-carte.sel .theme-coche { opacity: 1; transform: none; }
.theme-desc { display: block; font-size: 12.5px; color: var(--ink-2); margin-top: 3px; line-height: 1.45; }

.theme-ic { display: flex; align-items: center; justify-content: center; gap: 3px; border: 1px solid var(--line); }

/* ═══════════ Logo permanent ═══════════
   L'icône de l'application accompagne l'assuré sur tous les écrans.
   Elle garde ses couleurs propres, quel que soit le thème retenu. */
.mark-app { width: 30px; height: 30px; flex-shrink: 0; border-radius: 8px; display: block; }
.brand-mini { display: flex; align-items: center; gap: 10px; color: var(--ink-2); }
.brand-mini .mot-app { height: 12px; width: auto; display: block; }
.topbar .brand-mini.seule .mot-app { height: 13px; }
.hero .brand-mini.sur-photo .mot-app { height: 11px; }
.dash-head .brand-mini { margin-bottom: 16px; }
.topbar .brand-mini.seule .mark-app { width: 34px; height: 34px; }
.hero .brand-mini.sur-photo {
  position: absolute; bottom: 14px; right: 16px; z-index: 3;
  padding: 4px; border-radius: 11px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(20,28,38,.18);
}
.hero .brand-mini.sur-photo .mark-app { width: 26px; height: 26px; }

/* ═══════════ Témoin de synchronisation ═══════════
   Une saisie n'est jamais présentée comme enregistrée tant qu'elle ne
   l'est pas : l'état d'échec reste affiché et propose une reprise. */
.sync-etat {
  position: fixed; left: 50%; transform: translateX(-50%);
  top: calc(10px + var(--safe-t)); z-index: 210;
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px 9px 14px; border-radius: 14px;
  font-size: 13px; line-height: 1.3;
  width: max-content; max-width: min(94vw, 460px);
  box-shadow: var(--shadow-l); border: 1px solid transparent;
}
.sync-etat .pt { font-size: 10px; flex-shrink: 0; }
.sync-etat .txt { flex: 1; min-width: 0; }
.sync-etat.envoi  { background: var(--surface); color: var(--ink-2); border-color: var(--line); }
.sync-etat.ok     { background: var(--ok-bg); color: var(--ink); border-color: var(--ok-bord); }
.sync-etat.ok .pt { color: var(--ok); }
.sync-etat.erreur { background: var(--danger-bg); color: var(--ink); border-color: var(--danger-bord); }
.sync-etat.erreur .pt { color: var(--danger); }
.sync-etat .rejouer {
  border: 1px solid var(--danger-bord); background: var(--surface);
  color: var(--ink); border-radius: var(--r-full);
  padding: 5px 12px; font-size: 12px; cursor: pointer; font-family: inherit; flex-shrink: 0; white-space: nowrap;
}
.sync-etat .rejouer:hover { background: var(--surface-2); }
.sync-etat .spinner {
  width: 13px; height: 13px; border-width: 2px;
  border-color: color-mix(in srgb, var(--ink) 18%, transparent);
  border-top-color: var(--sienna);
}

/* Version en ligne différente de la version installée : la bascule est
   restée en chemin, et cela doit se voir. */
.info-row .v.en-retard { color: var(--warn-fg); font-weight: 600; }

/* ═══════════ Aide en ligne ═══════════ */
.aide-item {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-m); margin-bottom: 10px; overflow: hidden;
}
.aide-item.on { border-color: color-mix(in srgb, var(--sienna) 40%, var(--line)); }
.aide-tete {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 16px; background: transparent; border: none; cursor: pointer;
  font-family: var(--display); font-size: 16px; font-weight: 600; color: var(--ink); text-align: left;
}
.aide-tete .chev { color: var(--ink-3); font-size: 17px; }
.aide-corps {
  padding: 0 16px 16px; font-size: 14.5px; line-height: 1.6; color: var(--ink-2);
  border-top: 1px solid var(--line);
}
.aide-corps p { margin: 12px 0; }
.aide-corps b { color: var(--ink); font-weight: 600; }
.aide-corps ul { margin: 12px 0; padding-left: 20px; }
.aide-corps li { margin-bottom: 7px; }

/* ═══════════ Partage temporaire ═══════════ */
.pf-duree { display: flex; align-items: center; gap: 14px; }
.pf-duree input[type="range"] { flex: 1; accent-color: var(--sienna); min-width: 0; }
.pf-duree output {
  font-family: var(--display); font-size: 17px; font-weight: 600;
  min-width: 84px; text-align: right; font-variant-numeric: tabular-nums;
}
.pf-lien {
  background: var(--bg-alt); border: 1px solid var(--line); border-radius: var(--r-s, 10px);
  padding: 11px 13px; font-size: 12.5px; word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink-2);
}
.pf-qr-img { width: 100%; max-width: 240px; border-radius: 12px; background: #fff; padding: 8px; }

.pf-actif {
  display: grid; grid-template-columns: 26px 1fr auto auto; gap: 10px; align-items: center;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.pf-actif:last-of-type { border-bottom: none; }
.pf-glyphe { font-size: 18px; }
.pf-txt b { display: block; font-size: 14.5px; }
.pf-txt i { font-style: normal; font-size: 12.5px; color: var(--ink-3); }
.pf-rejouer, .pf-stop {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: var(--r-full); padding: 5px 12px; font-size: 12.5px;
  cursor: pointer; font-family: inherit; white-space: nowrap;
}
.pf-rejouer:hover { background: var(--surface-2); color: var(--ink); }
.pf-stop { color: var(--danger); border-color: var(--danger-bord); }
.pf-stop:hover { background: var(--danger-bg); }

/* ═══════════ Vue du destinataire ═══════════ */
.viewer-tete {
  position: relative; height: 260px; margin: 0 -20px 0;
  background: var(--navy-deep); background-size: cover; background-position: center;
}
.viewer-tete .noimg {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 68px; opacity: .5;
}
.viewer-tete .caption {
  position: absolute; left: 20px; right: 20px; bottom: 16px; color: #fff;
  text-shadow: 0 1px 12px rgba(12,18,26,.6);
}
.viewer-tete .caption h1 { font-size: 30px; margin: 0; }
.viewer-tete .caption .race { font-size: 14px; opacity: .92; margin-top: 3px; }
.viewer-bandeau {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--info-bg); border: 1px solid var(--info-bord); color: var(--info-fg);
  border-radius: var(--r-m); padding: 12px 14px; margin: 16px 0 4px; font-size: 13.5px;
}
.viewer-bandeau .g { font-size: 16px; flex-shrink: 0; }
.viewer-urgence { border-color: var(--danger-bord); background: var(--danger-bg); }
.v-bloc { padding: 9px 0; }
.v-bloc b { display: block; font-size: 12.5px; color: var(--ink-3); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 3px; }
.v-bloc p { margin: 0; font-size: 14.5px; line-height: 1.6; white-space: pre-line; }
.v-retard { color: var(--danger); font-weight: 600; }
.viewer-attente { padding: 60px 20px; text-align: center; color: var(--ink-2); display: flex; gap: 10px; justify-content: center; align-items: center; }
.viewer-vide { padding: 70px 24px; text-align: center; }
.viewer-vide .glyph { font-size: 44px; opacity: .5; }
.viewer-vide h3 { font-size: 20px; margin: 14px 0 8px; }
.viewer-vide p { color: var(--ink-2); max-width: 34ch; margin: 0 auto; }
.viewer-pied { margin-top: 34px; padding: 24px 0 40px; border-top: 1px solid var(--line); text-align: center; }
.viewer-pied p { font-size: 13px; color: var(--ink-3); max-width: 40ch; margin: 10px auto; }
.viewer-pied a { color: var(--sienna); font-size: 14px; }
#viewer-body a { color: var(--sienna); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--sienna) 40%, transparent); }
#viewer-body a:hover { border-bottom-color: var(--sienna); }

/* ═══════════ Journal de la garde ═══════════ */
.pf-bascule { display: flex; align-items: center; gap: 10px; margin: 6px 0 4px; cursor: pointer; }
.pf-bascule input { width: 18px; height: 18px; accent-color: var(--sienna); flex-shrink: 0; }
.pf-bascule span { font-size: 14.5px; }
.pf-actif { grid-template-columns: 26px 1fr auto; row-gap: 8px; }
.pf-actif .pf-rejouer, .pf-actif .pf-stop { grid-column: auto; }

.jn-intro { font-size: 14px; color: var(--ink-2); margin: 0 0 14px; line-height: 1.55; }
.jn-compteurs { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.jn-compteurs span {
  background: var(--bg-alt); border-radius: var(--r-full); padding: 6px 13px;
  font-size: 12.5px; color: var(--ink-2);
}
.jn-compteurs b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.jn-grille {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 9px; margin-top: 16px;
}
.jn-photo {
  position: relative; aspect-ratio: 1; border-radius: var(--r-m);
  background-size: cover; background-position: center;
  border: 1px solid var(--line); overflow: hidden; margin: 0;
}
.jn-photo figcaption {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: linear-gradient(transparent, rgba(14,20,28,.72));
  color: #fff; font-size: 11px; padding: 14px 7px 5px; text-align: center;
}
.jn-x {
  position: absolute; top: 5px; right: 5px; width: 24px; height: 24px;
  border-radius: 50%; border: none; background: rgba(20,28,38,.68); color: #fff;
  cursor: pointer; line-height: 1; font-size: 15px;
}
.jn-vide {
  grid-column: 1 / -1; padding: 18px; text-align: center;
  color: var(--ink-3); font-size: 13.5px; background: var(--bg-alt); border-radius: var(--r-m);
}
.viewer-droits { font-size: 11.5px; color: var(--ink-3); line-height: 1.5; max-width: 44ch; margin: 14px auto; }
.viewer-lien {
  background: none; border: none; color: var(--ink-3); font: inherit; font-size: 13px;
  text-decoration: underline; cursor: pointer; padding: 6px;
}
.viewer-lien:hover { color: var(--ink-2); }

/* Choix unique : la sélection se lit d'un coup d'œil, et la teinte porte
   le sens, du vert rassurant à l'ambre qui appelle l'attention. */
.choix-unique .tag.on.t-ok    { background: var(--ok-bg);    border-color: var(--ok);    color: var(--ok-fg); }
.choix-unique .tag.on.t-warn  { background: var(--warn-bg);  border-color: var(--warn);  color: var(--warn-fg); }
.choix-unique .tag.on.t-info  { background: var(--info-bg);  border-color: var(--info);  color: var(--info-fg); }
.v-etat-forme      { color: var(--ok-fg); font-weight: 600; }
.v-etat-traitement { color: var(--warn-fg); font-weight: 600; }
.v-etat-handicap   { color: var(--info-fg); font-weight: 600; }

/* Un lien peut prendre l'apparence d'un bouton de partage : il ne doit pas
   pour autant reprendre le bleu souligné du navigateur. */
a.share-btn { text-decoration: none; color: inherit; }
a.share-btn .t { color: var(--ink); text-decoration: none; }
a.share-btn .d { color: var(--ink-3); text-decoration: none; }

/* Ce qui manque au livre de vie, nommé plutôt que deviné. */
.manques {
  margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line);
  font-size: 14px;
}
.manques b { display: block; margin-bottom: 7px; color: var(--ink); font-weight: 600; }
.manques ul { margin: 0; padding-left: 18px; color: var(--ink-2); }
.manques li { margin-bottom: 3px; }
.manques .et-plus { color: var(--ink-3); list-style: none; margin-left: -18px; padding-top: 2px; }

/* ═══════════ État de l'accueil ═══════════ */
.etat-accueil { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.puce {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; padding: 5px 11px; border-radius: var(--r-full);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font-family: inherit; line-height: 1.3;
}
.puce i { font-style: normal; font-size: 9px; }
.puce.ok      { border-color: var(--ok-bord);     background: var(--ok-bg);     color: var(--ok-fg); }
.puce.alerte  { border-color: var(--danger-bord); background: var(--danger-bg); color: var(--danger-fg); }
.puce.neutre  { border-color: var(--warn-bord);   background: var(--warn-bg);   color: var(--warn-fg); }
.puce.discrete { color: var(--ink-3); }
.puce.action {
  border-color: var(--sienna); background: var(--accent-bg); color: var(--sienna);
  cursor: pointer; font-weight: 600;
}
.puce.action:hover { background: color-mix(in srgb, var(--sienna) 18%, var(--surface)); }
