@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary: #6366f1;
    --primary-light: #eef2ff;
    --primary-hover: #4f46e5;
    --bg-body: #f3f4f6;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --text-main: #1f2937;
    --text-sub: #9ca3af;
    --border: #f3f4f6;
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --radius-l: 16px;
    --radius-m: 10px;
}

html[data-theme="dark"] {
    --primary: #818cf8;
    --primary-light: rgba(129, 140, 248, 0.10);
    --primary-hover: #6366f1;
    --bg-body: #0b1220;
    --bg-sidebar: #0f172a;
    --bg-card: #111c33;
    --text-main: #e5e7eb;
    --text-sub: #9ca3af;
    --border: rgba(148, 163, 184, 0.14);
    --shadow-card: 0 10px 15px -3px rgba(0, 0, 0, 0.35), 0 4px 6px -2px rgba(0, 0, 0, 0.25);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

.theme-toggle-btn {
    width: auto;
    padding: 0 12px;
    gap: 8px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s;
}

#theme-toggle-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: #6b7280;
}

html:not([data-theme="dark"]) #theme-toggle-text {
    color: #6b7280;
}

.theme-toggle-btn:hover {
    border-color: rgba(129, 140, 248, 0.45);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

/* 登录页面专用样式 */
.login-wrapper {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    position: relative;
}

html[data-theme="dark"] .login-wrapper {
    background: linear-gradient(135deg, #0b1220 0%, #1a1f35 100%);
}

.login-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    width: 90%;
    max-width: 400px;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    text-align: center;
}

html[data-theme="dark"] .login-card {
    background: rgba(17, 28, 51, 0.85);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

.login-logo {
    font-size: 3.5rem;
    margin-bottom: 10px;
    background: linear-gradient(to right, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.login-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
}

html[data-theme="dark"] .login-title {
    color: rgba(229, 231, 235, 0.95);
}

.login-subtitle {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 30px;
}

html[data-theme="dark"] .login-subtitle {
    color: rgba(229, 231, 235, 0.60);
}

.login-form-group {
    margin-bottom: 20px;
    text-align: left;
}

.login-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #555;
}

html[data-theme="dark"] .login-label {
    color: rgba(229, 231, 235, 0.85);
}

.login-input {
    width: 100%;
    padding: 14px;
    border: 2px solid #eee;
    border-radius: 10px;
    background: #f9f9f9;
    font-size: 1rem;
    transition: 0.3s;
    color: #333;
}

html[data-theme="dark"] .login-input {
    border-color: rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.55);
    color: rgba(229, 231, 235, 0.95);
}

.login-input:focus {
    border-color: var(--primary);
    background: #fff;
    outline: none;
}

html[data-theme="dark"] .login-input:focus {
    background: rgba(15, 23, 42, 0.75);
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.3);
    transition: transform 0.2s;
}

.login-btn:active {
    transform: scale(0.98);
}

/* 主界面布局 */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

.sidebar {
    width: 250px;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    z-index: 50;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand {
    padding: 30px 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 10px;
    color: white;
    font-weight: 800;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.brand-text {
    font-size: 1.18rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.brand-version {
    margin-top: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-sub);
    letter-spacing: 0.02em;
}

#sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px;
    scrollbar-width: none;
}

#sidebar-nav::-webkit-scrollbar {
    display: none;
}

/* 分类分组（可折叠） */
.nav-category-group {
    margin-top: 14px;
}

.nav-category-group:first-child {
    margin-top: 4px;
}

.nav-category-btn {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.14);
    outline: none;
    background: rgba(148, 163, 184, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px 6px 10px;
    margin: 0;
    cursor: pointer;
    border-radius: 8px;
    color: var(--text-sub);
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

html:not([data-theme="dark"]) .nav-category-btn {
    background: #f8fafc;
    border-color: #e9eef5;
}

html[data-theme="dark"] .nav-category-btn {
    background: rgba(148, 163, 184, 0.08);
    border-color: rgba(148, 163, 184, 0.18);
}

.nav-category-btn:hover {
    background: rgba(148, 163, 184, 0.10);
    border-color: rgba(148, 163, 184, 0.22);
    color: var(--text-main);
}

html:not([data-theme="dark"]) .nav-category-btn:hover {
    background: #f9fafb;
    border-color: #e5e7eb;
    color: #111827;
}

html[data-theme="dark"] .nav-category-btn:hover {
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.28);
}

.nav-category-btn:focus-visible {
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.28);
}

.nav-category-title {
    font-size: 0.74rem;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.nav-category-arrow {
    width: 16px;
    height: 16px;
    margin-left: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    flex-shrink: 0;
}

.nav-category-arrow::before {
    content: '';
    width: 6px;
    height: 6px;
    border-right: 1.6px solid currentColor;
    border-bottom: 1.6px solid currentColor;
    transform: translateY(-0.5px) rotate(45deg);
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

html[data-theme="dark"] .nav-category-arrow {
    color: rgba(148, 163, 184, 0.9);
}

.nav-category-btn:hover .nav-category-arrow {
    color: var(--primary);
}

html[data-theme="dark"] .nav-category-btn:hover .nav-category-arrow {
    color: #a5b4fc;
}

.nav-category-group.collapsed .nav-category-arrow::before {
    transform: translateY(0) rotate(-45deg);
}

.nav-category-body {
    margin-top: 4px;
}

.nav-category-group.collapsed .nav-category-body {
    display: none;
}

.nav-category-group.collapsed.search-expanded .nav-category-body {
    display: block;
}

.nav-category-group.collapsed.search-expanded .nav-category-arrow::before {
    transform: translateY(-0.5px) rotate(45deg);
}

/* 菜单项 */
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    margin-bottom: 4px;
    border-radius: var(--radius-m);
    cursor: pointer;
    transition: all 0.2s ease;
    color: #4b5563;
    font-weight: 500;
    font-size: 0.93rem;
    border: 1px solid transparent;
}

/* 系统工具导航项与普通项保持一致字号（防止被浏览器/插件默认样式放大） */
.system-tool-nav-item,
.system-tool-nav-item .nav-text,
.system-tool-nav-item .nav-icon-emoji {
    font-size: 0.93rem;
    line-height: 1.2;
}

html[data-theme="dark"] .nav-item {
    color: rgba(229, 231, 235, 0.72);
}

.nav-item:hover {
    background-color: rgba(148, 163, 184, 0.10);
    color: var(--text-main);
}

html:not([data-theme="dark"]) .nav-item:hover {
    background-color: #f9fafb;
    color: #111827;
}

.nav-item:hover .nav-icon-emoji {
    transform: scale(1.1);
}

/* 选中状态 */
.nav-item.active {
    background-color: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

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

/* 底部栏 */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-footer .theme-toggle-btn {
    width: 100%;
    padding: 10px;
    border: 1px solid #e5e7eb;
    background: var(--bg-card);
    color: #6b7280;
    border-radius: var(--radius-m);
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    gap: 8px;
    display: flex;
    align-items: center;
}

html[data-theme="dark"] .sidebar-footer .theme-toggle-btn {
    color: rgba(229, 231, 235, 0.75);
    border-color: rgba(148, 163, 184, 0.18);
}

.sidebar-footer .theme-toggle-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #4b5563;
}

html[data-theme="dark"] .sidebar-footer .theme-toggle-btn:hover {
    background: rgba(148, 163, 184, 0.15);
    border-color: rgba(148, 163, 184, 0.25);
    color: rgba(229, 231, 235, 0.85);
}

.sidebar-footer #theme-toggle-text {
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

.logout-btn {
    width: 100%;
    padding: 10px;
    border: 1px solid #e5e7eb;
    background: var(--bg-card);
    color: #6b7280;
    border-radius: var(--radius-m);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

.logout-btn:hover {
    background: #fef2f2;
    border-color: #fee2e2;
    color: #ef4444;
}

html[data-theme="dark"] .logout-btn {
    color: rgba(229, 231, 235, 0.75);
    border-color: rgba(148, 163, 184, 0.18);
}

html[data-theme="dark"] .logout-btn:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.25);
    color: #f87171;
}

/* 内容区 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-body);
    position: relative;
    width: 100%;
}

.top-bar {
    height: 64px;
    padding: 0 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    gap: 16px;
}

html[data-theme="dark"] .top-bar {
    background: rgba(15, 23, 42, 0.78);
    border-bottom: 1px solid rgba(148, 163, 184, 0.10);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    flex: 1;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 搜索框 */
.search-wrapper {
    position: relative;
}

.search-input {
    width: 280px;
    padding: 8px 12px 8px 36px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: var(--radius-m);
    font-size: 0.9rem;
    background: rgba(148, 163, 184, 0.10);
    transition: all 0.2s;
    color: var(--text-main);
}

html:not([data-theme="dark"]) .search-input {
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    color: #1f2937;
}

.search-input:focus {
    background: var(--bg-card);
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-light);
    width: 320px;
}

.search-input::placeholder {
    color: #9ca3af;
}

/* 完成度指示器 */
.completion-indicator {
    min-width: 60px;
    padding: 6px 12px;
    border-radius: var(--radius-m);
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    cursor: default;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.save-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: var(--radius-m);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.save-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
}

.save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    max-width: 1120px;
    margin: 0 auto;
    width: 100%;
}

.content-area.dashboard-full-width {
    max-width: none;
    margin: 0;
}

/* 配置卡片 */
.config-group {
    background: var(--bg-card);
    border-radius: var(--radius-l);
    padding: 32px;
    box-shadow: var(--shadow-card);
    margin-bottom: 24px;
    display: none;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.config-group.active {
    display: block;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-item {
    margin-bottom: 28px;
}

.form-header {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.vf-inline-open-btn {
    border: 1px solid rgba(99, 102, 241, 0.35);
    background: rgba(99, 102, 241, 0.10);
    color: var(--primary);
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.vf-inline-btn-wrap {
    margin-bottom: 8px;
}

.vf-inline-open-btn:hover {
    background: rgba(99, 102, 241, 0.16);
    border-color: rgba(99, 102, 241, 0.55);
    transform: translateY(-1px);
}

html:not([data-theme="dark"]) .vf-inline-open-btn {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #4338ca;
}

html:not([data-theme="dark"]) .vf-inline-open-btn:hover {
    background: #e0e7ff;
    border-color: #a5b4fc;
}

.form-label {
    font-weight: 600;
    font-size: 0.95rem;
    color: rgba(229, 231, 235, 0.85);
}

html:not([data-theme="dark"]) .form-label {
    color: #374151;
}

.required-tag {
    background: #fff1f2;
    color: #e11d48;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 99px;
    font-weight: 700;
    border: 1px solid #ffe4e6;
}

.form-desc {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 10px;
    line-height: 1.5;
}

html[data-theme="dark"] .form-desc {
    color: rgba(229, 231, 235, 0.60);
}

.vf-inline-editor {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.vf-inline-preview {
    min-height: 92px;
    resize: vertical;
    font-family: "Cascadia Code", "Consolas", monospace;
    font-size: 0.82rem;
    line-height: 1.5;
    cursor: default;
}

.vf-inline-tip {
    font-size: 0.76rem;
    color: var(--text-sub);
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: var(--radius-m);
    font-size: 0.95rem;
    background: rgba(148, 163, 184, 0.10);
    transition: all 0.2s;
    color: var(--text-main);
}

html:not([data-theme="dark"]) .form-input {
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    color: #1f2937;
}

.form-input:focus {
    background: var(--bg-card);
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-input.cron-input-valid {
    border-color: rgba(16, 185, 129, 0.45);
}

.form-input.cron-input-invalid {
    border-color: rgba(239, 68, 68, 0.55);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.10);
}

.cron-helper {
    margin-top: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(148, 163, 184, 0.08);
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.83rem;
    line-height: 1.55;
}

html:not([data-theme="dark"]) .cron-helper {
    background: #f8fafc;
    border-color: #e5e7eb;
}

.cron-helper-status {
    font-weight: 700;
    color: var(--text-main);
}

.cron-helper-mechanism,
.cron-helper-next,
.cron-helper-example {
    color: var(--text-sub);
}

.cron-helper.is-valid {
    border-color: rgba(16, 185, 129, 0.28);
    background: rgba(16, 185, 129, 0.08);
}

html:not([data-theme="dark"]) .cron-helper.is-valid {
    background: #ecfdf5;
    border-color: #a7f3d0;
}

.cron-helper.is-valid .cron-helper-status {
    color: #059669;
}

.cron-helper.is-invalid {
    border-color: rgba(239, 68, 68, 0.28);
    background: rgba(239, 68, 68, 0.08);
}

html:not([data-theme="dark"]) .cron-helper.is-invalid {
    background: #fef2f2;
    border-color: #fecaca;
}

.cron-helper.is-invalid .cron-helper-status {
    color: #dc2626;
}

.cron-helper.is-empty .cron-helper-status {
    color: var(--text-main);
}

/* 卡片式配置项 - 关键词:目录ID */
.key-value-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.key-value-card-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    align-items: start;
}

.key-value-card-list.single-column {
    grid-template-columns: 1fr;
}

.key-value-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(148, 163, 184, 0.10);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: var(--radius-m);
    transition: all 0.2s;
    min-width: 0;
}

html:not([data-theme="dark"]) .key-value-card {
    background: white;
    border: 1px solid #e5e7eb;
}

.key-value-card:hover {
    border-color: #d1d5db;
    background: #f3f4f6;
}

html[data-theme="dark"] .key-value-card:hover {
    background: rgba(148, 163, 184, 0.15);
    border-color: rgba(148, 163, 184, 0.25);
}

.kv-key-input {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid rgba(148, 163, 184, 0.20);
    border-radius: var(--radius-m);
    background: rgba(15, 23, 42, 0.55);
    font-size: 0.9rem;
    transition: all 0.2s;
    color: var(--text-main);
}

html:not([data-theme="dark"]) .kv-key-input {
    border-color: #e5e7eb;
    background: white;
    color: #1f2937;
}

.kv-key-input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-light);
}

.kv-separator {
    font-size: 1rem;
    font-weight: 600;
    color: #6b7280;
    user-select: none;
    flex-shrink: 0;
}

.kv-value-input,
.kv-target-input,
.kv-blacklist-input {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid rgba(148, 163, 184, 0.20);
    border-radius: var(--radius-m);
    background: rgba(15, 23, 42, 0.55);
    font-size: 0.9rem;
    transition: all 0.2s;
    color: var(--text-main);
}

html:not([data-theme="dark"]) .kv-value-input,
html:not([data-theme="dark"]) .kv-target-input,
html:not([data-theme="dark"]) .kv-blacklist-input {
    border: 1px solid #e5e7eb;
    background: white;
    color: #1f2937;
}

.kv-value-input:focus,
.kv-target-input:focus,
.kv-blacklist-input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-light);
}

.kv-delete-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.3rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.kv-delete-btn:hover {
    background: #fecaca;
    transform: scale(1.1);
}

.kv-add-btn {
    padding: 10px 16px;
    border: 2px dashed #d1d5db;
    background: transparent;
    color: var(--primary);
    border-radius: var(--radius-m);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: fit-content;
    margin-top: 4px;
}

.kv-add-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

html[data-theme="dark"] .kv-add-btn {
    border-color: rgba(148, 163, 184, 0.25);
}

html[data-theme="dark"] .kv-add-btn:hover {
    background: rgba(129, 140, 248, 0.15);
}

/* 卡片式配置项 - 简单值列表（用 | 或逗号分隔） */
.value-list-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.value-list-card-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    align-items: start;
}

.value-list-card-list.single-column {
    grid-template-columns: 1fr;
}

.value-list-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(148, 163, 184, 0.10);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: var(--radius-m);
    transition: all 0.2s;
    min-width: 0;
}

html:not([data-theme="dark"]) .value-list-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
}

.value-list-card:hover {
    border-color: #d1d5db;
    background: #f3f4f6;
}

html[data-theme="dark"] .value-list-card:hover {
    background: rgba(148, 163, 184, 0.20);
    border-color: rgba(148, 163, 184, 0.30);
}

.vl-input {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid rgba(148, 163, 184, 0.20);
    border-radius: var(--radius-m);
    background: rgba(15, 23, 42, 0.55);
    font-size: 0.9rem;
    transition: all 0.2s;
    color: var(--text-main);
}

html:not([data-theme="dark"]) .vl-input {
    border-color: #e5e7eb;
    background: white;
    color: #1f2937;
}

.vl-input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-light);
}

.vl-delete-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.3rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.vl-delete-btn:hover {
    background: #fecaca;
    transform: scale(1.1);
}

.vl-add-btn {
    padding: 10px 16px;
    border: 2px dashed #d1d5db;
    background: transparent;
    color: var(--primary);
    border-radius: var(--radius-m);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: fit-content;
    margin-top: 4px;
}

.vl-add-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

html[data-theme="dark"] .vl-add-btn {
    border-color: rgba(148, 163, 184, 0.25);
}

html[data-theme="dark"] .vl-add-btn:hover {
    background: rgba(129, 140, 248, 0.15);
}

/* 115 扫码登录面板 */
.qr115-panel {
    margin-top: 14px;
    padding: 14px;
    border: 1px dashed rgba(99, 102, 241, 0.45);
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.06);
}

html[data-theme="dark"] .qr115-panel {
    border-color: rgba(129, 140, 248, 0.40);
    background: rgba(99, 102, 241, 0.10);
}

.qr115-panel-title {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 10px;
}

.qr115-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.qr115-select {
    min-width: 240px;
    flex: 1;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: var(--bg-card);
    color: var(--text-main);
}

.qr115-action-btn,
.qr115-stop-btn {
    border: none;
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.qr115-action-btn {
    background: var(--primary);
    color: #fff;
}

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

.qr115-stop-btn {
    background: #f3f4f6;
    color: #4b5563;
    border: 1px solid #e5e7eb;
}

.qr115-stop-btn:hover:not(:disabled) {
    background: #e5e7eb;
}

.qr115-action-btn:disabled,
.qr115-stop-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

html[data-theme="dark"] .qr115-stop-btn {
    background: rgba(148, 163, 184, 0.12);
    color: rgba(229, 231, 235, 0.85);
    border-color: rgba(148, 163, 184, 0.2);
}

.qr115-qrcode-wrap {
    width: 220px;
    max-width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.qr115-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.qr115-placeholder {
    text-align: center;
    color: #6b7280;
    padding: 10px;
    line-height: 1.4;
    font-size: 0.86rem;
}

.qr115-status {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #6b7280;
}

.qr115-status.success {
    color: #059669;
    font-weight: 600;
}

.qr115-status.error {
    color: #dc2626;
}

.qr115-countdown {
    margin-top: 4px;
    font-size: 0.82rem;
    color: #9ca3af;
}

/* 开关控件 */
.switch-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: #f9fafb;
    border: 1px solid #f3f4f6;
    border-radius: var(--radius-m);
    cursor: pointer;
    transition: border-color 0.2s;
}

html[data-theme="dark"] .switch-wrapper {
    background: rgba(148, 163, 184, 0.10);
    border-color: rgba(148, 163, 184, 0.18);
}

.switch-wrapper:hover {
    border-color: #e5e7eb;
    background: #f3f4f6;
}

html[data-theme="dark"] .switch-wrapper:hover {
    background: rgba(148, 163, 184, 0.15);
    border-color: rgba(148, 163, 184, 0.25);
}

.switch-label {
    font-size: 0.95rem;
    font-weight: 500;
    color: #4b5563;
}

.switch-label.on {
    color: var(--primary);
    font-weight: 600;
}

.switch-box {
    position: relative;
    width: 44px;
    height: 24px;
}

.switch-box input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #d1d5db;
    border-radius: 34px;
    transition: .3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: .3s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* 移动端 */
.menu-toggle {
    display: none;
    border: none;
    background: none;
    font-size: 1.5rem;
    color: #374151;
    padding: 4px;
}

html[data-theme="dark"] .menu-toggle {
    color: rgba(229, 231, 235, 0.85);
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(3px);
    z-index: 45;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -250px;
        height: 100%;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    }

    .sidebar.open {
        transform: translateX(250px);
    }

    .menu-toggle {
        display: block;
    }

    .top-bar {
        padding: 8px 16px;
        height: auto;
        min-height: 56px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .page-title {
        width: 100%;
        order: 1;
        margin-bottom: 0;
    }

    .top-bar-right {
        width: 100%;
        order: 2;
        display: flex;
        gap: 8px;
        align-items: center;
        flex-wrap: nowrap;
    }

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

    .search-input {
        width: 100%;
        max-width: none;
        padding: 8px 12px 8px 36px;
    }

    .search-input:focus {
        width: 100%;
    }

    .completion-indicator {
        font-size: 0.75rem;
        padding: 4px 8px;
        min-width: 50px;
        flex-shrink: 0;
    }

    .save-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
        flex-shrink: 0;
        white-space: nowrap;
    }

    .content-area {
        padding: 16px;
    }

    .config-group {
        padding: 20px;
    }

    /* 移动端卡片网格单列显示 */
    .key-value-card-list,
    .value-list-card-list {
        grid-template-columns: 1fr;
    }
}

/* 日志查看器样式 */
.log-viewer-container {
    background: var(--bg-card);
    border-radius: var(--radius-l);
    padding: 24px;
    box-shadow: var(--shadow-card);
}

html:not([data-theme="dark"]) .log-viewer-container {
    background: #ffffff;
}

.log-loading,
.log-error {
    padding: 20px;
    text-align: center;
    color: var(--text-sub);
    font-size: 0.9rem;
}

.log-error {
    color: #dc2626;
}

.log-content {
    background: #1f2937;
    color: #e5e7eb;
    padding: 20px;
    border-radius: var(--radius-m);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
    /* 优化移动端滚动体验 */
    -webkit-overflow-scrolling: touch;
    /* 自定义滚动条样式（WebKit浏览器） */
    scrollbar-width: thick;
    /* Firefox */
    scrollbar-color: #4b5563 #374151;
    /* Firefox */
}

/* WebKit浏览器（Chrome、Safari、Edge）滚动条样式 */
.log-content::-webkit-scrollbar {
    width: 12px;
    /* 滚动条宽度 */
    height: 12px;
    /* 水平滚动条高度 */
}

.log-content::-webkit-scrollbar-track {
    background: #374151;
    /* 滚动条轨道背景 */
    border-radius: 6px;
}

.log-content::-webkit-scrollbar-thumb {
    background: #6b7280;
    /* 滚动条滑块颜色 */
    border-radius: 6px;
    border: 2px solid #374151;
    /* 增加视觉边界 */
    min-height: 40px;
    /* 最小高度，便于拖动 */
}

.log-content::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
    /* 悬停时颜色 */
}

/* 转存历史 */
.transfer-history-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.transfer-history-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.transfer-history-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

.transfer-history-tip {
    font-size: 0.86rem;
    color: var(--text-sub);
}

.transfer-history-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.transfer-history-refresh-btn {
    border: none;
    background: var(--primary);
    color: #fff;
    border-radius: 8px;
    font-size: 0.84rem;
    font-weight: 600;
    padding: 7px 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.transfer-history-refresh-btn:hover {
    background: var(--primary-hover);
}

.transfer-history-updated {
    font-size: 0.8rem;
    color: var(--text-sub);
}

/* 命令调整页：紧凑布局 */
#bot-commands-section .transfer-history-header {
    margin-bottom: 12px;
    gap: 10px;
}

#bot-commands-section .transfer-history-title-wrap {
    gap: 4px;
}

#bot-commands-section .transfer-history-title {
    font-size: 1rem;
}

#bot-commands-section .transfer-history-tip {
    font-size: 0.8rem;
}

#bot-commands-section .transfer-history-actions {
    gap: 8px;
}

#bot-commands-section .transfer-history-refresh-btn {
    font-size: 0.8rem;
    padding: 6px 10px;
}

#bot-commands-section .transfer-history-container {
    gap: 8px;
}

.bot-cmd-updated {
    margin-bottom: 8px;
}

.bot-cmd-row {
    padding: 8px 10px;
}

.bot-cmd-row-main {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bot-cmd-drag-handle {
    cursor: grab;
    user-select: none;
    color: var(--text-sub);
    line-height: 1;
}

.bot-cmd-switch {
    margin: 0;
    padding: 6px 10px;
    min-width: 112px;
}

.bot-cmd-switch .switch-label {
    font-size: 0.84rem;
}

.bot-cmd-command {
    font-weight: 700;
    min-width: 128px;
    font-size: 0.88rem;
}

.bot-cmd-desc {
    flex: 1;
    min-width: 220px;
    padding: 8px 10px;
    font-size: 0.86rem;
}

.transfer-source-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.transfer-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.transfer-filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.transfer-filter-label {
    font-size: 0.82rem;
    color: var(--text-sub);
    font-weight: 600;
}

.transfer-status-select {
    min-width: 150px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 0.82rem;
    outline: none;
}

.transfer-status-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.transfer-filter-item-keyword {
    margin-left: auto;
}

.transfer-result-input {
    min-width: 300px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 0.82rem;
    outline: none;
}

.transfer-result-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.transfer-source-tab-btn {
    border: 1px solid var(--border);
    background: rgba(148, 163, 184, 0.10);
    color: var(--text-main);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

html:not([data-theme="dark"]) .transfer-source-tab-btn {
    background: #f8fafc;
}

.transfer-source-tab-btn:hover {
    border-color: rgba(99, 102, 241, 0.4);
}

.transfer-source-tab-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* 修复浅色模式下 active 背景被更高优先级规则覆盖，导致白字看不清 */
html:not([data-theme="dark"]) .transfer-source-tab-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.28);
}

.transfer-history-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.transfer-source-block {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: rgba(148, 163, 184, 0.08);
}

html:not([data-theme="dark"]) .transfer-source-block {
    background: #f8fafc;
}

.transfer-source-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.transfer-source-title {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text-main);
}

.transfer-source-meta {
    font-size: 0.8rem;
    color: var(--text-sub);
}

.transfer-table-wrap {
    overflow: auto;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-card);
}

.transfer-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 860px;
}

.transfer-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    text-align: left;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    background: rgba(148, 163, 184, 0.16);
    color: var(--text-main);
    white-space: nowrap;
}

html:not([data-theme="dark"]) .transfer-table thead th {
    background: #f1f5f9;
}

.transfer-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 0.84rem;
    color: var(--text-main);
    vertical-align: top;
}

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

.transfer-time {
    white-space: nowrap;
}

.transfer-result-cell {
    max-width: 360px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.transfer-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.transfer-link:hover {
    text-decoration: underline;
}

.transfer-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 0.76rem;
    font-weight: 700;
    border: 1px solid transparent;
    white-space: nowrap;
}

.transfer-status-badge.status-success {
    color: #047857;
    background: #d1fae5;
    border-color: #a7f3d0;
}

.transfer-status-badge.status-failed {
    color: #b91c1c;
    background: #fee2e2;
    border-color: #fecaca;
}

.transfer-status-badge.status-skipped {
    color: #92400e;
    background: #fef3c7;
    border-color: #fde68a;
}

.transfer-status-badge.status-replace {
    color: #1d4ed8;
    background: #dbeafe;
    border-color: #bfdbfe;
}

.transfer-status-badge.status-unknown {
    color: #4b5563;
    background: #e5e7eb;
    border-color: #d1d5db;
}

.transfer-pagination {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.transfer-page-info {
    font-size: 0.82rem;
    color: var(--text-sub);
}

.transfer-page-btn {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.transfer-page-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.transfer-page-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* 整理历史卡片摘要 */
.organize-cards-wrap {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}

.organize-card {
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: 10px;
    padding: 10px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-main);
}

.organize-card:hover {
    border-color: rgba(99, 102, 241, 0.45);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.organize-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.organize-card-time {
    font-size: 0.78rem;
    color: var(--text-sub);
    white-space: nowrap;
}

.organize-card-runid {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.organize-card-stats {
    font-size: 0.8rem;
    color: var(--text-sub);
}

.organize-card-foot {
    margin-top: 8px;
    font-size: 0.76rem;
    color: var(--text-sub);
    display: flex;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

/* 整理历史详情弹窗 */
.organize-detail-modal {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.organize-detail-mask {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
}

.organize-detail-panel {
    position: relative;
    width: min(1200px, calc(100vw - 36px));
    max-height: calc(100vh - 36px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.organize-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.organize-detail-title-wrap h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-main);
}

.organize-detail-meta {
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-sub);
}

.organize-detail-close-btn {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-main);
    border-radius: 8px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 0.9rem;
}

.organize-detail-close-btn:hover {
    border-color: rgba(99, 102, 241, 0.45);
    color: var(--primary);
}

.organize-detail-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
}

.organize-detail-content {
    padding: 10px 16px;
    overflow: auto;
    flex: 1;
}

.organize-detail-pagination {
    padding: 10px 16px 14px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

body.modal-open {
    overflow: hidden;
}

/* 可视化过滤器弹窗 */
.vf-modal {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.vf-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.62);
    backdrop-filter: blur(3px);
}

.vf-modal-panel {
    position: relative;
    width: min(1380px, calc(100vw - 36px));
    max-height: calc(100vh - 36px);
    height: calc(100vh - 36px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-card);
    box-shadow: 0 26px 50px rgba(0, 0, 0, 0.28);
}

.vf-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.vf-modal-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
}

.vf-modal-subtitle {
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--text-sub);
}

.vf-close-btn {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-main);
    border-radius: 8px;
    padding: 3px 10px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1.2;
    transition: all 0.2s;
}

.vf-close-btn:hover {
    border-color: rgba(99, 102, 241, 0.45);
    color: var(--primary);
}

.vf-modal-body {
    padding: 14px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.vf-columns {
    display: grid;
    grid-template-columns: minmax(310px, 1fr) minmax(360px, 1.15fr) minmax(290px, 0.9fr);
    gap: 12px;
}

.vf-panel {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(148, 163, 184, 0.08);
    padding: 12px;
    min-width: 0;
}

html:not([data-theme="dark"]) .vf-panel {
    background: #f8fafc;
}

.vf-panel h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--text-main);
}

.vf-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.vf-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.vf-scene-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.vf-scene-tab-btn {
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.vf-scene-tab-btn:hover {
    border-color: rgba(99, 102, 241, 0.45);
    color: var(--primary);
}

.vf-scene-tab-btn.active {
    border-color: transparent;
    background: var(--primary);
    color: #fff;
}

.vf-scene-desc {
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--text-sub);
}

.vf-parse-hint {
    margin-top: 8px;
    border: 1px dashed rgba(245, 158, 11, 0.5);
    background: rgba(245, 158, 11, 0.10);
    color: #b45309;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 0.78rem;
    line-height: 1.45;
}

html[data-theme="dark"] .vf-parse-hint {
    color: #facc15;
    border-color: rgba(250, 204, 21, 0.45);
    background: rgba(234, 179, 8, 0.14);
}

.vf-search-row {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) 130px auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.vf-select {
    min-width: 0;
}

.vf-inline-status {
    min-height: 20px;
    font-size: 0.78rem;
    color: var(--text-sub);
    margin-bottom: 8px;
}

.vf-search-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 58vh;
    overflow: auto;
    padding-right: 2px;
}

.vf-result-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-card);
    padding: 8px;
    display: grid;
    grid-template-columns: 62px 1fr auto;
    gap: 9px;
    align-items: start;
}

.vf-result-poster {
    width: 62px;
    aspect-ratio: 2 / 3;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-sub);
    font-size: 0.72rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.vf-result-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.vf-result-title {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text-main);
}

.vf-result-meta {
    margin-top: 3px;
    font-size: 0.74rem;
    color: var(--text-sub);
}

.vf-result-overview {
    margin-top: 6px;
    font-size: 0.77rem;
    color: var(--text-sub);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.vf-selected-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 58vh;
    overflow: auto;
}

.vf-selected-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-card);
    padding: 10px;
    display: grid;
    grid-template-columns: 68px 1fr;
    gap: 10px;
    min-width: 0;
}

.vf-selected-poster {
    width: 68px;
    aspect-ratio: 2 / 3;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-sub);
    font-size: 0.72rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.vf-selected-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.vf-selected-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.vf-card-input {
    font-size: 0.82rem;
    padding-top: 9px;
    padding-bottom: 9px;
}

.vf-card-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.vf-card-select {
    min-width: 0;
    font-size: 0.82rem;
    padding-top: 9px;
    padding-bottom: 9px;
}

.vf-selected-card-custom {
    border-style: dashed;
    border-color: rgba(99, 102, 241, 0.35);
}

html[data-theme="dark"] .vf-selected-card-custom {
    border-color: rgba(129, 140, 248, 0.52);
    background: rgba(99, 102, 241, 0.08);
}

.vf-selected-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.vf-year-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-sub);
}

.vf-year-input {
    width: 90px;
    min-width: 0;
    font-size: 0.8rem;
    padding: 7px 10px;
}

.vf-all-mode-card {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px dashed rgba(16, 185, 129, 0.45);
    border-radius: 10px;
    background: rgba(16, 185, 129, 0.08);
    color: #065f46;
    padding: 10px 12px;
    margin-bottom: 10px;
}

.vf-all-mode-icon {
    font-size: 1.2rem;
}

.vf-all-mode-title {
    font-size: 0.86rem;
    font-weight: 800;
}

.vf-all-mode-desc {
    margin-top: 2px;
    font-size: 0.76rem;
    line-height: 1.45;
}

html[data-theme="dark"] .vf-all-mode-card {
    color: #a7f3d0;
    border-color: rgba(16, 185, 129, 0.55);
    background: rgba(16, 185, 129, 0.16);
}

.vf-mode-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.vf-radio-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-main);
}

.vf-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-sub);
    margin-bottom: 6px;
}

.vf-textarea {
    width: 100%;
    min-height: 145px;
    max-height: 280px;
    resize: none;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(148, 163, 184, 0.08);
    color: var(--text-main);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.8rem;
    line-height: 1.5;
    font-family: "Cascadia Code", "Consolas", monospace;
}

html:not([data-theme="dark"]) .vf-textarea {
    border-color: #e5e7eb;
    background: #f8fafc;
}

.vf-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.vf-save-actions {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.vf-save-tip {
    font-size: 0.8rem;
    line-height: 1.45;
    color: #92400e;
    background: rgba(251, 191, 36, 0.18);
    border: 1px solid rgba(251, 191, 36, 0.55);
    border-radius: 10px;
    padding: 8px 10px;
}

.vf-save-actions .vf-btn {
    align-self: flex-end;
}

.vf-save-tip strong {
    color: #b45309;
}

html[data-theme="dark"] .vf-save-tip {
    color: #fde68a;
    background: rgba(245, 158, 11, 0.18);
    border-color: rgba(251, 191, 36, 0.5);
}

html[data-theme="dark"] .vf-save-tip strong {
    color: #fcd34d;
}

.vf-btn {
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.vf-btn:hover {
    transform: translateY(-1px);
}

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

.vf-btn-primary {
    border-color: transparent;
    background: var(--primary);
    color: #fff;
}

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

.vf-btn-ghost {
    border-style: dashed;
    color: var(--primary);
}

.vf-btn-ghost:hover:not(:disabled) {
    border-color: var(--primary);
    background: var(--primary-light);
}

.vf-btn-danger {
    border-color: rgba(239, 68, 68, 0.35);
    color: #dc2626;
    background: rgba(239, 68, 68, 0.08);
}

.vf-btn-danger:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.14);
}

html[data-theme="dark"] .vf-btn-danger {
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.45);
    background: rgba(239, 68, 68, 0.14);
}

.vf-empty {
    border: 1px dashed var(--border);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-sub);
    background: rgba(148, 163, 184, 0.05);
}

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

    .vf-search-results,
    .vf-selected-list {
        max-height: 320px;
    }
}

@media (max-width: 768px) {
    .vf-modal {
        padding: 8px;
    }

    .vf-modal-panel {
        width: calc(100vw - 10px);
        max-height: calc(100vh - 10px);
        height: calc(100vh - 10px);
        border-radius: 10px;
    }

    .vf-modal-head,
    .vf-modal-body {
        padding: 10px;
    }

    .vf-search-row {
        grid-template-columns: 1fr;
    }

    .vf-result-card {
        grid-template-columns: 54px 1fr;
    }

    .vf-result-card .vf-btn {
        grid-column: 1 / -1;
        justify-self: flex-end;
    }

    .vf-selected-card {
        grid-template-columns: 56px 1fr;
    }

    .vf-card-row {
        grid-template-columns: 1fr;
    }

    .vf-year-wrap {
        width: 100%;
    }

    .vf-inline-preview {
        min-height: 82px;
    }
}

html[data-theme="dark"] .transfer-status-badge.status-success {
    color: #6ee7b7;
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.35);
}

html[data-theme="dark"] .transfer-status-badge.status-failed {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.35);
}

html[data-theme="dark"] .transfer-status-badge.status-skipped {
    color: #fcd34d;
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.35);
}

html[data-theme="dark"] .transfer-status-badge.status-replace {
    color: #93c5fd;
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.35);
}

html[data-theme="dark"] .transfer-status-badge.status-unknown {
    color: #d1d5db;
    background: rgba(148, 163, 184, 0.2);
    border-color: rgba(148, 163, 184, 0.35);
}

@media (max-width: 768px) {
    .transfer-history-actions {
        width: 100%;
        justify-content: space-between;
    }

    .transfer-history-refresh-btn {
        padding: 7px 10px;
    }

    .bot-cmd-row-main {
        flex-wrap: wrap;
        gap: 6px;
    }

    .bot-cmd-switch {
        min-width: 0;
    }

    .bot-cmd-command {
        min-width: 0;
    }

    .bot-cmd-desc {
        min-width: 0;
        width: 100%;
    }

    .transfer-pagination {
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .transfer-filter-item {
        width: 100%;
    }

    .transfer-status-select {
        width: 100%;
    }

    .transfer-filter-item-keyword {
        margin-left: 0;
    }

    .transfer-result-input {
        width: 100%;
        min-width: 0;
    }

    .organize-detail-panel {
        width: calc(100vw - 14px);
        max-height: calc(100vh - 14px);
        border-radius: 10px;
    }

    .organize-detail-header,
    .organize-detail-filters,
    .organize-detail-content,
    .organize-detail-pagination {
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* Toast */
.toast-container {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: #1f2937;
    color: white;
    padding: 10px 24px;
    border-radius: 99px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    animation: fadeDown 0.3s;
}

@keyframes fadeDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* SSH 终端容器 */
.ssh-terminal-container {
    background: #000000;
    padding: 10px;
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    height: 500px;
    /* 固定高度，或者根据需要调整 */
    position: relative;
}

/* 隐藏 xterm 的滚动条，使用容器的 */
.xterm-viewport {
    overflow-y: auto !important;
}

/* ====== SSH 头部美化 ====== */
.ssh-header {
    display: flex;
    justify-content: space-between;
    /* 左右对齐 */
    align-items: center;
    /* 垂直居中 */
    margin-bottom: 20px;
    /* 增加底部间距 */
    padding: 0 4px;
    flex-wrap: wrap;
    /* 手机端自动换行 */
    gap: 12px;
}

/* 左侧标题区域 - 修复对齐问题 */
.ssh-header-main {
    display: flex;
    align-items: center;
    /* 垂直居中核心代码 */
    gap: 10px;
}

.ssh-header-icon {
    font-size: 1.6rem;
    line-height: 1;
    /* 关键：强制行高为 1，消除上下间隙 */

    /* 额外技巧：让 Emoji 自身也居中，并微调位置 */
    display: flex;
    align-items: center;
    justify-content: center;

    /* 微调：Emoji 视觉上通常偏高，往下压 1-2px 会更协调 */
    transform: translateY(2px);

    /* 阴影增加立体感 */
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.1));
}

.ssh-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #111827;
    letter-spacing: -0.5px;
    line-height: 1;
    /* 保持标题行高紧凑 */

    /* 渐变色文字效果（可选，不喜欢可以删掉 background 相关属性） */
    background: linear-gradient(135deg, #1f2937 0%, #4b5563 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

html[data-theme="dark"] .ssh-title {
    background: linear-gradient(135deg, #e5e7eb 0%, #9ca3af 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 右侧（或下方）的安全提示胶囊 */
.ssh-tip-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #ecfdf5;
    /* 淡绿色背景 (安全感) */
    border: 1px solid #d1fae5;
    padding: 6px 12px;
    border-radius: 99px;
    /* 胶囊形状 */
    font-size: 0.8rem;
    color: #047857;
    /* 深绿色文字 */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    max-width: 100%;
}

html[data-theme="dark"] .ssh-tip-box {
    background-color: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.25);
    color: #6ee7b7;
}

.ssh-tip-icon {
    font-size: 1rem;
}

.ssh-tip-text b {
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-decoration-color: #10b981;
}

/* 移动端适配：变为垂直排列 */
@media (max-width: 600px) {
    .ssh-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .ssh-tip-box {
        width: 100%;
        border-radius: 8px;
        /* 手机上改圆角矩形 */
        justify-content: center;
    }
}

/* =========================================
   SSH 配置栏样式优化 (Flex 布局)
   ========================================= */
.ssh-config {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-card);
    padding: 20px;

    /* 改用 Flex 布局，自动换行，对齐底部 */
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
    /* 让按钮和输入框底部对齐 */

    margin-bottom: 16px;
}

.ssh-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    /* 自动撑开宽度 */
    min-width: 140px;
    /* 防止太窄 */
}

/* 针对端口号输入框，让它窄一点，看起来更协调 */
.ssh-field:nth-child(2) {
    flex: 0.4;
    min-width: 80px;
}

.ssh-label {
    font-size: 13px;
    color: #4b5563;
    font-weight: 600;
    margin-left: 2px;
}

.ssh-input {
    width: 100%;
    height: 40px;
    /* 固定高度 */
    padding: 0 12px;
    border: 1px solid rgba(148, 163, 184, 0.20);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.55);
    outline: none;
    font-size: 14px;
    font-family: 'Inter', monospace;
    /* 数字显示更好看 */
    transition: all 0.2s;
    color: var(--text-main);
}

html:not([data-theme="dark"]) .ssh-input {
    border-color: #d1d5db;
    background: #fff;
    color: #1f2937;
}

.ssh-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* 按钮样式优化 */
.ssh-save,
.ssh-connect {
    height: 40px;
    /* 与输入框高度一致 */
    padding: 0 20px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
}

.ssh-save {
    background: #eff6ff;
    color: var(--primary);
    border: 1px solid transparent;
}

html[data-theme="dark"] .ssh-save {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
}

.ssh-save:hover {
    background: #dbeafe;
    border-color: #bfdbfe;
}

html[data-theme="dark"] .ssh-save:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.35);
}

.ssh-connect {
    background: #10b981;
    color: #fff;
    box-shadow: 0 2px 5px rgba(16, 185, 129, 0.2);
}

.ssh-connect:hover {
    background: #059669;
    transform: translateY(-1px);
}

.ssh-connect:active {
    transform: translateY(0);
}

.ssh-connect:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 连接成功后的状态 */
.ssh-connect.connected {
    background: #ef4444;
    /* 变成红色断开按钮 */
    box-shadow: none;
}

.ssh-connect.connected:hover {
    background: #dc2626;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .ssh-config {
        flex-direction: column;
        /* 手机上垂直排列 */
        align-items: stretch;
        gap: 12px;
    }

    .ssh-field,
    .ssh-field:nth-child(2) {
        width: 100%;
        flex: none;
    }

    .ssh-save,
    .ssh-connect {
        width: 100%;
        margin-top: 4px;
    }
}

/* Pansou 3列自适应网格 - 强制覆盖默认单列/双列样式 */
.pansou-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 10px;
}

@media (max-width: 768px) {
    .pansou-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 480px) {
    .pansou-grid {
        grid-template-columns: 1fr !important;
    }
}

/* 后缀名 4列自适应网格 */
.ext-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 10px;
}

@media (max-width: 1024px) {
    .ext-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .ext-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .ext-grid[data-key="ENV_123_STRM_EXTS"],
    .ext-grid[data-key="ENV_123_STRM_DL_EXTS"],
    .ext-grid[data-key="ENV_123_ORGANIZE_MEDIA_EXTS"],
    .ext-grid[data-key="ENV_123_ORGANIZE_SUBS_EXTS"],
    .ext-grid[data-key="ENV_123_MAGNET_VIDEO_EXTS"],
    .ext-grid[data-key="ENV_123_MAGNET_EXCLUDED_KEYWORDS"],
    .ext-grid[data-key="ENV_115_ORGANIZE_MEDIA_EXTS"],
    .ext-grid[data-key="ENV_115_ORGANIZE_SUBS_EXTS"] {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 6px;
    }

    .ext-grid[data-key="ENV_123_STRM_EXTS"] .value-list-card,
    .ext-grid[data-key="ENV_123_STRM_DL_EXTS"] .value-list-card,
    .ext-grid[data-key="ENV_123_ORGANIZE_MEDIA_EXTS"] .value-list-card,
    .ext-grid[data-key="ENV_123_ORGANIZE_SUBS_EXTS"] .value-list-card,
    .ext-grid[data-key="ENV_123_MAGNET_VIDEO_EXTS"] .value-list-card,
    .ext-grid[data-key="ENV_123_MAGNET_EXCLUDED_KEYWORDS"] .value-list-card,
    .ext-grid[data-key="ENV_115_ORGANIZE_MEDIA_EXTS"] .value-list-card,
    .ext-grid[data-key="ENV_115_ORGANIZE_SUBS_EXTS"] .value-list-card {
        flex-direction: row;
        align-items: center;
        gap: 6px;
        padding: 6px;
    }

    .ext-grid[data-key="ENV_123_STRM_EXTS"] .vl-input,
    .ext-grid[data-key="ENV_123_STRM_DL_EXTS"] .vl-input,
    .ext-grid[data-key="ENV_123_ORGANIZE_MEDIA_EXTS"] .vl-input,
    .ext-grid[data-key="ENV_123_ORGANIZE_SUBS_EXTS"] .vl-input,
    .ext-grid[data-key="ENV_123_MAGNET_VIDEO_EXTS"] .vl-input,
    .ext-grid[data-key="ENV_123_MAGNET_EXCLUDED_KEYWORDS"] .vl-input,
    .ext-grid[data-key="ENV_115_ORGANIZE_MEDIA_EXTS"] .vl-input,
    .ext-grid[data-key="ENV_115_ORGANIZE_SUBS_EXTS"] .vl-input {
        padding: 6px 4px;
        font-size: 0.82rem;
        text-align: center;
    }

    .ext-grid[data-key="ENV_123_STRM_EXTS"] .vl-delete-btn,
    .ext-grid[data-key="ENV_123_STRM_DL_EXTS"] .vl-delete-btn,
    .ext-grid[data-key="ENV_123_ORGANIZE_MEDIA_EXTS"] .vl-delete-btn,
    .ext-grid[data-key="ENV_123_ORGANIZE_SUBS_EXTS"] .vl-delete-btn,
    .ext-grid[data-key="ENV_123_MAGNET_VIDEO_EXTS"] .vl-delete-btn,
    .ext-grid[data-key="ENV_123_MAGNET_EXCLUDED_KEYWORDS"] .vl-delete-btn,
    .ext-grid[data-key="ENV_115_ORGANIZE_MEDIA_EXTS"] .vl-delete-btn,
    .ext-grid[data-key="ENV_115_ORGANIZE_SUBS_EXTS"] .vl-delete-btn {
        width: 22px;
        height: 22px;
        font-size: 1rem;
        align-self: center;
    }
}

@media (max-width: 480px) {
    .ext-grid {
        grid-template-columns: 1fr !important;
    }

    .ext-grid[data-key="ENV_123_STRM_EXTS"],
    .ext-grid[data-key="ENV_123_STRM_DL_EXTS"],
    .ext-grid[data-key="ENV_123_ORGANIZE_MEDIA_EXTS"],
    .ext-grid[data-key="ENV_123_ORGANIZE_SUBS_EXTS"],
    .ext-grid[data-key="ENV_123_MAGNET_VIDEO_EXTS"],
    .ext-grid[data-key="ENV_123_MAGNET_EXCLUDED_KEYWORDS"],
    .ext-grid[data-key="ENV_115_ORGANIZE_MEDIA_EXTS"],
    .ext-grid[data-key="ENV_115_ORGANIZE_SUBS_EXTS"] {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

/* 复选框网格布局 (Douban Hot) */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.checkbox-card {
    background: rgba(148, 163, 184, 0.10);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: var(--radius-m);
    padding: 10px 12px;
    transition: all 0.2s;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    user-select: none;
    font-size: 0.9rem;
    color: var(--text-main);
    font-weight: 500;
}

html:not([data-theme="dark"]) .checkbox-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
}

.checkbox-card:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

html[data-theme="dark"] .checkbox-card:hover {
    background: rgba(148, 163, 184, 0.15);
    border-color: rgba(148, 163, 184, 0.25);
}

.checkbox-card.checked {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.checkbox-card input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

/* ===============================
   Emby 仪表盘
   =============================== */
.emby-dashboard-wrap {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.emby-dashboard-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.emby-dashboard-title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-main);
}

.emby-dashboard-date {
    margin-top: 4px;
    font-size: 0.8rem;
    color: #9ca3af;
    font-weight: 700;
}

.emby-dashboard-tip {
    margin-top: 6px;
    font-size: 0.76rem;
    color: #94a3b8;
    line-height: 1.5;
}

.emby-dashboard-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.emby-config-btn {
    border: 1px solid rgba(59, 130, 246, 0.25);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(37, 99, 235, 0.08));
    color: #2563eb;
    border-radius: 12px;
    padding: 9px 14px;
    font-size: 0.86rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
}

.emby-config-btn:hover {
    border-color: #3b82f6;
    color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.emby-refresh-btn {
    border: 1px solid rgba(16, 185, 129, 0.28);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.14), rgba(5, 150, 105, 0.08));
    color: #047857;
    border-radius: 12px;
    padding: 9px 14px;
    font-size: 0.86rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
}

.emby-refresh-btn:hover:not(:disabled) {
    border-color: #10b981;
    color: #065f46;
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(16, 185, 129, 0.22);
}

.emby-refresh-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.emby-setup-panel {
    border: 1px solid rgba(59, 130, 246, 0.18);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.06), rgba(59, 130, 246, 0.02));
    padding: 18px;
}

.emby-setup-card {
    max-width: 760px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-card);
    padding: 18px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.emby-setup-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.2px;
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}

.emby-setup-title {
    margin-top: 10px;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
}

.emby-setup-desc {
    margin-top: 6px;
    color: #9ca3af;
    font-size: 0.83rem;
    line-height: 1.5;
}

.emby-setup-desc code {
    background: rgba(148, 163, 184, 0.16);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 6px;
    padding: 1px 6px;
    color: var(--text-main);
    font-size: 0.78rem;
}

.emby-setup-form {
    margin-top: 14px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
}

.emby-setup-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #64748b;
}

.emby-setup-input {
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    border-radius: 12px;
    padding: 11px 12px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.emby-setup-input:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.22);
}

.emby-setup-password-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.emby-setup-password-wrap .emby-setup-input {
    width: 100%;
    padding-right: 44px;
}

.emby-setup-toggle-key {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
}

.emby-setup-toggle-key:hover {
    background: rgba(148, 163, 184, 0.18);
}

.emby-setup-actions {
    margin-top: 8px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.emby-setup-btn {
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.86rem;
    font-weight: 800;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.emby-setup-btn.primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-color: #2563eb;
    color: #fff;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.28);
}

.emby-setup-btn.secondary {
    background: rgba(148, 163, 184, 0.08);
    color: #334155;
}

.emby-setup-btn.danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.25);
    color: #dc2626;
}

.emby-setup-btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.emby-setup-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.emby-setup-result {
    min-height: 24px;
    margin-top: 4px;
    font-size: 0.82rem;
    border-radius: 10px;
    padding: 7px 10px;
    border: 1px solid transparent;
}

.emby-setup-result.info {
    color: #64748b;
    background: rgba(148, 163, 184, 0.08);
    border-color: rgba(148, 163, 184, 0.22);
}

.emby-setup-result.success {
    color: #059669;
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.22);
}

.emby-setup-result.error {
    color: #dc2626;
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.25);
}

.emby-setup-tip {
    margin-top: 2px;
    font-size: 0.75rem;
    color: #94a3b8;
}

.emby-user-select {
    min-width: 220px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 0.9rem;
    font-weight: 600;
}

.emby-live-btn {
    position: relative;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    border-radius: 10px;
    width: 40px;
    height: 40px;
    cursor: pointer;
}

.emby-live-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.hidden {
    display: none !important;
}

.emby-live-dropdown {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-card);
    overflow: hidden;
}

.emby-live-head {
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    font-weight: 700;
}

.emby-live-list {
    max-height: 320px;
    overflow: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.emby-live-item {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 10px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
}

.emby-live-item img {
    width: 48px;
    height: 68px;
    object-fit: cover;
    border-radius: 8px;
    background: #111827;
}

.emby-live-title {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.emby-live-meta {
    margin-top: 2px;
    font-size: 0.75rem;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.emby-live-progress {
    margin-top: 8px;
    height: 6px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.25);
    overflow: hidden;
}

.emby-live-progress span {
    display: block;
    height: 100%;
    background: #3b82f6;
}

.emby-metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.emby-metric-card {
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: 12px;
    padding: 12px;
}

.emby-metric-label {
    font-size: 0.76rem;
    color: #9ca3af;
    font-weight: 700;
}

.emby-metric-value {
    margin-top: 6px;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
}

.emby-panel {
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: 12px;
    padding: 12px;
}

.emby-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.emby-panel-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 10px;
}

.emby-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.emby-library-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    background: var(--bg-card);
}

.emby-library-card img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    background: #0f172a;
}

.emby-library-name {
    font-size: 0.85rem;
    font-weight: 700;
    padding: 8px;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.emby-two-cols {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.emby-poster-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
    gap: 10px;
}

.emby-poster-card {
    text-decoration: none;
    color: inherit;
}

.emby-poster-card img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #0f172a;
}

.emby-poster-title {
    margin-top: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.emby-poster-meta {
    margin-top: 2px;
    font-size: 0.72rem;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.emby-trend-actions {
    display: inline-flex;
    gap: 6px;
}

.emby-trend-btn {
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.emby-trend-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

.emby-chart-box {
    height: 260px;
}

.emby-top-users {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 320px;
    overflow: auto;
}

.emby-user-row {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    gap: 10px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
}

.emby-user-rank {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 800;
}

.emby-user-name {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-main);
}

.emby-user-meta {
    font-size: 0.72rem;
    color: #9ca3af;
}

.emby-user-time {
    font-size: 0.84rem;
    font-weight: 800;
    color: var(--text-main);
}

.emby-loading,
.emby-empty,
.emby-error {
    text-align: center;
    padding: 16px 8px;
    font-size: 0.85rem;
    color: #9ca3af;
}

.emby-error {
    color: #ef4444;
}

/* ===============================
   Emby 反代配置页
   =============================== */
.emby-proxy-wrap {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.emby-proxy-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.emby-proxy-title {
    margin: 0;
    font-size: 1.28rem;
    font-weight: 800;
    color: var(--text-main);
}

.emby-proxy-tip {
    margin-top: 6px;
    font-size: 0.8rem;
    color: #94a3b8;
    line-height: 1.6;
}

.emby-proxy-tip code {
    background: rgba(148, 163, 184, 0.16);
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 6px;
    padding: 1px 6px;
    color: var(--text-main);
    font-size: 0.76rem;
}

.emby-proxy-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.emby-proxy-btn {
    border-radius: 12px;
    padding: 9px 14px;
    font-size: 0.86rem;
    font-weight: 800;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.emby-proxy-btn.primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-color: #2563eb;
    color: #fff;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}

.emby-proxy-btn.secondary {
    background: rgba(148, 163, 184, 0.08);
    color: #334155;
}

.emby-proxy-btn.danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.25);
    color: #dc2626;
}

.emby-proxy-btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.emby-proxy-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.emby-proxy-result {
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 0.82rem;
    border: 1px solid transparent;
}

.emby-proxy-result.info {
    color: #64748b;
    background: rgba(148, 163, 184, 0.08);
    border-color: rgba(148, 163, 184, 0.22);
}

.emby-proxy-result.success {
    color: #059669;
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.22);
}

.emby-proxy-result.error {
    color: #dc2626;
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.25);
}

.emby-proxy-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.emby-proxy-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    background: var(--bg-card);
    box-shadow: 0 4px 14px rgba(2, 6, 23, 0.04);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.emby-proxy-card-head {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.emby-proxy-name-input {
    min-width: 0;
    max-width: none;
}

.emby-proxy-card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: stretch;
}

.emby-proxy-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.emby-proxy-field>span {
    font-size: 0.74rem;
    color: #64748b;
    font-weight: 700;
}

.emby-proxy-input {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 0.84rem;
}

.emby-proxy-input:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

.emby-proxy-api-wrap {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px;
}

.emby-proxy-mini-btn {
    border: 1px solid var(--border);
    background: rgba(148, 163, 184, 0.08);
    color: var(--text-main);
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
}

.emby-proxy-mini-btn:hover {
    border-color: #94a3b8;
}

.emby-proxy-mini-btn.danger {
    color: #dc2626;
    border-color: rgba(239, 68, 68, 0.28);
    background: rgba(239, 68, 68, 0.1);
}

.emby-proxy-mini-btn.success {
    color: #065f46;
    border-color: rgba(16, 185, 129, 0.28);
    background: rgba(16, 185, 129, 0.1);
}

.emby-proxy-mini-btn.primary {
    color: #1d4ed8;
    border-color: rgba(59, 130, 246, 0.32);
    background: rgba(59, 130, 246, 0.1);
}

.emby-proxy-center {
    text-align: center;
}

.emby-proxy-status {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
}

.emby-proxy-status.running {
    color: #065f46;
    background: rgba(16, 185, 129, 0.16);
}

.emby-proxy-status.stopped {
    color: #92400e;
    background: rgba(251, 191, 36, 0.2);
}

.emby-proxy-status.disabled {
    color: #475569;
    background: rgba(148, 163, 184, 0.18);
}

.emby-proxy-status-error {
    margin-top: 4px;
    font-size: 0.72rem;
    color: #dc2626;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.emby-proxy-row-actions {
    display: inline-flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.emby-proxy-hidden-flag {
    display: none;
}

.emby-proxy-empty {
    text-align: center;
    color: #94a3b8;
    font-size: 0.84rem;
    padding: 22px 8px;
    border: 1px dashed rgba(148, 163, 184, 0.35);
    border-radius: 12px;
}

@media (max-width: 1200px) {
    .emby-proxy-cards {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 980px) {
    .emby-metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .emby-two-cols {
        grid-template-columns: 1fr;
    }

    .emby-proxy-cards {
        grid-template-columns: 1fr;
    }

    .emby-proxy-card-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .emby-user-select {
        min-width: 150px;
    }

    /* 手机视图：我的媒体库至少 2 列 */
    #emby-library-container.emby-library-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* 手机视图：最近入库至少 3 列 */
    #emby-latest-container.emby-poster-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    /* 手机视图：继续播放至少 3 列 */
    #emby-recent-container.emby-poster-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .emby-metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .emby-metric-value {
        font-size: 1.3rem;
    }
}
