/* 光采 ERP 手机 / 平板统一响应式层
   mobile-responsive-system-v1: 只改布局和触控体验，不改业务状态、权限或数据。 */

/* mobile-safe-header-v1: 手机页面抬头、iPhone 安全区和搜索吸顶共用同一垂直基线。 */

#mobileTabBar[hidden],
#mobileMoreSheet[hidden],
#mobileMoreBackdrop[hidden] {
  display: none !important;
}

/* 平板：保留折叠侧栏，减少桌面多栏挤压。 */
@media (min-width: 768px) and (max-width: 1023px) {
  main#main {
    padding: 18px 18px 104px !important;
  }

  .controls {
    padding: 12px 18px;
  }

  .today-cards,
  .today-cards-dev,
  .today-cards-po,
  body.sidebar-collapsed .today-cards,
  body.sidebar-collapsed .today-cards-dev,
  body.sidebar-collapsed .today-cards-po {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .style-grid,
  .po-grid,
  .po-arch-grid,
  .prod-grid-wrapper {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .ship-page,
  .plog-page,
  .client-info-page {
    padding-left: 18px !important;
    padding-right: 18px !important;
  }

  .ship-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ship-cell:nth-child(3n) {
    border-right: 0;
  }

  .ship-cell:nth-child(-n + 3) {
    border-bottom: 1px solid var(--line-soft, #e5e5ea);
  }

  .ship-table-wrap,
  .admin-table-wrap,
  .qt-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .ship-table {
    min-width: 920px;
  }

  .client-info-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* 手机：统一到 767px，不按具体手机型号写死。 */
@media (max-width: 767px) {
  :root {
    --gc-mobile-nav-height: 58px;
    --gc-mobile-page-gap: 12px;
  }

  html,
  body {
    width: 100%;
    min-width: 0;
    min-height: 100%;
    overflow-x: hidden;
    overscroll-behavior-x: none;
  }

  body.mobile-sheet-open {
    overflow: hidden !important;
    touch-action: none;
  }

  .sidebar,
  #sidebar,
  .storage-notice,
  .collapsed-flyout {
    display: none !important;
  }

  .content-area {
    width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
  }

  body.gc-mobile-head-visible .gc-admin-page-head {
    position: sticky;
    top: 0;
    z-index: 70;
    width: 100%;
    height: calc(44px + env(safe-area-inset-top));
    min-height: calc(44px + env(safe-area-inset-top));
    box-sizing: border-box;
    display: flex !important;
    align-items: flex-end;
    padding: env(safe-area-inset-top) 14px 0;
    border-bottom: 1px solid var(--line, #e5e5ea);
    background: rgba(251, 251, 253, 0.96);
    box-shadow: 0 1px 8px rgba(20, 20, 24, 0.04);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    backdrop-filter: saturate(180%) blur(18px);
  }

  body.gc-mobile-head-visible .gc-admin-page-head[hidden] {
    display: none !important;
  }

  body.gc-mobile-head-visible .gc-admin-page-sidebar-trigger,
  body.gc-mobile-head-visible .gc-admin-page-head-separator,
  body.gc-mobile-head-visible .gc-admin-page-actions {
    display: none !important;
  }

  body.gc-mobile-head-visible .gc-admin-page-breadcrumb {
    min-width: 0;
    height: 44px;
    display: flex;
    align-items: center;
    padding-right: 52px;
  }

  body.gc-mobile-head-visible .gc-admin-page-breadcrumb strong {
    overflow: hidden;
    color: var(--ink, #1d1d1f);
    font-size: 17px;
    font-weight: 750;
    line-height: 1.2;
    letter-spacing: -0.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  main#main {
    width: 100%;
    min-width: 0;
    padding: 12px 12px calc(var(--gc-mobile-nav-height) + env(safe-area-inset-bottom) + 28px) !important;
    scroll-padding-bottom: calc(var(--gc-mobile-nav-height) + env(safe-area-inset-bottom) + 24px);
    -webkit-overflow-scrolling: touch;
  }

  main#main > * {
    min-width: 0;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* 输入框使用 16px，避免 iPhone 聚焦时自动放大页面。 */
  input,
  select,
  textarea,
  [contenteditable="true"] {
    font-size: 16px !important;
  }

  button,
  [role="button"] {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  main#main button,
  .drawer button,
  .modal button,
  .app-dialog button,
  .template-modal button,
  .client-info-modal button,
  .gc-cu-modal button {
    min-height: 44px;
  }

  /* 顶部搜索和筛选：一行一个职责，筛选可横向滑动。 */
  .controls {
    width: 100%;
    padding: 10px 12px;
    gap: 8px;
    align-items: stretch;
    background: var(--bg, #f5f5f7);
  }

  .controls .search {
    flex: 1 0 100%;
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .controls .search input {
    min-height: 44px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .controls .filter-group,
  .cg-chips-row .filter-group,
  .patternlog-filters,
  .plog-facets,
  .ship-subtabs {
    max-width: 100%;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .controls .filter-group::-webkit-scrollbar,
  .cg-chips-row .filter-group::-webkit-scrollbar,
  .patternlog-filters::-webkit-scrollbar,
  .plog-facets::-webkit-scrollbar,
  .ship-subtabs::-webkit-scrollbar {
    display: none;
  }

  .filter-btn,
  .view-toggle button,
  .ship-subtab,
  .plog-chip,
  .plog-section-tab,
  .gc-sdf-chip,
  .peter-ai-brand-option {
    min-height: 44px;
    flex: 0 0 auto;
  }

  .view-toggle {
    width: 100%;
    margin-left: 0;
  }

  .view-toggle button {
    flex: 1;
  }

  .ef-date-filter,
  .show-po-toggle {
    min-height: 44px;
  }

  .erp-filter-status,
  .ship-filter-status {
    margin-left: 0;
    margin-right: 0;
  }

  /* 手机顶部只保留报警，批量入口放在“更多”里。 */
  .global-tools,
  .floating-tools {
    top: calc(8px + env(safe-area-inset-top)) !important;
    right: 10px !important;
    gap: 6px;
  }

  body.gc-mobile-head-visible .global-tools,
  body.gc-mobile-head-visible .floating-tools {
    top: calc(1px + env(safe-area-inset-top)) !important;
  }

  .global-tools .batch-toggle-btn,
  .floating-tools .batch-toggle-btn {
    display: none !important;
  }

  .alert-bell,
  .floating-btn {
    width: 42px !important;
    height: 42px !important;
  }

  .today-search-bar {
    top: 0;
    z-index: 60;
    min-height: 46px;
    margin: 0 52px 10px 0 !important;
    padding: 8px 11px;
    border-radius: 9px;
    background: var(--bg-elevated, #fbfbfd);
  }

  body.peter-topbar-trial .today-search-bar {
    margin-right: 0 !important;
  }

  .alert-panel {
    top: calc(58px + env(safe-area-inset-top));
    right: 10px !important;
    left: 10px !important;
    width: auto !important;
    max-height: calc(100dvh - 86px - var(--gc-mobile-nav-height) - env(safe-area-inset-bottom));
  }

  /* 底部导航：安全区属于导航本身，主内容同步让位。 */
  #mobileTabBar {
    display: flex !important;
    height: calc(var(--gc-mobile-nav-height) + env(safe-area-inset-bottom)) !important;
    padding: 0 4px env(safe-area-inset-bottom) !important;
    background: var(--bg-elevated, #fbfbfd) !important;
    border-top: 1px solid var(--line, #e5e5ea) !important;
    box-shadow: 0 -3px 16px rgba(20, 20, 24, 0.06);
  }

  .mtab-item {
    min-width: 0;
    min-height: var(--gc-mobile-nav-height);
    gap: 2px;
    color: var(--ink-mute, #6b6b6e);
    font-size: 10.5px;
    font-weight: 650;
  }

  .mtab-item.active {
    color: var(--apple-blue, #007aff);
  }

  .mtab-item .mtab-icon {
    width: 23px;
    height: 23px;
  }

  #mobileMoreSheet {
    bottom: calc(var(--gc-mobile-nav-height) + env(safe-area-inset-bottom)) !important;
    max-height: min(70dvh, 560px);
    overflow-y: auto;
    padding: 8px 8px calc(10px + env(safe-area-inset-bottom)) !important;
    border-radius: 16px 16px 0 0;
    background: var(--bg-elevated, #fbfbfd) !important;
    transform: translateY(100%);
    transition: transform var(--gc-motion-panel-exit, 170ms) var(--gc-ease-out, cubic-bezier(0.23, 1, 0.32, 1));
    will-change: transform;
  }

  #mobileMoreSheet.open {
    transform: translateY(0);
    transition-duration: var(--gc-motion-panel-enter, 240ms);
    transition-timing-function: var(--gc-ease-drawer, cubic-bezier(0.32, 0.72, 0, 1));
  }

  #mobileMoreBackdrop {
    transition: opacity 140ms var(--gc-ease-out, cubic-bezier(0.23, 1, 0.32, 1));
  }

  #mobileMoreBackdrop.open {
    transition-duration: 190ms;
  }

  .msheet-btn {
    min-height: 52px;
    padding: 12px 14px !important;
    border-radius: 10px;
    color: var(--ink, #1d1d1f) !important;
  }

  /* 今日、开发、生产、历史：单列优先。 */
  .today-page,
  .admin-wrap,
  .ship-page,
  .plog-page,
  .client-info-page,
  .patternlog-page {
    width: 100%;
    min-width: 0;
    padding: 0 0 18px !important;
  }

  .today-cards,
  .today-cards-dev,
  .today-cards-po,
  body.sidebar-collapsed .today-cards,
  body.sidebar-collapsed .today-cards-dev,
  body.sidebar-collapsed .today-cards-po {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 9px !important;
  }

  .today-card {
    min-width: 0;
    padding: 11px !important;
    gap: 10px;
  }

  .today-card .thumb-mini,
  .today-card .thumb-mini-placeholder {
    width: 52px;
    height: 66px;
  }

  .today-card-v2 .today-card-row1 {
    flex-wrap: wrap;
    gap: 5px;
  }

  .today-card-v2 .today-card-row2,
  .today-card-v2 .today-card-row3 {
    flex-wrap: wrap;
    row-gap: 3px;
  }

  .today-card-v2 .today-card-row3 .today-card-ef {
    margin-left: auto;
  }

  .admin-overview-bar,
  .cg-chips-row {
    max-width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

  .admin-overview-chip,
  .cg-chips-row .filter-btn {
    flex: 0 0 auto;
    min-height: 40px;
  }

  /* 开发列表：图片在左，主要信息和当前节点分两行，不再压成四小列。 */
  .list-header,
  .list-header.simplified,
  .production-list-header {
    display: none !important;
  }

  .style-list,
  .production-list {
    overflow: visible;
    border-radius: 10px;
  }

  .style-row,
  .style-row.simplified {
    display: grid !important;
    grid-template-columns: 52px minmax(0, 1fr) auto !important;
    grid-template-rows: auto auto auto !important;
    gap: 5px 9px !important;
    align-items: center !important;
    padding: 10px !important;
  }

  .style-row > .thumb,
  .style-row > .thumb-placeholder,
  .style-row.simplified > .thumb,
  .style-row.simplified > .thumb-placeholder {
    grid-column: 1 !important;
    grid-row: 1 / 4 !important;
    width: 52px !important;
    height: 68px !important;
    align-self: start !important;
  }

  .style-row > .sku,
  .style-row.simplified > .sku {
    grid-column: 2 !important;
    grid-row: 1 !important;
    display: block !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    word-break: normal !important;
    font-size: 13px !important;
    font-weight: 720 !important;
  }

  .style-row > .client-badge,
  .style-row.simplified > .client-badge {
    grid-column: 3 !important;
    grid-row: 1 !important;
    align-self: center !important;
    justify-self: end !important;
    margin: 0 !important;
  }

  .style-row > div:not(.sku):not(.client-badge):not(.thumb):not(.thumb-placeholder):not(.node-block):not(.arrow),
  .style-row.simplified > div:not(.sku):not(.client-badge):not(.thumb):not(.thumb-placeholder):not(.node-block):not(.arrow) {
    grid-column: 2 / 4 !important;
    grid-row: 2 !important;
    min-width: 0 !important;
  }

  .style-row > .node-block,
  .style-row.simplified > .node-block {
    grid-column: 2 / 4 !important;
    grid-row: 3 !important;
    min-width: 0 !important;
    margin: 0 !important;
    text-align: left !important;
  }

  .style-row .node-block-row1 {
    justify-content: flex-start !important;
  }

  .style-row .arrow,
  .production-row .arrow,
  .style-row .batch-checkbox,
  .style-row .row-batch-checkbox,
  .production-row .batch-checkbox,
  .production-row .row-batch-checkbox {
    display: none !important;
  }

  .production-row {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 7px 10px !important;
    padding: 11px !important;
    align-items: flex-start !important;
  }

  .production-row > * {
    min-width: 0;
  }

  .production-row > .thumb,
  .production-row > .thumb-placeholder {
    width: 52px !important;
    height: 68px !important;
    flex: 0 0 52px !important;
  }

  .production-row > *:not(.thumb):not(.thumb-placeholder):not(.arrow):not(.batch-checkbox):not(.row-batch-checkbox) {
    flex: 1 1 calc(50% - 10px);
  }

  /* 平铺、看板和版师档案。 */
  .style-grid,
  .po-grid,
  .po-arch-grid,
  .prod-grid-wrapper,
  .prod-board,
  .peter-ai-workbench-grid,
  .peter-ai-workbench-grid.workbench-grid-core {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 10px !important;
  }

  .style-grid,
  .po-grid {
    padding: 0 !important;
  }

  .grid-card {
    min-height: 116px;
  }

  .grid-card-img-wrap {
    width: 92px !important;
  }

  .board {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: min(82vw, 320px);
    grid-template-columns: none !important;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    padding-bottom: 8px;
  }

  .board-col {
    scroll-snap-align: start;
  }

  .plog-header {
    margin-bottom: 16px;
  }

  .plog-header-title {
    font-size: 24px;
  }

  .plog-header-stats {
    font-size: 12px;
    line-height: 1.7;
  }

  .plog-toolbar-row {
    align-items: stretch;
    flex-direction: column;
  }

  .plog-view-toggle {
    width: 100%;
    height: 44px;
  }

  .plog-view-toggle button {
    flex: 1;
    justify-content: center;
  }

  .plog-facets {
    margin-inline: -12px;
    padding-inline: 12px;
  }

  .plog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 9px;
  }

  .plog-group {
    margin-top: 26px;
  }

  .plog-group-header {
    align-items: flex-start;
    margin-bottom: 11px;
    padding-bottom: 9px;
  }

  .plog-group-title {
    font-size: 17px;
  }

  .plog-list-row {
    grid-template-columns: 54px minmax(0, 1fr) !important;
    gap: 10px;
    padding: 9px !important;
  }

  .plog-list-thumb {
    width: 54px !important;
  }

  .plog-list-aside {
    grid-column: 1 / -1;
    min-width: 0;
  }

  /* 生产 / QC：状态入口适应宽度，业务卡片上下分层。 */
  .pq2-top {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .pq2-st,
  .pq2-report-btn {
    width: 100%;
    min-width: 0;
    min-height: 58px;
    margin: 0;
    padding: 8px 9px;
  }

  .pq2-report-btn {
    grid-column: 1 / -1;
    min-height: 44px;
  }

  .pq2-po {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 8px 10px;
    align-items: start;
    padding: 10px;
  }

  .pq2-img {
    grid-column: 1;
    grid-row: 1;
    width: 46px;
    height: 58px;
  }

  .pq2-mid {
    grid-column: 2;
    grid-row: 1;
  }

  .pq2-right {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    min-width: 0;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .pq2-acts,
  .pq2-dual,
  .pq2-focus {
    gap: 6px;
    flex-wrap: wrap;
  }

  .pq2-btn,
  .pq2-chip {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
  }

  .pv2-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pv2-sm,
  .pv2-report-btn {
    min-width: 0;
    margin: 0;
    white-space: normal;
  }

  .pv2-sm.gap {
    display: none;
  }

  .pv2-report-btn {
    grid-column: 1 / -1;
    min-height: 44px;
  }

  .pv2-h {
    padding: 11px 12px;
    flex-wrap: wrap;
  }

  .pv2-h .why {
    flex: 1 0 100%;
    margin-left: 25px;
  }

  .pv2-body {
    padding: 10px;
  }

  .prod-arrival-grid,
  .defect-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  /* 船务：摘要分格，流水线在每张卡片内部横向滑动。 */
  .ship-title-row {
    align-items: flex-start;
    margin-bottom: 12px;
  }

  .ship-page-title {
    font-size: 19px;
  }

  .ship-report-btn {
    min-height: 44px;
    margin-left: auto;
  }

  .ship-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 12px;
    box-shadow: none;
  }

  .ship-cell {
    min-width: 0;
    min-height: 96px;
    padding: 10px;
    border-bottom: 1px solid var(--line-soft, #e5e5ea);
  }

  .ship-cell:nth-child(3n) {
    border-right: 0;
  }

  .ship-cell:nth-child(n + 4) {
    border-bottom: 0;
  }

  .ship-cell .sc-head {
    gap: 4px;
    flex-wrap: wrap;
  }

  .ship-cell .sc-mode {
    margin-left: 0;
  }

  .ship-subtabs {
    width: 100%;
    height: 44px;
  }

  .ship-search-input {
    width: 100%;
    max-width: none;
    height: 44px;
  }

  .ship-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .ship-table,
  .ship-table tbody {
    display: block;
    width: 100%;
  }

  .ship-table thead {
    display: none;
  }

  .ship-table tr.s-row {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 8px 10px;
    width: 100%;
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid var(--line-soft, #e5e5ea);
    border-radius: 11px;
    background: var(--bg-elevated, #fbfbfd);
  }

  .ship-table tr.s-row > td {
    display: block;
    padding: 0;
    border: 0;
    min-width: 0;
  }

  .ship-table tr.s-row > td:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
  }

  .ship-table tr.s-row > td:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
  }

  .ship-table tr.s-row > td:nth-child(3),
  .ship-table tr.s-row > td:nth-child(4) {
    grid-column: 1 / -1;
  }

  .ship-row-thumb {
    width: 46px;
    height: 58px;
  }

  .ship-stage-bar-wrap {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .ship-stage-bar,
  .ship-phase-row {
    min-width: 520px;
  }

  .ship-action-btn {
    min-height: 44px;
    width: 100%;
    justify-content: center;
  }

  .ship-month-row,
  .ship-month-row td {
    display: block;
    width: 100%;
  }

  .ship-month-head {
    padding: 11px 10px;
  }

  /* AI 工作台：所有双栏 / 三栏变单栏，但页面仍在工作台内部滚动。 */
  body.peter-ai-workbench-active main#main,
  body.sample-dispatch-active main#main {
    height: calc(100dvh - var(--gc-mobile-nav-height) - env(safe-area-inset-bottom));
    min-height: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  .peter-ai-workbench-page {
    height: 100%;
    min-height: 0;
    padding: 12px 12px 10px;
    overflow: hidden;
  }

  .peter-ai-workbench-hero {
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    align-items: flex-start;
    flex-direction: column;
  }

  .peter-ai-workbench-title {
    font-size: 21px;
  }

  .peter-ai-workbench-sub {
    font-size: 12px;
    margin-top: 3px;
  }

  .peter-ai-workbench-safe {
    width: 100%;
    max-width: none;
    padding: 7px 9px;
  }

  .peter-ai-workbench-layout {
    flex: 1;
    overflow-y: auto;
    padding-right: 0;
  }

  .peter-ai-workbench-card {
    min-height: 118px;
    padding: 13px;
    box-shadow: none;
  }

  .peter-ai-workbench-icon {
    width: 38px;
    height: 38px;
    margin-bottom: 9px;
  }

  .peter-ai-grid,
  .peter-ai-two,
  .peter-ai-new-layout,
  .peter-ai-form-grid,
  .peter-ai-editor-row,
  .pet-mail-field-grid,
  .pet-mail-line-grid,
  .qt-confirm-grid,
  .qt-param-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .quote-tool-page,
  .pet-mail-page {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    padding: 8px;
  }

  .quote-tool-page,
  .pet-mail-shell {
    display: flex;
    flex-direction: column;
    gap: 9px;
  }

  .qt-sidebar,
  .qt-main,
  .qt-summary,
  .pet-mail-panel,
  .pet-mail-compose {
    width: 100%;
    min-height: 0;
  }

  .qt-style-list {
    max-height: 280px;
  }

  .qt-step-tabs {
    grid-template-columns: repeat(3, minmax(112px, 1fr)) !important;
    overflow-x: auto;
  }

  .qt-table-wrap,
  .pet-mail-preview-wrap,
  .pet-mail-edit-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .qt-cost-table,
  .pet-mail-edit-table,
  .pet-mail-preview table {
    min-width: 680px;
  }

  /* 寄样表：固定一屏，上半设置、下半预览，各自滚动。 */
  .sample-dispatch-page {
    height: 100%;
    min-height: 0;
    padding: 10px 10px 8px !important;
    overflow: hidden !important;
  }

  .sample-dispatch-head {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
  }

  .sample-dispatch-head h1 {
    font-size: 19px;
  }

  .sample-dispatch-head p,
  .sample-dispatch-eyebrow,
  .sample-dispatch-pill {
    display: none;
  }

  .sample-dispatch-shell {
    min-height: 0;
    height: 100%;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: minmax(260px, 46%) minmax(0, 54%);
    gap: 8px;
    overflow: hidden;
  }

  .sample-dispatch-page .gc-sdf-left,
  .sample-dispatch-page .gc-sdf-right {
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: hidden !important;
    border-radius: 10px;
  }

  .sample-dispatch-page .gc-sdf-left {
    padding: 10px;
  }

  .sample-dispatch-page .gc-sdf-left-head {
    margin-bottom: 8px;
  }

  .sample-dispatch-page .gc-sdf-panels,
  .sample-dispatch-page .gc-sdf-panel.on,
  .sample-dispatch-page .gc-sdf-style-panel .gc-sdf-list,
  .sample-dispatch-page .gc-sdf-dear-list {
    min-height: 0;
    max-height: none !important;
  }

  .sample-dispatch-page .gc-sdf-style-panel .gc-sdf-list,
  .sample-dispatch-page .gc-sdf-dear-list,
  .sample-dispatch-page .gc-sdf-panel:not(.gc-sdf-style-panel) {
    overflow-y: auto;
  }

  .sample-dispatch-page .gc-sdf-toolbar {
    min-height: 48px;
    padding: 8px 10px;
  }

  .sample-dispatch-page .gc-sdf-preview {
    min-height: 0;
    padding: 8px;
  }

  .sample-dispatch-page .gc-sdf-paper {
    transform: none !important;
    width: 210mm;
    min-width: 210mm;
    margin: 0 !important;
  }

  .gc-sdf-print-btn {
    min-height: 40px;
    padding: 8px 12px;
  }

  /* 客户邮件工具抽屉。 */
  .gc-cu-drawer {
    width: 100%;
    height: 100dvh;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: minmax(220px, 46%) minmax(0, 54%);
  }

  .gc-cu-left,
  .gc-cu-right {
    min-height: 0;
    max-height: none !important;
    overflow-y: auto;
  }

  .gc-cu-right {
    padding: 12px;
  }

  .gc-cu-close-float {
    width: 44px;
    height: 44px;
    top: calc(6px + env(safe-area-inset-top));
    right: 8px;
  }

  .gc-cu-ebox {
    min-height: 260px;
    max-height: none;
    padding: 14px;
  }

  .gc-cu-mail-meta {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  /* 客户信息。 */
  .client-info-header {
    gap: 16px;
    margin-bottom: 16px;
  }

  .client-info-title h1 {
    font-size: 24px !important;
  }

  .client-info-title p {
    font-size: 13px;
  }

  .client-info-brand-grid,
  .client-info-cards,
  .client-info-list,
  .client-info-workspace {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .client-info-group-rail {
    position: static;
    padding: 6px;
  }

  .client-info-list {
    display: flex !important;
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    scrollbar-width: none;
  }

  .client-info-list > * {
    flex: 0 0 auto;
  }

  .client-contact-card {
    padding: 15px !important;
  }

  .client-info-modal-backdrop {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  .client-info-modal {
    width: 100%;
    max-height: 92dvh;
    border-radius: 16px 16px 0 0;
  }

  .client-info-form {
    grid-template-columns: minmax(0, 1fr) !important;
    padding: 16px;
  }

  /* 管理后台。 */
  .admin-page-head {
    gap: 12px;
    margin-bottom: 14px;
  }

  .admin-sec {
    padding: 13px !important;
    border-radius: 11px;
  }

  .admin-storage-grid,
  .admin-storage-split {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .admin-storage-card {
    padding: 12px;
  }

  .admin-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .admin-tbl {
    min-width: 760px;
  }

  .admin-filterbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-filterbar input,
  .admin-filterbar select {
    width: 100%;
    max-width: none;
    min-height: 44px;
  }

  /* 抽屉：手机全屏，操作按钮固定在拇指区域。 */
  .drawer {
    top: 0;
    right: 0;
    width: 100vw;
    max-width: none;
    height: 100dvh;
    border-radius: 0;
  }

  .drawer-header {
    flex: 0 0 auto;
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
    gap: 10px;
  }

  .drawer-title h2 {
    font-family: var(--font-sans);
    font-size: 20px;
    font-weight: 760;
  }

  .drawer-desc {
    font-size: 12px;
  }

  .drawer-close {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
  }

  .drawer-body {
    min-height: 0;
    padding: 0 14px 22px;
    overscroll-behavior: contain;
  }

  .drawer-status-actions {
    margin-left: -14px;
    margin-right: -14px;
  }

  .drawer-actions {
    flex: 0 0 auto;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    gap: 7px;
    max-height: 34dvh;
    overflow-y: auto;
  }

  .drawer-actions button {
    flex: 1 1 calc(50% - 7px);
    min-height: 44px;
    padding: 9px 10px;
  }

  .detail-top-section,
  .po-fields-section,
  .fit-comment-section,
  .spec-block,
  .notes-section {
    min-width: 0;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  /* 弹窗：手机底部面板，表单单列。 */
  .modal-backdrop,
  .app-dialog-backdrop,
  .template-modal-backdrop,
  .add-color-backdrop {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  .modal,
  .app-dialog,
  .template-modal,
  .gc-cu-modal {
    width: 100% !important;
    max-width: none !important;
    max-height: 92dvh !important;
    border-radius: 16px 16px 0 0 !important;
  }

  .modal-header,
  .app-dialog-header,
  .template-modal-head {
    padding: 15px 16px 12px !important;
  }

  .modal-header h3 {
    font-family: var(--font-sans);
    font-size: 19px;
    font-style: normal;
    font-weight: 760;
  }

  .modal-body,
  .app-dialog-body,
  .template-modal-body {
    padding: 14px 16px !important;
  }

  .modal-footer,
  .app-dialog-footer,
  .template-modal-foot {
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom)) !important;
  }

  .modal-footer button,
  .app-dialog-footer button,
  .template-modal-foot button {
    flex: 1;
    min-height: 44px;
    padding: 9px 10px;
  }

  /* feedback-modal-centered-v2: 客户评语即使在窄屏也保持居中圆角，不沿用通用底部面板。 */
  #updateBackdrop.feedback-drawer {
    align-items: center !important;
    justify-content: center !important;
    padding: 12px !important;
  }

  #updateBackdrop.feedback-drawer .modal {
    width: calc(100vw - 24px) !important;
    max-width: 620px !important;
    height: min(840px, calc(100dvh - 24px)) !important;
    max-height: calc(100dvh - 24px) !important;
    margin: 0 !important;
    border-radius: 18px !important;
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
  }

  #updateBackdrop.feedback-drawer .modal-header {
    flex: 0 0 auto;
    position: static;
    border-radius: 18px 18px 0 0;
  }

  #updateBackdrop.feedback-drawer .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  #updateBackdrop.feedback-drawer .modal-footer {
    flex: 0 0 auto;
    position: static;
    padding-bottom: 10px !important;
    border-radius: 0 0 18px 18px;
  }

  /* QC 登记弹窗：标题 / 操作固定，只让中间表单滚动，并避开手机底部导航。 */
  #updateBackdrop.gc-prod-qc-modal .modal {
    height: min(92dvh, calc(100dvh - var(--gc-mobile-nav-height) - env(safe-area-inset-bottom))) !important;
    max-height: calc(100dvh - var(--gc-mobile-nav-height) - env(safe-area-inset-bottom)) !important;
    margin-bottom: calc(var(--gc-mobile-nav-height) + env(safe-area-inset-bottom));
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
  }

  #updateBackdrop.gc-prod-qc-modal .modal-header {
    flex: 0 0 auto;
    position: static;
  }

  #updateBackdrop.gc-prod-qc-modal .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  #updateBackdrop.gc-prod-qc-modal .modal-footer {
    flex: 0 0 auto;
    position: static;
    padding-bottom: 10px !important;
  }

  .form-row,
  .form-row-3,
  .po-color-card-fields,
  .bf-row,
  .batch-modal-row {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .form-row,
  .form-row-3,
  .po-color-card-fields {
    gap: 10px;
  }

  .field-with-action {
    grid-template-columns: minmax(0, 1fr) 44px;
  }

  .image-dropzone {
    padding: 18px 12px;
  }

  /* 批量操作栏高于底部导航，按钮横向滑动。 */
  .batch-bar {
    left: 8px;
    right: 8px;
    bottom: calc(var(--gc-mobile-nav-height) + env(safe-area-inset-bottom) + 8px) !important;
    width: auto !important;
    max-height: 46dvh;
    padding: 9px 10px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .batch-bar-actions {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }

  .batch-bar-actions .batch-btn {
    flex: 0 0 auto;
    min-height: 42px;
  }

  /* 报表保持纸张比例，通过预览区域横向滚动，不压缩小字。 */
  #gcQcReportPreview .gc-rpt-shell,
  #gcProdArrivalReportPreview .gc-rpt-shell,
  #gcShippingReportPreview .gc-rpt-shell {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  #gcQcReportPreview .gc-rpt-topbar,
  #gcProdArrivalReportPreview .gc-rpt-topbar,
  #gcShippingReportPreview .gc-rpt-topbar {
    max-height: 42dvh;
    padding: 12px;
    overflow-y: auto;
  }

  #gcQcReportPreview .gc-rpt-stage,
  #gcProdArrivalReportPreview .gc-rpt-stage,
  #gcShippingReportPreview .gc-rpt-stage {
    padding: 10px !important;
    overflow: auto !important;
  }

  #gcQcReportPreview .gc-rpt-sheet,
  #gcQcReportPreview .gc-qcrpt-appendix-page,
  #gcProdArrivalReportPreview .gc-rpt-sheet,
  #gcShippingReportPreview .gc-rpt-sheet {
    width: 960px !important;
    min-width: 960px !important;
    margin: 0 !important;
  }

  /* 打印预览工具栏保留核心操作，纸张区域允许横向查看。 */
  .print-spec-toolbar {
    padding: 8px 10px;
  }

  .print-spec-actions {
    overflow-x: auto;
  }

  .print-spec-btn {
    min-height: 40px;
    padding: 7px 10px;
    white-space: nowrap;
  }

  .print-spec-scroll {
    overflow: auto;
    padding: 10px;
  }

  .print-spec-paper {
    width: 210mm !important;
    min-width: 210mm;
    min-height: 297mm;
    padding: 14mm 16mm !important;
    margin: 0 !important;
  }
}

/* 普通小屏手机：摘要两列，卡片更重视文字宽度。 */
@media (max-width: 430px) {
  .ship-strip,
  .pq2-top,
  .admin-storage-grid,
  .admin-storage-split {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .ship-cell:nth-child(3n) {
    border-right: 1px solid var(--line-soft, #e5e5ea);
  }

  .ship-cell:nth-child(2n) {
    border-right: 0;
  }

  .ship-cell:nth-child(n + 4) {
    border-bottom: 1px solid var(--line-soft, #e5e5ea);
  }

  .ship-cell:nth-child(n + 5) {
    border-bottom: 0;
  }

  .peter-ai-workbench-card span,
  .peter-ai-workbench-guide,
  .peter-ai-workbench-section-head span {
    font-size: 12px;
  }

  .gc-sdf-toolbar-sub {
    display: none;
  }
}

/* 极小屏：避免两列信息继续挤压。 */
@media (max-width: 360px) {
  :root {
    --gc-mobile-page-gap: 10px;
  }

  main#main {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  .plog-grid,
  .admin-storage-grid,
  .admin-storage-split {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .grid-card-img-wrap {
    width: 82px !important;
  }

  .mtab-item {
    font-size: 10px;
  }

  .mtab-item .mtab-icon {
    width: 21px;
    height: 21px;
  }

  .drawer-actions button {
    flex-basis: 100%;
  }
}

/* 横屏手机：工作台改为左右结构，提高有效操作面积。 */
@media (max-width: 767px) and (orientation: landscape) {
  .sample-dispatch-shell {
    grid-template-columns: minmax(280px, 42%) minmax(0, 58%) !important;
    grid-template-rows: minmax(0, 1fr);
  }

  .gc-cu-drawer {
    grid-template-columns: minmax(300px, 44%) minmax(0, 56%) !important;
    grid-template-rows: minmax(0, 1fr);
  }

  .sample-dispatch-head {
    display: none;
  }

  .drawer-actions {
    max-height: 42dvh;
  }
}

/* iPhone real-device correction v2: desktop menu parity + compact filters + dev row fix. */
#mobileFilterToggle {
  display: none;
}

@media (max-width: 767px) {
  #controlsBar.mobile-controls-visible {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 70px 46px;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
  }

  #controlsBar > .search {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    min-width: 0;
    max-width: none;
    flex: none;
  }

  #controlsBar > .search input {
    min-height: 44px;
    padding-right: 10px;
  }

  #mobileFilterToggle {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    min-height: 44px;
    padding: 0 9px;
    border: 1px solid var(--line-strong, #d1d1d6);
    border-radius: 9px;
    background: var(--bg-elevated, #fbfbfd);
    color: var(--ink-soft, #424248);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
  }

  #mobileFilterToggle svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
  }

  #mobileFilterToggle.active {
    border-color: var(--apple-blue, #007aff);
    background: var(--apple-blue-bg, #e5f0ff);
    color: var(--apple-blue, #007aff);
  }

  #controlsBar > :not(.search):not(#mobileFilterToggle) {
    grid-column: 1 / -1;
    min-width: 0;
    max-width: 100%;
  }

  body:not(.mobile-filters-open) #controlsBar > :not(.search):not(#mobileFilterToggle) {
    display: none !important;
  }

  body.mobile-filters-open #controlsBar {
    padding-bottom: 11px;
  }

  body.mobile-filters-open #controlsBar > .filter-group,
  body.mobile-filters-open #controlsBar > .view-toggle,
  body.mobile-filters-open #controlsBar > .ef-date-filter,
  body.mobile-filters-open #controlsBar > .show-po-toggle {
    margin: 0;
  }

  body[data-mobile-route="dev"]:not(.mobile-filters-open) .cg-chips-row,
  body[data-mobile-route="production"]:not(.mobile-filters-open) .cg-chips-row,
  body[data-mobile-route="archive-done"]:not(.mobile-filters-open) .cg-chips-row,
  body[data-mobile-route="archive-archived"]:not(.mobile-filters-open) .cg-chips-row {
    display: none !important;
  }

  .erp-filter-status {
    min-height: 36px;
    margin: 0 10px 8px;
    padding: 7px 9px;
    gap: 6px;
    font-size: 11.5px;
  }

  .erp-filter-chip {
    height: 20px;
    padding: 0 7px;
    font-size: 11px;
  }

  .msheet-section-title {
    padding: 7px 10px 6px;
    color: var(--ink-mute, #6b6b6e);
    font-size: 11px;
    font-weight: 750;
  }

  .msheet-nav-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    padding: 0 6px 6px;
  }

  .msheet-nav-btn {
    min-width: 0;
    min-height: 54px;
    padding: 9px 10px;
    border: 1px solid var(--line, #e5e5ea);
    border-radius: 10px;
    background: var(--bg-elevated, #fbfbfd);
    color: var(--ink, #1d1d1f);
    display: flex;
    align-items: center;
    gap: 9px;
    text-align: left;
    font: inherit;
    cursor: pointer;
  }

  .msheet-nav-btn.active {
    border-color: var(--apple-blue, #007aff);
    background: var(--apple-blue-bg, #e5f0ff);
    color: var(--apple-blue, #007aff);
  }

  .msheet-nav-btn .mtab-icon {
    width: 21px;
    height: 21px;
    flex: 0 0 auto;
  }

  .msheet-nav-text {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .msheet-nav-text b {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12.5px;
  }

  .msheet-nav-text em {
    margin-left: auto;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    border-radius: 8px;
    background: var(--bg-sunken, #ebebef);
    color: var(--ink-soft, #424248);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10.5px;
    font-style: normal;
    font-weight: 750;
  }

  /* 开发追踪真实 DOM 有 style-row-brand-info，单独重排，避免旧四列规则撑出空白。 */
  .style-row.simplified.dev-list-row {
    min-height: 0 !important;
    height: auto !important;
    grid-template-columns: 62px minmax(0, 1fr) !important;
    grid-template-rows: auto auto auto !important;
    align-content: start !important;
    align-items: start !important;
    gap: 5px 10px !important;
    padding: 10px !important;
  }

  .style-row.simplified.dev-list-row > .batch-checkbox,
  .style-row.simplified.dev-list-row > .row-batch-checkbox,
  .style-row.simplified.dev-list-row > .arrow {
    display: none !important;
  }

  .style-row.simplified.dev-list-row > .thumb,
  .style-row.simplified.dev-list-row > .thumb-placeholder {
    grid-column: 1 !important;
    grid-row: 1 / 4 !important;
    width: 62px !important;
    height: 80px !important;
    align-self: start !important;
  }

  .style-row.simplified.dev-list-row > .sku {
    grid-column: 2 !important;
    grid-row: 1 !important;
    display: block !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 13px !important;
    font-weight: 760 !important;
    line-height: 1.35 !important;
  }

  .style-row.simplified.dev-list-row > .style-row-brand-info {
    grid-column: 2 !important;
    grid-row: 2 !important;
    min-width: 0 !important;
    width: 100%;
    display: flex !important;
    flex-direction: column;
    align-items: flex-start !important;
    gap: 5px !important;
  }

  .style-row.simplified.dev-list-row > .style-row-brand-info .client-badge {
    max-width: 100% !important;
    min-height: 22px;
    padding: 2px 7px !important;
    font-size: 10.5px !important;
  }

  .style-row.simplified.dev-list-row > .style-row-brand-info .style-row-info {
    width: 100%;
    min-width: 0;
    gap: 3px;
  }

  .style-row.simplified.dev-list-row > .style-row-brand-info .style-name {
    max-height: 42px;
    overflow: hidden;
    gap: 4px !important;
  }

  .style-row.simplified.dev-list-row > .style-row-brand-info .style-subinfo {
    gap: 5px !important;
    font-size: 10.5px !important;
  }

  .style-row.simplified.dev-list-row > .node-block {
    grid-column: 2 !important;
    grid-row: 3 !important;
    min-width: 0 !important;
    width: 100%;
    margin: 0 !important;
    text-align: left !important;
  }

  .style-row.simplified.dev-list-row > .node-block .node-block-row1 {
    justify-content: flex-start !important;
    flex-wrap: nowrap !important;
  }
}

/* mobile-app-polish-v1:
   手机固定浅色、列表减密、详情抬头收纳、底部导航与“全部”菜单按真实 App 触控规范统一。 */
@media (max-width: 767px) {
  html {
    color-scheme: light;
  }

  /* 底部导航使用真实按钮，并给当前页一个稳定的图标底色。 */
  #mobileTabBar .mtab-item {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 4px 2px 3px;
    font-family: inherit;
  }

  #mobileTabBar .mtab-item.active {
    color: var(--apple-blue, #007aff);
    font-weight: 760;
  }

  #mobileTabBar .mtab-item.active .mtab-icon {
    box-sizing: content-box;
    padding: 3px 8px;
    border-radius: 10px;
    background: var(--apple-blue-bg, #e5f0ff);
  }

  #mobileTabBar .mtab-item:focus-visible {
    outline: 2px solid rgba(0, 122, 255, 0.42);
    outline-offset: -3px;
    border-radius: 10px;
  }

  /* “全部”是一个页面抽屉：页面、日常操作、管理三层，不再混成一条长列表。 */
  #mobileMoreSheet {
    max-height: min(78dvh, 640px);
    padding-top: 18px !important;
  }

  #mobileMoreSheet::before {
    content: '';
    position: absolute;
    top: 7px;
    left: 50%;
    width: 34px;
    height: 4px;
    border-radius: 999px;
    background: var(--line-strong, #d1d1d6);
    transform: translateX(-50%);
  }

  .msheet-actions-group {
    display: grid;
    gap: 6px;
    padding: 0 6px 6px;
  }

  .msheet-actions-group .msheet-btn {
    min-height: 52px;
    padding: 11px 12px !important;
    border: 1px solid var(--line, #e5e5ea);
    border-radius: 10px;
    background: var(--bg-elevated, #ffffff);
  }

  .msheet-management-title {
    margin-top: 2px;
    color: var(--ink-soft, #424248);
  }

  .msheet-management-group .msheet-btn {
    background: var(--bg-sunken, #f5f5f7);
  }

  .msheet-management-action.danger {
    color: var(--danger, #d70015) !important;
  }

  /* 搜索结果直接说“找到 N 项”；清除按钮保持 44px 可点区域。 */
  .today-search-result-info {
    white-space: nowrap;
    font-family: var(--font-sans);
    font-size: 11.5px;
    font-weight: 650;
  }

  .today-search-clear {
    min-width: 44px;
    width: 44px;
    min-height: 44px;
    height: 44px;
    margin: -6px -8px -6px 0;
    border: 0;
    background: transparent;
    color: var(--ink-soft, #424248);
    font-size: 20px;
  }

  /* 日常卡片只保留客户、版型、颜色、交期和当前状态；低频资料点开详情再看。 */
  .today-card-row1 > .group-badge,
  .today-card-row1 > .category-badge,
  .today-card-row1 > .ship-method-badge,
  .today-card-row1 > .dev-size-badge,
  .today-card-row1 > .factory-badge,
  .today-card-row1 > .grading-badge {
    display: none !important;
  }

  .today-card {
    padding: 10px !important;
    border-radius: 11px;
  }

  .today-card-v2 .today-card-row1 {
    gap: 4px;
  }

  .today-card-v2 .today-card-row2 {
    flex-wrap: nowrap;
  }

  .today-card-v2 .today-card-row2 .today-card-sku {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .today-card-v2 .today-card-row2 .today-card-po {
    flex: 0 0 auto;
  }

  .today-section .section-sub {
    color: var(--ink-soft, #424248) !important;
    line-height: 1.45;
  }

  /* 手机已有系统页头，工作台内部不再重复一次“跟单工作台”。 */
  .peter-ai-workbench-page-compact .peter-ai-workbench-hero {
    display: none !important;
  }

  .peter-ai-workbench-page-compact {
    padding-top: 8px;
  }

  .peter-ai-workbench-page-compact .peter-ai-workbench-section-head {
    margin-bottom: 8px;
  }

  .peter-ai-workbench-page-compact .peter-ai-workbench-card {
    min-height: 68px;
  }

  /* 款式详情：款号最多两行，顶部工具保持单行等宽，“加同套”由脚本移入原三点菜单。 */
  #drawer.style-detail-drawer-v2.peter-style-drawer-compact-v1 .drawer-header.drawer-header-v2 {
    padding: calc(7px + env(safe-area-inset-top)) 10px 8px;
    row-gap: 8px;
    column-gap: 8px;
    border-bottom: 1px solid var(--line, #e5e5ea);
  }

  #drawer.style-detail-drawer-v2.peter-style-drawer-compact-v1 .drawer-header.peter-style-drawer-header-unified-v1 .drawer-title-main {
    align-items: flex-start;
  }

  #drawer.style-detail-drawer-v2.peter-style-drawer-compact-v1 .drawer-header.peter-style-drawer-header-unified-v1 .drawer-title-main .sku-text {
    display: -webkit-box;
    overflow: hidden;
    white-space: normal;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    font-size: 17px;
    line-height: 1.25;
  }

  #drawer.style-detail-drawer-v2.peter-style-drawer-compact-v1 .peter-style-drawer-title-tools {
    gap: 4px;
  }

  #drawer.style-detail-drawer-v2.peter-style-drawer-compact-v1 .peter-style-drawer-title-tools .edit-info-btn,
  #drawer.style-detail-drawer-v2.peter-style-drawer-compact-v1 .drawer-close,
  #drawer.style-detail-drawer-v2.peter-style-drawer-compact-v1 .peter-style-drawer-more > summary {
    min-width: 44px;
    width: 44px;
    min-height: 44px;
    height: 44px;
  }

  #drawer.style-detail-drawer-v2.peter-style-drawer-compact-v1 .drawer-header-tools {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    gap: 6px;
    overflow: visible;
  }

  #drawer.style-detail-drawer-v2.peter-style-drawer-compact-v1 .drawer-header-tools > * {
    min-width: 0;
    width: 100%;
    flex: none;
  }

  #drawer.style-detail-drawer-v2.peter-style-drawer-compact-v1 .drawer-header-tools .drawer-print-btn {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding: 7px 6px;
    justify-content: center;
  }

  #drawer.style-detail-drawer-v2.peter-style-drawer-compact-v1 .drawer-header-tools .drawer-print-btn > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #drawer.style-detail-drawer-v2.peter-style-drawer-compact-v1 .drawer-meta-line {
    margin-top: 4px;
    font-size: 11.5px;
  }

  #drawer.style-detail-drawer-v2.peter-style-drawer-compact-v1 .drawer-quick-actions {
    gap: 7px;
  }

  #drawer.style-detail-drawer-v2.peter-style-drawer-compact-v1 .drawer-quick-actions > button {
    min-height: 44px;
  }

  /* mobile-detail-hit-target-v2: 覆盖抽屉重设计层的 32px 桌面控件，不让手机触控面积被重新压小。 */
  #drawer.style-detail-drawer-v2.peter-style-drawer-compact-v1.peter-style-drawer-redesign-v1 .drawer-header.peter-style-drawer-header-unified-v1 .edit-info-btn,
  #drawer.style-detail-drawer-v2.peter-style-drawer-compact-v1.peter-style-drawer-redesign-v1 .drawer-header.peter-style-drawer-header-unified-v1 .drawer-close {
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
  }

  #drawer.style-detail-drawer-v2.peter-style-drawer-compact-v1.peter-style-drawer-redesign-v1 .drawer-header.peter-style-drawer-header-unified-v1 .drawer-header-tools > .drawer-print-btn,
  #drawer.style-detail-drawer-v2.peter-style-drawer-compact-v1.peter-style-drawer-redesign-v1 .drawer-header.peter-style-drawer-header-unified-v1 .drawer-header-tools > .drawer-pdf-dropdown > .drawer-print-btn {
    height: 40px !important;
    min-height: 40px !important;
  }
}

/* mobile-cross-tab-polish-v1:
   跟单、生产 QC、开发、大货、辅料、船务使用同一手机卡片宽度；修复桌面多列在手机上的压缩与横向裁切。 */
@media (max-width: 767px) {
  /* 所有业务搜索框稳定为 16px；圆角和高度保持同一套手机控件语言。 */
  :is(
    #search,
    #todaySearchInput,
    #accSearchInput,
    #shipSearchInput,
    .acc-search-input,
    .ship-search-input,
    #controlsBar > .search input
  ) {
    min-width: 0 !important;
    min-height: 44px !important;
    height: 44px !important;
    border-radius: 11px !important;
    font-size: 16px !important;
    line-height: 1.25 !important;
  }

  /* 跟单：提醒列表单列，款号与风险不互相挤压。 */
  body.today-followup-sub-active .followup-po-alert {
    display: block !important;
    margin: 0 0 12px !important;
    padding: 12px !important;
    border-left-width: 1px !important;
    border-radius: 12px !important;
  }

  body.today-followup-sub-active .followup-po-alert-head {
    margin-bottom: 9px;
  }

  body.today-followup-sub-active .followup-po-alert-list {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 7px !important;
  }

  body.today-followup-sub-active .followup-po-alert-row {
    width: 100% !important;
    max-width: none !important;
    min-height: 58px !important;
    box-sizing: border-box;
    grid-template-columns: minmax(0, 1fr) auto !important;
    padding: 8px 10px !important;
  }

  body.today-followup-sub-active .followup-po-alert-idline,
  body.today-followup-sub-active .followup-po-alert-sku {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* 生产 QC：摘要始终两列，PO 主信息和动作上下分层。 */
  .pq2-top,
  .pv2-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  .pq2-st,
  .pv2-sm {
    min-width: 0 !important;
    min-height: 70px !important;
    padding: 10px !important;
  }

  .pq2-report-btn,
  .pv2-report-btn {
    grid-column: 1 / -1 !important;
    min-height: 44px !important;
  }

  .pq2-po {
    width: 100%;
    box-sizing: border-box;
    grid-template-columns: 54px minmax(0, 1fr) !important;
    gap: 8px 10px !important;
    padding: 11px !important;
  }

  .pq2-img {
    width: 54px !important;
    height: 70px !important;
  }

  .pq2-mid,
  .pq2-right,
  .pq2-acts {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .pq2-right {
    grid-column: 1 / -1 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px !important;
  }

  /* 开发：月份抬头和每款卡片使用完整可用宽度。 */
  .dev-month-header,
  .production-group-header {
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
  }

  .style-row.simplified.dev-list-row {
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }

  .style-row.simplified.dev-list-row > .style-row-brand-info,
  .style-row.simplified.dev-list-row > .node-block {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  /* 大货：原 prod-row-thumb 未命中通用 thumb 规则，导致照片被 flex 拉成半屏。 */
  .production-row.with-node {
    display: grid !important;
    grid-template-columns: 58px minmax(0, 1fr) !important;
    grid-template-rows: auto auto auto auto !important;
    width: 100%;
    box-sizing: border-box;
    gap: 6px 11px !important;
    padding: 11px !important;
    overflow: hidden;
  }

  .production-row.with-node > .prod-row-checkbox,
  .production-row.with-node > .arrow {
    display: none !important;
  }

  .production-row.with-node > .prod-row-thumb,
  .production-row.with-node > .thumb-placeholder {
    grid-column: 1 !important;
    grid-row: 1 / 4 !important;
    width: 58px !important;
    height: 76px !important;
    min-width: 58px !important;
    max-width: 58px !important;
    object-fit: cover;
    align-self: start;
  }

  .production-row.with-node > .prod-cell-main {
    grid-column: 2 !important;
    grid-row: 1 !important;
  }

  .production-row.with-node > .prod-cell-meta {
    grid-column: 2 !important;
    grid-row: 2 !important;
  }

  .production-row.with-node > .prod-cell-colors {
    grid-column: 2 !important;
    grid-row: 3 !important;
  }

  .production-row.with-node > .prod-cell-progress {
    grid-column: 1 / -1 !important;
    grid-row: 4 !important;
    margin-top: 3px;
    padding-top: 8px;
    border-top: 1px solid var(--line-soft, #e5e5ea);
  }

  .production-group-header.date-group-header {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    gap: 8px !important;
    margin-bottom: 8px !important;
    padding: 10px 11px !important;
  }

  .production-group-header .date-main {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .production-group-header .group-batch-btn {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 40px !important;
    margin: 0 !important;
  }

  /* 辅料：头部不重复标题；筛选、摘要、分组和 PO 行全部改为手机网格。 */
  .acc-page {
    width: 100%;
    padding: 0 0 18px !important;
  }

  .acc-workbench-head .acc-top-row:first-child {
    display: none !important;
  }

  .acc-workbench-head .acc-top-row:nth-child(2) {
    display: block !important;
    margin: 0 0 10px !important;
  }

  .acc-sub-tabs {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    box-sizing: border-box;
  }

  .acc-sub-tab {
    min-width: 0 !important;
    min-height: 44px !important;
    padding: 6px 4px !important;
    justify-content: center;
    white-space: normal;
    text-align: center;
  }

  .acc-action-bar {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    min-width: 0;
    margin: 9px 0 0 !important;
    gap: 8px !important;
  }

  .acc-action-bar #accSearchInput {
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100% !important;
  }

  .acc-action-bar .acc-filter-select {
    width: 100%;
    min-width: 0;
    min-height: 44px;
  }

  .acc-action-bar .acc-ef-date-wrap {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    box-sizing: border-box;
  }

  .acc-action-bar .acc-ef-date-wrap input {
    flex: 1;
    min-width: 0;
  }

  .acc-action-bar .acc-filter-clear {
    grid-column: 1 / -1;
    min-height: 40px;
  }

  .acc-summary-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    margin-bottom: 12px !important;
  }

  .acc-summary-cell,
  body.peter-topbar-trial.accessory-tab-active .acc-summary-cell {
    min-width: 0 !important;
    min-height: 82px !important;
    padding: 9px 4px !important;
    flex-direction: column;
    justify-content: center;
    gap: 4px !important;
    text-align: center;
  }

  .acc-summary-cell .acc-sc-ico {
    width: 30px;
    height: 30px;
  }

  .acc-summary-cell .acc-sc-num {
    font-size: 20px;
  }

  .acc-summary-cell .acc-sc-lbl {
    min-width: 0;
    font-size: 10.5px;
    line-height: 1.25;
  }

  .acc-summary-cell.pending .acc-sc-lbl {
    font-size: 0;
  }

  .acc-summary-cell.pending .acc-sc-lbl::after {
    content: '待订';
    font-size: 10.5px;
  }

  .acc-group {
    margin-bottom: 12px;
  }

  .acc-group-head {
    display: grid !important;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    gap: 7px !important;
    padding: 10px !important;
  }

  .acc-group-head .acc-gh-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    margin: 3px 0 0 !important;
  }

  .acc-btn-mini {
    min-width: 0;
    min-height: 40px !important;
    padding: 7px 8px !important;
    justify-content: center;
    white-space: normal;
  }

  .acc-row {
    display: grid !important;
    grid-template-columns: 24px 54px minmax(0, 1fr) !important;
    grid-template-rows: auto auto auto auto !important;
    width: 100%;
    box-sizing: border-box;
    gap: 7px 10px !important;
    padding: 11px 10px !important;
    align-items: start !important;
    overflow: hidden;
  }

  .acc-row .acc-cb {
    grid-column: 1;
    grid-row: 1 / 3;
    width: 20px;
    height: 20px;
    margin-top: 3px;
  }

  .acc-row .acc-thumb {
    grid-column: 2;
    grid-row: 1 / 3;
    width: 54px;
    height: 68px;
  }

  .acc-row .acc-main {
    grid-column: 3;
    grid-row: 1;
    min-width: 0;
  }

  .acc-row .acc-style {
    min-width: 0;
    overflow-wrap: anywhere;
    line-height: 1.35;
  }

  .acc-row .acc-style .acc-po-no {
    display: block;
    margin: 3px 0 0;
  }

  .acc-row .acc-sub-info {
    flex-wrap: wrap;
    gap: 3px 8px;
    line-height: 1.35;
  }

  .acc-row .acc-ex {
    grid-column: 3;
    grid-row: 2;
    min-width: 0;
    text-align: left;
  }

  .acc-row .acc-chips {
    grid-column: 1 / -1;
    grid-row: 3;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 7px;
  }

  .acc-row .acc-chip {
    min-width: 0;
    min-height: 40px;
    box-sizing: border-box;
    justify-content: center;
    padding: 7px 6px;
    white-space: normal;
    text-align: center;
  }

  .acc-row .acc-quick {
    grid-column: 1 / -1;
    grid-row: 4;
    width: 100%;
  }

  .acc-row .acc-quick .acc-qb {
    width: 100%;
    min-height: 44px;
  }

  /* 船务：头部不重复标题；六段流水线在卡片内改成两行，不再横向裁切。 */
  .ship-page {
    width: 100%;
    padding: 0 0 18px !important;
  }

  .ship-title-row {
    justify-content: flex-end;
    margin-bottom: 10px !important;
  }

  .ship-page-title {
    display: none !important;
  }

  .ship-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .ship-cell {
    min-height: 82px !important;
    padding: 9px 10px !important;
    border-right: 1px solid var(--line-soft, #e5e5ea) !important;
    border-bottom: 1px solid var(--line-soft, #e5e5ea) !important;
  }

  .ship-cell:nth-child(2n) {
    border-right: 0 !important;
  }

  .ship-cell:nth-last-child(-n + 2) {
    border-bottom: 0 !important;
  }

  .ship-subtabs {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    min-height: 44px;
    height: auto !important;
    overflow: visible !important;
  }

  .ship-subtab {
    min-width: 0 !important;
    min-height: 40px !important;
    height: auto !important;
    padding: 6px 4px !important;
    justify-content: center;
    text-align: center;
    white-space: normal;
  }

  .ship-table tr.s-row {
    grid-template-columns: 54px minmax(0, 1fr) !important;
    gap: 8px 10px !important;
    padding: 11px !important;
    overflow: hidden;
  }

  .ship-row-thumb {
    width: 54px !important;
    height: 70px !important;
  }

  .ship-table tr.s-row > td:nth-child(3) {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
    padding-top: 8px;
    border-top: 1px solid var(--line-soft, #e5e5ea);
  }

  .ship-table tr.s-row > td:nth-child(4) {
    grid-column: 1 / -1;
    grid-row: 3;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }

  .ship-stage-bar-wrap {
    width: 100%;
    min-width: 0 !important;
    overflow: visible !important;
    padding: 0 !important;
  }

  .ship-phase-row {
    display: none !important;
  }

  .ship-stage-bar {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    min-width: 0 !important;
    width: 100%;
    gap: 6px !important;
  }

  .ship-stage-ps {
    grid-column: 1 / -1 !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    min-width: 0 !important;
    gap: 6px !important;
  }

  .ship-stage-ps.no-client {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .ship-stage-div {
    display: none !important;
  }

  .ship-stage-cell {
    min-width: 0 !important;
    height: 42px !important;
    padding: 4px 3px !important;
    flex-direction: column;
    gap: 2px;
    line-height: 1.15;
  }

  .ship-stage-cell .ship-sc-date {
    position: static !important;
    max-width: 100%;
    color: inherit;
    font-size: 9px;
  }

  .ship-action-btn {
    width: 100%;
    min-width: 0;
    min-height: 44px !important;
    white-space: normal;
  }
}

@media print {
  #mobileTabBar,
  #mobileMoreSheet,
  #mobileMoreBackdrop {
    display: none !important;
  }
}

/* batch-toolbar-mobile-apple-erp-v1: 手机继续使用横向操作列，触摸目标不小于 44px。 */
@media (max-width: 767px) {
  .batch-bar {
    border-radius: 16px;
    padding: 8px !important;
    gap: 7px;
  }

  .batch-bar-left {
    min-height: 32px;
    padding: 0 4px 7px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  }

  .batch-bar-scope {
    display: inline;
    max-width: none;
  }

  .batch-bar-actions .batch-btn {
    min-height: 44px;
    height: 44px;
    padding-inline: 13px;
    border-radius: 10px;
    white-space: nowrap;
  }
}
