/* ergonomie.css — audit design du 02/12/2026.
   Chargée en DERNIER (après thèmes) : ne touche ni couleurs ni polices de marque,
   seulement tailles de zones cliquables, alignements, planchers de lisibilité.
   Cible de référence : Samsung Galaxy S7 (360×640 px CSS). Préfixe html:root body
   pour l'emporter sur les !important historiques des vues. */

/* ── 1. Zones cliquables ≥ 44 px (tactile) ─────────────────────────────── */
@media (max-width: 1024px), (pointer: coarse) {
  html:root body .btn,
  html:root body .btn-sm,
  html:root body main .btn-secondary,
  html:root body .page-header .btn,
  html:root body form[action$="/delete"] .btn-danger.btn-sm {
    min-height: 44px !important;
    min-width: 44px !important;
    flex-basis: auto !important;
  }
  html:root body form[action$="/delete"] .btn-danger.btn-sm { width: 44px !important; height: 44px !important; }
  html:root body .form-group input:not([type=checkbox]):not([type=radio]),
  html:root body .form-group select,
  html:root body .form-group textarea,
  html:root body .form-group .pf-trigger,
  html:root body .pf-trigger,
  html:root body .pf-text,
  html:root body .courses-filter-auto-submit,
  html:root body .courses-filter-search input {
    min-height: 44px !important;
  }
  /* Bouton « masquer ce bloc » (œil barré) de la synthèse, bouton × de la bannière, œil du mot de passe */
  html:root body #synth-blocks .synth-hide-btn { width: 44px !important; height: 44px !important; top: 2px !important; right: 2px !important; }
  html:root body .stats-banner button,
  html:root body .pf-pwd-toggle { min-width: 44px !important; min-height: 44px !important; }
  /* Liens autonomes (hors phrase) : zone de toucher agrandie sans bouger la mise en page */
  html:root body .pf-pcl-date-link,
  html:root body .practice-modules-legend a,
  html:root body .crs-pager a,
  html:root body .footer-link-nouveautes,
  html:root body .footer-link-contact,
  html:root body .footer-col-nouveautes a,
  html:root body footer a,
  html:root body .navbar-brand-logo-row a {
    display: inline-flex !important; align-items: center; min-height: 44px; box-sizing: border-box;
  }
  html:root body .crs-pager a { min-width: 44px; justify-content: center; }
  html:root body a.c-nom-link { display: inline-block !important; padding: 14px 0 !important; min-height: 44px; box-sizing: border-box; }
  html:root body .synthesis-block a[href]:not(.btn),
  html:root body .synth-ext-placeholder a[href]:not(.btn) { display: inline-block; padding: 12px 0; }
  /* Pastilles de ligne de tableau (actions) : même gabarit partout */
  html:root body table .btn, html:root body table .btn-sm { min-height: 44px !important; min-width: 44px !important; }
}
/* PC souris : compact mais jamais en dessous de 36 px */
@media (min-width: 1025px) and (pointer: fine) {
  html:root body .btn, html:root body .btn-sm { min-height: 36px !important; }
  html:root body .form-group input:not([type=checkbox]):not([type=radio]),
  html:root body .form-group select, html:root body .pf-trigger,
  html:root body .courses-filter-auto-submit { min-height: 38px !important; }
  html:root body footer a, html:root body .footer-link-nouveautes, html:root body .footer-link-contact { min-height: 28px; display: inline-flex; align-items: center; }
}

/* ── 2. En-tête de page : titre à gauche, actions alignées à droite, même gabarit ── */
html:root body .page-header { align-items: center !important; justify-content: space-between !important; }
html:root body .page-header > h1 { flex: 1 1 auto; min-width: 0; margin: 0; }
html:root body .page-header > .btn,
html:root body .page-header > div .btn,
html:root body .page-header > a { align-self: center; }
html:root body .page-header .btn-secondary:not(.btn-label-visible) { width: 44px; padding: 0 !important; }
html:root body .page-header > div { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* ── 3. Barre basse (mobile / tablette) : libellés visibles ─────────────── */
@media (max-width: 768px) {
  html:root body #bottom-nav .bnav-item .bnav-label {
    position: static !important; width: auto !important; height: auto !important; margin: 0 !important;
    clip-path: none !important; overflow: visible !important;
    font-size: 12px !important; line-height: 1.1 !important; font-weight: 700; letter-spacing: 0;
    color: inherit; white-space: nowrap; padding-top: 1px !important;
  }
  html:root body #bottom-nav .bnav-item .bnav-icon img { height: 1.7rem !important; }
  html:root body #bottom-nav .bnav-item { gap: 1px; min-height: 52px; }
  html:root body { padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }
  html:root body.menu-open { padding-bottom: 0; }
}

/* ── 4. Menu PC : effet « dock » d'origine rétabli (demande de Xavier 05/12) ──
   Rien n'est forcé : l'icône grossit (×1,5) et le libellé n'apparaît qu'au survol, comme avant l'audit du 02/12.
   Accessibilité : le libellé reste dans le DOM (nom accessible) et s'affiche aussi au focus clavier. */
@media (min-width: 1180px) {
  html:root body .dock-menu .dock-item:focus-visible .dock-label { transform: translateX(-50%) scale(1) !important; -webkit-transform: translateX(-50%) scale(1) !important; }
}

/* ── 5. Planchers de lisibilité (S7 inclus) ────────────────────────────── */
@media (max-width: 768px) {
  html:root body main :is(p, li, td, th, label, span, small, a, div):not(.pf-sr-only) { font-size: max(1em, 12px); }
  html:root body .courses-table th, html:root body .courses-table td { font-size: max(0.75rem, 12px) !important; }
  html:root body .courses-table .c-nom-link, html:root body .courses-table .c-nom-golf { font-size: .85rem !important; }
  html:root body .courses-table .c-nom-course, html:root body .courses-table .c-pays { font-size: .75rem !important; }
}

/* ── 6. Formulaires (profil, filtres) : colonne de libellés commune, champs alignés ── */
@media (max-width: 600px) {
  html:root body .profile-form .form-group { align-items: center !important; }
  html:root body .profile-form .form-group > label {
    flex: 0 0 104px !important; white-space: normal !important; font-size: .82rem !important; line-height: 1.15 !important;
  }
  html:root body .profile-form .form-group > input,
  html:root body .profile-form .form-group > select,
  html:root body .profile-form .form-group > .pf-trigger,
  html:root body .profile-form .form-group > .pf-pwd-wrap { flex: 1 1 0 !important; min-width: 0 !important; width: auto !important; }
}

/* ── 7. Filtres : actions principales lisibles et de même poids ───────────── */
html:root body form#stats-filters-form .btn { min-height: 44px; }

/* ── 8. Contraste : valeurs de la distribution (le blanc « Par » était illisible) ── */
html:root body .dist-row .pf-score-color { color: #1d2333 !important; }
html:root body .dist-bar { box-shadow: inset 0 0 0 1px rgba(0,0,0,.35); min-width: 3px; }

/* ── 9. Sommaire de la page Stats (injecté par ergonomie.js) ───────────── */
.pf-jump { position: sticky; top: 0; z-index: 40; margin: 8px 0; display: flex; gap: 8px; align-items: center;
  background: rgba(255,255,255,.94); border: 1px solid #c9ceda; border-radius: 12px; padding: 6px 10px; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.pf-jump label { font-weight: 700; font-size: .85rem; color: #141c30; white-space: nowrap; }
.pf-jump select { flex: 1 1 auto; min-width: 0; min-height: 44px; font-size: 1rem; border-radius: 8px; border: 1px solid #9aa3b8; background: #fff; color: #141c30; padding: 0 8px; }
.pf-totop { position: fixed; right: 12px; bottom: calc(68px + env(safe-area-inset-bottom, 0px)); z-index: 340; width: 48px; height: 48px;
  border-radius: 50%; border: 1px solid #000; background: #1F7A3E; color: #fff; font-size: 1.4rem; font-weight: 700; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.4); display: none; }
.pf-totop.is-on { display: inline-flex; align-items: center; justify-content: center; }
@media (min-width: 769px) { .pf-totop { bottom: 20px; } }

/* ── 10. Compléments tactiles ─────────────────────────────────────────── */
@media (max-width: 1024px), (pointer: coarse) {
  html:root body .page-header .btn-secondary,
  html:root body .pf-list-actions .btn-sm,
  html:root body .putting-list-actions .btn-sm,
  html:root body td .btn-sm { width: 44px !important; min-width: 44px !important; max-width: none !important; }
  html:root body .wb-row { min-height: 44px; }
  html:root body .synthesis-block a[href]:not(.btn),
  html:root body .synth-ext-placeholder a[href]:not(.btn),
  html:root body .card a.pf-link-block { padding: 14px 0; }
  html:root body form.form-meteo .pf-trigger,
  html:root body .pfp-clickable,
  html:root body input.pf-comment,
  html:root body .cell .pf-trigger { padding-block: 13px !important; min-height: 44px; box-sizing: border-box; }
  html:root body main :not(p):not(li):not(span) > a[href^="http"]:not(.btn),
  html:root body main .card-title > a { display: inline-flex; align-items: center; min-height: 44px; }
}

/* ── 11. Anti-débordement S7 : un enfant à large min-content ne doit pas élargir sa carte ── */
html:root body main .card, html:root body main .form-group, html:root body main .profile-form { min-width: 0; max-width: 100%; box-sizing: border-box; }
@media (max-width: 600px) {
  html:root body main :is(.card, .form-group) > :is(input, select, button, .pf-trigger, .pf-pwd-wrap) { max-width: 100%; }
}

/* ── 12. Liste des parcours en mobile : le nom passe à la ligne au lieu d'être tronqué, le tableau tient dans 360 px ── */
@media (max-width: 600px) {
  html:root body .courses-table { width: 100% !important; min-width: 0 !important; table-layout: auto; }
  html:root body .courses-table :is(.c-nom-link, .c-nom-golf, .c-nom-course) {
    white-space: normal !important; overflow: visible !important; text-overflow: clip !important; max-width: none !important; word-break: normal; overflow-wrap: break-word;
  }
  html:root body .courses-table td:first-child, html:root body .courses-table th:first-child { white-space: normal !important; max-width: none !important; width: 52%; }
  html:root body .courses-table :is(td, th):not(:first-child) { padding-left: 3px !important; padding-right: 3px !important; white-space: nowrap; }
}

@media (min-width: 1025px) and (pointer: fine) {
  html:root body .page-header .btn-secondary { height: 40px; min-height: 40px !important; }
}

/* ── 13. En-têtes de tableaux sur écran étroit : une ligne, pas de coupe au milieu d'un mot ── */
@media (max-width: 600px) {
  html:root body main table th { letter-spacing: 0 !important; white-space: nowrap; word-break: normal !important; overflow-wrap: normal !important; padding-left: 2px !important; padding-right: 2px !important; }
  html:root body main :is(.kpi-grid-3, .kpi-grid-4, .kpi-grid-5) * { letter-spacing: 0 !important; }
}

/* ── 14. Paysage téléphone (S7 : 640×360) : récupérer de la hauteur utile, ne rien faire déborder ── */
@media (orientation: landscape) and (max-height: 480px) {
  html:root body header { position: static !important; }
  html:root body #bottom-nav { height: 44px !important; min-height: 44px !important; }
  html:root body #bottom-nav a, html:root body #bottom-nav button {
    flex-direction: row !important; gap: 6px !important; justify-content: center !important; align-items: center !important; min-height: 44px !important; padding: 0 4px !important;
  }
  html:root body #bottom-nav :is(img, svg, .bnav-icon) { height: 1.3rem !important; width: auto !important; max-height: 1.3rem !important; }
  html:root body #bottom-nav .bnav-label { font-size: 12px !important; }
  html:root body { padding-bottom: calc(46px + env(safe-area-inset-bottom, 0px)) !important; }
  html:root body .header-action-grid { flex-wrap: wrap !important; max-width: 100% !important; gap: 6px !important; }
  html:root body .header-action-grid .btn { flex: 1 1 140px !important; min-width: 0 !important; }
  html:root body .pf-jump { top: 0 !important; }
}
/* Tablettes/paysage étroit : les 4 colonnes de départs passent à 2 (évite le débordement de 640–900 px) */
@media (min-width: 601px) and (max-width: 900px) {
  html:root body .pf-tees-cols { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  html:root body .pf-tee-card .pf-tee-row { white-space: normal; }
}

/* ── 15. Admin : barres d'outils qui passent à la ligne, boutons de zoom tactiles ── */
@media (max-width: 600px) {
  html:root body .claude-header-tools { flex-wrap: wrap !important; max-width: 100% !important; row-gap: 6px; }
  html:root body .claude-header-tools :is(a, button) { min-height: 44px; min-width: 44px; }
  html:root body .zoom-btn { min-height: 44px; min-width: 44px; }
}
@media (max-width: 600px) {
  html:root body .page-header:has(.claude-header-tools) { flex-wrap: wrap !important; }
  html:root body .page-header > div:has(> .claude-header-tools) { flex-wrap: wrap !important; max-width: 100% !important; min-width: 0 !important; }
}

/* ── 16. Saisie trou par trou et menu latéral : cibles ≥ 44 px (gants, soleil, une main) ── */
@media (max-width: 1024px), (pointer: coarse) {
  html:root body .sidebar-link { min-height: 44px !important; display: flex; align-items: center; }
  html:root body .lang-picker button { min-height: 44px !important; min-width: 44px !important; display: inline-flex; align-items: center; justify-content: center; }
  html:root body :is(.live-btn, .fir-btn) { min-height: 44px !important; }
  html:root body main button[data-click*="istance"], html:root body main button[data-click*="Green"], html:root body .pf-skip-link { min-height: 44px; }
}

/* ── 17. Tableau 18 trous en portrait étroit : 18 colonnes de 15 px illisibles sur S7 → défilement horizontal, cases de 26 px ── */
@media (max-width: 600px) and (orientation: portrait) {
  html:root body :not(#pf-landscape-stats) > .landscape-holes-table { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
  html:root body :not(#pf-landscape-stats) > .landscape-holes-table .lht-row { min-width: calc(44px + var(--lht-nb, 18) * 26px); grid-template-columns: 44px repeat(var(--lht-nb, 18), minmax(26px, 1fr)); }
  html:root body :not(#pf-landscape-stats) > .landscape-holes-table :is(.lht-cell, .lht-label) { font-size: 12px !important; padding: 4px 0 !important; }
  html:root body :not(#pf-landscape-stats) > .landscape-holes-table .lht-label { position: sticky; left: 0; z-index: 1; }
}
@media (max-width: 600px) {
  html:root body .merged-card :is(.merged-headline, .merged-grid, .stats-row) * { letter-spacing: 0 !important; overflow-wrap: normal; }
  html:root body .merged-card .merged-headline > * { min-width: 0; }
}
@media (max-width: 600px) and (orientation: portrait) {
  html:root body .merged-card:not(.pf-stats-landscape) .merged-headline { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; row-gap: 10px !important; }
  html:root body .merged-card:not(.pf-stats-landscape) .merged-headline .hl-label { font-size: 12px !important; }
}

/* ── 18. Fenêtres modales (sélecteur de lieu, etc.) : fermeture, liste et filtre tactiles ── */
@media (max-width: 1024px), (pointer: coarse) {
  html:root body :is([class*="modal-close"], [class*="popup-close"], [class$="-close"]):is(button, a) { min-width: 44px !important; min-height: 44px !important; display: inline-flex; align-items: center; justify-content: center; }
  html:root body .sg-golf-item { min-height: 44px; display: flex; align-items: center; }
  html:root body :is(.sg-modal, [class*="picker"]) select { min-height: 44px; }
}
@media (max-width: 1024px), (pointer: coarse) { html:root body .sg-golf-search { min-height: 44px; } }

/* ── 19. Confirmations (toast) : en bas, au-dessus de la barre basse, pour ne plus masquer les boutons d'en-tête ── */
@media (max-width: 1024px) {
  html:root body .pf-toast { top: auto !important; bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important; }
}
@media (orientation: landscape) and (max-height: 480px) {
  html:root body .pf-toast { bottom: calc(54px + env(safe-area-inset-bottom, 0px)) !important; }
}

/* ── 20. Espace coach et admin : liens du bandeau, onglets, filtres, pagination ── */
@media (max-width: 1024px), (pointer: coarse) {
  html:root body .stats-banner a { display: inline-block; padding: 13px 6px; margin: -13px 0; }
  html:root body :is(.garmin-tabs a, .garmin-pagination a, .garmin-filters select, .icon-link-item a, .icon-link-item button) { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; }
  html:root body .icon-link-item button { min-width: 44px; }
}
@media (max-width: 600px) {
  html:root body main input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=range]):not([type=file]):not([type=color]) { min-height: 44px; box-sizing: border-box; }
  html:root body main td input:not([type=checkbox]):not([type=radio]), html:root body main th input:not([type=checkbox]):not([type=radio]) { min-height: 36px; }
}
@media (max-width: 1024px), (pointer: coarse) { html:root body .prep-voice-sample { min-width: 44px !important; min-height: 44px !important; } }

/* ── 21. Constats Chrome Android réel (Pixel 7, 412 px) ── */
@media (max-width: 600px) {
  /* Boutons « Saisie détaillée / simplifiée » : même bord gauche, même largeur (étaient alignés à droite, largeurs différentes) */
  html:root body .saisie-actions-row { flex-direction: column !important; align-items: stretch !important; gap: 10px !important; }
  html:root body .saisie-actions-row > * { width: 100% !important; max-width: none !important; box-sizing: border-box; justify-content: center; }
  /* Nom du joueur sous le logo : ne doit plus recouvrir le haut du contenu */
  html:root body header { padding-bottom: 16px; }
}
@media (max-width: 600px) and (orientation: portrait) {
  html:root body #bottom-nav > * { justify-content: space-between !important; padding-top: 6px !important; padding-bottom: 4px !important; }
  html:root body #bottom-nav .bnav-label { margin-top: auto !important; }
}

/* ── 22. Passe Chrome Android à 360×640 : cibles restantes + texte gris trop pâle ── */
@media (max-width: 1024px), (pointer: coarse) {
  html:root body .stats-banner a { padding: 14px 2px; margin: -14px 0; }
  html:root body .u-48042d3b > a { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; }
  html:root body .live-nav-btn { min-height: 44px !important; }
  html:root body .live-card > button { min-height: 44px !important; }
}
@media (max-width: 600px) {
  html:root body .u-48042d3b { font-size: 12px !important; color: #4a4a4a !important; }
}

/* ── 23. Bouton « mode hors connexion » : couleurs explicites (il n'avait que .btn, donc des couleurs système du navigateur : rouge sur rouge observé dans Chrome Android en affichage forcé 360 px) ── */
html:root body .pf-offline-readiness .btn,
html:root body #pf-prepare-offline { background-color: #fff !important; color: #1a2233 !important; -webkit-text-fill-color: #1a2233 !important; border: 1.5px solid #1a2233 !important; }

/* ── 24. Garde-fou global : aucune couleur ne doit dépendre des couleurs système du navigateur ──
   Cause du rouge sur rouge (Chrome Android) : un <button class="btn"> sans variante prenait ButtonFace/ButtonText.
   :where() = spécificité 0 → toute règle existante de l'application ou du thème garde la priorité ;
   seul ce qui n'avait AUCUNE couleur reçoit une valeur explicite et lisible. */
:root { color-scheme: light; }
:where(button, input[type="button"], input[type="submit"], input[type="reset"], .btn) {
  background-color: #efefef; color: #1a2233; border-color: #1a2233;
}
:where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]), select, textarea) {
  background-color: #fff; color: #1a2233; border-color: #8a93a6;
}
:where(input, textarea)::placeholder { color: #5b6477; opacity: 1; }
:where(a) { color: #1E5C9B; }

/* ── 25. Bandeau « saisie en attente » (offline-queue) : ne doit pas masquer la barre basse mobile,
   et son bouton d'export suit les règles de taille/couleur (constaté dans Chrome Android 360×640 :
   bandeau collé sur la barre de navigation, bouton « Exporter la saisie » de 17 px de haut). */
html:root body .pf-offline-banner button {
  min-height: 44px; padding: 8px 18px; margin-top: 6px; cursor: pointer;
  background: #fff !important; color: #1a2233 !important;
  border: 1.5px solid #1a2233 !important; border-radius: 8px; font-size: 14px; font-weight: 600;
}
@media (max-width: 900px) {
  html:root body .pf-offline-banner {
    bottom: env(safe-area-inset-bottom, 0px); border-radius: 10px 10px 0 0; line-height: 1.3;
  }
  /* La barre basse (66 px) n'existe pas sur la saisie trou après trou : on ne remonte que si elle est là. */
  html:root body:has(#bottom-nav) .pf-offline-banner { bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }
}
@media (orientation: landscape) and (max-height: 480px) {
  html:root body:has(#bottom-nav) .pf-offline-banner { bottom: calc(44px + env(safe-area-inset-bottom, 0px)); }
}

/* ── 26. Texte « Chargement… » des sélecteurs de lieu : couleur par attribut (un style= inline est bloqué par la CSP). */
.pl-golf-item[data-loading], .pp-golf-item[data-loading], .sg-golf-item[data-loading] { color: var(--fg-3, #5b6477); }

/* ── 27. Liens de pied de page isolés (confidentialité / conditions) sur /decouvrir et le profil :
   14–17 px de haut mesurés sous WebKit iPhone SE → zone tactile de 44 px (WCAG 2.5.8). */
@media (max-width: 900px) {
  html:root body a.u-038e1fb6, html:root body a.u-48f6a03d {
    display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; box-sizing: border-box;
  }
}

/* ── 28. Espace coach › Caddie : boutons de liste de 38 px sur tablette → 44 px (audit WebKit/Chromium 768). */
@media (max-width: 1024px) { html:root body button.u-059293c3 { min-height: 44px; } }

/* ── 29. Menu icônes (dock) sur tablette 769–949 px (iPad 10,2" = 810, Android 800) : les 11 icônes dépassaient de l'écran
   (Déconnexion coupée à droite, constaté sous WebKit iPad). On resserre espacement et marges latérales. */
@media (min-width: 769px) and (max-width: 949px) {
  html:root body .dock-menu { gap: 1px !important; padding-left: 2px !important; padding-right: 2px !important; }
  html:root body .dock-menu .dock-item { padding-left: 5px !important; padding-right: 5px !important; }
}

/* ── 30. Saisie › grille d'infos (Date | Mode | Index | Vent | Pluie | SSS | Slope) : 7 colonnes fixes, le dernier champ
   dépassait de 10 px de l'écran en paysage 640×360 dans Chrome Android (polices Roboto plus larges). On autorise le retour à la ligne. */
@media (min-width: 601px) and (max-width: 900px) {
  html:root body .saisie-info-grid { grid-template-columns: repeat(auto-fit, minmax(96px, auto)); justify-content: start; }
}

/* ── 31. Le <main> (enfant flex du body) ne doit jamais dépasser l'écran ──────────────
   Constaté sur iPad (810 px) : /admin/courses, /admin/logs, /admin/claude. Le body est en
   display:flex ; main.container avait min-width:auto et s'élargissait à la largeur du plus
   large tableau (949 à 1024 px), le body coupait ensuite le surplus (overflow-x:clip) : les
   colonnes de droite devenaient inaccessibles. min-width:0 le laisse rétrécir, et les
   tableaux défilent dans leur .table-responsive. */
html:root body > main,
html:root body > .container { min-width: 0 !important; max-width: min(100%, 1024px); }
html:root main .card { min-width: 0; max-width: 100%; }

/* ── 32. Grille de cartes à largeur minimale fixe (fail2ban : minmax(340px,1fr)) : une colonne sous 400 px
   (iPhone SE 320 px : les cartes dépassaient de 30 px). */
@media (max-width: 400px) {
  html:root body .u-edeb9653 { grid-template-columns: minmax(0, 1fr) !important; }
}

/* ── 33. Écrans tactiles : boutons d'outils de la console Claude (admin) et zoom des icônes à 44 px. */
@media (pointer: coarse) {
  html:root body .claude-header-new-tab,
  html:root body .claude-history-btn,
  html:root body .claude-fontsize-btn,
  html:root body .claude-maxsess-btn,
  html:root body .claude-theme-toggle,
  html:root body .claude-palette-btn,
  html:root body .zoom-btn { min-height: 44px; min-width: 44px; }
}

/* ── 34. Tablettes tactiles (> 768 px) : champs de formulaire à 44 px comme sur mobile (admin : 30 px sur iPad). */
@media (pointer: coarse) {
  html:root body main input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=range]):not([type=color]):not([type=file]),
  html:root body main select { min-height: 44px; }
  html:root body main td input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
  html:root body main td select, html:root body main th input, html:root body main th select { min-height: 36px; }
}

/* ── 35. iOS Safari zoome la page quand on touche un champ dont la police est < 16 px (constaté en WebKit iPhone :
   filtres de /courses, profil, formulaire d'une partie). Sur les écrans tactiles, tout champ de saisie reste à 16 px. */
@media (pointer: coarse) {
  html:root body input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]):not([type=submit]):not([type=button]):not([type=hidden]),
  html:root body select,
  html:root body textarea { font-size: 16px !important; }
}

/* ── 36. Paysage téléphone (≈568 px) : tableaux à colonnes « hide-mobile » encore visibles (coach › Compétitions : 604 px)
   → la carte qui contient un tableau défile à l'horizontale ; les blocs <code> (admin) passent à la ligne. */
@media (max-width: 900px) {
  html:root body main .card:has(> table),
  html:root body main .comp-body:has(> table) { overflow-x: auto; }
  html:root body main code { overflow-wrap: anywhere; word-break: break-word; white-space: normal; }
}

/* ── 37. Coach › Caddie : boutons de liste à 44 px sur tout écran tactile (la règle 28 s'arrêtait à 1024 px : iPad paysage = 1080). */
@media (pointer: coarse) { html:root body button.u-059293c3 { min-height: 44px; } }

/* ── 38. Constats sur captures WebKit (iPhone) ───────────────────────────────────────────
   a) Barre basse : fond totalement transparent (rgba(0,0,0,0)) + flou seul → le contenu qui défile dessous restait
      lisible derrière les libellés (pastilles de /courses, « Vent / Pluie » de la partie). Fond de surface du thème
      (opaque à 90 %), avec repli en rgba pour les navigateurs sans color-mix. */
html:root body #bottom-nav {
  background-color: rgba(243, 239, 232, 0.92) !important;
  background-color: color-mix(in srgb, var(--surface-1, #F3EFE8) 92%, transparent) !important;
  border-top: 1px solid rgba(20, 28, 48, 0.12);
}
/*    b) Un bouton dont le libellé dépasse la largeur de son conteneur passe à la ligne au lieu d'être rogné
      (« Demander un nouveau parcours ou une modificati… » sur /courses à 390 px). */
@media (max-width: 600px) {
  html:root body main .btn { max-width: 100%; white-space: normal; text-align: center; height: auto; }
}

/* ── 39. Grille d'infos de la partie (Date | Mode | Index | Vent | Pluie | SSS | Slope) en portrait téléphone :
   3 colonnes de 81 à 105 px → la date en 16 px chevauchait « Mode » (capture iPhone 13). Deux colonnes, libellé au-dessus de la valeur. */
@media (max-width: 480px) {
  html:root body .saisie-info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  html:root body .saisie-info-grid .cell { flex-direction: column !important; align-items: flex-start !important; gap: 2px !important; min-width: 0; }
  html:root body .saisie-info-grid .cell > * { max-width: 100%; min-width: 0; }
}

/* ── 40. Champ mot de passe avec œil : le texte (et le placeholder, ex. « Actuel, pour changer l'e-mail » sur le profil)
   passait sous l'icône. Marge droite = largeur de la zone tactile de l'œil (44 px) + 8 px. */
html:root body .pf-pw-wrap > input { padding-right: 52px !important; text-overflow: ellipsis; }

/* ── 41. Dernières corrections de design ─────────────────────────────────────────────────
   a) Bouton « Passer en saisie simplifiée / détaillée » : rouge foncé avec « ! » alors que le changement de mode ne supprime rien
      (les coups détaillés sont masqués, pas effacés). Bouton secondaire neutre : contour marine sur fond clair. */
html:root body .btn.u-44a2399d {
  background: #fff !important; color: #1a2233 !important; border: 2px solid #1a2233 !important; box-shadow: none !important;
}
html:root body .btn.u-44a2399d:hover, html:root body .btn.u-44a2399d:focus-visible { background: #eef3fa !important; }
/*    b) Boutons d'action de la saisie : `white-space: nowrap !important` faisait toucher le bord au libellé quand la police est
      plus large (police de repli, grand texte iOS). Le libellé passe à la ligne, le bouton garde ≥ 44 px. */
html:root body .saisie-actions-row .btn { white-space: normal !important; text-align: center; height: auto; min-height: 44px; line-height: 1.25; }
/*    c) « (Tour 1/3) » : contour noir 1,5 px pour tenir sur tous les fonds (vert fluo sur beige clair, contraste faible). */
html:root body .u-6889a5a0 { -webkit-text-stroke: 1.5px #000 !important; }
/*    d) Colonne « Actions » collée à droite dans les tableaux qui défilent (posée par ergonomie.js). */
html:root body .pf-sticky-actions { position: sticky; right: 0; z-index: 2; box-shadow: -8px 0 8px -8px rgba(0, 0, 0, 0.3); }

/* ── 42. En-tête du haut (logo, menu, icônes) : sticky avec un fond totalement transparent → le contenu qui défile (en-têtes de
   tableau, titres) passait derrière le logo et se mélangeait à lui (capture iPad /admin/courses). Même fond de surface que la
   barre basse (opaque à 94 %). */
@media (max-width: 1024px) {
  html:root body > header {
    background-color: rgba(243, 239, 232, 0.97) !important;
    background-color: color-mix(in srgb, var(--surface-1, #F3EFE8) 97%, transparent) !important;
    border-bottom: 1px solid rgba(20, 28, 48, 0.12);
  }
}
/* (Sur PC > 1024 px les libellés du menu sont blancs : le bandeau d'origine, plus sombre, est conservé.) */

/* ── Audit 05/12 : public_layout ── */
/* Contact : l'e-mail (souvent long) passe sur sa propre ligne au lieu d'être tronqué dans une demi-colonne ;
   bouton Retour du gabarit 44 px (ne s'écrase plus en capsule 24 px). */
html:root body .contact-name-email { grid-template-columns: 1fr !important; gap: 0 16px !important; }
html:root body .page-header > a.btn.contact-back { flex: 0 0 44px !important; min-width: 44px !important; width: 44px !important; justify-content: center; }
/* Invitation d'installation PWA : feuille compacte non modale en bas d'écran (ne masque plus la synthèse, la page reste utilisable). */
html:root body .pf-modal-overlay.pf-install-tip { background: transparent !important; align-items: flex-end !important; pointer-events: none; }
html:root body .pf-modal-overlay.pf-install-tip .pf-modal-box { pointer-events: auto; max-height: 46dvh; overflow-y: auto; margin-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 6px 28px rgba(0, 0, 0, 0.3); }

/* ── Audit 05/12 : données (dashboard, stats, caddie, profil, sacs, parcours, demandes de parcours) ──
   Sélecteurs spécifiques, aucune règle globale ; 3 thèmes conservés (couleurs sombres neutres sur cartes claires translucides). */

/* a) États vides (dashboard, stats) : le gris #aaa du utilitaire était illisible sur les cartes translucides. */
html:root body p.pf-empty-state.pf-empty-state {
  color: #3a4252 !important; font-size: 0.95rem; line-height: 1.4;
  background: rgba(255, 255, 255, 0.55); border-radius: 8px;
}
html:root body a.pf-empty-cta {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; font-weight: bold; white-space: nowrap;
}

/* b) Caddie : pastilles « Compétitions / Entraînements » ≥ 44 px de haut, espacées. */
html:root body label.u-de55ef66 { min-height: 44px; padding-top: 4px !important; padding-bottom: 4px !important; margin: 2px 0; }
html:root body .pf-caddie-empty-alt { margin-left: 8px; }
html:root body a.btn.u-93761be7 { min-height: 44px !important; display: inline-flex !important; align-items: center; justify-content: center; }
@media (max-width: 480px) { html:root body .pf-caddie-empty-alt { margin: 8px 0 0; } }

/* c) Profil (≤ 600 px) : dans les grilles « valeur | date » (index, classement) le libellé passait à côté du champ et
      écrasait la date (« 05… ») ; libellé au-dessus, champ pleine largeur de sa cellule. E-mail : libellé au-dessus (plus de troncature). */
@media (max-width: 600px) {
  html:root body .profile-form :is(.index-grid, .classement-grid) .form-group { flex-direction: column !important; align-items: stretch !important; gap: 4px !important; }
  html:root body .profile-form :is(.index-grid, .classement-grid) .form-group > :is(input, select, .pf-trigger) { width: 100% !important; min-width: 0 !important; flex: 0 0 auto !important; }
  html:root body .profile-form :is(.index-grid, .classement-grid) .form-group > label { flex: 0 0 auto !important; }
  html:root body .profile-form :is(.index-grid, .classement-grid) .pf-trigger-value { overflow: visible !important; text-overflow: clip !important; }
  html:root body .profile-form .form-group:has(#profile-email) { flex-direction: column !important; align-items: stretch !important; gap: 4px !important; }
  html:root body .profile-form #profile-email { width: 100% !important; text-overflow: ellipsis; flex: 0 0 auto !important; }
  html:root body .profile-form .form-group:has(#profile-email) > :is(label, .pf-trigger) { flex: 0 0 auto !important; }
  html:root body .profile-form #profile-email + .pf-trigger { width: 100% !important; }
}

/* d) Aide « Comment créer votre sac ? » (bags / clubs) : bornée au viewport, corps défilant, texte plus petit, croix visible. */
html:root body .pf-modal-overlay.pf-modal-info .pf-modal-box {
  max-height: calc(100dvh - 32px); overflow-y: auto; display: flex; flex-direction: column;
}
html:root body .pf-modal-overlay.pf-modal-info .pf-modal-body { overflow-y: auto; flex: 1 1 auto; min-height: 0; font-size: 1.05rem; }
html:root body .pf-modal-overlay.pf-modal-info .pf-modal-title { font-size: 1.4rem; }
html:root body .pf-modal-overlay.pf-modal-info .pf-modal-actions { position: sticky; bottom: 0; }
html:root body .pf-modal-overlay.pf-modal-info .pf-modal-close { min-width: 44px; min-height: 44px; }
html:root body .pf-modal-overlay.pf-modal-info .pf-modal-btn-cancel[hidden] { display: none !important; }

/* e) Liste des parcours : titre du filtre lisible, champ de recherche aussi haut que les sélecteurs,
      colonne des noms élargie en mobile (table-layout fixe de l'utilitaire écrasait la règle § 12). */
html:root body .courses-filter-card .u-55dd8793 { color: #1a2233 !important; text-shadow: none !important; }
@media (min-width: 1025px) and (pointer: fine) { html:root body .courses-filter-search input { min-height: 38px !important; } }
@media (max-width: 600px) {
  html:root body table.courses-table { table-layout: auto !important; min-width: 0 !important; width: 100% !important; }
  html:root body table.courses-table > tbody > tr > :is(th, td) { min-width: 0 !important; max-width: none !important; width: 1% !important; }
  html:root body table.courses-table > tbody > tr > :nth-child(1) { width: auto !important; min-width: 26vw !important; }
    html:root body .courses-table :is(.c-nom-link, .c-nom-golf, .c-nom-course) { word-break: normal !important; overflow-wrap: break-word; hyphens: auto; }
}

/* f) Fiche parcours : départs (distance + rang sur leur propre ligne, sans retour à la ligne), colonnes vides masquées,
      Slope/SSS insécables ; scorecard mobile : numéros de trous 10-18 sur une ligne, repères Aller/Retour/trous lisibles (blanc sur bleu). */
html:root body .pf-tees-cols .pf-tee-card { flex-wrap: wrap; }
html:root body .pf-tees-cols .pf-tee-card .pf-tee-rows { flex-shrink: 0; }
html:root body .pf-tees-cols .pf-tee-card .pf-tee-dist { order: 3; flex: 0 0 100%; padding-left: 32px; white-space: nowrap; font-size: 0.85rem; color: #333; }
html:root body .pf-tees-cols .pf-tees-col-empty { display: none; }
html:root body .pf-tees-cols { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
@media (max-width: 600px) {
  html:root body .pf-tees-cols .pf-tee-card .pf-tee-dist { padding-left: 24px; font-size: 0.75rem; }
  html:root body table.scorecard-mobile th.sm-hole, html:root body table.scorecard-mobile td.sm-hole { width: 26px; white-space: nowrap; letter-spacing: 0; }
  html:root body table.scorecard-mobile th.sm-tee, html:root body table.scorecard-mobile td.sm-dist { width: calc((100% - 76px) / var(--n-tees, 9)) !important; }
  html:root body table.scorecard-mobile tbody tr td.sm-hole { background: #1E5C9B !important; color: #fff !important; }
  html:root body table.scorecard-mobile tbody tr.sm-subtotal td { background: #1E5C9B !important; color: #fff !important; }
  html:root body table.scorecard-mobile tbody tr.sm-total td { background: #1B6B2F !important; color: #fff !important; }
}

/* g) Demande de parcours / création : aides sous le libellé, en casse normale, lisibles. */
html:root body .form-group > small.pf-field-hint {
  display: block; font-size: 0.85rem; font-weight: normal; letter-spacing: normal; text-transform: none; color: #3a4252; margin: 0 0 4px; line-height: 1.3;
}

/* h) Stats > Personnaliser : zone tactile des interrupteurs ≥ 44 px (le dessin reste 44 × 24), focus visible, boutons Monter/Descendre. */
html:root body .perso-toggle::after { content: ''; position: absolute; inset: -10px -4px; }
html:root body .perso-toggle input:focus-visible + .slider { outline: 3px solid #1E5C9B; outline-offset: 2px; }
html:root body .perso-item { min-height: 48px; }
html:root body .perso-move-btns { display: inline-flex; gap: 2px; flex-shrink: 0; }
html:root body .perso-move {
  min-width: 44px; min-height: 44px; border: 1px solid #c9d3e3; background: #fff; color: #1E5C9B; border-radius: 6px; font-size: 0.9rem; cursor: pointer;
}
html:root body .perso-move:hover, html:root body .perso-move:focus-visible { background: #eef3fa; outline: 2px solid #1E5C9B; }
@media (max-width: 600px) { html:root body .perso-item { gap: 6px; padding-left: 6px; padding-right: 6px; } html:root body .perso-item .drag-handle { display: none; } }

/* ── Audit 05/12 : entraînement (attack, bunker, drapeaux, driver-piste, étalonnage, putting, short-game, save-par, practice, trainings) — 05/12/2026 ── */
/* Retours : zone tactile ≥ 44×44 (le nom accessible est posé dans les vues) */
html:root body a.btn-secondary.pf-back-link,
html:root body .page-header a.btn-secondary.pf-back-link {
  min-width: 44px !important; width: auto; min-height: 44px !important; height: auto; box-sizing: border-box;
  display: inline-flex; align-items: center; justify-content: center;
}
/* Formulaires d'exercice : Date / Lieu / Commentaire ne doivent plus être écrasés (17–19 px) */
html:root body :is(.pl-field-row, .pp-field-row, .sg-field-row) input:not([type=checkbox]):not([type=radio]):not([type=hidden]) {
  min-height: 44px; padding: 10px 12px; box-sizing: border-box; font-size: 1rem; line-height: 1.3;
}
html:root body .cc-fields-row :is(input, textarea) { min-height: 44px; box-sizing: border-box; }
/* Compteurs de balles : vrais boutons (clavier, focus visible), cible ≥ 44 px */
html:root body button.pl-score-cell {
  font-family: inherit; color: inherit; line-height: 1.2; cursor: pointer;
  min-height: 44px; min-width: 44px; box-sizing: border-box; justify-content: center; align-items: center;
}
html:root body button.pl-score-cell:focus-visible { outline: 3px solid #1E5C9B; outline-offset: 2px; }
/* Petit jeu : boutons de score des 9 exercices */
html:root body .sg-score-btn { min-height: 44px; min-width: 64px; box-sizing: border-box; justify-content: center; }
html:root body .sg-ref-note { margin: 10px 0 0; font-size: .85rem; line-height: 1.35; color: #333; }
/* Tableau de saisie du putting longue distance : défilement local plutôt que colonnes hors champ */
html:root body .pl-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
@media (max-width: 600px) {
  html:root body .pl-table-scroll .pl-scores-table { width: 100%; }
  html:root body .pl-table-scroll .pl-scores-table th { white-space: normal; font-size: .62rem; line-height: 1.1; padding-left: 1px !important; padding-right: 1px !important; }
  html:root body .pl-table-scroll .pl-scores-table td { padding-left: 1px !important; padding-right: 1px !important; }
  html:root body .pl-table-scroll button.pl-score-cell { min-width: 44px; padding: 4px 3px !important; }
  html:root body .pl-table-scroll button.pl-score-cell .pl-den { display: none; }
}
/* Tableau des règles : la colonne des points ne passe plus à la ligne (« 0 pt ») */
html:root body .pf-rules-table td:last-child { white-space: nowrap; min-width: 3.5em; }
/* Étalonnage : introduction sur panneau opaque (lisible sur la photo de fond) */
html:root body .pf-note.pf-note-panel {
  background: #fff; color: #222; border: 1px solid #c9d3e3; border-radius: 10px; padding: 12px 16px;
  font-size: .95rem; line-height: 1.45; box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
/* Practice : raccourcis d'exercices en grille régulière, cibles ≥ 44 px */
html:root body .practice-modules-legend { gap: 10px; }
html:root body .practice-modules-legend a { min-height: 44px; padding: 10px 14px; box-sizing: border-box; line-height: 1.2; }
@media (max-width: 600px) {
  html:root body .practice-modules-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
