/* ================= ADAPTATION MOBILE ET TABLETTE ================= */
html{-webkit-text-size-adjust:100%;}
.main{min-width:0;} .content{min-width:0;}
img,svg,canvas{max-width:100%;}
.boot{display:flex;align-items:center;justify-content:center;min-height:100vh;min-height:100dvh;width:100%;flex-direction:column;gap:14px;font-family:var(--font-body);color:var(--slate);font-size:13px;padding:20px;text-align:center;}
.boot-spin{width:46px;height:46px;border-radius:50%;border:4px solid #eee;border-top-color:var(--red);animation:boot 1s linear infinite;}
@keyframes boot{to{transform:rotate(360deg);}}
#loginGate{overflow-y:auto;padding:16px;} #loginGate > div{margin:auto;}
body.is-offline .topbar{border-bottom-color:var(--bad) !important;}
.bottom-nav{display:none;}

/* ---- Tablette ---- */
@media(max-width:1100px){
  .panel:has(> table){overflow-x:auto;}
  .panel:has(> table .annu-pop){overflow:visible !important;}
}
@media(max-width:900px){
  .main{width:100%;}
  .adm-nav{max-width:100%;-webkit-overflow-scrolling:touch;}
  .adm-shell > *{min-width:0;}
  .content [style*="display:grid"] > *{min-width:0;}
}

/* ---- Téléphone ---- */
@media(max-width:720px){
  body{padding-bottom:calc(62px + env(safe-area-inset-bottom));}
  #app{min-height:auto;}
  .topbar{padding-left:max(14px,env(safe-area-inset-left)) !important;padding-right:max(14px,env(safe-area-inset-right)) !important;}
  .topbar-user{padding:2px !important;}
  .panel-pad{padding:16px 14px;}
  .content .panel{max-width:100%;}
  .content [style*="display:flex"]:not(.topbar *){flex-wrap:wrap;}
  .content [style*="display:grid"]:not(.adm-shell){grid-template-columns:minmax(0,1fr) !important;}
  .grid-4{grid-template-columns:repeat(2,minmax(0,1fr)) !important;gap:10px;}
  .stat-card{padding:14px;} .stat-value{font-size:24px;} .stat-label{font-size:10.5px;}
  .section-title{flex-wrap:wrap;gap:8px;min-width:0;}
  .pp-mark em{width:78px;left:-39px;} .pp-mark:last-of-type em{left:auto;right:-8px;text-align:right;}
  .pp-mark em{white-space:nowrap;} .pp-track .pp-mark:nth-child(3) em{left:auto;right:6px;text-align:right;} .pp-track .pp-mark:nth-child(4) em{bottom:60px;left:-60px;width:120px;text-align:center;right:auto;} .pp-wrap{padding-top:72px !important;}
  .scope-bar .scope-sel:disabled{display:none;} .mp-hero .close-x,.mp-hero .close-x svg{color:#fff !important;}
  .admin-detail,.profil-body{animation:none;}
  .parr-facts,.parr-head > *{min-width:0;}
  .scope-bar{padding:12px !important;} .scope-bar .scope-sel{flex:1 1 100%;width:100%;} .scope-lab{flex:1 1 100%;}
  .struct-seg,.seg{display:flex;max-width:100%;overflow-x:auto;} .struct-seg-item{white-space:nowrap;flex:1 0 auto;text-align:center;padding:10px 12px;}
  .toolbar > select,.toolbar > .btn{flex:1 1 auto;}
  .membercard{max-width:100%;}

  /* iOS n'agrandit pas la page au focus à partir de 16 px */
  input:not([type=checkbox]):not([type=radio]):not([type=color]),select,textarea{font-size:16px !important;max-width:100%;}
  .btn{min-height:42px;}
  .close-x{width:42px !important;height:42px !important;}

  /* Tableaux présentés en fiches */
  table.as-cards,table.as-cards tbody{display:block;width:100%;}
  table.as-cards thead{display:none;}
  table.as-cards.has-filters thead{display:block;position:relative;z-index:5;}
  table.as-cards.has-filters thead tr{display:flex;flex-wrap:wrap;gap:6px;padding:10px 12px;background:var(--paper);border-bottom:1px solid var(--line);}
  table.as-cards.has-filters thead th{display:inline-flex;align-items:center;gap:4px;border:1px solid var(--line);border-radius:99px !important;background:#fff;padding:7px 12px;position:static;}
  table.as-cards.has-filters thead th:empty{display:none;}
  table.as-cards.has-filters .annu-funnel{padding:6px;margin:-6px -6px -6px 0;}
  table.as-cards.has-filters .annu-pop{left:12px !important;right:12px !important;max-width:none;top:calc(100% - 4px);}
  table.as-cards.has-filters .annu-pop input,table.as-cards.has-filters .annu-pop select{width:100%;}
  table.as-cards tbody tr{display:block;padding:12px 14px;border-bottom:1px solid var(--line);}
  table.as-cards tbody td{display:flex;justify-content:space-between;align-items:center;gap:14px;border:none;padding:5px 0 !important;text-align:right !important;white-space:normal !important;min-width:0;overflow-wrap:anywhere;width:auto !important;}
  table.as-cards tbody td::before{content:attr(data-label);color:var(--slate);font-size:12px;font-weight:600;text-align:left;flex:none;max-width:45%;}
  table.as-cards tbody td:not([data-label])::before,table.as-cards tbody td.no-label::before{content:none;}
  table.as-cards tbody td.no-label{display:block;text-align:left !important;}
  table.as-cards tbody td.cell-main{font-size:15px;padding-bottom:8px !important;}
  table.as-cards tbody td:empty{display:none;}
  table.as-cards tbody td > div{max-width:100%;}
  .panel:has(> table.as-cards){overflow:visible;}

  /* Fenêtres en plein écran, actions toujours visibles */
  .modal-overlay{padding:0 !important;align-items:stretch !important;z-index:450 !important;}
  .modal{width:100% !important;max-width:100% !important;min-height:100%;border-radius:0 !important;display:flex;flex-direction:column;}
  .modal-header{border-radius:0 !important;padding:12px 16px !important;z-index:6;}
  .modal-body{padding:16px !important;flex:1;min-width:0;overflow-x:hidden;}
  .modal-foot{position:sticky;bottom:0;background:#fff;z-index:6;flex-wrap:wrap;padding:10px 16px calc(10px + env(safe-area-inset-bottom)) !important;}
  .modal-foot .btn{flex:1 1 auto;justify-content:center;}
  .modal-body [style*="display:grid"]{grid-template-columns:minmax(0,1fr) !important;}
  .modal-body [style*="display:flex"]{flex-wrap:wrap;} .modal-body [style*="min-width"]{min-width:0 !important;}

  /* Barre de navigation basse */
  .bottom-nav{display:flex;position:fixed;left:0;right:0;bottom:0;z-index:300;background:#fff;border-top:1px solid var(--line);padding-bottom:env(safe-area-inset-bottom);}
  .bottom-nav button{flex:1;min-width:0;min-height:60px;border:none;background:none;font:700 10.5px var(--font-body);color:var(--slate);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;padding:0 2px;cursor:pointer;}
  .bottom-nav button span{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
  .bottom-nav button svg{width:20px;height:20px;} .bottom-nav button.on{color:var(--red);}
  .bottom-nav .bn-menu{font-size:20px;line-height:20px;}
  .toast-wrap{left:12px !important;right:12px !important;bottom:calc(74px + env(safe-area-inset-bottom)) !important;}
  .app-foot{padding-left:14px !important;padding-right:14px !important;}
}
@media(max-width:360px){ .grid-4{grid-template-columns:1fr !important;} }
@media(prefers-reduced-motion:reduce){ *{animation-duration:.01ms !important;transition-duration:.01ms !important;} }
@media print{ .bottom-nav{display:none !important;} body{padding:0 !important;} }
/* ---- Ajustements communs ---- */
.pp-track .pp-mark:nth-child(5) em{left:auto;right:-8px;text-align:right;}
.admin-detail,.profil-body{animation:none;}
@media(max-width:720px){ .btn{max-width:100%;white-space:normal;} [class*="map-leg"],[class*="map-legend"]{flex-wrap:wrap !important;width:calc(100% - 24px);justify-content:center;} }

/* ---- Pagination des listes ---- */
.list-pager{display:flex;align-items:center;justify-content:center;gap:12px;padding:12px;} .list-pager .meta{font-size:12.5px;color:var(--slate);}

/* ---- Téléphone en paysage : fenêtres plein écran, actions visibles ---- */
@media(max-height:520px) and (min-width:721px){
  .modal-overlay{padding:0 !important;align-items:stretch !important;z-index:450 !important;}
  .modal{width:100% !important;max-width:100% !important;min-height:100%;border-radius:0 !important;display:flex;flex-direction:column;}
  .modal-header{border-radius:0 !important;padding:8px 16px !important;z-index:6;}
  .modal-body{padding:14px 16px !important;flex:1;min-width:0;}
  .modal-foot{position:sticky;bottom:0;background:#fff;z-index:6;padding:8px 16px !important;}
  .close-x{width:40px !important;height:40px !important;}
  input:not([type=checkbox]):not([type=radio]):not([type=color]),select,textarea{font-size:16px !important;}
  .topbar{padding-top:6px !important;padding-bottom:6px !important;}
}
/* ---- Zones tactiles ---- */
@media(max-width:720px),(pointer:coarse),(max-height:520px){
  .btn-sm,.dash-nav-btn,.seg button,.seg.sm button{min-height:40px !important;} .btn{min-height:42px;}
  .icon-btn{min-width:40px;min-height:40px;align-items:center;justify-content:center;} .close-x,.mp-icon{min-width:40px;min-height:40px;}
  .annu-funnel{min-width:40px;min-height:40px;align-items:center;justify-content:center;margin:-8px -10px -8px 0 !important;padding:0 !important;}
  .annu-lab{display:inline-flex;align-items:center;min-height:32px;}
}
@media(max-width:720px){ table.as-cards.has-filters thead th{padding:0 2px 0 12px;} table.as-cards.has-filters thead .annu-funnel{margin:0 !important;} }
