:root {
  --bg: #0b0d12;
  --surface: #12151c;
  --surface-2: #1a1e27;
  --border: #232938;
  --border-strong: #2f3646;
  --text: #e8eaef;
  --muted: #8a92a3;
  --accent: #5b8cff;
  --danger: #ff6b6b;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }

.logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font-size: 22px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo.small { width: 40px; height: 40px; border-radius: 11px; font-size: 18px; }

/* ===== 登录页 ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 44px 36px;
  text-align: center;
}
.login-card .logo { margin: 0 auto 20px; }
.login-card h1 { font-size: 20px; font-weight: 600; margin: 0 0 6px; }
.login-card .sub { color: var(--muted); font-size: 14px; margin: 0 0 28px; }

#login-form { display: flex; flex-direction: column; gap: 12px; }
input[type="password"] {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 15px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color .15s;
}
input[type="password"]:focus { border-color: var(--accent); }
input[type="password"]::placeholder { color: var(--muted); }

button, .btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 13px 16px;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: filter .15s;
}
button:hover, .btn:hover { filter: brightness(1.1); }

button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 7px 13px;
  font-size: 13px;
  border-radius: 8px;
}
button.ghost:hover { color: var(--text); border-color: var(--border-strong); }
button.danger:hover { color: var(--danger); border-color: var(--danger); }
button.ghost:disabled { opacity: 0.4; cursor: not-allowed; }
button.ghost:disabled:hover { color: var(--muted); border-color: var(--border); }

.error { color: var(--danger); font-size: 13px; min-height: 20px; margin: 14px 0 0; }
.hint { color: var(--muted); font-size: 12px; margin: 24px 0 0; }

/* ===== 网盘页 ===== */
.topbar {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 20px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-text h1 { font-size: 18px; font-weight: 600; margin: 0 0 5px; }
.clear-badge {
  display: inline-block;
  background: rgba(255, 107, 107, 0.12);
  color: #ff9d9d;
  border: 1px solid rgba(255, 107, 107, 0.28);
  border-radius: 6px;
  font-size: 12px;
  padding: 3px 9px;
}
.top-actions { display: flex; align-items: center; gap: 14px; }

.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 20px 60px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.sidebar {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 20px;
}
.storage-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.storage-title {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}
.storage-bar {
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}
.storage-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 4px;
  transition: width .2s ease;
}
.storage-text {
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
  white-space: nowrap;
}
.container { flex: 1; min-width: 0; }

.drop-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 48px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--accent); background: var(--surface); }
.dz-title { font-size: 15px; margin: 0 0 8px; }
.dz-sub { color: var(--muted); font-size: 13px; margin: 0; }

.upload-progress { margin-top: 16px; }
.upload-info { color: var(--muted); font-size: 13px; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress-bar {
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 3px;
  transition: width .2s ease;
}
.loading {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 40px 0;
}

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.bulk-bar .muted { margin: 0 4px; }

.file-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 20px;
}
.file-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  transition: border-color .15s;
}
.file-item:hover { border-color: var(--border-strong); }
.file-item.selected { border-color: var(--accent); }
.file-item-top {
  display: flex;
  align-items: center;
  gap: 13px;
}
.file-check {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent);
}
.thumb {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.icon { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .5px; }
.fname { flex: 1; min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fmeta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.factions { display: flex; gap: 6px; flex-shrink: 0; }

.empty { text-align: center; color: var(--muted); padding: 64px 0; font-size: 14px; }

/* ===== 预览弹窗 ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.72); }
.modal-body {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-head span { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#preview-content {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.preview-img { max-width: 100%; max-height: 60vh; border-radius: 8px; }
.preview-media { max-width: 100%; max-height: 60vh; }
.preview-pdf { width: 100%; height: 60vh; border: none; }
.preview-text {
  text-align: left;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 13px;
  color: var(--text);
  width: 100%;
  margin: 0;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}

.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.toast.success { border-color: var(--accent); color: var(--text); }
.toast.error { border-color: var(--danger); color: var(--danger); }

@media (max-width: 800px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; position: static; }
}
@media (max-width: 600px) {
  .file-list { grid-template-columns: 1fr; }
  .login-card { padding: 36px 24px; }
}
