/* ── Thème par univers (allées = rouge DM, clôtures = jaune DM, piscines = bleu DM) ── */
/* Charte DMSVA « Daniel Moquet signe vos allées » (09/10/2026) : rouge RAL 3003
   #cb282b (Pantone 180C), saumon #de7b64 (180C à 60 %), vert RAL 6024 #009635
   (Pantone 355C), noir #1a171b. Le rouge sert aussi aux liens : 5,4:1 sur blanc
   et 4,9:1 sur le fond #f4f4f4 (AA) ; texte blanc sur rouge : 5,4:1. Le vert
   (3,9:1) reste réservé aux aplats et pastilles, jamais à du texte. */
:root {
  --dm-primary: #cb282b;
  --dm-primary-dark: #a91f22;
  --dm-primary-contrast: #fff;
  --dm-tint: #fbeaea;
  --dm-focus-ring: rgba(203,40,43,0.15);
  --dm-accent: #009635;
  --dm-link: #cb282b;
}
/* Charte DMC « signe vos clôtures » (DM Médias, 07/10/2026) : jaune RAL 1018
   #f1cb00, vert RAL 6037 #34943f, vert clair RAL 1016 #b7c72a, noir #1a171b. Liens et icônes : vert de la charte foncé (#2b7d35,
   5,1:1 sur blanc — #34943f plafonne à 3,9:1, sous le seuil AA). */
body.theme-cloture {
  --dm-primary: #f1cb00;
  --dm-primary-dark: #d4b200;
  --dm-primary-contrast: #1a171b;
  --dm-tint: #fdf7d9;
  --dm-focus-ring: rgba(241,203,0,0.3);
  --dm-accent: #b7c72a;
  --dm-link: #2b7d35;
  --dm-green: #34943f;
}
/* Pages publiques hors dm.monrendu.fr (connexion, mot de passe oublié,
   invitation) : couleurs MonRendu, celles de la vitrine. */
body.theme-monrendu {
  --dm-primary: #1f6f4a;
  --dm-primary-dark: #17573a;
  --dm-primary-contrast: #fff;
  --dm-tint: #e6f1eb;
  --dm-focus-ring: rgba(31,111,74,0.18);
  --dm-accent: #1f6f4a;
  --dm-link: #1f6f4a;
}
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 auto 20px; font-family: "Bitter", Georgia, serif; font-weight: 700; font-size: 26px; color: #17212b; text-decoration: none; }
.auth-brand-mark { color: #1f6f4a; flex: none; }

/* Typographie commune à tous les univers (Lato / Bitter) : changer d'onglet ne
   change ni la police ni la taille. L'identité d'univers passe par les couleurs,
   le logo et le bandeau. */
body.theme-piscine {
  --dm-primary: #0077bc;
  --dm-primary-dark: #005a8c;
  --dm-primary-contrast: #fff;
  --dm-tint: #e6f3f9;
  --dm-focus-ring: rgba(0,119,188,0.15);
  --dm-accent: #24b9d5;
  --dm-link: #0077bc;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-family: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 16px; color: #353535; background: #f4f4f4; }
h1, h2, h3, .navbar-brand { font-family: "Bitter", Georgia, serif; }
/* Les boutons n'héritent pas de la police par défaut (Arial du navigateur). */
button, input, select, textarea { font-family: inherit; }
a { color: var(--dm-link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Container ── */
.container { max-width: 960px; margin: 0 auto; padding: 24px 16px; }

/* ── Navbar (charte Daniel Moquet : fond blanc, rouge #cb282b, vert #009635) ── */
.navbar { background: #fff; color: #353535; padding: 0 16px; border-bottom: 3px solid var(--dm-primary); box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.navbar-inner { max-width: 960px; margin: 0 auto; display: flex; align-items: center; height: 62px; gap: 24px; }
.navbar-brand { display: flex; align-items: center; }
.navbar-brand:hover { text-decoration: none; }
.brand-hz { height: 54px; width: auto; display: block; margin: -6px 0; }
/* logo officiel DMC (PNG détouré, ratio 4,45) : 32px = même encre (~32px de haut, ~140px de large) que les logos allées et piscines */
body.theme-cloture .brand-hz { height: 32px; margin: 0; }
/* le SVG piscines n'a aucune marge interne (encre 100 % du viewBox) — même encre visuelle (~32px) que les deux autres */
body.theme-piscine .brand-hz { height: 32px; margin: 0; }
.navbar-links { display: flex; gap: 4px; align-self: stretch; align-items: stretch; }
.navbar-links a { color: #4d4d4d; font-size: 14px; font-weight: 700; display: flex; align-items: center; padding: 0 12px; border-bottom: 3px solid transparent; margin-bottom: -3px; }
.navbar-links a:hover { color: #353535; text-decoration: none; background: #f4f4f4; }
/* Onglet actif : le texte reste gris foncé (12:1) car aucune couleur d'univers
   ne passe le contraste AA en 14px gras — le jaune clôtures plafonne à 1,9:1.
   L'identité d'univers passe par le fond teinté et le soulignement. */
.navbar-links a.active { color: #353535; background: var(--dm-tint); border-bottom-color: var(--dm-primary-dark); }
.navbar-links a.active:hover { background: var(--dm-tint); }
/* Historique et Admin sont transverses aux univers : marquage neutre, jamais
   la couleur de l'univers courant. */
.navbar-links a.nav-generic.active { color: #353535; background: #e8e8e8; border-bottom-color: #8c8c8c; }
.navbar-links a.nav-generic.active:hover { background: #e8e8e8; }

.subcategory-title { font-size: 15px; font-weight: 600; color: #444; margin: 18px 0 10px; }
.subcategory-title:first-of-type { margin-top: 0; }
.navbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.navbar-user { font-size: 13px; color: #717171; }
.btn-logout { background: none; border: 1px solid #d6d6d6; color: #4d4d4d; padding: 4px 12px; border-radius: 4px; font-size: 13px; cursor: pointer; }
.btn-logout:hover { border-color: var(--dm-link); color: var(--dm-link); }

/* ── Flash ── */
.flash { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.flash-notice { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.flash-alert { background: #fbe9e7; color: #c62828; border: 1px solid #ffccbc; }

/* ── Auth pages ── */
.auth-wrapper { display: flex; justify-content: center; align-items: center; min-height: 80vh; }
.auth-card { background: #fff; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,0.08); padding: 40px; width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 24px; margin-bottom: 4px; text-align: center; }
.auth-card .subtitle { font-size: 14px; color: #888; text-align: center; margin-bottom: 24px; }
.auth-card .brand { font-size: 16px; font-weight: 700; color: #cb282b; text-align: center; display: block; margin-bottom: 16px; }
.auth-logo { display: block; width: 150px; margin: 0 auto 20px; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: #333; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 15px;
  transition: border-color 0.15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--dm-primary); box-shadow: 0 0 0 2px var(--dm-focus-ring);
}
.form-errors { background: #fbe9e7; border: 1px solid #ffccbc; border-radius: 6px; padding: 12px 16px; margin-bottom: 16px; font-size: 14px; color: #c62828; }
.form-errors ul { margin: 4px 0 0 16px; }

/* ── Buttons ── */
.btn { display: inline-block; padding: 10px 20px; border-radius: 6px; font-size: 15px; font-weight: 600; cursor: pointer; border: none; text-align: center; transition: background 0.15s; }
.btn-primary { background: var(--dm-primary); color: var(--dm-primary-contrast); }
.btn-primary:hover { background: var(--dm-primary-dark); text-decoration: none; }
.btn-secondary { background: #eee; color: #333; }
.btn-secondary:hover { background: #ddd; }

.auth-card .btn-primary { width: 100%; }
.btn-generate { width: 100%; }

/* ── Links under forms ── */
.auth-links { text-align: center; margin-top: 16px; font-size: 13px; color: #888; }
.auth-links a { color: var(--dm-link); }

/* ── Visualizer ── */
.visualizer h1 { margin-bottom: 24px; }
/* Bandeau « mots clés » des chartes : DMC « PORTAIL CLÔTURE PERGOLA CARPORT »
   noir sur jaune, DMSVA « ALLÉE COUR TERRASSE » blanc sur rouge — couleurs
   portées par --dm-primary / --dm-primary-contrast du thème. */
.brand-keywords { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 22px; margin: -12px 0 24px; padding: 9px 16px;
  background: var(--dm-primary); color: var(--dm-primary-contrast); font-weight: 700; font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase; border-radius: 4px; }
@media (max-width: 600px) {
  .visualizer h1 { font-size: 24px; line-height: 1.25; }
  .brand-keywords { font-size: 12px; gap: 2px 14px; padding: 7px 10px; }
}
.viz-section { background: #fff; border-radius: 10px; padding: 24px; margin-bottom: 16px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.viz-section h2 { font-size: 16px; color: #666; margin-bottom: 16px; }
.hidden { display: none !important; }

/* Upload zone */
.upload-zone { border: 2px dashed #ddd; border-radius: 10px; padding: 40px 20px; text-align: center; transition: border-color 0.2s, background 0.2s; }
.upload-zone:hover, .upload-zone.dragover { border-color: var(--dm-primary); background: var(--dm-tint); }
.upload-zone.has-image { border-style: solid; border-color: #ccc; padding: 12px; }
/* Icône au-dessus du texte, les deux centrés (le SVG inline restait sur la ligne du texte) */
.upload-placeholder { color: #6b6b6b; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.upload-placeholder p { font-size: 15px; margin: 12px 0 4px; font-weight: 600; color: #333; }
.upload-placeholder span { font-size: 13px; }
.upload-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 14px 0 8px; }
/* Photo de dessin : au moins 400px, jusqu'à 70 % de la hauteur d'écran (tablettes, photos en portrait) —
   le dessin envoyé à l'IA est recomposé à la résolution d'origine, la taille d'affichage n'y change rien. */
.upload-preview { max-width: 100%; max-height: max(400px, min(70vh, 760px)); border-radius: 8px; display: block; margin: 0 auto; }
/* Photo chargée : petit « Changer la photo » (même choix appareil / galerie) */
.photo-change { margin: 10px 0 2px; }
.photo-change > summary { display: inline-block; list-style: none; padding: 6px 4px; font-size: 14px; font-weight: 600; }
.photo-change > summary::-webkit-details-marker { display: none; }
.photo-change-menu { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }

/* Products grid */
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.product-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border: 2px solid #eee; border-radius: 10px; background: #fff; cursor: pointer; transition: all 0.15s; }
.product-card:hover { border-color: #ccc; background: #fafafa; }
.product-card.selected { border-color: var(--dm-primary); background: var(--dm-tint); }
.product-icon { width: 36px; height: 36px; }
.product-icon svg { width: 100%; height: 100%; }
.product-name { font-size: 11px; font-weight: 600; text-align: center; line-height: 1.2; color: #333; }

/* Navigateur du catalogue clôtures (design du 07/10) : catégories → gammes → modèles */
.nav-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.nav-search { flex: 1; min-width: 0; }
.nav-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; font-size: 13px; color: #666; }
.nav-crumbs [aria-current] { font-weight: 600; color: #333; }
.nav-crumb-sep { color: #bbb; }
/* Zones de tap confortables (fil d'Ariane, « Annuler ») */
.catalog-nav .nav-crumbs .btn-link, .catalog-nav .nav-toolbar .btn-link { padding: 8px 4px; min-height: 36px; }
.nav-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.nav-tile { display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 8px; border: 2px solid #eee; border-radius: 10px; background: #fff; cursor: pointer; text-align: left; font: inherit; transition: all 0.15s; }
.nav-tile:hover { border-color: #ccc; background: #fafafa; }
.nav-tile .product-icon { width: 100%; height: auto; aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; border-radius: 6px; background: #f3f3f3; }
.nav-tile-title { font-size: 14px; font-weight: 600; color: #333; }
.nav-tile-material { font-size: 12px; color: #555; }
.nav-tile-meta { font-size: 12px; color: #888; }
/* Tuiles de catégorie : pictogramme + texte en ligne. --dm-link (et non --dm-primary, trop clair en jaune) pour le trait. */
.nav-tiles[data-nav-panel="categories"] { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.nav-tile--category { align-items: center; text-align: center; gap: 8px; padding: 14px 8px 12px; }
.nav-tile--category .nav-tile-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nav-tile-icon { flex: none; width: 52px; height: 52px; border-radius: 12px; background: var(--dm-tint); color: var(--dm-link); display: flex; align-items: center; justify-content: center; }
.nav-tile-icon svg { width: 30px; height: 30px; }
.product-card-caption { display: none; font-size: 10px; line-height: 1.2; text-align: center; color: #888; }
.catalog-nav.is-searching .product-card-caption { display: block; }
/* Recherche : les grilles de gamme fusionnent en une seule grille à plat */
.catalog-nav.is-searching .nav-models { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.catalog-nav.is-searching .nav-models > .products-grid { display: contents; }
/* Modèles : 4 colonnes au plus, vignettes lisibles (07/10, retour de Romain) */
.catalog-nav .nav-models > .products-grid, .catalog-nav.is-searching .nav-models { grid-template-columns: repeat(auto-fill, minmax(max(160px, calc((100% - 36px) / 4)), 1fr)); gap: 12px; }
.catalog-nav .product-card .product-name { font-size: 14px; }
.nav-empty { margin-top: 8px; font-size: 13px; color: #888; }
.nav-summary { display: flex; align-items: center; gap: 12px; padding: 10px; border: 2px solid var(--dm-primary); border-radius: 10px; background: var(--dm-tint); }
.nav-summary-visual { width: 96px; flex-shrink: 0; }
.nav-summary-visual .product-icon { width: 48px; height: 48px; margin: 0 auto; }
.nav-summary-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-summary-name { font-size: 14px; color: #333; }
.nav-summary-meta { font-size: 12px; color: #666; }
.catalog-nav ~ .variant-group, .catalog-nav ~ .gate-kinds { margin-top: 10px; }
/* Après « Changer » : coloris et type du modèle en place masqués pendant le parcours */
.catalog-nav.is-browsing ~ [data-variant-group], .catalog-nav.is-browsing ~ [data-gate-kinds-block] { display: none !important; }
.product-thumb { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; background: #f3f3f3; }
.product-icon-placeholder { color: #bbb; }

/* Variants */
.variant-group { margin-bottom: 16px; }
.variant-group h3 { font-size: 13px; font-weight: 600; color: #666; margin-bottom: 8px; }
.variants-row { display: flex; flex-wrap: wrap; gap: 8px; }
.variant-chip { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border: 2px solid #eee; border-radius: 20px; background: #fff; cursor: pointer; transition: all 0.15s; font-size: 13px; }
.variant-chip:hover { border-color: #ccc; }
.variant-chip.selected { border-color: var(--dm-primary); background: var(--dm-tint); }
/* Focus : jamais de cadre bleu du navigateur après un clic (il se confondait
   avec la sélection, retour de Romain 07/10) ; cadre au thème au clavier. */
.variant-chip:focus, .kind-chip:focus, .product-card:focus, .nav-tile:focus { outline: none; }
.variant-chip:focus-visible, .kind-chip:focus-visible, .product-card:focus-visible, .nav-tile:focus-visible { outline: 2px solid var(--dm-link); outline-offset: 2px; }
.kind-chip { padding: 6px 14px; border: 2px solid #eee; border-radius: 20px; background: #fff; cursor: pointer; font-size: 13px; transition: all 0.15s; }
.kind-chip:hover { border-color: #ccc; }
.kind-chip.selected { border-color: var(--dm-primary); background: var(--dm-tint); }
.gate-kinds { margin-top: 10px; }
.variant-swatch { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.1); flex-shrink: 0; }
.variant-label { color: #333; }

/* Actions : barre collante en bas de l'écran (formulaire long, mobile),
   rendue à sa place pendant qu'un outil de dessin est actif. */
.viz-actions { position: sticky; bottom: 0; z-index: 15; margin-top: 8px; padding: 12px; background: #fff; border-radius: 10px 10px 0 0; box-shadow: 0 -2px 12px rgba(0,0,0,0.1); }
form.is-drawing .viz-actions { position: static; }
.btn-generate { font-size: 16px; padding: 14px 24px; }
/* #6b6b6b sur #ccc : contraste insuffisant pour du texte — gris clair + texte foncé */
.btn-generate:disabled { background: #e2e2e2; color: #555; cursor: not-allowed; }
.undo-toast { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; padding: 8px 12px; border-radius: 8px; background: #1a1a2e; color: #fff; font-size: 14px; }
.undo-toast .btn-link { color: #ffd84d; font-size: 14px; font-weight: 700; padding: 4px 6px; }

/* ── Generation result ── */
.generation-page { max-width: 700px; margin: 0 auto; }
.generation-header { margin-bottom: 20px; }
.generation-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.badge { display: inline-block; background: #f0f0f0; padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; color: #333; }
.generation-date { font-size: 13px; color: #888; }

/* Loading */
.generation-loading { text-align: center; padding: 60px 20px; }
.generation-loading p { font-size: 16px; font-weight: 600; margin-top: 16px; }
.generation-loading span { display: block; margin-top: 4px; font-size: 13px; color: #666; }
.spinner { width: 40px; height: 40px; border: 3px solid #eee; border-top-color: var(--dm-primary); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Compare slider — les deux images remplissent le même cadre au format de
   la photo (--compare-ratio, nombre largeur/hauteur posé par slider_controller) :
   superposition exacte, jamais plus large que la carte. touch-action: pan-y :
   le défilement vertical reste à la page, le glissé horizontal déplace la séparation. */
.compare-container { --compare-ratio: 1.3333; position: relative; width: 100%; aspect-ratio: var(--compare-ratio); overflow: hidden; border-radius: 10px; background: #eee;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: pan-y; cursor: ew-resize; }
.compare-container img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-width: none; object-fit: fill; pointer-events: none; -webkit-user-drag: none; }
.compare-before { z-index: 1; }
.compare-after { z-index: 2; clip-path: inset(0 0 0 50%); }
.compare-slider { position: absolute; top: 0; left: 50%; width: 4px; height: 100%; z-index: 3; cursor: ew-resize; transform: translateX(-50%); outline: none; }
.compare-slider-line { width: 2px; height: 100%; background: #fff; margin: 0 auto; box-shadow: 0 0 4px rgba(0,0,0,0.3); }
.compare-slider-button { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 40px; height: 40px; background: var(--dm-primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.compare-slider:focus-visible .compare-slider-button { outline: 3px solid #fff; box-shadow: 0 0 0 6px rgba(0,0,0,0.55); }
.compare-animating .compare-after { transition: clip-path 0.25s ease; }
.compare-animating .compare-slider { transition: left 0.25s ease; }
.compare-labels { display: flex; justify-content: space-between; padding: 4px 0 0; }
.compare-label { min-height: 44px; padding: 0 10px; border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: #777; cursor: pointer; border-radius: 6px; }
.compare-label:hover { color: var(--dm-link); }

/* Plein écran : overlay CSS (pas l'API Fullscreen, absente sur iPhone) */
.compare-fs-bar { display: none; }
.compare-stage.is-fullscreen { position: fixed; inset: 0; z-index: 1000; background: #111; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  overscroll-behavior: contain; }
.compare-stage.is-fullscreen .compare-fs-bar { display: flex; justify-content: flex-end; width: 100%; flex: none; }
.compare-fs-close { min-height: 44px; background: rgba(255,255,255,0.14); color: #fff; }
.compare-fs-close:hover { background: rgba(255,255,255,0.24); }
/* contain : la photo entière tient entre la barre du haut et les libellés */
.compare-stage.is-fullscreen .compare-container { flex: none; border-radius: 0; background: #000;
  width: min(100%, calc((100vh - 120px) * var(--compare-ratio)));
  width: min(100%, calc((100dvh - 120px) * var(--compare-ratio))); }
.compare-stage.is-fullscreen .compare-labels { flex: none; width: min(100%, 480px); }
.compare-stage.is-fullscreen .compare-label { color: #eee; font-size: 15px; }

/* Timing & actions du rendu */
.generation-timing { text-align: center; font-size: 13px; color: #888; margin-top: 8px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: stretch; margin-top: 16px; }
.result-actions .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; width: auto; }
.result-actions .btn:disabled { opacity: 0.6; cursor: progress; }
.result-message { margin-top: 8px; text-align: center; font-size: 13px; font-weight: 600; color: #c62828; }
.result-message.is-info { color: #2e7d32; }
.result-message:empty { display: none; }
.result-send .result-actions { margin-top: 12px; }
.result-send-hint { margin-top: 6px; text-align: center; font-size: 12px; color: #888; }
.generation-drawing { margin-top: 12px; text-align: center; }
.generation-drawing > summary { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; cursor: pointer; color: var(--dm-link); font-size: 14px; font-weight: 600; }
.generation-drawing img { display: block; width: 100%; height: auto; margin-top: 4px; border-radius: 8px; background: #eee; }
.generation-actions { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: 24px; justify-content: center; }
.generation-actions .btn { width: auto; }
.generation-actions form { margin: 0; }
/* « Continuer en … » : chaque bouton aux couleurs de SON univers, quel que
   soit le thème de la page (teinte claire, bord et pastille de l'univers,
   texte foncé #353535 : ≥ 10:1 sur chaque teinte). */
.btn-universe { --u-color: #cb282b; --u-tint: #fbeaea; --u-tint-strong: #f8dcdc;
  display: inline-flex; align-items: center; gap: 8px; background: var(--u-tint); color: #353535;
  border: 1.5px solid var(--u-color); }
.btn-universe:hover { background: var(--u-tint-strong); text-decoration: none; }
.btn-universe:focus-visible { outline: 2px solid var(--u-color); outline-offset: 2px; }
.btn-universe-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--u-color); }
.btn-universe--cloture { --u-color: #f1cb00; --u-tint: #fdf7d9; --u-tint-strong: #faedab; }
.btn-universe--cloture .btn-universe-dot { box-shadow: 0 0 0 1px #1a171b33; }
.btn-universe--piscine { --u-color: #0077bc; --u-tint: #e6f3f9; --u-tint-strong: #cce6f3; }

@media (max-width: 600px) {
  .result-actions .btn { flex: 1 1 calc(50% - 8px); padding: 10px 12px; font-size: 14px; }
  .generation-actions { gap: 8px; }
  .generation-actions .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; padding: 10px 12px; }
}

/* Error */
.generation-error { text-align: center; padding: 40px 20px; }
.generation-error p { font-size: 16px; font-weight: 600; color: #c62828; margin-bottom: 8px; }
.error-detail { font-size: 13px; color: #888; display: block; margin-bottom: 16px; }
.generation-error .btn { width: auto; }

/* ── History page ── */
.history-page { }
.history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.history-header h1 { margin: 0; }
.btn-sm { padding: 6px 14px; font-size: 13px; }

/* Filters */
.history-filters { background: #fff; border-radius: 10px; padding: 16px; margin-bottom: 16px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.filters-row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.filter-group { flex: 1; min-width: 140px; }
.filter-input, .filter-select { width: 100%; padding: 8px 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; }
.filter-input:focus, .filter-select:focus { outline: none; border-color: var(--dm-primary); }
.filter-date { min-width: 120px; }
.filter-actions { display: flex; gap: 8px; align-items: center; }
.btn-link { font-size: 13px; color: var(--dm-link); background: none; border: none; cursor: pointer; padding: 0; }
.btn-link:hover { text-decoration: underline; }

/* ── Historique (refonte lots 1-2, 11/10/2026) ── */
.history-filters { display: grid; gap: 10px; }
.history-search { font-size: 15px; padding: 10px 12px; background: #fff; }
.history-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.history-pill { --u-color: #353535; --u-tint: #ececec; position: relative; cursor: pointer; }
.history-pill--allee { --u-color: #cb282b; --u-tint: #fbeaea; }
.history-pill--cloture { --u-color: #c9a900; --u-tint: #fdf7d9; }
.history-pill--piscine { --u-color: #0077bc; --u-tint: #e6f3f9; }
.history-pill input { position: absolute; opacity: 0; pointer-events: none; }
.history-pill span { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border: 1.5px solid #ddd; border-radius: 18px; background: #fff; font-size: 14px; font-weight: 600; color: #353535; }
.history-pill input:checked + span { border-color: var(--u-color); background: var(--u-tint); }
.history-pill input:focus-visible + span { outline: 2px solid var(--u-color); outline-offset: 2px; }
.history-more-filters summary { font-size: 13px; color: #666; cursor: pointer; width: fit-content; }
.history-dates { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.history-dates label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #666; }
.history-dates .filter-input { width: auto; }
.history-count { display: flex; align-items: center; gap: 12px; font-size: 13px; color: #888; margin: 16px 0 10px; }

/* Cartes : liste compacte au téléphone, grille dès la tablette. Les cadres
   Turbo de « Voir plus » sont transparents pour la grille. */
.generations-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.generations-list turbo-frame { display: contents; }
.generation-card { position: relative; min-width: 0; background: #fff; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); transition: box-shadow 0.15s; }
.generation-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.1); }
.generation-card-link { display: flex; gap: 12px; padding: 10px; padding-right: 48px; color: inherit; text-decoration: none; }
.generation-card-link:hover { text-decoration: none; }
.generation-card-media { flex: none; }
.history-card-thumb { display: block; width: 88px; height: 88px; border-radius: 8px; object-fit: cover; background: #f0f0f2; }
.generation-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.generation-card-client { font-family: "Lato", sans-serif; font-size: 15px; font-weight: 700; color: #1a1a2e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.generation-card-contact, .generation-card-products { font-size: 13px; color: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.generation-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 4px; font-size: 12px; color: #888; }
.universe-pill { --u-color: #cb282b; --u-tint: #fbeaea; display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 10px; background: var(--u-tint); color: #353535; font-weight: 600; }
.universe-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--u-color); }
.universe-pill--cloture { --u-color: #c9a900; --u-tint: #fdf7d9; }
.universe-pill--piscine { --u-color: #0077bc; --u-tint: #e6f3f9; }
.generation-card-status { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 8px; white-space: nowrap; }
.status-pending, .status-processing { background: #fff3e0; color: #e65100; }
.status-failed { background: #fbe9e7; color: #c62828; }

/* Menu « ⋯ » : bouton de 40 px en haut à droite, liste en surimpression. */
.generation-card-menu { position: absolute; top: 6px; right: 6px; }
.generation-card-menu summary { list-style: none; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 8px; font-size: 20px; line-height: 1; color: #666; cursor: pointer; user-select: none; }
.generation-card-menu summary::-webkit-details-marker { display: none; }
.generation-card-menu summary:hover, .generation-card-menu[open] summary { background: #f2f2f4; color: #1a1a2e; }
.generation-card-menu summary:focus-visible { outline: 2px solid var(--dm-link); outline-offset: 1px; }
.generation-card-menu-list { position: absolute; right: 0; top: 44px; z-index: 20; min-width: 200px; padding: 6px; background: #fff; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,0.16); display: grid; }
.generation-card-menu-list form { margin: 0; }
.generation-card-menu-item { display: block; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 6px; background: none; font-size: 14px; text-align: left; color: #353535; cursor: pointer; line-height: 44px; text-decoration: none; }
.generation-card-menu-item:hover { background: #f4f4f6; text-decoration: none; }
.generation-card-menu-item.is-danger { color: #c62828; }
.generation-card-menu-item.is-danger:hover { background: #fbe9e7; }
.generation-card-menu-item.hidden { display: none; }

/* « Modifier le client » : déplié sous la carte. */
.generation-card-edit { display: grid; gap: 8px; padding: 0 10px 10px; }
.generation-card-edit.hidden { display: none; }
.generation-card-edit-actions { display: flex; justify-content: flex-end; gap: 8px; }
.generation-card-edit-error { font-size: 13px; color: #c62828; }

.history-more { grid-column: 1 / -1; display: flex; justify-content: center; padding: 8px 0 16px; }

@media (min-width: 768px) {
  .generations-list { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
  .generation-card-link { flex-direction: column; padding: 0 0 12px; }
  .history-card-thumb { width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: 10px 10px 0 0; }
  .generation-card-body { padding: 0 12px; }
  .generation-card-menu { top: 8px; right: 8px; }
  .generation-card-menu summary { background: rgba(255,255,255,0.92); box-shadow: 0 1px 4px rgba(0,0,0,0.15); }
}

/* Empty state */
.history-empty { text-align: center; padding: 60px 20px; color: #888; }
.history-empty p { font-size: 15px; margin: 12px 0 16px; }

/* Generation show header */
.generation-header-top { display: flex; justify-content: space-between; align-items: center; }
.generation-client-info { margin-top: 12px; background: #f9f9f9; padding: 12px 16px; border-radius: 8px; font-size: 14px; }
.generation-client-info p { margin-bottom: 4px; }
.generation-client-info p:last-child { margin-bottom: 0; }

/* Delete button */
.btn-danger { background: #fff; color: #c62828; border: 1px solid #e0e0e0; }
.btn-danger:hover { background: #fbe9e7; border-color: #c62828; }

/* Form row */
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.form-input { width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
.form-input:focus { outline: none; border-color: var(--dm-primary); box-shadow: 0 0 0 2px var(--dm-focus-ring); }
.form-textarea { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; font-family: inherit; min-height: 100px; resize: vertical; line-height: 1.5; }
.form-textarea:focus { outline: none; border-color: var(--dm-primary); box-shadow: 0 0 0 2px var(--dm-focus-ring); }
.form-textarea::placeholder { color: #999; }
.variants-label { font-size: 13px; font-weight: 600; color: #666; margin: 16px 0 8px; }
.optional-label { font-size: 12px; font-weight: 400; color: #999; }

/* ── Responsive ── */
/* Navbar mobile : les onglets défilent horizontalement (sans wrap ni débordement
   de page), le nom d'utilisateur est masqué, Déconnexion reste accessible. */
@media (max-width: 700px) {
  .navbar { padding: 0 10px; }
  .navbar-inner { gap: 10px; height: 56px; }
  .brand-hz { height: 40px; margin: -4px 0; }
  body.theme-cloture .brand-hz { height: 24px; margin: 0; }
  body.theme-piscine .brand-hz { height: 24px; margin: 0; }
  .navbar-user { display: none; }
  .navbar-links { flex: 1; min-width: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .navbar-links::-webkit-scrollbar { display: none; }
  .navbar-links a { padding: 0 8px; font-size: 13px; white-space: nowrap; }
  .navbar-right { margin-left: 0; flex-shrink: 0; }
  .btn-logout { padding: 4px 10px; white-space: nowrap; }
}

/* Navbar ≤ 600px : logo + Déconnexion sur la 1re ligne, onglets sur une 2e
   ligne pleine largeur (5 onglets tiennent à 375px). Plus étroit, la ligne
   défile horizontalement avec une ombre en bord droit tant qu'il reste des
   onglets à droite (fond « local » qui recouvre l'ombre en fin de défilement). */
@media (max-width: 600px) {
  .navbar-inner { flex-wrap: wrap; height: auto; column-gap: 10px; row-gap: 0; }
  .navbar-brand { height: 50px; }
  .navbar-right { margin-left: auto; }
  .navbar-links {
    order: 3; flex: 1 0 100%; height: 40px; gap: 0; margin: 0 -10px; padding: 0 4px;
    border-top: 1px solid #eee;
    background:
      linear-gradient(to left, #fff 40%, rgba(255,255,255,0)) 100% 0 / 28px 100% no-repeat local,
      linear-gradient(to left, rgba(0,0,0,0.14), rgba(0,0,0,0)) 100% 0 / 14px 100% no-repeat scroll,
      #fff;
  }
  .navbar-links a { flex: 1 0 auto; justify-content: center; padding: 0 7px; }
}

@media (max-width: 600px) {
  .auth-card { padding: 24px 20px; margin: 16px; }
  .navbar-user { display: none; }
  .products-grid { grid-template-columns: repeat(3, 1fr); }
  .nav-tiles { grid-template-columns: repeat(2, 1fr); }
  .nav-tiles[data-nav-panel="categories"] { grid-template-columns: repeat(2, 1fr); }
  .catalog-nav .nav-models > .products-grid, .catalog-nav.is-searching .nav-models { grid-template-columns: repeat(2, 1fr); }
  .nav-summary-visual { width: 72px; }
  .filters-row { flex-direction: column; }
  .filter-group { min-width: 100%; }
  .history-header { flex-direction: column; gap: 12px; align-items: stretch; }
  .form-row { flex-direction: column; }
  .generation-header-top { flex-direction: column; gap: 8px; }
}

/* ── Admin — Catalogue ── */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.admin-page { max-width: 960px; margin: 0 auto; }
.admin-header { margin-bottom: 20px; }
.admin-header h1 { font-size: 24px; margin-bottom: 4px; color: #1a1a2e; }
.admin-subtitle { color: #666; font-size: 14px; line-height: 1.5; }
.admin-subtitle small { color: #6b6b6b; font-size: 12px; }
.admin-icon { flex: none; display: block; }

.admin-type-badge {
  display: inline-block; margin-left: 8px; padding: 2px 8px;
  font-size: 11px; font-weight: 600; color: #555;
  background: #eee; border-radius: 10px; vertical-align: middle;
}
.admin-manifest-note { background: #fff7e0; border: 1px solid #f0d58a; border-radius: 10px; padding: 10px 14px; font-size: 13px; color: #6b5310; margin-bottom: 16px; line-height: 1.5; }
.admin-badge-off { color: #fff; background: #b04a4a; }
.admin-count { font-size: 12px; color: #6b6b6b; font-weight: 400; font-family: "Lato", sans-serif; }

/* En-tête de la liste : titre à gauche, « + Ajouter un produit » à droite
   (un <details> stylé en bouton, le formulaire s'ouvre en panneau). */
.admin-list-head { position: relative; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
.admin-add-product > summary { list-style: none; white-space: nowrap; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.admin-add-product > summary::-webkit-details-marker { display: none; }
.admin-add-product[open] > summary { background: var(--dm-primary-dark); }
.admin-add-product-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30;
  width: min(520px, 100%); background: #fff; border: 1px solid #ececec; border-radius: 12px;
  padding: 18px; box-shadow: 0 12px 32px rgba(0,0,0,0.14);
}
.admin-add-product[open] .admin-add-product-panel { animation: admin-pop 0.16s ease-out; }
@keyframes admin-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* Sous-navigation Admin : Catalogue | Consommation */
.admin-subnav { display: flex; gap: 6px; margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.admin-subnav::-webkit-scrollbar { display: none; }
.admin-subnav a {
  flex: none; padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; color: #555;
  white-space: nowrap; transition: background 0.15s, color 0.15s;
}
.admin-subnav a:hover { background: #e9e9e9; color: #1a1a2e; text-decoration: none; }
.admin-subnav a.is-active { background: var(--dm-tint); color: #1a1a2e; box-shadow: inset 0 0 0 1px var(--dm-primary); }
.admin-subnav a:focus-visible { outline: 2px solid var(--dm-link); outline-offset: 1px; }

/* Admin — Consommation : chiffres clés, tableaux défilant dans leur carte */
.usage-page { min-width: 0; }
.usage-page .admin-section { min-width: 0; }
.usage-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0; }
.usage-stat { background: #f7f7f8; border-radius: 10px; padding: 12px 14px; min-width: 0; }
.usage-stat dt { font-size: 12px; color: #6b6b6b; font-weight: 600; }
.usage-stat dd { margin: 4px 0 0; font-size: 22px; font-weight: 700; color: #1a1a2e; overflow-wrap: anywhere; }
.usage-stat dd.usage-stat-detail { font-size: 12px; font-weight: 400; color: #6b6b6b; margin-top: 2px; }
.usage-muted { color: #8a8a8a; font-weight: 400; }
.usage-stat dd .usage-muted { font-size: 15px; }
.usage-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.usage-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.usage-table th, .usage-table td { padding: 8px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid #eee; }
.usage-table th:first-child { text-align: left; }
.usage-table thead th { font-size: 12px; color: #6b6b6b; font-weight: 600; }
.usage-table tbody th { font-weight: 600; color: #1a1a2e; }
.usage-table tbody tr:last-child > * { border-bottom: none; }
.usage-note { margin-top: 4px; }

/* Onglets univers et puces sous-catégorie (look des puces du sélecteur) */
.admin-tabs { display: flex; gap: 4px; border-bottom: 2px solid #e6e6e6; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tab { padding: 10px 16px; margin-bottom: -2px; border-bottom: 3px solid transparent; color: #555; font-weight: 600; font-size: 15px; white-space: nowrap; transition: color 0.15s, border-color 0.15s; }
.admin-tab:hover { color: #1a1a2e; text-decoration: none; border-bottom-color: #d0d0d0; }
.admin-tab.selected { color: #1a1a2e; border-bottom-color: var(--dm-primary); }
.admin-tab-count { font-size: 12px; font-weight: 400; color: #6b6b6b; margin-left: 2px; }
.admin-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.admin-chips .kind-chip { color: #333; display: inline-flex; align-items: center; gap: 4px; }
.admin-chips .kind-chip:hover { text-decoration: none; }

/* Filtres instantanés */
.admin-filters { border-radius: 12px; padding: 12px; }
.admin-filters .filters-row { align-items: center; }
.admin-filters .filter-group--search { flex: 2 1 220px; }
.admin-filters .filter-input {
  padding-left: 34px; height: 38px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 11px center;
}
.admin-filters .filter-select { height: 38px; background-color: #fff; }
.admin-filters .filter-input:focus, .admin-filters .filter-select:focus { box-shadow: 0 0 0 3px var(--dm-focus-ring); }
.admin-catalogue { display: block; }
.admin-catalogue[busy] .admin-rows { opacity: 0.6; transition: opacity 0.2s; }

/* Compteur + en-tête de colonne « Mon visualiseur » */
.admin-list-count { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.admin-list-count .btn-link { font-size: 13px; }
.admin-list-count { color: #6b6b6b; }
.admin-col-head { font-size: 12px; color: #6b6b6b; padding-right: 30px; }
/* Aide « Mon visualiseur » : <details> ouvert au clic ou au toucher */
.admin-help-pop { position: relative; }
.admin-help-pop > summary { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; list-style: none; }
.admin-help-pop > summary::-webkit-details-marker { display: none; }
.admin-help-pop > summary:focus-visible { outline: 2px solid var(--dm-link); outline-offset: 2px; border-radius: 4px; }
.admin-help-text {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: min(280px, 80vw);
  background: #fff; border: 1px solid #ececec; border-radius: 10px; padding: 10px 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.14); font-size: 13px; line-height: 1.45; color: #333;
}
.admin-help {
  display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px;
  border-radius: 50%; background: #e6e6e6; color: #666; font-size: 11px; font-weight: 700;
}

/* Liste compacte : une ligne par produit, regroupée par gamme */
.admin-group { margin-bottom: 22px; }
.admin-group-title { font-size: 15px; color: #1a1a2e; margin: 0 0 8px; }
.admin-rows { background: #fff; border-radius: 12px; box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04); overflow: hidden; }
.admin-row { position: relative; display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-top: 1px solid #f2f2f2; cursor: pointer; transition: background 0.15s; }
.admin-row:first-child { border-top: none; }
.admin-row:hover { background: #f8f8fa; }
.admin-row:target { background: var(--dm-tint); }
.admin-row--retired .admin-row-thumb, .admin-row--retired .admin-row-link { opacity: 0.55; }
.admin-row-thumb { flex: 0 0 72px; width: 72px; height: 72px; border-radius: 10px; overflow: hidden; background: #efefef; }
.admin-row-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.admin-row-main { flex: 1; min-width: 0; }
.admin-row-link { display: block; font-weight: 700; color: #1a1a2e; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Toute la ligne ouvre la fiche ; l'interrupteur reste cliquable au-dessus. */
.admin-row-link::after { content: ""; position: absolute; inset: 0; }
.admin-row-link:hover { text-decoration: none; }
.admin-row:hover .admin-row-link { color: var(--dm-link); }
.admin-row-link:focus-visible { outline: none; }
.admin-row:has(.admin-row-link:focus-visible) { box-shadow: inset 0 0 0 2px var(--dm-link); }
.admin-row-meta { font-size: 12px; color: #6b6b6b; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 3px; }
.admin-row-meta .admin-type-badge { margin-left: 0; }
.admin-row-swatches { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; max-width: 210px; }
.admin-row-swatches .admin-swatch { width: 14px; height: 14px; }
/* Au-dessus du lien de ligne (::after) : infobulles title des pastilles et du badge photos */
.admin-row-swatches .admin-swatch, .admin-row-photos .admin-photo-status { position: relative; z-index: 1; }
.admin-row-photos { display: flex; justify-content: flex-end; min-width: 96px; }
.admin-row-toggle { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.admin-toggle-label { font-size: 11px; color: #6b6b6b; white-space: nowrap; display: none; }
.admin-row-chevron { flex: none; color: #c4c4c4; font-size: 24px; line-height: 1; margin-left: -4px; transition: color 0.15s, transform 0.15s; }
.admin-row:hover .admin-row-chevron { color: var(--dm-link); transform: translateX(2px); }
.admin-swatch--off { opacity: 0.3; }

/* Pastille photos : rouge sans photo, orange avec une seule (clôtures), vert ≥ 2 */
.admin-photo-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #666; white-space: nowrap; }
.admin-photo-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #c4c4c4; flex: none; }
.admin-photo-status.is-ok::before { background: #2a9d2f; }
.admin-photo-status.is-warn { color: #9a5800; font-weight: 600; }
.admin-photo-status.is-warn::before { background: #f08c00; }
.admin-photo-status.is-missing { color: #b3261e; font-weight: 600; }
.admin-photo-status.is-missing::before { background: #d93025; }

/* Images en fondu sur fond « squelette » (fade_in_controller.js) */
img[data-controller~="fade-in"] { transition: opacity 0.3s ease; }
img[data-controller~="fade-in"]:not([data-loaded]) { opacity: 0; }
.admin-row-thumb:has(img:not([data-loaded])), .ref-tile:has(img:not([data-loaded])), .admin-product-visual:has(img:not([data-loaded])) {
  background: linear-gradient(90deg, #ececec 25%, #f6f6f6 50%, #ececec 75%) 0 0 / 200% 100%;
  animation: admin-skeleton 1.2s ease-in-out infinite;
}
@keyframes admin-skeleton { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.toggle-form { display: inline-flex; }
.toggle-switch {
  position: relative; width: 44px; height: 24px; flex: 0 0 44px;
  border: none; border-radius: 12px; background: #c4c4c4;
  cursor: pointer; padding: 0; transition: background 0.15s ease;
}
.toggle-switch.on { background: #2a9d2f; }
.toggle-switch:focus-visible { outline: 2px solid var(--dm-link); outline-offset: 2px; }
.toggle-knob {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: left 0.15s ease;
}
.toggle-switch.on .toggle-knob { left: 22px; }

/* ── Fiche produit ── */
.admin-product-head { margin-bottom: 12px; }
.admin-product-head h1 { margin-top: 6px; }
.admin-product-head .admin-subtitle .admin-type-badge { margin-left: 6px; }

/* Onglets de section collants (section_nav_controller.js) */
.admin-sections {
  position: sticky; top: 0; z-index: 20;
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  margin: 0 -16px 16px; padding: 8px 16px;
  background: rgba(244, 244, 244, 0.92); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid #e6e6e6;
}
.admin-sections::-webkit-scrollbar { display: none; }
.admin-sections a {
  flex: none; padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; color: #555;
  white-space: nowrap; transition: background 0.15s, color 0.15s;
}
.admin-sections a:hover { background: #e9e9e9; color: #1a1a2e; text-decoration: none; }
.admin-sections a.is-active { background: var(--dm-tint); color: #1a1a2e; box-shadow: inset 0 0 0 1px var(--dm-primary); }
.admin-sections a:focus-visible { outline: 2px solid var(--dm-link); outline-offset: 1px; }

.admin-section { background: #fff; border-radius: 12px; padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04); scroll-margin-top: 64px; }
.admin-section > h2 { font-size: 18px; color: #1a1a2e; margin-bottom: 12px; }
.admin-section > .admin-subtitle { margin-bottom: 12px; }
.admin-section--danger { border: 1px solid #f1d0d0; }
.admin-photo-warning { font-size: 13px; color: #6b5310; background: #fff0c2; border-radius: 8px; padding: 6px 10px; margin-bottom: 12px; }

/* Deux colonnes dès 960px : vignette + photos du produit (≈ 40 %) | informations.
   Une colonne en dessous : vignette → informations → photos. */
.admin-product-grid { display: grid; gap: 16px; grid-template-areas: "visual" "infos" "photos"; margin-bottom: 16px; }
.admin-product-grid > .admin-section { margin-bottom: 0; }
.admin-product-visual { grid-area: visual; }
.admin-product-grid > #photos { grid-area: photos; }
.admin-product-grid > #infos { grid-area: infos; }
@media (min-width: 960px) {
  .admin-product-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); grid-template-rows: auto 1fr; grid-template-areas: "visual infos" "photos infos"; align-items: start; }
}
.admin-product-visual {
  position: relative; aspect-ratio: 4 / 3; max-height: 280px; border-radius: 12px; overflow: hidden;
  background: #efefef; box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04);
  display: flex; align-items: center; justify-content: center;
}
.admin-product-visual img { width: 100%; height: 100%; object-fit: cover; display: block; }
.admin-product-visual-empty { color: #6b6b6b; font-size: 13px; }
@media (min-width: 960px) { .admin-product-visual { max-height: none; } }

.form-textarea--mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; font-size: 13px; line-height: 1.55; }
.admin-char-count { font-size: 12px; color: #6b6b6b; text-align: right; margin-top: 4px; font-variant-numeric: tabular-nums; }

/* Prompt : « Régénérer » à droite du libellé, avertissements (ProductQuality) sous le champ */
.admin-prompt-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.admin-prompt-head label { margin-bottom: 0; }
.admin-prompt-warnings { list-style: none; margin: 6px 0 0; padding: 0; font-size: 12px; color: #9a5800; }
.admin-prompt-warnings li { padding-left: 14px; position: relative; line-height: 1.5; }
.admin-prompt-warnings li::before { content: ""; position: absolute; left: 0; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: #f08c00; }
.admin-regenerate-status { font-size: 12px; color: #2a6b2f; margin-top: 4px; }
.admin-regenerate-status:empty { display: none; }
.admin-regenerate-status.is-error { color: #b3261e; }
.admin-regenerate-note { margin-top: 2px; color: #6b6b6b; }

/* « À corriger » : pastilles de la liste (rouge bloquant, orange à vérifier, gris info) et panneau de la fiche */
.admin-row-issues { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.admin-issue-chip { position: relative; z-index: 1; display: inline-block; padding: 1px 7px; border-radius: 9px; font-size: 11px; font-weight: 600; line-height: 1.6; white-space: nowrap; background: #eee; color: #555; }
.admin-issue-chip.is-blocking { background: #fde7e5; color: #b3261e; }
.admin-issue-chip.is-warning { background: #fff0d6; color: #8a4f00; }
.admin-issue-chip.is-info, .admin-issue-chip.is-more { background: #efefef; color: #5f5f5f; }
.admin-issues { border: 1px solid #f0d58a; background: #fffaf0; border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; }
.admin-issues h2 { font-size: 15px; margin-bottom: 6px; color: #1a1a2e; }
.admin-issues ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.admin-issue { font-size: 13px; padding-left: 16px; position: relative; line-height: 1.5; }
.admin-issue::before { content: ""; position: absolute; left: 0; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: #c4c4c4; }
.admin-issue.is-blocking::before { background: #d93025; }
.admin-issue.is-warning::before { background: #f08c00; }
.admin-issue a { color: inherit; text-decoration: underline; text-decoration-color: #c9c9c9; text-underline-offset: 2px; }
.admin-issue a:hover { color: var(--dm-link); }

/* Barre d'enregistrement (dirty_form_controller.js) : collante dans le
   formulaire ; dès qu'il est modifié, fixée en bas de l'écran. */
.admin-savebar-slot { position: sticky; bottom: 12px; z-index: 10; min-height: 52px; margin-top: 16px; }
.admin-savebar {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  padding: 8px 10px 8px 14px; background: #fff; border: 1px solid #ececec; border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.admin-savebar .btn:disabled { opacity: 0.45; cursor: not-allowed; }
.admin-savebar-status { margin-right: auto; font-size: 13px; font-weight: 700; color: #9a5800; display: inline-flex; align-items: center; gap: 8px; }
.admin-savebar-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #f08c00; }
.admin-savebar-status[hidden] { display: none; }
form.is-dirty .admin-savebar {
  position: fixed; left: 50%; bottom: 16px; z-index: 40; transform: translateX(-50%);
  width: min(928px, calc(100% - 32px)); border-color: var(--dm-primary);
  box-shadow: 0 10px 30px rgba(0,0,0,0.18); animation: admin-savebar-in 0.2s ease-out;
}
@keyframes admin-savebar-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
.admin-product-page:has(form.is-dirty) { padding-bottom: 72px; }

/* Coloris : une ligne compacte par coloris — pastille, nom, photos en tuiles, suppression */
.admin-variants { display: flex; flex-direction: column; }
.admin-variant {
  display: grid; grid-template-columns: minmax(140px, 200px) minmax(0, 1fr) auto; gap: 10px 16px;
  align-items: start; padding: 14px 0; border-top: 1px solid #f0f0f0; scroll-margin-top: 64px;
}
.admin-variant:first-child { border-top: none; padding-top: 0; }
.admin-variant:target { background: var(--dm-tint); border-radius: 10px; padding-left: 10px; padding-right: 10px; }
.admin-variant-info { display: flex; align-items: flex-start; gap: 10px; min-width: 0; padding-top: 4px; }
.admin-variant-info .admin-swatch { width: 22px; height: 22px; }
.admin-variant-text { min-width: 0; }
.admin-variant-text h3 { font-family: "Lato", sans-serif; font-size: 14px; font-weight: 700; color: #1a1a2e; overflow-wrap: anywhere; }
.admin-variant-text h3 .admin-type-badge { margin-left: 4px; }
.admin-variant-photos { min-width: 0; }
.admin-variant-photos .ref-tiles { --tile: 72px; }
.admin-variant-delete-form { margin: 0; }
/* Coloris non proposé : ligne estompée (le formulaire « Modifier » reste net). */
.admin-variant--off > .admin-variant-info, .admin-variant--off > .admin-variant-photos { opacity: 0.55; }
.admin-variant-prompt {
  margin-top: 2px; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; font-size: 11px; color: #6b6b6b; cursor: help;
}
.admin-variant-edit { grid-column: 1 / -1; }
.admin-variant-edit > summary {
  display: inline-block; cursor: pointer; font-weight: 700; font-size: 13px; color: var(--dm-link);
  padding: 2px 0;
}
.admin-variant-edit[open] > summary { margin-bottom: 8px; }
.admin-variant-form { background: #fafafa; border: 1px solid #eee; border-radius: 10px; padding: 12px 14px; }
.admin-variant-form .admin-check { margin-bottom: 12px; }
.admin-color-field { display: flex; align-items: center; gap: 8px; }
.admin-color-field input[type="color"] { flex: none; width: 40px; height: 36px; padding: 2px; border: 1px solid #ddd; border-radius: 8px; background: #fff; cursor: pointer; }
.admin-color-field .form-input { max-width: 120px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Envoi à l'IA (lecture seule, cadre Turbo « ia-preview ») */
.admin-ia-pick { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.admin-ia-pick label { font-size: 13px; font-weight: 700; color: #333; }
.admin-ia-pick select { width: auto; max-width: 100%; }
.admin-ia-preview { display: block; }
.admin-ia-preview[aria-busy="true"] { opacity: 0.5; transition: opacity 0.15s; }
.admin-ia-label { font-family: "Lato", sans-serif; font-size: 13px; font-weight: 700; color: #1a1a2e; margin: 0 0 6px; }
.admin-ia-label small { font-weight: 400; color: #6b6b6b; margin-left: 6px; }
.admin-ia-text {
  white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 16px; padding: 10px 12px;
  background: #f6f6f8; border: 1px solid #ececec; border-radius: 8px; color: #222;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; font-size: 12px; line-height: 1.55;
}
.admin-ia-tiles { --tile: 88px; }
.admin-ia-tiles .ref-tile-badge { cursor: default; min-width: 18px; text-align: center; }
.admin-ia-origin { font-size: 12px; color: #6b6b6b; margin-top: 6px; }

.admin-swatch { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.1); flex-shrink: 0; }

.btn-danger { background: #b04a4a; color: #fff; }
.btn-danger:hover { background: #8f3a3a; }

/* Boutons de suppression libellés (icône + texte) */
.admin-delete-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px;
  background: #fff; color: #b3261e; border: 1px solid #edd3d3; border-radius: 8px;
  font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.admin-delete-btn:hover { background: #fbe9e7; border-color: #c62828; }
.admin-delete-btn:focus-visible { outline: 2px solid #c62828; outline-offset: 2px; }
.admin-danger-btn { display: inline-flex; align-items: center; gap: 8px; }

.admin-add-variant { margin-top: 12px; padding-top: 12px; border-top: 1px solid #eee; }
.admin-add-variant summary { cursor: pointer; font-weight: 700; font-size: 13px; color: var(--dm-link); }
.admin-add-variant .admin-form { margin-top: 12px; }

.admin-form-checks { align-items: center; margin-bottom: 16px; }
.admin-check { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 400; color: #333; }
.admin-check input { width: auto; }

/* Tuiles photo (photo_drop_controller.js) : photos + tuile « + » d'ajout */
.ref-tiles { --tile: 104px; display: flex; flex-wrap: wrap; gap: 8px; }
.ref-tile { position: relative; flex: none; width: var(--tile); height: var(--tile); border-radius: 10px; overflow: hidden; background: #efefef; margin: 0; }
.ref-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ref-tile-fallback { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 24px; color: #999; }
.ref-tile-delete-form { position: absolute; top: 5px; right: 5px; margin: 0; }
.ref-tile-delete {
  display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0;
  border: none; border-radius: 50%; background: rgba(255,255,255,0.95); color: #b3261e; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25); opacity: 0; transition: opacity 0.15s, background 0.15s, color 0.15s;
}
.ref-tile:hover .ref-tile-delete, .ref-tile:focus-within .ref-tile-delete { opacity: 1; }
.ref-tile-delete:hover { background: #c62828; color: #fff; }
.ref-tile-delete:focus-visible { outline: 2px solid #c62828; outline-offset: 2px; }
@media (hover: none) { .ref-tile-delete { opacity: 1; } }
.admin-variant-photos .ref-tile-delete { width: 26px; height: 26px; }

.ref-tile--add { overflow: visible; background: #fafafa; border: 2px dashed #cfcfcf; transition: border-color 0.15s, background 0.15s, transform 0.15s; }
.ref-tile--add:hover, .ref-tile--add:focus-within, .ref-tile--add.is-dragover { border-color: var(--dm-primary); background: var(--dm-tint); }
.ref-tile--add:focus-within { box-shadow: 0 0 0 3px var(--dm-focus-ring); }
.ref-tile--add.is-dragover { border-style: solid; transform: scale(1.04); }
.ref-tile--add.is-sending { pointer-events: none; border-style: solid; border-color: var(--dm-primary); }
.ref-tile--add.is-sending .ref-add-plus { animation: spin 0.9s linear infinite; }
.ref-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 100%; height: 100%; cursor: pointer; color: #666; text-align: center; }
.ref-tile--add:hover .ref-add, .ref-tile--add.is-dragover .ref-add, .ref-tile--add.is-sending .ref-add { color: var(--dm-link); }
.ref-add-plus { font-size: 26px; line-height: 1; font-weight: 300; }
.ref-add-label { font-size: 12px; font-weight: 700; }
.ref-add-submit { position: absolute; left: 4px; right: 4px; bottom: 4px; padding: 4px 6px; font-size: 11px; }
.admin-variant-photos .ref-add-plus { font-size: 22px; }

/* Badge des tuiles photo : « Envoyée à l'IA » (2 premières) ou « Ignorée » */
.ref-tile-badge {
  position: absolute; left: 4px; bottom: 4px; max-width: calc(100% - 8px); padding: 2px 6px;
  border-radius: 8px; font-size: 10px; font-weight: 700; line-height: 1.25; cursor: help;
}
.ref-tile-badge.is-sent { background: rgba(255,255,255,0.95); color: #1d6b21; }
.ref-tile-badge.is-ignored { background: rgba(26,26,46,0.85); color: #fff; }
.ref-tile--ignored img { opacity: 0.55; }
.admin-variant-photo-note { font-size: 12px; color: #6b6b6b; margin-bottom: 6px; }
.admin-delete-locked { font-size: 12px; color: #6b6b6b; white-space: nowrap; cursor: help; padding: 6px 0; }

.ref-empty { color: #6b6b6b; font-size: 13px; font-style: italic; padding: 8px 4px 12px; }

@media (max-width: 600px) {
  .admin-section { padding: 16px; }
  .admin-list-head h1 { font-size: 22px; }
  .admin-list-head > div { flex: 1 1 100%; }
  .admin-add-product { width: 100%; }
  .admin-add-product > summary { display: block; }
  .admin-col-head { padding-right: 0; }
  .admin-toggle-label { display: block; }
  .admin-row { flex-wrap: wrap; gap: 6px 10px; padding: 10px 12px; }
  .admin-row-main { flex: 1 1 0; }
  .admin-row-link { white-space: normal; overflow-wrap: anywhere; }
  .admin-row-swatches { order: 5; flex: 1 1 0; min-width: 0; max-width: none; margin-left: 82px; }
  .admin-row-photos { order: 6; min-width: 0; }
  .admin-row-chevron { display: none; }
  .ref-tiles { --tile: 88px; gap: 6px; }
  .admin-variant { grid-template-columns: minmax(0, 1fr) auto; }
  .admin-variant-photos { grid-column: 1 / -1; grid-row: 2; }
  .admin-variant-photos .ref-tiles { --tile: 68px; }
  .admin-delete-btn span { display: none; }
  .admin-delete-btn { padding: 7px; }
  form.is-dirty .admin-savebar { bottom: 8px; width: calc(100% - 16px); }
}

@media (prefers-reduced-motion: reduce) {
  .admin-page *, .admin-page *::before, .admin-page *::after { transition: none !important; animation: none !important; }
}

/* ── Zone editor ── */
.preview-wrap { position: relative; display: inline-block; max-width: 100%; }
/* Calque zoomé (plein écran) : image + canvas, transform posé par zone_editor */
.preview-zoom { position: relative; display: block; max-width: 100%; min-width: 0; transform-origin: 0 0; }
.fs-toggle { position: absolute; top: 8px; right: 8px; z-index: 3; min-height: 36px; padding: 6px 10px; border: 0; border-radius: 8px;
  background: rgba(0,0,0,0.62); color: #fff; font-size: 13px; font-weight: 700; cursor: pointer; }
.fs-toggle:hover { background: rgba(0,0,0,0.78); }
.fs-done { display: none; }
.photo-preparing { margin: 10px 0 4px; font-size: 14px; font-weight: 600; color: #555; }
.editor-notice { margin-bottom: 10px; padding: 8px 12px; border-radius: 8px; background: #1a1a2e; color: #fff; font-size: 14px; }
.zone-selection-actions { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.zone-canvas { position: absolute; inset: 0; max-width: 100%; pointer-events: none; touch-action: none; border-radius: 8px; } /* sans photo, le canvas vide (300px par défaut) débordait sur téléphone */
.zone-canvas.drawing { pointer-events: auto; cursor: crosshair; }
.zone-canvas.selectable { pointer-events: auto; touch-action: auto; }

.zone-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.zone-toolbar .active { background: var(--dm-primary); color: var(--dm-primary-contrast); border-color: var(--dm-primary); }
/* Outils de dessin : pictogramme SVG + libellé (plus de caractères Unicode) */
.zone-toolbar [data-tool], .zone-toolbar .btn-reset { display: inline-flex; align-items: center; gap: 8px; }
.zone-toolbar .tool-icon { flex-shrink: 0; color: var(--dm-link); }
.zone-toolbar .active .tool-icon { color: currentColor; }
.zone-toolbar .btn-reset .tool-icon { color: currentColor; }
.zone-drawing-actions { display: inline-flex; gap: 6px; }
.zone-drawing-actions .btn:disabled { opacity: 0.5; cursor: not-allowed; }
/* #5f5f5f : contraste AA (6,4:1 sur blanc) — l'ancien #999 plafonnait à 2,8:1 */
.btn-reset { color: #cb282b; background: #fff; border: 1px solid #f3c2ca; }
.btn-reset:hover { background: #fef2f2; }

.zone-picker { background: #fafafa; border: 1px solid #eee; border-radius: 10px; padding: 16px; margin-top: 14px; }
.zone-picker-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.zone-picker-header h3 { font-size: 15px; font-weight: 600; flex: 1; }
.zone-pattern { display: grid; gap: 8px; margin-top: 14px; padding: 12px; border: 1px solid #e3e3e8; border-radius: 10px; }
.zone-pattern-toggle { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.zone-pattern-toggle input { width: 18px; height: 18px; }
.zone-pattern-controls { display: grid; gap: 8px; }
.zone-pattern-slider { display: grid; grid-template-columns: minmax(0, 8.5em) minmax(0, 1fr); align-items: center; gap: 10px; font-size: 14px; }
.zone-pattern-slider input[type="range"] { width: 100%; }
.zone-pattern-hint { margin: 0; font-size: 12px; color: #888; }
.zone-pattern-more summary { cursor: pointer; font-size: 13px; color: #666; }
.zone-pattern-more[open] { display: grid; gap: 8px; }
.zone-instruction { display: grid; gap: 6px; margin-top: 14px; }
.zone-instruction label { font-size: 14px; font-weight: 700; }
.zone-instruction .optional { font-weight: 400; color: #888; }
.zone-instruction-input { min-height: 64px; }
.zone-instruction-count { font-size: 12px; color: #888; justify-self: end; font-variant-numeric: tabular-nums; }
.gate-size-warning { margin: -4px 0 12px; padding: 8px 12px; border-radius: 8px; background: #fff4e5; border: 1px solid #f5c26b; color: #7a4b00; font-size: 13px; line-height: 1.4; }
.zone-remove { background: none; border: none; color: #cb282b; cursor: pointer; font-size: 13px; }

.seam-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.seam-item { background: #fff; border: 1px solid #ddd; border-radius: 14px; padding: 3px 10px; font-size: 13px; }
.seam-remove { background: none; border: none; cursor: pointer; color: #999; }
.seam-remove:hover { color: #cb282b; }

@media (max-width: 600px) {
  .zone-toolbar { gap: 6px; }
  .zone-picker { padding: 12px; }
}

.border-type-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
/* Choix du produit bordure : même pastille que les coloris (police comprise). */
.border-type-card { flex-direction: row; padding: 6px 14px; border-radius: 20px; font: inherit; }
.border-type-card .product-name { font-size: 13px; font-weight: 600; }

/* ── Tablettes et téléphones (tests multi-écrans du 07/10/2026) ── */
/* 601–900px (iPad portrait) : la barre ne tenait pas, « Déconnexion » sortait de l'écran. */
@media (min-width: 601px) and (max-width: 900px) {
  .navbar-inner { gap: 14px; }
  .navbar-user { display: none; }
  .navbar-links a { padding: 0 9px; }
}
/* Téléphones : moins de marges autour de la photo pour agrandir la zone de dessin. */
@media (max-width: 600px) {
  .viz-section { padding: 16px 12px; }
  .upload-zone.has-image { padding: 6px; }
  /* Barre « Générer » collante plus compacte : elle masquait les outils sous la photo (115px sur 667). */
  .viz-actions { padding: 8px 10px; }
  .btn-generate { padding: 11px 12px; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
/* Écrans tactiles : cibles d'au moins 44px pour les outils de dessin. */
@media (pointer: coarse) {
  .zone-toolbar button, .zone-drawing-actions button, .photo-change > summary, .photo-change-menu button { min-height: 44px; }
  .zone-remove, .nav-summary .btn, .visualizer details > summary { min-height: 40px; display: inline-flex; align-items: center; }
}

/* ── Dessin en plein écran (form.is-fullscreen, zone_editor#enterFullscreen) ──
   Overlay CSS, pas l'API Fullscreen (absente de Safari iPhone) : la scène
   (photo + canvas) occupe l'écran entre la consigne en haut et les outils en
   bas, dont zone_editor mesure les hauteurs (--fs-top / --fs-bottom). */
form.is-fullscreen .preview-wrap {
  position: fixed; top: 0; left: 0; right: 0; height: 100vh; height: 100dvh; z-index: 1000;
  display: flex; align-items: center; justify-content: center; max-width: none; overflow: hidden;
  background: #111; touch-action: none; overscroll-behavior: contain;
  padding: var(--fs-top, 56px) max(6px, env(safe-area-inset-right)) var(--fs-bottom, 72px) max(6px, env(safe-area-inset-left));
}
form.is-fullscreen .preview-zoom { max-width: 100%; }
form.is-fullscreen .upload-preview {
  border-radius: 0;
  max-width: calc(100vw - 12px - env(safe-area-inset-left) - env(safe-area-inset-right));
  max-height: calc(100vh - var(--fs-top, 56px) - var(--fs-bottom, 72px) - 8px);
  max-height: calc(100dvh - var(--fs-top, 56px) - var(--fs-bottom, 72px) - 8px);
}
form.is-fullscreen .zone-canvas { pointer-events: auto; touch-action: none; border-radius: 0; }
form.is-fullscreen .fs-toggle { display: none; }
form.is-fullscreen .zone-toolbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1001; margin: 0; justify-content: center; gap: 6px;
  padding: 8px max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  background: rgba(17,17,17,0.94);
}
form.is-fullscreen .zone-toolbar .btn { min-height: 44px; padding: 8px 12px; font-size: 14px; }
/* Actions de l'outil et de la sélection : boutons au même niveau que les outils (moins de lignes) */
form.is-fullscreen .zone-drawing-actions, form.is-fullscreen .zone-selection-actions { display: contents; }
form.is-fullscreen .fs-done { display: inline-flex; align-items: center; }
/* Outil actif : seuls l'outil et ses actions restent dans la barre du bas */
form.is-fullscreen.is-drawing .zone-toolbar [data-tool]:not(.active),
form.is-fullscreen.is-drawing .zone-toolbar .btn-reset { display: none; }
/* Toasts (« Annuler », choix repris) au-dessus de la barre du bas */
form.is-fullscreen .viz-actions { position: static; z-index: auto; }
form.is-fullscreen .undo-toast, form.is-fullscreen .editor-notice {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--fs-bottom, 72px) + 8px); z-index: 1002; margin: 0;
}
@media (pointer: coarse) {
  .fs-toggle { min-height: 44px; padding: 8px 12px; }
  .zone-selection-actions button { min-height: 44px; }
}
