/* ============================================
   移动端适配（≤768px）：文档管理页单列化 + 各 tab 微调
   原则：桌面样式不动，仅在小屏覆盖；页面改为整体滚动，放弃嵌套滚动容器
   ============================================ */

@media (max-width: 768px) {

  /* ---------- 文档管理页 ---------- */

  .container {
    height: auto;
    min-height: 100vh;
  }

  /* 头部：标题缩小、控件换行 */
  .header {
    padding: 10px 12px;
    gap: 8px;
    flex-wrap: wrap;
  }

  .header h1 {
    font-size: 16px;
    width: 100%;
    order: -1;
  }

  .folder-select {
    min-width: 0;
    flex: 1;
  }

  /* 主区域：侧栏与内容上下排 */
  .main-area {
    flex-direction: column;
    overflow: visible;
  }

  /* 侧边栏：全宽、文件列表限高内滚 */
  .sidebar {
    width: auto;
    margin: 8px;
    max-height: none;
  }

  .sidebar .file-list {
    max-height: 36vh;
    overflow-y: auto;
  }

  .sidebar-header {
    padding: 10px;
  }

  .multi-select-actions > div {
    flex-wrap: wrap;
  }

  /* 内容区：不再内部滚动，随页面滚动 */
  .content {
    margin: 0 8px 8px;
    overflow: visible;
  }

  /* 摘要表单：两列 */
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .summary-full {
    grid-column: span 2;
  }

  .summary-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .summary-section {
    padding: 10px 12px;
  }

  /* 预览面板：纵向堆叠、限高 */
  .preview-panels {
    flex-direction: column;
    overflow: visible;
    padding: 8px;
    gap: 8px;
  }

  .panel {
    flex: none;
    min-width: 0 !important;
  }

  .panel .panel-content {
    overflow: visible;
  }

  .image-preview {
    height: 320px;
    overflow: auto;
  }

  .ocr-text {
    max-height: 240px;
    overflow-y: auto;
  }

  #htmlCodeContent,
  #htmlRenderContent,
  #htmlStructuredContent {
    position: relative !important;
    min-height: 280px;
  }

  .panel-content[style*="overflow:hidden"] {
    overflow: visible !important;
    min-height: 300px;
  }

  /* 文件信息栏换行 */
  .file-info-bar {
    flex-wrap: wrap;
    gap: 4px 12px;
  }

  /* ---------- 弹窗 ---------- */

  .modal-content,
  .browse-dialog-content {
    width: 95vw !important;
    max-width: 95vw !important;
    margin: 4vh auto;
    max-height: 92vh;
    overflow-y: auto;
  }

  .batch-progress-modal {
    max-width: 95vw !important;
  }

  /* ---------- 健康/项目/财务/首页 tab ---------- */

  .health-container {
    padding: 8px;
  }

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

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

  .health-info-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .health-form-grid {
    grid-template-columns: 1fr;
  }

  .health-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .health-table {
    min-width: 520px;
  }

  .health-indicator-panel {
    max-height: 40vh;
  }

  /* 财务概览卡单列 */
  .finance-summary-grid {
    grid-template-columns: 1fr;
  }

  /* 项目卡片操作区换行 */
  .projects-card-head {
    flex-wrap: wrap;
  }

  .projects-card-actions {
    margin-left: 0;
    width: 100%;
    justify-content: flex-end;
  }

  .projects-add-task {
    flex-wrap: wrap;
  }

  .projects-add-task input[type="text"] {
    width: 100%;
    flex: none;
  }

  /* 首页提醒与动态行内换行 */
  .home-feed-meta {
    align-items: flex-start;
  }

  .dup-row {
    flex-direction: column;
    align-items: stretch;
  }

  .dup-row-actions {
    justify-content: flex-end;
  }

  /* 打卡/用药弹窗内容 */
  .health-checkin-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  /* ---------- 底部 tab 栏 ---------- */

  .shell-tab-bar {
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .shell-tab {
    font-size: 11px;
  }
}
