:root {
    --bg: #f7f4ff;
    --panel: rgba(255, 255, 255, 0.78);
    --line: rgba(139, 92, 246, 0.12);
    --text: #2d2340;
    --subtext: #6f6488;
    --purple: rgba(196, 181, 255, 0.45);
    --purple-strong: #8b5cf6;
    --purple-dark: #6d28d9;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #f59e0b;
    --shadow: 0 18px 40px rgba(109, 40, 217, 0.10);
    --radius: 22px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(196, 181, 255, 0.55), transparent 28%),
        radial-gradient(circle at bottom right, rgba(216, 180, 254, 0.32), transparent 26%),
        linear-gradient(180deg, #fcfbff 0%, #f5f0ff 100%);
}

a { color: inherit; text-decoration: none; }
code {
    background: rgba(255,255,255,0.7);
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--line);
}

.page-shell {
    width: min(1480px, calc(100% - 32px));
    margin: 20px auto;
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
}

.sidebar, .content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.glass {
    background: var(--panel);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,0.7);
    box-shadow: var(--shadow);
}

.brand-card, .panel, .alert {
    border-radius: var(--radius);
    padding: 20px;
}

.panel-soft {
    background: linear-gradient(180deg, rgba(255,255,255,0.76), rgba(196,181,255,0.14));
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px;
}

.brand-card {
    display: flex;
    gap: 14px;
    align-items: center;
}

.brand-dot {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(196, 181, 255, 0.95), rgba(167, 139, 250, 0.95));
    box-shadow: inset 0 2px 10px rgba(255,255,255,0.5);
}

.brand-card h1 { margin: 0 0 6px; font-size: 22px; }
.brand-card p { margin: 0; color: var(--subtext); }

.quick-guide ol {
    margin: 12px 0 0 18px;
    padding: 0;
    color: var(--subtext);
    line-height: 1.8;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat-card {
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,0.85), rgba(196,181,255,0.2));
    border: 1px solid var(--line);
    padding: 14px;
}

.stat-card span {
    display: block;
    color: var(--subtext);
    font-size: 13px;
    margin-bottom: 8px;
}

.stat-card strong {
    font-size: 28px;
}

.alert.success { border-left: 5px solid var(--success); }
.alert.error { border-left: 5px solid var(--danger); }

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}
.section-head h2 {
    margin: 0 0 8px;
    font-size: 24px;
}
.section-head p {
    margin: 0;
    color: var(--subtext);
}

.grid.two-col {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 18px;
}

.task-form { display: flex; flex-direction: column; gap: 10px; }

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
}

input[type="text"],
input[type="file"],
textarea,
select {
    width: 100%;
    border: 1px solid rgba(139, 92, 246, 0.15);
    background: rgba(255,255,255,0.82);
    border-radius: 18px;
    padding: 14px 16px;
    font-size: 14px;
    color: var(--text);
    outline: none;
}

input[type="file"] { padding: 12px; }
textarea { resize: vertical; min-height: 220px; }

small {
    display: inline-block;
    margin-top: 2px;
    color: var(--subtext);
}

.upload-tip {
    margin-top: 8px;
    padding: 14px 16px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(196, 181, 255, 0.24), rgba(255,255,255,0.7));
    border: 1px solid var(--line);
}
.upload-tip strong { display: block; margin-bottom: 6px; }
.upload-tip span { color: var(--subtext); font-size: 14px; }

.upload-progress-wrap {
    width: 100%;
    height: 24px;
    background: rgba(196, 181, 255, 0.18);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 6px;
    border: 1px solid rgba(196, 181, 255, 0.45);
}
.upload-progress-bar {
    height: 100%;
    width: 0%;
    line-height: 22px;
    text-align: center;
    font-size: 12px;
    color: #4c1d95;
    background: rgba(196, 181, 255, 0.45);
    transition: width 0.2s ease;
}
.upload-status {
    color: var(--subtext);
    min-height: 22px;
    font-size: 14px;
}

.form-actions, .table-actions, .toolbar-actions, .pagination-list { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.btn {
    border: none;
    cursor: pointer;
    border-radius: 999px;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 700;
    transition: transform .15s ease, opacity .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary {
    color: #fff;
    background: linear-gradient(135deg, var(--purple-strong), var(--purple-dark));
}
.btn.ghost {
    background: rgba(255,255,255,0.75);
    border: 1px solid var(--line);
}
.btn.danger {
    color: #fff;
    background: linear-gradient(135deg, #ef4444, #b91c1c);
}
.btn.mini, .btn.disabled {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 68px;
    padding: 8px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--purple-strong), var(--purple-dark));
    color: #fff;
    font-size: 12px;
}
.btn.disabled {
    background: #c4b5fd66;
    color: #6b5d88;
    cursor: default;
}

.live-dot {
    background: rgba(22,163,74,0.12);
    color: var(--success);
    border: 1px solid rgba(22,163,74,0.15);
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.live-list { display: grid; gap: 14px; }
.live-item {
    border-radius: 18px;
    padding: 14px;
    background: linear-gradient(180deg, rgba(255,255,255,0.84), rgba(196,181,255,0.18));
    border: 1px solid var(--line);
}
.live-title-row, .live-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.live-title-row { margin-bottom: 10px; }
.live-meta {
    color: var(--subtext);
    font-size: 13px;
    margin-top: 10px;
}

.progress-bar, .mini-progress {
    height: 12px;
    background: rgba(139, 92, 246, 0.08);
    border-radius: 999px;
    overflow: hidden;
}
.progress-bar span, .mini-progress span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(196,181,255,0.8), rgba(109,40,217,0.95));
}
.mini-progress { width: 120px; margin-bottom: 6px; }

.status-chip, .type-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.82);
}
.status-chip.completed { color: var(--success); }
.status-chip.failed { color: var(--danger); }
.status-chip.downloading { color: var(--warning); }
.status-chip.queued { color: var(--purple-dark); }

.table-wrap { overflow: auto; }
.table-tools { color: var(--subtext); }

.filter-bar {
    display: grid;
    grid-template-columns: 1.2fr 180px 180px auto auto;
    gap: 12px;
    margin-bottom: 16px;
}
.compact-filter input, .compact-filter select { min-width: 0; }

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1180px;
}

thead th {
    background: rgba(196,181,255,0.16);
    color: var(--subtext);
    text-align: left;
    padding: 14px 12px;
    font-size: 13px;
    position: sticky;
    top: 0;
}

tbody td {
    border-top: 1px solid rgba(139, 92, 246, 0.08);
    padding: 14px 12px;
    vertical-align: top;
}

.file-name-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.file-name-cell small { margin-top: 0; }
.source-cell {
    max-width: 260px;
    word-break: break-all;
    color: var(--subtext);
}
.action-stack {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.empty-box {
    border-radius: 18px;
    padding: 18px;
    text-align: center;
    color: var(--subtext);
    background: linear-gradient(180deg, rgba(255,255,255,0.82), rgba(196,181,255,0.14));
}

.pagination-wrap {
    margin-top: 18px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}
.pagination-meta { color: var(--subtext); }

.preview-page-body {
    min-height: 100vh;
    padding: 24px;
}
.preview-shell {
    width: min(1200px, 100%);
    margin: 0 auto;
    display: grid;
    gap: 18px;
}
.preview-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}
.preview-head h1 { margin: 0 0 8px; font-size: 24px; }
.preview-head p { margin: 0; color: var(--subtext); }
.preview-body { min-height: 70vh; }
.preview-image, .preview-media, .preview-frame {
    width: 100%;
    max-height: 72vh;
    border: none;
    border-radius: 18px;
    background: rgba(255,255,255,0.86);
}
.preview-frame { height: 72vh; }
.preview-audio { width: 100%; }
.preview-text {
    white-space: pre-wrap;
    word-break: break-word;
    background: rgba(255,255,255,0.88);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px;
    min-height: 60vh;
    overflow: auto;
}

@media (max-width: 1100px) {
    .page-shell { grid-template-columns: 1fr; }
    .grid.two-col, .filter-bar { grid-template-columns: 1fr; }
}

.bulk-actions-group {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 10px;
}

.lightbox-modal[hidden] {
    display: none !important;
}

.modal-open {
    overflow: hidden;
}

.lightbox-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(24, 16, 40, 0.72);
    backdrop-filter: blur(6px);
}

.lightbox-shell {
    position: relative;
    width: min(1200px, calc(100% - 36px));
    height: min(88vh, 900px);
    margin: 4vh auto 0;
    border-radius: 26px;
    background: rgba(255,255,255,0.96);
    border: 1px solid rgba(255,255,255,0.75);
    box-shadow: 0 30px 90px rgba(0,0,0,0.25);
    overflow: hidden;
    display: grid;
    grid-template-columns: 64px 1fr 64px;
    grid-template-rows: 1fr auto;
}

.lightbox-stage {
    grid-column: 1 / span 3;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 24px 70px 12px;
}

.lightbox-stage img {
    max-width: 100%;
    max-height: calc(88vh - 150px);
    object-fit: contain;
    border-radius: 20px;
    background: rgba(248, 245, 255, 0.9);
}

.lightbox-nav,
.lightbox-close {
    appearance: none;
    border: 0;
    cursor: pointer;
}

.lightbox-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    background: rgba(196,181,255,0.55);
    color: #462b85;
    font-size: 30px;
    line-height: 42px;
    z-index: 2;
}

.lightbox-nav {
    align-self: center;
    justify-self: center;
    width: 44px;
    height: 64px;
    border-radius: 14px;
    background: rgba(196,181,255,0.35);
    color: #462b85;
    font-size: 36px;
    line-height: 1;
    z-index: 1;
}

.lightbox-nav.prev {
    grid-column: 1;
    grid-row: 1;
}

.lightbox-nav.next {
    grid-column: 3;
    grid-row: 1;
}

.lightbox-info {
    grid-column: 1 / span 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 24px 22px;
    border-top: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255,255,255,0.82), rgba(196,181,255,0.14));
}

.lightbox-info strong {
    display: block;
    margin-bottom: 4px;
}

.lightbox-info span {
    color: var(--subtext);
    font-size: 13px;
}

@media (max-width: 760px) {
    .lightbox-shell {
        width: calc(100% - 16px);
        height: calc(100vh - 16px);
        margin: 8px auto 0;
        grid-template-columns: 42px 1fr 42px;
    }

    .lightbox-stage {
        padding: 18px 48px 8px;
    }

    .lightbox-nav {
        width: 36px;
        height: 52px;
        font-size: 28px;
    }

    .lightbox-info {
        padding: 14px;
        align-items: flex-start;
        flex-direction: column;
    }
}
