/* ==========================================
   Admin Panel — Glass Morphism Theme
   半透明毛玻璃 + 深阴影浮空感 + 渐变蓝强调
   参考 Upload.cshtml 的对比数值重新设计
   ========================================== */

/* ===== CSS Variables ===== */
:root {
    /* ── Depth / Background Layers ── */
    --admin-bg-page: #f5f5f7;
    --admin-bg-surface-primary: rgba(255, 255, 255, 0.85);
    --admin-bg-surface-secondary: rgba(255, 255, 255, 0.72);
    --admin-bg-surface-tertiary: rgba(255, 255, 255, 0.78);
    --admin-bg-glass: rgba(255, 255, 255, 0.78);
    --admin-bg-input: rgba(0, 0, 0, 0.06); /* 输入框灰色底(日间, 与近白背景拉开对比) */
    --admin-bg-input-focus: #ffffff;

    /* ── Glass Effect ── */
    --admin-glass-blur: blur(20px) saturate(160%);
    --admin-glass-border: rgba(0, 0, 0, 0.08);

    /* ── Shadow Scale (对齐编辑器轻阴影) ── */
    --shadow-surface:  0 1px 4px rgba(0,0,0,0.04);
    --shadow-card:     0 8px 24px rgba(17, 24, 39, 0.06);
    --shadow-elevated: 0 12px 32px rgba(17, 24, 39, 0.08);
    --shadow-floating: 0 20px 48px rgba(17, 24, 39, 0.12);

    /* ── Accent / System Colors (对齐编辑器 #0066ff → #00b8ff) ── */
    --admin-accent: #0066ff;
    --admin-accent-hover: #0052d9;
    --admin-accent-light: #66a3ff;
    --admin-accent-sub: rgba(0, 102, 255, 0.08);
    --admin-accent-gradient: linear-gradient(135deg, #0066ff, #00b8ff);
    --admin-success: #059669;
    --admin-success-bg: rgba(16, 185, 129, 0.1);
    --admin-danger: #ef4444;
    --admin-danger-bg: rgba(239, 68, 68, 0.1);
    --admin-danger-gradient: linear-gradient(135deg, #ef4444, #f87171);
    --admin-warning: #f59e0b;
    --admin-warning-bg: rgba(245, 158, 11, 0.1);

    /* ── Text (对齐编辑器 #111827/#6b7280/#9ca3af) ── */
    --admin-text: #111827;
    --admin-text-sub: #6b7280;
    --admin-text-muted: #9ca3af;

    /* ── Border Radius Scale ── */
    --admin-radius-sm: 10px;
    --admin-radius: 14px;
    --admin-radius-lg: 18px;
    --admin-radius-xl: 20px;
    --admin-radius-pill: 9999px;

    /* ── Spacing Scale (unit: 4px) ── */
    --space-4:  4px;
    --space-8:  8px;
    --space-12: 12px;
    --space-16: 16px;
    --space-20: 20px;
    --space-24: 24px;
    --space-32: 32px;
    --space-40: 40px;
    --space-48: 48px;

    /* ── Animation / Easing ── */
    --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-smooth: cubic-bezier(0.43, 1, 0.58, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

    /* ── Backward-compat ── */
    --admin-sidebar-bg: var(--admin-bg-surface-tertiary);
    --admin-sidebar-border: rgba(0, 0, 0, 0.08);
    --admin-card-bg: var(--admin-bg-surface-primary);
    --admin-card-border: rgba(0, 0, 0, 0.08);
    --admin-card-shadow: var(--shadow-card);
    --admin-nav-hover: rgba(0, 0, 0, 0.04);
    --admin-nav-active-bg: var(--admin-accent-gradient);
    --admin-nav-active-text: #ffffff;
    --admin-divider: rgba(0, 0, 0, 0.08);
    --admin-table-stripe: rgba(0, 0, 0, 0.02);
}

/* ============================================================
   说明：这里曾经放过一个 body:has(.admin-layout) 的深色令牌块，
   目的是不依赖 JS 加类的时序。但它特异性 (0,2,1) 高于
   body.dark-mode (0,1,1)，会把日间模式一起压成深色 —— 已删除。
   现在完全走 body.dark-mode，与最初版本一致。
   ============================================================ */

body.dark-mode {
    /* ── Depth / Background Layers ──
       与原设计一致：深色玻璃，不透明度足够高以形成层次。 */
    --admin-bg-page: #000000;
    --admin-bg-surface-primary: rgba(30, 30, 30, 0.72);
    --admin-bg-surface-secondary: rgba(40, 40, 42, 0.72);
    --admin-bg-surface-tertiary: rgba(45, 45, 47, 0.78);
    --admin-bg-glass: rgba(28, 28, 30, 0.78);
    --admin-bg-input: rgba(255, 255, 255, 0.07); /* 输入框灰色底(深色, 比纯黑背景略亮) */
    --admin-bg-input-focus: #222222;

    /* ── Shadow Scale (对齐编辑器深色轻阴影) ── */
    --shadow-surface:  0 1px 4px rgba(0,0,0,0.25);
    --shadow-card:     0 8px 24px rgba(0,0,0,0.28);
    --shadow-elevated: 0 12px 32px rgba(0,0,0,0.36);
    --shadow-floating: 0 20px 48px rgba(0,0,0,0.44);

    /* ── Glass ── */
    --admin-glass-blur: blur(20px) saturate(160%);
    --admin-glass-border: rgba(255, 255, 255, 0.10);

    /* ── Accent (对齐编辑器深色 #7ab4ff) ── */
    --admin-accent: #7ab4ff;
    --admin-accent-hover: #9cc5ff;
    --admin-accent-light: #9cc5ff;
    --admin-accent-sub: rgba(122, 180, 255, 0.12);
    --admin-accent-gradient: linear-gradient(135deg, #7ab4ff, #00b8ff);
    --admin-success: #34d399;
    --admin-success-bg: rgba(52, 211, 153, 0.12);
    --admin-danger: #f87171;
    --admin-danger-bg: rgba(248, 113, 113, 0.12);
    --admin-danger-gradient: linear-gradient(135deg, #f87171, #fca5a5);
    --admin-warning: #fbbf24;
    --admin-warning-bg: rgba(251, 191, 36, 0.12);

    /* ── Text (对齐编辑器深色 #f3f4f6/#9ca3af) ── */
    --admin-text: #f3f4f6;
    --admin-text-sub: #9ca3af;
    --admin-text-muted: #6b7280;

    /* ── Backward-compat ── */
    --admin-sidebar-bg: var(--admin-bg-surface-tertiary);
    --admin-sidebar-border: rgba(255, 255, 255, 0.1);
    --admin-card-bg: var(--admin-bg-surface-primary);
    --admin-card-border: rgba(255, 255, 255, 0.1);
    --admin-card-shadow: var(--shadow-card);
    --admin-nav-hover: rgba(255, 255, 255, 0.06);
    --admin-nav-active-bg: var(--admin-accent-gradient);
    --admin-nav-active-text: #ffffff;
    --admin-divider: rgba(255, 255, 255, 0.1);
    --admin-table-stripe: rgba(255, 255, 255, 0.02);
}

/* ===== Admin Layout ===== */
.upload-wrapper {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    box-sizing: border-box;
}

.admin-layout {
    display: flex;
    width: 100%;
    height: calc(100vh - 40px);
    gap: 20px;
    align-items: flex-start;
}

/* ===== Sidebar (Acrylic) ===== */
.admin-sidebar {
    flex: 0 0 280px;
    background: var(--admin-sidebar-bg);
    backdrop-filter: var(--admin-glass-blur);
    -webkit-backdrop-filter: var(--admin-glass-blur);
    border: 1px solid var(--admin-glass-border);
    border-radius: var(--admin-radius-xl);
    box-shadow: var(--admin-card-shadow);
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 32px;
    overflow: hidden;
}

.admin-sidebar-header {
    padding: 8px 24px 20px;
    font-size: var(--fs-xl);
    font-weight: var(--fw-bold);
    color: var(--admin-text);
    letter-spacing: var(--ls-heading);
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-sidebar-header svg {
    flex-shrink: 0;
    color: var(--admin-accent);
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 10px;
    flex: 1;
}

.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--admin-radius-sm);
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: var(--fs-base);
    font-weight: var(--fw-semibold);
    color: var(--admin-text-sub);
    transition: background 0.12s, color 0.12s, transform 0.1s;
    text-align: left;
    width: 100%;
    font-family: inherit;
}

.admin-nav-item svg {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
}

.admin-nav-item:hover {
    background: var(--admin-nav-hover);
    color: var(--admin-text);
}

.admin-nav-item.active {
    background: var(--admin-nav-active-bg);
    color: var(--admin-nav-active-text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.admin-sidebar-divider {
    height: 1px;
    background: var(--admin-divider);
    margin: 12px 20px;
}

.admin-theme-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 10px 4px;
    padding: 10px 16px;
    border-radius: var(--admin-radius-sm);
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    color: var(--admin-text-sub);
    transition: background 0.12s, color 0.12s;
    text-align: left;
    font-family: inherit;
}

.admin-theme-btn:hover {
    background: var(--admin-nav-hover);
    color: var(--admin-text);
}

.admin-theme-btn:active {
    transform: scale(0.97);
}

.admin-theme-btn svg {
    flex-shrink: 0;
}

.admin-sidebar-footer {
    padding: 8px 10px 0;
}

.admin-back-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: var(--admin-radius-sm);
    color: var(--admin-text-sub);
    text-decoration: none;
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    transition: background 0.12s, color 0.12s;
}

.admin-back-link:hover {
    background: var(--admin-nav-hover);
    color: var(--admin-text);
}

.admin-back-link:active {
    transform: scale(0.97);
}

/* ===== 退出登录 ===== */
.admin-logout-form {
    margin: 2px 0 0;
}

.admin-logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    border: none;
    border-radius: var(--admin-radius-sm);
    background: none;
    font-family: inherit;
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    color: var(--admin-danger, #ef4444);
    text-align: left;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.admin-logout-btn:hover {
    background: var(--admin-danger-bg, rgba(239, 68, 68, 0.1));
}

.admin-logout-btn:active {
    transform: scale(0.97);
}

/* ===== Content Area ===== */
.admin-content {
    flex: 1;
    min-width: 0;
}

.admin-panel {
    display: none;
}

.admin-panel.active {
    display: block;
    /* 入场动画由 admin-polish.css 按面板差异化定义 */
}

/* ===== Main Card ===== */
.main-card {
    background: var(--admin-card-bg);
    backdrop-filter: var(--admin-glass-blur);
    -webkit-backdrop-filter: var(--admin-glass-blur);
    border: 1px solid var(--admin-glass-border);
    border-radius: var(--admin-radius-xl);
    box-shadow: var(--admin-card-shadow);
    overflow: hidden;
    /* 入场动画由 admin-polish.css 统一管理 */
}

.main-card.admin-card {
    max-width: none;
    padding: 0;
    min-height: 100%;
}

/* ===== Page Header ===== */
.admin-page-header {
    padding: 32px 44px 0;
}

.admin-page-title {
    font-size: var(--fs-2xl);
    font-weight: var(--fw-bold);
    color: var(--admin-text);
    margin: 0;
    letter-spacing: var(--ls-heading);
}

.admin-page-subtitle {
    font-size: var(--fs-sm);
    color: var(--admin-text-sub);
    margin-top: 4px;
    font-weight: var(--fw-medium);
}

/* ===== Dashboard: Stat Cards ===== */
.dash-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    padding: 28px 44px;
}

.dash-stat-card {
    background: var(--admin-card-bg);

    border: 1px solid var(--admin-card-border);
    border-left: 3px solid var(--admin-accent);
    border-radius: var(--admin-radius);
    padding: 18px 22px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: default;
}

.dash-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

body.dark-mode .dash-stat-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.dash-stat-label {
    font-size: var(--fs-2xs);
    font-weight: var(--fw-semibold);
    color: var(--admin-text-sub);
    text-transform: uppercase;
    letter-spacing: var(--ls-caps);
    display: flex;
    align-items: center;
    gap: 6px;
}

.dash-stat-label svg {
    width: 14px;
    height: 14px;
    color: var(--admin-accent);
}

.dash-stat-value {
    font-size: var(--fs-3xl);
    font-weight: var(--fw-bold);
    color: var(--admin-text);
    letter-spacing: var(--ls-display);
    line-height: 1;
}

.dash-stat-sub {
    font-size: var(--fs-2xs);
    color: var(--admin-text-muted);
    font-weight: var(--fw-medium);
}

/* ===== Dashboard: Grid Panels ===== */
.dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: 0 44px 24px;
}

.dash-panel {
    background: var(--admin-card-bg);

    border: 1px solid var(--admin-card-border);
    border-radius: var(--admin-radius);
    overflow: hidden;
}

.dash-panel.full-width {
    grid-column: 1 / -1;
}

.dash-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--admin-divider);
}

.dash-panel-title {
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    color: var(--admin-text);
    text-transform: uppercase;
    letter-spacing: var(--ls-label);
    display: flex;
    align-items: center;
    gap: 8px;
}

.dash-panel-title svg {
    width: 16px;
    height: 16px;
    color: var(--admin-accent);
}

/* ===== Dashboard: Category List ===== */
.dash-cat-list {
    padding: 8px 0;
    max-height: 320px;
    overflow-y: auto;
}

.dash-cat-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 20px;
    transition: background 0.1s;
}

.dash-cat-row:hover {
    background: var(--admin-nav-hover);
}

.dash-cat-name {
    flex: 1;
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    color: var(--admin-text);
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-cat-count {
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    color: var(--admin-text-sub);
    flex-shrink: 0;
}

.dash-cat-bar-wrap {
    width: 120px;
    height: 4px;
    background: var(--admin-nav-hover);
    border-radius: 99px;
    overflow: hidden;
    flex-shrink: 0;
}

.dash-cat-bar {
    height: 100%;
    background: var(--admin-accent);
    border-radius: 99px;
    transition: width 0.4s ease;
}

/* ===== Dashboard: Recent Table ===== */
.dash-table-wrap {
    overflow-x: auto;
}

.dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-xs);
}

.dash-table th {
    text-align: left;
    padding: 10px 20px;
    font-size: var(--fs-2xs);
    font-weight: var(--fw-bold);
    color: var(--admin-text-sub);
    text-transform: uppercase;
    letter-spacing: var(--ls-label);
    background: var(--admin-table-stripe);
    border-bottom: 1px solid var(--admin-divider);
}

.dash-table td {
    padding: 12px 20px;
    color: var(--admin-text);
    border-bottom: 1px solid var(--admin-divider);
    white-space: nowrap;
}

.dash-table tr:last-child td {
    border-bottom: none;
}

.dash-table tr:hover td {
    background: var(--admin-table-stripe);
}

.dash-table .col-name {
    font-weight: var(--fw-semibold);
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-table .col-cat {
    color: var(--admin-text-sub);
    font-size: var(--fs-2xs);
}

.dash-table .col-size {
    font-family: 'Inter', monospace;
    font-size: var(--fs-2xs);
    color: var(--admin-text-sub);
}

.dash-table .col-date {
    font-size: var(--fs-2xs);
    color: var(--admin-text-muted);
}

.dash-table .col-rating {
    font-size: var(--fs-2xs);
    font-weight: var(--fw-bold);
}

.btn-dash-del {
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: var(--fs-sm);
    padding: 4px 8px;
    opacity: 0.4;
    transition: opacity 0.15s, background 0.15s, border-color 0.15s, color 0.15s;
    line-height: 1;
}
.btn-dash-del:hover {
    opacity: 1;
    background: var(--admin-danger-bg);
    border-color: var(--admin-danger);
    color: var(--admin-danger);
}

.btn-dash-goto {
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: var(--fs-sm);
    padding: 4px 8px;
    opacity: 0.4;
    transition: opacity 0.15s, background 0.15s, border-color 0.15s, color 0.15s;
    line-height: 1;
    color: var(--admin-text);
    text-decoration: none;
    display: inline-block;
    margin-right: 2px;
}
.btn-dash-goto:hover {
    opacity: 1;
    background: var(--admin-accent-sub);
    border-color: var(--admin-accent);
    color: var(--admin-accent);
}

.dash-table .badge-rating {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: var(--fs-2xs);
    font-weight: var(--fw-bold);
    letter-spacing: var(--ls-label);
}

.badge-rating.general {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.badge-rating.questionable {
    background: rgba(249, 115, 22, 0.1);
    color: #ea580c;
}

.badge-rating.nsfw {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

body.dark-mode .badge-rating.general { color: #34d399; }
body.dark-mode .badge-rating.questionable { color: #fb923c; }
body.dark-mode .badge-rating.nsfw { color: #f87171; }

/* ===== Dashboard: Empty State ===== */
.dash-empty {
    padding: 36px;
    text-align: center;
    color: var(--admin-text-muted);
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
}

.dash-empty svg {
    display: block;
    margin: 0 auto 12px;
    color: var(--admin-text-muted);
    opacity: 0.4;
}

/* ===== Upload: Two-column ===== */
.upload-cols {
    display: flex;
    align-items: stretch;
    max-height: calc(100vh - 200px);
}

.form-col {
    flex: 0 0 480px;
    padding: 32px 44px;
    box-sizing: border-box;
    min-width: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.side-col {
    flex: 1;
    min-width: 0;
    padding: 32px 32px 32px 28px;
    box-sizing: border-box;
    border-left: 1px solid var(--admin-divider);
    display: none;
    flex-direction: column;
    gap: 16px;
    overflow: hidden;
}

.side-col.visible {
    display: flex;
}

/* ===== Scrollable Area (队列+日志) ===== */
.side-col-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* ===== Form Elements ===== */
.card-title {
    font-size: var(--fs-2xl);
    font-weight: var(--fw-bold);
    margin: 0;
    color: var(--admin-text);
    letter-spacing: var(--ls-heading);
}

.card-subtitle {
    font-size: var(--fs-sm);
    color: var(--admin-text-sub);
    margin-top: 4px;
    font-weight: var(--fw-medium);
    margin-bottom: 22px;
}

.form-section {
    margin-bottom: 16px;
}

.input-label {
    display: block;
    font-size: var(--fs-2xs);
    font-weight: var(--fw-bold);
    color: var(--admin-text-sub);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: var(--ls-label);
}

.modern-input {
    width: 100%;
    padding: 11px 16px;
    font-size: var(--fs-sm);
    border-radius: var(--admin-radius);
    border: 2px solid transparent; /* 非聚焦 2px 透明边框, 聚焦只变色, 零跳动 */
    background: var(--admin-bg-input);
    color: var(--admin-text);
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    outline: none;
    font-family: inherit;
}

.modern-input:focus {
    background: var(--admin-bg-input-focus);
    border-color: var(--admin-accent); /* 宽度恒定 2px, 只变色 */
    box-shadow: none;
}

input[type="file"].modern-input::file-selector-button {
    margin-right: 12px;
    border: none;
    background: rgba(0, 0, 0, 0.08);
    padding: 5px 10px;
    border-radius: 6px;
    color: var(--admin-text);
    font-weight: var(--fw-semibold);
    cursor: pointer;
    font-family: inherit;
    font-size: var(--fs-2xs);
}

body.dark-mode input[type="file"].modern-input::file-selector-button {
    background: rgba(255, 255, 255, 0.15);
    color: #eee;
}

/* ===== Drop Zone ===== */
.drop-zone {
    border: 2px dashed rgba(37, 99, 235, 0.35);
    border-radius: var(--admin-radius);
    padding: 22px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.25s, background 0.25s, transform 0.25s;
    background: rgba(37, 99, 235, 0.03);
    user-select: none;
}

body.dark-mode .drop-zone {
    border-color: rgba(96, 165, 250, 0.30);
    background: rgba(96, 165, 250, 0.04);
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--admin-accent);
    background: rgba(37, 99, 235, 0.08);
    transform: scale(1.01);
}

body.dark-mode .drop-zone:hover,
body.dark-mode .drop-zone.dragover {
    border-color: var(--admin-accent);
    background: rgba(96, 165, 250, 0.10);
    transform: scale(1.01);
}

.dz-icon { font-size: var(--fs-3xl); line-height: 1; margin-bottom: 5px; }
.dz-icon svg { width: 28px; height: 28px; color: var(--admin-accent); }
.dz-text { font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--admin-accent); }
.dz-sub { font-size: var(--fs-2xs); color: var(--admin-text-muted); margin-top: 2px; }

/* ===== Tag Search Autocomplete ===== */
.tag-search-wrap {
    position: relative;
    margin-bottom: 16px;
}

.tag-search-input {
    width: 100%;
    padding: 11px 16px 11px 36px;
    font-size: var(--fs-sm);
    border-radius: var(--admin-radius);
    border: 2px solid transparent;
    background: var(--admin-bg-input);
    color: var(--admin-text);
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    outline: none;
    font-family: inherit;
}

.tag-search-input:focus {
    background: var(--admin-bg-input-focus);
    border-color: var(--admin-accent);
    box-shadow: none; /* 对齐编辑器: 去掉蓝色光晕 */
}

.tag-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--admin-text-muted);
    pointer-events: none;
}

.tag-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--admin-radius);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.06);
    z-index: 100;
    max-height: 260px;
    overflow-y: auto;
    overflow-x: hidden;
    display: none;
    margin-top: 4px;
}

body.dark-mode .tag-search-dropdown {
    background: #1e1e1e;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.50), 0 4px 12px rgba(0, 0, 0, 0.30);
}

.tag-search-dropdown.visible {
    display: block;
}

.tag-search-item {
    display: flex;
    flex-direction: column;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.1s;
    gap: 2px;
}

.tag-search-item:hover,
.tag-search-item.active {
    background: rgba(37, 99, 235, 0.08);
}
body.dark-mode .tag-search-item:hover,
body.dark-mode .tag-search-item.active {
    background: rgba(96, 165, 250, 0.12);
}

.tag-search-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.tag-search-matched {
    font-size: var(--fs-sm);
    color: var(--admin-accent);
    font-weight: var(--fw-bold);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.tag-search-count {
    font-size: var(--fs-2xs);
    color: var(--admin-text-muted);
    font-weight: var(--fw-semibold);
    flex-shrink: 0;
}

.tag-search-path {
    font-size: var(--fs-2xs);
    color: var(--admin-text-muted);
    font-weight: var(--fw-normal);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.tag-search-empty {
    padding: 16px;
    text-align: center;
    color: var(--admin-text-muted);
    font-size: var(--fs-2xs);
}

/* 「还有 N 条未显示」提示：必须吸底常驻。
   下拉框 max-height:260px 且 overflow-y:auto，普通放在列表末尾的元素会被滚出视野，
   提示就等于没提示。背景与下拉框保持一致，避免滚到底时透出下面的条目。 */
.tag-search-more {
    position: sticky;
    bottom: 0;
    padding: 8px 14px;
    text-align: center;
    font-size: var(--fs-2xs);
    font-weight: var(--fw-semibold);
    color: var(--admin-text-muted);
    background: #ffffff;
    border-top: 1px solid var(--admin-divider);
}

body.dark-mode .tag-search-more {
    background: #1e1e1e;
}

.tag-search-sep {
    height: 1px;
    background: var(--admin-divider);
    margin: 12px 0 16px;
}

/* ===== Custom Select (内容分级下拉 — 与标签补全框统一风格) ===== */
.custom-select-wrap {
    position: relative;
}

.custom-select {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}
.custom-select:focus,
.custom-select:focus-within {
    background: var(--admin-bg-input-focus);
    border-color: var(--admin-accent); /* 宽度恒定 2px, 只变色; :focus-within 覆盖内部含输入框的组合下拉 */
    box-shadow: none;
}

.custom-select-arrow {
    flex-shrink: 0;
    color: var(--admin-text-muted);
    transition: transform 0.2s ease;
}
.custom-select.open .custom-select-arrow {
    transform: rotate(180deg);
}

.custom-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 260px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--admin-radius);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.06);
    z-index: 100;
    display: none;
}
body.dark-mode .custom-select-dropdown {
    background: #1e1e1e;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.50);
}
.custom-select-dropdown.visible {
    display: block;
}

.custom-select-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: var(--fs-sm);
    color: var(--admin-text);
    transition: background 0.1s;
}
.custom-select-item:hover {
    background: rgba(37, 99, 235, 0.08);
}
body.dark-mode .custom-select-item:hover {
    background: rgba(96, 165, 250, 0.12);
}
.custom-select-item.active {
    color: var(--admin-accent);
    background: rgba(37, 99, 235, 0.06);
}
body.dark-mode .custom-select-item.active {
    background: rgba(96, 165, 250, 0.10);
}

/* ── Combobox variant (自由输入模式，内嵌 input) ── */
.custom-select-combo {
    padding: 0;
    cursor: text;
}
.custom-select-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    padding: 11px 0 11px 16px;
    font-size: var(--fs-sm);
    color: var(--admin-text);
    font-family: inherit;
    min-width: 0;
}
.custom-select-input::placeholder {
    color: var(--admin-text-muted);
}
.custom-select-combo .custom-select-arrow {
    margin-right: 12px;
    flex-shrink: 0;
}

/* ===== Buttons ===== */
.btn-submit {
    width: 100%;
    padding: 13px;
    border-radius: var(--admin-radius);
    border: none;
    font-size: var(--fs-base);
    font-weight: var(--fw-bold);
    color: white;
    background: var(--admin-accent-gradient);
    cursor: pointer;
    transition: transform 0.25s var(--ease-spring), box-shadow 0.25s var(--ease-spring), filter 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    box-shadow: 0 8px 20px -5px rgba(37, 99, 235, 0.40);
}

.btn-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    filter: brightness(1.1);
    box-shadow: 0 12px 28px -4px rgba(37, 99, 235, 0.45), 0 4px 12px rgba(37, 99, 235, 0.20);
}

.btn-submit:active:not(:disabled) {
    transform: scale(0.97);
    filter: brightness(0.95);
    transition-duration: 0.1s;
}

.btn-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    filter: none !important;
}

.btn-delete {
    background: var(--admin-danger-gradient);
    box-shadow: 0 8px 20px -5px rgba(220, 38, 38, 0.40);
}

.btn-delete:hover:not(:disabled) {
    background: var(--admin-danger-gradient);
    box-shadow: 0 12px 28px -4px rgba(220, 38, 38, 0.45), 0 4px 12px rgba(220, 38, 38, 0.20);
}

.btn-reset {
    flex-shrink: 0;
    padding: 13px 15px;
    border-radius: var(--admin-radius);
    border: 2px solid rgba(0, 0, 0, 0.10);
    background: transparent;
    cursor: pointer;
    font-size: var(--fs-md);
    transition: border-color 0.2s, color 0.2s, background 0.2s;
    color: var(--admin-text-muted);
    line-height: 1;
}

.btn-reset:hover {
    border-color: var(--admin-danger);
    color: var(--admin-danger);
    background: rgba(239, 68, 68, 0.06);
}

body.dark-mode .btn-reset {
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--admin-text-muted);
}

body.dark-mode .btn-reset:hover {
    border-color: var(--admin-danger);
    color: var(--admin-danger);
}

/* ===== Action Buttons ===== */
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: var(--fs-2xs);
    font-weight: var(--fw-bold);
    border-radius: var(--admin-radius-sm);
    border: none;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
    white-space: nowrap;
    font-family: inherit;
}

.btn-action:hover { transform: translateY(-1px); }
.btn-action:active { transform: scale(0.96); transition-duration: 0.08s; }

.btn-action-green {
    background: rgba(16, 185, 129, 0.10);
    color: #059669;
}
.btn-action-green:hover { background: rgba(16, 185, 129, 0.18); }
body.dark-mode .btn-action-green { background: rgba(52, 211, 153, 0.15); color: #34d399; }
body.dark-mode .btn-action-green:hover { background: rgba(52, 211, 153, 0.25); }

.btn-action-red {
    background: rgba(239, 68, 68, 0.10);
    color: #dc2626;
}
.btn-action-red:hover { background: rgba(239, 68, 68, 0.18); }
body.dark-mode .btn-action-red { background: rgba(248, 113, 113, 0.15); color: #f87171; }
body.dark-mode .btn-action-red:hover { background: rgba(248, 113, 113, 0.25); }

.btn-action-blue {
    background: rgba(37, 99, 235, 0.10);
    color: #2563eb;
}
.btn-action-blue:hover { background: rgba(37, 99, 235, 0.18); }
body.dark-mode .btn-action-blue { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }
body.dark-mode .btn-action-blue:hover { background: rgba(96, 165, 250, 0.25); }

/* ===== Checkbox ===== */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.checkbox-group input {
    width: 16px;
    height: 16px;
    accent-color: var(--admin-accent);
    flex-shrink: 0;
    cursor: pointer;
}

.checkbox-group label {
    font-size: var(--fs-xs);
    color: var(--admin-text-sub);
    font-weight: var(--fw-medium);
    cursor: pointer;
}

/* 开关型切换（登录页与上传页共用） */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    cursor: pointer;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--admin-border, #d1d5db);
    border-radius: 24px;
    transition: 0.25s;
}
.toggle-slider::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.25s;
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--admin-accent);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* ===== Progress Bar ===== */
.progress-wrap {
    display: none;
    padding: 14px 16px;
    border-radius: var(--admin-radius);
    background: rgba(37, 99, 235, 0.06);
    border: 1px solid rgba(37, 99, 235, 0.12);
}

body.dark-mode .progress-wrap {
    background: rgba(96, 165, 250, 0.07);
    border-color: rgba(96, 165, 250, 0.18);
}

.progress-wrap.visible { display: block; }

.progress-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.progress-text {
    font-size: var(--fs-2xs);
    font-weight: var(--fw-bold);
    color: var(--admin-accent);
}

.progress-pct {
    font-size: var(--fs-2xs);
    font-weight: var(--fw-bold);
    color: var(--admin-accent);
}

.progress-bg {
    height: 8px;
    border-radius: 99px;
    background: rgba(37, 99, 235, 0.15);
    overflow: hidden;
}

body.dark-mode .progress-bg {
    background: rgba(96, 165, 250, 0.15);
}

/* 进度填充：流光渐变
   去掉原先的 45° 斜纹（廉价感），改为一道柔和高光扫过；
   宽度用 0.6s 缓出过渡，让按文件整跳的进度看起来是"滑过去"而不是"跳过去" */
.progress-fill {
    position: relative;
    height: 100%;
    width: 0%;
    border-radius: 99px;
    background: var(--admin-accent-gradient);
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

/* 流光高光层：附着在填充之上，随填充宽度一起裁切 */
.progress-fill::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 99px;
    background: linear-gradient(90deg,
        transparent 20%, rgba(255, 255, 255, 0.55) 50%, transparent 80%);
    background-size: 45% 100%;
    background-repeat: no-repeat;
    animation: progressSheen 2.4s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

/* 普通文件：高光 2.4s 扫过一次 */
@keyframes progressSheen {
    0%   { background-position: -60% 0; }
    100% { background-position: 190% 0; }
}

/* 大文件等待（>10MB，由 admin-upload.js 的 setScanMode(true) 触发）：
   视觉与普通状态保持完全一致，唯一区别是流光扫过的频率放慢到 4.2s。
   节奏变慢本身就传达"这张还需要等一会儿"，不需要换颜色或换形态。 */
.progress-fill.indeterminate {
    width: 100% !important;
}

.progress-fill.indeterminate::after {
    animation-duration: 4.2s;
}

/* 减少动效偏好：保留静态渐变，停掉流光 */
@media (prefers-reduced-motion: reduce) {
    .progress-fill,
    .progress-fill::after {
        animation: none !important;
    }
}

.upload-hint {
    font-size: var(--fs-2xs);
    color: #f59e0b;
    font-weight: var(--fw-semibold);
    margin-top: 6px;
    text-align: center;
    display: none;
}

.upload-hint.visible { display: block; }

/* ===== Section Headers ===== */
.sec-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.sec-title {
    font-size: var(--fs-2xs);
    font-weight: var(--fw-bold);
    color: var(--admin-text-sub);
    letter-spacing: var(--ls-caps);
    text-transform: uppercase;
}

/* 可点击折叠标题栏（队列/日志） */
.sec-title-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
    border-radius: 6px;
    padding: 3px 6px 3px 2px;
    transition: background 0.15s;
}
.sec-title-toggle:hover { background: rgba(37, 99, 235, 0.08); }
body.dark-mode .sec-title-toggle:hover { background: rgba(96, 165, 250, 0.12); }

.collapse-arrow {
    color: var(--admin-text-muted);
    transition: transform 0.2s ease;
}
.sec-title-toggle.collapsed .collapse-arrow { transform: rotate(-90deg); }

/* 折叠状态：隐藏对应列表 */
.queue-list.collapsed,
.log-list.collapsed { display: none; }

/* ===== Queue Items ===== */
.queue-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.q-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: var(--admin-radius-sm);
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: border-color 0.2s, background 0.2s;
}

body.dark-mode .q-item {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.07);
}

.q-item.uploading {
    border-color: rgba(37, 99, 235, 0.30);
    background: rgba(37, 99, 235, 0.05);
}

.q-item.success {
    border-color: rgba(16, 185, 129, 0.30);
    background: rgba(16, 185, 129, 0.05);
}

.q-item.error {
    border-color: rgba(239, 68, 68, 0.30);
    background: rgba(239, 68, 68, 0.05);
}

.q-item.unclassified {
    border-color: rgba(239, 68, 68, 0.50);
    background: rgba(239, 68, 68, 0.07);
}

body.dark-mode .q-item.unclassified {
    border-color: rgba(248, 113, 113, 0.40);
    background: rgba(248, 113, 113, 0.10);
}

.q-check {
    width: 15px;
    height: 15px;
    accent-color: var(--admin-accent);
    flex-shrink: 0;
    cursor: pointer;
}

.q-thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    display: block;
}

.q-placeholder {
    width: 72px;
    height: 72px;
    border-radius: 6px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-sm);
    background: var(--admin-accent-sub);
}

.q-info { flex: 1; min-width: 0; }

.q-name {
    font-size: var(--fs-2xs);
    font-weight: var(--fw-bold);
    color: var(--admin-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.q-path {
    font-size: var(--fs-2xs);
    color: var(--admin-text-muted);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.q-meta {
    font-size: var(--fs-2xs);
    color: var(--admin-text-muted);
    margin-top: 2px;
}

.q-server {
    font-size: var(--fs-2xs);
    color: var(--admin-success);
    margin-top: 3px;
    font-family: 'SF Mono', 'Cascadia Code', monospace;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.q-err {
    font-size: var(--fs-2xs);
    color: var(--admin-danger);
    margin-top: 2px;
}

.q-status { font-size: var(--fs-sm); flex-shrink: 0; }

.q-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--admin-text-muted);
    padding: 2px 4px;
    font-size: var(--fs-2xs);
    border-radius: 4px;
    flex-shrink: 0;
    line-height: 1;
}

.q-remove:hover {
    color: var(--admin-danger);
    background: var(--admin-danger-bg);
}

/* ===== Log Entries ===== */
#logSection {
    margin-top: 12px;
    padding-top: 14px;
    border-top: 1px solid var(--admin-divider);
}

.log-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.log-entry {
    padding: 8px 10px;
    border-radius: 8px;
    font-size: var(--fs-2xs);
    border-left: 3px solid var(--admin-accent);
    background: rgba(37, 99, 235, 0.04);
}

body.dark-mode .log-entry {
    background: rgba(37, 99, 235, 0.07);
}

.log-entry.success {
    border-left-color: #10b981;
    background: rgba(16, 185, 129, 0.04);
}

body.dark-mode .log-entry.success {
    background: rgba(16, 185, 129, 0.07);
}

.log-entry.error {
    border-left-color: var(--admin-danger);
    background: rgba(239, 68, 68, 0.04);
}

body.dark-mode .log-entry.error {
    background: rgba(239, 68, 68, 0.07);
}

.log-hdr { display: flex; justify-content: space-between; gap: 6px; }
.log-file { font-weight: var(--fw-bold); color: var(--admin-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-time { color: var(--admin-text-muted); font-size: var(--fs-2xs); flex-shrink: 0; }
.log-path { color: var(--admin-text-sub); margin-top: 1px; }
.log-server { color: var(--admin-success); font-family: monospace; margin-top: 4px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; word-break: break-all; }
.log-err { color: var(--admin-danger); margin-top: 2px; }

/* ===== Msg Alert ===== */
.msg-alert {
    padding: 12px;
    border-radius: var(--admin-radius-sm);
    text-align: center;
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
}

.msg-success {
    background: var(--admin-success-bg);
    color: var(--admin-success);
}

.msg-error {
    background: var(--admin-danger-bg);
    color: var(--admin-danger);
}

.d-none { display: none !important; }

/* ===== Copy Button ===== */
.btn-copy {
    font-size: var(--fs-2xs);
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid var(--admin-success);
    background: transparent;
    color: var(--admin-success);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
}

.btn-copy:hover {
    background: var(--admin-success);
    color: white;
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    min-width: 240px;
    padding: 14px 24px;
    border-radius: var(--admin-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    text-align: center;
    font-size: var(--fs-sm);
    font-weight: var(--fw-bold);
    display: none;
    transition: opacity 0.35s ease;
}

body.dark-mode .toast {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.60);
}

/* ===== 撤销提示条（取消收藏等操作的后悔药） =====
   设计要点：
   - 固定底部居中：撤销的公认位置，且与顶部 .toast 错开，两者可同时出现
   - 连续操作合并为一条（见 admin-common.js 的 showUndo），避免堆叠遮挡网格
   - 底部细线为倒计时，比数字安静，同时给出"还剩多久"的直觉 */
.undo-bar {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 9998;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: min(600px, calc(100vw - 40px));
    padding: 12px 14px 12px 18px;
    border-radius: var(--admin-radius);
    background: rgba(17, 24, 39, 0.93);
    color: #fff;
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.55);
    overflow: hidden;
    opacity: 0;
    transform: translate(-50%, 14px);
    pointer-events: none;
    transition: opacity 0.3s var(--ease-spring), transform 0.3s var(--ease-spring);
}

body.dark-mode .undo-bar {
    background: rgba(40, 40, 44, 0.96);
    box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.8);
}

.undo-bar.visible {
    opacity: 1;
    transform: translate(-50%, 0);
    pointer-events: auto;
}

.undo-bar .undo-icon { flex-shrink: 0; color: #eab308; }

.undo-bar .undo-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 撤销按钮：文字按钮 + 下划线，克制但有明确的可点击暗示 */
.undo-bar .undo-action {
    flex-shrink: 0;
    padding: 4px 2px;
    border: none;
    background: none;
    font-family: inherit;
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    letter-spacing: var(--ls-label);
    color: #66b3ff;
    cursor: pointer;
    border-radius: 6px;
    transition: color 0.18s, background 0.18s;
}

.undo-bar .undo-action:hover {
    color: #9ccbff;
    background: rgba(102, 179, 255, 0.12);
}

.undo-bar .undo-action:active { transform: scale(0.96); }

.undo-bar .undo-action:focus-visible {
    outline: 2px solid #66b3ff;
    outline-offset: 2px;
}

body.dark-mode .undo-bar .undo-action { color: var(--admin-accent); }

/* 倒计时细线：贴在提示条底部，从满宽缩到 0 */
.undo-bar .undo-timer {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 2px;
    width: 100%;
    background: linear-gradient(90deg, #0066ff, #00b8ff);
    transform-origin: left center;
}

.undo-bar.visible .undo-timer {
    animation: undoCountdown 5s linear forwards;
}

@keyframes undoCountdown {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* ===== Unified Thin Scrollbar (主窗口 + 内部容器统一 4px 细条) ===== */
/* ── 垂直 4px 容器 ── */
.form-col, .side-col-scroll, .dash-cat-list, .tag-search-dropdown, .custom-select-dropdown, #tagFileItems {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

body.dark-mode .form-col,
body.dark-mode .side-col-scroll,
body.dark-mode .dash-cat-list,
body.dark-mode .tag-search-dropdown,
body.dark-mode .custom-select-dropdown,
body.dark-mode #tagFileItems {
    scrollbar-color: rgba(255, 255, 255, 0.20) transparent;
}

.form-col::-webkit-scrollbar,
.side-col-scroll::-webkit-scrollbar,
.dash-cat-list::-webkit-scrollbar,
.tag-search-dropdown::-webkit-scrollbar,
.custom-select-dropdown::-webkit-scrollbar,
#tagFileItems::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}
.form-col::-webkit-scrollbar-track,
.side-col-scroll::-webkit-scrollbar-track,
.dash-cat-list::-webkit-scrollbar-track,
.tag-search-dropdown::-webkit-scrollbar-track,
.custom-select-dropdown::-webkit-scrollbar-track,
#tagFileItems::-webkit-scrollbar-track {
    background: transparent;
}
.form-col::-webkit-scrollbar-thumb,
.side-col-scroll::-webkit-scrollbar-thumb,
.dash-cat-list::-webkit-scrollbar-thumb,
.tag-search-dropdown::-webkit-scrollbar-thumb,
.custom-select-dropdown::-webkit-scrollbar-thumb,
#tagFileItems::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 99px;
}
.form-col::-webkit-scrollbar-thumb:hover,
.side-col-scroll::-webkit-scrollbar-thumb:hover,
.dash-cat-list::-webkit-scrollbar-thumb:hover,
.tag-search-dropdown::-webkit-scrollbar-thumb:hover,
.custom-select-dropdown::-webkit-scrollbar-thumb:hover,
#tagFileItems::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

body.dark-mode .form-col::-webkit-scrollbar-thumb,
body.dark-mode .side-col-scroll::-webkit-scrollbar-thumb,
body.dark-mode .dash-cat-list::-webkit-scrollbar-thumb,
body.dark-mode .tag-search-dropdown::-webkit-scrollbar-thumb,
body.dark-mode .custom-select-dropdown::-webkit-scrollbar-thumb,
body.dark-mode #tagFileItems::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.20);
}
body.dark-mode .form-col::-webkit-scrollbar-thumb:hover,
body.dark-mode .side-col-scroll::-webkit-scrollbar-thumb:hover,
body.dark-mode .dash-cat-list::-webkit-scrollbar-thumb:hover,
body.dark-mode .tag-search-dropdown::-webkit-scrollbar-thumb:hover,
body.dark-mode .custom-select-dropdown::-webkit-scrollbar-thumb:hover,
body.dark-mode #tagFileItems::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* ── 水平 6px (表格横向滚动，太细不好点) ── */
.dash-table-wrap {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}
body.dark-mode .dash-table-wrap {
    scrollbar-color: rgba(255, 255, 255, 0.20) transparent;
}

.dash-table-wrap::-webkit-scrollbar {
    width: 4px;
    height: 6px;
}
.dash-table-wrap::-webkit-scrollbar-track {
    background: transparent;
}
.dash-table-wrap::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 99px;
}
.dash-table-wrap::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}
body.dark-mode .dash-table-wrap::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.20);
}
body.dark-mode .dash-table-wrap::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* ===== Responsive ===== */

/* ── 1200px: 仪表盘缩列 + 上传面板紧凑 ── */
@media (max-width: 1200px) {
    .dash-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .upload-cols {
        max-height: none;
    }

    .form-col {
        flex: 0 0 380px;
        padding: 24px 28px;
    }

    .side-col {
        padding: 24px 20px 24px 20px;
    }

    .admin-page-header {
        padding: 24px 28px 0;
    }

    .dash-stats-grid {
        padding: 20px 28px;
    }

    .dash-grid {
        padding: 0 28px 20px;
    }
}

/* ── 1000px: 侧边栏收窄 + 上传面板堆叠 ── */
@media (max-width: 1000px) {
    .admin-sidebar {
        flex: 0 0 220px;
    }

    .upload-cols {
        flex-direction: column;
    }

    .form-col {
        flex: 0 0 auto;
        padding: 20px;
    }

    .side-col {
        border-left: none;
        border-top: 1px solid var(--admin-divider);
        padding: 20px;
    }

    .dash-stats-grid {
        padding: 16px 20px;
    }

    .dash-grid {
        padding: 0 20px 16px;
    }

    .admin-page-header {
        padding: 20px 20px 0;
    }
}

/* ── 900px: 侧边栏变横条导航（移动端） ── */
@media (max-width: 900px) {
    .admin-layout {
        flex-direction: column;
    }

    .admin-sidebar {
        flex: 0 0 auto !important;
        flex-direction: row;
        padding: 8px;
        position: static;
        overflow-x: auto;
        gap: 4px;
        border-radius: 0;
    }

    .admin-sidebar-header {
        display: none;
    }

    .admin-nav {
        flex-direction: row;
        gap: 4px;
        padding: 0;
    }

    .admin-nav-item {
        padding: 8px 12px;
        font-size: var(--fs-2xs);
        white-space: nowrap;
        flex-shrink: 0;
        gap: 6px;
    }

    .admin-nav-item svg {
        width: 16px;
        height: 16px;
    }

    .admin-theme-btn,
    .admin-sidebar-divider,
    .admin-sidebar-footer {
        display: none;
    }

    .admin-content {
        margin-left: 0;
    }

    .dash-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 16px;
    }

    .dash-grid {
        grid-template-columns: 1fr;
        padding: 0 16px 16px;
    }

    .form-col {
        padding: 16px;
    }

    .side-col {
        padding: 16px;
    }
}

/* ===== Subtle Scrollbar (极细半透明, 不占空间) ===== */
/* 视口滚动条属于 html 元素，暗色模式需用 :has() 选到 html */
html {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}
html:has(> body.dark-mode) {
    scrollbar-color: rgba(255, 255, 255, 0.20) transparent;
}

html::-webkit-scrollbar { width: 4px; height: 4px; }
html::-webkit-scrollbar-track { background: transparent; }
html::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.15); border-radius: 99px; }
html::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.3); }

html:has(> body.dark-mode)::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.20); }
html:has(> body.dark-mode)::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.35); }

/* ==================== 标签管理（批量重命名 · 只读预检） ==================== */
.tags-admin { padding: 0 44px 40px; }

/* 三列 + 按钮同一行：用 grid 保证标签顶端与控件底部都严格对齐。
   之前用 flex + align-items:flex-end，各控件高度不同（select 43px、input 50px、
   搜索框还带 16px 下边距），导致三个 label 高低不齐。 */
.tags-form {
    display: grid;
    grid-template-columns: 210px minmax(200px, 1fr) minmax(200px, 1fr) auto;
    gap: 16px;
    align-items: end;
}
.tags-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tags-field-wide { min-width: 0; }
.tags-label {
    font-size: var(--fs-xs, 13px);
    color: var(--admin-text-sub, #666);
    font-weight: 600;
    line-height: 18px;
}
.tags-admin .modern-input { width: 100%; }
.tags-preview-btn { height: 48px; width: auto; padding: 0 26px; white-space: nowrap; }

/* 统一控件高度：类型下拉、旧名字搜索框、新名字输入框全部 48px */
.tags-form .dl-select,
.tags-form .modern-input,
.tags-form .tag-search-input {
    height: 48px;
    box-sizing: border-box;
}
.tags-form .dl-select {
    width: 100%;
    min-width: 0;
    padding: 0 40px 0 16px;
}
.tags-form .tag-search-wrap {
    height: 48px;
    margin-bottom: 0;
}
/* 固定高度后改用左右内边距，避免上下 padding 把文字挤到裁切 */
.tags-form .modern-input { padding: 0 16px; }
.tags-form .tag-search-input { padding: 0 16px 0 36px; }

.tags-status { margin-top: 16px; padding: 10px 14px; border-radius: var(--admin-radius-sm, 10px); font-size: var(--fs-sm, 14px); }
.tags-status.err { background: var(--admin-danger-bg, rgba(220,38,38,.1)); color: var(--admin-danger, #dc2626); }
.tags-status.ok { background: var(--admin-success-bg, rgba(16,185,129,.1)); color: var(--admin-success, #059669); }

.tags-summary { margin-top: 18px; padding: 16px 18px; border-radius: var(--admin-radius-lg, 14px); background: var(--admin-bg-surface-secondary, rgba(0,0,0,.03)); border: 1px solid var(--admin-card-border, rgba(0,0,0,.06)); }
.tags-summary-line { font-size: var(--fs-md, 16px); color: var(--admin-text, #111); }
.tags-summary-sub { margin-top: 6px; font-size: var(--fs-sm, 14px); color: var(--admin-text-sub, #666); }
.tags-warning { margin-top: 8px; font-size: var(--fs-xs, 13px); color: var(--admin-warning, #f59e0b); }

.tags-conflicts { margin-top: 14px; padding: 14px 16px; border-radius: var(--admin-radius-lg, 14px); background: var(--admin-danger-bg, rgba(220,38,38,.08)); border-left: 3px solid var(--admin-danger, #dc2626); }
.tags-conflict-title { font-weight: 700; color: var(--admin-danger, #dc2626); font-size: var(--fs-sm, 14px); }
.tags-conflicts ul { margin: 8px 0 0; padding-left: 20px; }
.tags-conflicts li { font-size: var(--fs-xs, 13px); color: var(--admin-text, #111); line-height: 1.7; }

.tags-groups { margin-top: 8px; }
.tags-group { margin-top: 22px; border: 1px solid var(--admin-card-border, rgba(0,0,0,.08)); border-radius: var(--admin-radius-lg, 14px); overflow: hidden; }
.tags-group-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; background: var(--admin-bg-surface-secondary, rgba(0,0,0,.03)); font-size: var(--fs-sm, 14px); }
.tags-group-name { font-weight: 700; color: var(--admin-text, #111); }
.tags-group-count { color: var(--admin-text-sub, #666); font-size: var(--fs-xs, 13px); }

.tags-table { width: 100%; border-collapse: collapse; font-size: var(--fs-xs, 13px); }
.tags-table th { text-align: left; font-weight: 600; color: var(--admin-text-sub, #666); padding: 8px 12px; border-top: 1px solid var(--admin-card-border, rgba(0,0,0,.06)); }
.tags-table td { padding: 8px 12px; border-top: 1px solid var(--admin-card-border, rgba(0,0,0,.06)); vertical-align: top; color: var(--admin-text, #111); }
.tags-filename { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; word-break: break-all; }
.tags-newpath { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--admin-text-sub, #666); word-break: break-all; line-height: 1.6; }
.tags-note { margin-top: 4px; color: var(--admin-text-muted, #888); line-height: 1.6; }
.tags-more { padding: 10px 16px; font-size: var(--fs-xs, 13px); color: var(--admin-text-muted, #888); border-top: 1px dashed var(--admin-card-border, rgba(0,0,0,.08)); }
.tags-empty { padding: 24px 0; color: var(--admin-text-muted, #888); }

.tags-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; margin-right: 4px; white-space: nowrap; }
.tags-badge.move { background: rgba(0, 123, 255, .12); color: #007bff; }
.tags-badge.json { background: rgba(107, 114, 128, .14); color: var(--admin-text-sub, #666); }
.tags-badge.conflict { background: rgba(220, 38, 38, .14); color: #dc2626; }

.tags-footer { margin-top: 26px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.tags-hint { font-size: var(--fs-xs, 13px); color: var(--admin-text-muted, #888); }

@media (max-width: 1200px) {
    .tags-form { grid-template-columns: 1fr 1fr; }
    .tags-preview-btn { width: 100%; }
}
@media (max-width: 900px) {
    .tags-admin { padding: 0 18px 28px; }
    .tags-form { grid-template-columns: 1fr; }
    .tags-preview-btn { width: 100%; }
    .tags-table td:nth-child(3), .tags-table th:nth-child(3) { display: none; }
}
/* ---------- 标签管理：分组摘要行（移动 / 仅 JSON） ---------- */
.tags-kind { width: 100%; min-width: 220px; }
.tags-name-wrap { width: 100%; }
.tags-group-rows { display: flex; flex-direction: column; }
.tags-row {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 13px 18px; border: 0;
    border-top: 1px solid var(--admin-card-border, rgba(0,0,0,.06));
    background: transparent; color: var(--admin-text, #111);
    font-size: var(--fs-sm, 14px); text-align: left; cursor: pointer;
    transition: background .15s ease;
}
.tags-row:hover { background: var(--admin-bg-surface-secondary, rgba(0,0,0,.03)); }
.tags-row-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.tags-row-dot.move { background: #007bff; }
.tags-row-dot.json { background: #9ca3af; }
.tags-row-label { font-weight: 600; }
.tags-row-chevron { margin-left: auto; color: var(--admin-text-muted, #999); transition: transform .2s ease; }
.tags-row[aria-expanded="true"] .tags-row-chevron { transform: rotate(90deg); }
.tags-detail { border-top: 1px dashed var(--admin-card-border, rgba(0,0,0,.08)); }
.tags-detail .tags-table th { padding-top: 10px; }
.tags-detail-cell { width: 70%; }
.tags-note-danger { color: #dc2626; }
/* ---------- 标签管理：选择 / 执行 / 撤销 ---------- */
.tags-selectbar {
    display: flex; align-items: center; gap: 16px;
    margin-top: 18px; padding: 10px 14px;
    border-radius: var(--admin-radius-sm, 10px);
    background: var(--admin-bg-surface-secondary, rgba(0,0,0,.03));
    border: 1px solid var(--admin-card-border, rgba(0,0,0,.06));
}
.tags-check {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: var(--fs-sm, 14px); color: var(--admin-text, #111);
    cursor: pointer; user-select: none;
}
.tags-check input { width: 16px; height: 16px; accent-color: var(--admin-accent, #0066ff); cursor: pointer; }
.tags-group-check {
    width: 16px; height: 16px; flex: 0 0 auto;
    margin: 0 2px 0 0; accent-color: var(--admin-accent, #0066ff); cursor: pointer;
}
.tags-group-name { flex: 1 1 auto; }
.tags-apply { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--admin-card-border, rgba(0,0,0,.08)); }
.tags-apply-row { display: flex; align-items: end; gap: 16px; flex-wrap: wrap; }
.tags-apply-row .tags-field { flex: 1 1 320px; }
.tags-apply-result {
    margin-top: 14px; padding: 12px 14px;
    border-radius: var(--admin-radius-sm, 10px);
    background: var(--admin-bg-surface-secondary, rgba(0,0,0,.03));
    border: 1px solid var(--admin-card-border, rgba(0,0,0,.06));
    font-size: var(--fs-sm, 14px);
}
.tags-result-line { color: var(--admin-text, #111); }
.tags-result-line.err { color: var(--admin-danger, #dc2626); }
.tags-result-errors { margin: 8px 0 0; padding-left: 20px; color: var(--admin-danger, #dc2626); font-size: var(--fs-xs, 13px); line-height: 1.7; }
/* 旧名字联想：挂到 body 的浮层，避免被 .main-card 的 overflow:hidden 裁剪 */
.tag-search-dropdown.tags-dropdown-portal {
    position: fixed;
    z-index: 9999;
    margin-top: 0;
}
/* 自绘下拉菜单挂到 body 后使用 fixed 定位（不再受 .main-card overflow 裁剪） */
.dl-select-menu.dl-select-menu-portal {
    position: fixed;
    right: auto;
    bottom: auto;
    min-width: 0;
    z-index: 9999;
    display: none;
    opacity: 1;
    visibility: visible;
    transform: none;
}
.dl-select-menu.dl-select-menu-portal.is-open { display: block; }

/* ==================== 标签管理：可读性放大 ==================== */
#admin-panel-tags .admin-page-title { font-size: 27px; }
#admin-panel-tags .admin-page-subtitle { font-size: 15px; line-height: 1.7; }
.tags-admin { font-size: 15px; }
.tags-label { font-size: 14px; color: var(--admin-text, #111); }
.tags-form .dl-select,
.tags-form .modern-input,
.tags-form .tag-search-input {
    font-size: 15px;
    height: 52px;
}
.tags-form .dl-select { padding: 0 44px 0 18px; }
.tags-form .modern-input { padding: 0 18px; }
.tags-form .tag-search-input { padding: 0 18px 0 40px; }
.tags-form .tag-search-wrap { height: 52px; }
.tags-preview-btn { height: 52px; font-size: 15px; padding: 0 28px; }
.tags-status { font-size: 15px; }
.tags-summary { padding: 18px 20px; }
.tags-summary-line { font-size: 18px; }
.tags-summary-sub { font-size: 15px; }
.tags-warning { font-size: 14px; }
.tags-group-head { padding: 14px 18px; font-size: 15px; }
.tags-group-count { font-size: 14px; }
.tags-row { padding: 14px 18px; font-size: 15px; }
.tags-table { font-size: 14px; }
.tags-table th, .tags-table td { padding: 10px 14px; }
.tags-note, .tags-more { font-size: 13.5px; }
.tags-hint { font-size: 13.5px; line-height: 1.6; }
.tags-check { font-size: 15px; }
.tags-apply-result { font-size: 15px; }
.tags-result-errors { font-size: 14px; }
.tags-badge { font-size: 12px; padding: 3px 9px; }