/* Telephone : corrections d'affichage chargees EN DERNIER sur chaque page.
   Mesure de reference : ecran de 390 px (iPhone 12 a 15, la plupart des
   Android). Objectifs : rien ne deborde, titres et chiffres a taille de
   telephone, boutons compacts mais faciles a toucher (36-44 px), champs a
   16 px (sinon l'iPhone zoome), formulaires et fenetres centres. */

/* Partout : un champ sous 16 px fait zoomer l'iPhone quand on le touche. */
@media (max-width:820px){
  input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=range]),select,textarea{font-size:max(16px,1em)}
}

@media (max-width:820px){
  /* ---------- Application (app.html) ---------- */
  #appRoot .wrap{min-width:0}
  #appRoot h1{font-size:22px;line-height:1.2}
  #appRoot h2{font-size:18px}
  #appRoot h3{font-size:16px}
  #appRoot .page-head{gap:12px}
  #appRoot .page-head h1,#appRoot .page-head + div h1{font-size:21px}
  #appRoot .page-head .ico{width:40px!important;height:40px!important;flex:none}
  #appRoot .big{font-size:32px}

  /* Onglets : une seule ligne qui defile au doigt, au lieu d'un gros bloc
     de boutons sur plusieurs lignes. */
  #appRoot .tabs,#modalRoot .tabs{display:flex;flex-wrap:nowrap!important;width:100%;max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:none;-webkit-overflow-scrolling:touch;scroll-snap-type:x proximity}
  #appRoot .tabs::-webkit-scrollbar,#modalRoot .tabs::-webkit-scrollbar{display:none}
  #appRoot .tabs button,#modalRoot .tabs button{flex:0 0 auto;white-space:nowrap;min-height:36px;padding:8px 12px;font-size:13px;scroll-snap-align:start}

  /* Boutons : compacts, texte sur une ligne */
  #appRoot .btn,#modalRoot .btn{min-height:38px;padding:8px 14px;font-size:13.5px;gap:6px}
  #appRoot .btn.sm,#modalRoot .btn.sm{min-height:34px;padding:6px 11px;font-size:12.5px}
  #appRoot .btn.buy,#modalRoot .btn.buy{padding:10px 14px;font-size:14px}

  /* Actions d'un routeur : grille reguliere de 2 colonnes */
  #appRoot .item:has(> .ico.c-cyan) > .row:last-child{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  #appRoot .item:has(> .ico.c-cyan) > .row:last-child .btn{width:100%;justify-content:center;overflow:hidden;text-overflow:ellipsis}

  /* Champs : 16 px (pas de zoom iPhone), hauteur raisonnable */
  #appRoot .field input,#appRoot .field select,#appRoot .field textarea,
  #modalRoot .field input,#modalRoot .field select,#modalRoot .field textarea{font-size:16px;padding:9px 12px}
  #appRoot input:not([type=checkbox]):not([type=radio]):not([type=color]),#appRoot select,#appRoot textarea,
  #modalRoot input:not([type=checkbox]):not([type=radio]):not([type=color]),#modalRoot select,#modalRoot textarea{font-size:16px;max-width:100%}
  #appRoot .field label,#modalRoot .field label{font-size:13px}

  /* Chiffres clefs */
  #appRoot .kpi-v{font-size:22px}
  #appRoot .kpi .label{font-size:10px}
  #appRoot .price{font-size:22px}
  #appRoot .stat3 strong,#appRoot .card strong[style*="font-size"]{font-size:18px!important}
  #appRoot code{font-size:inherit}

  /* Tableaux larges : ils defilent dans leur carte au lieu d'etre coupes */
  #appRoot table:not(.journal),#modalRoot table:not(.journal){display:block;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
  #appRoot table:not(.journal) td,#appRoot table:not(.journal) th{white-space:nowrap}

  /* Atelier : tuiles moins hautes */
  #appRoot .at-card{padding:14px!important;gap:6px!important}
  #appRoot .at-card p,#appRoot .at-card .small{font-size:12.5px}

  /* Hotspot : tuiles de forfait et modeles de ticket plus compacts */
  #appRoot .tarif{padding:8px 10px}
  #appRoot .tarif .tp{font-size:15px}
  #appRoot .tarif .ts{font-size:16px}

  /* Fenetres : contenu centre, boutons d'action pleine largeur en bas */
  #modalRoot .modal h2{font-size:18px}
  /* En-tete : titre long sur 2 lignes au plus, croix toujours a droite */
  #modalRoot .modal-head{flex-wrap:nowrap!important;align-items:flex-start}
  #modalRoot .modal-head > :first-child{min-width:0;font-size:16px;line-height:1.3;overflow-wrap:anywhere}
  #modalRoot .modal-head > .btn:last-child,#modalRoot .modal-head > .x:last-child{flex:none}
  #modalRoot .modal form,#modalRoot .modal .stack{margin-inline:auto;width:100%}
  #modalRoot .modal form > .btn:last-child,#modalRoot .modal form > .row:last-child .btn{justify-content:center}
  #modalRoot .modal form > .btn:last-child{width:100%}
}

@media (max-width:420px){
  #appRoot .card{padding:14px}
  #appRoot .big{font-size:30px}
  #appRoot .bal-actions .btn{font-size:12px}
}

/* ---------- Page de connexion / creation de compte ---------- */
@media (max-width:620px){
  .auth h1,.auth-title,#authTitle{font-size:23px!important;line-height:1.2}
}

/* ---------- Site public (decouvrir, conditions, confidentialite...) ---------- */
@media (max-width:620px){
  .top .acts .btn{white-space:nowrap;padding:8px 14px;font-size:13px}
  .hero h1{font-size:clamp(26px,7.6vw,30px)!important;line-height:1.15}
  .hero p{font-size:15px}
  section.block h2,.block h2{font-size:clamp(21px,6vw,24px)!important}
  .hero .cta .btn,section .btn{min-height:44px;padding:11px 18px;font-size:15px}
  .doc{padding-top:32px}
  .doc h1{font-size:24px}
  .doc h2{font-size:18px;margin-top:26px}
  .doc p,.doc li{font-size:15px}
}

@media (max-width:380px){
  .top .acts .btn{padding:7px 10px;font-size:12px}
  .top .wrap{gap:8px}
  .top .brand,.top a:first-child{min-width:0}
  .top img{max-width:100%;height:auto}
}

/* ---------- Anciennes pages (Vente en ligne admin, impression...) ---------- */
@media (max-width:720px){
  .app-shell .sidebar{scrollbar-width:none}
  .app-shell .sidebar::-webkit-scrollbar{display:none}
  .app-shell .sidebar-nav a{font-size:13px;padding:8px 10px}
  .main-content{padding:16px!important}
  .main-content .page-title,.main-content h1{font-size:22px}
  .main-content .card{padding:16px}
  .main-content .card h2{font-size:18px;line-height:1.25}
  .main-content input,.main-content select,.main-content textarea{font-size:16px;width:100%;max-width:100%}
  .main-content button{min-height:40px;font-size:14px}
  .main-content form[style*="grid-template-columns"]{grid-template-columns:1fr 1fr!important}
  .main-content pre{white-space:pre-wrap;word-break:break-all;font-size:12px}
  .main-content fieldset{min-width:0}
}

/* ---------- Achat d'un ticket par le client du WiFi ---------- */
@media (max-width:620px){
  .shop h1,#shop-name{font-size:22px}
  .forfaits button,.forfait{min-height:44px}
}

/* ---------- Audit mobile du 21/11/2026 (audit-mobile.js, ecran de 360 px) ---------- */
@media (max-width:820px){
  /* Menu du bas : 9 a 11 rubriques ne tiennent pas en 360 px (libelles coupes
     « Acc… »). Il defile au doigt, chaque rubrique garde son libelle entier. */
  .nav{overflow-x:auto;justify-content:flex-start;scrollbar-width:none;-webkit-overflow-scrolling:touch;scroll-snap-type:x proximity}
  .nav::-webkit-scrollbar{display:none}
  .nav button{flex:1 0 62px;scroll-snap-align:start}
  .nav .lbl-short{font-size:11px;overflow:visible;text-overflow:clip}

  /* Atelier : tuiles d'outils en ligne (icone a gauche, texte a droite),
     au lieu de grands blocs de 170 px de haut. */
  #appRoot .at-card{display:grid!important;grid-template-columns:38px minmax(0,1fr);column-gap:12px!important;row-gap:2px!important;align-items:start;padding:12px 14px!important}
  #appRoot .at-card > .ico{grid-row:1 / span 3}

  /* Hotspot : modeles de ticket sur 2 colonnes (5 grands blocs les uns sous les autres sinon) */
  #appRoot .tpls{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  #appRoot .tplc{padding:6px;min-width:0;overflow:hidden}

  /* Petits boutons faciles a toucher (32 px au moins) */
  .toast .toast-x{min-width:32px;min-height:32px;font-size:18px;display:inline-grid;place-items:center}
  .lbl-row .link{min-height:32px;display:inline-flex;align-items:center}
  .pv-more{padding:8px 0;min-height:32px}

  /* Textes trop petits pour un telephone */
  #appRoot .kpi .label{font-size:11px}
}

/* Barre du haut : nom + 💡 + « Se deconnecter » debordaient (bouton coupe a droite).
   Sous 480 px, le bouton de deconnexion garde seulement son icone (il a son aria-label). */
@media (max-width:480px){
  .side-foot #logoutBtn .long{display:none}
  .side .brand{min-width:0}
}

/* Site public (decouvrir) : titres et prix a taille de telephone */
@media (max-width:620px){
  .head h2,.final h2,.secure h2{font-size:clamp(21px,6vw,24px)!important}
  .price .amount{font-size:28px}
}
