@media (max-width: 720px) {
  :root { --nav-height: 68px; }
  body { padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom)); }
  html, body { overflow-x: hidden; }
  .shell { display: block; min-height: 100vh; }
  aside { position: fixed; z-index: 100; top: auto; right: 0; bottom: 0; left: 0; width: auto; height: calc(var(--nav-height) + env(safe-area-inset-bottom)); padding: 6px 5px env(safe-area-inset-bottom); border-top: 1px solid #ffffff1b; box-shadow: 0 -8px 30px #17151f2e; }
  .brand { display: none; }
  nav { display: grid; grid-template-columns: repeat(9,1fr); height: 100%; gap: 2px; }
  nav button { display: grid; min-width: 0; min-height: 54px; place-items: center; gap: 1px; padding: 5px 2px; border-radius: 11px; font-size: 11px; text-align: center; }
  nav button i { width: 24px; height: 22px; background: transparent; font-size: 11px; }
  nav button.active { background: #ffffff; }
  main { padding: 0 10px 20px; }
  header { position: sticky; z-index: 50; top: 0; margin: 0 -10px 13px; padding: 12px 14px 10px; border-bottom: 1px solid var(--line); background: #f7f8fbec; backdrop-filter: blur(14px); }
  header h1 { font-size: 20px; }
  header p { max-width: 72vw; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
  .status-dot { font-size: 0; }
  .status-dot::before { width: 8px; height: 8px; margin: 0; }
  .current-user { max-width: 96px; padding: 4px 7px; font-size: 11px; }
  .page, .page.active { gap: 11px; }
  .header-actions { gap: 5px; }
  .header-actions .small-button { min-height: 30px; padding: 4px 7px; font-size: 11px; }
  .card { padding: 14px; border-radius: 15px; box-shadow: 0 3px 15px #29253d0b; }
  .entry-hero { gap: 9px; padding: 0 2px; }
  .entry-hero h2 { font-size: 16px; }
  .entry-hero p { font-size: 11px; }
  .step-number { flex-basis: 30px; width: 30px; height: 30px; border-radius: 10px; font-size: 13px; }
  .photo-card { border-radius: 16px; }
  .photo-upload-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .photo-title { padding: 9px 10px; }
  .photo-picker { min-height: 190px; }
  .photo-picker.compact { min-height: 145px; }
  .photo-picker img { max-height: 310px; }
  .photo-picker b { font-size: 15px; }
  .photo-picker small { padding: 0 6px; font-size: 10px; }
  .recognize-status { min-height: 46px; flex-wrap: wrap; gap: 2px 8px; padding: 9px 11px; }
  .recognize-status.error { text-align: left; }
  .recognize-actions { grid-template-columns: 1fr 1fr; gap: 7px; }
  .recognize-actions button { min-height: 50px; padding: 8px 5px; font-size: 13px; }
  .task-center-head { padding: 11px 12px; }
  .task-grid { grid-template-columns: 1fr 1fr; }
  .task-item { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .task-item:nth-child(even) { border-right: 0; }
  .task-item:nth-last-child(-n+2) { border-bottom: 0; }
  .quick-form, .form-grid, .advanced-grid, .today-order-form, .today-filter, .inventory-filter, .sale-form { grid-template-columns: 1fr; gap: 11px; }
  .field-wide { grid-column: 1; }
  .inventory-filter .field-wide { grid-column: 1; }
  .today-order-form #today-save-button, .today-order-form .today-profit-box { grid-column: 1; }
  .today-order-form #today-save-button, .today-order-form .today-profit-box { order: 0; }
  .today-order-form #today-save-button { width: 100%; }
  .today-order-form .today-profit-box { min-height: 68px; }
  .sale-item-row { grid-template-columns: 1fr; padding: 9px; }
  .sale-product-field .autocomplete-menu { width: 100%; max-height: 360px; }
  .sale-product-summary { min-height: 42px; font-size: 12px; line-height: 1.4; }
  .sale-form #add-sale-item, .sale-form .sale-shipping-field, .sale-form .sale-amount-field, .sale-form #sale-save-button { grid-column: 1; width: 100%; }
  .sale-form #sale-save-button { order: 0; }
  input, select, textarea, button, .button { min-height: 46px; font-size: 16px; }
  button, .button { font-size: 14px; }
  .profit-box { grid-template-columns: 1fr auto; }
  .profit-box strong { font-size: 22px; }
  .success-card div { display: grid; grid-template-columns: 1fr 1fr; }
  .toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .toolbar input { grid-column: 1 / -1; }
  .toolbar select { width: 100%; }
  .account-toolbar .account-total-badge { min-height: 44px; }
  .bulk-import-form { grid-template-columns: 1fr; align-items: stretch; }
  .bulk-file-picker > span { min-height: 58px; }
  .failed-import-item { grid-template-columns: 76px minmax(0,1fr); gap: 10px; }
  .failed-image { width: 76px; height: 70px; }
  .failed-import-item form { grid-column: 1 / -1; grid-template-columns: 1fr; }
  .package-toolbar { grid-template-columns: 1fr 1fr; }
  .package-toolbar input { grid-column: 1 / -1; }
  .order-toolbar select, .package-toolbar select { width: 100%; }
  .order-batch-actions { display: grid; grid-template-columns: 1fr 1fr; padding: 9px; }
  .mobile-select-all { display: flex; min-height: 46px; align-items: center; justify-content: center; gap: 9px; padding: 8px 12px; border: 1px solid #dedafc; border-radius: 12px; background: #f4f1ff; color: var(--primary-dark); font-size: 14px; font-weight: 800; }
  .mobile-select-all input { width: 22px; min-height: 22px; margin: 0; }
  .order-batch-actions .mobile-select-all { grid-column: 1 / -1; }
  .order-batch-actions > span { grid-column: 1 / -1; margin-right: 0; text-align: center; }
  .order-batch-actions .danger { grid-column: 1 / -1; }
  .pagination-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 4px; }
  .pagination-bar > span, .pagination-bar label { grid-column: 1 / -1; }
  .pagination-bar select, .pagination-bar button { width: 100%; }
  .package-mobile-select-all { margin-top: 9px; }
  .columns, .card-grid, .metrics, .today-summary, .today-breakdown { grid-template-columns: 1fr; gap: 10px; }
  .today-stat-list ul { max-height: 190px; }
  .product-manager { grid-template-columns: 1fr; gap: 10px; }
  .category-panel, .product-panel { position: static; height: auto; max-height: none; overflow: visible; }
  .category-panel, .product-panel { padding: 12px; }
  .panel-heading { align-items: flex-start; }
  .category-create { margin-bottom: 11px; }
  .category-nav { display: flex; gap: 8px; margin: 0 -14px; padding: 0 14px 3px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; scrollbar-width: none; }
  .category-nav::-webkit-scrollbar { display: none; }
  .category-nav-item { flex: 0 0 min(220px,72vw); scroll-snap-align: start; background: #f8f8fb; }
  .category-nav-item.active { background: #f4f2ff; }
  .category-item-actions { display: flex; opacity: 1; }
  .category-select { min-height: 48px; }
  .product-panel { min-height: 0; }
  .product-panel-head { display: grid; align-items: stretch; gap: 10px; padding-bottom: 13px; }
  .product-panel-head > div { min-width: 0; }
  .product-panel-head > button { width: 100%; min-height: 44px; padding: 8px 10px; font-size: 14px; }
  .product-create-panel { padding: 13px; }
  .product-search, .category-search { margin-top: 10px; font-size: 15px; }
  .product-batch-bar { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 9px; }
  .product-batch-bar .check { margin-right: 0; }
  .product-batch-bar button { width: 100%; }
  .form-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .form-actions button { min-width: 0; }
  .product-row { grid-template-columns: auto auto 48px minmax(0,1fr); align-items: start; gap: 8px 10px; padding: 11px; }
  .product-select-box { min-height: 46px; align-items: center; }
  .product-drag-handle { min-height: 46px; }
  .product-thumb { width: 48px; height: 48px; border-radius: 10px; }
  .product-title-line { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: start; gap: 8px; }
  .product-title-line h3 { font-size: 14px; line-height: 1.45; }
  .product-title-line strong { font-size: 13px; }
  .product-row > .actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
  .today-product-cell, .inventory-product-cell { grid-template-columns: 44px minmax(0,1fr); }
  .today-product-cell .product-thumb, .inventory-product-cell .product-thumb { width: 44px; height: 44px; }
  .product-empty { min-height: 190px; padding: 24px 12px; }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .metric { padding: 13px; }
  .metric strong { font-size: 21px; }
  .account-card { padding: 8px; }
  .account-card-main { min-height: 0; gap: 9px; padding: 8px; }
  .account-card-head b { font-size: 14px; }
  .account-note { padding: 8px; }
  .account-stats { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
  .account-stats > span { min-height: 56px; place-content: center; padding: 7px; }
  .account-card .actions { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; padding: 3px 8px 8px; }
  .account-card .actions button { min-height: 42px; font-size: 13px; }
  .bulk-details > summary { min-height: 50px; }
  .inline-form { display: grid; grid-template-columns: 1fr auto; }
  .list-row { align-items: flex-start; }
  .list-row > span { min-width: 0; overflow-wrap: anywhere; }
  .table-wrap { overflow: visible; padding: 0; border: 0; background: transparent; box-shadow: none; }
  table, thead, tbody, tr, td { display: block; }
  thead { display: none; }
  tbody { display: grid; gap: 9px; }
  tr { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 3px 12px #29253d0b; }
  td { display: grid; grid-template-columns: 80px minmax(0,1fr); gap: 8px; width: 100%; padding: 10px 12px; overflow-wrap: anywhere; border-bottom: 1px solid #eff0f4; }
  td:last-child { border-bottom: 0; }
  td::before { color: var(--muted); font-size: 11px; font-weight: 700; }
  #orders-body td:nth-child(2)::before { content: "订单"; }
  #orders-body td:nth-child(3)::before { content: "商品"; }
  #orders-body td:nth-child(4)::before { content: "收支"; }
  #orders-body td:nth-child(5)::before { content: "包裹"; }
  #orders-body td:nth-child(6)::before { content: "操作"; }
  #packages-body td:nth-child(2)::before { content: "账号"; }
  #packages-body td:nth-child(3)::before { content: "运单号"; }
  #packages-body td:nth-child(4)::before { content: "快递"; }
  #packages-body td:nth-child(5)::before { content: "订单"; }
  #packages-body td:nth-child(6)::before { content: "状态"; }
  #packages-body td:nth-child(7)::before { content: "操作"; }
  #today-orders-body td:nth-child(2)::before { content: "账号"; }
  #today-orders-body td:nth-child(3)::before { content: "购买商品"; }
  #today-orders-body td:nth-child(4)::before { content: "下单金额"; }
  #today-orders-body td:nth-child(5)::before { content: "返金币"; }
  #today-orders-body td:nth-child(6)::before { content: "回款金额"; }
  #today-orders-body td:nth-child(7)::before { content: "利润"; }
  #today-orders-body td:nth-child(8)::before { content: "操作"; }
  #inventory-body td:nth-child(1)::before { content: "商品"; }
  #inventory-body td:nth-child(2)::before { content: "最近入库"; }
  #inventory-body td:nth-child(3)::before { content: "入库数量"; }
  #inventory-body td:nth-child(4)::before { content: "卖出数量"; }
  #inventory-body td:nth-child(5)::before { content: "当前库存"; }
  #inventory-body td:nth-child(6)::before { content: "库存金额"; }
  #sales-body td:nth-child(1)::before { content: "时间"; }
  #sales-body td:nth-child(2)::before { content: "商品"; }
  #sales-body td:nth-child(3)::before { content: "数量"; }
  #sales-body td:nth-child(4)::before { content: "销售金额"; }
  #sales-body td:nth-child(5)::before { content: "运费"; }
  #sales-body td:nth-child(6)::before { content: "操作"; }
  #orders-body td.select-cell, #packages-body td.select-cell, #today-orders-body td.select-cell { display: block; padding: 8px 12px 2px; border-bottom: 0; }
  #orders-body td.select-cell::before, #packages-body td.select-cell::before, #today-orders-body td.select-cell::before { content: none; }
  .order-main, .finance-cell, .package-account { grid-column: 2; }
  .sticky-actions { position: static; box-shadow: none; }
  #page-orders table { min-width: 0; table-layout: auto; }
  #page-inventory table, #page-sales table { min-width: 0; table-layout: auto; }
  #inventory-body td, #sales-body td { grid-template-columns: 74px minmax(0,1fr); align-items: center; }
  #inventory-body td:first-child, #sales-body td:nth-child(2) { grid-template-columns: 1fr; gap: 5px; }
  #inventory-body td:first-child::before, #sales-body td:nth-child(2)::before { display: block; margin-bottom: 2px; }
  #inventory-body tr, #sales-body tr { border-radius: 13px; }
  .inventory-detail-filter, .inventory-detail-summary, .inventory-purchase-item { grid-template-columns: 1fr; }
  #sales-body .actions { grid-template-columns: 1fr; }
  #logs-body td:nth-child(1)::before { content: "时间"; }
  #logs-body td:nth-child(2)::before { content: "运单号"; }
  #logs-body td:nth-child(3)::before { content: "结果"; }
  #logs-body td:nth-child(4)::before { content: "说明"; }
  #audit-body td:nth-child(1)::before { content: "时间"; }
  #audit-body td:nth-child(2)::before { content: "操作对象"; }
  #audit-body td:nth-child(3)::before { content: "具体操作"; }
  #audit-body td:nth-child(4)::before { content: "操作人"; }
  td.empty { display: block; }
  .actions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); width: 100%; }
  .actions button { min-height: 42px; touch-action: manipulation; }
  .actions button.danger, button.danger[data-action*="delete"], button.danger:not([data-action]) { min-height: 44px; }
  .scan-card { padding: 18px 13px; }
  .scan-card form { grid-template-columns: 1fr; }
  .scan-card input { min-height: 56px; font-size: 20px; text-align: center; }
  .scan-card form button { min-height: 50px; }
  .candidate { align-items: flex-start; }
  .edit-item-row { grid-template-columns: 1fr 1fr; }
  .edit-item-row label:first-child, .edit-item-row button { grid-column: 1 / -1; }
  .modal, .modal.wide-modal, .image-modal { width: 100vw; max-width: none; height: min(92vh,850px); max-height: 92vh; margin: auto 0 0; border-radius: 20px 20px 0 0; }
  .modal-head { padding: 14px 15px; }
  .modal-body { max-height: calc(92vh - 128px); padding: 14px; }
  .modal-actions { padding: 10px 13px calc(10px + env(safe-area-inset-bottom)); }
  .modal-actions button { flex: 1; }
  .image-gallery { grid-template-columns: 1fr; padding: 10px; }
  .recycle-item { grid-template-columns: auto minmax(0,1fr); }
  .recycle-item .actions { display: grid; grid-column: 1 / -1; }
  .recycle-toolbar .check { width: 100%; margin-right: 0; }
  .recycle-toolbar button { flex: 1; }
  .recycle-item .actions { grid-template-columns: 1fr 1fr; }
  .ranking-list > div { grid-template-columns: 24px minmax(0,1fr) auto; }
  .ranking-list > div strong { grid-column: 2 / -1; }
  #toast { right: 11px; bottom: calc(var(--nav-height) + 10px + env(safe-area-inset-bottom)); left: 11px; max-width: none; text-align: center; }
}

@media (max-width: 365px) {
  nav button span { font-size: 10px; }
  td { grid-template-columns: 68px minmax(0,1fr); }
}
