/* ==========================================================================
   课记资料库 · 移动端 UI  V1.0
   依据《课记资料库_移动端UI设计交付规范》2026.12.02
   仅在 <768px 生效；桌面端（>=768px）不受到影响。
   本文件只覆盖样式与移动端交互，不修改任何接口、权限或数据逻辑。
   ========================================================================== */

/* ---------- 0. 修复：手机上文件列表整体消失 ------------------------------
   preview-v13.css 原有规则在 <768px 下无条件隐藏 .reader-list，
   导致未打开预览时列表也不可见。预览打开时由 .preview-open 自行控制。 */
@media (max-width: 767px) {
  .reader-v13 .reader-list { display: flex; }
  .reader-v13.preview-open .reader-list,
  .reader-v13.preview-open .preview-divider { display: none; }
}

@media (max-width: 767px) {

  /* ---------- 1. 设计变量（规范 03：颜色与实现约束） ---------- */
  :root {
    --m-theme: #52796B;
    --m-bg: #F4F6F6;
    --m-surface: #FFFFFF;
    --m-text: #263238;
    --m-muted: #63737A;
    --m-line: #E4E9E7;
    --m-pad: 16px;
    --m-radius: 8px;
    --m-nav-h: 56px;
    --m-safe: env(safe-area-inset-bottom, 0px);
  }

  html { -webkit-text-size-adjust: 100%; }
  body {
    background: var(--m-bg);
    color: var(--m-text);
    font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei",
                 "Noto Sans CJK SC", sans-serif;
    overflow-x: hidden;
  }

  /* ---------- 2. 顶栏 ---------- */
  header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    min-height: 52px;
    padding: 0 var(--m-pad);
    background: var(--m-surface);
    border-bottom: 1px solid var(--m-line);
    gap: 8px;
  }
  header .brand {
    font-size: 17px;
    font-weight: 600;
    color: var(--m-theme);
    text-decoration: none;
    white-space: nowrap;
  }
  header .brand span { display: none; }
  header nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
  }
  header nav #current-user {
    font-size: 13px;
    color: var(--m-muted);
    max-width: 96px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  header nav button {
    min-height: 44px;
    min-width: 44px;
    padding: 0 10px;
    font-size: 13px;
    border: 1px solid var(--m-line);
    border-radius: var(--m-radius);
    background: var(--m-surface);
    color: var(--m-theme);
  }
  .environment-label { display: none; }

  /* ---------- 3. 布局：单列，取消侧栏（规范 02 首页） ---------- */
  .shell {
    display: block !important;
    grid-template-columns: none !important;
    min-height: auto;
  }
  .shell > aside,
  #library-sidebar {
    display: none !important;
  }
  .shell > main,
  main {
    padding: 0 var(--m-pad);
    padding-bottom: calc(var(--m-nav-h) + var(--m-safe) + 76px);
    max-width: none;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
  }

  /* 页面标题 20-22 / 正文 14 / 辅助 12 */
  #workspace > h1 {
    font-size: 21px;
    line-height: 1.35;
    margin: 14px 0 10px;
    font-weight: 600;
  }
  h2 { font-size: 18px; margin: 12px 0; }
  .muted, .notice { font-size: 12px; line-height: 1.7; }

  /* ---------- 4. 工具栏：标题 + 上传 ---------- */
  #workspace > .toolbar {
    margin: 0 0 8px;
    gap: 10px;
    flex-wrap: nowrap;
    align-items: flex-start;
    justify-content: space-between;
  }
  #workspace > h1 {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 10px 0 6px;
  }
  #workspace > .toolbar > div:last-child {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
    justify-content: flex-end;
    padding-top: 8px;
  }
  #workspace > .toolbar button {
    min-height: 44px;
    font-size: 14px;
    padding: 0 16px;
    margin: 0;
    white-space: nowrap;
  }
  /* 新建文件夹、刷新并入其它入口，手机上不单列 */
  #new-folder { display: none; }
  #refresh { display: none; }
  /* 由 ui-v12.js 提供的筛选入口，保持可用 */
  .mobile-filter {
    display: flex !important;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin: 0 0 12px;
    padding: 0 16px;
    font-size: 14px;
    border: 1px solid var(--m-line);
    border-radius: var(--m-radius);
    background: var(--m-surface);
    color: var(--m-text);
  }
  /* 旧的类型快捷条由"类型"筛选入口取代，避免与范围标签重复 */
  .type-shortcuts { display: none !important; }

  /* ---------- 5. 搜索（规范：搜索框 40-44） ---------- */
  .search {
    margin: 0 0 10px;
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
  }
  .search label {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0;
    gap: 0;
    margin: 0;
  }
  .search input {
    width: 100%;
    max-width: none;
    height: 44px;
    margin: 0;
    padding: 0 14px;
    font-size: 15px;
    border-radius: var(--m-radius);
    border: 1px solid var(--m-line);
    background: var(--m-surface);
  }
  .search button {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0 14px;
    font-size: 14px;
    border-radius: var(--m-radius);
  }
  #clear-search { display: none; }

  /* ---------- 6. 资料范围标签（由脚本生成，见 §22） ---------- */
  .type-shortcuts { display: none !important; }

  /* ---------- 7. 筛选入口按钮（由脚本生成的三个 chip，见 §22） ---------- */

  /* ---------- 8. 筛选面板：底部抽屉（规范 02 集中筛选） ---------- */
  .filters {
    display: none;
  }
  /* 面板内隐藏桌面专用按钮 */
  #density { display: none !important; }
  .filters.mobile-expanded {
    display: grid !important;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 120;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    max-height: 82dvh;
    overflow-y: auto;
    margin: 0;
    padding: 20px var(--m-pad) calc(20px + var(--m-safe));
    background: var(--m-surface);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 40px #26323833;
    box-sizing: border-box;
  }
  .filters.mobile-expanded::before {
    content: "筛选资料";
    grid-column: 1 / -1;
    font-size: 17px;
    font-weight: 600;
    color: var(--m-text);
    padding-bottom: 4px;
  }
  .filters.mobile-expanded label {
    width: auto !important;
    font-size: 12px;
    color: var(--m-muted);
    margin: 0;
    line-height: 1.6;
  }
  .filters.mobile-expanded label:nth-child(5) { grid-column: 1 / -1; }
  .filters.mobile-expanded input {
    width: 100%;
    height: 44px;
    margin-top: 4px;
    font-size: 15px;
    border-radius: var(--m-radius);
  }
  .filters.mobile-expanded button {
    min-height: 48px;
    font-size: 15px;
    border-radius: var(--m-radius);
  }
  #apply-filters {
    grid-column: 1 / -1;
    background: var(--m-theme);
    border-color: var(--m-theme);
    color: #fff;
    font-weight: 600;
  }
  #reset-filters {
    grid-column: 1 / -1;
    background: var(--m-bg);
  }
  #density { display: none; }

  /* ---------- 9. 列表（规范：单列，行高 60-68） ---------- */
  .panel.table-wrap {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    overflow: visible;
  }
  .document-split,
  .document-split.preview-open {
    display: block;
    height: auto;
  }
  .reader-list {
    padding: 0;
    background: var(--m-surface);
    border-radius: var(--m-radius);
    border: 1px solid var(--m-line);
    overflow: visible;
  }
  .reader-list > .table-wrap {
    overflow: visible;
    border: 0;
  }
  table, thead, tbody, tr, td {
    display: block;
    width: 100%;
  }
  thead { display: none; }
  tbody#items { padding: 0; }

  #items tr {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 64px;
    padding: 12px 8px 12px 4px;
    border-bottom: 1px solid var(--m-line);
    position: relative;
    box-sizing: border-box;
  }
  #items tr:last-child { border-bottom: 0; }
  #items tr.preview-selected { background: #EEF4F1; }

  /* 复选框列：只在多选时显示，避免每行都占位 */
  #items td.select-col {
    display: none;
  }
  body.m-selecting #items td.select-col {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    min-width: 40px;
    flex: 0 0 40px;
    padding: 0;
    height: 44px;
  }
  #items td.select-col input {
    width: 20px;
    height: 20px;
    margin: 0;
  }
  /* 文件夹行没有勾选框，图标需顶格 */
  #items td.name-cell { padding-left: 12px; }
  body.m-selecting #items td.name-cell { padding-left: 0; }

  /* 名称列 */
  #items td.name-cell {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
    padding: 0;
    border: 0;
    max-width: none;
    min-height: 0;
  }
  #items td.name-cell > .file-icon,
  #items .file-icon {
    float: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 36px;
    width: 36px;
    min-width: 36px;
    height: 36px;
    margin: 0 !important;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .3px;
    background: #EDF2F0;
    color: var(--m-theme);
  }
  #items .file-icon.pdf { background: #FBEDEA; color: #B46252; }
  #items .file-icon.word { background: #E8EEF8; color: #4C6FA8; }
  #items .file-icon.ppt { background: #FCEEDF; color: #B5793A; }
  #items .file-icon.excel { background: #E6F2E9; color: #4A7F5B; }
  #items .file-icon.image { background: #F0EDF7; color: #6E5C94; }

  #items td.name-cell > div {
    min-width: 0;
    flex: 1 1 auto;
    overflow: visible;
    display: block;
    min-height: 0;
  }
  #items .filename {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    word-break: break-word;
    text-align: left;
    font-size: 15px;
    line-height: 1.35;
    max-width: 100%;
    color: var(--m-text);
    border: 0;
    background: none;
    padding: 0;
    min-height: 0;
  }
  #items .mobile-meta {
    display: block;
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--m-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* 隐藏桌面专属列 */
  #items td.column-meta { display: none !important; }

  /* 操作列：更多按钮 */
  #items td:last-child {
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    padding: 0;
    border: 0;
    height: auto;
  }
  #items .operations {
    display: flex;
    align-items: center;
    gap: 2px;
    min-width: 0;
    flex-wrap: nowrap;
  }
  /* 下载与收藏移入"更多"底部菜单（由脚本搬迁），行内只保留更多按钮 */
  #items .operations > .download,
  #items .operations > .star {
    display: none;
  }
  /* 菜单内的下载/收藏条目 */
  #items details.more[open] > .more-menu .m-moved {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 52px;
    padding: 0 8px;
    font-size: 16px;
    text-align: left;
    border: 0;
    border-bottom: 1px solid var(--m-line);
    border-radius: 0;
    background: transparent;
    color: var(--m-text);
    text-decoration: none;
    box-sizing: border-box;
  }
  #items details.more > summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 0;
    border: 0;
    background: transparent;
    color: var(--m-muted);
    cursor: pointer;
  }
  #items details.more > summary::-webkit-details-marker { display: none; }
  #items details.more > summary::before {
    content: "⋯";
    font-size: 22px;
    line-height: 1;
    letter-spacing: 1px;
  }

  /* ---------- 10. 更多菜单：底部操作面板（规范 02 文件操作） ---------- */
  #items details.more[open] > .more-menu {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto !important;
    z-index: 130;
    margin: 0;
    padding: 12px var(--m-pad) calc(12px + var(--m-safe));
    background: var(--m-surface);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 40px #26323833;
    max-height: 76dvh;
    overflow-y: auto;
    box-sizing: border-box;
  }
  #items details.more[open] > .more-menu::before {
    content: "";
    display: block;
    width: 40px;
    height: 4px;
    margin: 0 auto 12px;
    border-radius: 2px;
    background: var(--m-line);
  }
  #items details.more[open] > .more-menu button {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 52px;
    padding: 0 8px;
    font-size: 16px;
    text-align: left;
    border: 0;
    border-bottom: 1px solid var(--m-line);
    border-radius: 0;
    background: transparent;
    color: var(--m-text);
  }
  #items details.more[open] > .more-menu button:last-child { border-bottom: 0; }
  #items details.more[open] > .more-menu button.danger { color: #A4453C; }


  /* ---------- 11. 空状态 / 分页 ---------- */
  #items .empty-state {
    display: block;
    padding: 48px 16px;
    text-align: center;
    color: var(--m-muted);
    font-size: 14px;
    border: 0;
  }
  .pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 12px 0 0;
    padding: 0;
    flex-wrap: nowrap;
  }
  .pager #total {
    font-size: 12px;
    color: var(--m-muted);
    flex: 1 1 auto;
    min-width: 0;
  }
  .pager button {
    min-height: 44px;
    min-width: 64px;
    font-size: 14px;
    border-radius: var(--m-radius);
  }

  /* ---------- 12. 选择条 ---------- */
  .selection-bar {
    position: sticky;
    bottom: calc(var(--m-nav-h) + var(--m-safe));
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-height: 48px;
    margin: 8px 0;
    padding: 8px 12px;
    border-radius: var(--m-radius);
    background: #E3EFE8;
    font-size: 13px;
  }
  .selection-bar button { min-height: 40px; }
  #storage-info { display: none; }

  /* ---------- 13. 面包屑 ---------- */
  #breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 2px;
    font-size: 12px;
    color: var(--m-muted);
    margin: 0 0 8px;
    scrollbar-width: none;
  }
  #breadcrumbs::-webkit-scrollbar { display: none; }
  #breadcrumbs button {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 0 6px;
    font-size: 12px;
    border: 0;
    background: transparent;
    color: var(--m-theme);
    white-space: nowrap;
  }

  /* ---------- 14. 底部导航（规范：56 + 安全区） ---------- */
  .mobile-bottom {
    display: flex !important;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    height: calc(var(--m-nav-h) + var(--m-safe));
    padding-bottom: var(--m-safe);
    background: var(--m-surface);
    border-top: 1px solid var(--m-line);
    justify-content: space-around;
    align-items: stretch;
    box-sizing: border-box;
  }
  .guest .mobile-bottom { display: none !important; }
  .mobile-bottom button {
    flex: 1 1 0;
    min-height: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 0;
    background: transparent;
    color: var(--m-muted);
    font-size: 11px;
    padding: 4px 0;
    line-height: 1.2;
  }
  .mobile-bottom button::before {
    font-size: 19px;
    line-height: 1;
  }
  .mobile-bottom button:nth-child(1)::before { content: "▤"; }
  .mobile-bottom button:nth-child(2)::before { content: "☆"; }
  .mobile-bottom button:nth-child(3)::before { content: "◎"; }
  /* 第 3 个是「上传」，并入右下悬浮按钮，导航里不再重复 */
  .mobile-bottom button:nth-child(3) { display: none; }

  /* ---------- 15. 悬浮上传按钮：样式见 §22（仅移动端显示） ---------- */

  /* ---------- 16. 账号管理 / 系统状态：卡片化 ---------- */
  #users-view .table-wrap, #status-view .table-wrap {
    border: 1px solid var(--m-line);
    border-radius: var(--m-radius);
    background: var(--m-surface);
    padding: 0;
  }
  #users tbody tr {
    display: block;
    padding: 12px;
    border-bottom: 1px solid var(--m-line);
    min-height: 0;
  }
  #users tbody tr:last-child { border-bottom: 0; }
  #users tbody td {
    display: block;
    padding: 2px 0;
    height: auto;
  }
  #users tbody td:nth-child(1) { font-size: 15px; font-weight: 600; }
  #users tbody td:nth-child(2) { font-size: 13px; color: var(--m-muted); }
  #users tbody td:nth-child(3),
  #users tbody td:nth-child(4) {
    display: inline-block;
    font-size: 12px;
    color: var(--m-muted);
    margin-right: 10px;
  }
  #users tbody td:last-child { margin-top: 8px; }
  #users tbody td button {
    min-height: 40px;
    margin: 4px 6px 0 0;
    font-size: 13px;
    padding: 0 12px;
    border-radius: var(--m-radius);
  }
  #users-view .toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }
  #users-view .toolbar h2 { flex: 1 1 auto; margin: 0; }

  /* ---------- 17. 登录页 ---------- */
  /* 宽度直接按视口锁定，不依赖祖先的 padding 计算，避免任何横向裁切 */
  #login-view.login.panel {
    width: calc(100vw - 32px) !important;
    max-width: calc(100vw - 32px) !important;
    margin: 20px auto !important;
    box-sizing: border-box !important;
    padding: 20px !important;
    border-radius: var(--m-radius);
  }
  #login-view h2 { font-size: 20px; margin-bottom: 8px; }
  #login-view form label {
    display: block;
    margin-bottom: 14px;
    font-size: 13px;
    color: var(--m-muted);
  }
  #login-view form input {
    width: 100% !important;
    height: 46px;
    margin-top: 6px;
    font-size: 16px;
    border-radius: var(--m-radius);
    box-sizing: border-box;
  }
  #login-view form button {
    width: 100% !important;
    min-height: 48px;
    font-size: 16px;
    border-radius: var(--m-radius);
  }
  #login-view p.muted { font-size: 12px; line-height: 1.7; }

  .login {
    margin: 20px 0;
    max-width: none;
    padding: 20px;
    border-radius: var(--m-radius);
  }
  .login h2 { font-size: 20px; margin-bottom: 8px; }
  .login form label {
    display: block;
    margin-bottom: 14px;
    font-size: 13px;
    color: var(--m-muted);
  }
  .login form input {
    width: 100%;
    height: 46px;
    margin-top: 6px;
    font-size: 16px; /* 避免 iOS 聚焦时自动放大 */
    border-radius: var(--m-radius);
    box-sizing: border-box;
  }
  .login form button {
    width: 100%;
    min-height: 48px;
    font-size: 16px;
    border-radius: var(--m-radius);
  }

  /* ---------- 18. 对话框 ---------- */
  dialog {
    width: calc(100vw - 24px);
    max-width: none;
    max-height: 86dvh;
    padding: 18px;
    border-radius: 14px;
  }
  dialog input, dialog select, dialog textarea {
    font-size: 16px;
    min-height: 46px;
    border-radius: var(--m-radius);
  }
  dialog button { min-height: 46px; border-radius: var(--m-radius); }
  dialog .dialog-heading button {
    width: 44px;
    height: 44px;
    min-height: 44px;
  }

  /* ---------- 19. 提示信息 ---------- */
  footer.muted {
    display: block;
    padding: 16px var(--m-pad);
    font-size: 12px;
    line-height: 1.6;
    color: var(--m-muted);
    text-align: center;
    background: transparent;
    word-break: break-all;
  }
  footer.muted a {
    color: var(--m-muted);
    text-decoration: none;
    font-size: 12px;
  }
  /* 登录页无底部导航，去掉多余留白 */
  body.guest .shell > main { padding-bottom: 32px; }

  #message {
    position: static;
    margin: 12px 0 0;
    padding: 10px 14px;
    border-radius: var(--m-radius);
    background: #26323812;
    color: var(--m-text);
    font-size: 13px;
    line-height: 1.5;
    min-height: 0;
  }
  #message:empty { display: none; }
  #message:not(:empty) + .m-fab { display: none; }

  /* ---------- 20. 预览：独立全屏（规范 02/04） ---------- */
  /* 只在预览真正打开时全屏；平时必须保持 display:none，
     否则这块灰底会盖住整页并吞掉所有点击。 */
  .document-preview:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 90;
    width: 100%;
    height: 100dvh;
    background: #EDF1EE;
    display: flex;
    flex-direction: column;
  }
  .reader-v13 .document-preview[hidden],
  .document-preview[hidden] { display: none !important; }
  .preview-heading {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    padding-top: calc(8px + env(safe-area-inset-top, 0px));
    background: var(--m-surface);
    border-bottom: 1px solid var(--m-line);
    flex-wrap: nowrap;
    flex: 0 0 auto;
  }
  .preview-heading strong {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 15px;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    order: 0;
  }
  /* 标题右侧只留"关闭"，其余收进次级工具条，避免换行占三行 */
  .preview-heading button {
    min-height: 44px;
    min-width: 44px;
    padding: 0 10px;
    font-size: 13px;
    border-radius: var(--m-radius);
    flex: 0 0 auto;
  }
  #pane-detail, #pane-fullscreen { display: none; }
  #pane-star { order: 1; }
  #pane-close { order: 2; }
  #reader-list-toggle { display: none; }
  .preview-tools {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    background: var(--m-surface);
    border-bottom: 1px solid var(--m-line);
    flex-wrap: wrap;
    flex: 0 0 auto;
  }
  .preview-tools button,
  .preview-tools .download {
    min-height: 44px;
    min-width: 44px;
    padding: 0 12px;
    font-size: 14px;
    border-radius: var(--m-radius);
  }
  .preview-tools .page-jump { font-size: 13px; }
  .preview-tools .page-jump input { width: 52px; height: 40px; font-size: 15px; }
  #pane-download {
    flex: 1 1 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    margin-top: 6px;
    background: var(--m-theme);
    border: 1px solid var(--m-theme);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
  }
  .reader-v13 .page-viewport {
    padding: 8px;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  .reader-v13 .pdf-page { margin: 0 auto 8px; }
  /* 手机端逐页图片预览（服务端渲染） */
  .reader-v13 .page-image {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 1px 5px #24352d18;
  }
  #pane-state, #pane-info {
    font-size: 12px;
    padding: 4px 10px;
    color: var(--m-muted);
    flex: 0 0 auto;
  }
}

/* ---------- 21. 极窄屏（<=340px）微调 ---------- */
@media (max-width: 340px) {
  :root { --m-pad: 12px; }
  #items tr { gap: 6px; padding-right: 2px; }
  #items td.select-col { width: 30px; flex-basis: 30px; }
  #items .file-icon { flex-basis: 32px; width: 32px; min-width: 32px; height: 32px; }
  #items .filename { font-size: 14px; }
  header nav #current-user { display: none; }
}

/* ---------- 22. 移动端新增元素（范围标签 / 筛选入口 / 悬浮上传） ---------- */
/* 默认隐藏；在下方移动端媒体查询里按需显示 */
.m-scope-tabs,
.m-filter-chips,
.m-fab { display: none; }

@media (max-width: 767px) {
  /* 悬浮上传按钮（覆盖默认 display:none） */
  .m-fab {
    display: flex;
    position: fixed;
    right: 16px;
    bottom: calc(var(--m-nav-h) + var(--m-safe) + 16px);
    z-index: 61;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 0;
    background: var(--m-theme);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px #26323840;
  }
  .guest .m-fab { display: none; }
  body.m-selecting .m-fab { display: none; }
  #message:not(:empty) ~ .m-fab { display: none; }

  .m-scope-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    overflow-x: auto;
    margin: 0 0 10px;
    padding-bottom: 2px;
    border-bottom: 1px solid var(--m-line);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .m-scope-tabs::-webkit-scrollbar { display: none; }
  .m-scope-tabs button {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0 14px;
    font-size: 14px;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--m-muted);
    white-space: nowrap;
  }
  .m-scope-tabs button[aria-pressed="true"] {
    color: var(--m-theme);
    font-weight: 600;
    border-bottom-color: var(--m-theme);
  }

  .m-filter-chips {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    margin: 0 0 12px;
    scrollbar-width: none;
  }
  .m-filter-chips::-webkit-scrollbar { display: none; }
  .m-chip {
    flex: 1 1 0;
    min-width: 0;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0 10px;
    font-size: 14px;
    border: 1px solid var(--m-line);
    border-radius: var(--m-radius);
    background: var(--m-surface);
    color: var(--m-text);
    white-space: nowrap;
    overflow: hidden;
  }
  .m-chip span { overflow: hidden; text-overflow: ellipsis; }
  .m-chip i { font-style: normal; color: var(--m-muted); font-size: 12px; }
  .m-chip[data-filed="1"] {
    border-color: var(--m-theme);
    color: var(--m-theme);
    font-weight: 600;
  }

  /* 多选入口：只在有文件时出现（脚本按行数切换 data-empty） */
  .m-select-entry {
    min-height: 44px;
    padding: 0 16px;
    margin: 0;
    font-size: 14px;
    border: 1px solid var(--m-line);
    border-radius: var(--m-radius);
    background: var(--m-surface);
    color: var(--m-theme);
  }
  .m-select-entry[data-empty="1"] { display: none; }
  body.m-selecting .m-select-entry {
    background: var(--m-theme);
    border-color: var(--m-theme);
    color: #fff;
  }
  body.m-selecting #m-fab { display: none; }
}

