/* cloud2api /files/ — 人类可用的文件空间页（API Key 域，非管理登录）。
 * 依赖 /files/assets/app.css 的设计令牌与基础组件（btn/card/badge/tbl/callout/
 * field/input/select/chip/drive-grid……），本文件只补充页面自身的布局与状态。 */

/* ---------- MOCK 演示模式 banner ---------- */
.fx-mock {
  position: sticky; top: 0; z-index: 90;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--violet-soft); color: var(--violet);
  border-bottom: 1px solid #ddd0f5;
  padding: 7px 16px; font-size: 12.5px; line-height: 1.5;
}
.fx-mock strong { font-size: 12px; letter-spacing: .04em; white-space: nowrap; }
.fx-mock-txt { color: var(--text-2); min-width: 0; }

/* ---------- 门（gate） ---------- */
body:has(#gate:not([hidden])) {
  background: radial-gradient(ellipse at 50% 12%, var(--ok-soft) 0%, var(--bg) 58%);
}
.fx-gate {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 32px 16px; gap: 18px;
  animation: fxArrive .35s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes fxArrive { from { opacity: 0; transform: translateY(10px); } }
.fx-brand { display: flex; align-items: center; gap: 14px; }
.fx-mark {
  width: 76px; height: 76px; border-radius: 18px; overflow: hidden; flex: 0 0 auto;
  background: transparent;
}
.fx-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.fx-mark-sm { width: 36px; height: 36px; border-radius: 10px; }
.fx-brand-name { font-size: 18px; font-weight: 700; letter-spacing: .01em; color: var(--text); }
.fx-brand-name-sm { font-size: 14.5px; }
.fx-brand-sub { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.fx-gate-card {
  width: 560px; max-width: 100%;
  padding: 26px 26px 24px;
  border-radius: 20px;
}
.fx-gate-card h1 { font-size: 22px; font-weight: 650; margin-bottom: 6px; }
.fx-hint { font-size: 13px; color: var(--text-2); line-height: 1.65; margin-bottom: 18px; }
.fx-keyrow { display: flex; gap: 8px; }
.fx-keyrow .input { flex: 1; min-width: 0; font-family: var(--mono); }
.fx-gate-card .btn-block { margin-top: 14px; padding: 10px 14px; font-size: 14px; }
.fx-gate-card .field-error:not(:empty) {
  margin-top: 10px; padding: 8px 11px; border-radius: 8px; background: var(--danger-soft);
}
.fx-privacy { margin-top: 16px; }
.fx-privacy-sm { font-size: 12px; color: var(--text-3); line-height: 1.65; margin-top: 14px; }
.fx-more { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 10px; }
.fx-more summary {
  cursor: pointer; user-select: none; font-size: 12.5px; font-weight: 600;
  color: var(--text-2); list-style: none; display: flex; align-items: center; gap: 6px;
}
.fx-more summary::before { content: '▸'; color: var(--text-3); transition: transform .15s; }
.fx-more[open] summary::before { transform: rotate(90deg); }
.fx-more summary::-webkit-details-marker { display: none; }
.fx-more-body { font-size: 12.5px; color: var(--text-2); line-height: 1.7; padding-top: 8px; }
.fx-more-body p { margin: 0 0 6px; }
.fx-more-body a { font-weight: 600; }
.fx-presubmit-warn { margin-top: 10px; }
.fx-foot { font-size: 12px; color: var(--text-3); }
.fx-foot a { color: var(--text-2); font-weight: 600; }

/* ---------- 工作区顶栏 ---------- */
.fx-top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  min-height: 58px;
}
.fx-brand-sm { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fx-keyline { font-size: 11.5px; color: var(--text-3); margin-top: 1px; display: flex; align-items: center; gap: 6px; }
.fx-top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
#theme-toggle .ico-moon { display: none; }
[data-theme="dark"] #theme-toggle .ico-sun { display: none; }
[data-theme="dark"] #theme-toggle .ico-moon { display: block; }

.fx-shell {
  max-width: 1180px; margin: 0 auto;
  padding: 22px 20px 64px;
}

/* ---------- 通知条 ---------- */
.fx-notice {
  max-width: 1180px; margin: 14px auto -6px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 13px; line-height: 1.55; word-break: break-word;
}
.fx-notice.fx-ok { background: var(--ok-soft); color: var(--ok); }
.fx-notice.fx-err { background: var(--danger-soft); color: var(--danger); }
.fx-notice.fx-info { background: var(--info-soft); color: var(--info); }

/* ---------- 页头 ---------- */
.fx-pagehead { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.fx-pagehead h2 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.fx-sub { color: var(--text-3); font-size: 12.5px; margin-top: 4px; line-height: 1.55; }

/* ---------- 网盘卡片（着陆页） ---------- */
.fx-drive-name { font-size: 18px; font-weight: 650; letter-spacing: -.02em; margin: 14px 0 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-drive-root { color: var(--text-3); font-size: 11.5px; font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-drive-perms { margin-top: 12px; }
.fx-drive-foot {
  margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.fx-drive-foot .btn { border-radius: 999px; padding: 8px 16px; }
.fx-drive-limit { margin-left: auto; font-size: 11px; color: var(--text-3); }
.fx-default-chip { margin-left: auto; }
.fx-health-note { margin-top: 9px; font-size: 11.5px; color: var(--text-2); line-height: 1.6; }
.fx-health-note.fx-warn { color: var(--warn); }

/* ---------- 面包屑 ---------- */
.fx-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 0; margin-bottom: 12px; min-height: 32px; }
.fx-crumb {
  appearance: none; background: none; border: 0; font-family: inherit; font-size: 13.5px;
  font-weight: 550; color: var(--text-2); padding: 4px 6px; border-radius: 7px;
  cursor: pointer; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fx-crumb:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.fx-crumb[aria-current="page"] { color: var(--text); font-weight: 650; cursor: default; }
.fx-crumb[aria-current="page"]:hover { background: none; }
.fx-crumb-sep { color: var(--text-3); font-size: 12px; user-select: none; }
.fx-crumb-sep::after { content: "/"; }
.fx-crumb-home { font-weight: 650; color: var(--text); }
.fx-crumbs .fx-drive-health { margin-left: 8px; }

/* ---------- 工具栏 ---------- */
.fx-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.fx-search { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); font-weight: 600; }
.fx-search .input { width: 230px; }
.fx-grow { flex: 1 1 auto; }

/* ---------- 拖放上传区 ---------- */
.fx-upload-head { justify-content: space-between; margin-bottom: 18px; }
.fx-upload-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fx-destination { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; min-width: 0; }
.fx-destination > span { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.fx-destination .fx-crumbs { margin: 0; min-width: 0; }
.fx-dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: clamp(340px, 48vh, 500px);
  border: 2px dashed var(--border-strong); border-radius: 24px;
  background: radial-gradient(ellipse at 50% 0%, var(--ok-soft), transparent 75%), var(--surface);
  padding: 40px 28px; margin-bottom: 22px; text-align: center;
  cursor: pointer; outline: none;
  transition: border-color var(--motion-fast), background-color var(--motion-fast), box-shadow var(--motion-fast);
}
.fx-dropzone:hover, .fx-dropzone:focus-visible { border-color: var(--ok); }
.fx-dropzone:focus-visible { box-shadow: 0 0 0 3px var(--ok-soft); }
.fx-dropzone.fx-drag { border-color: var(--ok); background: var(--ok-soft); box-shadow: inset 0 0 0 1px var(--ok); }
.fx-upload-icon { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 22px; background: var(--ok-soft); color: var(--ok); margin-bottom: 20px; }
.fx-dz-title { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-bottom: 10px; }
.fx-dz-main { max-width: 600px; font-size: 14px; color: var(--text-2); line-height: 1.8; overflow-wrap: anywhere; }
.fx-dz-opts { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-top: 24px; max-width: 100%; }
.fx-choose-files { min-width: 180px; padding: 13px 30px; font-size: 15px; border-radius: 12px; }
.fx-upload-hint { color: var(--text-3); font-size: 12px; line-height: 1.7; margin-top: 20px; }
.fx-dropzone[aria-disabled="true"] { background: var(--surface-2); cursor: default; }
.fx-dropzone[aria-disabled="true"] .fx-upload-icon { color: var(--text-3); background: var(--surface-3); }
.fx-file-manager { margin-top: 28px; border-top: 1px solid var(--border); padding-top: 24px; }
.fx-manager-head { margin-bottom: 16px; }
.fx-manager-head h3 { font-size: 16px; font-weight: 650; }
.fx-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); font-weight: 600; }
.fx-inline .select { width: auto; padding: 5px 28px 5px 10px; font-size: 12.5px; border-radius: 8px; }
.fx-overwrite-confirm { color: var(--warn); font-weight: 550; }

/* ---------- 文件表 ---------- */
th.fx-th-actions { text-align: right; }
.tbl td.fx-cell-actions { text-align: right; white-space: nowrap; }
.tbl td.fx-cell-share { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; min-width: 150px; }
.fx-namebtn {
  appearance: none; background: none; border: 0; padding: 0; font-family: inherit;
  font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; max-width: 420px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left;
}
.fx-namebtn:hover { color: var(--ok); text-decoration: underline; }
.fx-namebtn:focus-visible { outline: 2px solid var(--ok); outline-offset: 2px; border-radius: 4px; }
.fx-ico-dir, .fx-ico-file { flex: 0 0 auto; display: inline-block; }
.fx-ico-dir::before {
  content: ""; display: inline-block; width: 0; height: 0;
  border-left: 8px solid #e9b65e; border-top: 5px solid transparent; border-bottom: 5px solid transparent;
  border-radius: 1px;
}
[data-theme="dark"] .fx-ico-dir::before { border-left-color: #edba79; }
.fx-ico-file::before {
  content: ""; display: inline-block; width: 10px; height: 12px;
  border: 1.5px solid var(--text-3); border-radius: 2.5px;
}
.fx-cell-name { display: flex; align-items: center; min-width: 0; }
.fx-cell-name .fx-namebtn, .fx-cell-name .fx-nametext { min-width: 0; }
.fx-nametext {
  font-size: 13px; font-weight: 600; color: var(--text);
  display: inline-flex; align-items: center; gap: 8px;
  max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
td.fx-cell-num { font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 12.5px; white-space: nowrap; }
td.fx-cell-time { color: var(--text-3); font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.fx-cell-path { font-family: var(--mono); font-size: 11px; color: var(--text-3); max-width: 220px; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 分页 ---------- */
.fx-pager { display: flex; align-items: center; gap: 12px; margin: 14px 0 22px; }
.fx-pageinfo { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------- 上传队列 ---------- */
.fx-uploadpanel { padding: 20px 22px; }
.fx-uphead { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.fx-uphead h3 { font-size: 17px; font-weight: 650; }
.fx-queue { display: flex; flex-direction: column; }
.fx-task {
  display: grid; grid-template-columns: minmax(140px, 1.4fr) minmax(120px, 1fr) auto auto;
  gap: 4px 14px; align-items: center;
  padding: 10px 4px; border-bottom: 1px solid var(--border); font-size: 12.5px;
}
.fx-task:last-child { border-bottom: 0; }
.fx-task-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-task-name .fx-task-sub { display: block; font-weight: 400; font-size: 11px; color: var(--text-3); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-task-mid { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fx-task progress { flex: 1; width: 100%; height: 8px; appearance: none; -webkit-appearance: none; border: 0; background: transparent; }
.fx-task progress::-webkit-progress-bar { background: var(--surface-3); border-radius: 999px; }
.fx-task progress::-webkit-progress-value { background: var(--ok); border-radius: 999px; transition: width .18s; }
.fx-task progress::-moz-progress-bar { background: var(--ok); border-radius: 999px; }
.fx-task-size { color: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fx-task-state { white-space: nowrap; }
.fx-task-act { display: flex; gap: 6px; justify-content: flex-end; }
.fx-queue .empty { padding: 22px 10px; }
.fx-state-done { color: var(--ok); font-weight: 600; }
.fx-state-failed { color: var(--danger); font-weight: 600; }
.fx-state-interrupted { color: var(--warn); font-weight: 600; }
.fx-state-busy { color: var(--text-2); font-weight: 550; }
.fx-task-err { grid-column: 1 / -1; font-size: 11.5px; color: var(--text-2); background: var(--surface-3); border-radius: 7px; padding: 6px 9px; line-height: 1.55; word-break: break-word; }
.fx-task-err.fx-warn { color: var(--warn); background: var(--warn-soft); }

/* ---------- 原生对话框 ---------- */
dialog.fx-dlg {
  border: 1px solid var(--border); border-radius: 20px;
  padding: 0; background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-3);
  width: 500px; max-width: calc(100vw - 24px);
}
dialog.fx-dlg::backdrop { background: rgba(15, 20, 32, .46); backdrop-filter: blur(4px); }
.fx-dlg-inner { padding: 22px 22px 18px; }
.fx-dlg-inner h3 { font-size: 17px; font-weight: 650; margin-bottom: 4px; }
.fx-dlg-sub { font-size: 12.5px; color: var(--text-2); line-height: 1.6; margin: 6px 0; word-break: break-all; }
.fx-dlg .field { margin-top: 14px; }
.fx-dlg .field-error:not(:empty) { margin-top: 10px; }
.fx-dlg-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.fx-delete-path {
  background: var(--surface-3); border-radius: 9px; padding: 9px 12px;
  font-size: 12.5px; word-break: break-all;
}
.fx-share-row { display: flex; gap: 8px; }
.fx-share-row .input { flex: 1; min-width: 0; font-size: 12px; }
#share-result .callout { margin-top: 12px; }
#share-result .fx-sub { word-break: break-all; }

/* ---------- 空态微调 ---------- */
.fx-empty-inline { padding: 30px 16px; }
.fx-err-line { color: var(--danger); }
.fx-err-sub { color: var(--text-2); font-size: 12px; margin-top: 6px; line-height: 1.6; max-width: 560px; margin-left: auto; margin-right: auto; word-break: break-word; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------- 已保存的工作区列表（正式模式恢复流） ---------- */
.fx-wslist {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 32px 16px; gap: 18px;
  animation: fxArrive .35s cubic-bezier(.2, .7, .2, 1) both;
}
.fx-ws-wrap { width: 560px; max-width: 100%; }
.fx-ws-wrap h1 { font-size: 22px; font-weight: 650; margin: 0 0 4px; }
.fx-ws-wrap .fx-sub { margin-bottom: 16px; }
.fx-ws-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.fx-ws-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-1); padding: 16px 16px 14px;
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.fx-ws-name { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.fx-ws-meta { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-ws-meta.mono { font-family: var(--mono); }
.fx-ws-foot { margin-top: 12px; display: flex; justify-content: flex-end; }
.fx-ws-foot .btn { border-radius: 999px; padding: 8px 16px; }
.fx-ws-wrap .fx-foot { margin-top: 16px; display: flex; align-items: center; gap: 10px; }

/* ---------- 主页导航（/，静态无脚本；深色跟随系统） ---------- */
body.home {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 32px 16px;
  background: radial-gradient(ellipse at 50% 12%, var(--ok-soft) 0%, var(--bg) 58%);
}
.home-shell {
  width: 640px; max-width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  animation: fxArrive .35s cubic-bezier(.2, .7, .2, 1) both;
}
.home-title { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin: 14px 0 0; }
.home-sub { font-size: 13px; color: var(--text-2); margin: 0 0 10px; text-align: center; }
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%; }
.home-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 20px 20px 18px; border-radius: 20px;
  color: var(--text); text-decoration: none;
  transition: transform .16s, box-shadow .16s, border-color .16s;
}
.home-grid > .home-card { margin: 0; }
.home-card:hover { text-decoration: none; border-color: var(--ok); box-shadow: var(--shadow-2); transform: translateY(-2px); }
.home-card-head { display: flex; align-items: center; gap: 10px; }
.home-ico {
  width: 38px; height: 38px; border-radius: 12px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: var(--ok-soft); color: var(--ok);
}
.home-ico-admin { background: var(--accent-soft); color: var(--text-2); }
.home-card-name { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.home-card-desc { font-size: 12.5px; color: var(--text-2); line-height: 1.7; margin: 0; flex: 1; }
.home-card-go { font-size: 13px; font-weight: 600; color: var(--ok); }
.home-foot { font-size: 11.5px; color: var(--text-3); margin-top: 14px; text-align: center; }
/* 主页没有脚本设置 data-theme：跟随系统浅深色 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #171917; --surface: #202320; --surface-2: #252925; --surface-3: #2e332e;
    --border: #363c36; --border-strong: #4e574e;
    --text: #f0f1eb; --text-2: #bec4b9; --text-3: #99a293;
    --accent: #e3e9dd; --accent-hover: #ffffff; --on-accent: #202620;
    --accent-soft: #333a30; --accent-soft-2: #3c4537;
    --ok: #68d8af; --ok-soft: #223c30; --warn: #edba79; --warn-soft: #403322;
    --danger: #ff9393; --danger-hover: #dd6565; --danger-soft: #472b2b;
    --info: #8dcffa; --info-soft: #233845; --violet: #baa6f8; --violet-soft: #352e47;
    --slate-soft: #30362f;
    --shadow-1: 0 1px 2px #00000014; --shadow-2: 0 8px 24px #00000025;
  }
}

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
  .fx-top { padding: 8px 12px; }
  .fx-shell { padding: 16px 12px 48px; }
  .fx-pagehead h2 { font-size: 23px; }
  .fx-search .input { width: 100%; }
  .fx-search { flex-wrap: wrap; }
  .fx-toolbar { gap: 8px; }
  .fx-toolbar .fx-grow { display: none; }
  .fx-upload-head { align-items: flex-start; }
  .fx-upload-nav { gap: 6px; }
  .fx-dz-opts { gap: 14px; width: 100%; }
  .fx-dropzone { min-height: 380px; padding: 28px 16px; border-radius: 18px; }
  .fx-dz-title { font-size: 23px; }
  .fx-dz-main { font-size: 13px; }
  .fx-upload-icon { width: 60px; height: 60px; border-radius: 18px; margin-bottom: 16px; }
  .fx-overwrite-confirm { text-align: left; }
  .fx-uploadpanel { padding: 16px 14px; }
  .fx-namebtn, .fx-nametext { max-width: 180px; }
  .fx-task { grid-template-columns: minmax(0, 1fr) auto; }
  .fx-task-name { grid-column: 1; grid-row: 1; }
  .fx-task-mid { grid-column: 1 / -1; grid-row: 3; }
  .fx-task-state { grid-column: 1 / -1; grid-row: 2; }
  .fx-task-act { grid-column: 2; grid-row: 1; }
  .fx-dlg { max-width: calc(100vw - 12px); }
  .fx-share-row { flex-wrap: wrap; }
  .fx-gate-card { padding: 20px 16px 18px; }
  .fx-ws-wrap { width: 100%; }
  .fx-ws-grid { grid-template-columns: 1fr; }
  .home-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .fx-brand-sub, .fx-keyline { display: none; }
  .fx-crumb { max-width: 130px; }
}
