/* =====================================================================
   EASY JARDIN — AJUSTEMENT À L'ÉCRAN (aucune barre de défilement visible)
   - La page est verrouillée sur la hauteur de la fenêtre (100dvh).
   - Menu latéral et en-tête restent fixes ; seule la zone de contenu glisse
     (molette / doigt) quand une page est plus longue que l'écran, sans barre visible.
   - Le tableau de bord tient entièrement dans l'écran sur ordinateur.
   ===================================================================== */
@media screen {
  html:has(body.ej-app){height:100%;overflow:hidden}
  body.ej-app{height:100vh;height:100dvh;overflow:hidden;display:flex;flex-direction:column}
  body.ej-app>.env-banner{position:relative;top:auto;flex:0 0 auto}
  body.ej-app .ej-shell{flex:1 1 auto;min-height:0}

  /* Zone de contenu = seul conteneur qui défile */
  body.ej-app .ej-main{height:100%;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scroll-behavior:smooth}
  body.ej-app .ej-topbar,body.ej-app.has-env-banner .ej-topbar{top:0}

  /* Aucune barre de défilement visible dans l'application */
  body.ej-app,body.ej-app *{scrollbar-width:none}
  body.ej-app ::-webkit-scrollbar{display:none;width:0;height:0}
}

/* Ordinateur : menu latéral sur toute la hauteur disponible */
@media screen and (min-width: 992px) {
  body.ej-app .ej-sidebar,body.ej-app.has-env-banner .ej-sidebar{position:relative;top:0;height:100%}
}
@media screen and (min-width: 992px) and (max-height: 820px) {
  body.ej-app .sidebar-photo{display:none}
}
@media screen and (min-width: 992px) and (max-height: 640px) {
  body.ej-app .ej-sidebar .school-chip{display:none}
}

/* Mobile : le menu glissant couvre toute la hauteur de l'écran */
@media screen and (max-width: 991.98px) {
  body.ej-app .ej-sidebar,body.ej-app.has-env-banner .ej-sidebar{height:100vh;height:100dvh}
  body.with-bottom-nav .ej-main{padding-bottom:0}
}

/* =====================================================================
   TABLEAU DE BORD — grille plein écran
   ===================================================================== */
.dash-fit{display:flex;flex-direction:column;gap:1rem}
.dash-hero{display:flex;align-items:center;justify-content:space-between;gap:1rem;flex-wrap:wrap;margin:0!important}
.dash-hero .content{max-width:none;flex:1 1 420px}
.dash-hero .dash-filters{position:relative;z-index:2;display:flex;gap:.5rem;flex-wrap:wrap}
.dash-hero .dash-filters .form-select{background-color:rgba(255,255,255,.95);border:0;min-width:170px}
.dash-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:1rem}
.dash-grid{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:1rem}
.dash-grid>.card{grid-column:span 12;display:flex;flex-direction:column;min-height:0;margin:0}
.dash-grid .card-body{flex:1 1 auto;min-height:0}
.dash-grid .chart-box{position:relative;height:240px}
.dash-grid .chart-box.sm{height:200px}
.dash-grid .card-scroll{flex:1 1 auto;min-height:0;overflow:auto}
.dash-grid .level-stats{display:flex;justify-content:space-around;gap:.5rem;flex-wrap:wrap;margin-top:.6rem;font-size:.78rem}
.dash-grid .assess{display:flex;gap:.6rem;margin-bottom:.8rem}
.dash-grid .assess>div{flex:1;padding:.6rem;border-radius:14px;text-align:center}
.dash-grid .assess .kpi-value{font-size:1.3rem}

@media (min-width: 768px){
  .dash-grid>.c-trend,.dash-grid>.c-classes{grid-column:span 12}
  .dash-grid>.c-levels,.dash-grid>.c-alerts,.dash-grid>.c-pay,.dash-grid>.c-activity{grid-column:span 6}
}
@media (max-width: 991.98px){ .dash-kpis{grid-template-columns:repeat(2,minmax(0,1fr))} }
@media (max-width: 575.98px){
  .dash-fit,.dash-kpis,.dash-grid{gap:.7rem}
  .dash-hero .dash-filters{width:100%}
  .dash-hero .dash-filters form,.dash-hero .dash-filters .form-select{flex:1;min-width:0}
  .dash-kpis .kpi{padding:.8rem}
  .dash-kpis .kpi .kpi-value{font-size:1.35rem}
  .dash-kpis .kpi .kpi-ico{width:38px;height:38px;font-size:1.05rem;margin-bottom:.45rem}
}

/* Ordinateur : TOUT le tableau de bord tient dans l'écran (hauteur calculée par fit.js) */
@media screen and (min-width: 1200px) and (min-height: 640px) {
  .dash-fit.is-fit{height:var(--fit-h,auto);gap:clamp(.55rem,1.3vh,1rem)}
  .dash-fit.is-fit .dash-hero{flex:0 0 auto;flex-wrap:nowrap;padding:clamp(.7rem,1.8vh,1.4rem) clamp(1rem,1.6vw,1.8rem)}
  .dash-fit.is-fit .dash-hero h1{font-size:clamp(1.15rem,2.6vh,1.65rem);margin:.15rem 0 .3rem!important}
  .dash-fit.is-fit .dash-hero p{margin-bottom:clamp(.3rem,1vh,.8rem)!important;font-size:.85rem}
  .dash-fit.is-fit .dash-hero .stat{padding:clamp(.3rem,.8vh,.6rem) .8rem}
  .dash-fit.is-fit .dash-hero .stat b{font-size:clamp(1rem,2vh,1.3rem)}
  .dash-fit.is-fit .dash-hero .hero-img{width:30%}
  .dash-fit.is-fit .dash-kpis{flex:0 0 auto;gap:clamp(.55rem,1.3vh,1rem)}
  .dash-fit.is-fit .dash-kpis .kpi{display:grid;grid-template-columns:auto 1fr;grid-template-rows:auto auto auto;column-gap:.85rem;align-items:center;padding:clamp(.55rem,1.4vh,1.1rem) clamp(.8rem,1vw,1.2rem)}
  .dash-fit.is-fit .dash-kpis .kpi .kpi-ico{grid-row:1/3;margin:0;width:clamp(36px,4.6vh,48px);height:clamp(36px,4.6vh,48px);font-size:clamp(.95rem,1.9vh,1.3rem)}
  .dash-fit.is-fit .dash-kpis .kpi .kpi-value{font-size:clamp(1.15rem,2.7vh,1.75rem)}
  .dash-fit.is-fit .dash-kpis .kpi .kpi-trend{grid-column:1/3;justify-self:start;margin-top:clamp(.25rem,.8vh,.6rem)}
  .dash-fit.is-fit .dash-grid{flex:1 1 auto;min-height:0;grid-template-rows:minmax(0,1fr) minmax(0,1fr);gap:clamp(.55rem,1.3vh,1rem)}
  .dash-fit.is-fit .dash-grid>.c-trend{grid-column:span 5}
  .dash-fit.is-fit .dash-grid>.c-levels{grid-column:span 3}
  .dash-fit.is-fit .dash-grid>.c-alerts{grid-column:span 4}
  .dash-fit.is-fit .dash-grid>.c-classes{grid-column:span 5}
  .dash-fit.is-fit .dash-grid>.c-pay{grid-column:span 4}
  .dash-fit.is-fit .dash-grid>.c-activity{grid-column:span 3}
  .dash-fit.is-fit .dash-grid .card-header{padding:clamp(.45rem,1.1vh,.9rem) 1rem}
  .dash-fit.is-fit .dash-grid .section-title{font-size:clamp(.85rem,1.6vh,1rem)}
  .dash-fit.is-fit .dash-grid .section-title .ico{width:clamp(26px,3.2vh,34px);height:clamp(26px,3.2vh,34px)}
  .dash-fit.is-fit .dash-grid .card-body{display:flex;flex-direction:column;padding:clamp(.5rem,1.2vh,1.1rem) 1rem;overflow:auto}
  .dash-fit.is-fit .dash-grid .chart-box,.dash-fit.is-fit .dash-grid .chart-box.sm{flex:1 1 auto;height:auto;min-height:60px}
  .dash-fit.is-fit .dash-grid .table>thead th{padding:.45rem .8rem;position:sticky;top:0;z-index:1}
  .dash-fit.is-fit .dash-grid .table>tbody td{padding:clamp(.3rem,.8vh,.6rem) .8rem}
  .dash-fit.is-fit .dash-grid .empty-state{padding:.6rem}
  .dash-fit.is-fit .dash-grid .empty-state .ico{width:clamp(40px,6vh,64px);height:clamp(40px,6vh,64px);font-size:1.4rem;margin-bottom:.4rem}
  .dash-fit.is-fit .dash-grid .timeline li{padding-bottom:clamp(.4rem,1vh,1rem)}
  .dash-fit.is-fit .dash-grid .assess>div{padding:clamp(.35rem,.9vh,.7rem)}
  .dash-fit.is-fit .dash-grid .assess .kpi-value{font-size:clamp(1rem,2.2vh,1.4rem)}
}
@media screen and (min-width: 1200px) and (min-height: 640px) and (max-height: 820px) {
  .dash-fit.is-fit .dash-hero .hero-meta,.dash-fit.is-fit .dash-kpis .kpi .kpi-trend,.dash-fit.is-fit .level-stats{display:none}
}
@media screen and (min-width: 1200px) and (min-height: 640px) and (max-height: 720px) {
  .dash-fit.is-fit .dash-hero .stat{display:none}
}

/* En-tête : jamais de débordement horizontal sur téléphone */
body.ej-app .ej-topbar .tb-title{flex:1 1 0;min-width:0}
body.ej-app .ej-topbar .page-heading{min-width:0}
@media (max-width: 575.98px){
  body.ej-app .ej-topbar{gap:.3rem;padding:0 .5rem}
  body.ej-app .ej-topbar .topbar-btn,body.ej-app .ej-topbar .ej-cmd-trigger{width:36px;height:36px;min-width:36px;padding:0;justify-content:center}
  body.ej-app .ej-topbar .user-pill{padding:.15rem}
  body.ej-app .ej-topbar .page-heading .ph-ico{display:none}
}
@media (max-width: 359.98px){ body.ej-app .ej-topbar .tb-title{display:none} }
/* Tablette / petit portable : en-tête allégé pour ne jamais déborder */
@media (max-width: 1279.98px){
  body.ej-app .ej-topbar .tb-env{display:none!important}
  body.ej-app .ej-topbar .user-pill>.d-md-block,body.ej-app .ej-topbar .user-pill>.chev{display:none!important}
  body.ej-app .ej-topbar .ej-cmd-trigger kbd{display:none!important}
}
