/* Shared mobile safety layer. Loaded last on every page so desktop styles stay intact. */
html{max-width:100%;-webkit-text-size-adjust:100%}
body{max-width:100%;overflow-x:hidden}
img,video,canvas,svg,iframe{max-width:100%;height:auto}
audio{max-width:100%}
input,select,textarea,button{max-width:100%;font:inherit}
pre,code,.breakable{white-space:pre-wrap;overflow-wrap:anywhere}
table{max-width:100%}
dialog{box-sizing:border-box;max-width:calc(100vw - 24px)}

@media(max-width:700px){
  html{scroll-padding-top:72px}
  body{min-width:0}
  h1,h2,h3,p,a,span,b,strong,small,label,td,th{overflow-wrap:anywhere}
  a,button,input,select,textarea,summary{touch-action:manipulation}
  button,.btn,input,select{min-height:44px}
  input,select,textarea{font-size:16px!important}

  .wrap,.account-wrap,.purchases-wrap,.saved-wrap,.claim-wrap,.action-wrap,.flow-main,
  .auctions-wrap,.market-layout{box-sizing:border-box;width:calc(100% - 24px);max-width:none;margin-left:auto;margin-right:auto}

  .topbar,.account-header,.auth-header,.action-header,.flow-header,.admin-header{
    box-sizing:border-box;width:100%;min-width:0;padding-left:12px;padding-right:12px;gap:10px
  }
  .topbar nav,.topbar>.market-header-link,.topbar>.admin-header-link{display:none!important}
  .topbar{display:flex;justify-content:space-between}
  .topbar>.account-links{margin-left:auto;min-width:0}
  .brand,.account-brand,.auth-brand,.action-brand{min-width:0}
  .brand>span:last-child,.account-brand b,.auth-brand b,.action-brand b{min-width:0;line-height:1.15}
  .topbar .brand-mark,.brand-mark,.account-brand span,.auth-brand span,.action-brand span{flex:0 0 auto}
  .account-header>a:last-child,.auth-header>a:last-child,.action-header>a:last-child,.flow-header>a:last-child{
    flex:0 0 auto;max-width:42%;text-align:right;line-height:1.2
  }
  .account-links{flex:0 0 auto;gap:5px}
  .account-links a{display:grid;place-items:center;min-height:40px;padding:6px 8px}

  .hero-grid,.content-grid,.choice-grid,.flow-form,.account-form,.claim-two,.payment-choice-grid,
  .bank-fields-preview,.admin-grid,.upload-grid{grid-template-columns:minmax(0,1fr)!important}
  .wide,.flow-form .wide,.flow-form button,.secure-note{grid-column:auto!important}

  .photo-main img,.gallery-placeholder,.saved-card img,.saved-photo{display:block;width:100%;height:auto;object-fit:cover}
  .photo-main img,.gallery-placeholder{aspect-ratio:4/3}
  .video-panel video,.live-player video,.customer-media video{width:100%;height:auto;max-height:70vh;object-fit:contain}
  .media-panel,.audio-panel,.video-panel{min-width:0}

  .auction-card{grid-template-columns:105px minmax(0,1fr)!important;width:100%;min-width:0}
  .auction-card-info,.auction-card-side{min-width:0}
  .auction-card-info{padding:13px!important}
  .auction-card-info h2{font-size:16px!important}
  .auction-card-side{grid-column:1/-1!important;border-left:0!important;border-top:1px solid var(--line,#d8ddd7)}
  .auction-card-image img{width:100%;height:100%;min-height:115px;object-fit:cover}
  .card-countdown{min-width:0}

  .market-filter-bar{position:static;grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;padding:10px 12px;gap:8px}
  .market-search{grid-column:1/-1;min-width:0}
  .market-filter-bar button{grid-column:1/-1}
  .distance-panel{position:fixed;inset:76px 12px auto!important;width:auto!important;max-height:calc(100dvh - 90px);overflow-y:auto}
  .auction-status-tabs{grid-template-columns:1fr!important}
  .auction-status-tabs>*{border-right:0}
  .results-toolbar{gap:10px;flex-wrap:wrap}

  .summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .financial-grid,.invoice-grid{grid-template-columns:minmax(0,1fr)!important}
  .financial-grid div,.invoice-grid div{border-right:0!important;border-bottom:1px solid var(--line,#d8ddd7)}
  .activity-head,.invoice-head{flex-direction:column;align-items:flex-start}
  .account-panel,.auth-card,.action-card,.claim-form,.flow-card,.form-section{padding:20px 16px}

  .purchase-sheet,.table-wrap,.responsive-table{width:100%;overflow-x:auto;overscroll-behavior-inline:contain;-webkit-overflow-scrolling:touch}
  .purchase-sheet table,.table-wrap table,.responsive-table table{min-width:680px}
  .purchase-sheet:focus-visible,.table-wrap:focus-visible{outline:2px solid var(--green,#173d31)}

  dialog{width:calc(100vw - 24px)!important;max-height:calc(100dvh - 24px);margin:auto;padding:28px 18px!important;overflow:auto}
  dialog form{min-width:0}

  .offer-box{flex-direction:column;align-items:flex-start;gap:12px}
  .payment-choice{grid-template-columns:44px minmax(0,1fr);padding:17px 14px;gap:12px}
  .payment-choice>b{grid-column:2}
  .secure-provider{align-items:flex-start;flex-direction:column}
  .deposit-terms{min-width:0}

  .saved-wrap{padding:28px 0 70px}
  .saved-wrap h1{font-size:34px}
  .saved-grid{grid-template-columns:minmax(0,1fr)}
  .saved-card-actions{display:grid;grid-template-columns:1fr;gap:8px}
  .saved-card-actions a,.saved-card-actions button{width:100%;text-align:center}
  .saved-empty{padding:28px 18px}

  .admin-shell{display:block!important}
  .inventory-sidebar,.editor{box-sizing:border-box;width:100%;min-width:0}
  .inventory-list{display:flex;max-width:100%;overflow-x:auto;scroll-snap-type:x proximity}
  .inventory-item{flex:0 0 min(230px,80vw);scroll-snap-align:start}
  .editor{padding:20px 12px 64px!important}
  .editor-top{align-items:stretch;flex-direction:column}
  .editor-actions{display:grid;grid-template-columns:1fr 1fr;width:100%}
  .editor-actions .save-button{grid-column:1/-1}
  .admin-statuses{grid-template-columns:1fr!important}
  .image-previews{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  .save-bar{max-width:100%}

  .mobile-actions{padding-bottom:max(9px,env(safe-area-inset-bottom))}
}

@media(max-width:430px){
  .topbar .brand>span:last-child{display:none}
  .topbar{min-height:62px;height:auto}
  .topbar .account-links a{font-size:9px}
  .account-wrap,.purchases-wrap{margin-top:24px}
  .account-wrap h1,.purchases-wrap h1,.claim-intro h1,.action-card h1{font-size:30px}
  .flow-intro h1{font-size:34px}
  .flow-card h2{font-size:23px}
  .summary-grid{grid-template-columns:1fr}
  .auction-card{grid-template-columns:92px minmax(0,1fr)!important}
  .auction-card-info p{font-size:11px}
  .auction-card-side{padding:13px!important}
  .card-countdown span{font-size:10px}
  .trust-grid{grid-template-columns:1fr!important}
  .trust-grid div{border-left:0!important;padding-left:0!important}
  .payment-options{grid-template-columns:1fr}
  .admin-header>div>span{display:none}
}

@media(max-width:370px){
  .account-brand b,.auth-brand b,.action-brand b,.flow-header .brand>span:last-child{display:none}
  .auction-card{grid-template-columns:82px minmax(0,1fr)!important}
  .account-links a{padding-inline:6px}
  .image-previews{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}
