/* === 作品记录页样式 (高级极简商业版) === */

.works-page {
    background: #0f1015; /* 极深渊色背景 */
    color: #e2e8f0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
}

/* --- 顶部导航 --- */
.works-nav {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: rgba(15, 16, 21, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 10;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
}

.nav-back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #9ca3af;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
    width: 100px;
}

.nav-back-btn:hover {
    color: #ffffff;
}

.nav-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #f3f4f6;
}

/* --- 页面主体结构 --- */
.works-container {
    display: flex;
    flex: 1;
    overflow: visible;
    min-height: 0;
    padding-top: 60px;
}

/* --- 左侧边栏 --- */
.works-sidebar {
    width: 240px;
    background: rgba(20, 21, 28, 0.4);
    border-right: 1px solid rgba(255, 255, 255, 0.03);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    overflow-y: auto;
}

.works-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.works-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: #9ca3af;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.works-menu-item:hover {
    background: rgba(255, 255, 255, 0.03);
    color: #d1d5db;
}

.works-menu-item.active {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* --- 右侧主内容区 --- */
.works-main {
    flex: 1;
    overflow: visible;
    padding: 32px 40px;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
    display: flex;
    flex-direction: column;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.works-main::-webkit-scrollbar {
    width: 6px;
}
.works-main::-webkit-scrollbar-thumb {
    background-color: rgba(255,255,255,0.2);
    border-radius: 3px;
}

.works-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 32px;
    width: 100%; /* 确保头部也占满 */
    gap: 20px;
}

.works-retention-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: -14px 0 24px;
    padding: 13px 15px;
    border: 1px solid rgba(129, 140, 248, 0.16);
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.07);
    color: #c7d2fe;
}

.works-retention-notice svg { flex: 0 0 auto; margin-top: 1px; }
.works-retention-notice > div { display: flex; flex-direction: column; gap: 3px; }
.works-retention-notice strong { font-size: 13px; font-weight: 600; }
.works-retention-notice span { color: #9ca3af; font-size: 12px; line-height: 1.55; }
.works-retention-copy { min-width: 0; flex: 1 1 auto; }
.works-storage-usage {
    width: min(330px, 34vw);
    flex: 0 0 auto;
    gap: 8px !important;
    margin-left: auto;
}
.works-storage-usage[hidden] { display: none !important; }
.works-storage-label { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.works-storage-label span { color: rgba(211, 223, 241, .62); font-size: 11px; }
.works-storage-label strong { color: #eef7ff; font-size: 11px; font-variant-numeric: tabular-nums; }
.works-storage-track { height: 5px; overflow: hidden; border-radius: 999px; background: rgba(255, 255, 255, .08); }
.works-storage-track > span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #43c8ff, #756cff); transition: width .35s ease; }
.works-storage-usage.is-near-limit .works-storage-track > span { background: linear-gradient(90deg, #ffb454, #ff6b75); }

.works-header-main {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.works-header h2 {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
    color: #ffffff;
}

.works-stats {
    font-size: 13px;
    color: #6b7280;
}

.works-header-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
    gap: 12px;
    flex-wrap: wrap;
}

.works-batch-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: auto;
}

.works-batch-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: #f3f4f6;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.works-batch-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.works-batch-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.works-batch-btn.danger {
    color: #fecaca;
    border-color: rgba(239, 68, 68, 0.18);
    background: rgba(127, 29, 29, 0.2);
}

.works-batch-btn.danger:hover {
    background: rgba(127, 29, 29, 0.3);
}

.works-upload-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    padding: 0 18px;
    border-radius: 14px;
}

.works-search-box {
    width: min(360px, 100%);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    height: 42px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: #9ca3af;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.works-search-box:focus-within {
    border-color: rgba(129, 140, 248, 0.3);
    color: #d1d5db;
}

.works-search-box input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: #f3f4f6;
    font-size: 14px;
}

.works-search-box input::placeholder {
    color: #6b7280;
}

.works-category-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 28px;
}

.works-category-chip {
    height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: #9ca3af;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.works-category-chip.active,
.works-category-chip:hover {
    color: #fff;
    border-color: rgba(129, 140, 248, 0.24);
    background: rgba(99, 102, 241, 0.14);
}

/* --- 状态视图 --- */
.works-loading, .works-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    color: #6b7280;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

.works-empty svg {
    color: #4b5563;
    margin-bottom: 16px;
}

.works-empty p {
    font-size: 15px;
    margin-bottom: 24px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-primary:hover {
    opacity: 0.9;
}

/* --- 网格布局 (图片/视频) --- */
.works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
    align-items: start;
    width: 100%;
}

/* 列表布局 (对话) */
.works-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 1000px; /* 控制整个列表的最大宽度 */
    align-items: stretch; /* 强制子元素拉伸 */
}

/* --- 卡片项 (通用) --- */
.work-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
    box-sizing: border-box;
}

.work-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
}

/* 图片/视频卡片 */
.work-card.media-card {
    aspect-ratio: 1; /* 正方形网格 */
    width: 100%; /* 在网格中占满分配的空间 */
}

.works-grid.is-selection-mode .work-card.media-card {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.works-grid.is-selection-mode .work-card:hover {
    transform: none;
}

.works-grid.is-selection-mode .history-select-toggle {
    transition: opacity 0.14s ease, background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.works-grid.is-drag-selecting .work-card.media-card,
.works-grid.is-drag-selecting .history-select-toggle {
    cursor: crosshair;
}

.work-card.is-selected {
    border-color: rgba(129, 140, 248, 0.42);
    box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.3), 0 12px 24px rgba(0, 0, 0, 0.4);
}

.media-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #1a1b23;
}

.media-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 16px;
}

.work-card:hover .media-overlay {
    opacity: 1;
}

.media-kind-chip {
    position: absolute;
    top: 14px;
    left: 14px;
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(12, 14, 20, 0.76);
    color: #e5e7eb;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    backdrop-filter: blur(10px);
}

.media-source-chip {
    position: absolute;
    top: 14px;
    right: 14px;
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(167, 139, 250, 0.2);
    background: rgba(44, 27, 78, 0.72);
    color: #e9d5ff;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    backdrop-filter: blur(10px);
}

.media-expiry-chip {
    position: absolute;
    top: 14px;
    right: 14px;
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 10px;
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-radius: 999px;
    background: rgba(69, 46, 9, 0.72);
    color: #fde68a;
    font-size: 11px;
    font-weight: 600;
    backdrop-filter: blur(10px);
    z-index: 2;
}

.history-select-toggle {
    position: absolute;
    top: 48px;
    right: 14px;
    z-index: 3;
    height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(12, 14, 20, 0.76);
    color: #f9fafb;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(10px);
    opacity: 0;
    transition: all 0.2s ease;
}

.work-card:hover .history-select-toggle,
.works-grid.is-selection-mode .history-select-toggle,
.history-select-toggle.is-selected {
    opacity: 1;
}

.history-select-toggle.is-selected {
    background: rgba(76, 29, 149, 0.8);
    border-color: rgba(167, 139, 250, 0.3);
    color: #ede9fe;
}

.media-prompt {
    font-size: 12px;
    color: #e2e8f0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
    line-height: 1.4;
}

.media-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #9ca3af;
}

.media-card-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.24s ease, transform 0.24s ease;
    pointer-events: none;
}

.work-card:hover .media-card-actions {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.media-card-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 30px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(17, 18, 25, 0.78);
    color: #f3f4f6;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.media-card-btn.primary {
    color: #ddd6fe;
    border-color: rgba(167, 139, 250, 0.22);
    background: rgba(76, 29, 149, 0.28);
}

.media-card-btn.primary:hover {
    border-color: rgba(167, 139, 250, 0.32);
    background: rgba(91, 33, 182, 0.42);
}

.media-card-btn.is-disabled,
.media-card-btn.is-disabled:hover {
    color: rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    cursor: not-allowed;
}

.media-card-btn:hover {
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(29, 30, 41, 0.92);
}

.media-card-btn.danger {
    color: #fca5a5;
}

.media-card-btn.danger:hover {
    border-color: rgba(239, 68, 68, 0.28);
    background: rgba(127, 29, 29, 0.3);
}

.video-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    pointer-events: none;
}

/* 对话卡片 (列表) */
.work-card.chat-card {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%; /* 确保填满列表容器 */
    box-sizing: border-box;
}

.chat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-title {
    font-size: 16px;
    font-weight: 500;
    color: #f3f4f6;
    margin: 0;
}

.chat-meta {
    font-size: 12px;
    color: #6b7280;
}

.chat-model {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
    font-size: 11px;
    color: #9ca3af;
}

/* --- 预览弹窗 --- */
.preview-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.preview-close {
    position: absolute;
    top: 24px;
    right: 24px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 1001;
}

.preview-close:hover {
    background: rgba(255,255,255,0.2);
}

.preview-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    overflow: hidden;
}

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

.preview-info {
    padding: 24px 40px;
    background: linear-gradient(to top, rgba(0,0,0,1), transparent);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
}

.preview-prompt {
    flex: 1;
    color: #e2e8f0;
    font-size: 14px;
    line-height: 1.6;
    max-height: 80px;
    overflow-y: auto;
}

.preview-download-btn {
    background: rgba(255,255,255,0.1);
    color: white;
    text-decoration: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
    white-space: nowrap;
}

.preview-download-btn:hover {
    background: rgba(255,255,255,0.2);
}

.works-asset-editor {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.works-asset-editor-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 5, 10, 0.72);
    backdrop-filter: blur(18px);
    opacity: 0;
    transition: opacity 0.24s ease;
}

.works-asset-editor-panel {
    position: relative;
    width: min(920px, 100%);
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(19, 22, 31, 0.98), rgba(10, 12, 18, 0.96));
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.45);
    transform: translateY(16px) scale(0.98);
    opacity: 0;
    transition: transform 0.24s ease, opacity 0.24s ease;
    overflow: hidden;
}

.works-asset-editor.is-visible .works-asset-editor-backdrop {
    opacity: 1;
}

.works-asset-editor.is-visible .works-asset-editor-panel {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.works-asset-editor-header,
.works-asset-editor-actions {
    padding: 24px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.works-asset-editor-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.works-asset-editor-kicker {
    display: inline-block;
    margin-bottom: 8px;
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #818cf8;
}

.works-asset-editor-header h3 {
    margin: 0;
    font-size: 24px;
    color: #fff;
}

.works-asset-editor-header p {
    margin: 8px 0 0;
    color: rgba(255, 255, 255, 0.56);
    font-size: 14px;
}

.works-asset-editor-close {
    position: static;
    width: 42px;
    height: 42px;
}

.works-asset-editor-body {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 24px;
    padding: 28px;
}

.works-asset-editor-preview {
    min-height: 360px;
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
}

.works-asset-editor-preview.is-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.works-asset-preview-media {
    width: 100%;
    height: 100%;
    min-height: 360px;
    object-fit: cover;
    display: block;
}

.works-asset-picker {
    width: 100%;
    min-height: 312px;
    border-radius: 18px;
    border: 1px dashed rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    padding: 18px;
}

.works-asset-picker p {
    margin: 0;
    font-size: 14px;
    line-height: 1.7;
}

.works-asset-picker-btn {
    height: 40px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid rgba(129, 140, 248, 0.32);
    background: rgba(99, 102, 241, 0.14);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.works-asset-picker-btn:hover {
    background: rgba(99, 102, 241, 0.22);
    border-color: rgba(129, 140, 248, 0.48);
}

.works-asset-editor-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.works-asset-editor-field {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.works-asset-editor-field span {
    color: rgba(255, 255, 255, 0.84);
    font-size: 14px;
    font-weight: 600;
}

.works-asset-editor-field input,
.works-asset-editor-field textarea {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    padding: 14px 16px;
    font-size: 14px;
    outline: none;
    resize: vertical;
}

.works-asset-editor-field input:focus,
.works-asset-editor-field textarea:focus {
    border-color: rgba(129, 140, 248, 0.35);
}

.works-asset-editor-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.works-asset-category-chip {
    height: 38px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.68);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.works-asset-category-chip.active,
.works-asset-category-chip:hover {
    color: #fff;
    border-color: rgba(129, 140, 248, 0.3);
    background: rgba(99, 102, 241, 0.14);
}

.works-asset-editor-actions {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    justify-content: flex-end;
}

.works-asset-editor-cancel {
    border: none;
}

/* --- 响应式 --- */
@media (max-width: 768px) {
    .works-container {
        flex-direction: column;
        overflow: visible;
    }
    .works-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.05);
        padding: 16px;
        position: sticky;
        top: 60px;
        height: auto;
        overflow: visible;
        z-index: 9;
    }
    .works-menu {
        flex-direction: row;
        overflow-x: auto;
    }
    .works-menu-item {
        white-space: nowrap;
    }
    .works-main {
        padding: 20px;
        overflow: visible;
    }
    .works-header {
        flex-direction: column;
        align-items: stretch;
    }
    .works-header-tools {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    .works-batch-tools {
        width: 100%;
        margin-right: 0;
        flex-wrap: wrap;
    }
    .works-search-box {
        width: 100%;
    }
    .works-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 16px;
    }
    .works-asset-editor {
        padding: 14px;
    }
    .works-asset-editor-body {
        grid-template-columns: 1fr;
        padding: 20px;
    }
    .works-asset-editor-preview,
    .works-asset-preview-media {
        min-height: 220px;
    }
    .works-asset-editor-header,
    .works-asset-editor-actions {
        padding: 18px 20px;
    }
}

@media (max-width: 480px) {
    .works-main { padding: 14px; }
    .works-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
    .works-header-tools { gap: 8px; }
}

/* ============================================================================
   浅色模式覆盖 (body.theme-light)
   ============================================================================ */

body.theme-light.works-page {
    background: #f8fafc;
    color: #1a1a2e;
}

body.theme-light .works-nav {
    background: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
body.theme-light .nav-back-btn { color: rgba(0, 0, 0, 0.5); }
body.theme-light .nav-back-btn:hover { color: #1a1a2e; }
body.theme-light .nav-title { color: #1a1a2e; }

body.theme-light .works-sidebar {
    background: rgba(255, 255, 255, 0.6);
    border-right: 1px solid rgba(0, 0, 0, 0.06);
}
body.theme-light .works-menu-item { color: rgba(0, 0, 0, 0.5); }
body.theme-light .works-menu-item:hover {
    background: rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.8);
}
body.theme-light .works-menu-item.active {
    background: rgba(99, 102, 241, 0.08);
    color: #6366f1;
    border-color: rgba(99, 102, 241, 0.15);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.08);
}

body.theme-light .works-main::-webkit-scrollbar-thumb { background-color: rgba(0,0,0,0.12); }

body.theme-light .works-header h2 { color: #1a1a2e; }
body.theme-light .works-stats { color: rgba(0, 0, 0, 0.4); }

body.theme-light .works-batch-btn {
    border-color: rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.03);
    color: rgba(0, 0, 0, 0.8);
}
body.theme-light .works-batch-btn:hover { background: rgba(0, 0, 0, 0.06); }
body.theme-light .works-batch-btn.danger {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.15);
    background: rgba(239, 68, 68, 0.04);
}
body.theme-light .works-batch-btn.danger:hover { background: rgba(239, 68, 68, 0.08); }

body.theme-light .works-search-box {
    border-color: rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.02);
    color: rgba(0, 0, 0, 0.5);
    box-shadow: none;
}
body.theme-light .works-search-box:focus-within {
    border-color: rgba(99, 102, 241, 0.3);
    color: rgba(0, 0, 0, 0.8);
}
body.theme-light .works-search-box input { color: #1a1a2e; }
body.theme-light .works-search-box input::placeholder { color: rgba(0, 0, 0, 0.35); }

body.theme-light .works-category-chip {
    border-color: rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.02);
    color: rgba(0, 0, 0, 0.5);
}
body.theme-light .works-category-chip.active,
body.theme-light .works-category-chip:hover {
    color: #6366f1;
    border-color: rgba(99, 102, 241, 0.25);
    background: rgba(99, 102, 241, 0.08);
}

body.theme-light .works-loading,
body.theme-light .works-empty { color: rgba(0, 0, 0, 0.4); }
body.theme-light .loading-spinner {
    border-color: rgba(0, 0, 0, 0.1);
    border-top-color: #6366f1;
}
body.theme-light .works-empty svg { color: rgba(0, 0, 0, 0.3); }

body.theme-light .work-card {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
body.theme-light .work-card:hover {
    border-color: rgba(0, 0, 0, 0.15);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}
body.theme-light .work-card.is-selected {
    border-color: rgba(99, 102, 241, 0.42);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.3), 0 12px 24px rgba(0, 0, 0, 0.08);
}
body.theme-light .media-thumb { background: #f0f1f3; }
body.theme-light .media-overlay {
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 50%);
}
body.theme-light .media-kind-chip {
    border-color: rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.85);
    color: #1a1a2e;
}
body.theme-light .media-source-chip {
    border-color: rgba(99, 102, 241, 0.2);
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}
body.theme-light .works-retention-notice {
    border-color: rgba(99, 102, 241, 0.16);
    background: rgba(99, 102, 241, 0.06);
    color: #4f46e5;
}
body.theme-light .works-retention-notice span { color: rgba(0, 0, 0, 0.55); }
body.theme-light .works-storage-label strong { color: #302747; }
body.theme-light .works-storage-track { background: rgba(74, 58, 112, .11); }
body.theme-light .media-expiry-chip {
    border-color: rgba(217, 119, 6, 0.18);
    background: rgba(255, 251, 235, 0.9);
    color: #b45309;
}
body.theme-light .history-select-toggle {
    border-color: rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.85);
    color: #1a1a2e;
}
body.theme-light .history-select-toggle.is-selected {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    color: #6366f1;
}
body.theme-light .media-prompt { color: #e2e8f0; }
body.theme-light .media-meta { color: rgba(255, 255, 255, 0.6); }
body.theme-light .media-card-btn {
    border-color: rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.85);
    color: #1a1a2e;
}
body.theme-light .media-card-btn.primary {
    color: #6366f1;
    border-color: rgba(99, 102, 241, 0.22);
    background: rgba(99, 102, 241, 0.1);
}
body.theme-light .media-card-btn.primary:hover {
    border-color: rgba(99, 102, 241, 0.35);
    background: rgba(99, 102, 241, 0.15);
}

/* 作品页列表卡片 */
body.theme-light .work-card.list-card {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.08);
}
body.theme-light .work-card.list-card:hover {
    border-color: rgba(0, 0, 0, 0.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
body.theme-light .list-card-prompt { color: #1a1a2e; }
body.theme-light .list-card-meta { color: rgba(0, 0, 0, 0.45); }
body.theme-light .list-card-actions {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* 上传区域 */
body.theme-light .works-upload-zone {
    border-color: rgba(0, 0, 0, 0.12);
    background: rgba(0, 0, 0, 0.02);
}
body.theme-light .works-upload-zone:hover {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(99, 102, 241, 0.02);
}
body.theme-light .works-upload-icon { color: rgba(0, 0, 0, 0.3); }
body.theme-light .works-upload-text { color: rgba(0, 0, 0, 0.5); }
body.theme-light .works-upload-hint { color: rgba(0, 0, 0, 0.35); }

/* 滚动条 */
body.theme-light .works-sidebar::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); }
body.theme-light .works-main::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); }

/* 作品中心视觉升级 */
.works-page {
    background: radial-gradient(circle at 72% 0%, rgba(66, 108, 255, 0.08), transparent 34%), #090b11;
}

.works-nav {
    height: 68px;
    padding: 0 28px;
    background: rgba(9, 11, 17, 0.86);
    border-bottom-color: rgba(255, 255, 255, 0.07);
}

.works-container { padding-top: 68px; }

.works-sidebar {
    width: 280px;
    top: 68px;
    height: calc(100vh - 68px);
    padding: 22px 18px;
    gap: 18px;
    background: linear-gradient(180deg, rgba(18, 21, 29, 0.94), rgba(11, 13, 19, 0.9));
    border-right-color: rgba(255, 255, 255, 0.07);
}

.works-menu { gap: 7px; }
.works-menu-item { min-height: 48px; padding: 0 15px; border-radius: 13px; }
.works-menu-item.active {
    color: #eef7ff;
    border-color: rgba(78, 145, 255, 0.25);
    background: linear-gradient(90deg, rgba(49, 112, 232, 0.2), rgba(70, 88, 150, 0.08));
    box-shadow: inset 3px 0 0 #5aa5ff, 0 10px 25px rgba(0, 0, 0, 0.18);
}

.works-main { padding: 36px 40px 56px; }
.works-header { align-items: center; margin-bottom: 26px; }
.works-header-main { gap: 5px; }
.works-header-kicker { color: #6fb8ff; font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.works-header h2 { font-size: 29px; font-weight: 760; letter-spacing: -.02em; }
.works-stats { color: rgba(212, 222, 240, 0.46); }

.works-search-box,
.works-batch-btn { border-color: rgba(255, 255, 255, 0.09); background: rgba(18, 22, 31, 0.76); }

.works-retention-notice {
    position: relative;
    margin: 0 0 26px;
    padding: 15px 18px;
    overflow: hidden;
    border-color: rgba(69, 145, 255, 0.18);
    border-radius: 14px;
    background: linear-gradient(90deg, rgba(42, 100, 210, 0.13), rgba(72, 61, 154, 0.08));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.works-retention-notice::after { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: linear-gradient(#67c7ff, #776dff); }
.works-retention-notice svg { color: #67bdff; }
.works-retention-notice strong { color: #e9f5ff; }
.works-retention-notice span { color: rgba(210, 221, 240, 0.56); }

.works-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
.work-card { border-color: rgba(255, 255, 255, 0.075); border-radius: 16px; background: #11141c; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14); }
.work-card:hover { border-color: rgba(92, 164, 255, 0.32); transform: translateY(-4px); box-shadow: 0 22px 46px rgba(0, 0, 0, 0.32), 0 0 28px rgba(49, 118, 255, 0.07); }
.media-thumb { position: relative; z-index: 1; display: block; transition: opacity .25s ease, transform .5s cubic-bezier(.2,.8,.2,1); }
.work-card:hover .media-thumb { transform: scale(1.025); }

.media-fallback {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 28px;
    color: rgba(221, 232, 250, 0.72);
    text-align: center;
    background: radial-gradient(circle at 50% 28%, rgba(61, 128, 255, 0.2), transparent 34%), linear-gradient(145deg, #141824, #0d1017);
}
.media-fallback::before { content: ''; position: absolute; inset: 18px; border: 1px dashed rgba(117, 170, 255, 0.14); border-radius: 14px; }
.media-fallback-icon { position: relative; display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid rgba(98, 169, 255, 0.22); border-radius: 15px; color: #72bfff; background: rgba(43, 109, 225, 0.12); font-size: 17px; }
.media-fallback strong, .media-fallback small { position: relative; }
.media-fallback strong { color: #e7f2ff; font-size: 14px; }
.media-fallback small { max-width: 210px; color: rgba(211, 222, 241, 0.42); font-size: 11px; line-height: 1.55; }
.work-card.media-unavailable .media-thumb { opacity: 0; pointer-events: none; }
.work-card.media-unavailable .video-icon { display: none; }

.media-overlay { z-index: 2; opacity: 1; padding: 54px 15px 15px; background: linear-gradient(to top, rgba(5, 7, 12, .96) 0%, rgba(5, 7, 12, .7) 34%, transparent 66%); }
.media-kind-chip { top: 13px; left: 13px; background: rgba(9, 12, 19, .68); }
.media-expiry-chip { top: 13px; right: 13px; }
.media-prompt { margin-top: auto; font-size: 13px; font-weight: 600; }
.media-meta { color: rgba(225, 233, 247, 0.52); }

@media (max-width: 900px) {
    .works-sidebar { width: 230px; }
    .works-main { padding: 30px 24px 48px; }
    .works-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
}

@media (max-width: 768px) {
    .works-container { padding-top: 68px; }
    .works-sidebar { top: 68px; width: 100%; height: auto; padding: 12px 14px; }
    .works-menu { gap: 8px; }
    .works-menu-item { min-height: 42px; }
    .works-retention-notice { align-items: flex-start; flex-wrap: wrap; }
    .works-storage-usage { width: 100%; margin: 8px 0 0 30px; }
}

body.theme-light .media-fallback { background: linear-gradient(145deg, #edf3fb, #f8fbff); color: #53627a; }
body.theme-light .media-fallback strong { color: #26354d; }
body.theme-light .media-fallback small { color: rgba(38, 53, 77, .52); }
