/* ADESS Mobile Toolbar Fix V9.6.19
   Scope: mobile only. Desktop table toolbar remains untouched. */
@media (max-width: 640px){
  html, body{overflow-x:hidden!important;}
  .workspace, .page, main.page, .page > section, .section, .card, .panel, .register-panel{
    max-width:100%!important;
    box-sizing:border-box!important;
  }

  /* Kill the inner horizontal table scroller on mobile card mode. */
  .table-wrap, .register-table-wrap, .responsive-table, .data-table-wrap, .adess-table-wrap{
    overflow-x:hidden!important;
    max-width:100%!important;
  }

  /* Toolbars: search first full width, then count + export icons in one row. */
  .auto-register-toolbar,
  .register-tools,
  .table-tools,
  .report-tools,
  .list-tools,
  .toolbar,
  .table-head .auto-register-toolbar,
  .table-head .register-tools{
    position:static!important;
    display:flex!important;
    flex-wrap:wrap!important;
    align-items:center!important;
    justify-content:flex-start!important;
    gap:8px!important;
    width:100%!important;
    max-width:100%!important;
    min-height:0!important;
    height:auto!important;
    overflow:visible!important;
    padding:0!important;
    margin:8px 0 10px!important;
    transform:none!important;
    background:transparent!important;
    box-shadow:none!important;
  }

  .auto-register-toolbar input[type="search"],
  .auto-register-toolbar input.register-search,
  .register-tools input[type="search"],
  .table-tools input[type="search"],
  .report-tools input[type="search"],
  .list-tools input[type="search"],
  .toolbar input[type="search"]{
    flex:1 1 100%!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    order:1!important;
  }

  .adess-mobile-add-clone{
    display:inline-flex!important;
    order:2!important;
    flex:0 0 auto!important;
    align-items:center!important;
    justify-content:center!important;
    min-height:42px!important;
    padding:0 14px!important;
    border-radius:12px!important;
    white-space:nowrap!important;
  }

  .register-count,
  .row-count,
  .rows-count,
  .auto-register-toolbar .badge,
  .register-tools .badge,
  .table-tools .badge,
  .toolbar .badge{
    order:3!important;
    flex:0 0 auto!important;
    white-space:nowrap!important;
  }

  .auto-register-toolbar button,
  .register-tools button,
  .table-tools button,
  .report-tools button,
  .list-tools button,
  .toolbar button,
  .auto-register-toolbar a.btn,
  .register-tools a.btn,
  .table-tools a.btn{
    flex:0 0 auto!important;
    width:42px!important;
    height:42px!important;
    min-width:42px!important;
    max-width:42px!important;
    padding:0!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    order:4!important;
    overflow:hidden!important;
  }

  .auto-register-toolbar .adess-mobile-add-clone,
  .register-tools .adess-mobile-add-clone,
  .table-tools .adess-mobile-add-clone{
    width:auto!important;
    max-width:none!important;
  }

  /* Column manager is not needed on phone cards. Hide the trigger and dropdown only on mobile. */
  .adess-mobile-hide-column-manager,
  .adess-column-popover,
  .column-manager-popover,
  .columns-popover,
  .show-hide-columns,
  .column-dropdown{
    display:none!important;
    visibility:hidden!important;
  }

  /* Prevent the tiny empty box caused by an injected floating column toolbar. */
  .auto-register-toolbar:empty,
  .register-tools:empty,
  .table-tools:empty{
    display:none!important;
  }

  /* Cards in mobile table mode should use full available width, not half clipped. */
  .mobile-card,
  tr.mobile-card,
  .register-card,
  .adess-mobile-card,
  .zk-mobile-card{
    width:100%!important;
    max-width:100%!important;
    box-sizing:border-box!important;
    overflow:hidden!important;
  }

  .mobile-card td,
  .register-card td,
  .adess-mobile-card td,
  .zk-mobile-card td{
    overflow-wrap:anywhere!important;
    word-break:break-word!important;
  }

  /* Section tabs should wrap instead of creating horizontal scrollbars. */
  .section-tabs,
  .tabs,
  .nav-tabs{
    display:flex!important;
    flex-wrap:wrap!important;
    gap:8px!important;
    overflow-x:hidden!important;
    white-space:normal!important;
  }
  .section-tabs a,
  .section-tabs button,
  .tabs a,
  .tabs button,
  .nav-tabs a,
  .nav-tabs button{
    flex:1 1 calc(50% - 8px)!important;
    min-width:0!important;
    text-align:center!important;
  }
}

@media (min-width: 641px){
  .adess-mobile-add-clone{display:none!important;}
}
