/* Admin pages use the sidebar Logout control; hide the duplicate topbar icon. */
.topbar .admin-icon-btn[onclick="logoutAdmin()"]{
  display:none !important;
}

@media (max-width: 1024px){
  body{
    display:block;
  }

  .sidebar{
    position:relative !important;
    width:100% !important;
    height:auto !important;
    max-height:none !important;
    overflow:visible !important;
  }

  .sidebar-header{
    padding:14px 10px !important;
  }

  .sidebar-logo{
    width:82px !important;
    height:82px !important;
  }

  .sidebar-header h2{
    margin-top:0 !important;
    font-size:19px !important;
  }

  .sidebar-header p{
    margin-top:2px !important;
  }

  .menu{
    display:flex !important;
    overflow-x:auto !important;
    overflow-y:hidden !important;
    gap:0 !important;
    flex:none !important;
  }

  .menu a,
  .menu button{
    flex:0 0 auto !important;
    white-space:nowrap !important;
    padding:12px 14px !important;
  }

  .sidebar-logout{
    padding:12px 14px !important;
  }

  .main{
    margin-left:0 !important;
    width:100% !important;
  }

  .topbar{
    position:relative !important;
    flex-wrap:wrap !important;
    align-items:stretch !important;
    gap:10px !important;
    padding:12px 14px !important;
  }

  .search{
    width:100% !important;
    max-width:none !important;
  }

  .topbar-actions,
  .top-actions{
    width:100% !important;
    justify-content:flex-end !important;
    flex-wrap:wrap !important;
  }

  .header,
  .section,
  .container{
    margin:14px !important;
  }

  .cards,
  .admin-summary-grid{
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  }

  .grid,
  .services-grid,
  .form-grid{
    grid-template-columns:1fr !important;
  }

  .table-panel,
  .table-wrap{
    overflow-x:auto !important;
  }

  table{
    min-width:760px;
  }
}

@media (max-width: 640px){
  .cards,
  .admin-summary-grid{
    grid-template-columns:1fr !important;
  }

  .header{
    padding:18px !important;
  }

  .header h1,
  .header h2{
    font-size:21px !important;
  }

  .box,
  .card{
    padding:14px !important;
  }

  .page-actions{
    display:grid !important;
    grid-template-columns:1fr !important;
  }

  .page-actions .btn,
  .btn-full{
    width:100% !important;
  }

  #modalContent,
  .modal-content{
    width:calc(100vw - 24px) !important;
    max-height:86vh !important;
    padding:18px !important;
  }

  .app-popup-box{
    width:calc(100vw - 28px) !important;
  }

  table{
    min-width:700px;
  }
}
