/* ============================================================
   秒传 sec_transfer — 设计系统
   浅色主题为主，CSS 变量驱动，支持深色模式自动适配
   ============================================================ */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f5;
  --border: #e3e6ea;
  --border-strong: #cbd2d9;
  --text: #1a1d21;
  --text-muted: #656d76;
  --text-faint: #8b949e;
  --accent: #1f6feb;
  --accent-hover: #1a5fd0;
  --accent-soft: #e8f0fe;
  --success: #1a7f37;
  --warning: #9a6700;
  --danger: #cf222e;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 8px 24px rgba(0, 0, 0, .06);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .06);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --surface: #161b22;
    --surface-2: #21262d;
    --border: #30363d;
    --border-strong: #484f58;
    --text: #e6edf3;
    --text-muted: #9198a1;
    --text-faint: #6e7681;
    --accent: #4493f8;
    --accent-hover: #58a6ff;
    --accent-soft: #121d2f;
    --success: #3fb950;
    --warning: #d29922;
    --danger: #f85149;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 布局 ---------- */

.app { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -.01em;
  white-space: nowrap;
}

.brand .logo {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  border-radius: 8px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}

.spacer { flex: 1; }

.main { flex: 1; width: 100%; max-width: 1160px; margin: 0 auto; padding: 24px; }

/* ---------- 组件 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, opacity .15s;
}

.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--text-faint); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-danger { color: var(--danger); border-color: var(--border-strong); }
.btn-danger:hover:not(:disabled) { background: var(--danger); border-color: var(--danger); color: #fff; }

.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }

.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-icon { padding: 6px 8px; min-width: 32px; }

.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 550; }
.field .hint { margin-top: 5px; font-size: 12px; color: var(--text-muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-pad { padding: 20px; }

/* ---------- 登录页 ---------- */

.auth-wrap {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card { width: 100%; max-width: 400px; padding: 32px; }

.auth-card .brand { justify-content: center; margin-bottom: 6px; font-size: 20px; }
.auth-sub { margin: 0 0 24px; color: var(--text-muted); text-align: center; font-size: 13.5px; }

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 22px;
  padding: 4px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

.auth-tab {
  padding: 7px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.auth-tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- 文件列表 ---------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.search { flex: 1; min-width: 200px; }

.quota {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 200px;
}

.quota-text {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.progress {
  height: 6px;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: 999px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #7c3aed);
  border-radius: 999px;
  transition: width .3s;
}

/* 存储容量等级：正常 / 接近上限 / 已满 */
.progress-bar.level-warning { background: linear-gradient(90deg, #d29922, #bf8700); }
.progress-bar.level-full { background: linear-gradient(90deg, #f85149, #cf222e); }

.badge.level-warning { background: rgba(210, 153, 34, .15); color: var(--warning); }
.badge.level-full { background: rgba(248, 81, 73, .15); color: var(--danger); }

.file-list { display: flex; flex-direction: column; gap: 2px; }

.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}

.file-row:hover { background: var(--surface); border-color: var(--border); }
.file-row.active { background: var(--accent-soft); border-color: var(--accent); }

.file-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 15px;
  background: var(--surface-2);
}

.file-icon.img { background: #dcfce7; color: #15803d; }
.file-icon.vid { background: #fef3c7; color: #b45309; }
.file-icon.aud { background: #fce7f3; color: #be185d; }
.file-icon.doc { background: #dbeafe; color: #1d4ed8; }
.file-icon.zip { background: #ede9fe; color: #6d28d9; }

@media (prefers-color-scheme: dark) {
  .file-icon.img { background: #052e16; color: #4ade80; }
  .file-icon.vid { background: #422006; color: #fbbf24; }
  .file-icon.aud { background: #500724; color: #f9a8d4; }
  .file-icon.doc { background: #172554; color: #93c5fd; }
  .file-icon.zip { background: #2e1065; color: #c4b5fd; }
}

.file-meta { flex: 1; min-width: 0; }

.file-name {
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-sub {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.star { color: var(--warning); }

.badge {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 550;
}

.empty {
  padding: 64px 20px;
  color: var(--text-muted);
  text-align: center;
}

.empty .icon { margin-bottom: 12px; font-size: 40px; opacity: .35; }

/* ---------- 拖拽上传区 ---------- */

.dropzone {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  place-items: center;
  background: rgba(31, 111, 235, .1);
  backdrop-filter: blur(3px);
  border: 3px dashed var(--accent);
  font-size: 20px;
  font-weight: 600;
  color: var(--accent);
}

.dropzone.active { display: grid; }

/* ---------- 上传任务 ---------- */

.upload-item { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.upload-item:last-child { border-bottom: none; }
.upload-head { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.upload-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.upload-pct { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.upload-state { font-size: 12px; }

.dedup-flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--success);
  font-size: 12px;
  font-weight: 550;
}

/* ---------- 弹窗 ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, .45);
}

.modal-backdrop.open { display: grid; }

.modal {
  width: 100%;
  max-width: 460px;
  max-height: 86vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-head h3 { margin: 0; font-size: 15.5px; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }

/* ---------- 提示 ---------- */

.toast-wrap {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  min-width: 240px;
  max-width: 380px;
  padding: 11px 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  animation: slide-in .22s ease-out;
  font-size: 13.5px;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warning); }

@keyframes slide-in {
  from { opacity: 0; transform: translateX(28px); }
  to { opacity: 1; transform: translateX(0); }
}

.row { display: flex; align-items: center; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.muted { color: var(--text-muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }

.share-link {
  display: flex;
  gap: 6px;
  padding: 8px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

.share-link input {
  flex: 1;
  padding: 4px 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 12px;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--text-muted); font-size: 12px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { padding: 14px; background: var(--surface-2); border-radius: var(--radius-sm); }
.stat .v { margin-bottom: 2px; font-size: 21px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat .k { font-size: 12px; color: var(--text-muted); }

.spinner {
  width: 15px; height: 15px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .main { padding: 16px; }
  .topbar { padding: 10px 16px; gap: 10px; }
  .file-sub { font-size: 11.5px; }
  .hide-sm { display: none; }
}
