/* iPhone 14 Pro 和小屏幕优化（<= 480px） */
@media (max-width: 480px) {
  .hero-nav {
    grid-template-columns: minmax(0, 0.66fr) minmax(0, 1.34fr) !important;
    gap: 4px !important;
  }

  .view-tabs {
    padding: 2px !important;
    gap: 3px !important;
  }

  .tab-btn {
    min-height: 30px !important;
    padding: 4px 8px !important;
    font-size: 11px !important;
  }

  /* 1) 顶部四个操作按钮保持同一行 */
  .hero-actions {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 4px !important;
    overflow: visible !important;
    position: relative !important;
    z-index: 12001 !important;
  }

  .hero-actions > .io-menu {
    position: relative !important;
    z-index: 12002 !important;
  }

  .hero-actions .io-menu__list {
    z-index: 12003 !important;
  }

  .hero-actions > * {
    flex: 1 1 0 !important;
    min-width: 0 !important;
  }

  .hero-actions .btn,
  .hero-actions .btn--menu,
  .hero-actions .io-menu > summary {
    width: 100% !important;
    min-height: 32px !important;
    min-width: 0 !important;
    padding: 0 3px !important;
    font-size: 9.8px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1 !important;
    letter-spacing: -0.1px;
  }

  #openAddFromHero {
    flex: 1.35 1 0 !important;
    min-width: 0 !important;
    padding: 0 6px !important;
    letter-spacing: -0.05px;
    text-overflow: clip !important;
  }

  #openBrandLibraryBtn {
    flex: 0.82 1 0 !important;
    padding: 0 2px !important;
    letter-spacing: -0.2px;
  }

  #brandFilterWrap .brand-filter-menu {
    min-width: 180px !important;
    max-width: 72vw !important;
  }

  #brandFilterWrap .brand-filter-option {
    white-space: nowrap !important;
  }

  /* 2) 服装分类改为单行 */
  .category-grid {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 4px !important;
    overflow: hidden !important;
  }

  .category-card {
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
    height: 64px !important;
  }

  .category-card__btn {
    padding: 4px 3px !important;
    font-size: 11px !important;
    min-width: 0 !important;
  }

  .category-card__name {
    font-size: 11px !important;
  }

  .category-card__count {
    font-size: 10px !important;
  }

  /* 3) 筛选框字体变小，且同一行显示 */
  #filterPanel {
    padding: 10px !important;
    overflow: visible !important;
  }

  .filters-row {
    display: grid !important;
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    gap: 4px !important;
    overflow: visible !important;
    padding-bottom: 0 !important;
    min-width: 0 !important;
    align-items: center !important;
  }

  .filters-row > select,
  .filters-row > .brand-filter-wrap {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  #filterPanel input,
  #filterPanel select,
  #filterPanel .brand-filter-trigger {
    font-size: 9px !important;
    min-height: 30px !important;
    height: 30px !important;
    box-sizing: border-box !important;
    padding: 2px 4px !important;
    line-height: 1.2 !important;
    letter-spacing: -0.1px;
  }

  #filterForm #searchInput {
    width: 100% !important;
    min-width: 0 !important;
    margin-top: 4px !important;
    font-size: 9px !important;
    min-height: 30px !important;
    padding: 3px 6px !important;
  }

  /* 6) 清空当前筛选 / 重置 按钮高度缩小 */
  #clearCurrentFilters,
  #resetFilters {
    min-height: 26px !important;
    height: 26px !important;
    padding: 0 8px !important;
    font-size: 11px !important;
    line-height: 1 !important;
    border-radius: 7px !important;
  }

  /* 4) 右下角 FAB：加号居中，提升图层避免被遮挡 */
  .fab {
    position: fixed !important;
    display: block !important;
    z-index: 9999 !important;
    right: 14px !important;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    width: 58px !important;
    height: 58px !important;
    line-height: 58px !important;
    padding: 0 !important;
    text-indent: -9999px !important;
    overflow: hidden !important;
  }

  .fab::before {
    content: "+";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -52%);
    font-size: 30px;
    font-weight: 500;
    line-height: 1;
    color: #fff;
    text-indent: 0;
  }

  /* 5) 弹窗右上角关闭按钮符号居中 */
  .close-btn {
    display: grid !important;
    place-items: center !important;
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    line-height: 1 !important;
    font-size: 22px !important;
  }
}
