:root {
  --text: #1a1a1a;
  --bg: #ffffff;
  --line: #d2d2d2;
  --muted: #707070;
  --soft: #f5f5f5;
  --btn: #111111;
  --danger: #c0392b;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --text: #e6e6e6;
    --bg: #1a1a1a;
    --line: #3a3a3a;
    --muted: #9a9a9a;
    --soft: #262626;
    --btn: #e6e6e6;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

button { font: inherit; cursor: pointer; }
ul { list-style: none; margin: 0; padding: 0; }

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
}

.hidden { display: none !important; }

/* ---------- 登录 ---------- */
.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card { width: 100%; max-width: 360px; }
.login-card .input { font-size: 16px; }

.err {
  color: var(--danger);
  font-size: 13px;
  min-height: 20px;
  margin-top: 10px;
}

/* ---------- 输入 ---------- */
.input {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 11px 12px;
  font: inherit;
  font-size: 16px;
  outline: none;
  appearance: none;
}
.input:focus { border-color: var(--text); }
.input::placeholder { color: var(--muted); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--btn);
  color: var(--bg);
  border: 1px solid var(--btn);
  border-radius: 0;
  padding: 9px 20px;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--text); }
.btn.sm { padding: 5px 12px; font-size: 13px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  min-width: 0;
}
.brand svg { width: 22px; height: 22px; flex: none; }
.brand span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 工具条 ---------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 0;
  flex-wrap: wrap;
}
.toolbar-right { min-width: 220px; flex: 1; max-width: 320px; }
.cap { color: var(--muted); font-size: 13px; }
.cap b { color: var(--text); font-weight: 600; }

.meter {
  height: 4px;
  background: var(--soft);
  border: 1px solid var(--line);
  margin-top: 14px;
}
.meter > i { display: block; height: 100%; width: 0; background: var(--muted); }

/* ---------- 表格 ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.table th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  vertical-align: middle;
}
.table th:last-child { text-align: right; padding-right: 0; }
.table td:last-child { padding-right: 0; }

.c-name { width: 44%; }
.c-size { width: 14%; }
.c-time { width: 20%; }
.c-act { width: 22%; }

.fname {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.fname svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.fname span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.muted { color: var(--muted); }

.row-actions { text-align: right; white-space: nowrap; }
.row-actions .btn { padding: 8px 16px; font-size: 13px; }
.row-actions .btn + .btn { margin-left: 14px; }

/* ---------- 上传中 ---------- */
.uploading .bar {
  height: 3px;
  background: var(--soft);
  border: 1px solid var(--line);
  margin-top: 6px;
}
.uploading .bar > i { display: block; height: 100%; width: 0; background: var(--text); }
.uploading .pct { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- 空状态 ---------- */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 70px 0;
  border: 1px dashed var(--line);
  margin: 8px 0 40px;
}
.empty svg { width: 34px; height: 34px; margin-bottom: 12px; }

.spacer { height: 48px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  background: var(--btn);
  color: var(--bg);
  padding: 10px 20px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  max-width: calc(100vw - 48px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  z-index: 20;
}
.toast.show { opacity: 1; }

@media (max-width: 560px) {
  .c-time { display: none; }
  .c-name { width: 48%; }
  .c-size { width: 18%; }
  .c-act { width: 34%; }
  .row-actions .btn { padding: 8px 12px; }
  .row-actions .btn + .btn { margin-left: 10px; }
  .toolbar-right { max-width: none; min-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}
