/* AL Mohandes Automotive V4.52 — iPhone layout fix based on actual 01-Dec-2026 iPhone screenshot.
   Presentation only, no permissions, APIs, login, booking or inventory logic changed. */
@media screen and (max-width:760px){
  html{-webkit-text-size-adjust:100%;width:100%}
  body{min-width:0!important;width:100%!important;max-width:100vw!important;overflow-x:clip!important}
  body *{box-sizing:border-box}
  /* Reduce branded masthead without hiding the QR or company identity. */
  header{display:grid!important;grid-template-columns:64px minmax(0,1fr) 46px!important;align-items:center!important;gap:8px!important;padding:10px 12px!important;min-height:78px!important;max-width:100vw!important}
  header .main{width:64px!important;height:58px!important;max-width:64px!important;grid-column:1!important;object-fit:contain!important}
  header .group{display:none!important} /* still available on desktop */
  header .qr{width:44px!important;height:44px!important;max-width:44px!important;grid-column:3!important;grid-row:1!important;padding:3px!important;margin:0!important}
  header>div{grid-column:2!important;grid-row:1!important;min-width:0!important;width:100%!important;line-height:1.24!important;text-align:left!important;font-size:11px!important;overflow-wrap:anywhere!important}
  header>div b{font-size:clamp(10px,2.9vw,12px)!important;line-height:1.3!important;letter-spacing:0!important;display:block!important}
  header>div :is(span,a,div){font-size:11px!important;line-height:1.25!important}
  /* The branch picker is more useful than its repeated secondary ID line. */
  #branchHost.branch-host{display:block!important;min-width:0!important;padding:9px 12px!important;max-width:100%!important}
  #branchHost.branch-host[hidden]{display:none!important}
  #branchHost .branch-picker-label{display:grid!important;grid-template-columns:92px minmax(0,1fr)!important;align-items:center!important;gap:8px!important;width:100%!important;min-width:0!important;font-size:12px!important}
  #branchHost .branch-picker-label select{width:100%!important;min-width:0!important;max-width:100%!important;padding:10px 8px!important;height:43px!important;font-size:13px!important}
  #branchHost .branch-mini{display:none!important} /* same branch already shown in selector */
  /* Employee identity and primary actions: two compact rows. */
  #accountbar.accountbar{display:grid!important;grid-template-columns:36px minmax(0,1fr) auto!important;gap:7px 8px!important;align-items:center!important;justify-content:stretch!important;padding:9px 12px!important;height:auto!important;min-height:0!important;overflow:visible!important}
  #accountbar.accountbar[hidden]{display:none!important}
  #accountbar #accountavatar{grid-column:1!important;grid-row:1!important;width:35px!important;height:35px!important;font-size:13px!important}
  #accountbar .accountinfo{grid-column:2!important;grid-row:1!important;min-width:0!important;width:auto!important}
  #accountbar #accountname{font-size:13px!important;line-height:1.23!important;overflow-wrap:anywhere!important}
  #accountbar #accountrole{font-size:11px!important;line-height:1.2!important}
  #accountbar #logoutTop{grid-column:3!important;grid-row:1!important;min-height:38px!important;margin:0!important;padding:7px 10px!important;font-size:12px!important;white-space:nowrap!important}
  #accountbar #shareAfterSalesQRTop{grid-row:2!important;grid-column:1 / -1!important;width:100%!important;margin:0!important;min-height:36px!important;font-size:12px!important;padding:7px 10px!important}
  #accountbar #shareAfterSalesQRTop[hidden]{display:none!important}
  /* Make global search touch-friendly, remove desktop-only command hint. */
  #amaGlobalSearch.ama-global-search-host{padding:7px 12px!important;max-width:100vw!important;min-width:0!important}
  #amaGlobalSearch .ama-global-search-control{min-width:0!important;max-width:100%!important;height:44px!important;padding:0 9px!important}
  #amaGlobalSearchInput{font-size:16px!important;min-width:0!important;width:100%!important;text-overflow:ellipsis!important}
  #amaGlobalSearch .ama-search-hint{display:none!important}
  .mobile-topbar{display:flex!important;justify-content:space-between!important;align-items:center!important;padding:7px 12px!important;min-height:50px!important;gap:8px!important}
  .mobile-topbar strong{font-size:12px!important;line-height:1.3!important;min-width:0!important;overflow-wrap:anywhere!important}
  #menuToggle{min-height:39px!important;min-width:88px!important;padding:6px 11px!important;font-size:13px!important;white-space:nowrap!important}
  #main{padding:11px 12px 74px!important;min-width:0!important;width:100%!important;max-width:100%!important;overflow-x:clip!important}
  #main .bar{display:flex!important;flex-wrap:wrap!important;gap:7px!important;margin:9px 0 12px!important;align-items:center!important}
  #main .bar>button,#main .bar>a{min-height:38px!important;font-size:12px!important;padding:7px 10px!important;white-space:normal!important;line-height:1.2!important;min-width:0!important}
  #main .hero{padding:20px 18px!important;border-radius:16px!important;min-height:0!important;margin:12px 0!important}
  #main .hero .eyebrow{font-size:10px!important;letter-spacing:.12em!important;line-height:1.3!important}
  #main .hero h1{font-size:clamp(23px,6vw,28px)!important;line-height:1.12!important;margin:8px 0!important}
  #main .hero p{font-size:13px!important;line-height:1.4!important;margin:8px 0!important}
  #main .hero .hero-meta{font-size:11px!important}
  #main :is(.card,.panel,.ama-card,.ama-executive-card){max-width:100%!important;min-width:0!important;overflow-wrap:anywhere!important}
  #main :is(h1,h2,h3){overflow-wrap:break-word!important}
  #main input,#main select,#main textarea{font-size:16px!important;max-width:100%!important}
  #main .scroll{max-width:100%!important;-webkit-overflow-scrolling:touch!important}
  /* Keep stock table horizontally scrollable on phones without overlapping sticky actions. */
  #main table[data-module="Stock"] td.actions,
  #main table[data-module="Stock"] th:last-child{position:static!important;right:auto!important;left:auto!important;box-shadow:none!important}
  #editor{width:calc(100vw - 20px)!important;max-width:calc(100vw - 20px)!important;max-height:calc(100dvh - 20px)!important;overflow-y:auto!important}
  #editor .fields{grid-template-columns:minmax(0,1fr)!important}
}
@media screen and (max-width:360px){
  header{grid-template-columns:54px minmax(0,1fr) 40px!important;padding:8px!important}
  header .main{width:54px!important;height:52px!important}
  header .qr{width:39px!important;height:39px!important}
  #main{padding-left:9px!important;padding-right:9px!important}
  #branchHost .branch-picker-label{grid-template-columns:78px minmax(0,1fr)!important;font-size:11px!important}
}
