/* ENTEBHOOMI admin - phone polish (app + mobile browser). Loaded LAST, so it wins over the older bundles.
   1. Add/Edit Product (and Combo, Banner) step-by-step popup: the form can scroll again, fields are compact.
   2. The round "+" button no longer sits on top of the bottom menu.
   3. Order / customer filters take less height.  Desktop is untouched. */
@media (max-width:640px){

  /* ---- 1. step popup: the body is the ONE scrolling area (it was clipped: flex-shrink:0 inside an overflow:hidden box) ---- */
  .modal-overlay.mw-on{ top:0; bottom:auto; height:var(--vvh,100%); }
  .modal-overlay.mw-on .modal{ height:100%; max-height:100%; overflow:hidden; display:flex; flex-direction:column; }
  .modal-overlay.mw-on .modal-head{ flex:0 0 auto; padding:calc(8px + env(safe-area-inset-top,0px)) 12px 8px; }
  .modal-overlay.mw-on .modal-head h3{ font-size:1rem; }
  .modal-overlay.mw-on .modal-close{ width:34px; height:34px; }
  .modal-overlay.mw-on .mw-bar{ position:static !important; flex:0 0 auto; padding:6px 12px 7px; }
  .modal-overlay.mw-on .mw-top{ margin-bottom:5px; }
  .modal-overlay.mw-on .mw-top span{ font-size:.88rem; }
  .modal-overlay.mw-on .mw-dots button{ height:6px; }
  .modal-overlay.mw-on .modal-body{
    flex:1 1 auto !important; min-height:0; overflow-y:auto; overflow-x:hidden; -webkit-overflow-scrolling:touch; overscroll-behavior:contain;
    padding:10px 12px 28px !important;
  }
  .modal-overlay.mw-on .modal-body input, .modal-overlay.mw-on .modal-body select, .modal-overlay.mw-on .modal-body textarea{ scroll-margin-top:12px; scroll-margin-bottom:24px; }
  .modal-overlay.mw-on .modal-footer{ position:static; flex:0 0 auto; padding:8px 12px calc(8px + env(safe-area-inset-bottom,0px)); gap:8px; }
  .modal-overlay.mw-on .modal-footer .btn{ min-height:42px; font-size:.92rem; }

  /* compact form: no nested cards, two short fields per row, hints only while typing */
  .modal-overlay.mw-on .pf-layout, .modal-overlay.mw-on .pf-main, .modal-overlay.mw-on .pf-side{ display:block; padding:0; margin:0; gap:0; }
  .modal-overlay.mw-on .pf-sec, .modal-overlay.mw-on .bn-sec{ padding:0; margin:0 0 8px; border:0; border-radius:0; box-shadow:none; background:transparent; }
  .modal-overlay.mw-on .pf-sec > h4, .modal-overlay.mw-on .bn-sec > h4{ display:none; }          /* the step bar already names the step */
  .modal-overlay.mw-on .form-grid{ display:grid; grid-template-columns:1fr 1fr; gap:8px 10px; }
  .modal-overlay.mw-on .form-grid > .field.full, .modal-overlay.mw-on .form-grid > .full{ grid-column:1 / -1; }
  .modal-overlay.mw-on .field{ min-width:0; margin:0; }
  .modal-overlay.mw-on .field label, .modal-overlay.mw-on .modal-body label.filter-label{ font-size:.7rem; margin:0 0 3px; letter-spacing:.2px; }
  .modal-overlay.mw-on .field input:not([type=checkbox]):not([type=radio]):not([type=file]), .modal-overlay.mw-on .field select, .modal-overlay.mw-on .field textarea{
    width:100%; min-width:0; box-sizing:border-box; padding:8px 10px; font-size:15px; min-height:40px; border-radius:10px; text-overflow:ellipsis;
  }
  .modal-overlay.mw-on .field textarea{ min-height:84px; }
  .modal-overlay.mw-on .field .field-hint, .modal-overlay.mw-on .field > p.hint{ display:none; margin:3px 0 0; font-size:.7rem; line-height:1.35; }
  .modal-overlay.mw-on .field:focus-within .field-hint, .modal-overlay.mw-on .field:focus-within > p.hint{ display:block; }
  .modal-overlay.mw-on .pf-chips{ display:flex; flex-wrap:nowrap; gap:5px; overflow-x:auto; padding:4px 0 0; scrollbar-width:none; }
  .modal-overlay.mw-on .pf-chips::-webkit-scrollbar{ display:none; }
  .modal-overlay.mw-on .pf-chips button{ flex:0 0 auto; padding:4px 9px; font-size:.72rem; }
  .modal-overlay.mw-on .pf-calc{ margin:6px 0 0; }
  .modal-overlay.mw-on .pf-calc summary{ padding:9px 10px; font-size:.82rem; }
  .modal-overlay.mw-on .pf-similar{ margin:0 0 8px; }
  .modal-overlay.mw-on .pf-gstname .gst-name-row{ display:flex; gap:6px; }
  .modal-overlay.mw-on .pf-gstname .gst-ic .tx{ display:none; }

  /* ---- 2. the round + button sits ABOVE the bottom menu, not on top of its last item ---- */
  #openAddModal{ bottom:calc(var(--nav-h,64px) + env(safe-area-inset-bottom,0px) + 12px) !important; right:14px; width:52px; height:52px; }
  #openAddModal .fab-ico{ font-size:1.7rem; }
  .main-col{ padding-bottom:calc(var(--nav-h,64px) + env(safe-area-inset-bottom,0px) + 76px); }   /* last card is never hidden by the menu or the + button */

  /* ---- 3. less height for page headings and filters ---- */
  .page-head{ margin-bottom:10px; }
  .page-head h1{ font-size:1.5rem; margin-bottom:2px; }
  .page-head p{ font-size:.8rem; line-height:1.4; margin:0; }
  .order-toolbar, #viewCustomers .toolbar{ display:grid; grid-template-columns:1fr 1fr; gap:8px; align-items:end; }
  .order-toolbar .filter-group, #viewCustomers .toolbar .filter-group{ min-width:0; margin:0; }
  .order-toolbar .order-filter, #viewCustomers .toolbar .order-filter{ width:100%; min-width:0; box-sizing:border-box; }
  .order-toolbar .btn-clear-filters{ width:100%; margin:0; }
  #viewCustomers .toolbar .toolbar-search, #viewCustomers .toolbar #remindIncompleteBtn{ grid-column:1 / -1; }
  .status-btn-row{ flex-wrap:nowrap; overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:none; padding-bottom:2px; }
  .status-btn-row::-webkit-scrollbar{ display:none; }
  .status-btn-row > *{ flex:0 0 auto; }
}
