/* 手机 / 平板竖屏（宽度 ≤ 900px） */
@media (max-width: 900px) {
  html {
    height: 100%;
    -webkit-text-size-adjust: 100%;
  }

  body {
    zoom: 1;
    width: 100%;
    height: 100%;
    height: 100dvh;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .app-chrome {
    flex-direction: column;
  }

  .mobile-only {
    display: flex !important;
  }

  .desktop-only {
    display: none !important;
  }

  .mobile-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 350;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }

  body.mobile-nav-open .mobile-drawer-overlay,
  body.mobile-groups-open .mobile-drawer-overlay {
    display: block;
  }

  .app-nav {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(288px, 88vw);
    z-index: 400;
    transform: translateX(-105%);
    transition: transform 0.28s var(--ease-out);
    padding-top: max(12px, env(safe-area-inset-top));
  }

  body.mobile-nav-open .app-nav {
    transform: translateX(0);
  }

  body.app-nav-collapsed .app-nav {
    width: min(288px, 88vw);
  }

  .app-nav-collapse-btn {
    display: none;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(288px, 88vw);
    z-index: 400;
    transform: translateX(-105%);
    transition: transform 0.28s var(--ease-out);
    padding-top: max(16px, env(safe-area-inset-top));
  }

  body.mobile-groups-open .sidebar {
    transform: translateX(0);
  }

  .app-main {
    flex: 1;
    min-height: 0;
    width: 100%;
  }

  .app-page-warehouse.active {
    flex-direction: row;
    flex-wrap: nowrap;
  }

  .main-header {
    padding-left: 8px;
    padding-right: 8px;
    gap: 8px;
  }

  .main-header h3 {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .toolbar-cluster.column-toggle,
  .toolbar-cluster .view-toggle,
  #globalViewBtn {
    display: none;
  }

  .toolbar-row {
    flex-wrap: wrap;
    gap: 6px;
  }

  .header-actions {
    flex: 1;
    min-width: 0;
  }

  .search-box input {
    min-width: 0;
    width: 100%;
  }

  .cards-container {
    padding: 12px 10px calc(80px + env(safe-area-inset-bottom)) !important;
  }

  :root {
    --card-columns: 2;
    --toolbar-h: 52px;
  }

  .edit-panel {
    position: fixed;
    inset: 0;
    width: 100% !important;
    max-width: 100%;
    min-width: 0;
    z-index: 450;
    border-left: none;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .edit-panel.hidden {
    width: 100% !important;
    transform: translateX(100%);
    opacity: 0;
  }

  .edit-panel:not(.hidden) {
    transform: translateX(0);
    opacity: 1;
  }

  .fab-new {
    bottom: calc(72px + env(safe-area-inset-bottom));
    right: 16px;
    width: 52px;
    height: 52px;
    font-size: 26px;
  }

  .toast {
    bottom: calc(76px + env(safe-area-inset-bottom));
    max-width: calc(100vw - 32px);
    text-align: center;
  }

  .mobile-header-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    padding: 0;
  }

  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 380;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    gap: 4px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: rgba(18, 18, 18, 0.94);
    border-top: 1px solid var(--border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
  }

  .mobile-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 48px;
    padding: 4px 6px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
  }

  .mobile-tab svg {
    width: 22px;
    height: 22px;
  }

  .mobile-tab.active,
  .mobile-tab:active {
    color: var(--text-primary);
    background: var(--accent-bg);
  }

  .auth-box,
  .settings-panel,
  .custom-modal {
    max-height: 85dvh;
    margin: 16px;
  }

  .floating-prompt {
    max-width: calc(100vw - 24px);
    right: 12px !important;
    left: 12px !important;
    width: auto !important;
  }

  .tag-sheet-panel {
    max-height: 70dvh;
  }

  body.panel-open {
    overflow: hidden;
  }
}

@media (min-width: 901px) {
  .mobile-only {
    display: none !important;
  }

  .mobile-drawer-overlay {
    display: none !important;
  }

  .mobile-bottom-nav {
    display: none !important;
  }
}
