/* ===== 手机端底部导航栏 ===== */
.mobile-tabbar {
  display: none;
}

@media (max-width: 768px) {
  /* 隐藏侧边栏，改用底部Tab */
  .sidebar {
    display: none !important;
  }

  .mobile-toggle {
    display: none !important;
  }

  /* 主内容区占满屏幕，底部留出Tab栏空间 */
  .main-content {
    margin-left: 0 !important;
    padding: 12px 12px 72px 12px !important;
  }

  /* 底部Tab栏 */
  .mobile-tabbar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg2);
    border-top: 1px solid var(--rule);
    z-index: 200;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .mobile-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--muted);
    cursor: pointer;
    text-decoration: none;
    font-size: 11px;
    transition: color 0.15s;
    padding: 4px 0;
  }

  .mobile-tab.active {
    color: var(--accent);
  }

  .mobile-tab-icon {
    font-size: 20px;
    line-height: 1;
  }

  .mobile-tab-label {
    font-size: 11px;
    line-height: 1;
  }

  /* 页面头部适配 */
  .page-header {
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .page-header h2 {
    font-size: 17px;
  }

  .page-header .actions {
    gap: 6px;
    flex-wrap: wrap;
  }

  .page-header .actions .btn {
    font-size: 12px;
    padding: 4px 10px;
  }

  /* 隐藏主题切换按钮（在设置里统一管理） */
  .theme-toggle {
    display: none !important;
  }

  .theme-toggle-mobile {
    display: none !important;
  }

  /* 统计卡片：手机端2列 */
  .stat-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  .stat-card {
    padding: 12px !important;
  }

  .stat-card .stat-label {
    font-size: 11px !important;
  }

  .stat-card .stat-value {
    font-size: 18px !important;
  }

  /* 表格适配：横向滚动 */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 500px;
  }

  table th {
    font-size: 12px;
    padding: 8px 10px;
    white-space: nowrap;
  }

  table td {
    font-size: 13px;
    padding: 8px 10px;
  }

  /* 表单适配 */
  .form-row {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .form-group {
    margin-bottom: 10px !important;
  }

  /* 模态框适配 */
  .modal-overlay {
    padding: 0 !important;
    overflow-y: auto;
  }

  .modal {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 100vh;
    border-radius: 0 !important;
    max-height: 100vh !important;
    overflow-y: auto !important;
  }

  .modal-header {
    padding: 12px 16px !important;
    position: sticky;
    top: 0;
    background: var(--bg2);
    z-index: 10;
  }

  .modal-body {
    padding: 16px !important;
  }

  .modal-footer {
    padding: 12px 16px !important;
    position: sticky;
    bottom: 0;
    background: var(--bg2);
    z-index: 10;
  }

  /* 按钮适配 */
  .btn {
    font-size: 13px;
    padding: 8px 14px;
  }

  .btn-sm {
    font-size: 12px;
    padding: 5px 10px;
  }

  /* 卡片间距缩小 */
  .card {
    margin-bottom: 10px !important;
    padding: 12px !important;
  }

  /* 项目看板特殊适配 */
  .project-board {
    flex-direction: column !important;
  }

  .project-column {
    margin-bottom: 12px;
  }

  /* 导出弹窗适配 */
  .export-toolbar {
    flex-direction: column;
    gap: 8px !important;
  }

  /* 设置页面适配 */
  #page-settings .s-stats-table th {
    font-size: 11px;
    padding: 6px 8px;
  }

  #page-settings .s-stats-table td {
    font-size: 12px;
    padding: 6px 8px;
  }

  #page-settings .s-monthly {
    grid-template-columns: repeat(3, 1fr) !important;
  }

  #page-settings .s-quarterly {
    flex-direction: column !important;
  }

  #page-settings .s-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }

  #page-settings .s-tab {
    white-space: nowrap;
    padding: 8px 14px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .main-content {
    padding: 10px 10px 72px 10px !important;
  }

  .page-header h2 {
    font-size: 16px;
  }

  .stat-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  .stat-card .stat-value {
    font-size: 16px !important;
  }

  .btn {
    font-size: 12px;
    padding: 7px 12px;
  }

  .mobile-tab-label {
    font-size: 10px;
  }

  .mobile-tab-icon {
    font-size: 18px;
  }
}
