/* SYSTJEM 11.24.0 — Sprint 22-24: compacte iPhone UI, vaste mobiele navigatie, loading + persistent login polish */

.login-remember{display:flex!important;align-items:center!important;gap:9px!important;font-weight:700!important}
.login-remember input{width:20px!important;height:20px!important;flex:0 0 20px!important;margin:0!important}

/* De loader blijft zichtbaar zolang de nieuwe sprint hem expliciet vasthoudt. */
body.systjem-loading-visible .systjem-loader,
body.systjem-page-leaving .systjem-loader{
  opacity:1!important;visibility:visible!important;pointer-events:auto!important;
}
body:not(.systjem-loading-visible):not(.systjem-page-leaving) .systjem-loader[aria-hidden="true"]{
  opacity:0!important;visibility:hidden!important;pointer-events:none!important;
}

@media(max-width:900px){
  :root{--systjem-mobile-header:58px;--systjem-mobile-gutter:10px;--systjem-mobile-radius:14px}

  /* Sprint 22 — één vaste, compacte iPhone-header. Geen tweede witte balk. */
  body.admin-sidebar-on:not(.butcher-original-layout) .session-topbar,
  body.admin-sidebar-on:not(.butcher-original-layout) #sidebarToggle{
    display:none!important;
  }
  body.admin-sidebar-on:not(.butcher-original-layout) .admin-hero{
    position:sticky!important;top:0!important;left:0!important;right:0!important;
    z-index:620!important;width:100%!important;height:auto!important;
    min-height:calc(var(--systjem-mobile-header) + env(safe-area-inset-top))!important;
    padding-top:env(safe-area-inset-top)!important;
    overflow:visible!important;transform:none!important;
  }
  body.admin-sidebar-on:not(.butcher-original-layout) .admin-hero-inner{
    min-height:var(--systjem-mobile-header)!important;padding:6px 10px!important;
  }
  body.admin-sidebar-on:not(.butcher-original-layout) .brand{max-width:calc(100% - 48px)!important;gap:7px!important}
  body.admin-sidebar-on:not(.butcher-original-layout) .brand-logo-pair{
    grid-template-columns:30px 30px!important;width:64px!important;min-width:64px!important;max-width:64px!important;gap:4px!important;
  }
  body.admin-sidebar-on:not(.butcher-original-layout) .brand-logo-pair .brand-logo{
    width:30px!important;height:30px!important;min-width:30px!important;max-width:30px!important;border-radius:8px!important;
  }
  body.admin-sidebar-on:not(.butcher-original-layout) .brand-copy strong{font-size:14px!important}
  body.admin-sidebar-on:not(.butcher-original-layout) .brand-copy small{font-size:7.5px!important;margin-top:2px!important}
  body.admin-sidebar-on:not(.butcher-original-layout) .mobile-nav-toggle{
    display:grid!important;place-content:center!important;position:relative!important;z-index:730!important;
    width:42px!important;height:42px!important;min-height:42px!important;flex:0 0 42px!important;
    padding:9px!important;margin:0!important;border-radius:11px!important;background:rgba(255,255,255,.08)!important;
  }
  body.admin-sidebar-on:not(.butcher-original-layout) .mobile-nav-toggle span{width:20px!important}

  /* De oude zwevende 'naar boven'-knop was de vreemde knop rechtsboven: weg op iPhone/iPad. */
  .systjem-mobile-top-button{display:none!important}

  /* Lade compacter zodat alle onderdelen sneller bereikbaar zijn. */
  body.admin-sidebar-on:not(.butcher-original-layout) > #primaryAdminNav{
    width:min(86vw,340px)!important;max-width:340px!important;border-radius:0 18px 18px 0!important;
    padding:calc(12px + env(safe-area-inset-top)) 10px calc(10px + env(safe-area-inset-bottom))!important;gap:5px!important;
  }
  body.admin-sidebar-on:not(.butcher-original-layout) > #primaryAdminNav::before{padding:3px 8px 5px!important;font-size:10px!important}
  body.admin-sidebar-on:not(.butcher-original-layout) > #primaryAdminNav .nav-main{gap:1px!important}
  body.admin-sidebar-on:not(.butcher-original-layout) > #primaryAdminNav .nav-main>a{
    min-height:41px!important;padding:8px 11px!important;border-radius:9px!important;font-size:14px!important;
  }
  .systjem-mobile-account{gap:7px!important;padding:9px 6px 0!important}
  .systjem-mobile-account-copy span{padding:7px 8px!important}
  .systjem-mobile-account-actions a{min-height:41px!important;padding:8px!important;font-size:12px!important}

  /* Sprint 23 — minder gigantische knoppen en kaarten, maar nog steeds goed tikbaar. */
  body.admin-sidebar-on:not(.butcher-original-layout) .admin-wrap,
  body.admin-sidebar-on:not(.butcher-original-layout).sidebar-collapsed .admin-wrap{
    padding:12px var(--systjem-mobile-gutter) calc(24px + env(safe-area-inset-bottom))!important;
  }
  .module-heading{margin-bottom:12px!important}
  .module-heading h1,.module-heading h2{font-size:clamp(28px,8vw,36px)!important;line-height:1.04!important;margin-bottom:7px!important}
  .module-heading p{font-size:15px!important;line-height:1.45!important;margin-top:6px!important}
  .eyebrow{font-size:10px!important;letter-spacing:.13em!important}

  button,.btn,.primary,.section-nav a,.communication-tabs a,.goal-mode-tabs a,.goal-tabs-v3 a,.view-switch a{
    min-height:42px!important;padding:8px 12px!important;border-radius:10px!important;font-size:14px!important;line-height:1.2!important;
  }
  .actions,.dexxter-export-actions,.communication-quick-actions,.privacy-actions,.accounting-period-shortcuts,.lessonbook-head .actions,.settings-main .actions{
    display:flex!important;flex-wrap:wrap!important;align-items:center!important;gap:7px!important;width:auto!important;
  }
  .actions>*:not(input):not(select):not(textarea),.dexxter-export-actions>*,.communication-quick-actions>*,.privacy-actions>*,.accounting-period-shortcuts>*{
    width:auto!important;max-width:100%!important;flex:0 1 auto!important;margin:0!important;
  }
  .actions form{width:auto!important;display:inline-flex!important;gap:7px!important}
  .actions form button{width:auto!important}
  .students-primary-action,.setup-save{width:auto!important;min-width:0!important}

  .card,.student-card,.student-panel,.setting-card,.connection-card,.private-calendar-settings,.communication-card,.backup-card,.accounting-card,.goals-v3,.lessonbook-shell{
    padding:13px!important;border-radius:14px!important;box-shadow:0 5px 16px rgba(25,32,27,.045)!important;
  }
  .card+.card,.setting-card+.setting-card,.student-panel+.student-panel{margin-top:10px!important}

  /* Leerlingen: de filters en hoofdactie hoeven geen halve pagina in te nemen. */
  .students-hero{padding:15px!important;gap:10px!important}
  .students-hero h2{font-size:30px!important;margin:2px 0 5px!important}
  .students-primary-action{display:inline-flex!important;margin-top:10px!important;padding:9px 13px!important}
  .students-shell>.actions{display:grid!important;grid-template-columns:1fr 1fr!important;gap:7px!important;padding:12px 12px 0!important}
  .students-shell>.actions>*{width:100%!important;justify-content:center!important}
  .students-shell>details,.students-shell>p,.students-shell>label,.students-shell>#studentSearch,.students-shell>.student-grid,.students-shell>.students-tools-intro,.students-shell>.students-bulkbar{
    margin-left:12px!important;margin-right:12px!important;
  }
  #studentSearch{height:44px!important;min-height:44px!important;padding-top:9px!important;padding-bottom:9px!important}
  .student-grid{gap:10px!important}
  .student-card{padding:14px!important}
  .student-card h3{font-size:18px!important;margin-bottom:7px!important}
  .student-card p{line-height:1.45!important;margin:5px 0!important}

  /* Dashboard veel compacter. */
  body.admin-view-overview .dashboard-intro{margin-bottom:10px!important}
  body.admin-view-overview .dashboard-intro h1{font-size:42px!important;line-height:1!important;margin:4px 0!important}
  body.admin-view-overview .dashboard-layout{gap:10px!important}
  body.admin-view-overview .dashboard-today-card,
  body.admin-view-overview .dashboard-next-card,
  body.admin-view-overview .dashboard-quick-card{padding:14px!important}
  body.admin-view-overview .dashboard-next-time{font-size:42px!important;line-height:1!important}

  /* Communicatie: vier cijfers in compacte tegels in plaats van vier schermhoge kaarten. */
  .communication-heading{gap:10px!important}
  .communication-heading .communication-status{min-height:30px!important;padding:5px 9px!important;font-size:11px!important}
  .communication-tabs{padding:5px 10px!important;margin-bottom:12px!important;gap:5px!important}
  .communication-tabs a{min-height:40px!important;padding:8px 11px!important;font-size:13px!important}
  .communication-metrics{grid-template-columns:1fr 1fr!important;gap:8px!important;margin-bottom:12px!important}
  .communication-metrics article,.communication-metrics article:first-child{
    grid-column:auto!important;min-height:108px!important;padding:12px!important;border-radius:13px!important;
  }
  .communication-metrics span{font-size:12px!important}
  .communication-metrics strong{font-size:22px!important;margin:4px 0 2px!important}
  .communication-metrics small{font-size:11px!important;line-height:1.3!important}

  /* Statistiek: cijfers mogen naast elkaar staan. */
  .stat,.accounting-summary,.backup-summary{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important}
  .stat .box,.accounting-summary>*{padding:12px!important;min-height:96px!important}

  /* Agenda: navigatie- en periodeknoppen compacter, titel niet tegen de pijlen gedrukt. */
  .calendar-card{padding:12px!important}
  .calendar-card .calhead{display:grid!important;grid-template-columns:42px minmax(0,1fr) 42px!important;gap:7px!important;align-items:center!important}
  .calendar-card .calhead>a,.calendar-card .calhead>button{width:42px!important;height:42px!important;min-height:42px!important;padding:0!important}
  .calendar-card .calhead h2,.calendar-card .calhead h3{min-width:0!important;font-size:17px!important;line-height:1.2!important;text-align:center!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important}
  .view-switch{padding:5px!important;gap:4px!important}
  .view-switch a{min-height:38px!important;padding:7px 10px!important;font-size:13px!important}

  /* Onderste opslagstatus minder dominant. */
  .admin-storage-footer{margin-top:16px!important;padding:10px!important;border-radius:12px!important}
  .admin-storage-footer strong{font-size:12px!important}
  .admin-storage-footer .storage-items{gap:5px!important}
  .admin-storage-footer .storage-items>*{min-height:34px!important;padding:6px 8px!important;font-size:11px!important}

  /* Login compact en geschikt voor Face ID / iCloud Keychain. */
  .login-page{padding:calc(18px + env(safe-area-inset-top)) 12px calc(18px + env(safe-area-inset-bottom))!important}
  .login-card{width:min(100%,420px)!important;padding:18px!important}
  .login-remember{min-height:42px!important;padding:7px 0!important;font-size:14px!important}
}

@media(min-width:601px) and (max-width:900px){
  /* Sprint 24 — iPad: benut de breedte zonder alles desktop-groot te maken. */
  :root{--systjem-mobile-gutter:16px;--systjem-mobile-header:62px}
  body.admin-sidebar-on:not(.butcher-original-layout) > #primaryAdminNav{width:min(48vw,360px)!important}
  .communication-metrics{grid-template-columns:repeat(4,minmax(0,1fr))!important}
  .communication-metrics article{min-height:104px!important}
  .stat,.accounting-summary,.backup-summary{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  .student-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .settings-grid,.communication-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .settings-grid>.setting-card:only-child,.communication-settings-card{grid-column:1/-1!important}
}

@media(max-width:390px){
  body.admin-sidebar-on:not(.butcher-original-layout) .brand-copy strong{font-size:13px!important}
  body.admin-sidebar-on:not(.butcher-original-layout) .brand-copy small{max-width:39vw!important}
  .communication-metrics{grid-template-columns:1fr 1fr!important}
  .stat{grid-template-columns:1fr 1fr!important}
}

@media(prefers-reduced-motion:reduce){
  .systjem-loader,.systjem-loader *{animation:none!important;transition:none!important}
}
