/* =====================================================================
   Tessvine — « Chai de nuit »
   Anthracite profond, bordeaux, verre, ivoire et une touche d'or.
   Titres, noms de vins et chiffres : Cormorant Garamond. Interface : Instrument Sans.
   ===================================================================== */
@font-face { font-family: "Cormorant Garamond"; font-weight: 500; font-display: swap; src: url("fonts/cormorant-500.woff2") format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-weight: 600; font-display: swap; src: url("fonts/cormorant-600.woff2") format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-weight: 700; font-display: swap; src: url("fonts/cormorant-700.woff2") format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-weight: 500 700; font-style: italic; font-display: swap; src: url("fonts/cormorant-500-italique.woff2") format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-weight: 400 700; font-display: swap; src: url("fonts/instrument-sans.woff2") format("woff2-variations"), url("fonts/instrument-sans.woff2") format("woff2"); }

/* ---------- jetons : thème clair (papier ivoire, encre anthracite) ---------- */
:root {
  --fond: #f3eee6;
  --fond-2: #ebe4d8;
  --surface: #fbf8f2;
  --surface-2: #f0e9de;
  --bord: #e1d7c8;
  --bord-fort: #cdbfab;
  --texte: #1c1a1e;
  --texte-2: #5b544e;
  --texte-3: #8d857c;
  --accent: #7a1b33;          /* bordeaux : actions */
  --accent-texte: #fbf4ea;
  --accent-lien: #7a1b33;     /* bordeaux lisible en texte */
  --accent-doux: #f2e2e1;
  --or: #9a7630;              /* or patiné : apogée, étoiles, filets */
  --or-vif: #c9a24f;
  --ok: #3d7a52;
  --attention: #a8641c;
  --danger: #a8232f;
  --info: #3f6687;
  /* la « nuit » : barre latérale, bandeau d'accueil, plan de cave — sombre dans les deux thèmes */
  --nuit: #18161b;
  --nuit-2: #232026;
  --nuit-3: #2e2a31;
  --nuit-bord: rgba(255, 246, 232, .1);
  --nuit-texte: #f1e9dc;
  --nuit-texte-2: rgba(241, 233, 220, .62);
  --nuit-texte-3: rgba(241, 233, 220, .38);
  /* couleurs de vin (pastilles, barres) */
  --c-rouge: #8a1f36;
  --c-blanc: #cfa93e;
  --c-rose: #e08a9b;
  --c-effervescent: #4f7fae;
  --c-liquoreux: #c27523;
  --c-autre: #7d64b5;
  /* étapes de garde : une teinte chacune, du frais au rouge à mesure que le vin vieillit */
  --s-trop_jeune: #46698c;
  --s-a_boire: #3d7f55;
  --s-apogee: #a07a1f;
  --s-declin: #c0661f;
  --s-urgent: #b3263a;
  --s-depasse: #6b6560;
  --s-inconnu: #8d857c;
  --ombre: 0 1px 2px rgba(28, 26, 30, .05), 0 10px 26px -18px rgba(28, 26, 30, .3);
  --ombre-haute: 0 24px 60px -18px rgba(20, 16, 22, .42);
  --rayon: 16px;
  --rayon-petit: 10px;
  --serif: "Cormorant Garamond", "Cormorant", "Iowan Old Style", Georgia, serif;
  --sans: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --largeur-menu: 236px;
  --hauteur-onglets: 64px;
  color-scheme: light;
}

/* ---------- thème sombre (anthracite à reflet prune, texte ivoire) ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #121013;
    --fond-2: #16141a;
    --surface: #1b181e;
    --surface-2: #242027;
    --bord: #2f2a33;
    --bord-fort: #423b46;
    --texte: #f0e8db;
    --texte-2: #b7ada2;
    --texte-3: #857b73;
    --accent: #8e2340;
    --accent-texte: #fbf1e6;
    --accent-lien: #e08a9c;
    --accent-doux: #2d1a21;
    --or: #d4b062;
    --or-vif: #d9b96b;
    --ok: #74b98a;
    --attention: #e0a052;
    --danger: #f07a7a;
    --info: #8db4d6;
    --nuit: #0e0c10;
    --nuit-2: #1c191f;
    --nuit-3: #27232a;
    --c-rouge: #c2445f;
    --c-blanc: #d8b54c;
    --c-rose: #e796a7;
    --c-effervescent: #6d9fd0;
    --c-liquoreux: #d88a3a;
    --c-autre: #9c84d4;
    --s-trop_jeune: #86b0d8;
    --s-a_boire: #78c294;
    --s-apogee: #e2c264;
    --s-declin: #ec9a52;
    --s-urgent: #f06a6f;
    --s-depasse: #a49c94;
    --s-inconnu: #857b73;
    --ombre: 0 1px 0 rgba(255, 255, 255, .02) inset, 0 12px 30px -18px rgba(0, 0, 0, .8);
    --ombre-haute: 0 26px 70px -16px rgba(0, 0, 0, .85);
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 400 15px/1.55 var(--sans); letter-spacing: .003em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "liga", "kern";
}
a { color: var(--accent-lien); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
h1, h2, h3 { margin: 0 0 .6em; }
h1 { font: 600 2.7rem/1.02 var(--serif); letter-spacing: -.012em; font-variant-numeric: lining-nums; }
h2 { font: 600 1.55rem/1.15 var(--serif); letter-spacing: -.004em; font-variant-numeric: lining-nums; }
h3 { font: 600 .72rem/1.3 var(--sans); text-transform: uppercase; letter-spacing: .14em; color: var(--texte-3); }
p { margin: 0 0 .8em; }
img { max-width: 100%; }
code { font: .85em ui-monospace, "SF Mono", Menlo, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent-lien); outline-offset: 2px; border-radius: 4px; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.muted { color: var(--texte-2); }
.petit-texte { font-size: .85rem; }
.tronque { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chiffre, .tuile .valeur, .compteur .valeur, .climat .mesure, .vin .stock, .suggestion .rang { font-family: var(--serif); font-variant-numeric: lining-nums; }
.surtitre {
  display: block; margin: 0 0 6px; font: 600 .68rem/1.2 var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--or);
}
.vide { text-align: center; color: var(--texte-2); padding: 40px 18px; }
.sep { height: 1px; background: var(--bord); margin: 18px 0; border: 0; }
.separation { border: 0; height: 1px; background: var(--bord-fort); margin: 30px 0; }
.chargement { padding: 60px 20px; text-align: center; color: var(--texte-3); font: italic 500 1.2rem var(--serif); }
.chargement::before {
  content: ""; display: block; width: 28px; height: 28px; margin: 0 auto 14px; border-radius: 50%;
  border: 2px solid var(--bord); border-top-color: var(--accent-lien); animation: tourne .8s linear infinite;
}
@keyframes tourne { to { transform: rotate(360deg); } }

/* icônes en ligne */
.ic, .bouton svg, .ajouter svg, .localiser svg, .bandeau-localisation > svg, .puce svg.ic {
  width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- navigation : barre latérale (iPad, ordinateur) ---------- */
.barre {
  position: fixed; inset: 0 auto 0 0; z-index: 20; width: var(--largeur-menu);
  display: flex; flex-direction: column; gap: 4px;
  padding: max(26px, env(safe-area-inset-top)) 16px 22px max(16px, env(safe-area-inset-left));
  background:
    radial-gradient(120% 50% at 0% 0%, rgba(142, 35, 64, .22), transparent 70%),
    radial-gradient(90% 40% at 100% 100%, rgba(201, 162, 79, .08), transparent 70%),
    var(--nuit);
  color: var(--nuit-texte); border-right: 1px solid var(--nuit-bord);
}
.logo {
  display: flex; align-items: center; gap: 11px; padding: 2px 10px 26px; white-space: nowrap;
  color: var(--nuit-texte); font: italic 600 1.75rem/1 var(--serif); letter-spacing: .005em;
}
.logo:hover { text-decoration: none; }
.logo img { width: 34px; height: 34px; border-radius: 9px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .08); }
#menu { display: flex; flex-direction: column; gap: 2px; flex: 1; }
#menu a, #menu button {
  position: relative; display: flex; align-items: center; gap: 13px;
  padding: 10px 12px; border-radius: 9px; border: 0; background: none; cursor: pointer; text-align: left;
  color: var(--nuit-texte-2); font: 500 .93rem var(--sans); transition: color .15s, background .15s;
}
#menu svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
#menu a:hover { background: rgba(255, 255, 255, .05); color: var(--nuit-texte); text-decoration: none; }
#menu a.actif { background: rgba(255, 255, 255, .07); color: var(--nuit-texte); }
#menu a.actif::before {
  content: ""; position: absolute; left: -16px; top: 9px; bottom: 9px; width: 2px; border-radius: 0 2px 2px 0; background: var(--or-vif);
}
#menu a.actif svg { color: var(--or-vif); }
#menu a[data-page="stats"] { margin-top: 30px; }
#menu a[data-page="stats"]::after {
  content: "Cave"; position: absolute; top: -21px; left: 12px; font: 600 .62rem var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--nuit-texte-3);
}
html[lang="en"] #menu a[data-page="stats"]::after { content: "Cellar"; }
#menu .onglet-ajouter, #menu .seul-mobile { display: none; }
.barre .ajouter { margin-top: auto; min-height: 46px; width: 100%; }
.barre .ajouter:hover { text-decoration: none; }

main { max-width: 1240px; margin: 0 auto; padding: max(34px, env(safe-area-inset-top)) 40px 90px calc(var(--largeur-menu) + 40px); }
@media (min-width: 1540px) { main { margin-left: calc((100vw - var(--largeur-menu) - 1240px) / 2); } }
#page > * { animation: apparait .32s cubic-bezier(.2, .7, .2, 1) both; }
#page > *:nth-child(2) { animation-delay: .03s; }
#page > *:nth-child(3) { animation-delay: .06s; }
#page > *:nth-child(n+4) { animation-delay: .09s; }
@keyframes apparait { from { opacity: 0; transform: translateY(6px); } }

/* iPad portrait : rail d'icônes */
@media (max-width: 1100px) and (min-width: 761px) {
  :root { --largeur-menu: 88px; }
  .barre { align-items: center; padding-left: 10px; padding-right: 10px; }
  .logo { padding: 2px 0 22px; }
  .logo span, .barre .ajouter span { display: none; }
  #menu a { flex-direction: column; gap: 4px; padding: 9px 4px; width: 68px; font-size: .64rem; text-align: center; }
  #menu a span { white-space: nowrap; }
  #menu a.actif::before { left: -10px; }
  #menu a[data-page="stats"] { margin-top: 18px; }
  #menu a[data-page="stats"]::after, html[lang] #menu a[data-page="stats"]::after { content: ""; top: -10px; left: 14px; right: 14px; height: 1px; background: var(--nuit-bord); }
  .barre .ajouter { width: 52px; height: 52px; min-height: 0; padding: 0; border-radius: 50%; }
  .barre .ajouter svg { width: 22px; height: 22px; }
  main { padding-left: calc(var(--largeur-menu) + 28px); padding-right: 28px; }
}

/* iPhone : barre d'onglets en bas */
@media (max-width: 760px) {
  .barre {
    inset: auto 0 0 0; width: auto; flex-direction: row; gap: 0;
    padding: 6px max(6px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
    border-right: 0; border-top: 1px solid var(--bord); color: var(--texte);
    background: color-mix(in srgb, var(--surface) 84%, transparent);
    -webkit-backdrop-filter: saturate(1.5) blur(20px); backdrop-filter: saturate(1.5) blur(20px);
  }
  .logo, .barre .ajouter, #menu .secondaire { display: none; }
  #menu { flex-direction: row; justify-content: space-around; align-items: flex-end; }
  #menu a, #menu button {
    flex: 1; flex-direction: column; gap: 3px; padding: 4px 0; justify-content: flex-end; text-align: center;
    color: var(--texte-3); font-size: .64rem; font-weight: 600; letter-spacing: .01em;
  }
  #menu a:hover { background: none; color: var(--texte-2); }
  #menu a.actif, #menu button.actif { background: none; color: var(--accent-lien); }
  #menu a.actif::before { display: none; }
  #menu a.actif svg { color: var(--accent-lien); }
  #menu svg { width: 23px; height: 23px; }
  #menu .onglet-ajouter, #menu .seul-mobile { display: flex; }
  #menu .onglet-ajouter svg {
    width: 50px; height: 50px; padding: 13px; margin-top: -24px; border-radius: 50%;
    background: var(--accent); color: var(--accent-texte); stroke-width: 2.2;
    box-shadow: 0 0 0 4px var(--fond), 0 10px 22px -8px color-mix(in srgb, var(--accent) 85%, transparent);
  }
  #menu .onglet-ajouter.actif svg { color: var(--accent-texte); }
  main { padding: max(22px, env(safe-area-inset-top)) 16px calc(var(--hauteur-onglets) + 40px + env(safe-area-inset-bottom)); }
  h1 { font-size: 2.15rem; }
}

/* ---------- en-têtes de page ---------- */
.entete { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 26px; }
.entete h1, .entete h2 { margin: 0; }
.entete + .muted { margin-top: -12px; max-width: 64ch; }
.retour { display: inline-flex; align-items: center; gap: 4px; margin: 0 0 18px; color: var(--texte-2); font-weight: 500; font-size: .9rem; }
.retour:hover { color: var(--texte); text-decoration: none; }
.retour svg { width: 16px; height: 16px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.titre-carte { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.titre-carte h2 { margin: 0; }
.titre-carte a { font-size: .86rem; white-space: nowrap; font-weight: 500; }

/* ---------- boutons ---------- */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px; border-radius: var(--rayon-petit);
  border: 1px solid var(--bord-fort); background: transparent; color: var(--texte);
  font: 500 .9rem/1.2 var(--sans); letter-spacing: .005em; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .1s, box-shadow .15s;
}
.bouton:hover { background: var(--surface-2); border-color: var(--texte-3); text-decoration: none; }
.bouton:active { transform: translateY(1px); }
.bouton.primaire {
  background: var(--accent); border-color: var(--accent); color: var(--accent-texte); font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 8px 18px -12px color-mix(in srgb, var(--accent) 90%, transparent);
}
.bouton.primaire:hover { background: color-mix(in srgb, var(--accent) 88%, #fff); border-color: transparent; }
.bouton.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.bouton.danger:hover { background: color-mix(in srgb, var(--danger) 8%, transparent); border-color: var(--danger); }
.bouton.petit { min-height: 34px; padding: 0 12px; font-size: .84rem; gap: 6px; }
.bouton.petit svg { width: 15px; height: 15px; }
.bouton.rond { width: 42px; min-height: 42px; padding: 0; border-radius: 50%; font-size: 1.2rem; }
.bouton.discret { border-color: transparent; color: var(--texte-2); }
.bouton.discret:hover { color: var(--texte); background: var(--surface-2); }
.bouton:disabled { opacity: .45; cursor: default; transform: none; }

/* ---------- panneaux ---------- */
.carte {
  background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon);
  padding: 22px 24px; box-shadow: var(--ombre);
}
.grille { display: grid; gap: 20px; }
.grille > *, .fiche > * { min-width: 0; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
@media (max-width: 420px) { .g2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .carte { padding: 18px; border-radius: 14px; } }
.tableau-bord { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); align-items: start; }
@media (max-width: 420px) { .tableau-bord { grid-template-columns: minmax(0, 1fr); } }
.tuile .valeur { font-size: 2rem; font-weight: 600; line-height: 1.1; }
.tuile .libelle { color: var(--texte-2); font-size: .88rem; }
.tuile.alerte { border-color: var(--danger); }
.alerte-carte { border-color: color-mix(in srgb, var(--s-urgent) 35%, var(--bord)); }
.alerte-carte h2::after {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 10px; vertical-align: .25em; border-radius: 50%;
  background: var(--s-urgent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--s-urgent) 18%, transparent);
}

/* ---------- pastilles, statuts, étoiles ---------- */
.pastille {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; vertical-align: 0;
  background: var(--c-autre); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15), 0 0 0 2px color-mix(in srgb, currentColor 0%, transparent);
}
.pastille.rouge { background: var(--c-rouge); }
.pastille.blanc { background: var(--c-blanc); }
.pastille.rose { background: var(--c-rose); }
.pastille.effervescent { background: var(--c-effervescent); }
.pastille.liquoreux { background: var(--c-liquoreux); }

.statut {
  --s: var(--s-inconnu);
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 8px; border-radius: 999px;
  font: 600 .72rem/1.25 var(--sans); letter-spacing: .02em; white-space: nowrap;
  color: var(--s); background: color-mix(in srgb, var(--s) 12%, transparent);
}
.statut > span[aria-hidden] { font-size: .9em; line-height: 1; }
.statut.trop_jeune { --s: var(--s-trop_jeune); }
.statut.a_boire { --s: var(--s-a_boire); }
.statut.apogee { --s: var(--s-apogee); background: color-mix(in srgb, var(--s) 16%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--s) 35%, transparent); }
.statut.declin { --s: var(--s-declin); }
.statut.urgent { --s: var(--s-urgent); color: #fff; background: var(--s); }
.statut.depasse { --s: var(--s-depasse); color: #fff; background: var(--s); }
.statut.inconnu { --s: var(--s-inconnu); }
@media (prefers-color-scheme: dark) { .statut.urgent, .statut.depasse { color: #1a1210; } }
.etoiles { color: var(--or); letter-spacing: 1.5px; white-space: nowrap; font-size: .95rem; }

/* ---------- listes ---------- */
.liste { list-style: none; margin: 0; padding: 0; }
.liste li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--bord); }
.liste li:first-child { border-top: 0; padding-top: 4px; }
.liste .grandit { flex: 1; min-width: 0; }
.liste .titre { font: 600 1.14rem/1.2 var(--serif); color: var(--texte); font-variant-numeric: lining-nums; }
.liste a.titre:hover { color: var(--accent-lien); text-decoration: none; }
.qte { font: 600 1.15rem var(--serif); font-variant-numeric: lining-nums; color: var(--texte-2); min-width: 2.2ch; text-align: right; }
.mini-bouteille { display: block; flex: none; width: 15px; height: 46px; }
.mini-bouteille svg { width: 100%; height: 100%; display: block; overflow: visible; }
@media (max-width: 760px) {
  .liste li { flex-wrap: wrap; row-gap: 4px; }
  .liste li > .grandit { flex: 1 1 calc(100% - 90px); }
  .liste li > .statut { order: 4; margin-left: 27px; }
  .liste li > .qte { order: 3; }
  .liste .titre.tronque { white-space: normal; }
}

/* ---------- barres et histogramme (statistiques) ---------- */
.barres { display: grid; gap: 4px; }
.barre-ligne {
  display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; align-items: center; gap: 12px;
  padding: 6px 8px; margin: 0 -8px; border-radius: 8px; font-size: .9rem;
}
.barre-ligne .nom { display: flex; align-items: center; gap: 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.barre-ligne .piste { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.barre-ligne .remplie { height: 100%; min-width: 3px; border-radius: 3px; background: var(--accent); transition: filter .15s; }
.barre-ligne .nombre { font: 600 1.05rem var(--serif); font-variant-numeric: lining-nums tabular-nums; color: var(--texte-2); min-width: 2ch; text-align: right; }
.barre-ligne.cliquable, .histogramme .col.cliquable { cursor: pointer; }
.barre-ligne.cliquable:hover { background: var(--surface-2); }
.barre-ligne.cliquable:hover .nom { color: var(--accent-lien); }
.barre-ligne.cliquable:hover .remplie { filter: brightness(1.12); }
.barre-ligne.cliquable:focus-visible, .histogramme .col.cliquable:focus-visible { outline: 2px solid var(--accent-lien); outline-offset: 1px; }
.histogramme { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-top: 10px; border-bottom: 1px solid var(--bord-fort); }
.histogramme .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; border-radius: 4px 4px 0 0; }
.histogramme .col div {
  width: 100%; max-width: 26px; min-height: 3px; border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 80%, #fff), var(--accent));
}
.histogramme .col.cliquable:hover div { filter: brightness(1.2); }
.histogramme .col.cliquable:hover { background: var(--surface-2); }
.axe-x { display: flex; gap: 3px; margin-top: 6px; font: .72rem var(--sans); color: var(--texte-3); font-variant-numeric: tabular-nums; }
.axe-x span { flex: 1; text-align: center; overflow: hidden; min-width: 0; }
.lien-stats { margin: 30px 0 0; text-align: center; }
.lien-stats a { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }

/* ---------- formulaires ---------- */
label { display: block; font: 500 .8rem/1.3 var(--sans); color: var(--texte-2); letter-spacing: .01em; }
input, select, textarea {
  width: 100%; min-height: 44px; margin-top: 6px; padding: 9px 12px;
  border: 1px solid var(--bord-fort); border-radius: var(--rayon-petit); background: var(--surface); color: var(--texte);
  font: 400 16px/1.35 var(--sans); transition: border-color .15s, box-shadow .15s;
}
select {
  -webkit-appearance: none; appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238d857c' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px;
}
input::placeholder, textarea::placeholder { color: var(--texte-3); }
textarea { min-height: 90px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--texte-3); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent-lien); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-lien) 18%, transparent);
}
input[type=checkbox] { width: 19px; min-height: 19px; height: 19px; margin: 0; accent-color: var(--accent); flex: none; }
input[type=file] { padding: 9px; font-size: .88rem; }
.form { display: grid; gap: 16px 18px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.form .large { grid-column: 1 / -1; }
.form fieldset {
  grid-column: 1 / -1; margin: 6px 0 0; padding: 22px 0 6px; border: 0; border-top: 1px solid var(--bord);
  display: grid; gap: 16px 18px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.form legend { padding: 0 12px 0 0; font: 600 1.35rem/1 var(--serif); color: var(--texte); }
.case { display: flex; align-items: center; gap: 10px; color: var(--texte); font-size: .95rem; cursor: pointer; }
.filtres { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filtres input, .filtres select { width: auto; margin: 0; flex: 1 1 150px; }
.filtres input[type=search] { flex: 1 1 240px; }

/* recherche avec loupe */
.recherche { position: relative; flex: 1 1 260px; display: block; }
.recherche svg { position: absolute; left: 13px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--texte-3); stroke-width: 1.8; stroke-linecap: round; pointer-events: none; }
.recherche input { width: 100%; margin: 0; padding-left: 40px; border-radius: 999px; }

/* puces de filtre (couleurs, garde, surlignage du plan) */
.puces { display: flex; gap: 6px; flex-wrap: wrap; }
.puce {
  display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 13px; border-radius: 999px;
  border: 1px solid var(--bord-fort); background: transparent; color: var(--texte-2);
  font: 500 .84rem var(--sans); cursor: pointer; white-space: nowrap; transition: all .15s;
}
.puce:hover { color: var(--texte); border-color: var(--texte-3); }
.puce.actif { background: var(--texte); border-color: var(--texte); color: var(--fond); }
.puce .n { font: 600 .95rem var(--serif); font-variant-numeric: lining-nums; opacity: .7; }
.puce .pastille { width: 9px; height: 9px; }
.puce svg.leg { width: 22px; height: 22px; margin: -4px -4px -4px -6px; overflow: visible; }

/* ---------- Mes vins : barre de filtres et cartes ---------- */
.barre-filtres {
  position: sticky; top: 0; z-index: 6; display: grid; gap: 10px;
  margin: -10px -4px 10px; padding: 10px 4px 12px; background: color-mix(in srgb, var(--fond) 92%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.barre-filtres .filtres { margin: 0; }
.barre-filtres select { flex: 0 1 auto; max-width: 11rem; border-radius: 999px; min-height: 40px; font-size: .88rem; padding-top: 6px; padding-bottom: 6px; }
.barre-filtres .recherche { flex: 1 1 200px; }
.barre-filtres .recherche input { min-height: 40px; }
@media (max-width: 760px) {
  .barre-filtres { margin: -10px -16px 10px; padding: 10px 16px 12px; }
  .barre-filtres .filtres, .barre-filtres .puces { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
  .barre-filtres .filtres::-webkit-scrollbar, .barre-filtres .puces::-webkit-scrollbar { display: none; }
  .barre-filtres .recherche { flex: 0 0 74vw; }
  .barre-filtres select { flex: 0 0 auto; }
}
#compte { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin: 0 0 16px; color: var(--texte-2); }
#compte .bouton { margin-left: 2px; }
.filtre-actif { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--accent-doux); color: var(--accent-lien); font-weight: 600; font-size: .8rem; }

.vins { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.vin {
  position: relative; display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 16px; align-items: stretch;
  padding: 16px 16px 16px 14px; color: inherit; overflow: hidden;
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
.vin:hover { text-decoration: none; border-color: var(--bord-fort); box-shadow: var(--ombre-haute); transform: translateY(-2px); }
.vin .vignette {
  width: 56px; height: 128px; display: grid; place-items: end center; align-self: center; overflow: hidden;
  border-radius: 8px;
}
.vin .vignette svg { width: auto; height: 124px; overflow: visible; }
.vin .vignette img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.vin .infos { min-width: 0; display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.vin .appellation { font: 600 .66rem/1.2 var(--sans); letter-spacing: .15em; text-transform: uppercase; color: var(--or); }
.vin .nom { font: 600 1.32rem/1.08 var(--serif); color: var(--texte); font-variant-numeric: lining-nums; }
.vin .nom .coeur { color: var(--accent-lien); font-size: .8em; margin-right: 3px; }
.vin .details { font-size: .84rem; color: var(--texte-2); }
.vin .pied { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.vin .garde { font-size: .78rem; color: var(--texte-3); font-variant-numeric: tabular-nums; }
.vin .stock { display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-start; font-size: 2rem; font-weight: 600; line-height: 1; padding-top: 2px; }
.vin .stock small { margin-top: 4px; font: 600 .62rem var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--texte-3); }
.vin.epuise { opacity: .62; }
.localiser {
  position: absolute; right: 12px; bottom: 12px; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  color: var(--texte-2); border: 1px solid var(--bord-fort); background: var(--surface);
  transition: all .15s;
}
.localiser:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-texte); }

/* ---------- fiche d'un vin ---------- */
.fiche { display: grid; gap: 28px; grid-template-columns: 340px minmax(0, 1fr); align-items: start; }
.fiche > div:first-child { position: sticky; top: 24px; }
.photo {
  position: relative; aspect-ratio: 3 / 4; border-radius: 20px; overflow: hidden; display: grid; place-items: center;
  background: var(--surface-2); box-shadow: var(--ombre);
}
.photo img { width: 100%; height: 100%; object-fit: cover; }
#photo-vin { cursor: zoom-in; }
.photo.scene {
  aspect-ratio: 3 / 4.2; place-items: end center; padding: 8% 0 9%;
  background:
    radial-gradient(55% 48% at 50% 40%, rgba(255, 238, 210, .2), transparent 72%),
    radial-gradient(70% 18% at 50% 92%, rgba(0, 0, 0, .55), transparent 70%),
    linear-gradient(180deg, var(--nuit-3), var(--nuit) 78%);
  box-shadow: inset 0 0 0 1px var(--nuit-bord), var(--ombre-haute);
}
.photo.scene::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 21%;
  background: linear-gradient(180deg, rgba(255, 255, 255, .035), transparent 40%); border-top: 1px solid rgba(255, 255, 255, .06);
}
.photo.scene svg {
  position: absolute; left: 50%; bottom: 12%; height: 82%; width: auto; transform: translateX(-50%); overflow: visible;
  filter: drop-shadow(0 18px 22px rgba(0, 0, 0, .5));
  -webkit-box-reflect: below 2px linear-gradient(transparent 76%, rgba(255, 255, 255, .16));
}
.fiche .photo + .actions { margin-top: 12px; justify-content: center; }
.fiche-tete { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.fiche-tete h1 { margin: 0 0 6px; font-size: 2.85rem; }
.fiche-tete .sous-titre { font: italic 500 1.2rem/1.3 var(--serif); color: var(--texte-2); }
.fiche-tete .etiquettes { margin-top: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: .9rem; color: var(--texte-2); }
.fiche .actions-vin { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--bord); }
.fiche .actions-vin .danger { margin-left: auto; border-color: transparent; }
.fiche-tete .millesime { color: var(--or); font-weight: 500; }
@media (max-width: 760px) {
  .fiche { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .fiche > div:first-child { position: static; }
  .fiche .photo { width: min(230px, 64vw); margin: 0 auto; }
  .fiche-tete { flex-direction: column; align-items: stretch; }
  .fiche-tete h1 { font-size: 2.1rem; }
  .fiche .compteur { align-self: flex-start; }
  .fiche .actions-vin { display: grid; grid-template-columns: 1fr 1fr; }
  .fiche .actions-vin .bouton { white-space: normal; text-align: center; }
  .fiche .actions-vin .primaire { grid-column: 1 / -1; }
  .fiche .actions-vin .danger { margin-left: 0; }
}
.compteur { display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--bord); }
.compteur .valeur { min-width: 2.2ch; text-align: center; font-size: 2.3rem; font-weight: 600; line-height: 1; }
.compteur .bouton.rond { border: 0; background: var(--surface); box-shadow: var(--ombre); font-size: 1.3rem; }
.compteur .bouton.rond:hover { background: var(--accent); color: var(--accent-texte); }
.proprietes { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0 22px; margin: 0; }
.proprietes > div { padding: 11px 0; border-top: 1px solid var(--bord); }
.proprietes dt { font: 600 .66rem/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--texte-3); margin-bottom: 3px; }
.proprietes dd { margin: 0; font-size: .97rem; }
@media (max-width: 760px) { .proprietes { grid-template-columns: 1fr 1fr; } }
.note-perso {
  display: inline-flex; align-items: center; gap: 8px; margin: 4px 0 8px; padding: 5px 12px 5px 10px; border-radius: 999px;
  font-weight: 600; color: var(--danger); background: color-mix(in srgb, var(--danger) 9%, transparent);
  animation: clignote-note 1.2s ease-in-out infinite;
}
@keyframes clignote-note { 50% { opacity: .35; } }

/* frise de garde */
.frise { position: relative; height: 40px; margin: 34px 4px 4px; }
.frise .piste { position: absolute; top: 15px; left: 0; right: 0; height: 4px; border-radius: 2px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--bord); }
.frise .zone { position: absolute; top: 13px; height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--s-a_boire) 55%, transparent); }
.frise .zone.plateau { background: linear-gradient(90deg, var(--or-vif), var(--or)); }
.frise .repere { position: absolute; top: 4px; width: 2px; height: 26px; margin-left: -1px; border-radius: 1px; background: var(--texte); }
.frise .repere span { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); font: 700 .72rem var(--sans); white-space: nowrap; padding: 2px 7px; border-radius: 999px; background: var(--texte); color: var(--fond); }
.frise .etoile { position: absolute; top: 8px; transform: translateX(-50%); color: var(--or); font-size: .95rem; line-height: 1; text-shadow: 0 0 4px var(--surface); }
.frise .borne { position: absolute; top: 26px; transform: translateX(-50%); font-size: .74rem; color: var(--texte-3); font-variant-numeric: tabular-nums; }
.origine-garde { margin: 10px 0 0; color: var(--texte-2); }
.emplacement-ligne .position { margin-right: 2px; }

/* position dans un casier (« B4 ») */
.position {
  display: inline-grid; place-items: center; min-width: 34px; height: 24px; padding: 0 7px; border-radius: 6px; flex: none;
  font: 700 .74rem var(--sans); letter-spacing: .04em; color: var(--texte); background: var(--surface-2); border: 1px solid var(--bord);
}

/* ---------- tableaux ---------- */
.tableau { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tableau th { text-align: left; font: 600 .66rem var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--texte-3); border-bottom: 1px solid var(--bord-fort); padding: 8px 10px; }
.tableau td { border-bottom: 1px solid var(--bord); padding: 11px 10px; vertical-align: top; }
.tableau tr:last-child td { border-bottom: 0; }
.tableau tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.defile { overflow-x: auto; }
.signe { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 6px; border-radius: 50%; font-weight: 700; font-size: .85rem; vertical-align: -1px; }
.signe.entree { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.signe.sortie { color: var(--accent-lien); background: color-mix(in srgb, var(--accent-lien) 13%, transparent); }

/* climat */
.climat { display: flex; gap: 34px; flex-wrap: wrap; }
.climat .mesure { font-size: 2.2rem; font-weight: 600; line-height: 1.1; }
.climat .alerte { color: var(--danger); }

/* ---------- message et fenêtres ---------- */
#toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 60; max-width: calc(100% - 32px);
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  padding: 12px 20px; border-radius: 12px; border: 1px solid var(--nuit-bord);
  background: var(--nuit); color: var(--nuit-texte); font-weight: 500; box-shadow: var(--ombre-haute);
  transition: opacity .25s, transform .3s cubic-bezier(.2, .8, .2, 1);
}
#toast.visible { opacity: 1; transform: translate(-50%, 0); }
#toast.erreur { background: var(--danger); color: #fff; border-color: transparent; }
@media (prefers-color-scheme: dark) { #toast.erreur { color: #1a0d0d; } }
#toast.avec-action { pointer-events: auto; display: flex; align-items: center; gap: 14px; width: max-content; max-width: calc(100% - 24px); white-space: nowrap; }
.toast-action { border: 0; border-radius: 999px; padding: 6px 14px; font: 700 .86rem var(--sans); cursor: pointer; background: var(--or-vif); color: #1c1a1e; }

dialog {
  width: min(540px, calc(100% - 32px)); max-height: 88vh; padding: 28px; border: 1px solid var(--bord); border-radius: 20px;
  background: var(--surface); color: var(--texte); box-shadow: var(--ombre-haute);
}
dialog[open] { animation: fenetre .26s cubic-bezier(.2, .8, .2, 1); }
@keyframes fenetre { from { opacity: 0; transform: translateY(10px) scale(.985); } }
dialog::backdrop { background: rgba(14, 11, 16, .5); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
dialog h2 { font-size: 1.75rem; }
dialog .actions { justify-content: flex-end; margin-top: 22px; }
.choix-multiple { flex-wrap: wrap; }
@media (max-width: 760px) {
  #toast { bottom: calc(var(--hauteur-onglets) + 26px + env(safe-area-inset-bottom)); }
  /* sur iPhone, les fenêtres montent du bas comme une feuille iOS */
  dialog { width: 100% !important; max-width: none; max-height: 92vh; margin: auto 0 0; border-radius: 22px 22px 0 0; border-bottom: 0;
    padding: 26px 20px max(24px, env(safe-area-inset-bottom)); }
  dialog::before { content: ""; display: block; width: 38px; height: 4px; margin: -14px auto 16px; border-radius: 2px; background: var(--bord-fort); }
  dialog[open] { animation: feuille .3s cubic-bezier(.2, .8, .2, 1); }
}
@keyframes feuille { from { transform: translateY(100%); } }
.notes-etoiles { display: flex; gap: 4px; margin-top: 6px; }
.notes-etoiles button { background: none; border: 0; font-size: 1.9rem; line-height: 1; cursor: pointer; color: var(--bord-fort); padding: 2px; transition: color .12s, transform .12s; }
.notes-etoiles button:hover { transform: scale(1.12); }
.notes-etoiles button.on { color: var(--or); }
.feuille-plus { display: grid; gap: 4px; }
.feuille-plus a { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 12px; color: var(--texte); font-weight: 500; }
.feuille-plus a:hover { background: var(--surface-2); text-decoration: none; }
.feuille-plus svg { width: 22px; height: 22px; fill: none; stroke: var(--accent-lien); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- accueil : le bandeau de la cave ---------- */
.casier {
  position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 34px; align-items: center;
  margin-bottom: 22px; padding: 36px 38px; border-radius: 24px; color: var(--nuit-texte);
  background:
    radial-gradient(70% 90% at 0% 0%, rgba(142, 35, 64, .38), transparent 62%),
    radial-gradient(50% 70% at 100% 100%, rgba(201, 162, 79, .1), transparent 70%),
    linear-gradient(160deg, var(--nuit-2), var(--nuit));
  box-shadow: inset 0 0 0 1px var(--nuit-bord), var(--ombre-haute);
}
.casier .surtitre { color: var(--or-vif); }
.casier .total { font: 600 clamp(4.2rem, 10vw, 6.6rem)/.86 var(--serif); letter-spacing: -.025em; font-variant-numeric: lining-nums; }
.casier .sous-total { margin-top: 8px; font: italic 500 1.3rem var(--serif); color: var(--nuit-texte-2); }
.casier .chiffres { display: flex; flex-wrap: wrap; gap: 16px 0; margin: 28px 0 0 -22px; overflow: hidden; }
.casier .chiffres > * { display: grid; gap: 2px; margin-left: -1px; padding: 0 22px; border-left: 1px solid var(--nuit-bord); color: inherit; }
.casier .chiffres strong { font: 600 1.7rem/1 var(--serif); font-variant-numeric: lining-nums; }
.casier .chiffres span { font: 600 .64rem var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--nuit-texte-2); }
.casier .a-ranger { color: #f3c98a; border-radius: 0; }
.casier .a-ranger span { color: inherit; opacity: .85; }
.casier .a-ranger:hover { text-decoration: none; color: #ffdca8; }
.alveoles {
  align-self: center; display: grid; grid-template-columns: repeat(var(--colonnes, 12), 20px); gap: 7px;
  padding: 16px; border-radius: 16px; background: rgba(0, 0, 0, .32);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(255, 255, 255, .04);
}
/* chaque alvéole : le cul d'une bouteille vu de face, teinté par le vin */
.alveoles i {
  display: block; width: 20px; height: 20px; border-radius: 50%;
  background:
    radial-gradient(circle at 34% 30%, rgba(255, 255, 255, .55), transparent 28%),
    radial-gradient(circle, color-mix(in srgb, var(--c) 92%, #000) 0 30%, color-mix(in srgb, var(--c) 45%, #000) 34% 42%, color-mix(in srgb, var(--c) 72%, #0b0a0c) 46% 100%);
  box-shadow: 0 2px 3px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(255, 255, 255, .07);
  animation: remplir .5s backwards cubic-bezier(.2, .8, .2, 1); animation-delay: calc(var(--i) * 10ms);
}
.alveoles i.libre { background: rgba(255, 255, 255, .04); box-shadow: inset 0 2px 3px rgba(0, 0, 0, .6); animation: none; }
.alveoles .reste { grid-column: 1 / -1; text-align: center; font-size: .76rem; color: var(--nuit-texte-2); margin-top: 4px; }
@keyframes remplir { from { transform: scale(0); opacity: 0; } }
@media (max-width: 900px) {
  .casier { grid-template-columns: minmax(0, 1fr); padding: 28px 24px; gap: 24px; }
  .alveoles { grid-template-columns: repeat(var(--colonnes-mobile, 10), minmax(0, 1fr)); justify-items: center; }
  .alveoles i { width: 100%; max-width: 26px; height: auto; aspect-ratio: 1; }
}
@media (max-width: 760px) {
  .casier { margin: 0 -4px 18px; border-radius: 20px; }
  .casier .chiffres { margin-left: -14px; }
  .casier .chiffres > * { padding: 0 14px; }
  .casier .chiffres strong { font-size: 1.45rem; }
}

/* alerte « place libre » dans le bandeau */
.alerte-place {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 26px; padding: 14px 16px; border-radius: 14px;
  background: rgba(201, 162, 79, .08); border: 1px solid rgba(217, 185, 107, .3);
}
.alerte-place > div { flex: 1 1 240px; display: grid; gap: 3px; }
.alerte-place b { font-weight: 600; }
.alerte-place b::before { content: "❄"; margin-right: 8px; color: #a9c9e6; }
.alerte-place span { font-size: .87rem; color: var(--nuit-texte-2); }
.alerte-place .actions { gap: 8px; }
.alerte-place .bouton { background: var(--nuit-texte); color: #1c1a1e; border: 0; }
.alerte-place .bouton:hover { background: #fff; }
.alerte-place .secondaire-clair { background: transparent; color: var(--nuit-texte); border: 1px solid rgba(241, 233, 220, .35); }
.alerte-place .secondaire-clair:hover { background: rgba(255, 255, 255, .08); }

.raccourcis { margin: 0 0 26px; }
@media (max-width: 760px) { .raccourcis .bouton { width: 100%; } }
.duo-a-boire { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
@media (max-width: 860px) { .duo-a-boire { grid-template-columns: minmax(0, 1fr); } }
.occasions { margin-top: 20px; }
.occasions li .quand { font: 600 .72rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--danger); white-space: nowrap; }

/* ---------- bouteilles non rangées, candidats ---------- */
.pastille-ranger {
  display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 0 14px; min-height: 36px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--attention) 45%, transparent); background: color-mix(in srgb, var(--attention) 10%, transparent);
  color: var(--texte); font: 600 .86rem var(--sans); cursor: pointer;
}
.pastille-ranger:hover { background: color-mix(in srgb, var(--attention) 18%, transparent); }
.pastille-ranger svg { width: 16px; height: 16px; fill: none; stroke: var(--attention); stroke-width: 1.7; stroke-linejoin: round; }
.a-ranger-liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 62vh; overflow-y: auto; }
.a-ranger-liste li { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--bord); }
.a-ranger-liste .etiquette { width: 44px; height: 96px; flex: none; display: grid; place-items: end center; overflow: hidden; border-radius: 8px; }
.a-ranger-liste .etiquette img { width: 100%; height: 100%; object-fit: cover; }
.a-ranger-liste .etiquette svg { height: 94px; width: auto; overflow: visible; }
.a-ranger-liste .grandit { flex: 1; min-width: 0; display: grid; gap: 2px; }
.a-ranger-liste b { font: 600 1.12rem/1.2 var(--serif); font-variant-numeric: lining-nums; }
.a-ranger-liste .statut { margin-right: 4px; }

/* ---------- plan de cave ---------- */
.onglets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.onglets a {
  display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--bord-fort); color: var(--texte-2); font-weight: 500;
}
.onglets a:hover { color: var(--texte); text-decoration: none; border-color: var(--texte-3); }
.onglets a.actif { background: var(--texte); color: var(--fond); border-color: var(--texte); }
.onglets a .muted { color: inherit; opacity: .6; font: 600 1rem var(--serif); font-variant-numeric: lining-nums; }

.cave-tete { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.cave-tete h2 { margin: 0 0 2px; font-size: 1.9rem; }
.cave-tete .remplissage { display: flex; align-items: center; gap: 10px; color: var(--texte-2); font-size: .9rem; }
.cave-tete .jauge { width: 120px; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; box-shadow: inset 0 0 0 1px var(--bord); }
.cave-tete .jauge span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--or-vif)); }

/* barre d'outils : recherche, surlignage, zoom, vue */
.plan-outils { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin: 0 0 14px; }
.plan-outils .recherche { flex: 1 1 220px; max-width: 340px; }
.plan-outils .recherche input { min-height: 38px; font-size: .9rem; }
.plan-puces { flex: 1 1 100%; order: 3; }
.groupe-boutons { display: inline-flex; border: 1px solid var(--bord-fort); border-radius: 999px; padding: 2px; gap: 2px; background: var(--surface); }
.groupe-boutons button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 34px; height: 32px; padding: 0 10px; border: 0; border-radius: 999px;
  background: transparent; color: var(--texte-2); font: 500 .82rem var(--sans); cursor: pointer;
}
.groupe-boutons button:hover { color: var(--texte); background: var(--surface-2); }
.groupe-boutons button.actif { background: var(--texte); color: var(--fond); }
.groupe-boutons button:disabled { opacity: .35; cursor: default; background: none; }
.groupe-boutons svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.plan-outils .resultat-surlignage { font-size: .84rem; color: var(--texte-2); }
@media (max-width: 760px) {
  .plan-outils .recherche { flex: 1 1 100%; max-width: none; }
  .plan-puces { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -18px; padding: 0 18px; }
  .plan-puces::-webkit-scrollbar { display: none; }
}

/* la vitrine : fond sombre, comme l'intérieur d'une cave éclairée */
.plan-conteneur {
  --case: 58px;
  --fantome: rgba(241, 233, 220, .07);
  position: relative; overflow: auto; overscroll-behavior: contain; padding: 26px 24px 22px; border-radius: 18px;
  color: var(--nuit-texte);
  background:
    radial-gradient(90% 60% at 50% -10%, rgba(255, 236, 205, .09), transparent 70%),
    linear-gradient(180deg, #221f25, #161418);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06), inset 0 30px 60px -40px rgba(0, 0, 0, .6);
  touch-action: pan-x pan-y;
}
.plan-conteneur::-webkit-scrollbar { height: 8px; width: 8px; }
.plan-conteneur::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 4px; }
.casiers { display: flex; gap: 48px; align-items: flex-start; width: max-content; margin: 0 auto; padding-right: 14px; }
.colonne-casiers { display: flex; flex-direction: column; gap: 26px; align-items: flex-start; }
.casier-bloc { position: relative; display: grid; gap: 6px; }
.casier-bloc.refrigere {
  padding: 10px 10px 8px 4px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(150, 190, 225, .07), rgba(150, 190, 225, .02));
  box-shadow: inset 0 0 0 1px rgba(170, 205, 235, .14), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.casier-titre {
  display: flex; align-items: center; gap: 8px; padding-left: 24px; min-height: 26px;
  font: italic 600 1.1rem/1.1 var(--serif); color: var(--nuit-texte);
}
.casier-taux { font: 600 .68rem var(--sans); font-style: normal; letter-spacing: .06em; color: var(--nuit-texte-3); font-variant-numeric: tabular-nums; }
.froid-titre { color: #a9c9e6; font-style: normal; font-size: .9rem; }
.casier-coin { position: absolute; top: 20px; right: -34px; z-index: 50; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.casier-coin .casier-taux { writing-mode: vertical-rl; transform: rotate(180deg); }
.casier-bloc.refrigere .casier-coin { right: -30px; }
.modifier-etagere {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; min-height: 0; padding: 0 10px; border-radius: 999px;
  border: 1px solid rgba(214, 178, 106, .45); background: rgba(24, 22, 27, .75); color: var(--or-vif, #d6b26a);
  font: 600 .72rem var(--sans); letter-spacing: .02em; white-space: nowrap; cursor: pointer; transition: background .15s, color .15s;
}
.modifier-etagere:hover, .modifier-etagere:focus-visible { color: var(--nuit-texte); background: rgba(24, 22, 27, .95); border-color: rgba(214, 178, 106, .8); }
.casier-titre .modifier-etagere { margin-left: 2px; }

/* un casier : chaque place est posée à sa position (étage, colonne, profondeur, quinconce).
   --x/--y : place normale ; --xe/--ye : place en vue éclatée (rangs de derrière posés au-dessus de celui de devant). */
.plan { position: relative; display: block; width: calc(var(--case) * var(--w)); height: calc(var(--case) * var(--h)); }
/* le glissement ne joue qu'à l'ouverture / fermeture d'un casier (pas pendant un zoom) */
.plan.anime { transition: width .5s cubic-bezier(.2, .8, .2, 1), height .5s cubic-bezier(.2, .8, .2, 1); }
.plan.eclate { width: calc(var(--case) * var(--we)); height: calc(var(--case) * var(--he)); }
.plan .case-cave, .plan .repere, .plan .tablette, .plan .nom-rang { left: calc(var(--case) * var(--x)); top: calc(var(--case) * var(--y)); }
.plan.anime .case-cave, .plan.anime .repere, .plan.anime .tablette, .plan.anime .nom-rang {
  transition: left .5s cubic-bezier(.2, .8, .2, 1), top .5s cubic-bezier(.2, .8, .2, 1), opacity .3s; }
.plan.eclate .case-cave, .plan.eclate .repere, .plan.eclate .tablette, .plan.eclate .nom-rang { left: calc(var(--case) * var(--xe)); top: calc(var(--case) * var(--ye)); }
.plan .repere { position: absolute; display: grid; place-items: center; width: var(--case); height: calc(var(--case) * .32);
  font: 600 .62rem var(--sans); letter-spacing: .04em; color: var(--nuit-texte-3); pointer-events: none; z-index: 950; }
.plan .repere.rang { width: calc(var(--case) * .45); height: var(--case); }
.plan .repere.arriere, .plan .tablette.arriere, .plan .nom-rang { opacity: 0; }
.plan.eclate .repere.arriere, .plan.eclate .tablette.arriere, .plan.eclate .nom-rang { opacity: 1; }
/* tablette en bois sous chaque rang, vue en perspective (elle fuit vers le haut-droite comme les bouteilles) */
.plan .tablette { position: absolute; width: calc(var(--case) * (var(--l) - .1)); height: calc(var(--case) * .2); margin-left: calc(var(--case) * .02);
  transform: skewX(-48deg); transform-origin: 0 100%; border-radius: 2px; pointer-events: none;
  background: linear-gradient(180deg, rgba(214, 178, 106, .34), rgba(214, 178, 106, .16) 70%, rgba(120, 92, 50, .5));
  box-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.plan-apercu .tablette { background: linear-gradient(180deg, rgba(214, 178, 106, .45), rgba(214, 178, 106, .22) 70%, rgba(120, 92, 50, .6)); }
/* nom du rang (devant, derrière) au bout de sa tablette, en vue éclatée */
.plan .nom-rang { position: absolute; margin-top: calc(var(--case) * -.04); margin-left: calc(var(--case) * (var(--l) + .32)); font: 600 .58rem var(--sans);
  letter-spacing: .14em; text-transform: uppercase; color: var(--or-vif, #d6b26a); pointer-events: none; white-space: nowrap; }

.plan .case-cave {
  position: absolute; display: block; width: var(--case); height: var(--case); padding: 0;
  border: 0; border-radius: 0; background: none; box-shadow: none; outline: none; cursor: default;
  color: #8b8592; --capsule: #b9b2bf;  /* place libre : bouteille gris clair, bien distincte des vraies */
  pointer-events: none;  /* seule la forme de la bouteille est cliquable */
}
.plan .case-cave svg { width: var(--case); height: var(--case); display: block; overflow: visible; transition: opacity .2s, filter .2s, transform .2s; }
.plan .case-cave .forme, .plan .case-cave use { pointer-events: visiblePainted; cursor: pointer; }
.plan .case-cave:not(.pleine) svg { opacity: .32; filter: saturate(0); }
.plan .case-cave:not(.pleine):hover svg { opacity: .7; }
.plan .case-cave.pleine svg { filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .5)); }
.plan .case-cave.pleine:hover svg { filter: brightness(1.18) drop-shadow(0 3px 4px rgba(0, 0, 0, .55)); transform: translate(-1px, -1px); }
.plan .case-cave:focus-visible svg { filter: drop-shadow(0 0 2px var(--or-vif)) drop-shadow(0 0 5px var(--or-vif)); }
/* à boire vite / dépassé : un point d'alerte */
.plan .case-cave.pleine.urgent::after, .plan .case-cave.pleine.depasse::after {
  content: "!"; position: absolute; top: calc(var(--case) * .06); right: calc(var(--case) * .08); width: 15px; height: 15px; border-radius: 50%;
  display: grid; place-items: center; font: 800 .62rem/1 var(--sans); color: #fff; background: var(--s-urgent);
  box-shadow: 0 0 0 2px #1d1a20; pointer-events: none;
}
.plan .case-cave.pleine.depasse::after { background: #6b6560; }
/* déplacement / rangement : les places libres s'allument */
.plan .case-cave.cible { color: rgba(217, 185, 107, .55); --capsule: rgba(217, 185, 107, .8); }
.plan .case-cave.cible svg { opacity: .7; animation: appel 1.6s ease-in-out infinite; }
.plan .case-cave.cible:hover svg { opacity: 1; animation: none; }
@keyframes appel { 50% { opacity: .35; } }
/* surlignage (puces, recherche) */
.plan .case-cave.estompee svg { opacity: .16; filter: grayscale(.8); }
.plan .case-cave.estompee::after { opacity: .2; }
.plan .case-cave.trouvee svg { filter: drop-shadow(0 0 1.5px rgba(255, 228, 170, .95)) drop-shadow(0 0 7px rgba(217, 185, 107, .65)); }
/* localisation : la bouteille clignote, une fois en noir, une fois en rouge */
.plan .case-cave.surligne { z-index: 60 !important; }
.plan .case-cave.surligne svg { animation: clignote-bouteille 1.4s ease-in-out infinite; }
@keyframes clignote-bouteille {
  0%, 100% { filter: drop-shadow(0 0 0 transparent); transform: scale(1); }
  25% { filter: brightness(.15) drop-shadow(0 0 3px #000) drop-shadow(0 0 1px #000); transform: scale(1.12); }
  50% { filter: drop-shadow(0 0 0 transparent); transform: scale(1); }
  75% { filter: sepia(1) saturate(9) hue-rotate(-50deg) brightness(.85) drop-shadow(0 0 6px #e0102a) drop-shadow(0 0 2px #e0102a); transform: scale(1.12); }
}
@media (prefers-reduced-motion: reduce) { .plan .case-cave.surligne svg { filter: drop-shadow(0 0 3px #e0102a) drop-shadow(0 0 6px #e0102a); } }
/* choix d'un emplacement dans un formulaire */
.plan-choix .case-cave.pleine { cursor: default; }
.plan-choix .case-cave.pleine svg { opacity: .3; filter: grayscale(.7); }
.plan-choix .case-cave.pleine .forme, .plan-choix .case-cave.pleine use { pointer-events: none; }
.plan-choix .case-cave:not(.pleine) svg { opacity: .32; }
.plan .case-cave.choisie svg { opacity: 1; filter: drop-shadow(0 0 2px var(--or-vif)) drop-shadow(0 0 6px rgba(217, 185, 107, .7)); }
.choix-emplacements:empty { display: none; }
.choix-emplacements .choix-info { margin: 0 0 10px; color: var(--texte-2); }
.choix-emplacements .plan-conteneur { --case: 46px; max-width: 100%; max-height: 60vh; }

.legende { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font-size: .8rem; color: var(--texte-3); }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.legende .alerte-pt { display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; background: var(--s-urgent); color: #fff; font: 800 .58rem var(--sans); }

/* infobulle au survol (souris) */
.infobulle {
  position: fixed; z-index: 70; max-width: 260px; padding: 11px 13px; border-radius: 12px; pointer-events: none;
  background: rgba(16, 14, 18, .96); color: var(--nuit-texte); border: 1px solid rgba(217, 185, 107, .25);
  box-shadow: 0 14px 34px -10px rgba(0, 0, 0, .7); font-size: .8rem; line-height: 1.4;
  opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s;
}
.infobulle.visible { opacity: 1; transform: none; }
.infobulle .nom { display: block; font: 600 1.1rem/1.15 var(--serif); font-variant-numeric: lining-nums; margin-bottom: 2px; }
.infobulle .lieu { display: block; margin-top: 6px; color: var(--nuit-texte-2); font-size: .74rem; letter-spacing: .04em; }
.infobulle .statut { margin-top: 6px; }

/* vue liste du contenu de la cave */
.vue-liste { display: grid; gap: 22px; }
.vue-liste h3 { margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.vue-liste .liste li { cursor: pointer; padding-left: 6px; padding-right: 6px; margin: 0 -6px; border-radius: 8px; }
.vue-liste .liste li:hover { background: var(--surface-2); }
.vue-liste .liste li.estompee { opacity: .35; }

/* bandeaux : localisation, déplacement */
.bandeau-localisation {
  display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding: 14px 18px;
  border-color: color-mix(in srgb, var(--accent-lien) 35%, var(--bord)); background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}
.bandeau-localisation > svg { width: 24px; height: 24px; color: var(--accent-lien); }
.bandeau-localisation .grandit { flex: 1; min-width: 0; }
.bandeau-localisation b { font: 600 1.15rem var(--serif); font-variant-numeric: lining-nums; }
@media (max-width: 760px) { .bandeau-localisation { flex-wrap: wrap; } .bandeau-localisation .grandit { flex-basis: calc(100% - 40px); } }
#mode-deplacement {
  position: sticky; top: 8px; z-index: 8; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; padding: 10px 14px;
  border-radius: 12px; background: var(--nuit); color: var(--nuit-texte); border: 1px solid rgba(217, 185, 107, .4); box-shadow: var(--ombre-haute);
}
#mode-deplacement .grandit { flex: 1; min-width: 0; }
#mode-deplacement .bouton { background: transparent; color: var(--nuit-texte); border-color: rgba(241, 233, 220, .35); }
.bandeau-rangement { margin-bottom: 18px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; border-color: color-mix(in srgb, var(--accent-lien) 35%, var(--bord)); }
.liste li.surligne { border-radius: 10px; padding-left: 8px; padding-right: 8px; animation: clignote-ligne 1s ease-in-out infinite; }
@keyframes clignote-ligne { 50% { background: var(--accent-doux); } }

/* fenêtre d'une bouteille du plan */
.dialogue-bouteille { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 22px; align-items: center; }
.dialogue-bouteille .art {
  position: relative; height: 236px; border-radius: 14px; overflow: hidden;
  background: radial-gradient(60% 40% at 50% 30%, rgba(255, 238, 210, .12), transparent 70%), linear-gradient(180deg, var(--nuit-3), var(--nuit));
}
.dialogue-bouteille .art svg { position: absolute; left: 50%; bottom: 10px; height: calc(100% - 22px); width: auto; transform: translateX(-50%); overflow: visible; }
.dialogue-bouteille .art img { width: 100%; height: 100%; object-fit: cover; }
.dialogue-bouteille h2 { margin: 0 0 4px; font-size: 1.85rem; }
.dialogue-bouteille .lieu { display: flex; align-items: center; gap: 8px; margin: 12px 0 8px; color: var(--texte-2); font-size: .88rem; }
.dialogue-bouteille .actions { justify-content: flex-start; margin-top: 16px; }
@media (max-width: 420px) { .dialogue-bouteille { grid-template-columns: 70px minmax(0, 1fr); gap: 16px; } .dialogue-bouteille .art { height: 190px; } }

/* ---------- Mets & Vins ---------- */
.plats-tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 10px; }
.tuile-plat {
  position: relative; display: grid; justify-items: center; gap: 6px; padding: 18px 6px 13px; border-radius: 16px;
  border: 1px solid var(--bord); background: var(--surface); color: var(--texte-2); font: 500 .84rem var(--sans); cursor: pointer;
  transition: transform .18s, border-color .18s, background .18s, color .18s, box-shadow .18s;
}
.tuile-plat:hover { border-color: var(--bord-fort); color: var(--texte); transform: translateY(-1px); }
.tuile-plat .emoji { font-size: 2.2rem; line-height: 1; display: block; filter: saturate(.92); }
.tuile-plat:hover .emoji { animation: penche .6s ease-in-out; }
.tuile-plat.actif { background: var(--nuit); border-color: rgba(217, 185, 107, .55); color: var(--nuit-texte); transform: translateY(-2px); box-shadow: var(--ombre-haute); }
.tuile-plat.actif .nom { color: var(--or-vif); font-weight: 600; }
.tuile-plat.actif .emoji { animation: saute .5s cubic-bezier(.3, 1.6, .5, 1), flotte 2.4s ease-in-out .5s infinite; }
.fumee { position: absolute; top: 2px; left: 50%; width: 30px; height: 18px; transform: translateX(-50%); pointer-events: none; }
.fumee i { position: absolute; bottom: 0; width: 4px; height: 12px; border-radius: 4px; background: rgba(241, 233, 220, .55); opacity: 0; }
.fumee i:nth-child(1) { left: 4px; } .fumee i:nth-child(2) { left: 13px; } .fumee i:nth-child(3) { left: 22px; }
.tuile-plat.chaud.actif .fumee i { animation: fumee 1.8s ease-out infinite; }
.tuile-plat.chaud.actif .fumee i:nth-child(2) { animation-delay: .6s; } .tuile-plat.chaud.actif .fumee i:nth-child(3) { animation-delay: 1.2s; }
@keyframes saute { 0% { transform: scale(.6); } 60% { transform: scale(1.25) rotate(-6deg); } 100% { transform: scale(1); } }
@keyframes flotte { 50% { transform: translateY(-3px); } }
@keyframes penche { 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
@keyframes fumee { 0% { opacity: 0; transform: translateY(6px) scaleY(.6); } 30% { opacity: .7; } 100% { opacity: 0; transform: translateY(-12px) translateX(3px) scaleY(1.2); } }
.filtre-couleur { margin: 18px 0 0; }
.suggestions-liste { display: grid; gap: 12px; margin-top: 18px; }
.suggestion-vin { display: flex; gap: 18px; align-items: center; padding: 14px 18px 14px 14px; }
.suggestion-vin.meilleure { border-color: color-mix(in srgb, var(--or) 55%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--or) 30%, transparent), var(--ombre-haute); }
.suggestion-vin .photo-vin { width: 56px; height: 118px; flex: none; display: grid; place-items: end center; overflow: hidden; border-radius: 8px; }
.suggestion-vin .photo-vin img { width: 100%; height: 100%; object-fit: cover; }
.suggestion-vin .photo-vin svg { height: 114px; width: auto; overflow: visible; }
.suggestion-vin .grandit { flex: 1; min-width: 0; display: grid; gap: 3px; }
.suggestion-vin .titre { font: 600 1.3rem/1.12 var(--serif); color: var(--texte); font-variant-numeric: lining-nums; }
.suggestion-vin .titre:hover { color: var(--accent-lien); text-decoration: none; }
.suggestion-vin .raisons { color: var(--texte-2); }
.suggestion-vin .cote { display: grid; justify-items: end; gap: 10px; }
.accord { display: flex; align-items: center; gap: 10px; font: 600 .68rem var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--or); }
.accord .jauge { width: 64px; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; box-shadow: inset 0 0 0 1px var(--bord); }
.accord .jauge span { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--or), var(--or-vif)); }
.suggestion .rang { font: 600 1.6rem var(--serif); color: var(--texte-3); width: 1.4em; text-align: center; }
.plats { display: flex; gap: 8px; flex-wrap: wrap; }
.plats button { border-radius: 999px; }
.plats button.actif, .cadrages .actif { background: var(--texte); color: var(--fond); border-color: var(--texte); }
@media (max-width: 520px) {
  .suggestion-vin { flex-wrap: wrap; }
  .suggestion-vin .grandit { flex-basis: calc(100% - 80px); }
  .suggestion-vin .cote { flex-basis: 100%; grid-auto-flow: column; justify-content: space-between; align-items: center; }
}

/* ---------- ajout d'un vin ---------- */
.tuiles-ajout { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.tuile-ajout {
  display: grid; gap: 8px; justify-items: start; text-align: left; padding: 26px 24px; cursor: pointer; color: var(--texte);
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.tuile-ajout:hover { border-color: var(--bord-fort); text-decoration: none; transform: translateY(-2px); box-shadow: var(--ombre-haute); }
.tuile-ajout .icone { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 6px; border-radius: 14px; background: var(--accent); color: var(--accent-texte); }
.tuile-ajout .icone svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tuile-ajout.secondaire .icone { background: var(--surface-2); color: var(--texte); box-shadow: inset 0 0 0 1px var(--bord-fort); }
.tuile-ajout b { font: 600 1.4rem/1.1 var(--serif); }
.tuile-ajout .muted { font-size: .88rem; }
.resultat-scan, .traitement { display: flex; gap: 18px; align-items: flex-start; margin-top: 18px; flex-wrap: wrap; }
.resultat-scan > img, .resultat-scan > svg { width: 110px; max-height: 160px; object-fit: contain; border-radius: 10px; flex: none; }
.resultat-scan h2 { margin: 2px 0; }
.apercu-ajout { display: grid; gap: 10px; justify-items: center; margin-bottom: 16px; }
.apercu-ajout img { width: 180px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 14px; background: var(--surface-2); box-shadow: var(--ombre-haute); }
.traitement .etapes { flex: 1; min-width: 220px; }
.traitement .etapes li { font-size: .92rem; }
.traitement .actions { flex-basis: 100%; }
.verso-choix { margin-top: 12px; flex-basis: 100%; box-shadow: none; border-color: color-mix(in srgb, var(--accent-lien) 40%, var(--bord)); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.verso-choix p { margin: 4px 0 0; }
.nouveau-vin-case { margin-top: 16px; padding: 16px; box-shadow: none; background: var(--surface-2); }
.nouveau-vin-case .bouton { white-space: normal; text-align: center; }
.viseur { position: relative; border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.viseur video { width: 100%; height: 100%; object-fit: cover; display: block; }
.viseur .cadre { position: absolute; inset: 18% 14%; border: 2px solid rgba(255, 255, 255, .9); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .4); }
.fonds { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.vignette-fond { display: grid; gap: 4px; padding: 4px; border: 2px solid var(--bord); border-radius: 12px; background: var(--surface); color: var(--texte); font: inherit; font-size: .8rem; cursor: pointer; }
.vignette-fond:hover { border-color: var(--accent-lien); }
.vignette-fond img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; }
.vignette-fond:disabled { opacity: .5; cursor: wait; }
.cadrages { margin-bottom: 12px; }
.plein-ecran { display: grid; place-items: center; }
.plein-ecran img { max-width: 100%; max-height: 78vh; border-radius: 12px; object-fit: contain; }
.diagnostic-ia { border: 1px solid var(--bord); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); line-height: 1.6; }

/* formulaire d'un vin */
.formulaire-vin { max-width: 980px; }
.formulaire-vin .actions.large { position: sticky; bottom: 0; z-index: 4; margin: 8px -24px -22px; padding: 14px 24px; border-top: 1px solid var(--bord); border-radius: 0 0 var(--rayon) var(--rayon);
  background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
@media (max-width: 760px) { .formulaire-vin .actions.large { margin: 8px -18px -18px; padding: 12px 18px; bottom: calc(var(--hauteur-onglets) + env(safe-area-inset-bottom)); } }

/* réglages */
.reglages .carte h2 { display: flex; align-items: center; gap: 10px; }
.reglages .carte h2 svg { width: 20px; height: 20px; fill: none; stroke: var(--or); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.reglages ul { padding-left: 18px; }
.reglages ul li { margin: 4px 0; }

/* envies */
.envies .liste li .grandit.fait { text-decoration: line-through; opacity: .55; }

/* ---------- bouteilles dessinées (bouteilles.js) : textes de l'étiquette ---------- */
.bouteille-debout { display: block; }
.bouteille-debout text { text-anchor: middle; font-family: var(--serif); font-variant-numeric: lining-nums; }
.bouteille-debout .b-nom { font-weight: 700; }
.bouteille-debout .b-mil { font-weight: 700; }
.bouteille-debout .b-app { font-style: italic; font-weight: 500; }
.bouteille-debout .b-dom { font-family: var(--sans); font-weight: 600; letter-spacing: .14em; }
#page > .infobulle { animation: none; }
@media (max-width: 760px) {
  /* iPhone : l'ajout passe par le bouton central de la barre d'onglets */
  .entete .bouton.primaire[href="#/ajouter"] { display: none; }
  .entete .actions .bouton { min-height: 38px; padding: 0 13px; font-size: .85rem; }
  .cave-tete .seul-texte { display: none; }
  .cave-tete .actions { width: 100%; }
}

/* profondeurs : montrer un seul rang pour lire les bouteilles du fond */
.profondeurs-choix { display: inline-flex; gap: 2px; padding: 2px; margin-left: 4px; border-radius: 999px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); }
.profondeurs-choix button { border: 0; background: none; color: var(--nuit-texte-2); font: 600 .66rem var(--sans); letter-spacing: .02em; padding: 3px 9px; border-radius: 999px; cursor: pointer; font-style: normal; }
.profondeurs-choix button:hover { color: var(--nuit-texte); }
.profondeurs-choix button.actif { background: var(--nuit-texte); color: #1c1a1e; }
.plan .case-cave.masquee svg { opacity: .07 !important; filter: grayscale(1); }
.plan .case-cave.masquee::after { opacity: 0; }
.plan .case-cave.masquee use, .plan .case-cave.masquee .forme { pointer-events: none !important; }
.plan .case-cave.au-premier-plan { z-index: 900 !important; }

/* configurateur de disposition */
.configurateur { display: grid; gap: 16px; }
.configurateur .apercu-disposition { --case: 52px; display: grid; place-items: center; min-height: 170px; padding: 20px 16px 16px; overflow: auto; border-radius: 16px;
  background: radial-gradient(90% 70% at 50% 0%, rgba(255, 236, 205, .1), transparent 70%), linear-gradient(180deg, #221f25, #161418); }
.plan-apercu .case-cave { color: #8d8794; --capsule: #d9cfbf; pointer-events: none; }
.plan-apercu .case-cave svg { opacity: 1 !important; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .45)); }
.plan-apercu .case-cave[data-p="2"], .plan-apercu .case-cave[data-p="4"] { color: #6f6a76; }
.plan-apercu .case-cave.actuelle { color: #b98a5e; --capsule: #f0dcc0; }
.onglets-profondeur { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.onglets-profondeur button { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--bord-fort);
  background: transparent; color: var(--texte-2); font: 600 .84rem var(--sans); cursor: pointer; }
.onglets-profondeur button.actif { background: var(--texte); border-color: var(--texte); color: var(--fond); }
.onglets-profondeur button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.reglage-ligne { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--bord); }
.reglage-ligne .libelle b { display: block; font-weight: 600; }
.reglage-ligne .libelle span { font-size: .8rem; color: var(--texte-3); }
.pas-a-pas { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--bord); }
.pas-a-pas button { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--surface); box-shadow: var(--ombre); color: var(--texte); font: 600 1.15rem var(--sans); cursor: pointer; }
.pas-a-pas button:disabled { opacity: .35; cursor: default; }
.pas-a-pas output { min-width: 2.4ch; text-align: center; font: 600 1.35rem var(--serif); font-variant-numeric: lining-nums; }
.empilements { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.empilements button { display: grid; justify-items: center; gap: 4px; padding: 10px 6px 9px; border-radius: 14px; border: 1px solid var(--bord-fort); background: var(--surface);
  color: var(--texte-2); font: 600 .78rem var(--sans); cursor: pointer; }
.empilements button.actif { border-color: var(--accent-lien); box-shadow: 0 0 0 1px var(--accent-lien); color: var(--texte); }
.empilements button:disabled { opacity: .4; cursor: default; }
.empilements .mini { --case: 30px; height: 70px; display: grid; place-items: center; }
.configurateur .total-places { text-align: center; font-size: .86rem; color: var(--texte-2); }
.configurateur .total-places b { font: 600 1.15rem var(--serif); color: var(--texte); font-variant-numeric: lining-nums; }


.nombre-rangees { margin-top: 4px; border-top: 1px solid var(--bord); border-bottom: 0; }

/* casier mis en avant : étiquette à toucher, les autres casiers s'estompent */
.choisir-casier { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 12px; border-radius: 9px; cursor: pointer;
  border: 1px solid rgba(241, 233, 220, .16); background: rgba(241, 233, 220, .07); color: var(--nuit-texte);
  font: 600 .74rem var(--sans); letter-spacing: .02em; white-space: nowrap; transition: background .2s, color .2s, border-color .2s; }
.choisir-casier:hover { background: rgba(241, 233, 220, .13); }
.choisir-casier .nb-rangs { font-weight: 500; color: var(--nuit-texte-3); font-size: .66rem; }
.choisir-casier[aria-pressed="true"] { background: #b8784a; border-color: #b8784a; color: #fff; }
.choisir-casier[aria-pressed="true"] .nb-rangs { color: rgba(255, 255, 255, .8); }
.casier-bloc { transition: opacity .4s, filter .4s; }
.casier-bloc.estompe { opacity: .22; filter: grayscale(.6); cursor: zoom-in; }
.casier-bloc.estompe .plan * { cursor: zoom-in !important; }
@media (prefers-reduced-motion: reduce) {
  .plan, .plan .case-cave, .plan .repere, .plan .tablette, .plan .nom-rang, .casier-bloc { transition: none; }
}

/* bouteilles allongées (vue de côté) : 3,2 cases de large ; goulot à gauche = dessin retourné */
.plan .case-cave.allonge, .plan .case-cave.allonge svg { width: calc(var(--case) * 3.2); }
/* choix du sens des bouteilles : cartes avec un petit aperçu, comme l'empilement */
.sens-choix { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sens-choix button { display: grid; justify-items: center; align-content: start; gap: 2px; padding: 10px 6px 9px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--bord); background: var(--surface); color: var(--texte); font: 600 .78rem var(--sans); }
.sens-choix button small { font: 500 .66rem var(--sans); color: var(--texte-2); text-align: center; line-height: 1.25; }
.sens-choix button.actif { border-color: #b8784a; box-shadow: 0 0 0 2px rgba(184, 120, 74, .35); }
.sens-choix .mini { --case: 30px; display: grid; place-items: center; height: 54px; width: 100%; margin-bottom: 4px; border-radius: 10px;
  background: linear-gradient(180deg, #221f25, #161418); overflow: hidden; }
@media (max-width: 520px) { .sens-choix { grid-template-columns: repeat(2, 1fr); } }

/* choisir le vin à ranger dans une place libre : fiches avec la bouteille, recherche */
.recherche-fiches { display: flex; margin: 4px 0 12px; }
.recherche-fiches input { flex: 1; }
.fiches-liste { max-height: min(52vh, 520px); overflow-y: auto; margin: 0 -4px; padding: 0 4px 4px; overscroll-behavior: contain; }
.fiches-liste h3 { margin: 10px 0 8px; font: 600 .82rem var(--sans); letter-spacing: .04em; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.fiches-liste h3:first-child { margin-top: 0; }
.fiches-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.fiche-choix { display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 8px 12px 8px 8px; text-align: left; cursor: pointer;
  border: 1px solid var(--bord); border-radius: 14px; background: var(--surface); color: var(--texte); font: inherit; min-width: 0; }
.fiche-choix:hover { border-color: var(--bord-fort); }
.fiche-choix[aria-pressed="true"] { border-color: #b8784a; box-shadow: 0 0 0 2px rgba(184, 120, 74, .35); background: var(--surface-2); }
.fiche-choix .mini-bouteille { flex: none; width: 34px; height: 52px; display: grid; place-items: center; }
.fiche-choix .mini-bouteille img { width: 34px; height: 52px; object-fit: cover; border-radius: 6px; }
.fiche-choix .mini-bouteille svg { height: 52px; width: auto; }
.fiche-choix .grandit { display: grid; min-width: 0; gap: 2px; }
.fiche-choix .titre { font: 600 1rem/1.15 var(--serif); }
.fiche-choix .tronque { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.etiquette-choix { margin-left: auto; flex: none; display: grid; justify-items: end; font: 600 .95rem var(--serif); color: var(--texte); }
.etiquette-choix small { font: 500 .64rem var(--sans); color: var(--texte-2); white-space: nowrap; }
.fiche-choix[hidden], .fiches-liste h3[hidden] { display: none; }
.nouveau-vin-case { margin-top: 12px; }
#ranger-ici { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fiches-liste h3 .petit-texte { text-transform: none; letter-spacing: 0; font-weight: 500; }

/* statistiques : classement des vins par prix */
.carte-prix .choix-prix { margin: 0 0 10px; }
.classement-prix li { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.classement-prix .rang { flex: none; width: 1.6em; text-align: right; font: 600 1rem var(--serif); color: var(--texte-2); }
.classement-prix .mini-bouteille { flex: none; width: 26px; height: 44px; display: grid; place-items: center; }
.classement-prix .mini-bouteille img { width: 26px; height: 44px; object-fit: cover; border-radius: 5px; }
.classement-prix .mini-bouteille svg { height: 44px; width: auto; }
.classement-prix .grandit { min-width: 0; }
.classement-prix .tronque { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.classement-prix .jauge-prix { display: block; height: 4px; margin-top: 5px; border-radius: 2px; width: var(--part);
  background: linear-gradient(90deg, #b8784a, var(--or-vif, #d6b26a)); }
.classement-prix .prix { flex: none; display: grid; justify-items: end; text-align: right; }
.classement-prix .prix b { font: 600 1.05rem var(--serif); font-variant-numeric: lining-nums; }
.classement-prix .prix small { font-size: .7rem; color: var(--texte-2); white-space: nowrap; }
.classement-prix li { flex-wrap: nowrap; }
.classement-prix .grandit { flex: 1 1 auto; }
@media (max-width: 420px) { .classement-prix .prix b { font-size: .95rem; } .classement-prix .rang { width: 1.2em; } }

/* bandeau d'accueil : température et humidité de la cave */
.climat-bandeau { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 0; color: inherit; text-decoration: none; }
.mesure-climat { display: flex; align-items: center; gap: 10px; padding: 9px 16px 9px 12px; border-radius: 14px;
  background: rgba(241, 233, 220, .07); border: 1px solid var(--nuit-bord); }
.mesure-climat .ic { width: 22px; height: 22px; color: var(--or-vif, #d6b26a); flex: none; }
.mesure-climat span { display: grid; gap: 1px; }
.mesure-climat b { font: 600 1.45rem/1 var(--serif); font-variant-numeric: lining-nums; color: var(--nuit-texte); }
.mesure-climat b i { font: 600 .9rem var(--sans); font-style: normal; margin-left: 3px; color: var(--nuit-texte-2); }
.mesure-climat small { font: 600 .6rem var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--nuit-texte-2); }
.mesure-climat.alerte { background: rgba(224, 16, 42, .14); border-color: rgba(224, 80, 90, .55); }
.mesure-climat.alerte .ic, .mesure-climat.alerte small { color: #ff8a93; }
.mesure-climat.indisponible { opacity: .7; }
.climat-bandeau:hover .mesure-climat { border-color: rgba(214, 178, 106, .45); }
/* rappel du filtre à charbon (bandeau d'accueil) et petit bouton sur le plan */
.alerte-filtre b { display: inline-flex; align-items: center; gap: 6px; }
.alerte-filtre b .ic { width: 16px; height: 16px; }
.alerte-filtre b::before { content: none !important; }
.puce-filtre { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(169, 201, 230, .35); background: rgba(169, 201, 230, .08); color: #a9c9e6; font: 600 .66rem var(--sans); white-space: nowrap; }
.puce-filtre .ic { width: 13px; height: 13px; }
.puce-filtre.alerte { border-color: rgba(224, 80, 90, .6); background: rgba(224, 16, 42, .14); color: #ff8a93; }
.etat-filtre.alerte { color: var(--danger); font-weight: 600; }
.climat-bandeau { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, max-content)); }
@media (max-width: 520px) {
  .climat-bandeau { grid-template-columns: 1fr 1fr; gap: 8px; }
  .mesure-climat { padding: 8px 10px; gap: 8px; align-items: flex-start; }
  .mesure-climat b { font-size: 1.3rem; }
  .mesure-climat small { letter-spacing: .06em; line-height: 1.3; }
}

/* statistiques : chiffres clés, puis sections Composition / Valeur / Activité */
.stats-chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 6px 0 12px; }
.tuile-stat { display: grid; gap: 4px; padding: 16px 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--bord); }
.tuile-stat strong { font: 600 1.7rem/1 var(--serif); font-variant-numeric: lining-nums; }
.tuile-stat span { font: 600 .64rem var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--texte-2); }
.titre-section { margin: 30px 0 12px; font: 600 .72rem var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--or, #a07a2c); }
.stats-grille { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.stats-grille .large { grid-column: 1 / -1; }
.stats-grille h3, .carte-prix h3, .carte h3 { margin: 0 0 14px; font: 500 1.25rem var(--serif); }
.carte-prix .titre-carte, .carte > .titre-carte { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.carte-prix .titre-carte h3, .carte > .titre-carte h3 { margin: 0; }
.carte-prix .choix-prix { margin: 0; }
@media (min-width: 900px) {
  .classement-prix, .mouvements-colonnes { columns: 2; column-gap: 32px; }
  .classement-prix li, .mouvements-colonnes li { break-inside: avoid; }
}
@media (max-width: 700px) { .stats-grille { grid-template-columns: minmax(0, 1fr); } .tuile-stat strong { font-size: 1.4rem; } }
.stats-grille h3, .carte-prix h3, .carte > .titre-carte h3 { text-transform: none; letter-spacing: 0; color: var(--texte); }
.stats-chiffres { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1100px) { .stats-chiffres { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 520px) { .stats-chiffres { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tuile-stat { padding: 13px 14px; } }
.classement-prix, .mouvements-colonnes { margin-top: 4px; }
.classement-prix li:first-child, .mouvements-colonnes li:first-child { border-top: 0; }
@media (min-width: 900px) { .classement-prix li, .mouvements-colonnes li { display: flex; border-top: 0; } }

/* prise de vue guidée : caméra plein écran, silhouette de bouteille, cadre de l'étiquette */
html.camera-ouverte, html.camera-ouverte body { overflow: hidden; }
.camera-guidee { position: fixed; inset: 0; z-index: 10000; background: #000; color: #fff; overflow: hidden; touch-action: none; }
.camera-guidee video, .camera-guidee .camera-apercu { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camera-guidee .camera-apercu { object-fit: contain; background: #0c0b0e; }
.camera-guidee .guide { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.camera-guidee.fige .guide { display: none; }
.camera-haut { position: absolute; top: 0; left: 0; right: 0; padding: calc(14px + env(safe-area-inset-top)) 18px 14px; display: grid; gap: 3px;
  text-align: center; background: linear-gradient(180deg, rgba(0,0,0,.7), transparent); font: 500 .86rem var(--sans); }
.camera-haut b { font: 600 1.15rem var(--serif); }
.camera-haut .astuce { font-size: .74rem; color: #d6b26a; }
.camera-guidee.fige .camera-haut { display: none; }
.camera-message { position: absolute; left: 24px; right: 24px; top: 42%; padding: 16px; border-radius: 14px; text-align: center;
  background: rgba(20, 18, 24, .92); font: 600 .95rem var(--sans); }
.camera-bas { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  padding: 16px 16px calc(18px + env(safe-area-inset-bottom)); background: linear-gradient(0deg, rgba(0,0,0,.75), transparent); }
.camera-bas .bouton { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.3); }
.camera-bas .bouton.primaire { background: var(--bordeaux, #7a1b33); border-color: transparent; }
.camera-declencheur { width: 74px; height: 74px; border-radius: 50%; border: 4px solid #fff; background: rgba(255,255,255,.25); cursor: pointer;
  box-shadow: inset 0 0 0 4px rgba(0,0,0,.35); }
.camera-declencheur:active { background: rgba(255,255,255,.6); }
.camera-declencheur:disabled { opacity: .35; }
.camera-flash[aria-pressed="true"] { background: #d6b26a !important; color: #1b1a1e !important; }
.camera-natif { font-size: .8rem; }
