.mobile-field-label{display:none}
.modal h2 button.x{border:0;background:transparent;font-family:inherit;line-height:1}
@media(max-width:720px){
  *,*::before,*::after{box-sizing:border-box}
  html,body{max-width:100%;overflow-x:hidden;overscroll-behavior-x:none;touch-action:pan-y}
  body{overflow-wrap:anywhere}
  header{padding:12px 16px!important;gap:10px!important}header h1{font-size:22px}header .sub{display:none}
  /* 保存状況と操作を別の行に固定し、メッセージの長さでボタンを折り返さない。 */
  .cloud-bar{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr));padding:6px 12px!important;gap:4px!important;align-items:center!important}
  .cloud-bar [hidden]{display:none!important}.cloud-bar #cloud-email-label,.cloud-bar [onclick="exportBackup()"]{display:none}
  #cloud-status{grid-column:1/-1;grid-row:1;min-width:0;min-height:22px;line-height:18px;font-size:11px;padding:2px 0}
  .cloud-bar button,.cloud-bar .install-entry{width:100%;min-width:0;min-height:34px;margin:0!important;padding:6px 2px!important;white-space:nowrap;font-size:11px!important}
  #cloud-sync{grid-column:1;grid-row:2}#cloud-screen-update{grid-column:2;grid-row:2}.cloud-bar .install-entry{grid-column:3;grid-row:2}#cloud-logout{grid-column:4;grid-row:2}
  #cloud-retry{grid-column:1/3;grid-row:3}#cloud-reload{grid-column:3/-1;grid-row:3}
  .cloud-bar .install-label-long{display:none}.cloud-bar .install-label-short{display:inline}
  .cloud-bar:has(.install-entry[hidden]){grid-template-columns:repeat(3,minmax(0,1fr))}.cloud-bar:has(.install-entry[hidden]) #cloud-logout{grid-column:3}.cloud-bar:has(.install-entry[hidden]) #cloud-retry{grid-column:1/3}.cloud-bar:has(.install-entry[hidden]) #cloud-reload{grid-column:3}
  .tabs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));padding:0!important;gap:0!important}.tab{padding:13px 2px!important;text-align:center;font-size:12px;white-space:nowrap}
  .tab[data-tab="report"],#page-report,[onclick="openImport()"],[onclick="openBulkOrders()"],#order-filter-toggle,#order-filter-panel{display:none!important}
  .wrap{padding:16px 12px!important;min-width:0}.page,.field,.modal .body>*,.grid2>*{min-width:0}
  input,select,textarea{font-size:16px!important;max-width:100%;min-width:0}button{min-height:38px}
  input[type="date"]{display:block;width:100%!important;min-width:0!important;max-width:100%!important;min-inline-size:0;inline-size:100%;appearance:none;-webkit-appearance:none;overflow:hidden;min-height:44px}
  input[type="date"]::-webkit-date-and-time-value{min-width:0;text-align:left;min-height:1.4em}
  input[type="date"]::-webkit-datetime-edit{min-width:0;padding:0}
  #c_children,#c_children>div{min-width:0;max-width:100%}
  .customer-toolbar{gap:8px}.customer-toolbar .btn-primary{width:auto;flex:1}.customer-toolbar .search{flex:1 1 100%;width:100%}
  #cust-stats{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px!important}#cust-stats>*{width:auto!important;min-width:0!important}#cust-stats>:first-child{grid-column:1/-1}
  .stats{gap:8px}.stat{min-width:0;padding:12px!important}.stat .val{font-size:22px!important}
  .filterbar{gap:8px;align-items:stretch}.filterbar .seg{display:flex;width:100%;overflow-x:auto}.seg button{flex:1;white-space:nowrap;padding:8px 7px!important}
  #order-filter-event,#order-sort-date{width:calc(50% - 4px);flex:1 1 44%}#custom-range{width:100%;flex-wrap:wrap;gap:6px}#custom-range input{width:43%}.filterbar>.btn-primary{width:100%}
  /* 一覧はカード化。非表示の情報は詳細・編集画面で確認できる。 */
  #page-customers table:has(#cust-tbody),#order-browse table:has(#order-tbody),.detail-orders table,#page-ledger table:has(#ledger-tbody){display:block;background:transparent;border:0;box-shadow:none;width:100%}
  table:has(#cust-tbody) thead,table:has(#order-tbody) thead,.detail-orders thead,table:has(#ledger-tbody) thead{display:none}
  #cust-tbody,#order-tbody,.detail-orders tbody,#ledger-tbody{display:grid;gap:10px;width:100%}
  #cust-tbody tr,#order-tbody tr,.detail-orders tbody tr,#ledger-tbody tr{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px 12px;padding:14px;border:1px solid var(--line);border-radius:14px;background:var(--card);min-width:0}
  #cust-tbody td,#order-tbody td,.detail-orders td,#ledger-tbody td{display:block;border:0!important;padding:0!important;min-width:0;white-space:normal!important}
  #cust-tbody td:first-child{grid-column:1/-1}#cust-tbody td:nth-child(2){align-self:center}#cust-tbody td:nth-child(3),#cust-tbody td:nth-child(4){display:none}
  #order-tbody td:nth-child(1){color:var(--muted);font-size:12px}#order-tbody td:nth-child(2){text-align:right;font-weight:700}
  #order-tbody td:nth-child(3),#order-tbody td:nth-child(4),#order-tbody td:nth-child(6),#order-tbody td:nth-child(7),#order-tbody td:nth-child(8),#order-tbody td:nth-child(9){display:none}
  #order-tbody td:nth-child(5){grid-column:1/-1;margin:4px 0}#order-tbody td:nth-child(10){text-align:left!important;align-self:center}#order-tbody td:nth-child(10)::before{content:'差引額 ';font-size:11px;color:var(--muted);font-weight:400}
  #order-tbody td:nth-child(11){display:flex;justify-content:flex-end;gap:6px}
  .overlay{padding:8px;padding-top:max(8px,env(safe-area-inset-top));padding-bottom:max(8px,env(safe-area-inset-bottom));overflow:hidden;touch-action:pan-y}.modal{width:100%!important;max-width:100%;min-width:0;max-height:calc(100dvh - 24px);border-radius:14px;overflow-x:hidden;overflow-y:auto;overscroll-behavior-x:none;touch-action:pan-y}.modal h2{padding:14px 62px 14px 14px;flex-wrap:wrap;font-size:16px;position:sticky;top:0;z-index:3;background:var(--card)}.modal h2 .x{position:absolute;right:8px;top:8px;display:flex;align-items:center;justify-content:center;width:44px;height:44px;min-width:44px;font-size:28px;background:var(--soft);border-radius:10px}.modal h2>span{min-width:0;max-width:100%}#detail-overlay h2>span:last-child{flex-wrap:wrap}#detail-overlay h2 button:not(.x){font-size:12px}.modal .body,.detail-head,.detail-orders{padding:14px}.modal .body,.grid2,.detail-head{grid-template-columns:minmax(0,1fr)!important}.modal .body .full,.detail-head .full{grid-column:1!important}
  .modal .foot{padding:12px 14px;position:sticky;bottom:0;background:var(--card);z-index:2;flex-wrap:wrap}.modal .foot button{flex:1;white-space:nowrap}
  .contact-row{display:grid!important;grid-template-columns:18px minmax(130px,1.2fr) minmax(0,1fr)!important;gap:6px!important;min-width:0}.contact-row input,.contact-row select{width:100%;min-width:0;padding:10px 6px!important}.contact-row button{grid-column:2/4;justify-self:end;width:auto;padding:6px 12px!important;font-size:12px}
  .item-head{display:none}.item-row:not(.item-head){grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px;padding:12px;border:1px solid var(--line);border-radius:12px;margin-bottom:12px}
  .item-row>.item-no{grid-column:1;grid-row:1}.item-row>button{grid-column:2;grid-row:1;justify-self:end;width:38px}.item-row>div,.item-row>input:nth-child(3){grid-column:1/-1}.item-row>span:nth-last-child(2){display:none}.item-row>input:last-child{grid-column:1/-1!important}.item-row>span[id^="isub"]{grid-column:1/-1}.item-row>span[id^="isub"]::before{content:'小計 ';font-size:12px;color:var(--muted)}
  .mobile-field-label{display:block;font-size:12px;color:var(--muted);margin-bottom:4px}.item-row label input{width:100%}.item-row label{min-width:0}
  .detail-orders tbody td:nth-child(2),.detail-orders tbody td:nth-child(4),.detail-orders tbody td:nth-child(5),.detail-orders tbody td:nth-child(6),.detail-orders tbody td:nth-child(7){display:none}.detail-orders tbody td:nth-child(3){grid-column:1/-1}.detail-orders tbody td:nth-child(8)::before{content:'差引額 ';color:var(--muted);font-size:11px}.detail-orders .hd{flex-wrap:wrap;gap:8px}
  #ledger-tbody td:nth-child(1){white-space:nowrap!important;font-size:12px}#ledger-tbody td:nth-child(2){justify-self:end}#ledger-tbody td:nth-child(3),#ledger-tbody td:nth-child(4){grid-column:1/-1}#ledger-tbody td:nth-child(5){text-align:left!important}
  .anniversary-table{min-width:0;width:100%}.anniversary-table th:last-child,.anniversary-table td:last-child{display:none}.anniversary-table th,.anniversary-table td{padding:8px 5px!important;font-size:12px}
}
