:root {
  --bg: #0a0c11;
  --bg-soft: #0f131a;
  --panel: #151a23;
  --panel-2: #1a2029;
  --line: #252d3a;
  --line-soft: #1e2531;
  --text: #e9edf6;
  --muted: #8b95a7;
  --muted-2: #6b7688;
  --accent: #4c7dff;
  --accent-2: #7b5cff;
  --accent-soft: rgba(76, 125, 255, 0.14);
  --danger: #ff5c6c;
  --danger-soft: rgba(255, 92, 108, 0.12);
  --success: #35d29a;
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --radius: 14px;
  --radius-sm: 9px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(76, 125, 255, 0.12), transparent 60%),
    radial-gradient(700px 400px at -10% 110%, rgba(123, 92, 255, 0.10), transparent 60%),
    var(--bg);
}

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

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 登录 ---------- */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.login-glow {
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(76, 125, 255, 0.22), transparent 65%);
  top: -180px;
  right: -120px;
  filter: blur(10px);
  pointer-events: none;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: linear-gradient(180deg, rgba(26, 32, 41, 0.96), rgba(17, 21, 28, 0.96));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 38px 32px 28px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}
.brand-mark { display: flex; justify-content: center; margin-bottom: 16px; }
.login-card h1 {
  margin: 0;
  text-align: center;
  font-size: 26px;
  letter-spacing: 0.5px;
}
.login-sub {
  margin: 8px 0 28px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.4px;
}
.input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: var(--muted-2); }
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-error {
  margin: 14px 0 0;
  color: var(--danger);
  font-size: 13px;
  text-align: center;
}
.login-foot {
  margin: 26px 0 0;
  text-align: center;
  color: var(--muted-2);
  font-size: 11.5px;
  letter-spacing: 0.2px;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.08s, opacity 0.15s;
}
.btn:hover { background: #202734; border-color: #303a4a; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.42; cursor: not-allowed; transform: none; }
.btn.primary {
  background: linear-gradient(180deg, #5a88ff, #436fe8);
  border-color: #5a88ff;
  color: #fff;
  box-shadow: 0 6px 18px rgba(76, 125, 255, 0.22);
}
.btn.primary:hover { background: linear-gradient(180deg, #6a94ff, #4a76ee); }
.btn.danger { color: #ff8b96; border-color: rgba(255, 92, 108, 0.3); background: var(--danger-soft); }
.btn.danger:hover { background: rgba(255, 92, 108, 0.2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.btn.block { width: 100%; height: 44px; margin-top: 20px; font-size: 14px; }
.btn.small { height: 28px; padding: 0 9px; font-size: 12px; }
.btn-icon { width: 16px; height: 16px; }

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.danger:hover { background: var(--danger-soft); color: #ff8b96; }
.icon-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ---------- 顶栏 ---------- */
.drive-view { min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 24px;
  background: rgba(10, 12, 17, 0.78);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-dot {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 14px rgba(76, 125, 255, 0.35);
}
.brand-name { font-weight: 650; letter-spacing: 0.4px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.sync-hint { color: var(--muted-2); font-size: 12px; margin-right: 4px; }

/* ---------- 主体 ---------- */
.shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px 24px 140px;
}
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-bottom: 14px;
  font-size: 13.5px;
  min-height: 24px;
}
.crumb {
  border: none;
  background: none;
  padding: 3px 6px;
  border-radius: 6px;
  color: var(--muted);
}
.crumb:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.crumb.current { color: var(--text); font-weight: 600; }
.crumb-sep { color: var(--muted-2); padding: 0 1px; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-right .muted { font-size: 12.5px; margin-right: 4px; }

.content-panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-height: 380px;
  overflow: hidden;
}

/* ---------- 表格 ---------- */
.file-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.file-table thead th {
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.3px;
  color: var(--muted);
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
  user-select: none;
}
.file-table th.col-check { width: 44px; padding-right: 0; }
.file-table th.col-size { width: 110px; }
.file-table th.col-time { width: 170px; }
.file-table th.col-actions { width: 186px; text-align: right; padding-right: 18px; }
.file-table th.sortable { cursor: pointer; }
.file-table th.sortable:hover { color: var(--text); }
.sort-mark { display: inline-block; width: 10px; margin-left: 3px; color: var(--accent); font-size: 10px; }

.file-row { transition: background 0.12s; }
.file-row:hover { background: rgba(255, 255, 255, 0.03); }
.file-row.selected { background: var(--accent-soft); }
.file-row td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.file-row:last-child td { border-bottom: none; }
.file-row td.col-check { padding-right: 0; }
.cell-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.file-icon {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
}
.file-icon svg { width: 18px; height: 18px; }
.file-icon.folder { background: rgba(76, 125, 255, 0.12); }
.name-wrap { min-width: 0; }
.name-btn {
  display: block;
  max-width: 100%;
  border: none;
  background: none;
  padding: 0;
  text-align: left;
  color: var(--text);
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.name-btn:hover { color: #9db8ff; }
.name-meta { display: none; color: var(--muted-2); font-size: 11.5px; margin-top: 2px; }
.cell-size, .cell-time { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.cell-actions { text-align: right; white-space: nowrap; }
.cell-actions .icon-btn { width: 30px; height: 30px; }
.cell-actions .icon-btn svg { width: 16px; height: 16px; }

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  background: rgba(15, 19, 26, 0.9);
  z-index: 3;
  font-size: 13px;
}
.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty {
  padding: 64px 24px 72px;
  text-align: center;
}
.empty-art svg { width: 88px; height: 88px; opacity: 0.9; }
.empty h2 { margin: 18px 0 6px; font-size: 16px; font-weight: 600; }
.empty p { margin: 0; color: var(--muted); font-size: 13px; }

.load-more { padding: 14px; text-align: center; border-top: 1px solid var(--line-soft); }

/* ---------- 拖拽遮罩 ---------- */
.drop-overlay {
  position: absolute;
  inset: 8px;
  border: 1.5px dashed rgba(76, 125, 255, 0.7);
  border-radius: 12px;
  background: rgba(76, 125, 255, 0.08);
  display: none;
  align-items: center;
  justify-content: center;
  color: #b9ccff;
  font-size: 15px;
  z-index: 5;
  pointer-events: none;
  backdrop-filter: blur(2px);
}
.content-panel.dragging .drop-overlay { display: flex; }

/* ---------- 上传面板 ---------- */
.upload-panel {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: min(420px, calc(100vw - 32px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 30;
  overflow: hidden;
}
.upload-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}
.upload-head strong { font-size: 13px; }
.upload-head .muted { font-size: 12px; margin-right: auto; }
.upload-list { max-height: 260px; overflow-y: auto; }
.upload-list:empty { display: none; }
.upload-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.upload-item:last-child { border-bottom: none; }
.upload-name {
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-meta { font-size: 11.5px; color: var(--muted-2); text-align: right; font-variant-numeric: tabular-nums; }
.upload-bar {
  grid-column: 1 / -1;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}
.upload-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 3px;
  transition: width 0.2s ease;
}
.upload-item.failed .upload-bar span { background: var(--danger); }
.upload-item.done .upload-bar span { background: var(--success); }
.upload-retry {
  border: none;
  background: none;
  color: #9db8ff;
  font-size: 11.5px;
  padding: 0 0 0 6px;
}

/* ---------- 弹窗 ---------- */
.modal-root { 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(4, 6, 10, 0.7); backdrop-filter: blur(3px); }
.modal {
  position: relative;
  width: min(440px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  animation: modal-in 0.18s ease-out;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.modal h2 { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.modal-body { color: var(--muted); font-size: 13px; line-height: 1.6; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.modal-note { margin-top: 14px; font-size: 12px; color: var(--muted-2); }

.share-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  color: var(--text);
}
.share-file svg { width: 18px; height: 18px; opacity: 0.7; flex: none; }
.share-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.share-section { margin-top: 16px; }
.share-expiry { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.expiry-option {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  height: 38px;
  color: var(--muted);
  font-size: 12.5px;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.expiry-option:hover { border-color: #37445a; color: var(--text); }
.expiry-option.active { border-color: var(--accent); background: var(--accent-soft); color: #b9ccff; }
.share-result { margin-top: 16px; }
.share-link-row { display: flex; gap: 8px; }
.share-link {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: #b9ccff;
  font-size: 12px;
}
.share-link:focus { outline: none; border-color: var(--accent); }

.rename-input { width: 100%; margin-top: 14px; }
.confirm-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}
.confirm-list li {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.confirm-list li:last-child { border-bottom: none; }
.danger-text { color: #ff8b96; }

/* ---------- Toast ---------- */
.toast-root {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: #1c2430;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  font-size: 13px;
  max-width: min(560px, calc(100vw - 40px));
  animation: toast-in 0.18s ease-out;
}
.toast.error { border-color: rgba(255, 92, 108, 0.4); color: #ffb3ba; }
.toast.success { border-color: rgba(53, 210, 154, 0.35); color: #9cf0ce; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 820px) {
  .topbar { padding: 0 16px; }
  .shell { padding: 18px 16px 150px; }
  .file-table th.col-time, .file-table .cell-time { display: none; }
  .file-table th.col-actions { width: 150px; }
  .cell-actions .icon-btn { width: 28px; height: 28px; }
  .toolbar-right .muted { display: none; }
}

@media (max-width: 620px) {
  .file-table thead { display: none; }
  .file-table, .file-table tbody { display: block; }
  .file-row {
    display: grid;
    grid-template-columns: 30px 1fr auto;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line-soft);
  }
  .file-row td { padding: 0; border: none; }
  .file-row td.col-check { padding-right: 8px; }
  .file-row td.col-size { display: none; }
  .file-row td.col-actions { width: auto; padding-left: 6px; }
  .cell-actions .icon-btn.hide-mobile { display: none; }
  .name-meta { display: block; }
  .cell-time { display: none; }
  .content-panel { min-height: 300px; }
  .toolbar-left, .toolbar-right { width: 100%; }
  .toolbar-left .btn { flex: 1; }
  .toolbar-right { justify-content: flex-end; }
  .upload-panel { right: 12px; bottom: 12px; width: calc(100vw - 24px); }
  .share-expiry { grid-template-columns: repeat(2, 1fr); }
  .modal { padding: 20px; }
  .login-card { padding: 30px 22px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
