/* 云盘 · 界面样式
   设计目标：安静、清晰、可信。信息密度接近专业文件管理器，但视觉克制。 */

:root {
  --bg: #f5f6f8;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-3: #e9edf3;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #141a21;
  --text-2: #475467;
  --muted: #7a8494;
  --accent: #2a5fe0;
  --accent-hover: #1d4fca;
  --accent-soft: #e8efff;
  --accent-contrast: #ffffff;
  --danger: #cf3327;
  --danger-soft: #fdecea;
  --warn: #a15c07;
  --ok: #0d7f56;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(16, 24, 40, 0.08), 0 2px 4px -2px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 24px 48px -12px rgba(16, 24, 40, 0.18);
  --radius: 12px;
  --radius-sm: 8px;
  --row-h: 52px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

:root[data-theme="dark"] {
  --bg: #0e1116;
  --bg-elevated: #141920;
  --surface: #161b22;
  --surface-2: #1b212a;
  --surface-3: #232b36;
  --border: #262e39;
  --border-strong: #333d4a;
  --text: #e8ecf2;
  --text-2: #b3bdcb;
  --muted: #8590a0;
  --accent: #5b8cff;
  --accent-hover: #7aa2ff;
  --accent-soft: #17233f;
  --accent-contrast: #0b1020;
  --danger: #ff6f61;
  --danger-soft: #2a1512;
  --warn: #f3b34c;
  --ok: #3ddc9a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 16px -4px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 28px 56px -16px rgba(0, 0, 0, 0.65);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[hidden] {
  display: none !important;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  display: block;
  color: inherit;
}

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

button {
  cursor: pointer;
}

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

::selection {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  font-weight: 550;
  font-size: 13.5px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.btn:active {
  transform: translateY(0.5px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: var(--shadow-sm);
}

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

.btn-ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

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

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-block {
  width: 100%;
  justify-content: center;
  height: 42px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  transition: background 120ms ease, color 120ms ease;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.icon-btn[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.text-btn {
  border: 0;
  background: none;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 550;
}

.text-btn:hover {
  background: var(--accent-soft);
}

.text-btn.danger {
  color: var(--danger);
}

.text-btn.danger:hover {
  background: var(--danger-soft);
}

.icon-sun,
.icon-moon {
  width: 18px;
  height: 18px;
}

:root[data-theme="dark"] .icon-sun,
:root:not([data-theme="dark"]) .icon-moon {
  display: none;
}

/* ---------- 登录 ---------- */
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%),
    var(--bg);
}

.login-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 34px 30px 26px;
  box-shadow: var(--shadow-md);
}

.login-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--accent);
  color: var(--accent-contrast);
  margin-bottom: 18px;
}

.login-mark .icon {
  width: 26px;
  height: 26px;
}

.login h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.01em;
}

.login-sub {
  margin: 6px 0 22px;
  color: var(--muted);
  font-size: 13.5px;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}

.field-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.field-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
  background: var(--surface);
}

.field-wrap input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 11px 12px;
  outline: none;
}

.field-action {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
  padding: 0 12px;
  height: 100%;
}

.login-error {
  margin: 0 0 12px;
  padding: 9px 12px;
  border-radius: 9px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
}

.login-error.shake {
  animation: shake 320ms ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}

.login-foot {
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* ---------- 主框架 ---------- */
.shell {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  height: 100dvh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 14px 14px;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  min-height: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 14px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-contrast);
}

.brand-mark .icon {
  width: 19px;
  height: 19px;
}

.brand-name {
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 550;
  text-align: left;
  transition: background 120ms ease, color 120ms ease;
}

.nav-item .icon {
  width: 18px;
  height: 18px;
  opacity: 0.85;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11.5px;
  text-align: center;
}

.quota {
  margin-top: auto;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.quota-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-2);
  font-weight: 600;
  margin-bottom: 8px;
}

.quota-percent {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.quota-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.quota-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width 400ms cubic-bezier(0.22, 1, 0.36, 1), background 200ms ease;
}

.quota.is-warn .quota-bar span {
  background: var(--warn);
}

.quota.is-full .quota-bar span {
  background: var(--danger);
}

.quota-text {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}

.quota-free {
  margin-top: 8px;
  border: 0;
  background: none;
  padding: 0;
  color: var(--danger);
  font-size: 11.5px;
  font-weight: 600;
  text-align: left;
}

.quota-free:hover {
  text-decoration: underline;
}

.sidebar-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 4px 0;
}

/* ---------- 顶栏 ---------- */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 62px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elevated) 85%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  font-size: 13.5px;
}

.breadcrumb::-webkit-scrollbar {
  display: none;
}

.crumb {
  border: 0;
  background: none;
  padding: 5px 7px;
  border-radius: 7px;
  color: var(--text-2);
  white-space: nowrap;
  font-weight: 550;
}

.crumb:hover {
  background: var(--surface-2);
  color: var(--text);
}

.crumb.is-current {
  color: var(--text);
}

.crumb-sep {
  color: var(--muted);
  display: grid;
  place-items: center;
  opacity: 0.6;
}

.crumb-sep .icon {
  width: 14px;
  height: 14px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  min-width: 200px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}

.search .icon {
  width: 16px;
  height: 16px;
}

.search input {
  border: 0;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 13px;
}

.search input::-webkit-search-cancel-button {
  appearance: none;
}

.search kbd {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0 5px;
  line-height: 17px;
}

.icon-group {
  display: flex;
  padding: 2px;
  gap: 2px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.icon-group .icon-btn {
  width: 30px;
  height: 28px;
}

.icon-group .icon-btn .icon {
  width: 17px;
  height: 17px;
}

/* ---------- 横幅 ---------- */
.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 20px 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  border: 1px solid color-mix(in srgb, var(--danger) 22%, transparent);
}

.banner .icon {
  width: 17px;
  height: 17px;
}

.banner-action {
  margin-left: auto;
  border: 1px solid currentColor;
  background: none;
  color: inherit;
  border-radius: 7px;
  padding: 3px 10px;
  font-size: 12.5px;
  font-weight: 600;
}

/* ---------- 内容区 ---------- */
.content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px 20px 40px;
  scroll-behavior: smooth;
}

.list-toolbar {
  display: flex;
  align-items: center;
  min-height: 40px;
  gap: 12px;
}

.selection-info {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-2);
  font-weight: 550;
}

.selection-info span {
  margin-right: 6px;
}

.sort-info {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

.table-wrap {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 40px;
  padding: 0 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table th.col-check {
  width: 44px;
  padding-left: 14px;
}

.table th.col-size {
  width: 110px;
}

.table th.col-date {
  width: 168px;
}

.table th.col-actions {
  width: 96px;
}

.th-inner {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.sortable {
  cursor: pointer;
  user-select: none;
}

.sortable:hover {
  color: var(--text-2);
}

.sort-arrow {
  width: 0;
  height: 0;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-bottom: 4.5px solid currentColor;
  opacity: 0;
  transition: transform 140ms ease, opacity 140ms ease;
}

.sortable[data-dir="1"] .sort-arrow {
  opacity: 1;
}

.sortable[data-dir="-1"] .sort-arrow {
  opacity: 1;
  transform: rotate(180deg);
}

.table tbody tr {
  height: var(--row-h);
  cursor: default;
  transition: background 90ms ease;
}

.table tbody tr:hover {
  background: var(--surface-2);
}

.table tbody tr.is-selected {
  background: var(--accent-soft);
}

.table td {
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table td.col-check {
  padding-left: 14px;
}

.cell-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cell-name .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--surface-2);
  color: var(--text-2);
}

.file-icon .icon {
  width: 18px;
  height: 18px;
}

.file-icon.is-folder {
  background: color-mix(in srgb, #f3b34c 16%, var(--surface-2));
  color: #b4730f;
}

.file-icon.is-image {
  background: color-mix(in srgb, #4eb389 15%, var(--surface-2));
  color: #167a56;
}

.file-icon.is-video {
  background: color-mix(in srgb, #6a7cf5 15%, var(--surface-2));
  color: #4a5bd4;
}

.file-icon.is-audio {
  background: color-mix(in srgb, #d06bd0 15%, var(--surface-2));
  color: #a544a5;
}

.file-icon.is-archive {
  background: color-mix(in srgb, #8a94a6 16%, var(--surface-2));
  color: #5c6577;
}

:root[data-theme="dark"] .file-icon.is-folder { color: #f3c46a; }
:root[data-theme="dark"] .file-icon.is-image { color: #6fd6ac; }
:root[data-theme="dark"] .file-icon.is-video { color: #9aa8ff; }
:root[data-theme="dark"] .file-icon.is-audio { color: #e59be5; }

.cell-size,
.cell-date {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 12.8px;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  opacity: 0;
  transition: opacity 100ms ease;
}

tr:hover .row-actions,
tr.is-selected .row-actions,
.row-actions:focus-within {
  opacity: 1;
}

.row-actions .icon-btn {
  width: 28px;
  height: 28px;
}

.row-actions .icon-btn .icon {
  width: 16px;
  height: 16px;
}

@media (hover: none) {
  .row-actions {
    opacity: 1;
  }
}

/* 复选框 */
input[type="checkbox"] {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 5px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 100ms ease, border-color 100ms ease;
  flex: none;
}

input[type="checkbox"]:hover {
  border-color: var(--accent);
}

input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

input[type="checkbox"]:checked::after {
  content: "";
  width: 8px;
  height: 4.5px;
  border-left: 2px solid var(--accent-contrast);
  border-bottom: 2px solid var(--accent-contrast);
  transform: rotate(-45deg) translate(0.5px, -1px);
}

/* 网格视图 */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 10px;
  padding: 4px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 12px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: default;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.card.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.card-icon {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--text-2);
  overflow: hidden;
}

.card-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-icon.is-folder { background: color-mix(in srgb, #f3b34c 14%, var(--surface-2)); color: #b4730f; }
.card-icon.is-image { background: color-mix(in srgb, #4eb389 13%, var(--surface-2)); color: #167a56; }
.card-icon.is-video { background: color-mix(in srgb, #6a7cf5 13%, var(--surface-2)); color: #4a5bd4; }
.card-icon.is-audio { background: color-mix(in srgb, #d06bd0 13%, var(--surface-2)); color: #a544a5; }

:root[data-theme="dark"] .card-icon.is-folder { color: #f3c46a; }
:root[data-theme="dark"] .card-icon.is-image { color: #6fd6ac; }
:root[data-theme="dark"] .card-icon.is-video { color: #9aa8ff; }
:root[data-theme="dark"] .card-icon.is-audio { color: #e59be5; }

.card-icon .icon {
  width: 34px;
  height: 34px;
}

.card-name {
  font-size: 13px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-all;
  line-height: 1.35;
}

.card-meta {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.card-check {
  position: absolute;
  top: 10px;
  left: 10px;
  opacity: 0;
}

.card:hover .card-check,
.card.is-selected .card-check {
  opacity: 1;
}

.card-more {
  position: absolute;
  top: 6px;
  right: 6px;
  opacity: 0;
}

.card:hover .card-more {
  opacity: 1;
}

/* 空状态 / 加载 */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 72px 24px;
  text-align: center;
}

.empty-art {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--surface-2);
  color: var(--muted);
  margin-bottom: 6px;
}

.empty-art .icon {
  width: 30px;
  height: 30px;
}

.empty-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.empty-text {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  max-width: 380px;
  line-height: 1.6;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 0;
  color: var(--muted);
  font-size: 13px;
}

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

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

.load-more {
  display: flex;
  justify-content: center;
  padding: 16px 0 4px;
}

.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 30px;
  padding: 0 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  flex: none;
}

/* ---------- 拖拽遮罩 ---------- */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.drop-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px 56px;
  border-radius: 18px;
  border: 2px dashed var(--accent);
  color: var(--accent);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
}

.drop-inner .icon {
  width: 34px;
  height: 34px;
}

/* ---------- 上传队列 ---------- */
.uploads {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: min(380px, calc(100vw - 32px));
  z-index: 50;
  border-radius: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: rise 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes rise {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.uploads-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 10px 14px;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.uploads-head .icon-btn {
  width: 26px;
  height: 26px;
}

.uploads-head .icon-btn .icon {
  width: 15px;
  height: 15px;
  transform: rotate(90deg);
  transition: transform 160ms ease;
}

.uploads.is-collapsed .uploads-head .icon-btn .icon {
  transform: rotate(-90deg);
}

.uploads.is-collapsed .upload-list,
.uploads.is-collapsed .uploads-foot {
  display: none;
}

.upload-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: 280px;
  overflow: auto;
}

.upload-item {
  padding: 8px 10px;
  border-radius: 9px;
}

.upload-item:hover {
  background: var(--surface-2);
}

.upload-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
}

.upload-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-status {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.upload-status.is-error {
  color: var(--danger);
}

.upload-status.is-done {
  color: var(--ok);
}

.upload-bar {
  margin-top: 6px;
  height: 4px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.upload-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: inherit;
  transition: width 180ms ease;
}

.upload-item.is-error .upload-bar span {
  background: var(--danger);
}

.upload-item.is-done .upload-bar span {
  background: var(--ok);
}

.uploads-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- 弹层 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(10, 14, 20, 0.45);
  backdrop-filter: blur(3px);
  animation: fade 140ms ease;
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  width: min(440px, 100%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 22px;
  animation: pop 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes pop {
  from { transform: scale(0.97) translateY(6px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 650;
}

.modal-text {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}

.modal-text strong {
  color: var(--text);
  font-weight: 600;
}

.modal input[type="text"],
.modal select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  outline: none;
}

.modal input[type="text"]:focus,
.modal select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
  background: var(--surface);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* 预览 */
.overlay.is-preview {
  padding: 0;
  background: rgba(8, 11, 16, 0.82);
  place-items: stretch;
}

.preview {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
  height: 100%;
}

.preview-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #eef2f7;
  background: rgba(12, 16, 22, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.preview-title {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.preview-title b {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-title span {
  font-size: 11.5px;
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
}

.preview-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.preview-actions .icon-btn {
  color: #dbe2ec;
  background: rgba(255, 255, 255, 0.06);
}

.preview-actions .icon-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.preview-body {
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow: auto;
}

.preview-body img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.preview-body video {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  background: #000;
}

.preview-body audio {
  width: min(520px, 100%);
}

.preview-body iframe {
  width: min(1000px, 100%);
  height: 100%;
  border: 0;
  border-radius: 10px;
  background: #fff;
}

.preview-body pre {
  width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 18px 20px;
  border-radius: 12px;
  background: rgba(14, 18, 25, 0.92);
  color: #dfe6ef;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.preview-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: #dbe2ec;
  text-align: center;
  padding: 40px;
}

/* ---------- 右键菜单 ---------- */
.menu {
  position: fixed;
  z-index: 90;
  min-width: 172px;
  padding: 5px;
  border-radius: 11px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: pop 120ms ease;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--text);
  font-size: 13px;
  text-align: left;
}

.menu-item .icon {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.menu-item:hover {
  background: var(--surface-2);
}

.menu-item.is-danger {
  color: var(--danger);
}

.menu-item.is-danger .icon {
  color: var(--danger);
}

.menu-sep {
  height: 1px;
  margin: 4px 6px;
  background: var(--border);
}

/* ---------- Toast ---------- */
.toasts {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 15px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in 200ms cubic-bezier(0.22, 1, 0.36, 1);
  max-width: min(560px, calc(100vw - 40px));
}

.toast.is-error {
  background: var(--danger);
  color: #fff;
}

.toast .icon {
  width: 16px;
  height: 16px;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* ---------- 响应式 ---------- */
.only-mobile {
  display: none;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 258px;
    z-index: 80;
    transform: translateX(-100%);
    transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: var(--shadow-lg);
  }

  .shell.nav-open .sidebar {
    transform: none;
  }

  .shell.nav-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 75;
    background: rgba(8, 11, 16, 0.4);
  }

  .only-mobile {
    display: inline-flex;
  }

  .only-desktop {
    display: none;
  }

  .search {
    min-width: 0;
    flex: 1;
  }

  .search kbd {
    display: none;
  }

  .topbar {
    gap: 8px;
    padding: 0 12px;
  }

  .content {
    padding: 8px 12px 40px;
  }

  .table th.col-date,
  .table td.col-date {
    display: none;
  }

  .table th.col-size {
    width: 82px;
  }

  .table th.col-actions {
    width: 44px;
  }

  .row-actions .icon-btn:not(:last-child) {
    display: none;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  }
}

@media (max-width: 560px) {
  .topbar-actions .btn span {
    display: none;
  }

  .btn-primary {
    padding: 0 12px;
  }

  .login-card {
    padding: 26px 20px 20px;
  }

  .uploads {
    right: 8px;
    left: 8px;
    bottom: 8px;
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
