/* Keep the desktop data model and its controls; each record reads top to bottom on phones. */
@media (max-width: 760px), (max-width: 960px) and (max-height: 540px) {
  #stage.utility-mode #panel > .utility-banner {
    position:relative; display:flex; flex-wrap:wrap; align-items:center; gap:4px 9px;
    height:auto; min-height:56px; padding:6px 10px; box-sizing:border-box;
  }
  #panel > .utility-banner :is(.rd-back,.rd-close) {width:44px;height:44px;min-width:44px; padding:0; margin:0;}
  #panel > .utility-banner .rd-identity {flex:1 1 65px; min-width:0;}
  #panel > .utility-banner .rd-banner-actions {width:auto; margin:0; flex:0 1 auto; gap:6px;}
  #panel > .utility-banner .rd-banner-actions:has(> .ui-button) {
    flex:1 1 100%; padding:0; justify-content:flex-start; flex-wrap:wrap;
  }
  #panel > .utility-banner .rd-banner-actions:has(> .ui-button) > .rd-close {position:absolute;right:10px;top:6px;}
  #panel > .utility-banner:has(.rd-banner-actions > .ui-button) .rd-identity {padding-right:48px;}
  #panel > .utility-banner .rd-banner-actions .ui-button {min-height:44px;flex:0 1 auto;padding-inline:12px;}
  #panel :is(.compact-table-box,.relation-list,.ec-management) :is(.table-overflow,.ec-table-wrap:has(> :is(.ec-store-table,.ec-orders-table))) {
    max-height: none; overflow: visible;
  }
  #panel :is(.compact-table-box table,.relation-list table,.ec-store-table,.ec-orders-table) {
    display: block; width: 100%; min-width: 0; table-layout: auto;
  }
  #panel :is(.compact-table-box table,.relation-list table,.ec-store-table,.ec-orders-table) > thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  #panel .ec-orders-table > colgroup {display: none;}
  #panel :is(.compact-table-box table,.relation-list table,.ec-store-table,.ec-orders-table) > tbody {
    display: grid; gap: 8px; min-width: 0;
  }
  #panel :is(.compact-table-box table,.relation-list table,.ec-store-table,.ec-orders-table) > tbody > tr {
    display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px 12px;
    align-items: start; position: relative; padding: 12px; margin: 0;
    border: 1px solid var(--pr-rule,#d8e3f4); border-radius: 8px;
  }
  #panel .ec-management:not(.ec-admin-management) { --pr-rule:#587185; --pr-label:#bbccdc; }
  #panel :is(.compact-table-box table,.relation-list table,.ec-store-table,.ec-orders-table) > tbody > tr > td {
    display: block; position: static; width: auto; max-width: 100%; min-width: 0; height: auto; min-height: 0;
    padding: 0; margin: 0; border: 0; text-align: left; text-overflow: clip;
    background: transparent; white-space: normal; overflow-wrap: anywhere; overflow: visible; line-height: 1.45;
  }
  #panel :is(.compact-table-box table,.relation-list table,.ec-store-table,.ec-orders-table) > tbody > tr > :is(td:first-child,td[colspan]) {
    grid-column: 1/-1; font-size: 15px; font-weight: 650;
  }
  #panel :is(.compact-table-box table,.relation-list table) > tbody > tr[data-to] {padding-right: 28px; cursor:pointer;}
  #panel :is(.compact-table-box table,.relation-list table) > tbody > tr > td:last-child:not([data-phone-label]) {
    position: absolute; inset-inline-end: 9px; inset-block-start: 12px; padding: 0; color:var(--muted);
  }
  #panel :is(.compact-table-box table,.relation-list table) td[data-phone-label]:not(:first-child)::before {
    content: attr(data-phone-label); content: attr(data-phone-label) / "";
  }
  #panel :is(.compact-table-box table,.relation-list table) td[data-phone-label]::before,
  #panel :is(.ec-store-table,.ec-orders-table) td::before {
    display: block; color: var(--pr-label,#546986); font-size: 12px; line-height: 1.35; font-weight: 450; margin-bottom: 2px;
  }
  #panel :is(.ec-store-table,.ec-orders-table) td:not([colspan])::before {
    content: var(--pr-column,none); content: var(--pr-column,none) / "";
  }
  .ec-store-table td:nth-child(2) {--pr-column:'所属平台';}
  .ec-store-table td:nth-child(3) {--pr-column:'营业状态';}
  .ec-store-table td:nth-child(4) {--pr-column:'负责人';}
  .ec-store-table td:nth-child(5) {--pr-column:'已上架';}
  .ec-orders-table td:first-child {--pr-column:'订单号';}
  .ec-orders-table td:nth-child(2) {--pr-column:'店铺 / 平台';}
  .ec-orders-table td:nth-child(3) {--pr-column:'商品 / 编号';}
  .ec-orders-table td:nth-child(4) {--pr-column:'数量';}
  .ec-orders-table td:nth-child(5) {--pr-column:'成交单价';}
  .ec-orders-table td:nth-child(6) {--pr-column:'销售金额';}
  .ec-orders-table td:nth-child(7) {--pr-column:'成交时间';}
  .ec-orders-table td:nth-child(8) {--pr-column:'目的地';}
  .ec-orders-table td:nth-child(9) {--pr-column:'发货状态 / 物流单号';}
  .ec-orders-table td:nth-child(10) {--pr-column:'录入人';}
  .ec-orders-table td.ec-order-reason:last-child {--pr-column:'删除原因';}
  .ec-return-orders-table td:first-child {--pr-column:'退货单号';}
  .ec-return-orders-table td:nth-child(2) {--pr-column:'原销售订单';}
  .ec-return-orders-table td:nth-child(3) {--pr-column:'店铺 / 平台';}
  .ec-return-orders-table td:nth-child(4) {--pr-column:'商品 / 编号';}
  .ec-return-orders-table td:nth-child(5) {--pr-column:'退货数量';}
  .ec-return-orders-table td:nth-child(6) {--pr-column:'退货金额';}
  .ec-return-orders-table td:nth-child(7) {--pr-column:'退货时间';}
  .ec-return-orders-table td:nth-child(8) {--pr-column:'退货原因';}
  .ec-return-orders-table td:nth-child(9) {--pr-column:'状态 / 实物回库';}
  #panel :is(.ec-store-table,.ec-orders-table) > tbody > tr > td:last-child {grid-column:1/-1;}
  #panel .ec-store-table td:first-child {display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between;gap:4px;}
  #panel .ec-orders-page .ec-table-wrap:has(>.ec-orders-table) {padding:0; border:0; background:none;}
  #panel .ec-order-row-actions {flex-wrap:wrap; gap:6px;}
  #panel .ec-store-table td>a {display:inline-flex;align-items:center;font-size:13px;}
  #panel .ec-management :is(.ec-store-table button,.ec-store-table td>a,.ec-admin-back,.ec-admin-create,.ec-order-text) {min-height:44px;}
  #panel .ec-admin-back {min-width:44px;}
  #panel .ec-orders-table .ec-order-fulfillment strong {white-space:normal;}
  #panel .compact-list :is(.compact-search,.compact-search button,.compact-filter-toggle,.table-footer button) {min-height:44px;}
  #panel .relation-list .table-box {overflow:visible;}
  #panel .compact-table-box {border:0;overflow:visible;}
  #panel .compact-table-box .table-footer {display:flex;flex-wrap:wrap;gap:8px;align-items:center;}
  #panel .compact-table-box .table-footer>div {display:flex;flex-wrap:wrap;gap:6px;align-items:center;}

  #panel .blueprint-notices [data-ph-notice] {
    display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:start; gap:5px 8px;
    width:100%; padding:12px; border:0; border-radius:7px; background:white; color:#203d72;
    font:inherit; text-align:left; overflow-wrap:anywhere;
  }
  #panel .blueprint-notices [data-ph-notice] .ph-work-date {
    display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
  }

  /* Keep shop coverage comparable across columns; pin only the product name on narrow screens. */
  #panel .ec-listings-matrix th.ec-listing-sku {left:auto;z-index:4;}
  #panel .ec-listings-matrix td.ec-listing-sku {position:static;}
  #panel .ec-listings-matrix :is(th,td).ec-listing-product {left:0;}
  #panel .ec-listings-matrix col:nth-child(2) {width:clamp(98px,32vw,148px)!important;}
  #panel .ec-listings-matrix input.ec-listing-matrix-check {width:32px;height:32px;outline-offset:2px;}
  #panel .ec-listings-page :is([data-listing-save],[data-listing-master],[data-listing-price],[data-listing-filter],[data-listing-search]) {min-height:44px;}
  #panel .ec-listings-scroll {overscroll-behavior-y:auto;}

  /* Fit the stock search and its popover to the available viewport while the keyboard is open. */
  #panel .whf-page .whf-icon-btn, #panel .whf-page .whf-back {width:44px; height:44px; min-width:44px; padding:0;}
  #panel .whf-page .whf-catalog-filters, #panel .whf-page .whf-banner-actions {gap:4px;}
  #panel .whf-page .whf-banner-tools {flex-wrap:wrap;gap:4px;justify-content:space-between;}
  #panel .whf-page .whf-banner-actions {padding:0;border:0;}
  #panel .whf-tool-panel {
    max-height:min(70dvh,calc(var(--keyboard-view-height,100dvh) * .67)); overflow-y:auto; overscroll-behavior:contain;
  }
  html[data-mobile-keyboard] #panel .whf-search-panel {
    position:fixed; top:calc(var(--keyboard-view-top,0px) + 8px); left:10px;right:10px;
    margin:0; width:auto; max-width:none;
  }
  #panel .whf-filter-footer {flex-wrap:wrap;}
  #panel .whf-tool-panel :is(button,select,input) {min-height:44px;}
  #panel .wh-summary {column-gap:12px;row-gap:4px;}
  #panel .wh-stat {min-height:0;}
  #panel .wh-sync {white-space:nowrap;}
  #panel .wh-page .wh-select {min-width:0;}
  #panel .wh-page .wh-table .wh-detail-row:not([hidden]) > td {display:block;}

  /* Account preferences and account actions. */
  #panel form[data-submit=settings] :is(.form-footer button,.switch) {min-height:44px;}
  #panel .sections:has(> form[data-submit=settings]) :is(.cards,.details) {display:grid;gap:0;grid-template-columns:minmax(0,1fr);}
  #panel .sections:has(> form[data-submit=settings]) .cards {border-block:1px solid var(--line);}
  #panel .sections:has(> form[data-submit=settings]) .info-card {
    min-height:52px;height:auto;border:0;border-bottom:1px solid var(--line);
    padding:10px 25px 10px 3px;border-radius:0;text-align:left;
  }
  #panel .sections:has(> form[data-submit=settings]) .info-card:last-child {border-bottom:0;}
  #panel .sections:has(> form[data-submit=settings]) .info-card .mini-cube {display:none;}
  #panel .sections:has(> form[data-submit=settings]) .info-card strong {margin:0;font-size:15px;}
  #panel .sections:has(> form[data-submit=settings]) .info-card p {margin:3px 0 0;font-size:13px;line-height:1.45;}
  #panel .sections:has(> form[data-submit=settings]) .info-card .arrow {top:12px;right:4px;}
  #panel .sections:has(> form[data-submit=settings]) .details>div {
    display:grid;grid-template-columns:7em minmax(0,1fr);gap:8px;align-items:baseline;padding:6px 10px;
  }
  #panel .sections:has(> form[data-submit=settings]) .details p {margin:0;font-size:14px;}
}
@media(max-width:650px) {
  #panel .whf-page .whf-banner:has(.whf-catalog-stats) {grid-template-columns:44px minmax(0,1fr);}
}
