/* ======================================================
   DOCO Workstation - 移动端补充样式 (mobile.css)
   补充 styles.css 中已有的移动端响应式样式
   不覆盖、不重复，仅增强
   ====================================================== */

/* ===== 触摸优化：按钮最小触摸域 48×48 ===== */
@media (max-width: 768px) {
  /* ═══ 移动端顶部导航栏紧凑优化 v5 - !important 强制生效 ═══ */
  .mobile-header {
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    padding: 6px 8px !important;
    gap: 4px !important;
    min-height: 48px !important;
    max-height: 56px !important;
    overflow: hidden !important;
  }

  .logo-circle {
    width: 32px !important;
    height: 32px !important;
    font-size: 9px !important;
    flex-shrink: 0 !important;
  }

  .header-title {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    overflow: hidden !important;
    white-space: nowrap !important;
  }

  .header-title strong {
    font-size: 13px !important;
    display: inline !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .header-title small {
    font-size: 10px !important;
    display: inline !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* v5 右侧按钮尺寸缩减 - 全部 !important */
  .lang-switch {
    flex-shrink: 0 !important;
    padding: 1px !important;
    gap: 1px !important;
  }

  .lang-switch button {
    padding: 2px 4px !important;
    font-size: 9px !important;
    min-height: auto !important;
    min-width: auto !important;
  }

  .notification-bell {
    width: 20px !important;
    height: 20px !important;
    flex-shrink: 0 !important;
  }

  .notification-bell-icon {
    width: 20px !important;
    height: 20px !important;
    font-size: 14px !important;
    flex-shrink: 0 !important;
  }

  .theme-toggle-btn {
    width: 28px !important;
    height: 28px !important;
    flex-shrink: 0 !important;
  }

  .scan-btn {
    width: 32px !important;
    height: 32px !important;
    flex-shrink: 0 !important;
    border-radius: 8px !important;
    font-size: 14px !important;
  }

  .back-btn {
    font-size: 22px !important;
    flex-shrink: 0 !important;
  }

  .btn {
    min-height: 48px;
    min-width: 48px;
    padding: 12px 18px;
  }

  .btn-sm {
    min-height: 44px;
    padding: 10px 14px;
  }

  .icon-btn {
    min-height: 48px;
    min-width: 48px;
    font-size: 26px;
  }

  /* 输入框 16px 防止 iOS 自动缩放 */
  .input,
  .select,
  textarea {
    font-size: 16px;
    min-height: 48px;
    padding: 12px 14px;
  }

  /* 底部导航触摸优化 */
  .bottom-nav button {
    min-height: 56px;
    font-size: 11px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .bottom-nav button strong {
    font-size: 24px;
  }

  /* 表格转卡片布局 */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-mobile thead {
    display: none;
  }

  .table-mobile tbody tr {
    display: block;
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    background: #fff;
  }

  .table-mobile td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(117, 28, 40, .06);
    font-size: 14px;
  }

  .table-mobile td:last-child {
    border-bottom: none;
    white-space: normal;
  }

  .table-mobile td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--muted);
    margin-right: 16px;
    flex-shrink: 0;
    font-size: 13px;
  }

  /* 下拉刷新指示器 */
  .pull-to-refresh {
    text-align: center;
    padding: 16px;
    color: var(--muted);
    font-size: 13px;
    transition: opacity 0.3s;
  }

  .pull-to-refresh.refreshing {
    opacity: 0.6;
  }

  /* 侧滑操作按钮 */
  .swipe-actions {
    display: flex;
    gap: 8px;
  }

  .swipe-btn {
    min-width: 80px;
    min-height: 44px;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 14px;
  }

  /* 模态框底部安全区 */
  .modal-actions {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }

  /* 主内容区预留底部导航空间 */
  .mobile-content {
    padding-bottom: 84px;
  }
}

/* ===== 小屏手机 (≤520px) 额外优化 ===== */
@media (max-width: 520px) {
  /* 统计卡片单列 */
  .stat-grid,
  .stat-grid.compact {
    grid-template-columns: 1fr;
  }

  .stat {
    padding: 14px;
  }

  .stat strong {
    font-size: 24px;
  }

  /* 筛选栏单列 */
  .filter-bar {
    grid-template-columns: 1fr;
  }

  /* 表单单列 */
  .form-grid {
    grid-template-columns: 1fr;
  }

  /* 详情网格两列 */
  .detail-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* 工具栏竖排 */
  .toolbar-row {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-row label {
    min-width: 0;
  }

  /* 快速登录单列 */
  .quick-logins {
    grid-template-columns: 1fr 1fr;
  }

  /* 工作台列表单列 */
  .workbench-list > div:not(.empty) {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  /* Hero banner 缩小 */
  .hero-banner {
    min-height: 140px;
    padding: 20px 16px;
  }

  .hero-banner h2 {
    font-size: 24px;
  }

  /* 今日条幅单列 */
  .today-strip {
    grid-template-columns: 1fr;
  }

  /* 图标网格三列 */
  .icon-grid.four {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ===== Safe Area 适配 ===== */
@supports (padding: env(safe-area-inset-bottom)) {
  .bottom-nav {
    height: calc(72px + env(safe-area-inset-bottom));
  }

  .mobile-shell {
    padding-bottom: calc(84px + env(safe-area-inset-bottom));
  }

  .mobile-header {
    padding-top: calc(5px + env(safe-area-inset-top));
  }
}

/* ===== 平板端补充 (769px - 1024px) ===== */
@media (min-width: 769px) and (max-width: 1024px) {
  .stat-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .filter-bar {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ===== 隐藏/显示工具类 ===== */
@media (max-width: 768px) {
  .hide-on-mobile {
    display: none !important;
  }
}

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