/* V79 — couche responsive commune FGA
   Un seul fichier partagé, sans !important, chargé après les styles de page. */
*,*::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{max-width:100%}
.table-wrap,.table-responsive{width:100%;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
.app-content,.main-content,main,.panel,.card,.settings-card,.history-card{min-width:0;max-width:100%}
.row,.grid,.form-grid,.ap-section-grid{min-width:0}
@media (max-width:1199px){
  .main-content{padding-left:20px;padding-right:20px}
  .page-heading{gap:14px;flex-wrap:wrap}
  .page-heading>div{min-width:0}
}
@media (max-width:991px){
  .app-shell{display:block}
  .app-content{width:100%;margin-left:0}
  .sidebar{transform:translateX(-100%);transition:transform .22s ease;z-index:1050}
  .sidebar.open,.sidebar.active,body.sidebar-open .sidebar{transform:translateX(0)}
  .menu-toggle{display:inline-flex}
  .topbar{padding-left:14px;padding-right:14px}
  .main-content{padding:18px 14px}
  .page-heading{align-items:flex-start}
  .panel-head{gap:10px;flex-wrap:wrap}
  .settings-grid,.dashboard-grid,.governance-grid,.cards-grid{grid-template-columns:1fr}
  .modal-dialog,.modal-content{max-width:calc(100vw - 24px);margin-left:auto;margin-right:auto}
}
@media (max-width:767px){
  .topbar-title span{display:none}
  .topbar-actions{gap:7px}
  .top-status{display:none}
  .main-content{padding:14px 10px}
  .page-heading h1{font-size:1.55rem}
  .page-heading p{font-size:.92rem}
  .page-heading>a,.page-heading>button{width:100%;justify-content:center}
  .panel,.card{border-radius:12px}
  .panel-head{padding-left:14px;padding-right:14px}
  form:not(.inline-form):not(.ap-filters) .field{min-width:0}
  .form-row,.form-grid,.governance-fields,.ap-section-grid{grid-template-columns:1fr}
  .form-actions{display:flex;flex-direction:column;align-items:stretch;gap:9px}
  .form-actions button,.form-actions a{width:100%;justify-content:center;text-align:center}
  .ap-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}
  .ap-effect-grid{grid-template-columns:1fr}
  .ap-filters{display:grid;grid-template-columns:1fr auto auto;gap:8px}
  .update-form-simple{grid-template-columns:1fr}
  .update-form-simple .update-comment,.update-form-simple .update-submit{grid-column:auto;width:100%}
  .notification-popover{right:8px;left:auto;width:min(420px,calc(100vw - 16px))}
  .dash-table{min-width:680px}
}
@media (max-width:479px){
  .topbar{min-height:58px}
  .topbar-title strong{font-size:.92rem}
  .top-avatar{width:32px;height:32px}
  .page-heading h1{font-size:1.35rem}
  .breadcrumb{font-size:.76rem}
  .ap-kpis{grid-template-columns:1fr 1fr}
  .ap-filters{grid-template-columns:1fr auto auto}
  .ap-filters select{grid-column:1/-1}
  .modal-dialog,.modal-content{max-width:calc(100vw - 12px)}
  .modal-body,.modal-header,.modal-footer{padding-left:12px;padding-right:12px}
}
@media (hover:none) and (pointer:coarse){
  button,a.btn,.ap-main-btn,.ap-secondary-btn,.ap-view,.menu-toggle{min-height:44px}
  input,select{min-height:44px}
}

/* V80 — correction ouverture/fermeture sidebar mobile */
@media (max-width:991px){
  body.sidebar-open{overflow:hidden}
  body.sidebar-open .sidebar{transform:translateX(0)}
  body.sidebar-open .app-content::before{
    content:"";position:fixed;inset:0;background:rgba(15,23,42,.38);z-index:1040
  }
  .sidebar{z-index:1050}
  .menu-toggle{position:relative;z-index:1060}
}


/* V96 — Gabarit administratif fixe commun.
   Chargé en dernier sur toutes les interfaces, y compris le tableau de bord :
   topbar fixe + page-heading fixe + contenu entièrement dégagé dessous. */
.fga-admin-dashboard,
.fga-admin-page{
  --fga-admin-topbar-height:76px;
  --fga-admin-heading-height:118px;
  --fga-admin-heading-gap:20px;
}
.fga-admin-dashboard .topbar,
.fga-admin-page .topbar{
  position:fixed;
  top:0;
  left:250px;
  right:0;
  width:auto;
  z-index:40;
}
.fga-admin-dashboard .page-heading,
.fga-admin-page .page-heading{
  position:fixed;
  top:var(--fga-admin-topbar-height);
  left:280px;
  right:30px;
  width:auto;
  max-width:1640px;
  min-height:0;
  margin:0 auto;
  padding:12px 0;
  z-index:35;
  background:var(--bg,#f4f7f8);
}
.fga-admin-dashboard .main-content,
.fga-admin-page .main-content{
  padding-top:calc(var(--fga-admin-topbar-height) + var(--fga-admin-heading-height) + var(--fga-admin-heading-gap));
}
@media(max-width:1100px) and (min-width:901px){
  .fga-admin-dashboard .page-heading,
  .fga-admin-page .page-heading{left:270px;right:20px;}
}
@media(max-width:900px){
  .fga-admin-dashboard,
  .fga-admin-page{
    --fga-admin-topbar-height:64px;
    --fga-admin-heading-height:150px;
    --fga-admin-heading-gap:16px;
  }
  .fga-admin-dashboard .topbar,
  .fga-admin-page .topbar{left:0;right:0;}
  .fga-admin-dashboard .page-heading,
  .fga-admin-page .page-heading{left:14px;right:14px;max-width:none;}
  .fga-admin-dashboard .main-content,
  .fga-admin-page .main-content{
    padding-top:calc(var(--fga-admin-topbar-height) + var(--fga-admin-heading-height) + var(--fga-admin-heading-gap));
  }
}
@media(max-width:650px){
  .fga-admin-dashboard,
  .fga-admin-page{--fga-admin-heading-gap:14px;}
  .fga-admin-dashboard .page-heading,
  .fga-admin-page .page-heading{left:10px;right:10px;}
}

/* V104 — audit responsive global : public + administration. */
html,body{width:100%;min-width:0}
body{overflow-x:clip}
:where(.container,.app-content,.main-content,.panel,.card,.step,.wizard-card,.modal-content,.settings-card,.history-card){min-width:0}
:where(h1,h2,h3,h4,p,strong,small,td,th,a,button){overflow-wrap:break-word}
:where(input,select,textarea){min-width:0}
body:not(.fga-public-home) :where(input,select,textarea){width:100%}
:where(.table-wrap,.table-responsive){overscroll-behavior-inline:contain}

/* Accueil public : responsive géré exclusivement dans app.css (V106). */

/* Parcours public / questionnaires */
@media(max-width:700px){
  .container,.header-inner{width:calc(100% - 20px)}
  .site-grid,.profile-grid,.form-grid{grid-template-columns:minmax(0,1fr)}
  .wizard-card,.profile-section,.step,.signature-box{padding:16px}
  .stepper{overflow-x:auto;scrollbar-width:thin;padding-bottom:14px}
  .stepper-item{flex:0 0 auto}.stepper-item strong,.stepper-item small{white-space:normal}
  .question fieldset{min-width:0;padding:0}.option{align-items:flex-start}
  .qr-panel{align-items:flex-start}.qr-panel>div:last-child{min-width:0}
  .signature-canvas-wrap{height:min(220px,48vw)}
}

/* Administration */
@media(max-width:900px){
  .fga-admin-dashboard .main-content,.fga-admin-page .main-content{padding-left:12px;padding-right:12px}
  .fga-admin-dashboard .page-heading,.fga-admin-page .page-heading{max-width:calc(100vw - 24px)}
  .page-heading{width:auto}.page-heading>*{min-width:0;max-width:100%}
  .topbar{width:100%}.topbar-actions{min-width:0}
  .panel-head,.card-header,.modal-header,.modal-footer{flex-wrap:wrap}
  .modal-dialog{width:calc(100vw - 20px);max-width:none;margin:10px auto}
  .modal-content{max-height:calc(100dvh - 20px);overflow:auto}
  .settings-grid,.dashboard-grid,.governance-grid,.cards-grid,.form-grid,.governance-fields,.ap-section-grid{grid-template-columns:minmax(0,1fr)}
}
@media(max-width:767px){
  .main-content{padding-left:10px;padding-right:10px}
  .page-heading{gap:8px}.page-heading h1{line-height:1.15}.page-heading p{margin-top:4px}
  .page-heading .btn,.page-heading>a,.page-heading>button{max-width:100%}
  .panel,.card,.settings-card,.history-card{max-width:100%;overflow:hidden}
  .panel-body,.card-body{padding-left:12px;padding-right:12px}
  .table-wrap,.table-responsive{margin-left:0;margin-right:0}
  table{width:max-content;min-width:100%}
  .notification-popover{position:fixed;top:64px;left:8px;right:8px;width:auto;max-height:calc(100dvh - 76px);overflow:auto}
  .ap-filters{grid-template-columns:1fr}.ap-filters>*{grid-column:auto;width:100%}
  .form-actions,.modal-footer{display:grid;grid-template-columns:1fr;gap:8px}.form-actions>* ,.modal-footer>*{width:100%}
}
@media(max-width:420px){
  .topbar{padding-left:8px;padding-right:8px}.topbar-actions{gap:4px}.topbar-actions .btn{padding-left:8px;padding-right:8px}
  .fga-admin-dashboard,.fga-admin-page{--fga-admin-heading-height:164px}
  .ap-kpis{grid-template-columns:1fr}
}
