/* Modern Premium Glassmorphism Design System */
:root {
    --bg-dark: #0a0a0c;
    --bg-dark-gradient: linear-gradient(135deg, #0c0c0f 0%, #15151e 100%);
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.06);
    --border-glass: rgba(255, 255, 255, 0.05);
    --border-glass-focus: rgba(157, 78, 221, 0.3);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --accent-purple: #9d4edd;
    --accent-purple-glow: rgba(157, 78, 221, 0.4);
    --accent-cyan: #00f5d4;
    --accent-cyan-glow: rgba(0, 245, 212, 0.4);
    
    --btn-primary-bg: linear-gradient(135deg, #7b2cbf 0%, #9d4edd 100%);
    --btn-accent-bg: linear-gradient(135deg, #00b4d8 0%, #00f5d4 100%);
    
    /* Semantic Colors */
    --color-green: #00e676;
    --color-green-glow: rgba(0, 230, 118, 0.3);
    --color-orange: #ff7043;
    --color-orange-glow: rgba(255, 112, 67, 0.3);
    --color-grey: #64748b;
    --color-grey-glow: rgba(100, 116, 139, 0.2);
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    --blur-intensity: 16px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background: var(--bg-dark);
    background-image: var(--bg-dark-gradient);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Background Glowing Orbs */
body::before, body::after {
    content: '';
    position: fixed;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    z-index: -1;
    filter: blur(120px);
    opacity: 0.15;
    pointer-events: none;
}
body::before {
    top: 10%;
    left: 20%;
    background: var(--accent-purple);
}
body::after {
    bottom: 10%;
    right: 20%;
    background: var(--accent-cyan);
}

/* App Container Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Scrollbars styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.01);
}
::-webkit-scrollbar-thumb {
    background: rgba(157, 78, 221, 0.3);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(157, 78, 221, 0.5);
}

/* Sidebar Styling */
.sidebar {
    width: 20vw;
    background: rgba(10, 10, 12, 0.6);
    backdrop-filter: blur(var(--blur-intensity));
    border-right: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    height: 100%;
    flex-shrink: 0;
    z-index: 10;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-glass);
}

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

.logo-icon {
    font-size: 24px;
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 8px var(--accent-purple-glow));
}

.logo-text {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 20px;
    letter-spacing: 1px;
}

.logo-text span {
    color: var(--accent-cyan);
    font-weight: 400;
}

/* Section Containers inside Sidebar */
.section-container {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-glass);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.section-header h3 {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-header h3 i {
    color: var(--accent-purple);
}

/* Inputs and Forms */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.input-group label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

input[type="text"], textarea, .form-control {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 13px;
    transition: var(--transition-smooth);
}

input[type="text"]:focus, textarea:focus, .form-control:focus {
    outline: none;
    border-color: var(--accent-purple);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 12px var(--accent-purple-glow);
}

/* Read-only fields sourced from defaults.json (repo). */
.form-control:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.defaults-note {
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-muted);
    margin: 6px 0 2px;
}
.defaults-note i { margin-right: 6px; color: var(--accent-cyan); }
.defaults-note code {
    color: var(--accent-cyan);
    background: rgba(0, 0, 0, 0.3);
    padding: 1px 4px;
    border-radius: 4px;
}

/* Auth Status Card */
.auth-status {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
}

.status-indicator .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-indicator.connected .dot {
    background: var(--color-green);
    box-shadow: 0 0 8px var(--color-green-glow);
}

.status-indicator.connected {
    color: var(--color-green);
}

.status-indicator.disconnected .dot {
    background: var(--color-orange);
    box-shadow: 0 0 8px var(--color-orange-glow);
}

.status-indicator.disconnected {
    color: var(--color-orange);
}

/* Scene Add Row */
.scene-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    animation: slideDown 0.2s ease-out;
}

/* Scenes List */
.scenes-list {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 320px;
}

.scene-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.scene-item:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.scene-item.active {
    background: rgba(157, 78, 221, 0.08);
    border-color: var(--accent-purple);
    box-shadow: 0 0 10px rgba(157, 78, 221, 0.15);
}

.scene-item-info {
    display: flex;
    flex-direction: column;
}

.scene-num {
    font-size: 10px;
    font-weight: 700;
    color: var(--accent-cyan);
    text-transform: uppercase;
}

.scene-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.scene-item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: var(--transition-smooth);
}

.scene-item:hover .scene-item-actions {
    opacity: 1;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 13px;
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 14px;
}

.btn-primary {
    background: var(--btn-primary-bg);
    color: #fff;
    box-shadow: 0 4px 14px var(--accent-purple-glow);
}
.btn-primary:hover {
    filter: brightness(1.1);
    box-shadow: 0 6px 20px rgba(157, 78, 221, 0.6);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-glass);
    color: var(--text-primary);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-accent {
    background: var(--btn-accent-bg);
    color: #0c0c0f;
    box-shadow: 0 4px 14px var(--accent-cyan-glow);
}
.btn-accent:hover {
    filter: brightness(1.1);
    box-shadow: 0 6px 20px rgba(0, 245, 212, 0.6);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
}
.btn-outline:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-green {
    background: var(--color-green);
    color: #0a0a0c;
    box-shadow: 0 4px 12px var(--color-green-glow);
}
.btn-green:hover {
    filter: brightness(1.1);
    box-shadow: 0 6px 16px rgba(0, 230, 118, 0.5);
}
/* Lightbox "Select as Final" while the shown item is already the final */
.btn-green.is-final {
    background: transparent;
    color: var(--color-green);
    border-color: var(--color-green);
    box-shadow: none;
}

.btn-orange {
    background: var(--color-orange);
    color: #fff;
    box-shadow: 0 4px 12px var(--color-orange-glow);
}
.btn-orange:hover {
    filter: brightness(1.1);
    box-shadow: 0 6px 16px rgba(255, 112, 67, 0.5);
}

.btn-grey {
    background: var(--color-grey);
    color: #fff;
    box-shadow: 0 4px 12px var(--color-grey-glow);
}
.btn-grey:hover {
    filter: brightness(1.1);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition-smooth);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.btn-icon-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-accent {
    background: rgba(0, 245, 212, 0.1);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 245, 212, 0.2);
}

/* Read-only shot code from the JSON. Monospace + not uppercased, since it is a
   literal machine tag that gets appended to exported file names. */
.shot-code-badge {
    background: rgba(0, 245, 212, 0.12);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 245, 212, 0.35);
    font-family: monospace;
    font-weight: 600;
    text-transform: none;
}

/* Main Workspace */
.main-workspace {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.workspace-header {
    height: auto;
    min-height: 48px;
    border-bottom: 1px solid var(--border-glass);
    padding: 12px 20px;
    background: var(--bg-main);
    flex-shrink: 0;
}

.header-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

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

.shot-notes-header {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-light);
    max-width: 800px;
    word-wrap: break-word;
}

.header-project-info h2 {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-project-info p {
    font-size: 12px;
    color: var(--text-muted);
}

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

/* Content Area — now handled by shot-strips-container */
.workspace-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Glass Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    backdrop-filter: blur(var(--blur-intensity));
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-premium);
}

.glass-card {
    background: rgba(20, 20, 25, 0.4);
    border: 1px solid var(--border-glass);
}

/* Welcome Panel */
.welcome-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
    height: calc(100vh - 48px);
}

.welcome-card {
    text-align: center;
    max-width: 500px;
}

.welcome-icon {
    font-size: 64px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 16px var(--accent-purple-glow));
}

.welcome-card h2 {
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 12px;
}

.welcome-card p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
}

.setup-steps {
    list-style: none;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.setup-steps li {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13px;
    color: var(--text-secondary);
}

.setup-steps li span {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-purple);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}

/* Scene Builder Panel Layout */
.scene-panel {
    height: 100%;
}

.builder-grid {
    display: grid;
    grid-template-columns: 480px 1fr;
    gap: 24px;
    height: 100%;
}

.generator-config-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.generator-config-card h3 {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-cyan);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Dropzone styling */
.dropzone {
    border: 2px dashed var(--border-glass);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    background: rgba(255, 255, 255, 0.01);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.dropzone:hover {
    border-color: var(--accent-purple);
    background: rgba(157, 78, 221, 0.03);
}

.dropzone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.dropzone-icon {
    font-size: 24px;
    color: var(--text-muted);
}

.dropzone p {
    font-size: 12px;
    color: var(--text-secondary);
}

.dropzone p span {
    color: var(--accent-purple);
    font-weight: 600;
}

.file-info {
    font-size: 10px;
    color: var(--text-muted);
}

.dropzone-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
}

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

.btn-clear-ref {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.btn-clear-ref:hover {
    background: #ef4444;
}

/* Output Gallery */
.output-review-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.section-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title-row h3 {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
}

.generation-status-tag {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 112, 67, 0.1);
    border: 1px solid rgba(255, 112, 67, 0.2);
    color: var(--color-orange);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    flex-grow: 1;
    align-content: start;
}

.gallery-empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    border: 1px dashed var(--border-glass);
    border-radius: 16px;
    color: var(--text-muted);
    text-align: center;
    gap: 12px;
}

.gallery-empty-state i {
    font-size: 40px;
}

/* Gallery Visual Cards */
.card-variant {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border-glass);
    background: var(--bg-card);
    transition: var(--transition-smooth);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

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

.card-variant.selected {
    border-color: var(--color-green);
    box-shadow: 0 0 15px var(--color-green-glow);
}

.card-variant.skipped {
    opacity: 0.4;
}

.card-media-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    background: #000;
    overflow: hidden;
}

.card-media-wrapper img, .card-media-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Badges on Variant Cards */
.card-variant-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    gap: 6px;
    z-index: 2;
}

.card-badge {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    color: #fff;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.card-badge.scene-num-badge {
    color: var(--accent-cyan);
}

.card-badge.selection-indicator {
    background: var(--color-green);
    color: #000;
    font-weight: 800;
}

/* Card Body Content */
.card-variant-body {
    padding: 14px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-prompt-snippet {
    font-size: 11px;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 32px;
}

/* Card Actions Panel */
.card-variant-actions {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 6px;
    margin-top: auto;
}

.card-variant-actions .btn {
    padding: 8px;
    font-size: 11px;
    border-radius: 6px;
}

/* Storyboard Bottom Section */
.storyboard-section {
    margin-top: 32px;
    background: rgba(10, 10, 12, 0.4);
    border-top: 1px solid var(--border-glass);
    padding: 32px;
}

.storyboard-section h2 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
}

.section-helper {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 12px;
}

.storyboard-timeline {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* Storyboard Card */
.story-card {
    border-radius: 12px;
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.02);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.story-card-header {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.story-card-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
}

.story-card-index {
    color: var(--accent-cyan);
    font-weight: 800;
    font-size: 11px;
}

.story-card-media {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #000;
}

.story-card-media img, .story-card-media video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-card-empty-media {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 11px;
    gap: 6px;
    background: rgba(0, 0, 0, 0.3);
}

.story-card-empty-media i {
    font-size: 20px;
}

.story-card-footer {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
}

.story-video-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.story-video-ref-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.story-video-ref-group label {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.story-video-ref-group input[type="file"] {
    font-size: 9px;
    color: var(--text-secondary);
}

/* Video status overlays */
.video-status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    padding: 4px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.4);
    font-weight: 600;
}

.video-status-indicator.queued {
    color: var(--text-secondary);
}

.video-status-indicator.in_progress {
    color: var(--color-orange);
}

.video-status-indicator.completed {
    color: var(--color-green);
    background: rgba(0, 230, 118, 0.08);
}

.video-status-indicator.failed {
    color: #ef4444;
}

/* Modal overlays */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    /* width:90vw lets each modal grow to its own max-width instead of being
       clamped at a narrow fixed width; padding gives fields room to breathe. */
    width: 90vw;
    max-width: 560px;
    padding: 24px;
    animation: zoomIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Comfortable, readable inputs inside modals (larger than the app default). */
.modal-body input[type="text"],
.modal-body input[type="password"],
.modal-body input[type="number"],
.modal-body textarea,
.modal-body select,
.modal-body .form-control {
    font-size: 14px;
    padding: 12px 14px;
}
/* .select-compact sets its own size with !important (used in the shot strips),
   so modal copies (e.g. Image Edit) need an equally-specific override to grow. */
.modal-body .select-compact {
    font-size: 14px !important;
    padding: 10px 12px !important;
    height: auto !important;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    color: var(--color-orange);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

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

.modal-body p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

/* Keyframes */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Custom selectors layout */
.form-row.select-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}
.select-col {
    flex: 1;
}
.select-compact {
    padding: 6px 10px !important;
    font-size: 0.85rem !important;
    height: 38px !important;
    background-color: rgba(10, 10, 12, 0.65) !important;
    border: 1px solid var(--border-glass) !important;
    border-radius: 8px !important;
    color: var(--text-primary) !important;
    cursor: pointer;
}
.select-compact option {
    background-color: #121214;
    color: var(--text-primary);
}
.story-video-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}
.control-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.control-row.inline-row {
    flex-direction: row;
    gap: 8px;
}
.control-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.control-col label, .control-row label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}
.mt-1 {
    margin-top: 4px;
}
.mt-2 {
    margin-top: 8px;
}

/* Tree List (Videos -> Scenes -> Shots) */
.tree-list {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    max-height: 400px;
}
.tree-node-video {
    margin-bottom: 8px;
}
.tree-video-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 6px;
    font-weight: 700;
    font-size: 13px;
    color: var(--accent-cyan);
}
.tree-scenes {
    padding-left: 12px;
    margin-top: 4px;
}
.tree-scene-header {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 4px 8px;
    font-weight: 600;
}
.tree-shots {
    padding-left: 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.tree-shot-item {
    padding: 6px 8px;
    font-size: 12px;
    color: var(--text-primary);
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.tree-shot-item:hover {
    background: rgba(255,255,255,0.08);
}
.tree-shot-item.active {
    background: rgba(157, 78, 221, 0.2);
    color: #fff;
}
.shot-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transition: background-color 0.3s;
    display: inline-block;
}

@keyframes pulse-generating {
    0% { transform: scale(0.95); opacity: 0.7; }
    50% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.7; }
}

.shot-status-dot.draft { background: gray; }
/* In-progress dots use blue/orange so they are never confused with the
   solid yellow/green of the final approved states below. */
.shot-status-dot.photo_generating { background: #3b82f6; box-shadow: 0 0 6px rgba(59, 130, 246, 0.7); animation: pulse-generating 1.5s infinite; }
.shot-status-dot.photo_ready { background: #ffd700; box-shadow: 0 0 5px rgba(255, 215, 0, 0.5); }
.shot-status-dot.video_generating { background: #f97316; box-shadow: 0 0 6px rgba(249, 115, 22, 0.7); animation: pulse-generating 1.5s infinite; }
.shot-status-dot.video_ready { background: #22c55e; box-shadow: 0 0 5px var(--color-green-glow); }
.shot-status-dot.approved { background: #22c55e; box-shadow: 0 0 8px var(--color-green-glow); }
.shot-status-dot.failed { background: #ef4444; }
/* Error = unresolved references. Purple, distinct from grey/blue/yellow/orange/green/red. */
.shot-status-dot.error { background: #a855f7; box-shadow: 0 0 6px rgba(168, 85, 247, 0.7); }

/* Queue Panel */
/* .queue-panel removed — queue is now in sidebar */
.queue-panel {
    display: none;
}
.queue-header {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    border-bottom: 1px solid var(--border-glass);
    font-size: 13px;
    font-weight: 700;
}
.queue-list {
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.queue-item {
    font-size: 11px;
    background: rgba(255,255,255,0.03);
    padding: 8px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Elements Library */
/* Element Library filter + sort toolbar */
.elements-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}
.elements-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.el-filter-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition-smooth);
}
.el-filter-btn:hover { background: rgba(255,255,255,0.09); color: var(--text-primary); }
.el-filter-btn.active {
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
    color: #04201c;
    font-weight: 700;
}
.el-filter-count { opacity: 0.7; font-variant-numeric: tabular-nums; margin-left: 2px; }
.el-filter-btn.active .el-filter-count { opacity: 0.85; }
/* The "Missing upstream" filter reads as a warning, not a category. */
.el-filter-btn.el-filter-missing { border-color: rgba(245, 158, 11, 0.5); color: #f59e0b; }
.el-filter-btn.el-filter-missing.active { background: #f59e0b; border-color: #f59e0b; color: #1a1a1a; }
.elements-sort { display: flex; align-items: center; gap: 8px; }
.elements-sort label { font-size: 12px; color: var(--text-secondary); }
.elements-sort select { width: auto; padding: 5px 10px; font-size: 12px; }

.elements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}
.element-card {
    background: rgba(255,255,255,0.05);
    padding: 10px;
    border-radius: 8px;
    font-size: 12px;
}
.element-thumb {
    width: 100%;
    height: 120px;
    background-size: cover;
    background-position: center;
    border-radius: 4px;
    margin-bottom: 8px;
    background-color: rgba(255,255,255,0.02);
}
/* <img> variant so grid thumbnails can lazy-load and reserve space (no reflow). */
.element-thumb-img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
    border-radius: 4px;
    margin-bottom: 8px;
    background-color: rgba(255,255,255,0.02);
}
/* Non-completed elements are visually dimmed and can't be selected for a shot. */
.element-card.element-not-ready { opacity: 0.6; }
.element-status-badge {
    position: absolute; top: 6px; left: 6px; z-index: 3;
    font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px;
    padding: 2px 6px; border-radius: 6px;
    background: rgba(245, 158, 11, 0.9); color: #1a1a1a;
}
/* Missing upstream: a red-outlined card + badge, shown in EVERY view (incl. All)
   so a dead element never looks fine. */
.element-card.element-missing-upstream {
    outline: 1px solid rgba(239, 68, 68, 0.6);
    outline-offset: -1px;
}
.element-missing-badge {
    position: absolute; top: 6px; right: 34px; z-index: 3;
    font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px;
    padding: 2px 6px; border-radius: 6px;
    background: rgba(239, 68, 68, 0.92); color: #fff;
}
/* Image preview box for the "Add New Element" form (holds one or more thumbs). */
.new-el-image-preview {
    min-width: 72px; min-height: 72px; flex-shrink: 0;
    border-radius: 8px; border: 1px dashed var(--border-glass);
    display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px;
    color: var(--text-muted); background: rgba(0,0,0,0.2); padding: 4px;
}
.new-el-image-preview.has-images { border-style: solid; border-color: var(--border-glass); justify-content: flex-start; }
.new-el-thumb {
    position: relative; width: 56px; height: 56px; border-radius: 6px; overflow: hidden; flex-shrink: 0;
}
.new-el-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.new-el-thumb-remove {
    position: absolute; top: 1px; right: 1px; width: 16px; height: 16px; line-height: 15px;
    text-align: center; background: rgba(0,0,0,0.7); color: #fff; border: none; border-radius: 50%;
    font-size: 10px; cursor: pointer; padding: 0;
}
.new-el-thumb-remove:hover { background: #ef4444; }

/* Floating hover preview (reference chips, elements grid, media library). */
#hover-preview {
    position: fixed; z-index: 100001; display: none; pointer-events: none;
    border-radius: 10px; overflow: hidden;
    border: 1px solid var(--accent-cyan); box-shadow: 0 8px 30px rgba(0,0,0,0.6);
    background: #0a0a0e;
}
#hover-preview img { display: block; max-width: 300px; max-height: 300px; }
.element-name {
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.element-cat {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.elements-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.element-tag {
    background: rgba(157, 78, 221, 0.2);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    color: #fff;
}
.action-buttons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.action-buttons-vertical {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}
.selected-media-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}
.selected-media-grid {
    display: flex;
    gap: 16px;
    margin-top: 10px;
}
.selected-media-item {
    flex: 1;
    min-height: 100px;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.selected-media-item img, .selected-media-item video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.shot-status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Lightbox Styles */
.lightbox-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}
.lightbox-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 90vw;
    max-height: 90vh;
}
#lightbox-media-container img, #lightbox-media-container video {
    max-width: 100%;
    max-height: 75vh;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}
.lightbox-close {
    position: absolute;
    top: 20px; right: 30px;
    background: rgba(255,255,255,0.1);
    border: none; color: white;
    font-size: 24px;
    width: 44px; height: 44px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition-smooth);
}
.lightbox-close:hover {
    background: #ef4444;
}
.lightbox-nav {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,0.1);
    border: none; color: white;
    font-size: 24px;
    width: 50px; height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition-smooth);
}
.lightbox-nav:hover {
    background: rgba(255,255,255,0.2);
}
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

/* Flash Animation */
@keyframes flashNewItem {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 245, 212, 0); }
    50% { transform: scale(1.02); box-shadow: 0 0 25px 5px rgba(0, 245, 212, 0.6); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 245, 212, 0); }
}
.flash-highlight {
    animation: flashNewItem 1.5s ease-out;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 230, 118, 0.2);
    border: 1px solid var(--color-green);
    color: var(--color-green);
    padding: 12px 24px;
    border-radius: 8px;
    backdrop-filter: blur(8px);
    z-index: 10000;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 230, 118, 0.2);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
    transform: translateX(120%);
    opacity: 0;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

/* Card Info Header */
.card-info-header {
    position: absolute;
    top: 0; left: 0; right: 0;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 11px;
    padding: 4px 8px;
    text-align: center;
    z-index: 2;
    backdrop-filter: blur(4px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#modal-settings .form-control {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}
#modal-settings .form-control option {
    background: #121214;
    color: var(--text-primary);
}

/* =====================================================
   WAVE 2: No-Scroll Layout — Shot Strips
   ===================================================== */

/* Main workspace is already flex-col in .main-workspace */
.main-workspace {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Two-strip container fills the rest after the header */
.shot-strips-container {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Each strip takes exactly 50% of the remaining height */
.shot-strip {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.01);
}

.shot-strip.strip-divider {
    border-top: 1px solid var(--border-glass);
}

/* Left controls panel: widened to ~58% to host the two-column layout,
   leaving the gallery (flex:1) at ~42%. */
.strip-controls {
    flex: 0 0 58%;
    width: 58%;
    border-right: 1px solid var(--border-glass);
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: hidden;
    background: rgba(10, 10, 14, 0.4);
}

/* Two-column body: prompt/elements on the left, all settings + buttons
   stacked on the right. Fills the panel height so nothing needs to scroll. */
.strip-controls-body {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: row;
    gap: 14px;
    overflow: hidden;
}

.strip-col-left {
    flex: 1 1 66%;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.strip-col-right {
    flex: 0 0 34%;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    overflow-y: auto;  /* safety valve if a model exposes many extra selects */
    padding-right: 2px;
}

/* Tighten the stacked settings so the common cases fit with no scroll. */
.strip-col-right .form-group {
    gap: 3px;
}

.strip-col-right .select-compact {
    height: 34px !important;
}

/* Prompt group grows to fill the left column; textarea fills the group. */
.strip-prompt-group {
    flex: 1 1 auto;
    min-height: 0;
}

.strip-prompt-group .strip-textarea {
    flex: 1 1 auto;
    min-height: 90px;
}

/* Elements chips sit below the prompt, capped so they never push it out. */
.strip-elements-group {
    flex: 0 0 auto;
    max-height: 34%;
    overflow-y: auto;
}

/* Video strip: the prompt and its "Elements Used" chips form one block that keeps the
   full height of the column — exactly what they had before the Kling 4.0 reference
   section existed. That section sits below the block and the column scrolls to reach it,
   so it can neither squeeze the textarea nor make it overflow onto the chips/counter. */
.video-controls .strip-col-left {
    overflow-y: auto;
}
.strip-prompt-block {
    flex: 0 0 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* "+ Add" button pushed to the bottom of the right column, just above Generate. */
.strip-add-btn {
    margin-top: auto;
    padding: 5px 10px;
    font-size: 11px;
    border-color: rgba(255, 255, 255, 0.2);
}

.strip-controls-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    gap: 8px;
}

.strip-label {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.shot-notes-inline {
    font-size: 10px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
    text-align: right;
}

.strip-textarea {
    resize: none;
    font-size: 12px;
    line-height: 1.4;
}

.strip-action-btn {
    margin-top: 6px;
    flex-shrink: 0;
    font-size: 12px;
    padding: 7px 10px;
}

/* Quiet "check the library first" line under Generate Video (opens the picker). */
.shot-library-hint {
    flex-shrink: 0; margin: 4px 0 0; padding: 0; background: none; border: none;
    color: var(--text-muted); font: inherit; font-size: 11px; line-height: 1.3;
    text-align: center; cursor: pointer;
}
.shot-library-hint:hover { text-decoration: underline; }

.strip-video-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 4px;
}

/* Gallery area: wraps the horizontal scroll strip + arrow buttons */
.strip-gallery-wrapper {
    flex: 1 1 0;
    min-width: 0;
    background: rgba(0, 0, 0, 0.15);
    border-left: 1px solid var(--border-glass);
    position: relative;
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    overflow: hidden;
}

/* The scrollable horizontal lane */
.strip-gallery {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: row;
    gap: 10px;
    padding: 10px 44px;  /* side padding for arrow buttons */
    overflow-x: auto;
    overflow-y: hidden;
    align-items: center;
    scroll-behavior: smooth;
    scroll-padding-inline: 48px;  /* keep keyboard-scrolled cards clear of the arrow buttons */
    scrollbar-width: thin;
}

.strip-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 80px;
    color: var(--text-muted);
    font-size: 12px;
    opacity: 0.5;
}
.strip-empty-state i { font-size: 28px; }

/* Gallery navigation arrows */
.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(20, 20, 25, 0.85);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    font-size: 13px;
}
.gallery-arrow:hover {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    box-shadow: 0 0 12px var(--accent-purple-glow);
}
.gallery-arrow-left  { left: 4px; }
.gallery-arrow-right { right: 4px; }

/* Individual strip gallery card */
.gen-strip-card {
    flex: 0 0 200px;
    width: 200px;
    display: flex;
    flex-direction: column;
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
}

.gen-strip-card:hover {
    border-color: rgba(157, 78, 221, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

.gen-strip-card.selected {
    border-color: var(--color-green);
    box-shadow: 0 0 12px var(--color-green-glow);
}

/* Keyboard cursor (arrow keys / F / V / Space). An outline, so it never competes
   with .selected's green border + glow: a final card under the cursor shows both. */
.gen-strip-card.kb-focus {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.gen-strip-card.failed {
    border-color: rgba(239, 68, 68, 0.3);
    opacity: 0.7;
}

.gen-strip-card.orphaned {
    border-color: rgba(245, 158, 11, 0.4);
    opacity: 0.85;
}

/* Orphaned/incomplete state thumbnail — amber */
.gen-strip-orphaned-thumb {
    width: 100%;
    aspect-ratio: 9 / 16;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: rgba(245, 158, 11, 0.08);
    color: #f59e0b;
    font-size: 20px;
}
.gen-strip-orphaned-label {
    font-size: 11px;
    font-weight: 700;
    color: #f59e0b;
    letter-spacing: 0.3px;
}
.gen-strip-orphaned-sub {
    font-size: 9px;
    color: rgba(245, 158, 11, 0.6);
}

.gen-strip-thumb {
    width: 100%;
    aspect-ratio: 9 / 16;
    object-fit: cover;
    display: block;
    background: rgba(0,0,0,0.3);
}

.gen-strip-thumb-video {
    width: 100%;
    aspect-ratio: 9 / 16;
    object-fit: cover;
    display: block;
}

/* Failed state thumbnail */
.gen-strip-failed-thumb {
    width: 100%;
    aspect-ratio: 9 / 16;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    font-size: 22px;
}
.gen-strip-failed-label {
    font-size: 11px;
    font-weight: 700;
    color: #ef4444;
    letter-spacing: 0.5px;
}
.gen-strip-failed-error {
    font-size: 14px;
    color: rgba(239, 68, 68, 0.7);
    cursor: help;
}

/* Pending/in-progress state thumbnail */
.gen-strip-pending-thumb {
    width: 100%;
    aspect-ratio: 9 / 16;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(0, 212, 255, 0.05);
    color: var(--accent-cyan);
    font-size: 22px;
}
.gen-strip-pending-thumb span {
    font-size: 10px;
    color: var(--text-muted);
}

/* Media wrapper: contains thumb + overlays */
.gen-strip-media-wrap {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* Hover overlay: magnifying glass */
.gen-strip-hover-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: rgba(255,255,255,0);
    transition: background 0.2s, color 0.2s;
    pointer-events: none;
}
.gen-strip-media-wrap.gen-strip-clickable {
    cursor: pointer;
}
.gen-strip-media-wrap.gen-strip-clickable:hover .gen-strip-hover-overlay {
    background: rgba(0,0,0,0.45);
    color: rgba(255,255,255,0.9);
}

/* Play icon for video cards (always visible at low opacity) */
.gen-strip-play-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.gen-strip-play-icon i {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0,0,0,0.55);
    border: 2px solid rgba(255,255,255,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: rgba(255,255,255,0.85);
    padding-left: 3px; /* optical center for play triangle */
    transition: background 0.2s, border-color 0.2s;
}
.gen-strip-media-wrap:hover .gen-strip-play-icon i {
    background: rgba(157, 78, 221, 0.7);
    border-color: var(--accent-purple);
}


.gen-strip-footer {
    padding: 5px 7px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    background: rgba(10,10,12,0.6);
    flex-shrink: 0;
}

.gen-strip-meta {
    font-size: 9px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.gen-strip-actions {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}

.gen-strip-btn {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    border: 1px solid var(--border-glass);
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    transition: var(--transition-smooth);
}
.gen-strip-btn:hover { background: var(--accent-purple); border-color: var(--accent-purple); color: #fff; }
.gen-strip-btn.selected-btn { background: var(--color-green); border-color: var(--color-green); color: #000; }
.gen-strip-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.gen-strip-btn:disabled:hover { background: rgba(255,255,255,0.05); border-color: var(--border-glass); color: var(--text-secondary); }

/* Item 9: badge marking a cropped entry (vs a generation). */
.gen-crop-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 20px;
    height: 20px;
    border-radius: 5px;
    background: rgba(0, 245, 212, 0.9);
    color: #04201c;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    z-index: 3;
}

/* ─── Crop modal (9:16, local) ─── */
.crop-dims {
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-variant-numeric: tabular-nums;
}
.crop-dims.at-min { color: #f59e0b; }   /* Item 5: warning state at the minimum */
.crop-stage {
    display: block;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
    line-height: 0;
    overflow: hidden;                    /* clips the dim overlay to the image */
    border-radius: 6px;
}
#crop-img {
    display: block;
    max-width: 100%;
    max-height: 60vh;
    user-select: none;
    -webkit-user-drag: none;
}
.crop-rect {
    position: absolute;
    box-sizing: border-box;
    border: 2px solid var(--accent-cyan);
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.55);   /* dims everything outside */
    cursor: move;
    touch-action: none;
}
.crop-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--accent-cyan);
    border: 2px solid #0a0a0c;
    border-radius: 50%;
    box-sizing: border-box;
    touch-action: none;
}
.crop-handle.nw { left: -8px; top: -8px; cursor: nwse-resize; }
.crop-handle.ne { right: -8px; top: -8px; cursor: nesw-resize; }
.crop-handle.sw { left: -8px; bottom: -8px; cursor: nesw-resize; }
.crop-handle.se { right: -8px; bottom: -8px; cursor: nwse-resize; }
.crop-handle.n { top: -8px; left: 50%; margin-left: -7px; cursor: ns-resize; }
.crop-handle.s { bottom: -8px; left: 50%; margin-left: -7px; cursor: ns-resize; }
.crop-handle.e { right: -8px; top: 50%; margin-top: -7px; cursor: ew-resize; }
.crop-handle.w { left: -8px; top: 50%; margin-top: -7px; cursor: ew-resize; }
.crop-note { font-size: 11px; color: var(--text-muted); text-align: center; margin-top: 10px; }

/* Overlay "selected" checkmark badge on card */
.gen-strip-card .selected-overlay {
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--color-green);
    color: #000;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
}

/* In-progress card in gallery strip */
.gen-strip-card.in-progress .gen-strip-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-cyan);
    font-size: 24px;
}

/* Sidebar queue section */
.queue-sidebar-section {
    flex-shrink: 0;
}

.queue-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.queue-sidebar-header h3 {
    font-size: 12px;
}
.queue-sidebar-header:hover h3 {
    color: var(--accent-cyan);
}

.queue-list {
    max-height: 160px;
    overflow-y: auto;
    padding: 4px 0;
}

/* Sidebar tree scrolls internally */
.tree-section {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.tree-section .tree-list {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
}

/* Lightbox sizing — full viewport for detail inspection */
.lightbox-content {
    max-width: 94vw;
    max-height: 96vh;
}


/* Lightbox zoom state — cursor hint */
#lightbox-media-container {
    transition: cursor 0.1s;
    position: relative;
}

/* Video zoom: a fixed-size viewport clips the video, which is zoomed/panned with a
   CSS transform only, so the viewport (and the native controls at 1×) never resize. */
.lb-video-viewport {
    overflow: hidden;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    border-radius: 8px;
    position: relative;
    touch-action: none;
}
.lb-video-viewport video {
    transform-origin: 0 0;
    will-change: transform;
    user-select: none;
}
.lb-video-viewport.is-zoomed { cursor: grab; }
.lb-video-viewport.is-dragging { cursor: grabbing; }
/* Clicking a video plays/pauses, so the photo's "Click to zoom" hint would mislead —
   and at the bottom it would sit on the native controls. */
#lightbox-media-container.is-video:hover::after {
    content: "Scroll to zoom · Z";
    bottom: auto;
    top: 10px;
}
/* ─── Safe-zone overlay (9:16 ads). Sizes come from SAFE_ZONE in main.js. ─── */
.lb-media-wrap {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    line-height: 0;
}
.lb-safe-zone {
    position: absolute; inset: 0; z-index: 2;
    pointer-events: none;
    display: none;
    border-radius: 8px;
    overflow: hidden;
    line-height: 1.2;
}
.safe-zone-host.safe-zone-on .lb-safe-zone:not(.is-pending) { display: block; }
.lb-video-viewport.is-zoomed .lb-safe-zone { display: none !important; }
.lb-safe-zone .sz-ui,
.lb-safe-zone .sz-sub { position: absolute; left: 0; right: 0; box-sizing: border-box; }
.lb-safe-zone .sz-ui {
    background: rgba(239, 68, 68, 0.28);
    border-bottom: 1px solid rgba(239, 68, 68, 0.9);
}
.lb-safe-zone .sz-ui.sz-bottom { border-bottom: none; border-top: 1px solid rgba(239, 68, 68, 0.9); }
.lb-safe-zone .sz-sub {
    background: rgba(250, 204, 21, 0.18);
    border: 1px dashed rgba(250, 204, 21, 0.95);
    border-left: none; border-right: none;
}
.lb-safe-zone .sz-label {
    position: absolute; left: 6px; top: 4px;
    font-size: 10px; font-weight: 600; letter-spacing: 0.3px;
    color: #fff; background: rgba(0, 0, 0, 0.55);
    padding: 1px 6px; border-radius: 4px;
}
.lb-safe-zone .sz-sub .sz-label { color: #fde047; }
.lb-safe-zone .sz-note {
    display: none;
    position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
    font-size: 11px; color: #fff; background: rgba(0, 0, 0, 0.65);
    padding: 3px 10px; border-radius: 6px; white-space: nowrap;
}
/* Center crosshair: shown with the safe zone, also on frames that aren't 9:16. */
.lb-safe-zone .sz-center { position: absolute; inset: 0; z-index: 1; }
.lb-safe-zone .sz-center-v,
.lb-safe-zone .sz-center-h { position: absolute; background: #3b82f6; box-shadow: 0 0 2px rgba(0, 0, 0, 0.7); }
.lb-safe-zone .sz-center-v { left: 50%; top: 0; bottom: 0; width: 1px; transform: translateX(-0.5px); }
.lb-safe-zone .sz-center-h { top: 50%; left: 0; right: 0; height: 1px; transform: translateY(-0.5px); }
.lb-safe-zone .sz-note { z-index: 2; }
/* Inside the crop frame: square corners; the handles stay above the overlay. */
.crop-rect .lb-safe-zone { border-radius: 0; }
.crop-rect .crop-handle { z-index: 3; }
.lb-safe-zone.not-916 .sz-ui,
.lb-safe-zone.not-916 .sz-sub { display: none; }
.lb-safe-zone.not-916 .sz-note { display: block; }
.safe-zone-btn.is-active {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.9);
    color: #fff;
}

#lightbox-img {
    user-select: none;
    -webkit-user-drag: none;
}
#lightbox-img:not(.zoomed) {
    cursor: zoom-in;
}
/* Zoom hint badge that appears on hover while not zoomed */
#lightbox-media-container:hover::after {
    content: "Click to zoom";
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.6);
    color: rgba(255,255,255,0.8);
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 20px;
    pointer-events: none;
    white-space: nowrap;
}

/* ── Tree CRUD + collapse styles ─────────────────────────────── */
.tree-video-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    user-select: none;
}
.tree-video-header:hover { background: rgba(255,255,255,0.05); }

.tree-collapse-btn {
    width: 14px;
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tree-video-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-node-actions {
    display: none;
    gap: 2px;
    margin-left: auto;
    flex-shrink: 0;
}
.tree-video-header:hover .tree-node-actions,
.tree-scene-header:hover .tree-node-actions,
.tree-shot-item:hover .tree-node-actions {
    display: flex;
}

.tree-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 10px;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}
.tree-btn-add { color: var(--accent-cyan); }
.tree-btn-add:hover { background: rgba(0, 212, 255, 0.15); }
.tree-btn-del { color: var(--text-muted); }
.tree-btn-del:hover { color: #ef4444; background: rgba(239,68,68,0.12); }

.tree-scene-header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px 4px 18px;
    font-size: 11px;
    color: var(--text-muted);
    border-radius: 4px;
    cursor: default;
}
.tree-scene-header:hover { background: rgba(255,255,255,0.03); }
.tree-scene-header > span:first-child { flex: 1; }

.tree-shot-item {
    display: flex;
    align-items: center;
    padding: 4px 6px 4px 28px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    gap: 4px;
}
.tree-shot-item:hover { background: rgba(255,255,255,0.05); }
.tree-shot-item.active { background: rgba(157, 78, 221, 0.15); color: var(--accent-purple); }

.tree-shot-label {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 5px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.tree-btn-shot-del { margin-left: auto; flex-shrink: 0; }

.tree-add-shot-row,
.tree-add-video-row {
    padding: 2px 6px 2px 28px;
}
.tree-add-video-row {
    padding: 4px 8px;
    border-top: 1px solid var(--border-glass);
    margin-top: 4px;
}
.tree-btn-add-inline {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 10px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    gap: 3px;
    transition: color 0.15s, background 0.15s;
}
.tree-btn-add-inline:hover {
    color: var(--accent-cyan);
    background: rgba(0, 212, 255, 0.08);
}

/* Item 1 Tree Fixes */

.tree-video-header {
    background: rgba(255,255,255,0.08) !important;
    padding: 8px 10px !important;
    margin-bottom: 4px;
    border-radius: 6px;
    border-left: 3px solid var(--accent-cyan);
}
.tree-scene-header {
    background: rgba(255,255,255,0.03) !important;
    margin: 4px 0 2px 8px !important;
    padding: 6px 8px 6px 12px !important;
    border-left: 2px solid var(--accent-purple);
}
.tree-shots {
    padding-left: 20px !important;
}
.tree-shot-item {
    padding: 4px 8px 4px 12px !important;
    margin-bottom: 2px;
}
.tree-node-actions {
    gap: 8px !important;
}
.tree-btn {
    font-size: 11px !important;
    padding: 4px 6px !important;
}
.tree-list {
    max-height: none !important;
}
.tree-collapse-btn {
    width: 20px !important;
    font-size: 12px !important;
}


/* Item 4 Char Counter */
.char-counter {
    text-align: right;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}
.char-counter.over-limit {
    color: #ef4444 !important; /* accent-red */
    font-weight: 600;
}


/* Project Tree UI Polish (Added for Sidebar 1) */
.tree-node {
    display: flex;
    flex-direction: column;
}

.tree-header {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background 0.2s;
    user-select: none;
    margin-bottom: 2px;
}
.tree-header:hover {
    background: rgba(255, 255, 255, 0.05);
}
.tree-header.active {
    background: rgba(157, 78, 221, 0.15);
    color: var(--accent-purple);
}
.tree-header.active .tree-title {
    font-weight: 600;
}

.tree-title {
    flex: 1; /* Pushes actions to the right */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 8px; /* Spacing between title and actions */
}

.tree-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0.2; /* Dim until hover */
    transition: opacity 0.2s;
}
.tree-header:hover .tree-actions,
.tree-header.active .tree-actions {
    opacity: 1;
}

.tree-actions button, .btn-icon-tiny {
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s, color 0.2s;
}
.tree-actions button:hover, .btn-icon-tiny:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}
.tree-actions button.text-danger, .btn-icon-tiny.text-danger {
    color: var(--text-muted);
}
.tree-actions button.text-danger:hover, .btn-icon-tiny.text-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.tree-toggle {
    width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-right: 4px;
    opacity: 0.6;
    font-size: 10px;
    transition: opacity 0.2s;
}
.tree-toggle:hover {
    opacity: 1;
}

/* Manual "b-roll added" checkmark next to a video's title (always visible). */
.tree-broll-check {
    flex-shrink: 0; background: none; border: none; padding: 0 4px 0 0; margin: 0;
    color: var(--text-muted); font-size: 12px; line-height: 1; cursor: pointer;
    display: inline-flex; align-items: center;
}
.tree-broll-check:hover { opacity: 0.8; }
.tree-broll-check.is-on { color: var(--color-green); }

/* Specific item spacing fixes */
.tree-children {
    margin-bottom: 4px;
}

/* --- Project Dashboard Styles --- */
.dashboard-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-dark);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background-color: var(--bg-darker);
    border-bottom: 1px solid var(--border-glass);
}
.dashboard-content {
    padding: 40px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}
.dashboard-client-group {
    margin-bottom: 40px;
}
.dashboard-client-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
}
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.dashboard-card {
    background-color: var(--bg-darker);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.dashboard-card:hover {
    border-color: var(--accent-cyan);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}
.dashboard-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-light);
}
.dashboard-card-stats {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ─── Usage Statistics (read-only) ─── */
.stats-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
/* The list gets its own scroll area; the sticky header + totals stay put. */
.stats-scroll {
    max-height: 46vh;
    overflow-y: auto;
    border: 1px solid var(--border-glass);
    border-radius: 10px;
}
.stats-table {
    width: 100%;
    table-layout: fixed;          /* enables reliable name ellipsis */
    border-collapse: separate;    /* keeps sticky cell borders intact */
    border-spacing: 0;
    font-size: 13px;
}
.stats-table col.col-proj { width: 44%; }
.stats-table th, .stats-table td {
    padding: 8px 12px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-glass);
}
.stats-table td.num, .stats-table th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;   /* figures line up column-wise */
}
.stats-table td.num { white-space: nowrap; }
/* Headers may wrap the unit onto a second line rather than clip it in a
   narrow column, so "Photo (cr)" etc. are always fully readable. */
.stats-table th.num { white-space: normal; }
/* Sticky column headers — stay visible while the list scrolls. */
.stats-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #14141a;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
/* Totals row pinned to the bottom of the scroll area. */
.stats-table tfoot td {
    position: sticky;
    bottom: 0;
    z-index: 3;
    background: #14141a;
    border-top: 1px solid var(--border-glass);
    border-bottom: none;
    font-weight: 600;
    color: var(--text-primary);
}
.stats-table tfoot td:first-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.stats-table tbody tr:hover { background: var(--bg-card-hover); }
.stats-proj-cell { overflow: hidden; }
.stats-proj-nameline { display: flex; align-items: center; gap: 6px; min-width: 0; }
.stats-proj-title {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;          /* long names stay one line */
    color: var(--text-primary);
    font-weight: 600;
}
.stats-proj-id {
    font-size: 10px;
    color: var(--text-muted);
    font-family: monospace;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.stats-deleted-badge {
    flex: 0 0 auto;
    padding: 1px 6px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-radius: 6px;
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
}
.stats-fail-count { color: #fca5a5; }

/* ─── Library File Browser ─── */
.fb-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    margin-bottom: 12px;
    color: var(--text-secondary);
}
.fb-crumb {
    color: var(--accent-cyan);
    cursor: pointer;
    text-decoration: none;
}
.fb-crumb:hover { text-decoration: underline; }
.fb-crumb-sep { color: var(--text-muted); }
.fb-list {
    max-height: 55vh;
    overflow-y: auto;
    border: 1px solid var(--border-glass);
    border-radius: 8px;
}
.fb-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 13px;
}
.fb-row:last-child { border-bottom: none; }
.fb-row:hover { background: rgba(255, 255, 255, 0.03); }
.fb-icon { width: 16px; text-align: center; color: var(--text-muted); }
.fb-row.is-folder .fb-icon { color: var(--accent-cyan); }
.fb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-row.is-folder .fb-name { cursor: pointer; }
.fb-row.is-folder .fb-name:hover { text-decoration: underline; }
.fb-meta { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.fb-size { font-size: 11px; color: var(--text-muted); white-space: nowrap; min-width: 64px; text-align: right; }
.fb-del { background: none; border: none; color: #ef4444; cursor: pointer; padding: 2px 6px; font-size: 13px; }
.fb-del:hover { color: #f87171; }
.fb-empty { padding: 20px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ─── Ad-hoc Reference Photos ─── */
.reference-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.reference-chip {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--accent-cyan);
    box-shadow: 0 0 6px rgba(0, 245, 212, 0.25);
    flex-shrink: 0;
}
.reference-chip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.reference-chip .ref-remove {
    position: absolute; top: 1px; right: 1px;
    width: 16px; height: 16px; line-height: 15px; text-align: center;
    background: rgba(0,0,0,0.7); color: #fff; border: none; border-radius: 50%;
    font-size: 9px; cursor: pointer; padding: 0;
}
.reference-chip .ref-remove:hover { background: #ef4444; }
/* Flow: download the full-size picture (bottom-right, above the source label). */
.reference-chip .flow-dl-btn {
    position: absolute; bottom: 1px; right: 1px; z-index: 3;
    width: 15px; height: 15px; padding: 0;
    display: flex; align-items: center; justify-content: center;
    border: none; border-radius: 50%;
    background: rgba(0, 0, 0, 0.7); color: #fff; font-size: 8px; cursor: pointer;
    opacity: 0; transition: opacity 0.15s;
}
.reference-chip:hover .flow-dl-btn { opacity: 1; }
.reference-chip .flow-dl-btn:hover { background: var(--accent-cyan); color: #0a0a0c; }
.element-tag .flow-dl-btn {
    margin-left: 4px; padding: 0 2px;
    border: none; background: none; color: inherit; font-size: 10px; cursor: pointer;
    opacity: 0.6;
}
.element-tag .flow-dl-btn:hover { opacity: 1; color: var(--accent-cyan); }
.reference-chip .ref-src {
    position: absolute; bottom: 0; left: 0; right: 0;
    font-size: 7px; text-align: center; text-transform: uppercase;
    background: rgba(0,0,0,0.6); color: var(--accent-cyan); letter-spacing: 0.3px;
}

/* Chips resolved from imported JSON are marked with a violet border/glow so
   they read as distinct from cyan hand-attached references. */
.reference-chip.from-json {
    border-color: #a78bfa;
    box-shadow: 0 0 6px rgba(167, 139, 250, 0.35);
}
.reference-chip.from-json .ref-src {
    background: rgba(76, 29, 149, 0.75); color: #ddd6fe;
}

/* Item 6: "broken" chip for an unresolved reference (placeholder or not-found).
   Purple, dashed, and shaped as a pill so the raw value is readable — clearly
   different from the square thumbnail chips of real attached media. */
.reference-chip.broken {
    width: auto;
    max-width: 220px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 8px;
    border: 1px dashed #a855f7;
    background: rgba(168, 85, 247, 0.12);
    box-shadow: none;
    color: #d8b4fe;
    font-size: 10px;
    font-family: monospace;
}
.reference-chip.broken .broken-icon { flex: 0 0 auto; color: #a855f7; }
.reference-chip.broken .broken-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.reference-chip.broken .broken-remove {
    flex: 0 0 auto;
    width: 16px; height: 16px; line-height: 15px; text-align: center;
    background: rgba(0, 0, 0, 0.5); color: #fff; border: none; border-radius: 50%;
    font-size: 11px; cursor: pointer; padding: 0;
}
.reference-chip.broken .broken-remove:hover { background: #a855f7; }
/* "Remove all unresolved" — appears only when there is more than one. */
.ref-remove-all {
    height: 44px;
    padding: 0 12px;
    border: 1px solid rgba(168, 85, 247, 0.5);
    border-radius: 8px;
    background: rgba(168, 85, 247, 0.10);
    color: #d8b4fe;
    font-size: 11px;
    cursor: pointer;
}
.ref-remove-all:hover { background: rgba(168, 85, 247, 0.22); }
.ref-remove-all i { margin-right: 4px; }

.ref-tabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 1px solid var(--border-glass); }
.ref-tab {
    background: none; border: none; color: var(--text-secondary);
    padding: 8px 12px; cursor: pointer; font-size: 13px;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.ref-tab:hover { color: var(--text-primary); }
.ref-tab.active { color: var(--accent-cyan); border-bottom-color: var(--accent-cyan); }

.ref-lib-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 150px);
    gap: 8px;
    max-height: 48vh;
    overflow-y: auto;
}
.ref-lib-item {
    position: relative;
    width: 150px;
    height: 150px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-glass);
    cursor: pointer;
    background: rgba(0,0,0,0.2);
}
.ref-lib-item:hover { border-color: var(--accent-cyan); box-shadow: 0 0 8px rgba(0,245,212,0.3); }
.ref-lib-item img { width: 150px; height: 150px; object-fit: cover; display: block; }
.ref-lib-empty { grid-column: 1 / -1; text-align: center; color: var(--text-muted); font-size: 13px; padding: 20px; }

/* Copy-UUID overlay button (Elements grid, media library grid, reference chips) */
.copy-uuid-btn {
    position: absolute; top: 4px; right: 4px; z-index: 3;
    width: 22px; height: 22px; padding: 0;
    display: flex; align-items: center; justify-content: center;
    border: none; border-radius: 6px;
    background: rgba(0, 0, 0, 0.65); color: #fff;
    font-size: 11px; cursor: pointer;
    opacity: 0; transition: opacity 0.15s;
}
.copy-uuid-btn:hover { background: var(--accent-cyan); color: #0a0a0c; }
.element-card { position: relative; }
.element-card:hover .copy-uuid-btn,
.ref-lib-item:hover .copy-uuid-btn,
.reference-chip:hover .copy-uuid-btn { opacity: 1; }
/* Reference chips are tiny (44px): smaller button, top-left (remove is top-right). */
.reference-chip .copy-uuid-btn {
    width: 15px; height: 15px; top: 1px; left: 1px; right: auto;
    border-radius: 50%; font-size: 8px;
}

/* ─── Kling 4.0 "from references": one compact row of tiles ─── */
#shot-video-references {
    align-items: flex-start;
    gap: 6px;
}
.vref-item {
    flex: 0 0 auto;
    width: 44px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
/* Label under the thumbnail: one line, never wider than the tile. */
.vref-label {
    width: 44px;
    font-size: 9px;
    line-height: 11px;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.vref-badge {
    position: absolute; top: 1px; left: 1px;
    font-size: 7px; line-height: 9px; padding: 0 3px; border-radius: 3px;
    background: rgba(0, 0, 0, 0.7); color: #fff;
}
.vref-badge-icon { padding: 1px 2px; font-size: 8px; line-height: 8px; }
.vref-badge-dead { color: #ef4444; }
.reference-chip.vref-dead {
    border-color: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
    outline: 2px solid #ef4444;
    outline-offset: -1px;
}
.vref-divider {
    flex: 0 0 1px;
    align-self: flex-start;
    width: 1px;
    height: 44px;
    margin: 0 4px;
    background: rgba(255, 255, 255, 0.18);
}
.vref-count {
    flex: 0 0 auto;
    align-self: flex-start;
    height: 44px;
    display: flex;
    align-items: center;
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
}
.vref-count-over { color: #ef4444; font-weight: 700; }
.vref-info {
    margin-left: 4px;
    font-size: 10px;
    color: var(--text-muted);
    cursor: help;
}
/* Kling 4.0 "from references" (class set by updateVideoReferencesVisibility): the prompt
   block no longer keeps the full column height — its textarea shrinks by exactly what the
   references section needs, but never below 120px; if even that does not fit, the column
   scrolls. Every other model / mode keeps the full-height block above. */
.strip-col-left.kling4-refs .strip-prompt-block {
    flex: 1 1 auto;
    min-height: auto;
}
.strip-col-left.kling4-refs .strip-prompt-group .strip-textarea {
    min-height: 120px;
}

/* ─── Google Drive library ─── */
#modal-drive { z-index: 10001; }   /* opens from the lightbox too (z 9999) */
/* Big picker: fixed-height column where only the folder tree (or the search
   results) scrolls; header, recent, search, selection, file name and footer stay put. */
#modal-drive .drive-modal-content {
    width: min(960px, 94vw);
    max-width: none;
    height: 88vh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}
#modal-drive .modal-header,
#modal-drive .modal-footer { flex-shrink: 0; }
#modal-drive .modal-footer { margin-top: 12px; }
.drive-modal-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.drive-modal-body > * { flex-shrink: 0; }
.drive-modal-body > .drive-tree,
.drive-modal-body > .drive-search-results {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
}
@media (max-width: 600px) {
    #modal-drive .drive-modal-content {
        width: calc(100vw - 24px);
        height: calc(100vh - 24px);
        padding: 16px;
    }
}
.gen-drive-badge {
    position: absolute;
    left: 6px;
    bottom: 6px;
    padding: 2px 6px;
    border-radius: 5px;
    background: rgba(66, 133, 244, 0.92);
    color: #fff;
    font-size: 9px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 3;
    pointer-events: auto;
}
.drive-section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 4px 0 6px;
}
.drive-recent {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
    font-size: 12px;
    color: var(--text-muted);
}
.drive-chip {
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
}
.drive-chip:hover, .drive-chip.active { border-color: var(--accent-purple); background: rgba(157, 78, 221, 0.2); }
.drive-search-results, .drive-tree {
    margin-top: 8px;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 4px;
    background: rgba(10, 10, 12, 0.4);
    font-size: 13px;
}
.drive-search-item {
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
}
.drive-search-item:hover, .drive-search-item.active { background: rgba(157, 78, 221, 0.2); }
.drive-search-path { display: block; font-size: 11px; color: var(--text-muted); }
.drive-empty { padding: 6px 8px; color: var(--text-muted); font-size: 12px; }
.drive-node-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    border-radius: 6px;
    cursor: pointer;
}
.drive-node-row:hover { background: rgba(255, 255, 255, 0.05); }
.drive-node-row.active { background: rgba(157, 78, 221, 0.28); color: #fff; }
.drive-toggle {
    width: 14px;
    flex-shrink: 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 10px;
}
.drive-node-row .fa-folder, .drive-node-row .fa-folder-open { color: #f4b400; }
/* Long names wrap at word boundaries, up to two lines; the full name is in title. */
.drive-node-name {
    min-width: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow-wrap: break-word;
}
.drive-children { padding-left: 16px; }
.drive-selected-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0;
    font-size: 13px;
}
.drive-selected-label { color: var(--text-secondary); flex-shrink: 0; }
.drive-selected { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.toast a.toast-link { color: inherit; text-decoration: underline; margin-left: 8px; }

/* ─── Library folder code (shot library_folder -> Drive folder) ─── */
/* Teal, not green: green already means "final". */
.drive-btn.drive-suggested {
    background: rgba(0, 245, 212, 0.18);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    box-shadow: 0 0 0 1px rgba(0, 245, 212, 0.35), 0 0 8px rgba(0, 245, 212, 0.35);
}
.drive-btn.drive-suggested:hover { background: var(--accent-cyan); border-color: var(--accent-cyan); color: #04201c; }
.drive-btn.drive-code-missing { position: relative; }
.drive-btn.drive-code-missing::after {
    content: "";
    position: absolute;
    top: -3px;
    right: -3px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #f5a524;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6);
}
.drive-suggest-note {
    margin-top: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    background: rgba(0, 245, 212, 0.1);
    border: 1px solid rgba(0, 245, 212, 0.35);
    color: var(--accent-cyan);
    overflow-wrap: break-word;
}
.drive-suggest-note.missing {
    background: rgba(245, 165, 36, 0.1);
    border-color: rgba(245, 165, 36, 0.4);
    color: #f5a524;
}

/* Inline rename of a video in the tree (display_title) */
.tree-rename-input {
    flex: 1;
    min-width: 0;
    font: inherit;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--accent-purple);
    background: rgba(10, 10, 12, 0.8);
    color: var(--text-primary);
    outline: none;
}

/* ─── "Not needed" shots (shot.skipped) ─── */
.shot-status-dot.skipped { background: #ef4444; box-shadow: none; animation: none; }
.tree-item-shot.is-skipped .tree-title { opacity: 0.5; }
.shot-skip-toggle.is-on { color: #ef4444; }
.shot-skip-btn { align-items: center; gap: 6px; }
.shot-skip-btn.is-on { border-color: #ef4444; color: #fca5a5; background: rgba(239, 68, 68, 0.12); }

/* A shot's stored model is switched off in the studio (ALLOWED_* in app.py). */
.model-disabled-note {
    font-size: 10px;
    color: #f59e0b;
    margin-top: 4px;
    line-height: 1.35;
}

/* ─── Credit budget badge in the video header (levels from /api/budget) ─── */
.budget-badge {
    margin-left: 8px;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid transparent;
    flex-shrink: 0;
}
.budget-badge:hover { filter: brightness(1.15); }
.budget-green  { color: #4ade80; background: rgba(34, 197, 94, 0.14);  border-color: rgba(34, 197, 94, 0.45); }
.budget-yellow { color: #facc15; background: rgba(234, 179, 8, 0.14);  border-color: rgba(234, 179, 8, 0.5); }
.budget-orange { color: #fb923c; background: rgba(249, 115, 22, 0.16); border-color: rgba(249, 115, 22, 0.55); }
.budget-red    { color: #f87171; background: rgba(239, 68, 68, 0.16);  border-color: rgba(239, 68, 68, 0.6); }
.budget-over   { color: #fff;    background: rgba(220, 38, 38, 0.75);  border-color: #ef4444; }
.budget-none   { color: var(--text-muted); background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.15); font-weight: 500; }
.budget-row    { display: flex; padding: 0 0 4px 26px; }
.budget-row .budget-badge { margin-left: 0; }
.budget-input  { width: 90px; flex: 0 0 auto; margin-left: 0; }

/* ─── Narrow "add" strips in the galleries (Upload Local / + з бібліотеки) ─── */
.gen-add-strip {
    flex: 0 0 44px;
    width: 44px;
    align-self: stretch;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 10px;
    border: 1px dashed var(--border-color, rgba(255,255,255,0.2));
    background: var(--bg-lighter, rgba(255,255,255,0.04));
    color: var(--text-dim, #aaa);
    cursor: pointer;
    transition: var(--transition-smooth);
    user-select: none;
}
.gen-add-strip:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); }
.gen-add-strip-label {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.gen-add-strip.is-disabled { opacity: 0.4; cursor: not-allowed; }
.gen-add-strip.is-disabled:hover { border-color: var(--border-color, rgba(255,255,255,0.2)); color: var(--text-dim, #aaa); }

/* A video generation that is a ready clip from the Drive library */
.gen-infl-tag {
    padding: 0 4px; border-radius: 3px; background: rgba(255,255,255,0.22); font-weight: 700;
}
.gen-library-badge {
    position: absolute;
    left: 6px;
    top: 6px;
    padding: 2px 6px;
    border-radius: 5px;
    background: rgba(66, 133, 244, 0.92);
    color: #fff;
    font-size: 9px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 2;
}

/* ─── Pick a clip from the library ─── */
.drive-pick-content { width: min(920px, 96vw); max-width: 96vw; }
.drive-pick-body { max-height: 70vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.drive-pick-nav { display: flex; align-items: center; gap: 8px; }
.drive-pick-path { font-size: 12px; color: var(--text-muted); overflow-wrap: anywhere; }
.drive-pick-crumb { background: none; border: none; padding: 0; color: var(--accent-cyan); cursor: pointer; font: inherit; }
.drive-pick-crumb:hover { text-decoration: underline; }
.drive-pick-tabs {
    display: inline-flex; align-self: flex-start; margin-bottom: 8px;
    border: 1px solid var(--border-glass); border-radius: 6px; overflow: hidden;
}
.drive-pick-tab {
    background: rgba(255,255,255,0.05); border: none; color: var(--text-muted);
    padding: 5px 14px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.drive-pick-tab + .drive-pick-tab { border-left: 1px solid var(--border-glass); }
.drive-pick-tab:hover { color: inherit; }
.drive-pick-tab[aria-selected="true"] { background: rgba(0, 245, 212, 0.15); color: var(--accent-cyan); }
.drive-pick-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.drive-pick-chip {
    background: rgba(255,255,255,0.05); border: 1px solid var(--border-glass); color: var(--text-muted);
    border-radius: 999px; padding: 2px 10px; font-size: 11px; cursor: pointer; font-family: inherit;
}
.drive-pick-chip:hover { color: inherit; }
.drive-pick-chip[aria-pressed="true"] { border-color: var(--accent-cyan); color: var(--accent-cyan); background: rgba(0, 245, 212, 0.12); }
.drive-pick-section-title {
    grid-column: 1 / -1; font-size: 12px; font-weight: 600; margin-top: 6px;
    text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted);
}
.drive-pick-section-head { grid-column: 1 / -1; font-size: 12px; color: var(--text-muted); overflow-wrap: anywhere; }
.drive-pick-section-error { color: #f87171; }
.drive-pick-sort {
    margin-left: auto; flex-shrink: 0; display: inline-flex;
    border: 1px solid var(--border-glass); border-radius: 6px; overflow: hidden;
}
.drive-pick-sort-btn {
    background: rgba(255,255,255,0.05); border: none; color: var(--text-muted);
    padding: 4px 10px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.drive-pick-sort-btn + .drive-pick-sort-btn { border-left: 1px solid var(--border-glass); }
.drive-pick-sort-btn:hover { color: inherit; }
.drive-pick-sort-btn[aria-pressed="true"] { background: rgba(0, 245, 212, 0.15); color: var(--accent-cyan); }
.drive-pick-folders { display: flex; flex-wrap: wrap; gap: 6px; }
.drive-pick-folder {
    background: rgba(255,255,255,0.05); border: 1px solid var(--border-glass); color: inherit;
    border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer;
}
.drive-pick-folder:hover { border-color: var(--accent-cyan); }
.drive-pick-folder i { color: #f5a524; }
.drive-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.drive-pick-card {
    border: 1px solid var(--border-glass); border-radius: 8px; overflow: hidden; cursor: pointer;
    background: var(--bg-card); transition: var(--transition-smooth);
}
.drive-pick-card:hover { border-color: var(--accent-cyan); }
.drive-pick-card.is-in-shot { opacity: 0.55; cursor: default; }
.drive-pick-card.is-in-shot:hover { border-color: var(--border-glass); }
.drive-pick-card.is-importing { pointer-events: none; }
.drive-pick-thumb {
    position: relative; aspect-ratio: 9 / 16; max-height: 220px; width: 100%;
    background: #0d0d10; display: flex; align-items: center; justify-content: center; color: var(--text-muted);
    font-size: 26px;
}
.drive-pick-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.drive-pick-badges { position: absolute; top: 5px; left: 5px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.drive-pick-badge { font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 4px; }
.drive-pick-badge.warn { background: rgba(245, 165, 36, 0.92); color: #1a1205; }
.drive-pick-badge.done { background: rgba(34, 197, 94, 0.92); color: #04210f; }
.drive-pick-spinner {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 6px;
    background: rgba(0,0,0,0.6); color: #fff; font-size: 12px;
}
.drive-pick-name { font-size: 11px; padding: 6px 8px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drive-pick-meta { font-size: 10px; padding: 2px 8px 8px; color: var(--text-muted); }
.drive-pick-empty { grid-column: 1 / -1; padding: 20px; text-align: center; color: var(--text-muted); font-size: 13px; }
.drive-pick-empty.is-error { color: #f87171; }

/* ─── Library clip: «Додати» on a grid card, and the in-window preview ─── */
.drive-pick-add { margin: 0 8px 8px; width: calc(100% - 16px); font-size: 11px; padding: 3px 6px; }
.drive-pick-preview { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.drive-preview-stage { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; }
.drive-preview-host {
    position: relative;
    display: flex; align-items: center; justify-content: center;
    min-width: 200px; min-height: 200px;   /* a 9:16 frame area until the clip's size is known */
}
.drive-preview-wrap { border-radius: 8px; overflow: hidden; background: #000; }
.drive-preview-video { display: block; max-height: 58vh; max-width: min(60vw, 520px); border-radius: 8px; }
.drive-preview-nav {
    flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%;
    background: rgba(20, 20, 25, 0.85); border: 1px solid var(--border-glass); color: #fff; cursor: pointer;
}
.drive-preview-nav:disabled { opacity: 0.3; cursor: default; }
.drive-preview-info { text-align: center; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.drive-preview-name { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.drive-preview-meta, .drive-preview-pos { font-size: 11px; color: var(--text-muted); }
.drive-pick-badges-inline { display: flex; gap: 6px; }
.drive-preview-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
