@media (max-width: 768px) {
  /* 根容器与首层渲染容器：宽度随视口，禁止横向溢出 */
  html, body, #root, #root > div {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden !important;
  }
  * { box-sizing: border-box; }

  /* 常见布局容器统一全宽，避免 max-width/负外边距带来的左右空白 */
  .ant-layout, .ant-layout-content, main, .header-content {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* 普适容器类：防止被局部样式限制宽度 */
  [class*="container"], [class*="content"], [class*="wrapper"], [class*="page"], [class*="section"] {
    max-width: 100% !important;
    width: 100% !important;
  }

  /* 媒体元素不溢出视口 */
  img, canvas, video, svg { max-width: 100%; height: auto; }
}

@media (max-width: 768px) {
  /* 底部操作区：按钮自动换行为两列，防止挤出屏幕 */
  .ant-layout-footer .ant-space,
  .ant-layout-footer .ant-btn-group,
  .footer-actions,
  .page-actions,
  .action-bar {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px;
    justify-content: center;
    width: 100%;
  }

  .ant-layout-footer .ant-space .ant-btn,
  .ant-layout-footer .ant-btn-group .ant-btn,
  .footer-actions .ant-btn,
  .page-actions .ant-btn,
  .action-bar .ant-btn {
    flex: 1 1 calc(50% - 8px);
    min-width: 140px;
    max-width: 100%;
    white-space: normal; /* 允许按钮文字换行 */
  }

  /* 分页器在小屏可换行，避免挤出屏幕 */
  .ant-pagination {
    flex-wrap: wrap;
    row-gap: 6px;
    justify-content: center;
  }

  /* 通用修复：AntD Space 默认 inline-flex，导致不易换行；在小屏强制占满并可换行 */
  .ant-space:not(.ant-space-vertical) {
    display: flex !important;
    flex-wrap: wrap !important;
    width: 100% !important;
  }
  /* 让按钮在 Space 中尽量两列排布（可根据可用宽度自动换行） */
  .ant-space .ant-space-item .ant-btn {
    flex: 1 1 calc(50% - 8px);
    min-width: 140px;
    white-space: normal;
  }

  /* 常见底部容器统一换行（Modal/Drawer/Card/页头额外操作区） */
  .ant-modal-footer,
  .ant-drawer-footer,
  .ant-card-actions,
  .ant-page-header-heading-extra {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
  }
  .ant-modal-footer .ant-btn,
  .ant-drawer-footer .ant-btn,
  .ant-card-actions .ant-btn,
  .ant-page-header-heading-extra .ant-btn {
    flex: 1 1 calc(50% - 8px);
    min-width: 140px;
    white-space: normal;
  }
}

@media (max-width: 768px) {
  /* 覆盖订单列表筛选区：按钮按文字自适应，不使用两列扩展 */
  .order-management .filter-section .ant-space { width: auto !important; }
  .order-management .filter-section .ant-space .ant-space-item { max-width: none; }
  .order-management .filter-section .ant-space .ant-btn {
    flex: 0 0 auto !important;
    min-width: auto !important;
  }
}

@media (max-width: 768px) {
  /* 订单列表筛选区按钮：缩小到接近文字尺寸 */
  .order-management .filter-section .ant-btn {
    padding: 0 6px !important;
    height: auto !important;
    min-height: 0 !important;
    line-height: 1.2 !important;
    border-radius: 4px !important;
    font-size: 12px !important;
  }
  .order-management .filter-section .ant-btn .ant-btn-icon {
    margin-inline-end: 4px;
  }
}


