:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --line: #e6e9f0;
  --text: #1c2333;
  --muted: #7b869c;
  --primary: #2f6bff;
  --primary-soft: #e8efff;
  --danger: #e5484d;
  --ok: #17a34a;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(20, 30, 60, .06);
  /* 安全区域：iPhone 刘海屏与底部横条 */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  /* 长文件名 / 长路径不该把整页撑出横向滚动条 */
  overflow-x: hidden;
}
.hidden { display: none !important; }

/* ---------- 登录 ---------- */
.login-mask {
  position: fixed; inset: 0; z-index: 100;
  background: linear-gradient(160deg, #eef2ff, #f7f9fc 60%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  padding-bottom: calc(20px + var(--sab));
  min-height: 100vh;
  min-height: 100dvh;
  /* 矮屏（横屏手机）时卡片可能超出视口，允许遮罩层滚动 */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.login-card {
  width: 100%; max-width: 360px; background: var(--card);
  border-radius: 18px; padding: 32px 28px; box-shadow: 0 12px 40px rgba(20, 30, 60, .12);
  text-align: center;
}
.login-logo { line-height: 0; }
.logo-svg {
  width: 30px; height: 30px; display: block;
  color: var(--primary);
}
.login-logo .logo-svg { width: 54px; height: 54px; margin: 0 auto; }
.login-card h1 { font-size: 20px; margin: 6px 0 4px; }
.login-sub { color: var(--muted); margin: 0 0 18px; font-size: 13px; }
.login-card input {
  width: 100%; padding: 11px 14px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 16px; outline: none; transition: border-color .15s;
}
.login-card input:focus { border-color: var(--primary); }
.login-err { color: var(--danger); font-size: 13px; min-height: 20px; margin-top: 8px; }
.login-tip { color: var(--muted); font-size: 12px; margin: 14px 0 0; }

/* ---------- 布局 ---------- */
.app {
  max-width: 1180px; margin: 0 auto;
  padding: 0 14px 120px;
  padding-left: calc(14px + var(--sal));
  padding-right: calc(14px + var(--sar));
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 2px 10px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { font-size: 26px; }
.brand .title { font-size: 17px; font-weight: 600; }
.brand .sub { font-size: 12px; color: var(--muted); }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.alert-bar {
  background: #fff6e6; color: #8a5a00; border: 1px solid #ffdca8;
  padding: 9px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.alert-bar.warn {
  background: #fdecec; color: #a33; border-color: #f5c2c2;
}
.alert-bar.hidden { display: none; }
.alert-msg { flex: 1; min-width: 0; }
.alert-act { flex: none; }

.toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  justify-content: space-between; margin-bottom: 10px;
}
.tool-left, .tool-right { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search { display: flex; gap: 6px; }
.search input {
  width: 190px; max-width: 46vw; padding: 7px 12px; border: 1px solid var(--line);
  border-radius: 9px; outline: none; background: var(--card); font-size: 14px;
  font-family: inherit;
}
.search input:focus { border-color: var(--primary); }
.select {
  padding: 7px 8px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--card); color: var(--text); font-size: 14px; font-family: inherit;
}

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  padding: 7px 13px; border-radius: 9px; cursor: pointer; font-size: 13px;
  transition: .15s; white-space: nowrap;
  touch-action: manipulation;          /* 去掉移动端 300ms 点击延迟 */
  font-family: inherit;
  -webkit-appearance: none;
}
.btn:hover { border-color: #c9d3ea; background: #fafbff; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: #2559db; }
.btn.danger { border-color: #f3c6c8; color: var(--danger); background: #fff; }
.btn.danger:hover { background: #fdf1f1; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: #eef1f8; color: var(--text); }
.btn.block { width: 100%; padding: 11px; font-size: 15px; margin-top: 4px; }
.btn.tiny { padding: 3px 8px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- 面包屑 ---------- */
.crumbs {
  display: flex; flex-wrap: wrap; gap: 2px; align-items: center;
  font-size: 13px; padding: 6px 2px 10px; color: var(--muted);
}
.crumbs .crumb {
  cursor: pointer; padding: 3px 8px; border-radius: 7px; color: var(--primary);
}
.crumbs .crumb:hover { background: var(--primary-soft); }
.crumbs .sep { opacity: .5; }
.crumbs .cur {
  color: var(--text); font-weight: 600; padding: 3px 4px;
  overflow-wrap: anywhere;
}

/* ---------- 列表 ---------- */
.main { position: relative; }
.list { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.row:last-child, .up-item:last-child, .sh-item:last-child {
  border-bottom: none;
}
.row:hover { background: #fafbfe; }
.row.sel { background: var(--primary-soft); }

/* 表头行：无 hover 态、不参与选择高亮 */
.row.head {
  font-size: 12px; color: var(--muted); min-height: 0;
  padding-top: 8px; padding-bottom: 8px;
}
.row.head:hover { background: transparent; }
/* 图标列占位：数据行有图标，表头没有，不占位的话「名称」会左移 44px */
.row.head .ico.ph { visibility: hidden; }
/* 操作列宽度按按钮个数给：数据行的 ops 由按钮内容自然撑开，
   表头没有按钮，只能靠这个对齐。 */
.row.head .ops.w1 { width: 42px; }
.row.head .ops.w2 { width: 92px; }
.row.head .ops.w3 { width: 146px; }
.row .cb { width: 16px; height: 16px; cursor: pointer; flex: none; margin: 0; }
.row .ico {
  width: 34px; height: 34px; flex: none; border-radius: 8px; display: flex;
  align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
  background: #eef1f7; color: #5a6884; text-transform: uppercase;
  overflow: hidden;
}
.row .ico.dir { background: #fff2d9; color: #b7791f; }
.row .ico svg { width: 18px; height: 18px; }
.row .name {
  flex: 1; min-width: 0; cursor: pointer; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.row .name:hover { color: var(--primary); }
/* 目录整行可点（点任意位置进入下一级），光标要跟着变，
   否则用户看不出哪里能点。文件只有名称/图标可点。 */
.row[data-dir="1"] { cursor: pointer; }
.row[data-dir="1"]:hover { background: #f7f9fe; }
.row[data-dir="1"].sel:hover { background: #eaf1fe; }
/* 元信息容器：桌面端作为 .row 的一个 flex 项，内部再横排 meta/time。 */
.row .info {
  display: flex; align-items: baseline; gap: 10px; flex: none;
}
.row .meta { width: 96px; text-align: right; color: var(--muted); font-size: 12px; flex: none; }
.row .time { width: 128px; text-align: right; color: var(--muted); font-size: 12px; flex: none; }
.row .ops { display: flex; gap: 4px; flex: none; }
.row .ops .btn { padding: 4px 9px; font-size: 12px; }

/* ---------- 网格 ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.cell {
  background: var(--card); border-radius: var(--radius); padding: 14px 8px 10px;
  text-align: center; box-shadow: var(--shadow); cursor: pointer; position: relative;
  border: 2px solid transparent;
}
.cell.sel { border-color: var(--primary); background: var(--primary-soft); }
.cell .ico {
  width: 46px; height: 46px; margin: 0 auto 8px; border-radius: 10px; display: flex;
  align-items: center; justify-content: center; background: #eef1f7; color: #5a6884;
  font-size: 11px; font-weight: 700; text-transform: uppercase; overflow: hidden;
}
.cell .ico.dir { background: #fff2d9; color: #b7791f; }
.cell .ico svg { width: 26px; height: 26px; }
.cell .nm {
  font-size: 12px; word-break: break-all; line-height: 1.35;
  overflow-wrap: anywhere;
}
.cell .sz { font-size: 11px; color: var(--muted); margin-top: 3px; }

.empty { text-align: center; color: var(--muted); padding: 60px 20px; }
.empty-ico { line-height: 0; margin-bottom: 10px; color: var(--muted); opacity: .55; }
.empty-ico svg { width: 44px; height: 44px; }
.drop-hint {
  position: fixed; inset: 12px; z-index: 60; display: none;
  border: 2px dashed var(--primary); border-radius: 16px; background: rgba(232, 239, 255, .92);
  align-items: center; justify-content: center; font-size: 18px; color: var(--primary);
  pointer-events: none;
}
.drop-hint.on { display: flex; }

/* ---------- 底部条 ---------- */
.selbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 50;
  display: flex; gap: 8px; align-items: center; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px;
  box-shadow: 0 8px 30px rgba(20, 30, 60, .16);
}
.sel-count { font-size: 13px; color: var(--muted); margin-right: 4px; }

.upload-panel {
  position: fixed; right: 16px; bottom: 16px; width: 340px; max-width: calc(100vw - 32px);
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; z-index: 55;
  box-shadow: 0 10px 34px rgba(20, 30, 60, .18); overflow: hidden;
}
.up-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 600;
}
.up-head-actions { display: flex; gap: 6px; }
.up-list { max-height: 320px; overflow: auto; overscroll-behavior: contain; }
.up-item { padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 12px; }
.up-item .nm { display: flex; justify-content: space-between; gap: 8px; }
/* 文件名过长时换行显示，不截断 */
.up-item .nm span:first-child { overflow-wrap: anywhere; min-width: 0; }
.up-item .nm span:last-child { flex: none; }
.up-item .bar { height: 5px; background: #eef1f7; border-radius: 3px; margin-top: 6px; overflow: hidden; }
.up-item .bar i { display: block; height: 100%; background: var(--primary); width: 0; transition: width .2s; }
.up-item.err .bar i { background: var(--danger); }
.up-item.done .bar i { background: var(--ok); }
.up-item .st { color: var(--muted); margin-top: 4px; display: flex; justify-content: space-between; }

/* ---------- 弹窗 / 提示 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 90; background: rgba(18, 24, 40, .45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card {
  width: 100%; max-width: 340px; background: var(--card); border-radius: 16px; padding: 22px;
  /* 弹性列：内容区占据剩余高度并可滚动，标题与按钮区固定不参与压缩。
     不改这处时，长内容弹窗在小屏上会把确认按钮挤出可视区。 */
  display: flex; flex-direction: column;
  max-height: 86vh;
}
.modal-card h3 { margin: 0 0 14px; font-size: 16px; flex: none; }
.modal-card input {
  width: 100%; margin-bottom: 10px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 9px; outline: none; font-size: 16px; font-family: inherit;
}
.modal-card input:focus { border-color: var(--primary); }
/* flex: none —— 按钮区不参与压缩，始终可见 */
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; flex: none; }

/* ---------- 可访问目录 ---------- */
.vol-card { max-width: 560px; }
.vol-hint { color: var(--muted); font-size: 12px; line-height: 1.7; margin: 0 0 12px; }
.vol-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.vol-loading { color: var(--muted); font-size: 13px; text-align: center; padding: 24px 8px; line-height: 1.8; }
.vol-warn {
  background: #fff6e6; color: #8a5a00; border: 1px solid #ffdca8;
  border-radius: 9px; padding: 9px 12px; font-size: 12px; line-height: 1.7; margin-bottom: 10px;
}
.vol-warn code {
  background: rgba(0, 0, 0, .07); padding: 1px 5px; border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.vol-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 12px; border-radius: 9px; cursor: pointer; margin-bottom: 4px;
  border: 1px solid transparent;
}
.vol-item:hover { background: rgba(0, 0, 0, .04); }
.vol-item.active { background: rgba(58, 122, 254, .10); border-color: rgba(58, 122, 254, .30); cursor: default; }
.vol-main { min-width: 0; flex: 1; }
.vol-name { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.vol-path { font-size: 11px; color: var(--muted); word-break: break-all; }
.vol-tag { font-size: 10px; padding: 1px 6px; border-radius: 5px; margin-left: 6px; font-weight: 400; }
.vol-tag.cur { background: var(--primary); color: #fff; }
.vol-tag.w { background: rgba(52, 168, 122, .16); color: #1f8a63; }
.vol-tag.ro { background: rgba(0, 0, 0, .07); color: var(--muted); }

/* ---------- 顶栏存储容量条 ---------- */
.brand-text { min-width: 0; flex: 1; }
.disk-bar {
  margin-top: 5px; height: 4px; width: 100%; max-width: 260px;
  background: rgba(0, 0, 0, .07); border-radius: 3px; overflow: hidden;
}
.disk-used {
  display: block; height: 100%; width: 0;
  background: var(--primary); border-radius: 3px;
  transition: width .4s ease;
}
.disk-used.warm { background: #e8a33d; }
.disk-used.hot { background: #d9585c; }

/* ---------- 管理面板 ---------- */
.admin-card { max-width: 720px; }
.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; flex: none; }
.admin-tab {
  padding: 5px 12px; border-radius: 8px; font-size: 12px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  font-family: inherit; touch-action: manipulation;
}
.admin-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.admin-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.admin-pane { display: none; }
.admin-pane.active { display: block; }
.admin-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.admin-bar .grow { flex: 1; }
.admin-stat { font-size: 12px; color: var(--muted); }
.admin-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.admin-label { font-size: 12px; color: var(--muted); min-width: 92px; }
.admin-row input, .admin-row select { flex: 1; min-width: 160px; }
.admin-row input.num { flex: none; width: 90px; }
.admin-note {
  font-size: 12px; color: var(--muted); line-height: 1.75; margin: 0 0 12px;
  background: rgba(0, 0, 0, .03); border-radius: 8px; padding: 8px 11px;
}
.admin-msg { font-size: 12px; color: var(--primary); min-height: 16px; }
.admin-limits {
  border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; margin-bottom: 4px;
}

/* ---------- 分享链接 ---------- */
.share-result { margin-top: 10px; }
.share-url-box { display: flex; gap: 8px; align-items: center; }
.share-url-box input {
  flex: 1; min-width: 0; padding: 8px 11px; font-size: 12.5px;
  border: 1px solid var(--line); border-radius: 9px; background: #f7f9fc;
  color: var(--text); font-family: ui-monospace, Menlo, Consolas, monospace;
}
.sh-item {
  padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 13px;
}
.sh-row1 {
  display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap;
}
.sh-nm {
  font-weight: 600; min-width: 0;
  overflow-wrap: anywhere;      /* 长文件名换行，不截断 */
}
.sh-row2 {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 6px;
}
.sh-meta { color: var(--muted); font-size: 11.5px; }
.sh-tag {
  font-size: 10.5px; padding: 2px 8px; border-radius: 20px; flex: none;
}
.sh-tag.ok { background: rgba(52, 168, 122, .13); color: #1f8a63; }
.sh-tag.bad { background: rgba(229, 72, 77, .12); color: #c9484b; }
.sh-row2 .grow { flex: 1; min-width: 0; }

/* 日志列表 */
.log-list { font-size: 12px; }
.log-empty { color: var(--muted); text-align: center; padding: 22px 8px; }
.log-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: 7px; margin-bottom: 2px; line-height: 1.5;
}
.log-row:hover { background: rgba(0, 0, 0, .035); }
.log-t { color: var(--muted); font-size: 11px; min-width: 82px; }
.log-ip { font-family: ui-monospace, Menlo, monospace; font-size: 11px; min-width: 96px; }
.log-ip.wide { min-width: 140px; }
.log-a { flex: 1; min-width: 0; word-break: break-all; }
/* 路径不做截断：审计日志的价值就在于能看清操作了哪个文件 */
.log-target { color: var(--muted); min-width: 0; word-break: break-all; }
.log-res { font-size: 11px; min-width: 34px; text-align: right; }
.log-res.ok { color: #1f8a63; }
.log-res.bad { color: #c9484b; }
.log-ua { color: var(--muted); font-size: 11px; padding: 0 8px 4px 96px; word-break: break-all; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(-20px);
  top: calc(16px + var(--sat)); z-index: 200; background: rgba(28, 35, 51, .92); color: #fff;
  padding: 9px 18px; border-radius: 10px; font-size: 13px; opacity: 0;
  transition: .25s; pointer-events: none; max-width: 86vw; text-align: center;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   移动端适配
   目标：窄屏下不挤压、触摸目标够大、弹窗不溢出、贴合安全区域
   ============================================================ */
@media (max-width: 640px) {
  /* ---------- 整体布局 ---------- */
  body { font-size: 15px; }
  .app {
    padding: 0 12px calc(110px + var(--sab));
    padding-left: calc(12px + var(--sal));
    padding-right: calc(12px + var(--sar));
    max-width: 100%;
  }

  /* ---------- 顶栏：品牌一行，操作一行 ---------- */
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: calc(10px + var(--sat)) 0 10px;
  }
  .brand { gap: 9px; align-items: flex-start; }
  .brand .logo { font-size: 26px; }
  .brand .title { font-size: 16px; }
  .brand .sub { font-size: 11.5px; line-height: 1.5; }
  /* 路径过长时换行显示，不截断 */
  .brand-text { min-width: 0; }
  .brand .sub {
    display: block; max-width: 100%;
    overflow-wrap: anywhere;
  }
  .disk-bar { max-width: none; margin-top: 6px; height: 5px; }

  /* 操作按钮：换行而不是横向滚动（滚动会让后面的按钮被挤出可视区） */
  .top-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-start;
    overflow: visible;
    padding-bottom: 2px;
  }
  .top-actions .btn { flex: none; white-space: nowrap; }

  /* 触摸目标：iOS HIG 建议 44px，这里用 38px 兼顾密度 */
  .btn { min-height: 38px; padding: 8px 13px; font-size: 13.5px; }
  .btn.tiny { min-height: 32px; padding: 6px 10px; }

  /* ---------- 工具栏 ---------- */
  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 9px;
    padding: 6px 0 10px;
  }
  .tool-left {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;          /* 换行替代横向滚动，让全部按钮都露出来 */
    overflow: visible;
  }
  .tool-left .btn { flex: none; white-space: nowrap; }

  /* 搜索独占一行：和排序、视图按钮挤在一行时，
     搜索框只剩不到 100px，连五个字都输入不了 */
  .tool-right {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
  }
  .search { flex: 1 1 100%; min-width: 0; }
  .search input {
    width: 100%;
    min-height: 38px;
    font-size: 16px;          /* 低于 16px 时 iOS 聚焦会自动放大页面 */
  }
  .select { min-height: 38px; font-size: 16px; flex: 1; min-width: 0; }
  #btn-view { min-width: 44px; }

  /* ---------- 文件行：手机上改两行 ----------
     一行塞不下「文件名 + 大小 + 时间 + 三个按钮」。
       第一行  复选框 · 图标 · 文件名（跨满剩余宽度，可换行显示完整）
       第二行  ─ 大小 · 修改时间 ······ 操作按钮（靠右） */
  .row {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    column-gap: 8px;
    row-gap: 3px;
    padding: 10px 8px;
    align-items: center;
  }
  /* 复选框与图标纵向跨两行，垂直居中 */
  .row .cb  { grid-area: 1 / 1 / 3 / 2; align-self: center; width: 18px; height: 18px; }
  .row .ico {
    grid-area: 1 / 2 / 3 / 3; align-self: center;
    width: 30px; height: 30px; font-size: 15px;
  }
  /* 文件名：跨满第 3~4 列，占尽剩余宽度；取消截断，允许换行 */
  .row .name {
    grid-area: 1 / 3 / 2 / 5;
    font-size: 15px; line-height: 1.4;
    white-space: normal;
    overflow-wrap: anywhere;
    overflow: visible;
    text-overflow: clip;
  }
  /* 元信息：占弹性列，内部 flex-wrap —— 空间不够时时间整体换行，
     而不是被 grid 的 auto 列压扁 */
  .row .info {
    grid-area: 2 / 3 / 3 / 4;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 10px;
    min-width: 0;
  }
  .row .meta, .row .time {
    width: auto;
    font-size: 11.5px;
    text-align: left;
    white-space: nowrap;
  }
  .row .time { display: block; }
  /* 操作按钮：占末列并靠右，把右侧空白吃掉 */
  .row .ops { grid-area: 2 / 4 / 3 / 5; justify-self: end; gap: 5px; flex: none; }

  /* ---------- 行内操作按钮：图标化 ----------
     三个文字按钮约 144px，会挤占第二行；改成图标后只占约 110px。 */
  .row .ops .btn {
    width: 36px; height: 36px;
    /* 必须显式覆盖：上面 .btn 有 min-height:38px，
       min-height 会兜住 height 的下限 */
    min-height: 36px;
    padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0;                 /* 文字让位给图标，但保留在 DOM 里供读屏使用 */
    border-radius: 9px;
  }
  .row .ops .btn::before { font-size: 16px; line-height: 1; }
  .row .ops .btn[data-act="ren"]::before { content: "✎"; }
  .row .ops .btn[data-act="del"]::before { content: "✕"; }

  /* 下载是这一行最主要的操作：主色实心 + 白字 + 阴影 + 稍大，
     与重命名/删除明显区分 */
  .row .ops .btn[data-act="dl"] {
    width: 40px; height: 40px; min-height: 40px;
    background: var(--primary); border-color: var(--primary); color: #fff;
    box-shadow: 0 2px 8px rgba(47, 107, 255, .30);
  }
  .row .ops .btn[data-act="dl"]::before {
    content: "↓"; font-weight: 700; color: #fff; font-size: 18px;
  }

  /* 只有一个按钮时恢复文字，空间够、也更直观 */
  .row .ops .btn:only-child {
    width: auto; height: 38px; min-height: 38px;
    padding: 0 14px; font-size: 13px;
  }
  .row .ops .btn:only-child::before { content: none; }

  /* 删除按钮图标化后仍需一眼可辨，保留危险色 */
  .row .ops .btn.danger { border-color: #f3c6c8; color: var(--danger); background: #fff; }

  /* ---------- 表头：和数据行共用同一套 grid，列自然对齐 ---------- */
  .row.head {
    padding: 8px; font-size: 12px; color: var(--muted);
    min-height: 0;
  }
  .row.head .ops.w1,
  .row.head .ops.w2,
  .row.head .ops.w3 { width: auto; }
  /* 手机上每行自带大小与时间，表头再标一遍只会多占一行 */
  .row.head .info { display: none; }
  .row.head .name { grid-area: 1 / 3 / 2 / 5; }

  /* ---------- 面包屑 ----------
     容器横向滚动，而不是给每个 crumb 加滚动 */
  .crumbs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    font-size: 13.5px;
    padding: 4px 0 10px;
  }
  .crumbs::-webkit-scrollbar { display: none; }
  .crumbs .crumb, .crumbs .cur { flex: none; white-space: nowrap; }

  /* ---------- 弹窗：贴底升起，更符合手机习惯 ---------- */
  .modal {
    padding: 0;
    align-items: flex-end;      /* 桌面居中，手机贴底 */
  }
  .modal-card {
    width: 100%;
    max-width: 100%;
    max-height: 88vh;
    max-height: 88dvh;
    border-radius: 18px 18px 0 0;
    padding: 18px 16px calc(18px + var(--sab));
    margin: 0;
    animation: sheet-up .22s ease;
  }
  @keyframes sheet-up {
    from { transform: translateY(24px); opacity: .4; }
    to   { transform: translateY(0);    opacity: 1; }
  }
  .modal-card h3 { font-size: 16px; margin: 0 0 12px; }
  .modal-card input,
  .modal-card select {
    min-height: 42px;
    font-size: 16px;            /* 防 iOS 聚焦缩放 */
  }
  .modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
  }
  .modal-actions .btn { flex: 1; min-height: 44px; }

  /* ---------- 登录页 ---------- */
  .login-mask { padding: 16px; align-items: flex-start; padding-top: 12vh; }
  .login-card { padding: 26px 20px; border-radius: 16px; }
  .login-card input { min-height: 44px; font-size: 16px; }
  .login-card .btn { min-height: 46px; font-size: 15px; }

  /* ---------- 上传面板 ----------
     默认贴底；有选中项时（底部操作条升起）自动上移，避免互相遮挡 */
  .upload-panel {
    right: 10px;
    left: 10px;
    width: auto;
    bottom: calc(12px + var(--sab));
    border-radius: 14px;
  }
  body.has-sel .upload-panel { bottom: calc(150px + var(--sab)); }
  .up-list { max-height: 42vh; }

  /* ---------- 选中操作条 ----------
     贴底铺满，按钮等分，比桌面那个居中小条更好点 */
  .selbar {
    left: 10px;
    right: 10px;
    transform: none;
    bottom: calc(10px + var(--sab));
    border-radius: 14px;
    padding: 10px 12px;
    gap: 8px;
    flex-wrap: wrap;
    box-shadow: 0 -2px 20px rgba(20, 30, 60, .14), 0 8px 30px rgba(20, 30, 60, .16);
  }
  .sel-count { flex: 1 1 100%; text-align: center; margin: 0 0 2px; font-size: 12.5px; }
  .selbar .btn { flex: 1 1 28%; min-height: 42px; padding: 8px 6px; font-size: 13px; }
  .selbar #btn-sel-clear { flex: 1 1 100%; }

  /* ---------- 网格视图：手机上 3 列正好 ---------- */
  .grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .cell { padding: 12px 6px 9px; border-radius: 12px; }
  .cell .ico { width: 44px; height: 44px; font-size: 11px; margin-bottom: 6px; }
  .cell .ico.dir { font-size: 21px; }
  .cell .nm { font-size: 12px; }

  /* ---------- 提示条 ----------
     按钮另起一行并撑满，点起来更顺手，也不会把文字挤成很窄的一列 */
  .alert-bar {
    font-size: 13px;
    line-height: 1.7;
    padding: 12px 13px;
    border-radius: 12px;
    word-break: break-word;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .alert-msg { flex: none; }
  .alert-act { width: 100%; min-height: 40px; }

  /* ---------- 空状态：加卡片框住，手机上看得出边界 ---------- */
  .empty {
    padding: 40px 20px;
    font-size: 14px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }
  .empty-ico { font-size: 42px; margin-bottom: 12px; }

  /* ---------- 管理面板 ---------- */
  .admin-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
  }
  .admin-tabs::-webkit-scrollbar { display: none; }
  .admin-tab { flex: none; white-space: nowrap; min-height: 34px; padding: 7px 13px; }
  .admin-row { flex-direction: column; align-items: stretch; gap: 5px; }
  .admin-label { min-width: 0; font-size: 12.5px; }
  .admin-row input,
  .admin-row select { min-height: 42px; font-size: 16px; width: 100%; }
  .admin-row input.num { width: 100%; }
  /* 底部「日志上限 / IP 上限」：一行放下两个输入，按钮独占一行。
     之前用 grid 时每个字段各占一行，光这块就吃掉两百多像素，
     把上面的设置项挤得只剩两三行。 */
  .admin-limits {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }
  .admin-limits .admin-label { min-width: 0; font-size: 12px; }
  .admin-limits .num {
    flex: 1 1 72px; width: auto; min-height: 38px; font-size: 16px;
  }
  .admin-limits #lim-save { flex: 1 1 100%; min-height: 38px; }

  /* 日志行在手机上改用多行布局，避免挤成一团 */
  .log-row {
    flex-wrap: wrap;
    gap: 4px 8px;
    padding: 8px;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
  }
  .log-row:last-child { border-bottom: none; }
  .log-t { min-width: 76px; font-size: 11px; }
  .log-ip { min-width: 0; font-size: 11px; }
  .log-a { flex: 1 1 100%; order: 3; font-size: 12px; color: var(--text); }
  .log-target { flex: 1 1 100%; order: 4; font-size: 11px; }
  .log-ua { padding: 0 8px 4px; }
  .log-res { margin-left: auto; }

  /* ---------- 目录选择弹窗 ---------- */
  .vol-item { padding: 12px 10px; min-height: 54px; }
}

/* 超窄屏（iPhone SE 一类 375px 及以下）再收紧一档 */
@media (max-width: 400px) {
  .app { padding-left: 10px; padding-right: 10px; }
  .brand .title { font-size: 15px; }
  .row { column-gap: 6px; }
  .row .name { font-size: 14px; }
  .btn { padding: 7px 11px; font-size: 13px; }
  .top-actions { gap: 5px; }
  /* 3 列在 375px 下每格只剩 110px，图标会挤，退回 2 列 */
  .grid { grid-template-columns: repeat(2, 1fr); }
  .selbar .btn { font-size: 12px; padding: 8px 4px; }
  .row .ops .btn { width: 34px; height: 34px; min-height: 34px; }
  .row .ops .btn[data-act="dl"] { width: 38px; height: 38px; min-height: 38px; }
}

/* 横屏手机：顶栏收回一行，避免占掉太多高度 */
@media (max-height: 480px) and (orientation: landscape) {
  .topbar { flex-direction: row; align-items: center; padding-top: calc(6px + var(--sat)); }
  .top-actions { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; }
  .login-mask { padding-top: 4vh; align-items: center; }
  .modal-card { max-height: 92vh; }
  .row .time { display: inline; }
}

/* 触摸设备：去掉 hover 残留（手机上点完会一直高亮） */
@media (hover: none) {
  .row:hover { background: transparent; }
  .row:active { background: var(--primary-soft); }
  .row[data-dir="1"]:hover { background: transparent; }
  .btn:hover { border-color: var(--line); background: var(--card); }
  .btn.ghost:hover { background: transparent; color: var(--muted); }
  .btn.primary:hover { background: var(--primary); }
  .btn:active { opacity: .72; }
  .cell:active { border-color: var(--primary); }
  .log-row:hover { background: transparent; }
}
