/* Phone layouts use a single vertical reading surface, with full-size controls. */
@media (max-width: 760px), (max-width: 1024px) and (max-height: 600px) {
  :is(.customer-body,.admin-body) :is(input:not([type=checkbox]):not([type=radio]),textarea,select) { font-size:16px; }
  :is(.customer-body,.admin-body) :is(textarea,pre,code) { overflow-wrap:anywhere; }
  :is(.customer-body,.admin-body) textarea { max-width:100%; overscroll-behavior-y:auto; }
  :is(.customer-body,.admin-body) :is(.line-button,.signal-button,.buyer-quiet-button,.buyer-primary-button) { min-height:44px; font-size:14px!important; touch-action:manipulation; }

  /* The former fixed order header left only ~40px for the actual details. */
  body.admin-body.light-console .order-console-v7 #orderDialog.buyer-workbench-open[open] {
    position:fixed!important; inset:8px!important; margin:0!important;
    width:calc(100vw - 16px)!important; max-width:none!important;
    height:calc(100vh - 16px)!important; height:calc(100dvh - 16px)!important;
    max-height:calc(100dvh - 16px)!important; min-height:0!important;
    overflow-y:auto!important; overscroll-behavior-y:contain; border-radius:12px;
    scroll-padding-block:72px 24px; -webkit-overflow-scrolling:touch;
  }
  #orderDialog.buyer-workbench-open .drawer-shell { display:block!important; height:auto!important; min-height:100%; overflow:visible!important; }
  body.admin-body.light-console .order-console-v7 #orderDialog.buyer-workbench-open .dialog-head {
    position:sticky!important; top:0!important; z-index:6; min-height:60px; background:#fff; padding:10px 14px;
  }
  body.admin-body.light-console .order-console-v7 #orderDialog.buyer-workbench-open #orderDetail {
    display:block; height:auto; min-height:0; overflow:visible; padding-bottom:max(20px,env(safe-area-inset-bottom));
  }
  .buyer-workbench .bw-layout { display:block; height:auto; overflow:visible; }
  .buyer-workbench .bw-sidebar { display:block; height:auto; }
  .buyer-workbench .bw-detail { display:none; height:auto; min-height:0; overflow:visible; }
  .buyer-workbench.bw-show-detail .bw-sidebar { display:none; }
  .buyer-workbench.bw-show-detail .bw-detail { display:block; }
  body.admin-body.light-console.admin-redesign .buyer-workbench :is(.bw-order-list,.bw-detail-scroll) { height:auto; max-height:none; overflow:visible; flex:none; overscroll-behavior:auto; }
  .buyer-workbench .bw-detail-head { padding:16px 14px 0; }
  .buyer-workbench .bw-detail-scroll { padding:16px 14px; }
  .buyer-workbench .bw-title-row h3 { font-size:20px; }
  .buyer-workbench .bw-summary { grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
  .buyer-workbench .bw-summary>div { border:0!important; padding:0; }
  .buyer-workbench .bw-summary dd { font-size:14px; line-height:1.5; }
  .buyer-workbench :is(.bw-order-account,.bw-order-label>b) { white-space:normal; font-size:14px; overflow-wrap:anywhere; }
  .buyer-workbench .bw-tabs { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0 12px; padding-inline:14px; overflow:visible; }
  .buyer-workbench .bw-tabs button { min-width:0; min-height:44px; padding:10px 0; font-size:14px; white-space:normal; }
  .buyer-workbench :is(.bw-back,.bw-filters button,.bw-pagination button) { min-height:44px; font-size:14px; }
  .buyer-workbench .bw-back { display:inline-flex; }
  .buyer-workbench .bw-buyer-bar { flex-wrap:wrap; align-items:flex-start; }
  .buyer-workbench .bw-buyer-bar h3 { font-size:16px; }
  .buyer-workbench :is(.bw-reference,.bw-buyer-bar p,.bw-order-times dd,.bw-order-foot,.bw-detail-scroll p) { font-size:13px; line-height:1.7; }
  body.admin-body.light-console .order-console-v7 .buyer-audit>ol { max-height:none; overflow:visible; }
  .admin-body.light-console :is(.buyer-session-body textarea,.session-archive-value) {
    min-height:160px; height:200px; max-height:40dvh; font-size:16px; line-height:1.5; resize:vertical;
  }
  .session-archive-actions { display:grid; grid-template-columns:1fr; }
  .session-archive-actions button { width:100%; min-height:44px; white-space:normal; }
  .admin-body.light-console :is(.order-resubmit-panel textarea,[data-buyer-resubmit-session]) { min-height:160px; max-height:40dvh; }
  .admin-body.light-console :is(.order-resubmit-panel,.buyer-failure-body) .inline-actions { flex-wrap:wrap; }

  /* Customer orders and security panels scroll as one sheet on phones. */
  .customer-body #buyerControlDialog {
    inset:0; margin:0; width:100%; max-width:100%; height:100vh; height:100dvh;
    max-height:100dvh; border:0; border-radius:0; overflow-y:auto; overscroll-behavior-y:contain;
    scroll-padding-block:80px 24px; -webkit-overflow-scrolling:touch;
  }
  .customer-body .buyer-control-shell { display:block; height:auto; min-height:100%; }
  .customer-body .buyer-control-head { position:sticky; top:0; z-index:3; min-height:68px; padding:12px 16px; background:#fff; }
  .customer-body .buyer-control-identity h2 { font-size:16px; white-space:normal; overflow-wrap:anywhere; }
  .customer-body .buyer-control-layout { display:contents; }
  .customer-body .buyer-control-nav { display:flex; overflow-x:auto; padding:0 8px; }
  .customer-body .buyer-control-nav button { flex:0 0 auto; width:auto; min-height:48px; font-size:14px; }
  .customer-body .buyer-control-content { overflow:visible; height:auto; }
  .customer-body .buyer-account-panel { min-height:0; padding:22px 16px max(28px,env(safe-area-inset-bottom)); }
  .customer-body :is(.buyer-panel-copy,.buyer-order-subscription,.buyer-order-code,.buyer-device-row,.buyer-security-note p) { font-size:14px; line-height:1.7; }
  .customer-body .buyer-order-primary { flex-wrap:wrap; gap:8px 14px; }
  .customer-body .buyer-order-primary strong { font-size:16px; line-height:1.5; }
  .customer-body .buyer-order-amount { font-size:14px; }
  .customer-body :is(.buyer-order-meta,.buyer-order-status-copy) { font-size:13px; line-height:1.7; }
  .customer-body :is(.buyer-order-primary code,.buyer-order-code code,.buyer-order-subscription small) { font-size:13px; white-space:normal; overflow-wrap:anywhere; }
  .customer-body .buyer-order-tabs { display:flex; flex-wrap:wrap; }
  .customer-body .buyer-order-tabs button { min-height:44px; font-size:14px; }

  .customer-body .redeem-station { grid-template-columns:minmax(0,1fr); }
  .customer-body .redeem-station>.redeem-main { height:auto; min-height:0; overflow:visible; }
  .customer-body :is(.segment-body,.upgrade-form-body,.order-record-main) { min-width:0; }
  .customer-body .checkout-path { gap:8px; }
  .customer-body .checkout-path li { min-width:0; }
  .customer-body .checkout-path li>span:not(.checkout-step-index) { font-size:13px; line-height:1.5; overflow-wrap:anywhere; }
  .customer-body .checkout-path li small { font-size:12px; line-height:1.5; }
  .customer-body .session-guide-copy :is(span,small) { font-size:14px; line-height:1.7; }
  .customer-body .session-guide-action { white-space:normal; min-height:44px; font-size:14px; }
  .customer-body .session-guide-continue { width:100%; min-height:48px; white-space:normal; }
  .customer-body :is(#session,#upgradeSession) { min-height:168px; height:200px; max-height:40dvh; font-size:16px; line-height:1.5; }
  .customer-body .submission-actions { display:flex; flex-direction:column; gap:10px; }
  .customer-body .submission-actions>button { width:100%; min-height:48px; white-space:normal; }
  .customer-body :is(.redeem-confirmation,.submission-facts) dd { overflow-wrap:anywhere; }
  .customer-body :is(.upgrade-auth-link,.service-product-action,.buyer-control-close,.auth-dialog-close) { min-height:44px; }
  .customer-body :is(.customer-auth-dialog,.service-info-dialog) { max-height:calc(100dvh - 16px); overflow-y:auto; }
}
@media (max-width: 380px) {
  .customer-body .checkout-path li>span:not(.checkout-step-index) { font-size:12px; }
  .customer-body .checkout-path li small { font-size:11px; }
  .customer-body .buyer-control-nav button { padding-inline:12px; }
}
