/* SpaceMV 网盘门户公共样式 — 深色科技风，移动端自适应 */
:root {
  --bg: #0e1420; --panel: #161e2e; --panel2: #1c2740; --line: #2a3852;
  --fg: #e8eef8; --dim: #8ea0bf; --accent: #4c8dff; --accent2: #2f6ae0;
  --ok: #2fbf71; --warn: #e0a13c; --err: #e05c5c; --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg);
  font: 14px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif; }
a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel2); color: var(--fg); padding: 7px 14px; font-size: 14px; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent2); border-color: var(--accent2); }
button.primary:hover { background: var(--accent); }
button.danger { color: #ffb3b3; border-color: #6e2f2f; }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select { background: var(--panel2); border: 1px solid var(--line); color: var(--fg);
  border-radius: 8px; padding: 8px 10px; font-size: 14px; width: 100%; }
input:focus, select:focus { outline: none; border-color: var(--accent); }
.muted { color: var(--dim); }
.err-msg { color: var(--err); min-height: 20px; font-size: 13px; }
.ok-msg { color: var(--ok); min-height: 20px; font-size: 13px; }

/* ── 认证页 ── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth-card { width: 400px; max-width: 100%; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 28px; }
.auth-card h1 { margin: 0 0 4px; font-size: 20px; }
.tabs { display: flex; gap: 4px; margin: 16px 0; background: var(--panel2);
  border-radius: 10px; padding: 4px; }
.tabs button { flex: 1; border: none; background: transparent; padding: 8px; border-radius: 8px; }
.tabs button.active { background: var(--accent2); }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--dim); margin-bottom: 4px; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.row > button { flex: 0 0 auto; white-space: nowrap; }
.captcha-box { display: flex; gap: 8px; align-items: center; }
.captcha-box .svg-holder { width: 120px; height: 44px; border-radius: 8px; overflow: hidden;
  cursor: pointer; border: 1px solid var(--line); background: #f4f6fb; flex: 0 0 auto; }
.agree { display: flex; gap: 6px; align-items: flex-start; font-size: 12px; color: var(--dim); margin: 10px 0; }
.agree input { width: auto; margin-top: 3px; }

/* ── 文件管理器骨架 ── */
.layout { display: grid; grid-template-columns: 220px 1fr; grid-template-rows: 56px 1fr;
  height: 100vh; grid-template-areas: "top top" "side main"; }
.topbar { grid-area: top; display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar .logo { font-weight: 700; font-size: 16px; white-space: nowrap; }
.topbar .search { flex: 1; max-width: 420px; }
.quota { width: 180px; font-size: 12px; color: var(--dim); }
.quota .bar { height: 6px; background: var(--panel2); border-radius: 3px; overflow: hidden; }
.quota .bar i { display: block; height: 100%; background: var(--accent); }
.sidebar { grid-area: side; background: var(--panel); border-right: 1px solid var(--line);
  padding: 12px 8px; overflow-y: auto; }
.sidebar .nav-item { padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--dim); }
.sidebar .nav-item.active, .sidebar .nav-item:hover { background: var(--panel2); color: var(--fg); }
.sidebar .tree { margin-top: 12px; font-size: 13px; }
.sidebar .tree .node { padding: 3px 6px 3px 18px; cursor: pointer; border-radius: 6px; position: relative; }
.sidebar .tree .node:hover { background: var(--panel2); }
.sidebar .tree .node .tw { position: absolute; left: 4px; color: var(--dim); }
.main { grid-area: main; overflow-y: auto; padding: 14px 18px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; align-items: center; }
.crumbs { margin: 4px 0 10px; color: var(--dim); font-size: 13px; }
.crumbs a { cursor: pointer; }

/* 文件列表：网格/列表双视图 */
.files.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.files.grid .fitem { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 8px; text-align: center; cursor: pointer; user-select: none; }
.files.grid .fitem .ico { font-size: 34px; }
.files.grid .fitem .nm { word-break: break-all; font-size: 13px; margin-top: 6px; }
.files.list .fitem { display: grid; grid-template-columns: 28px 1fr 110px 150px; gap: 8px;
  padding: 8px 10px; border-bottom: 1px solid var(--line); align-items: center; cursor: pointer; }
.fitem.selected { outline: 2px solid var(--accent); background: var(--panel2); }
.fitem .sz, .fitem .mt { color: var(--dim); font-size: 12px; text-align: right; }

/* 右键菜单 */
.ctx-menu { position: fixed; z-index: 90; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 10px; padding: 4px; min-width: 140px; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.ctx-menu button { display: block; width: 100%; text-align: left; border: none;
  background: transparent; padding: 8px 10px; border-radius: 6px; }
.ctx-menu button:hover { background: var(--accent2); }

/* 传输列表 */
.transfers { position: fixed; right: 16px; bottom: 16px; width: 340px; max-width: 92vw;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; z-index: 80; }
.transfers .hd { padding: 8px 12px; border-bottom: 1px solid var(--line); display: flex;
  justify-content: space-between; cursor: pointer; }
.transfers .bd { max-height: 260px; overflow-y: auto; padding: 8px 12px; }
.titem { margin-bottom: 10px; font-size: 13px; }
.titem .pbar { height: 5px; background: var(--panel2); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.titem .pbar i { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.titem .badge { font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--panel2); color: var(--ok); }

/* 预览抽屉 */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 420px; max-width: 94vw;
  background: var(--panel); border-left: 1px solid var(--line); z-index: 85; padding: 16px;
  overflow-y: auto; box-shadow: -8px 0 24px rgba(0,0,0,.4); }
.drawer img { max-width: 100%; border-radius: 8px; }
.drawer pre { background: var(--panel2); padding: 10px; border-radius: 8px; overflow: auto; font-size: 12px; }

/* 模态 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 20px; width: 420px; max-width: 100%; max-height: 86vh; overflow-y: auto; }
.modal h3 { margin: 0 0 12px; font-size: 16px; }
.modal .ft { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.dir-pick { max-height: 240px; overflow-y: auto; border: 1px solid var(--line);
  border-radius: 8px; padding: 6px; }
.dir-pick .node { padding: 4px 8px; border-radius: 6px; cursor: pointer; }
.dir-pick .node:hover, .dir-pick .node.sel { background: var(--panel2); }

/* 拖拽上传遮罩 */
.drop-mask { position: fixed; inset: 0; z-index: 70; background: rgba(76,141,255,.12);
  border: 3px dashed var(--accent); display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--accent); pointer-events: none; }

.empty { text-align: center; color: var(--dim); padding: 60px 0; }
.menu-toggle { display: none; }

@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; grid-template-areas: "top" "main"; }
  .sidebar { position: fixed; z-index: 95; left: 0; top: 56px; bottom: 0; width: 220px;
    transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .menu-toggle { display: inline-block; }
  .quota { width: 110px; }
  .files.list .fitem { grid-template-columns: 28px 1fr 80px; }
  .files.list .fitem .mt { display: none; }
  .drawer { width: 100vw; }
}
