/* Adaptation commune des écrans Ny Ravo aux téléphones et tablettes. */
*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{max-width:100%;overflow-x:hidden}
img,svg,video,canvas{max-width:100%;height:auto}
input,select,textarea,button{max-width:100%;font:inherit}
textarea{resize:vertical}
.table-wrap,.site-table-wrap,.dashboard-table-wrap,[class*="table-wrap"]{max-width:100%;max-height:min(68dvh,42rem);overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable;touch-action:pan-x pan-y;contain:layout paint}
.table-wrap::-webkit-scrollbar,.site-table-wrap::-webkit-scrollbar,.dashboard-table-wrap::-webkit-scrollbar,[class*="table-wrap"]::-webkit-scrollbar{width:12px;height:12px}
.table-wrap::-webkit-scrollbar-track,.site-table-wrap::-webkit-scrollbar-track,.dashboard-table-wrap::-webkit-scrollbar-track,[class*="table-wrap"]::-webkit-scrollbar-track{background:#e7edf5}
.table-wrap::-webkit-scrollbar-thumb,.site-table-wrap::-webkit-scrollbar-thumb,.dashboard-table-wrap::-webkit-scrollbar-thumb,[class*="table-wrap"]::-webkit-scrollbar-thumb{background:#66788f;border:3px solid #e7edf5;border-radius:999px}
table{border-collapse:collapse}
dialog,.modal,.modal-content,[role="dialog"]{max-width:calc(100vw - 2rem);max-height:calc(100dvh - 2rem);overflow:auto}

@media (max-width:768px){
  body{margin:0;font-size:16px}
  header{display:flex;flex-wrap:wrap;gap:.75rem;padding:.85rem 1rem;align-items:flex-start}
  header>div{display:flex;flex-wrap:wrap;gap:.55rem;width:100%;align-items:center}
  header a,header button{min-height:2.75rem;display:inline-flex;align-items:center}
  main{width:100%;max-width:none!important;margin:0!important;padding:1rem!important}
  section,.dashboard-shell,.dashboard-panel{width:100%;max-width:none!important;padding:1rem!important;border-radius:.65rem}
  h1{font-size:clamp(1.5rem,7vw,2rem);line-height:1.15;overflow-wrap:anywhere}
  h2{font-size:1.25rem;line-height:1.25}
  p,label,td,th,a,button{overflow-wrap:anywhere}
  form,.filter-grid,.filters,.filter-actions,.section-title{max-width:100%}
  .filter-grid,.filters{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:.75rem!important}
  .filter-actions,.section-title{display:flex;flex-wrap:wrap;gap:.65rem}
  label{min-width:0!important;width:100%}
  input,select,textarea{width:100%;min-width:0;min-height:2.75rem}
  button{min-height:2.75rem;white-space:normal}
  .filter-actions button,.section-title button,form>button{width:100%}
  .metrics,.cards,.menu-grid,.admin-grid{grid-template-columns:minmax(0,1fr)!important}
  .table-wrap,.site-table-wrap,.dashboard-table-wrap,[class*="table-wrap"]{height:auto;max-height:62dvh;border:1px solid #cbd5e1;border-radius:.55rem}
  table{width:max-content!important;min-width:100%!important}
  th,td{min-width:8.5rem;padding:.7rem!important}
  thead th{position:sticky;top:0;z-index:4}
  /* Une cellule figée par ligne crée des centaines de couches dans Android
     WebView. Sur mobile, seul l’en-tête reste figé pour préserver la mémoire. */
  th:first-child,td:first-child{position:static!important;left:auto!important}
  thead th:first-child{position:sticky!important;top:0;z-index:5}
  .nyravo-live{right:.65rem!important;top:.65rem!important}
  .nyravo-panel{width:calc(100vw - 1.3rem)!important;max-height:calc(100dvh - 5rem);overflow:auto}
  #position-map{height:min(55vh,360px)!important}
}

@media (max-width:420px){
  main{padding:.65rem!important}
  section,.dashboard-shell,.dashboard-panel{padding:.75rem!important}
  header strong{width:100%}
  header a,header button{width:100%;justify-content:center}
  dialog,.modal,.modal-content,[role="dialog"]{max-width:calc(100vw - 1rem);max-height:calc(100dvh - 1rem)}
}

@media (orientation:landscape) and (max-height:520px){
  dialog,.modal,.modal-content,[role="dialog"]{max-height:calc(100dvh - 1rem)}
  .nyravo-panel{max-height:calc(100dvh - 4rem)}
}
.rank-column{width:4.5rem;min-width:4.5rem;text-align:center!important;font-variant-numeric:tabular-nums}
