:root {
    --bg:        #181c1e;
    --panel:     #232a2e;
    --card:      #2a3238;
    --border:    #3a4450;
    --accent:    #02dba3;
    --accent-dk: #00b58e;
    --accent-lt: #27e8b1;
    --accent-bg: rgba(2, 219, 163, 0.08);
    --text:      #f0f4f5;
    --muted:     #7a8f9a;
    --radius:    10px;
    --shadow:    0 8px 32px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

/* ── 登录模态框 ────────────────────────────────────── */
.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 13, 14, 0.92);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.auth-modal {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 36px 32px 28px;
    width: 360px;
    max-width: 92vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    box-shadow: var(--shadow);
}

.auth-logo { font-size: 3rem; line-height: 1; margin-bottom: 10px; }
.auth-title { font-size: 1.2rem; font-weight: 700; color: var(--text); }
.auth-subtitle { font-size: 0.72rem; color: var(--accent); margin-top: 4px; margin-bottom: 24px; letter-spacing: 0.03em; }

.auth-tabs {
    display: flex;
    gap: 0;
    background: var(--card);
    border-radius: 8px;
    padding: 3px;
    width: 100%;
    margin-bottom: 20px;
}

.auth-tab {
    flex: 1;
    padding: 8px;
    border: none;
    background: transparent;
    color: var(--muted);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.2s;
}

.auth-tab.active { background: var(--accent); color: #000; font-weight: 700; }

.auth-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-form input {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.9rem;
    padding: 11px 14px;
    width: 100%;
    transition: border-color 0.2s;
    font-family: inherit;
}

.auth-form input:focus { outline: none; border-color: var(--accent); }
.auth-form input::placeholder { color: var(--muted); }

.auth-error {
    background: rgba(229, 57, 53, 0.12);
    border: 1px solid rgba(229, 57, 53, 0.4);
    color: #ff8a80;
    border-radius: 7px;
    padding: 8px 12px;
    font-size: 0.82rem;
    text-align: center;
}

.auth-submit {
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: #000;
    font-size: 0.95rem;
    font-weight: 700;
    padding: 12px;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 4px;
}

.auth-submit:hover { background: var(--accent-lt); }
.auth-submit:disabled { opacity: 0.5; cursor: not-allowed; }

.auth-tip {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 16px;
    text-align: center;
}

/* ── 用户信息栏 ────────────────────────────────────── */
.user-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.user-info { display: flex; align-items: center; gap: 7px; flex: 1; min-width: 0; }

.user-avatar {
    width: 28px; height: 28px;
    background: var(--accent-bg);
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700;
    flex-shrink: 0;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.points-badge {
    display: flex;
    align-items: center;
    gap: 3px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 0.8rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.points-icon { font-size: 0.85rem; }
.points-val { font-weight: 700; color: var(--accent); }
.points-label { color: var(--muted); font-size: 0.72rem; }

.user-info {
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 6px;
    transition: background 0.2s;
}
.user-info:hover { background: var(--card); }

.user-caret {
    font-size: 0.65rem;
    color: var(--muted);
    margin-left: 2px;
}

/* 下拉菜单 */
.user-dropdown {
    margin: 0 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    animation: fadeDown 0.15s ease;
}

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

.dropdown-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
}

.dropdown-avatar {
    width: 36px; height: 36px;
    background: var(--accent-bg);
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem; font-weight: 700;
    flex-shrink: 0;
}

.dropdown-name { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.dropdown-points { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }

.dropdown-divider { height: 1px; background: var(--border); margin: 0; }

.dropdown-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 14px;
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-align: left;
}

.dropdown-item:hover { background: var(--bg-hover, #1e2428); color: var(--text); }
.logout-item:hover { color: #ff6b6b !important; }

/* ── 生成按钮积分标签 ────────────────────────────────────── */
.btn-cost {
    font-size: 0.72rem;
    opacity: 0.65;
    font-weight: 400;
}

/* ── 整体布局 ────────────────────────────────────── */
.app {
    display: flex;
    height: 100vh;
}

/* ── 左侧面板 ────────────────────────────────────── */
.panel {
    width: 360px;
    min-width: 320px;
    background: var(--panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 0 24px;
}

.panel::-webkit-scrollbar { width: 4px; }
.panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Logo ────────────────────────────────────── */
.panel-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon { font-size: 2rem; line-height: 1; }

.logo-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.02em;
}

.logo-model {
    font-size: 0.72rem;
    color: var(--accent);
    margin-top: 2px;
    letter-spacing: 0.03em;
}

/* ── 模式选择 ────────────────────────────────────── */
.mode-group {
    display: flex;
    gap: 6px;
    padding: 16px 16px 0;
}

.mode-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px 4px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--muted);
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-btn:hover { border-color: var(--accent); color: var(--text); }

.mode-btn.active {
    background: var(--accent-bg);
    border-color: var(--accent);
    color: var(--accent);
}

.mode-icon { font-size: 1.2rem; line-height: 1; }

/* ── 通用 section label ────────────────────────────────────── */
.section-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.label-tip {
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
}

/* ── 参考图区 ────────────────────────────────────── */
.ref-section {
    padding: 16px 16px 0;
    display: flex;
    flex-direction: column;
}

/* 单图上传 */
.upload-box {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: var(--card);
    border: 1.5px dashed var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s, background 0.2s;
}

.upload-box:hover, .upload-box.drag { border-color: var(--accent); background: var(--accent-bg); }

.upload-hint-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 0.82rem;
    pointer-events: none;
}

.upload-plus {
    font-size: 2rem;
    line-height: 1;
    color: var(--border);
}

.upload-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius);
}

.clear-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    background: rgba(0,0,0,0.65);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.2s;
}

.clear-btn:hover { background: #e53935; }

/* 多图网格 */
.multi-upload {
    border-radius: var(--radius);
    transition: background 0.2s, box-shadow 0.2s;
}

.multi-upload.drag {
    background: var(--accent-bg);
    box-shadow: 0 0 0 2px var(--accent);
}

.multi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.multi-upload-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.multi-slot {
    aspect-ratio: 1;
    background: var(--card);
    border: 1.5px dashed var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s, background 0.2s;
    font-size: 1.4rem;
    color: var(--border);
}

.multi-slot:hover { border-color: var(--accent); background: var(--accent-bg); }
.multi-slot.filled { border-style: solid; border-color: var(--accent); }

.multi-slot img { width: 100%; height: 100%; object-fit: cover; }

.multi-slot .slot-del {
    position: absolute;
    top: 3px; right: 3px;
    width: 20px; height: 20px;
    background: rgba(0,0,0,0.7);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

.multi-slot .slot-del:hover { background: #e53935; }

.multi-hint { font-size: 0.72rem; color: var(--muted); margin-top: 6px; text-align: center; }

/* ── 审核 checkbox ─────────────────────────────── */
.moderate-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #aaa;
    margin-top: 6px;
    cursor: pointer;
    user-select: none;
}
.moderate-check input[type="checkbox"] { cursor: pointer; }
.moderate-check.hidden { display: none; }

.multi-upload-box { position: relative; }
.moderate-check-slot {
    position: absolute;
    bottom: 0;
    right: 0;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    z-index: 5;
    user-select: none;
}
.moderate-check-slot input[type="checkbox"] { cursor: pointer; }
.moderate-check-slot.hidden { display: none; }

/* ── 审核确认弹窗缩略图 ────────────────────────────────── */
#mod-confirm-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin: 14px 0 6px;
}
.mod-sel-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    user-select: none;
}
.mod-sel-item img {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #555;
    transition: border-color 0.15s;
    display: block;
}
.mod-sel-item.selected img {
    border-color: #4f8ef7;
}
.mod-sel-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 96px;
    height: 96px;
    border-radius: 8px;
    background: rgba(79, 142, 247, 0.40);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 15px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
}
.mod-sel-item.selected .mod-sel-overlay { opacity: 1; }
.mod-confirm-label {
    font-size: 12px;
    color: #aaa;
}

/* ── Prompt ────────────────────────────────────── */
.prompt-section {
    padding: 16px 16px 0;
    display: flex;
    flex-direction: column;
}

textarea {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.88rem;
    padding: 10px 12px;
    resize: none;
    line-height: 1.6;
    font-family: inherit;
    transition: border-color 0.2s;
}

textarea:focus { outline: none; border-color: var(--accent); }
textarea::placeholder { color: var(--muted); }

/* ── 宽高比 ────────────────────────────────────── */
.ratio-section {
    padding: 16px 16px 0;
}

.ratio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}
.ratio-grid-4 { grid-template-columns: repeat(4, 1fr); }
.ratio-grid-5 { grid-template-columns: repeat(5, 1fr); }
.ratio-grid-6 { grid-template-columns: repeat(6, 1fr); }
.ratio-grid-6 .vp-btn { padding: 5px 0; font-size: 0.8rem; font-weight: 500; text-align: center; }
.ratio-grid-5 .vp-btn { padding: 5px 0; font-size: 0.8rem; font-weight: 500; text-align: center; }

.ratio-btn {
    padding: 7px 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.ratio-btn:hover { border-color: var(--accent); color: var(--text); }

.ratio-btn.active {
    background: var(--accent-bg);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}

/* 智能比例按钮 */
.ratio-auto-btn { color: #8cb8e0; border-color: #4a6080; }
.ratio-auto-btn.active { background: rgba(140,184,224,0.12); border-color: #8cb8e0; color: #8cb8e0; }

.auto-ratio-hint {
    font-size: 0.72rem;
    color: #8cb8e0;
    font-weight: 400;
}

/* 批次数量按钮（复用 res-btn 样式） */
.batch-btn {
    padding: 5px 0;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.batch-btn:hover { border-color: var(--accent); color: var(--text); }

.batch-btn.active {
    background: var(--accent-bg);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}

/* 分辨率按钮（复用 ratio-btn 样式） */
.res-btn {
    padding: 5px 0;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.res-btn:hover { border-color: var(--accent); color: var(--text); }

.res-btn.active {
    background: var(--accent-bg);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}

.model-select {
    width: 100%;
    padding: 8px 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.model-select:hover, .model-select:focus { border-color: var(--accent); }

.model-quota-warning {
    margin-top: 6px;
    padding: 6px 10px;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-radius: 6px;
    font-size: 0.75rem;
    color: #fbbf24;
    line-height: 1.6;
}

/* ── 临时模式弹窗 ────────────────────────────────── */
.temp-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

.temp-modal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px 32px;
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: center;
}

.temp-modal-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
}

.temp-modal-desc {
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.5;
}

.temp-modal-btns {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.temp-modal-btn {
    flex: 1;
    padding: 10px 0;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: opacity 0.2s;
}

.temp-modal-btn:hover { opacity: 0.85; }

.temp-btn-normal {
    background: var(--accent);
    color: #fff;
}

.temp-btn-draft {
    background: #2d3a5a;
    border: 1px solid #4a6080 !important;
    color: #8cb8e0;
}

.temp-btn-temp {
    background: var(--card);
    border: 1px solid var(--border) !important;
    color: var(--text);
}

.temp-modal-cancel {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 0.82rem;
    cursor: pointer;
    padding: 4px;
}

.temp-modal-cancel:hover { color: var(--text); }

/* ── 修改密码弹窗 ─────────────────────────────────── */
.cpwd-modal {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 360px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.cpwd-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--border);
}
.cpwd-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}
.cpwd-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 14px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.cpwd-close:hover { background: var(--card); color: var(--text); }
.cpwd-body {
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.cpwd-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.cpwd-label {
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 500;
}
.cpwd-input {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.9rem;
    padding: 10px 13px;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s;
    font-family: inherit;
}
.cpwd-input:focus { outline: none; border-color: var(--accent); }
.cpwd-input::placeholder { color: var(--muted); }
.cpwd-err {
    font-size: 0.78rem;
    color: #f87171;
    min-height: 16px;
}
.cpwd-footer {
    display: flex;
    gap: 10px;
    padding: 14px 22px 20px;
}
.cpwd-btn-cancel {
    flex: 1;
    padding: 10px 0;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--muted);
    transition: color 0.15s, border-color 0.15s;
}
.cpwd-btn-cancel:hover { color: var(--text); border-color: var(--accent); }
.cpwd-btn-submit {
    flex: 2;
    padding: 10px 0;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--accent);
    border: none;
    color: #fff;
    transition: opacity 0.2s;
}
.cpwd-btn-submit:hover { opacity: 0.85; }
.cpwd-btn-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── 生成按钮 ────────────────────────────────────── */
.generate-btn {
    margin: 20px 16px 0;
    padding: 13px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    color: #000;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s, transform 0.15s;
    letter-spacing: 0.02em;
}

.generate-btn:hover { background: var(--accent-lt); }
.generate-btn:active { transform: scale(0.98); }
.generate-btn:disabled { background: var(--border); color: var(--muted); cursor: not-allowed; transform: none; }

.btn-spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(0,0,0,0.25);
    border-top-color: #000;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* ── 右侧输出区 ────────────────────────────────────── */
.output {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    position: relative;
    overflow: hidden;
    padding: 24px 24px 0 24px;
}

/* 空状态 */
.empty-state {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex: 1;
    min-height: 300px;
}

.empty-icon { font-size: 4rem; opacity: 0.4; }
.empty-title { font-size: 1.2rem; font-weight: 600; color: var(--muted); }
.empty-desc { font-size: 0.85rem; color: var(--muted); line-height: 1.8; opacity: 0.7; }

/* 生成中状态 */
.generating-state {
    text-align: center;
    flex: 1;
    min-height: 300px;    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

/* 发光球动画 */
.gen-orb {
    position: relative;
    width: 64px; height: 64px;
    margin: 0 auto;
}
.gen-orb-dot {
    position: absolute;
    inset: 50%; transform: translate(-50%, -50%);
    width: 20px; height: 20px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 16px var(--accent), 0 0 32px color-mix(in srgb, var(--accent) 40%, transparent);
    animation: orbPulse 1.6s ease-in-out infinite;
}
.gen-orb-ring {
    position: absolute;
    inset: 0;
    border: 1.5px solid color-mix(in srgb, var(--accent) 50%, transparent);
    border-radius: 50%;
    animation: orbRing 2s linear infinite;
}
.gen-orb-ring2 {
    inset: 8px;
    border-color: color-mix(in srgb, var(--accent) 30%, transparent);
    animation-duration: 3s;
    animation-direction: reverse;
}
@keyframes orbPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.7; }
}
@keyframes orbRing {
    from { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.05); }
    to { transform: rotate(360deg) scale(1); }
}

.gen-title { font-size: 1.05rem; font-weight: 600; color: var(--text); }
.gen-desc  { font-size: 0.82rem; color: var(--muted); letter-spacing: 0.02em; }
.gen-elapsed { font-size: 0.78rem; color: var(--muted); opacity: 0.6; }

.gen-progress-wrap {
    width: 160px;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto;
}
.gen-progress-bar {
    height: 100%;
    width: 40%;
    background: var(--accent);
    border-radius: 2px;
    animation: genSlide 1.8s ease-in-out infinite;
}
@keyframes genSlide {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

/* 结果状态 */
.result-state {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.result-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.result-info { display: flex; align-items: center; gap: 10px; }

.result-tag {
    background: var(--accent-bg);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 0.03em;
}

.result-ratio-label {
    font-size: 0.78rem;
    color: var(--muted);
}

.dl-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 7px;
    padding: 7px 16px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s;
}

.dl-btn:hover { border-color: var(--accent); color: var(--accent); }

.result-img-wrap {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

/* 批量结果网格 */
.result-batch-grid {
    display: grid;
    grid-template-columns: repeat(var(--cols, 2), 1fr);
    gap: 10px;
    width: 100%;
}

.result-batch-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--border);
}

.result-batch-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

.result-batch-dl {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.75rem;
    text-decoration: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.result-batch-item:hover .result-batch-dl { opacity: 1; }

.result-img-wrap img {
    max-width: 100%;
    max-height: calc(100vh - 140px);
    display: block;
    object-fit: contain;
}

/* ── Toast ────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    background: #2d1f1f;
    border: 1px solid #e53935;
    color: #ff8a80;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.88rem;
    z-index: 999;
    max-width: 90vw;
    text-align: center;
    animation: fadeUp 0.25s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}
.toast-action {
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}
.toast-action:hover { text-decoration: underline; }

/* ── 任务队列 ─────────────────────────────────────── */
.queue-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #000;
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 10px;
    min-width: 17px;
    height: 17px;
    padding: 0 5px;
    margin-left: 6px;
    vertical-align: middle;
}

.queue-empty {
    color: var(--muted);
    text-align: center;
    padding: 64px 0;
    font-size: 0.87rem;
}

/* 卡片容器 */
.queue-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.queue-card-wrap {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

/* 表头 */
.queue-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    font-family: 'Inter', 'PingFang SC', 'SF Pro Text', system-ui, -apple-system, sans-serif;
    table-layout: fixed;
}
.queue-table thead tr {
    background: color-mix(in srgb, var(--border) 30%, transparent);
    border-bottom: 1px solid var(--border);
}
.queue-table th {
    padding: 9px 14px;
    text-align: left;
    font-size: 0.71rem;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
/* 数据行 */
.queue-table td {
    padding: 14px 14px;
    vertical-align: middle;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 35%, transparent);
    text-align: left;
}
.qt-row:last-child td { border-bottom: none; }
.qt-row { transition: background 0.15s; }
.qt-row:hover td { background: color-mix(in srgb, var(--accent) 4%, transparent); }

/* 列宽 */
.qt-status { width: 24px; }
.qt-mode   { width: 82px; }
.qt-prompt {
    color: var(--text);
    font-size: 0.84rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.qt-model {
    width: 100px;
    color: var(--muted);
    font-size: 0.77rem;
    white-space: nowrap;
}
.qt-batch {
    width: 44px;
    color: var(--muted);
    font-size: 0.77rem;
    white-space: nowrap;
}
.qt-time {
    width: 54px;
    color: var(--accent);
    font-size: 0.77rem;
    font-variant-numeric: tabular-nums;
    font-family: 'Inter', 'SF Mono', monospace;
    white-space: nowrap;
}
.qt-cancel { width: 36px; text-align: center; }
.qt-cancel-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px; height: 24px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.qt-cancel-btn:hover {
    background: color-mix(in srgb, #f87171 15%, transparent);
    color: #f87171;
}

/* 底部流光进度条 */
.queue-progress-row {
    height: 3px;
    background: color-mix(in srgb, var(--border) 60%, transparent);
    overflow: hidden;
}
.queue-shimmer-fill {
    height: 100%;
    width: 35%;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    animation: queueShimmer 2s ease-in-out infinite;
}
@keyframes queueShimmer {
    0%   { transform: translateX(-200%); }
    100% { transform: translateX(500%); }
}

/* 失败行 */
.qt-row-failed td { background: color-mix(in srgb, #f87171 4%, transparent); }
.qt-row-failed:hover td { background: color-mix(in srgb, #f87171 8%, transparent) !important; }
.qt-error {
    color: #f87171;
    font-size: 0.77rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 状态点 */
.queue-dot {
    display: inline-block;
    width: 8px; height: 8px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 40%, transparent);
    animation: dotPulse 1.6s ease-in-out infinite;
}
.queue-dot-err {
    display: inline-block;
    width: 8px; height: 8px;
    background: #f87171;
    border-radius: 50%;
}
@keyframes dotPulse {
    0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); }
    60%  { box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 0%, transparent); }
    100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); }
}

/* 模式标签 */
.queue-tag {
    display: inline-flex;
    align-items: center;
    font-size: 0.71rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
    letter-spacing: 0.01em;
    border: 1px solid transparent;
}
.mode-text  {
    background: color-mix(in srgb, #6c8fff 12%, transparent);
    color: #7d97ff;
    border-color: color-mix(in srgb, #6c8fff 25%, transparent);
}
.mode-edit  {
    background: color-mix(in srgb, #a78bfa 12%, transparent);
    color: #b59ffc;
    border-color: color-mix(in srgb, #a78bfa 25%, transparent);
}
.mode-multi {
    background: color-mix(in srgb, #34d399 12%, transparent);
    color: #3ddba3;
    border-color: color-mix(in srgb, #34d399 25%, transparent);
}
.mode-video {
    background: color-mix(in srgb, #f97316 12%, transparent);
    color: #fb923c;
    border-color: color-mix(in srgb, #f97316 25%, transparent);
}

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

@keyframes fadeUp {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.hidden { display: none !important; }

/* ── 输出 Tab ────────────────────────────────────── */
.output-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    flex-shrink: 0;
}

.output-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 500;
    padding: 10px 20px;
    transition: color 0.2s, border-color 0.2s;
}

.output-tab:hover { color: var(--text); }
.output-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.output-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    width: 100%;
}

/* 历史/草稿/临时/视频面板：子元素铺满宽度 */
#panel-history,
#panel-draft,
#panel-temp,
#panel-video {
    align-items: stretch;
}

/* ── 历史记录 ────────────────────────────────────── */
.history-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 860px;
    margin-bottom: 16px;
}

.history-toolbar .history-title { flex: 1; }

.history-title { font-size: 0.9rem; color: var(--muted); }
.history-subtitle { font-size: 0.78rem; color: var(--muted); opacity: 0.55; }

.refresh-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 7px;
    padding: 5px 14px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.refresh-btn:hover { border-color: var(--accent); color: var(--accent); }

.select-mode-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 7px;
    padding: 5px 14px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.select-mode-btn:hover { border-color: var(--accent); color: var(--accent); }
.select-mode-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }

.bulk-delete-btn {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #f87171;
    border-radius: 7px;
    padding: 5px 14px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.bulk-delete-btn:hover { background: rgba(239, 68, 68, 0.22); border-color: #f87171; }

.bulk-download-btn {
    background: rgba(46, 160, 90, 0.12);
    border: 1px solid rgba(46, 160, 90, 0.5);
    color: #4ade80;
    border-radius: 7px;
    padding: 5px 14px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.bulk-download-btn:hover { background: rgba(46, 160, 90, 0.22); border-color: #4ade80; }


.history-empty {
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: 60px;
}

.history-loading {
    color: var(--muted);
    font-size: 0.88rem;
    padding: 40px 0;
}

.history-grid {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding-bottom: 16px;
}

.history-card {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.18s, box-shadow 0.18s;
}

/* ── 批次生图分组 ─────────────────────────────────── */
.history-batch-group {
    grid-column: 1 / -1;   /* 横跨父 grid 所有列 */
    border: 1px solid rgba(140, 184, 224, 0.25);
    border-radius: 12px;
    padding: 10px;
    background: rgba(140, 184, 224, 0.04);
}

.history-batch-label {
    font-size: 0.75rem;
    color: #8cb8e0;
    font-weight: 600;
    letter-spacing: 0.03em;
    margin-bottom: 8px;
    padding-left: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.history-batch-label::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #8cb8e0;
    opacity: 0.7;
}

.history-batch-inner {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
}

/* 序号徽章 */
.hc-num-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 5;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: opacity 0.2s;
}

.history-card:hover .hc-num-badge { opacity: 0.3; }

/* 批量选择专属捕获层：默认隐藏，选择模式时铺满卡片最顶层 */
.hc-select-layer {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 50;
    cursor: pointer;
}

/* 选择模式：卡片所有子元素均禁用指针事件，消除一切干扰 */
.select-mode-active .history-card > * {
    pointer-events: none !important;
    opacity: 0.999; /* 强制不透明，避免 transition 残留 */
}

/* 仅捕获层保持可点击，且必须在上一条之后声明（同优先级取后者） */
.select-mode-active .hc-select-layer {
    display: block;
    pointer-events: auto !important;
    opacity: 1 !important;
}

/* 选择模式取消 hover 位移，避免坐标偏差 */
.select-mode-active .history-card:hover {
    transform: none !important;
}

.select-mode-active .history-card {
    cursor: pointer;
}

/* 拖拽选中时禁止文字选中 */
body.drag-selecting {
    user-select: none;
    -webkit-user-select: none;
}
body.drag-selecting .hc-select-layer {
    cursor: crosshair;
}

.history-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
    outline: none;
}

.history-card.selected::after {
    content: '✓';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 60; /* 高于 hc-select-layer(50)，勾始终可见 */
    pointer-events: none;
}

.history-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(2, 219, 163, 0.12);
}

.history-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.history-card:hover img { transform: scale(1.04); }

/* 悬停遮罩 */
.history-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 40%, rgba(8, 12, 14, 0.92) 100%);
    opacity: 0;
    transition: opacity 0.22s;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 10px;
    gap: 7px;
    pointer-events: none;
}

.history-card:hover .history-card-overlay {
    opacity: 1;
    pointer-events: auto;
}

.history-card-prompt {
    font-size: 0.72rem;
    color: rgba(230, 240, 245, 0.82);
    line-height: 1.35;
    word-break: break-all;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 操作按钮行 */
.history-card-actions {
    display: flex;
    gap: 5px;
}

.hc-btn {
    flex: 1;
    height: 28px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.10);
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(6px);
    transition: background 0.15s, border-color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    white-space: nowrap;
}

.hc-btn:hover { background: rgba(255, 255, 255, 0.22); border-color: rgba(255, 255, 255, 0.35); }
.hc-btn.hc-remake-btn { border-color: rgba(2, 219, 163, 0.45); color: #02dba3; }
.hc-btn.hc-remake-btn:hover { background: rgba(2, 219, 163, 0.18); }
.hc-btn.hc-promote-btn { border-color: rgba(2, 219, 163, 0.45); color: #02dba3; }
.hc-btn.hc-promote-btn:hover { background: rgba(2, 219, 163, 0.18); }
.hc-btn.hc-promote-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.hc-btn.hc-edit-btn { border-color: rgba(140, 184, 224, 0.45); color: #8cb8e0; }
.hc-btn.hc-edit-btn:hover { background: rgba(140, 184, 224, 0.18); }
.hc-dl-corner {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 10;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: none;
    background: rgba(46, 160, 90, 0.82);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 0.82rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.1s;
}
.hc-dl-corner { text-decoration: none; }
.hc-dl-corner:hover { background: rgba(46, 200, 100, 0.95); transform: scale(1.1); }
.hc-btn.hc-delete-btn { border-color: rgba(220, 80, 80, 0.35); color: #e08080; }
.hc-btn.hc-delete-btn:hover { background: rgba(220, 80, 80, 0.25); border-color: rgba(220, 80, 80, 0.7); }

/* ── 管理员面板 ────────────────────────────────────── */
.admin-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 13, 14, 0.88);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.admin-modal {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 760px;
    max-width: 96vw;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.admin-title { font-size: 1rem; font-weight: 700; color: var(--text); }

.admin-close {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}
.admin-close:hover { color: var(--text); }

/* admin tabs */
.admin-tabs {
    display: flex;
    gap: 4px;
    background: var(--card);
    border-radius: 8px;
    padding: 3px;
}
.admin-tab {
    padding: 5px 16px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.admin-tab.active { background: var(--panel); color: var(--text); font-weight: 600; }
.admin-tab:hover:not(.active) { color: var(--text); }

/* admin panels */
.admin-panel { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.admin-panel.hidden { display: none; }

/* admin billing filter */
.admin-billing-filter-section { flex-shrink: 0; padding: 14px 24px; }
.admin-billing-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.admin-filter-select, .admin-filter-date {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text);
    font-size: 0.82rem;
    padding: 6px 10px;
    height: 32px;
    font-family: inherit;
}
.admin-filter-select:focus, .admin-filter-date:focus { outline: none; border-color: var(--accent); }
.admin-filter-select option { background: var(--card); }

/* admin billing pager */
.admin-billing-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 0 6px;
    font-size: 0.8rem;
    color: var(--muted);
    flex-shrink: 0;
}
.admin-billing-pager button {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.8rem;
    padding: 3px 12px;
    cursor: pointer;
}
.admin-billing-pager button:disabled { opacity: 0.4; cursor: not-allowed; }
.admin-billing-pager button:not(:disabled):hover { border-color: var(--accent); }

.admin-section {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.admin-section:last-child { border-bottom: none; flex: 1; overflow: hidden; display: flex; flex-direction: column; }

.admin-section-title {
    font-size: 0.82rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-add-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.admin-add-form input {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.88rem;
    padding: 9px 12px;
    transition: border-color 0.2s;
    font-family: inherit;
    flex: 1;
    min-width: 120px;
}

.admin-add-form input:focus { outline: none; border-color: var(--accent); }
.admin-add-form input::placeholder { color: var(--muted); }
.admin-add-form input[type="number"] { max-width: 120px; }

.admin-add-btn {
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: #000;
    font-size: 0.88rem;
    font-weight: 700;
    padding: 9px 20px;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}
.admin-add-btn:hover { background: var(--accent-lt); }
.admin-add-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.admin-form-msg {
    margin-top: 8px;
    font-size: 0.82rem;
    border-radius: 6px;
    padding: 7px 10px;
}
.admin-form-msg.success { background: rgba(2,219,163,0.1); color: var(--accent); border: 1px solid rgba(2,219,163,0.4); }
.admin-form-msg.error   { background: rgba(229,57,53,0.12); color: #ff8a80; border: 1px solid rgba(229,57,53,0.4); }

.admin-table-wrap { overflow-y: auto; flex: 1; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.admin-table th {
    background: var(--card);
    color: var(--muted);
    font-weight: 600;
    text-align: left;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.admin-table td {
    padding: 9px 12px;
    border-bottom: 1px solid rgba(58,68,80,0.5);
    vertical-align: middle;
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(255,255,255,0.02); }

.points-inline { margin-right: 6px; }

.tbl-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--muted);
    font-size: 0.76rem;
    padding: 3px 9px;
    cursor: pointer;
    transition: all 0.15s;
}
.tbl-btn:hover { border-color: var(--accent); color: var(--accent); }
.del-btn:hover { border-color: #ff6b6b !important; color: #ff6b6b !important; }

.role-badge {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.75rem;
    color: var(--muted);
}
.role-badge.role-admin { border-color: var(--accent); color: var(--accent); }

.admin-item:hover { color: var(--accent) !important; }


/* ── 结果页操作按钮 ────────────────────────────── */
.result-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-action-btn {
    padding: 6px 12px;
    border-radius: 7px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--muted);
    transition: color 0.2s, border-color 0.2s;
}

.result-action-btn:hover { color: var(--text); border-color: var(--accent); }

.result-action-btn.remake-btn { color: var(--accent); border-color: var(--accent); }
.result-action-btn.remake-btn:hover { background: var(--accent-bg); }

.result-action-btn.edit-btn { color: #8cb8e0; border-color: #4a6080; }
.result-action-btn.edit-btn:hover { background: rgba(140, 184, 224, 0.1); border-color: #8cb8e0; }

.result-action-btn.back-btn { color: var(--text-muted); }
.result-action-btn.back-btn:hover { color: var(--text); border-color: var(--border); }

/* ── 历史筛选栏 ────────────────────────────────── */
.history-filter-bar {
    display: flex;
    gap: 6px;
    padding: 10px 4px 4px;
    flex-wrap: wrap;
}

.filter-btn, .video-filter-btn {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    transition: all 0.2s;
}

.filter-btn:hover, .video-filter-btn:hover { color: var(--text); border-color: var(--accent); }
.filter-btn.active, .video-filter-btn.active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }

/* ── 历史日期分组 ───────────────────────────────── */
.history-date-divider {
    padding: 14px 4px 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.history-grid-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    padding: 0 4px 4px;
}


/* ── 响应式 ────────────────────────────────────── */
@media (max-width: 680px) {
    body { overflow: auto; }
    .app { flex-direction: column; height: auto; }
    .panel { width: 100%; min-width: 0; border-right: none; border-bottom: 1px solid var(--border); }
    .output { min-height: 60vh; padding: 16px; }
    .result-img-wrap img { max-height: 60vh; }
}

/* ── 视频子模式 ─────────────────────────────────── */
.video-submode {
    padding: 16px 16px 0;
}
.video-sub-btn {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}
.video-sub-btn.active {
    background: var(--accent-bg);
    border-color: var(--accent);
    color: var(--accent);
}

/* ── 视频生成参数 ────────────────────────────────── */
.video-params { display: flex; flex-direction: column; gap: 10px; padding: 16px 16px 0; }
.video-params-row { display: flex; gap: 12px; flex-wrap: wrap; }
.vp-group { display: flex; flex-direction: column; gap: 6px; }
.video-params-row > .vp-group:only-child { width: 100%; }
.vp-btn {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 8px;
    padding: 5px 12px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
}
.vp-btn.active {
    background: var(--accent-bg);
    border-color: var(--accent);
    color: var(--accent);
}
.vp-btn:hover:not(.active) { border-color: var(--accent); color: var(--text); }
.vp-checks { gap: 16px; align-items: center; padding-top: 2px; }
.vp-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
}
.vp-check input[type="checkbox"] { accent-color: var(--accent); cursor: pointer; }

/* ── 视频历史 ────────────────────────────────────── */
/* ── 账单面板 ───────────────────────────────────────────── */

#panel-billing {
    background: var(--bg);
    align-items: stretch;
    overflow-y: auto;
}

.bl-wrap {
    width: 100%;
    padding: 24px 28px 48px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 顶部统计行 */
.bl-stats-row {
    display: flex;
    gap: 14px;
}
.bl-s-card {
    flex: 1;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 22px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.bl-s-icon {
    width: 44px; height: 44px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}
.bl-s-label { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.bl-s-value { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1; }

/* 筛选栏 */
.bl-filter-bar {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 22px;
    display: flex;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: wrap;
}
.bl-filter-group { display: flex; flex-direction: column; gap: 5px; }
.bl-filter-label { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.bl-date-range { display: flex; align-items: center; gap: 8px; }
.bl-date-sep { color: var(--muted); font-size: 13px; }
.bl-input {
    border: 1px solid var(--border); border-radius: 7px;
    padding: 7px 10px; font-size: 13px; color: var(--text);
    background: var(--card); outline: none; transition: border-color .15s;
    color-scheme: dark;
}
.bl-input:focus { border-color: var(--accent); }
.bl-select {
    border: 1px solid var(--border); border-radius: 7px;
    padding: 7px 12px; font-size: 13px; color: var(--text);
    background: var(--card); outline: none; cursor: pointer; transition: border-color .15s;
}
.bl-select:focus { border-color: var(--accent); }
#bl-user-filter { min-width: 160px; }
.bl-filter-actions { display: flex; gap: 8px; align-items: flex-end; }
.bl-filter-btn {
    border: none; border-radius: 7px;
    background: var(--accent); color: #0a1a14;
    padding: 8px 18px; font-size: 13px; font-weight: 700;
    cursor: pointer; transition: background .15s; white-space: nowrap;
}
.bl-filter-btn:hover { background: var(--accent-lt); }
.bl-reset-btn {
    border: 1px solid var(--border); border-radius: 7px;
    background: transparent; color: var(--muted);
    padding: 7px 14px; font-size: 13px; font-weight: 500;
    cursor: pointer; transition: all .15s; white-space: nowrap;
}
.bl-reset-btn:hover { border-color: var(--accent); color: var(--accent); }

/* 表格卡片 */
.bl-table-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    min-height: 420px;
    display: flex;
    flex-direction: column;
}
.bl-table {
    width: 100%;
    border-collapse: collapse;
}
.bl-table thead tr {
    background: var(--card);
    border-bottom: 1px solid var(--border);
}
.bl-table th {
    font-size: 11px; font-weight: 700;
    color: var(--muted); letter-spacing: .07em; text-transform: uppercase;
    padding: 7px 14px; text-align: left; white-space: nowrap;
}
.bl-table td {
    font-size: 13px; color: var(--text);
    padding: 7px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.bl-table tbody tr:last-child td { border-bottom: none; }
.bl-table tbody tr:hover { background: rgba(255,255,255,.03); }

.bl-td-time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.bl-td-desc { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-th-r { text-align: right; }
.bl-td-r  { text-align: right; }
.bl-td-badge {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600; white-space: nowrap;
}
.bl-b-consume { background: rgba(248,113,113,.15); color: #f87171; }
.bl-b-pay     { background: rgba(2,219,163,.15);   color: var(--accent); }
.bl-b-refund  { background: rgba(74,158,255,.15);  color: #4a9eff; }
.bl-b-other   { background: rgba(148,163,184,.15); color: #94a3b8; }
.bl-td-amount { font-weight: 700; white-space: nowrap; }
.bl-td-amount.plus  { color: #34d399; }
.bl-td-amount.minus { color: #f87171; }
.bl-td-balance { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* 空状态（tbody 内） */
.bl-td-empty { padding: 0 !important; border-bottom: none !important; }
.bl-empty-inner {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; padding: 60px 0; gap: 8px;
}
.bl-empty-icon  { font-size: 36px; opacity: .3; }
.bl-empty-title { font-size: 14px; font-weight: 500; color: var(--muted); }
.bl-empty-sub   { font-size: 12px; color: var(--muted); opacity: .6; }

/* 日期错误提示 */
.bl-date-error {
    margin-top: 4px; font-size: 12px; color: #f87171;
}

/* 分页 */
.bl-pagination {
    display: flex; align-items: center;
    justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
}
.bl-page-size-wrap {
    font-size: 13px; color: var(--muted);
    display: flex; align-items: center; gap: 8px;
}
.bl-ps-select {
    border: 1px solid var(--border); border-radius: 6px;
    padding: 4px 8px; font-size: 13px; color: var(--text);
    background: var(--card); cursor: pointer; outline: none;
}
.bl-page-nav { display: flex; align-items: center; gap: 4px; }
.bl-page-btn {
    min-width: 32px; height: 32px;
    border: 1px solid var(--border); border-radius: 6px;
    background: var(--card); font-size: 13px; color: var(--muted);
    cursor: pointer; display: flex; align-items: center;
    justify-content: center; transition: all .15s; padding: 0 8px;
}
.bl-page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.bl-page-btn.active { background: var(--accent); border-color: var(--accent); color: #0a1a14; font-weight: 700; }
.bl-page-btn:disabled { opacity: .3; cursor: not-allowed; }
.bl-page-info { font-size: 12px; color: var(--muted); }

.video-history-grid {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding-bottom: 16px;
}
.video-history-grid .history-grid-group {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

/* 视频卡片继承 history-card，只覆盖缩略图比例 */
.vhc-video-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
    background: #111;
    pointer-events: none; /* video 元素不捕获鼠标，避免干扰 select-layer */
}
.history-card.vhc-card:hover .vhc-video-thumb { transform: scale(1.04); }

/* 时间角标 */
.vhc-time-badge {
    position: absolute;
    bottom: 6px;
    right: 8px;
    background: rgba(0,0,0,0.65);
    color: #ddd;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    pointer-events: none;
    z-index: 1;
}

/* 待处理/失败状态卡片 */
.vhc-pending-card { cursor: default; }
.vhc-pending-body {
    width: 100%;
    aspect-ratio: 16/9;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(255,255,255,0.04);
    pointer-events: none; /* 不拦截鼠标，同 vhc-video-thumb */
}
.vhc-pending-icon { font-size: 28px; opacity: 0.45; }
.vhc-pending-text { font-size: 12px; color: var(--muted); }
.vhc-error-msg { margin-top: 8px; font-size: 11px; color: #e57373; line-height: 1.4; max-width: 180px; word-break: break-all; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ── 视频播放 Modal ────────────────────────────── */
.video-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 3500;
    display: flex;
    align-items: center;
    justify-content: center;
}
.video-modal.hidden { display: none; }
.video-modal-player {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 8px;
    outline: none;
}
.video-modal-close {
    position: fixed;
    top: 18px;
    right: 22px;
    background: rgba(255,255,255,0.12);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.video-modal-close:hover { background: rgba(255,255,255,0.25); }
.video-modal-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.12);
    border: none;
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    z-index: 1;
    user-select: none;
}
.video-modal-nav:hover { background: rgba(255,255,255,0.28); }
.video-modal-prev { left: 20px; }
.video-modal-next { right: 20px; }
.video-modal-nav.vm-hidden { visibility: hidden; pointer-events: none; }
.video-modal-counter {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.55);
    font-size: 13px;
    pointer-events: none;
}

/* ── 灯箱 ────────────────────────────────────── */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.93);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-overlay.hidden { display: none; }
.lb-img {
    max-width: 90vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 6px;
    display: block;
    user-select: none;
}
.lb-close {
    position: fixed;
    top: 18px;
    right: 22px;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.lb-close:hover { background: rgba(255, 255, 255, 0.28); }
.lb-prev, .lb-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 42px;
    line-height: 1;
    cursor: pointer;
    width: 52px;
    height: 90px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    user-select: none;
}
.lb-prev { left: 14px; }
.lb-next { right: 14px; }
.lb-prev:hover, .lb-next:hover { background: rgba(255, 255, 255, 0.26); }
.lb-prev.lb-hidden, .lb-next.lb-hidden { visibility: hidden; pointer-events: none; }
.lb-counter {
    position: fixed;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.65);
    font-size: 13px;
    letter-spacing: 0.5px;
}
/* 结果图和批量图可点击提示 */
.result-img-wrap img { cursor: zoom-in; }
.result-batch-item img { cursor: zoom-in; }
