html[data-theme="light"] {
  color-scheme: light;
}

[v-cloak] {
  display: none !important;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --primary-color: #9aa9ff;
  --primary-light: #b5bdf8;
  --primary-dark: #768cff;
  --primary: #9aa9ff;
  --accent-color: #8d9dd8;
  --accent: #8d9dd8;
  --bg-gradient: linear-gradient(140deg, #111a2d 0%, #0b1120 55%, #070b16 100%);
  --bg: var(--bg-gradient);
  --card-bg: rgba(15, 23, 39, 0.9);
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 14px 32px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] body {
  background: var(--bg-gradient) !important;
  color: #e8eeff !important;
}

html[data-theme="dark"] #app,
html[data-theme="dark"] .container,
html[data-theme="dark"] .main-container {
  color: #e8eeff;
}

html[data-theme="dark"] .header,
html[data-theme="dark"] .header-content,
html[data-theme="dark"] .card,
html[data-theme="dark"] .login-card,
html[data-theme="dark"] .preview-card,
html[data-theme="dark"] .el-dialog,
html[data-theme="dark"] .el-dialog__body,
html[data-theme="dark"] .el-dialog__header,
html[data-theme="dark"] .el-dialog__footer,
html[data-theme="dark"] .el-message,
html[data-theme="dark"] .el-message-box,
html[data-theme="dark"] .el-message-box__content,
html[data-theme="dark"] .el-message-box__header,
html[data-theme="dark"] .el-message-box__btns,
html[data-theme="dark"] .el-card:not(.video-card):not(.audio-card):not(.file-card),
html[data-theme="dark"] .image-card,
html[data-theme="dark"] .storage-btn,
html[data-theme="dark"] .method-btn,
html[data-theme="dark"] .format-tab,
html[data-theme="dark"] .upload-item,
html[data-theme="dark"] .result-item,
html[data-theme="dark"] .history-item,
html[data-theme="dark"] .stats,
html[data-theme="dark"] .toast,
html[data-theme="dark"] .search-card .el-input__inner,
html[data-theme="dark"] .el-input__inner,
html[data-theme="dark"] .url-input-container input,
html[data-theme="dark"] .batch-links {
  background: rgba(15, 23, 39, 0.9) !important;
  color: #e8eeff !important;
  border-color: rgba(130, 152, 196, 0.35) !important;
}

html[data-theme="dark"] .storage-switcher,
html[data-theme="dark"] .stats-bar,
html[data-theme="dark"] .guest-notice {
  background: linear-gradient(
    135deg,
    rgba(20, 29, 49, 0.9) 0%,
    rgba(25, 35, 58, 0.85) 100%
  ) !important;
  border-color: rgba(130, 152, 196, 0.35) !important;
}

html[data-theme="dark"] .header-title,
html[data-theme="dark"] .title,
html[data-theme="dark"] .card-title,
html[data-theme="dark"] .file-name,
html[data-theme="dark"] .file-title,
html[data-theme="dark"] .video-title,
html[data-theme="dark"] .audio-title,
html[data-theme="dark"] .result-item-name,
html[data-theme="dark"] .upload-item-name,
html[data-theme="dark"] .image-card-name,
html[data-theme="dark"] .preview-filename,
html[data-theme="dark"] .el-dropdown-link,
html[data-theme="dark"] .el-dialog__title {
  color: #e8eeff !important;
}

html[data-theme="dark"] .upload-hint,
html[data-theme="dark"] .subtitle,
html[data-theme="dark"] .file-size,
html[data-theme="dark"] .result-item-link,
html[data-theme="dark"] .upload-item-size,
html[data-theme="dark"] .stat-item,
html[data-theme="dark"] .footer,
html[data-theme="dark"] .footer a,
html[data-theme="dark"] .el-form-item__label,
html[data-theme="dark"] .el-dialog__body,
html[data-theme="dark"] .el-message-box__message p {
  color: #c4cde3 !important;
}

html[data-theme="dark"] a {
  color: #c4d4ff;
}

html[data-theme="dark"] .upload-zone,
html[data-theme="dark"] .container,
html[data-theme="dark"] .image-card,
html[data-theme="dark"] .el-main,
html[data-theme="dark"] .el-header {
  border-color: rgba(130, 152, 196, 0.35) !important;
}

html[data-theme="dark"] .el-button:not(.el-button--primary):not(.el-button--danger) {
  background: rgba(33, 45, 72, 0.85) !important;
  color: #e8eeff !important;
  border-color: rgba(130, 152, 196, 0.4) !important;
}

html[data-theme="dark"] .el-button--primary {
  background: linear-gradient(135deg, #6f84ff 0%, #8ea4ff 100%) !important;
  border-color: transparent !important;
}

html[data-theme="dark"] .el-button--danger {
  background: linear-gradient(135deg, #d0617d 0%, #eb839f 100%) !important;
  border-color: transparent !important;
}

html[data-theme="dark"] .preview-modal .preview-btn-default {
  background: rgba(255, 255, 255, 0.2) !important;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: #90a0bf !important;
}

.theme-floating-toggle {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 11px;
  border: 1.5px solid rgba(138, 75, 255, 0.25);
  background: linear-gradient(
    135deg,
    rgba(138, 75, 255, 0.16),
    rgba(200, 241, 255, 0.42)
  );
  color: #2f3243;
  font-size: 0.88em;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-floating-toggle i {
  color: #8a4bff;
  width: 14px;
  text-align: center;
}

.theme-floating-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(138, 75, 255, 0.2);
}

.theme-auto-inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border-radius: 10px;
  border: 1.5px solid rgba(138, 75, 255, 0.25);
  background: linear-gradient(
    135deg,
    rgba(138, 75, 255, 0.16),
    rgba(200, 241, 255, 0.42)
  );
  color: #2f3243;
  font-size: 0.86em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-auto-inline-toggle i {
  color: #8a4bff;
  width: 14px;
  text-align: center;
}

.theme-auto-inline-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(138, 75, 255, 0.2);
}

.theme-admin-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1.5px solid rgba(138, 75, 255, 0.25);
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    rgba(138, 75, 255, 0.16),
    rgba(200, 241, 255, 0.42)
  );
  color: #2f3243;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-right: 8px;
}

.theme-admin-toggle [data-theme-label] {
  display: none;
}

.theme-admin-toggle i {
  color: #8a4bff;
  font-size: 14px;
}

.theme-admin-toggle:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 20px rgba(138, 75, 255, 0.2);
}

html[data-theme="dark"] .theme-floating-toggle {
  border-color: rgba(154, 169, 255, 0.45);
  background: linear-gradient(
    135deg,
    rgba(154, 169, 255, 0.2),
    rgba(84, 106, 156, 0.35)
  );
  color: #e8eeff;
}

html[data-theme="dark"] .theme-floating-toggle i {
  color: #c4d4ff;
}

html[data-theme="dark"] .theme-auto-inline-toggle,
html[data-theme="dark"] .theme-admin-toggle {
  border-color: rgba(154, 169, 255, 0.45);
  background: linear-gradient(
    135deg,
    rgba(154, 169, 255, 0.2),
    rgba(84, 106, 156, 0.35)
  );
  color: #e8eeff;
}

html[data-theme="dark"] .theme-auto-inline-toggle i,
html[data-theme="dark"] .theme-admin-toggle i {
  color: #c4d4ff;
}

@media (max-width: 768px) {
  .theme-floating-toggle {
    top: 12px;
    right: 12px;
    padding: 8px 12px;
    font-size: 0.82em;
  }
}

/* ===== Unified Background + Glass Layer ===== */
:root {
  --ui-page-bg: #fafaf8;
  --ui-page-bg-dark: #101318;
  --ui-surface-rgb: 255, 255, 255;
  --ui-surface-rgb-dark: 19, 24, 33;
  --ui-border-rgb: 198, 206, 218;
  --ui-border-rgb-dark: 92, 105, 126;
  --ui-card-opacity: 0.86;
  --ui-card-blur: 14px;
  --ui-noise-opacity: 0;
  --ui-shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.09);
  --ui-shadow-soft-dark: 0 14px 32px rgba(0, 0, 0, 0.34);
}

html[data-theme="dark"] {
  --ui-surface-rgb: var(--ui-surface-rgb-dark);
  --ui-border-rgb: var(--ui-border-rgb-dark);
  --shadow: var(--ui-shadow-soft-dark);
  --shadow-hover: 0 18px 36px rgba(0, 0, 0, 0.42);
}

html,
body {
  min-height: 100%;
}

body {
  min-height: 100dvh;
  position: relative;
  isolation: isolate;
  background: var(--ui-page-bg) !important;
  background-color: var(--ui-page-bg) !important;
  background-image: none !important;
}

body::before {
  content: none !important;
  background: none !important;
}

html[data-theme="dark"] body {
  background: var(--ui-page-bg-dark) !important;
  background-color: var(--ui-page-bg-dark) !important;
  background-image: none !important;
}

.ui-bg-image-layer,
.ui-bg-canvas-layer,
.ui-bg-noise-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.ui-bg-image-layer {
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.ui-bg-canvas-layer {
  z-index: 1;
  width: 100vw;
  height: 100dvh;
}

.ui-bg-noise-layer {
  z-index: 2;
  opacity: var(--ui-noise-opacity);
  background-image:
    radial-gradient(rgba(17, 24, 39, 0.11) 0.4px, transparent 0.5px),
    radial-gradient(rgba(17, 24, 39, 0.06) 0.5px, transparent 0.6px);
  background-size: 4px 4px, 6px 6px;
  background-position: 0 0, 1px 2px;
  mix-blend-mode: multiply;
}

html[data-theme="dark"] .ui-bg-noise-layer {
  mix-blend-mode: screen;
  opacity: calc(var(--ui-noise-opacity) * 0.75);
}

body > #app,
body > .page,
body > .login-container,
body > .container {
  position: relative;
  z-index: 5;
}

.header,
.header-content,
.toolbar,
.card,
.login-card,
.preview-card,
.folder-sidebar,
.folder-breadcrumb,
.list-view-card,
.search-card,
.stats,
.storage-switcher,
.guest-notice,
.upload-zone,
.storage-target,
.upload-item,
.result-item,
.history-item,
.image-card,
.toolbar-row,
.status-pill,
.file-picker,
.file-queue-wrap,
.result-empty,
.empty-tip,
.token-loading,
.token-empty,
.el-card:not(.video-card):not(.audio-card):not(.file-card),
.el-dialog,
.el-dialog__header,
.el-dialog__body,
.el-dialog__footer,
.el-message-box,
.el-message-box__content,
.el-message-box__header,
.el-message-box__btns {
  background: rgba(var(--ui-surface-rgb), var(--ui-card-opacity)) !important;
  border-color: rgba(var(--ui-border-rgb), 0.46) !important;
  box-shadow: var(--ui-shadow-soft) !important;
  backdrop-filter: blur(var(--ui-card-blur)) saturate(115%);
  -webkit-backdrop-filter: blur(var(--ui-card-blur)) saturate(115%);
}

html[data-theme="dark"] .header,
html[data-theme="dark"] .header-content,
html[data-theme="dark"] .card,
html[data-theme="dark"] .login-card,
html[data-theme="dark"] .preview-card,
html[data-theme="dark"] .folder-sidebar,
html[data-theme="dark"] .folder-breadcrumb,
html[data-theme="dark"] .list-view-card,
html[data-theme="dark"] .el-card:not(.video-card):not(.audio-card):not(.file-card),
html[data-theme="dark"] .el-dialog,
html[data-theme="dark"] .el-message-box {
  box-shadow: var(--ui-shadow-soft-dark) !important;
}

.theme-floating-toggle,
.theme-auto-inline-toggle,
.theme-admin-toggle,
.gallery-theme-toggle {
  border-color: rgba(var(--ui-border-rgb), 0.58) !important;
  background: rgba(var(--ui-surface-rgb), 0.9) !important;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.1) !important;
  color: #344054 !important;
}

html[data-theme="dark"] .theme-floating-toggle,
html[data-theme="dark"] .theme-auto-inline-toggle,
html[data-theme="dark"] .theme-admin-toggle,
html[data-theme="dark"] .gallery-theme-toggle {
  color: #e8eeff !important;
}

/* ============================================================
 * Task 1: 图像处理面板（亮色/暗色自适应，沿用项目 CSS 变量）
 * ============================================================ */
.folder-pick-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 200px;
  padding: 11px 14px;
  border: 1px solid rgba(138, 75, 255, 0.22);
  border-radius: 12px;
  background: var(--surface-1);
  color: var(--primary-color);
  cursor: pointer;
  font-size: 0.88em;
  font-weight: 600;
  transition: var(--transition);
  overflow: hidden;
}
.folder-pick-btn span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.folder-pick-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(138, 75, 255, 0.15);
  border-color: var(--primary-color);
}

.image-process-panel {
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: 16px;
  border: 1px solid rgba(138, 75, 255, 0.12);
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(200, 241, 255, 0.18) 100%
  );
  display: grid;
  gap: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.image-process-panel.is-enabled {
  border-color: rgba(138, 75, 255, 0.35);
  box-shadow: 0 6px 18px rgba(138, 75, 255, 0.1);
}
.image-process-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.image-process-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  color: var(--text-primary);
  font-weight: 600;
}
.image-process-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-track {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
  border-radius: 999px;
  background: rgba(138, 75, 255, 0.18);
  transition: background 0.2s;
  flex-shrink: 0;
}
.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s;
}
.image-process-switch input:checked + .switch-track {
  background: var(--primary-color);
}
.image-process-switch input:checked + .switch-track .switch-thumb {
  transform: translateX(20px);
}
.image-process-switch input:focus + .switch-track {
  box-shadow: 0 0 0 3px rgba(138, 75, 255, 0.18);
}
.switch-label {
  font-size: 0.92em;
}
.image-process-hint {
  color: var(--text-muted);
  font-size: 0.82em;
}
.image-process-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.image-process-field {
  display: grid;
  gap: 6px;
}
.ipf-label {
  color: var(--text-secondary);
  font-size: 0.84em;
  font-weight: 600;
}
.image-process-slider {
  display: flex;
  align-items: center;
  gap: 10px;
}
.image-process-slider input[type="range"] {
  flex: 1;
  min-width: 0;
  accent-color: var(--primary-color);
  cursor: pointer;
}
.slider-value {
  min-width: 2.4em;
  text-align: center;
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(138, 75, 255, 0.12);
  color: var(--primary-color);
  font-size: 0.84em;
  font-weight: 600;
}
.ipf-select,
.ipf-number {
  border: 1px solid var(--input-border);
  border-radius: 10px;
  background: var(--surface-1);
  color: var(--text-primary);
  padding: 8px 10px;
  font-size: 0.9em;
  width: 100%;
  box-sizing: border-box;
}
.ipf-select:focus,
.ipf-number:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(138, 75, 255, 0.12);
}
.image-process-scale {
  display: flex;
  align-items: center;
  gap: 6px;
}
.image-process-scale .ipf-number {
  flex: 1;
}
.field-suffix {
  color: var(--text-muted);
  font-size: 0.84em;
}

/* ============================================================
 * Task 2: 目录选择器模态框（亮色/暗色自适应）
 * ============================================================ */
.folder-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.folder-picker-dialog {
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: var(--surface-1, #fff);
  color: var(--text-primary, #2f3243);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  border: 1px solid rgba(138, 75, 255, 0.18);
}
.folder-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(138, 75, 255, 0.12);
  background: rgba(138, 75, 255, 0.06);
}
.folder-picker-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--primary-color);
}
.folder-picker-close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1em;
  padding: 4px 8px;
  border-radius: 8px;
  transition: var(--transition);
}
.folder-picker-close:hover {
  color: var(--danger-color, #f56c6c);
  background: rgba(245, 108, 108, 0.1);
}
.folder-picker-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 6px;
}
.folder-picker-loading,
.folder-picker-empty {
  padding: 30px 18px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.92em;
}
.folder-tree {
  list-style: none;
  margin: 0;
  padding: 0;
}
.folder-tree-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.9em;
  transition: background 0.15s, color 0.15s;
}
.folder-tree-item:hover {
  background: rgba(138, 75, 255, 0.08);
  color: var(--primary-color);
}
.folder-tree-item.active {
  background: rgba(138, 75, 255, 0.14);
  color: var(--primary-color);
  font-weight: 600;
}
.folder-tree-item i {
  width: 16px;
  text-align: center;
  color: inherit;
}
.folder-tree-name {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.folder-tree-count {
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(138, 75, 255, 0.12);
  color: var(--primary-color);
  font-size: 0.8em;
  font-weight: 600;
}
.folder-picker-footer {
  padding: 12px 14px;
  border-top: 1px solid rgba(138, 75, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(138, 75, 255, 0.04);
}
.folder-picker-new {
  display: flex;
  gap: 8px;
}
.folder-picker-new input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  background: var(--surface-1);
  color: var(--text-primary);
  padding: 9px 12px;
  font-size: 0.9em;
}
.folder-picker-new input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(138, 75, 255, 0.12);
}
.folder-picker-create-btn {
  border: 1px solid rgba(138, 75, 255, 0.3);
  border-radius: 10px;
  background: var(--primary-color);
  color: #fff;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 0.88em;
  font-weight: 600;
  white-space: nowrap;
  transition: var(--transition);
}
.folder-picker-create-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(138, 75, 255, 0.25);
}
.folder-picker-create-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.folder-picker-cancel {
  align-self: flex-end;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  background: var(--surface-1);
  color: var(--text-secondary);
  padding: 8px 16px;
  cursor: pointer;
  font-size: 0.88em;
  transition: var(--transition);
}
.folder-picker-cancel:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

/* 暗色主题覆盖 */
html[data-theme="dark"] .image-process-panel {
  background: linear-gradient(
    135deg,
    rgba(15, 23, 39, 0.9) 0%,
    rgba(154, 169, 255, 0.08) 100%
  );
  border-color: rgba(154, 169, 255, 0.18);
}
html[data-theme="dark"] .image-process-panel.is-enabled {
  border-color: rgba(154, 169, 255, 0.4);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}
html[data-theme="dark"] .switch-track {
  background: rgba(154, 169, 255, 0.22);
}
html[data-theme="dark"] .switch-thumb {
  background: #e8eeff;
}
html[data-theme="dark"] .folder-pick-btn,
html[data-theme="dark"] .ipf-select,
html[data-theme="dark"] .ipf-number,
html[data-theme="dark"] .folder-picker-new input,
html[data-theme="dark"] .folder-picker-cancel {
  background: rgba(15, 23, 39, 0.9);
  color: #e8eeff;
}
html[data-theme="dark"] .folder-picker-dialog {
  background: rgba(15, 23, 39, 0.96);
  color: #e8eeff;
  border-color: rgba(154, 169, 255, 0.22);
}
html[data-theme="dark"] .folder-picker-header,
html[data-theme="dark"] .folder-picker-footer {
  background: rgba(154, 169, 255, 0.08);
  border-color: rgba(154, 169, 255, 0.18);
}
html[data-theme="dark"] .folder-tree-item {
  color: #b8c2e0;
}
html[data-theme="dark"] .folder-tree-count,
html[data-theme="dark"] .slider-value {
  background: rgba(154, 169, 255, 0.18);
  color: var(--primary-color);
}
html[data-theme="dark"] .folder-picker-create-btn {
  background: var(--primary-color);
  color: #0b1120;
}

html[data-theme="dark"] .theme-floating-toggle i,
html[data-theme="dark"] .theme-auto-inline-toggle i,
html[data-theme="dark"] .theme-admin-toggle i,
html[data-theme="dark"] .gallery-theme-toggle i {
  color: #d0dcff !important;
}

html[data-theme="dark"] .storage-switcher,
html[data-theme="dark"] .stats-bar,
html[data-theme="dark"] .guest-notice {
  background: rgba(var(--ui-surface-rgb), var(--ui-card-opacity)) !important;
}

html[data-theme="dark"] .el-button--primary {
  background: #6f84ff !important;
  border-color: transparent !important;
}

html[data-theme="dark"] .el-button--danger {
  background: #d0617d !important;
  border-color: transparent !important;
}

body.login-page {
  min-height: 100dvh !important;
  display: flex;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px 16px !important;
}

body.login-page .login-container {
  position: relative;
  z-index: 2;
}

body.login-page .bg-image-layer,
body.login-page .bg-overlay {
  display: none !important;
}

@media (max-width: 768px) {
  body.login-page {
    align-items: center !important;
    justify-content: center !important;
    padding: max(14px, env(safe-area-inset-top)) 14px
      max(14px, env(safe-area-inset-bottom)) 14px !important;
  }

  .ui-bg-canvas-layer {
    height: 100vh;
  }
}

/* ============================================================
 * 同步 K-Vault 暗色主题细节优化
 * 来源: K-Vault 2026-05-02 commit
 *   "增强管理头部的响应式设计,优化暗色主题下的视觉效果"
 * 仅追加,不修改已有规则;不破坏亮色主题
 * ============================================================ */

/* --- 卡片毛玻璃变量(便于后续统一调整) --- */
:root {
  --ui-card-backdrop-filter: blur(var(--ui-card-blur)) saturate(115%);
}

/* --- 弹窗内层元素移除阴影/毛玻璃,避免暗色下层叠阴影问题 ---
   K-Vault 核心暗色优化: el-dialog / el-message-box 的内层
   header/body/footer 不再重复 box-shadow 与 backdrop-filter,
   防止暗色主题下出现"双层阴影"视觉污染 */
.el-dialog__header,
.el-dialog__body,
.el-dialog__footer,
.el-message-box__content,
.el-message-box__header,
.el-message-box__btns {
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* --- 背景图层 GPU 加速,避免暗色长页面滚动卡顿 ---
   K-Vault 将 background-attachment 从 fixed 改为 scroll,
   并加上 transform: translateZ(0) / backface-visibility,
   在暗色主题(深色大背景)下显著提升滚动流畅度。
   GPU 提速对亮/暗均无害; background-attachment 仅在暗色下切换,避免影响亮色视觉 */
.ui-bg-image-layer {
  transform: translateZ(0);
  backface-visibility: hidden;
}

html[data-theme="dark"] .ui-bg-image-layer {
  background-attachment: scroll !important;
}

/* --- 暗色主题: 预览弹窗视觉细节 --- */
html[data-theme="dark"] .preview-modal {
  background: rgba(0, 0, 0, 0.94) !important;
}

html[data-theme="dark"] .preview-info {
  background: rgba(15, 23, 39, 0.88) !important;
  border: 1px solid rgba(130, 152, 196, 0.3);
  color: #e8eeff !important;
}

html[data-theme="dark"] .preview-close {
  background: rgba(30, 41, 59, 0.7) !important;
  border: 1px solid rgba(130, 152, 196, 0.3);
  color: #e8eeff !important;
}

html[data-theme="dark"] .preview-close:hover {
  background: rgba(50, 65, 95, 0.85) !important;
  border-color: rgba(154, 169, 255, 0.45);
}

/* --- 暗色主题: 批量操作栏增强对比度 --- */
html[data-theme="dark"] .batch-bar {
  background: rgba(15, 23, 39, 0.96) !important;
  border: 1px solid rgba(130, 152, 196, 0.3);
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.5) !important;
}

/* --- 暗色主题: Toast 通知暗色适配 --- */
html[data-theme="dark"] .toast {
  background: rgba(15, 23, 39, 0.95) !important;
  color: #e8eeff !important;
  border: 1px solid rgba(130, 152, 196, 0.25);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4) !important;
}

html[data-theme="dark"] .toast.success { border-left-color: #67c23a !important; }
html[data-theme="dark"] .toast.error { border-left-color: #f56c6c !important; }
html[data-theme="dark"] .toast.info { border-left-color: var(--primary-color) !important; }

/* --- 暗色主题: 分页按钮 --- */
html[data-theme="dark"] .page-btn {
  background: rgba(30, 41, 59, 0.85) !important;
  color: #c4cde3 !important;
  border: 1px solid rgba(130, 152, 196, 0.2);
}

html[data-theme="dark"] .page-btn:hover {
  background: rgba(50, 65, 95, 0.9) !important;
  color: #e8eeff !important;
  border-color: rgba(154, 169, 255, 0.4);
}

html[data-theme="dark"] .page-btn.active {
  background: var(--primary-color) !important;
  color: #0b1120 !important;
  border-color: transparent !important;
}

html[data-theme="dark"] .page-btn:disabled {
  opacity: 0.4 !important;
}

/* --- 暗色主题: 链接格式选择器 --- */
html[data-theme="dark"] .format-selector {
  background: rgba(30, 41, 59, 0.6) !important;
  border: 1px solid rgba(130, 152, 196, 0.2);
}

html[data-theme="dark"] .format-btn {
  color: #c4cde3 !important;
}

html[data-theme="dark"] .format-btn:hover {
  background: rgba(154, 169, 255, 0.15) !important;
  color: #e8eeff !important;
}

html[data-theme="dark"] .format-btn.active {
  background: var(--primary-color) !important;
  color: #0b1120 !important;
}

/* --- 暗色主题: 统计徽章 --- */
html[data-theme="dark"] .stat-badge {
  background: linear-gradient(
    135deg,
    rgba(154, 169, 255, 0.12),
    rgba(130, 152, 196, 0.1)
  ) !important;
  color: #c4cde3 !important;
  border: 1px solid rgba(130, 152, 196, 0.2);
}

html[data-theme="dark"] .stat-badge strong {
  color: var(--primary-color) !important;
}

/* --- 暗色主题: 头部搜索框 --- */
html[data-theme="dark"] .header-search input {
  background: rgba(15, 23, 39, 0.6) !important;
  color: #e8eeff !important;
  border-color: rgba(130, 152, 196, 0.3) !important;
}

html[data-theme="dark"] .header-search input:focus {
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 3px rgba(154, 169, 255, 0.18) !important;
}

html[data-theme="dark"] .header-search input::placeholder {
  color: #90a0bf !important;
}

/* --- 暗色主题: 导航按钮 --- */
html[data-theme="dark"] .nav-btn {
  background: rgba(30, 41, 59, 0.7) !important;
  color: #c4cde3 !important;
  border-color: rgba(130, 152, 196, 0.25) !important;
}

html[data-theme="dark"] .nav-btn:hover {
  background: rgba(50, 65, 95, 0.85) !important;
  color: #e8eeff !important;
  border-color: var(--primary-color) !important;
}

html[data-theme="dark"] .nav-btn.active {
  background: var(--primary-color) !important;
  color: #0b1120 !important;
  border-color: transparent !important;
}

/* --- 暗色主题: 图片卡片操作按钮 --- */
html[data-theme="dark"] .card-btn {
  background: rgba(30, 41, 59, 0.9) !important;
  color: #e8eeff !important;
  border: 1px solid rgba(130, 152, 196, 0.2);
}

html[data-theme="dark"] .card-btn:hover {
  background: var(--primary-color) !important;
  color: #0b1120 !important;
  border-color: transparent !important;
}

html[data-theme="dark"] .card-btn.delete:hover {
  background: #d0617d !important;
  color: #fff !important;
}

/* --- 暗色主题: 图片卡片边框细节 --- */
html[data-theme="dark"] .image-card {
  border-color: rgba(130, 152, 196, 0.28) !important;
}

html[data-theme="dark"] .image-card.selected {
  box-shadow: 0 0 0 3px var(--primary-color), var(--shadow-hover) !important;
}

/* --- 暗色主题: 空状态/加载状态 --- */
html[data-theme="dark"] .empty-state {
  color: #8b9ab8 !important;
}

html[data-theme="dark"] .empty-state i {
  color: #4a5568 !important;
}

html[data-theme="dark"] .loading-state {
  color: #8b9ab8 !important;
}

html[data-theme="dark"] .loading-spinner {
  border-color: rgba(130, 152, 196, 0.2) !important;
  border-top-color: var(--primary-color) !important;
}

/* --- 暗色主题: 图片卡片勾选框 --- */
html[data-theme="dark"] .image-card-checkbox {
  background: rgba(30, 41, 59, 0.9) !important;
  color: #e8eeff !important;
  border: 1px solid rgba(130, 152, 196, 0.3);
}

html[data-theme="dark"] .image-card-checkbox.checked {
  background: var(--primary-color) !important;
  color: #0b1120 !important;
  border-color: transparent !important;
}

/* --- 暗色主题: 工具栏链接格式提示文字 --- */
html[data-theme="dark"] .toolbar-right > span {
  color: #8b9ab8 !important;
}
