:root {
    --bg-color: #0f172a;
    --sidebar-bg: #1e293b;
    --card-bg: rgba(30, 41, 59, 0.8);
    --primary-color: #8b5cf6;
    --primary-hover: #7c3aed;
    --accent-color: #22c55e;
    --text-color: #e2e8f0;
    --text-muted: #94a3b8;
    --border-color: rgba(148, 163, 184, 0.15);
    --error-color: #ef4444;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
}

/* Sidebar */
.sidebar {
    width: 200px;
    min-width: 200px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
}

.sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    background: linear-gradient(to right, #c084fc, #6366f1);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.sidebar-user {
    margin-top: 0.75rem;
    padding: 0.625rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
}

.user-name {
    color: var(--text-color);
    font-weight: 500;
}

.logout-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
}

.logout-link:hover {
    color: var(--error-color);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.nav-item:hover {
    background: rgba(139, 92, 246, 0.1);
    color: var(--text-color);
}

.nav-item.active {
    background: var(--primary-color);
    color: white;
}

.nav-item.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.nav-icon {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    background: rgba(255,255,255,0.1);
    padding: 0.25rem 0.375rem;
    border-radius: 0.25rem;
}

.nav-badge {
    margin-left: auto;
    font-size: 0.625rem;
    background: rgba(255,255,255,0.1);
    padding: 0.125rem 0.375rem;
    border-radius: 999px;
    text-transform: uppercase;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 200px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
}

/* Split Layout */
.split-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Input Panel */
.input-panel {
    width: 360px;
    min-width: 320px;
    max-width: 400px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h2 {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

form {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.section-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Refs/Media Sections */
.refs-section,
.media-section {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

/* Frames Section (Video) */
.frames-section {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.frame-upload {
    flex: 1;
    min-width: 0;
}

.frame-upload .media-upload-area {
    margin-bottom: 0;
}

.frame-upload .upload-dropzone {
    padding: 0.5rem;
    min-height: 80px;
}

.frame-upload .dropzone-icon {
    font-size: 1.25rem;
    margin-bottom: 0.125rem;
}

.frame-upload .dropzone-text {
    font-size: 0.7rem;
}

.frame-upload .media-preview {
    max-height: 100px;
}

.frame-upload .media-preview img {
    max-height: 80px;
}

/* Ref Images Section (Reference Video) */
.ref-images-section {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.ref-images-section .section-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.ref-images-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.ref-upload {
    min-width: 0;
}

.ref-upload .media-upload-area {
    margin-bottom: 0;
}

.ref-upload .upload-dropzone {
    padding: 0.5rem;
    min-height: 80px;
}

.ref-upload .dropzone-icon {
    font-size: 1.25rem;
    margin-bottom: 0.125rem;
}

.ref-upload .dropzone-text {
    font-size: 0.7rem;
}

.ref-upload .media-preview {
    max-height: 100px;
}

.ref-upload .media-preview img {
    max-height: 80px;
}

.file-upload-area,
.media-upload-area {
    margin-bottom: 0.75rem;
}

.upload-dropzone {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    border: 1px dashed var(--border-color);
    border-radius: 0.5rem;
    text-align: center;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.8rem;
    transition: all 0.2s;
}

.upload-dropzone:hover,
.upload-dropzone.highlight {
    border-color: var(--primary-color);
    background: rgba(139, 92, 246, 0.05);
    color: var(--text-color);
}

.upload-dropzone input {
    display: none;
}

.dropzone-content {
    text-align: center;
}

.dropzone-icon {
    display: block;
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.refs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 0.5rem;
}

.thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: 0.375rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

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

.thumb-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    background: rgba(0,0,0,0.7);
    color: white;
    border-radius: 50%;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.thumb:hover .thumb-remove {
    opacity: 1;
}

/* Media Preview (Describe) */
.media-preview {
    position: relative;
    border-radius: 0.5rem;
    overflow: hidden;
    background: rgba(0,0,0,0.3);
}

.media-preview img,
.media-preview video {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    display: block;
}

.remove-media {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 28px;
    height: 28px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-media:hover {
    background: var(--error-color);
}

/* Options Section (Describe) */
.options-section {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.option-group {
    flex: 1;
}

.option-group select {
    width: 100%;
    padding: 0.5rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.8rem;
}

.option-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Prompt Section */
.prompt-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    min-height: 0;
}

.prompt-section textarea {
    flex: 1;
    width: 100%;
    min-height: 100px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem;
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.875rem;
    resize: none;
    line-height: 1.5;
}

.prompt-section textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Generate/Submit Section */
.generate-section {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.primary-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    background: linear-gradient(to right, var(--primary-color), #6366f1);
    border: none;
    border-radius: 0.5rem;
    color: white;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

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

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.describe-btn {
    background: linear-gradient(to right, var(--accent-color), #10b981);
}

.error-msg {
    color: var(--error-color);
    font-size: 0.8rem;
    margin-top: 0.5rem;
    text-align: center;
}

/* Output Panel */
.output-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* Output Split Layout (60/40) */
.output-split {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.results-column {
    flex: 6;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.details-column {
    flex: 4;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-left: 1px solid var(--border-color);
    background: var(--sidebar-bg);
    min-width: 280px;
    max-width: 400px;
}

.details-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.detail-preview {
    margin-bottom: 1rem;
    border-radius: 0.5rem;
    overflow: hidden;
    background: rgba(0,0,0,0.3);
}

.detail-preview img,
.detail-preview video {
    width: 100%;
    display: block;
    cursor: pointer;
}

/* Frame capture section */
.frame-capture-section {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: rgba(0,0,0,0.2);
    border-radius: 0.5rem;
}

.frame-capture-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.frame-time-input {
    width: 70px;
    padding: 0.4rem 0.5rem;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    color: var(--text-color);
    font-size: 0.85rem;
    text-align: right;
}

.frame-time-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.frame-time-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-right: 0.5rem;
}

.frame-capture-status {
    font-size: 0.75rem;
    margin-top: 0.5rem;
    color: var(--text-muted);
}

.frame-capture-status.success {
    color: var(--accent-color);
}

.frame-capture-status.error {
    color: var(--error-color);
}

.detail-section {
    margin-bottom: 1rem;
}

.detail-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.375rem;
}

.detail-text {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-color);
    white-space: pre-wrap;
}

.detail-settings {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--primary-color);
}

.detail-refs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.detail-refs img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 0.375rem;
    border: 1px solid var(--border-color);
}

.detail-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.detail-actions .action-btn {
    width: 100%;
    justify-content: center;
}

.detail-actions .action-btn.primary {
    background: linear-gradient(to right, var(--primary-color), #6366f1);
    border: none;
    color: white;
}

/* Selected result card */
.result-card.selected {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

.clear-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.625rem;
    border-radius: 0.375rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    width: auto;
}

.clear-btn:hover {
    color: var(--text-color);
    border-color: var(--text-muted);
}

/* Results Feed */
.results-feed {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    align-content: start;
}

.results-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-content: start;
}

.results-grid .result-card {
    flex: 0 0 auto;
    width: 280px;
}

.results-grid .result-image-wrapper {
    width: 100%;
}

.results-grid .result-image {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    padding: 3rem;
}

/* Result Cards */
.result-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    overflow: hidden;
}

.results-list .result-card {
    display: flex;
}

.result-card.pending .generating-placeholder {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--text-muted);
    background: rgba(139, 92, 246, 0.05);
}

.results-grid .result-card.pending .generating-placeholder {
    aspect-ratio: 1;
}

.generating-placeholder .gen-note {
    font-size: 0.75rem;
    opacity: 0.7;
}

.generating-placeholder .server-pending-detail {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.result-card.error {
    border-color: rgba(239, 68, 68, 0.3);
}

.result-error {
    padding: 1.5rem;
    text-align: center;
    color: var(--error-color);
    width: 100%;
}

.result-error span {
    font-weight: 500;
}

.result-error p {
    font-size: 0.8rem;
    margin-top: 0.5rem;
    opacity: 0.8;
}

/* Generate Result Card */
.result-image-wrapper {
    position: relative;
    cursor: pointer;
}

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

.use-ref-btn {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    color: var(--text-color);
    font-size: 0.7rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.result-image-wrapper:hover .use-ref-btn {
    opacity: 1;
}

.result-meta {
    padding: 0.5rem 0.75rem;
    border-top: 1px solid var(--border-color);
    max-height: 80px;
    overflow: hidden;
}

.result-meta.expanded {
    max-height: none;
    overflow: visible;
}

.result-prompt-preview {
    font-size: 0.8rem;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.25rem;
    margin: -0.25rem;
    border-radius: 0.25rem;
    transition: background 0.2s;
}

.result-prompt-preview:hover {
    background: rgba(255,255,255,0.05);
}

.expand-hint {
    color: var(--primary-color);
    font-size: 0.7rem;
}

.result-details {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.result-prompt-full {
    font-size: 0.8rem;
    color: var(--text-color);
    line-height: 1.5;
    white-space: pre-wrap;
    margin-bottom: 0.75rem;
}

.result-refs {
    margin-bottom: 0.75rem;
}

.refs-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 0.375rem;
}

.refs-thumbs {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.refs-thumbs img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 0.25rem;
    border: 1px solid var(--border-color);
}

.result-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
}

/* Describe Result Card */
.result-media {
    width: 160px;
    min-width: 160px;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.result-media img,
.result-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-content {
    flex: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
}

.result-meta-info {
    display: flex;
    gap: 0.5rem;
}

.model-badge {
    font-size: 0.65rem;
    background: rgba(34, 197, 94, 0.2);
    color: var(--accent-color);
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.result-description {
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-color);
    flex: 1;
}

.result-prompt-info {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.prompt-label {
    font-weight: 500;
}

.result-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    color: var(--text-color);
    font-size: 0.75rem;
    cursor: pointer;
    width: auto;
}

.action-btn:hover {
    background: rgba(139, 92, 246, 0.25);
}

.action-btn.danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--error-color);
}

.action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* Loader */
.loader {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 2rem;
}

.modal-content {
    background: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    width: 90vw;
    max-width: 1100px;
    height: 85vh;
    max-height: 900px;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-content > .modal-header,
.modal-content > .library-tabs {
    flex-shrink: 0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1rem;
    font-weight: 500;
}

.modal-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.add-selected-btn {
    background: var(--primary-color);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    color: white;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    width: auto;
}

.add-selected-btn:hover {
    opacity: 0.9;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: auto;
}

.close-btn:hover {
    color: var(--text-color);
}

.library-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.library-tab {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 0.375rem 0.75rem;
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    width: auto;
}

.library-tab:hover {
    color: var(--text-color);
}

.library-tab.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.library-tab-content {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.library-tab-content.active {
    display: flex;
}

.library-tab-content .empty-msg {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}

.library-upload-area {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.library-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    border: 2px dashed var(--border-color);
    border-radius: 0.5rem;
    text-align: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
}

.library-dropzone:hover,
.library-dropzone.highlight {
    border-color: var(--primary-color);
    background: rgba(139, 92, 246, 0.05);
    color: var(--text-color);
}

.library-dropzone input {
    display: none;
}

.library-dropzone .dropzone-icon {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.library-dropzone .dropzone-text {
    font-size: 0.85rem;
}

.upload-status {
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    text-align: center;
}

.upload-status.uploading {
    background: rgba(139, 92, 246, 0.15);
    color: var(--primary-color);
}

.upload-status.success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-color);
}

.upload-status.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error-color);
}

.library-grid {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    grid-auto-rows: 120px;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    overflow-y: auto;
    overflow-x: hidden;
}

.library-grid.active,
.library-tab-content.active .library-grid {
    display: grid;
}

.library-grid:empty::after {
    content: 'No items';
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
    grid-column: 1 / -1;
}

.library-item {
    width: 100%;
    height: 100%;
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    position: relative;
    background: rgba(0, 0, 0, 0.2);
}

.library-item:hover {
    border-color: var(--primary-color);
}

.library-item .delete-btn {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 22px;
    height: 22px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.library-item:hover .delete-btn {
    opacity: 1;
}

.library-item .delete-btn:hover {
    background: var(--error-color);
}

.library-item.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.3);
}

.library-item.selected .select-check {
    opacity: 1;
}

.library-item img,
.library-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.select-check {
    position: absolute;
    top: 0.375rem;
    right: 0.375rem;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s;
}

.video-badge {
    position: absolute;
    bottom: 0.375rem;
    left: 0.375rem;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    pointer-events: none;
}

.empty-msg {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 2rem;
}

/* Legacy lightbox styles - now using .lightbox-media img/video */

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 2rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

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

.lightbox-content {
    display: flex;
    max-width: 95vw;
    max-height: 90vh;
    gap: 1.5rem;
}

.lightbox-media {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-media img,
.lightbox-media video {
    max-width: 70vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 0.5rem;
}

.lightbox-info {
    width: 350px;
    max-height: 85vh;
    overflow-y: auto;
    background: rgba(30, 41, 59, 0.95);
    border-radius: 0.75rem;
    padding: 1rem;
    color: var(--text-color);
    font-size: 0.85rem;
    line-height: 1.5;
}

.lightbox-info::-webkit-scrollbar {
    width: 6px;
}

.lightbox-info::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.lightbox-section {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.lightbox-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.lightbox-section strong {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.lightbox-section p {
    margin: 0;
    white-space: pre-wrap;
}

.lightbox-settings p {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--primary-color);
}

/* Description indicator on library items */
.library-item .desc-indicator {
    position: absolute;
    bottom: 0.35rem;
    right: 0.35rem;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    color: white;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Advanced Options Toggle */
.advanced-section {
    border-top: 1px solid var(--border-color);
}

.advanced-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.advanced-toggle:hover {
    color: var(--text-color);
}

.advanced-toggle span {
    font-size: 0.65rem;
}

.advanced-options {
    padding: 0 1rem 1rem;
}

.advanced-options .options-section {
    padding: 0;
    border-bottom: none;
    margin-bottom: 0.75rem;
}

.option-field {
    margin-bottom: 0.75rem;
}

.option-field input[type="text"] {
    width: 100%;
    padding: 0.5rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.8rem;
}

.option-field input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Checkbox Group */
.checkbox-group {
    margin-bottom: 0.5rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    accent-color: var(--primary-color);
}

/* Story Breakdown */
.story-breakdown {
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--text-color);
}

.story-breakdown p {
    margin-bottom: 0.5rem;
}

.story-breakdown strong {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Responsive */
@media (max-width: 1200px) {
    .details-column {
        min-width: 240px;
        max-width: 320px;
    }
}

@media (max-width: 1024px) {
    .split-layout {
        flex-direction: column;
    }

    .input-panel {
        width: 100%;
        max-width: none;
        height: auto;
        max-height: 40vh;
    }

    .output-panel {
        flex: 1;
        min-height: 0;
    }

    .output-split {
        flex-direction: column;
    }

    .details-column {
        flex: none;
        height: 35vh;
        min-width: 0;
        max-width: none;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }

    .results-list .result-card {
        flex-direction: column;
    }

    .result-media {
        width: 100%;
        height: 150px;
    }

    .lightbox-content {
        flex-direction: column;
        align-items: center;
    }

    .lightbox-media img,
    .lightbox-media video {
        max-width: 90vw;
        max-height: 50vh;
    }

    .lightbox-info {
        width: 90vw;
        max-height: 35vh;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 60px;
        min-width: 60px;
    }

    .sidebar-header h1 {
        font-size: 0.9rem;
    }

    .nav-label, .nav-badge {
        display: none;
    }

    .nav-item {
        justify-content: center;
    }

    .main-content {
        margin-left: 60px;
    }
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-color);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.login-card {
    background: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 2.5rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 2rem;
    font-weight: 600;
    background: linear-gradient(to right, #c084fc, #6366f1);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.25rem;
}

.login-header p {
    color: var(--text-muted);
    font-size: 1rem;
}

.login-field {
    margin-bottom: 1.25rem;
}

.login-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.login-field input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-color);
    font-family: inherit;
    font-size: 1rem;
}

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

.login-field input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.login-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--error-color);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
    text-align: center;
}

.login-btn {
    width: 100%;
    padding: 0.875rem 1rem;
    background: linear-gradient(to right, var(--primary-color), #6366f1);
    border: none;
    border-radius: 0.5rem;
    color: white;
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

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

/* ========================================
   Image Editor Styles
   ======================================== */

.editor-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
}

/* Saved images grid in left panel */
.saved-results-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.saved-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 0.5rem;
    overflow-y: auto;
    flex: 1;
    padding: 0.25rem;
}

.saved-grid .empty-msg {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 1rem;
}

.saved-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 0.375rem;
    overflow: hidden;
    cursor: pointer;
}

.saved-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.saved-item:hover .delete-btn {
    opacity: 1;
}

/* Editor output panel */
.editor-output-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.editor-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

.editor-empty-state {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1rem;
}

.editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

/* Top toolbar */
.editor-top-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    flex-shrink: 0;
    overflow-x: auto;
}

.tool-buttons {
    display: flex;
    gap: 0.375rem;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
    margin: 0 0.25rem;
}

.toolbar-spacer {
    flex: 1;
}

.tool-btn {
    width: 36px;
    height: 36px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.tool-btn:hover {
    border-color: var(--primary-color);
    color: var(--text-color);
}

.tool-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.tool-btn.small {
    width: auto;
    padding: 0 0.5rem;
    font-size: 0.7rem;
}

/* Inline tool options */
.tool-options-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tool-options-inline label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.tool-options-inline input[type="range"] {
    width: 80px;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    -webkit-appearance: none;
    appearance: none;
}

.tool-options-inline input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
}

.tool-options-inline input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.tool-options-inline input[type="text"] {
    width: 150px;
    padding: 0.375rem 0.5rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    color: var(--text-color);
    font-size: 0.8rem;
    font-family: inherit;
}

.tool-options-inline input[type="number"] {
    width: 50px;
    padding: 0.375rem 0.5rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    color: var(--text-color);
    font-size: 0.8rem;
    font-family: inherit;
    text-align: center;
}

.tool-options-inline input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.tool-options-inline span {
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 20px;
}

.grid-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-right: 0.5rem;
}

.color-picker-inline {
    display: flex;
    gap: 0.25rem;
}

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 0.25rem;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: all 0.15s;
}

.color-swatch:hover {
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.color-swatch.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.3);
}

.save-btn {
    white-space: nowrap;
}

/* Canvas area */
.editor-canvas-area {
    flex: 1;
    background: #0a0f1a;
    overflow: hidden;
    min-height: 0;
    min-width: 0;
    position: relative;
}

.canvas-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform-origin: center center;
    transform: translate(-50%, -50%);
}

#editor-canvas {
    display: block;
    border-radius: 0.25rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    cursor: crosshair;
}

/* Zoom controls */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0 0.5rem;
    border-left: 1px solid var(--border-color);
    margin-left: 0.5rem;
}

.zoom-controls span {
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 40px;
    text-align: center;
}

.loader.mini {
    width: 14px;
    height: 14px;
    border-width: 2px;
    margin-left: 0.5rem;
}

/* =============================================================================
   Library Manager
   ============================================================================= */

.library-manager {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-color);
}

.manager-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--sidebar-bg);
}

.category-tabs {
    display: flex;
    gap: 0.5rem;
}

.category-tab {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.category-tab:hover {
    color: var(--text-color);
    border-color: var(--text-muted);
}

.category-tab.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.manager-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.view-toggle {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-color);
    padding: 0.25rem;
    border-radius: 0.375rem;
}

.view-btn {
    padding: 0.375rem 0.625rem;
    background: transparent;
    border: none;
    border-radius: 0.25rem;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.15s;
}

.view-btn:hover {
    color: var(--text-color);
}

.view-btn.active {
    background: var(--primary-color);
    color: white;
}

.selection-info {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.selection-info span {
    color: var(--text-color);
    font-weight: 500;
}

.manager-content {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* File List Panel */
.file-list-panel {
    width: 35%;
    min-width: 350px;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    overflow: hidden;
}

/* Right Panel */
.right-panel {
    flex: 1;
    display: flex;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.file-list-header {
    display: flex;
    padding: 0.625rem 1rem;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.file-list-header .col-name {
    flex: 1;
}

.file-list-header .col-date {
    width: 140px;
    text-align: center;
}

.file-list-header .col-type {
    width: 50px;
    text-align: center;
}

.file-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    outline: none;
}

.file-row {
    display: flex;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.15s;
    font-size: 0.8125rem;
}

.file-row:hover {
    background: rgba(139, 92, 246, 0.1);
}

.file-row.focused {
    background: rgba(139, 92, 246, 0.2);
    outline: 1px solid var(--primary-color);
    outline-offset: -1px;
}

.file-row.selected {
    background: rgba(139, 92, 246, 0.25);
}

.file-row.selected.focused {
    background: rgba(139, 92, 246, 0.35);
}

.file-row .col-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-color);
}

.file-row .col-date {
    width: 140px;
    text-align: center;
    color: var(--text-muted);
}

.file-row .col-type {
    width: 50px;
    text-align: center;
    color: var(--text-muted);
}

.file-list-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--sidebar-bg);
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.keyboard-hint {
    opacity: 0.7;
}

/* Thumbnail Panel */
.thumb-panel {
    flex: 1;
    min-height: 0;
    min-width: 0;
    overflow-y: auto;
    padding: 1rem;
    background: var(--bg-color);
}

/* View mode toggle via data attribute */
.right-panel[data-view="preview"] .thumb-panel {
    display: none !important;
}

.right-panel[data-view="grid"] .preview-panel {
    display: none !important;
}

.thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
}

.thumb-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 0.375rem;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s, transform 0.15s;
}

.thumb-item:hover {
    transform: scale(1.02);
}

.thumb-item.focused {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.3);
}

.thumb-item.selected {
    border-color: var(--accent-color);
}

.thumb-item.selected .select-indicator {
    opacity: 1;
}

.thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumb-item .video-badge {
    position: absolute;
    bottom: 0.375rem;
    left: 0.375rem;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.thumb-item .select-indicator {
    position: absolute;
    top: 0.375rem;
    right: 0.375rem;
    width: 22px;
    height: 22px;
    background: var(--accent-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.15s;
}

/* Preview Panel */
.preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    background: var(--bg-color);
    overflow: hidden;
}

.preview-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    min-height: 0;
    overflow: hidden;
}

.preview-empty {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.preview-media {
    max-width: 100%;
    max-height: calc(100% - 2rem);
    object-fit: contain;
    border-radius: 0.5rem;
    background: var(--sidebar-bg);
}

.preview-filename {
    margin-top: 0.75rem;
    padding: 0.375rem 0.75rem;
    background: var(--sidebar-bg);
    border-radius: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Library Manager Responsive */
@media (max-width: 1024px) {
    .manager-content {
        flex-direction: column;
    }

    .file-list-panel {
        width: 100%;
        min-width: 0;
        height: 40%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .right-panel {
        height: 60%;
    }

    .thumb-panel,
    .preview-panel {
        height: 100%;
    }

    .keyboard-hint {
        display: none;
    }
}

/* =============================================================================
   Status Dashboard
   ============================================================================= */

.status-page {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-color);
}

.status-title {
    font-size: 1rem;
    font-weight: 500;
}

.status-auto-refresh {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.status-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.status-section {
    background: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    overflow: hidden;
}

.status-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.status-section-header h3 {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-color);
}

.active-count {
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--primary-color);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    min-width: 20px;
    text-align: center;
}

.status-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Jobs Table */
.jobs-table {
    width: 100%;
    border-collapse: collapse;
}

.jobs-table thead th {
    padding: 0.625rem 1rem;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
    background: rgba(0, 0, 0, 0.15);
}

.jobs-table tbody td {
    padding: 0.75rem 1rem;
    font-size: 0.825rem;
    border-top: 1px solid var(--border-color);
}

.jobs-table tbody tr:first-child td {
    border-top: none;
}

.job-user {
    font-weight: 500;
    color: var(--text-color);
}

.job-detail {
    max-width: 350px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-muted);
}

.job-time {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.job-duration {
    font-family: monospace;
    font-size: 0.825rem;
    color: var(--text-color);
}

/* Job Type Badges */
.job-type-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.job-type-badge.type-generate {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
}

.job-type-badge.type-describe {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.job-type-badge.type-video {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.job-type-badge.type-refvideo {
    background: rgba(6, 182, 212, 0.2);
    color: #22d3ee;
}

.job-type-badge.type-character {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.job-type-badge.type-storyvideo {
    background: rgba(236, 72, 153, 0.2);
    color: #f472b6;
}

/* Elapsed Time */
.elapsed-time {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--text-color);
}

.elapsed-time.long-running {
    color: #fbbf24;
    font-weight: 600;
}

/* Status Badges */
.job-status-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.job-status-badge.status-success {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.job-status-badge.status-fail {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* Retry Button */
.retry-btn {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.15rem 0.5rem;
    font-size: 0.65rem;
    font-weight: 600;
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 999px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.retry-btn:hover {
    background: rgba(139, 92, 246, 0.35);
    color: white;
}

.retry-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
